@viur/shop-components 0.0.1-dev.40 → 0.0.1-dev.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +1 -1
- package/dist/viur-shop-components.es.js +1275 -1300
- package/dist/viur-shop-components.umd.js +9 -9
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(Ve,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("vue"),require("@viur/vue-utils"),require("pinia"),require("@viur/viur-shop-client"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","@viur/vue-utils","pinia","@viur/viur-shop-client","vue-router"],h):(Ve=typeof globalThis<"u"?globalThis:Ve||self,h(Ve.ViurShopComponents={},Ve.Vue,Ve.ViurVueUtils,Ve.Pinia,Ve.ViurShopClient))})(this,function(Ve,h,Cn,or,Yf){"use strict";var KD=Object.defineProperty;var GD=(Ve,h,Cn)=>h in Ve?KD(Ve,h,{enumerable:!0,configurable:!0,writable:!0,value:Cn}):Ve[h]=Cn;var Jf=(Ve,h,Cn)=>GD(Ve,typeof h!="symbol"?h+"":h,Cn);const de=(m,x)=>{const C=m.__vccOpts||m;for(const[N,D]of x)C[N]=D;return C},ir={props:{size:{type:String,default:"2"},active:{type:Boolean,default:!0},logo:{default:"logo-cube.svg",type:String},color:{default:"var(--sl-color-primary-500)",type:String}},setup(m,x){const C=h.reactive({trackWidth:h.computed(()=>`${m.size/30}rem`),outerSize:h.computed(()=>`calc(${m.size}rem + ${C.trackWidth})`),spinnerSize:h.computed(()=>`${m.size}rem`),logoSize:h.computed(()=>`calc(${m.size}rem - ${C.trackWidth} * 10)`),shadow:h.computed(()=>`0px 0px ${m.size/6}rem 0 color-mix(in hsl, var(--sl-color-neutral-1000), 80% transparent)`)});return{state:C}}},Ha=()=>{h.useCssVars(m=>({"93747d92":m.state.outerSize,"284424e5":m.state.shadow,"6485ca5e":m.state.logoSize,"5d833915":m.state.spinnerSize,d5b3feca:m.color,"2050b700":m.state.trackWidth}))},qa=ir.setup;ir.setup=qa?(m,x)=>(Ha(),qa(m,x)):Ha;const Qf=m=>(h.pushScopeId("data-v-46c45785"),m=m(),h.popScopeId(),m),Xf={key:0,class:"loading"},ek=Qf(()=>h.createElementVNode("sl-spinner",{class:"loader"},null,-1)),tk={class:"logo"},nk=["src"];function ok(m,x,C,N,D,M){return h.openBlock(),h.createBlock(h.Transition,null,{default:h.withCtx(()=>[C.active?(h.openBlock(),h.createElementBlock("div",Xf,[ek,h.createElementVNode("div",tk,[h.createElementVNode("sl-icon",{src:C.logo},null,8,nk)])])):h.createCommentVNode("",!0)]),_:1})}const ik=de(ir,[["render",ok],["__scopeId","data-v-46c45785"]]),vn=or.defineStore("cartstore",()=>{const m=new Yf.ViURShopClient({host_url:window.location.origin==="http://localhost:8081"?"http://localhost:8080":window.location.origin}),x=h.reactive({basketRootNode:{},whishlistRootNodes:[],children:{},structure:{address:{},cart:{}}});async function C(){await D()}async function N(B){return await m.cart_list({cart_key:B})}async function D(){(await m.cart_list()).forEach(v=>{v.is_root_node&&(v.cart_type==="basket"?x.basketRootNode=v:x.whishlistRootNodes.push(v))})}async function M(B,v){let k=await m.article_add({article_key:B,parent_cart_key:v});console.log("addToCart",k)}async function w(B,v){let k=await m.article_view({article_key:B,parent_cart_key:v});console.log("getArticleView",k)}async function S(B,v){let k=await m.article_remove({article_key:B,parent_cart_key:v});console.log("remove Resp",k)}async function p(B,v,k){let _=await m.article_update({article_key:B,parent_cart_key:v,quantity:k,quantity_mode:"replace"});console.log("update Resp",_)}async function y(){let B=await m.address_structure();x.structure.address=B.addSkel,console.log("adress add",x.structure.address)}return{state:x,addToCart:M,getArticleView:w,removeItem:S,updateItem:p,init:C,getAdressStructure:y,getChildren:N}}),rk={__name:"CartNode",props:{node:{type:Object,required:!0}},setup(m){return h.reactive({}),(x,C)=>(h.openBlock(),h.createElementBlock(h.Fragment,null,[h.createTextVNode(" cartnode "),h.createElementVNode("pre",null,h.toDisplayString(m.node.name),1)],64))}},io=m=>(h.pushScopeId("data-v-0e24135f"),m=m(),h.popScopeId(),m),sk={horizontal:"",class:"viur-shop-cart-card"},ak=["src"],lk={class:"viur-shop-cart-card-header",slot:"header"},ck={class:"viur-shop-cart-card-headline headline"},dk={class:"viur-shop-cart-card-body-row"},hk={class:"viur-shop-cart-card-body-info"},uk=io(()=>h.createElementVNode("div",{class:"viur-shop-cart-card-descr"},[h.createTextVNode(" Version: 900x900x2000 "),h.createElementVNode("br"),h.createTextVNode(" Farbe: Chromoptik "),h.createElementVNode("br"),h.createTextVNode(" Glasart: Klar hell mit Edelglasbeschichtung"),h.createElementVNode("br"),h.createTextVNode(" Anschlag: Beidseitig variabel"),h.createElementVNode("br"),h.createTextVNode(" Griff: Stangengriff Exklusiv (56) ")],-1)),mk={class:"viur-shop-cart-card-body-footer"},gk=io(()=>h.createElementVNode("sl-button",{size:"small",outline:"",class:"viur-shop-cart-card-add-to-favourites-btn",variant:"primary",title:"Add to favourites"},[h.createElementVNode("sl-icon",{name:"heart",slot:"prefix"})],-1)),pk=[io(()=>h.createElementVNode("sl-icon",{name:"trash",slot:"prefix"},null,-1))],fk={class:"viur-shop-cart-card-body-amount"},kk={class:"viur-shop-cart-card-price-wrap",slot:"footer"},bk=io(()=>h.createElementVNode("div",{class:"viur-shop-cart-card-price-label"},"Preis",-1)),wk={class:"viur-shop-cart-card-price"},Ak=io(()=>h.createElementVNode("div",{class:"viur-shop-cart-card-small-print"},"Brutto / Stk.",-1)),_k=de({__name:"CartLeaf",props:{leaf:{type:Object,required:!0},node:{type:Object,required:!0}},emits:["updateItem","removeItem"],setup(m,{emit:x}){const C=m,N=x,D=h.reactive({leaf:{}});function M(p){return p!==void 0?Cn.Request.downloadUrlFor(p):"https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80"}function w(p,y,B,v){N("updateItem",{item:p,articleKey:y,node:B,quantity:v})}function S(p,y,B){N("removeItem",{item:p,articleKey:y,node:B})}return h.onBeforeMount(()=>{D.leaf=C.leaf}),(p,y)=>(h.openBlock(),h.createElementBlock(h.Fragment,null,[h.createTextVNode(" cartleafe "),h.createElementVNode("sl-card",sk,[h.createElementVNode("img",{class:"viur-shop-cart-card-img",slot:"image",src:M(D.leaf.shop_image?D.leaf.shop_image:void 0)},null,8,ak),h.createElementVNode("div",lk,[h.createElementVNode("h4",ck,h.toDisplayString(D.leaf.shop_name)+" | "+h.toDisplayString(m.leaf.shop_art_no_or_gtin),1)]),h.createElementVNode("div",dk,[h.createElementVNode("div",hk,[uk,h.createElementVNode("div",mk,[gk,h.createElementVNode("sl-button",{size:"small",outline:"",class:"viur-shop-cart-card-delete-btn",variant:"primary",title:"Remove from cart",onClick:y[0]||(y[0]=B=>S(D.leaf,D.leaf.article.dest.key,m.node))},pk)])]),h.createElementVNode("div",fk,[h.withDirectives(h.createElementVNode("sl-input",{class:"amount-input",type:"number",label:"Anzahl",placeholder:"Number",min:"0","onUpdate:modelValue":y[1]||(y[1]=B=>D.leaf.quantity=B),onInput:y[2]||(y[2]=B=>w(D.leaf,D.leaf.article.dest.key,m.node,D.leaf.quantity))},null,544),[[h.vModelText,D.leaf.quantity]])]),h.createElementVNode("div",kk,[bk,h.createElementVNode("div",wk,h.toDisplayString(D.leaf.price.retail)+" € ",1),Ak])])])],64))}},[["__scopeId","data-v-0e24135f"]]),gt=m=>(h.pushScopeId("data-v-7aae4815"),m=m(),h.popScopeId(),m),Ck={key:0},vk=gt(()=>h.createElementVNode("p",null,"Möchten Sie den Artikel wirklich aus dem Warenkorb entfernen?",-1)),yk={class:"footer-wrap",slot:"footer"},Ek={key:0},xk=gt(()=>h.createElementVNode("h2",{class:"viur-shop-cart-sidebar-headline headline"},"Zusammenfassung",-1)),Sk=gt(()=>h.createElementVNode("br",null,null,-1)),Dk=gt(()=>h.createElementVNode("sl-input",{label:"Rabattcode eingeben"},null,-1)),Bk=gt(()=>h.createElementVNode("br",null,null,-1)),Tk={class:"viur-shop-cart-sidebar-info-line"},Ik=gt(()=>h.createElementVNode("span",null,"Zwischensumme",-1)),Pk=gt(()=>h.createElementVNode("div",{class:"viur-shop-cart-sidebar-info-line"},[h.createElementVNode("span",null,"Rabatt"),h.createTextVNode(" 0 € ")],-1)),Rk=gt(()=>h.createElementVNode("div",{class:"viur-shop-cart-sidebar-info-line"},[h.createElementVNode("span",null,"Versandkosten"),h.createTextVNode(" 0 € ")],-1)),Ok={class:"viur-shop-cart-sidebar-info-line total"},Nk=gt(()=>h.createElementVNode("span",null,"Gesamt:",-1)),zk=gt(()=>h.createElementVNode("div",{class:"viur-shop-cart-sidebar-btn-wrap"},[h.createElementVNode("sl-button",{variant:"info",size:"small"}," Jetzt Bestellen "),h.createElementVNode("sl-button",{size:"small",variant:"primary"},[h.createElementVNode("sl-icon",{name:"paypal",slot:"prefix"}),h.createTextVNode(" Paypal ")])],-1)),rr=de({__name:"CartView",props:{mode:{type:String,default:"basket"},cartKey:{type:String,required:!0},sidebar:{type:Boolean,default:!0}},setup(m){const x=m,C=vn(),N=h.ref(null),D=h.reactive({cartIsInit:h.computed(()=>!!C.state.basketRootNode),itemsIsInit:h.computed(()=>!0),images:{},currentItem:{},currentNode:{},nodes:[],leaves:{}});h.computed(()=>x.mode==="basket"?C.state.basket:x.cartKey);async function M(){await C.updateItem(D.currentItem.article.dest.key,D.currentNode.key,0),await y(),N.value.hide()}async function w(v){console.log("updateItem :",v),v.quantity===0?(N.value.show(),D.currentItem=v.item,D.currentNode=v.node):(await C.updateItem(v.articleKey,v.node.key,v.quantity),await C.init())}function S(v){console.log("removeItem :",v),N.value.show(),D.currentItem=v.item,D.currentNode=v.node}async function p(){D.leaves[D.currentNode.key].forEach(v=>{v.key===D.currentItem.key&&(v.quantity=1)}),D.currentItem={},D.currentNode={}}async function y(){D.nodes=[],D.leaves={},await C.init(),await B()}async function B(v=x.cartKey){console.log("debug getChildren parentKey from comp: ",v);const k=await C.getChildren(v);console.log("getChildren children: ",k),k.forEach(async _=>{_.skel_type==="node"?(D.nodes.push(_),await B(_.key)):(Object.keys(D.leaves).includes(v)||(D.leaves[v]=[]),D.leaves[v].push(_))})}return h.onBeforeMount(async()=>{await C.init(),await B(),x.mode==="basket"&&D.nodes.push(C.state.basketRootNode),console.log("state.nodes test",D.nodes),console.log("state.leaves",D.leaves)}),(v,k)=>m.cartKey.length?(h.openBlock(),h.createElementBlock(h.Fragment,{key:1},[h.createElementVNode("sl-dialog",{ref_key:"confirm",ref:N,onSlHide:p},[vk,h.createElementVNode("div",yk,[h.createElementVNode("sl-button",{variant:"danger",onClick:k[0]||(k[0]=_=>N.value.hide()),size:"medium"}," Abbrechen "),h.createElementVNode("sl-button",{variant:"success",onClick:M,size:"medium"}," Aus Warenkorb entfernen ")])],544),(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(D.nodes,_=>(h.openBlock(),h.createElementBlock("div",null,[Object.keys(D.leaves).includes(_.key)?(h.openBlock(),h.createElementBlock(h.Fragment,{key:0},[h.createVNode(rk,{node:_},null,8,["node"]),(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(D.leaves[_.key],R=>(h.openBlock(),h.createBlock(_k,{key:R.key,leaf:R,node:_,onRemoveItem:S,onUpdateItem:w},null,8,["leaf","node"]))),128))],64)):h.createCommentVNode("",!0)]))),256)),m.sidebar?(h.openBlock(),h.createElementBlock("div",Ek,[xk,Sk,Dk,Bk,h.createElementVNode("div",Tk,[Ik,h.createTextVNode(" --> "+h.toDisplayString(m.mode==="basket"?h.unref(C).state.basketRootNode.total:h.unref(C).state.whishlistRootNodes[m.cartKey].total)+" € ",1)]),Pk,Rk,h.createElementVNode("div",Ok,[Nk,h.createTextVNode(" "+h.toDisplayString(m.mode==="basket"?h.unref(C).state.basketRootNode.total:h.unref(C).state.whishlistRootNodes[m.cartKey].total)+" € ",1)]),zk])):h.createCommentVNode("",!0)],64)):(h.openBlock(),h.createElementBlock("sl-spinner",Ck))}},[["__scopeId","data-v-7aae4815"]]),rt=m=>(h.pushScopeId("data-v-b0504ee0"),m=m(),h.popScopeId(),m),Mk={key:1,class:"list"},Fk=rt(()=>h.createElementVNode("h2",{class:"viur-shop-cart-headline headline"},"Bestellung prüfen",-1)),Vk=rt(()=>h.createElementVNode("br",null,null,-1)),Lk=rt(()=>h.createElementVNode("div",{class:"viur-shop-cart-address-wrap"},[h.createElementVNode("div",{class:"viur-shop-cart-address"},[h.createElementVNode("div",{class:"viur-shop-cart-address-headline"},[h.createTextVNode(" Versandadresse "),h.createElementVNode("sl-button",{outline:"",size:"small"},[h.createElementVNode("sl-icon",{name:"pencil",slot:"prefix"})])]),h.createTextVNode(" Roland Brose"),h.createElementVNode("br"),h.createTextVNode(" Speicherstraße 33"),h.createElementVNode("br"),h.createTextVNode(" 44147 Dortmund, DE"),h.createElementVNode("br"),h.createElementVNode("br"),h.createTextVNode(" rb@mausbrand.de"),h.createElementVNode("br"),h.createTextVNode(" 0231 21 34 68 90 ")]),h.createElementVNode("div",{class:"viur-shop-cart-address"},[h.createElementVNode("div",{class:"viur-shop-cart-address-headline"},[h.createTextVNode(" Rechnungsadresse "),h.createElementVNode("sl-button",{outline:"",size:"small"},[h.createElementVNode("sl-icon",{name:"pencil",slot:"prefix"})])]),h.createTextVNode(" Roland Brose"),h.createElementVNode("br"),h.createTextVNode(" Speicherstraße 33"),h.createElementVNode("br"),h.createTextVNode(" 44147 Dortmund, DE"),h.createElementVNode("br"),h.createElementVNode("br"),h.createTextVNode(" rb@mausbrand.de"),h.createElementVNode("br"),h.createTextVNode(" 0231 21 34 68 90 ")])],-1)),jk=rt(()=>h.createElementVNode("div",{class:"viur-shop-cart-payment"},[h.createElementVNode("div",{class:"viur-shop-cart-payment-method"},[h.createElementVNode("span",null,"Zahlungsmethode:"),h.createTextVNode(" Paypal ")]),h.createElementVNode("sl-button",{outline:"",size:"small"},[h.createElementVNode("sl-icon",{name:"pencil",slot:"prefix"})])],-1)),$k=rt(()=>h.createElementVNode("h2",{class:"viur-shop-cart-headline headline"},"Warenkorb",-1)),Hk=rt(()=>h.createElementVNode("br",null,null,-1)),qk=rt(()=>h.createElementVNode("h2",{class:"viur-shop-cart-sidebar-headline headline"},"Jetzt Bestellen",-1)),Uk=rt(()=>h.createElementVNode("br",null,null,-1)),Wk={class:"viur-shop-cart-sidebar-info-line"},Kk=rt(()=>h.createElementVNode("span",null,"Zwischensumme",-1)),Gk=rt(()=>h.createElementVNode("div",{class:"viur-shop-cart-sidebar-info-line"},[h.createElementVNode("span",null,"Rabatt"),h.createTextVNode(" 0 € ")],-1)),Zk=rt(()=>h.createElementVNode("div",{class:"viur-shop-cart-sidebar-info-line"},[h.createElementVNode("span",null,"Versandkosten"),h.createTextVNode(" 0 € ")],-1)),Jk={class:"viur-shop-cart-sidebar-info-line total"},Yk=rt(()=>h.createElementVNode("span",null,"Gesamt:",-1)),Qk={class:"viur-shop-cart-sidebar-btn-wrap"},Xk=["variant","disabled"],sr=de({__name:"ConfirmView",setup(m){const x=vn(),C=h.reactive({cartIsInit:h.computed(()=>{var D;return!!((D=x.state)!=null&&D.basket.length)}),itemsIsInit:h.computed(()=>{var D;return!!((D=x.state)!=null&&D.carts[x.state.basket].items)}),images:{},showOrderButton:!1});function N(D){D.target.checked&&(C.showOrderButton=!0),D.target.checked||(C.showOrderButton=!1)}return h.onBeforeMount(async()=>{await x.init()}),(D,M)=>{var w,S;return C.cartIsInit?(h.openBlock(),h.createElementBlock("div",Mk,[Fk,Vk,Lk,jk,$k,Hk,(h.openBlock(),h.createBlock(h.Teleport,{to:"#order_sidebar"},[qk,Uk,h.createElementVNode("div",Wk,[Kk,h.createTextVNode(" "+h.toDisplayString((w=h.unref(x).state)!=null&&w.basket?h.unref(x).state.carts[h.unref(x).state.basket].info.total:"00,00")+" € ",1)]),Gk,Zk,h.createElementVNode("div",Jk,[Yk,h.createTextVNode(" "+h.toDisplayString((S=h.unref(x).state)!=null&&S.basket?h.unref(x).state.carts[h.unref(x).state.basket].info.total:"00")+" € ",1)]),h.createElementVNode("sl-checkbox",{onSlChange:N}," Ich akzeptiere die geltenden AGBs und Datenschutzbestimmungen ",32),h.createElementVNode("div",Qk,[h.createElementVNode("sl-button",{variant:C.showOrderButton?"info":"disabled",size:"small",disabled:!C.showOrderButton}," Zahlungspflichtig bestellen ",8,Xk)])]))])):(h.openBlock(),h.createBlock(ik,{key:0}))}}},[["__scopeId","data-v-b0504ee0"]]),eb=m=>(h.pushScopeId("data-v-61488015"),m=m(),h.popScopeId(),m),tb={class:"bind viur-shop-wrap"},nb=["panel","disabled"],ob={class:"viur-shop-order-step"},ib=["name","library"],rb={class:"viur-shop-order-status-text"},sb={key:0,name:"chevron-right",class:"viur-shop-order-tab-check"},ab=["name"],lb=["onClick"],cb=["onClick"],db=eb(()=>h.createElementVNode("div",{class:"viur-shop-sidebar",id:"order_sidebar"},null,-1)),hb=de({__name:"OrderView",props:{tabs:{type:Object,required:!0}},emits:["tabChange"],setup(m,{emit:x}){const C=m,N=x,D=h.reactive({tabNames:h.computed(()=>w(C.tabs)),isFirstTab:B=>B===0}),M=h.ref(null);function w(B){let v=[],k=[];for(const _ in B)B[_].position?v.push([_,B[_].position]):v.push([_,0]);return v.sort((_,R)=>_[1]-R[1]),v.forEach(_=>{k.push(_[0])}),k}function S(B){N("tabChange",B)}function p(B){M.value.show(B)}function y(B){M.value.show(B)}return(B,v)=>(h.openBlock(),h.createElementBlock("div",tb,[h.createElementVNode("sl-tab-group",{class:"viur-shop-order-tab",noScrollControls:"",onSlTabShow:S,ref_key:"tabGroup",ref:M},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(D.tabNames,(k,_)=>(h.openBlock(),h.createElementBlock("sl-tab",{slot:"nav",panel:k,key:k,disabled:m.tabs[k].disabled},[h.createElementVNode("div",ob,[h.createElementVNode("sl-icon",{name:m.tabs[k].icon.name,library:m.tabs[k].icon.library},null,8,ib),h.createElementVNode("div",rb,h.toDisplayString(_+1)+". "+h.toDisplayString(m.tabs[k].displayName),1)]),_<D.tabNames.length-1?(h.openBlock(),h.createElementBlock("sl-icon",sb)):h.createCommentVNode("",!0)],8,nb))),128)),(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(D.tabNames,(k,_)=>(h.openBlock(),h.createElementBlock("sl-tab-panel",{name:k,key:k},[(h.openBlock(),h.createBlock(h.resolveDynamicComponent(m.tabs[k].component),h.mergeProps({ref_for:!0},m.tabs[k].props?m.tabs[k].props:""),null,16)),_!==D.tabNames.length-1?(h.openBlock(),h.createElementBlock("div",{key:0,class:h.normalizeClass(["viur-shop-form-footer",{"flex-end":D.isFirstTab(_)}])},[h.withDirectives(h.createElementVNode("sl-button",{type:"submit",onClick:R=>p(D.tabNames[_-1])}," Zurück ",8,lb),[[h.vShow,_!==0]]),h.createElementVNode("sl-button",{type:"submit",variant:"primary",onClick:R=>y(D.tabNames[_+1])}," Weiter ",8,cb)],2)):h.createCommentVNode("",!0)],8,ab))),128))],544),db]))}},[["__scopeId","data-v-61488015"]]),ub={},jo=m=>(h.pushScopeId("data-v-36ccc280"),m=m(),h.popScopeId(),m),mb={class:"bind"},gb=[jo(()=>h.createElementVNode("h1",{class:"headline"},"Vielen Dank für Ihre Bestellung",-1)),jo(()=>h.createElementVNode("br",null,null,-1)),jo(()=>h.createElementVNode("p",{class:"paragraph"},[h.createElementVNode("strong",null,"Ihre Bestellnummer:"),h.createTextVNode(" 123345670 ")],-1)),jo(()=>h.createElementVNode("p",{class:"paragraph"},[h.createTextVNode(" Wir haben Ihre Bestellung erhalten und werden diese schenllstmöglich bearbeiten."),h.createElementVNode("br"),h.createTextVNode(" Sie erhalten in wenigen Minuten eine Bestätigung per E-Mail. "),h.createElementVNode("div",{class:"btn-wrap"},[h.createElementVNode("sl-button",{size:"medium"}," Zur Startseite "),h.createElementVNode("sl-button",{variant:"primary",size:"medium"}," Weiter Einkaufen ")])],-1))];function pb(m,x){return h.openBlock(),h.createElementBlock("div",mb,gb)}const fb=de(ub,[["render",pb],["__scopeId","data-v-36ccc280"]]),kb=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({});function D(M){x.emit("change",m.name,M.target.value,m.lang,m.index)}return h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:D}}}),bb=["disabled","value"],wb=["disabled","value"];function Ab(m,x,C,N,D,M){var w,S;return m.boneState.bonestructure.type==="raw.json"?(h.openBlock(),h.createElementBlock("sl-textarea",{key:0,disabled:(w=m.boneState)==null?void 0:w.readonly,value:JSON.stringify(m.value),onInput:x[0]||(x[0]=(...p)=>m.changeEvent&&m.changeEvent(...p))},null,40,bb)):(h.openBlock(),h.createElementBlock("sl-textarea",{key:1,disabled:(S=m.boneState)==null?void 0:S.readonly,value:m.value,onInput:x[1]||(x[1]=(...p)=>m.changeEvent&&m.changeEvent(...p))},null,40,wb))}const ar=de(kb,[["render",Ab],["__scopeId","data-v-0ebe5f0b"]]),_b=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String,readonly:Boolean,params:Object},components:{},emits:["change"],setup(m,x){const C=h.reactive({});function N(D){x.emit("change",m.name,D.target.value,m.lang,m.index)}return h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:C,changeEvent:N}}}),Cb=["value"];function vb(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("sl-input",{disabled:"",value:m.value,onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w))},null,40,Cb)}const Ua=de(_b,[["render",vb],["__scopeId","data-v-b45a1311"]]);function yb(m){return h.getCurrentScope()?(h.onScopeDispose(m),!0):!1}function Eb(m){return typeof m=="function"?m():h.unref(m)}const xb=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;function $o(m,x,C={}){const{immediate:N=!0}=C,D=h.ref(!1);let M=null;function w(){M&&(clearTimeout(M),M=null)}function S(){D.value=!1,w()}function p(...y){w(),D.value=!0,M=setTimeout(()=>{D.value=!1,M=null,m(...y)},Eb(x))}return N&&(D.value=!0,xb&&p()),yb(S),{isPending:h.readonly(D),start:p,stop:S}}class Sb{static objectEmpty(x){return Object.keys(x).length===0&&x.constructor===Object}static getDescr(x,C){try{return x.values.filter(N=>N[0]===C)[0][1]}catch{return"-"}}static unescape(x){return x||(x=""),String(x).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/(/g,"(").replace(/)/g,")").replace(/=/g,"=").replace(/'/g,"'").replace(/(/g,"(").replace(/)/g,")").replace(/=/g,"=")}static formatString(x,C){function N(w){let S=[],p=[],y=/\$\((.*?)\)/g;for(;p;){if(p=y.exec(w),!p){p=!1;continue}S.push(p[1])}return S}let D=N(x),M=[];Array.isArray(C)||(C=[C]);for(let w of C){let S=x;for(let p of D){let y=p.split("."),B=w;for(let v of y)B&&B!=="-"&&v in B&&B[v]?B=B[v]:B="-";B=this.unescape(B),S=S.replace("$("+p+")",B)}M.push(S)}return M.join(", ")}}const Db=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String,autofocus:Boolean},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value:h.computed(()=>m.value)}),D=h.ref(null);function M(w){x.emit("change",m.name,w.target.value,m.lang,m.index)}return h.watchEffect(()=>{if(m.autofocus&&D.value&&D.value!==null&&D!==null){const{start:w}=$o(()=>{D.value.focus()},600);w()}}),h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,Utils:Sb,boneState:C,changeEvent:M,stringBone:D}}}),Bb=["disabled","value","required"];function Tb(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("sl-input",{ref:"stringBone",disabled:m.boneState.readonly,value:m.Utils.unescape(m.value),required:m.boneState.bonestructure.required,onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w)),onKeyup:x[1]||(x[1]=(...w)=>m.changeEvent&&m.changeEvent(...w))},null,40,Bb)}const Wa=de(Db,[["render",Tb],["__scopeId","data-v-1ccbacc0"]]),Ib=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String,autofocus:Boolean},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({}),D=h.ref(null);function M(w){x.emit("change",m.name,w.target.value,m.lang,m.index)}return h.watchEffect(()=>{if(m.autofocus&&D.value&&D.value!==null&&D!==null){const{start:w}=$o(()=>{D.value.focus()},600);w()}}),h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:M,emailBone:D}}}),Pb=["disabled","value"];function Rb(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("sl-input",{ref:"emailBone",disabled:m.boneState.readonly,type:"email",value:m.value,onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w))},null,40,Pb)}const Ka=de(Ib,[["render",Rb],["__scopeId","data-v-4328e024"]]),Ob=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value:h.computed(()=>{var w;let M=m.value;return C.bonestructure.time?M=(w=m.value)==null?void 0:w.split("+")[0]:m.value&&(M=new Date(m.value).toISOString().substr(0,10)),M}),typeString:h.computed(()=>{let M="datetime-local";return C.bonestructure.time||(M="date"),M})});function D(M){x.emit("change",m.name,M.target.value,m.lang,m.index)}return h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:D}}}),Nb=["disabled","type","value"];function zb(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("sl-input",{disabled:m.boneState.readonly,type:m.state.typeString,value:m.state.value,onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w))},null,40,Nb)}const Ga=de(Ob,[["render",zb],["__scopeId","data-v-f1b8af8c"]]),Mb=h.defineComponent({inheritAttrs:!1,props:{name:String,value:null,index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value:h.computed(()=>{let w=m.value;return Array.isArray(m.value)?(C.bonestructure.values instanceof Array?w=w.filter(S=>C.bonestructure.values.map(p=>p[0].toString()).includes(S)):w=w.filter(S=>Object.keys(C.bonestructure.values).map(p=>p.toString()).includes(S)),w.map(S=>S.toString())):m.value?m.value.toString():""})});function D(){if(Array.isArray(C.bonestructure.values))return C.bonestructure.values;{let w=[];for(const[S,p]of Object.entries(C.bonestructure.values))w.push([S,p]);return w}}function M(w){x.emit("change",m.name,w.target.value,m.lang,m.index),W}return h.onMounted(()=>{x.emit("change",m.name,N.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:M,convertObjToList:D}}}),Fb=["disabled","value","multiple"],Vb=["value"];function Lb(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("sl-select",{disabled:m.boneState.readonly,value:m.state.value,hoist:"",multiple:m.boneState.bonestructure.multiple,"max-options-visible":"0",clearable:"",onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w))},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(m.convertObjToList(),w=>(h.openBlock(),h.createElementBlock("sl-option",{key:w[0],value:w[0]},h.toDisplayString(w[1]),9,Vb))),128))],40,Fb)}const Za=de(Mb,[["render",Lb],["__scopeId","data-v-5a38b97f"]]),jb=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value:h.computed(()=>![!1,null,void 0,""].includes(m.value))});function D(M){x.emit("change",m.name,M.target.checked,m.lang,m.index)}return h.onMounted(()=>{let M=m.value;M||(M=!1),x.emit("change",m.name,M,m.lang,m.index)}),{state:N,boneState:C,changeEvent:D}}}),$b=["disabled","checked"];function Hb(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("sl-switch",{disabled:m.boneState.readonly,checked:m.state.value,onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w))},null,40,$b)}const Ja=de(jb,[["render",Hb],["__scopeId","data-v-363598c8"]]),qb=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String,autofocus:Boolean},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value1:"",value2:null,equal:!1,passwordInfo:[],requiredPasswordInfo:[]}),D=h.ref(null);function M(S){N.value1===N.value2?N.equal=!0:N.equal=!1,w(N.value1),N.requiredPasswordInfo.length===0&&N.passwordInfo.length-N.requiredPasswordInfo.length<=C.bonestructure.test_threshold?x.emit("change",m.name,N.value1,m.lang,m.index,!0):x.emit("change",m.name,N.value1,m.lang,m.index,!1)}h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)});function w(S){N.passwordInfo=[],N.requiredPasswordInfo=[];for(const p of C.bonestructure.tests)new RegExp(p[0]).test(S)||(p[2]?N.requiredPasswordInfo.push(p[1]):N.passwordInfo.push(p[1]));N.equal||N.requiredPasswordInfo.push("Die eingegebenen Passwörter stimmen nicht überein."),N.value1||N.requiredPasswordInfo.push("Das eingegebene Passwort ist leer.")}return h.watchEffect(()=>{if(m.autofocus&&D.value&&D.value!==null&&D!==null){const{start:S}=$o(()=>{D.value.focus()},600);S()}}),h.watch(()=>m.value,(S,p)=>{N.value1=S}),{state:N,boneState:C,changeEvent:M,passwordBone:D}}}),Ub=["disabled"],Wb=["name"],Kb=["name"],Gb={class:"errors"};function Zb(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock(h.Fragment,null,[h.withDirectives(h.createElementVNode("sl-input",{ref:"passwordBone","onUpdate:modelValue":x[0]||(x[0]=w=>m.state.value1=w),disabled:m.boneState.readonly,class:h.normalizeClass({"has-check":!m.boneState.readonly}),type:"password",clearable:"","password-toggle":"true",onSlChange:x[1]||(x[1]=(...w)=>m.changeEvent&&m.changeEvent(...w)),onSlClear:x[2]||(x[2]=w=>m.state.value1=""),onKeyup:x[3]||(x[3]=(...w)=>m.changeEvent&&m.changeEvent(...w))},[h.createElementVNode("sl-icon",{slot:"suffix",name:m.state.equal&&m.state.value1.length?"check":"x"},null,8,Wb)],42,Ub),[[h.vModelText,m.state.value1]]),m.boneState.readonly?h.createCommentVNode("",!0):h.withDirectives((h.openBlock(),h.createElementBlock("sl-input",{key:0,"onUpdate:modelValue":x[4]||(x[4]=w=>m.state.value2=w),class:"password-check",type:"password",clearable:"","password-toggle":"true",onSlChange:x[5]||(x[5]=(...w)=>m.changeEvent&&m.changeEvent(...w)),onSlClear:x[6]||(x[6]=w=>m.state.value2=""),onKeyup:x[7]||(x[7]=(...w)=>m.changeEvent&&m.changeEvent(...w))},[h.createElementVNode("sl-icon",{slot:"suffix",name:m.state.equal&&m.state.value1.length?"check":"x"},null,8,Kb)],544)),[[h.vModelText,m.state.value2]]),h.createElementVNode("ul",Gb,[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(m.state.passwordInfo,(w,S)=>(h.openBlock(),h.createElementBlock("li",{key:S},h.toDisplayString(w),1))),128)),(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(m.state.requiredPasswordInfo,(w,S)=>(h.openBlock(),h.createElementBlock("li",{key:S,class:"requiredInfo"},h.toDisplayString(w),1))),128))])],64)}const Ya=de(qb,[["render",Zb],["__scopeId","data-v-0ccf18c0"]]),Jb=h.defineComponent({props:{name:String,value:null,index:Number,lang:String,readonly:Boolean,params:Object},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value:h.computed(()=>m.value),structure:h.computed(()=>w(C.bonestructure.using)),globalRegistration:!1,formGroups:h.computed(()=>{var y,B;let S={default:{name:"Allgemein",bones:[],groupVisible:!1,groupOpen:!0}};for(const[v,k]of Object.entries(N.structure)){let _="default",R=N.structure[v],T=(y=N.value)==null?void 0:y[v];(B=k==null?void 0:k.params)!=null&&B.category&&(_=k.params.category.toLowerCase()),Object.keys(S).includes(_)?S[_].bones.push({boneName:v,boneStructure:R,boneValue:T}):S[_]={name:k.params.category,bones:[{boneName:v,boneStructure:R,boneValue:T}]},R.visible===!0&&(S[_].groupVisible=!0)}let p={};return Object.keys(S).sort().forEach(function(v){p[v]=S[v]}),p})});function D(S){x.emit("change",S)}h.onMounted(()=>{h.getCurrentInstance().appContext.components.Bone?N.globalRegistration=!0:N.globalRegistration=!1,x.emit("change",m.name,m.value,m.lang,m.index)});function M(S){console.log(S)}function w(S){if(Array.isArray(S)){let p={};for(const y in S)p[S[y][0]]=S[y][1];return p}else return S}return{state:N,boneState:C,getBoneWidget:Jt,structureToDict:w,changeEvent:D,updateValue:M}}}),Yb={key:0,open:"",variant:"danger"},Qb={key:1,class:"form"},Xb=["summary","open"];function ew(m,x,C,N,D,M){const w=h.resolveComponent("bone");return m.state.globalRegistration?(h.openBlock(),h.createElementBlock("div",Qb,[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(m.state.formGroups,(S,p)=>h.withDirectives((h.openBlock(),h.createElementBlock("sl-details",{key:p,summary:S.name,open:S.groupOpen},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(S.bones,y=>h.withDirectives((h.openBlock(),h.createBlock(w,{key:y.name,is:m.getBoneWidget(m.state.structure[y.boneName].type),name:y.boneName,structure:m.state.structure,skel:m.state.value,errors:m.boneState.errors,readonly:m.boneState.bonestructure.readonly?!0:void 0,onChangeInternal:m.changeEvent},null,8,["is","name","structure","skel","errors","readonly","onChangeInternal"])),[[h.vShow,m.state.structure[y.boneName].visible]])),128))],8,Xb)),[[h.vShow,S.groupVisible]])),128))])):(h.openBlock(),h.createElementBlock("sl-alert",Yb," In Order to use this Bone register the bone component globally in your main file "))}const Qa=de(Jb,[["render",ew],["__scopeId","data-v-e6fcfbca"]]),tw=h.defineComponent({inheritAttrs:!1,props:{name:String,value:null,index:Number,lang:String},components:{Wrapper_nested:Qa},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value:{},index:h.computed(()=>m.index),lang:h.computed(()=>m.lang)});function D(M){var S;(S=N.value)!=null&&S[M.name]||(N.value?N.value[M.name]=null:N.value={[M.name]:null});let w=N.value[M.name];M.lang?(w===null&&(w={}),Object.keys(w).includes(M.lang)&&M.index!==null?w[M.lang][M.index]=M.value:w[M.lang]=M.value):M.index!==null?(w===null&&(w=[]),w[M.index]=M.value):w=M.value,N.value[M.name]=w,x.emit("change",m.name,N.value,m.lang,m.index,!0)}return h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:D}}});function nw(m,x,C,N,D,M){const w=h.resolveComponent("Wrapper_nested");return h.openBlock(),h.createBlock(w,{value:m.value,name:m.name,index:m.state.index,disabled:m.boneState.bonestructure.readonly,onChange:m.changeEvent},null,8,["value","name","index","disabled","onChange"])}const Xa=de(tw,[["render",nw],["__scopeId","data-v-84a761ce"]]),ow=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({});function D(M){x.emit("change",m.name,M.target.value,m.lang,m.index)}return h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:D}}}),iw=["disabled","value"];function rw(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("sl-color-picker",{disabled:m.boneState.readonly,value:m.value,onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w))},null,40,iw)}const el=de(ow,[["render",rw],["__scopeId","data-v-534b9149"]]),sw=h.defineComponent({inheritAttrs:!1,emits:{change:null},props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String,autofocus:Boolean},components:{},setup(m,x){const C=h.inject("boneState"),N=h.reactive({minAmount:h.computed(()=>C.bonestructure.minAmount),maxAmount:h.computed(()=>C.bonestructure.maxAmount),precision:h.computed(()=>{if(C.bonestructure.precision>1)return parseFloat(`0.${"0".repeat(C.bonestructure.precision-1)}1`)})}),D=h.ref(null);function M(w){x.emit("change",m.name,w.target.value,m.lang,m.index)}return h.watchEffect(()=>{if(m.autofocus&&D.value&&D.value!==null&&D!==null){const{start:w}=$o(()=>{D.value.focus()},600);w()}}),h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:M,numericBone:D}}}),aw=["disabled","value","min","max","step"],lw={class:"info"},cw={key:0},dw={key:1},hw={key:2};function uw(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock(h.Fragment,null,[h.createElementVNode("sl-input",{ref:"numericBone",type:"number",disabled:m.boneState.readonly,value:m.value,min:m.state.minAmount,max:m.state.maxAmount,step:m.state.precision,onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w)),onKeyup:x[1]||(x[1]=(...w)=>m.changeEvent&&m.changeEvent(...w))},null,40,aw),h.createElementVNode("ul",lw,[m.state.minAmount!==-9223372036854776e3&&m.state.minAmount?(h.openBlock(),h.createElementBlock("li",cw,h.toDisplayString(m.$t("bones.numeric.min",{val:m.state.minAmount})),1)):h.createCommentVNode("",!0),m.state.maxAmount!==9223372036854776e3&&m.state.maxAmount?(h.openBlock(),h.createElementBlock("li",dw,h.toDisplayString(m.$t("bones.numeric.max",{val:m.state.maxAmount})),1)):h.createCommentVNode("",!0),m.state.precision?(h.openBlock(),h.createElementBlock("li",hw,h.toDisplayString(m.$t("bones.numeric.precision",{val:m.boneState.bonestructure.precision})),1)):h.createCommentVNode("",!0)])],64)}const tl=de(sw,[["render",uw],["__scopeId","data-v-03d5b399"]]);var Le={VITE_API_URL:"",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};class Ho extends Error{constructor(x,C,N,D){super(N||C),arguments.length>=4&&D&&Object.assign(this,D),this.statusText=C,this.statusCode=x,this.response=D}}let lr=null;function Zt(){return lr||(lr=or.defineStore("requestStore",()=>{const m=h.reactive({sKeys:new Set});function x(){m.sKeys=new Set}return{state:m,$reset:x}})),lr()}class we{static resetState(){Zt().$reset(),Zt().$dispose()}static buildUrl(x){return x&&!(x.startsWith("http://")||x.startsWith("https://")||x.startsWith("//"))&&(x=window.location.origin+x),x}static post(x,{dataObj:C=null,callback:N=null,failedCallback:D=null,abortController:M=null,headers:w=null,mode:S=null}={}){function p(){if(C instanceof FormData)return C;const B=new FormData;for(const v in C)if(Array.isArray(C[v]))for(let k of C[v])B.append(v,k);else B.append(v,C[v]);return B}let y=ro.post(we.buildUrl(x),p(),null,w,M,S);return y.then(function(B){N&&N(B.data)}).catch(function(B){D&&D(B)}),y}static async getBatchSkeys(x=30,C=Le.VITE_DEFAULT_RENDERER||"json"){await we.get(`/${C}/skey`,{dataObj:{amount:x}}).then(async N=>{let D=await N.json();Array.isArray(D)||(D=[D]),Zt().state.sKeys=new Set(D)})}static async securePost(x,{dataObj:C=null,callback:N=null,failedCallback:D=null,abortController:M=null,renderer:w=Le.VITE_DEFAULT_RENDERER||"json",headers:S=null,mode:p=null,amount:y=30}={}){let B=null;Zt().state.sKeys.size===0&&await we.getBatchSkeys(y);const v=[...Zt().state.sKeys][0];return C instanceof FormData?(C.append("skey",v),Zt().state.sKeys.delete(v)):(C||(C={}),C.skey=v,Zt().state.sKeys.delete(v)),B=we.post(x,{dataObj:C,callback:N,abortController:M,headers:S,mode:p}),B}static get(x,{dataObj:C=null,callback:N=null,failedCallback:D=null,cached:M=!1,clearCache:w=!1,abortController:S=null,headers:p=null,mode:y=null,cacheTime:B=1e3*60*60*24*1}={}){let v=ro.get(we.buildUrl(x),C,w,p,S,y);return v.then(function(k){N&&N(k.data)}).catch(function(k){D&&D(k)}),v}static list(x,{dataObj:C=null,callback:N=null,failedCallback:D=null,group:M=null,abortController:w=null,renderer:S=(Le==null?void 0:Le.VITE_DEFAULT_RENDERER)||"json"}={}){let p=`/${S}/${x}/list`;return M&&(p+=`/${M}`),we.get(p,{dataObj:C,callback:N,failedCallback:D,abortController:w})}static getStructure(x,{dataObj:C=null,callback:N=null,failedCallback:D=null,group:M=null,abortController:w=null,renderer:S=(Le==null?void 0:Le.VITE_DEFAULT_RENDERER)||"json"}={}){x=x.replace(/\//g,".");let p=`/${S}/getStructure/${x}`;return M&&(p+=`/${M}`),we.get(p,{dataObj:C,callback:N,failedCallback:D,abortController:w})}static view(x,C,{dataObj:N=null,callback:D=null,failedCallback:M=null,group:w=null,abortController:S=null,renderer:p=(Le==null?void 0:Le.VITE_DEFAULT_RENDERER)||"json"}={}){let y=`/${p}/${x}/view/${C}`;return w&&(y=`/${p}/${x}/view/${w}/${C}`),we.get(y,{dataObj:N,callback:D,failedCallback:M,abortController:S})}static add(x,{dataObj:C=null,callback:N=null,failedCallback:D=null,group:M=null,abortController:w=null,renderer:S=(Le==null?void 0:Le.VITE_DEFAULT_RENDERER)||"json"}={}){let p=`/${S}/${x}/add`;return M&&(p=`/${S}/${x}/add/${M}`),we.securePost(p,{dataObj:C,callback:N,failedCallback:D,abortController:w})}static edit(x,C,{dataObj:N=null,callback:D=null,failedCallback:M=null,group:w=null,abortController:S=null,renderer:p=(Le==null?void 0:Le.VITE_DEFAULT_RENDERER)||"json"}={}){let y=`/${p}/${x}/edit/${C}`;return w&&(y=`/${p}/${x}/edit/${w}/${C}`),we.securePost(y,{dataObj:N,callback:D,failedCallback:M,abortController:S})}static delete(x,C,{dataObj:N=null,callback:D=null,failedCallback:M=null,group:w=null,abortController:S=null,renderer:p=(Le==null?void 0:Le.VITE_DEFAULT_RENDERER)||"json"}={}){let y=`/${p}/${x}/delete/${C}`;return w&&(y=`/${p}/${x}/delete/${w}/${C}`),we.securePost(y,{dataObj:N,callback:D,failedCallback:M,abortController:S,amount:1})}static downloadUrlFor(x,C=!1){return x&&"dest"in x?C&&"thumbnail"in x.dest?we.buildUrl(x.dest.thumbnail):"downloadUrl"in x.dest?we.buildUrl(x.dest.downloadUrl):we.buildUrl(null):we.buildUrl(x)}static uploadFile(x,C=void 0){const N={fileName:x.name,mimeType:x.type||"application/octet-stream",size:x.size.toString(),node:C};return new Promise((D,M)=>{we.securePost("/vi/file/getUploadURL",{dataObj:N}).then(async w=>{let S=await w.json();fetch(S.values.uploadUrl,{body:x,method:"POST",mode:"no-cors"}).then(async p=>{const y={key:S.values.uploadKey,skelType:"leaf"};we.securePost("/vi/file/add",{dataObj:y}).then(async B=>{let v=await B.json();v.action==="addSuccess"?D(v.values):M(v)}).catch(B=>{M(B)})}).catch(p=>{M(p)})}).catch(w=>{M(w)})})}}class ro{constructor(){Jf(this,"withCredentials",!0)}static buildOptions(x,C=null,N=null,D=null,M=null){let w={method:x};return w.credentials="include",w.headers={Accept:"application/json, text/plain, */*"},N&&(w.headers={...w.headers,...N}),C&&(w.body=C),D&&(w.signal=D.signal),M&&(w.mode=M),w}static get(x,C=null,N=null,D=null,M=null,w=null){function S(p,y){let B=new URL(p);if(y&&Object.keys(y).length>0){const v=new URLSearchParams;for(const[k,_]of Object.entries(y))if(Array.isArray(_))for(const R of _)v.append(k,R);else v.append(k,_);B.search=v.toString()}return B.toString()}return fetch(S(x,C),ro.buildOptions("GET",null,D,M,w)).then(async p=>{if(p.ok)return p;{const y=`${p.status} ${p.statusText}: ${p.headers?p.headers.get("x-error-descr"):""}`;return Promise.reject(new Ho(p.status,p.statusText,y,p))}}).catch(p=>{if(p instanceof TypeError){const B=`503 ${p.message}: ${p.headers?p.headers.get("x-error-descr"):""}`;return Promise.reject(new Ho(503,p.message,B,p))}if(p instanceof DOMException&&p.name=="AbortError"){const B=`${p.code} ${p.name}: ${p.headers?p.headers.get("x-error-descr"):""}`;return Promise.reject(new Ho(p.code,p.name,B,{url:x}))}const y=`${p.statusCode} ${p.statusText}: ${p.headers?p.headers.get("x-error-descr"):""}`;return Promise.reject(new Ho(p.statusCode,p.statusText,y,p.response))})}static post(x,C=null,N=null,D=null,M=null,w=null){return fetch(x,ro.buildOptions("POST",C,D,M,w))}}var mw={VITE_API_URL:"",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const gw=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{Wrapper_nested:Qa},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.inject("formatString"),D=h.reactive({format:h.computed(()=>C==null?void 0:C.bonestructure.format),skellistdata:null,selection:null});function M(p){let y="";return C.bonestructure.type==="relational.tree.leaf.file"?y="skelType=leaf&":C.bonestructure.type==="relational.tree.node.file"&&(y="skelType=node&"),we.get(`/${mw.VITE_DEFAULT_RENDERER||"vi"}/${C.bonestructure.module}/list?${y}limit=99`).then(async B=>{var k;const v=await B.json();D.skellistdata={};for(let _ of v.skellist)D.skellistdata[_.key]=_;return(k=v.skellist)==null?void 0:k.map(_=>({text:N(C.bonestructure.format,{dest:_}),value:_.key,data:_}))})}function w(p){D.selection={dest:D.skellistdata[p.detail.item.value]},x.emit("change",m.name,D.selection,m.lang,m.index)}function S(p){var B;D.selection||(D.selection={}),(B=D.selection.rel)!=null&&B[p.name]||(D.selection.rel?D.selection.rel[p.name]=null:D.selection.rel={[p.name]:null});let y=D.selection.rel[p.name];p.lang?(y===null&&(y={}),Object.keys(y).includes(p.lang)&&p.index!==null?y[p.lang][p.index]=p.value:y[p.lang]=p.value):p.index!==null?(y===null&&(y=[]),y[p.index]=p.value):y=p.value,Object.keys(D.selection).includes("rel")&&D.selection.rel?D.selection.rel[p.name]=y:D.selection.rel={[p.name]:y},Object.keys(D.selection).includes("dest")&&x.emit("change",m.name,D.selection,m.lang,m.index)}return h.onMounted(()=>{D.selection=m.value,x.emit("change",m.name,m.value,m.lang,m.index)}),{state:D,boneState:C,formatString:N,changeEvent:w,changeEventNested:S,getList:M}}}),pw=m=>(h.pushScopeId("data-v-61dd72e0"),m=m(),h.popScopeId(),m),fw={class:"record"},kw={class:"single-entry"},bw=["value"],ww=["disabled","source"],Aw=["title"],_w=[pw(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"x-lg"},null,-1))];function Cw(m,x,C,N,D,M){var S,p;const w=h.resolveComponent("Wrapper_nested");return h.openBlock(),h.createElementBlock("div",fw,[h.createElementVNode("div",kw,[m.state.selection?(h.openBlock(),h.createElementBlock("sl-input",{key:0,disabled:!0,value:m.value?m.formatString(m.state.format,m.state.selection):""},null,8,bw)):(h.openBlock(),h.createElementBlock("sl-combobox",{key:1,disabled:m.boneState.readonly,source:m.getList,hoist:"",onSlItemSelect:x[0]||(x[0]=(...y)=>m.changeEvent&&m.changeEvent(...y))},null,40,ww)),!m.boneState.multiple&&!m.boneState.isEmpty?(h.openBlock(),h.createElementBlock("sl-button",{key:2,variant:"danger",outline:"",title:m.$t("bone.del"),class:"delete-btn square-btn",onClick:x[1]||(x[1]=()=>{m.$emit("change",m.name,"",m.lang,m.index),m.state.selection=null})},_w,8,Aw)):h.createCommentVNode("",!0)]),(S=m.boneState)!=null&&S.bonestructure.using?(h.openBlock(),h.createBlock(w,{key:0,value:(p=m.value)==null?void 0:p.rel,name:m.name,index:m.index,disabled:m.boneState.bonestructure.readonly,onChange:m.changeEventNested},null,8,["value","name","index","disabled","onChange"])):h.createCommentVNode("",!0)])}const nl=de(gw,[["render",Cw],["__scopeId","data-v-61dd72e0"]]),vw=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String,readonly:Boolean,params:Object},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({});function D(M,w){x.emit("change",m.name,M,m.lang,m.index)}return h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:D}}}),yw={class:"box"};function Ew(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("div",yw,h.toDisplayString(m.value),1)}const xw=de(vw,[["render",Ew],["__scopeId","data-v-343aca69"]]);var ol={VITE_API_URL:"",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Sw=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.ref(),D=h.reactive({loading:!1,droparea:!1,previewopen:!1});h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)});function M(){console.log(we.downloadUrlFor(m.value)),window.open(we.downloadUrlFor(m.value))}function w(){return we.downloadUrlFor(m.value,!1)}function S(B){const v={fileName:B.name,mimeType:B.type||"application/octet-stream",size:B.size.toString()};return new Promise((k,_)=>{we.securePost(`/${ol.VITE_DEFAULT_RENDERER||"vi"}/file/getUploadURL`,{dataObj:v}).then(async R=>{let T=await R.json();fetch(T.values.uploadUrl,{body:B,method:"POST",mode:"no-cors"}).then(async O=>{const F={key:T.values.uploadKey,node:void 0,skelType:"leaf"};we.securePost(`/${ol.VITE_DEFAULT_RENDERER||"vi"}/file/add`,{dataObj:F}).then(async L=>{let $=await L.json();$.action==="addSuccess"?k($.values):_($)}).catch(L=>{_(L)})}).catch(O=>{_(O)})}).catch(R=>{_(R)})})}async function p(B){D.loading=!0;for(let v of B.target.files){let k=await S(v);N.value.value=null,x.emit("change",m.name,{dest:k,rel:null},m.lang,m.index)}D.loading=!1}async function y(B){D.loading=!0,D.droparea=!1;for(let v of B.dataTransfer.files){let k=await S(v);N.value.value=null,x.emit("change",m.name,{dest:k,rel:null},m.lang,m.index);break}D.loading=!1}return{state:D,boneState:C,downloadFile:M,createBackgroundImage:w,handleUpload:p,uploadinput:N,handleDrop:y}}}),qo=m=>(h.pushScopeId("data-v-91086308"),m=m(),h.popScopeId(),m),Dw={key:0,class:"loader"},Bw=[qo(()=>h.createElementVNode("sl-spinner",{slot:"suffix"},null,-1))],Tw={key:1,class:"droparea"},Iw=["title"],Pw=[qo(()=>h.createElementVNode("sl-icon",{name:"upload"},null,-1))],Rw=["multiple"],Ow=["title"],Nw=[qo(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"download"},null,-1))],zw={class:"box"},Mw=["src"],Fw=["label","open"],Vw=["src"],Lw={key:1,class:"preview"},jw={key:0,name:"file-earmark"},$w={key:2},Hw=["title"],qw=[qo(()=>h.createElementVNode("sl-icon",{name:"x-lg"},null,-1))];function Uw(m,x,C,N,D,M){var w,S,p,y,B,v,k,_,R,T;return h.openBlock(),h.createElementBlock("div",{class:"file-wrapper",onDragover:x[5]||(x[5]=h.withModifiers(O=>m.state.droparea=!0,["prevent"])),onDragleave:x[6]||(x[6]=O=>m.state.droparea=!1),onDrop:x[7]||(x[7]=h.withModifiers((...O)=>m.handleDrop&&m.handleDrop(...O),["prevent"]))},[m.state.loading?(h.openBlock(),h.createElementBlock("div",Dw,Bw)):h.createCommentVNode("",!0),m.state.droparea?(h.openBlock(),h.createElementBlock("div",Tw," Dateien hier hinziehen ")):h.createCommentVNode("",!0),!m.boneState.readonly&&(!m.value||m.state.loading)?(h.openBlock(),h.createElementBlock("sl-button",{key:2,title:m.$t("bone.upload"),outline:"",class:"upload-btn",onClick:x[0]||(x[0]=O=>m.uploadinput.click())},Pw,8,Iw)):h.createCommentVNode("",!0),h.createElementVNode("input",{ref:"uploadinput",hidden:"",type:"file",multiple:m.boneState.multiple,onChange:x[1]||(x[1]=(...O)=>m.handleUpload&&m.handleUpload(...O))},null,40,Rw),m.value?(h.openBlock(),h.createElementBlock("sl-button",{key:3,title:m.$t("bone.download"),onClick:x[2]||(x[2]=(...O)=>m.downloadFile&&m.downloadFile(...O))},Nw,8,Ow)):h.createCommentVNode("",!0),h.createElementVNode("div",zw,[(S=(w=m.value)==null?void 0:w.dest)!=null&&S.mimetype.includes("image")?(h.openBlock(),h.createElementBlock("div",{key:0,class:"preview has-preview",onClick:x[3]||(x[3]=O=>m.state.previewopen=!m.state.previewopen)},[h.createElementVNode("img",{class:"preview-img",src:m.createBackgroundImage(),alt:""},null,8,Mw),h.createElementVNode("sl-dialog",{label:decodeURIComponent((y=(p=m.value)==null?void 0:p.dest)==null?void 0:y.name),class:"preview-overlay",open:m.state.previewopen},[h.createElementVNode("img",{src:m.createBackgroundImage(),alt:""},null,8,Vw)],8,Fw)])):(h.openBlock(),h.createElementBlock("div",Lw,[(v=(B=m.value)==null?void 0:B.dest)!=null&&v.name?(h.openBlock(),h.createElementBlock("sl-icon",jw)):h.createCommentVNode("",!0)])),(_=(k=m.value)==null?void 0:k.dest)!=null&&_.name?(h.openBlock(),h.createElementBlock("div",$w,h.toDisplayString(decodeURIComponent((T=(R=m.value)==null?void 0:R.dest)==null?void 0:T.name)),1)):h.createCommentVNode("",!0)]),m.boneState.multiple?h.createCommentVNode("",!0):(h.openBlock(),h.createElementBlock("sl-button",{key:4,variant:"danger",outline:"",title:m.$t("bone.del"),class:"delete-btn",onClick:x[4]||(x[4]=O=>m.$emit("change",m.name,"",m.lang,m.index))},qw,8,Hw))],32)}const il=de(Sw,[["render",Uw],["__scopeId","data-v-91086308"]]);var Uo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ww(m){return m&&m.__esModule&&Object.prototype.hasOwnProperty.call(m,"default")?m.default:m}var Wo={exports:{}};Wo.exports,function(m,x){(function(C){const N=C.de=C.de||{};N.dictionary=Object.assign(N.dictionary||{},{"%0 of %1":"%0 von %1","Align cell text to the bottom":"Zellentext unten ausrichten","Align cell text to the center":"Zellentext zentriert ausrichten","Align cell text to the left":"Zellentext linksbündig ausrichten","Align cell text to the middle":"Zellentext mittig ausrichten","Align cell text to the right":"Zellentext rechtsbündig ausrichten","Align cell text to the top":"Zellentext oben ausrichten","Align center":"Zentriert","Align left":"Linksbündig","Align right":"Rechtsbündig","Align table to the left":"Tabelle links ausrichten","Align table to the right":"Tabelle rechts ausrichten",Alignment:"Ausrichtung",Aquamarine:"Aquamarinblau",Background:"Hintergrund",Black:"Schwarz","Block quote":"Blockzitat",Blue:"Blau",Bold:"Fett",Border:"Rahmen","Break text":"Bild teilt Text","Bulleted List":"Aufzählungsliste","Bulleted list styles toolbar":"Darstellung der ungeordneten Liste",Cancel:"Abbrechen","Cannot upload file:":"Die Datei kann nicht hochgeladen werden:","Caption for image: %0":"Bildunterschrift: %0","Caption for the image":"Bildunterschrift","Cell properties":"Zelleneigenschaften","Center table":"Tabelle zentrieren","Centered image":"Zentriertes Bild","Change image text alternative":"Alternativtext ändern","Choose heading":"Überschrift auswählen",Circle:"Leerer Kreis",Code:"Code",Color:"Farbe","Color picker":"Farbwähler",Column:"Spalte",Dashed:"Gestrichelt",Decimal:"Dezimalzahlen","Decimal with leading zero":"Dezimalzahlen mit vorangestellten Nullen","Decrease indent":"Einzug verkleinern","Delete column":"Spalte löschen","Delete row":"Zeile löschen","Dim grey":"Dunkelgrau",Dimensions:"Größe",Disc:"Gefüllter Kreis",Dotted:"Gepunktet",Double:"Doppelt",Downloadable:"Herunterladbar","Dropdown toolbar":"Dropdown-Liste Werkzeugleiste","Edit block":"Absatz bearbeiten","Edit link":"Link bearbeiten","Editor block content toolbar":"Editor Blockinhalt-Toolbar","Editor contextual toolbar":"Editor kontextuelle Toolbar","Editor editing area: %0":"Bearbeitungsbereich des Editors: %0","Editor toolbar":"Editor Werkzeugleiste","Enter image caption":"Bildunterschrift eingeben","Enter table caption":"Tabellenüberschrift eingeben","Full size image":"Bild in voller Größe",Green:"Grün",Grey:"Grau",Groove:"Eingeritzt","Header column":"Kopfspalte","Header row":"Kopfzeile",Heading:"Überschrift","Heading 1":"Überschrift 1","Heading 2":"Überschrift 2","Heading 3":"Überschrift 3","Heading 4":"Überschrift 4","Heading 5":"Überschrift 5","Heading 6":"Überschrift 6",Height:"Höhe",HEX:"","Horizontal text alignment toolbar":"Werkzeugleiste für die horizontale Zellentext-Ausrichtung","HTML object":"HTML-Objekt","Image resize list":"Bildgrößen-Liste","Image toolbar":"Bild Werkzeugleiste","image widget":"Bild-Steuerelement","In line":"Text in Zeile","Increase indent":"Einzug vergrößern",Insert:"Einfügen","Insert column left":"Spalte links einfügen","Insert column right":"Spalte rechts einfügen","Insert image":"Bild einfügen","Insert image via URL":"Bild von URL einfügen","Insert paragraph after block":"Absatz nach Block einfügen","Insert paragraph before block":"Absatz vor Block einfügen","Insert row above":"Zeile oben einfügen","Insert row below":"Zeile unten einfügen","Insert table":"Tabelle einfügen",Inset:"Eingelassen",Italic:"Kursiv",Justify:"Blocksatz","Justify cell text":"Zellentext als Blocksatz ausrichten","Left aligned image":"Linksbündiges Bild","Light blue":"Hellblau","Light green":"Hellgrün","Light grey":"Hellgrau",Link:"Link","Link image":"Bild verlinken","Link URL":"Link Adresse","List properties":"Listeneigenschaften","Lower-latin":"Kleingeschriebene lateinische Buchstaben","Lower–roman":"Kleingeschriebene römische Zahlen","Merge cell down":"Zelle unten verbinden","Merge cell left":"Zelle links verbinden","Merge cell right":"Zelle rechts verbinden","Merge cell up":"Zelle verbinden","Merge cells":"Zellen verbinden",Next:"Nächste",None:"Kein Rahmen","Numbered List":"Nummerierte Liste","Numbered list styles toolbar":"Darstellung der geordneten Liste","Open in a new tab":"In neuem Tab öffnen","Open link in new tab":"Link im neuen Tab öffnen",Orange:"Orange",Original:"Original",Outset:"Geprägt",Padding:"Innenabstand",Paragraph:"Absatz","Press Enter to type after or press Shift + Enter to type before the widget":"Drücken Sie die Eingabetaste, um nach dem Widget zu tippen oder Shift + Eingabetaste, um vor dem Widget zu tippen.",Previous:"vorherige",Purple:"Violett",Red:"Rot",Redo:"Wiederherstellen","Remove color":"Farbe entfernen","Remove Format":"Formatierung entfernen","Resize image":"Bildgröße ändern","Resize image to %0":"Bildgröße ändern in %0","Resize image to the original size":"Bild in Originalgröße ändern","Restore default":"Standard wiederherstellen","Reversed order":"Umgekehrte Reihenfolge","Rich Text Editor":"Rich Text Editor",Ridge:"Hervorgehoben","Right aligned image":"Rechtsbündiges Bild",Row:"Zeile",Save:"Speichern","Select all":"Alles auswählen","Select column":"Spalte auswählen","Select row":"Zeile auswählen","Show more items":"Mehr anzeigen","Side image":"Seitenbild",Solid:"Durchgezogen","Split cell horizontally":"Zelle horizontal teilen","Split cell vertically":"Zelle vertikal teilen",Square:"Quadrat","Start at":"Beginnen mit","Start index must be greater than 0.":"Der Startwert muss größer als 0 sein.",Strikethrough:"Durchgestrichen",Style:"Rahmenart",Subscript:"Tiefgestellt",Superscript:"Hochgestellt","Table alignment toolbar":"Werkzeugleiste für die Tabellen-Ausrichtung","Table cell text alignment":"Ausrichtung des Zellentextes","Table properties":"Tabelleneigenschaften","Table toolbar":"Tabelle Werkzeugleiste","Text alignment":"Textausrichtung","Text alignment toolbar":"Text-Ausrichtung Toolbar","Text alternative":"Alternativtext",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':"Die Farbe ist ungültig. Probieren Sie „#FF0000“ oder „rgb(255,0,0)“ oder „red“.",'The value is invalid. Try "10px" or "2em" or simply "2".':"Der Wert ist ungültig. Probieren Sie „10px“ oder „2em“ oder „2“.","This link has no URL":"Dieser Link hat keine Adresse","To-do List":"Aufgabenliste","Toggle caption off":"Tabellenüberschrift deaktivieren","Toggle caption on":"Tabellenüberschrift aktivieren","Toggle the circle list style":"Leeren Kreis einstellen","Toggle the decimal list style":"Dezimalzahlen einstellen","Toggle the decimal with leading zero list style":"Dezimalzahlen mit vorangestellten Nullen einstellen","Toggle the disc list style":"Gefüllten Kreis einstellen","Toggle the lower–latin list style":"Kleingeschriebene lateinische Buchstaben einstellen","Toggle the lower–roman list style":"Kleingeschriebene römische Zahlen einstellen","Toggle the square list style":"Quadrat einstellen","Toggle the upper–latin list style":"Großgeschriebene lateinische Buchstaben einstellen","Toggle the upper–roman list style":"Großgeschriebene römische Zahlen einstellen",Turquoise:"Türkis","Type or paste your content here.":"Hier Inhalt einfügen.","Type your title":"Titel eingeben",Underline:"Unterstrichen",Undo:"Rückgängig",Unlink:"Link entfernen",Update:"Aktualisieren","Update image URL":"Bild-URL aktualisieren","Upload failed":"Hochladen fehlgeschlagen","Upload in progress":"Upload läuft","Upper-latin":"Großgeschriebene lateinische Buchstaben","Upper-roman":"Großgeschriebene römische Zahlen","Vertical text alignment toolbar":"Werkzeugleiste für die vertikale Zellentext-Ausrichtung",White:"Weiß","Widget toolbar":"Widget Werkzeugleiste",Width:"Breite","Wrap text":"Text umfließt Bild",Yellow:"Gelb"}),N.getPluralForm=function(D){return D!=1}})(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),function(C,N){m.exports=N()}(self,()=>(()=>{var C={4959:(w,S,p)=>{const y=p(1103),B={};for(const k of Object.keys(y))B[y[k]]=k;const v={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};w.exports=v;for(const k of Object.keys(v)){if(!("channels"in v[k]))throw new Error("missing channels property: "+k);if(!("labels"in v[k]))throw new Error("missing channel labels property: "+k);if(v[k].labels.length!==v[k].channels)throw new Error("channel and label counts mismatch: "+k);const{channels:_,labels:R}=v[k];delete v[k].channels,delete v[k].labels,Object.defineProperty(v[k],"channels",{value:_}),Object.defineProperty(v[k],"labels",{value:R})}v.rgb.hsl=function(k){const _=k[0]/255,R=k[1]/255,T=k[2]/255,O=Math.min(_,R,T),F=Math.max(_,R,T),L=F-O;let $,K;F===O?$=0:_===F?$=(R-T)/L:R===F?$=2+(T-_)/L:T===F&&($=4+(_-R)/L),$=Math.min(60*$,360),$<0&&($+=360);const J=(O+F)/2;return K=F===O?0:J<=.5?L/(F+O):L/(2-F-O),[$,100*K,100*J]},v.rgb.hsv=function(k){let _,R,T,O,F;const L=k[0]/255,$=k[1]/255,K=k[2]/255,J=Math.max(L,$,K),te=J-Math.min(L,$,K),Z=function(ee){return(J-ee)/6/te+.5};return te===0?(O=0,F=0):(F=te/J,_=Z(L),R=Z($),T=Z(K),L===J?O=T-R:$===J?O=.3333333333333333+_-T:K===J&&(O=.6666666666666666+R-_),O<0?O+=1:O>1&&(O-=1)),[360*O,100*F,100*J]},v.rgb.hwb=function(k){const _=k[0],R=k[1];let T=k[2];const O=v.rgb.hsl(k)[0],F=1/255*Math.min(_,Math.min(R,T));return T=1-.00392156862745098*Math.max(_,Math.max(R,T)),[O,100*F,100*T]},v.rgb.cmyk=function(k){const _=k[0]/255,R=k[1]/255,T=k[2]/255,O=Math.min(1-_,1-R,1-T);return[100*((1-_-O)/(1-O)||0),100*((1-R-O)/(1-O)||0),100*((1-T-O)/(1-O)||0),100*O]},v.rgb.keyword=function(k){const _=B[k];if(_)return _;let R,T=1/0;for(const L of Object.keys(y)){const $=y[L],K=(F=$,((O=k)[0]-F[0])**2+(O[1]-F[1])**2+(O[2]-F[2])**2);K<T&&(T=K,R=L)}var O,F;return R},v.keyword.rgb=function(k){return y[k]},v.rgb.xyz=function(k){let _=k[0]/255,R=k[1]/255,T=k[2]/255;return _=_>.04045?((_+.055)/1.055)**2.4:_/12.92,R=R>.04045?((R+.055)/1.055)**2.4:R/12.92,T=T>.04045?((T+.055)/1.055)**2.4:T/12.92,[100*(.4124*_+.3576*R+.1805*T),100*(.2126*_+.7152*R+.0722*T),100*(.0193*_+.1192*R+.9505*T)]},v.rgb.lab=function(k){const _=v.rgb.xyz(k);let R=_[0],T=_[1],O=_[2];return R/=95.047,T/=100,O/=108.883,R=R>.008856?R**.3333333333333333:7.787*R+.13793103448275862,T=T>.008856?T**.3333333333333333:7.787*T+.13793103448275862,O=O>.008856?O**.3333333333333333:7.787*O+.13793103448275862,[116*T-16,500*(R-T),200*(T-O)]},v.hsl.rgb=function(k){const _=k[0]/360,R=k[1]/100,T=k[2]/100;let O,F,L;if(R===0)return L=255*T,[L,L,L];O=T<.5?T*(1+R):T+R-T*R;const $=2*T-O,K=[0,0,0];for(let J=0;J<3;J++)F=_+.3333333333333333*-(J-1),F<0&&F++,F>1&&F--,L=6*F<1?$+6*(O-$)*F:2*F<1?O:3*F<2?$+(O-$)*(.6666666666666666-F)*6:$,K[J]=255*L;return K},v.hsl.hsv=function(k){const _=k[0];let R=k[1]/100,T=k[2]/100,O=R;const F=Math.max(T,.01);return T*=2,R*=T<=1?T:2-T,O*=F<=1?F:2-F,[_,100*(T===0?2*O/(F+O):2*R/(T+R)),100*((T+R)/2)]},v.hsv.rgb=function(k){const _=k[0]/60,R=k[1]/100;let T=k[2]/100;const O=Math.floor(_)%6,F=_-Math.floor(_),L=255*T*(1-R),$=255*T*(1-R*F),K=255*T*(1-R*(1-F));switch(T*=255,O){case 0:return[T,K,L];case 1:return[$,T,L];case 2:return[L,T,K];case 3:return[L,$,T];case 4:return[K,L,T];case 5:return[T,L,$]}},v.hsv.hsl=function(k){const _=k[0],R=k[1]/100,T=k[2]/100,O=Math.max(T,.01);let F,L;L=(2-R)*T;const $=(2-R)*O;return F=R*O,F/=$<=1?$:2-$,F=F||0,L/=2,[_,100*F,100*L]},v.hwb.rgb=function(k){const _=k[0]/360;let R=k[1]/100,T=k[2]/100;const O=R+T;let F;O>1&&(R/=O,T/=O);const L=Math.floor(6*_),$=1-T;F=6*_-L,1&L&&(F=1-F);const K=R+F*($-R);let J,te,Z;switch(L){default:case 6:case 0:J=$,te=K,Z=R;break;case 1:J=K,te=$,Z=R;break;case 2:J=R,te=$,Z=K;break;case 3:J=R,te=K,Z=$;break;case 4:J=K,te=R,Z=$;break;case 5:J=$,te=R,Z=K}return[255*J,255*te,255*Z]},v.cmyk.rgb=function(k){const _=k[0]/100,R=k[1]/100,T=k[2]/100,O=k[3]/100;return[255*(1-Math.min(1,_*(1-O)+O)),255*(1-Math.min(1,R*(1-O)+O)),255*(1-Math.min(1,T*(1-O)+O))]},v.xyz.rgb=function(k){const _=k[0]/100,R=k[1]/100,T=k[2]/100;let O,F,L;return O=3.2406*_+-1.5372*R+-.4986*T,F=-.9689*_+1.8758*R+.0415*T,L=.0557*_+-.204*R+1.057*T,O=O>.0031308?1.055*O**.4166666666666667-.055:12.92*O,F=F>.0031308?1.055*F**.4166666666666667-.055:12.92*F,L=L>.0031308?1.055*L**.4166666666666667-.055:12.92*L,O=Math.min(Math.max(0,O),1),F=Math.min(Math.max(0,F),1),L=Math.min(Math.max(0,L),1),[255*O,255*F,255*L]},v.xyz.lab=function(k){let _=k[0],R=k[1],T=k[2];return _/=95.047,R/=100,T/=108.883,_=_>.008856?_**.3333333333333333:7.787*_+.13793103448275862,R=R>.008856?R**.3333333333333333:7.787*R+.13793103448275862,T=T>.008856?T**.3333333333333333:7.787*T+.13793103448275862,[116*R-16,500*(_-R),200*(R-T)]},v.lab.xyz=function(k){let _,R,T;R=(k[0]+16)/116,_=k[1]/500+R,T=R-k[2]/200;const O=R**3,F=_**3,L=T**3;return R=O>.008856?O:(R-.13793103448275862)/7.787,_=F>.008856?F:(_-.13793103448275862)/7.787,T=L>.008856?L:(T-.13793103448275862)/7.787,_*=95.047,R*=100,T*=108.883,[_,R,T]},v.lab.lch=function(k){const _=k[0],R=k[1],T=k[2];let O;return O=360*Math.atan2(T,R)/2/Math.PI,O<0&&(O+=360),[_,Math.sqrt(R*R+T*T),O]},v.lch.lab=function(k){const _=k[0],R=k[1],T=k[2]/360*2*Math.PI;return[_,R*Math.cos(T),R*Math.sin(T)]},v.rgb.ansi16=function(k,_=null){const[R,T,O]=k;let F=_===null?v.rgb.hsv(k)[2]:_;if(F=Math.round(F/50),F===0)return 30;let L=30+(Math.round(O/255)<<2|Math.round(T/255)<<1|Math.round(R/255));return F===2&&(L+=60),L},v.hsv.ansi16=function(k){return v.rgb.ansi16(v.hsv.rgb(k),k[2])},v.rgb.ansi256=function(k){const _=k[0],R=k[1],T=k[2];return _===R&&R===T?_<8?16:_>248?231:Math.round((_-8)/247*24)+232:16+36*Math.round(_/255*5)+6*Math.round(R/255*5)+Math.round(T/255*5)},v.ansi16.rgb=function(k){let _=k%10;if(_===0||_===7)return k>50&&(_+=3.5),_=_/10.5*255,[_,_,_];const R=.5*(1+~~(k>50));return[(1&_)*R*255,(_>>1&1)*R*255,(_>>2&1)*R*255]},v.ansi256.rgb=function(k){if(k>=232){const R=10*(k-232)+8;return[R,R,R]}let _;return k-=16,[Math.floor(k/36)/5*255,Math.floor((_=k%36)/6)/5*255,_%6/5*255]},v.rgb.hex=function(k){const _=(((255&Math.round(k[0]))<<16)+((255&Math.round(k[1]))<<8)+(255&Math.round(k[2]))).toString(16).toUpperCase();return"000000".substring(_.length)+_},v.hex.rgb=function(k){const _=k.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!_)return[0,0,0];let R=_[0];_[0].length===3&&(R=R.split("").map(O=>O+O).join(""));const T=parseInt(R,16);return[T>>16&255,T>>8&255,255&T]},v.rgb.hcg=function(k){const _=k[0]/255,R=k[1]/255,T=k[2]/255,O=Math.max(Math.max(_,R),T),F=Math.min(Math.min(_,R),T),L=O-F;let $,K;return $=L<1?F/(1-L):0,K=L<=0?0:O===_?(R-T)/L%6:O===R?2+(T-_)/L:4+(_-R)/L,K/=6,K%=1,[360*K,100*L,100*$]},v.hsl.hcg=function(k){const _=k[1]/100,R=k[2]/100,T=R<.5?2*_*R:2*_*(1-R);let O=0;return T<1&&(O=(R-.5*T)/(1-T)),[k[0],100*T,100*O]},v.hsv.hcg=function(k){const _=k[1]/100,R=k[2]/100,T=_*R;let O=0;return T<1&&(O=(R-T)/(1-T)),[k[0],100*T,100*O]},v.hcg.rgb=function(k){const _=k[0]/360,R=k[1]/100,T=k[2]/100;if(R===0)return[255*T,255*T,255*T];const O=[0,0,0],F=_%1*6,L=F%1,$=1-L;let K=0;switch(Math.floor(F)){case 0:O[0]=1,O[1]=L,O[2]=0;break;case 1:O[0]=$,O[1]=1,O[2]=0;break;case 2:O[0]=0,O[1]=1,O[2]=L;break;case 3:O[0]=0,O[1]=$,O[2]=1;break;case 4:O[0]=L,O[1]=0,O[2]=1;break;default:O[0]=1,O[1]=0,O[2]=$}return K=(1-R)*T,[255*(R*O[0]+K),255*(R*O[1]+K),255*(R*O[2]+K)]},v.hcg.hsv=function(k){const _=k[1]/100,R=_+k[2]/100*(1-_);let T=0;return R>0&&(T=_/R),[k[0],100*T,100*R]},v.hcg.hsl=function(k){const _=k[1]/100,R=k[2]/100*(1-_)+.5*_;let T=0;return R>0&&R<.5?T=_/(2*R):R>=.5&&R<1&&(T=_/(2*(1-R))),[k[0],100*T,100*R]},v.hcg.hwb=function(k){const _=k[1]/100,R=_+k[2]/100*(1-_);return[k[0],100*(R-_),100*(1-R)]},v.hwb.hcg=function(k){const _=k[1]/100,R=1-k[2]/100,T=R-_;let O=0;return T<1&&(O=(R-T)/(1-T)),[k[0],100*T,100*O]},v.apple.rgb=function(k){return[k[0]/65535*255,k[1]/65535*255,k[2]/65535*255]},v.rgb.apple=function(k){return[k[0]/255*65535,k[1]/255*65535,k[2]/255*65535]},v.gray.rgb=function(k){return[k[0]/100*255,k[0]/100*255,k[0]/100*255]},v.gray.hsl=function(k){return[0,0,k[0]]},v.gray.hsv=v.gray.hsl,v.gray.hwb=function(k){return[0,100,k[0]]},v.gray.cmyk=function(k){return[0,0,0,k[0]]},v.gray.lab=function(k){return[k[0],0,0]},v.gray.hex=function(k){const _=255&Math.round(k[0]/100*255),R=((_<<16)+(_<<8)+_).toString(16).toUpperCase();return"000000".substring(R.length)+R},v.rgb.gray=function(k){return[(k[0]+k[1]+k[2])/3/255*100]}},841:(w,S,p)=>{const y=p(4959),B=p(9325),v={};Object.keys(y).forEach(k=>{v[k]={},Object.defineProperty(v[k],"channels",{value:y[k].channels}),Object.defineProperty(v[k],"labels",{value:y[k].labels});const _=B(k);Object.keys(_).forEach(R=>{const T=_[R];v[k][R]=function(O){const F=function(...L){const $=L[0];if($==null)return $;$.length>1&&(L=$);const K=O(L);if(typeof K=="object")for(let J=K.length,te=0;te<J;te++)K[te]=Math.round(K[te]);return K};return"conversion"in O&&(F.conversion=O.conversion),F}(T),v[k][R].raw=function(O){const F=function(...L){const $=L[0];return $==null?$:($.length>1&&(L=$),O(L))};return"conversion"in O&&(F.conversion=O.conversion),F}(T)})}),w.exports=v},9325:(w,S,p)=>{const y=p(4959);function B(_){const R=function(){const O={},F=Object.keys(y);for(let L=F.length,$=0;$<L;$++)O[F[$]]={distance:-1,parent:null};return O}(),T=[_];for(R[_].distance=0;T.length;){const O=T.pop(),F=Object.keys(y[O]);for(let L=F.length,$=0;$<L;$++){const K=F[$],J=R[K];J.distance===-1&&(J.distance=R[O].distance+1,J.parent=O,T.unshift(K))}}return R}function v(_,R){return function(T){return R(_(T))}}function k(_,R){const T=[R[_].parent,_];let O=y[R[_].parent][_],F=R[_].parent;for(;R[F].parent;)T.unshift(R[F].parent),O=v(y[R[F].parent][F],O),F=R[F].parent;return O.conversion=T,O}w.exports=function(_){const R=B(_),T={},O=Object.keys(R);for(let F=O.length,L=0;L<F;L++){const $=O[L];R[$].parent!==null&&(T[$]=k($,R))}return T}},1103:w=>{w.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},8603:(w,S,p)=>{p.d(S,{Z:()=>_});var y=p(1799),B=p.n(y),v=p(2609),k=p.n(v)()(B());k.push([w.id,".ck-content code{background-color:hsla(0,0%,78%,.3);border-radius:2px;padding:.15em}.ck.ck-editor__editable .ck-code_selected{background-color:hsla(0,0%,78%,.5)}","",{version:3,sources:["webpack://./../ckeditor5-basic-styles/theme/code.css"],names:[],mappings:"AAKA,iBACC,kCAAuC,CAEvC,iBAAkB,CADlB,aAED,CAEA,0CACC,kCACD",sourcesContent:[`/*
|
|
1
|
+
(function(Ve,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("vue"),require("@viur/vue-utils"),require("pinia"),require("@viur/viur-shop-client"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","@viur/vue-utils","pinia","@viur/viur-shop-client","vue-router"],h):(Ve=typeof globalThis<"u"?globalThis:Ve||self,h(Ve.ViurShopComponents={},Ve.Vue,Ve.ViurVueUtils,Ve.Pinia,Ve.ViurShopClient))})(this,function(Ve,h,Cn,or,Yf){"use strict";var jD=Object.defineProperty;var $D=(Ve,h,Cn)=>h in Ve?jD(Ve,h,{enumerable:!0,configurable:!0,writable:!0,value:Cn}):Ve[h]=Cn;var Jf=(Ve,h,Cn)=>$D(Ve,typeof h!="symbol"?h+"":h,Cn);const de=(m,x)=>{const C=m.__vccOpts||m;for(const[N,D]of x)C[N]=D;return C},ir={props:{size:{type:String,default:"2"},active:{type:Boolean,default:!0},logo:{default:"logo-cube.svg",type:String},color:{default:"var(--sl-color-primary-500)",type:String}},setup(m,x){const C=h.reactive({trackWidth:h.computed(()=>`${m.size/30}rem`),outerSize:h.computed(()=>`calc(${m.size}rem + ${C.trackWidth})`),spinnerSize:h.computed(()=>`${m.size}rem`),logoSize:h.computed(()=>`calc(${m.size}rem - ${C.trackWidth} * 10)`),shadow:h.computed(()=>`0px 0px ${m.size/6}rem 0 color-mix(in hsl, var(--sl-color-neutral-1000), 80% transparent)`)});return{state:C}}},Ha=()=>{h.useCssVars(m=>({"93747d92":m.state.outerSize,"284424e5":m.state.shadow,"6485ca5e":m.state.logoSize,"5d833915":m.state.spinnerSize,d5b3feca:m.color,"2050b700":m.state.trackWidth}))},qa=ir.setup;ir.setup=qa?(m,x)=>(Ha(),qa(m,x)):Ha;const Qf=m=>(h.pushScopeId("data-v-46c45785"),m=m(),h.popScopeId(),m),Xf={key:0,class:"loading"},ek=Qf(()=>h.createElementVNode("sl-spinner",{class:"loader"},null,-1)),tk={class:"logo"},nk=["src"];function ok(m,x,C,N,D,M){return h.openBlock(),h.createBlock(h.Transition,null,{default:h.withCtx(()=>[C.active?(h.openBlock(),h.createElementBlock("div",Xf,[ek,h.createElementVNode("div",tk,[h.createElementVNode("sl-icon",{src:C.logo},null,8,nk)])])):h.createCommentVNode("",!0)]),_:1})}const ik=de(ir,[["render",ok],["__scopeId","data-v-46c45785"]]),vn=or.defineStore("cartstore",()=>{const m=new Yf.ViURShopClient({host_url:window.location.origin==="http://localhost:8081"?"http://localhost:8080":window.location.origin}),x=h.reactive({basketRootNode:{},whishlistRootNodes:[],children:{},structure:{address:{},cart:{}}});async function C(){await D()}async function N(B){return await m.cart_list({cart_key:B})}async function D(){(await m.cart_list()).forEach(v=>{v.is_root_node&&(v.cart_type==="basket"?x.basketRootNode=v:x.whishlistRootNodes.push(v))})}async function M(B,v){let k=await m.article_add({article_key:B,parent_cart_key:v});console.log("addToCart",k)}async function w(B,v){let k=await m.article_view({article_key:B,parent_cart_key:v});console.log("getArticleView",k)}async function S(B,v){let k=await m.article_remove({article_key:B,parent_cart_key:v});console.log("remove Resp",k)}async function p(B,v,k){let _=await m.article_update({article_key:B,parent_cart_key:v,quantity:k,quantity_mode:"replace"});console.log("update Resp",_)}async function y(){let B=await m.address_structure();x.structure.address=B.addSkel,console.log("adress add",x.structure.address)}return{state:x,addToCart:M,getArticleView:w,removeItem:S,updateItem:p,init:C,getAdressStructure:y,getChildren:N}}),rk={__name:"CartNode",props:{node:{type:Object,required:!0}},setup(m){return h.reactive({}),(x,C)=>(h.openBlock(),h.createElementBlock(h.Fragment,null,[h.createTextVNode(" cartnode "),h.createElementVNode("pre",null,h.toDisplayString(m.node.name),1)],64))}},io=m=>(h.pushScopeId("data-v-0e24135f"),m=m(),h.popScopeId(),m),sk={horizontal:"",class:"viur-shop-cart-card"},ak=["src"],lk={class:"viur-shop-cart-card-header",slot:"header"},ck={class:"viur-shop-cart-card-headline headline"},dk={class:"viur-shop-cart-card-body-row"},hk={class:"viur-shop-cart-card-body-info"},uk=io(()=>h.createElementVNode("div",{class:"viur-shop-cart-card-descr"},[h.createTextVNode(" Version: 900x900x2000 "),h.createElementVNode("br"),h.createTextVNode(" Farbe: Chromoptik "),h.createElementVNode("br"),h.createTextVNode(" Glasart: Klar hell mit Edelglasbeschichtung"),h.createElementVNode("br"),h.createTextVNode(" Anschlag: Beidseitig variabel"),h.createElementVNode("br"),h.createTextVNode(" Griff: Stangengriff Exklusiv (56) ")],-1)),mk={class:"viur-shop-cart-card-body-footer"},gk=io(()=>h.createElementVNode("sl-button",{size:"small",outline:"",class:"viur-shop-cart-card-add-to-favourites-btn",variant:"primary",title:"Add to favourites"},[h.createElementVNode("sl-icon",{name:"heart",slot:"prefix"})],-1)),pk=[io(()=>h.createElementVNode("sl-icon",{name:"trash",slot:"prefix"},null,-1))],fk={class:"viur-shop-cart-card-body-amount"},kk={class:"viur-shop-cart-card-price-wrap",slot:"footer"},bk=io(()=>h.createElementVNode("div",{class:"viur-shop-cart-card-price-label"},"Preis",-1)),wk={class:"viur-shop-cart-card-price"},Ak=io(()=>h.createElementVNode("div",{class:"viur-shop-cart-card-small-print"},"Brutto / Stk.",-1)),_k=de({__name:"CartLeaf",props:{leaf:{type:Object,required:!0},node:{type:Object,required:!0}},emits:["updateItem","removeItem"],setup(m,{emit:x}){const C=m,N=x,D=h.reactive({leaf:{}});function M(p){return p!==void 0?Cn.Request.downloadUrlFor(p):"https://images.unsplash.com/photo-1559209172-0ff8f6d49ff7?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=80"}function w(p,y,B,v){N("updateItem",{item:p,articleKey:y,node:B,quantity:v})}function S(p,y,B){N("removeItem",{item:p,articleKey:y,node:B})}return h.onBeforeMount(()=>{D.leaf=C.leaf}),(p,y)=>(h.openBlock(),h.createElementBlock(h.Fragment,null,[h.createTextVNode(" cartleafe "),h.createElementVNode("sl-card",sk,[h.createElementVNode("img",{class:"viur-shop-cart-card-img",slot:"image",src:M(D.leaf.shop_image?D.leaf.shop_image:void 0)},null,8,ak),h.createElementVNode("div",lk,[h.createElementVNode("h4",ck,h.toDisplayString(D.leaf.shop_name)+" | "+h.toDisplayString(m.leaf.shop_art_no_or_gtin),1)]),h.createElementVNode("div",dk,[h.createElementVNode("div",hk,[uk,h.createElementVNode("div",mk,[gk,h.createElementVNode("sl-button",{size:"small",outline:"",class:"viur-shop-cart-card-delete-btn",variant:"primary",title:"Remove from cart",onClick:y[0]||(y[0]=B=>S(D.leaf,D.leaf.article.dest.key,m.node))},pk)])]),h.createElementVNode("div",fk,[h.withDirectives(h.createElementVNode("sl-input",{class:"amount-input",type:"number",label:"Anzahl",placeholder:"Number",min:"0","onUpdate:modelValue":y[1]||(y[1]=B=>D.leaf.quantity=B),onInput:y[2]||(y[2]=B=>w(D.leaf,D.leaf.article.dest.key,m.node,D.leaf.quantity))},null,544),[[h.vModelText,D.leaf.quantity]])]),h.createElementVNode("div",kk,[bk,h.createElementVNode("div",wk,h.toDisplayString(D.leaf.price.retail)+" € ",1),Ak])])])],64))}},[["__scopeId","data-v-0e24135f"]]),mt=m=>(h.pushScopeId("data-v-39d35665"),m=m(),h.popScopeId(),m),Ck={key:0},vk=mt(()=>h.createElementVNode("p",null,"Möchten Sie den Artikel wirklich aus dem Warenkorb entfernen?",-1)),yk={class:"footer-wrap",slot:"footer"},Ek={key:0},xk=mt(()=>h.createElementVNode("h2",{class:"viur-shop-cart-sidebar-headline headline"},"Zusammenfassung",-1)),Sk=mt(()=>h.createElementVNode("br",null,null,-1)),Dk=mt(()=>h.createElementVNode("sl-input",{label:"Rabattcode eingeben"},null,-1)),Bk=mt(()=>h.createElementVNode("br",null,null,-1)),Tk={class:"viur-shop-cart-sidebar-info-line"},Ik=mt(()=>h.createElementVNode("span",null,"Zwischensumme",-1)),Pk=mt(()=>h.createElementVNode("div",{class:"viur-shop-cart-sidebar-info-line"},[h.createElementVNode("span",null,"Rabatt"),h.createTextVNode(" 0 € ")],-1)),Rk=mt(()=>h.createElementVNode("div",{class:"viur-shop-cart-sidebar-info-line"},[h.createElementVNode("span",null,"Versandkosten"),h.createTextVNode(" 0 € ")],-1)),Ok={class:"viur-shop-cart-sidebar-info-line total"},Nk=mt(()=>h.createElementVNode("span",null,"Gesamt:",-1)),zk=mt(()=>h.createElementVNode("div",{class:"viur-shop-cart-sidebar-btn-wrap"},[h.createElementVNode("sl-button",{variant:"info",size:"small"}," Jetzt Bestellen "),h.createElementVNode("sl-button",{size:"small",variant:"primary"},[h.createElementVNode("sl-icon",{name:"paypal",slot:"prefix"}),h.createTextVNode(" Paypal ")])],-1)),rr=de({__name:"CartView",props:{mode:{type:String,default:"basket"},cartKey:{type:String,required:!0},sidebar:{type:Boolean,default:!0}},setup(m){const x=m,C=vn(),N=h.ref(null),D=h.reactive({itemsIsInit:h.computed(()=>!0),images:{},currentItem:{},currentNode:{},nodes:[],leaves:{}});h.computed(()=>x.mode==="basket"?C.state.basket:x.cartKey);async function M(){await C.updateItem(D.currentItem.article.dest.key,D.currentNode.key,0),await y(),N.value.hide()}async function w(v){console.log("updateItem :",v),v.quantity===0?(N.value.show(),D.currentItem=v.item,D.currentNode=v.node):(await C.updateItem(v.articleKey,v.node.key,v.quantity),await C.init())}function S(v){console.log("removeItem :",v),N.value.show(),D.currentItem=v.item,D.currentNode=v.node}async function p(){D.leaves[D.currentNode.key].forEach(v=>{v.key===D.currentItem.key&&(v.quantity=1)}),D.currentItem={},D.currentNode={}}async function y(){D.nodes=[],D.leaves={},await C.init(),await B()}async function B(v=x.cartKey){console.log("debug getChildren parentKey from comp: ",v);const k=await C.getChildren(v);console.log("getChildren children: ",k),k.forEach(async _=>{_.skel_type==="node"?(D.nodes.push(_),await B(_.key)):(Object.keys(D.leaves).includes(v)||(D.leaves[v]=[]),D.leaves[v].push(_))})}return h.onBeforeMount(async()=>{await C.init(),await B(),x.mode==="basket"&&D.nodes.push(C.state.basketRootNode),console.log("state.nodes test",D.nodes),console.log("state.leaves",D.leaves)}),(v,k)=>m.cartKey.length?(h.openBlock(),h.createElementBlock(h.Fragment,{key:1},[h.createElementVNode("sl-dialog",{ref_key:"confirm",ref:N,onSlHide:p},[vk,h.createElementVNode("div",yk,[h.createElementVNode("sl-button",{variant:"danger",onClick:k[0]||(k[0]=_=>N.value.hide()),size:"medium"}," Abbrechen "),h.createElementVNode("sl-button",{variant:"success",onClick:M,size:"medium"}," Aus Warenkorb entfernen ")])],544),(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(D.nodes,_=>(h.openBlock(),h.createElementBlock("div",null,[Object.keys(D.leaves).includes(_.key)?(h.openBlock(),h.createElementBlock(h.Fragment,{key:0},[h.createVNode(rk,{node:_},null,8,["node"]),(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(D.leaves[_.key],R=>(h.openBlock(),h.createBlock(_k,{key:R.key,leaf:R,node:_,onRemoveItem:S,onUpdateItem:w},null,8,["leaf","node"]))),128))],64)):h.createCommentVNode("",!0)]))),256)),m.sidebar?(h.openBlock(),h.createElementBlock("div",Ek,[xk,Sk,Dk,Bk,h.createElementVNode("div",Tk,[Ik,h.createTextVNode(" --> "+h.toDisplayString(m.mode==="basket"?h.unref(C).state.basketRootNode.total:h.unref(C).state.whishlistRootNodes[m.cartKey].total)+" € ",1)]),Pk,Rk,h.createElementVNode("div",Ok,[Nk,h.createTextVNode(" "+h.toDisplayString(m.mode==="basket"?h.unref(C).state.basketRootNode.total:h.unref(C).state.whishlistRootNodes[m.cartKey].total)+" € ",1)]),zk])):h.createCommentVNode("",!0)],64)):(h.openBlock(),h.createElementBlock("sl-spinner",Ck))}},[["__scopeId","data-v-39d35665"]]),Mt=m=>(h.pushScopeId("data-v-b7b745be"),m=m(),h.popScopeId(),m),Mk={key:1,class:"list"},Fk=Mt(()=>h.createElementVNode("h2",{class:"viur-shop-cart-headline headline"},"Bestellung prüfen",-1)),Vk=Mt(()=>h.createElementVNode("br",null,null,-1)),Lk=Mt(()=>h.createElementVNode("div",{class:"viur-shop-cart-address-wrap"},[h.createElementVNode("div",{class:"viur-shop-cart-address"},[h.createElementVNode("div",{class:"viur-shop-cart-address-headline"},[h.createTextVNode(" Versandadresse "),h.createElementVNode("sl-button",{outline:"",size:"small"},[h.createElementVNode("sl-icon",{name:"pencil",slot:"prefix"})])]),h.createTextVNode(" Roland Brose"),h.createElementVNode("br"),h.createTextVNode(" Speicherstraße 33"),h.createElementVNode("br"),h.createTextVNode(" 44147 Dortmund, DE"),h.createElementVNode("br"),h.createElementVNode("br"),h.createTextVNode(" rb@mausbrand.de"),h.createElementVNode("br"),h.createTextVNode(" 0231 21 34 68 90 ")]),h.createElementVNode("div",{class:"viur-shop-cart-address"},[h.createElementVNode("div",{class:"viur-shop-cart-address-headline"},[h.createTextVNode(" Rechnungsadresse "),h.createElementVNode("sl-button",{outline:"",size:"small"},[h.createElementVNode("sl-icon",{name:"pencil",slot:"prefix"})])]),h.createTextVNode(" Roland Brose"),h.createElementVNode("br"),h.createTextVNode(" Speicherstraße 33"),h.createElementVNode("br"),h.createTextVNode(" 44147 Dortmund, DE"),h.createElementVNode("br"),h.createElementVNode("br"),h.createTextVNode(" rb@mausbrand.de"),h.createElementVNode("br"),h.createTextVNode(" 0231 21 34 68 90 ")])],-1)),jk=Mt(()=>h.createElementVNode("div",{class:"viur-shop-cart-payment"},[h.createElementVNode("div",{class:"viur-shop-cart-payment-method"},[h.createElementVNode("span",null,"Zahlungsmethode:"),h.createTextVNode(" Paypal ")]),h.createElementVNode("sl-button",{outline:"",size:"small"},[h.createElementVNode("sl-icon",{name:"pencil",slot:"prefix"})])],-1)),$k=Mt(()=>h.createElementVNode("h2",{class:"viur-shop-cart-headline headline"},"Warenkorb",-1)),Hk=Mt(()=>h.createElementVNode("br",null,null,-1)),qk=Mt(()=>h.createElementVNode("h2",{class:"viur-shop-cart-sidebar-headline headline"},"Jetzt Bestellen",-1)),Uk=Mt(()=>h.createElementVNode("br",null,null,-1)),Wk={class:"viur-shop-cart-sidebar-btn-wrap"},Kk=["variant","disabled"],sr=de({__name:"ConfirmView",setup(m){const x=vn(),C=h.reactive({cartIsInit:h.computed(()=>!0),itemsIsInit:h.computed(()=>{var D;return!!((D=x.state)!=null&&D.carts[x.state.basket].items)}),images:{},showOrderButton:!1});function N(D){D.target.checked&&(C.showOrderButton=!0),D.target.checked||(C.showOrderButton=!1)}return h.onBeforeMount(async()=>{await x.init()}),(D,M)=>C.cartIsInit?(h.openBlock(),h.createElementBlock("div",Mk,[Fk,Vk,Lk,jk,$k,Hk,(h.openBlock(),h.createBlock(h.Teleport,{to:"#order_sidebar"},[qk,Uk,h.createElementVNode("sl-checkbox",{onSlChange:N}," Ich akzeptiere die geltenden AGBs und Datenschutzbestimmungen ",32),h.createElementVNode("div",Wk,[h.createElementVNode("sl-button",{variant:C.showOrderButton?"info":"disabled",size:"small",disabled:!C.showOrderButton}," Zahlungspflichtig bestellen ",8,Kk)])]))])):(h.openBlock(),h.createBlock(ik,{key:0}))}},[["__scopeId","data-v-b7b745be"]]),Gk=m=>(h.pushScopeId("data-v-61488015"),m=m(),h.popScopeId(),m),Zk={class:"bind viur-shop-wrap"},Jk=["panel","disabled"],Yk={class:"viur-shop-order-step"},Qk=["name","library"],Xk={class:"viur-shop-order-status-text"},eb={key:0,name:"chevron-right",class:"viur-shop-order-tab-check"},tb=["name"],nb=["onClick"],ob=["onClick"],ib=Gk(()=>h.createElementVNode("div",{class:"viur-shop-sidebar",id:"order_sidebar"},null,-1)),rb=de({__name:"OrderView",props:{tabs:{type:Object,required:!0}},emits:["tabChange"],setup(m,{emit:x}){const C=m,N=x,D=h.reactive({tabNames:h.computed(()=>w(C.tabs)),isFirstTab:B=>B===0}),M=h.ref(null);function w(B){let v=[],k=[];for(const _ in B)B[_].position?v.push([_,B[_].position]):v.push([_,0]);return v.sort((_,R)=>_[1]-R[1]),v.forEach(_=>{k.push(_[0])}),k}function S(B){N("tabChange",B)}function p(B){M.value.show(B)}function y(B){M.value.show(B)}return(B,v)=>(h.openBlock(),h.createElementBlock("div",Zk,[h.createElementVNode("sl-tab-group",{class:"viur-shop-order-tab",noScrollControls:"",onSlTabShow:S,ref_key:"tabGroup",ref:M},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(D.tabNames,(k,_)=>(h.openBlock(),h.createElementBlock("sl-tab",{slot:"nav",panel:k,key:k,disabled:m.tabs[k].disabled},[h.createElementVNode("div",Yk,[h.createElementVNode("sl-icon",{name:m.tabs[k].icon.name,library:m.tabs[k].icon.library},null,8,Qk),h.createElementVNode("div",Xk,h.toDisplayString(_+1)+". "+h.toDisplayString(m.tabs[k].displayName),1)]),_<D.tabNames.length-1?(h.openBlock(),h.createElementBlock("sl-icon",eb)):h.createCommentVNode("",!0)],8,Jk))),128)),(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(D.tabNames,(k,_)=>(h.openBlock(),h.createElementBlock("sl-tab-panel",{name:k,key:k},[(h.openBlock(),h.createBlock(h.resolveDynamicComponent(m.tabs[k].component),h.mergeProps({ref_for:!0},m.tabs[k].props?m.tabs[k].props:""),null,16)),_!==D.tabNames.length-1?(h.openBlock(),h.createElementBlock("div",{key:0,class:h.normalizeClass(["viur-shop-form-footer",{"flex-end":D.isFirstTab(_)}])},[h.withDirectives(h.createElementVNode("sl-button",{type:"submit",onClick:R=>p(D.tabNames[_-1])}," Zurück ",8,nb),[[h.vShow,_!==0]]),h.createElementVNode("sl-button",{type:"submit",variant:"primary",onClick:R=>y(D.tabNames[_+1])}," Weiter ",8,ob)],2)):h.createCommentVNode("",!0)],8,tb))),128))],544),ib]))}},[["__scopeId","data-v-61488015"]]),sb={},jo=m=>(h.pushScopeId("data-v-36ccc280"),m=m(),h.popScopeId(),m),ab={class:"bind"},lb=[jo(()=>h.createElementVNode("h1",{class:"headline"},"Vielen Dank für Ihre Bestellung",-1)),jo(()=>h.createElementVNode("br",null,null,-1)),jo(()=>h.createElementVNode("p",{class:"paragraph"},[h.createElementVNode("strong",null,"Ihre Bestellnummer:"),h.createTextVNode(" 123345670 ")],-1)),jo(()=>h.createElementVNode("p",{class:"paragraph"},[h.createTextVNode(" Wir haben Ihre Bestellung erhalten und werden diese schenllstmöglich bearbeiten."),h.createElementVNode("br"),h.createTextVNode(" Sie erhalten in wenigen Minuten eine Bestätigung per E-Mail. "),h.createElementVNode("div",{class:"btn-wrap"},[h.createElementVNode("sl-button",{size:"medium"}," Zur Startseite "),h.createElementVNode("sl-button",{variant:"primary",size:"medium"}," Weiter Einkaufen ")])],-1))];function cb(m,x){return h.openBlock(),h.createElementBlock("div",ab,lb)}const db=de(sb,[["render",cb],["__scopeId","data-v-36ccc280"]]),hb=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({});function D(M){x.emit("change",m.name,M.target.value,m.lang,m.index)}return h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:D}}}),ub=["disabled","value"],mb=["disabled","value"];function gb(m,x,C,N,D,M){var w,S;return m.boneState.bonestructure.type==="raw.json"?(h.openBlock(),h.createElementBlock("sl-textarea",{key:0,disabled:(w=m.boneState)==null?void 0:w.readonly,value:JSON.stringify(m.value),onInput:x[0]||(x[0]=(...p)=>m.changeEvent&&m.changeEvent(...p))},null,40,ub)):(h.openBlock(),h.createElementBlock("sl-textarea",{key:1,disabled:(S=m.boneState)==null?void 0:S.readonly,value:m.value,onInput:x[1]||(x[1]=(...p)=>m.changeEvent&&m.changeEvent(...p))},null,40,mb))}const ar=de(hb,[["render",gb],["__scopeId","data-v-0ebe5f0b"]]),pb=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String,readonly:Boolean,params:Object},components:{},emits:["change"],setup(m,x){const C=h.reactive({});function N(D){x.emit("change",m.name,D.target.value,m.lang,m.index)}return h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:C,changeEvent:N}}}),fb=["value"];function kb(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("sl-input",{disabled:"",value:m.value,onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w))},null,40,fb)}const Ua=de(pb,[["render",kb],["__scopeId","data-v-b45a1311"]]);function bb(m){return h.getCurrentScope()?(h.onScopeDispose(m),!0):!1}function wb(m){return typeof m=="function"?m():h.unref(m)}const Ab=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;function $o(m,x,C={}){const{immediate:N=!0}=C,D=h.ref(!1);let M=null;function w(){M&&(clearTimeout(M),M=null)}function S(){D.value=!1,w()}function p(...y){w(),D.value=!0,M=setTimeout(()=>{D.value=!1,M=null,m(...y)},wb(x))}return N&&(D.value=!0,Ab&&p()),bb(S),{isPending:h.readonly(D),start:p,stop:S}}class _b{static objectEmpty(x){return Object.keys(x).length===0&&x.constructor===Object}static getDescr(x,C){try{return x.values.filter(N=>N[0]===C)[0][1]}catch{return"-"}}static unescape(x){return x||(x=""),String(x).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/(/g,"(").replace(/)/g,")").replace(/=/g,"=").replace(/'/g,"'").replace(/(/g,"(").replace(/)/g,")").replace(/=/g,"=")}static formatString(x,C){function N(w){let S=[],p=[],y=/\$\((.*?)\)/g;for(;p;){if(p=y.exec(w),!p){p=!1;continue}S.push(p[1])}return S}let D=N(x),M=[];Array.isArray(C)||(C=[C]);for(let w of C){let S=x;for(let p of D){let y=p.split("."),B=w;for(let v of y)B&&B!=="-"&&v in B&&B[v]?B=B[v]:B="-";B=this.unescape(B),S=S.replace("$("+p+")",B)}M.push(S)}return M.join(", ")}}const Cb=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String,autofocus:Boolean},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value:h.computed(()=>m.value)}),D=h.ref(null);function M(w){x.emit("change",m.name,w.target.value,m.lang,m.index)}return h.watchEffect(()=>{if(m.autofocus&&D.value&&D.value!==null&&D!==null){const{start:w}=$o(()=>{D.value.focus()},600);w()}}),h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,Utils:_b,boneState:C,changeEvent:M,stringBone:D}}}),vb=["disabled","value","required"];function yb(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("sl-input",{ref:"stringBone",disabled:m.boneState.readonly,value:m.Utils.unescape(m.value),required:m.boneState.bonestructure.required,onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w)),onKeyup:x[1]||(x[1]=(...w)=>m.changeEvent&&m.changeEvent(...w))},null,40,vb)}const Wa=de(Cb,[["render",yb],["__scopeId","data-v-1ccbacc0"]]),Eb=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String,autofocus:Boolean},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({}),D=h.ref(null);function M(w){x.emit("change",m.name,w.target.value,m.lang,m.index)}return h.watchEffect(()=>{if(m.autofocus&&D.value&&D.value!==null&&D!==null){const{start:w}=$o(()=>{D.value.focus()},600);w()}}),h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:M,emailBone:D}}}),xb=["disabled","value"];function Sb(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("sl-input",{ref:"emailBone",disabled:m.boneState.readonly,type:"email",value:m.value,onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w))},null,40,xb)}const Ka=de(Eb,[["render",Sb],["__scopeId","data-v-4328e024"]]),Db=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value:h.computed(()=>{var w;let M=m.value;return C.bonestructure.time?M=(w=m.value)==null?void 0:w.split("+")[0]:m.value&&(M=new Date(m.value).toISOString().substr(0,10)),M}),typeString:h.computed(()=>{let M="datetime-local";return C.bonestructure.time||(M="date"),M})});function D(M){x.emit("change",m.name,M.target.value,m.lang,m.index)}return h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:D}}}),Bb=["disabled","type","value"];function Tb(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("sl-input",{disabled:m.boneState.readonly,type:m.state.typeString,value:m.state.value,onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w))},null,40,Bb)}const Ga=de(Db,[["render",Tb],["__scopeId","data-v-f1b8af8c"]]),Ib=h.defineComponent({inheritAttrs:!1,props:{name:String,value:null,index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value:h.computed(()=>{let w=m.value;return Array.isArray(m.value)?(C.bonestructure.values instanceof Array?w=w.filter(S=>C.bonestructure.values.map(p=>p[0].toString()).includes(S)):w=w.filter(S=>Object.keys(C.bonestructure.values).map(p=>p.toString()).includes(S)),w.map(S=>S.toString())):m.value?m.value.toString():""})});function D(){if(Array.isArray(C.bonestructure.values))return C.bonestructure.values;{let w=[];for(const[S,p]of Object.entries(C.bonestructure.values))w.push([S,p]);return w}}function M(w){x.emit("change",m.name,w.target.value,m.lang,m.index),W}return h.onMounted(()=>{x.emit("change",m.name,N.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:M,convertObjToList:D}}}),Pb=["disabled","value","multiple"],Rb=["value"];function Ob(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("sl-select",{disabled:m.boneState.readonly,value:m.state.value,hoist:"",multiple:m.boneState.bonestructure.multiple,"max-options-visible":"0",clearable:"",onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w))},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(m.convertObjToList(),w=>(h.openBlock(),h.createElementBlock("sl-option",{key:w[0],value:w[0]},h.toDisplayString(w[1]),9,Rb))),128))],40,Pb)}const Za=de(Ib,[["render",Ob],["__scopeId","data-v-5a38b97f"]]),Nb=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value:h.computed(()=>![!1,null,void 0,""].includes(m.value))});function D(M){x.emit("change",m.name,M.target.checked,m.lang,m.index)}return h.onMounted(()=>{let M=m.value;M||(M=!1),x.emit("change",m.name,M,m.lang,m.index)}),{state:N,boneState:C,changeEvent:D}}}),zb=["disabled","checked"];function Mb(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("sl-switch",{disabled:m.boneState.readonly,checked:m.state.value,onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w))},null,40,zb)}const Ja=de(Nb,[["render",Mb],["__scopeId","data-v-363598c8"]]),Fb=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String,autofocus:Boolean},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value1:"",value2:null,equal:!1,passwordInfo:[],requiredPasswordInfo:[]}),D=h.ref(null);function M(S){N.value1===N.value2?N.equal=!0:N.equal=!1,w(N.value1),N.requiredPasswordInfo.length===0&&N.passwordInfo.length-N.requiredPasswordInfo.length<=C.bonestructure.test_threshold?x.emit("change",m.name,N.value1,m.lang,m.index,!0):x.emit("change",m.name,N.value1,m.lang,m.index,!1)}h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)});function w(S){N.passwordInfo=[],N.requiredPasswordInfo=[];for(const p of C.bonestructure.tests)new RegExp(p[0]).test(S)||(p[2]?N.requiredPasswordInfo.push(p[1]):N.passwordInfo.push(p[1]));N.equal||N.requiredPasswordInfo.push("Die eingegebenen Passwörter stimmen nicht überein."),N.value1||N.requiredPasswordInfo.push("Das eingegebene Passwort ist leer.")}return h.watchEffect(()=>{if(m.autofocus&&D.value&&D.value!==null&&D!==null){const{start:S}=$o(()=>{D.value.focus()},600);S()}}),h.watch(()=>m.value,(S,p)=>{N.value1=S}),{state:N,boneState:C,changeEvent:M,passwordBone:D}}}),Vb=["disabled"],Lb=["name"],jb=["name"],$b={class:"errors"};function Hb(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock(h.Fragment,null,[h.withDirectives(h.createElementVNode("sl-input",{ref:"passwordBone","onUpdate:modelValue":x[0]||(x[0]=w=>m.state.value1=w),disabled:m.boneState.readonly,class:h.normalizeClass({"has-check":!m.boneState.readonly}),type:"password",clearable:"","password-toggle":"true",onSlChange:x[1]||(x[1]=(...w)=>m.changeEvent&&m.changeEvent(...w)),onSlClear:x[2]||(x[2]=w=>m.state.value1=""),onKeyup:x[3]||(x[3]=(...w)=>m.changeEvent&&m.changeEvent(...w))},[h.createElementVNode("sl-icon",{slot:"suffix",name:m.state.equal&&m.state.value1.length?"check":"x"},null,8,Lb)],42,Vb),[[h.vModelText,m.state.value1]]),m.boneState.readonly?h.createCommentVNode("",!0):h.withDirectives((h.openBlock(),h.createElementBlock("sl-input",{key:0,"onUpdate:modelValue":x[4]||(x[4]=w=>m.state.value2=w),class:"password-check",type:"password",clearable:"","password-toggle":"true",onSlChange:x[5]||(x[5]=(...w)=>m.changeEvent&&m.changeEvent(...w)),onSlClear:x[6]||(x[6]=w=>m.state.value2=""),onKeyup:x[7]||(x[7]=(...w)=>m.changeEvent&&m.changeEvent(...w))},[h.createElementVNode("sl-icon",{slot:"suffix",name:m.state.equal&&m.state.value1.length?"check":"x"},null,8,jb)],544)),[[h.vModelText,m.state.value2]]),h.createElementVNode("ul",$b,[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(m.state.passwordInfo,(w,S)=>(h.openBlock(),h.createElementBlock("li",{key:S},h.toDisplayString(w),1))),128)),(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(m.state.requiredPasswordInfo,(w,S)=>(h.openBlock(),h.createElementBlock("li",{key:S,class:"requiredInfo"},h.toDisplayString(w),1))),128))])],64)}const Ya=de(Fb,[["render",Hb],["__scopeId","data-v-0ccf18c0"]]),qb=h.defineComponent({props:{name:String,value:null,index:Number,lang:String,readonly:Boolean,params:Object},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value:h.computed(()=>m.value),structure:h.computed(()=>w(C.bonestructure.using)),globalRegistration:!1,formGroups:h.computed(()=>{var y,B;let S={default:{name:"Allgemein",bones:[],groupVisible:!1,groupOpen:!0}};for(const[v,k]of Object.entries(N.structure)){let _="default",R=N.structure[v],T=(y=N.value)==null?void 0:y[v];(B=k==null?void 0:k.params)!=null&&B.category&&(_=k.params.category.toLowerCase()),Object.keys(S).includes(_)?S[_].bones.push({boneName:v,boneStructure:R,boneValue:T}):S[_]={name:k.params.category,bones:[{boneName:v,boneStructure:R,boneValue:T}]},R.visible===!0&&(S[_].groupVisible=!0)}let p={};return Object.keys(S).sort().forEach(function(v){p[v]=S[v]}),p})});function D(S){x.emit("change",S)}h.onMounted(()=>{h.getCurrentInstance().appContext.components.Bone?N.globalRegistration=!0:N.globalRegistration=!1,x.emit("change",m.name,m.value,m.lang,m.index)});function M(S){console.log(S)}function w(S){if(Array.isArray(S)){let p={};for(const y in S)p[S[y][0]]=S[y][1];return p}else return S}return{state:N,boneState:C,getBoneWidget:Jt,structureToDict:w,changeEvent:D,updateValue:M}}}),Ub={key:0,open:"",variant:"danger"},Wb={key:1,class:"form"},Kb=["summary","open"];function Gb(m,x,C,N,D,M){const w=h.resolveComponent("bone");return m.state.globalRegistration?(h.openBlock(),h.createElementBlock("div",Wb,[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(m.state.formGroups,(S,p)=>h.withDirectives((h.openBlock(),h.createElementBlock("sl-details",{key:p,summary:S.name,open:S.groupOpen},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(S.bones,y=>h.withDirectives((h.openBlock(),h.createBlock(w,{key:y.name,is:m.getBoneWidget(m.state.structure[y.boneName].type),name:y.boneName,structure:m.state.structure,skel:m.state.value,errors:m.boneState.errors,readonly:m.boneState.bonestructure.readonly?!0:void 0,onChangeInternal:m.changeEvent},null,8,["is","name","structure","skel","errors","readonly","onChangeInternal"])),[[h.vShow,m.state.structure[y.boneName].visible]])),128))],8,Kb)),[[h.vShow,S.groupVisible]])),128))])):(h.openBlock(),h.createElementBlock("sl-alert",Ub," In Order to use this Bone register the bone component globally in your main file "))}const Qa=de(qb,[["render",Gb],["__scopeId","data-v-e6fcfbca"]]),Zb=h.defineComponent({inheritAttrs:!1,props:{name:String,value:null,index:Number,lang:String},components:{Wrapper_nested:Qa},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value:{},index:h.computed(()=>m.index),lang:h.computed(()=>m.lang)});function D(M){var S;(S=N.value)!=null&&S[M.name]||(N.value?N.value[M.name]=null:N.value={[M.name]:null});let w=N.value[M.name];M.lang?(w===null&&(w={}),Object.keys(w).includes(M.lang)&&M.index!==null?w[M.lang][M.index]=M.value:w[M.lang]=M.value):M.index!==null?(w===null&&(w=[]),w[M.index]=M.value):w=M.value,N.value[M.name]=w,x.emit("change",m.name,N.value,m.lang,m.index,!0)}return h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:D}}});function Jb(m,x,C,N,D,M){const w=h.resolveComponent("Wrapper_nested");return h.openBlock(),h.createBlock(w,{value:m.value,name:m.name,index:m.state.index,disabled:m.boneState.bonestructure.readonly,onChange:m.changeEvent},null,8,["value","name","index","disabled","onChange"])}const Xa=de(Zb,[["render",Jb],["__scopeId","data-v-84a761ce"]]),Yb=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({});function D(M){x.emit("change",m.name,M.target.value,m.lang,m.index)}return h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:D}}}),Qb=["disabled","value"];function Xb(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("sl-color-picker",{disabled:m.boneState.readonly,value:m.value,onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w))},null,40,Qb)}const el=de(Yb,[["render",Xb],["__scopeId","data-v-534b9149"]]),ew=h.defineComponent({inheritAttrs:!1,emits:{change:null},props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String,autofocus:Boolean},components:{},setup(m,x){const C=h.inject("boneState"),N=h.reactive({minAmount:h.computed(()=>C.bonestructure.minAmount),maxAmount:h.computed(()=>C.bonestructure.maxAmount),precision:h.computed(()=>{if(C.bonestructure.precision>1)return parseFloat(`0.${"0".repeat(C.bonestructure.precision-1)}1`)})}),D=h.ref(null);function M(w){x.emit("change",m.name,w.target.value,m.lang,m.index)}return h.watchEffect(()=>{if(m.autofocus&&D.value&&D.value!==null&&D!==null){const{start:w}=$o(()=>{D.value.focus()},600);w()}}),h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:M,numericBone:D}}}),tw=["disabled","value","min","max","step"],nw={class:"info"},ow={key:0},iw={key:1},rw={key:2};function sw(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock(h.Fragment,null,[h.createElementVNode("sl-input",{ref:"numericBone",type:"number",disabled:m.boneState.readonly,value:m.value,min:m.state.minAmount,max:m.state.maxAmount,step:m.state.precision,onSlChange:x[0]||(x[0]=(...w)=>m.changeEvent&&m.changeEvent(...w)),onKeyup:x[1]||(x[1]=(...w)=>m.changeEvent&&m.changeEvent(...w))},null,40,tw),h.createElementVNode("ul",nw,[m.state.minAmount!==-9223372036854776e3&&m.state.minAmount?(h.openBlock(),h.createElementBlock("li",ow,h.toDisplayString(m.$t("bones.numeric.min",{val:m.state.minAmount})),1)):h.createCommentVNode("",!0),m.state.maxAmount!==9223372036854776e3&&m.state.maxAmount?(h.openBlock(),h.createElementBlock("li",iw,h.toDisplayString(m.$t("bones.numeric.max",{val:m.state.maxAmount})),1)):h.createCommentVNode("",!0),m.state.precision?(h.openBlock(),h.createElementBlock("li",rw,h.toDisplayString(m.$t("bones.numeric.precision",{val:m.boneState.bonestructure.precision})),1)):h.createCommentVNode("",!0)])],64)}const tl=de(ew,[["render",sw],["__scopeId","data-v-03d5b399"]]);var Le={VITE_API_URL:"",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};class Ho extends Error{constructor(x,C,N,D){super(N||C),arguments.length>=4&&D&&Object.assign(this,D),this.statusText=C,this.statusCode=x,this.response=D}}let lr=null;function Zt(){return lr||(lr=or.defineStore("requestStore",()=>{const m=h.reactive({sKeys:new Set});function x(){m.sKeys=new Set}return{state:m,$reset:x}})),lr()}class we{static resetState(){Zt().$reset(),Zt().$dispose()}static buildUrl(x){return x&&!(x.startsWith("http://")||x.startsWith("https://")||x.startsWith("//"))&&(x=window.location.origin+x),x}static post(x,{dataObj:C=null,callback:N=null,failedCallback:D=null,abortController:M=null,headers:w=null,mode:S=null}={}){function p(){if(C instanceof FormData)return C;const B=new FormData;for(const v in C)if(Array.isArray(C[v]))for(let k of C[v])B.append(v,k);else B.append(v,C[v]);return B}let y=ro.post(we.buildUrl(x),p(),null,w,M,S);return y.then(function(B){N&&N(B.data)}).catch(function(B){D&&D(B)}),y}static async getBatchSkeys(x=30,C=Le.VITE_DEFAULT_RENDERER||"json"){await we.get(`/${C}/skey`,{dataObj:{amount:x}}).then(async N=>{let D=await N.json();Array.isArray(D)||(D=[D]),Zt().state.sKeys=new Set(D)})}static async securePost(x,{dataObj:C=null,callback:N=null,failedCallback:D=null,abortController:M=null,renderer:w=Le.VITE_DEFAULT_RENDERER||"json",headers:S=null,mode:p=null,amount:y=30}={}){let B=null;Zt().state.sKeys.size===0&&await we.getBatchSkeys(y);const v=[...Zt().state.sKeys][0];return C instanceof FormData?(C.append("skey",v),Zt().state.sKeys.delete(v)):(C||(C={}),C.skey=v,Zt().state.sKeys.delete(v)),B=we.post(x,{dataObj:C,callback:N,abortController:M,headers:S,mode:p}),B}static get(x,{dataObj:C=null,callback:N=null,failedCallback:D=null,cached:M=!1,clearCache:w=!1,abortController:S=null,headers:p=null,mode:y=null,cacheTime:B=1e3*60*60*24*1}={}){let v=ro.get(we.buildUrl(x),C,w,p,S,y);return v.then(function(k){N&&N(k.data)}).catch(function(k){D&&D(k)}),v}static list(x,{dataObj:C=null,callback:N=null,failedCallback:D=null,group:M=null,abortController:w=null,renderer:S=(Le==null?void 0:Le.VITE_DEFAULT_RENDERER)||"json"}={}){let p=`/${S}/${x}/list`;return M&&(p+=`/${M}`),we.get(p,{dataObj:C,callback:N,failedCallback:D,abortController:w})}static getStructure(x,{dataObj:C=null,callback:N=null,failedCallback:D=null,group:M=null,abortController:w=null,renderer:S=(Le==null?void 0:Le.VITE_DEFAULT_RENDERER)||"json"}={}){x=x.replace(/\//g,".");let p=`/${S}/getStructure/${x}`;return M&&(p+=`/${M}`),we.get(p,{dataObj:C,callback:N,failedCallback:D,abortController:w})}static view(x,C,{dataObj:N=null,callback:D=null,failedCallback:M=null,group:w=null,abortController:S=null,renderer:p=(Le==null?void 0:Le.VITE_DEFAULT_RENDERER)||"json"}={}){let y=`/${p}/${x}/view/${C}`;return w&&(y=`/${p}/${x}/view/${w}/${C}`),we.get(y,{dataObj:N,callback:D,failedCallback:M,abortController:S})}static add(x,{dataObj:C=null,callback:N=null,failedCallback:D=null,group:M=null,abortController:w=null,renderer:S=(Le==null?void 0:Le.VITE_DEFAULT_RENDERER)||"json"}={}){let p=`/${S}/${x}/add`;return M&&(p=`/${S}/${x}/add/${M}`),we.securePost(p,{dataObj:C,callback:N,failedCallback:D,abortController:w})}static edit(x,C,{dataObj:N=null,callback:D=null,failedCallback:M=null,group:w=null,abortController:S=null,renderer:p=(Le==null?void 0:Le.VITE_DEFAULT_RENDERER)||"json"}={}){let y=`/${p}/${x}/edit/${C}`;return w&&(y=`/${p}/${x}/edit/${w}/${C}`),we.securePost(y,{dataObj:N,callback:D,failedCallback:M,abortController:S})}static delete(x,C,{dataObj:N=null,callback:D=null,failedCallback:M=null,group:w=null,abortController:S=null,renderer:p=(Le==null?void 0:Le.VITE_DEFAULT_RENDERER)||"json"}={}){let y=`/${p}/${x}/delete/${C}`;return w&&(y=`/${p}/${x}/delete/${w}/${C}`),we.securePost(y,{dataObj:N,callback:D,failedCallback:M,abortController:S,amount:1})}static downloadUrlFor(x,C=!1){return x&&"dest"in x?C&&"thumbnail"in x.dest?we.buildUrl(x.dest.thumbnail):"downloadUrl"in x.dest?we.buildUrl(x.dest.downloadUrl):we.buildUrl(null):we.buildUrl(x)}static uploadFile(x,C=void 0){const N={fileName:x.name,mimeType:x.type||"application/octet-stream",size:x.size.toString(),node:C};return new Promise((D,M)=>{we.securePost("/vi/file/getUploadURL",{dataObj:N}).then(async w=>{let S=await w.json();fetch(S.values.uploadUrl,{body:x,method:"POST",mode:"no-cors"}).then(async p=>{const y={key:S.values.uploadKey,skelType:"leaf"};we.securePost("/vi/file/add",{dataObj:y}).then(async B=>{let v=await B.json();v.action==="addSuccess"?D(v.values):M(v)}).catch(B=>{M(B)})}).catch(p=>{M(p)})}).catch(w=>{M(w)})})}}class ro{constructor(){Jf(this,"withCredentials",!0)}static buildOptions(x,C=null,N=null,D=null,M=null){let w={method:x};return w.credentials="include",w.headers={Accept:"application/json, text/plain, */*"},N&&(w.headers={...w.headers,...N}),C&&(w.body=C),D&&(w.signal=D.signal),M&&(w.mode=M),w}static get(x,C=null,N=null,D=null,M=null,w=null){function S(p,y){let B=new URL(p);if(y&&Object.keys(y).length>0){const v=new URLSearchParams;for(const[k,_]of Object.entries(y))if(Array.isArray(_))for(const R of _)v.append(k,R);else v.append(k,_);B.search=v.toString()}return B.toString()}return fetch(S(x,C),ro.buildOptions("GET",null,D,M,w)).then(async p=>{if(p.ok)return p;{const y=`${p.status} ${p.statusText}: ${p.headers?p.headers.get("x-error-descr"):""}`;return Promise.reject(new Ho(p.status,p.statusText,y,p))}}).catch(p=>{if(p instanceof TypeError){const B=`503 ${p.message}: ${p.headers?p.headers.get("x-error-descr"):""}`;return Promise.reject(new Ho(503,p.message,B,p))}if(p instanceof DOMException&&p.name=="AbortError"){const B=`${p.code} ${p.name}: ${p.headers?p.headers.get("x-error-descr"):""}`;return Promise.reject(new Ho(p.code,p.name,B,{url:x}))}const y=`${p.statusCode} ${p.statusText}: ${p.headers?p.headers.get("x-error-descr"):""}`;return Promise.reject(new Ho(p.statusCode,p.statusText,y,p.response))})}static post(x,C=null,N=null,D=null,M=null,w=null){return fetch(x,ro.buildOptions("POST",C,D,M,w))}}var aw={VITE_API_URL:"",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const lw=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{Wrapper_nested:Qa},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.inject("formatString"),D=h.reactive({format:h.computed(()=>C==null?void 0:C.bonestructure.format),skellistdata:null,selection:null});function M(p){let y="";return C.bonestructure.type==="relational.tree.leaf.file"?y="skelType=leaf&":C.bonestructure.type==="relational.tree.node.file"&&(y="skelType=node&"),we.get(`/${aw.VITE_DEFAULT_RENDERER||"vi"}/${C.bonestructure.module}/list?${y}limit=99`).then(async B=>{var k;const v=await B.json();D.skellistdata={};for(let _ of v.skellist)D.skellistdata[_.key]=_;return(k=v.skellist)==null?void 0:k.map(_=>({text:N(C.bonestructure.format,{dest:_}),value:_.key,data:_}))})}function w(p){D.selection={dest:D.skellistdata[p.detail.item.value]},x.emit("change",m.name,D.selection,m.lang,m.index)}function S(p){var B;D.selection||(D.selection={}),(B=D.selection.rel)!=null&&B[p.name]||(D.selection.rel?D.selection.rel[p.name]=null:D.selection.rel={[p.name]:null});let y=D.selection.rel[p.name];p.lang?(y===null&&(y={}),Object.keys(y).includes(p.lang)&&p.index!==null?y[p.lang][p.index]=p.value:y[p.lang]=p.value):p.index!==null?(y===null&&(y=[]),y[p.index]=p.value):y=p.value,Object.keys(D.selection).includes("rel")&&D.selection.rel?D.selection.rel[p.name]=y:D.selection.rel={[p.name]:y},Object.keys(D.selection).includes("dest")&&x.emit("change",m.name,D.selection,m.lang,m.index)}return h.onMounted(()=>{D.selection=m.value,x.emit("change",m.name,m.value,m.lang,m.index)}),{state:D,boneState:C,formatString:N,changeEvent:w,changeEventNested:S,getList:M}}}),cw=m=>(h.pushScopeId("data-v-61dd72e0"),m=m(),h.popScopeId(),m),dw={class:"record"},hw={class:"single-entry"},uw=["value"],mw=["disabled","source"],gw=["title"],pw=[cw(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"x-lg"},null,-1))];function fw(m,x,C,N,D,M){var S,p;const w=h.resolveComponent("Wrapper_nested");return h.openBlock(),h.createElementBlock("div",dw,[h.createElementVNode("div",hw,[m.state.selection?(h.openBlock(),h.createElementBlock("sl-input",{key:0,disabled:!0,value:m.value?m.formatString(m.state.format,m.state.selection):""},null,8,uw)):(h.openBlock(),h.createElementBlock("sl-combobox",{key:1,disabled:m.boneState.readonly,source:m.getList,hoist:"",onSlItemSelect:x[0]||(x[0]=(...y)=>m.changeEvent&&m.changeEvent(...y))},null,40,mw)),!m.boneState.multiple&&!m.boneState.isEmpty?(h.openBlock(),h.createElementBlock("sl-button",{key:2,variant:"danger",outline:"",title:m.$t("bone.del"),class:"delete-btn square-btn",onClick:x[1]||(x[1]=()=>{m.$emit("change",m.name,"",m.lang,m.index),m.state.selection=null})},pw,8,gw)):h.createCommentVNode("",!0)]),(S=m.boneState)!=null&&S.bonestructure.using?(h.openBlock(),h.createBlock(w,{key:0,value:(p=m.value)==null?void 0:p.rel,name:m.name,index:m.index,disabled:m.boneState.bonestructure.readonly,onChange:m.changeEventNested},null,8,["value","name","index","disabled","onChange"])):h.createCommentVNode("",!0)])}const nl=de(lw,[["render",fw],["__scopeId","data-v-61dd72e0"]]),kw=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String,readonly:Boolean,params:Object},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({});function D(M,w){x.emit("change",m.name,M,m.lang,m.index)}return h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)}),{state:N,boneState:C,changeEvent:D}}}),bw={class:"box"};function ww(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("div",bw,h.toDisplayString(m.value),1)}const Aw=de(kw,[["render",ww],["__scopeId","data-v-343aca69"]]);var ol={VITE_API_URL:"",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const _w=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.ref(),D=h.reactive({loading:!1,droparea:!1,previewopen:!1});h.onMounted(()=>{x.emit("change",m.name,m.value,m.lang,m.index)});function M(){console.log(we.downloadUrlFor(m.value)),window.open(we.downloadUrlFor(m.value))}function w(){return we.downloadUrlFor(m.value,!1)}function S(B){const v={fileName:B.name,mimeType:B.type||"application/octet-stream",size:B.size.toString()};return new Promise((k,_)=>{we.securePost(`/${ol.VITE_DEFAULT_RENDERER||"vi"}/file/getUploadURL`,{dataObj:v}).then(async R=>{let T=await R.json();fetch(T.values.uploadUrl,{body:B,method:"POST",mode:"no-cors"}).then(async O=>{const F={key:T.values.uploadKey,node:void 0,skelType:"leaf"};we.securePost(`/${ol.VITE_DEFAULT_RENDERER||"vi"}/file/add`,{dataObj:F}).then(async L=>{let $=await L.json();$.action==="addSuccess"?k($.values):_($)}).catch(L=>{_(L)})}).catch(O=>{_(O)})}).catch(R=>{_(R)})})}async function p(B){D.loading=!0;for(let v of B.target.files){let k=await S(v);N.value.value=null,x.emit("change",m.name,{dest:k,rel:null},m.lang,m.index)}D.loading=!1}async function y(B){D.loading=!0,D.droparea=!1;for(let v of B.dataTransfer.files){let k=await S(v);N.value.value=null,x.emit("change",m.name,{dest:k,rel:null},m.lang,m.index);break}D.loading=!1}return{state:D,boneState:C,downloadFile:M,createBackgroundImage:w,handleUpload:p,uploadinput:N,handleDrop:y}}}),qo=m=>(h.pushScopeId("data-v-91086308"),m=m(),h.popScopeId(),m),Cw={key:0,class:"loader"},vw=[qo(()=>h.createElementVNode("sl-spinner",{slot:"suffix"},null,-1))],yw={key:1,class:"droparea"},Ew=["title"],xw=[qo(()=>h.createElementVNode("sl-icon",{name:"upload"},null,-1))],Sw=["multiple"],Dw=["title"],Bw=[qo(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"download"},null,-1))],Tw={class:"box"},Iw=["src"],Pw=["label","open"],Rw=["src"],Ow={key:1,class:"preview"},Nw={key:0,name:"file-earmark"},zw={key:2},Mw=["title"],Fw=[qo(()=>h.createElementVNode("sl-icon",{name:"x-lg"},null,-1))];function Vw(m,x,C,N,D,M){var w,S,p,y,B,v,k,_,R,T;return h.openBlock(),h.createElementBlock("div",{class:"file-wrapper",onDragover:x[5]||(x[5]=h.withModifiers(O=>m.state.droparea=!0,["prevent"])),onDragleave:x[6]||(x[6]=O=>m.state.droparea=!1),onDrop:x[7]||(x[7]=h.withModifiers((...O)=>m.handleDrop&&m.handleDrop(...O),["prevent"]))},[m.state.loading?(h.openBlock(),h.createElementBlock("div",Cw,vw)):h.createCommentVNode("",!0),m.state.droparea?(h.openBlock(),h.createElementBlock("div",yw," Dateien hier hinziehen ")):h.createCommentVNode("",!0),!m.boneState.readonly&&(!m.value||m.state.loading)?(h.openBlock(),h.createElementBlock("sl-button",{key:2,title:m.$t("bone.upload"),outline:"",class:"upload-btn",onClick:x[0]||(x[0]=O=>m.uploadinput.click())},xw,8,Ew)):h.createCommentVNode("",!0),h.createElementVNode("input",{ref:"uploadinput",hidden:"",type:"file",multiple:m.boneState.multiple,onChange:x[1]||(x[1]=(...O)=>m.handleUpload&&m.handleUpload(...O))},null,40,Sw),m.value?(h.openBlock(),h.createElementBlock("sl-button",{key:3,title:m.$t("bone.download"),onClick:x[2]||(x[2]=(...O)=>m.downloadFile&&m.downloadFile(...O))},Bw,8,Dw)):h.createCommentVNode("",!0),h.createElementVNode("div",Tw,[(S=(w=m.value)==null?void 0:w.dest)!=null&&S.mimetype.includes("image")?(h.openBlock(),h.createElementBlock("div",{key:0,class:"preview has-preview",onClick:x[3]||(x[3]=O=>m.state.previewopen=!m.state.previewopen)},[h.createElementVNode("img",{class:"preview-img",src:m.createBackgroundImage(),alt:""},null,8,Iw),h.createElementVNode("sl-dialog",{label:decodeURIComponent((y=(p=m.value)==null?void 0:p.dest)==null?void 0:y.name),class:"preview-overlay",open:m.state.previewopen},[h.createElementVNode("img",{src:m.createBackgroundImage(),alt:""},null,8,Rw)],8,Pw)])):(h.openBlock(),h.createElementBlock("div",Ow,[(v=(B=m.value)==null?void 0:B.dest)!=null&&v.name?(h.openBlock(),h.createElementBlock("sl-icon",Nw)):h.createCommentVNode("",!0)])),(_=(k=m.value)==null?void 0:k.dest)!=null&&_.name?(h.openBlock(),h.createElementBlock("div",zw,h.toDisplayString(decodeURIComponent((T=(R=m.value)==null?void 0:R.dest)==null?void 0:T.name)),1)):h.createCommentVNode("",!0)]),m.boneState.multiple?h.createCommentVNode("",!0):(h.openBlock(),h.createElementBlock("sl-button",{key:4,variant:"danger",outline:"",title:m.$t("bone.del"),class:"delete-btn",onClick:x[4]||(x[4]=O=>m.$emit("change",m.name,"",m.lang,m.index))},Fw,8,Mw))],32)}const il=de(_w,[["render",Vw],["__scopeId","data-v-91086308"]]);var Uo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lw(m){return m&&m.__esModule&&Object.prototype.hasOwnProperty.call(m,"default")?m.default:m}var Wo={exports:{}};Wo.exports,function(m,x){(function(C){const N=C.de=C.de||{};N.dictionary=Object.assign(N.dictionary||{},{"%0 of %1":"%0 von %1","Align cell text to the bottom":"Zellentext unten ausrichten","Align cell text to the center":"Zellentext zentriert ausrichten","Align cell text to the left":"Zellentext linksbündig ausrichten","Align cell text to the middle":"Zellentext mittig ausrichten","Align cell text to the right":"Zellentext rechtsbündig ausrichten","Align cell text to the top":"Zellentext oben ausrichten","Align center":"Zentriert","Align left":"Linksbündig","Align right":"Rechtsbündig","Align table to the left":"Tabelle links ausrichten","Align table to the right":"Tabelle rechts ausrichten",Alignment:"Ausrichtung",Aquamarine:"Aquamarinblau",Background:"Hintergrund",Black:"Schwarz","Block quote":"Blockzitat",Blue:"Blau",Bold:"Fett",Border:"Rahmen","Break text":"Bild teilt Text","Bulleted List":"Aufzählungsliste","Bulleted list styles toolbar":"Darstellung der ungeordneten Liste",Cancel:"Abbrechen","Cannot upload file:":"Die Datei kann nicht hochgeladen werden:","Caption for image: %0":"Bildunterschrift: %0","Caption for the image":"Bildunterschrift","Cell properties":"Zelleneigenschaften","Center table":"Tabelle zentrieren","Centered image":"Zentriertes Bild","Change image text alternative":"Alternativtext ändern","Choose heading":"Überschrift auswählen",Circle:"Leerer Kreis",Code:"Code",Color:"Farbe","Color picker":"Farbwähler",Column:"Spalte",Dashed:"Gestrichelt",Decimal:"Dezimalzahlen","Decimal with leading zero":"Dezimalzahlen mit vorangestellten Nullen","Decrease indent":"Einzug verkleinern","Delete column":"Spalte löschen","Delete row":"Zeile löschen","Dim grey":"Dunkelgrau",Dimensions:"Größe",Disc:"Gefüllter Kreis",Dotted:"Gepunktet",Double:"Doppelt",Downloadable:"Herunterladbar","Dropdown toolbar":"Dropdown-Liste Werkzeugleiste","Edit block":"Absatz bearbeiten","Edit link":"Link bearbeiten","Editor block content toolbar":"Editor Blockinhalt-Toolbar","Editor contextual toolbar":"Editor kontextuelle Toolbar","Editor editing area: %0":"Bearbeitungsbereich des Editors: %0","Editor toolbar":"Editor Werkzeugleiste","Enter image caption":"Bildunterschrift eingeben","Enter table caption":"Tabellenüberschrift eingeben","Full size image":"Bild in voller Größe",Green:"Grün",Grey:"Grau",Groove:"Eingeritzt","Header column":"Kopfspalte","Header row":"Kopfzeile",Heading:"Überschrift","Heading 1":"Überschrift 1","Heading 2":"Überschrift 2","Heading 3":"Überschrift 3","Heading 4":"Überschrift 4","Heading 5":"Überschrift 5","Heading 6":"Überschrift 6",Height:"Höhe",HEX:"","Horizontal text alignment toolbar":"Werkzeugleiste für die horizontale Zellentext-Ausrichtung","HTML object":"HTML-Objekt","Image resize list":"Bildgrößen-Liste","Image toolbar":"Bild Werkzeugleiste","image widget":"Bild-Steuerelement","In line":"Text in Zeile","Increase indent":"Einzug vergrößern",Insert:"Einfügen","Insert column left":"Spalte links einfügen","Insert column right":"Spalte rechts einfügen","Insert image":"Bild einfügen","Insert image via URL":"Bild von URL einfügen","Insert paragraph after block":"Absatz nach Block einfügen","Insert paragraph before block":"Absatz vor Block einfügen","Insert row above":"Zeile oben einfügen","Insert row below":"Zeile unten einfügen","Insert table":"Tabelle einfügen",Inset:"Eingelassen",Italic:"Kursiv",Justify:"Blocksatz","Justify cell text":"Zellentext als Blocksatz ausrichten","Left aligned image":"Linksbündiges Bild","Light blue":"Hellblau","Light green":"Hellgrün","Light grey":"Hellgrau",Link:"Link","Link image":"Bild verlinken","Link URL":"Link Adresse","List properties":"Listeneigenschaften","Lower-latin":"Kleingeschriebene lateinische Buchstaben","Lower–roman":"Kleingeschriebene römische Zahlen","Merge cell down":"Zelle unten verbinden","Merge cell left":"Zelle links verbinden","Merge cell right":"Zelle rechts verbinden","Merge cell up":"Zelle verbinden","Merge cells":"Zellen verbinden",Next:"Nächste",None:"Kein Rahmen","Numbered List":"Nummerierte Liste","Numbered list styles toolbar":"Darstellung der geordneten Liste","Open in a new tab":"In neuem Tab öffnen","Open link in new tab":"Link im neuen Tab öffnen",Orange:"Orange",Original:"Original",Outset:"Geprägt",Padding:"Innenabstand",Paragraph:"Absatz","Press Enter to type after or press Shift + Enter to type before the widget":"Drücken Sie die Eingabetaste, um nach dem Widget zu tippen oder Shift + Eingabetaste, um vor dem Widget zu tippen.",Previous:"vorherige",Purple:"Violett",Red:"Rot",Redo:"Wiederherstellen","Remove color":"Farbe entfernen","Remove Format":"Formatierung entfernen","Resize image":"Bildgröße ändern","Resize image to %0":"Bildgröße ändern in %0","Resize image to the original size":"Bild in Originalgröße ändern","Restore default":"Standard wiederherstellen","Reversed order":"Umgekehrte Reihenfolge","Rich Text Editor":"Rich Text Editor",Ridge:"Hervorgehoben","Right aligned image":"Rechtsbündiges Bild",Row:"Zeile",Save:"Speichern","Select all":"Alles auswählen","Select column":"Spalte auswählen","Select row":"Zeile auswählen","Show more items":"Mehr anzeigen","Side image":"Seitenbild",Solid:"Durchgezogen","Split cell horizontally":"Zelle horizontal teilen","Split cell vertically":"Zelle vertikal teilen",Square:"Quadrat","Start at":"Beginnen mit","Start index must be greater than 0.":"Der Startwert muss größer als 0 sein.",Strikethrough:"Durchgestrichen",Style:"Rahmenart",Subscript:"Tiefgestellt",Superscript:"Hochgestellt","Table alignment toolbar":"Werkzeugleiste für die Tabellen-Ausrichtung","Table cell text alignment":"Ausrichtung des Zellentextes","Table properties":"Tabelleneigenschaften","Table toolbar":"Tabelle Werkzeugleiste","Text alignment":"Textausrichtung","Text alignment toolbar":"Text-Ausrichtung Toolbar","Text alternative":"Alternativtext",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':"Die Farbe ist ungültig. Probieren Sie „#FF0000“ oder „rgb(255,0,0)“ oder „red“.",'The value is invalid. Try "10px" or "2em" or simply "2".':"Der Wert ist ungültig. Probieren Sie „10px“ oder „2em“ oder „2“.","This link has no URL":"Dieser Link hat keine Adresse","To-do List":"Aufgabenliste","Toggle caption off":"Tabellenüberschrift deaktivieren","Toggle caption on":"Tabellenüberschrift aktivieren","Toggle the circle list style":"Leeren Kreis einstellen","Toggle the decimal list style":"Dezimalzahlen einstellen","Toggle the decimal with leading zero list style":"Dezimalzahlen mit vorangestellten Nullen einstellen","Toggle the disc list style":"Gefüllten Kreis einstellen","Toggle the lower–latin list style":"Kleingeschriebene lateinische Buchstaben einstellen","Toggle the lower–roman list style":"Kleingeschriebene römische Zahlen einstellen","Toggle the square list style":"Quadrat einstellen","Toggle the upper–latin list style":"Großgeschriebene lateinische Buchstaben einstellen","Toggle the upper–roman list style":"Großgeschriebene römische Zahlen einstellen",Turquoise:"Türkis","Type or paste your content here.":"Hier Inhalt einfügen.","Type your title":"Titel eingeben",Underline:"Unterstrichen",Undo:"Rückgängig",Unlink:"Link entfernen",Update:"Aktualisieren","Update image URL":"Bild-URL aktualisieren","Upload failed":"Hochladen fehlgeschlagen","Upload in progress":"Upload läuft","Upper-latin":"Großgeschriebene lateinische Buchstaben","Upper-roman":"Großgeschriebene römische Zahlen","Vertical text alignment toolbar":"Werkzeugleiste für die vertikale Zellentext-Ausrichtung",White:"Weiß","Widget toolbar":"Widget Werkzeugleiste",Width:"Breite","Wrap text":"Text umfließt Bild",Yellow:"Gelb"}),N.getPluralForm=function(D){return D!=1}})(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})),function(C,N){m.exports=N()}(self,()=>(()=>{var C={4959:(w,S,p)=>{const y=p(1103),B={};for(const k of Object.keys(y))B[y[k]]=k;const v={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};w.exports=v;for(const k of Object.keys(v)){if(!("channels"in v[k]))throw new Error("missing channels property: "+k);if(!("labels"in v[k]))throw new Error("missing channel labels property: "+k);if(v[k].labels.length!==v[k].channels)throw new Error("channel and label counts mismatch: "+k);const{channels:_,labels:R}=v[k];delete v[k].channels,delete v[k].labels,Object.defineProperty(v[k],"channels",{value:_}),Object.defineProperty(v[k],"labels",{value:R})}v.rgb.hsl=function(k){const _=k[0]/255,R=k[1]/255,T=k[2]/255,O=Math.min(_,R,T),F=Math.max(_,R,T),L=F-O;let $,K;F===O?$=0:_===F?$=(R-T)/L:R===F?$=2+(T-_)/L:T===F&&($=4+(_-R)/L),$=Math.min(60*$,360),$<0&&($+=360);const J=(O+F)/2;return K=F===O?0:J<=.5?L/(F+O):L/(2-F-O),[$,100*K,100*J]},v.rgb.hsv=function(k){let _,R,T,O,F;const L=k[0]/255,$=k[1]/255,K=k[2]/255,J=Math.max(L,$,K),te=J-Math.min(L,$,K),Z=function(ee){return(J-ee)/6/te+.5};return te===0?(O=0,F=0):(F=te/J,_=Z(L),R=Z($),T=Z(K),L===J?O=T-R:$===J?O=.3333333333333333+_-T:K===J&&(O=.6666666666666666+R-_),O<0?O+=1:O>1&&(O-=1)),[360*O,100*F,100*J]},v.rgb.hwb=function(k){const _=k[0],R=k[1];let T=k[2];const O=v.rgb.hsl(k)[0],F=1/255*Math.min(_,Math.min(R,T));return T=1-.00392156862745098*Math.max(_,Math.max(R,T)),[O,100*F,100*T]},v.rgb.cmyk=function(k){const _=k[0]/255,R=k[1]/255,T=k[2]/255,O=Math.min(1-_,1-R,1-T);return[100*((1-_-O)/(1-O)||0),100*((1-R-O)/(1-O)||0),100*((1-T-O)/(1-O)||0),100*O]},v.rgb.keyword=function(k){const _=B[k];if(_)return _;let R,T=1/0;for(const L of Object.keys(y)){const $=y[L],K=(F=$,((O=k)[0]-F[0])**2+(O[1]-F[1])**2+(O[2]-F[2])**2);K<T&&(T=K,R=L)}var O,F;return R},v.keyword.rgb=function(k){return y[k]},v.rgb.xyz=function(k){let _=k[0]/255,R=k[1]/255,T=k[2]/255;return _=_>.04045?((_+.055)/1.055)**2.4:_/12.92,R=R>.04045?((R+.055)/1.055)**2.4:R/12.92,T=T>.04045?((T+.055)/1.055)**2.4:T/12.92,[100*(.4124*_+.3576*R+.1805*T),100*(.2126*_+.7152*R+.0722*T),100*(.0193*_+.1192*R+.9505*T)]},v.rgb.lab=function(k){const _=v.rgb.xyz(k);let R=_[0],T=_[1],O=_[2];return R/=95.047,T/=100,O/=108.883,R=R>.008856?R**.3333333333333333:7.787*R+.13793103448275862,T=T>.008856?T**.3333333333333333:7.787*T+.13793103448275862,O=O>.008856?O**.3333333333333333:7.787*O+.13793103448275862,[116*T-16,500*(R-T),200*(T-O)]},v.hsl.rgb=function(k){const _=k[0]/360,R=k[1]/100,T=k[2]/100;let O,F,L;if(R===0)return L=255*T,[L,L,L];O=T<.5?T*(1+R):T+R-T*R;const $=2*T-O,K=[0,0,0];for(let J=0;J<3;J++)F=_+.3333333333333333*-(J-1),F<0&&F++,F>1&&F--,L=6*F<1?$+6*(O-$)*F:2*F<1?O:3*F<2?$+(O-$)*(.6666666666666666-F)*6:$,K[J]=255*L;return K},v.hsl.hsv=function(k){const _=k[0];let R=k[1]/100,T=k[2]/100,O=R;const F=Math.max(T,.01);return T*=2,R*=T<=1?T:2-T,O*=F<=1?F:2-F,[_,100*(T===0?2*O/(F+O):2*R/(T+R)),100*((T+R)/2)]},v.hsv.rgb=function(k){const _=k[0]/60,R=k[1]/100;let T=k[2]/100;const O=Math.floor(_)%6,F=_-Math.floor(_),L=255*T*(1-R),$=255*T*(1-R*F),K=255*T*(1-R*(1-F));switch(T*=255,O){case 0:return[T,K,L];case 1:return[$,T,L];case 2:return[L,T,K];case 3:return[L,$,T];case 4:return[K,L,T];case 5:return[T,L,$]}},v.hsv.hsl=function(k){const _=k[0],R=k[1]/100,T=k[2]/100,O=Math.max(T,.01);let F,L;L=(2-R)*T;const $=(2-R)*O;return F=R*O,F/=$<=1?$:2-$,F=F||0,L/=2,[_,100*F,100*L]},v.hwb.rgb=function(k){const _=k[0]/360;let R=k[1]/100,T=k[2]/100;const O=R+T;let F;O>1&&(R/=O,T/=O);const L=Math.floor(6*_),$=1-T;F=6*_-L,1&L&&(F=1-F);const K=R+F*($-R);let J,te,Z;switch(L){default:case 6:case 0:J=$,te=K,Z=R;break;case 1:J=K,te=$,Z=R;break;case 2:J=R,te=$,Z=K;break;case 3:J=R,te=K,Z=$;break;case 4:J=K,te=R,Z=$;break;case 5:J=$,te=R,Z=K}return[255*J,255*te,255*Z]},v.cmyk.rgb=function(k){const _=k[0]/100,R=k[1]/100,T=k[2]/100,O=k[3]/100;return[255*(1-Math.min(1,_*(1-O)+O)),255*(1-Math.min(1,R*(1-O)+O)),255*(1-Math.min(1,T*(1-O)+O))]},v.xyz.rgb=function(k){const _=k[0]/100,R=k[1]/100,T=k[2]/100;let O,F,L;return O=3.2406*_+-1.5372*R+-.4986*T,F=-.9689*_+1.8758*R+.0415*T,L=.0557*_+-.204*R+1.057*T,O=O>.0031308?1.055*O**.4166666666666667-.055:12.92*O,F=F>.0031308?1.055*F**.4166666666666667-.055:12.92*F,L=L>.0031308?1.055*L**.4166666666666667-.055:12.92*L,O=Math.min(Math.max(0,O),1),F=Math.min(Math.max(0,F),1),L=Math.min(Math.max(0,L),1),[255*O,255*F,255*L]},v.xyz.lab=function(k){let _=k[0],R=k[1],T=k[2];return _/=95.047,R/=100,T/=108.883,_=_>.008856?_**.3333333333333333:7.787*_+.13793103448275862,R=R>.008856?R**.3333333333333333:7.787*R+.13793103448275862,T=T>.008856?T**.3333333333333333:7.787*T+.13793103448275862,[116*R-16,500*(_-R),200*(R-T)]},v.lab.xyz=function(k){let _,R,T;R=(k[0]+16)/116,_=k[1]/500+R,T=R-k[2]/200;const O=R**3,F=_**3,L=T**3;return R=O>.008856?O:(R-.13793103448275862)/7.787,_=F>.008856?F:(_-.13793103448275862)/7.787,T=L>.008856?L:(T-.13793103448275862)/7.787,_*=95.047,R*=100,T*=108.883,[_,R,T]},v.lab.lch=function(k){const _=k[0],R=k[1],T=k[2];let O;return O=360*Math.atan2(T,R)/2/Math.PI,O<0&&(O+=360),[_,Math.sqrt(R*R+T*T),O]},v.lch.lab=function(k){const _=k[0],R=k[1],T=k[2]/360*2*Math.PI;return[_,R*Math.cos(T),R*Math.sin(T)]},v.rgb.ansi16=function(k,_=null){const[R,T,O]=k;let F=_===null?v.rgb.hsv(k)[2]:_;if(F=Math.round(F/50),F===0)return 30;let L=30+(Math.round(O/255)<<2|Math.round(T/255)<<1|Math.round(R/255));return F===2&&(L+=60),L},v.hsv.ansi16=function(k){return v.rgb.ansi16(v.hsv.rgb(k),k[2])},v.rgb.ansi256=function(k){const _=k[0],R=k[1],T=k[2];return _===R&&R===T?_<8?16:_>248?231:Math.round((_-8)/247*24)+232:16+36*Math.round(_/255*5)+6*Math.round(R/255*5)+Math.round(T/255*5)},v.ansi16.rgb=function(k){let _=k%10;if(_===0||_===7)return k>50&&(_+=3.5),_=_/10.5*255,[_,_,_];const R=.5*(1+~~(k>50));return[(1&_)*R*255,(_>>1&1)*R*255,(_>>2&1)*R*255]},v.ansi256.rgb=function(k){if(k>=232){const R=10*(k-232)+8;return[R,R,R]}let _;return k-=16,[Math.floor(k/36)/5*255,Math.floor((_=k%36)/6)/5*255,_%6/5*255]},v.rgb.hex=function(k){const _=(((255&Math.round(k[0]))<<16)+((255&Math.round(k[1]))<<8)+(255&Math.round(k[2]))).toString(16).toUpperCase();return"000000".substring(_.length)+_},v.hex.rgb=function(k){const _=k.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!_)return[0,0,0];let R=_[0];_[0].length===3&&(R=R.split("").map(O=>O+O).join(""));const T=parseInt(R,16);return[T>>16&255,T>>8&255,255&T]},v.rgb.hcg=function(k){const _=k[0]/255,R=k[1]/255,T=k[2]/255,O=Math.max(Math.max(_,R),T),F=Math.min(Math.min(_,R),T),L=O-F;let $,K;return $=L<1?F/(1-L):0,K=L<=0?0:O===_?(R-T)/L%6:O===R?2+(T-_)/L:4+(_-R)/L,K/=6,K%=1,[360*K,100*L,100*$]},v.hsl.hcg=function(k){const _=k[1]/100,R=k[2]/100,T=R<.5?2*_*R:2*_*(1-R);let O=0;return T<1&&(O=(R-.5*T)/(1-T)),[k[0],100*T,100*O]},v.hsv.hcg=function(k){const _=k[1]/100,R=k[2]/100,T=_*R;let O=0;return T<1&&(O=(R-T)/(1-T)),[k[0],100*T,100*O]},v.hcg.rgb=function(k){const _=k[0]/360,R=k[1]/100,T=k[2]/100;if(R===0)return[255*T,255*T,255*T];const O=[0,0,0],F=_%1*6,L=F%1,$=1-L;let K=0;switch(Math.floor(F)){case 0:O[0]=1,O[1]=L,O[2]=0;break;case 1:O[0]=$,O[1]=1,O[2]=0;break;case 2:O[0]=0,O[1]=1,O[2]=L;break;case 3:O[0]=0,O[1]=$,O[2]=1;break;case 4:O[0]=L,O[1]=0,O[2]=1;break;default:O[0]=1,O[1]=0,O[2]=$}return K=(1-R)*T,[255*(R*O[0]+K),255*(R*O[1]+K),255*(R*O[2]+K)]},v.hcg.hsv=function(k){const _=k[1]/100,R=_+k[2]/100*(1-_);let T=0;return R>0&&(T=_/R),[k[0],100*T,100*R]},v.hcg.hsl=function(k){const _=k[1]/100,R=k[2]/100*(1-_)+.5*_;let T=0;return R>0&&R<.5?T=_/(2*R):R>=.5&&R<1&&(T=_/(2*(1-R))),[k[0],100*T,100*R]},v.hcg.hwb=function(k){const _=k[1]/100,R=_+k[2]/100*(1-_);return[k[0],100*(R-_),100*(1-R)]},v.hwb.hcg=function(k){const _=k[1]/100,R=1-k[2]/100,T=R-_;let O=0;return T<1&&(O=(R-T)/(1-T)),[k[0],100*T,100*O]},v.apple.rgb=function(k){return[k[0]/65535*255,k[1]/65535*255,k[2]/65535*255]},v.rgb.apple=function(k){return[k[0]/255*65535,k[1]/255*65535,k[2]/255*65535]},v.gray.rgb=function(k){return[k[0]/100*255,k[0]/100*255,k[0]/100*255]},v.gray.hsl=function(k){return[0,0,k[0]]},v.gray.hsv=v.gray.hsl,v.gray.hwb=function(k){return[0,100,k[0]]},v.gray.cmyk=function(k){return[0,0,0,k[0]]},v.gray.lab=function(k){return[k[0],0,0]},v.gray.hex=function(k){const _=255&Math.round(k[0]/100*255),R=((_<<16)+(_<<8)+_).toString(16).toUpperCase();return"000000".substring(R.length)+R},v.rgb.gray=function(k){return[(k[0]+k[1]+k[2])/3/255*100]}},841:(w,S,p)=>{const y=p(4959),B=p(9325),v={};Object.keys(y).forEach(k=>{v[k]={},Object.defineProperty(v[k],"channels",{value:y[k].channels}),Object.defineProperty(v[k],"labels",{value:y[k].labels});const _=B(k);Object.keys(_).forEach(R=>{const T=_[R];v[k][R]=function(O){const F=function(...L){const $=L[0];if($==null)return $;$.length>1&&(L=$);const K=O(L);if(typeof K=="object")for(let J=K.length,te=0;te<J;te++)K[te]=Math.round(K[te]);return K};return"conversion"in O&&(F.conversion=O.conversion),F}(T),v[k][R].raw=function(O){const F=function(...L){const $=L[0];return $==null?$:($.length>1&&(L=$),O(L))};return"conversion"in O&&(F.conversion=O.conversion),F}(T)})}),w.exports=v},9325:(w,S,p)=>{const y=p(4959);function B(_){const R=function(){const O={},F=Object.keys(y);for(let L=F.length,$=0;$<L;$++)O[F[$]]={distance:-1,parent:null};return O}(),T=[_];for(R[_].distance=0;T.length;){const O=T.pop(),F=Object.keys(y[O]);for(let L=F.length,$=0;$<L;$++){const K=F[$],J=R[K];J.distance===-1&&(J.distance=R[O].distance+1,J.parent=O,T.unshift(K))}}return R}function v(_,R){return function(T){return R(_(T))}}function k(_,R){const T=[R[_].parent,_];let O=y[R[_].parent][_],F=R[_].parent;for(;R[F].parent;)T.unshift(R[F].parent),O=v(y[R[F].parent][F],O),F=R[F].parent;return O.conversion=T,O}w.exports=function(_){const R=B(_),T={},O=Object.keys(R);for(let F=O.length,L=0;L<F;L++){const $=O[L];R[$].parent!==null&&(T[$]=k($,R))}return T}},1103:w=>{w.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},8603:(w,S,p)=>{p.d(S,{Z:()=>_});var y=p(1799),B=p.n(y),v=p(2609),k=p.n(v)()(B());k.push([w.id,".ck-content code{background-color:hsla(0,0%,78%,.3);border-radius:2px;padding:.15em}.ck.ck-editor__editable .ck-code_selected{background-color:hsla(0,0%,78%,.5)}","",{version:3,sources:["webpack://./../ckeditor5-basic-styles/theme/code.css"],names:[],mappings:"AAKA,iBACC,kCAAuC,CAEvC,iBAAkB,CADlB,aAED,CAEA,0CACC,kCACD",sourcesContent:[`/*
|
|
2
2
|
* Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
@@ -6512,19 +6512,19 @@ of the component, floating–point numbers have been used which, for the default
|
|
|
6512
6512
|
`],sourceRoot:""}]);const _=k},2609:w=>{w.exports=function(S){var p=[];return p.toString=function(){return this.map(function(y){var B=S(y);return y[2]?"@media ".concat(y[2]," {").concat(B,"}"):B}).join("")},p.i=function(y,B,v){typeof y=="string"&&(y=[[null,y,""]]);var k={};if(v)for(var _=0;_<this.length;_++){var R=this[_][0];R!=null&&(k[R]=!0)}for(var T=0;T<y.length;T++){var O=[].concat(y[T]);v&&k[O[0]]||(B&&(O[2]?O[2]="".concat(B," and ").concat(O[2]):O[2]=B),p.push(O))}},p}},1799:w=>{function S(y,B){return function(v){if(Array.isArray(v))return v}(y)||function(v,k){var _=v&&(typeof Symbol<"u"&&v[Symbol.iterator]||v["@@iterator"]);if(_!=null){var R,T,O=[],F=!0,L=!1;try{for(_=_.call(v);!(F=(R=_.next()).done)&&(O.push(R.value),!k||O.length!==k);F=!0);}catch($){L=!0,T=$}finally{try{F||_.return==null||_.return()}finally{if(L)throw T}}return O}}(y,B)||function(v,k){if(v){if(typeof v=="string")return p(v,k);var _=Object.prototype.toString.call(v).slice(8,-1);if(_==="Object"&&v.constructor&&(_=v.constructor.name),_==="Map"||_==="Set")return Array.from(v);if(_==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(_))return p(v,k)}}(y,B)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
6513
6513
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function p(y,B){(B==null||B>y.length)&&(B=y.length);for(var v=0,k=new Array(B);v<B;v++)k[v]=y[v];return k}w.exports=function(y){var B=S(y,4),v=B[1],k=B[3];if(!k)return v;if(typeof btoa=="function"){var _=btoa(unescape(encodeURIComponent(JSON.stringify(k)))),R="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(_),T="/*# ".concat(R," */"),O=k.sources.map(function(F){return"/*# sourceURL=".concat(k.sourceRoot||"").concat(F," */")});return[v].concat(O).concat([T]).join(`
|
|
6514
6514
|
`)}return[v].join(`
|
|
6515
|
-
`)}},6062:(w,S,p)=>{var y,B=function(){return y===void 0&&(y=!!(window&&document&&document.all&&!window.atob)),y},v=function(){var Z={};return function(ee){if(Z[ee]===void 0){var I=document.querySelector(ee);if(window.HTMLIFrameElement&&I instanceof window.HTMLIFrameElement)try{I=I.contentDocument.head}catch{I=null}Z[ee]=I}return Z[ee]}}(),k=[];function _(Z){for(var ee=-1,I=0;I<k.length;I++)if(k[I].identifier===Z){ee=I;break}return ee}function R(Z,ee){for(var I={},Q=[],_e=0;_e<Z.length;_e++){var Se=Z[_e],Te=ee.base?Se[0]+ee.base:Se[0],Ft=I[Te]||0,
|
|
6515
|
+
`)}},6062:(w,S,p)=>{var y,B=function(){return y===void 0&&(y=!!(window&&document&&document.all&&!window.atob)),y},v=function(){var Z={};return function(ee){if(Z[ee]===void 0){var I=document.querySelector(ee);if(window.HTMLIFrameElement&&I instanceof window.HTMLIFrameElement)try{I=I.contentDocument.head}catch{I=null}Z[ee]=I}return Z[ee]}}(),k=[];function _(Z){for(var ee=-1,I=0;I<k.length;I++)if(k[I].identifier===Z){ee=I;break}return ee}function R(Z,ee){for(var I={},Q=[],_e=0;_e<Z.length;_e++){var Se=Z[_e],Te=ee.base?Se[0]+ee.base:Se[0],Ft=I[Te]||0,gt="".concat(Te," ").concat(Ft);I[Te]=Ft+1;var pt=_(gt),yn={css:Se[1],media:Se[2],sourceMap:Se[3]};pt!==-1?(k[pt].references++,k[pt].updater(yn)):k.push({identifier:gt,updater:te(yn,ee),references:1}),Q.push(gt)}return Q}function T(Z){var ee=document.createElement("style"),I=Z.attributes||{};if(I.nonce===void 0){var Q=p.nc;Q&&(I.nonce=Q)}if(Object.keys(I).forEach(function(Se){ee.setAttribute(Se,I[Se])}),typeof Z.insert=="function")Z.insert(ee);else{var _e=v(Z.insert||"head");if(!_e)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");_e.appendChild(ee)}return ee}var O,F=(O=[],function(Z,ee){return O[Z]=ee,O.filter(Boolean).join(`
|
|
6516
6516
|
`)});function L(Z,ee,I,Q){var _e=I?"":Q.media?"@media ".concat(Q.media," {").concat(Q.css,"}"):Q.css;if(Z.styleSheet)Z.styleSheet.cssText=F(ee,_e);else{var Se=document.createTextNode(_e),Te=Z.childNodes;Te[ee]&&Z.removeChild(Te[ee]),Te.length?Z.insertBefore(Se,Te[ee]):Z.appendChild(Se)}}function $(Z,ee,I){var Q=I.css,_e=I.media,Se=I.sourceMap;if(_e?Z.setAttribute("media",_e):Z.removeAttribute("media"),Se&&typeof btoa<"u"&&(Q+=`
|
|
6517
|
-
/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(Se))))," */")),Z.styleSheet)Z.styleSheet.cssText=Q;else{for(;Z.firstChild;)Z.removeChild(Z.firstChild);Z.appendChild(document.createTextNode(Q))}}var K=null,J=0;function te(Z,ee){var I,Q,_e;if(ee.singleton){var Se=J++;I=K||(K=T(ee)),Q=L.bind(null,I,Se,!1),_e=L.bind(null,I,Se,!0)}else I=T(ee),Q=$.bind(null,I,ee),_e=function(){(function(Te){if(Te.parentNode===null)return!1;Te.parentNode.removeChild(Te)})(I)};return Q(Z),function(Te){if(Te){if(Te.css===Z.css&&Te.media===Z.media&&Te.sourceMap===Z.sourceMap)return;Q(Z=Te)}else _e()}}w.exports=function(Z,ee){(ee=ee||{}).singleton||typeof ee.singleton=="boolean"||(ee.singleton=B());var I=R(Z=Z||[],ee);return function(Q){if(Q=Q||[],Object.prototype.toString.call(Q)==="[object Array]"){for(var _e=0;_e<I.length;_e++){var Se=_(I[_e]);k[Se].references--}for(var Te=R(Q,ee),Ft=0;Ft<I.length;Ft++){var
|
|
6518
|
-
Read more: ${ee}#error-${o}`}function Se(o,e){const t=_e(o);return e?[o,e,t]:[o,t]}const Te="38.0.1",Ft=new Date(2023,4,23),pt=typeof window=="object"?window:D.g;if(pt.CKEDITOR_VERSION)throw new I("ckeditor-duplicated-modules",null);pt.CKEDITOR_VERSION=Te;const ft=Symbol("listeningTo"),yn=Symbol("emitterId"),xt=Symbol("delegations"),ml=me(Object);function me(o){return o?class extends o{on(e,t,n){this.listenTo(this,e,t,n)}once(e,t,n){let i=!1;this.listenTo(this,e,(r,...s)=>{i||(i=!0,r.off(),t.call(this,r,...s))},n)}off(e,t){this.stopListening(this,e,t)}listenTo(e,t,n,i={}){let r,s;this[ft]||(this[ft]={});const a=this[ft];mr(e)||gl(e);const l=mr(e);(r=a[l])||(r=a[l]={emitter:e,callbacks:{}}),(s=r.callbacks[t])||(s=r.callbacks[t]=[]),s.push(n),function(c,d,u,g,f){d._addEventListener?d._addEventListener(u,g,f):c._addEventListener.call(d,u,g,f)}(this,e,t,n,i)}stopListening(e,t,n){const i=this[ft];let r=e&&mr(e);const s=i&&r?i[r]:void 0,a=s&&t?s.callbacks[t]:void 0;if(!(!i||e&&!s||t&&!a))if(n)pr(this,e,t,n),a.indexOf(n)!==-1&&(a.length===1?delete s.callbacks[t]:pr(this,e,t,n));else if(a){for(;n=a.pop();)pr(this,e,t,n);delete s.callbacks[t]}else if(s){for(t in s.callbacks)this.stopListening(e,t);delete i[r]}else{for(r in i)this.stopListening(i[r].emitter);delete this[ft]}}fire(e,...t){try{const n=e instanceof $?e:new $(this,e),i=n.name;let r=fl(this,i);if(n.path.push(this),r){const a=[n,...t];r=Array.from(r);for(let l=0;l<r.length&&(r[l].callback.apply(this,a),n.off.called&&(delete n.off.called,this._removeEventListener(i,r[l].callback)),!n.stop.called);l++);}const s=this[xt];if(s){const a=s.get(i),l=s.get("*");a&&kl(a,n,t),l&&kl(l,n,t)}return n.return}catch(n){I.rethrowUnexpectedError(n,this)}}delegate(...e){return{to:(t,n)=>{this[xt]||(this[xt]=new Map),e.forEach(i=>{const r=this[xt].get(i);r?r.set(t,n):this[xt].set(i,new Map([[t,n]]))})}}}stopDelegating(e,t){if(this[xt])if(e)if(t){const n=this[xt].get(e);n&&n.delete(t)}else this[xt].delete(e);else this[xt].clear()}_addEventListener(e,t,n){(function(s,a){const l=pl(s);if(l[a])return;let c=a,d=null;const u=[];for(;c!==""&&!l[c];)l[c]={callbacks:[],childEvents:[]},u.push(l[c]),d&&l[c].childEvents.push(d),d=c,c=c.substr(0,c.lastIndexOf(":"));if(c!==""){for(const g of u)g.callbacks=l[c].callbacks.slice();l[c].childEvents.push(d)}})(this,e);const i=gr(this,e),r={callback:t,priority:te.get(n.priority)};for(const s of i)Z(s,r)}_removeEventListener(e,t){const n=gr(this,e);for(const i of n)for(let r=0;r<i.length;r++)i[r].callback==t&&(i.splice(r,1),r--)}}:ml}function gl(o,e){o[yn]||(o[yn]=e||J())}function mr(o){return o[yn]}function pl(o){return o._events||Object.defineProperty(o,"_events",{value:{}}),o._events}function gr(o,e){const t=pl(o)[e];if(!t)return[];let n=[t.callbacks];for(let i=0;i<t.childEvents.length;i++){const r=gr(o,t.childEvents[i]);n=n.concat(r)}return n}function fl(o,e){let t;return o._events&&(t=o._events[e])&&t.callbacks.length?t.callbacks:e.indexOf(":")>-1?fl(o,e.substr(0,e.lastIndexOf(":"))):null}function kl(o,e,t){for(let[n,i]of o){i?typeof i=="function"&&(i=i(e.name)):i=e.name;const r=new $(e.source,i);r.path=[...e.path],n.fire(r,...t)}}function pr(o,e,t,n){e._removeEventListener?e._removeEventListener(t,n):o._removeEventListener.call(e,t,n)}["on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(o=>{me[o]=ml.prototype[o]});const xe=function(o){var e=typeof o;return o!=null&&(e=="object"||e=="function")},Ko=Symbol("observableProperties"),Go=Symbol("boundObservables"),Zo=Symbol("boundProperties"),En=Symbol("decoratedMethods"),bl=Symbol("decoratedOriginal"),wl=ge(me());function ge(o){return o?class extends o{set(e,t){if(xe(e))return void Object.keys(e).forEach(i=>{this.set(i,e[i])},this);fr(this);const n=this[Ko];if(e in this&&!n.has(e))throw new I("observable-set-cannot-override",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>n.get(e),set(i){const r=n.get(e);let s=this.fire(`set:${e}`,e,i,r);s===void 0&&(s=i),r===s&&n.has(e)||(n.set(e,s),this.fire(`change:${e}`,e,s,r))}}),this[e]=t}bind(...e){if(!e.length||!Al(e))throw new I("observable-bind-wrong-properties",this);if(new Set(e).size!==e.length)throw new I("observable-bind-duplicate-properties",this);fr(this);const t=this[Zo];e.forEach(i=>{if(t.has(i))throw new I("observable-bind-rebind",this)});const n=new Map;return e.forEach(i=>{const r={property:i,to:[]};t.set(i,r),n.set(i,r)}),{to:D0,toMany:B0,_observable:this,_bindProperties:e,_to:[],_bindings:n}}unbind(...e){if(!this[Ko])return;const t=this[Zo],n=this[Go];if(e.length){if(!Al(e))throw new I("observable-unbind-wrong-properties",this);e.forEach(i=>{const r=t.get(i);r&&(r.to.forEach(([s,a])=>{const l=n.get(s),c=l[a];c.delete(r),c.size||delete l[a],Object.keys(l).length||(n.delete(s),this.stopListening(s,"change"))}),t.delete(i))})}else n.forEach((i,r)=>{this.stopListening(r,"change")}),n.clear(),t.clear()}decorate(e){fr(this);const t=this[e];if(!t)throw new I("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:e});this.on(e,(n,i)=>{n.return=t.apply(this,i)}),this[e]=function(...n){return this.fire(e,n)},this[e][bl]=t,this[En]||(this[En]=[]),this[En].push(e)}stopListening(e,t,n){if(!e&&this[En]){for(const i of this[En])this[i]=this[i][bl];delete this[En]}super.stopListening(e,t,n)}}:wl}function fr(o){o[Ko]||(Object.defineProperty(o,Ko,{value:new Map}),Object.defineProperty(o,Go,{value:new Map}),Object.defineProperty(o,Zo,{value:new Map}))}function D0(...o){const e=function(...r){if(!r.length)throw new I("observable-bind-to-parse-error",null);const s={to:[]};let a;return typeof r[r.length-1]=="function"&&(s.callback=r.pop()),r.forEach(l=>{if(typeof l=="string")a.properties.push(l);else{if(typeof l!="object")throw new I("observable-bind-to-parse-error",null);a={observable:l,properties:[]},s.to.push(a)}}),s}(...o),t=Array.from(this._bindings.keys()),n=t.length;if(!e.callback&&e.to.length>1)throw new I("observable-bind-to-no-callback",this);if(n>1&&e.callback)throw new I("observable-bind-to-extra-callback",this);var i;e.to.forEach(r=>{if(r.properties.length&&r.properties.length!==n)throw new I("observable-bind-to-properties-length",this);r.properties.length||(r.properties=this._bindProperties)}),this._to=e.to,e.callback&&(this._bindings.get(t[0]).callback=e.callback),i=this._observable,this._to.forEach(r=>{const s=i[Go];let a;s.get(r.observable)||i.listenTo(r.observable,"change",(l,c)=>{a=s.get(r.observable)[c],a&&a.forEach(d=>{_l(i,d.property)})})}),function(r){let s;r._bindings.forEach((a,l)=>{r._to.forEach(c=>{s=c.properties[a.callback?0:r._bindProperties.indexOf(l)],a.to.push([c.observable,s]),function(d,u,g,f){const b=d[Go],A=b.get(g),E=A||{};E[f]||(E[f]=new Set),E[f].add(u),A||b.set(g,E)}(r._observable,a,c.observable,s)})})}(this),this._bindProperties.forEach(r=>{_l(this._observable,r)})}function B0(o,e,t){if(this._bindings.size>1)throw new I("observable-bind-to-many-not-one-binding",this);this.to(...function(n,i){const r=n.map(s=>[s,i]);return Array.prototype.concat.apply([],r)}(o,e),t)}function Al(o){return o.every(e=>typeof e=="string")}function _l(o,e){const t=o[Zo].get(e);let n;t.callback?n=t.callback.apply(o,t.to.map(i=>i[0][i[1]])):(n=t.to[0],n=n[0][n[1]]),Object.prototype.hasOwnProperty.call(o,e)?o[e]=n:o.set(e,n)}["set","bind","unbind","decorate","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(o=>{ge[o]=wl.prototype[o]});class Cl{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=[]}}function kr(o){let e=0;for(const t of o)e++;return e}function Ue(o,e){const t=Math.min(o.length,e.length);for(let n=0;n<t;n++)if(o[n]!=e[n])return n;return o.length==e.length?"same":o.length<e.length?"prefix":"extension"}function Xe(o){return!(!o||!o[Symbol.iterator])}const vl=typeof Uo=="object"&&Uo&&Uo.Object===Object&&Uo;var T0=typeof self=="object"&&self&&self.Object===Object&&self;const dt=vl||T0||Function("return this")(),kt=dt.Symbol;var yl=Object.prototype,I0=yl.hasOwnProperty,P0=yl.toString,ao=kt?kt.toStringTag:void 0;const R0=function(o){var e=I0.call(o,ao),t=o[ao];try{o[ao]=void 0;var n=!0}catch{}var i=P0.call(o);return n&&(e?o[ao]=t:delete o[ao]),i};var O0=Object.prototype.toString;const N0=function(o){return O0.call(o)};var El=kt?kt.toStringTag:void 0;const Vt=function(o){return o==null?o===void 0?"[object Undefined]":"[object Null]":El&&El in Object(o)?R0(o):N0(o)},We=Array.isArray,st=function(o){return o!=null&&typeof o=="object"},xl=function(o){return typeof o=="string"||!We(o)&&st(o)&&Vt(o)=="[object String]"};function br(o,e,t={},n=[]){const i=t&&t.xmlns,r=i?o.createElementNS(i,e):o.createElement(e);for(const s in t)r.setAttribute(s,t[s]);!xl(n)&&Xe(n)||(n=[n]);for(let s of n)xl(s)&&(s=o.createTextNode(s)),r.appendChild(s);return r}const Sl=function(o,e){return function(t){return o(e(t))}},wr=Sl(Object.getPrototypeOf,Object);var z0=Function.prototype,M0=Object.prototype,Dl=z0.toString,F0=M0.hasOwnProperty,V0=Dl.call(Object);const Ke=function(o){if(!st(o)||Vt(o)!="[object Object]")return!1;var e=wr(o);if(e===null)return!0;var t=F0.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Dl.call(t)==V0},L0=function(){this.__data__=[],this.size=0},lo=function(o,e){return o===e||o!=o&&e!=e},Jo=function(o,e){for(var t=o.length;t--;)if(lo(o[t][0],e))return t;return-1};var j0=Array.prototype.splice;const $0=function(o){var e=this.__data__,t=Jo(e,o);return!(t<0)&&(t==e.length-1?e.pop():j0.call(e,t,1),--this.size,!0)},H0=function(o){var e=this.__data__,t=Jo(e,o);return t<0?void 0:e[t][1]},q0=function(o){return Jo(this.__data__,o)>-1},U0=function(o,e){var t=this.__data__,n=Jo(t,o);return n<0?(++this.size,t.push([o,e])):t[n][1]=e,this};function xn(o){var e=-1,t=o==null?0:o.length;for(this.clear();++e<t;){var n=o[e];this.set(n[0],n[1])}}xn.prototype.clear=L0,xn.prototype.delete=$0,xn.prototype.get=H0,xn.prototype.has=q0,xn.prototype.set=U0;const Yo=xn,W0=function(){this.__data__=new Yo,this.size=0},K0=function(o){var e=this.__data__,t=e.delete(o);return this.size=e.size,t},G0=function(o){return this.__data__.get(o)},Z0=function(o){return this.__data__.has(o)},Qt=function(o){if(!xe(o))return!1;var e=Vt(o);return e=="[object Function]"||e=="[object GeneratorFunction]"||e=="[object AsyncFunction]"||e=="[object Proxy]"},Ar=dt["__core-js_shared__"];var Bl=function(){var o=/[^.]+$/.exec(Ar&&Ar.keys&&Ar.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}();const J0=function(o){return!!Bl&&Bl in o};var Y0=Function.prototype.toString;const Xt=function(o){if(o!=null){try{return Y0.call(o)}catch{}try{return o+""}catch{}}return""};var Q0=/^\[object .+?Constructor\]$/,X0=Function.prototype,e_=Object.prototype,t_=X0.toString,n_=e_.hasOwnProperty,o_=RegExp("^"+t_.call(n_).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const i_=function(o){return!(!xe(o)||J0(o))&&(Qt(o)?o_:Q0).test(Xt(o))},r_=function(o,e){return o==null?void 0:o[e]},en=function(o,e){var t=r_(o,e);return i_(t)?t:void 0},co=en(dt,"Map"),ho=en(Object,"create"),s_=function(){this.__data__=ho?ho(null):{},this.size=0},a_=function(o){var e=this.has(o)&&delete this.__data__[o];return this.size-=e?1:0,e};var l_=Object.prototype.hasOwnProperty;const c_=function(o){var e=this.__data__;if(ho){var t=e[o];return t==="__lodash_hash_undefined__"?void 0:t}return l_.call(e,o)?e[o]:void 0};var d_=Object.prototype.hasOwnProperty;const h_=function(o){var e=this.__data__;return ho?e[o]!==void 0:d_.call(e,o)},u_=function(o,e){var t=this.__data__;return this.size+=this.has(o)?0:1,t[o]=ho&&e===void 0?"__lodash_hash_undefined__":e,this};function Sn(o){var e=-1,t=o==null?0:o.length;for(this.clear();++e<t;){var n=o[e];this.set(n[0],n[1])}}Sn.prototype.clear=s_,Sn.prototype.delete=a_,Sn.prototype.get=c_,Sn.prototype.has=h_,Sn.prototype.set=u_;const Tl=Sn,m_=function(){this.size=0,this.__data__={hash:new Tl,map:new(co||Yo),string:new Tl}},g_=function(o){var e=typeof o;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?o!=="__proto__":o===null},Qo=function(o,e){var t=o.__data__;return g_(e)?t[typeof e=="string"?"string":"hash"]:t.map},p_=function(o){var e=Qo(this,o).delete(o);return this.size-=e?1:0,e},f_=function(o){return Qo(this,o).get(o)},k_=function(o){return Qo(this,o).has(o)},b_=function(o,e){var t=Qo(this,o),n=t.size;return t.set(o,e),this.size+=t.size==n?0:1,this};function Dn(o){var e=-1,t=o==null?0:o.length;for(this.clear();++e<t;){var n=o[e];this.set(n[0],n[1])}}Dn.prototype.clear=m_,Dn.prototype.delete=p_,Dn.prototype.get=f_,Dn.prototype.has=k_,Dn.prototype.set=b_;const Xo=Dn,w_=function(o,e){var t=this.__data__;if(t instanceof Yo){var n=t.__data__;if(!co||n.length<199)return n.push([o,e]),this.size=++t.size,this;t=this.__data__=new Xo(n)}return t.set(o,e),this.size=t.size,this};function Bn(o){var e=this.__data__=new Yo(o);this.size=e.size}Bn.prototype.clear=W0,Bn.prototype.delete=K0,Bn.prototype.get=G0,Bn.prototype.has=Z0,Bn.prototype.set=w_;const uo=Bn,A_=function(o,e){for(var t=-1,n=o==null?0:o.length;++t<n&&e(o[t],t,o)!==!1;);return o},ei=function(){try{var o=en(Object,"defineProperty");return o({},"",{}),o}catch{}}(),_r=function(o,e,t){e=="__proto__"&&ei?ei(o,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):o[e]=t};var __=Object.prototype.hasOwnProperty;const Cr=function(o,e,t){var n=o[e];__.call(o,e)&&lo(n,t)&&(t!==void 0||e in o)||_r(o,e,t)},Tn=function(o,e,t,n){var i=!t;t||(t={});for(var r=-1,s=e.length;++r<s;){var a=e[r],l=void 0;l===void 0&&(l=o[a]),i?_r(t,a,l):Cr(t,a,l)}return t},C_=function(o,e){for(var t=-1,n=Array(o);++t<o;)n[t]=e(t);return n},Il=function(o){return st(o)&&Vt(o)=="[object Arguments]"};var Pl=Object.prototype,v_=Pl.hasOwnProperty,y_=Pl.propertyIsEnumerable;const vr=Il(function(){return arguments}())?Il:function(o){return st(o)&&v_.call(o,"callee")&&!y_.call(o,"callee")},E_=function(){return!1};var Rl=x&&!x.nodeType&&x,Ol=Rl&&!0&&m&&!m.nodeType&&m,Nl=Ol&&Ol.exports===Rl?dt.Buffer:void 0;const mo=(Nl?Nl.isBuffer:void 0)||E_;var x_=/^(?:0|[1-9]\d*)$/;const yr=function(o,e){var t=typeof o;return!!(e=e??9007199254740991)&&(t=="number"||t!="symbol"&&x_.test(o))&&o>-1&&o%1==0&&o<e},zl=function(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=9007199254740991};var 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;const S_=function(o){return st(o)&&zl(o.length)&&!!ye[Vt(o)]},Er=function(o){return function(e){return o(e)}};var Ml=x&&!x.nodeType&&x,go=Ml&&!0&&m&&!m.nodeType&&m,xr=go&&go.exports===Ml&&vl.process;const In=function(){try{var o=go&&go.require&&go.require("util").types;return o||xr&&xr.binding&&xr.binding("util")}catch{}}();var Fl=In&&In.isTypedArray;const Sr=Fl?Er(Fl):S_;var D_=Object.prototype.hasOwnProperty;const Vl=function(o,e){var t=We(o),n=!t&&vr(o),i=!t&&!n&&mo(o),r=!t&&!n&&!i&&Sr(o),s=t||n||i||r,a=s?C_(o.length,String):[],l=a.length;for(var c in o)!e&&!D_.call(o,c)||s&&(c=="length"||i&&(c=="offset"||c=="parent")||r&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||yr(c,l))||a.push(c);return a};var B_=Object.prototype;const Dr=function(o){var e=o&&o.constructor;return o===(typeof e=="function"&&e.prototype||B_)},T_=Sl(Object.keys,Object);var I_=Object.prototype.hasOwnProperty;const P_=function(o){if(!Dr(o))return T_(o);var e=[];for(var t in Object(o))I_.call(o,t)&&t!="constructor"&&e.push(t);return e},ti=function(o){return o!=null&&zl(o.length)&&!Qt(o)},Br=function(o){return ti(o)?Vl(o):P_(o)},R_=function(o,e){return o&&Tn(e,Br(e),o)},O_=function(o){var e=[];if(o!=null)for(var t in Object(o))e.push(t);return e};var N_=Object.prototype.hasOwnProperty;const z_=function(o){if(!xe(o))return O_(o);var e=Dr(o),t=[];for(var n in o)(n!="constructor"||!e&&N_.call(o,n))&&t.push(n);return t},Pn=function(o){return ti(o)?Vl(o,!0):z_(o)},M_=function(o,e){return o&&Tn(e,Pn(e),o)};var Ll=x&&!x.nodeType&&x,jl=Ll&&!0&&m&&!m.nodeType&&m,$l=jl&&jl.exports===Ll?dt.Buffer:void 0,Hl=$l?$l.allocUnsafe:void 0;const ql=function(o,e){if(e)return o.slice();var t=o.length,n=Hl?Hl(t):new o.constructor(t);return o.copy(n),n},Tr=function(o,e){var t=-1,n=o.length;for(e||(e=Array(n));++t<n;)e[t]=o[t];return e},F_=function(o,e){for(var t=-1,n=o==null?0:o.length,i=0,r=[];++t<n;){var s=o[t];e(s,t,o)&&(r[i++]=s)}return r},Ul=function(){return[]};var V_=Object.prototype.propertyIsEnumerable,Wl=Object.getOwnPropertySymbols;const Ir=Wl?function(o){return o==null?[]:(o=Object(o),F_(Wl(o),function(e){return V_.call(o,e)}))}:Ul,L_=function(o,e){return Tn(o,Ir(o),e)},Kl=function(o,e){for(var t=-1,n=e.length,i=o.length;++t<n;)o[i+t]=e[t];return o},Gl=Object.getOwnPropertySymbols?function(o){for(var e=[];o;)Kl(e,Ir(o)),o=wr(o);return e}:Ul,j_=function(o,e){return Tn(o,Gl(o),e)},Zl=function(o,e,t){var n=e(o);return We(o)?n:Kl(n,t(o))},Pr=function(o){return Zl(o,Br,Ir)},$_=function(o){return Zl(o,Pn,Gl)},Rr=en(dt,"DataView"),Or=en(dt,"Promise"),Nr=en(dt,"Set"),zr=en(dt,"WeakMap");var Jl="[object Map]",Yl="[object Promise]",Ql="[object Set]",Xl="[object WeakMap]",ec="[object DataView]",H_=Xt(Rr),q_=Xt(co),U_=Xt(Or),W_=Xt(Nr),K_=Xt(zr),tn=Vt;(Rr&&tn(new Rr(new ArrayBuffer(1)))!=ec||co&&tn(new co)!=Jl||Or&&tn(Or.resolve())!=Yl||Nr&&tn(new Nr)!=Ql||zr&&tn(new zr)!=Xl)&&(tn=function(o){var e=Vt(o),t=e=="[object Object]"?o.constructor:void 0,n=t?Xt(t):"";if(n)switch(n){case H_:return ec;case q_:return Jl;case U_:return Yl;case W_:return Ql;case K_:return Xl}return e});const po=tn;var G_=Object.prototype.hasOwnProperty;const Z_=function(o){var e=o.length,t=new o.constructor(e);return e&&typeof o[0]=="string"&&G_.call(o,"index")&&(t.index=o.index,t.input=o.input),t},ni=dt.Uint8Array,Mr=function(o){var e=new o.constructor(o.byteLength);return new ni(e).set(new ni(o)),e},J_=function(o,e){var t=e?Mr(o.buffer):o.buffer;return new o.constructor(t,o.byteOffset,o.byteLength)};var Y_=/\w*$/;const Q_=function(o){var e=new o.constructor(o.source,Y_.exec(o));return e.lastIndex=o.lastIndex,e};var tc=kt?kt.prototype:void 0,nc=tc?tc.valueOf:void 0;const X_=function(o){return nc?Object(nc.call(o)):{}},oc=function(o,e){var t=e?Mr(o.buffer):o.buffer;return new o.constructor(t,o.byteOffset,o.length)},eC=function(o,e,t){var n=o.constructor;switch(e){case"[object ArrayBuffer]":return Mr(o);case"[object Boolean]":case"[object Date]":return new n(+o);case"[object DataView]":return J_(o,t);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 oc(o,t);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(o);case"[object RegExp]":return Q_(o);case"[object Symbol]":return X_(o)}};var ic=Object.create;const tC=function(){function o(){}return function(e){if(!xe(e))return{};if(ic)return ic(e);o.prototype=e;var t=new o;return o.prototype=void 0,t}}(),rc=function(o){return typeof o.constructor!="function"||Dr(o)?{}:tC(wr(o))},nC=function(o){return st(o)&&po(o)=="[object Map]"};var sc=In&&In.isMap;const oC=sc?Er(sc):nC,iC=function(o){return st(o)&&po(o)=="[object Set]"};var ac=In&&In.isSet;const rC=ac?Er(ac):iC;var lc="[object Arguments]",cc="[object Function]",dc="[object Object]",Ce={};Ce[lc]=Ce["[object Array]"]=Ce["[object ArrayBuffer]"]=Ce["[object DataView]"]=Ce["[object Boolean]"]=Ce["[object Date]"]=Ce["[object Float32Array]"]=Ce["[object Float64Array]"]=Ce["[object Int8Array]"]=Ce["[object Int16Array]"]=Ce["[object Int32Array]"]=Ce["[object Map]"]=Ce["[object Number]"]=Ce[dc]=Ce["[object RegExp]"]=Ce["[object Set]"]=Ce["[object String]"]=Ce["[object Symbol]"]=Ce["[object Uint8Array]"]=Ce["[object Uint8ClampedArray]"]=Ce["[object Uint16Array]"]=Ce["[object Uint32Array]"]=!0,Ce["[object Error]"]=Ce[cc]=Ce["[object WeakMap]"]=!1;const Fr=function o(e,t,n,i,r,s){var a,l=1&t,c=2&t,d=4&t;if(n&&(a=r?n(e,i,r,s):n(e)),a!==void 0)return a;if(!xe(e))return e;var u=We(e);if(u){if(a=Z_(e),!l)return Tr(e,a)}else{var g=po(e),f=g==cc||g=="[object GeneratorFunction]";if(mo(e))return ql(e,l);if(g==dc||g==lc||f&&!r){if(a=c||f?{}:rc(e),!l)return c?j_(e,M_(a,e)):L_(e,R_(a,e))}else{if(!Ce[g])return r?e:{};a=eC(e,g,l)}}s||(s=new uo);var b=s.get(e);if(b)return b;s.set(e,a),rC(e)?e.forEach(function(E){a.add(o(E,t,n,E,e,s))}):oC(e)&&e.forEach(function(E,P){a.set(P,o(E,t,n,P,e,s))});var A=u?void 0:(d?c?$_:Pr:c?Pn:Br)(e);return A_(A||e,function(E,P){A&&(E=e[P=E]),Cr(a,P,o(E,t,n,P,e,s))}),a},Vr=function(o,e){return Fr(o,5,e=typeof e=="function"?e:void 0)},Rn=function(o){return st(o)&&o.nodeType===1&&!Ke(o)};class hc{constructor(e,t){this._config={},t&&this.define(uc(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,n,i=!1){if(Ke(t))return void this._setObjectToTarget(e,t,i);const r=t.split(".");t=r.pop();for(const s of r)Ke(e[s])||(e[s]={}),e=e[s];if(Ke(n))return Ke(e[t])||(e[t]={}),e=e[t],void this._setObjectToTarget(e,n,i);i&&e[t]!==void 0||(e[t]=n)}_getFromSource(e,t){const n=t.split(".");t=n.pop();for(const i of n){if(!Ke(e[i])){e=null;break}e=e[i]}return e?uc(e[t]):void 0}_setObjectToTarget(e,t,n){Object.keys(t).forEach(i=>{this._setToTarget(e,i,t[i],n)})}}function uc(o){return Vr(o,sC)}function sC(o){return Rn(o)?o:void 0}function Lt(o){if(o){if(o.defaultView)return o instanceof o.defaultView.Document;if(o.ownerDocument&&o.ownerDocument.defaultView)return o instanceof o.ownerDocument.defaultView.Node}return!1}function oi(o){const e=Object.prototype.toString.apply(o);return e=="[object Window]"||e=="[object global]"}const mc=jt(me());function jt(o){return o?class extends o{listenTo(e,t,n,i={}){if(Lt(e)||oi(e)){const r={capture:!!i.useCapture,passive:!!i.usePassive},s=this._getProxyEmitter(e,r)||new aC(e,r);this.listenTo(s,t,n,i)}else super.listenTo(e,t,n,i)}stopListening(e,t,n){if(Lt(e)||oi(e)){const i=this._getAllProxyEmitters(e);for(const r of i)this.stopListening(r,t,n)}else super.stopListening(e,t,n)}_getProxyEmitter(e,t){return function(n,i){const r=n[ft];return r&&r[i]?r[i].emitter:null}(this,gc(e,t))}_getAllProxyEmitters(e){return[{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map(t=>this._getProxyEmitter(e,t)).filter(t=>!!t)}}:mc}["_getProxyEmitter","_getAllProxyEmitters","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(o=>{jt[o]=mc.prototype[o]});class aC extends me(){constructor(e,t){super(),gl(this,gc(e,t)),this._domNode=e,this._options=t}attach(e){if(this._domListeners&&this._domListeners[e])return;const t=this._createDomListener(e);this._domNode.addEventListener(e,t,this._options),this._domListeners||(this._domListeners={}),this._domListeners[e]=t}detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener()}_addEventListener(e,t,n){this.attach(e),me().prototype._addEventListener.call(this,e,t,n)}_removeEventListener(e,t){me().prototype._removeEventListener.call(this,e,t),this.detach(e)}_createDomListener(e){const t=n=>{this.fire(e,n)};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,this._options),delete this._domListeners[e]},t}}function gc(o,e){let t=function(n){return n["data-ck-expando"]||(n["data-ck-expando"]=J())}(o);for(const n of Object.keys(e).sort())e[n]&&(t+="-"+n);return t}let Lr;try{Lr={window,document}}catch{Lr={window:{},document:{}}}const oe=Lr;function pc(o){const e=[];let t=o;for(;t&&t.nodeType!=Node.DOCUMENT_NODE;)e.unshift(t),t=t.parentNode;return e}function Ie(o){return Object.prototype.toString.call(o)=="[object Text]"}function ii(o){return Object.prototype.toString.apply(o)=="[object Range]"}function fc(o){const e=o.ownerDocument.defaultView.getComputedStyle(o);return{top:parseInt(e.borderTopWidth,10),right:parseInt(e.borderRightWidth,10),bottom:parseInt(e.borderBottomWidth,10),left:parseInt(e.borderLeftWidth,10)}}const kc=["top","right","bottom","left","width","height"];class De{constructor(e){const t=ii(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),wc(e)||t)if(t){const n=De.getDomRangeRects(e);ri(this,De.getBoundingRect(n))}else ri(this,e.getBoundingClientRect());else if(oi(e)){const{innerWidth:n,innerHeight:i}=e;ri(this,{top:0,right:n,bottom:i,left:0,width:n,height:i})}else ri(this,e)}clone(){return new De(this)}moveTo(e,t){return this.top=t,this.right=e+this.width,this.bottom=t+this.height,this.left=e,this}moveBy(e,t){return this.top+=t,this.right+=e,this.left+=e,this.bottom+=t,this}getIntersection(e){const t={top:Math.max(this.top,e.top),right:Math.min(this.right,e.right),bottom:Math.min(this.bottom,e.bottom),left:Math.max(this.left,e.left),width:0,height:0};return t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0?null:new De(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(!bc(e)){let n=e.parentNode||e.commonAncestorContainer;for(;n&&!bc(n);){const i=new De(n),r=t.getIntersection(i);if(!r)return null;r.getArea()<t.getArea()&&(t=r),n=n.parentNode}}return t}isEqual(e){for(const t of kc)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,n,i;if(oi(e))t=e.innerWidth-e.document.documentElement.clientWidth,n=e.innerHeight-e.document.documentElement.clientHeight,i=e.getComputedStyle(e.document.documentElement).direction;else{const r=fc(e);t=e.offsetWidth-e.clientWidth-r.left-r.right,n=e.offsetHeight-e.clientHeight-r.top-r.bottom,i=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=r.left,this.top+=r.top,this.right-=r.right,this.bottom-=r.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=t,i==="ltr"?this.right-=t:this.left+=t,this.height-=n,this.bottom-=n,this}static getDomRangeRects(e){const t=[],n=Array.from(e.getClientRects());if(n.length)for(const i of n)t.push(new De(i));else{let i=e.startContainer;Ie(i)&&(i=i.parentNode);const r=new De(i.getBoundingClientRect());r.right=r.left,r.width=0,t.push(r)}return t}static getBoundingRect(e){const t={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,width:0,height:0};let n=0;for(const i of e)n++,t.left=Math.min(t.left,i.left),t.top=Math.min(t.top,i.top),t.right=Math.max(t.right,i.right),t.bottom=Math.max(t.bottom,i.bottom);return n==0?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new De(t))}}function ri(o,e){for(const t of kc)o[t]=e[t]}function bc(o){return!!wc(o)&&o===o.ownerDocument.body}function wc(o){return o!==null&&typeof o=="object"&&o.nodeType===1&&typeof o.getBoundingClientRect=="function"}const Ne=class{constructor(o,e){Ne._observerInstance||Ne._createObserver(),this._element=o,this._callback=e,Ne._addElementCallback(o,e),Ne._observerInstance.observe(o)}destroy(){Ne._deleteElementCallback(this._element,this._callback)}static _addElementCallback(o,e){Ne._elementCallbacks||(Ne._elementCallbacks=new Map);let t=Ne._elementCallbacks.get(o);t||(t=new Set,Ne._elementCallbacks.set(o,t)),t.add(e)}static _deleteElementCallback(o,e){const t=Ne._getElementCallbacks(o);t&&(t.delete(e),t.size||(Ne._elementCallbacks.delete(o),Ne._observerInstance.unobserve(o))),Ne._elementCallbacks&&!Ne._elementCallbacks.size&&(Ne._observerInstance=null,Ne._elementCallbacks=null)}static _getElementCallbacks(o){return Ne._elementCallbacks?Ne._elementCallbacks.get(o):null}static _createObserver(){Ne._observerInstance=new oe.window.ResizeObserver(o=>{for(const e of o){const t=Ne._getElementCallbacks(e.target);if(t)for(const n of t)n(e)}})}};let si=Ne;function lC(o,e){o instanceof HTMLTextAreaElement&&(o.value=e),o.innerHTML=e}function jr(o){return e=>e+o}function ai(o){let e=0;for(;o.previousSibling;)o=o.previousSibling,e++;return e}function Ac(o,e,t){o.insertBefore(t,o.childNodes[e]||null)}function On(o){return o&&o.nodeType===Node.COMMENT_NODE}function _c(o){try{oe.document.createAttribute(o)}catch{return!1}return!0}function nn(o){return!!(o&&o.getClientRects&&o.getClientRects().length)}si._observerInstance=null,si._elementCallbacks=null;var Cc=Math.pow;function vc({element:o,target:e,positions:t,limiter:n,fitInViewport:i,viewportOffsetConfig:r}){Qt(e)&&(e=e()),Qt(n)&&(n=n());const s=function(g){return g&&g.parentNode?g.offsetParent===oe.document.body?null:g.offsetParent:null}(o),a=new De(o),l=new De(e);let c;const d=i&&function(g){g=Object.assign({top:0,bottom:0,left:0,right:0},g);const f=new De(oe.window);return f.top+=g.top,f.height-=g.top,f.bottom-=g.bottom,f.height-=g.bottom,f}(r)||null,u={targetRect:l,elementRect:a,positionedElementAncestor:s,viewportRect:d};if(n||i){const g=n&&new De(n).getVisible();Object.assign(u,{limiterRect:g,viewportRect:d}),c=function(f,b){const{elementRect:A}=b,E=A.getArea(),P=f.map(Y=>new $r(Y,b)).filter(Y=>!!Y.name);let z=0,j=null;for(const Y of P){const{limiterIntersectionArea:ie,viewportIntersectionArea:Ee}=Y;if(ie===E)return Y;const he=Cc(Ee,2)+Cc(ie,2);he>z&&(z=he,j=Y)}return j}(t,u)||new $r(t[0],u)}else c=new $r(t[0],u);return c}function yc(o){const{scrollX:e,scrollY:t}=oe.window;return o.clone().moveBy(e,t)}class $r{constructor(e,t){const n=e(t.targetRect,t.elementRect,t.viewportRect);if(!n)return;const{left:i,top:r,name:s,config:a}=n;this.name=s,this.config=a,this._positioningFunctionCorrdinates={left:i,top:r},this._options=t}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get limiterIntersectionArea(){const e=this._options.limiterRect;if(e){const t=this._options.viewportRect;if(!t)return e.getIntersectionArea(this._rect);{const n=e.getIntersection(t);if(n)return n.getIntersectionArea(this._rect)}}return 0}get viewportIntersectionArea(){const e=this._options.viewportRect;return e?e.getIntersectionArea(this._rect):0}get _rect(){return this._cachedRect||(this._cachedRect=this._options.elementRect.clone().moveTo(this._positioningFunctionCorrdinates.left,this._positioningFunctionCorrdinates.top)),this._cachedRect}get _absoluteRect(){return this._cachedAbsoluteRect||(this._cachedAbsoluteRect=yc(this._rect),this._options.positionedElementAncestor&&function(e,t){const n=yc(new De(t)),i=fc(t);let r=0,s=0;r-=n.left,s-=n.top,r+=t.scrollLeft,s+=t.scrollTop,r-=i.left,s-=i.top,e.moveBy(r,s)}(this._cachedAbsoluteRect,this._options.positionedElementAncestor)),this._cachedAbsoluteRect}}function Ec(o){const e=o.parentNode;e&&e.removeChild(o)}function cC({window:o,rect:e,alignToTop:t,forceScroll:n,viewportOffset:i}){const r=e.clone().moveBy(0,i),s=e.clone().moveBy(0,-i),a=new De(o).excludeScrollbarsAndBorders(),l=t&&n,c=[s,r].every(b=>a.contains(b));let{scrollX:d,scrollY:u}=o;const g=d,f=u;l?u-=a.top-e.top+i:c||(Sc(s,a)?u-=a.top-e.top+i:xc(r,a)&&(u+=t?e.top-a.top-i:e.bottom-a.bottom+i)),c||(Dc(e,a)?d-=a.left-e.left+i:Bc(e,a)&&(d+=e.right-a.right+i)),d==g&&u===f||o.scrollTo(d,u)}function dC({parent:o,getRect:e,alignToTop:t,forceScroll:n,ancestorOffset:i=0}){const r=Hr(o),s=t&&n;let a,l,c;for(;o!=r.document.body;)l=e(),a=new De(o).excludeScrollbarsAndBorders(),c=a.contains(l),s?o.scrollTop-=a.top-l.top+i:c||(Sc(l,a)?o.scrollTop-=a.top-l.top+i:xc(l,a)&&(o.scrollTop+=t?l.top-a.top-i:l.bottom-a.bottom+i)),c||(Dc(l,a)?o.scrollLeft-=a.left-l.left+i:Bc(l,a)&&(o.scrollLeft+=l.right-a.right+i)),o=o.parentNode}function xc(o,e){return o.bottom>e.bottom}function Sc(o,e){return o.top<e.top}function Dc(o,e){return o.left<e.left}function Bc(o,e){return o.right>e.right}function Hr(o){return ii(o)?o.startContainer.ownerDocument.defaultView:o.ownerDocument.defaultView}function hC(o){if(ii(o)){let e=o.commonAncestorContainer;return Ie(e)&&(e=e.parentNode),e}return o.parentNode}function Tc(o,e){const t=Hr(o),n=new De(o);if(t===e)return n;{let i=t;for(;i!=e;){const r=i.frameElement,s=new De(r).excludeScrollbarsAndBorders();n.moveBy(s.left,s.top),i=i.parent}}return n}const uC={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},mC={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},se=function(){const o={arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,shift:2228224,alt:4456448,cmd:8912896};for(let e=65;e<=90;e++)o[String.fromCharCode(e).toLowerCase()]=e;for(let e=48;e<=57;e++)o[e-48]=e;for(let e=112;e<=123;e++)o["f"+(e-111)]=e;for(const e of"`-=[];',./\\")o[e]=e.charCodeAt(0);return o}(),gC=Object.fromEntries(Object.entries(se).map(([o,e])=>[e,o.charAt(0).toUpperCase()+o.slice(1)]));function Nn(o){let e;if(typeof o=="string"){if(e=se[o.toLowerCase()],!e)throw new I("keyboard-unknown-key",null,{key:o})}else e=o.keyCode+(o.altKey?se.alt:0)+(o.ctrlKey?se.ctrl:0)+(o.shiftKey?se.shift:0)+(o.metaKey?se.cmd:0);return e}function li(o){return typeof o=="string"&&(o=function(e){return e.split("+").map(t=>t.trim())}(o)),o.map(e=>typeof e=="string"?function(t){if(t.endsWith("!"))return Nn(t.slice(0,-1));const n=Nn(t);return k.isMac&&n==se.ctrl?se.cmd:n}(e):e).reduce((e,t)=>t+e,0)}function Ic(o){let e=li(o);return Object.entries(k.isMac?uC:mC).reduce((t,[n,i])=>(e&se[n]&&(e&=~se[n],t+=i),t),"")+(e?gC[e]:"")}function qr(o,e){const t=e==="ltr";switch(o){case se.arrowleft:return t?"left":"right";case se.arrowright:return t?"right":"left";case se.arrowup:return"up";case se.arrowdown:return"down"}}function Pe(o){return Array.isArray(o)?o:[o]}function pC(o,e,t=1){if(typeof t!="number")throw new I("translation-service-quantity-not-a-number",null,{quantity:t});const n=Object.keys(oe.window.CKEDITOR_TRANSLATIONS).length;n===1&&(o=Object.keys(oe.window.CKEDITOR_TRANSLATIONS)[0]);const i=e.id||e.string;if(n===0||!function(l,c){return!!oe.window.CKEDITOR_TRANSLATIONS[l]&&!!oe.window.CKEDITOR_TRANSLATIONS[l].dictionary[c]}(o,i))return t!==1?e.plural:e.string;const r=oe.window.CKEDITOR_TRANSLATIONS[o].dictionary,s=oe.window.CKEDITOR_TRANSLATIONS[o].getPluralForm||(l=>l===1?0:1),a=r[i];return typeof a=="string"?a:a[Number(s(t))]}oe.window.CKEDITOR_TRANSLATIONS||(oe.window.CKEDITOR_TRANSLATIONS={});const fC=["ar","ara","fa","per","fas","he","heb","ku","kur","ug","uig"];function Pc(o){return fC.includes(o)?"rtl":"ltr"}class kC{constructor({uiLanguage:e="en",contentLanguage:t}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=Pc(this.uiLanguage),this.contentLanguageDirection=Pc(this.contentLanguage),this.t=(n,i)=>this._t(n,i)}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=Pe(t),typeof e=="string"&&(e={string:e});const n=e.plural?t[0]:1;return function(i,r){return i.replace(/%(\d+)/g,(s,a)=>a<r.length?r[a]:s)}(pC(this.uiLanguage,e,n),t)}}class at extends me(){constructor(e={},t={}){super();const n=Xe(e);if(n||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],n)for(const i of e)this._items.push(i),this._itemMap.set(this._getItemIdBeforeAdding(i),i)}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(e,t){return this.addMany([e],t)}addMany(e,t){if(t===void 0)t=this._items.length;else if(t>this._items.length||t<0)throw new I("collection-add-item-invalid-index",this);let n=0;for(const i of e){const r=this._getItemIdBeforeAdding(i),s=t+n;this._items.splice(s,0,i),this._itemMap.set(r,i),this.fire("add",i,s),n++}return this.fire("change",{added:e,removed:[],index:t}),this}get(e){let t;if(typeof e=="string")t=this._itemMap.get(e);else{if(typeof e!="number")throw new I("collection-get-invalid-arg",this);t=this._items[e]}return t||null}has(e){if(typeof e=="string")return this._itemMap.has(e);{const t=e[this._idProperty];return t&&this._itemMap.has(t)}}getIndex(e){let t;return t=typeof e=="string"?this._itemMap.get(e):e,t?this._items.indexOf(t):-1}remove(e){const[t,n]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:n}),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 I("collection-bind-to-rebind",this);return this._bindToCollection=e,{as:t=>{this._setUpBindToBinding(n=>new t(n))},using:t=>{typeof t=="function"?this._setUpBindToBinding(t):this._setUpBindToBinding(n=>n[t])}}}_setUpBindToBinding(e){const t=this._bindToCollection,n=(i,r,s)=>{const a=t._bindToCollection==this,l=t._bindToInternalToExternalMap.get(r);if(a&&l)this._bindToExternalToInternalMap.set(r,l),this._bindToInternalToExternalMap.set(l,r);else{const c=e(r);if(!c)return void this._skippedIndexesFromExternal.push(s);let d=s;for(const u of this._skippedIndexesFromExternal)s>u&&d--;for(const u of t._skippedIndexesFromExternal)d>=u&&d++;this._bindToExternalToInternalMap.set(r,c),this._bindToInternalToExternalMap.set(c,r),this.add(c,d);for(let u=0;u<t._skippedIndexesFromExternal.length;u++)d<=t._skippedIndexesFromExternal[u]&&t._skippedIndexesFromExternal[u]++}};for(const i of t)n(0,i,t.getIndex(i));this.listenTo(t,"add",n),this.listenTo(t,"remove",(i,r,s)=>{const a=this._bindToExternalToInternalMap.get(r);a&&this.remove(a),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((l,c)=>(s<c&&l.push(c-1),s>c&&l.push(c),l),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let n;if(t in e){if(n=e[t],typeof n!="string")throw new I("collection-add-invalid-id",this);if(this.get(n))throw new I("collection-add-item-already-exists",this)}else e[t]=n=J();return n}_remove(e){let t,n,i,r=!1;const s=this._idProperty;if(typeof e=="string"?(n=e,i=this._itemMap.get(n),r=!i,i&&(t=this._items.indexOf(i))):typeof e=="number"?(t=e,i=this._items[t],r=!i,i&&(n=i[s])):(i=e,n=i[s],t=this._items.indexOf(i),r=t==-1||!this._itemMap.get(n)),r)throw new I("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(n);const a=this._bindToInternalToExternalMap.get(i);return this._bindToInternalToExternalMap.delete(i),this._bindToExternalToInternalMap.delete(a),this.fire("remove",i,t),[i,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}function ze(o){const e=o.next();return e.done?null:e.value}class ht extends jt(ge()){constructor(){super(),this._elements=new Set,this._nextEventLoopTimeout=null,this.set("isFocused",!1),this.set("focusedElement",null)}add(e){if(this._elements.has(e))throw new I("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>this._focus(e),{useCapture:!0}),this.listenTo(e,"blur",()=>this._blur(),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(),this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e))}destroy(){this.stopListening()}_focus(e){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=e,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0)}}class St{constructor(){this._listener=new(jt())}listenTo(e){this._listener.listenTo(e,"keydown",(t,n)=>{this._listener.fire("_keydown:"+Nn(n),n)})}set(e,t,n={}){const i=li(e),r=n.priority;this._listener.listenTo(this._listener,"_keydown:"+i,(s,a)=>{t(a,()=>{a.preventDefault(),a.stopPropagation(),s.stop()}),s.return=!0},{priority:r})}press(e){return!!this._listener.fire("_keydown:"+Nn(e),e)}stopListening(e){this._listener.stopListening(e)}destroy(){this.stopListening()}}function Dt(o){return Xe(o)?new Map(o):function(e){const t=new Map;for(const n in e)t.set(n,e[n]);return t}(o)}function Ur(o,e){let t;function n(...i){n.cancel(),t=setTimeout(()=>o(...i),e)}return n.cancel=()=>{clearTimeout(t)},n}function Wr(o,e){return!!(t=o.charAt(e-1))&&t.length==1&&/[\ud800-\udbff]/.test(t)&&function(n){return!!n&&n.length==1&&/[\udc00-\udfff]/.test(n)}(o.charAt(e));var t}function Kr(o,e){return!!(t=o.charAt(e))&&t.length==1&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(t);var t}const bC=function(){const o=[new RegExp("\\p{Emoji}[\\u{E0020}-\\u{E007E}]+\\u{E007F}","u"),new RegExp("\\p{Emoji}\\u{FE0F}?\\u{20E3}","u"),new RegExp("\\p{Emoji}\\u{FE0F}","u"),new RegExp("(?=\\p{General_Category=Other_Symbol})\\p{Emoji}\\p{Emoji_Modifier}*","u")],e=new RegExp("\\p{Regional_Indicator}{2}","u").source,t="(?:"+o.map(n=>n.source).join("|")+")";return new RegExp(`${e}|${t}(?:${t})*`,"ug")}();function Rc(o,e){const t=String(o).matchAll(bC);return Array.from(t).some(n=>n.index<e&&e<n.index+n[0].length)}class on extends at{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(t,n,i)=>{this._renderViewIntoCollectionParent(n,i)}),this.on("remove",(t,n)=>{n.element&&this._parentElement&&n.element.remove()}),this._parentElement=null}destroy(){this.map(e=>e.destroy())}setParent(e){this._parentElement=e;for(const t of this)this._renderViewIntoCollectionParent(t)}delegate(...e){if(!e.length||!e.every(t=>typeof t=="string"))throw new I("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const n of this)for(const i of e)n.delegate(i).to(t);this.on("add",(n,i)=>{for(const r of e)i.delegate(r).to(t)}),this.on("remove",(n,i)=>{for(const r of e)i.stopDelegating(r,t)})}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}remove(e){return super.remove(e)}}var wC=D(6062),G=D.n(wC),Oc=D(4793),AC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Oc.Z,AC),Oc.Z.locals;class re extends jt(ge()){constructor(e){super(),this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new at,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,n)=>{n.locale=e,n.t=e&&e.t}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=bt.bind(this,this)}createCollection(e){const t=new on(e);return this._viewCollections.add(t),t}registerChild(e){Xe(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){Xe(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new bt(e)}extendTemplate(e){bt.extend(this.template,e)}render(){if(this.isRendered)throw new I("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)}}class bt extends me(){constructor(e){super(),Object.assign(this,Fc(Mc(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,intoFragment:!1,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new I("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const n of t.children)di(n)?yield n:Gr(n)&&(yield*e(n))}(this)}static bind(e,t){return{to:(n,i)=>new _C({eventNameOrFunction:n,attribute:n,observable:e,emitter:t,callback:i}),if:(n,i,r)=>new Nc({observable:e,emitter:t,attribute:n,valueIfTrue:i,callback:r})}}static extend(e,t){if(e._isRendered)throw new I("template-extend-render",[this,e]);$c(e,Fc(Mc(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new I("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(""),ci(this.text)?this._bindToObservable({schema:this.text,updater:CC(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){if(!this.attributes)return;const t=e.node,n=e.revertData;for(const i in this.attributes){const r=t.getAttribute(i),s=this.attributes[i];n&&(n.attributes[i]=r);const a=Hc(s)?s[0].ns:null;if(ci(s)){const l=Hc(s)?s[0].value:s;n&&qc(i)&&l.unshift(r),this._bindToObservable({schema:l,updater:vC(t,i,a),data:e})}else if(i=="style"&&typeof s[0]!="string")this._renderStyleAttribute(s[0],e);else{n&&r&&qc(i)&&s.unshift(r);const l=s.map(c=>c&&c.value||c).reduce((c,d)=>c.concat(d),[]).reduce(Lc,"");zn(l)||t.setAttributeNS(a,i,l)}}}_renderStyleAttribute(e,t){const n=t.node;for(const i in e){const r=e[i];ci(r)?this._bindToObservable({schema:[r],updater:yC(n,i),data:t}):n.style[i]=r}}_renderElementChildren(e){const t=e.node,n=e.intoFragment?document.createDocumentFragment():t,i=e.isApplying;let r=0;for(const s of this.children)if(Zr(s)){if(!i){s.setParent(t);for(const a of s)n.appendChild(a.element)}}else if(di(s))i||(s.isRendered||s.render(),n.appendChild(s.element));else if(Lt(s))n.appendChild(s);else if(i){const a={children:[],bindings:[],attributes:{}};e.revertData.children.push(a),s._renderNode({intoFragment:!1,node:n.childNodes[r++],isApplying:!0,revertData:a})}else n.appendChild(s.render());e.intoFragment&&t.appendChild(n)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const n=this.eventListeners[t].map(i=>{const[r,s]=t.split("@");return i.activateDomEventListener(r,s,e)});e.revertData&&e.revertData.bindings.push(n)}}_bindToObservable({schema:e,updater:t,data:n}){const i=n.revertData;zc(e,t,n);const r=e.filter(s=>!zn(s)).filter(s=>s.observable).map(s=>s.activateAttributeListener(e,t,n));i&&i.bindings.push(r)}_revertTemplateFromNode(e,t){for(const i of t.bindings)for(const r of i)r();if(t.text)return void(e.textContent=t.text);const n=e;for(const i in t.attributes){const r=t.attributes[i];r===null?n.removeAttribute(i):n.setAttribute(i,r)}for(let i=0;i<t.children.length;++i)this._revertTemplateFromNode(n.childNodes[i],t.children[i])}}class fo{constructor(e){this.attribute=e.attribute,this.observable=e.observable,this.emitter=e.emitter,this.callback=e.callback}getValue(e){const t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,n){const i=()=>zc(e,t,n);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,i),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,i)}}}class _C extends fo{constructor(e){super(e),this.eventNameOrFunction=e.eventNameOrFunction}activateDomEventListener(e,t,n){const i=(r,s)=>{t&&!s.target.matches(t)||(typeof this.eventNameOrFunction=="function"?this.eventNameOrFunction(s):this.observable.fire(this.eventNameOrFunction,s))};return this.emitter.listenTo(n.node,e,i),()=>{this.emitter.stopListening(n.node,e,i)}}}class Nc extends fo{constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){return!zn(super.getValue(e))&&(this.valueIfTrue||!0)}}function ci(o){return!!o&&(o.value&&(o=o.value),Array.isArray(o)?o.some(ci):o instanceof fo)}function zc(o,e,{node:t}){const n=function(r,s){return r.map(a=>a instanceof fo?a.getValue(s):a)}(o,t);let i;i=o.length==1&&o[0]instanceof Nc?n[0]:n.reduce(Lc,""),zn(i)?e.remove():e.set(i)}function CC(o){return{set(e){o.textContent=e},remove(){o.textContent=""}}}function vC(o,e,t){return{set(n){o.setAttributeNS(t,e,n)},remove(){o.removeAttributeNS(t,e)}}}function yC(o,e){return{set(t){o.style[e]=t},remove(){o.style[e]=null}}}function Mc(o){return Vr(o,e=>{if(e&&(e instanceof fo||Gr(e)||di(e)||Zr(e)))return e})}function Fc(o){if(typeof o=="string"?o=function(e){return{text:[e]}}(o):o.text&&function(e){e.text=Pe(e.text)}(o),o.on&&(o.eventListeners=function(e){for(const t in e)Vc(e,t);return e}(o.on),delete o.on),!o.text){o.attributes&&function(t){for(const n in t)t[n].value&&(t[n].value=Pe(t[n].value)),Vc(t,n)}(o.attributes);const e=[];if(o.children)if(Zr(o.children))e.push(o.children);else for(const t of o.children)Gr(t)||di(t)||Lt(t)?e.push(t):e.push(new bt(t));o.children=e}return o}function Vc(o,e){o[e]=Pe(o[e])}function Lc(o,e){return zn(e)?o:zn(o)?e:`${o} ${e}`}function jc(o,e){for(const t in e)o[t]?o[t].push(...e[t]):o[t]=e[t]}function $c(o,e){if(e.attributes&&(o.attributes||(o.attributes={}),jc(o.attributes,e.attributes)),e.eventListeners&&(o.eventListeners||(o.eventListeners={}),jc(o.eventListeners,e.eventListeners)),e.text&&o.text.push(...e.text),e.children&&e.children.length){if(o.children.length!=e.children.length)throw new I("ui-template-extend-children-mismatch",o);let t=0;for(const n of e.children)$c(o.children[t++],n)}}function zn(o){return!o&&o!==0}function di(o){return o instanceof re}function Gr(o){return o instanceof bt}function Zr(o){return o instanceof on}function Hc(o){return xe(o[0])&&o[0].ns}function qc(o){return o=="class"||o=="style"}class EC extends on{constructor(e,t=[]){super(t),this.locale=e}attachToDom(){this._bodyCollectionContainer=new bt({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=br(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(e)),e.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const e=document.querySelector(".ck-body-wrapper");e&&e.childElementCount==0&&e.remove()}}var Uc=D(6574),xC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Uc.Z,xC),Uc.Z.locals;const Wc=class extends re{constructor(){super();const o=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.set("isColorInherited",!0),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon","ck-reset_all-excluded",o.if("isColorInherited","ck-icon_inherit-color")],viewBox:o.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 o=new DOMParser().parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),e=o.getAttribute("viewBox");e&&(this.viewBox=e);for(const{name:t,value:n}of Array.from(o.attributes))Wc.presentationalAttributeNames.includes(t)&&this.element.setAttribute(t,n);for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(;o.childNodes.length>0;)this.element.appendChild(o.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach(o=>{o.style.fill=this.fillColor})}};let ko=Wc;ko.presentationalAttributeNames=["alignment-baseline","baseline-shift","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-rendering","cursor","direction","display","dominant-baseline","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","mask","opacity","overflow","paint-order","pointer-events","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-overflow","text-rendering","transform","unicode-bidi","vector-effect","visibility","white-space","word-spacing","writing-mode"];var Kc=D(4906),SC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Kc.Z,SC),Kc.Z.locals;class Ae extends re{constructor(e){super(e),this._focusDelayed=null;const t=this.bindTemplate,n=J();this.set("ariaChecked",void 0),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",`ck-editor__aria-label_${n}`),this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke",void 0),this.set("label",void 0),this.set("role",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.labelView=this._createLabelView(),this.iconView=new ko,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this));const i={tag:"button",attributes:{class:["ck","ck-button",t.to("class"),t.if("isEnabled","ck-disabled",r=>!r),t.if("isVisible","ck-hidden",r=>!r),t.to("isOn",r=>r?"ck-on":"ck-off"),t.if("withText","ck-button_with-text"),t.if("withKeystroke","ck-button_with-keystroke")],role:t.to("role"),type:t.to("type",r=>r||"button"),tabindex:t.to("tabindex"),"aria-label":t.to("ariaLabel"),"aria-labelledby":t.to("ariaLabelledBy"),"aria-disabled":t.if("isEnabled",!0,r=>!r),"aria-checked":t.to("isOn"),"aria-pressed":t.to("isOn",r=>!!this.isToggleable&&String(!!r)),"data-cke-tooltip-text":t.to("_tooltipString"),"data-cke-tooltip-position":t.to("tooltipPosition")},children:this.children,on:{click:t.to(r=>{this.isEnabled?this.fire("execute"):r.preventDefault()})}};k.isSafari&&(this._focusDelayed||(this._focusDelayed=Ur(()=>this.focus(),0)),i.on.mousedown=t.to(()=>{this._focusDelayed()}),i.on.mouseup=t.to(()=>{this._focusDelayed.cancel()})),this.setTemplate(i)}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}destroy(){this._focusDelayed&&this._focusDelayed.cancel(),super.destroy()}_createLabelView(){const e=new re,t=this.bindTemplate;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:t.to("labelStyle"),id:this.ariaLabelledBy},children:[{text:t.to("label")}]}),e}_createKeystrokeView(){const e=new re;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",t=>Ic(t))}]}),e}_getTooltipString(e,t,n){return e?typeof e=="string"?e:(n&&(n=Ic(n)),e instanceof Function?e(t,n):`${t}${n?` (${n})`:""}`):""}}var Gc=D(6758),DC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Gc.Z,DC),Gc.Z.locals;class hi extends Ae{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 re;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}var Zc=D(6781),BC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Zc.Z,BC),Zc.Z.locals,D(1103),D(841);var Jc=D(3662),TC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Jc.Z,TC),Jc.Z.locals;class Yc extends re{constructor(e){super(e),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${J()}`;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")}]})}}var Qc=D(2577),IC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Qc.Z,IC),Qc.Z.locals;class Xc extends re{constructor(e,t){super(e);const n=`ck-labeled-field-view-${J()}`,i=`ck-labeled-field-view-status-${J()}`;this.fieldView=t(this,n,i),this.set("label",void 0),this.set("isEnabled",!0),this.set("isEmpty",!0),this.set("isFocused",!1),this.set("errorText",null),this.set("infoText",null),this.set("class",void 0),this.set("placeholder",void 0),this.labelView=this._createLabelView(n),this.statusView=this._createStatusView(i),this.fieldWrapperChildren=this.createCollection([this.fieldView,this.labelView]),this.bind("_statusText").to(this,"errorText",this,"infoText",(s,a)=>s||a);const r=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",r.to("class"),r.if("isEnabled","ck-disabled",s=>!s),r.if("isEmpty","ck-labeled-field-view_empty"),r.if("isFocused","ck-labeled-field-view_focused"),r.if("placeholder","ck-labeled-field-view_placeholder"),r.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:this.fieldWrapperChildren},this.statusView]})}_createLabelView(e){const t=new Yc(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new re(this.locale),n=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",n.if("errorText","ck-labeled-field-view__status_error"),n.if("_statusText","ck-hidden",i=>!i)],id:e,role:n.if("errorText","alert")},children:[{text:n.to("_statusText")}]}),t}focus(){this.fieldView.focus()}}var ed=D(4879),PC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(ed.Z,PC),ed.Z.locals;class RC extends re{constructor(e){super(e),this.set("value",void 0),this.set("id",void 0),this.set("placeholder",void 0),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById",void 0),this.focusTracker=new ht,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0),this.set("inputMode","text");const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck","ck-input",t.if("isFocused","ck-input_focused"),t.if("isEmpty","ck-input-text_empty"),t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),readonly:t.to("isReadOnly"),inputmode:t.to("inputMode"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById")},on:{input:t.to((...n)=>{this.fire("input",...n),this._updateIsEmpty()}),change:t.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on("change:value",(e,t,n)=>{this._setDomElementValue(n),this._updateIsEmpty()})}destroy(){super.destroy(),this.focusTracker.destroy()}select(){this.element.select()}focus(){this.element.focus()}_updateIsEmpty(){this.isEmpty=!this.element.value}_setDomElementValue(e){this.element.value=e||e===0?e:""}}class OC extends RC{constructor(e){super(e),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}}class NC extends re{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",n=>`ck-dropdown__panel_${n}`),t.if("isVisible","ck-dropdown__panel-visible")]},children:this.children,on:{selectstart:t.to(n=>{n.target.tagName.toLocaleLowerCase()!=="input"&&n.preventDefault()})}})}focus(){if(this.children.length){const e=this.children.first;typeof e.focus=="function"?e.focus():Q("ui-dropdown-panel-focus-child-missing-focus",{childView:this.children.first,dropdownPanel:this})}}focusLast(){if(this.children.length){const e=this.children.last;typeof e.focusLast=="function"?e.focusLast():e.focus()}}}var td=D(5485),zC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(td.Z,zC),td.Z.locals;const Jr=class extends re{constructor(o,e,t){super(o);const n=this.bindTemplate;this.buttonView=e,this.panelView=t,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class",void 0),this.set("id",void 0),this.set("panelPosition","auto"),this.keystrokes=new St,this.focusTracker=new ht,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",n.to("class"),n.if("isEnabled","ck-disabled",i=>!i)],id:n.to("id"),"aria-describedby":n.to("ariaDescribedById")},children:[e,t]}),e.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":n.to("isOpen")}})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.listenTo(this.buttonView,"open",()=>{this.isOpen=!this.isOpen}),this.panelView.bind("isVisible").to(this,"isOpen"),this.on("change:isOpen",(e,t,n)=>{n&&(this.panelPosition==="auto"?this.panelView.position=Jr._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 o=(e,t)=>{this.isOpen&&(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",o),this.keystrokes.set("esc",o)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:o,north:e,southEast:t,southWest:n,northEast:i,northWest:r,southMiddleEast:s,southMiddleWest:a,northMiddleEast:l,northMiddleWest:c}=Jr.defaultPanelPositions;return this.locale.uiLanguageDirection!=="rtl"?[t,n,s,a,o,i,r,l,c,e]:[n,t,a,s,o,r,i,c,l,e]}};let Yr=Jr;Yr.defaultPanelPositions={south:(o,e)=>({top:o.bottom,left:o.left-(e.width-o.width)/2,name:"s"}),southEast:o=>({top:o.bottom,left:o.left,name:"se"}),southWest:(o,e)=>({top:o.bottom,left:o.left-e.width+o.width,name:"sw"}),southMiddleEast:(o,e)=>({top:o.bottom,left:o.left-(e.width-o.width)/4,name:"sme"}),southMiddleWest:(o,e)=>({top:o.bottom,left:o.left-3*(e.width-o.width)/4,name:"smw"}),north:(o,e)=>({top:o.top-e.height,left:o.left-(e.width-o.width)/2,name:"n"}),northEast:(o,e)=>({top:o.top-e.height,left:o.left,name:"ne"}),northWest:(o,e)=>({top:o.top-e.height,left:o.left-e.width+o.width,name:"nw"}),northMiddleEast:(o,e)=>({top:o.top-e.height,left:o.left-(e.width-o.width)/4,name:"nme"}),northMiddleWest:(o,e)=>({top:o.top-e.height,left:o.left-3*(e.width-o.width)/4,name:"nmw"})},Yr._getOptimalPosition=vc;const nd='<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 od extends Ae{constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",t=>String(t))}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new ko;return e.content=nd,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}class bo{constructor(e){if(this.focusables=e.focusables,this.focusTracker=e.focusTracker,this.keystrokeHandler=e.keystrokeHandler,this.actions=e.actions,e.actions&&e.keystrokeHandler)for(const t in e.actions){let n=e.actions[t];typeof n=="string"&&(n=[n]);for(const i of n)e.keystrokeHandler.set(i,(r,s)=>{this[t](),s()})}}get first(){return this.focusables.find(Qr)||null}get last(){return this.focusables.filter(Qr).slice(-1)[0]||null}get next(){return this._getFocusableItem(1)}get previous(){return this._getFocusableItem(-1)}get current(){let e=null;return this.focusTracker.focusedElement===null?null:(this.focusables.find((t,n)=>{const i=t.element===this.focusTracker.focusedElement;return i&&(e=n),i}),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,n=this.focusables.length;if(!n)return null;if(t===null)return this[e===1?"first":"last"];let i=(t+n+e)%n;do{const r=this.focusables.get(i);if(Qr(r))return r;i=(i+n+e)%n}while(i!==t);return null}}function Qr(o){return!(!o.focus||!nn(o.element))}class id extends re{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class MC extends re{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}function rd(o){return Array.isArray(o)?{items:o,removeItems:[]}:o?Object.assign({items:[],removeItems:[]},o):{items:[],removeItems:[]}}class q extends ge(){constructor(e){super(),this._disableStack=new Set,this.editor=e,this.set("isEnabled",!0)}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",sd,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",sd),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function sd(o){o.return=!1,o.stop()}class ne extends ge(){constructor(e){super(),this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._affectsData=!0,this._isEnabledBasedOnSelection=!0,this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.listenTo(e,"change:isReadOnly",()=>{this.refresh()}),this.on("set:isEnabled",t=>{this.affectsData&&(e.isReadOnly||this._isEnabledBasedOnSelection&&!e.model.canEditAt(e.model.document.selection))&&(t.return=!1,t.stop())},{priority:"highest"}),this.on("execute",t=>{this.isEnabled||t.stop()},{priority:"high"})}get affectsData(){return this._affectsData}set affectsData(e){this._affectsData=e}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",ad,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",ad),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function ad(o){o.return=!1,o.stop()}class ld extends ne{constructor(){super(...arguments),this._childCommandsDefinitions=[]}refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){Z(this._childCommandsDefinitions,{command:e,priority:t.priority||"normal"}),e.on("change:isEnabled",()=>this._checkEnabled()),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){const e=this._childCommandsDefinitions.find(({command:t})=>t.isEnabled);return e&&e.command}}class cd extends me(){constructor(e,t=[],n=[]){super(),this._plugins=new Map,this._context=e,this._availablePlugins=new Map;for(const i of t)i.pluginName&&this._availablePlugins.set(i.pluginName,i);this._contextPlugins=new Map;for(const[i,r]of n)this._contextPlugins.set(i,r),this._contextPlugins.set(r,i),i.pluginName&&this._availablePlugins.set(i.pluginName,i)}*[Symbol.iterator](){for(const e of this._plugins)typeof e[0]=="function"&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let n=e;throw typeof e=="function"&&(n=e.pluginName||e.name),new I("plugincollection-plugin-not-loaded",this._context,{plugin:n})}return t}has(e){return this._plugins.has(e)}init(e,t=[],n=[]){const i=this,r=this._context;(function b(A,E=new Set){A.forEach(P=>{l(P)&&(E.has(P)||(E.add(P),P.pluginName&&!i._availablePlugins.has(P.pluginName)&&i._availablePlugins.set(P.pluginName,P),P.requires&&b(P.requires,E)))})})(e),g(e);const s=[...function b(A,E=new Set){return A.map(P=>l(P)?P:i._availablePlugins.get(P)).reduce((P,z)=>E.has(z)?P:(E.add(z),z.requires&&(g(z.requires,z),b(z.requires,E).forEach(j=>P.add(j))),P.add(z)),new Set)}(e.filter(b=>!d(b,t)))];(function(b,A){for(const E of A){if(typeof E!="function")throw new I("plugincollection-replace-plugin-invalid-type",null,{pluginItem:E});const P=E.pluginName;if(!P)throw new I("plugincollection-replace-plugin-missing-name",null,{pluginItem:E});if(E.requires&&E.requires.length)throw new I("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:P});const z=i._availablePlugins.get(P);if(!z)throw new I("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:P});const j=b.indexOf(z);if(j===-1){if(i._contextPlugins.has(z))return;throw new I("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:P})}if(z.requires&&z.requires.length)throw new I("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:P});b.splice(j,1,E),i._availablePlugins.set(P,E)}})(s,n);const a=s.map(b=>{let A=i._contextPlugins.get(b);return A=A||new b(r),i._add(b,A),A});return f(a,"init").then(()=>f(a,"afterInit")).then(()=>a);function l(b){return typeof b=="function"}function c(b){return l(b)&&!!b.isContextPlugin}function d(b,A){return A.some(E=>E===b||u(b)===E||u(E)===b)}function u(b){return l(b)?b.pluginName||b.name:b}function g(b,A=null){b.map(E=>l(E)?E:i._availablePlugins.get(E)||E).forEach(E=>{(function(P,z){if(!l(P))throw z?new I("plugincollection-soft-required",r,{missingPlugin:P,requiredBy:u(z)}):new I("plugincollection-plugin-not-found",r,{plugin:P})})(E,A),function(P,z){if(c(z)&&!c(P))throw new I("plugincollection-context-required",r,{plugin:u(P),requiredBy:u(z)})}(E,A),function(P,z){if(z&&d(P,t))throw new I("plugincollection-required",r,{plugin:u(P),requiredBy:u(z)})}(E,A)})}function f(b,A){return b.reduce((E,P)=>P[A]?i._contextPlugins.has(P)?E:E.then(P[A].bind(P)):E,Promise.resolve())}}destroy(){const e=[];for(const[,t]of this)typeof t.destroy!="function"||this._contextPlugins.has(t)||e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const n=e.pluginName;if(n){if(this._plugins.has(n))throw new I("plugincollection-plugin-name-conflict",null,{pluginName:n,plugin1:this._plugins.get(n).constructor,plugin2:e});this._plugins.set(n,t)}}}class dd{constructor(e){this._contextOwner=null,this.config=new hc(e,this.constructor.defaultConfig);const t=this.constructor.builtinPlugins;this.config.define("plugins",t),this.plugins=new cd(this,t);const n=this.config.get("language")||{};this.locale=new kC({uiLanguage:typeof n=="string"?n:n.ui,contentLanguage:this.config.get("language.content")}),this.t=this.locale.t,this.editors=new at}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const n of e.concat(t)){if(typeof n!="function")throw new I("context-initplugins-constructor-only",null,{Plugin:n});if(n.isContextPlugin!==!0)throw new I("context-initplugins-invalid-plugin",null,{Plugin:n})}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 I("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 n=new this(e);t(n.initPlugins().then(()=>n))})}}class ui extends ge(){constructor(e){super(),this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}class FC extends St{constructor(e){super(),this.editor=e}set(e,t,n={}){if(typeof t=="string"){const i=t;t=(r,s)=>{this.editor.execute(i),s()}}super.set(e,t,n)}}var hd=D(4717),VC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(hd.Z,VC),hd.Z.locals;const mi=new WeakMap;function LC(o,e){return!!e.hasClass("ck-placeholder")&&(o.removeClass("ck-placeholder",e),!0)}function Xr(o,e){const t=mi.get(o),n=[];let i=!1;for(const[r,s]of t)s.isDirectHost&&(n.push(r),ud(e,r,s)&&(i=!0));for(const[r,s]of t){if(s.isDirectHost)continue;const a=jC(r);a&&(n.includes(a)||(s.hostElement=a,ud(e,r,s)&&(i=!0)))}return i}function ud(o,e,t){const{text:n,isDirectHost:i,hostElement:r}=t;let s=!1;return r.getAttribute("data-placeholder")!==n&&(o.setAttribute("data-placeholder",n,r),s=!0),(i||e.childCount==1)&&function(a,l){if(!a.isAttached()||Array.from(a.getChildren()).some(u=>!u.is("uiElement")))return!1;const c=a.document,d=c.selection.anchor;return!(c.isComposing&&d&&d.parent===a||!l&&c.isFocused&&(!d||d.parent===a))}(r,t.keepOnFocus)?function(a,l){return!l.hasClass("ck-placeholder")&&(a.addClass("ck-placeholder",l),!0)}(o,r)&&(s=!0):LC(o,r)&&(s=!0),s}function jC(o){if(o.childCount){const e=o.getChild(0);if(e.is("element")&&!e.is("uiElement")&&!e.is("attributeElement"))return e}return null}class rn{is(){throw new Error("is() method is abstract")}}const md=function(o){return Fr(o,4)};class sn extends me(rn){constructor(e){super(),this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))==-1)throw new I("view-node-not-found-in-parent",this);return e}get nextSibling(){const e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}getCommonAncestor(e,t={}){const n=this.getAncestors(t),i=e.getAncestors(t);let r=0;for(;n[r]==i[r]&&n[r];)r++;return r===0?null:n[r-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const t=this.getPath(),n=e.getPath(),i=Ue(t,n);switch(i){case"prefix":return!0;case"extension":return!1;default:return t[i]<n[i]}}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=md(this);return delete e.parent,e}}sn.prototype.is=function(o){return o==="node"||o==="view:node"};class pe extends sn{constructor(e,t){super(e),this._textData=t}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(e){return e instanceof pe&&(this===e||this.data===e.data)}_clone(){return new pe(this.document,this.data)}}pe.prototype.is=function(o){return o==="$text"||o==="view:$text"||o==="text"||o==="view:text"||o==="node"||o==="view:node"};class wt extends rn{constructor(e,t,n){if(super(),this.textNode=e,t<0||t>e.data.length)throw new I("view-textproxy-wrong-offsetintext",this);if(n<0||t+n>e.data.length)throw new I("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+n),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}getAncestors(e={}){const t=[];let n=e.includeSelf?this.textNode:this.parent;for(;n!==null;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}}wt.prototype.is=function(o){return o==="$textProxy"||o==="view:$textProxy"||o==="textProxy"||o==="view:textProxy"};class Mn{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)(typeof t=="string"||t instanceof RegExp)&&(t={name:t}),this._patterns.push(t)}match(...e){for(const t of e)for(const n of this._patterns){const i=gd(t,n);if(i)return{element:t,pattern:n,match:i}}return null}matchAll(...e){const t=[];for(const n of e)for(const i of this._patterns){const r=gd(n,i);r&&t.push({element:n,pattern:i,match:r})}return t.length>0?t:null}getElementName(){if(this._patterns.length!==1)return null;const e=this._patterns[0],t=e.name;return typeof e=="function"||!t||t instanceof RegExp?null:t}}function gd(o,e){if(typeof e=="function")return e(o);const t={};return e.name&&(t.name=function(n,i){return n instanceof RegExp?!!i.match(n):n===i}(e.name,o.name),!t.name)||e.attributes&&(t.attributes=function(n,i){const r=new Set(i.getAttributeKeys());return Ke(n)?(n.style!==void 0&&Q("matcher-pattern-deprecated-attributes-style-key",n),n.class!==void 0&&Q("matcher-pattern-deprecated-attributes-class-key",n)):(r.delete("style"),r.delete("class")),es(n,r,s=>i.getAttribute(s))}(e.attributes,o),!t.attributes)||e.classes&&(t.classes=function(n,i){return es(n,i.getClassNames(),()=>{})}(e.classes,o),!t.classes)||e.styles&&(t.styles=function(n,i){return es(n,i.getStyleNames(!0),r=>i.getStyle(r))}(e.styles,o),!t.styles)?null:t}function es(o,e,t){const n=function(s){return Array.isArray(s)?s.map(a=>Ke(a)?(a.key!==void 0&&a.value!==void 0||Q("matcher-pattern-missing-key-or-value",a),[a.key,a.value]):[a,!0]):Ke(s)?Object.entries(s):[[s,!0]]}(o),i=Array.from(e),r=[];if(n.forEach(([s,a])=>{i.forEach(l=>{(function(c,d){return c===!0||c===d||c instanceof RegExp&&d.match(c)})(s,l)&&function(c,d,u){if(c===!0)return!0;const g=u(d);return c===g||c instanceof RegExp&&!!String(g).match(c)}(a,l,t)&&r.push(l)})}),n.length&&!(r.length<n.length))return r}const gi=function(o){return typeof o=="symbol"||st(o)&&Vt(o)=="[object Symbol]"};var $C=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,HC=/^\w*$/;const qC=function(o,e){if(We(o))return!1;var t=typeof o;return!(t!="number"&&t!="symbol"&&t!="boolean"&&o!=null&&!gi(o))||HC.test(o)||!$C.test(o)||e!=null&&o in Object(e)};function ts(o,e){if(typeof o!="function"||e!=null&&typeof e!="function")throw new TypeError("Expected a function");var t=function(){var n=arguments,i=e?e.apply(this,n):n[0],r=t.cache;if(r.has(i))return r.get(i);var s=o.apply(this,n);return t.cache=r.set(i,s)||r,s};return t.cache=new(ts.Cache||Xo),t}ts.Cache=Xo;const UC=ts,WC=function(o){var e=UC(o,function(n){return t.size===500&&t.clear(),n}),t=e.cache;return e};var KC=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,GC=/\\(\\)?/g,ZC=WC(function(o){var e=[];return o.charCodeAt(0)===46&&e.push(""),o.replace(KC,function(t,n,i,r){e.push(i?r.replace(GC,"$1"):n||t)}),e});const JC=ZC,YC=function(o,e){for(var t=-1,n=o==null?0:o.length,i=Array(n);++t<n;)i[t]=e(o[t],t,o);return i};var pd=kt?kt.prototype:void 0,fd=pd?pd.toString:void 0;const QC=function o(e){if(typeof e=="string")return e;if(We(e))return YC(e,o)+"";if(gi(e))return fd?fd.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t},ns=function(o){return o==null?"":QC(o)},os=function(o,e){return We(o)?o:qC(o,e)?[o]:JC(ns(o))},XC=function(o){var e=o==null?0:o.length;return e?o[e-1]:void 0},is=function(o){if(typeof o=="string"||gi(o))return o;var e=o+"";return e=="0"&&1/o==-1/0?"-0":e},kd=function(o,e){for(var t=0,n=(e=os(e,o)).length;o!=null&&t<n;)o=o[is(e[t++])];return t&&t==n?o:void 0},bd=function(o,e,t){var n=-1,i=o.length;e<0&&(e=-e>i?0:i+e),(t=t>i?i:t)<0&&(t+=i),i=e>t?0:t-e>>>0,e>>>=0;for(var r=Array(i);++n<i;)r[n]=o[n+e];return r},ev=function(o,e){return e.length<2?o:kd(o,bd(e,0,-1))},tv=function(o,e){return e=os(e,o),(o=ev(o,e))==null||delete o[is(XC(e))]},nv=function(o,e){return o==null||tv(o,e)},pi=function(o,e,t){var n=o==null?void 0:kd(o,e);return n===void 0?t:n},rs=function(o,e,t){(t!==void 0&&!lo(o[e],t)||t===void 0&&!(e in o))&&_r(o,e,t)},ov=function(o){return function(e,t,n){for(var i=-1,r=Object(e),s=n(e),a=s.length;a--;){var l=s[++i];if(t(r[l],l,r)===!1)break}return e}}(),iv=function(o){return st(o)&&ti(o)},ss=function(o,e){if((e!=="constructor"||typeof o[e]!="function")&&e!="__proto__")return o[e]},rv=function(o){return Tn(o,Pn(o))},sv=function(o,e,t,n,i,r,s){var a=ss(o,t),l=ss(e,t),c=s.get(l);if(c)rs(o,t,c);else{var d=r?r(a,l,t+"",o,e,s):void 0,u=d===void 0;if(u){var g=We(l),f=!g&&mo(l),b=!g&&!f&&Sr(l);d=l,g||f||b?We(a)?d=a:iv(a)?d=Tr(a):f?(u=!1,d=ql(l,!0)):b?(u=!1,d=oc(l,!0)):d=[]:Ke(l)||vr(l)?(d=a,vr(a)?d=rv(a):xe(a)&&!Qt(a)||(d=rc(l))):u=!1}u&&(s.set(l,d),i(d,l,n,r,s),s.delete(l)),rs(o,t,d)}},wd=function o(e,t,n,i,r){e!==t&&ov(t,function(s,a){if(r||(r=new uo),xe(s))sv(e,t,a,n,o,i,r);else{var l=i?i(ss(e,a),s,a+"",e,t,r):void 0;l===void 0&&(l=s),rs(e,a,l)}},Pn)},an=function(o){return o},av=function(o,e,t){switch(t.length){case 0:return o.call(e);case 1:return o.call(e,t[0]);case 2:return o.call(e,t[0],t[1]);case 3:return o.call(e,t[0],t[1],t[2])}return o.apply(e,t)};var Ad=Math.max;const lv=function(o,e,t){return e=Ad(e===void 0?o.length-1:e,0),function(){for(var n=arguments,i=-1,r=Ad(n.length-e,0),s=Array(r);++i<r;)s[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=t(s),av(o,this,a)}},cv=function(o){return function(){return o}},dv=ei?function(o,e){return ei(o,"toString",{configurable:!0,enumerable:!1,value:cv(e),writable:!0})}:an;var hv=Date.now;const uv=function(o){var e=0,t=0;return function(){var n=hv(),i=16-(n-t);if(t=n,i>0){if(++e>=800)return arguments[0]}else e=0;return o.apply(void 0,arguments)}}(dv),_d=function(o,e){return uv(lv(o,e,an),o+"")},mv=function(o,e,t){if(!xe(t))return!1;var n=typeof e;return!!(n=="number"?ti(t)&&yr(e,t.length):n=="string"&&e in t)&&lo(t[e],o)},as=function(o){return _d(function(e,t){var n=-1,i=t.length,r=i>1?t[i-1]:void 0,s=i>2?t[2]:void 0;for(r=o.length>3&&typeof r=="function"?(i--,r):void 0,s&&mv(t[0],t[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++n<i;){var a=t[n];a&&o(e,a,n,r)}return e})},Cd=as(function(o,e,t){wd(o,e,t)}),gv=function(o,e,t,n){if(!xe(o))return o;for(var i=-1,r=(e=os(e,o)).length,s=r-1,a=o;a!=null&&++i<r;){var l=is(e[i]),c=t;if(l==="__proto__"||l==="constructor"||l==="prototype")return o;if(i!=s){var d=a[l];(c=void 0)==void 0&&(c=xe(d)?d:yr(e[i+1])?[]:{})}Cr(a,l,c),a=a[l]}return o},pv=function(o,e,t){return o==null?o:gv(o,e,t)};class fv{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(n){let i=null,r=0,s=0,a=null;const l=new Map;if(n==="")return l;n.charAt(n.length-1)!=";"&&(n+=";");for(let c=0;c<n.length;c++){const d=n.charAt(c);if(i===null)switch(d){case":":a||(a=n.substr(r,c-r),s=c+1);break;case'"':case"'":i=d;break;case";":{const u=n.substr(s,c-s);a&&l.set(a.trim(),u.trim()),a=null,r=c+1;break}}else d===i&&(i=null)}return l}(e).entries());for(const[n,i]of t)this._styleProcessor.toNormalizedForm(n,i,this._styles)}has(e){if(this.isEmpty)return!1;const t=this._styleProcessor.getReducedForm(e,this._styles).find(([n])=>n===e);return Array.isArray(t)}set(e,t){if(xe(e))for(const[n,i]of Object.entries(e))this._styleProcessor.toNormalizedForm(n,i,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=ls(e);nv(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]&&!xe(this._styles[e]))return this._styles[e];const t=this._styleProcessor.getReducedForm(e,this._styles).find(([n])=>n===e);return Array.isArray(t)?t[1]:void 0}getStyleNames(e=!1){return this.isEmpty?[]:e?this._styleProcessor.getStyleNames(this._styles):this._getStylesEntries().map(([t])=>t)}clear(){this._styles={}}_getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const n of t)e.push(...this._styleProcessor.getReducedForm(n,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const n=t.splice(0,t.length-1).join("."),i=pi(this._styles,n);i&&!Array.from(Object.keys(i)).length&&this.remove(n)}}class kv{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,n){if(xe(t))cs(n,ls(e),t);else if(this._normalizers.has(e)){const i=this._normalizers.get(e),{path:r,value:s}=i(t);cs(n,r,s)}else cs(n,e,t)}getNormalized(e,t){if(!e)return Cd({},t);if(t[e]!==void 0)return t[e];if(this._extractors.has(e)){const n=this._extractors.get(e);if(typeof n=="string")return pi(t,n);const i=n(e,t);if(i)return i}return pi(t,ls(e))}getReducedForm(e,t){const n=this.getNormalized(e,t);return n===void 0?[]:this._reducers.has(e)?this._reducers.get(e)(n):[[e,n]]}getStyleNames(e){const t=Array.from(this._consumables.keys()).filter(i=>{const r=this.getNormalized(i,e);return r&&typeof r=="object"?Object.keys(r).length:r}),n=new Set([...t,...Object.keys(e)]);return Array.from(n.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 n of t)this._mapStyleNames(n,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function ls(o){return o.replace("-",".")}function cs(o,e,t){let n=t;xe(t)&&(n=Cd({},pi(o,e),t)),pv(o,e,n)}class et extends sn{constructor(e,t,n,i){if(super(e),this._unsafeAttributesToRender=[],this._customProperties=new Map,this.name=t,this._attrs=function(r){const s=Dt(r);for(const[a,l]of s)l===null?s.delete(a):typeof l!="string"&&s.set(a,String(l));return s}(n),this._children=[],i&&this._insertChild(0,i),this._classes=new Set,this._attrs.has("class")){const r=this._attrs.get("class");vd(this._classes,r),this._attrs.delete("class")}this._styles=new fv(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style"))}get childCount(){return this._children.length}get isEmpty(){return this._children.length===0}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(e){if(e=="class")return this._classes.size>0?[...this._classes].join(" "):void 0;if(e=="style"){const t=this._styles.toString();return t==""?void 0:t}return this._attrs.get(e)}hasAttribute(e){return e=="class"?this._classes.size>0:e=="style"?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(e){if(!(e instanceof et))return!1;if(this===e)return!0;if(this.name!=e.name||this._attrs.size!==e._attrs.size||this._classes.size!==e._classes.size||this._styles.size!==e._styles.size)return!1;for(const[t,n]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==n)return!1;for(const t of this._classes)if(!e._classes.has(t))return!1;for(const t of this._styles.getStyleNames())if(!e._styles.has(t)||e._styles.getAsString(t)!==this._styles.getAsString(t))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(e){return this._styles.getStyleNames(e)}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new Mn(...e);let n=this.parent;for(;n&&!n.is("documentFragment");){if(t.match(n))return n;n=n.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(),n=Array.from(this._attrs).map(i=>`${i[0]}="${i[1]}"`).sort().join(" ");return this.name+(e==""?"":` class="${e}"`)+(t?` style="${t}"`:"")+(n==""?"":` ${n}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}_clone(e=!1){const t=[];if(e)for(const i of this.getChildren())t.push(i._clone(e));const n=new this.constructor(this.document,this.name,this._attrs,t);return n._classes=new Set(this._classes),n._styles.set(this._styles.getNormalized()),n._customProperties=new Map(this._customProperties),n.getFillerOffset=this.getFillerOffset,n._unsafeAttributesToRender=this._unsafeAttributesToRender,n}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let n=0;const i=function(r,s){return typeof s=="string"?[new pe(r,s)]:(Xe(s)||(s=[s]),Array.from(s).map(a=>typeof a=="string"?new pe(r,a):a instanceof wt?new pe(r,a.data):a))}(this.document,t);for(const r of i)r.parent!==null&&r._remove(),r.parent=this,r.document=this.document,this._children.splice(e,0,r),e++,n++;return n}_removeChildren(e,t=1){this._fireChange("children",this);for(let n=e;n<e+t;n++)this._children[n].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){const n=String(t);this._fireChange("attributes",this),e=="class"?vd(this._classes,n):e=="style"?this._styles.setTo(n):this._attrs.set(e,n)}_removeAttribute(e){return this._fireChange("attributes",this),e=="class"?this._classes.size>0&&(this._classes.clear(),!0):e=="style"?!this._styles.isEmpty&&(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this);for(const t of Pe(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of Pe(e))this._classes.delete(t)}_setStyle(e,t){this._fireChange("attributes",this),typeof e!="string"?this._styles.set(e):this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this);for(const t of Pe(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}function vd(o,e){const t=e.split(/\s+/);o.clear(),t.forEach(n=>o.add(n))}et.prototype.is=function(o,e){return e?e===this.name&&(o==="element"||o==="view:element"):o==="element"||o==="view:element"||o==="node"||o==="view:node"};class wo extends et{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=yd}}function yd(){const o=[...this.getChildren()],e=o[this.childCount-1];if(e&&e.is("element","br"))return this.childCount;for(const t of o)if(!t.is("uiElement"))return null;return this.childCount}wo.prototype.is=function(o,e){return e?e===this.name&&(o==="containerElement"||o==="view:containerElement"||o==="element"||o==="view:element"):o==="containerElement"||o==="view:containerElement"||o==="element"||o==="view:element"||o==="node"||o==="view:node"};class fi extends ge(wo){constructor(e,t,n,i){super(e,t,n,i),this.set("isReadOnly",!1),this.set("isFocused",!1),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",r=>r&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}destroy(){this.stopListening()}}fi.prototype.is=function(o,e){return e?e===this.name&&(o==="editableElement"||o==="view:editableElement"||o==="containerElement"||o==="view:containerElement"||o==="element"||o==="view:element"):o==="editableElement"||o==="view:editableElement"||o==="containerElement"||o==="view:containerElement"||o==="element"||o==="view:element"||o==="node"||o==="view:node"};const Ed=Symbol("rootName");class xd extends fi{constructor(e,t){super(e,t),this.rootName="main"}get rootName(){return this.getCustomProperty(Ed)}set rootName(e){this._setCustomProperty(Ed,e)}set _name(e){this.name=e}}xd.prototype.is=function(o,e){return e?e===this.name&&(o==="rootElement"||o==="view:rootElement"||o==="editableElement"||o==="view:editableElement"||o==="containerElement"||o==="view:containerElement"||o==="element"||o==="view:element"):o==="rootElement"||o==="view:rootElement"||o==="editableElement"||o==="view:editableElement"||o==="containerElement"||o==="view:containerElement"||o==="element"||o==="view:element"||o==="node"||o==="view:node"};class ln{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new I("view-tree-walker-no-start-position",null);if(e.direction&&e.direction!="forward"&&e.direction!="backward")throw new I("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this._position=U._createAt(e.startPosition):this._position=U._createAt(e.boundaries[e.direction=="backward"?"end":"start"]),this.direction=e.direction||"forward",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,n;do n=this.position,t=this.next();while(!t.done&&e(t.value));t.done||(this._position=n)}next(){return this.direction=="forward"?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,n=e.parent;if(n.parent===null&&e.offset===n.childCount)return{done:!0,value:void 0};if(n===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let i;if(n instanceof pe){if(e.isAtEnd)return this._position=U._createAfter(n),this._next();i=n.data[e.offset]}else i=n.getChild(e.offset);if(i instanceof et)return this.shallow?e.offset++:e=new U(i,0),this._position=e,this._formatReturnValue("elementStart",i,t,e,1);if(i instanceof pe){if(this.singleCharacters)return e=new U(i,0),this._position=e,this._next();{let r,s=i.data.length;return i==this._boundaryEndParent?(s=this.boundaries.end.offset,r=new wt(i,0,s),e=U._createAfter(r)):(r=new wt(i,0,i.data.length),e.offset++),this._position=e,this._formatReturnValue("text",r,t,e,s)}}if(typeof i=="string"){let r;this.singleCharacters?r=1:r=(n===this._boundaryEndParent?this.boundaries.end.offset:n.data.length)-e.offset;const s=new wt(n,e.offset,r);return e.offset+=r,this._position=e,this._formatReturnValue("text",s,t,e,r)}return e=U._createAfter(n),this._position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",n,t,e)}_previous(){let e=this.position.clone();const t=this.position,n=e.parent;if(n.parent===null&&e.offset===0)return{done:!0,value:void 0};if(n==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let i;if(n instanceof pe){if(e.isAtStart)return this._position=U._createBefore(n),this._previous();i=n.data[e.offset-1]}else i=n.getChild(e.offset-1);if(i instanceof et)return this.shallow?(e.offset--,this._position=e,this._formatReturnValue("elementStart",i,t,e,1)):(e=new U(i,i.childCount),this._position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",i,t,e));if(i instanceof pe){if(this.singleCharacters)return e=new U(i,i.data.length),this._position=e,this._previous();{let r,s=i.data.length;if(i==this._boundaryStartParent){const a=this.boundaries.start.offset;r=new wt(i,a,i.data.length-a),s=r.data.length,e=U._createBefore(r)}else r=new wt(i,0,i.data.length),e.offset--;return this._position=e,this._formatReturnValue("text",r,t,e,s)}}if(typeof i=="string"){let r;if(this.singleCharacters)r=1;else{const a=n===this._boundaryStartParent?this.boundaries.start.offset:0;r=e.offset-a}e.offset-=r;const s=new wt(n,e.offset,r);return this._position=e,this._formatReturnValue("text",s,t,e,r)}return e=U._createBefore(n),this._position=e,this._formatReturnValue("elementStart",n,t,e,1)}_formatReturnValue(e,t,n,i,r){return t instanceof wt&&(t.offsetInText+t.data.length==t.textNode.data.length&&(this.direction!="forward"||this.boundaries&&this.boundaries.end.isEqual(this.position)?n=U._createAfter(t.textNode):(i=U._createAfter(t.textNode),this._position=i)),t.offsetInText===0&&(this.direction!="backward"||this.boundaries&&this.boundaries.start.isEqual(this.position)?n=U._createBefore(t.textNode):(i=U._createBefore(t.textNode),this._position=i))),{done:!1,value:{type:e,item:t,previousPosition:n,nextPosition:i,length:r}}}}class U extends rn{constructor(e,t){super(),this.parent=e,this.offset=t}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return this.offset===0}get isAtEnd(){const e=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof fi);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(e){const t=U._createAt(this),n=t.offset+e;return t.offset=n<0?0:n,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const n=new ln(t);return n.skip(e),n.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),n=e.getAncestors();let i=0;for(;t[i]==n[i]&&t[i];)i++;return i===0?null:t[i-1]}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return this.compareWith(e)=="before"}isAfter(e){return this.compareWith(e)=="after"}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],n=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),n.push(e.offset);const i=Ue(t,n);switch(i){case"prefix":return"before";case"extension":return"after";default:return t[i]<n[i]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new ln(e)}clone(){return new U(this.parent,this.offset)}static _createAt(e,t){if(e instanceof U)return new this(e.parent,e.offset);{const n=e;if(t=="end")t=n.is("$text")?n.data.length:n.childCount;else{if(t=="before")return this._createBefore(n);if(t=="after")return this._createAfter(n);if(t!==0&&!t)throw new I("view-createpositionat-offset-required",n)}return new U(n,t)}}static _createAfter(e){if(e.is("$textProxy"))return new U(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new I("view-position-after-root",e,{root:e});return new U(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new U(e.textNode,e.offsetInText);if(!e.parent)throw new I("view-position-before-root",e,{root:e});return new U(e.parent,e.index)}}U.prototype.is=function(o){return o==="position"||o==="view:position"};class X extends rn{constructor(e,t=null){super(),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(ki,{direction:"backward"}),t=this.end.getLastMatchingPosition(ki);return e.parent.is("$text")&&e.isAtStart&&(e=U._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=U._createAfter(t.parent)),new X(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(ki);if(e.isAfter(this.end)||e.isEqual(this.end))return new X(e,e);let t=this.end.getLastMatchingPosition(ki,{direction:"backward"});const n=e.nodeAfter,i=t.nodeBefore;return n&&n.is("$text")&&(e=new U(n,0)),i&&i.is("$text")&&(t=new U(i,i.data.length)),new X(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 n=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),i=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return n&&i}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new X(this.start,e.start)),this.containsPosition(e.end)&&t.push(new X(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,n=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(n=e.end),new X(t,n)}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 X(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new ln(e);for(const n of t)yield n.item}*getPositions(e={}){e.boundaries=this;const t=new ln(e);yield t.position;for(const n of t)yield n.nextPosition}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,t,n,i){return new this(new U(e,t),new U(n,i))}static _createFromPositionAndShift(e,t){const n=e,i=e.getShiftedBy(t);return t>0?new this(n,i):new this(i,n)}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(U._createBefore(e),t)}}function ki(o){return!(!o.item.is("attributeElement")&&!o.item.is("uiElement"))}X.prototype.is=function(o){return o==="range"||o==="view:range"};class At extends me(rn){constructor(...e){super(),this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",e.length&&this.setTo(...e)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return this.rangeCount===1&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?e.clone():null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake||this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel||this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let n=!1;for(const i of e._ranges)if(t.isEqual(i)){n=!0;break}if(!n)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=kr(this.getRanges());if(t!=kr(e.getRanges()))return!1;if(t==0)return!0;for(let n of this.getRanges()){n=n.getTrimmed();let i=!1;for(let r of e.getRanges())if(r=r.getTrimmed(),n.start.isEqual(r.start)&&n.end.isEqual(r.end)){i=!0;break}if(!i)return!1}return!0}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}setTo(...e){let[t,n,i]=e;if(typeof n=="object"&&(i=n,n=void 0),t===null)this._setRanges([]),this._setFakeOptions(i);else if(t instanceof At||t instanceof ds)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof X)this._setRanges([t],i&&i.backward),this._setFakeOptions(i);else if(t instanceof U)this._setRanges([new X(t)]),this._setFakeOptions(i);else if(t instanceof sn){const r=!!i&&!!i.backward;let s;if(n===void 0)throw new I("view-selection-setto-required-second-parameter",this);s=n=="in"?X._createIn(t):n=="on"?X._createOn(t):new X(U._createAt(t,n)),this._setRanges([s],r),this._setFakeOptions(i)}else{if(!Xe(t))throw new I("view-selection-setto-not-selectable",this);this._setRanges(t,i&&i.backward),this._setFakeOptions(i)}this.fire("change")}setFocus(e,t){if(this.anchor===null)throw new I("view-selection-setfocus-no-ranges",this);const n=U._createAt(e,t);if(n.compareWith(this.focus)=="same")return;const i=this.anchor;this._ranges.pop(),n.compareWith(i)=="before"?this._addRange(new X(n,i),!0):this._addRange(new X(i,n)),this.fire("change")}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const n of e)this._addRange(n);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof X))throw new I("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 I("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new X(e.start,e.end))}}At.prototype.is=function(o){return o==="selection"||o==="view:selection"};class ds extends me(rn){constructor(...e){super(),this._selection=new At,this._selection.delegate("change").to(this),e.length&&this._selection.setTo(...e)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}_setTo(...e){this._selection.setTo(...e)}_setFocus(e,t){this._selection.setFocus(e,t)}}ds.prototype.is=function(o){return o==="selection"||o=="documentSelection"||o=="view:selection"||o=="view:documentSelection"};class Fn extends ${constructor(e,t,n){super(e,t),this.startRange=n,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}const hs=Symbol("bubbling contexts");function us(o){return class extends o{fire(e,...t){try{const n=e instanceof $?e:new $(this,e),i=ms(this);if(!i.size)return;if(Ao(n,"capturing",this),Vn(i,"$capture",n,...t))return n.return;const r=n.startRange||this.selection.getFirstRange(),s=r?r.getContainedElement():null,a=!!s&&!!Sd(i,s);let l=s||function(c){if(!c)return null;const d=c.start.parent,u=c.end.parent,g=d.getPath(),f=u.getPath();return g.length>f.length?d:u}(r);if(Ao(n,"atTarget",l),!a){if(Vn(i,"$text",n,...t))return n.return;Ao(n,"bubbling",l)}for(;l;){if(l.is("rootElement")){if(Vn(i,"$root",n,...t))return n.return}else if(l.is("element")&&Vn(i,l.name,n,...t))return n.return;if(Vn(i,l,n,...t))return n.return;l=l.parent,Ao(n,"bubbling",l)}return Ao(n,"bubbling",this),Vn(i,"$document",n,...t),n.return}catch(n){I.rethrowUnexpectedError(n,this)}}_addEventListener(e,t,n){const i=Pe(n.context||"$document"),r=ms(this);for(const s of i){let a=r.get(s);a||(a=new(me()),r.set(s,a)),this.listenTo(a,e,t,n)}}_removeEventListener(e,t){const n=ms(this);for(const i of n.values())this.stopListening(i,e,t)}}}{const o=us(Object);["fire","_addEventListener","_removeEventListener"].forEach(e=>{us[e]=o.prototype[e]})}function Ao(o,e,t){o instanceof Fn&&(o._eventPhase=e,o._currentTarget=t)}function Vn(o,e,t,...n){const i=typeof e=="string"?o.get(e):Sd(o,e);return!!i&&(i.fire(t,...n),t.stop.called)}function Sd(o,e){for(const[t,n]of o)if(typeof t=="function"&&t(e))return n;return null}function ms(o){return o[hs]||(o[hs]=new Map),o[hs]}class Dd extends us(ge()){constructor(e){super(),this._postFixers=new Set,this.selection=new ds,this.roots=new at({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1)}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.map(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do for(const n of this._postFixers)if(t=n(e),t)break;while(t)}}class cn extends et{constructor(e,t,n,i){super(e,t,n,i),this._priority=10,this._id=null,this._clonesGroup=null,this.getFillerOffset=bv}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(this.id===null)throw new I("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}isSimilar(e){return this.id!==null||e.id!==null?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e=!1){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}function bv(){if(gs(this))return null;let o=this.parent;for(;o&&o.is("attributeElement");){if(gs(o)>1)return null;o=o.parent}return!o||gs(o)>1?null:this.childCount}function gs(o){return Array.from(o.getChildren()).filter(e=>!e.is("uiElement")).length}cn.DEFAULT_PRIORITY=10,cn.prototype.is=function(o,e){return e?e===this.name&&(o==="attributeElement"||o==="view:attributeElement"||o==="element"||o==="view:element"):o==="attributeElement"||o==="view:attributeElement"||o==="element"||o==="view:element"||o==="node"||o==="view:node"};class ps extends et{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=wv}_insertChild(e,t){if(t&&(t instanceof sn||Array.from(t).length>0))throw new I("view-emptyelement-cannot-add",[this,t]);return 0}}function wv(){return null}ps.prototype.is=function(o,e){return e?e===this.name&&(o==="emptyElement"||o==="view:emptyElement"||o==="element"||o==="view:element"):o==="emptyElement"||o==="view:emptyElement"||o==="element"||o==="view:element"||o==="node"||o==="view:node"};class bi extends et{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=_v}_insertChild(e,t){if(t&&(t instanceof sn||Array.from(t).length>0))throw new I("view-uielement-cannot-add",[this,t]);return 0}render(e,t){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const n of this.getAttributeKeys())t.setAttribute(n,this.getAttribute(n));return t}}function Av(o){o.document.on("arrowKey",(e,t)=>function(n,i,r){if(i.keyCode==se.arrowright){const s=i.domTarget.ownerDocument.defaultView.getSelection(),a=s.rangeCount==1&&s.getRangeAt(0).collapsed;if(a||i.shiftKey){const l=s.focusNode,c=s.focusOffset,d=r.domPositionToView(l,c);if(d===null)return;let u=!1;const g=d.getLastMatchingPosition(f=>(f.item.is("uiElement")&&(u=!0),!(!f.item.is("uiElement")&&!f.item.is("attributeElement"))));if(u){const f=r.viewPositionToDom(g);a?s.collapse(f.parent,f.offset):s.extend(f.parent,f.offset)}}}}(0,t,o.domConverter),{priority:"low"})}function _v(){return null}bi.prototype.is=function(o,e){return e?e===this.name&&(o==="uiElement"||o==="view:uiElement"||o==="element"||o==="view:element"):o==="uiElement"||o==="view:uiElement"||o==="element"||o==="view:element"||o==="node"||o==="view:node"};class fs extends et{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=Cv}_insertChild(e,t){if(t&&(t instanceof sn||Array.from(t).length>0))throw new I("view-rawelement-cannot-add",[this,t]);return 0}render(e,t){}}function Cv(){return null}fs.prototype.is=function(o,e){return e?e===this.name&&(o==="rawElement"||o==="view:rawElement"||o==="element"||o==="view:element"):o==="rawElement"||o==="view:rawElement"||o===this.name||o==="view:"+this.name||o==="element"||o==="view:element"||o==="node"||o==="view:node"};class dn extends me(rn){constructor(e,t){super(),this._children=[],this._customProperties=new Map,this.document=e,t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return this.childCount===0}get root(){return this}get parent(){return null}get name(){}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this);let n=0;const i=function(r,s){return typeof s=="string"?[new pe(r,s)]:(Xe(s)||(s=[s]),Array.from(s).map(a=>typeof a=="string"?new pe(r,a):a instanceof wt?new pe(r,a.data):a))}(this.document,t);for(const r of i)r.parent!==null&&r._remove(),r.parent=this,this._children.splice(e,0,r),e++,n++;return n}_removeChildren(e,t=1){this._fireChange("children",this);for(let n=e;n<e+t;n++)this._children[n].parent=null;return this._children.splice(e,t)}_fireChange(e,t){this.fire("change:"+e,t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}dn.prototype.is=function(o){return o==="documentFragment"||o==="view:documentFragment"};class Bd{constructor(e){this._cloneGroups=new Map,this._slotFactory=null,this.document=e}setSelection(...e){this.document.selection._setTo(...e)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createDocumentFragment(e){return new dn(this.document,e)}createText(e){return new pe(this.document,e)}createAttributeElement(e,t,n={}){const i=new cn(this.document,e,t);return typeof n.priority=="number"&&(i._priority=n.priority),n.id&&(i._id=n.id),n.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),i}createContainerElement(e,t,n={},i={}){let r=null;Ke(n)?i=n:r=n;const s=new wo(this.document,e,t,r);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createEditableElement(e,t,n={}){const i=new fi(this.document,e,t);return n.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),i}createEmptyElement(e,t,n={}){const i=new ps(this.document,e,t);return n.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),i}createUIElement(e,t,n){const i=new bi(this.document,e,t);return n&&(i.render=n),i}createRawElement(e,t,n,i={}){const r=new fs(this.document,e,t);return n&&(r.render=n),i.renderUnsafeAttributes&&r._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),r}setAttribute(e,t,n){n._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){Ke(e)&&n===void 0?t._setStyle(e):n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof U?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new I("view-writer-break-non-container-element",this.document);if(!t.parent)throw new I("view-writer-break-root",this.document);if(e.isAtStart)return U._createBefore(t);if(!e.isAtEnd){const n=t._clone(!1);this.insert(U._createAfter(t),n);const i=new X(e,U._createAt(t,"end")),r=new U(n,0);this.move(i,r)}return U._createAfter(t)}mergeAttributes(e){const t=e.offset,n=e.parent;if(n.is("$text"))return e;if(n.is("attributeElement")&&n.childCount===0){const s=n.parent,a=n.index;return n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new U(s,a))}const i=n.getChild(t-1),r=n.getChild(t);if(!i||!r)return e;if(i.is("$text")&&r.is("$text"))return Id(i,r);if(i.is("attributeElement")&&r.is("attributeElement")&&i.isSimilar(r)){const s=i.childCount;return i._appendChild(r.getChildren()),r._remove(),this._removeFromClonedElementsGroup(r),this.mergeAttributes(new U(i,s))}return e}mergeContainers(e){const t=e.nodeBefore,n=e.nodeAfter;if(!(t&&n&&t.is("containerElement")&&n.is("containerElement")))throw new I("view-writer-merge-containers-invalid-position",this.document);const i=t.getChild(t.childCount-1),r=i instanceof pe?U._createAt(i,"end"):U._createAt(t,"end");return this.move(X._createIn(n),U._createAt(t,"end")),this.remove(X._createOn(n)),r}insert(e,t){Pd(t=Xe(t)?[...t]:[t],this.document);const n=t.reduce((s,a)=>{const l=s[s.length-1],c=!a.is("uiElement");return l&&l.breakAttributes==c?l.nodes.push(a):s.push({breakAttributes:c,nodes:[a]}),s},[]);let i=null,r=e;for(const{nodes:s,breakAttributes:a}of n){const l=this._insertNodes(r,s,a);i||(i=l.start),r=l.end}return i?new X(i,r):new X(e)}remove(e){const t=e instanceof X?e:X._createOn(e);if(_o(t,this.document),t.isCollapsed)return new dn(this.document);const{start:n,end:i}=this._breakAttributesRange(t,!0),r=n.parent,s=i.offset-n.offset,a=r._removeChildren(n.offset,s);for(const c of a)this._removeFromClonedElementsGroup(c);const l=this.mergeAttributes(n);return t.start=l,t.end=l.clone(),new dn(this.document,a)}clear(e,t){_o(e,this.document);const n=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const i of n){const r=i.item;let s;if(r.is("element")&&t.isSimilar(r))s=X._createOn(r);else if(!i.nextPosition.isAfter(e.start)&&r.is("$textProxy")){const a=r.getAncestors().find(l=>l.is("element")&&t.isSimilar(l));a&&(s=X._createIn(a))}s&&(s.end.isAfter(e.end)&&(s.end=e.end),s.start.isBefore(e.start)&&(s.start=e.start),this.remove(s))}}move(e,t){let n;if(t.isAfter(e.end)){const i=(t=this._breakAttributes(t,!0)).parent,r=i.childCount;e=this._breakAttributesRange(e,!0),n=this.remove(e),t.offset+=i.childCount-r}else n=this.remove(e);return this.insert(t,n)}wrap(e,t){if(!(t instanceof cn))throw new I("view-writer-wrap-invalid-attribute",this.document);if(_o(e,this.document),e.isCollapsed){let i=e.start;i.parent.is("element")&&(n=i.parent,!Array.from(n.getChildren()).some(s=>!s.is("uiElement")))&&(i=i.getLastMatchingPosition(s=>s.item.is("uiElement"))),i=this._wrapPosition(i,t);const r=this.document.selection;return r.isCollapsed&&r.getFirstPosition().isEqual(e.start)&&this.setSelection(i),new X(i)}return this._wrapRange(e,t);var n}unwrap(e,t){if(!(t instanceof cn))throw new I("view-writer-unwrap-invalid-attribute",this.document);if(_o(e,this.document),e.isCollapsed)return e;const{start:n,end:i}=this._breakAttributesRange(e,!0),r=n.parent,s=this._unwrapChildren(r,n.offset,i.offset,t),a=this.mergeAttributes(s.start);a.isEqual(s.start)||s.end.offset--;const l=this.mergeAttributes(s.end);return new X(a,l)}rename(e,t){const n=new wo(this.document,e,t.getAttributes());return this.insert(U._createAfter(t),n),this.move(X._createIn(t),U._createAt(n,0)),this.remove(X._createOn(t)),n}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return U._createAt(e,t)}createPositionAfter(e){return U._createAfter(e)}createPositionBefore(e){return U._createBefore(e)}createRange(e,t){return new X(e,t)}createRangeOn(e){return X._createOn(e)}createRangeIn(e){return X._createIn(e)}createSelection(...e){return new At(...e)}createSlot(e="children"){if(!this._slotFactory)throw new I("view-writer-invalid-create-slot-context",this.document);return this._slotFactory(this,e)}_registerSlotFactory(e){this._slotFactory=e}_clearSlotFactory(){this._slotFactory=null}_insertNodes(e,t,n){let i,r;if(i=n?ks(e):e.parent.is("$text")?e.parent.parent:e.parent,!i)throw new I("view-writer-invalid-position-container",this.document);r=n?this._breakAttributes(e,!0):e.parent.is("$text")?bs(e):e;const s=i._insertChild(r.offset,t);for(const d of t)this._addToClonedElementsGroup(d);const a=r.getShiftedBy(s),l=this.mergeAttributes(r);l.isEqual(r)||a.offset--;const c=this.mergeAttributes(a);return new X(l,c)}_wrapChildren(e,t,n,i){let r=t;const s=[];for(;r<n;){const l=e.getChild(r),c=l.is("$text"),d=l.is("attributeElement");if(d&&this._wrapAttributeElement(i,l))s.push(new U(e,r));else if(c||!d||vv(i,l)){const u=i._clone();l._remove(),u._appendChild(l),e._insertChild(r,u),this._addToClonedElementsGroup(u),s.push(new U(e,r))}else this._wrapChildren(l,0,l.childCount,i);r++}let a=0;for(const l of s)l.offset-=a,l.offset!=t&&(this.mergeAttributes(l).isEqual(l)||(a++,n--));return X._createFromParentsAndOffsets(e,t,e,n)}_unwrapChildren(e,t,n,i){let r=t;const s=[];for(;r<n;){const l=e.getChild(r);if(l.is("attributeElement"))if(l.isSimilar(i)){const c=l.getChildren(),d=l.childCount;l._remove(),e._insertChild(r,c),this._removeFromClonedElementsGroup(l),s.push(new U(e,r),new U(e,r+d)),r+=d,n+=d-1}else this._unwrapAttributeElement(i,l)?(s.push(new U(e,r),new U(e,r+1)),r++):(this._unwrapChildren(l,0,l.childCount,i),r++);else r++}let a=0;for(const l of s)l.offset-=a,!(l.offset==t||l.offset==n)&&(this.mergeAttributes(l).isEqual(l)||(a++,n--));return X._createFromParentsAndOffsets(e,t,e,n)}_wrapRange(e,t){const{start:n,end:i}=this._breakAttributesRange(e,!0),r=n.parent,s=this._wrapChildren(r,n.offset,i.offset,t),a=this.mergeAttributes(s.start);a.isEqual(s.start)||s.end.offset--;const l=this.mergeAttributes(s.end);return new X(a,l)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Td(e.clone());e.parent.is("$text")&&(e=bs(e));const n=this.createAttributeElement("_wrapPosition-fake-element");n._priority=Number.POSITIVE_INFINITY,n.isSimilar=()=>!1,e.parent._insertChild(e.offset,n);const i=new X(e,e.getShiftedBy(1));this.wrap(i,t);const r=new U(n.parent,n.index);n._remove();const s=r.nodeBefore,a=r.nodeAfter;return s instanceof pe&&a instanceof pe?Id(s,a):Td(r)}_wrapAttributeElement(e,t){if(!Rd(e,t)||e.name!==t.name||e.priority!==t.priority)return!1;for(const n of e.getAttributeKeys())if(n!=="class"&&n!=="style"&&t.hasAttribute(n)&&t.getAttribute(n)!==e.getAttribute(n))return!1;for(const n of e.getStyleNames())if(t.hasStyle(n)&&t.getStyle(n)!==e.getStyle(n))return!1;for(const n of e.getAttributeKeys())n!=="class"&&n!=="style"&&(t.hasAttribute(n)||this.setAttribute(n,e.getAttribute(n),t));for(const n of e.getStyleNames())t.hasStyle(n)||this.setStyle(n,e.getStyle(n),t);for(const n of e.getClassNames())t.hasClass(n)||this.addClass(n,t);return!0}_unwrapAttributeElement(e,t){if(!Rd(e,t)||e.name!==t.name||e.priority!==t.priority)return!1;for(const n of e.getAttributeKeys())if(n!=="class"&&n!=="style"&&(!t.hasAttribute(n)||t.getAttribute(n)!==e.getAttribute(n)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const n of e.getStyleNames())if(!t.hasStyle(n)||t.getStyle(n)!==e.getStyle(n))return!1;for(const n of e.getAttributeKeys())n!=="class"&&n!=="style"&&this.removeAttribute(n,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const n=e.start,i=e.end;if(_o(e,this.document),e.isCollapsed){const l=this._breakAttributes(e.start,t);return new X(l,l)}const r=this._breakAttributes(i,t),s=r.parent.childCount,a=this._breakAttributes(n,t);return r.offset+=r.parent.childCount-s,new X(a,r)}_breakAttributes(e,t=!1){const n=e.offset,i=e.parent;if(e.parent.is("emptyElement"))throw new I("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new I("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new I("view-writer-cannot-break-raw-element",this.document);if(!t&&i.is("$text")&&ws(i.parent)||ws(i))return e.clone();if(i.is("$text"))return this._breakAttributes(bs(e),t);if(n==i.childCount){const r=new U(i.parent,i.index+1);return this._breakAttributes(r,t)}if(n===0){const r=new U(i.parent,i.index);return this._breakAttributes(r,t)}{const r=i.index+1,s=i._clone();i.parent._insertChild(r,s),this._addToClonedElementsGroup(s);const a=i.childCount-n,l=i._removeChildren(n,a);s._appendChild(l);const c=new U(i.parent,r);return this._breakAttributes(c,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const i of e.getChildren())this._addToClonedElementsGroup(i);const t=e.id;if(!t)return;let n=this._cloneGroups.get(t);n||(n=new Set,this._cloneGroups.set(t,n)),n.add(e),e._clonesGroup=n}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const i of e.getChildren())this._removeFromClonedElementsGroup(i);const t=e.id;if(!t)return;const n=this._cloneGroups.get(t);n&&n.delete(e)}}function ks(o){let e=o.parent;for(;!ws(e);){if(!e)return;e=e.parent}return e}function vv(o,e){return o.priority<e.priority||!(o.priority>e.priority)&&o.getIdentity()<e.getIdentity()}function Td(o){const e=o.nodeBefore;if(e&&e.is("$text"))return new U(e,e.data.length);const t=o.nodeAfter;return t&&t.is("$text")?new U(t,0):o}function bs(o){if(o.offset==o.parent.data.length)return new U(o.parent.parent,o.parent.index+1);if(o.offset===0)return new U(o.parent.parent,o.parent.index);const e=o.parent.data.slice(o.offset);return o.parent._data=o.parent.data.slice(0,o.offset),o.parent.parent._insertChild(o.parent.index+1,new pe(o.root.document,e)),new U(o.parent.parent,o.parent.index+1)}function Id(o,e){const t=o.data.length;return o._data+=e.data,e._remove(),new U(o,t)}const yv=[pe,cn,wo,ps,fs,bi];function Pd(o,e){for(const t of o){if(!yv.some(n=>t instanceof n))throw new I("view-writer-insert-invalid-node-type",e);t.is("$text")||Pd(t.getChildren(),e)}}function ws(o){return o&&(o.is("containerElement")||o.is("documentFragment"))}function _o(o,e){const t=ks(o.start),n=ks(o.end);if(!t||!n||t!==n)throw new I("view-writer-invalid-range-container",e)}function Rd(o,e){return o.id===null&&e.id===null}const Od=o=>o.createTextNode(" "),Nd=o=>{const e=o.createElement("span");return e.dataset.ckeFiller="true",e.innerText=" ",e},zd=o=>{const e=o.createElement("br");return e.dataset.ckeFiller="true",e},_t=7,wi="".repeat(_t);function tt(o){return Ie(o)&&o.data.substr(0,_t)===wi}function Co(o){return o.data.length==_t&&tt(o)}function Md(o){return tt(o)?o.data.slice(_t):o.data}function Ev(o,e){if(e.keyCode==se.arrowleft){const t=e.domTarget.ownerDocument.defaultView.getSelection();if(t.rangeCount==1&&t.getRangeAt(0).collapsed){const n=t.getRangeAt(0).startContainer,i=t.getRangeAt(0).startOffset;tt(n)&&i<=_t&&t.collapse(n,0)}}}var Fd=D(9315),xv={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Fd.Z,xv),Fd.Z.locals;class Sv extends ge(){constructor(e,t){super(),this.domDocuments=new Set,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this._inlineFiller=null,this._fakeSelectionContainer=null,this.domConverter=e,this.selection=t,this.set("isFocused",!1),this.set("isSelecting",!1),k.isBlink&&!k.isAndroid&&this.on("change:isSelecting",()=>{this.isSelecting||this.render()}),this.set("isComposing",!1),this.on("change:isComposing",()=>{this.isComposing||this.render()})}markToSync(e,t){if(e==="text")this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if(e==="attributes")this.markedAttributes.add(t);else{if(e!=="children")throw new I("view-renderer-unknown-type",this);this.markedChildren.add(t)}}}render(){if(this.isComposing&&!k.isAndroid)return;let e=null;const t=!(k.isBlink&&!k.isAndroid)||!this.isSelecting;for(const n of this.markedChildren)this._updateChildrenMappings(n);t?(this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent))):this._inlineFiller&&this._inlineFiller.parentNode&&(e=this.domConverter.domPositionToView(this._inlineFiller),e&&e.parent.is("$text")&&(e=U._createBefore(e.parent)));for(const n of this.markedAttributes)this._updateAttrs(n);for(const n of this.markedChildren)this._updateChildren(n,{inlineFillerPosition:e});for(const n of this.markedTexts)!this.markedChildren.has(n.parent)&&this.domConverter.mapViewToDom(n.parent)&&this._updateText(n,{inlineFillerPosition:e});if(t)if(e){const n=this.domConverter.viewPositionToDom(e),i=n.parent.ownerDocument;tt(n.parent)?this._inlineFiller=n.parent:this._inlineFiller=Vd(i,n.parent,n.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){if(!this.domConverter.mapViewToDom(e))return;const t=Array.from(this.domConverter.mapViewToDom(e).childNodes),n=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),i=this._diffNodeLists(t,n),r=this._findUpdateActions(i,t,n,Dv);if(r.indexOf("update")!==-1){const s={equal:0,insert:0,delete:0};for(const a of r)if(a==="update"){const l=s.equal+s.insert,c=s.equal+s.delete,d=e.getChild(l);!d||d.is("uiElement")||d.is("rawElement")||this._updateElementMappings(d,t[c]),Ec(n[l]),s.equal++}else s[a]++}}_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")?U._createBefore(e.parent):e}_isSelectionInInlineFiller(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&Ie(t.parent)&&tt(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!tt(e))throw new I("view-renderer-filler-was-lost",this);Co(e)?e.remove():e.data=e.data.substr(_t),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,n=e.offset;if(!this.domConverter.mapViewToDom(t.root)||!t.is("element")||!function(s){if(s.getAttribute("contenteditable")=="false")return!1;const a=s.findAncestor(l=>l.hasAttribute("contenteditable"));return!a||a.getAttribute("contenteditable")=="true"}(t)||n===t.getFillerOffset())return!1;const i=e.nodeBefore,r=e.nodeAfter;return!(i instanceof pe||r instanceof pe)&&(!k.isAndroid||!i&&!r)}_updateText(e,t){const n=this.domConverter.findCorrespondingDomText(e);let i=this.domConverter.viewToDom(e).data;const r=t.inlineFillerPosition;r&&r.parent==e.parent&&r.offset==e.index&&(i=wi+i),Ld(n,i)}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const n=Array.from(t.attributes).map(r=>r.name),i=e.getAttributeKeys();for(const r of i)this.domConverter.setDomElementAttribute(t,r,e.getAttribute(r),e);for(const r of n)e.hasAttribute(r)||this.domConverter.removeDomElementAttribute(t,r)}_updateChildren(e,t){const n=this.domConverter.mapViewToDom(e);if(!n)return;if(k.isAndroid){let u=null;for(const g of Array.from(n.childNodes)){if(u&&Ie(u)&&Ie(g)){n.normalize();break}u=g}}const i=t.inlineFillerPosition,r=n.childNodes,s=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));i&&i.parent===e&&Vd(n.ownerDocument,s,i.offset);const a=this._diffNodeLists(r,s),l=this._findUpdateActions(a,r,s,Bv);let c=0;const d=new Set;for(const u of l)u==="delete"?(d.add(r[c]),Ec(r[c])):u!=="equal"&&u!=="update"||c++;c=0;for(const u of l)u==="insert"?(Ac(n,c,s[c]),c++):u==="update"?(Ld(r[c],s[c].data),c++):u==="equal"&&(this._markDescendantTextToSync(this.domConverter.domToView(s[c])),c++);for(const u of d)u.parentNode||this.domConverter.unbindDomElement(u)}_diffNodeLists(e,t){return e=function(n,i){const r=Array.from(n);return r.length==0||!i||r[r.length-1]==i&&r.pop(),r}(e,this._fakeSelectionContainer),F(e,t,Tv.bind(null,this.domConverter))}_findUpdateActions(e,t,n,i){if(e.indexOf("insert")===-1||e.indexOf("delete")===-1)return e;let r=[],s=[],a=[];const l={equal:0,insert:0,delete:0};for(const c of e)c==="insert"?a.push(n[l.equal+l.insert]):c==="delete"?s.push(t[l.equal+l.delete]):(r=r.concat(F(s,a,i).map(d=>d==="equal"?"update":d)),r.push("equal"),s=[],a=[]),l[c]++;return r.concat(F(s,a,i).map(c=>c==="equal"?"update":c))}_markDescendantTextToSync(e){if(e){if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(const t of e.getChildren())this._markDescendantTextToSync(t)}}_updateSelection(){if(k.isBlink&&!k.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(this.selection.rangeCount===0)return this._removeDomSelection(),void this._removeFakeSelection();const e=this.domConverter.mapViewToDom(this.selection.editableElement);this.isFocused&&e&&(this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&k.isAndroid||this._updateDomSelection(e))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=function(s){const a=s.createElement("div");return a.className="ck-fake-selection-container",Object.assign(a.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),a.textContent=" ",a}(t));const n=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(n,this.selection),!this._fakeSelectionNeedsUpdate(e))return;n.parentElement&&n.parentElement==e||e.appendChild(n),n.textContent=this.selection.fakeSelectionLabel||" ";const i=t.getSelection(),r=t.createRange();i.removeAllRanges(),r.selectNodeContents(n),i.addRange(r)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const n=this.domConverter.viewPositionToDom(this.selection.anchor),i=this.domConverter.viewPositionToDom(this.selection.focus);t.collapse(n.parent,n.offset),t.extend(i.parent,i.offset),k.isGecko&&function(r,s){const a=r.parent;if(a.nodeType!=Node.ELEMENT_NODE||r.offset!=a.childNodes.length-1)return;const l=a.childNodes[r.offset];l&&l.tagName=="BR"&&s.addRange(s.getRangeAt(0))}(i,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,n=e.ownerDocument.getSelection();return!t||t.parentElement!==e||n.anchorNode!==t&&!t.contains(n.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel}_removeDomSelection(){for(const e of this.domDocuments){const t=e.getSelection();if(t.rangeCount){const n=e.activeElement,i=this.domConverter.mapDomToView(n);n&&i&&t.removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function Vd(o,e,t){const n=e instanceof Array?e:e.childNodes,i=n[t];if(Ie(i))return i.data=wi+i.data,i;{const r=o.createTextNode(wi);return Array.isArray(e)?n.splice(t,0,r):Ac(e,t,r),r}}function Dv(o,e){return Lt(o)&&Lt(e)&&!Ie(o)&&!Ie(e)&&!On(o)&&!On(e)&&o.tagName.toLowerCase()===e.tagName.toLowerCase()}function Bv(o,e){return Lt(o)&&Lt(e)&&Ie(o)&&Ie(e)}function Tv(o,e,t){return e===t||(Ie(e)&&Ie(t)?e.data===t.data:!(!o.isBlockFiller(e)||!o.isBlockFiller(t)))}function Ld(o,e){const t=o.data;if(t==e)return;const n=R(t,e);for(const i of n)i.type==="insert"?o.insertData(i.index,i.values.join("")):o.deleteData(i.index,i.howMany)}const Iv=zd(oe.document),Pv=Od(oe.document),Rv=Nd(oe.document),Ai="data-ck-unsafe-attribute-",jd="data-ck-unsafe-element";class $d{constructor(e,{blockFillerMode:t,renderingMode:n="editing"}={}){this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new Mn,this._encounteredRawContentDomNodes=new WeakSet,this.document=e,this.renderingMode=n,this.blockFillerMode=t||(n==="editing"?"br":"nbsp"),this.preElements=["pre"],this.blockElements=["address","article","aside","blockquote","caption","center","dd","details","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","legend","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"],this.inlineObjectElements=["object","iframe","input","button","textarea","select","option","video","embed","audio","img","canvas"],this.unsafeElements=["script","style"],this._domDocument=this.renderingMode==="editing"?oe.document:oe.document.implementation.createHTMLDocument("")}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new At(t))}fakeSelectionToView(e){return this._fakeSelectionMapping.get(e)}bindElements(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}unbindDomElement(e){const t=this._domToViewMapping.get(e);if(t){this._domToViewMapping.delete(e),this._viewToDomMapping.delete(t);for(const n of Array.from(e.children))this.unbindDomElement(n)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}shouldRenderAttribute(e,t,n){return this.renderingMode==="data"||!(e=e.toLowerCase()).startsWith("on")&&(e!=="srcdoc"||!t.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i))&&(n==="img"&&(e==="src"||e==="srcset")||n==="source"&&e==="srcset"||!t.match(/^\s*(javascript:|data:(image\/svg|text\/x?html))/i))}setContentOf(e,t){if(this.renderingMode==="data")return void(e.innerHTML=t);const n=new DOMParser().parseFromString(t,"text/html"),i=n.createDocumentFragment(),r=n.body.childNodes;for(;r.length>0;)i.appendChild(r[0]);const s=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT),a=[];let l;for(;l=s.nextNode();)a.push(l);for(const c of a){for(const u of c.getAttributeNames())this.setDomElementAttribute(c,u,c.getAttribute(u));const d=c.tagName.toLowerCase();this._shouldRenameElement(d)&&(Ud(d),c.replaceWith(this._createReplacementDomElement(d,c)))}for(;e.firstChild;)e.firstChild.remove();e.append(i)}viewToDom(e,t={}){if(e.is("$text")){const n=this._processDataFromViewText(e);return this._domDocument.createTextNode(n)}{if(this.mapViewToDom(e))return this.mapViewToDom(e);let n;if(e.is("documentFragment"))n=this._domDocument.createDocumentFragment(),t.bind&&this.bindDocumentFragments(n,e);else{if(e.is("uiElement"))return n=e.name==="$comment"?this._domDocument.createComment(e.getCustomProperty("$rawContent")):e.render(this._domDocument,this),t.bind&&this.bindElements(n,e),n;this._shouldRenameElement(e.name)?(Ud(e.name),n=this._createReplacementDomElement(e.name)):n=e.hasAttribute("xmlns")?this._domDocument.createElementNS(e.getAttribute("xmlns"),e.name):this._domDocument.createElement(e.name),e.is("rawElement")&&e.render(n,this),t.bind&&this.bindElements(n,e);for(const i of e.getAttributeKeys())this.setDomElementAttribute(n,i,e.getAttribute(i),e)}if(t.withChildren!==!1)for(const i of this.viewChildrenToDom(e,t))n.appendChild(i);return n}}setDomElementAttribute(e,t,n,i){const r=this.shouldRenderAttribute(t,n,e.tagName.toLowerCase())||i&&i.shouldRenderUnsafeAttribute(t);r||Q("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:n}),_c(t)?(e.hasAttribute(t)&&!r?e.removeAttribute(t):e.hasAttribute(Ai+t)&&r&&e.removeAttribute(Ai+t),e.setAttribute(r?t:Ai+t,n)):Q("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:n})}removeDomElementAttribute(e,t){t!=jd&&(e.removeAttribute(t),e.removeAttribute(Ai+t))}*viewChildrenToDom(e,t={}){const n=e.getFillerOffset&&e.getFillerOffset();let i=0;for(const r of e.getChildren()){n===i&&(yield this._getBlockFiller());const s=r.is("element")&&!!r.getCustomProperty("dataPipeline:transparentRendering")&&!ze(r.getAttributes());s&&this.renderingMode=="data"?yield*this.viewChildrenToDom(r,t):(s&&Q("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:r}),yield this.viewToDom(r,t)),i++}n===i&&(yield this._getBlockFiller())}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),n=this.viewPositionToDom(e.end),i=this._domDocument.createRange();return i.setStart(t.parent,t.offset),i.setEnd(n.parent,n.offset),i}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const n=this.findCorrespondingDomText(t);if(!n)return null;let i=e.offset;return tt(n)&&(i+=_t),{parent:n,offset:i}}{let n,i,r;if(e.offset===0){if(n=this.mapViewToDom(t),!n)return null;r=n.childNodes[0]}else{const s=e.nodeBefore;if(i=s.is("$text")?this.findCorrespondingDomText(s):this.mapViewToDom(s),!i)return null;n=i.parentNode,r=i.nextSibling}return Ie(r)&&tt(r)?{parent:r,offset:_t}:{parent:n,offset:i?ai(i)+1:0}}}domToView(e,t={}){if(this.isBlockFiller(e))return null;const n=this.getHostViewElement(e);if(n)return n;if(On(e)&&t.skipComments)return null;if(Ie(e)){if(Co(e))return null;{const i=this._processDataFromDomText(e);return i===""?null:new pe(this.document,i)}}{if(this.mapDomToView(e))return this.mapDomToView(e);let i;if(this.isDocumentFragment(e))i=new dn(this.document),t.bind&&this.bindDocumentFragments(e,i);else{i=this._createViewElement(e,t),t.bind&&this.bindElements(e,i);const r=e.attributes;if(r)for(let s=r.length,a=0;a<s;a++)i._setAttribute(r[a].name,r[a].value);if(this._isViewElementWithRawContent(i,t)||On(e)){const s=On(e)?e.data:e.innerHTML;return i._setCustomProperty("$rawContent",s),this._encounteredRawContentDomNodes.add(e),i}}if(t.withChildren!==!1)for(const r of this.domChildrenToView(e,t))i._appendChild(r);return i}}*domChildrenToView(e,t){for(let n=0;n<e.childNodes.length;n++){const i=e.childNodes[n],r=this.domToView(i,t);r!==null&&(yield r)}}domSelectionToView(e){if(e.rangeCount===1){let i=e.getRangeAt(0).startContainer;Ie(i)&&(i=i.parentNode);const r=this.fakeSelectionToView(i);if(r)return r}const t=this.isDomSelectionBackward(e),n=[];for(let i=0;i<e.rangeCount;i++){const r=e.getRangeAt(i),s=this.domRangeToView(r);s&&n.push(s)}return new At(n,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),n=this.domPositionToView(e.endContainer,e.endOffset);return t&&n?new X(t,n):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,ai(e));const n=this.mapDomToView(e);if(n&&(n.is("uiElement")||n.is("rawElement")))return U._createBefore(n);if(Ie(e)){if(Co(e))return this.domPositionToView(e.parentNode,ai(e));const i=this.findCorrespondingViewText(e);let r=t;return i?(tt(e)&&(r-=_t,r=r<0?0:r),new U(i,r)):null}if(t===0){const i=this.mapDomToView(e);if(i)return new U(i,0)}else{const i=e.childNodes[t-1];if(Ie(i)&&Co(i)||i&&this.isBlockFiller(i))return this.domPositionToView(i.parentNode,ai(i));const r=Ie(i)?this.findCorrespondingViewText(i):this.mapDomToView(i);if(r&&r.parent)return new U(r.parent,r.index+1)}return null}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(Co(e))return null;const t=this.getHostViewElement(e);if(t)return t;const n=e.previousSibling;if(n){if(!this.isElement(n))return null;const i=this.mapDomToView(n);if(i){const r=i.nextSibling;return r instanceof pe?r:null}}else{const i=this.mapDomToView(e.parentNode);if(i){const r=i.getChild(0);return r instanceof pe?r: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:n,scrollY:i}=oe.window,r=[];Hd(t,s=>{const{scrollLeft:a,scrollTop:l}=s;r.push([a,l])}),t.focus(),Hd(t,s=>{const[a,l]=r.shift();s.scrollLeft=a,s.scrollTop=l}),oe.window.scrollTo(n,i)}}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isBlockFiller(e){return this.blockFillerMode=="br"?e.isEqualNode(Iv):!(e.tagName!=="BR"||!qd(e,this.blockElements)||e.parentNode.childNodes.length!==1)||e.isEqualNode(Rv)||function(t,n){return t.isEqualNode(Pv)&&qd(t,n)&&t.parentNode.childNodes.length===1}(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=this._domDocument.createRange();try{t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset)}catch{return!1}const n=t.collapsed;return t.detach(),n}getHostViewElement(e){const t=pc(e);for(t.pop();t.length;){const n=t.pop(),i=this._domToViewMapping.get(n);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(){switch(this.blockFillerMode){case"nbsp":return Od(this._domDocument);case"markedNbsp":return Nd(this._domDocument);case"br":return zd(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if(Ie(e)&&tt(e)&&t<_t||this.isElement(e)&&tt(e.childNodes[t]))return!1;const n=this.mapDomToView(e);return!n||!n.is("uiElement")&&!n.is("rawElement")}_processDataFromViewText(e){let t=e.data;if(e.getAncestors().some(n=>this.preElements.includes(n.name)))return t;if(t.charAt(0)==" "){const n=this._getTouchingInlineViewNode(e,!1);!(n&&n.is("$textProxy")&&this._nodeEndsWithSpace(n))&&n||(t=" "+t.substr(1))}if(t.charAt(t.length-1)==" "){const n=this._getTouchingInlineViewNode(e,!0),i=n&&n.is("$textProxy")&&n.data.charAt(0)==" ";t.charAt(t.length-2)!=" "&&n&&!i||(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g," ")}_nodeEndsWithSpace(e){if(e.getAncestors().some(n=>this.preElements.includes(n.name)))return!1;const t=this._processDataFromViewText(e);return t.charAt(t.length-1)==" "}_processDataFromDomText(e){let t=e.data;if(function(c,d){return pc(c).some(g=>g.tagName&&d.includes(g.tagName.toLowerCase()))}(e,this.preElements))return Md(e);t=t.replace(/[ \n\t\r]{1,}/g," ");const n=this._getTouchingInlineDomNode(e,!1),i=this._getTouchingInlineDomNode(e,!0),r=this._checkShouldLeftTrimDomText(e,n),s=this._checkShouldRightTrimDomText(e,i);r&&(t=t.replace(/^ /,"")),s&&(t=t.replace(/ $/,"")),t=Md(new Text(t)),t=t.replace(/ \u00A0/g," ");const a=i&&this.isElement(i)&&i.tagName!="BR",l=i&&Ie(i)&&i.data.charAt(0)==" ";return(/( |\u00A0)\u00A0$/.test(t)||!i||a||l)&&(t=t.replace(/\u00A0$/," ")),(r||n&&this.isElement(n)&&n.tagName!="BR")&&(t=t.replace(/^\u00A0/," ")),t}_checkShouldLeftTrimDomText(e,t){return!t||(this.isElement(t)?t.tagName==="BR":!this._encounteredRawContentDomNodes.has(e.previousSibling)&&/[^\S\u00A0]/.test(t.data.charAt(t.data.length-1)))}_checkShouldRightTrimDomText(e,t){return!t&&!tt(e)}_getTouchingInlineViewNode(e,t){const n=new ln({startPosition:t?U._createAfter(e):U._createBefore(e),direction:t?"forward":"backward"});for(const i of n){if(i.item.is("element")&&this.inlineObjectElements.includes(i.item.name))return i.item;if(i.item.is("containerElement")||i.item.is("element","br"))return null;if(i.item.is("$textProxy"))return i.item}return null}_getTouchingInlineDomNode(e,t){if(!e.parentNode)return null;const n=t?"firstChild":"lastChild",i=t?"nextSibling":"previousSibling";let r=!0,s=e;do if(!r&&s[n]?s=s[n]:s[i]?(s=s[i],r=!1):(s=s.parentNode,r=!0),!s||this._isBlockElement(s))return null;while(!Ie(s)&&s.tagName!="BR"&&!this._isInlineObjectElement(s));return s}_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(On(e))return new bi(this.document,"$comment");const n=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new et(this.document,n)}_isViewElementWithRawContent(e,t){return t.withChildren!==!1&&!!this._rawContentElementMatcher.match(e)}_shouldRenameElement(e){const t=e.toLowerCase();return this.renderingMode==="editing"&&this.unsafeElements.includes(t)}_createReplacementDomElement(e,t){const n=this._domDocument.createElement("span");if(n.setAttribute(jd,e),t){for(;t.firstChild;)n.appendChild(t.firstChild);for(const i of t.getAttributeNames())n.setAttribute(i,t.getAttribute(i))}return n}}function Hd(o,e){let t=o;for(;t;)e(t),t=t.parentElement}function qd(o,e){const t=o.parentNode;return!!t&&!!t.tagName&&e.includes(t.tagName.toLowerCase())}function Ud(o){o==="script"&&Q("domconverter-unsafe-script-element-detected"),o==="style"&&Q("domconverter-unsafe-style-element-detected")}class Ct extends jt(){constructor(e){super(),this._isEnabled=!1,this.view=e,this.document=e.document}get isEnabled(){return this._isEnabled}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&e.nodeType===3&&(e=e.parentNode),!(!e||e.nodeType!==1)&&e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}const Wd=as(function(o,e){Tn(e,Pn(e),o)});class Ln{constructor(e,t,n){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,Wd(this,n)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}class $t extends Ct{constructor(){super(...arguments),this.useCapture=!1}observe(e){(typeof this.domEventType=="string"?[this.domEventType]:this.domEventType).forEach(t=>{this.listenTo(e,t,(n,i)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(i.target)&&this.onDomEvent(i)},{useCapture:this.useCapture})})}stopObserving(e){this.stopListening(e)}fire(e,t,n){this.isEnabled&&this.document.fire(e,new Ln(this.view,t,n))}}class Ov extends $t{constructor(){super(...arguments),this.domEventType=["keydown","keyup"]}onDomEvent(e){const t={keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return Nn(this)}};this.fire(e.type,e,t)}}const As=function(){return dt.Date.now()};var Nv=/\s/;const zv=function(o){for(var e=o.length;e--&&Nv.test(o.charAt(e)););return e};var Mv=/^\s+/;const Fv=function(o){return o&&o.slice(0,zv(o)+1).replace(Mv,"")};var Vv=/^[-+]0x[0-9a-f]+$/i,Lv=/^0b[01]+$/i,jv=/^0o[0-7]+$/i,$v=parseInt;const Kd=function(o){if(typeof o=="number")return o;if(gi(o))return NaN;if(xe(o)){var e=typeof o.valueOf=="function"?o.valueOf():o;o=xe(e)?e+"":e}if(typeof o!="string")return o===0?o:+o;o=Fv(o);var t=Lv.test(o);return t||jv.test(o)?$v(o.slice(2),t?2:8):Vv.test(o)?NaN:+o};var Hv=Math.max,qv=Math.min;const vo=function(o,e,t){var n,i,r,s,a,l,c=0,d=!1,u=!1,g=!0;if(typeof o!="function")throw new TypeError("Expected a function");function f(z){var j=n,Y=i;return n=i=void 0,c=z,s=o.apply(Y,j)}function b(z){var j=z-l;return l===void 0||j>=e||j<0||u&&z-c>=r}function A(){var z=As();if(b(z))return E(z);a=setTimeout(A,function(j){var Y=e-(j-l);return u?qv(Y,r-(j-c)):Y}(z))}function E(z){return a=void 0,g&&n?f(z):(n=i=void 0,s)}function P(){var z=As(),j=b(z);if(n=arguments,i=this,l=z,j){if(a===void 0)return function(Y){return c=Y,a=setTimeout(A,e),d?f(Y):s}(l);if(u)return clearTimeout(a),a=setTimeout(A,e),f(l)}return a===void 0&&(a=setTimeout(A,e)),s}return e=Kd(e)||0,xe(t)&&(d=!!t.leading,r=(u="maxWait"in t)?Hv(Kd(t.maxWait)||0,e):r,g="trailing"in t?!!t.trailing:g),P.cancel=function(){a!==void 0&&clearTimeout(a),c=0,n=l=i=a=void 0},P.flush=function(){return a===void 0?s:E(As())},P};class Uv extends Ct{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=vo(t=>{this.document.fire("selectionChangeDone",t)},200)}observe(){const e=this.document;e.on("arrowKey",(t,n)=>{e.selection.isFake&&this.isEnabled&&n.preventDefault()},{context:"$capture"}),e.on("arrowKey",(t,n)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(n.keyCode)},{priority:"lowest"})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,n=new At(t.getRanges(),{backward:t.isBackward,fake:!1});e!=se.arrowleft&&e!=se.arrowup||n.setTo(n.getFirstPosition()),e!=se.arrowright&&e!=se.arrowdown||n.setTo(n.getLastPosition());const i={oldSelection:t,newSelection:n,domSelection:null};this.document.fire("selectionChange",i),this._fireSelectionChangeDoneDebounced(i)}}const Wv=function(o){return this.__data__.set(o,"__lodash_hash_undefined__"),this},Kv=function(o){return this.__data__.has(o)};function _i(o){var e=-1,t=o==null?0:o.length;for(this.__data__=new Xo;++e<t;)this.add(o[e])}_i.prototype.add=_i.prototype.push=Wv,_i.prototype.has=Kv;const Gv=_i,Zv=function(o,e){for(var t=-1,n=o==null?0:o.length;++t<n;)if(e(o[t],t,o))return!0;return!1},Jv=function(o,e){return o.has(e)},Gd=function(o,e,t,n,i,r){var s=1&t,a=o.length,l=e.length;if(a!=l&&!(s&&l>a))return!1;var c=r.get(o),d=r.get(e);if(c&&d)return c==e&&d==o;var u=-1,g=!0,f=2&t?new Gv:void 0;for(r.set(o,e),r.set(e,o);++u<a;){var b=o[u],A=e[u];if(n)var E=s?n(A,b,u,e,o,r):n(b,A,u,o,e,r);if(E!==void 0){if(E)continue;g=!1;break}if(f){if(!Zv(e,function(P,z){if(!Jv(f,z)&&(b===P||i(b,P,t,n,r)))return f.push(z)})){g=!1;break}}else if(b!==A&&!i(b,A,t,n,r)){g=!1;break}}return r.delete(o),r.delete(e),g},Yv=function(o){var e=-1,t=Array(o.size);return o.forEach(function(n,i){t[++e]=[i,n]}),t},Qv=function(o){var e=-1,t=Array(o.size);return o.forEach(function(n){t[++e]=n}),t};var Zd=kt?kt.prototype:void 0,_s=Zd?Zd.valueOf:void 0;const Xv=function(o,e,t,n,i,r,s){switch(t){case"[object DataView]":if(o.byteLength!=e.byteLength||o.byteOffset!=e.byteOffset)return!1;o=o.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(o.byteLength!=e.byteLength||!r(new ni(o),new ni(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return lo(+o,+e);case"[object Error]":return o.name==e.name&&o.message==e.message;case"[object RegExp]":case"[object String]":return o==e+"";case"[object Map]":var a=Yv;case"[object Set]":var l=1&n;if(a||(a=Qv),o.size!=e.size&&!l)return!1;var c=s.get(o);if(c)return c==e;n|=2,s.set(o,e);var d=Gd(a(o),a(e),n,i,r,s);return s.delete(o),d;case"[object Symbol]":if(_s)return _s.call(o)==_s.call(e)}return!1};var ey=Object.prototype.hasOwnProperty;const ty=function(o,e,t,n,i,r){var s=1&t,a=Pr(o),l=a.length;if(l!=Pr(e).length&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in e:ey.call(e,d)))return!1}var u=r.get(o),g=r.get(e);if(u&&g)return u==e&&g==o;var f=!0;r.set(o,e),r.set(e,o);for(var b=s;++c<l;){var A=o[d=a[c]],E=e[d];if(n)var P=s?n(E,A,d,e,o,r):n(A,E,d,o,e,r);if(!(P===void 0?A===E||i(A,E,t,n,r):P)){f=!1;break}b||(b=d=="constructor")}if(f&&!b){var z=o.constructor,j=e.constructor;z==j||!("constructor"in o)||!("constructor"in e)||typeof z=="function"&&z instanceof z&&typeof j=="function"&&j instanceof j||(f=!1)}return r.delete(o),r.delete(e),f};var Jd="[object Arguments]",Yd="[object Array]",Ci="[object Object]",Qd=Object.prototype.hasOwnProperty;const ny=function(o,e,t,n,i,r){var s=We(o),a=We(e),l=s?Yd:po(o),c=a?Yd:po(e),d=(l=l==Jd?Ci:l)==Ci,u=(c=c==Jd?Ci:c)==Ci,g=l==c;if(g&&mo(o)){if(!mo(e))return!1;s=!0,d=!1}if(g&&!d)return r||(r=new uo),s||Sr(o)?Gd(o,e,t,n,i,r):Xv(o,e,l,t,n,i,r);if(!(1&t)){var f=d&&Qd.call(o,"__wrapped__"),b=u&&Qd.call(e,"__wrapped__");if(f||b){var A=f?o.value():o,E=b?e.value():e;return r||(r=new uo),i(A,E,t,n,r)}}return!!g&&(r||(r=new uo),ty(o,e,t,n,i,r))},Xd=function o(e,t,n,i,r){return e===t||(e==null||t==null||!st(e)&&!st(t)?e!=e&&t!=t:ny(e,t,n,i,o,r))},oy=function(o,e,t){var n=(t=typeof t=="function"?t:void 0)?t(o,e):void 0;return n===void 0?Xd(o,e,void 0,t):!!n};class eh extends Ct{constructor(e){super(e),this._config={childList:!0,characterData:!0,subtree:!0},this.domConverter=e.domConverter,this.renderer=e._renderer,this._domElements=new Set,this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.add(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}stopObserving(e){if(this._domElements.delete(e),this.isEnabled){this._mutationObserver.disconnect();for(const t of this._domElements)this._mutationObserver.observe(t,this._config)}}enable(){super.enable();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(e.length===0)return;const t=this.domConverter,n=new Set,i=new Set;for(const s of e){const a=t.mapDomToView(s.target);a&&(a.is("uiElement")||a.is("rawElement")||s.type!=="childList"||this._isBogusBrMutation(s)||i.add(a))}for(const s of e){const a=t.mapDomToView(s.target);if((!a||!a.is("uiElement")&&!a.is("rawElement"))&&s.type==="characterData"){const l=t.findCorrespondingViewText(s.target);l&&!i.has(l.parent)?n.add(l):!l&&tt(s.target)&&i.add(t.mapDomToView(s.target.parentNode))}}let r=!1;for(const s of n)r=!0,this.renderer.markToSync("text",s);for(const s of i){const a=t.mapViewToDom(s),l=Array.from(s.getChildren()),c=Array.from(t.domChildrenToView(a,{withChildren:!1}));oy(l,c,iy)||(r=!0,this.renderer.markToSync("children",s))}r&&this.view.forceRender()}_isBogusBrMutation(e){let t=null;return e.nextSibling===null&&e.removedNodes.length===0&&e.addedNodes.length==1&&(t=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),t&&t.is("element","br")}}function iy(o,e){if(!Array.isArray(o))return o===e||!(!o.is("$text")||!e.is("$text"))&&o.data===e.data}class Cs extends $t{constructor(e){super(e),this._isFocusChanging=!1,this.domEventType=["focus","blur"],this.useCapture=!0;const t=this.document;t.on("focus",()=>{this._isFocusChanging=!0,this._renderTimeoutId=setTimeout(()=>{this.flush(),e.change(()=>{})},50)}),t.on("blur",(n,i)=>{const r=t.selection.editableElement;r!==null&&r!==i.target||(t.isFocused=!1,this._isFocusChanging=!1,e.change(()=>{}))})}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}class ry extends Ct{constructor(e){super(e),this.mutationObserver=e.getObserver(eh),this.focusObserver=e.getObserver(Cs),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=vo(t=>{this.document.fire("selectionChangeDone",t)},200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._documentIsSelectingInactivityTimeoutDebounced=vo(()=>this.document.isSelecting=!1,5e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument,n=()=>{this.document.isSelecting&&(this._handleSelectionChange(null,t),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,"selectstart",()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()},{priority:"highest"}),this.listenTo(e,"keydown",n,{priority:"highest",useCapture:!0}),this.listenTo(e,"keyup",n,{priority:"highest",useCapture:!0}),this._documents.has(t)||(this.listenTo(t,"mouseup",n,{priority:"highest",useCapture:!0}),this.listenTo(t,"selectionchange",(i,r)=>{this.document.isComposing&&!k.isAndroid||(this._handleSelectionChange(r,t),this._documentIsSelectingInactivityTimeoutDebounced())}),this._documents.add(t))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e,t){if(!this.isEnabled)return;const n=t.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(n.anchorNode))return;this.mutationObserver.flush();const i=this.domConverter.domSelectionToView(n);if(i.rangeCount!=0){if(this.view.hasDomSelection=!0,!this.selection.isEqual(i)||!this.domConverter.isDomSelectionCorrect(n))if(++this._loopbackCounter>60)this._reportInfiniteLoop();else if(this.focusObserver.flush(),this.selection.isSimilar(i))this.view.forceRender();else{const r={oldSelection:this.selection,newSelection:i,domSelection:n};this.document.fire("selectionChange",r),this._fireSelectionChangeDoneDebounced(r)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class sy extends $t{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const t=this.document;t.on("compositionstart",()=>{t.isComposing=!0},{priority:"low"}),t.on("compositionend",()=>{t.isComposing=!1},{priority:"low"})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}}class th{constructor(e,t={}){this._files=t.cacheFiles?nh(e):null,this._native=e}get files(){return this._files||(this._files=nh(this._native)),this._files}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}set effectAllowed(e){this._native.effectAllowed=e}get effectAllowed(){return this._native.effectAllowed}set dropEffect(e){this._native.dropEffect=e}get dropEffect(){return this._native.dropEffect}setDragImage(e,t,n){this._native.setDragImage(e,t,n)}get isCanceled(){return this._native.dropEffect=="none"||!!this._native.mozUserCancelled}}function nh(o){const e=Array.from(o.files||[]),t=Array.from(o.items||[]);return e.length?e:t.filter(n=>n.kind==="file").map(n=>n.getAsFile())}class ay extends $t{constructor(){super(...arguments),this.domEventType="beforeinput"}onDomEvent(e){const t=e.getTargetRanges(),n=this.view,i=n.document;let r=null,s=null,a=[];if(e.dataTransfer&&(r=new th(e.dataTransfer)),e.data!==null?s=e.data:r&&(s=r.getData("text/plain")),i.selection.isFake)a=Array.from(i.selection.getRanges());else if(t.length)a=t.map(l=>n.domConverter.domRangeToView(l));else if(k.isAndroid){const l=e.target.ownerDocument.defaultView.getSelection();a=Array.from(n.domConverter.domSelectionToView(l).getRanges())}if(k.isAndroid&&e.inputType=="insertCompositionText"&&s&&s.endsWith(`
|
|
6517
|
+
/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(Se))))," */")),Z.styleSheet)Z.styleSheet.cssText=Q;else{for(;Z.firstChild;)Z.removeChild(Z.firstChild);Z.appendChild(document.createTextNode(Q))}}var K=null,J=0;function te(Z,ee){var I,Q,_e;if(ee.singleton){var Se=J++;I=K||(K=T(ee)),Q=L.bind(null,I,Se,!1),_e=L.bind(null,I,Se,!0)}else I=T(ee),Q=$.bind(null,I,ee),_e=function(){(function(Te){if(Te.parentNode===null)return!1;Te.parentNode.removeChild(Te)})(I)};return Q(Z),function(Te){if(Te){if(Te.css===Z.css&&Te.media===Z.media&&Te.sourceMap===Z.sourceMap)return;Q(Z=Te)}else _e()}}w.exports=function(Z,ee){(ee=ee||{}).singleton||typeof ee.singleton=="boolean"||(ee.singleton=B());var I=R(Z=Z||[],ee);return function(Q){if(Q=Q||[],Object.prototype.toString.call(Q)==="[object Array]"){for(var _e=0;_e<I.length;_e++){var Se=_(I[_e]);k[Se].references--}for(var Te=R(Q,ee),Ft=0;Ft<I.length;Ft++){var gt=_(I[Ft]);k[gt].references===0&&(k[gt].updater(),k.splice(gt,1))}I=Te}}}}},N={};function D(w){var S=N[w];if(S!==void 0)return S.exports;var p=N[w]={id:w,exports:{}};return C[w](p,p.exports,D),p.exports}D.n=w=>{var S=w&&w.__esModule?()=>w.default:()=>w;return D.d(S,{a:S}),S},D.d=(w,S)=>{for(var p in S)D.o(S,p)&&!D.o(w,p)&&Object.defineProperty(w,p,{enumerable:!0,get:S[p]})},D.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}}(),D.o=(w,S)=>Object.prototype.hasOwnProperty.call(w,S),D.nc=void 0;var M={};return(()=>{function w({emitter:o,activator:e,callback:t,contextElements:n}){o.listenTo(document,"mousedown",(i,r)=>{if(!e())return;const s=typeof r.composedPath=="function"?r.composedPath():[],a=typeof n=="function"?n():n;for(const l of a)if(l.contains(r.target)||s.includes(l))return;t()})}function S(o){return class extends o{disableCssTransitions(){this._isCssTransitionsDisabled=!0}enableCssTransitions(){this._isCssTransitionsDisabled=!1}constructor(...e){super(...e),this.set("_isCssTransitionsDisabled",!1),this.initializeCssTransitionDisablerMixin()}initializeCssTransitionDisablerMixin(){this.extendTemplate({attributes:{class:[this.bindTemplate.if("_isCssTransitionsDisabled","ck-transitions-disabled")]}})}}}function p({view:o}){o.listenTo(o.element,"submit",(e,t)=>{t.preventDefault(),o.fire("submit")},{useCapture:!0})}D.d(M,{default:()=>$a});const y=function(){try{return navigator.userAgent.toLowerCase()}catch{return""}}(),B={isMac:_(y),isWindows:(v=y,v.indexOf("windows")>-1),isGecko:function(o){return!!o.match(/gecko\/\d+/)}(y),isSafari:function(o){return o.indexOf(" applewebkit/")>-1&&o.indexOf("chrome")===-1}(y),isiOS:function(o){return!!o.match(/iphone|ipad/i)||_(o)&&navigator.maxTouchPoints>0}(y),isAndroid:function(o){return o.indexOf("android")>-1}(y),isBlink:function(o){return o.indexOf("chrome/")>-1&&o.indexOf("edge/")<0}(y),features:{isRegExpUnicodePropertySupported:function(){let o=!1;try{o="ć".search(new RegExp("[\\p{L}]","u"))===0}catch{}return o}()}};var v;const k=B;function _(o){return o.indexOf("macintosh")>-1}function R(o,e,t,n){t=t||function(l,c){return l===c};const i=Array.isArray(o)?o:Array.prototype.slice.call(o),r=Array.isArray(e)?e:Array.prototype.slice.call(e),s=function(l,c,d){const u=T(l,c,d);if(u===-1)return{firstIndex:-1,lastIndexOld:-1,lastIndexNew:-1};const g=O(l,u),f=O(c,u),b=T(g,f,d),A=l.length-b,E=c.length-b;return{firstIndex:u,lastIndexOld:A,lastIndexNew:E}}(i,r,t);return n?function(l,c){const{firstIndex:d,lastIndexOld:u,lastIndexNew:g}=l;if(d===-1)return Array(c).fill("equal");let f=[];return d>0&&(f=f.concat(Array(d).fill("equal"))),g-d>0&&(f=f.concat(Array(g-d).fill("insert"))),u-d>0&&(f=f.concat(Array(u-d).fill("delete"))),g<c&&(f=f.concat(Array(c-g).fill("equal"))),f}(s,r.length):function(l,c){const d=[],{firstIndex:u,lastIndexOld:g,lastIndexNew:f}=c;return f-u>0&&d.push({index:u,type:"insert",values:l.slice(u,f)}),g-u>0&&d.push({index:u+(f-u),type:"delete",howMany:g-u}),d}(r,s)}function T(o,e,t){for(let n=0;n<Math.max(o.length,e.length);n++)if(o[n]===void 0||e[n]===void 0||!t(o[n],e[n]))return n;return-1}function O(o,e){return o.slice(e).reverse()}function F(o,e,t){t=t||function(A,E){return A===E};const n=o.length,i=e.length;if(n>200||i>200||n+i>300)return F.fastDiff(o,e,t,!0);let r,s;if(i<n){const A=o;o=e,e=A,r="delete",s="insert"}else r="insert",s="delete";const a=o.length,l=e.length,c=l-a,d={},u={};function g(A){const E=(u[A-1]!==void 0?u[A-1]:-1)+1,P=u[A+1]!==void 0?u[A+1]:-1,z=E>P?-1:1;d[A+z]&&(d[A]=d[A+z].slice(0)),d[A]||(d[A]=[]),d[A].push(E>P?r:s);let j=Math.max(E,P),Y=j-A;for(;Y<a&&j<l&&t(o[Y],e[j]);)Y++,j++,d[A].push("equal");return j}let f,b=0;do{for(f=-b;f<c;f++)u[f]=g(f);for(f=c+b;f>c;f--)u[f]=g(f);u[c]=g(c),b++}while(u[c]!==l);return d[c].slice(1)}F.fastDiff=R;const L=function(){return function o(){o.called=!0}};class ${constructor(e,t){this.source=e,this.name=t,this.path=[],this.stop=L(),this.off=L()}}const K=new Array(256).fill("").map((o,e)=>("0"+e.toString(16)).slice(-2));function J(){const o=4294967296*Math.random()>>>0,e=4294967296*Math.random()>>>0,t=4294967296*Math.random()>>>0,n=4294967296*Math.random()>>>0;return"e"+K[o>>0&255]+K[o>>8&255]+K[o>>16&255]+K[o>>24&255]+K[e>>0&255]+K[e>>8&255]+K[e>>16&255]+K[e>>24&255]+K[t>>0&255]+K[t>>8&255]+K[t>>16&255]+K[t>>24&255]+K[n>>0&255]+K[n>>8&255]+K[n>>16&255]+K[n>>24&255]}const te={get(o="normal"){return typeof o!="number"?this[o]||this.normal:o},highest:1e5,high:1e3,normal:0,low:-1e3,lowest:-1e5};function Z(o,e){const t=te.get(e.priority);for(let n=0;n<o.length;n++)if(te.get(o[n].priority)<t)return void o.splice(n,0,e);o.push(e)}const ee="https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html";class I extends Error{constructor(e,t,n){super(function(i,r){const s=new WeakSet,a=(d,u)=>{if(typeof u=="object"&&u!==null){if(s.has(u))return`[object ${u.constructor.name}]`;s.add(u)}return u},l=r?` ${JSON.stringify(r,a)}`:"",c=_e(i);return i+l+c}(e,n)),this.name="CKEditorError",this.context=t,this.data=n}is(e){return e==="CKEditorError"}static rethrowUnexpectedError(e,t){if(e.is&&e.is("CKEditorError"))throw e;const n=new I(e.message,t);throw n.stack=e.stack,n}}function Q(o,e){console.warn(...Se(o,e))}function _e(o){return`
|
|
6518
|
+
Read more: ${ee}#error-${o}`}function Se(o,e){const t=_e(o);return e?[o,e,t]:[o,t]}const Te="38.0.1",Ft=new Date(2023,4,23),gt=typeof window=="object"?window:D.g;if(gt.CKEDITOR_VERSION)throw new I("ckeditor-duplicated-modules",null);gt.CKEDITOR_VERSION=Te;const pt=Symbol("listeningTo"),yn=Symbol("emitterId"),Et=Symbol("delegations"),ml=me(Object);function me(o){return o?class extends o{on(e,t,n){this.listenTo(this,e,t,n)}once(e,t,n){let i=!1;this.listenTo(this,e,(r,...s)=>{i||(i=!0,r.off(),t.call(this,r,...s))},n)}off(e,t){this.stopListening(this,e,t)}listenTo(e,t,n,i={}){let r,s;this[pt]||(this[pt]={});const a=this[pt];mr(e)||gl(e);const l=mr(e);(r=a[l])||(r=a[l]={emitter:e,callbacks:{}}),(s=r.callbacks[t])||(s=r.callbacks[t]=[]),s.push(n),function(c,d,u,g,f){d._addEventListener?d._addEventListener(u,g,f):c._addEventListener.call(d,u,g,f)}(this,e,t,n,i)}stopListening(e,t,n){const i=this[pt];let r=e&&mr(e);const s=i&&r?i[r]:void 0,a=s&&t?s.callbacks[t]:void 0;if(!(!i||e&&!s||t&&!a))if(n)pr(this,e,t,n),a.indexOf(n)!==-1&&(a.length===1?delete s.callbacks[t]:pr(this,e,t,n));else if(a){for(;n=a.pop();)pr(this,e,t,n);delete s.callbacks[t]}else if(s){for(t in s.callbacks)this.stopListening(e,t);delete i[r]}else{for(r in i)this.stopListening(i[r].emitter);delete this[pt]}}fire(e,...t){try{const n=e instanceof $?e:new $(this,e),i=n.name;let r=fl(this,i);if(n.path.push(this),r){const a=[n,...t];r=Array.from(r);for(let l=0;l<r.length&&(r[l].callback.apply(this,a),n.off.called&&(delete n.off.called,this._removeEventListener(i,r[l].callback)),!n.stop.called);l++);}const s=this[Et];if(s){const a=s.get(i),l=s.get("*");a&&kl(a,n,t),l&&kl(l,n,t)}return n.return}catch(n){I.rethrowUnexpectedError(n,this)}}delegate(...e){return{to:(t,n)=>{this[Et]||(this[Et]=new Map),e.forEach(i=>{const r=this[Et].get(i);r?r.set(t,n):this[Et].set(i,new Map([[t,n]]))})}}}stopDelegating(e,t){if(this[Et])if(e)if(t){const n=this[Et].get(e);n&&n.delete(t)}else this[Et].delete(e);else this[Et].clear()}_addEventListener(e,t,n){(function(s,a){const l=pl(s);if(l[a])return;let c=a,d=null;const u=[];for(;c!==""&&!l[c];)l[c]={callbacks:[],childEvents:[]},u.push(l[c]),d&&l[c].childEvents.push(d),d=c,c=c.substr(0,c.lastIndexOf(":"));if(c!==""){for(const g of u)g.callbacks=l[c].callbacks.slice();l[c].childEvents.push(d)}})(this,e);const i=gr(this,e),r={callback:t,priority:te.get(n.priority)};for(const s of i)Z(s,r)}_removeEventListener(e,t){const n=gr(this,e);for(const i of n)for(let r=0;r<i.length;r++)i[r].callback==t&&(i.splice(r,1),r--)}}:ml}function gl(o,e){o[yn]||(o[yn]=e||J())}function mr(o){return o[yn]}function pl(o){return o._events||Object.defineProperty(o,"_events",{value:{}}),o._events}function gr(o,e){const t=pl(o)[e];if(!t)return[];let n=[t.callbacks];for(let i=0;i<t.childEvents.length;i++){const r=gr(o,t.childEvents[i]);n=n.concat(r)}return n}function fl(o,e){let t;return o._events&&(t=o._events[e])&&t.callbacks.length?t.callbacks:e.indexOf(":")>-1?fl(o,e.substr(0,e.lastIndexOf(":"))):null}function kl(o,e,t){for(let[n,i]of o){i?typeof i=="function"&&(i=i(e.name)):i=e.name;const r=new $(e.source,i);r.path=[...e.path],n.fire(r,...t)}}function pr(o,e,t,n){e._removeEventListener?e._removeEventListener(t,n):o._removeEventListener.call(e,t,n)}["on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(o=>{me[o]=ml.prototype[o]});const xe=function(o){var e=typeof o;return o!=null&&(e=="object"||e=="function")},Ko=Symbol("observableProperties"),Go=Symbol("boundObservables"),Zo=Symbol("boundProperties"),En=Symbol("decoratedMethods"),bl=Symbol("decoratedOriginal"),wl=ge(me());function ge(o){return o?class extends o{set(e,t){if(xe(e))return void Object.keys(e).forEach(i=>{this.set(i,e[i])},this);fr(this);const n=this[Ko];if(e in this&&!n.has(e))throw new I("observable-set-cannot-override",this);Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>n.get(e),set(i){const r=n.get(e);let s=this.fire(`set:${e}`,e,i,r);s===void 0&&(s=i),r===s&&n.has(e)||(n.set(e,s),this.fire(`change:${e}`,e,s,r))}}),this[e]=t}bind(...e){if(!e.length||!Al(e))throw new I("observable-bind-wrong-properties",this);if(new Set(e).size!==e.length)throw new I("observable-bind-duplicate-properties",this);fr(this);const t=this[Zo];e.forEach(i=>{if(t.has(i))throw new I("observable-bind-rebind",this)});const n=new Map;return e.forEach(i=>{const r={property:i,to:[]};t.set(i,r),n.set(i,r)}),{to:C0,toMany:v0,_observable:this,_bindProperties:e,_to:[],_bindings:n}}unbind(...e){if(!this[Ko])return;const t=this[Zo],n=this[Go];if(e.length){if(!Al(e))throw new I("observable-unbind-wrong-properties",this);e.forEach(i=>{const r=t.get(i);r&&(r.to.forEach(([s,a])=>{const l=n.get(s),c=l[a];c.delete(r),c.size||delete l[a],Object.keys(l).length||(n.delete(s),this.stopListening(s,"change"))}),t.delete(i))})}else n.forEach((i,r)=>{this.stopListening(r,"change")}),n.clear(),t.clear()}decorate(e){fr(this);const t=this[e];if(!t)throw new I("observablemixin-cannot-decorate-undefined",this,{object:this,methodName:e});this.on(e,(n,i)=>{n.return=t.apply(this,i)}),this[e]=function(...n){return this.fire(e,n)},this[e][bl]=t,this[En]||(this[En]=[]),this[En].push(e)}stopListening(e,t,n){if(!e&&this[En]){for(const i of this[En])this[i]=this[i][bl];delete this[En]}super.stopListening(e,t,n)}}:wl}function fr(o){o[Ko]||(Object.defineProperty(o,Ko,{value:new Map}),Object.defineProperty(o,Go,{value:new Map}),Object.defineProperty(o,Zo,{value:new Map}))}function C0(...o){const e=function(...r){if(!r.length)throw new I("observable-bind-to-parse-error",null);const s={to:[]};let a;return typeof r[r.length-1]=="function"&&(s.callback=r.pop()),r.forEach(l=>{if(typeof l=="string")a.properties.push(l);else{if(typeof l!="object")throw new I("observable-bind-to-parse-error",null);a={observable:l,properties:[]},s.to.push(a)}}),s}(...o),t=Array.from(this._bindings.keys()),n=t.length;if(!e.callback&&e.to.length>1)throw new I("observable-bind-to-no-callback",this);if(n>1&&e.callback)throw new I("observable-bind-to-extra-callback",this);var i;e.to.forEach(r=>{if(r.properties.length&&r.properties.length!==n)throw new I("observable-bind-to-properties-length",this);r.properties.length||(r.properties=this._bindProperties)}),this._to=e.to,e.callback&&(this._bindings.get(t[0]).callback=e.callback),i=this._observable,this._to.forEach(r=>{const s=i[Go];let a;s.get(r.observable)||i.listenTo(r.observable,"change",(l,c)=>{a=s.get(r.observable)[c],a&&a.forEach(d=>{_l(i,d.property)})})}),function(r){let s;r._bindings.forEach((a,l)=>{r._to.forEach(c=>{s=c.properties[a.callback?0:r._bindProperties.indexOf(l)],a.to.push([c.observable,s]),function(d,u,g,f){const b=d[Go],A=b.get(g),E=A||{};E[f]||(E[f]=new Set),E[f].add(u),A||b.set(g,E)}(r._observable,a,c.observable,s)})})}(this),this._bindProperties.forEach(r=>{_l(this._observable,r)})}function v0(o,e,t){if(this._bindings.size>1)throw new I("observable-bind-to-many-not-one-binding",this);this.to(...function(n,i){const r=n.map(s=>[s,i]);return Array.prototype.concat.apply([],r)}(o,e),t)}function Al(o){return o.every(e=>typeof e=="string")}function _l(o,e){const t=o[Zo].get(e);let n;t.callback?n=t.callback.apply(o,t.to.map(i=>i[0][i[1]])):(n=t.to[0],n=n[0][n[1]]),Object.prototype.hasOwnProperty.call(o,e)?o[e]=n:o.set(e,n)}["set","bind","unbind","decorate","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(o=>{ge[o]=wl.prototype[o]});class Cl{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=[]}}function kr(o){let e=0;for(const t of o)e++;return e}function Ue(o,e){const t=Math.min(o.length,e.length);for(let n=0;n<t;n++)if(o[n]!=e[n])return n;return o.length==e.length?"same":o.length<e.length?"prefix":"extension"}function Xe(o){return!(!o||!o[Symbol.iterator])}const vl=typeof Uo=="object"&&Uo&&Uo.Object===Object&&Uo;var y0=typeof self=="object"&&self&&self.Object===Object&&self;const ct=vl||y0||Function("return this")(),ft=ct.Symbol;var yl=Object.prototype,E0=yl.hasOwnProperty,x0=yl.toString,ao=ft?ft.toStringTag:void 0;const S0=function(o){var e=E0.call(o,ao),t=o[ao];try{o[ao]=void 0;var n=!0}catch{}var i=x0.call(o);return n&&(e?o[ao]=t:delete o[ao]),i};var D0=Object.prototype.toString;const B0=function(o){return D0.call(o)};var El=ft?ft.toStringTag:void 0;const Vt=function(o){return o==null?o===void 0?"[object Undefined]":"[object Null]":El&&El in Object(o)?S0(o):B0(o)},We=Array.isArray,rt=function(o){return o!=null&&typeof o=="object"},xl=function(o){return typeof o=="string"||!We(o)&&rt(o)&&Vt(o)=="[object String]"};function br(o,e,t={},n=[]){const i=t&&t.xmlns,r=i?o.createElementNS(i,e):o.createElement(e);for(const s in t)r.setAttribute(s,t[s]);!xl(n)&&Xe(n)||(n=[n]);for(let s of n)xl(s)&&(s=o.createTextNode(s)),r.appendChild(s);return r}const Sl=function(o,e){return function(t){return o(e(t))}},wr=Sl(Object.getPrototypeOf,Object);var T0=Function.prototype,I0=Object.prototype,Dl=T0.toString,P0=I0.hasOwnProperty,R0=Dl.call(Object);const Ke=function(o){if(!rt(o)||Vt(o)!="[object Object]")return!1;var e=wr(o);if(e===null)return!0;var t=P0.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Dl.call(t)==R0},O0=function(){this.__data__=[],this.size=0},lo=function(o,e){return o===e||o!=o&&e!=e},Jo=function(o,e){for(var t=o.length;t--;)if(lo(o[t][0],e))return t;return-1};var N0=Array.prototype.splice;const z0=function(o){var e=this.__data__,t=Jo(e,o);return!(t<0)&&(t==e.length-1?e.pop():N0.call(e,t,1),--this.size,!0)},M0=function(o){var e=this.__data__,t=Jo(e,o);return t<0?void 0:e[t][1]},F0=function(o){return Jo(this.__data__,o)>-1},V0=function(o,e){var t=this.__data__,n=Jo(t,o);return n<0?(++this.size,t.push([o,e])):t[n][1]=e,this};function xn(o){var e=-1,t=o==null?0:o.length;for(this.clear();++e<t;){var n=o[e];this.set(n[0],n[1])}}xn.prototype.clear=O0,xn.prototype.delete=z0,xn.prototype.get=M0,xn.prototype.has=F0,xn.prototype.set=V0;const Yo=xn,L0=function(){this.__data__=new Yo,this.size=0},j0=function(o){var e=this.__data__,t=e.delete(o);return this.size=e.size,t},$0=function(o){return this.__data__.get(o)},H0=function(o){return this.__data__.has(o)},Qt=function(o){if(!xe(o))return!1;var e=Vt(o);return e=="[object Function]"||e=="[object GeneratorFunction]"||e=="[object AsyncFunction]"||e=="[object Proxy]"},Ar=ct["__core-js_shared__"];var Bl=function(){var o=/[^.]+$/.exec(Ar&&Ar.keys&&Ar.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}();const q0=function(o){return!!Bl&&Bl in o};var U0=Function.prototype.toString;const Xt=function(o){if(o!=null){try{return U0.call(o)}catch{}try{return o+""}catch{}}return""};var W0=/^\[object .+?Constructor\]$/,K0=Function.prototype,G0=Object.prototype,Z0=K0.toString,J0=G0.hasOwnProperty,Y0=RegExp("^"+Z0.call(J0).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");const Q0=function(o){return!(!xe(o)||q0(o))&&(Qt(o)?Y0:W0).test(Xt(o))},X0=function(o,e){return o==null?void 0:o[e]},en=function(o,e){var t=X0(o,e);return Q0(t)?t:void 0},co=en(ct,"Map"),ho=en(Object,"create"),e_=function(){this.__data__=ho?ho(null):{},this.size=0},t_=function(o){var e=this.has(o)&&delete this.__data__[o];return this.size-=e?1:0,e};var n_=Object.prototype.hasOwnProperty;const o_=function(o){var e=this.__data__;if(ho){var t=e[o];return t==="__lodash_hash_undefined__"?void 0:t}return n_.call(e,o)?e[o]:void 0};var i_=Object.prototype.hasOwnProperty;const r_=function(o){var e=this.__data__;return ho?e[o]!==void 0:i_.call(e,o)},s_=function(o,e){var t=this.__data__;return this.size+=this.has(o)?0:1,t[o]=ho&&e===void 0?"__lodash_hash_undefined__":e,this};function Sn(o){var e=-1,t=o==null?0:o.length;for(this.clear();++e<t;){var n=o[e];this.set(n[0],n[1])}}Sn.prototype.clear=e_,Sn.prototype.delete=t_,Sn.prototype.get=o_,Sn.prototype.has=r_,Sn.prototype.set=s_;const Tl=Sn,a_=function(){this.size=0,this.__data__={hash:new Tl,map:new(co||Yo),string:new Tl}},l_=function(o){var e=typeof o;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?o!=="__proto__":o===null},Qo=function(o,e){var t=o.__data__;return l_(e)?t[typeof e=="string"?"string":"hash"]:t.map},c_=function(o){var e=Qo(this,o).delete(o);return this.size-=e?1:0,e},d_=function(o){return Qo(this,o).get(o)},h_=function(o){return Qo(this,o).has(o)},u_=function(o,e){var t=Qo(this,o),n=t.size;return t.set(o,e),this.size+=t.size==n?0:1,this};function Dn(o){var e=-1,t=o==null?0:o.length;for(this.clear();++e<t;){var n=o[e];this.set(n[0],n[1])}}Dn.prototype.clear=a_,Dn.prototype.delete=c_,Dn.prototype.get=d_,Dn.prototype.has=h_,Dn.prototype.set=u_;const Xo=Dn,m_=function(o,e){var t=this.__data__;if(t instanceof Yo){var n=t.__data__;if(!co||n.length<199)return n.push([o,e]),this.size=++t.size,this;t=this.__data__=new Xo(n)}return t.set(o,e),this.size=t.size,this};function Bn(o){var e=this.__data__=new Yo(o);this.size=e.size}Bn.prototype.clear=L0,Bn.prototype.delete=j0,Bn.prototype.get=$0,Bn.prototype.has=H0,Bn.prototype.set=m_;const uo=Bn,g_=function(o,e){for(var t=-1,n=o==null?0:o.length;++t<n&&e(o[t],t,o)!==!1;);return o},ei=function(){try{var o=en(Object,"defineProperty");return o({},"",{}),o}catch{}}(),_r=function(o,e,t){e=="__proto__"&&ei?ei(o,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):o[e]=t};var p_=Object.prototype.hasOwnProperty;const Cr=function(o,e,t){var n=o[e];p_.call(o,e)&&lo(n,t)&&(t!==void 0||e in o)||_r(o,e,t)},Tn=function(o,e,t,n){var i=!t;t||(t={});for(var r=-1,s=e.length;++r<s;){var a=e[r],l=void 0;l===void 0&&(l=o[a]),i?_r(t,a,l):Cr(t,a,l)}return t},f_=function(o,e){for(var t=-1,n=Array(o);++t<o;)n[t]=e(t);return n},Il=function(o){return rt(o)&&Vt(o)=="[object Arguments]"};var Pl=Object.prototype,k_=Pl.hasOwnProperty,b_=Pl.propertyIsEnumerable;const vr=Il(function(){return arguments}())?Il:function(o){return rt(o)&&k_.call(o,"callee")&&!b_.call(o,"callee")},w_=function(){return!1};var Rl=x&&!x.nodeType&&x,Ol=Rl&&!0&&m&&!m.nodeType&&m,Nl=Ol&&Ol.exports===Rl?ct.Buffer:void 0;const mo=(Nl?Nl.isBuffer:void 0)||w_;var A_=/^(?:0|[1-9]\d*)$/;const yr=function(o,e){var t=typeof o;return!!(e=e??9007199254740991)&&(t=="number"||t!="symbol"&&A_.test(o))&&o>-1&&o%1==0&&o<e},zl=function(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=9007199254740991};var 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;const __=function(o){return rt(o)&&zl(o.length)&&!!ye[Vt(o)]},Er=function(o){return function(e){return o(e)}};var Ml=x&&!x.nodeType&&x,go=Ml&&!0&&m&&!m.nodeType&&m,xr=go&&go.exports===Ml&&vl.process;const In=function(){try{var o=go&&go.require&&go.require("util").types;return o||xr&&xr.binding&&xr.binding("util")}catch{}}();var Fl=In&&In.isTypedArray;const Sr=Fl?Er(Fl):__;var C_=Object.prototype.hasOwnProperty;const Vl=function(o,e){var t=We(o),n=!t&&vr(o),i=!t&&!n&&mo(o),r=!t&&!n&&!i&&Sr(o),s=t||n||i||r,a=s?f_(o.length,String):[],l=a.length;for(var c in o)!e&&!C_.call(o,c)||s&&(c=="length"||i&&(c=="offset"||c=="parent")||r&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||yr(c,l))||a.push(c);return a};var v_=Object.prototype;const Dr=function(o){var e=o&&o.constructor;return o===(typeof e=="function"&&e.prototype||v_)},y_=Sl(Object.keys,Object);var E_=Object.prototype.hasOwnProperty;const x_=function(o){if(!Dr(o))return y_(o);var e=[];for(var t in Object(o))E_.call(o,t)&&t!="constructor"&&e.push(t);return e},ti=function(o){return o!=null&&zl(o.length)&&!Qt(o)},Br=function(o){return ti(o)?Vl(o):x_(o)},S_=function(o,e){return o&&Tn(e,Br(e),o)},D_=function(o){var e=[];if(o!=null)for(var t in Object(o))e.push(t);return e};var B_=Object.prototype.hasOwnProperty;const T_=function(o){if(!xe(o))return D_(o);var e=Dr(o),t=[];for(var n in o)(n!="constructor"||!e&&B_.call(o,n))&&t.push(n);return t},Pn=function(o){return ti(o)?Vl(o,!0):T_(o)},I_=function(o,e){return o&&Tn(e,Pn(e),o)};var Ll=x&&!x.nodeType&&x,jl=Ll&&!0&&m&&!m.nodeType&&m,$l=jl&&jl.exports===Ll?ct.Buffer:void 0,Hl=$l?$l.allocUnsafe:void 0;const ql=function(o,e){if(e)return o.slice();var t=o.length,n=Hl?Hl(t):new o.constructor(t);return o.copy(n),n},Tr=function(o,e){var t=-1,n=o.length;for(e||(e=Array(n));++t<n;)e[t]=o[t];return e},P_=function(o,e){for(var t=-1,n=o==null?0:o.length,i=0,r=[];++t<n;){var s=o[t];e(s,t,o)&&(r[i++]=s)}return r},Ul=function(){return[]};var R_=Object.prototype.propertyIsEnumerable,Wl=Object.getOwnPropertySymbols;const Ir=Wl?function(o){return o==null?[]:(o=Object(o),P_(Wl(o),function(e){return R_.call(o,e)}))}:Ul,O_=function(o,e){return Tn(o,Ir(o),e)},Kl=function(o,e){for(var t=-1,n=e.length,i=o.length;++t<n;)o[i+t]=e[t];return o},Gl=Object.getOwnPropertySymbols?function(o){for(var e=[];o;)Kl(e,Ir(o)),o=wr(o);return e}:Ul,N_=function(o,e){return Tn(o,Gl(o),e)},Zl=function(o,e,t){var n=e(o);return We(o)?n:Kl(n,t(o))},Pr=function(o){return Zl(o,Br,Ir)},z_=function(o){return Zl(o,Pn,Gl)},Rr=en(ct,"DataView"),Or=en(ct,"Promise"),Nr=en(ct,"Set"),zr=en(ct,"WeakMap");var Jl="[object Map]",Yl="[object Promise]",Ql="[object Set]",Xl="[object WeakMap]",ec="[object DataView]",M_=Xt(Rr),F_=Xt(co),V_=Xt(Or),L_=Xt(Nr),j_=Xt(zr),tn=Vt;(Rr&&tn(new Rr(new ArrayBuffer(1)))!=ec||co&&tn(new co)!=Jl||Or&&tn(Or.resolve())!=Yl||Nr&&tn(new Nr)!=Ql||zr&&tn(new zr)!=Xl)&&(tn=function(o){var e=Vt(o),t=e=="[object Object]"?o.constructor:void 0,n=t?Xt(t):"";if(n)switch(n){case M_:return ec;case F_:return Jl;case V_:return Yl;case L_:return Ql;case j_:return Xl}return e});const po=tn;var $_=Object.prototype.hasOwnProperty;const H_=function(o){var e=o.length,t=new o.constructor(e);return e&&typeof o[0]=="string"&&$_.call(o,"index")&&(t.index=o.index,t.input=o.input),t},ni=ct.Uint8Array,Mr=function(o){var e=new o.constructor(o.byteLength);return new ni(e).set(new ni(o)),e},q_=function(o,e){var t=e?Mr(o.buffer):o.buffer;return new o.constructor(t,o.byteOffset,o.byteLength)};var U_=/\w*$/;const W_=function(o){var e=new o.constructor(o.source,U_.exec(o));return e.lastIndex=o.lastIndex,e};var tc=ft?ft.prototype:void 0,nc=tc?tc.valueOf:void 0;const K_=function(o){return nc?Object(nc.call(o)):{}},oc=function(o,e){var t=e?Mr(o.buffer):o.buffer;return new o.constructor(t,o.byteOffset,o.length)},G_=function(o,e,t){var n=o.constructor;switch(e){case"[object ArrayBuffer]":return Mr(o);case"[object Boolean]":case"[object Date]":return new n(+o);case"[object DataView]":return q_(o,t);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 oc(o,t);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(o);case"[object RegExp]":return W_(o);case"[object Symbol]":return K_(o)}};var ic=Object.create;const Z_=function(){function o(){}return function(e){if(!xe(e))return{};if(ic)return ic(e);o.prototype=e;var t=new o;return o.prototype=void 0,t}}(),rc=function(o){return typeof o.constructor!="function"||Dr(o)?{}:Z_(wr(o))},J_=function(o){return rt(o)&&po(o)=="[object Map]"};var sc=In&&In.isMap;const Y_=sc?Er(sc):J_,Q_=function(o){return rt(o)&&po(o)=="[object Set]"};var ac=In&&In.isSet;const X_=ac?Er(ac):Q_;var lc="[object Arguments]",cc="[object Function]",dc="[object Object]",Ce={};Ce[lc]=Ce["[object Array]"]=Ce["[object ArrayBuffer]"]=Ce["[object DataView]"]=Ce["[object Boolean]"]=Ce["[object Date]"]=Ce["[object Float32Array]"]=Ce["[object Float64Array]"]=Ce["[object Int8Array]"]=Ce["[object Int16Array]"]=Ce["[object Int32Array]"]=Ce["[object Map]"]=Ce["[object Number]"]=Ce[dc]=Ce["[object RegExp]"]=Ce["[object Set]"]=Ce["[object String]"]=Ce["[object Symbol]"]=Ce["[object Uint8Array]"]=Ce["[object Uint8ClampedArray]"]=Ce["[object Uint16Array]"]=Ce["[object Uint32Array]"]=!0,Ce["[object Error]"]=Ce[cc]=Ce["[object WeakMap]"]=!1;const Fr=function o(e,t,n,i,r,s){var a,l=1&t,c=2&t,d=4&t;if(n&&(a=r?n(e,i,r,s):n(e)),a!==void 0)return a;if(!xe(e))return e;var u=We(e);if(u){if(a=H_(e),!l)return Tr(e,a)}else{var g=po(e),f=g==cc||g=="[object GeneratorFunction]";if(mo(e))return ql(e,l);if(g==dc||g==lc||f&&!r){if(a=c||f?{}:rc(e),!l)return c?N_(e,I_(a,e)):O_(e,S_(a,e))}else{if(!Ce[g])return r?e:{};a=G_(e,g,l)}}s||(s=new uo);var b=s.get(e);if(b)return b;s.set(e,a),X_(e)?e.forEach(function(E){a.add(o(E,t,n,E,e,s))}):Y_(e)&&e.forEach(function(E,P){a.set(P,o(E,t,n,P,e,s))});var A=u?void 0:(d?c?z_:Pr:c?Pn:Br)(e);return g_(A||e,function(E,P){A&&(E=e[P=E]),Cr(a,P,o(E,t,n,P,e,s))}),a},Vr=function(o,e){return Fr(o,5,e=typeof e=="function"?e:void 0)},Rn=function(o){return rt(o)&&o.nodeType===1&&!Ke(o)};class hc{constructor(e,t){this._config={},t&&this.define(uc(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,n,i=!1){if(Ke(t))return void this._setObjectToTarget(e,t,i);const r=t.split(".");t=r.pop();for(const s of r)Ke(e[s])||(e[s]={}),e=e[s];if(Ke(n))return Ke(e[t])||(e[t]={}),e=e[t],void this._setObjectToTarget(e,n,i);i&&e[t]!==void 0||(e[t]=n)}_getFromSource(e,t){const n=t.split(".");t=n.pop();for(const i of n){if(!Ke(e[i])){e=null;break}e=e[i]}return e?uc(e[t]):void 0}_setObjectToTarget(e,t,n){Object.keys(t).forEach(i=>{this._setToTarget(e,i,t[i],n)})}}function uc(o){return Vr(o,eC)}function eC(o){return Rn(o)?o:void 0}function Lt(o){if(o){if(o.defaultView)return o instanceof o.defaultView.Document;if(o.ownerDocument&&o.ownerDocument.defaultView)return o instanceof o.ownerDocument.defaultView.Node}return!1}function oi(o){const e=Object.prototype.toString.apply(o);return e=="[object Window]"||e=="[object global]"}const mc=jt(me());function jt(o){return o?class extends o{listenTo(e,t,n,i={}){if(Lt(e)||oi(e)){const r={capture:!!i.useCapture,passive:!!i.usePassive},s=this._getProxyEmitter(e,r)||new tC(e,r);this.listenTo(s,t,n,i)}else super.listenTo(e,t,n,i)}stopListening(e,t,n){if(Lt(e)||oi(e)){const i=this._getAllProxyEmitters(e);for(const r of i)this.stopListening(r,t,n)}else super.stopListening(e,t,n)}_getProxyEmitter(e,t){return function(n,i){const r=n[pt];return r&&r[i]?r[i].emitter:null}(this,gc(e,t))}_getAllProxyEmitters(e){return[{capture:!1,passive:!1},{capture:!1,passive:!0},{capture:!0,passive:!1},{capture:!0,passive:!0}].map(t=>this._getProxyEmitter(e,t)).filter(t=>!!t)}}:mc}["_getProxyEmitter","_getAllProxyEmitters","on","once","off","listenTo","stopListening","fire","delegate","stopDelegating","_addEventListener","_removeEventListener"].forEach(o=>{jt[o]=mc.prototype[o]});class tC extends me(){constructor(e,t){super(),gl(this,gc(e,t)),this._domNode=e,this._options=t}attach(e){if(this._domListeners&&this._domListeners[e])return;const t=this._createDomListener(e);this._domNode.addEventListener(e,t,this._options),this._domListeners||(this._domListeners={}),this._domListeners[e]=t}detach(e){let t;!this._domListeners[e]||(t=this._events[e])&&t.callbacks.length||this._domListeners[e].removeListener()}_addEventListener(e,t,n){this.attach(e),me().prototype._addEventListener.call(this,e,t,n)}_removeEventListener(e,t){me().prototype._removeEventListener.call(this,e,t),this.detach(e)}_createDomListener(e){const t=n=>{this.fire(e,n)};return t.removeListener=()=>{this._domNode.removeEventListener(e,t,this._options),delete this._domListeners[e]},t}}function gc(o,e){let t=function(n){return n["data-ck-expando"]||(n["data-ck-expando"]=J())}(o);for(const n of Object.keys(e).sort())e[n]&&(t+="-"+n);return t}let Lr;try{Lr={window,document}}catch{Lr={window:{},document:{}}}const oe=Lr;function pc(o){const e=[];let t=o;for(;t&&t.nodeType!=Node.DOCUMENT_NODE;)e.unshift(t),t=t.parentNode;return e}function Ie(o){return Object.prototype.toString.call(o)=="[object Text]"}function ii(o){return Object.prototype.toString.apply(o)=="[object Range]"}function fc(o){const e=o.ownerDocument.defaultView.getComputedStyle(o);return{top:parseInt(e.borderTopWidth,10),right:parseInt(e.borderRightWidth,10),bottom:parseInt(e.borderBottomWidth,10),left:parseInt(e.borderLeftWidth,10)}}const kc=["top","right","bottom","left","width","height"];class De{constructor(e){const t=ii(e);if(Object.defineProperty(this,"_source",{value:e._source||e,writable:!0,enumerable:!1}),wc(e)||t)if(t){const n=De.getDomRangeRects(e);ri(this,De.getBoundingRect(n))}else ri(this,e.getBoundingClientRect());else if(oi(e)){const{innerWidth:n,innerHeight:i}=e;ri(this,{top:0,right:n,bottom:i,left:0,width:n,height:i})}else ri(this,e)}clone(){return new De(this)}moveTo(e,t){return this.top=t,this.right=e+this.width,this.bottom=t+this.height,this.left=e,this}moveBy(e,t){return this.top+=t,this.right+=e,this.left+=e,this.bottom+=t,this}getIntersection(e){const t={top:Math.max(this.top,e.top),right:Math.min(this.right,e.right),bottom:Math.min(this.bottom,e.bottom),left:Math.max(this.left,e.left),width:0,height:0};return t.width=t.right-t.left,t.height=t.bottom-t.top,t.width<0||t.height<0?null:new De(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(!bc(e)){let n=e.parentNode||e.commonAncestorContainer;for(;n&&!bc(n);){const i=new De(n),r=t.getIntersection(i);if(!r)return null;r.getArea()<t.getArea()&&(t=r),n=n.parentNode}}return t}isEqual(e){for(const t of kc)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,n,i;if(oi(e))t=e.innerWidth-e.document.documentElement.clientWidth,n=e.innerHeight-e.document.documentElement.clientHeight,i=e.getComputedStyle(e.document.documentElement).direction;else{const r=fc(e);t=e.offsetWidth-e.clientWidth-r.left-r.right,n=e.offsetHeight-e.clientHeight-r.top-r.bottom,i=e.ownerDocument.defaultView.getComputedStyle(e).direction,this.left+=r.left,this.top+=r.top,this.right-=r.right,this.bottom-=r.bottom,this.width=this.right-this.left,this.height=this.bottom-this.top}return this.width-=t,i==="ltr"?this.right-=t:this.left+=t,this.height-=n,this.bottom-=n,this}static getDomRangeRects(e){const t=[],n=Array.from(e.getClientRects());if(n.length)for(const i of n)t.push(new De(i));else{let i=e.startContainer;Ie(i)&&(i=i.parentNode);const r=new De(i.getBoundingClientRect());r.right=r.left,r.width=0,t.push(r)}return t}static getBoundingRect(e){const t={left:Number.POSITIVE_INFINITY,top:Number.POSITIVE_INFINITY,right:Number.NEGATIVE_INFINITY,bottom:Number.NEGATIVE_INFINITY,width:0,height:0};let n=0;for(const i of e)n++,t.left=Math.min(t.left,i.left),t.top=Math.min(t.top,i.top),t.right=Math.max(t.right,i.right),t.bottom=Math.max(t.bottom,i.bottom);return n==0?null:(t.width=t.right-t.left,t.height=t.bottom-t.top,new De(t))}}function ri(o,e){for(const t of kc)o[t]=e[t]}function bc(o){return!!wc(o)&&o===o.ownerDocument.body}function wc(o){return o!==null&&typeof o=="object"&&o.nodeType===1&&typeof o.getBoundingClientRect=="function"}const Ne=class{constructor(o,e){Ne._observerInstance||Ne._createObserver(),this._element=o,this._callback=e,Ne._addElementCallback(o,e),Ne._observerInstance.observe(o)}destroy(){Ne._deleteElementCallback(this._element,this._callback)}static _addElementCallback(o,e){Ne._elementCallbacks||(Ne._elementCallbacks=new Map);let t=Ne._elementCallbacks.get(o);t||(t=new Set,Ne._elementCallbacks.set(o,t)),t.add(e)}static _deleteElementCallback(o,e){const t=Ne._getElementCallbacks(o);t&&(t.delete(e),t.size||(Ne._elementCallbacks.delete(o),Ne._observerInstance.unobserve(o))),Ne._elementCallbacks&&!Ne._elementCallbacks.size&&(Ne._observerInstance=null,Ne._elementCallbacks=null)}static _getElementCallbacks(o){return Ne._elementCallbacks?Ne._elementCallbacks.get(o):null}static _createObserver(){Ne._observerInstance=new oe.window.ResizeObserver(o=>{for(const e of o){const t=Ne._getElementCallbacks(e.target);if(t)for(const n of t)n(e)}})}};let si=Ne;function nC(o,e){o instanceof HTMLTextAreaElement&&(o.value=e),o.innerHTML=e}function jr(o){return e=>e+o}function ai(o){let e=0;for(;o.previousSibling;)o=o.previousSibling,e++;return e}function Ac(o,e,t){o.insertBefore(t,o.childNodes[e]||null)}function On(o){return o&&o.nodeType===Node.COMMENT_NODE}function _c(o){try{oe.document.createAttribute(o)}catch{return!1}return!0}function nn(o){return!!(o&&o.getClientRects&&o.getClientRects().length)}si._observerInstance=null,si._elementCallbacks=null;var Cc=Math.pow;function vc({element:o,target:e,positions:t,limiter:n,fitInViewport:i,viewportOffsetConfig:r}){Qt(e)&&(e=e()),Qt(n)&&(n=n());const s=function(g){return g&&g.parentNode?g.offsetParent===oe.document.body?null:g.offsetParent:null}(o),a=new De(o),l=new De(e);let c;const d=i&&function(g){g=Object.assign({top:0,bottom:0,left:0,right:0},g);const f=new De(oe.window);return f.top+=g.top,f.height-=g.top,f.bottom-=g.bottom,f.height-=g.bottom,f}(r)||null,u={targetRect:l,elementRect:a,positionedElementAncestor:s,viewportRect:d};if(n||i){const g=n&&new De(n).getVisible();Object.assign(u,{limiterRect:g,viewportRect:d}),c=function(f,b){const{elementRect:A}=b,E=A.getArea(),P=f.map(Y=>new $r(Y,b)).filter(Y=>!!Y.name);let z=0,j=null;for(const Y of P){const{limiterIntersectionArea:ie,viewportIntersectionArea:Ee}=Y;if(ie===E)return Y;const he=Cc(Ee,2)+Cc(ie,2);he>z&&(z=he,j=Y)}return j}(t,u)||new $r(t[0],u)}else c=new $r(t[0],u);return c}function yc(o){const{scrollX:e,scrollY:t}=oe.window;return o.clone().moveBy(e,t)}class $r{constructor(e,t){const n=e(t.targetRect,t.elementRect,t.viewportRect);if(!n)return;const{left:i,top:r,name:s,config:a}=n;this.name=s,this.config=a,this._positioningFunctionCorrdinates={left:i,top:r},this._options=t}get left(){return this._absoluteRect.left}get top(){return this._absoluteRect.top}get limiterIntersectionArea(){const e=this._options.limiterRect;if(e){const t=this._options.viewportRect;if(!t)return e.getIntersectionArea(this._rect);{const n=e.getIntersection(t);if(n)return n.getIntersectionArea(this._rect)}}return 0}get viewportIntersectionArea(){const e=this._options.viewportRect;return e?e.getIntersectionArea(this._rect):0}get _rect(){return this._cachedRect||(this._cachedRect=this._options.elementRect.clone().moveTo(this._positioningFunctionCorrdinates.left,this._positioningFunctionCorrdinates.top)),this._cachedRect}get _absoluteRect(){return this._cachedAbsoluteRect||(this._cachedAbsoluteRect=yc(this._rect),this._options.positionedElementAncestor&&function(e,t){const n=yc(new De(t)),i=fc(t);let r=0,s=0;r-=n.left,s-=n.top,r+=t.scrollLeft,s+=t.scrollTop,r-=i.left,s-=i.top,e.moveBy(r,s)}(this._cachedAbsoluteRect,this._options.positionedElementAncestor)),this._cachedAbsoluteRect}}function Ec(o){const e=o.parentNode;e&&e.removeChild(o)}function oC({window:o,rect:e,alignToTop:t,forceScroll:n,viewportOffset:i}){const r=e.clone().moveBy(0,i),s=e.clone().moveBy(0,-i),a=new De(o).excludeScrollbarsAndBorders(),l=t&&n,c=[s,r].every(b=>a.contains(b));let{scrollX:d,scrollY:u}=o;const g=d,f=u;l?u-=a.top-e.top+i:c||(Sc(s,a)?u-=a.top-e.top+i:xc(r,a)&&(u+=t?e.top-a.top-i:e.bottom-a.bottom+i)),c||(Dc(e,a)?d-=a.left-e.left+i:Bc(e,a)&&(d+=e.right-a.right+i)),d==g&&u===f||o.scrollTo(d,u)}function iC({parent:o,getRect:e,alignToTop:t,forceScroll:n,ancestorOffset:i=0}){const r=Hr(o),s=t&&n;let a,l,c;for(;o!=r.document.body;)l=e(),a=new De(o).excludeScrollbarsAndBorders(),c=a.contains(l),s?o.scrollTop-=a.top-l.top+i:c||(Sc(l,a)?o.scrollTop-=a.top-l.top+i:xc(l,a)&&(o.scrollTop+=t?l.top-a.top-i:l.bottom-a.bottom+i)),c||(Dc(l,a)?o.scrollLeft-=a.left-l.left+i:Bc(l,a)&&(o.scrollLeft+=l.right-a.right+i)),o=o.parentNode}function xc(o,e){return o.bottom>e.bottom}function Sc(o,e){return o.top<e.top}function Dc(o,e){return o.left<e.left}function Bc(o,e){return o.right>e.right}function Hr(o){return ii(o)?o.startContainer.ownerDocument.defaultView:o.ownerDocument.defaultView}function rC(o){if(ii(o)){let e=o.commonAncestorContainer;return Ie(e)&&(e=e.parentNode),e}return o.parentNode}function Tc(o,e){const t=Hr(o),n=new De(o);if(t===e)return n;{let i=t;for(;i!=e;){const r=i.frameElement,s=new De(r).excludeScrollbarsAndBorders();n.moveBy(s.left,s.top),i=i.parent}}return n}const sC={ctrl:"⌃",cmd:"⌘",alt:"⌥",shift:"⇧"},aC={ctrl:"Ctrl+",alt:"Alt+",shift:"Shift+"},se=function(){const o={arrowleft:37,arrowup:38,arrowright:39,arrowdown:40,backspace:8,delete:46,enter:13,space:32,esc:27,tab:9,ctrl:1114112,shift:2228224,alt:4456448,cmd:8912896};for(let e=65;e<=90;e++)o[String.fromCharCode(e).toLowerCase()]=e;for(let e=48;e<=57;e++)o[e-48]=e;for(let e=112;e<=123;e++)o["f"+(e-111)]=e;for(const e of"`-=[];',./\\")o[e]=e.charCodeAt(0);return o}(),lC=Object.fromEntries(Object.entries(se).map(([o,e])=>[e,o.charAt(0).toUpperCase()+o.slice(1)]));function Nn(o){let e;if(typeof o=="string"){if(e=se[o.toLowerCase()],!e)throw new I("keyboard-unknown-key",null,{key:o})}else e=o.keyCode+(o.altKey?se.alt:0)+(o.ctrlKey?se.ctrl:0)+(o.shiftKey?se.shift:0)+(o.metaKey?se.cmd:0);return e}function li(o){return typeof o=="string"&&(o=function(e){return e.split("+").map(t=>t.trim())}(o)),o.map(e=>typeof e=="string"?function(t){if(t.endsWith("!"))return Nn(t.slice(0,-1));const n=Nn(t);return k.isMac&&n==se.ctrl?se.cmd:n}(e):e).reduce((e,t)=>t+e,0)}function Ic(o){let e=li(o);return Object.entries(k.isMac?sC:aC).reduce((t,[n,i])=>(e&se[n]&&(e&=~se[n],t+=i),t),"")+(e?lC[e]:"")}function qr(o,e){const t=e==="ltr";switch(o){case se.arrowleft:return t?"left":"right";case se.arrowright:return t?"right":"left";case se.arrowup:return"up";case se.arrowdown:return"down"}}function Pe(o){return Array.isArray(o)?o:[o]}function cC(o,e,t=1){if(typeof t!="number")throw new I("translation-service-quantity-not-a-number",null,{quantity:t});const n=Object.keys(oe.window.CKEDITOR_TRANSLATIONS).length;n===1&&(o=Object.keys(oe.window.CKEDITOR_TRANSLATIONS)[0]);const i=e.id||e.string;if(n===0||!function(l,c){return!!oe.window.CKEDITOR_TRANSLATIONS[l]&&!!oe.window.CKEDITOR_TRANSLATIONS[l].dictionary[c]}(o,i))return t!==1?e.plural:e.string;const r=oe.window.CKEDITOR_TRANSLATIONS[o].dictionary,s=oe.window.CKEDITOR_TRANSLATIONS[o].getPluralForm||(l=>l===1?0:1),a=r[i];return typeof a=="string"?a:a[Number(s(t))]}oe.window.CKEDITOR_TRANSLATIONS||(oe.window.CKEDITOR_TRANSLATIONS={});const dC=["ar","ara","fa","per","fas","he","heb","ku","kur","ug","uig"];function Pc(o){return dC.includes(o)?"rtl":"ltr"}class hC{constructor({uiLanguage:e="en",contentLanguage:t}={}){this.uiLanguage=e,this.contentLanguage=t||this.uiLanguage,this.uiLanguageDirection=Pc(this.uiLanguage),this.contentLanguageDirection=Pc(this.contentLanguage),this.t=(n,i)=>this._t(n,i)}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=Pe(t),typeof e=="string"&&(e={string:e});const n=e.plural?t[0]:1;return function(i,r){return i.replace(/%(\d+)/g,(s,a)=>a<r.length?r[a]:s)}(cC(this.uiLanguage,e,n),t)}}class st extends me(){constructor(e={},t={}){super();const n=Xe(e);if(n||(t=e),this._items=[],this._itemMap=new Map,this._idProperty=t.idProperty||"id",this._bindToExternalToInternalMap=new WeakMap,this._bindToInternalToExternalMap=new WeakMap,this._skippedIndexesFromExternal=[],n)for(const i of e)this._items.push(i),this._itemMap.set(this._getItemIdBeforeAdding(i),i)}get length(){return this._items.length}get first(){return this._items[0]||null}get last(){return this._items[this.length-1]||null}add(e,t){return this.addMany([e],t)}addMany(e,t){if(t===void 0)t=this._items.length;else if(t>this._items.length||t<0)throw new I("collection-add-item-invalid-index",this);let n=0;for(const i of e){const r=this._getItemIdBeforeAdding(i),s=t+n;this._items.splice(s,0,i),this._itemMap.set(r,i),this.fire("add",i,s),n++}return this.fire("change",{added:e,removed:[],index:t}),this}get(e){let t;if(typeof e=="string")t=this._itemMap.get(e);else{if(typeof e!="number")throw new I("collection-get-invalid-arg",this);t=this._items[e]}return t||null}has(e){if(typeof e=="string")return this._itemMap.has(e);{const t=e[this._idProperty];return t&&this._itemMap.has(t)}}getIndex(e){let t;return t=typeof e=="string"?this._itemMap.get(e):e,t?this._items.indexOf(t):-1}remove(e){const[t,n]=this._remove(e);return this.fire("change",{added:[],removed:[t],index:n}),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 I("collection-bind-to-rebind",this);return this._bindToCollection=e,{as:t=>{this._setUpBindToBinding(n=>new t(n))},using:t=>{typeof t=="function"?this._setUpBindToBinding(t):this._setUpBindToBinding(n=>n[t])}}}_setUpBindToBinding(e){const t=this._bindToCollection,n=(i,r,s)=>{const a=t._bindToCollection==this,l=t._bindToInternalToExternalMap.get(r);if(a&&l)this._bindToExternalToInternalMap.set(r,l),this._bindToInternalToExternalMap.set(l,r);else{const c=e(r);if(!c)return void this._skippedIndexesFromExternal.push(s);let d=s;for(const u of this._skippedIndexesFromExternal)s>u&&d--;for(const u of t._skippedIndexesFromExternal)d>=u&&d++;this._bindToExternalToInternalMap.set(r,c),this._bindToInternalToExternalMap.set(c,r),this.add(c,d);for(let u=0;u<t._skippedIndexesFromExternal.length;u++)d<=t._skippedIndexesFromExternal[u]&&t._skippedIndexesFromExternal[u]++}};for(const i of t)n(0,i,t.getIndex(i));this.listenTo(t,"add",n),this.listenTo(t,"remove",(i,r,s)=>{const a=this._bindToExternalToInternalMap.get(r);a&&this.remove(a),this._skippedIndexesFromExternal=this._skippedIndexesFromExternal.reduce((l,c)=>(s<c&&l.push(c-1),s>c&&l.push(c),l),[])})}_getItemIdBeforeAdding(e){const t=this._idProperty;let n;if(t in e){if(n=e[t],typeof n!="string")throw new I("collection-add-invalid-id",this);if(this.get(n))throw new I("collection-add-item-already-exists",this)}else e[t]=n=J();return n}_remove(e){let t,n,i,r=!1;const s=this._idProperty;if(typeof e=="string"?(n=e,i=this._itemMap.get(n),r=!i,i&&(t=this._items.indexOf(i))):typeof e=="number"?(t=e,i=this._items[t],r=!i,i&&(n=i[s])):(i=e,n=i[s],t=this._items.indexOf(i),r=t==-1||!this._itemMap.get(n)),r)throw new I("collection-remove-404",this);this._items.splice(t,1),this._itemMap.delete(n);const a=this._bindToInternalToExternalMap.get(i);return this._bindToInternalToExternalMap.delete(i),this._bindToExternalToInternalMap.delete(a),this.fire("remove",i,t),[i,t]}[Symbol.iterator](){return this._items[Symbol.iterator]()}}function ze(o){const e=o.next();return e.done?null:e.value}class dt extends jt(ge()){constructor(){super(),this._elements=new Set,this._nextEventLoopTimeout=null,this.set("isFocused",!1),this.set("focusedElement",null)}add(e){if(this._elements.has(e))throw new I("focustracker-add-element-already-exist",this);this.listenTo(e,"focus",()=>this._focus(e),{useCapture:!0}),this.listenTo(e,"blur",()=>this._blur(),{useCapture:!0}),this._elements.add(e)}remove(e){e===this.focusedElement&&this._blur(),this._elements.has(e)&&(this.stopListening(e),this._elements.delete(e))}destroy(){this.stopListening()}_focus(e){clearTimeout(this._nextEventLoopTimeout),this.focusedElement=e,this.isFocused=!0}_blur(){clearTimeout(this._nextEventLoopTimeout),this._nextEventLoopTimeout=setTimeout(()=>{this.focusedElement=null,this.isFocused=!1},0)}}class xt{constructor(){this._listener=new(jt())}listenTo(e){this._listener.listenTo(e,"keydown",(t,n)=>{this._listener.fire("_keydown:"+Nn(n),n)})}set(e,t,n={}){const i=li(e),r=n.priority;this._listener.listenTo(this._listener,"_keydown:"+i,(s,a)=>{t(a,()=>{a.preventDefault(),a.stopPropagation(),s.stop()}),s.return=!0},{priority:r})}press(e){return!!this._listener.fire("_keydown:"+Nn(e),e)}stopListening(e){this._listener.stopListening(e)}destroy(){this.stopListening()}}function St(o){return Xe(o)?new Map(o):function(e){const t=new Map;for(const n in e)t.set(n,e[n]);return t}(o)}function Ur(o,e){let t;function n(...i){n.cancel(),t=setTimeout(()=>o(...i),e)}return n.cancel=()=>{clearTimeout(t)},n}function Wr(o,e){return!!(t=o.charAt(e-1))&&t.length==1&&/[\ud800-\udbff]/.test(t)&&function(n){return!!n&&n.length==1&&/[\udc00-\udfff]/.test(n)}(o.charAt(e));var t}function Kr(o,e){return!!(t=o.charAt(e))&&t.length==1&&/[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test(t);var t}const uC=function(){const o=[new RegExp("\\p{Emoji}[\\u{E0020}-\\u{E007E}]+\\u{E007F}","u"),new RegExp("\\p{Emoji}\\u{FE0F}?\\u{20E3}","u"),new RegExp("\\p{Emoji}\\u{FE0F}","u"),new RegExp("(?=\\p{General_Category=Other_Symbol})\\p{Emoji}\\p{Emoji_Modifier}*","u")],e=new RegExp("\\p{Regional_Indicator}{2}","u").source,t="(?:"+o.map(n=>n.source).join("|")+")";return new RegExp(`${e}|${t}(?:${t})*`,"ug")}();function Rc(o,e){const t=String(o).matchAll(uC);return Array.from(t).some(n=>n.index<e&&e<n.index+n[0].length)}class on extends st{constructor(e=[]){super(e,{idProperty:"viewUid"}),this.on("add",(t,n,i)=>{this._renderViewIntoCollectionParent(n,i)}),this.on("remove",(t,n)=>{n.element&&this._parentElement&&n.element.remove()}),this._parentElement=null}destroy(){this.map(e=>e.destroy())}setParent(e){this._parentElement=e;for(const t of this)this._renderViewIntoCollectionParent(t)}delegate(...e){if(!e.length||!e.every(t=>typeof t=="string"))throw new I("ui-viewcollection-delegate-wrong-events",this);return{to:t=>{for(const n of this)for(const i of e)n.delegate(i).to(t);this.on("add",(n,i)=>{for(const r of e)i.delegate(r).to(t)}),this.on("remove",(n,i)=>{for(const r of e)i.stopDelegating(r,t)})}}}_renderViewIntoCollectionParent(e,t){e.isRendered||e.render(),e.element&&this._parentElement&&this._parentElement.insertBefore(e.element,this._parentElement.children[t])}remove(e){return super.remove(e)}}var mC=D(6062),G=D.n(mC),Oc=D(4793),gC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Oc.Z,gC),Oc.Z.locals;class re extends jt(ge()){constructor(e){super(),this.element=null,this.isRendered=!1,this.locale=e,this.t=e&&e.t,this._viewCollections=new st,this._unboundChildren=this.createCollection(),this._viewCollections.on("add",(t,n)=>{n.locale=e,n.t=e&&e.t}),this.decorate("render")}get bindTemplate(){return this._bindTemplate?this._bindTemplate:this._bindTemplate=kt.bind(this,this)}createCollection(e){const t=new on(e);return this._viewCollections.add(t),t}registerChild(e){Xe(e)||(e=[e]);for(const t of e)this._unboundChildren.add(t)}deregisterChild(e){Xe(e)||(e=[e]);for(const t of e)this._unboundChildren.remove(t)}setTemplate(e){this.template=new kt(e)}extendTemplate(e){kt.extend(this.template,e)}render(){if(this.isRendered)throw new I("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)}}class kt extends me(){constructor(e){super(),Object.assign(this,Fc(Mc(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,intoFragment:!1,isApplying:!0,revertData:this._revertData}),e}revert(e){if(!this._revertData)throw new I("ui-template-revert-not-applied",[this,e]);this._revertTemplateFromNode(e,this._revertData)}*getViews(){yield*function*e(t){if(t.children)for(const n of t.children)di(n)?yield n:Gr(n)&&(yield*e(n))}(this)}static bind(e,t){return{to:(n,i)=>new pC({eventNameOrFunction:n,attribute:n,observable:e,emitter:t,callback:i}),if:(n,i,r)=>new Nc({observable:e,emitter:t,attribute:n,valueIfTrue:i,callback:r})}}static extend(e,t){if(e._isRendered)throw new I("template-extend-render",[this,e]);$c(e,Fc(Mc(t)))}_renderNode(e){let t;if(t=e.node?this.tag&&this.text:this.tag?this.text:!this.text,t)throw new I("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(""),ci(this.text)?this._bindToObservable({schema:this.text,updater:fC(t),data:e}):t.textContent=this.text.join(""),t}_renderAttributes(e){if(!this.attributes)return;const t=e.node,n=e.revertData;for(const i in this.attributes){const r=t.getAttribute(i),s=this.attributes[i];n&&(n.attributes[i]=r);const a=Hc(s)?s[0].ns:null;if(ci(s)){const l=Hc(s)?s[0].value:s;n&&qc(i)&&l.unshift(r),this._bindToObservable({schema:l,updater:kC(t,i,a),data:e})}else if(i=="style"&&typeof s[0]!="string")this._renderStyleAttribute(s[0],e);else{n&&r&&qc(i)&&s.unshift(r);const l=s.map(c=>c&&c.value||c).reduce((c,d)=>c.concat(d),[]).reduce(Lc,"");zn(l)||t.setAttributeNS(a,i,l)}}}_renderStyleAttribute(e,t){const n=t.node;for(const i in e){const r=e[i];ci(r)?this._bindToObservable({schema:[r],updater:bC(n,i),data:t}):n.style[i]=r}}_renderElementChildren(e){const t=e.node,n=e.intoFragment?document.createDocumentFragment():t,i=e.isApplying;let r=0;for(const s of this.children)if(Zr(s)){if(!i){s.setParent(t);for(const a of s)n.appendChild(a.element)}}else if(di(s))i||(s.isRendered||s.render(),n.appendChild(s.element));else if(Lt(s))n.appendChild(s);else if(i){const a={children:[],bindings:[],attributes:{}};e.revertData.children.push(a),s._renderNode({intoFragment:!1,node:n.childNodes[r++],isApplying:!0,revertData:a})}else n.appendChild(s.render());e.intoFragment&&t.appendChild(n)}_setUpListeners(e){if(this.eventListeners)for(const t in this.eventListeners){const n=this.eventListeners[t].map(i=>{const[r,s]=t.split("@");return i.activateDomEventListener(r,s,e)});e.revertData&&e.revertData.bindings.push(n)}}_bindToObservable({schema:e,updater:t,data:n}){const i=n.revertData;zc(e,t,n);const r=e.filter(s=>!zn(s)).filter(s=>s.observable).map(s=>s.activateAttributeListener(e,t,n));i&&i.bindings.push(r)}_revertTemplateFromNode(e,t){for(const i of t.bindings)for(const r of i)r();if(t.text)return void(e.textContent=t.text);const n=e;for(const i in t.attributes){const r=t.attributes[i];r===null?n.removeAttribute(i):n.setAttribute(i,r)}for(let i=0;i<t.children.length;++i)this._revertTemplateFromNode(n.childNodes[i],t.children[i])}}class fo{constructor(e){this.attribute=e.attribute,this.observable=e.observable,this.emitter=e.emitter,this.callback=e.callback}getValue(e){const t=this.observable[this.attribute];return this.callback?this.callback(t,e):t}activateAttributeListener(e,t,n){const i=()=>zc(e,t,n);return this.emitter.listenTo(this.observable,`change:${this.attribute}`,i),()=>{this.emitter.stopListening(this.observable,`change:${this.attribute}`,i)}}}class pC extends fo{constructor(e){super(e),this.eventNameOrFunction=e.eventNameOrFunction}activateDomEventListener(e,t,n){const i=(r,s)=>{t&&!s.target.matches(t)||(typeof this.eventNameOrFunction=="function"?this.eventNameOrFunction(s):this.observable.fire(this.eventNameOrFunction,s))};return this.emitter.listenTo(n.node,e,i),()=>{this.emitter.stopListening(n.node,e,i)}}}class Nc extends fo{constructor(e){super(e),this.valueIfTrue=e.valueIfTrue}getValue(e){return!zn(super.getValue(e))&&(this.valueIfTrue||!0)}}function ci(o){return!!o&&(o.value&&(o=o.value),Array.isArray(o)?o.some(ci):o instanceof fo)}function zc(o,e,{node:t}){const n=function(r,s){return r.map(a=>a instanceof fo?a.getValue(s):a)}(o,t);let i;i=o.length==1&&o[0]instanceof Nc?n[0]:n.reduce(Lc,""),zn(i)?e.remove():e.set(i)}function fC(o){return{set(e){o.textContent=e},remove(){o.textContent=""}}}function kC(o,e,t){return{set(n){o.setAttributeNS(t,e,n)},remove(){o.removeAttributeNS(t,e)}}}function bC(o,e){return{set(t){o.style[e]=t},remove(){o.style[e]=null}}}function Mc(o){return Vr(o,e=>{if(e&&(e instanceof fo||Gr(e)||di(e)||Zr(e)))return e})}function Fc(o){if(typeof o=="string"?o=function(e){return{text:[e]}}(o):o.text&&function(e){e.text=Pe(e.text)}(o),o.on&&(o.eventListeners=function(e){for(const t in e)Vc(e,t);return e}(o.on),delete o.on),!o.text){o.attributes&&function(t){for(const n in t)t[n].value&&(t[n].value=Pe(t[n].value)),Vc(t,n)}(o.attributes);const e=[];if(o.children)if(Zr(o.children))e.push(o.children);else for(const t of o.children)Gr(t)||di(t)||Lt(t)?e.push(t):e.push(new kt(t));o.children=e}return o}function Vc(o,e){o[e]=Pe(o[e])}function Lc(o,e){return zn(e)?o:zn(o)?e:`${o} ${e}`}function jc(o,e){for(const t in e)o[t]?o[t].push(...e[t]):o[t]=e[t]}function $c(o,e){if(e.attributes&&(o.attributes||(o.attributes={}),jc(o.attributes,e.attributes)),e.eventListeners&&(o.eventListeners||(o.eventListeners={}),jc(o.eventListeners,e.eventListeners)),e.text&&o.text.push(...e.text),e.children&&e.children.length){if(o.children.length!=e.children.length)throw new I("ui-template-extend-children-mismatch",o);let t=0;for(const n of e.children)$c(o.children[t++],n)}}function zn(o){return!o&&o!==0}function di(o){return o instanceof re}function Gr(o){return o instanceof kt}function Zr(o){return o instanceof on}function Hc(o){return xe(o[0])&&o[0].ns}function qc(o){return o=="class"||o=="style"}class wC extends on{constructor(e,t=[]){super(t),this.locale=e}attachToDom(){this._bodyCollectionContainer=new kt({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=br(document,"div",{class:"ck-body-wrapper"}),document.body.appendChild(e)),e.appendChild(this._bodyCollectionContainer)}detachFromDom(){super.destroy(),this._bodyCollectionContainer&&this._bodyCollectionContainer.remove();const e=document.querySelector(".ck-body-wrapper");e&&e.childElementCount==0&&e.remove()}}var Uc=D(6574),AC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Uc.Z,AC),Uc.Z.locals;const Wc=class extends re{constructor(){super();const o=this.bindTemplate;this.set("content",""),this.set("viewBox","0 0 20 20"),this.set("fillColor",""),this.set("isColorInherited",!0),this.setTemplate({tag:"svg",ns:"http://www.w3.org/2000/svg",attributes:{class:["ck","ck-icon","ck-reset_all-excluded",o.if("isColorInherited","ck-icon_inherit-color")],viewBox:o.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 o=new DOMParser().parseFromString(this.content.trim(),"image/svg+xml").querySelector("svg"),e=o.getAttribute("viewBox");e&&(this.viewBox=e);for(const{name:t,value:n}of Array.from(o.attributes))Wc.presentationalAttributeNames.includes(t)&&this.element.setAttribute(t,n);for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);for(;o.childNodes.length>0;)this.element.appendChild(o.childNodes[0])}}_colorFillPaths(){this.fillColor&&this.element.querySelectorAll(".ck-icon__fill").forEach(o=>{o.style.fill=this.fillColor})}};let ko=Wc;ko.presentationalAttributeNames=["alignment-baseline","baseline-shift","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-rendering","cursor","direction","display","dominant-baseline","fill","fill-opacity","fill-rule","filter","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","image-rendering","letter-spacing","lighting-color","marker-end","marker-mid","marker-start","mask","opacity","overflow","paint-order","pointer-events","shape-rendering","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-anchor","text-decoration","text-overflow","text-rendering","transform","unicode-bidi","vector-effect","visibility","white-space","word-spacing","writing-mode"];var Kc=D(4906),_C={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Kc.Z,_C),Kc.Z.locals;class Ae extends re{constructor(e){super(e),this._focusDelayed=null;const t=this.bindTemplate,n=J();this.set("ariaChecked",void 0),this.set("ariaLabel",void 0),this.set("ariaLabelledBy",`ck-editor__aria-label_${n}`),this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isVisible",!0),this.set("isToggleable",!1),this.set("keystroke",void 0),this.set("label",void 0),this.set("role",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.set("withKeystroke",!1),this.children=this.createCollection(),this.labelView=this._createLabelView(),this.iconView=new ko,this.iconView.extendTemplate({attributes:{class:"ck-button__icon"}}),this.keystrokeView=this._createKeystrokeView(),this.bind("_tooltipString").to(this,"tooltip",this,"label",this,"keystroke",this._getTooltipString.bind(this));const i={tag:"button",attributes:{class:["ck","ck-button",t.to("class"),t.if("isEnabled","ck-disabled",r=>!r),t.if("isVisible","ck-hidden",r=>!r),t.to("isOn",r=>r?"ck-on":"ck-off"),t.if("withText","ck-button_with-text"),t.if("withKeystroke","ck-button_with-keystroke")],role:t.to("role"),type:t.to("type",r=>r||"button"),tabindex:t.to("tabindex"),"aria-label":t.to("ariaLabel"),"aria-labelledby":t.to("ariaLabelledBy"),"aria-disabled":t.if("isEnabled",!0,r=>!r),"aria-checked":t.to("isOn"),"aria-pressed":t.to("isOn",r=>!!this.isToggleable&&String(!!r)),"data-cke-tooltip-text":t.to("_tooltipString"),"data-cke-tooltip-position":t.to("tooltipPosition")},children:this.children,on:{click:t.to(r=>{this.isEnabled?this.fire("execute"):r.preventDefault()})}};k.isSafari&&(this._focusDelayed||(this._focusDelayed=Ur(()=>this.focus(),0)),i.on.mousedown=t.to(()=>{this._focusDelayed()}),i.on.mouseup=t.to(()=>{this._focusDelayed.cancel()})),this.setTemplate(i)}render(){super.render(),this.icon&&(this.iconView.bind("content").to(this,"icon"),this.children.add(this.iconView)),this.children.add(this.labelView),this.withKeystroke&&this.keystroke&&this.children.add(this.keystrokeView)}focus(){this.element.focus()}destroy(){this._focusDelayed&&this._focusDelayed.cancel(),super.destroy()}_createLabelView(){const e=new re,t=this.bindTemplate;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__label"],style:t.to("labelStyle"),id:this.ariaLabelledBy},children:[{text:t.to("label")}]}),e}_createKeystrokeView(){const e=new re;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__keystroke"]},children:[{text:this.bindTemplate.to("keystroke",t=>Ic(t))}]}),e}_getTooltipString(e,t,n){return e?typeof e=="string"?e:(n&&(n=Ic(n)),e instanceof Function?e(t,n):`${t}${n?` (${n})`:""}`):""}}var Gc=D(6758),CC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Gc.Z,CC),Gc.Z.locals;class hi extends Ae{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 re;return e.setTemplate({tag:"span",attributes:{class:["ck","ck-button__toggle"]},children:[{tag:"span",attributes:{class:["ck","ck-button__toggle__inner"]}}]}),e}}var Zc=D(6781),vC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Zc.Z,vC),Zc.Z.locals,D(1103),D(841);var Jc=D(3662),yC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Jc.Z,yC),Jc.Z.locals;class Yc extends re{constructor(e){super(e),this.set("text",void 0),this.set("for",void 0),this.id=`ck-editor__label_${J()}`;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")}]})}}var Qc=D(2577),EC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Qc.Z,EC),Qc.Z.locals;class Xc extends re{constructor(e,t){super(e);const n=`ck-labeled-field-view-${J()}`,i=`ck-labeled-field-view-status-${J()}`;this.fieldView=t(this,n,i),this.set("label",void 0),this.set("isEnabled",!0),this.set("isEmpty",!0),this.set("isFocused",!1),this.set("errorText",null),this.set("infoText",null),this.set("class",void 0),this.set("placeholder",void 0),this.labelView=this._createLabelView(n),this.statusView=this._createStatusView(i),this.fieldWrapperChildren=this.createCollection([this.fieldView,this.labelView]),this.bind("_statusText").to(this,"errorText",this,"infoText",(s,a)=>s||a);const r=this.bindTemplate;this.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view",r.to("class"),r.if("isEnabled","ck-disabled",s=>!s),r.if("isEmpty","ck-labeled-field-view_empty"),r.if("isFocused","ck-labeled-field-view_focused"),r.if("placeholder","ck-labeled-field-view_placeholder"),r.if("errorText","ck-error")]},children:[{tag:"div",attributes:{class:["ck","ck-labeled-field-view__input-wrapper"]},children:this.fieldWrapperChildren},this.statusView]})}_createLabelView(e){const t=new Yc(this.locale);return t.for=e,t.bind("text").to(this,"label"),t}_createStatusView(e){const t=new re(this.locale),n=this.bindTemplate;return t.setTemplate({tag:"div",attributes:{class:["ck","ck-labeled-field-view__status",n.if("errorText","ck-labeled-field-view__status_error"),n.if("_statusText","ck-hidden",i=>!i)],id:e,role:n.if("errorText","alert")},children:[{text:n.to("_statusText")}]}),t}focus(){this.fieldView.focus()}}var ed=D(4879),xC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(ed.Z,xC),ed.Z.locals;class SC extends re{constructor(e){super(e),this.set("value",void 0),this.set("id",void 0),this.set("placeholder",void 0),this.set("isReadOnly",!1),this.set("hasError",!1),this.set("ariaDescribedById",void 0),this.focusTracker=new dt,this.bind("isFocused").to(this.focusTracker),this.set("isEmpty",!0),this.set("inputMode","text");const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck","ck-input",t.if("isFocused","ck-input_focused"),t.if("isEmpty","ck-input-text_empty"),t.if("hasError","ck-error")],id:t.to("id"),placeholder:t.to("placeholder"),readonly:t.to("isReadOnly"),inputmode:t.to("inputMode"),"aria-invalid":t.if("hasError",!0),"aria-describedby":t.to("ariaDescribedById")},on:{input:t.to((...n)=>{this.fire("input",...n),this._updateIsEmpty()}),change:t.to(this._updateIsEmpty.bind(this))}})}render(){super.render(),this.focusTracker.add(this.element),this._setDomElementValue(this.value),this._updateIsEmpty(),this.on("change:value",(e,t,n)=>{this._setDomElementValue(n),this._updateIsEmpty()})}destroy(){super.destroy(),this.focusTracker.destroy()}select(){this.element.select()}focus(){this.element.focus()}_updateIsEmpty(){this.isEmpty=!this.element.value}_setDomElementValue(e){this.element.value=e||e===0?e:""}}class DC extends SC{constructor(e){super(e),this.extendTemplate({attributes:{type:"text",class:["ck-input-text"]}})}}class BC extends re{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",n=>`ck-dropdown__panel_${n}`),t.if("isVisible","ck-dropdown__panel-visible")]},children:this.children,on:{selectstart:t.to(n=>{n.target.tagName.toLocaleLowerCase()!=="input"&&n.preventDefault()})}})}focus(){if(this.children.length){const e=this.children.first;typeof e.focus=="function"?e.focus():Q("ui-dropdown-panel-focus-child-missing-focus",{childView:this.children.first,dropdownPanel:this})}}focusLast(){if(this.children.length){const e=this.children.last;typeof e.focusLast=="function"?e.focusLast():e.focus()}}}var td=D(5485),TC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(td.Z,TC),td.Z.locals;const Jr=class extends re{constructor(o,e,t){super(o);const n=this.bindTemplate;this.buttonView=e,this.panelView=t,this.set("isOpen",!1),this.set("isEnabled",!0),this.set("class",void 0),this.set("id",void 0),this.set("panelPosition","auto"),this.keystrokes=new xt,this.focusTracker=new dt,this.setTemplate({tag:"div",attributes:{class:["ck","ck-dropdown",n.to("class"),n.if("isEnabled","ck-disabled",i=>!i)],id:n.to("id"),"aria-describedby":n.to("ariaDescribedById")},children:[e,t]}),e.extendTemplate({attributes:{class:["ck-dropdown__button"],"data-cke-tooltip-disabled":n.to("isOpen")}})}render(){super.render(),this.focusTracker.add(this.buttonView.element),this.focusTracker.add(this.panelView.element),this.listenTo(this.buttonView,"open",()=>{this.isOpen=!this.isOpen}),this.panelView.bind("isVisible").to(this,"isOpen"),this.on("change:isOpen",(e,t,n)=>{n&&(this.panelPosition==="auto"?this.panelView.position=Jr._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 o=(e,t)=>{this.isOpen&&(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",o),this.keystrokes.set("esc",o)}focus(){this.buttonView.focus()}get _panelPositions(){const{south:o,north:e,southEast:t,southWest:n,northEast:i,northWest:r,southMiddleEast:s,southMiddleWest:a,northMiddleEast:l,northMiddleWest:c}=Jr.defaultPanelPositions;return this.locale.uiLanguageDirection!=="rtl"?[t,n,s,a,o,i,r,l,c,e]:[n,t,a,s,o,r,i,c,l,e]}};let Yr=Jr;Yr.defaultPanelPositions={south:(o,e)=>({top:o.bottom,left:o.left-(e.width-o.width)/2,name:"s"}),southEast:o=>({top:o.bottom,left:o.left,name:"se"}),southWest:(o,e)=>({top:o.bottom,left:o.left-e.width+o.width,name:"sw"}),southMiddleEast:(o,e)=>({top:o.bottom,left:o.left-(e.width-o.width)/4,name:"sme"}),southMiddleWest:(o,e)=>({top:o.bottom,left:o.left-3*(e.width-o.width)/4,name:"smw"}),north:(o,e)=>({top:o.top-e.height,left:o.left-(e.width-o.width)/2,name:"n"}),northEast:(o,e)=>({top:o.top-e.height,left:o.left,name:"ne"}),northWest:(o,e)=>({top:o.top-e.height,left:o.left-e.width+o.width,name:"nw"}),northMiddleEast:(o,e)=>({top:o.top-e.height,left:o.left-(e.width-o.width)/4,name:"nme"}),northMiddleWest:(o,e)=>({top:o.top-e.height,left:o.left-3*(e.width-o.width)/4,name:"nmw"})},Yr._getOptimalPosition=vc;const nd='<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 od extends Ae{constructor(e){super(e),this.arrowView=this._createArrowView(),this.extendTemplate({attributes:{"aria-haspopup":!0,"aria-expanded":this.bindTemplate.to("isOn",t=>String(t))}}),this.delegate("execute").to(this,"open")}render(){super.render(),this.children.add(this.arrowView)}_createArrowView(){const e=new ko;return e.content=nd,e.extendTemplate({attributes:{class:"ck-dropdown__arrow"}}),e}}class bo{constructor(e){if(this.focusables=e.focusables,this.focusTracker=e.focusTracker,this.keystrokeHandler=e.keystrokeHandler,this.actions=e.actions,e.actions&&e.keystrokeHandler)for(const t in e.actions){let n=e.actions[t];typeof n=="string"&&(n=[n]);for(const i of n)e.keystrokeHandler.set(i,(r,s)=>{this[t](),s()})}}get first(){return this.focusables.find(Qr)||null}get last(){return this.focusables.filter(Qr).slice(-1)[0]||null}get next(){return this._getFocusableItem(1)}get previous(){return this._getFocusableItem(-1)}get current(){let e=null;return this.focusTracker.focusedElement===null?null:(this.focusables.find((t,n)=>{const i=t.element===this.focusTracker.focusedElement;return i&&(e=n),i}),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,n=this.focusables.length;if(!n)return null;if(t===null)return this[e===1?"first":"last"];let i=(t+n+e)%n;do{const r=this.focusables.get(i);if(Qr(r))return r;i=(i+n+e)%n}while(i!==t);return null}}function Qr(o){return!(!o.focus||!nn(o.element))}class id extends re{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__separator"]}})}}class IC extends re{constructor(e){super(e),this.setTemplate({tag:"span",attributes:{class:["ck","ck-toolbar__line-break"]}})}}function rd(o){return Array.isArray(o)?{items:o,removeItems:[]}:o?Object.assign({items:[],removeItems:[]},o):{items:[],removeItems:[]}}class q extends ge(){constructor(e){super(),this._disableStack=new Set,this.editor=e,this.set("isEnabled",!0)}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",sd,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",sd),this.isEnabled=!0)}destroy(){this.stopListening()}static get isContextPlugin(){return!1}}function sd(o){o.return=!1,o.stop()}class ne extends ge(){constructor(e){super(),this.editor=e,this.set("value",void 0),this.set("isEnabled",!1),this._affectsData=!0,this._isEnabledBasedOnSelection=!0,this._disableStack=new Set,this.decorate("execute"),this.listenTo(this.editor.model.document,"change",()=>{this.refresh()}),this.listenTo(e,"change:isReadOnly",()=>{this.refresh()}),this.on("set:isEnabled",t=>{this.affectsData&&(e.isReadOnly||this._isEnabledBasedOnSelection&&!e.model.canEditAt(e.model.document.selection))&&(t.return=!1,t.stop())},{priority:"highest"}),this.on("execute",t=>{this.isEnabled||t.stop()},{priority:"high"})}get affectsData(){return this._affectsData}set affectsData(e){this._affectsData=e}refresh(){this.isEnabled=!0}forceDisabled(e){this._disableStack.add(e),this._disableStack.size==1&&(this.on("set:isEnabled",ad,{priority:"highest"}),this.isEnabled=!1)}clearForceDisabled(e){this._disableStack.delete(e),this._disableStack.size==0&&(this.off("set:isEnabled",ad),this.refresh())}execute(...e){}destroy(){this.stopListening()}}function ad(o){o.return=!1,o.stop()}class ld extends ne{constructor(){super(...arguments),this._childCommandsDefinitions=[]}refresh(){}execute(...e){const t=this._getFirstEnabledCommand();return!!t&&t.execute(e)}registerChildCommand(e,t={}){Z(this._childCommandsDefinitions,{command:e,priority:t.priority||"normal"}),e.on("change:isEnabled",()=>this._checkEnabled()),this._checkEnabled()}_checkEnabled(){this.isEnabled=!!this._getFirstEnabledCommand()}_getFirstEnabledCommand(){const e=this._childCommandsDefinitions.find(({command:t})=>t.isEnabled);return e&&e.command}}class cd extends me(){constructor(e,t=[],n=[]){super(),this._plugins=new Map,this._context=e,this._availablePlugins=new Map;for(const i of t)i.pluginName&&this._availablePlugins.set(i.pluginName,i);this._contextPlugins=new Map;for(const[i,r]of n)this._contextPlugins.set(i,r),this._contextPlugins.set(r,i),i.pluginName&&this._availablePlugins.set(i.pluginName,i)}*[Symbol.iterator](){for(const e of this._plugins)typeof e[0]=="function"&&(yield e)}get(e){const t=this._plugins.get(e);if(!t){let n=e;throw typeof e=="function"&&(n=e.pluginName||e.name),new I("plugincollection-plugin-not-loaded",this._context,{plugin:n})}return t}has(e){return this._plugins.has(e)}init(e,t=[],n=[]){const i=this,r=this._context;(function b(A,E=new Set){A.forEach(P=>{l(P)&&(E.has(P)||(E.add(P),P.pluginName&&!i._availablePlugins.has(P.pluginName)&&i._availablePlugins.set(P.pluginName,P),P.requires&&b(P.requires,E)))})})(e),g(e);const s=[...function b(A,E=new Set){return A.map(P=>l(P)?P:i._availablePlugins.get(P)).reduce((P,z)=>E.has(z)?P:(E.add(z),z.requires&&(g(z.requires,z),b(z.requires,E).forEach(j=>P.add(j))),P.add(z)),new Set)}(e.filter(b=>!d(b,t)))];(function(b,A){for(const E of A){if(typeof E!="function")throw new I("plugincollection-replace-plugin-invalid-type",null,{pluginItem:E});const P=E.pluginName;if(!P)throw new I("plugincollection-replace-plugin-missing-name",null,{pluginItem:E});if(E.requires&&E.requires.length)throw new I("plugincollection-plugin-for-replacing-cannot-have-dependencies",null,{pluginName:P});const z=i._availablePlugins.get(P);if(!z)throw new I("plugincollection-plugin-for-replacing-not-exist",null,{pluginName:P});const j=b.indexOf(z);if(j===-1){if(i._contextPlugins.has(z))return;throw new I("plugincollection-plugin-for-replacing-not-loaded",null,{pluginName:P})}if(z.requires&&z.requires.length)throw new I("plugincollection-replaced-plugin-cannot-have-dependencies",null,{pluginName:P});b.splice(j,1,E),i._availablePlugins.set(P,E)}})(s,n);const a=s.map(b=>{let A=i._contextPlugins.get(b);return A=A||new b(r),i._add(b,A),A});return f(a,"init").then(()=>f(a,"afterInit")).then(()=>a);function l(b){return typeof b=="function"}function c(b){return l(b)&&!!b.isContextPlugin}function d(b,A){return A.some(E=>E===b||u(b)===E||u(E)===b)}function u(b){return l(b)?b.pluginName||b.name:b}function g(b,A=null){b.map(E=>l(E)?E:i._availablePlugins.get(E)||E).forEach(E=>{(function(P,z){if(!l(P))throw z?new I("plugincollection-soft-required",r,{missingPlugin:P,requiredBy:u(z)}):new I("plugincollection-plugin-not-found",r,{plugin:P})})(E,A),function(P,z){if(c(z)&&!c(P))throw new I("plugincollection-context-required",r,{plugin:u(P),requiredBy:u(z)})}(E,A),function(P,z){if(z&&d(P,t))throw new I("plugincollection-required",r,{plugin:u(P),requiredBy:u(z)})}(E,A)})}function f(b,A){return b.reduce((E,P)=>P[A]?i._contextPlugins.has(P)?E:E.then(P[A].bind(P)):E,Promise.resolve())}}destroy(){const e=[];for(const[,t]of this)typeof t.destroy!="function"||this._contextPlugins.has(t)||e.push(t.destroy());return Promise.all(e)}_add(e,t){this._plugins.set(e,t);const n=e.pluginName;if(n){if(this._plugins.has(n))throw new I("plugincollection-plugin-name-conflict",null,{pluginName:n,plugin1:this._plugins.get(n).constructor,plugin2:e});this._plugins.set(n,t)}}}class dd{constructor(e){this._contextOwner=null,this.config=new hc(e,this.constructor.defaultConfig);const t=this.constructor.builtinPlugins;this.config.define("plugins",t),this.plugins=new cd(this,t);const n=this.config.get("language")||{};this.locale=new hC({uiLanguage:typeof n=="string"?n:n.ui,contentLanguage:this.config.get("language.content")}),this.t=this.locale.t,this.editors=new st}initPlugins(){const e=this.config.get("plugins")||[],t=this.config.get("substitutePlugins")||[];for(const n of e.concat(t)){if(typeof n!="function")throw new I("context-initplugins-constructor-only",null,{Plugin:n});if(n.isContextPlugin!==!0)throw new I("context-initplugins-invalid-plugin",null,{Plugin:n})}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 I("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 n=new this(e);t(n.initPlugins().then(()=>n))})}}class ui extends ge(){constructor(e){super(),this.context=e}destroy(){this.stopListening()}static get isContextPlugin(){return!0}}class PC extends xt{constructor(e){super(),this.editor=e}set(e,t,n={}){if(typeof t=="string"){const i=t;t=(r,s)=>{this.editor.execute(i),s()}}super.set(e,t,n)}}var hd=D(4717),RC={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(hd.Z,RC),hd.Z.locals;const mi=new WeakMap;function OC(o,e){return!!e.hasClass("ck-placeholder")&&(o.removeClass("ck-placeholder",e),!0)}function Xr(o,e){const t=mi.get(o),n=[];let i=!1;for(const[r,s]of t)s.isDirectHost&&(n.push(r),ud(e,r,s)&&(i=!0));for(const[r,s]of t){if(s.isDirectHost)continue;const a=NC(r);a&&(n.includes(a)||(s.hostElement=a,ud(e,r,s)&&(i=!0)))}return i}function ud(o,e,t){const{text:n,isDirectHost:i,hostElement:r}=t;let s=!1;return r.getAttribute("data-placeholder")!==n&&(o.setAttribute("data-placeholder",n,r),s=!0),(i||e.childCount==1)&&function(a,l){if(!a.isAttached()||Array.from(a.getChildren()).some(u=>!u.is("uiElement")))return!1;const c=a.document,d=c.selection.anchor;return!(c.isComposing&&d&&d.parent===a||!l&&c.isFocused&&(!d||d.parent===a))}(r,t.keepOnFocus)?function(a,l){return!l.hasClass("ck-placeholder")&&(a.addClass("ck-placeholder",l),!0)}(o,r)&&(s=!0):OC(o,r)&&(s=!0),s}function NC(o){if(o.childCount){const e=o.getChild(0);if(e.is("element")&&!e.is("uiElement")&&!e.is("attributeElement"))return e}return null}class rn{is(){throw new Error("is() method is abstract")}}const md=function(o){return Fr(o,4)};class sn extends me(rn){constructor(e){super(),this.document=e,this.parent=null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))==-1)throw new I("view-node-not-found-in-parent",this);return e}get nextSibling(){const e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.root.is("rootElement")}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.index),t=t.parent;return e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}getCommonAncestor(e,t={}){const n=this.getAncestors(t),i=e.getAncestors(t);let r=0;for(;n[r]==i[r]&&n[r];)r++;return r===0?null:n[r-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const t=this.getPath(),n=e.getPath(),i=Ue(t,n);switch(i){case"prefix":return!0;case"extension":return!1;default:return t[i]<n[i]}}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=md(this);return delete e.parent,e}}sn.prototype.is=function(o){return o==="node"||o==="view:node"};class pe extends sn{constructor(e,t){super(e),this._textData=t}get data(){return this._textData}get _data(){return this.data}set _data(e){this._fireChange("text",this),this._textData=e}isSimilar(e){return e instanceof pe&&(this===e||this.data===e.data)}_clone(){return new pe(this.document,this.data)}}pe.prototype.is=function(o){return o==="$text"||o==="view:$text"||o==="text"||o==="view:text"||o==="node"||o==="view:node"};class bt extends rn{constructor(e,t,n){if(super(),this.textNode=e,t<0||t>e.data.length)throw new I("view-textproxy-wrong-offsetintext",this);if(n<0||t+n>e.data.length)throw new I("view-textproxy-wrong-length",this);this.data=e.data.substring(t,t+n),this.offsetInText=t}get offsetSize(){return this.data.length}get isPartial(){return this.data.length!==this.textNode.data.length}get parent(){return this.textNode.parent}get root(){return this.textNode.root}get document(){return this.textNode.document}getAncestors(e={}){const t=[];let n=e.includeSelf?this.textNode:this.parent;for(;n!==null;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}}bt.prototype.is=function(o){return o==="$textProxy"||o==="view:$textProxy"||o==="textProxy"||o==="view:textProxy"};class Mn{constructor(...e){this._patterns=[],this.add(...e)}add(...e){for(let t of e)(typeof t=="string"||t instanceof RegExp)&&(t={name:t}),this._patterns.push(t)}match(...e){for(const t of e)for(const n of this._patterns){const i=gd(t,n);if(i)return{element:t,pattern:n,match:i}}return null}matchAll(...e){const t=[];for(const n of e)for(const i of this._patterns){const r=gd(n,i);r&&t.push({element:n,pattern:i,match:r})}return t.length>0?t:null}getElementName(){if(this._patterns.length!==1)return null;const e=this._patterns[0],t=e.name;return typeof e=="function"||!t||t instanceof RegExp?null:t}}function gd(o,e){if(typeof e=="function")return e(o);const t={};return e.name&&(t.name=function(n,i){return n instanceof RegExp?!!i.match(n):n===i}(e.name,o.name),!t.name)||e.attributes&&(t.attributes=function(n,i){const r=new Set(i.getAttributeKeys());return Ke(n)?(n.style!==void 0&&Q("matcher-pattern-deprecated-attributes-style-key",n),n.class!==void 0&&Q("matcher-pattern-deprecated-attributes-class-key",n)):(r.delete("style"),r.delete("class")),es(n,r,s=>i.getAttribute(s))}(e.attributes,o),!t.attributes)||e.classes&&(t.classes=function(n,i){return es(n,i.getClassNames(),()=>{})}(e.classes,o),!t.classes)||e.styles&&(t.styles=function(n,i){return es(n,i.getStyleNames(!0),r=>i.getStyle(r))}(e.styles,o),!t.styles)?null:t}function es(o,e,t){const n=function(s){return Array.isArray(s)?s.map(a=>Ke(a)?(a.key!==void 0&&a.value!==void 0||Q("matcher-pattern-missing-key-or-value",a),[a.key,a.value]):[a,!0]):Ke(s)?Object.entries(s):[[s,!0]]}(o),i=Array.from(e),r=[];if(n.forEach(([s,a])=>{i.forEach(l=>{(function(c,d){return c===!0||c===d||c instanceof RegExp&&d.match(c)})(s,l)&&function(c,d,u){if(c===!0)return!0;const g=u(d);return c===g||c instanceof RegExp&&!!String(g).match(c)}(a,l,t)&&r.push(l)})}),n.length&&!(r.length<n.length))return r}const gi=function(o){return typeof o=="symbol"||rt(o)&&Vt(o)=="[object Symbol]"};var zC=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,MC=/^\w*$/;const FC=function(o,e){if(We(o))return!1;var t=typeof o;return!(t!="number"&&t!="symbol"&&t!="boolean"&&o!=null&&!gi(o))||MC.test(o)||!zC.test(o)||e!=null&&o in Object(e)};function ts(o,e){if(typeof o!="function"||e!=null&&typeof e!="function")throw new TypeError("Expected a function");var t=function(){var n=arguments,i=e?e.apply(this,n):n[0],r=t.cache;if(r.has(i))return r.get(i);var s=o.apply(this,n);return t.cache=r.set(i,s)||r,s};return t.cache=new(ts.Cache||Xo),t}ts.Cache=Xo;const VC=ts,LC=function(o){var e=VC(o,function(n){return t.size===500&&t.clear(),n}),t=e.cache;return e};var jC=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,$C=/\\(\\)?/g,HC=LC(function(o){var e=[];return o.charCodeAt(0)===46&&e.push(""),o.replace(jC,function(t,n,i,r){e.push(i?r.replace($C,"$1"):n||t)}),e});const qC=HC,UC=function(o,e){for(var t=-1,n=o==null?0:o.length,i=Array(n);++t<n;)i[t]=e(o[t],t,o);return i};var pd=ft?ft.prototype:void 0,fd=pd?pd.toString:void 0;const WC=function o(e){if(typeof e=="string")return e;if(We(e))return UC(e,o)+"";if(gi(e))return fd?fd.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t},ns=function(o){return o==null?"":WC(o)},os=function(o,e){return We(o)?o:FC(o,e)?[o]:qC(ns(o))},KC=function(o){var e=o==null?0:o.length;return e?o[e-1]:void 0},is=function(o){if(typeof o=="string"||gi(o))return o;var e=o+"";return e=="0"&&1/o==-1/0?"-0":e},kd=function(o,e){for(var t=0,n=(e=os(e,o)).length;o!=null&&t<n;)o=o[is(e[t++])];return t&&t==n?o:void 0},bd=function(o,e,t){var n=-1,i=o.length;e<0&&(e=-e>i?0:i+e),(t=t>i?i:t)<0&&(t+=i),i=e>t?0:t-e>>>0,e>>>=0;for(var r=Array(i);++n<i;)r[n]=o[n+e];return r},GC=function(o,e){return e.length<2?o:kd(o,bd(e,0,-1))},ZC=function(o,e){return e=os(e,o),(o=GC(o,e))==null||delete o[is(KC(e))]},JC=function(o,e){return o==null||ZC(o,e)},pi=function(o,e,t){var n=o==null?void 0:kd(o,e);return n===void 0?t:n},rs=function(o,e,t){(t!==void 0&&!lo(o[e],t)||t===void 0&&!(e in o))&&_r(o,e,t)},YC=function(o){return function(e,t,n){for(var i=-1,r=Object(e),s=n(e),a=s.length;a--;){var l=s[++i];if(t(r[l],l,r)===!1)break}return e}}(),QC=function(o){return rt(o)&&ti(o)},ss=function(o,e){if((e!=="constructor"||typeof o[e]!="function")&&e!="__proto__")return o[e]},XC=function(o){return Tn(o,Pn(o))},ev=function(o,e,t,n,i,r,s){var a=ss(o,t),l=ss(e,t),c=s.get(l);if(c)rs(o,t,c);else{var d=r?r(a,l,t+"",o,e,s):void 0,u=d===void 0;if(u){var g=We(l),f=!g&&mo(l),b=!g&&!f&&Sr(l);d=l,g||f||b?We(a)?d=a:QC(a)?d=Tr(a):f?(u=!1,d=ql(l,!0)):b?(u=!1,d=oc(l,!0)):d=[]:Ke(l)||vr(l)?(d=a,vr(a)?d=XC(a):xe(a)&&!Qt(a)||(d=rc(l))):u=!1}u&&(s.set(l,d),i(d,l,n,r,s),s.delete(l)),rs(o,t,d)}},wd=function o(e,t,n,i,r){e!==t&&YC(t,function(s,a){if(r||(r=new uo),xe(s))ev(e,t,a,n,o,i,r);else{var l=i?i(ss(e,a),s,a+"",e,t,r):void 0;l===void 0&&(l=s),rs(e,a,l)}},Pn)},an=function(o){return o},tv=function(o,e,t){switch(t.length){case 0:return o.call(e);case 1:return o.call(e,t[0]);case 2:return o.call(e,t[0],t[1]);case 3:return o.call(e,t[0],t[1],t[2])}return o.apply(e,t)};var Ad=Math.max;const nv=function(o,e,t){return e=Ad(e===void 0?o.length-1:e,0),function(){for(var n=arguments,i=-1,r=Ad(n.length-e,0),s=Array(r);++i<r;)s[i]=n[e+i];i=-1;for(var a=Array(e+1);++i<e;)a[i]=n[i];return a[e]=t(s),tv(o,this,a)}},ov=function(o){return function(){return o}},iv=ei?function(o,e){return ei(o,"toString",{configurable:!0,enumerable:!1,value:ov(e),writable:!0})}:an;var rv=Date.now;const sv=function(o){var e=0,t=0;return function(){var n=rv(),i=16-(n-t);if(t=n,i>0){if(++e>=800)return arguments[0]}else e=0;return o.apply(void 0,arguments)}}(iv),_d=function(o,e){return sv(nv(o,e,an),o+"")},av=function(o,e,t){if(!xe(t))return!1;var n=typeof e;return!!(n=="number"?ti(t)&&yr(e,t.length):n=="string"&&e in t)&&lo(t[e],o)},as=function(o){return _d(function(e,t){var n=-1,i=t.length,r=i>1?t[i-1]:void 0,s=i>2?t[2]:void 0;for(r=o.length>3&&typeof r=="function"?(i--,r):void 0,s&&av(t[0],t[1],s)&&(r=i<3?void 0:r,i=1),e=Object(e);++n<i;){var a=t[n];a&&o(e,a,n,r)}return e})},Cd=as(function(o,e,t){wd(o,e,t)}),lv=function(o,e,t,n){if(!xe(o))return o;for(var i=-1,r=(e=os(e,o)).length,s=r-1,a=o;a!=null&&++i<r;){var l=is(e[i]),c=t;if(l==="__proto__"||l==="constructor"||l==="prototype")return o;if(i!=s){var d=a[l];(c=void 0)==void 0&&(c=xe(d)?d:yr(e[i+1])?[]:{})}Cr(a,l,c),a=a[l]}return o},cv=function(o,e,t){return o==null?o:lv(o,e,t)};class dv{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(n){let i=null,r=0,s=0,a=null;const l=new Map;if(n==="")return l;n.charAt(n.length-1)!=";"&&(n+=";");for(let c=0;c<n.length;c++){const d=n.charAt(c);if(i===null)switch(d){case":":a||(a=n.substr(r,c-r),s=c+1);break;case'"':case"'":i=d;break;case";":{const u=n.substr(s,c-s);a&&l.set(a.trim(),u.trim()),a=null,r=c+1;break}}else d===i&&(i=null)}return l}(e).entries());for(const[n,i]of t)this._styleProcessor.toNormalizedForm(n,i,this._styles)}has(e){if(this.isEmpty)return!1;const t=this._styleProcessor.getReducedForm(e,this._styles).find(([n])=>n===e);return Array.isArray(t)}set(e,t){if(xe(e))for(const[n,i]of Object.entries(e))this._styleProcessor.toNormalizedForm(n,i,this._styles);else this._styleProcessor.toNormalizedForm(e,t,this._styles)}remove(e){const t=ls(e);JC(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]&&!xe(this._styles[e]))return this._styles[e];const t=this._styleProcessor.getReducedForm(e,this._styles).find(([n])=>n===e);return Array.isArray(t)?t[1]:void 0}getStyleNames(e=!1){return this.isEmpty?[]:e?this._styleProcessor.getStyleNames(this._styles):this._getStylesEntries().map(([t])=>t)}clear(){this._styles={}}_getStylesEntries(){const e=[],t=Object.keys(this._styles);for(const n of t)e.push(...this._styleProcessor.getReducedForm(n,this._styles));return e}_cleanEmptyObjectsOnPath(e){const t=e.split(".");if(!(t.length>1))return;const n=t.splice(0,t.length-1).join("."),i=pi(this._styles,n);i&&!Array.from(Object.keys(i)).length&&this.remove(n)}}class hv{constructor(){this._normalizers=new Map,this._extractors=new Map,this._reducers=new Map,this._consumables=new Map}toNormalizedForm(e,t,n){if(xe(t))cs(n,ls(e),t);else if(this._normalizers.has(e)){const i=this._normalizers.get(e),{path:r,value:s}=i(t);cs(n,r,s)}else cs(n,e,t)}getNormalized(e,t){if(!e)return Cd({},t);if(t[e]!==void 0)return t[e];if(this._extractors.has(e)){const n=this._extractors.get(e);if(typeof n=="string")return pi(t,n);const i=n(e,t);if(i)return i}return pi(t,ls(e))}getReducedForm(e,t){const n=this.getNormalized(e,t);return n===void 0?[]:this._reducers.has(e)?this._reducers.get(e)(n):[[e,n]]}getStyleNames(e){const t=Array.from(this._consumables.keys()).filter(i=>{const r=this.getNormalized(i,e);return r&&typeof r=="object"?Object.keys(r).length:r}),n=new Set([...t,...Object.keys(e)]);return Array.from(n.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 n of t)this._mapStyleNames(n,[e])}_mapStyleNames(e,t){this._consumables.has(e)||this._consumables.set(e,[]),this._consumables.get(e).push(...t)}}function ls(o){return o.replace("-",".")}function cs(o,e,t){let n=t;xe(t)&&(n=Cd({},pi(o,e),t)),cv(o,e,n)}class et extends sn{constructor(e,t,n,i){if(super(e),this._unsafeAttributesToRender=[],this._customProperties=new Map,this.name=t,this._attrs=function(r){const s=St(r);for(const[a,l]of s)l===null?s.delete(a):typeof l!="string"&&s.set(a,String(l));return s}(n),this._children=[],i&&this._insertChild(0,i),this._classes=new Set,this._attrs.has("class")){const r=this._attrs.get("class");vd(this._classes,r),this._attrs.delete("class")}this._styles=new dv(this.document.stylesProcessor),this._attrs.has("style")&&(this._styles.setTo(this._attrs.get("style")),this._attrs.delete("style"))}get childCount(){return this._children.length}get isEmpty(){return this._children.length===0}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}*getAttributeKeys(){this._classes.size>0&&(yield"class"),this._styles.isEmpty||(yield"style"),yield*this._attrs.keys()}*getAttributes(){yield*this._attrs.entries(),this._classes.size>0&&(yield["class",this.getAttribute("class")]),this._styles.isEmpty||(yield["style",this.getAttribute("style")])}getAttribute(e){if(e=="class")return this._classes.size>0?[...this._classes].join(" "):void 0;if(e=="style"){const t=this._styles.toString();return t==""?void 0:t}return this._attrs.get(e)}hasAttribute(e){return e=="class"?this._classes.size>0:e=="style"?!this._styles.isEmpty:this._attrs.has(e)}isSimilar(e){if(!(e instanceof et))return!1;if(this===e)return!0;if(this.name!=e.name||this._attrs.size!==e._attrs.size||this._classes.size!==e._classes.size||this._styles.size!==e._styles.size)return!1;for(const[t,n]of this._attrs)if(!e._attrs.has(t)||e._attrs.get(t)!==n)return!1;for(const t of this._classes)if(!e._classes.has(t))return!1;for(const t of this._styles.getStyleNames())if(!e._styles.has(t)||e._styles.getAsString(t)!==this._styles.getAsString(t))return!1;return!0}hasClass(...e){for(const t of e)if(!this._classes.has(t))return!1;return!0}getClassNames(){return this._classes.keys()}getStyle(e){return this._styles.getAsString(e)}getNormalizedStyle(e){return this._styles.getNormalized(e)}getStyleNames(e){return this._styles.getStyleNames(e)}hasStyle(...e){for(const t of e)if(!this._styles.has(t))return!1;return!0}findAncestor(...e){const t=new Mn(...e);let n=this.parent;for(;n&&!n.is("documentFragment");){if(t.match(n))return n;n=n.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(),n=Array.from(this._attrs).map(i=>`${i[0]}="${i[1]}"`).sort().join(" ");return this.name+(e==""?"":` class="${e}"`)+(t?` style="${t}"`:"")+(n==""?"":` ${n}`)}shouldRenderUnsafeAttribute(e){return this._unsafeAttributesToRender.includes(e)}_clone(e=!1){const t=[];if(e)for(const i of this.getChildren())t.push(i._clone(e));const n=new this.constructor(this.document,this.name,this._attrs,t);return n._classes=new Set(this._classes),n._styles.set(this._styles.getNormalized()),n._customProperties=new Map(this._customProperties),n.getFillerOffset=this.getFillerOffset,n._unsafeAttributesToRender=this._unsafeAttributesToRender,n}_appendChild(e){return this._insertChild(this.childCount,e)}_insertChild(e,t){this._fireChange("children",this);let n=0;const i=function(r,s){return typeof s=="string"?[new pe(r,s)]:(Xe(s)||(s=[s]),Array.from(s).map(a=>typeof a=="string"?new pe(r,a):a instanceof bt?new pe(r,a.data):a))}(this.document,t);for(const r of i)r.parent!==null&&r._remove(),r.parent=this,r.document=this.document,this._children.splice(e,0,r),e++,n++;return n}_removeChildren(e,t=1){this._fireChange("children",this);for(let n=e;n<e+t;n++)this._children[n].parent=null;return this._children.splice(e,t)}_setAttribute(e,t){const n=String(t);this._fireChange("attributes",this),e=="class"?vd(this._classes,n):e=="style"?this._styles.setTo(n):this._attrs.set(e,n)}_removeAttribute(e){return this._fireChange("attributes",this),e=="class"?this._classes.size>0&&(this._classes.clear(),!0):e=="style"?!this._styles.isEmpty&&(this._styles.clear(),!0):this._attrs.delete(e)}_addClass(e){this._fireChange("attributes",this);for(const t of Pe(e))this._classes.add(t)}_removeClass(e){this._fireChange("attributes",this);for(const t of Pe(e))this._classes.delete(t)}_setStyle(e,t){this._fireChange("attributes",this),typeof e!="string"?this._styles.set(e):this._styles.set(e,t)}_removeStyle(e){this._fireChange("attributes",this);for(const t of Pe(e))this._styles.remove(t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}function vd(o,e){const t=e.split(/\s+/);o.clear(),t.forEach(n=>o.add(n))}et.prototype.is=function(o,e){return e?e===this.name&&(o==="element"||o==="view:element"):o==="element"||o==="view:element"||o==="node"||o==="view:node"};class wo extends et{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=yd}}function yd(){const o=[...this.getChildren()],e=o[this.childCount-1];if(e&&e.is("element","br"))return this.childCount;for(const t of o)if(!t.is("uiElement"))return null;return this.childCount}wo.prototype.is=function(o,e){return e?e===this.name&&(o==="containerElement"||o==="view:containerElement"||o==="element"||o==="view:element"):o==="containerElement"||o==="view:containerElement"||o==="element"||o==="view:element"||o==="node"||o==="view:node"};class fi extends ge(wo){constructor(e,t,n,i){super(e,t,n,i),this.set("isReadOnly",!1),this.set("isFocused",!1),this.bind("isReadOnly").to(e),this.bind("isFocused").to(e,"isFocused",r=>r&&e.selection.editableElement==this),this.listenTo(e.selection,"change",()=>{this.isFocused=e.isFocused&&e.selection.editableElement==this})}destroy(){this.stopListening()}}fi.prototype.is=function(o,e){return e?e===this.name&&(o==="editableElement"||o==="view:editableElement"||o==="containerElement"||o==="view:containerElement"||o==="element"||o==="view:element"):o==="editableElement"||o==="view:editableElement"||o==="containerElement"||o==="view:containerElement"||o==="element"||o==="view:element"||o==="node"||o==="view:node"};const Ed=Symbol("rootName");class xd extends fi{constructor(e,t){super(e,t),this.rootName="main"}get rootName(){return this.getCustomProperty(Ed)}set rootName(e){this._setCustomProperty(Ed,e)}set _name(e){this.name=e}}xd.prototype.is=function(o,e){return e?e===this.name&&(o==="rootElement"||o==="view:rootElement"||o==="editableElement"||o==="view:editableElement"||o==="containerElement"||o==="view:containerElement"||o==="element"||o==="view:element"):o==="rootElement"||o==="view:rootElement"||o==="editableElement"||o==="view:editableElement"||o==="containerElement"||o==="view:containerElement"||o==="element"||o==="view:element"||o==="node"||o==="view:node"};class ln{constructor(e={}){if(!e.boundaries&&!e.startPosition)throw new I("view-tree-walker-no-start-position",null);if(e.direction&&e.direction!="forward"&&e.direction!="backward")throw new I("view-tree-walker-unknown-direction",e.startPosition,{direction:e.direction});this.boundaries=e.boundaries||null,e.startPosition?this._position=U._createAt(e.startPosition):this._position=U._createAt(e.boundaries[e.direction=="backward"?"end":"start"]),this.direction=e.direction||"forward",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,n;do n=this.position,t=this.next();while(!t.done&&e(t.value));t.done||(this._position=n)}next(){return this.direction=="forward"?this._next():this._previous()}_next(){let e=this.position.clone();const t=this.position,n=e.parent;if(n.parent===null&&e.offset===n.childCount)return{done:!0,value:void 0};if(n===this._boundaryEndParent&&e.offset==this.boundaries.end.offset)return{done:!0,value:void 0};let i;if(n instanceof pe){if(e.isAtEnd)return this._position=U._createAfter(n),this._next();i=n.data[e.offset]}else i=n.getChild(e.offset);if(i instanceof et)return this.shallow?e.offset++:e=new U(i,0),this._position=e,this._formatReturnValue("elementStart",i,t,e,1);if(i instanceof pe){if(this.singleCharacters)return e=new U(i,0),this._position=e,this._next();{let r,s=i.data.length;return i==this._boundaryEndParent?(s=this.boundaries.end.offset,r=new bt(i,0,s),e=U._createAfter(r)):(r=new bt(i,0,i.data.length),e.offset++),this._position=e,this._formatReturnValue("text",r,t,e,s)}}if(typeof i=="string"){let r;this.singleCharacters?r=1:r=(n===this._boundaryEndParent?this.boundaries.end.offset:n.data.length)-e.offset;const s=new bt(n,e.offset,r);return e.offset+=r,this._position=e,this._formatReturnValue("text",s,t,e,r)}return e=U._createAfter(n),this._position=e,this.ignoreElementEnd?this._next():this._formatReturnValue("elementEnd",n,t,e)}_previous(){let e=this.position.clone();const t=this.position,n=e.parent;if(n.parent===null&&e.offset===0)return{done:!0,value:void 0};if(n==this._boundaryStartParent&&e.offset==this.boundaries.start.offset)return{done:!0,value:void 0};let i;if(n instanceof pe){if(e.isAtStart)return this._position=U._createBefore(n),this._previous();i=n.data[e.offset-1]}else i=n.getChild(e.offset-1);if(i instanceof et)return this.shallow?(e.offset--,this._position=e,this._formatReturnValue("elementStart",i,t,e,1)):(e=new U(i,i.childCount),this._position=e,this.ignoreElementEnd?this._previous():this._formatReturnValue("elementEnd",i,t,e));if(i instanceof pe){if(this.singleCharacters)return e=new U(i,i.data.length),this._position=e,this._previous();{let r,s=i.data.length;if(i==this._boundaryStartParent){const a=this.boundaries.start.offset;r=new bt(i,a,i.data.length-a),s=r.data.length,e=U._createBefore(r)}else r=new bt(i,0,i.data.length),e.offset--;return this._position=e,this._formatReturnValue("text",r,t,e,s)}}if(typeof i=="string"){let r;if(this.singleCharacters)r=1;else{const a=n===this._boundaryStartParent?this.boundaries.start.offset:0;r=e.offset-a}e.offset-=r;const s=new bt(n,e.offset,r);return this._position=e,this._formatReturnValue("text",s,t,e,r)}return e=U._createBefore(n),this._position=e,this._formatReturnValue("elementStart",n,t,e,1)}_formatReturnValue(e,t,n,i,r){return t instanceof bt&&(t.offsetInText+t.data.length==t.textNode.data.length&&(this.direction!="forward"||this.boundaries&&this.boundaries.end.isEqual(this.position)?n=U._createAfter(t.textNode):(i=U._createAfter(t.textNode),this._position=i)),t.offsetInText===0&&(this.direction!="backward"||this.boundaries&&this.boundaries.start.isEqual(this.position)?n=U._createBefore(t.textNode):(i=U._createBefore(t.textNode),this._position=i))),{done:!1,value:{type:e,item:t,previousPosition:n,nextPosition:i,length:r}}}}class U extends rn{constructor(e,t){super(),this.parent=e,this.offset=t}get nodeAfter(){return this.parent.is("$text")?null:this.parent.getChild(this.offset)||null}get nodeBefore(){return this.parent.is("$text")?null:this.parent.getChild(this.offset-1)||null}get isAtStart(){return this.offset===0}get isAtEnd(){const e=this.parent.is("$text")?this.parent.data.length:this.parent.childCount;return this.offset===e}get root(){return this.parent.root}get editableElement(){let e=this.parent;for(;!(e instanceof fi);){if(!e.parent)return null;e=e.parent}return e}getShiftedBy(e){const t=U._createAt(this),n=t.offset+e;return t.offset=n<0?0:n,t}getLastMatchingPosition(e,t={}){t.startPosition=this;const n=new ln(t);return n.skip(e),n.position}getAncestors(){return this.parent.is("documentFragment")?[this.parent]:this.parent.getAncestors({includeSelf:!0})}getCommonAncestor(e){const t=this.getAncestors(),n=e.getAncestors();let i=0;for(;t[i]==n[i]&&t[i];)i++;return i===0?null:t[i-1]}isEqual(e){return this.parent==e.parent&&this.offset==e.offset}isBefore(e){return this.compareWith(e)=="before"}isAfter(e){return this.compareWith(e)=="after"}compareWith(e){if(this.root!==e.root)return"different";if(this.isEqual(e))return"same";const t=this.parent.is("node")?this.parent.getPath():[],n=e.parent.is("node")?e.parent.getPath():[];t.push(this.offset),n.push(e.offset);const i=Ue(t,n);switch(i){case"prefix":return"before";case"extension":return"after";default:return t[i]<n[i]?"before":"after"}}getWalker(e={}){return e.startPosition=this,new ln(e)}clone(){return new U(this.parent,this.offset)}static _createAt(e,t){if(e instanceof U)return new this(e.parent,e.offset);{const n=e;if(t=="end")t=n.is("$text")?n.data.length:n.childCount;else{if(t=="before")return this._createBefore(n);if(t=="after")return this._createAfter(n);if(t!==0&&!t)throw new I("view-createpositionat-offset-required",n)}return new U(n,t)}}static _createAfter(e){if(e.is("$textProxy"))return new U(e.textNode,e.offsetInText+e.data.length);if(!e.parent)throw new I("view-position-after-root",e,{root:e});return new U(e.parent,e.index+1)}static _createBefore(e){if(e.is("$textProxy"))return new U(e.textNode,e.offsetInText);if(!e.parent)throw new I("view-position-before-root",e,{root:e});return new U(e.parent,e.index)}}U.prototype.is=function(o){return o==="position"||o==="view:position"};class X extends rn{constructor(e,t=null){super(),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(ki,{direction:"backward"}),t=this.end.getLastMatchingPosition(ki);return e.parent.is("$text")&&e.isAtStart&&(e=U._createBefore(e.parent)),t.parent.is("$text")&&t.isAtEnd&&(t=U._createAfter(t.parent)),new X(e,t)}getTrimmed(){let e=this.start.getLastMatchingPosition(ki);if(e.isAfter(this.end)||e.isEqual(this.end))return new X(e,e);let t=this.end.getLastMatchingPosition(ki,{direction:"backward"});const n=e.nodeAfter,i=t.nodeBefore;return n&&n.is("$text")&&(e=new U(n,0)),i&&i.is("$text")&&(t=new U(i,i.data.length)),new X(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 n=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),i=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return n&&i}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new X(this.start,e.start)),this.containsPosition(e.end)&&t.push(new X(e.end,this.end))):t.push(this.clone()),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,n=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(n=e.end),new X(t,n)}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 X(this.start,this.end)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new ln(e);for(const n of t)yield n.item}*getPositions(e={}){e.boundaries=this;const t=new ln(e);yield t.position;for(const n of t)yield n.nextPosition}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}static _createFromParentsAndOffsets(e,t,n,i){return new this(new U(e,t),new U(n,i))}static _createFromPositionAndShift(e,t){const n=e,i=e.getShiftedBy(t);return t>0?new this(n,i):new this(i,n)}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(U._createBefore(e),t)}}function ki(o){return!(!o.item.is("attributeElement")&&!o.item.is("uiElement"))}X.prototype.is=function(o){return o==="range"||o==="view:range"};class wt extends me(rn){constructor(...e){super(),this._ranges=[],this._lastRangeBackward=!1,this._isFake=!1,this._fakeSelectionLabel="",e.length&&this.setTo(...e)}get isFake(){return this._isFake}get fakeSelectionLabel(){return this._fakeSelectionLabel}get anchor(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.end:e.start).clone()}get focus(){if(!this._ranges.length)return null;const e=this._ranges[this._ranges.length-1];return(this._lastRangeBackward?e.start:e.end).clone()}get isCollapsed(){return this.rangeCount===1&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}get editableElement(){return this.anchor?this.anchor.editableElement:null}*getRanges(){for(const e of this._ranges)yield e.clone()}getFirstRange(){let e=null;for(const t of this._ranges)e&&!t.start.isBefore(e.start)||(e=t);return e?e.clone():null}getLastRange(){let e=null;for(const t of this._ranges)e&&!t.end.isAfter(e.end)||(e=t);return e?e.clone():null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}isEqual(e){if(this.isFake!=e.isFake||this.isFake&&this.fakeSelectionLabel!=e.fakeSelectionLabel||this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let n=!1;for(const i of e._ranges)if(t.isEqual(i)){n=!0;break}if(!n)return!1}return!0}isSimilar(e){if(this.isBackward!=e.isBackward)return!1;const t=kr(this.getRanges());if(t!=kr(e.getRanges()))return!1;if(t==0)return!0;for(let n of this.getRanges()){n=n.getTrimmed();let i=!1;for(let r of e.getRanges())if(r=r.getTrimmed(),n.start.isEqual(r.start)&&n.end.isEqual(r.end)){i=!0;break}if(!i)return!1}return!0}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}setTo(...e){let[t,n,i]=e;if(typeof n=="object"&&(i=n,n=void 0),t===null)this._setRanges([]),this._setFakeOptions(i);else if(t instanceof wt||t instanceof ds)this._setRanges(t.getRanges(),t.isBackward),this._setFakeOptions({fake:t.isFake,label:t.fakeSelectionLabel});else if(t instanceof X)this._setRanges([t],i&&i.backward),this._setFakeOptions(i);else if(t instanceof U)this._setRanges([new X(t)]),this._setFakeOptions(i);else if(t instanceof sn){const r=!!i&&!!i.backward;let s;if(n===void 0)throw new I("view-selection-setto-required-second-parameter",this);s=n=="in"?X._createIn(t):n=="on"?X._createOn(t):new X(U._createAt(t,n)),this._setRanges([s],r),this._setFakeOptions(i)}else{if(!Xe(t))throw new I("view-selection-setto-not-selectable",this);this._setRanges(t,i&&i.backward),this._setFakeOptions(i)}this.fire("change")}setFocus(e,t){if(this.anchor===null)throw new I("view-selection-setfocus-no-ranges",this);const n=U._createAt(e,t);if(n.compareWith(this.focus)=="same")return;const i=this.anchor;this._ranges.pop(),n.compareWith(i)=="before"?this._addRange(new X(n,i),!0):this._addRange(new X(i,n)),this.fire("change")}_setRanges(e,t=!1){e=Array.from(e),this._ranges=[];for(const n of e)this._addRange(n);this._lastRangeBackward=!!t}_setFakeOptions(e={}){this._isFake=!!e.fake,this._fakeSelectionLabel=e.fake&&e.label||""}_addRange(e,t=!1){if(!(e instanceof X))throw new I("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 I("view-selection-range-intersects",this,{addedRange:e,intersectingRange:t});this._ranges.push(new X(e.start,e.end))}}wt.prototype.is=function(o){return o==="selection"||o==="view:selection"};class ds extends me(rn){constructor(...e){super(),this._selection=new wt,this._selection.delegate("change").to(this),e.length&&this._selection.setTo(...e)}get isFake(){return this._selection.isFake}get fakeSelectionLabel(){return this._selection.fakeSelectionLabel}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get isCollapsed(){return this._selection.isCollapsed}get rangeCount(){return this._selection.rangeCount}get isBackward(){return this._selection.isBackward}get editableElement(){return this._selection.editableElement}get _ranges(){return this._selection._ranges}*getRanges(){yield*this._selection.getRanges()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getSelectedElement(){return this._selection.getSelectedElement()}isEqual(e){return this._selection.isEqual(e)}isSimilar(e){return this._selection.isSimilar(e)}_setTo(...e){this._selection.setTo(...e)}_setFocus(e,t){this._selection.setFocus(e,t)}}ds.prototype.is=function(o){return o==="selection"||o=="documentSelection"||o=="view:selection"||o=="view:documentSelection"};class Fn extends ${constructor(e,t,n){super(e,t),this.startRange=n,this._eventPhase="none",this._currentTarget=null}get eventPhase(){return this._eventPhase}get currentTarget(){return this._currentTarget}}const hs=Symbol("bubbling contexts");function us(o){return class extends o{fire(e,...t){try{const n=e instanceof $?e:new $(this,e),i=ms(this);if(!i.size)return;if(Ao(n,"capturing",this),Vn(i,"$capture",n,...t))return n.return;const r=n.startRange||this.selection.getFirstRange(),s=r?r.getContainedElement():null,a=!!s&&!!Sd(i,s);let l=s||function(c){if(!c)return null;const d=c.start.parent,u=c.end.parent,g=d.getPath(),f=u.getPath();return g.length>f.length?d:u}(r);if(Ao(n,"atTarget",l),!a){if(Vn(i,"$text",n,...t))return n.return;Ao(n,"bubbling",l)}for(;l;){if(l.is("rootElement")){if(Vn(i,"$root",n,...t))return n.return}else if(l.is("element")&&Vn(i,l.name,n,...t))return n.return;if(Vn(i,l,n,...t))return n.return;l=l.parent,Ao(n,"bubbling",l)}return Ao(n,"bubbling",this),Vn(i,"$document",n,...t),n.return}catch(n){I.rethrowUnexpectedError(n,this)}}_addEventListener(e,t,n){const i=Pe(n.context||"$document"),r=ms(this);for(const s of i){let a=r.get(s);a||(a=new(me()),r.set(s,a)),this.listenTo(a,e,t,n)}}_removeEventListener(e,t){const n=ms(this);for(const i of n.values())this.stopListening(i,e,t)}}}{const o=us(Object);["fire","_addEventListener","_removeEventListener"].forEach(e=>{us[e]=o.prototype[e]})}function Ao(o,e,t){o instanceof Fn&&(o._eventPhase=e,o._currentTarget=t)}function Vn(o,e,t,...n){const i=typeof e=="string"?o.get(e):Sd(o,e);return!!i&&(i.fire(t,...n),t.stop.called)}function Sd(o,e){for(const[t,n]of o)if(typeof t=="function"&&t(e))return n;return null}function ms(o){return o[hs]||(o[hs]=new Map),o[hs]}class Dd extends us(ge()){constructor(e){super(),this._postFixers=new Set,this.selection=new ds,this.roots=new st({idProperty:"rootName"}),this.stylesProcessor=e,this.set("isReadOnly",!1),this.set("isFocused",!1),this.set("isSelecting",!1),this.set("isComposing",!1)}getRoot(e="main"){return this.roots.get(e)}registerPostFixer(e){this._postFixers.add(e)}destroy(){this.roots.map(e=>e.destroy()),this.stopListening()}_callPostFixers(e){let t=!1;do for(const n of this._postFixers)if(t=n(e),t)break;while(t)}}class cn extends et{constructor(e,t,n,i){super(e,t,n,i),this._priority=10,this._id=null,this._clonesGroup=null,this.getFillerOffset=uv}get priority(){return this._priority}get id(){return this._id}getElementsWithSameId(){if(this.id===null)throw new I("attribute-element-get-elements-with-same-id-no-id",this);return new Set(this._clonesGroup)}isSimilar(e){return this.id!==null||e.id!==null?this.id===e.id:super.isSimilar(e)&&this.priority==e.priority}_clone(e=!1){const t=super._clone(e);return t._priority=this._priority,t._id=this._id,t}}function uv(){if(gs(this))return null;let o=this.parent;for(;o&&o.is("attributeElement");){if(gs(o)>1)return null;o=o.parent}return!o||gs(o)>1?null:this.childCount}function gs(o){return Array.from(o.getChildren()).filter(e=>!e.is("uiElement")).length}cn.DEFAULT_PRIORITY=10,cn.prototype.is=function(o,e){return e?e===this.name&&(o==="attributeElement"||o==="view:attributeElement"||o==="element"||o==="view:element"):o==="attributeElement"||o==="view:attributeElement"||o==="element"||o==="view:element"||o==="node"||o==="view:node"};class ps extends et{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=mv}_insertChild(e,t){if(t&&(t instanceof sn||Array.from(t).length>0))throw new I("view-emptyelement-cannot-add",[this,t]);return 0}}function mv(){return null}ps.prototype.is=function(o,e){return e?e===this.name&&(o==="emptyElement"||o==="view:emptyElement"||o==="element"||o==="view:element"):o==="emptyElement"||o==="view:emptyElement"||o==="element"||o==="view:element"||o==="node"||o==="view:node"};class bi extends et{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=pv}_insertChild(e,t){if(t&&(t instanceof sn||Array.from(t).length>0))throw new I("view-uielement-cannot-add",[this,t]);return 0}render(e,t){return this.toDomElement(e)}toDomElement(e){const t=e.createElement(this.name);for(const n of this.getAttributeKeys())t.setAttribute(n,this.getAttribute(n));return t}}function gv(o){o.document.on("arrowKey",(e,t)=>function(n,i,r){if(i.keyCode==se.arrowright){const s=i.domTarget.ownerDocument.defaultView.getSelection(),a=s.rangeCount==1&&s.getRangeAt(0).collapsed;if(a||i.shiftKey){const l=s.focusNode,c=s.focusOffset,d=r.domPositionToView(l,c);if(d===null)return;let u=!1;const g=d.getLastMatchingPosition(f=>(f.item.is("uiElement")&&(u=!0),!(!f.item.is("uiElement")&&!f.item.is("attributeElement"))));if(u){const f=r.viewPositionToDom(g);a?s.collapse(f.parent,f.offset):s.extend(f.parent,f.offset)}}}}(0,t,o.domConverter),{priority:"low"})}function pv(){return null}bi.prototype.is=function(o,e){return e?e===this.name&&(o==="uiElement"||o==="view:uiElement"||o==="element"||o==="view:element"):o==="uiElement"||o==="view:uiElement"||o==="element"||o==="view:element"||o==="node"||o==="view:node"};class fs extends et{constructor(e,t,n,i){super(e,t,n,i),this.getFillerOffset=fv}_insertChild(e,t){if(t&&(t instanceof sn||Array.from(t).length>0))throw new I("view-rawelement-cannot-add",[this,t]);return 0}render(e,t){}}function fv(){return null}fs.prototype.is=function(o,e){return e?e===this.name&&(o==="rawElement"||o==="view:rawElement"||o==="element"||o==="view:element"):o==="rawElement"||o==="view:rawElement"||o===this.name||o==="view:"+this.name||o==="element"||o==="view:element"||o==="node"||o==="view:node"};class dn extends me(rn){constructor(e,t){super(),this._children=[],this._customProperties=new Map,this.document=e,t&&this._insertChild(0,t)}[Symbol.iterator](){return this._children[Symbol.iterator]()}get childCount(){return this._children.length}get isEmpty(){return this.childCount===0}get root(){return this}get parent(){return null}get name(){}getCustomProperty(e){return this._customProperties.get(e)}*getCustomProperties(){yield*this._customProperties.entries()}_appendChild(e){return this._insertChild(this.childCount,e)}getChild(e){return this._children[e]}getChildIndex(e){return this._children.indexOf(e)}getChildren(){return this._children[Symbol.iterator]()}_insertChild(e,t){this._fireChange("children",this);let n=0;const i=function(r,s){return typeof s=="string"?[new pe(r,s)]:(Xe(s)||(s=[s]),Array.from(s).map(a=>typeof a=="string"?new pe(r,a):a instanceof bt?new pe(r,a.data):a))}(this.document,t);for(const r of i)r.parent!==null&&r._remove(),r.parent=this,this._children.splice(e,0,r),e++,n++;return n}_removeChildren(e,t=1){this._fireChange("children",this);for(let n=e;n<e+t;n++)this._children[n].parent=null;return this._children.splice(e,t)}_fireChange(e,t){this.fire("change:"+e,t)}_setCustomProperty(e,t){this._customProperties.set(e,t)}_removeCustomProperty(e){return this._customProperties.delete(e)}}dn.prototype.is=function(o){return o==="documentFragment"||o==="view:documentFragment"};class Bd{constructor(e){this._cloneGroups=new Map,this._slotFactory=null,this.document=e}setSelection(...e){this.document.selection._setTo(...e)}setSelectionFocus(e,t){this.document.selection._setFocus(e,t)}createDocumentFragment(e){return new dn(this.document,e)}createText(e){return new pe(this.document,e)}createAttributeElement(e,t,n={}){const i=new cn(this.document,e,t);return typeof n.priority=="number"&&(i._priority=n.priority),n.id&&(i._id=n.id),n.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),i}createContainerElement(e,t,n={},i={}){let r=null;Ke(n)?i=n:r=n;const s=new wo(this.document,e,t,r);return i.renderUnsafeAttributes&&s._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),s}createEditableElement(e,t,n={}){const i=new fi(this.document,e,t);return n.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),i}createEmptyElement(e,t,n={}){const i=new ps(this.document,e,t);return n.renderUnsafeAttributes&&i._unsafeAttributesToRender.push(...n.renderUnsafeAttributes),i}createUIElement(e,t,n){const i=new bi(this.document,e,t);return n&&(i.render=n),i}createRawElement(e,t,n,i={}){const r=new fs(this.document,e,t);return n&&(r.render=n),i.renderUnsafeAttributes&&r._unsafeAttributesToRender.push(...i.renderUnsafeAttributes),r}setAttribute(e,t,n){n._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){Ke(e)&&n===void 0?t._setStyle(e):n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}breakAttributes(e){return e instanceof U?this._breakAttributes(e):this._breakAttributesRange(e)}breakContainer(e){const t=e.parent;if(!t.is("containerElement"))throw new I("view-writer-break-non-container-element",this.document);if(!t.parent)throw new I("view-writer-break-root",this.document);if(e.isAtStart)return U._createBefore(t);if(!e.isAtEnd){const n=t._clone(!1);this.insert(U._createAfter(t),n);const i=new X(e,U._createAt(t,"end")),r=new U(n,0);this.move(i,r)}return U._createAfter(t)}mergeAttributes(e){const t=e.offset,n=e.parent;if(n.is("$text"))return e;if(n.is("attributeElement")&&n.childCount===0){const s=n.parent,a=n.index;return n._remove(),this._removeFromClonedElementsGroup(n),this.mergeAttributes(new U(s,a))}const i=n.getChild(t-1),r=n.getChild(t);if(!i||!r)return e;if(i.is("$text")&&r.is("$text"))return Id(i,r);if(i.is("attributeElement")&&r.is("attributeElement")&&i.isSimilar(r)){const s=i.childCount;return i._appendChild(r.getChildren()),r._remove(),this._removeFromClonedElementsGroup(r),this.mergeAttributes(new U(i,s))}return e}mergeContainers(e){const t=e.nodeBefore,n=e.nodeAfter;if(!(t&&n&&t.is("containerElement")&&n.is("containerElement")))throw new I("view-writer-merge-containers-invalid-position",this.document);const i=t.getChild(t.childCount-1),r=i instanceof pe?U._createAt(i,"end"):U._createAt(t,"end");return this.move(X._createIn(n),U._createAt(t,"end")),this.remove(X._createOn(n)),r}insert(e,t){Pd(t=Xe(t)?[...t]:[t],this.document);const n=t.reduce((s,a)=>{const l=s[s.length-1],c=!a.is("uiElement");return l&&l.breakAttributes==c?l.nodes.push(a):s.push({breakAttributes:c,nodes:[a]}),s},[]);let i=null,r=e;for(const{nodes:s,breakAttributes:a}of n){const l=this._insertNodes(r,s,a);i||(i=l.start),r=l.end}return i?new X(i,r):new X(e)}remove(e){const t=e instanceof X?e:X._createOn(e);if(_o(t,this.document),t.isCollapsed)return new dn(this.document);const{start:n,end:i}=this._breakAttributesRange(t,!0),r=n.parent,s=i.offset-n.offset,a=r._removeChildren(n.offset,s);for(const c of a)this._removeFromClonedElementsGroup(c);const l=this.mergeAttributes(n);return t.start=l,t.end=l.clone(),new dn(this.document,a)}clear(e,t){_o(e,this.document);const n=e.getWalker({direction:"backward",ignoreElementEnd:!0});for(const i of n){const r=i.item;let s;if(r.is("element")&&t.isSimilar(r))s=X._createOn(r);else if(!i.nextPosition.isAfter(e.start)&&r.is("$textProxy")){const a=r.getAncestors().find(l=>l.is("element")&&t.isSimilar(l));a&&(s=X._createIn(a))}s&&(s.end.isAfter(e.end)&&(s.end=e.end),s.start.isBefore(e.start)&&(s.start=e.start),this.remove(s))}}move(e,t){let n;if(t.isAfter(e.end)){const i=(t=this._breakAttributes(t,!0)).parent,r=i.childCount;e=this._breakAttributesRange(e,!0),n=this.remove(e),t.offset+=i.childCount-r}else n=this.remove(e);return this.insert(t,n)}wrap(e,t){if(!(t instanceof cn))throw new I("view-writer-wrap-invalid-attribute",this.document);if(_o(e,this.document),e.isCollapsed){let i=e.start;i.parent.is("element")&&(n=i.parent,!Array.from(n.getChildren()).some(s=>!s.is("uiElement")))&&(i=i.getLastMatchingPosition(s=>s.item.is("uiElement"))),i=this._wrapPosition(i,t);const r=this.document.selection;return r.isCollapsed&&r.getFirstPosition().isEqual(e.start)&&this.setSelection(i),new X(i)}return this._wrapRange(e,t);var n}unwrap(e,t){if(!(t instanceof cn))throw new I("view-writer-unwrap-invalid-attribute",this.document);if(_o(e,this.document),e.isCollapsed)return e;const{start:n,end:i}=this._breakAttributesRange(e,!0),r=n.parent,s=this._unwrapChildren(r,n.offset,i.offset,t),a=this.mergeAttributes(s.start);a.isEqual(s.start)||s.end.offset--;const l=this.mergeAttributes(s.end);return new X(a,l)}rename(e,t){const n=new wo(this.document,e,t.getAttributes());return this.insert(U._createAfter(t),n),this.move(X._createIn(t),U._createAt(n,0)),this.remove(X._createOn(t)),n}clearClonedElementsGroup(e){this._cloneGroups.delete(e)}createPositionAt(e,t){return U._createAt(e,t)}createPositionAfter(e){return U._createAfter(e)}createPositionBefore(e){return U._createBefore(e)}createRange(e,t){return new X(e,t)}createRangeOn(e){return X._createOn(e)}createRangeIn(e){return X._createIn(e)}createSelection(...e){return new wt(...e)}createSlot(e="children"){if(!this._slotFactory)throw new I("view-writer-invalid-create-slot-context",this.document);return this._slotFactory(this,e)}_registerSlotFactory(e){this._slotFactory=e}_clearSlotFactory(){this._slotFactory=null}_insertNodes(e,t,n){let i,r;if(i=n?ks(e):e.parent.is("$text")?e.parent.parent:e.parent,!i)throw new I("view-writer-invalid-position-container",this.document);r=n?this._breakAttributes(e,!0):e.parent.is("$text")?bs(e):e;const s=i._insertChild(r.offset,t);for(const d of t)this._addToClonedElementsGroup(d);const a=r.getShiftedBy(s),l=this.mergeAttributes(r);l.isEqual(r)||a.offset--;const c=this.mergeAttributes(a);return new X(l,c)}_wrapChildren(e,t,n,i){let r=t;const s=[];for(;r<n;){const l=e.getChild(r),c=l.is("$text"),d=l.is("attributeElement");if(d&&this._wrapAttributeElement(i,l))s.push(new U(e,r));else if(c||!d||kv(i,l)){const u=i._clone();l._remove(),u._appendChild(l),e._insertChild(r,u),this._addToClonedElementsGroup(u),s.push(new U(e,r))}else this._wrapChildren(l,0,l.childCount,i);r++}let a=0;for(const l of s)l.offset-=a,l.offset!=t&&(this.mergeAttributes(l).isEqual(l)||(a++,n--));return X._createFromParentsAndOffsets(e,t,e,n)}_unwrapChildren(e,t,n,i){let r=t;const s=[];for(;r<n;){const l=e.getChild(r);if(l.is("attributeElement"))if(l.isSimilar(i)){const c=l.getChildren(),d=l.childCount;l._remove(),e._insertChild(r,c),this._removeFromClonedElementsGroup(l),s.push(new U(e,r),new U(e,r+d)),r+=d,n+=d-1}else this._unwrapAttributeElement(i,l)?(s.push(new U(e,r),new U(e,r+1)),r++):(this._unwrapChildren(l,0,l.childCount,i),r++);else r++}let a=0;for(const l of s)l.offset-=a,!(l.offset==t||l.offset==n)&&(this.mergeAttributes(l).isEqual(l)||(a++,n--));return X._createFromParentsAndOffsets(e,t,e,n)}_wrapRange(e,t){const{start:n,end:i}=this._breakAttributesRange(e,!0),r=n.parent,s=this._wrapChildren(r,n.offset,i.offset,t),a=this.mergeAttributes(s.start);a.isEqual(s.start)||s.end.offset--;const l=this.mergeAttributes(s.end);return new X(a,l)}_wrapPosition(e,t){if(t.isSimilar(e.parent))return Td(e.clone());e.parent.is("$text")&&(e=bs(e));const n=this.createAttributeElement("_wrapPosition-fake-element");n._priority=Number.POSITIVE_INFINITY,n.isSimilar=()=>!1,e.parent._insertChild(e.offset,n);const i=new X(e,e.getShiftedBy(1));this.wrap(i,t);const r=new U(n.parent,n.index);n._remove();const s=r.nodeBefore,a=r.nodeAfter;return s instanceof pe&&a instanceof pe?Id(s,a):Td(r)}_wrapAttributeElement(e,t){if(!Rd(e,t)||e.name!==t.name||e.priority!==t.priority)return!1;for(const n of e.getAttributeKeys())if(n!=="class"&&n!=="style"&&t.hasAttribute(n)&&t.getAttribute(n)!==e.getAttribute(n))return!1;for(const n of e.getStyleNames())if(t.hasStyle(n)&&t.getStyle(n)!==e.getStyle(n))return!1;for(const n of e.getAttributeKeys())n!=="class"&&n!=="style"&&(t.hasAttribute(n)||this.setAttribute(n,e.getAttribute(n),t));for(const n of e.getStyleNames())t.hasStyle(n)||this.setStyle(n,e.getStyle(n),t);for(const n of e.getClassNames())t.hasClass(n)||this.addClass(n,t);return!0}_unwrapAttributeElement(e,t){if(!Rd(e,t)||e.name!==t.name||e.priority!==t.priority)return!1;for(const n of e.getAttributeKeys())if(n!=="class"&&n!=="style"&&(!t.hasAttribute(n)||t.getAttribute(n)!==e.getAttribute(n)))return!1;if(!t.hasClass(...e.getClassNames()))return!1;for(const n of e.getStyleNames())if(!t.hasStyle(n)||t.getStyle(n)!==e.getStyle(n))return!1;for(const n of e.getAttributeKeys())n!=="class"&&n!=="style"&&this.removeAttribute(n,t);return this.removeClass(Array.from(e.getClassNames()),t),this.removeStyle(Array.from(e.getStyleNames()),t),!0}_breakAttributesRange(e,t=!1){const n=e.start,i=e.end;if(_o(e,this.document),e.isCollapsed){const l=this._breakAttributes(e.start,t);return new X(l,l)}const r=this._breakAttributes(i,t),s=r.parent.childCount,a=this._breakAttributes(n,t);return r.offset+=r.parent.childCount-s,new X(a,r)}_breakAttributes(e,t=!1){const n=e.offset,i=e.parent;if(e.parent.is("emptyElement"))throw new I("view-writer-cannot-break-empty-element",this.document);if(e.parent.is("uiElement"))throw new I("view-writer-cannot-break-ui-element",this.document);if(e.parent.is("rawElement"))throw new I("view-writer-cannot-break-raw-element",this.document);if(!t&&i.is("$text")&&ws(i.parent)||ws(i))return e.clone();if(i.is("$text"))return this._breakAttributes(bs(e),t);if(n==i.childCount){const r=new U(i.parent,i.index+1);return this._breakAttributes(r,t)}if(n===0){const r=new U(i.parent,i.index);return this._breakAttributes(r,t)}{const r=i.index+1,s=i._clone();i.parent._insertChild(r,s),this._addToClonedElementsGroup(s);const a=i.childCount-n,l=i._removeChildren(n,a);s._appendChild(l);const c=new U(i.parent,r);return this._breakAttributes(c,t)}}_addToClonedElementsGroup(e){if(!e.root.is("rootElement"))return;if(e.is("element"))for(const i of e.getChildren())this._addToClonedElementsGroup(i);const t=e.id;if(!t)return;let n=this._cloneGroups.get(t);n||(n=new Set,this._cloneGroups.set(t,n)),n.add(e),e._clonesGroup=n}_removeFromClonedElementsGroup(e){if(e.is("element"))for(const i of e.getChildren())this._removeFromClonedElementsGroup(i);const t=e.id;if(!t)return;const n=this._cloneGroups.get(t);n&&n.delete(e)}}function ks(o){let e=o.parent;for(;!ws(e);){if(!e)return;e=e.parent}return e}function kv(o,e){return o.priority<e.priority||!(o.priority>e.priority)&&o.getIdentity()<e.getIdentity()}function Td(o){const e=o.nodeBefore;if(e&&e.is("$text"))return new U(e,e.data.length);const t=o.nodeAfter;return t&&t.is("$text")?new U(t,0):o}function bs(o){if(o.offset==o.parent.data.length)return new U(o.parent.parent,o.parent.index+1);if(o.offset===0)return new U(o.parent.parent,o.parent.index);const e=o.parent.data.slice(o.offset);return o.parent._data=o.parent.data.slice(0,o.offset),o.parent.parent._insertChild(o.parent.index+1,new pe(o.root.document,e)),new U(o.parent.parent,o.parent.index+1)}function Id(o,e){const t=o.data.length;return o._data+=e.data,e._remove(),new U(o,t)}const bv=[pe,cn,wo,ps,fs,bi];function Pd(o,e){for(const t of o){if(!bv.some(n=>t instanceof n))throw new I("view-writer-insert-invalid-node-type",e);t.is("$text")||Pd(t.getChildren(),e)}}function ws(o){return o&&(o.is("containerElement")||o.is("documentFragment"))}function _o(o,e){const t=ks(o.start),n=ks(o.end);if(!t||!n||t!==n)throw new I("view-writer-invalid-range-container",e)}function Rd(o,e){return o.id===null&&e.id===null}const Od=o=>o.createTextNode(" "),Nd=o=>{const e=o.createElement("span");return e.dataset.ckeFiller="true",e.innerText=" ",e},zd=o=>{const e=o.createElement("br");return e.dataset.ckeFiller="true",e},At=7,wi="".repeat(At);function tt(o){return Ie(o)&&o.data.substr(0,At)===wi}function Co(o){return o.data.length==At&&tt(o)}function Md(o){return tt(o)?o.data.slice(At):o.data}function wv(o,e){if(e.keyCode==se.arrowleft){const t=e.domTarget.ownerDocument.defaultView.getSelection();if(t.rangeCount==1&&t.getRangeAt(0).collapsed){const n=t.getRangeAt(0).startContainer,i=t.getRangeAt(0).startOffset;tt(n)&&i<=At&&t.collapse(n,0)}}}var Fd=D(9315),Av={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Fd.Z,Av),Fd.Z.locals;class _v extends ge(){constructor(e,t){super(),this.domDocuments=new Set,this.markedAttributes=new Set,this.markedChildren=new Set,this.markedTexts=new Set,this._inlineFiller=null,this._fakeSelectionContainer=null,this.domConverter=e,this.selection=t,this.set("isFocused",!1),this.set("isSelecting",!1),k.isBlink&&!k.isAndroid&&this.on("change:isSelecting",()=>{this.isSelecting||this.render()}),this.set("isComposing",!1),this.on("change:isComposing",()=>{this.isComposing||this.render()})}markToSync(e,t){if(e==="text")this.domConverter.mapViewToDom(t.parent)&&this.markedTexts.add(t);else{if(!this.domConverter.mapViewToDom(t))return;if(e==="attributes")this.markedAttributes.add(t);else{if(e!=="children")throw new I("view-renderer-unknown-type",this);this.markedChildren.add(t)}}}render(){if(this.isComposing&&!k.isAndroid)return;let e=null;const t=!(k.isBlink&&!k.isAndroid)||!this.isSelecting;for(const n of this.markedChildren)this._updateChildrenMappings(n);t?(this._inlineFiller&&!this._isSelectionInInlineFiller()&&this._removeInlineFiller(),this._inlineFiller?e=this._getInlineFillerPosition():this._needsInlineFillerAtSelection()&&(e=this.selection.getFirstPosition(),this.markedChildren.add(e.parent))):this._inlineFiller&&this._inlineFiller.parentNode&&(e=this.domConverter.domPositionToView(this._inlineFiller),e&&e.parent.is("$text")&&(e=U._createBefore(e.parent)));for(const n of this.markedAttributes)this._updateAttrs(n);for(const n of this.markedChildren)this._updateChildren(n,{inlineFillerPosition:e});for(const n of this.markedTexts)!this.markedChildren.has(n.parent)&&this.domConverter.mapViewToDom(n.parent)&&this._updateText(n,{inlineFillerPosition:e});if(t)if(e){const n=this.domConverter.viewPositionToDom(e),i=n.parent.ownerDocument;tt(n.parent)?this._inlineFiller=n.parent:this._inlineFiller=Vd(i,n.parent,n.offset)}else this._inlineFiller=null;this._updateFocus(),this._updateSelection(),this.markedTexts.clear(),this.markedAttributes.clear(),this.markedChildren.clear()}_updateChildrenMappings(e){if(!this.domConverter.mapViewToDom(e))return;const t=Array.from(this.domConverter.mapViewToDom(e).childNodes),n=Array.from(this.domConverter.viewChildrenToDom(e,{withChildren:!1})),i=this._diffNodeLists(t,n),r=this._findUpdateActions(i,t,n,Cv);if(r.indexOf("update")!==-1){const s={equal:0,insert:0,delete:0};for(const a of r)if(a==="update"){const l=s.equal+s.insert,c=s.equal+s.delete,d=e.getChild(l);!d||d.is("uiElement")||d.is("rawElement")||this._updateElementMappings(d,t[c]),Ec(n[l]),s.equal++}else s[a]++}}_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")?U._createBefore(e.parent):e}_isSelectionInInlineFiller(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=this.domConverter.viewPositionToDom(e);return!!(t&&Ie(t.parent)&&tt(t.parent))}_removeInlineFiller(){const e=this._inlineFiller;if(!tt(e))throw new I("view-renderer-filler-was-lost",this);Co(e)?e.remove():e.data=e.data.substr(At),this._inlineFiller=null}_needsInlineFillerAtSelection(){if(this.selection.rangeCount!=1||!this.selection.isCollapsed)return!1;const e=this.selection.getFirstPosition(),t=e.parent,n=e.offset;if(!this.domConverter.mapViewToDom(t.root)||!t.is("element")||!function(s){if(s.getAttribute("contenteditable")=="false")return!1;const a=s.findAncestor(l=>l.hasAttribute("contenteditable"));return!a||a.getAttribute("contenteditable")=="true"}(t)||n===t.getFillerOffset())return!1;const i=e.nodeBefore,r=e.nodeAfter;return!(i instanceof pe||r instanceof pe)&&(!k.isAndroid||!i&&!r)}_updateText(e,t){const n=this.domConverter.findCorrespondingDomText(e);let i=this.domConverter.viewToDom(e).data;const r=t.inlineFillerPosition;r&&r.parent==e.parent&&r.offset==e.index&&(i=wi+i),Ld(n,i)}_updateAttrs(e){const t=this.domConverter.mapViewToDom(e);if(!t)return;const n=Array.from(t.attributes).map(r=>r.name),i=e.getAttributeKeys();for(const r of i)this.domConverter.setDomElementAttribute(t,r,e.getAttribute(r),e);for(const r of n)e.hasAttribute(r)||this.domConverter.removeDomElementAttribute(t,r)}_updateChildren(e,t){const n=this.domConverter.mapViewToDom(e);if(!n)return;if(k.isAndroid){let u=null;for(const g of Array.from(n.childNodes)){if(u&&Ie(u)&&Ie(g)){n.normalize();break}u=g}}const i=t.inlineFillerPosition,r=n.childNodes,s=Array.from(this.domConverter.viewChildrenToDom(e,{bind:!0}));i&&i.parent===e&&Vd(n.ownerDocument,s,i.offset);const a=this._diffNodeLists(r,s),l=this._findUpdateActions(a,r,s,vv);let c=0;const d=new Set;for(const u of l)u==="delete"?(d.add(r[c]),Ec(r[c])):u!=="equal"&&u!=="update"||c++;c=0;for(const u of l)u==="insert"?(Ac(n,c,s[c]),c++):u==="update"?(Ld(r[c],s[c].data),c++):u==="equal"&&(this._markDescendantTextToSync(this.domConverter.domToView(s[c])),c++);for(const u of d)u.parentNode||this.domConverter.unbindDomElement(u)}_diffNodeLists(e,t){return e=function(n,i){const r=Array.from(n);return r.length==0||!i||r[r.length-1]==i&&r.pop(),r}(e,this._fakeSelectionContainer),F(e,t,yv.bind(null,this.domConverter))}_findUpdateActions(e,t,n,i){if(e.indexOf("insert")===-1||e.indexOf("delete")===-1)return e;let r=[],s=[],a=[];const l={equal:0,insert:0,delete:0};for(const c of e)c==="insert"?a.push(n[l.equal+l.insert]):c==="delete"?s.push(t[l.equal+l.delete]):(r=r.concat(F(s,a,i).map(d=>d==="equal"?"update":d)),r.push("equal"),s=[],a=[]),l[c]++;return r.concat(F(s,a,i).map(c=>c==="equal"?"update":c))}_markDescendantTextToSync(e){if(e){if(e.is("$text"))this.markedTexts.add(e);else if(e.is("element"))for(const t of e.getChildren())this._markDescendantTextToSync(t)}}_updateSelection(){if(k.isBlink&&!k.isAndroid&&this.isSelecting&&!this.markedChildren.size)return;if(this.selection.rangeCount===0)return this._removeDomSelection(),void this._removeFakeSelection();const e=this.domConverter.mapViewToDom(this.selection.editableElement);this.isFocused&&e&&(this.selection.isFake?this._updateFakeSelection(e):this._fakeSelectionContainer&&this._fakeSelectionContainer.isConnected?(this._removeFakeSelection(),this._updateDomSelection(e)):this.isComposing&&k.isAndroid||this._updateDomSelection(e))}_updateFakeSelection(e){const t=e.ownerDocument;this._fakeSelectionContainer||(this._fakeSelectionContainer=function(s){const a=s.createElement("div");return a.className="ck-fake-selection-container",Object.assign(a.style,{position:"fixed",top:0,left:"-9999px",width:"42px"}),a.textContent=" ",a}(t));const n=this._fakeSelectionContainer;if(this.domConverter.bindFakeSelection(n,this.selection),!this._fakeSelectionNeedsUpdate(e))return;n.parentElement&&n.parentElement==e||e.appendChild(n),n.textContent=this.selection.fakeSelectionLabel||" ";const i=t.getSelection(),r=t.createRange();i.removeAllRanges(),r.selectNodeContents(n),i.addRange(r)}_updateDomSelection(e){const t=e.ownerDocument.defaultView.getSelection();if(!this._domSelectionNeedsUpdate(t))return;const n=this.domConverter.viewPositionToDom(this.selection.anchor),i=this.domConverter.viewPositionToDom(this.selection.focus);t.collapse(n.parent,n.offset),t.extend(i.parent,i.offset),k.isGecko&&function(r,s){const a=r.parent;if(a.nodeType!=Node.ELEMENT_NODE||r.offset!=a.childNodes.length-1)return;const l=a.childNodes[r.offset];l&&l.tagName=="BR"&&s.addRange(s.getRangeAt(0))}(i,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,n=e.ownerDocument.getSelection();return!t||t.parentElement!==e||n.anchorNode!==t&&!t.contains(n.anchorNode)||t.textContent!==this.selection.fakeSelectionLabel}_removeDomSelection(){for(const e of this.domDocuments){const t=e.getSelection();if(t.rangeCount){const n=e.activeElement,i=this.domConverter.mapDomToView(n);n&&i&&t.removeAllRanges()}}}_removeFakeSelection(){const e=this._fakeSelectionContainer;e&&e.remove()}_updateFocus(){if(this.isFocused){const e=this.selection.editableElement;e&&this.domConverter.focus(e)}}}function Vd(o,e,t){const n=e instanceof Array?e:e.childNodes,i=n[t];if(Ie(i))return i.data=wi+i.data,i;{const r=o.createTextNode(wi);return Array.isArray(e)?n.splice(t,0,r):Ac(e,t,r),r}}function Cv(o,e){return Lt(o)&&Lt(e)&&!Ie(o)&&!Ie(e)&&!On(o)&&!On(e)&&o.tagName.toLowerCase()===e.tagName.toLowerCase()}function vv(o,e){return Lt(o)&&Lt(e)&&Ie(o)&&Ie(e)}function yv(o,e,t){return e===t||(Ie(e)&&Ie(t)?e.data===t.data:!(!o.isBlockFiller(e)||!o.isBlockFiller(t)))}function Ld(o,e){const t=o.data;if(t==e)return;const n=R(t,e);for(const i of n)i.type==="insert"?o.insertData(i.index,i.values.join("")):o.deleteData(i.index,i.howMany)}const Ev=zd(oe.document),xv=Od(oe.document),Sv=Nd(oe.document),Ai="data-ck-unsafe-attribute-",jd="data-ck-unsafe-element";class $d{constructor(e,{blockFillerMode:t,renderingMode:n="editing"}={}){this._domToViewMapping=new WeakMap,this._viewToDomMapping=new WeakMap,this._fakeSelectionMapping=new WeakMap,this._rawContentElementMatcher=new Mn,this._encounteredRawContentDomNodes=new WeakSet,this.document=e,this.renderingMode=n,this.blockFillerMode=t||(n==="editing"?"br":"nbsp"),this.preElements=["pre"],this.blockElements=["address","article","aside","blockquote","caption","center","dd","details","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","legend","li","main","menu","nav","ol","p","pre","section","summary","table","tbody","td","tfoot","th","thead","tr","ul"],this.inlineObjectElements=["object","iframe","input","button","textarea","select","option","video","embed","audio","img","canvas"],this.unsafeElements=["script","style"],this._domDocument=this.renderingMode==="editing"?oe.document:oe.document.implementation.createHTMLDocument("")}bindFakeSelection(e,t){this._fakeSelectionMapping.set(e,new wt(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 n of Array.from(e.children))this.unbindDomElement(n)}}bindDocumentFragments(e,t){this._domToViewMapping.set(e,t),this._viewToDomMapping.set(t,e)}shouldRenderAttribute(e,t,n){return this.renderingMode==="data"||!(e=e.toLowerCase()).startsWith("on")&&(e!=="srcdoc"||!t.match(/\bon\S+\s*=|javascript:|<\s*\/*script/i))&&(n==="img"&&(e==="src"||e==="srcset")||n==="source"&&e==="srcset"||!t.match(/^\s*(javascript:|data:(image\/svg|text\/x?html))/i))}setContentOf(e,t){if(this.renderingMode==="data")return void(e.innerHTML=t);const n=new DOMParser().parseFromString(t,"text/html"),i=n.createDocumentFragment(),r=n.body.childNodes;for(;r.length>0;)i.appendChild(r[0]);const s=n.createTreeWalker(i,NodeFilter.SHOW_ELEMENT),a=[];let l;for(;l=s.nextNode();)a.push(l);for(const c of a){for(const u of c.getAttributeNames())this.setDomElementAttribute(c,u,c.getAttribute(u));const d=c.tagName.toLowerCase();this._shouldRenameElement(d)&&(Ud(d),c.replaceWith(this._createReplacementDomElement(d,c)))}for(;e.firstChild;)e.firstChild.remove();e.append(i)}viewToDom(e,t={}){if(e.is("$text")){const n=this._processDataFromViewText(e);return this._domDocument.createTextNode(n)}{if(this.mapViewToDom(e))return this.mapViewToDom(e);let n;if(e.is("documentFragment"))n=this._domDocument.createDocumentFragment(),t.bind&&this.bindDocumentFragments(n,e);else{if(e.is("uiElement"))return n=e.name==="$comment"?this._domDocument.createComment(e.getCustomProperty("$rawContent")):e.render(this._domDocument,this),t.bind&&this.bindElements(n,e),n;this._shouldRenameElement(e.name)?(Ud(e.name),n=this._createReplacementDomElement(e.name)):n=e.hasAttribute("xmlns")?this._domDocument.createElementNS(e.getAttribute("xmlns"),e.name):this._domDocument.createElement(e.name),e.is("rawElement")&&e.render(n,this),t.bind&&this.bindElements(n,e);for(const i of e.getAttributeKeys())this.setDomElementAttribute(n,i,e.getAttribute(i),e)}if(t.withChildren!==!1)for(const i of this.viewChildrenToDom(e,t))n.appendChild(i);return n}}setDomElementAttribute(e,t,n,i){const r=this.shouldRenderAttribute(t,n,e.tagName.toLowerCase())||i&&i.shouldRenderUnsafeAttribute(t);r||Q("domconverter-unsafe-attribute-detected",{domElement:e,key:t,value:n}),_c(t)?(e.hasAttribute(t)&&!r?e.removeAttribute(t):e.hasAttribute(Ai+t)&&r&&e.removeAttribute(Ai+t),e.setAttribute(r?t:Ai+t,n)):Q("domconverter-invalid-attribute-detected",{domElement:e,key:t,value:n})}removeDomElementAttribute(e,t){t!=jd&&(e.removeAttribute(t),e.removeAttribute(Ai+t))}*viewChildrenToDom(e,t={}){const n=e.getFillerOffset&&e.getFillerOffset();let i=0;for(const r of e.getChildren()){n===i&&(yield this._getBlockFiller());const s=r.is("element")&&!!r.getCustomProperty("dataPipeline:transparentRendering")&&!ze(r.getAttributes());s&&this.renderingMode=="data"?yield*this.viewChildrenToDom(r,t):(s&&Q("domconverter-transparent-rendering-unsupported-in-editing-pipeline",{viewElement:r}),yield this.viewToDom(r,t)),i++}n===i&&(yield this._getBlockFiller())}viewRangeToDom(e){const t=this.viewPositionToDom(e.start),n=this.viewPositionToDom(e.end),i=this._domDocument.createRange();return i.setStart(t.parent,t.offset),i.setEnd(n.parent,n.offset),i}viewPositionToDom(e){const t=e.parent;if(t.is("$text")){const n=this.findCorrespondingDomText(t);if(!n)return null;let i=e.offset;return tt(n)&&(i+=At),{parent:n,offset:i}}{let n,i,r;if(e.offset===0){if(n=this.mapViewToDom(t),!n)return null;r=n.childNodes[0]}else{const s=e.nodeBefore;if(i=s.is("$text")?this.findCorrespondingDomText(s):this.mapViewToDom(s),!i)return null;n=i.parentNode,r=i.nextSibling}return Ie(r)&&tt(r)?{parent:r,offset:At}:{parent:n,offset:i?ai(i)+1:0}}}domToView(e,t={}){if(this.isBlockFiller(e))return null;const n=this.getHostViewElement(e);if(n)return n;if(On(e)&&t.skipComments)return null;if(Ie(e)){if(Co(e))return null;{const i=this._processDataFromDomText(e);return i===""?null:new pe(this.document,i)}}{if(this.mapDomToView(e))return this.mapDomToView(e);let i;if(this.isDocumentFragment(e))i=new dn(this.document),t.bind&&this.bindDocumentFragments(e,i);else{i=this._createViewElement(e,t),t.bind&&this.bindElements(e,i);const r=e.attributes;if(r)for(let s=r.length,a=0;a<s;a++)i._setAttribute(r[a].name,r[a].value);if(this._isViewElementWithRawContent(i,t)||On(e)){const s=On(e)?e.data:e.innerHTML;return i._setCustomProperty("$rawContent",s),this._encounteredRawContentDomNodes.add(e),i}}if(t.withChildren!==!1)for(const r of this.domChildrenToView(e,t))i._appendChild(r);return i}}*domChildrenToView(e,t){for(let n=0;n<e.childNodes.length;n++){const i=e.childNodes[n],r=this.domToView(i,t);r!==null&&(yield r)}}domSelectionToView(e){if(e.rangeCount===1){let i=e.getRangeAt(0).startContainer;Ie(i)&&(i=i.parentNode);const r=this.fakeSelectionToView(i);if(r)return r}const t=this.isDomSelectionBackward(e),n=[];for(let i=0;i<e.rangeCount;i++){const r=e.getRangeAt(i),s=this.domRangeToView(r);s&&n.push(s)}return new wt(n,{backward:t})}domRangeToView(e){const t=this.domPositionToView(e.startContainer,e.startOffset),n=this.domPositionToView(e.endContainer,e.endOffset);return t&&n?new X(t,n):null}domPositionToView(e,t=0){if(this.isBlockFiller(e))return this.domPositionToView(e.parentNode,ai(e));const n=this.mapDomToView(e);if(n&&(n.is("uiElement")||n.is("rawElement")))return U._createBefore(n);if(Ie(e)){if(Co(e))return this.domPositionToView(e.parentNode,ai(e));const i=this.findCorrespondingViewText(e);let r=t;return i?(tt(e)&&(r-=At,r=r<0?0:r),new U(i,r)):null}if(t===0){const i=this.mapDomToView(e);if(i)return new U(i,0)}else{const i=e.childNodes[t-1];if(Ie(i)&&Co(i)||i&&this.isBlockFiller(i))return this.domPositionToView(i.parentNode,ai(i));const r=Ie(i)?this.findCorrespondingViewText(i):this.mapDomToView(i);if(r&&r.parent)return new U(r.parent,r.index+1)}return null}mapDomToView(e){return this.getHostViewElement(e)||this._domToViewMapping.get(e)}findCorrespondingViewText(e){if(Co(e))return null;const t=this.getHostViewElement(e);if(t)return t;const n=e.previousSibling;if(n){if(!this.isElement(n))return null;const i=this.mapDomToView(n);if(i){const r=i.nextSibling;return r instanceof pe?r:null}}else{const i=this.mapDomToView(e.parentNode);if(i){const r=i.getChild(0);return r instanceof pe?r: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:n,scrollY:i}=oe.window,r=[];Hd(t,s=>{const{scrollLeft:a,scrollTop:l}=s;r.push([a,l])}),t.focus(),Hd(t,s=>{const[a,l]=r.shift();s.scrollLeft=a,s.scrollTop=l}),oe.window.scrollTo(n,i)}}isElement(e){return e&&e.nodeType==Node.ELEMENT_NODE}isDocumentFragment(e){return e&&e.nodeType==Node.DOCUMENT_FRAGMENT_NODE}isBlockFiller(e){return this.blockFillerMode=="br"?e.isEqualNode(Ev):!(e.tagName!=="BR"||!qd(e,this.blockElements)||e.parentNode.childNodes.length!==1)||e.isEqualNode(Sv)||function(t,n){return t.isEqualNode(xv)&&qd(t,n)&&t.parentNode.childNodes.length===1}(e,this.blockElements)}isDomSelectionBackward(e){if(e.isCollapsed)return!1;const t=this._domDocument.createRange();try{t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset)}catch{return!1}const n=t.collapsed;return t.detach(),n}getHostViewElement(e){const t=pc(e);for(t.pop();t.length;){const n=t.pop(),i=this._domToViewMapping.get(n);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(){switch(this.blockFillerMode){case"nbsp":return Od(this._domDocument);case"markedNbsp":return Nd(this._domDocument);case"br":return zd(this._domDocument)}}_isDomSelectionPositionCorrect(e,t){if(Ie(e)&&tt(e)&&t<At||this.isElement(e)&&tt(e.childNodes[t]))return!1;const n=this.mapDomToView(e);return!n||!n.is("uiElement")&&!n.is("rawElement")}_processDataFromViewText(e){let t=e.data;if(e.getAncestors().some(n=>this.preElements.includes(n.name)))return t;if(t.charAt(0)==" "){const n=this._getTouchingInlineViewNode(e,!1);!(n&&n.is("$textProxy")&&this._nodeEndsWithSpace(n))&&n||(t=" "+t.substr(1))}if(t.charAt(t.length-1)==" "){const n=this._getTouchingInlineViewNode(e,!0),i=n&&n.is("$textProxy")&&n.data.charAt(0)==" ";t.charAt(t.length-2)!=" "&&n&&!i||(t=t.substr(0,t.length-1)+" ")}return t.replace(/ {2}/g," ")}_nodeEndsWithSpace(e){if(e.getAncestors().some(n=>this.preElements.includes(n.name)))return!1;const t=this._processDataFromViewText(e);return t.charAt(t.length-1)==" "}_processDataFromDomText(e){let t=e.data;if(function(c,d){return pc(c).some(g=>g.tagName&&d.includes(g.tagName.toLowerCase()))}(e,this.preElements))return Md(e);t=t.replace(/[ \n\t\r]{1,}/g," ");const n=this._getTouchingInlineDomNode(e,!1),i=this._getTouchingInlineDomNode(e,!0),r=this._checkShouldLeftTrimDomText(e,n),s=this._checkShouldRightTrimDomText(e,i);r&&(t=t.replace(/^ /,"")),s&&(t=t.replace(/ $/,"")),t=Md(new Text(t)),t=t.replace(/ \u00A0/g," ");const a=i&&this.isElement(i)&&i.tagName!="BR",l=i&&Ie(i)&&i.data.charAt(0)==" ";return(/( |\u00A0)\u00A0$/.test(t)||!i||a||l)&&(t=t.replace(/\u00A0$/," ")),(r||n&&this.isElement(n)&&n.tagName!="BR")&&(t=t.replace(/^\u00A0/," ")),t}_checkShouldLeftTrimDomText(e,t){return!t||(this.isElement(t)?t.tagName==="BR":!this._encounteredRawContentDomNodes.has(e.previousSibling)&&/[^\S\u00A0]/.test(t.data.charAt(t.data.length-1)))}_checkShouldRightTrimDomText(e,t){return!t&&!tt(e)}_getTouchingInlineViewNode(e,t){const n=new ln({startPosition:t?U._createAfter(e):U._createBefore(e),direction:t?"forward":"backward"});for(const i of n){if(i.item.is("element")&&this.inlineObjectElements.includes(i.item.name))return i.item;if(i.item.is("containerElement")||i.item.is("element","br"))return null;if(i.item.is("$textProxy"))return i.item}return null}_getTouchingInlineDomNode(e,t){if(!e.parentNode)return null;const n=t?"firstChild":"lastChild",i=t?"nextSibling":"previousSibling";let r=!0,s=e;do if(!r&&s[n]?s=s[n]:s[i]?(s=s[i],r=!1):(s=s.parentNode,r=!0),!s||this._isBlockElement(s))return null;while(!Ie(s)&&s.tagName!="BR"&&!this._isInlineObjectElement(s));return s}_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(On(e))return new bi(this.document,"$comment");const n=t.keepOriginalCase?e.tagName:e.tagName.toLowerCase();return new et(this.document,n)}_isViewElementWithRawContent(e,t){return t.withChildren!==!1&&!!this._rawContentElementMatcher.match(e)}_shouldRenameElement(e){const t=e.toLowerCase();return this.renderingMode==="editing"&&this.unsafeElements.includes(t)}_createReplacementDomElement(e,t){const n=this._domDocument.createElement("span");if(n.setAttribute(jd,e),t){for(;t.firstChild;)n.appendChild(t.firstChild);for(const i of t.getAttributeNames())n.setAttribute(i,t.getAttribute(i))}return n}}function Hd(o,e){let t=o;for(;t;)e(t),t=t.parentElement}function qd(o,e){const t=o.parentNode;return!!t&&!!t.tagName&&e.includes(t.tagName.toLowerCase())}function Ud(o){o==="script"&&Q("domconverter-unsafe-script-element-detected"),o==="style"&&Q("domconverter-unsafe-style-element-detected")}class _t extends jt(){constructor(e){super(),this._isEnabled=!1,this.view=e,this.document=e.document}get isEnabled(){return this._isEnabled}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}destroy(){this.disable(),this.stopListening()}checkShouldIgnoreEventFromTarget(e){return e&&e.nodeType===3&&(e=e.parentNode),!(!e||e.nodeType!==1)&&e.matches("[data-cke-ignore-events], [data-cke-ignore-events] *")}}const Wd=as(function(o,e){Tn(e,Pn(e),o)});class Ln{constructor(e,t,n){this.view=e,this.document=e.document,this.domEvent=t,this.domTarget=t.target,Wd(this,n)}get target(){return this.view.domConverter.mapDomToView(this.domTarget)}preventDefault(){this.domEvent.preventDefault()}stopPropagation(){this.domEvent.stopPropagation()}}class $t extends _t{constructor(){super(...arguments),this.useCapture=!1}observe(e){(typeof this.domEventType=="string"?[this.domEventType]:this.domEventType).forEach(t=>{this.listenTo(e,t,(n,i)=>{this.isEnabled&&!this.checkShouldIgnoreEventFromTarget(i.target)&&this.onDomEvent(i)},{useCapture:this.useCapture})})}stopObserving(e){this.stopListening(e)}fire(e,t,n){this.isEnabled&&this.document.fire(e,new Ln(this.view,t,n))}}class Dv extends $t{constructor(){super(...arguments),this.domEventType=["keydown","keyup"]}onDomEvent(e){const t={keyCode:e.keyCode,altKey:e.altKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,metaKey:e.metaKey,get keystroke(){return Nn(this)}};this.fire(e.type,e,t)}}const As=function(){return ct.Date.now()};var Bv=/\s/;const Tv=function(o){for(var e=o.length;e--&&Bv.test(o.charAt(e)););return e};var Iv=/^\s+/;const Pv=function(o){return o&&o.slice(0,Tv(o)+1).replace(Iv,"")};var Rv=/^[-+]0x[0-9a-f]+$/i,Ov=/^0b[01]+$/i,Nv=/^0o[0-7]+$/i,zv=parseInt;const Kd=function(o){if(typeof o=="number")return o;if(gi(o))return NaN;if(xe(o)){var e=typeof o.valueOf=="function"?o.valueOf():o;o=xe(e)?e+"":e}if(typeof o!="string")return o===0?o:+o;o=Pv(o);var t=Ov.test(o);return t||Nv.test(o)?zv(o.slice(2),t?2:8):Rv.test(o)?NaN:+o};var Mv=Math.max,Fv=Math.min;const vo=function(o,e,t){var n,i,r,s,a,l,c=0,d=!1,u=!1,g=!0;if(typeof o!="function")throw new TypeError("Expected a function");function f(z){var j=n,Y=i;return n=i=void 0,c=z,s=o.apply(Y,j)}function b(z){var j=z-l;return l===void 0||j>=e||j<0||u&&z-c>=r}function A(){var z=As();if(b(z))return E(z);a=setTimeout(A,function(j){var Y=e-(j-l);return u?Fv(Y,r-(j-c)):Y}(z))}function E(z){return a=void 0,g&&n?f(z):(n=i=void 0,s)}function P(){var z=As(),j=b(z);if(n=arguments,i=this,l=z,j){if(a===void 0)return function(Y){return c=Y,a=setTimeout(A,e),d?f(Y):s}(l);if(u)return clearTimeout(a),a=setTimeout(A,e),f(l)}return a===void 0&&(a=setTimeout(A,e)),s}return e=Kd(e)||0,xe(t)&&(d=!!t.leading,r=(u="maxWait"in t)?Mv(Kd(t.maxWait)||0,e):r,g="trailing"in t?!!t.trailing:g),P.cancel=function(){a!==void 0&&clearTimeout(a),c=0,n=l=i=a=void 0},P.flush=function(){return a===void 0?s:E(As())},P};class Vv extends _t{constructor(e){super(e),this._fireSelectionChangeDoneDebounced=vo(t=>{this.document.fire("selectionChangeDone",t)},200)}observe(){const e=this.document;e.on("arrowKey",(t,n)=>{e.selection.isFake&&this.isEnabled&&n.preventDefault()},{context:"$capture"}),e.on("arrowKey",(t,n)=>{e.selection.isFake&&this.isEnabled&&this._handleSelectionMove(n.keyCode)},{priority:"lowest"})}stopObserving(){}destroy(){super.destroy(),this._fireSelectionChangeDoneDebounced.cancel()}_handleSelectionMove(e){const t=this.document.selection,n=new wt(t.getRanges(),{backward:t.isBackward,fake:!1});e!=se.arrowleft&&e!=se.arrowup||n.setTo(n.getFirstPosition()),e!=se.arrowright&&e!=se.arrowdown||n.setTo(n.getLastPosition());const i={oldSelection:t,newSelection:n,domSelection:null};this.document.fire("selectionChange",i),this._fireSelectionChangeDoneDebounced(i)}}const Lv=function(o){return this.__data__.set(o,"__lodash_hash_undefined__"),this},jv=function(o){return this.__data__.has(o)};function _i(o){var e=-1,t=o==null?0:o.length;for(this.__data__=new Xo;++e<t;)this.add(o[e])}_i.prototype.add=_i.prototype.push=Lv,_i.prototype.has=jv;const $v=_i,Hv=function(o,e){for(var t=-1,n=o==null?0:o.length;++t<n;)if(e(o[t],t,o))return!0;return!1},qv=function(o,e){return o.has(e)},Gd=function(o,e,t,n,i,r){var s=1&t,a=o.length,l=e.length;if(a!=l&&!(s&&l>a))return!1;var c=r.get(o),d=r.get(e);if(c&&d)return c==e&&d==o;var u=-1,g=!0,f=2&t?new $v:void 0;for(r.set(o,e),r.set(e,o);++u<a;){var b=o[u],A=e[u];if(n)var E=s?n(A,b,u,e,o,r):n(b,A,u,o,e,r);if(E!==void 0){if(E)continue;g=!1;break}if(f){if(!Hv(e,function(P,z){if(!qv(f,z)&&(b===P||i(b,P,t,n,r)))return f.push(z)})){g=!1;break}}else if(b!==A&&!i(b,A,t,n,r)){g=!1;break}}return r.delete(o),r.delete(e),g},Uv=function(o){var e=-1,t=Array(o.size);return o.forEach(function(n,i){t[++e]=[i,n]}),t},Wv=function(o){var e=-1,t=Array(o.size);return o.forEach(function(n){t[++e]=n}),t};var Zd=ft?ft.prototype:void 0,_s=Zd?Zd.valueOf:void 0;const Kv=function(o,e,t,n,i,r,s){switch(t){case"[object DataView]":if(o.byteLength!=e.byteLength||o.byteOffset!=e.byteOffset)return!1;o=o.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(o.byteLength!=e.byteLength||!r(new ni(o),new ni(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return lo(+o,+e);case"[object Error]":return o.name==e.name&&o.message==e.message;case"[object RegExp]":case"[object String]":return o==e+"";case"[object Map]":var a=Uv;case"[object Set]":var l=1&n;if(a||(a=Wv),o.size!=e.size&&!l)return!1;var c=s.get(o);if(c)return c==e;n|=2,s.set(o,e);var d=Gd(a(o),a(e),n,i,r,s);return s.delete(o),d;case"[object Symbol]":if(_s)return _s.call(o)==_s.call(e)}return!1};var Gv=Object.prototype.hasOwnProperty;const Zv=function(o,e,t,n,i,r){var s=1&t,a=Pr(o),l=a.length;if(l!=Pr(e).length&&!s)return!1;for(var c=l;c--;){var d=a[c];if(!(s?d in e:Gv.call(e,d)))return!1}var u=r.get(o),g=r.get(e);if(u&&g)return u==e&&g==o;var f=!0;r.set(o,e),r.set(e,o);for(var b=s;++c<l;){var A=o[d=a[c]],E=e[d];if(n)var P=s?n(E,A,d,e,o,r):n(A,E,d,o,e,r);if(!(P===void 0?A===E||i(A,E,t,n,r):P)){f=!1;break}b||(b=d=="constructor")}if(f&&!b){var z=o.constructor,j=e.constructor;z==j||!("constructor"in o)||!("constructor"in e)||typeof z=="function"&&z instanceof z&&typeof j=="function"&&j instanceof j||(f=!1)}return r.delete(o),r.delete(e),f};var Jd="[object Arguments]",Yd="[object Array]",Ci="[object Object]",Qd=Object.prototype.hasOwnProperty;const Jv=function(o,e,t,n,i,r){var s=We(o),a=We(e),l=s?Yd:po(o),c=a?Yd:po(e),d=(l=l==Jd?Ci:l)==Ci,u=(c=c==Jd?Ci:c)==Ci,g=l==c;if(g&&mo(o)){if(!mo(e))return!1;s=!0,d=!1}if(g&&!d)return r||(r=new uo),s||Sr(o)?Gd(o,e,t,n,i,r):Kv(o,e,l,t,n,i,r);if(!(1&t)){var f=d&&Qd.call(o,"__wrapped__"),b=u&&Qd.call(e,"__wrapped__");if(f||b){var A=f?o.value():o,E=b?e.value():e;return r||(r=new uo),i(A,E,t,n,r)}}return!!g&&(r||(r=new uo),Zv(o,e,t,n,i,r))},Xd=function o(e,t,n,i,r){return e===t||(e==null||t==null||!rt(e)&&!rt(t)?e!=e&&t!=t:Jv(e,t,n,i,o,r))},Yv=function(o,e,t){var n=(t=typeof t=="function"?t:void 0)?t(o,e):void 0;return n===void 0?Xd(o,e,void 0,t):!!n};class eh extends _t{constructor(e){super(e),this._config={childList:!0,characterData:!0,subtree:!0},this.domConverter=e.domConverter,this.renderer=e._renderer,this._domElements=new Set,this._mutationObserver=new window.MutationObserver(this._onMutations.bind(this))}flush(){this._onMutations(this._mutationObserver.takeRecords())}observe(e){this._domElements.add(e),this.isEnabled&&this._mutationObserver.observe(e,this._config)}stopObserving(e){if(this._domElements.delete(e),this.isEnabled){this._mutationObserver.disconnect();for(const t of this._domElements)this._mutationObserver.observe(t,this._config)}}enable(){super.enable();for(const e of this._domElements)this._mutationObserver.observe(e,this._config)}disable(){super.disable(),this._mutationObserver.disconnect()}destroy(){super.destroy(),this._mutationObserver.disconnect()}_onMutations(e){if(e.length===0)return;const t=this.domConverter,n=new Set,i=new Set;for(const s of e){const a=t.mapDomToView(s.target);a&&(a.is("uiElement")||a.is("rawElement")||s.type!=="childList"||this._isBogusBrMutation(s)||i.add(a))}for(const s of e){const a=t.mapDomToView(s.target);if((!a||!a.is("uiElement")&&!a.is("rawElement"))&&s.type==="characterData"){const l=t.findCorrespondingViewText(s.target);l&&!i.has(l.parent)?n.add(l):!l&&tt(s.target)&&i.add(t.mapDomToView(s.target.parentNode))}}let r=!1;for(const s of n)r=!0,this.renderer.markToSync("text",s);for(const s of i){const a=t.mapViewToDom(s),l=Array.from(s.getChildren()),c=Array.from(t.domChildrenToView(a,{withChildren:!1}));Yv(l,c,Qv)||(r=!0,this.renderer.markToSync("children",s))}r&&this.view.forceRender()}_isBogusBrMutation(e){let t=null;return e.nextSibling===null&&e.removedNodes.length===0&&e.addedNodes.length==1&&(t=this.domConverter.domToView(e.addedNodes[0],{withChildren:!1})),t&&t.is("element","br")}}function Qv(o,e){if(!Array.isArray(o))return o===e||!(!o.is("$text")||!e.is("$text"))&&o.data===e.data}class Cs extends $t{constructor(e){super(e),this._isFocusChanging=!1,this.domEventType=["focus","blur"],this.useCapture=!0;const t=this.document;t.on("focus",()=>{this._isFocusChanging=!0,this._renderTimeoutId=setTimeout(()=>{this.flush(),e.change(()=>{})},50)}),t.on("blur",(n,i)=>{const r=t.selection.editableElement;r!==null&&r!==i.target||(t.isFocused=!1,this._isFocusChanging=!1,e.change(()=>{}))})}flush(){this._isFocusChanging&&(this._isFocusChanging=!1,this.document.isFocused=!0)}onDomEvent(e){this.fire(e.type,e)}destroy(){this._renderTimeoutId&&clearTimeout(this._renderTimeoutId),super.destroy()}}class Xv extends _t{constructor(e){super(e),this.mutationObserver=e.getObserver(eh),this.focusObserver=e.getObserver(Cs),this.selection=this.document.selection,this.domConverter=e.domConverter,this._documents=new WeakSet,this._fireSelectionChangeDoneDebounced=vo(t=>{this.document.fire("selectionChangeDone",t)},200),this._clearInfiniteLoopInterval=setInterval(()=>this._clearInfiniteLoop(),1e3),this._documentIsSelectingInactivityTimeoutDebounced=vo(()=>this.document.isSelecting=!1,5e3),this._loopbackCounter=0}observe(e){const t=e.ownerDocument,n=()=>{this.document.isSelecting&&(this._handleSelectionChange(null,t),this.document.isSelecting=!1,this._documentIsSelectingInactivityTimeoutDebounced.cancel())};this.listenTo(e,"selectstart",()=>{this.document.isSelecting=!0,this._documentIsSelectingInactivityTimeoutDebounced()},{priority:"highest"}),this.listenTo(e,"keydown",n,{priority:"highest",useCapture:!0}),this.listenTo(e,"keyup",n,{priority:"highest",useCapture:!0}),this._documents.has(t)||(this.listenTo(t,"mouseup",n,{priority:"highest",useCapture:!0}),this.listenTo(t,"selectionchange",(i,r)=>{this.document.isComposing&&!k.isAndroid||(this._handleSelectionChange(r,t),this._documentIsSelectingInactivityTimeoutDebounced())}),this._documents.add(t))}stopObserving(e){this.stopListening(e)}destroy(){super.destroy(),clearInterval(this._clearInfiniteLoopInterval),this._fireSelectionChangeDoneDebounced.cancel(),this._documentIsSelectingInactivityTimeoutDebounced.cancel()}_reportInfiniteLoop(){}_handleSelectionChange(e,t){if(!this.isEnabled)return;const n=t.defaultView.getSelection();if(this.checkShouldIgnoreEventFromTarget(n.anchorNode))return;this.mutationObserver.flush();const i=this.domConverter.domSelectionToView(n);if(i.rangeCount!=0){if(this.view.hasDomSelection=!0,!this.selection.isEqual(i)||!this.domConverter.isDomSelectionCorrect(n))if(++this._loopbackCounter>60)this._reportInfiniteLoop();else if(this.focusObserver.flush(),this.selection.isSimilar(i))this.view.forceRender();else{const r={oldSelection:this.selection,newSelection:i,domSelection:n};this.document.fire("selectionChange",r),this._fireSelectionChangeDoneDebounced(r)}}else this.view.hasDomSelection=!1}_clearInfiniteLoop(){this._loopbackCounter=0}}class ey extends $t{constructor(e){super(e),this.domEventType=["compositionstart","compositionupdate","compositionend"];const t=this.document;t.on("compositionstart",()=>{t.isComposing=!0},{priority:"low"}),t.on("compositionend",()=>{t.isComposing=!1},{priority:"low"})}onDomEvent(e){this.fire(e.type,e,{data:e.data})}}class th{constructor(e,t={}){this._files=t.cacheFiles?nh(e):null,this._native=e}get files(){return this._files||(this._files=nh(this._native)),this._files}get types(){return this._native.types}getData(e){return this._native.getData(e)}setData(e,t){this._native.setData(e,t)}set effectAllowed(e){this._native.effectAllowed=e}get effectAllowed(){return this._native.effectAllowed}set dropEffect(e){this._native.dropEffect=e}get dropEffect(){return this._native.dropEffect}setDragImage(e,t,n){this._native.setDragImage(e,t,n)}get isCanceled(){return this._native.dropEffect=="none"||!!this._native.mozUserCancelled}}function nh(o){const e=Array.from(o.files||[]),t=Array.from(o.items||[]);return e.length?e:t.filter(n=>n.kind==="file").map(n=>n.getAsFile())}class ty extends $t{constructor(){super(...arguments),this.domEventType="beforeinput"}onDomEvent(e){const t=e.getTargetRanges(),n=this.view,i=n.document;let r=null,s=null,a=[];if(e.dataTransfer&&(r=new th(e.dataTransfer)),e.data!==null?s=e.data:r&&(s=r.getData("text/plain")),i.selection.isFake)a=Array.from(i.selection.getRanges());else if(t.length)a=t.map(l=>n.domConverter.domRangeToView(l));else if(k.isAndroid){const l=e.target.ownerDocument.defaultView.getSelection();a=Array.from(n.domConverter.domSelectionToView(l).getRanges())}if(k.isAndroid&&e.inputType=="insertCompositionText"&&s&&s.endsWith(`
|
|
6519
6519
|
`))this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:[n.createRange(a[0].end)]});else if(e.inputType=="insertText"&&s&&s.includes(`
|
|
6520
|
-
`)){const l=s.split(/\n{1,2}/g);let c=a;for(let d=0;d<l.length;d++){const u=l[d];u!=""&&(this.fire(e.type,e,{data:u,dataTransfer:r,targetRanges:c,inputType:e.inputType,isComposing:e.isComposing}),c=[i.selection.getFirstRange()]),d+1<l.length&&(this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:c}),c=[i.selection.getFirstRange()])}}else this.fire(e.type,e,{data:s,dataTransfer:r,targetRanges:a,inputType:e.inputType,isComposing:e.isComposing})}}class ly extends Ct{constructor(e){super(e),this.document.on("keydown",(t,n)=>{if(this.isEnabled&&((i=n.keyCode)==se.arrowright||i==se.arrowleft||i==se.arrowup||i==se.arrowdown)){const r=new Fn(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(r,n),r.stop.called&&t.stop()}var i})}observe(){}stopObserving(){}}class cy extends Ct{constructor(e){super(e);const t=this.document;t.on("keydown",(n,i)=>{if(!this.isEnabled||i.keyCode!=se.tab||i.ctrlKey)return;const r=new Fn(t,"tab",t.selection.getFirstRange());t.fire(r,i),r.stop.called&&n.stop()})}observe(){}stopObserving(){}}class dy extends ge(){constructor(e){super(),this.domRoots=new Map,this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this.document=new Dd(e),this.domConverter=new $d(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new Sv(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new Bd(this.document),this.addObserver(eh),this.addObserver(Cs),this.addObserver(ry),this.addObserver(Ov),this.addObserver(Uv),this.addObserver(sy),this.addObserver(ly),this.addObserver(ay),this.addObserver(cy),this.document.on("arrowKey",Ev,{priority:"low"}),Av(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 n=this.document.getRoot(t);n._name=e.tagName.toLowerCase();const i={};for(const{name:s,value:a}of Array.from(e.attributes))i[s]=a,s==="class"?this._writer.addClass(a.split(" "),n):this._writer.setAttribute(s,a,n);this._initialDomRootAttributes.set(e,i);const r=()=>{this._writer.setAttribute("contenteditable",(!n.isReadOnly).toString(),n),n.isReadOnly?this._writer.addClass("ck-read-only",n):this._writer.removeClass("ck-read-only",n)};r(),this.domRoots.set(t,e),this.domConverter.bindElements(e,n),this._renderer.markToSync("children",n),this._renderer.markToSync("attributes",n),this._renderer.domDocuments.add(e.ownerDocument),n.on("change:children",(s,a)=>this._renderer.markToSync("children",a)),n.on("change:attributes",(s,a)=>this._renderer.markToSync("attributes",a)),n.on("change:text",(s,a)=>this._renderer.markToSync("text",a)),n.on("change:isReadOnly",()=>this.change(r)),n.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const s of this._observers.values())s.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:i})=>t.removeAttribute(i));const n=this._initialDomRootAttributes.get(t);for(const i in n)t.setAttribute(i,n[i]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t);for(const i of this._observers.values())i.stopObserving(t)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let t=this._observers.get(e);if(t)return t;t=new e(this),this._observers.set(e,t);for(const[n,i]of this.domRoots)t.observe(i,n);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(const e of this._observers.values())e.disable()}enableObservers(){for(const e of this._observers.values())e.enable()}scrollToTheSelection({alignToTop:e,forceScroll:t,viewportOffset:n=20,ancestorOffset:i=20}={}){const r=this.document.selection.getFirstRange();r&&function({target:s,viewportOffset:a=0,ancestorOffset:l=0,alignToTop:c,forceScroll:d}){const u=Hr(s);let g=u,f=null;for(;g;){let b;b=hC(g==u?s:f),dC({parent:b,getRect:()=>Tc(s,g),alignToTop:c,ancestorOffset:l,forceScroll:d});const A=Tc(s,g);if(cC({window:g,rect:A,viewportOffset:a,alignToTop:c,forceScroll:d}),g.parent!=g){if(f=g.frameElement,g=g.parent,!f)return}else g=null}}({target:this.domConverter.viewRangeToDom(r),viewportOffset:n,ancestorOffset:i,alignToTop:e,forceScroll:t})}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 I("cannot-change-view-tree",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;const t=e(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),t}catch(t){I.rethrowUnexpectedError(t,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.getObserver(Cs).flush(),this.change(()=>{})}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return U._createAt(e,t)}createPositionAfter(e){return U._createAfter(e)}createPositionBefore(e){return U._createBefore(e)}createRange(e,t){return new X(e,t)}createRangeOn(e){return X._createOn(e)}createRangeIn(e){return X._createIn(e)}createSelection(...e){return new At(...e)}_disableRendering(e){this._renderingDisabled=e,e==0&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}class Ht{is(){throw new Error("is() method is abstract")}}class hn extends Ht{constructor(e){super(),this.parent=null,this._attrs=Dt(e)}get document(){return null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))===null)throw new I("model-node-not-found-in-parent",this);return e}get startOffset(){let e;if(!this.parent)return null;if((e=this.parent.getChildStartOffset(this))===null)throw new I("model-node-not-found-in-parent",this);return e}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.parent!==null&&this.root.isAttached()}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}getCommonAncestor(e,t={}){const n=this.getAncestors(t),i=e.getAncestors(t);let r=0;for(;n[r]==i[r]&&n[r];)r++;return r===0?null:n[r-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const t=this.getPath(),n=e.getPath(),i=Ue(t,n);switch(i){case"prefix":return!0;case"extension":return!1;default:return t[i]<n[i]}}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((t,n)=>(t[n[0]]=n[1],t),{})),e}_clone(e){return new this.constructor(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=Dt(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}hn.prototype.is=function(o){return o==="node"||o==="model:node"};class yo{constructor(e){this._nodes=[],e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce((e,t)=>e+t.offsetSize,0)}getNode(e){return this._nodes[e]||null}getNodeIndex(e){const t=this._nodes.indexOf(e);return t==-1?null:t}getNodeStartOffset(e){const t=this.getNodeIndex(e);return t===null?null:this._nodes.slice(0,t).reduce((n,i)=>n+i.offsetSize,0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new I("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const n of this._nodes){if(e>=t&&e<t+n.offsetSize)return this.getNodeIndex(n);t+=n.offsetSize}if(t!=e)throw new I("model-nodelist-offset-out-of-bounds",this,{offset:e,nodeList:this});return this.length}_insertNodes(e,t){for(const n of t)if(!(n instanceof hn))throw new I("model-nodelist-insertnodes-not-node",this);this._nodes=function(n,i,r,s){if(Math.max(i.length,n.length)>1e4)return n.slice(0,r).concat(i).concat(n.slice(r+s,n.length));{const a=Array.from(n);return a.splice(r,s,...i),a}}(this._nodes,Array.from(t),e,0)}_removeNodes(e,t=1){return this._nodes.splice(e,t)}toJSON(){return this._nodes.map(e=>e.toJSON())}}class fe extends hn{constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new fe(this.data,this.getAttributes())}static fromJSON(e){return new fe(e.data,e.attributes)}}fe.prototype.is=function(o){return o==="$text"||o==="model:$text"||o==="text"||o==="model:text"||o==="node"||o==="model:node"};class ut extends Ht{constructor(e,t,n){if(super(),this.textNode=e,t<0||t>e.offsetSize)throw new I("model-textproxy-wrong-offsetintext",this);if(n<0||t+n>e.offsetSize)throw new I("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+n),this.offsetInText=t}get startOffset(){return this.textNode.startOffset!==null?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return this.startOffset!==null?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.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()}}ut.prototype.is=function(o){return o==="$textProxy"||o==="model:$textProxy"||o==="textProxy"||o==="model:textProxy"};class ke extends hn{constructor(e,t,n){super(t),this._children=new yo,this.name=e,n&&this._insertChild(0,n)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return this.childCount===0}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(const n of e)t=t.getChild(t.offsetToIndex(n));return t}findAncestor(e,t={}){let n=t.includeSelf?this:this.parent;for(;n;){if(n.name===e)return n;n=n.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(n=>n._clone(!0)):void 0;return new ke(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const n=function(i){return typeof i=="string"?[new fe(i)]:(Xe(i)||(i=[i]),Array.from(i).map(r=>typeof r=="string"?new fe(r):r instanceof ut?new fe(r.data,r.getAttributes()):r))}(t);for(const i of n)i.parent!==null&&i._remove(),i.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){const n=this._children._removeNodes(e,t);for(const i of n)i.parent=null;return n}static fromJSON(e){let t;if(e.children){t=[];for(const n of e.children)n.name?t.push(ke.fromJSON(n)):t.push(fe.fromJSON(n))}return new ke(e.name,e.attributes,t)}}ke.prototype.is=function(o,e){return e?e===this.name&&(o==="element"||o==="model:element"):o==="element"||o==="model:element"||o==="node"||o==="model:node"};class vt{constructor(e){if(!e||!e.boundaries&&!e.startPosition)throw new I("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if(t!="forward"&&t!="backward")throw new I("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=H._createAt(this.boundaries[this.direction=="backward"?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,n,i,r;do i=this.position,r=this._visitedParent,{done:t,value:n}=this.next();while(!t&&e(n));t||(this._position=i,this._visitedParent=r)}next(){return this.direction=="forward"?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),n=this._visitedParent;if(n.parent===null&&t.offset===n.maxOffset)return{done:!0,value:void 0};if(n===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0,value:void 0};const i=Eo(t,n),r=i||oh(t,n,i);if(r instanceof ke)return this.shallow?t.offset++:(t.path.push(0),this._visitedParent=r),this._position=t,un("elementStart",r,e,t,1);if(r instanceof fe){let s;if(this.singleCharacters)s=1;else{let c=r.endOffset;this._boundaryEndParent==n&&this.boundaries.end.offset<c&&(c=this.boundaries.end.offset),s=c-t.offset}const a=t.offset-r.startOffset,l=new ut(r,a,s);return t.offset+=s,this._position=t,un("text",l,e,t,s)}return t.path.pop(),t.offset++,this._position=t,this._visitedParent=n.parent,this.ignoreElementEnd?this._next():un("elementEnd",n,e,t)}_previous(){const e=this.position,t=this.position.clone(),n=this._visitedParent;if(n.parent===null&&t.offset===0)return{done:!0,value:void 0};if(n==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0,value:void 0};const i=t.parent,r=Eo(t,i),s=r||ih(t,i,r);if(s instanceof ke)return t.offset--,this.shallow?(this._position=t,un("elementStart",s,e,t,1)):(t.path.push(s.maxOffset),this._position=t,this._visitedParent=s,this.ignoreElementEnd?this._previous():un("elementEnd",s,e,t));if(s instanceof fe){let a;if(this.singleCharacters)a=1;else{let d=s.startOffset;this._boundaryStartParent==n&&this.boundaries.start.offset>d&&(d=this.boundaries.start.offset),a=t.offset-d}const l=t.offset-s.startOffset,c=new ut(s,l-a,a);return t.offset-=a,this._position=t,un("text",c,e,t,a)}return t.path.pop(),this._position=t,this._visitedParent=n.parent,un("elementStart",n,e,t,1)}}function un(o,e,t,n,i){return{done:!1,value:{type:o,item:e,previousPosition:t,nextPosition:n,length:i}}}class H extends Ht{constructor(e,t,n="toNone"){if(super(),!e.is("element")&&!e.is("documentFragment"))throw new I("model-position-root-invalid",e);if(!(t instanceof Array)||t.length===0)throw new I("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=n}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 I("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new I("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return Eo(this,this.parent)}get nodeAfter(){const e=this.parent;return oh(this,e,Eo(this,e))}get nodeBefore(){const e=this.parent;return ih(this,e,Eo(this,e))}get isAtStart(){return this.offset===0}get isAtEnd(){return this.offset==this.parent.maxOffset}compareWith(e){if(this.root!=e.root)return"different";const t=Ue(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 n=new vt(t);return n.skip(e),n.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=Ue(this.path,e.path),n=typeof t=="string"?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,n)}getCommonAncestor(e){const t=this.getAncestors(),n=e.getAncestors();let i=0;for(;t[i]==n[i]&&t[i];)i++;return i===0?null:t[i-1]}getShiftedBy(e){const t=this.clone(),n=t.offset+e;return t.offset=n<0?0:n,t}isAfter(e){return this.compareWith(e)=="after"}isBefore(e){return this.compareWith(e)=="before"}isEqual(e){return this.compareWith(e)=="same"}isTouching(e){if(this.root!==e.root)return!1;const t=Math.min(this.path.length,e.path.length);for(let n=0;n<t;n++){const i=this.path[n]-e.path[n];if(i<-1||i>1)return!1;if(i===1)return rh(e,this,n);if(i===-1)return rh(this,e,n)}return this.path.length===e.path.length||(this.path.length>e.path.length?vs(this.path,t):vs(e.path,t))}hasSameParentAs(e){return this.root!==e.root?!1:Ue(this.getParentPath(),e.getParentPath())=="same"}getTransformedByOperation(e){let t;switch(e.type){case"insert":t=this._getTransformedByInsertOperation(e);break;case"move":case"remove":case"reinsert":t=this._getTransformedByMoveOperation(e);break;case"split":t=this._getTransformedBySplitOperation(e);break;case"merge":t=this._getTransformedByMergeOperation(e);break;default:t=H._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)&&this.stickiness=="toNext"?this._getCombined(e.splitPosition,e.moveTargetPosition):e.graveyardPosition?this._getTransformedByMove(e.graveyardPosition,e.insertionPosition,1):this._getTransformedByInsertion(e.insertionPosition,1)}_getTransformedByMergeOperation(e){const t=e.movedRange;let n;return t.containsPosition(this)||t.start.isEqual(this)?(n=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(n=n._getTransformedByDeletion(e.deletionPosition,1))):n=this.isEqual(e.deletionPosition)?H._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),n}_getTransformedByDeletion(e,t){const n=H._createAt(this);if(this.root!=e.root)return n;if(Ue(e.getParentPath(),this.getParentPath())=="same"){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;n.offset-=t}}else if(Ue(e.getParentPath(),this.getParentPath())=="prefix"){const i=e.path.length-1;if(e.offset<=this.path[i]){if(e.offset+t>this.path[i])return null;n.path[i]-=t}}return n}_getTransformedByInsertion(e,t){const n=H._createAt(this);if(this.root!=e.root)return n;if(Ue(e.getParentPath(),this.getParentPath())=="same")(e.offset<this.offset||e.offset==this.offset&&this.stickiness!="toPrevious")&&(n.offset+=t);else if(Ue(e.getParentPath(),this.getParentPath())=="prefix"){const i=e.path.length-1;e.offset<=this.path[i]&&(n.path[i]+=t)}return n}_getTransformedByMove(e,t,n){if(t=t._getTransformedByDeletion(e,n),e.isEqual(t))return H._createAt(this);const i=this._getTransformedByDeletion(e,n);return i===null||e.isEqual(this)&&this.stickiness=="toNext"||e.getShiftedBy(n).isEqual(this)&&this.stickiness=="toPrevious"?this._getCombined(e,t):i._getTransformedByInsertion(t,n)}_getCombined(e,t){const n=e.path.length-1,i=H._createAt(t);return i.stickiness=this.stickiness,i.offset=i.offset+this.path[n]-e.offset,i.path=[...i.path,...this.path.slice(n+1)],i}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,n="toNone"){if(e instanceof H)return new H(e.root,e.path,e.stickiness);{const i=e;if(t=="end")t=i.maxOffset;else{if(t=="before")return this._createBefore(i,n);if(t=="after")return this._createAfter(i,n);if(t!==0&&!t)throw new I("model-createpositionat-offset-required",[this,e])}if(!i.is("element")&&!i.is("documentFragment"))throw new I("model-position-parent-incorrect",[this,e]);const r=i.getPath();return r.push(t),new this(i.root,r,n)}}static _createAfter(e,t){if(!e.parent)throw new I("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 I("model-position-before-root",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if(e.root==="$graveyard"){const n=new H(t.graveyard,e.path);return n.stickiness=e.stickiness,n}if(!t.getRoot(e.root))throw new I("model-position-fromjson-no-root",t,{rootName:e.root});return new H(t.getRoot(e.root),e.path,e.stickiness)}}function Eo(o,e){const t=e.getChild(e.offsetToIndex(o.offset));return t&&t.is("$text")&&t.startOffset<o.offset?t:null}function oh(o,e,t){return t!==null?null:e.getChild(e.offsetToIndex(o.offset))}function ih(o,e,t){return t!==null?null:e.getChild(e.offsetToIndex(o.offset)-1)}function rh(o,e,t){return t+1!==o.path.length&&!!vs(e.path,t+1)&&!!function(n,i){let r=n.parent,s=n.path.length-1,a=0;for(;s>=i;){if(n.path[s]+a!==r.maxOffset)return!1;a=1,s--,r=r.parent}return!0}(o,t+1)}function vs(o,e){for(;e<o.length;){if(o[e]!==0)return!1;e++}return!0}H.prototype.is=function(o){return o==="position"||o==="model:position"};class V extends Ht{constructor(e,t){super(),this.start=H._createAt(e),this.end=t?H._createAt(t):H._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new vt({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return Ue(this.start.getParentPath(),this.end.getParentPath())=="same"}get root(){return this.start.root}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const n=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),i=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return n&&i}containsItem(e){const t=H._createBefore(e);return this.containsPosition(t)||this.start.isEqual(t)}isEqual(e){return this.start.isEqual(e.start)&&this.end.isEqual(e.end)}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new V(this.start,e.start)),this.containsPosition(e.end)&&t.push(new V(e.end,this.end))):t.push(new V(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,n=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(n=e.end),new V(t,n)}return null}getJoined(e,t=!1){let n=this.isIntersecting(e);if(n||(n=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)),!n)return null;let i=this.start,r=this.end;return e.start.isBefore(i)&&(i=e.start),e.end.isAfter(r)&&(r=e.end),new V(i,r)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,n=H._createAt(this.start);let i=n.parent;for(;n.path.length>t+1;){const r=i.maxOffset-n.offset;r!==0&&e.push(new V(n,n.getShiftedBy(r))),n.path=n.path.slice(0,-1),n.offset++,i=i.parent}for(;n.path.length<=this.end.path.length;){const r=this.end.path[n.path.length-1],s=r-n.offset;s!==0&&e.push(new V(n,n.getShiftedBy(s))),n.offset=r,n.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new vt(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new vt(e);for(const n of t)yield n.item}*getPositions(e={}){e.boundaries=this;const t=new vt(e);yield t.position;for(const n of t)yield n.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 V(this.start,this.end)]}getTransformedByOperations(e){const t=[new V(this.start,this.end)];for(const n of e)for(let i=0;i<t.length;i++){const r=t[i].getTransformedByOperation(n);t.splice(i,1,...r),i+=r.length-1}for(let n=0;n<t.length;n++){const i=t[n];for(let r=n+1;r<t.length;r++){const s=t[r];(i.containsRange(s)||s.containsRange(i)||i.isEqual(s))&&t.splice(r,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 n=e.sourcePosition,i=e.howMany,r=e.targetPosition;return this._getTransformedByMove(n,r,i,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let n=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(n=this.end.getShiftedBy(1)),t.root!=n.root&&(n=this.end.getShiftedBy(-1)),new V(t,n)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new V(this.start);let t=this.start._getTransformedByMergeOperation(e),n=this.end._getTransformedByMergeOperation(e);return t.root!=n.root&&(n=this.end.getShiftedBy(-1)),t.isAfter(n)?(e.sourcePosition.isBefore(e.targetPosition)?(t=H._createAt(n),t.offset=0):(e.deletionPosition.isEqual(t)||(n=e.deletionPosition),t=e.targetPosition),new V(t,n)):new V(t,n)}_getTransformedByInsertion(e,t,n=!1){if(n&&this.containsPosition(e))return[new V(this.start,e),new V(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const i=new V(this.start,this.end);return i.start=i.start._getTransformedByInsertion(e,t),i.end=i.end._getTransformedByInsertion(e,t),[i]}}_getTransformedByMove(e,t,n,i=!1){if(this.isCollapsed){const u=this.start._getTransformedByMove(e,t,n);return[new V(u)]}const r=V._createFromPositionAndShift(e,n),s=t._getTransformedByDeletion(e,n);if(this.containsPosition(t)&&!i&&(r.containsPosition(this.start)||r.containsPosition(this.end))){const u=this.start._getTransformedByMove(e,t,n),g=this.end._getTransformedByMove(e,t,n);return[new V(u,g)]}let a;const l=this.getDifference(r);let c=null;const d=this.getIntersection(r);if(l.length==1?c=new V(l[0].start._getTransformedByDeletion(e,n),l[0].end._getTransformedByDeletion(e,n)):l.length==2&&(c=new V(this.start,this.end._getTransformedByDeletion(e,n))),a=c?c._getTransformedByInsertion(s,n,d!==null||i):[],d){const u=new V(d.start._getCombined(r.start,s),d.end._getCombined(r.start,s));a.length==2?a.splice(1,0,u):a.push(u)}return a}_getTransformedByDeletion(e,t){let n=this.start._getTransformedByDeletion(e,t),i=this.end._getTransformedByDeletion(e,t);return n==null&&i==null?null:(n==null&&(n=e),i==null&&(i=e),new V(n,i))}static _createFromPositionAndShift(e,t){const n=e,i=e.getShiftedBy(t);return t>0?new this(n,i):new this(i,n)}static _createIn(e){return new this(H._createAt(e,0),H._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(H._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(e.length===0)throw new I("range-create-from-ranges-empty-array",null);if(e.length==1)return e[0].clone();const t=e[0];e.sort((r,s)=>r.start.isAfter(s.start)?1:-1);const n=e.indexOf(t),i=new this(t.start,t.end);if(n>0)for(let r=n-1;e[r].end.isEqual(i.start);r++)i.start=H._createAt(e[r].start);for(let r=n+1;r<e.length&&e[r].start.isEqual(i.end);r++)i.end=H._createAt(e[r].end);return i}static fromJSON(e,t){return new this(H.fromJSON(e.start,t),H.fromJSON(e.end,t))}}V.prototype.is=function(o){return o==="range"||o==="model:range"};class sh extends me(){constructor(){super(),this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._viewToModelLengthCallbacks=new Map,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._deferredBindingRemovals=new Map,this._unboundMarkerNames=new Set,this.on("modelToViewPosition",(e,t)=>{if(t.viewPosition)return;const n=this._modelToViewMapping.get(t.modelPosition.parent);if(!n)throw new I("mapping-model-position-view-parent-not-found",this,{modelPosition:t.modelPosition});t.viewPosition=this.findPositionIn(n,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const n=this.findMappedViewAncestor(t.viewPosition),i=this._viewToModelMapping.get(n),r=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,n);t.modelPosition=H._createAt(i,r)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e,t={}){const n=this.toModelElement(e);if(this._elementToMarkerNames.has(e))for(const i of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(i);t.defer?this._deferredBindingRemovals.set(e,e.root):(this._viewToModelMapping.delete(e),this._modelToViewMapping.get(n)==e&&this._modelToViewMapping.delete(n))}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const n=this._markerNameToElements.get(t)||new Set;n.add(e);const i=this._elementToMarkerNames.get(e)||new Set;i.add(t),this._markerNameToElements.set(t,n),this._elementToMarkerNames.set(e,i)}unbindElementFromMarkerName(e,t){const n=this._markerNameToElements.get(t);n&&(n.delete(e),n.size==0&&this._markerNameToElements.delete(t));const i=this._elementToMarkerNames.get(e);i&&(i.delete(t),i.size==0&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}flushDeferredBindings(){for(const[e,t]of this._deferredBindingRemovals)e.root==t&&this.unbindViewElement(e);this._deferredBindingRemovals=new Map}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this._deferredBindingRemovals=new Map}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new V(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new X(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={}){const n={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",n),n.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const n=new Set;for(const i of t)if(i.is("attributeElement"))for(const r of i.getElementsWithSameId())n.add(r);else n.add(i);return n}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,n){if(n!=e)return this._toModelOffset(e.parent,e.index,n)+this._toModelOffset(e,t,e);if(e.is("$text"))return t;let i=0;for(let r=0;r<t;r++)i+=this.getModelLength(e.getChild(r));return i}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 n of e.getChildren())t+=this.getModelLength(n);return t}}findPositionIn(e,t){let n,i=0,r=0,s=0;if(e.is("$text"))return new U(e,t);for(;r<t;)n=e.getChild(s),i=this.getModelLength(n),r+=i,s++;return r==t?this._moveViewPositionToTextNode(new U(e,s)):this.findPositionIn(n,t-(r-i))}_moveViewPositionToTextNode(e){const t=e.nodeBefore,n=e.nodeAfter;return t instanceof pe?new U(t,t.data.length):n instanceof pe?new U(n,0):e}}class hy{constructor(){this._consumable=new Map,this._textProxyRegistry=new Map}add(e,t){t=vi(t),e instanceof ut&&(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=vi(t),e instanceof ut&&(e=this._getSymbolForTextProxy(e)),!!this.test(e,t)&&(this._consumable.get(e).set(t,!1),!0)}test(e,t){t=vi(t),e instanceof ut&&(e=this._getSymbolForTextProxy(e));const n=this._consumable.get(e);if(n===void 0)return null;const i=n.get(t);return i===void 0?null:i}revert(e,t){t=vi(t),e instanceof ut&&(e=this._getSymbolForTextProxy(e));const n=this.test(e,t);return n===!1?(this._consumable.get(e).set(t,!0),!0):n!==!0&&null}verifyAllConsumed(e){const t=[];for(const[n,i]of this._consumable)for(const[r,s]of i){const a=r.split(":")[0];s&&e==a&&t.push({event:r,item:n.name||n.description})}if(t.length)throw new I("conversion-model-consumable-not-consumed",null,{items:t})}_getSymbolForTextProxy(e){let t=null;const n=this._textProxyRegistry.get(e.startOffset);if(n){const i=n.get(e.endOffset);i&&(t=i.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e)),t}_addSymbolForTextProxy(e){const t=e.startOffset,n=e.endOffset,i=e.parent,r=Symbol("$textProxy:"+e.data);let s,a;return s=this._textProxyRegistry.get(t),s||(s=new Map,this._textProxyRegistry.set(t,s)),a=s.get(n),a||(a=new Map,s.set(n,a)),a.set(i,r),r}}function vi(o){const e=o.split(":");return e[0]=="insert"?e[0]:e[0]=="addMarker"||e[0]=="removeMarker"?o:e.length>1?e[0]+":"+e[1]:e[0]}var uy=Object.defineProperty,my=Object.defineProperties,gy=Object.getOwnPropertyDescriptors,ah=Object.getOwnPropertySymbols,py=Object.prototype.hasOwnProperty,fy=Object.prototype.propertyIsEnumerable,lh=(o,e,t)=>e in o?uy(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,ys=(o,e)=>{for(var t in e||(e={}))py.call(e,t)&&lh(o,t,e[t]);if(ah)for(var t of ah(e))fy.call(e,t)&&lh(o,t,e[t]);return o},ch=(o,e)=>my(o,gy(e));class dh extends me(){constructor(e){super(),this._conversionApi=ys({dispatcher:this},e),this._firedEventsMap=new WeakMap}convertChanges(e,t,n){const i=this._createConversionApi(n,e.getRefreshedItems());for(const s of e.getMarkersToRemove())this._convertMarkerRemove(s.name,s.range,i);const r=this._reduceChanges(e.getChanges());for(const s of r)s.type==="insert"?this._convertInsert(V._createFromPositionAndShift(s.position,s.length),i):s.type==="reinsert"?this._convertReinsert(V._createFromPositionAndShift(s.position,s.length),i):s.type==="remove"?this._convertRemove(s.position,s.length,s.name,i):this._convertAttribute(s.range,s.attributeKey,s.attributeOldValue,s.attributeNewValue,i);for(const s of i.mapper.flushUnboundMarkerNames()){const a=t.get(s).getRange();this._convertMarkerRemove(s,a,i),this._convertMarkerAdd(s,a,i)}for(const s of e.getMarkersToAdd())this._convertMarkerAdd(s.name,s.range,i);i.mapper.flushDeferredBindings(),i.consumable.verifyAllConsumed("insert")}convert(e,t,n,i={}){const r=this._createConversionApi(n,void 0,i);this._convertInsert(e,r);for(const[s,a]of t)this._convertMarkerAdd(s,a,r);r.consumable.verifyAllConsumed("insert")}convertSelection(e,t,n){const i=Array.from(t.getMarkersAtPosition(e.getFirstPosition())),r=this._createConversionApi(n);if(this._addConsumablesForSelection(r.consumable,e,i),this.fire("selection",{selection:e},r),e.isCollapsed){for(const s of i){const a=s.getRange();if(!ky(e.getFirstPosition(),s,r.mapper))continue;const l={item:e,markerName:s.name,markerRange:a};r.consumable.test(e,"addMarker:"+s.name)&&this.fire(`addMarker:${s.name}`,l,r)}for(const s of e.getAttributeKeys()){const a={item:e,range:e.getFirstRange(),attributeKey:s,attributeOldValue:null,attributeNewValue:e.getAttribute(s)};r.consumable.test(e,"attribute:"+a.attributeKey)&&this.fire(`attribute:${a.attributeKey}:$text`,a,r)}}}_convertInsert(e,t,n={}){n.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,Array.from(e));for(const i of Array.from(e.getWalker({shallow:!0})).map(hh))this._testAndFire("insert",i,t)}_convertRemove(e,t,n,i){this.fire(`remove:${n}`,{position:e,length:t},i)}_convertAttribute(e,t,n,i,r){this._addConsumablesForRange(r.consumable,e,`attribute:${t}`);for(const s of e){const a={item:s.item,range:V._createFromPositionAndShift(s.previousPosition,s.length),attributeKey:t,attributeOldValue:n,attributeNewValue:i};this._testAndFire(`attribute:${t}`,a,r)}}_convertReinsert(e,t){const n=Array.from(e.getWalker({shallow:!0}));this._addConsumablesForInsert(t.consumable,n);for(const i of n.map(hh))this._testAndFire("insert",ch(ys({},i),{reconversion:!0}),t)}_convertMarkerAdd(e,t,n){if(t.root.rootName=="$graveyard")return;const i=`addMarker:${e}`;if(n.consumable.add(t,i),this.fire(i,{markerName:e,markerRange:t},n),n.consumable.consume(t,i)){this._addConsumablesForRange(n.consumable,t,i);for(const r of t.getItems()){if(!n.consumable.test(r,i))continue;const s={item:r,range:V._createOn(r),markerName:e,markerRange:t};this.fire(i,s,n)}}}_convertMarkerRemove(e,t,n){t.root.rootName!="$graveyard"&&this.fire(`removeMarker:${e}`,{markerName:e,markerRange:t},n)}_reduceChanges(e){const t={changes:e};return this.fire("reduceChanges",t),t.changes}_addConsumablesForInsert(e,t){for(const n of t){const i=n.item;if(e.test(i,"insert")===null){e.add(i,"insert");for(const r of i.getAttributeKeys())e.add(i,"attribute:"+r)}}return e}_addConsumablesForRange(e,t,n){for(const i of t.getItems())e.add(i,n);return e}_addConsumablesForSelection(e,t,n){e.add(t,"selection");for(const i of n)e.add(t,"addMarker:"+i.name);for(const i of t.getAttributeKeys())e.add(t,"attribute:"+i);return e}_testAndFire(e,t,n){const i=function(l,c){const d=c.item.is("element")?c.item.name:"$text";return`${l}:${d}`}(e,t),r=t.item.is("$textProxy")?n.consumable._getSymbolForTextProxy(t.item):t.item,s=this._firedEventsMap.get(n),a=s.get(r);if(a){if(a.has(i))return;a.add(i)}else s.set(r,new Set([i]));this.fire(i,t,n)}_testAndFireAddAttributes(e,t){const n={item:e,range:V._createOn(e)};for(const i of n.item.getAttributeKeys())n.attributeKey=i,n.attributeOldValue=null,n.attributeNewValue=n.item.getAttribute(i),this._testAndFire(`attribute:${i}`,n,t)}_createConversionApi(e,t=new Set,n={}){const i=ch(ys({},this._conversionApi),{consumable:new hy,writer:e,options:n,convertItem:r=>this._convertInsert(V._createOn(r),i),convertChildren:r=>this._convertInsert(V._createIn(r),i,{doNotAddConsumables:!0}),convertAttributes:r=>this._testAndFireAddAttributes(r,i),canReuseView:r=>!t.has(i.mapper.toModelElement(r))});return this._firedEventsMap.set(i,new Map),i}}function ky(o,e,t){const n=e.getRange(),i=Array.from(o.getAncestors());return i.shift(),i.reverse(),!i.some(r=>{if(n.containsItem(r))return!!t.toViewElement(r).getCustomProperty("addHighlight")})}function hh(o){return{item:o.item,range:V._createFromPositionAndShift(o.previousPosition,o.length)}}class nt extends me(Ht){constructor(...e){super(),this._lastRangeBackward=!1,this._attrs=new Map,this._ranges=[],e.length&&this.setTo(...e)}get anchor(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return this._ranges.length===1&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let n=!1;for(const i of e._ranges)if(t.isEqual(i)){n=!0;break}if(!n)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new V(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 V(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 V(e.start,e.end):null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}setTo(...e){let[t,n,i]=e;if(typeof n=="object"&&(i=n,n=void 0),t===null)this._setRanges([]);else if(t instanceof nt)this._setRanges(t.getRanges(),t.isBackward);else if(t&&typeof t.getRanges=="function")this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof V)this._setRanges([t],!!i&&!!i.backward);else if(t instanceof H)this._setRanges([new V(t)]);else if(t instanceof hn){const r=!!i&&!!i.backward;let s;if(n=="in")s=V._createIn(t);else if(n=="on")s=V._createOn(t);else{if(n===void 0)throw new I("model-selection-setto-required-second-parameter",[this,t]);s=new V(H._createAt(t,n))}this._setRanges([s],r)}else{if(!Xe(t))throw new I("model-selection-setto-not-selectable",[this,t]);this._setRanges(t,i&&!!i.backward)}}_setRanges(e,t=!1){const n=Array.from(e),i=n.some(r=>{if(!(r instanceof V))throw new I("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every(s=>!s.isEqual(r))});(n.length!==this._ranges.length||i)&&(this._replaceAllRanges(n),this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0}))}setFocus(e,t){if(this.anchor===null)throw new I("model-selection-setfocus-no-ranges",[this,e]);const n=H._createAt(e,t);if(n.compareWith(this.focus)=="same")return;const i=this.anchor;this._ranges.length&&this._popRange(),n.compareWith(i)=="before"?(this._pushRange(new V(n,i)),this._lastRangeBackward=!0):(this._pushRange(new V(i,n)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const n=mh(t.start,e);wy(n,t)&&(yield n);for(const r of t.getWalker()){const s=r.item;r.type=="elementEnd"&&by(s,e,t)&&(yield s)}const i=mh(t.end,e);Ay(i,t)&&(yield i)}}containsEntireContent(e=this.anchor.root){const t=H._createAt(e,0),n=H._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&n.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new V(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new I("model-selection-range-intersects",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_replaceAllRanges(e){this._removeAllRanges();for(const t of e)this._pushRange(t)}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}function uh(o,e){return!e.has(o)&&(e.add(o),o.root.document.model.schema.isBlock(o)&&!!o.parent)}function by(o,e,t){return uh(o,e)&&Es(o,t)}function mh(o,e){const t=o.parent.root.document.model.schema,n=o.parent.getAncestors({parentFirst:!0,includeSelf:!0});let i=!1;const r=n.find(s=>!i&&(i=t.isLimit(s),!i&&uh(s,e)));return n.forEach(s=>e.add(s)),r}function Es(o,e){const t=function(n){const i=n.root.document.model.schema;let r=n.parent;for(;r;){if(i.isBlock(r))return r;r=r.parent}}(o);return t?!e.containsRange(V._createOn(t),!0):!0}function wy(o,e){return!!o&&(!(!e.isCollapsed&&!o.isEmpty)||!e.start.isTouching(H._createAt(o,o.maxOffset))&&Es(o,e))}function Ay(o,e){return!!o&&(!(!e.isCollapsed&&!o.isEmpty)||!e.end.isTouching(H._createAt(o,0))&&Es(o,e))}nt.prototype.is=function(o){return o==="selection"||o==="model:selection"};class Bt extends me(V){constructor(e,t){super(e,t),_y.call(this)}detach(){this.stopListening()}toRange(){return new V(this.start,this.end)}static fromRange(e){return new Bt(e.start,e.end)}}function _y(){this.listenTo(this.root.document.model,"applyOperation",(o,e)=>{const t=e[0];t.isDocumentOperation&&Cy.call(this,t)},{priority:"low"})}function Cy(o){const e=this.getTransformedByOperation(o),t=V._createFromRanges(e),n=!t.isEqual(this),i=function(s,a){switch(a.type){case"insert":return s.containsPosition(a.position);case"move":case"remove":case"reinsert":case"merge":return s.containsPosition(a.sourcePosition)||s.start.isEqual(a.sourcePosition)||s.containsPosition(a.targetPosition);case"split":return s.containsPosition(a.splitPosition)||s.containsPosition(a.insertionPosition)}return!1}(this,o);let r=null;if(n){t.root.rootName=="$graveyard"&&(r=o.type=="remove"?o.sourcePosition:o.deletionPosition);const s=this.toRange();this.start=t.start,this.end=t.end,this.fire("change:range",s,{deletionPosition:r})}else i&&this.fire("change:content",this.toRange(),{deletionPosition:r})}Bt.prototype.is=function(o){return o==="liveRange"||o==="model:liveRange"||o=="range"||o==="model:range"};const yi="selection:";class mt extends me(Ht){constructor(e){super(),this._selection=new vy(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection.updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(e){this._selection.observeMarkers(e)}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(...e){this._selection.setTo(...e)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection.getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return yi+e}static _isStoreAttributeKey(e){return e.startsWith(yi)}}mt.prototype.is=function(o){return o==="selection"||o=="model:selection"||o=="documentSelection"||o=="model:documentSelection"};class vy extends nt{constructor(e){super(),this.markers=new at({idProperty:"name"}),this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this._observedMarkers=new Set,this._model=e.model,this._document=e,this.listenTo(this._model,"applyOperation",(t,n)=>{const i=n[0];i.isDocumentOperation&&i.type!="marker"&&i.type!="rename"&&i.type!="noop"&&(this._ranges.length==0&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1})))},{priority:"lowest"}),this.on("change:range",()=>{this._validateSelectionRanges(this.getRanges())}),this.listenTo(this._model.markers,"update",(t,n,i,r)=>{this._updateMarker(n,r)}),this.listenTo(this._document,"change",(t,n)=>{(function(i,r){const s=i.document.differ;for(const a of s.getChanges()){if(a.type!="insert")continue;const l=a.position.parent;a.length===l.maxOffset&&i.enqueueChange(r,c=>{const d=Array.from(l.getAttributeKeys()).filter(u=>u.startsWith(yi));for(const u of d)c.removeAttribute(u,l)})}})(this._model,n)})}get isCollapsed(){return this._ranges.length===0?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e<this._ranges.length;e++)this._ranges[e].detach();this.stopListening()}*getRanges(){this._ranges.length?yield*super.getRanges():yield this._document._getDefaultRange()}getFirstRange(){return super.getFirstRange()||this._document._getDefaultRange()}getLastRange(){return super.getLastRange()||this._document._getDefaultRange()}setTo(...e){super.setTo(...e),this._updateAttributes(!0),this.updateMarkers()}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(!0),this.updateMarkers()}setAttribute(e,t){if(this._setAttribute(e,t)){const n=[e];this.fire("change:attribute",{attributeKeys:n,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=J();return this._overriddenGravityRegister.add(e),this._overriddenGravityRegister.size===1&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new I("document-selection-gravity-wrong-restore",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}observeMarkers(e){this._observedMarkers.add(e),this.updateMarkers()}_replaceAllRanges(e){this._validateSelectionRanges(e),super._replaceAllRanges(e)}_popRange(){this._ranges.pop().detach()}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t)}_validateSelectionRanges(e){for(const t of e)if(!this._document._validateSelectionRange(t))throw new I("document-selection-wrong-position",this,{range:t})}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=Bt.fromRange(e);return t.on("change:range",(n,i,r)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=r.deletionPosition;const s=this._ranges.indexOf(t);this._ranges.splice(s,1),t.detach()}}),t}updateMarkers(){if(!this._observedMarkers.size)return;const e=[];let t=!1;for(const i of this._model.markers){const r=i.name.split(":",1)[0];if(!this._observedMarkers.has(r))continue;const s=i.getRange();for(const a of this.getRanges())s.containsRange(a,!a.isCollapsed)&&e.push(i)}const n=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:n,directChange:!1})}_updateMarker(e,t){const n=e.name.split(":",1)[0];if(!this._observedMarkers.has(n))return;let i=!1;const r=Array.from(this.markers),s=this.markers.has(e);if(t){let a=!1;for(const l of this.getRanges())if(t.containsRange(l,!l.isCollapsed)){a=!0;break}a&&!s?(this.markers.add(e),i=!0):!a&&s&&(this.markers.remove(e),i=!0)}else s&&(this.markers.remove(e),i=!0);i&&this.fire("change:marker",{oldMarkers:r,directChange:!1})}_updateAttributes(e){const t=Dt(this._getSurroundingAttributes()),n=Dt(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[r,s]of this._attributePriority)s=="low"&&(this._attrs.delete(r),this._attributePriority.delete(r));this._setAttributesTo(t);const i=[];for(const[r,s]of this.getAttributes())n.has(r)&&n.get(r)===s||i.push(r);for(const[r]of n)this.hasAttribute(r)||i.push(r);i.length>0&&this.fire("change:attribute",{attributeKeys:i,directChange:!1})}_setAttribute(e,t,n=!0){const i=n?"normal":"low";return i=="low"&&this._attributePriority.get(e)=="normal"?!1:super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,i),!0)}_removeAttribute(e,t=!0){const n=t?"normal":"low";return(n!="low"||this._attributePriority.get(e)!="normal")&&(this._attributePriority.set(e,n),!!super.hasAttribute(e)&&(this._attrs.delete(e),!0))}_setAttributesTo(e){const t=new Set;for(const[n,i]of this.getAttributes())e.get(n)!==i&&this._removeAttribute(n,!1);for(const[n,i]of e)this._setAttribute(n,i,!1)&&t.add(n);return t}*getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())t.startsWith(yi)&&(yield[t.substr(10),e.getAttribute(t)])}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;let n=null;if(this.isCollapsed){const i=e.textNode?e.textNode:e.nodeBefore,r=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(n=Ei(i)),n||(n=Ei(r)),!this.isGravityOverridden&&!n){let s=i;for(;s&&!t.isInline(s)&&!n;)s=s.previousSibling,n=Ei(s)}if(!n){let s=r;for(;s&&!t.isInline(s)&&!n;)s=s.nextSibling,n=Ei(s)}n||(n=this.getStoredAttributes())}else{const i=this.getFirstRange();for(const r of i){if(r.item.is("element")&&t.isObject(r.item))break;if(r.type=="text"){n=r.item.getAttributes();break}}}return n}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function Ei(o){return o instanceof ut||o instanceof fe?o.getAttributes():null}class gh{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}const qt=function(o){return Fr(o,5)};class yy extends gh{elementToElement(e){return this.add(function(t){const n=kh(t.model),i=xo(t.view,"container");return n.attributes.length&&(n.children=!0),r=>{r.on(`insert:${n.name}`,function(s,a=xy){return(l,c,d)=>{if(!a(c.item,d.consumable,{preflight:!0}))return;const u=s(c.item,d,c);if(!u)return;a(c.item,d.consumable);const g=d.mapper.toViewPosition(c.range.start);d.mapper.bindElements(c.item,u),d.writer.insert(g,u),d.convertAttributes(c.item),Ch(u,c.item.getChildren(),d,{reconversion:c.reconversion})}}(i,_h(n)),{priority:t.converterPriority||"normal"}),(n.children||n.attributes.length)&&r.on("reduceChanges",Ah(n),{priority:"low"})}}(e))}elementToStructure(e){return this.add(function(t){const n=kh(t.model),i=xo(t.view,"container");return n.children=!0,r=>{if(r._conversionApi.schema.checkChild(n.name,"$text"))throw new I("conversion-element-to-structure-disallowed-text",r,{elementName:n.name});var s,a;r.on(`insert:${n.name}`,(s=i,a=_h(n),(l,c,d)=>{if(!a(c.item,d.consumable,{preflight:!0}))return;const u=new Map;d.writer._registerSlotFactory(function(b,A,E){return(P,z)=>{const j=P.createContainerElement("$slot");let Y=null;if(z==="children")Y=Array.from(b.getChildren());else{if(typeof z!="function")throw new I("conversion-slot-mode-unknown",E.dispatcher,{modeOrFilter:z});Y=Array.from(b.getChildren()).filter(ie=>z(ie))}return A.set(j,Y),j}}(c.item,u,d));const g=s(c.item,d,c);if(d.writer._clearSlotFactory(),!g)return;(function(b,A,E){const P=Array.from(A.values()).flat(),z=new Set(P);if(z.size!=P.length)throw new I("conversion-slot-filter-overlap",E.dispatcher,{element:b});if(z.size!=b.childCount)throw new I("conversion-slot-filter-incomplete",E.dispatcher,{element:b})})(c.item,u,d),a(c.item,d.consumable);const f=d.mapper.toViewPosition(c.range.start);d.mapper.bindElements(c.item,g),d.writer.insert(f,g),d.convertAttributes(c.item),function(b,A,E,P){E.mapper.on("modelToViewPosition",Y,{priority:"highest"});let z=null,j=null;for([z,j]of A)Ch(b,j,E,P),E.writer.move(E.writer.createRangeIn(z),E.writer.createPositionBefore(z)),E.writer.remove(z);function Y(ie,Ee){const he=Ee.modelPosition.nodeAfter,Mt=j.indexOf(he);Mt<0||(Ee.viewPosition=Ee.mapper.findPositionIn(z,Mt))}E.mapper.off("modelToViewPosition",Y)}(g,u,d,{reconversion:c.reconversion})}),{priority:t.converterPriority||"normal"}),r.on("reduceChanges",Ah(n),{priority:"low"})}}(e))}attributeToElement(e){return this.add(function(t){t=qt(t);let n=t.model;typeof n=="string"&&(n={key:n});let i=`attribute:${n.key}`;if(n.name&&(i+=":"+n.name),n.values)for(const s of n.values)t.view[s]=xo(t.view[s],"attribute");else t.view=xo(t.view,"attribute");const r=bh(t);return s=>{s.on(i,function(a){return(l,c,d)=>{if(!d.consumable.test(c.item,l.name))return;const u=a(c.attributeOldValue,d,c),g=a(c.attributeNewValue,d,c);if(!u&&!g)return;d.consumable.consume(c.item,l.name);const f=d.writer,b=f.document.selection;if(c.item instanceof nt||c.item instanceof mt)f.wrap(b.getFirstRange(),g);else{let A=d.mapper.toViewRange(c.range);c.attributeOldValue!==null&&u&&(A=f.unwrap(A,u)),c.attributeNewValue!==null&&g&&f.wrap(A,g)}}}(r),{priority:t.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(t){t=qt(t);let n=t.model;typeof n=="string"&&(n={key:n});let i=`attribute:${n.key}`;if(n.name&&(i+=":"+n.name),n.values)for(const s of n.values)t.view[s]=wh(t.view[s]);else t.view=wh(t.view);const r=bh(t);return s=>{var a;s.on(i,(a=r,(l,c,d)=>{if(!d.consumable.test(c.item,l.name))return;const u=a(c.attributeOldValue,d,c),g=a(c.attributeNewValue,d,c);if(!u&&!g)return;d.consumable.consume(c.item,l.name);const f=d.mapper.toViewElement(c.item),b=d.writer;if(!f)throw new I("conversion-attribute-to-attribute-on-text",d.dispatcher,c);if(c.attributeOldValue!==null&&u)if(u.key=="class"){const A=Pe(u.value);for(const E of A)b.removeClass(E,f)}else if(u.key=="style"){const A=Object.keys(u.value);for(const E of A)b.removeStyle(E,f)}else b.removeAttribute(u.key,f);if(c.attributeNewValue!==null&&g)if(g.key=="class"){const A=Pe(g.value);for(const E of A)b.addClass(E,f)}else if(g.key=="style"){const A=Object.keys(g.value);for(const E of A)b.setStyle(E,g.value[E],f)}else b.setAttribute(g.key,g.value,f)}),{priority:t.converterPriority||"normal"})}}(e))}markerToElement(e){return this.add(function(t){const n=xo(t.view,"ui");return i=>{var r;i.on(`addMarker:${t.model}`,(r=n,(s,a,l)=>{a.isOpening=!0;const c=r(a,l);a.isOpening=!1;const d=r(a,l);if(!c||!d)return;const u=a.markerRange;if(u.isCollapsed&&!l.consumable.consume(u,s.name))return;for(const b of u)if(!l.consumable.consume(b.item,s.name))return;const g=l.mapper,f=l.writer;f.insert(g.toViewPosition(u.start),c),l.mapper.bindElementToMarker(c,a.markerName),u.isCollapsed||(f.insert(g.toViewPosition(u.end),d),l.mapper.bindElementToMarker(d,a.markerName)),s.stop()}),{priority:t.converterPriority||"normal"}),i.on(`removeMarker:${t.model}`,(s,a,l)=>{const c=l.mapper.markerNameToElements(a.markerName);if(c){for(const d of c)l.mapper.unbindElementFromMarkerName(d,a.markerName),l.writer.clear(l.writer.createRangeOn(d),d);l.writer.clearClonedElementsGroup(a.markerName),s.stop()}},{priority:t.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(t){return n=>{var i;n.on(`addMarker:${t.model}`,(i=t.view,(r,s,a)=>{if(!s.item||!(s.item instanceof nt||s.item instanceof mt||s.item.is("$textProxy")))return;const l=xs(i,s,a);if(!l||!a.consumable.consume(s.item,r.name))return;const c=a.writer,d=ph(c,l),u=c.document.selection;if(s.item instanceof nt||s.item instanceof mt)c.wrap(u.getFirstRange(),d);else{const g=a.mapper.toViewRange(s.range),f=c.wrap(g,d);for(const b of f.getItems())if(b.is("attributeElement")&&b.isSimilar(d)){a.mapper.bindElementToMarker(b,s.markerName);break}}}),{priority:t.converterPriority||"normal"}),n.on(`addMarker:${t.model}`,function(r){return(s,a,l)=>{if(!a.item||!(a.item instanceof ke))return;const c=xs(r,a,l);if(!c||!l.consumable.test(a.item,s.name))return;const d=l.mapper.toViewElement(a.item);if(d&&d.getCustomProperty("addHighlight")){l.consumable.consume(a.item,s.name);for(const u of V._createIn(a.item))l.consumable.consume(u.item,s.name);d.getCustomProperty("addHighlight")(d,c,l.writer),l.mapper.bindElementToMarker(d,a.markerName)}}}(t.view),{priority:t.converterPriority||"normal"}),n.on(`removeMarker:${t.model}`,function(r){return(s,a,l)=>{if(a.markerRange.isCollapsed)return;const c=xs(r,a,l);if(!c)return;const d=ph(l.writer,c),u=l.mapper.markerNameToElements(a.markerName);if(u){for(const g of u)l.mapper.unbindElementFromMarkerName(g,a.markerName),g.is("attributeElement")?l.writer.unwrap(l.writer.createRangeOn(g),d):g.getCustomProperty("removeHighlight")(g,c.id,l.writer);l.writer.clearClonedElementsGroup(a.markerName),s.stop()}}}(t.view),{priority:t.converterPriority||"normal"})}}(e))}markerToData(e){return this.add(function(t){t=qt(t);const n=t.model;let i=t.view;return i||(i=r=>({group:n,name:r.substr(t.model.length+1)})),r=>{var s;r.on(`addMarker:${n}`,(s=i,(a,l,c)=>{const d=s(l.markerName,c);if(!d)return;const u=l.markerRange;c.consumable.consume(u,a.name)&&(fh(u,!1,c,l,d),fh(u,!0,c,l,d),a.stop())}),{priority:t.converterPriority||"normal"}),r.on(`removeMarker:${n}`,function(a){return(l,c,d)=>{const u=a(c.markerName,d);if(!u)return;const g=d.mapper.markerNameToElements(c.markerName);if(g){for(const b of g)d.mapper.unbindElementFromMarkerName(b,c.markerName),b.is("containerElement")?(f(`data-${u.group}-start-before`,b),f(`data-${u.group}-start-after`,b),f(`data-${u.group}-end-before`,b),f(`data-${u.group}-end-after`,b)):d.writer.clear(d.writer.createRangeOn(b),b);d.writer.clearClonedElementsGroup(c.markerName),l.stop()}function f(b,A){if(A.hasAttribute(b)){const E=new Set(A.getAttribute(b).split(","));E.delete(u.name),E.size==0?d.writer.removeAttribute(b,A):d.writer.setAttribute(b,Array.from(E).join(","),A)}}}}(i),{priority:t.converterPriority||"normal"})}}(e))}}function ph(o,e){const t=o.createAttributeElement("span",e.attributes);return e.classes&&t._addClass(e.classes),typeof e.priority=="number"&&(t._priority=e.priority),t._id=e.id,t}function fh(o,e,t,n,i){const r=e?o.start:o.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 l,c;e&&s||!e&&!a?(l=s,c=!0):(l=a,c=!1);const d=t.mapper.toViewElement(l);if(d)return void function(u,g,f,b,A,E){const P=`data-${E.group}-${g?"start":"end"}-${f?"before":"after"}`,z=u.hasAttribute(P)?u.getAttribute(P).split(","):[];z.unshift(E.name),b.writer.setAttribute(P,z.join(","),u),b.mapper.bindElementToMarker(u,A.markerName)}(d,e,c,t,n,i)}(function(l,c,d,u,g){const f=`${g.group}-${c?"start":"end"}`,b=g.name?{name:g.name}:null,A=d.writer.createUIElement(f,b);d.writer.insert(l,A),d.mapper.bindElementToMarker(A,u.markerName)})(t.mapper.toViewPosition(r),e,t,n,i)}function kh(o){return typeof o=="string"&&(o={name:o}),o.attributes?Array.isArray(o.attributes)||(o.attributes=[o.attributes]):o.attributes=[],o.children=!!o.children,o}function xo(o,e){return typeof o=="function"?o:(t,n)=>function(i,r,s){typeof i=="string"&&(i={name:i});let a;const l=r.writer,c=Object.assign({},i.attributes);if(s=="container")a=l.createContainerElement(i.name,c);else if(s=="attribute"){const d={priority:i.priority||cn.DEFAULT_PRIORITY};a=l.createAttributeElement(i.name,c,d)}else a=l.createUIElement(i.name,c);if(i.styles){const d=Object.keys(i.styles);for(const u of d)l.setStyle(u,i.styles[u],a)}if(i.classes){const d=i.classes;if(typeof d=="string")l.addClass(d,a);else for(const u of d)l.addClass(u,a)}return a}(o,n,e)}function bh(o){return o.model.values?(e,t,n)=>{const i=o.view[e];return i?i(e,t,n):null}:o.view}function wh(o){return typeof o=="string"?e=>({key:o,value:e}):typeof o=="object"?o.value?()=>o:e=>({key:o.key,value:e}):o}function xs(o,e,t){const n=typeof o=="function"?o(e,t):o;return n?(n.priority||(n.priority=10),n.id||(n.id=e.markerName),n):null}function Ah(o){const e=function(t){return(n,i)=>{if(!n.is("element",t.name))return!1;if(i.type=="attribute"){if(t.attributes.includes(i.attributeKey))return!0}else if(t.children)return!0;return!1}}(o);return(t,n)=>{const i=[];n.reconvertedElements||(n.reconvertedElements=new Set);for(const r of n.changes){const s=r.type=="attribute"?r.range.start.nodeAfter:r.position.parent;if(s&&e(s,r)){if(!n.reconvertedElements.has(s)){n.reconvertedElements.add(s);const a=H._createBefore(s);let l=i.length;for(let c=i.length-1;c>=0;c--){const d=i[c],u=(d.type=="attribute"?d.range.start:d.position).compareWith(a);if(u=="before"||d.type=="remove"&&u=="same")break;l=c}i.splice(l,0,{type:"remove",name:s.name,position:a,length:1},{type:"reinsert",name:s.name,position:a,length:1})}}else i.push(r)}n.changes=i}}function _h(o){return(e,t,n={})=>{const i=["insert"];for(const r of o.attributes)e.hasAttribute(r)&&i.push(`attribute:${r}`);return!!i.every(r=>t.test(e,r))&&(n.preflight||i.forEach(r=>t.consume(e,r)),!0)}}function Ch(o,e,t,n){for(const i of e)Ey(o.root,i,t,n)||t.convertItem(i)}function Ey(o,e,t,n){const{writer:i,mapper:r}=t;if(!n.reconversion)return!1;const s=r.toViewElement(e);return!(!s||s.root==o)&&!!t.canReuseView(s)&&(i.move(i.createRangeOn(s),r.toViewPosition(H._createBefore(e))),!0)}function xy(o,e,{preflight:t}={}){return t?e.test(o,"insert"):e.consume(o,"insert")}function vh(o){const{schema:e,document:t}=o.model;for(const n of t.getRootNames()){const i=t.getRoot(n);if(i.isEmpty&&!e.checkChild(i,"$text")&&e.checkChild(i,"paragraph"))return o.insertElement("paragraph",i),!0}return!1}function yh(o,e,t){const n=t.createContext(o);return!!t.checkChild(n,"paragraph")&&!!t.checkChild(n.push("paragraph"),e)}function Eh(o,e){const t=e.createElement("paragraph");return e.insert(t,o),e.createPositionAt(t,0)}var Sy=Object.defineProperty,Dy=Object.defineProperties,By=Object.getOwnPropertyDescriptors,xh=Object.getOwnPropertySymbols,Ty=Object.prototype.hasOwnProperty,Iy=Object.prototype.propertyIsEnumerable,Sh=(o,e,t)=>e in o?Sy(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;class Py extends gh{elementToElement(e){return this.add(Dh(e))}elementToAttribute(e){return this.add(function(t){t=qt(t),Bh(t);const n=Th(t,!1),i=Ss(t.view),r=i?`element:${i}`:"element";return s=>{s.on(r,n,{priority:t.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(t){t=qt(t);let n=null;(typeof t.view=="string"||t.view.key)&&(n=function(r){typeof r.view=="string"&&(r.view={key:r.view});const s=r.view.key;let a;return s=="class"||s=="style"?a={[s=="class"?"classes":"styles"]:r.view.value}:a={attributes:{[s]:r.view.value===void 0?/[\s\S]*/:r.view.value}},r.view.name&&(a.name=r.view.name),r.view=a,s}(t)),Bh(t,n);const i=Th(t,!0);return r=>{r.on("element",i,{priority:t.converterPriority||"low"})}}(e))}elementToMarker(e){return this.add(function(t){const n=function(s){return(a,l)=>{const c=typeof s=="string"?s:s(a,l);return l.writer.createElement("$marker",{"data-name":c})}}(t.model);return Dh((i=((s,a)=>{for(var l in a||(a={}))Ty.call(a,l)&&Sh(s,l,a[l]);if(xh)for(var l of xh(a))Iy.call(a,l)&&Sh(s,l,a[l]);return s})({},t),r={model:n},Dy(i,By(r))));var i,r}(e))}dataToMarker(e){return this.add(function(t){t=qt(t),t.model||(t.model=s=>s?t.view+":"+s:t.view);const n={view:t.view,model:t.model},i=Ds(Ih(n,"start")),r=Ds(Ih(n,"end"));return s=>{s.on(`element:${t.view}-start`,i,{priority:t.converterPriority||"normal"}),s.on(`element:${t.view}-end`,r,{priority:t.converterPriority||"normal"});const a=te.get("low"),l=te.get("highest"),c=te.get(t.converterPriority)/l;s.on("element",function(d){return(u,g,f)=>{const b=`data-${d.view}`;function A(E,P){for(const z of P){const j=d.model(z,f),Y=f.writer.createElement("$marker",{"data-name":j});f.writer.insert(Y,E),g.modelCursor.isEqual(E)?g.modelCursor=g.modelCursor.getShiftedBy(1):g.modelCursor=g.modelCursor._getTransformedByInsertion(E,1),g.modelRange=g.modelRange._getTransformedByInsertion(E,1)[0]}}(f.consumable.test(g.viewItem,{attributes:b+"-end-after"})||f.consumable.test(g.viewItem,{attributes:b+"-start-after"})||f.consumable.test(g.viewItem,{attributes:b+"-end-before"})||f.consumable.test(g.viewItem,{attributes:b+"-start-before"}))&&(g.modelRange||Object.assign(g,f.convertChildren(g.viewItem,g.modelCursor)),f.consumable.consume(g.viewItem,{attributes:b+"-end-after"})&&A(g.modelRange.end,g.viewItem.getAttribute(b+"-end-after").split(",")),f.consumable.consume(g.viewItem,{attributes:b+"-start-after"})&&A(g.modelRange.end,g.viewItem.getAttribute(b+"-start-after").split(",")),f.consumable.consume(g.viewItem,{attributes:b+"-end-before"})&&A(g.modelRange.start,g.viewItem.getAttribute(b+"-end-before").split(",")),f.consumable.consume(g.viewItem,{attributes:b+"-start-before"})&&A(g.modelRange.start,g.viewItem.getAttribute(b+"-start-before").split(",")))}}(n),{priority:a+c})}}(e))}}function Dh(o){const e=Ds(o=qt(o)),t=Ss(o.view),n=t?`element:${t}`:"element";return i=>{i.on(n,e,{priority:o.converterPriority||"normal"})}}function Ss(o){return typeof o=="string"?o:typeof o=="object"&&typeof o.name=="string"?o.name:null}function Ds(o){const e=new Mn(o.view);return(t,n,i)=>{const r=e.match(n.viewItem);if(!r)return;const s=r.match;if(s.name=!0,!i.consumable.test(n.viewItem,s))return;const a=function(l,c,d){return l instanceof Function?l(c,d):d.writer.createElement(l)}(o.model,n.viewItem,i);a&&i.safeInsert(a,n.modelCursor)&&(i.consumable.consume(n.viewItem,s),i.convertChildren(n.viewItem,a),i.updateConversionResult(a,n))}}function Bh(o,e=null){const t=e===null||(r=>r.getAttribute(e)),n=typeof o.model!="object"?o.model:o.model.key,i=typeof o.model!="object"||o.model.value===void 0?t:o.model.value;o.model={key:n,value:i}}function Th(o,e){const t=new Mn(o.view);return(n,i,r)=>{if(!i.modelRange&&e)return;const s=t.match(i.viewItem);if(!s||(function(d,u){const g=typeof d=="function"?d(u):d;return typeof g=="object"&&!Ss(g)?!1:!g.classes&&!g.attributes&&!g.styles}(o.view,i.viewItem)?s.match.name=!0:delete s.match.name,!r.consumable.test(i.viewItem,s.match)))return;const a=o.model.key,l=typeof o.model.value=="function"?o.model.value(i.viewItem,r):o.model.value;if(l===null)return;i.modelRange||Object.assign(i,r.convertChildren(i.viewItem,i.modelCursor)),function(d,u,g,f){let b=!1;for(const A of Array.from(d.getItems({shallow:g})))f.schema.checkAttribute(A,u.key)&&(b=!0,A.hasAttribute(u.key)||f.writer.setAttribute(u.key,u.value,A));return b}(i.modelRange,{key:a,value:l},e,r)&&(r.consumable.test(i.viewItem,{name:!0})&&(s.match.name=!0),r.consumable.consume(i.viewItem,s.match))}}function Ih(o,e){return{view:`${o.view}-${e}`,model:(t,n)=>{const i=t.getAttribute("name"),r=o.model(i,n);return n.writer.createElement("$marker",{"data-name":r})}}}function Ry(o){o.document.registerPostFixer(e=>function(t,n){const i=n.document.selection,r=n.schema,s=[];let a=!1;for(const l of i.getRanges()){const c=Ph(l,r);c&&!c.isEqual(l)?(s.push(c),a=!0):s.push(l)}return a&&t.setSelection(function(l){const c=[...l],d=new Set;let u=1;for(;u<c.length;){const g=c[u],f=c.slice(0,u);for(const[b,A]of f.entries())if(!d.has(b)){if(g.isEqual(A))d.add(b);else if(g.isIntersecting(A)){d.add(b),d.add(u);const E=g.getJoined(A);c.push(E)}}u++}return c.filter((g,f)=>!d.has(f))}(s),{backward:i.isBackward}),!1}(e,o))}function Ph(o,e){return o.isCollapsed?function(t,n){const i=t.start,r=n.getNearestSelectionRange(i);if(!r){const a=i.getAncestors().reverse().find(l=>n.isObject(l));return a?V._createOn(a):null}if(!r.isCollapsed)return r;const s=r.start;return i.isEqual(s)?null:new V(s)}(o,e):function(t,n){const{start:i,end:r}=t,s=n.checkChild(i,"$text"),a=n.checkChild(r,"$text"),l=n.getLimitElement(i),c=n.getLimitElement(r);if(l===c){if(s&&a)return null;if(function(g,f,b){const A=g.nodeAfter&&!b.isLimit(g.nodeAfter)||b.checkChild(g,"$text"),E=f.nodeBefore&&!b.isLimit(f.nodeBefore)||b.checkChild(f,"$text");return A||E}(i,r,n)){const g=i.nodeAfter&&n.isSelectable(i.nodeAfter)?null:n.getNearestSelectionRange(i,"forward"),f=r.nodeBefore&&n.isSelectable(r.nodeBefore)?null:n.getNearestSelectionRange(r,"backward"),b=g?g.start:i,A=f?f.end:r;return new V(b,A)}}const d=l&&!l.is("rootElement"),u=c&&!c.is("rootElement");if(d||u){const g=i.nodeAfter&&r.nodeBefore&&i.nodeAfter.parent===r.nodeBefore.parent,f=d&&(!g||!Oh(i.nodeAfter,n)),b=u&&(!g||!Oh(r.nodeBefore,n));let A=i,E=r;return f&&(A=H._createBefore(Rh(l,n))),b&&(E=H._createAfter(Rh(c,n))),new V(A,E)}return null}(o,e)}function Rh(o,e){let t=o,n=t;for(;e.isLimit(n)&&n.parent;)t=n,n=n.parent;return t}function Oh(o,e){return o&&e.isSelectable(o)}class Oy extends ge(){constructor(e,t){super(),this.model=e,this.view=new dy(t),this.mapper=new sh,this.downcastDispatcher=new dh({mapper:this.mapper,schema:e.schema});const n=this.model.document,i=n.selection,r=this.model.markers;var s,a,l;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(n,"change",()=>{this.view.change(c=>{this.downcastDispatcher.convertChanges(n.differ,r,c),this.downcastDispatcher.convertSelection(i,r,c)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(c,d){return(u,g)=>{const f=g.newSelection,b=[];for(const E of f.getRanges())b.push(d.toModelRange(E));const A=c.createSelection(b,{backward:f.isBackward});A.isEqual(c.document.selection)||c.change(E=>{E.setSelection(A)})}}(this.model,this.mapper)),this.listenTo(this.view.document,"beforeinput",(s=this.mapper,a=this.model.schema,l=this.view,(c,d)=>{if(!l.document.isComposing||k.isAndroid)for(let u=0;u<d.targetRanges.length;u++){const g=d.targetRanges[u],f=s.toModelRange(g),b=Ph(f,a);b&&!b.isEqual(f)&&(d.targetRanges[u]=s.toViewRange(b))}}),{priority:"high"}),this.downcastDispatcher.on("insert:$text",(c,d,u)=>{if(!u.consumable.consume(d.item,c.name))return;const g=u.writer,f=u.mapper.toViewPosition(d.range.start),b=g.createText(d.item.data);g.insert(f,b)},{priority:"lowest"}),this.downcastDispatcher.on("insert",(c,d,u)=>{u.convertAttributes(d.item),d.reconversion||!d.item.is("element")||d.item.isEmpty||u.convertChildren(d.item)},{priority:"lowest"}),this.downcastDispatcher.on("remove",(c,d,u)=>{const g=u.mapper.toViewPosition(d.position),f=d.position.getShiftedBy(d.length),b=u.mapper.toViewPosition(f,{isPhantom:!0}),A=u.writer.createRange(g,b),E=u.writer.remove(A.getTrimmed());for(const P of u.writer.createRangeIn(E).getItems())u.mapper.unbindViewElement(P,{defer:!0})},{priority:"low"}),this.downcastDispatcher.on("selection",(c,d,u)=>{const g=u.writer,f=g.document.selection;for(const b of f.getRanges())b.isCollapsed&&b.end.parent.isAttached()&&u.writer.mergeAttributes(b.start);g.setSelection(null)},{priority:"high"}),this.downcastDispatcher.on("selection",(c,d,u)=>{const g=d.selection;if(g.isCollapsed||!u.consumable.consume(g,"selection"))return;const f=[];for(const b of g.getRanges())f.push(u.mapper.toViewRange(b));u.writer.setSelection(f,{backward:g.isBackward})},{priority:"low"}),this.downcastDispatcher.on("selection",(c,d,u)=>{const g=d.selection;if(!g.isCollapsed||!u.consumable.consume(g,"selection"))return;const f=u.writer,b=g.getFirstPosition(),A=u.mapper.toViewPosition(b),E=f.breakAttributes(A);f.setSelection(E)},{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(c=>{if(c.rootName=="$graveyard")return null;const d=new xd(this.view.document,c.name);return d.rootName=c.rootName,this.mapper.bindElements(c,d),d})}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){const t=typeof e=="string"?e:e.name,n=this.model.markers.get(t);if(!n)throw new I("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:t});this.model.change(()=>{this.model.markers._refresh(n)})}reconvertItem(e){this.model.change(()=>{this.model.document.differ._refreshItem(e)})}}class So{constructor(){this._consumables=new Map}add(e,t){let n;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?n=this._consumables.get(e):(n=new Ny(e),this._consumables.set(e,n)),n.add(t))}test(e,t){const n=this._consumables.get(e);return n===void 0?null:e.is("$text")||e.is("documentFragment")?n:n.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 n=this._consumables.get(e);n!==void 0&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):n.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},n=e.getAttributeKeys();for(const s of n)s!="style"&&s!="class"&&t.attributes.push(s);const i=e.getClassNames();for(const s of i)t.classes.push(s);const r=e.getStyleNames();for(const s of r)t.styles.push(s);return t}static createFrom(e,t){if(t||(t=new So),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,So.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const n of e.getChildren())t=So.createFrom(n,t);return t}}const xi=["attributes","classes","styles"];class Ny{constructor(e){this.element=e,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(e){e.name&&(this._canConsumeName=!0);for(const t of xi)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t of xi)if(t in e){const n=this._test(t,e[t]);if(n!==!0)return n}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t of xi)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t of xi)t in e&&this._revert(t,e[t])}_add(e,t){const n=We(t)?t:[t],i=this._consumables[e];for(const r of n){if(e==="attributes"&&(r==="class"||r==="style"))throw new I("viewconsumable-invalid-attribute",this);if(i.set(r,!0),e==="styles")for(const s of this.element.document.stylesProcessor.getRelatedStyles(r))i.set(s,!0)}}_test(e,t){const n=We(t)?t:[t],i=this._consumables[e];for(const r of n)if(e!=="attributes"||r!=="class"&&r!=="style"){const s=i.get(r);if(s===void 0)return null;if(!s)return!1}else{const s=r=="class"?"classes":"styles",a=this._test(s,[...this._consumables[s].keys()]);if(a!==!0)return a}return!0}_consume(e,t){const n=We(t)?t:[t],i=this._consumables[e];for(const r of n)if(e!=="attributes"||r!=="class"&&r!=="style"){if(i.set(r,!1),e=="styles")for(const s of this.element.document.stylesProcessor.getRelatedStyles(r))i.set(s,!1)}else{const s=r=="class"?"classes":"styles";this._consume(s,[...this._consumables[s].keys()])}}_revert(e,t){const n=We(t)?t:[t],i=this._consumables[e];for(const r of n)if(e!=="attributes"||r!=="class"&&r!=="style")i.get(r)===!1&&i.set(r,!0);else{const s=r=="class"?"classes":"styles";this._revert(s,[...this._consumables[s].keys()])}}}class zy extends ge(){constructor(){super(),this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new mn(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new mn(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new I("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 I("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=typeof e=="string"?e:"is"in e&&(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 n=this.getDefinition(e.last);return!!n&&n.allowAttributes.includes(t)}checkMerge(e,t){if(e instanceof H){const n=e.nodeBefore,i=e.nodeAfter;if(!(n instanceof ke))throw new I("schema-check-merge-no-element-before",this);if(!(i instanceof ke))throw new I("schema-check-merge-no-element-after",this);return this.checkMerge(n,i)}for(const n of t.getChildren())if(!this.checkChild(e,n))return!1;return!0}addChildCheck(e){this.on("checkChild",(t,[n,i])=>{if(!i)return;const r=e(n,i);typeof r=="boolean"&&(t.stop(),t.return=r)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(t,[n,i])=>{const r=e(n,i);typeof r=="boolean"&&(t.stop(),t.return=r)},{priority:"high"})}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;for(e instanceof H?t=e.parent:t=(e instanceof V?[e]:Array.from(e.getRanges())).reduce((n,i)=>{const r=i.getCommonAncestor();return n?n.getCommonAncestor(r,{includeSelf:!0}):r},null);!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const n=[...e.getFirstPosition().getAncestors(),new fe("",e.getAttributes())];return this.checkAttribute(n,t)}{const n=e.getRanges();for(const i of n)for(const r of i)if(this.checkAttribute(r.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(n){for(const i of n)yield*i.getMinimalFlatRanges()}(e);for(const n of e)yield*this._getValidRangesForRange(n,t)}getNearestSelectionRange(e,t="both"){if(this.checkChild(e,"$text"))return new V(e);let n,i;const r=e.getAncestors().reverse().find(s=>this.isLimit(s))||e.root;t!="both"&&t!="backward"||(n=new vt({boundaries:V._createIn(r),startPosition:e,direction:"backward"})),t!="both"&&t!="forward"||(i=new vt({boundaries:V._createIn(r),startPosition:e}));for(const s of function*(a,l){let c=!1;for(;!c;){if(c=!0,a){const d=a.next();d.done||(c=!1,yield{walker:a,value:d.value})}if(l){const d=l.next();d.done||(c=!1,yield{walker:l,value:d.value})}}}(n,i)){const a=s.walker==n?"elementEnd":"elementStart",l=s.value;if(l.type==a&&this.isObject(l.item))return V._createOn(l.item);if(this.checkChild(l.nextPosition,"$text"))return new V(l.nextPosition)}return null}findAllowedParent(e,t){let n=e.parent;for(;n;){if(this.checkChild(n,t))return n;if(this.isLimit(n))return null;n=n.parent}return null}setAllowedAttributes(e,t,n){const i=n.model;for(const[r,s]of Object.entries(t))i.schema.checkAttribute(e,r)&&n.setAttribute(r,s,e)}removeDisallowedAttributes(e,t){for(const n of e)if(n.is("$text"))Nh(this,n,t);else{const i=V._createIn(n).getPositions();for(const r of i)Nh(this,r.nodeBefore||r.parent,t)}}getAttributesWithProperty(e,t,n){const i={};for(const[r,s]of e.getAttributes()){const a=this.getAttributeProperties(r);a[t]!==void 0&&(n!==void 0&&n!==a[t]||(i[r]=s))}return i}createContext(e){return new mn(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,n=Object.keys(t);for(const i of n)e[i]=My(t[i],i);for(const i of n)Fy(e,i);for(const i of n)Vy(e,i);for(const i of n)Ly(e,i);for(const i of n)jy(e,i),$y(e,i);for(const i of n)Hy(e,i),qy(e,i),Uy(e,i);this._compiledDefinitions=e}_checkContextMatch(e,t,n=t.length-1){const i=t.getItem(n);if(e.allowIn.includes(i.name)){if(n==0)return!0;{const r=this.getDefinition(i);return this._checkContextMatch(r,t,n-1)}}return!1}*_getValidRangesForRange(e,t){let n=e.start,i=e.start;for(const r of e.getItems({shallow:!0}))r.is("element")&&(yield*this._getValidRangesForRange(V._createIn(r),t)),this.checkAttribute(r,t)||(n.isEqual(i)||(yield new V(n,i)),n=H._createAfter(r)),i=H._createAfter(r);n.isEqual(i)||(yield new V(n,i))}}class mn{constructor(e){if(e instanceof mn)return e;let t;t=typeof e=="string"?[e]:Array.isArray(e)?e:e.getAncestors({includeSelf:!0}),this._items=t.map(Ky)}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 mn([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 My(o,e){const t={name:e,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],allowChildren:[],inheritTypesFrom:[]};return function(n,i){for(const r of n){const s=Object.keys(r).filter(a=>a.startsWith("is"));for(const a of s)i[a]=!!r[a]}}(o,t),gn(o,t,"allowIn"),gn(o,t,"allowContentOf"),gn(o,t,"allowWhere"),gn(o,t,"allowAttributes"),gn(o,t,"allowAttributesOf"),gn(o,t,"allowChildren"),gn(o,t,"inheritTypesFrom"),function(n,i){for(const r of n){const s=r.inheritAllFrom;s&&(i.allowContentOf.push(s),i.allowWhere.push(s),i.allowAttributesOf.push(s),i.inheritTypesFrom.push(s))}}(o,t),t}function Fy(o,e){const t=o[e];for(const n of t.allowChildren){const i=o[n];i&&i.allowIn.push(e)}t.allowChildren.length=0}function Vy(o,e){for(const t of o[e].allowContentOf)o[t]&&Wy(o,t).forEach(n=>{n.allowIn.push(e)});delete o[e].allowContentOf}function Ly(o,e){for(const t of o[e].allowWhere){const n=o[t];if(n){const i=n.allowIn;o[e].allowIn.push(...i)}}delete o[e].allowWhere}function jy(o,e){for(const t of o[e].allowAttributesOf){const n=o[t];if(n){const i=n.allowAttributes;o[e].allowAttributes.push(...i)}}delete o[e].allowAttributesOf}function $y(o,e){const t=o[e];for(const n of t.inheritTypesFrom){const i=o[n];if(i){const r=Object.keys(i).filter(s=>s.startsWith("is"));for(const s of r)s in t||(t[s]=i[s])}}delete t.inheritTypesFrom}function Hy(o,e){const t=o[e],n=t.allowIn.filter(i=>o[i]);t.allowIn=Array.from(new Set(n))}function qy(o,e){const t=o[e];for(const n of t.allowIn)o[n].allowChildren.push(e)}function Uy(o,e){const t=o[e];t.allowAttributes=Array.from(new Set(t.allowAttributes))}function gn(o,e,t){for(const n of o){const i=n[t];typeof i=="string"?e[t].push(i):Array.isArray(i)&&e[t].push(...i)}}function Wy(o,e){const t=o[e];return(n=o,Object.keys(n).map(i=>n[i])).filter(i=>i.allowIn.includes(t.name));var n}function Ky(o){return typeof o=="string"||o.is("documentFragment")?{name:typeof o=="string"?o:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:o.is("element")?o.name:"$text",*getAttributeKeys(){yield*o.getAttributeKeys()},getAttribute:e=>o.getAttribute(e)}}function Nh(o,e,t){for(const n of e.getAttributeKeys())o.checkAttribute(e,n)||t.removeAttribute(n,e)}var Gy=Object.defineProperty,Zy=Object.defineProperties,Jy=Object.getOwnPropertyDescriptors,zh=Object.getOwnPropertySymbols,Yy=Object.prototype.hasOwnProperty,Qy=Object.prototype.propertyIsEnumerable,Mh=(o,e,t)=>e in o?Gy(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;class Xy extends me(){constructor(e){var t;super(),this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this._emptyElementsToKeep=new Set,this.conversionApi=(t=((n,i)=>{for(var r in i||(i={}))Yy.call(i,r)&&Mh(n,r,i[r]);if(zh)for(var r of zh(i))Qy.call(i,r)&&Mh(n,r,i[r]);return n})({},e),Zy(t,Jy({consumable:null,writer:null,store:null,convertItem:(n,i)=>this._convertItem(n,i),convertChildren:(n,i)=>this._convertChildren(n,i),safeInsert:(n,i)=>this._safeInsert(n,i),updateConversionResult:(n,i)=>this._updateConversionResult(n,i),splitToAllowedParent:(n,i)=>this._splitToAllowedParent(n,i),getSplitParts:n=>this._getSplitParts(n),keepEmptyElement:n=>this._keepEmptyElement(n)})))}convert(e,t,n=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(s,a){let l;for(const c of new mn(s)){const d={};for(const g of c.getAttributeKeys())d[g]=c.getAttribute(g);const u=a.createElement(c.name,d);l&&a.insert(u,l),l=H._createAt(u,0)}return l}(n,t),this.conversionApi.writer=t,this.conversionApi.consumable=So.createFrom(e),this.conversionApi.store={};const{modelRange:i}=this._convertItem(e,this._modelCursor),r=t.createDocumentFragment();if(i){this._removeEmptyElements();for(const s of Array.from(this._modelCursor.parent.getChildren()))t.append(s,r);r.markers=function(s,a){const l=new Set,c=new Map,d=V._createIn(s).getItems();for(const u of d)u.is("element","$marker")&&l.add(u);for(const u of l){const g=u.getAttribute("data-name"),f=a.createPositionBefore(u);c.has(g)?c.get(g).end=f.clone():c.set(g,new V(f.clone())),a.remove(u)}return c}(r,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,r}_convertItem(e,t){const n={viewItem:e,modelCursor:t,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,n,this.conversionApi):e.is("$text")?this.fire("text",n,this.conversionApi):this.fire("documentFragment",n,this.conversionApi),n.modelRange&&!(n.modelRange instanceof V))throw new I("view-conversion-dispatcher-incorrect-result",this);return{modelRange:n.modelRange,modelCursor:n.modelCursor}}_convertChildren(e,t){let n=t.is("position")?t:H._createAt(t,0);const i=new V(n);for(const r of Array.from(e.getChildren())){const s=this._convertItem(r,n);s.modelRange instanceof V&&(i.end=s.modelRange.end,n=s.modelCursor)}return{modelRange:i,modelCursor:n}}_safeInsert(e,t){const n=this._splitToAllowedParent(e,t);return!!n&&(this.conversionApi.writer.insert(e,n.position),!0)}_updateConversionResult(e,t){const n=this._getSplitParts(e),i=this.conversionApi.writer;t.modelRange||(t.modelRange=i.createRange(i.createPositionBefore(e),i.createPositionAfter(n[n.length-1])));const r=this._cursorParents.get(e);t.modelCursor=r?i.createPositionAt(r,0):t.modelRange.end}_splitToAllowedParent(e,t){const{schema:n,writer:i}=this.conversionApi;let r=n.findAllowedParent(t,e);if(r){if(r===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(r)&&(r=null)}if(!r)return yh(t,e,n)?{position:Eh(t,i)}:null;const s=this.conversionApi.writer.split(t,r),a=[];for(const c of s.range.getWalker())if(c.type=="elementEnd")a.push(c.item);else{const d=a.pop(),u=c.item;this._registerSplitPair(d,u)}const l=s.range.end.parent;return this._cursorParents.set(e,l),{position:s.position,cursorParent:l}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const n=this._splitParts.get(e);this._splitParts.set(t,n),n.push(t)}_getSplitParts(e){let t;return t=this._splitParts.has(e)?this._splitParts.get(e):[e],t}_keepEmptyElement(e){this._emptyElementsToKeep.add(e)}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&!this._emptyElementsToKeep.has(t)&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}class e1{getHtml(e){const t=document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}class t1{constructor(e){this.skipComments=!0,this.domParser=new DOMParser,this.domConverter=new $d(e,{renderingMode:"data"}),this.htmlWriter=new e1}toData(e){const t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this.domConverter.domToView(t,{skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e)}useFillerType(e){this.domConverter.blockFillerMode=e=="marked"?"markedNbsp":"nbsp"}_toDom(e){e.match(/<(?:html|body|head|meta)(?:\s[^>]*)?>/i)||(e=`<body>${e}</body>`);const t=this.domParser.parseFromString(e,"text/html"),n=t.createDocumentFragment(),i=t.body.childNodes;for(;i.length>0;)n.appendChild(i[0]);return n}}class n1 extends me(){constructor(e,t){super(),this.model=e,this.mapper=new sh,this.downcastDispatcher=new dh({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",(n,i,r)=>{if(!r.consumable.consume(i.item,n.name))return;const s=r.writer,a=r.mapper.toViewPosition(i.range.start),l=s.createText(i.item.data);s.insert(a,l)},{priority:"lowest"}),this.downcastDispatcher.on("insert",(n,i,r)=>{r.convertAttributes(i.item),i.reconversion||!i.item.is("element")||i.item.isEmpty||r.convertChildren(i.item)},{priority:"lowest"}),this.upcastDispatcher=new Xy({schema:e.schema}),this.viewDocument=new Dd(t),this.stylesProcessor=t,this.htmlProcessor=new t1(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new Bd(this.viewDocument),this.upcastDispatcher.on("text",(n,i,{schema:r,consumable:s,writer:a})=>{let l=i.modelCursor;if(!s.test(i.viewItem))return;if(!r.checkChild(l,"$text")){if(!yh(l,"$text",r)||i.viewItem.data.trim().length==0)return;const d=l.nodeBefore;l=Eh(l,a),d&&d.is("element","$marker")&&(a.move(a.createRangeOn(d),l),l=a.createPositionAfter(d))}s.consume(i.viewItem);const c=a.createText(i.viewItem.data);a.insert(c,l),i.modelRange=a.createRange(l,l.getShiftedBy(c.offsetSize)),i.modelCursor=i.modelRange.end},{priority:"lowest"}),this.upcastDispatcher.on("element",(n,i,r)=>{if(!i.modelRange&&r.consumable.consume(i.viewItem,{name:!0})){const{modelRange:s,modelCursor:a}=r.convertChildren(i.viewItem,i.modelCursor);i.modelRange=s,i.modelCursor=a}},{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",(n,i,r)=>{if(!i.modelRange&&r.consumable.consume(i.viewItem,{name:!0})){const{modelRange:s,modelCursor:a}=r.convertChildren(i.viewItem,i.modelCursor);i.modelRange=s,i.modelCursor=a}},{priority:"lowest"}),ge().prototype.decorate.call(this,"init"),ge().prototype.decorate.call(this,"set"),ge().prototype.decorate.call(this,"get"),ge().prototype.decorate.call(this,"toView"),ge().prototype.decorate.call(this,"toModel"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange({isUndoable:!1},vh)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:n="empty"}=e;if(!this._checkIfRootsExists([t]))throw new I("datacontroller-get-non-existent-root",this);const i=this.model.document.getRoot(t);return i.isAttached()||Q("datacontroller-get-detached-root",this),n!=="empty"||this.model.hasContent(i,{ignoreWhitespaces:!0})?this.stringify(i,e):""}stringify(e,t={}){const n=this.toView(e,t);return this.processor.toData(n)}toView(e,t={}){const n=this.viewDocument,i=this._viewWriter;this.mapper.clearBindings();const r=V._createIn(e),s=new dn(n);this.mapper.bindElements(e,s);const a=e.is("documentFragment")?e.markers:function(l){const c=[],d=l.root.document;if(!d)return new Map;const u=V._createIn(l);for(const g of d.model.markers){const f=g.getRange(),b=f.isCollapsed,A=f.start.isEqual(u.start)||f.end.isEqual(u.end);if(b&&A)c.push([g.name,f]);else{const E=u.getIntersection(f);E&&c.push([g.name,E])}}return c.sort(([g,f],[b,A])=>{if(f.end.compareWith(A.start)!=="after")return 1;if(f.start.compareWith(A.end)!=="before")return-1;switch(f.start.compareWith(A.start)){case"before":return 1;case"after":return-1;default:switch(f.end.compareWith(A.end)){case"before":return 1;case"after":return-1;default:return b.localeCompare(g)}}}),new Map(c)}(e);return this.downcastDispatcher.convert(r,a,i,t),s}init(e){if(this.model.document.version)throw new I("datacontroller-init-document-not-empty",this);let t={};if(typeof e=="string"?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new I("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},n=>{for(const i of Object.keys(t)){const r=this.model.document.getRoot(i);n.insert(this.parse(t[i],r),r,0)}}),Promise.resolve()}set(e,t={}){let n={};if(typeof e=="string"?n.main=e:n=e,!this._checkIfRootsExists(Object.keys(n)))throw new I("datacontroller-set-non-existent-root",this);this.model.enqueueChange(t.batchType||{},i=>{i.setSelection(null),i.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const r of Object.keys(n)){const s=this.model.document.getRoot(r);i.remove(i.createRangeIn(s)),i.insert(this.parse(n[r],s),s,0)}})}parse(e,t="$root"){const n=this.processor.toView(e);return this.toModel(n,t)}toModel(e,t="$root"){return this.model.change(n=>this.upcastDispatcher.convert(e,n,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRoot(t))return!1;return!0}}class o1{constructor(e,t){this._helpers=new Map,this._downcast=Pe(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=Pe(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const n=this._downcast.includes(t);if(!this._upcast.includes(t)&&!n)throw new I("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:n})}for(e){if(!this._helpers.has(e))throw new I("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:n}of Bs(e))this.for("upcast").elementToElement({model:t,view:n,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:n}of Bs(e))this.for("upcast").elementToAttribute({view:n,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:n}of Bs(e))this.for("upcast").attributeToAttribute({view:n,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:n}){if(this._helpers.has(e))throw new I("conversion-group-exists",this);const i=n?new yy(t):new Py(t);this._helpers.set(e,i)}}function*Bs(o){if(o.model.values)for(const e of o.model.values){const t={key:o.model.key,value:e},n=o.view[e],i=o.upcastAlso?o.upcastAlso[e]:void 0;yield*Fh(t,n,i)}else yield*Fh(o.model,o.view,o.upcastAlso)}function*Fh(o,e,t){if(yield{model:o,view:e},t)for(const n of Pe(t))yield{model:o,view:n}}class ot{constructor(e){this.baseVersion=e,this.isDocumentOperation=this.baseVersion!==null,this.batch=null}_validate(){}toJSON(){const e=Object.assign({},this);return e.__className=this.constructor.className,delete e.batch,delete e.isDocumentOperation,e}static get className(){return"Operation"}static fromJSON(e,t){return new this(e.baseVersion)}}function Ts(o,e){const t=Lh(e),n=t.reduce((s,a)=>s+a.offsetSize,0),i=o.parent;To(o);const r=o.index;return i._insertChild(r,t),Bo(i,r+t.length),Bo(i,r),new V(o,o.getShiftedBy(n))}function Vh(o){if(!o.isFlat)throw new I("operation-utils-remove-range-not-flat",this);const e=o.start.parent;To(o.start),To(o.end);const t=e._removeChildren(o.start.index,o.end.index-o.start.index);return Bo(e,o.start.index),t}function Do(o,e){if(!o.isFlat)throw new I("operation-utils-move-range-not-flat",this);const t=Vh(o);return Ts(e=e._getTransformedByDeletion(o.start,o.end.offset-o.start.offset),t)}function Lh(o){const e=[];(function t(n){if(typeof n=="string")e.push(new fe(n));else if(n instanceof ut)e.push(new fe(n.data,n.getAttributes()));else if(n instanceof hn)e.push(n);else if(Xe(n))for(const i of n)t(i)})(o);for(let t=1;t<e.length;t++){const n=e[t],i=e[t-1];n instanceof fe&&i instanceof fe&&jh(n,i)&&(e.splice(t-1,2,new fe(i.data+n.data,i.getAttributes())),t--)}return e}function Bo(o,e){const t=o.getChild(e-1),n=o.getChild(e);if(t&&n&&t.is("$text")&&n.is("$text")&&jh(t,n)){const i=new fe(t.data+n.data,t.getAttributes());o._removeChildren(e-1,2),o._insertChild(e-1,i)}}function To(o){const e=o.textNode,t=o.parent;if(e){const n=o.offset-e.startOffset,i=e.index;t._removeChildren(i,1);const r=new fe(e.data.substr(0,n),e.getAttributes()),s=new fe(e.data.substr(n),e.getAttributes());t._insertChild(i,[r,s])}}function jh(o,e){const t=o.getAttributes(),n=e.getAttributes();for(const i of t){if(i[1]!==e.getAttribute(i[0]))return!1;n.next()}return n.next().done}class ce extends ot{constructor(e,t,n,i){super(i),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNone"}get type(){return this.targetPosition.root.rootName=="$graveyard"?"remove":this.sourcePosition.root.rootName=="$graveyard"?"reinsert":"move"}get affectedSelectable(){return[V._createFromPositionAndShift(this.sourcePosition,this.howMany),V._createFromPositionAndShift(this.targetPosition,0)]}clone(){return new ce(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 ce(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,n=this.sourcePosition.offset,i=this.targetPosition.offset;if(n+this.howMany>e.maxOffset)throw new I("move-operation-nodes-do-not-exist",this);if(e===t&&n<i&&i<n+this.howMany)throw new I("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&Ue(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())=="prefix"){const r=this.sourcePosition.path.length-1;if(this.targetPosition.path[r]>=n&&this.targetPosition.path[r]<n+this.howMany)throw new I("move-operation-node-into-itself",this)}}_execute(){Do(V._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 n=H.fromJSON(e.sourcePosition,t),i=H.fromJSON(e.targetPosition,t);return new this(n,e.howMany,i,e.baseVersion)}}class $e extends ot{constructor(e,t,n){super(n),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new yo(Lh(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){const e=new yo([...this.nodes].map(n=>n._clone(!0))),t=new $e(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new H(e,[0]);return new ce(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new I("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new yo([...e].map(t=>t._clone(!0))),Ts(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 n=[];for(const r of e.nodes)r.name?n.push(ke.fromJSON(r)):n.push(fe.fromJSON(r));const i=new $e(H.fromJSON(e.position,t),n,e.baseVersion);return i.shouldReceiveAttributes=e.shouldReceiveAttributes,i}}class be extends ot{constructor(e,t,n,i,r){super(r),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=n,this.graveyardPosition=i?i.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 H(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new V(this.splitPosition,e)}get affectedSelectable(){const e=[V._createFromPositionAndShift(this.splitPosition,0),V._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(V._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new be(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new H(e,[0]);return new Re(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset<t)throw new I("split-operation-position-invalid",this);if(!e.parent)throw new I("split-operation-split-in-root",this);if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new I("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new I("split-operation-graveyard-position-invalid",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)Do(V._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const t=e._clone();Ts(this.insertionPosition,t)}Do(new V(H._createAt(e,this.splitPosition.offset),H._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 H(e.root,t,"toPrevious")}static fromJSON(e,t){const n=H.fromJSON(e.splitPosition,t),i=H.fromJSON(e.insertionPosition,t),r=e.graveyardPosition?H.fromJSON(e.graveyardPosition,t):null;return new this(n,e.howMany,i,r,e.baseVersion)}}class Re extends ot{constructor(e,t,n,i,r){super(r),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=i.clone()}get type(){return"merge"}get deletionPosition(){return new H(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new V(this.sourcePosition,e)}get affectedSelectable(){const e=this.sourcePosition.parent;return[V._createOn(e),V._createFromPositionAndShift(this.targetPosition,0),V._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new Re(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),n=new H(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new be(e,this.howMany,n,this.graveyardPosition,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new I("merge-operation-source-position-invalid",this);if(!t.parent)throw new I("merge-operation-target-position-invalid",this);if(this.howMany!=e.maxOffset)throw new I("merge-operation-how-many-invalid",this)}_execute(){const e=this.sourcePosition.parent;Do(V._createIn(e),this.targetPosition),Do(V._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 n=H.fromJSON(e.sourcePosition,t),i=H.fromJSON(e.targetPosition,t),r=H.fromJSON(e.graveyardPosition,t);return new this(n,e.howMany,i,r,e.baseVersion)}}class Ge extends ot{constructor(e,t,n,i,r,s){super(s),this.name=e,this.oldRange=t?t.clone():null,this.newRange=n?n.clone():null,this.affectsData=r,this._markers=i}get type(){return"marker"}get affectedSelectable(){const e=[];return this.oldRange&&e.push(this.oldRange.clone()),this.newRange&&(this.oldRange?e.push(...this.newRange.getDifference(this.oldRange)):e.push(this.newRange.clone())),e}clone(){return new Ge(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Ge(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){this.newRange?this._markers._set(this.name,this.newRange,!0,this.affectsData):this._markers._remove(this.name)}toJSON(){const e=super.toJSON();return this.oldRange&&(e.oldRange=this.oldRange.toJSON()),this.newRange&&(e.newRange=this.newRange.toJSON()),delete e._markers,e}static get className(){return"MarkerOperation"}static fromJSON(e,t){return new Ge(e.name,e.oldRange?V.fromJSON(e.oldRange,t):null,e.newRange?V.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}const Si=function(o,e){return Xd(o,e)};class Me extends ot{constructor(e,t,n,i,r){super(r),this.range=e.clone(),this.key=t,this.oldValue=n===void 0?null:n,this.newValue=i===void 0?null:i}get type(){return this.oldValue===null?"addAttribute":this.newValue===null?"removeAttribute":"changeAttribute"}get affectedSelectable(){return this.range.clone()}clone(){return new Me(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Me(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 I("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(this.oldValue!==null&&!Si(e.getAttribute(this.key),this.oldValue))throw new I("attribute-operation-wrong-old-value",this,{item:e,key:this.key,value:this.oldValue});if(this.oldValue===null&&this.newValue!==null&&e.hasAttribute(this.key))throw new I("attribute-operation-attribute-exists",this,{node:e,key:this.key})}}_execute(){Si(this.oldValue,this.newValue)||function(e,t,n){To(e.start),To(e.end);for(const i of e.getItems({shallow:!0})){const r=i.is("$textProxy")?i.textNode:i;n!==null?r._setAttribute(t,n):r._removeAttribute(t),Bo(r.parent,r.index)}Bo(e.end.parent,e.end.index)}(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new Me(V.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}class je extends ot{get type(){return"noop"}get affectedSelectable(){return null}clone(){return new je(this.baseVersion)}getReversed(){return new je(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}class Ze extends ot{constructor(e,t,n,i){super(i),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=n}get type(){return"rename"}get affectedSelectable(){return this.position.nodeAfter}clone(){return new Ze(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Ze(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof ke))throw new I("rename-operation-wrong-position",this);if(e.name!==this.oldName)throw new I("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 Ze(H.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class Tt extends ot{constructor(e,t,n,i,r){super(r),this.root=e,this.key=t,this.oldValue=n===void 0?null:n,this.newValue=i===void 0?null:i}get type(){return this.oldValue===null?"addRootAttribute":this.newValue===null?"removeRootAttribute":"changeRootAttribute"}get affectedSelectable(){return this.root}clone(){return new Tt(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Tt(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new I("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(this.oldValue!==null&&this.root.getAttribute(this.key)!==this.oldValue)throw new I("rootattribute-operation-wrong-old-value",this,{root:this.root,key:this.key});if(this.oldValue===null&&this.newValue!==null&&this.root.hasAttribute(this.key))throw new I("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){this.newValue!==null?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return"RootAttributeOperation"}static fromJSON(e,t){if(!t.getRoot(e.root))throw new I("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new Tt(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class yt extends ot{constructor(e,t,n,i,r){super(r),this.rootName=e,this.elementName=t,this.isAdd=n,this._document=i,!this._document.getRoot(this.rootName)&&(this._document.createRoot(this.elementName,this.rootName)._isAttached=!1)}get type(){return this.isAdd?"addRoot":"detachRoot"}get affectedSelectable(){return this._document.getRoot(this.rootName)}clone(){return new yt(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new yt(this.rootName,this.elementName,!this.isAdd,this._document,this.baseVersion+1)}_validate(){const e=this._document.getRoot(this.rootName);if(e.isAttached()&&this.isAdd)throw new I("root-operation-root-attached",this);if(!e.isAttached()&&!this.isAdd)throw new I("root-operation-root-detached",this)}_execute(){this._document.getRoot(this.rootName)._isAttached=this.isAdd}toJSON(){const e=super.toJSON();return delete e._document,e}static get className(){return"RootOperation"}static fromJSON(e,t){return new yt(e.rootName,e.elementName,e.isAdd,t,e.baseVersion)}}const lt={};lt[Me.className]=Me,lt[$e.className]=$e,lt[Ge.className]=Ge,lt[ce.className]=ce,lt[je.className]=je,lt[ot.className]=ot,lt[Ze.className]=Ze,lt[Tt.className]=Tt,lt[yt.className]=yt,lt[be.className]=be,lt[Re.className]=Re;class i1{static fromJSON(e,t){return lt[e.__className].fromJSON(e,t)}}const Is=new Map;function ae(o,e,t){let n=Is.get(o);n||(n=new Map,Is.set(o,n)),n.set(e,t)}function r1(o){return[o]}function $h(o,e,t={}){const n=function(i,r){const s=Is.get(i);return s&&s.has(r)?s.get(r):r1}(o.constructor,e.constructor);try{return n(o=o.clone(),e,t)}catch(i){throw i}}function s1(o,e,t){o=o.slice(),e=e.slice();const n=new a1(t.document,t.useRelations,t.forceWeakRemove);n.setOriginalOperations(o),n.setOriginalOperations(e);const i=n.originalOperations;if(o.length==0||e.length==0)return{operationsA:o,operationsB:e,originalOperations:i};const r=new WeakMap;for(const l of o)r.set(l,0);const s={nextBaseVersionA:o[o.length-1].baseVersion+1,nextBaseVersionB:e[e.length-1].baseVersion+1,originalOperationsACount:o.length,originalOperationsBCount:e.length};let a=0;for(;a<o.length;){const l=o[a],c=r.get(l);if(c==e.length){a++;continue}const d=e[c],u=$h(l,d,n.getContext(l,d,!0)),g=$h(d,l,n.getContext(d,l,!1));n.updateRelation(l,d),n.setOriginalOperations(u,l),n.setOriginalOperations(g,d);for(const f of u)r.set(f,c+g.length);o.splice(a,1,...u),e.splice(c,1,...g)}return Hh(o,s.nextBaseVersionB),Hh(e,s.nextBaseVersionA),{operationsA:o,operationsB:e,originalOperations:i}}class a1{constructor(e,t,n=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!n,this._relations=new Map}setOriginalOperations(e,t=null){const n=t?this.originalOperations.get(t):null;for(const i of e)this.originalOperations.set(i,n||i)}updateRelation(e,t){if(e instanceof ce)t instanceof Re?e.targetPosition.isEqual(t.sourcePosition)||t.movedRange.containsPosition(e.targetPosition)?this._setRelation(e,t,"insertAtSource"):e.targetPosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"insertBetween"):e.targetPosition.isAfter(t.sourcePosition)&&this._setRelation(e,t,"moveTargetAfter"):t instanceof ce&&(e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter"));else if(e instanceof be){if(t instanceof Re)e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");else if(t instanceof ce)if(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))this._setRelation(e,t,"splitBefore");else{const n=V._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.splitPosition)){const i=n.end.offset-e.splitPosition.offset,r=e.splitPosition.offset-n.start.offset;this._setRelation(e,t,{howMany:i,offset:r})}}}else if(e instanceof Re)t instanceof Re?(e.targetPosition.isEqual(t.sourcePosition)||this._setRelation(e,t,"mergeTargetNotMoved"),e.sourcePosition.isEqual(t.targetPosition)&&this._setRelation(e,t,"mergeSourceNotMoved"),e.sourcePosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeSameElement")):t instanceof be&&e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource");else if(e instanceof Ge){const n=e.newRange;if(!n)return;if(t instanceof ce){const i=V._createFromPositionAndShift(t.sourcePosition,t.howMany),r=i.containsPosition(n.start)||i.start.isEqual(n.start),s=i.containsPosition(n.end)||i.end.isEqual(n.end);!r&&!s||i.containsRange(n)||this._setRelation(e,t,{side:r?"left":"right",path:r?n.start.path.slice():n.end.path.slice()})}else if(t instanceof Re){const i=n.start.isEqual(t.targetPosition),r=n.start.isEqual(t.deletionPosition),s=n.end.isEqual(t.deletionPosition),a=n.end.isEqual(t.sourcePosition);(i||r||s||a)&&this._setRelation(e,t,{wasInLeftElement:i,wasStartBeforeMergedElement:r,wasEndBeforeMergedElement:s,wasInRightElement:a})}}}getContext(e,t,n){return{aIsStrong:n,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 n=this.originalOperations.get(t),i=this._history.getUndoneOperation(n);if(!i)return null;const r=this.originalOperations.get(e),s=this._relations.get(r);return s&&s.get(i)||null}_setRelation(e,t,n){const i=this.originalOperations.get(e),r=this.originalOperations.get(t);let s=this._relations.get(i);s||(s=new Map,this._relations.set(i,s)),s.set(r,n)}}function Hh(o,e){for(const t of o)t.baseVersion=e++}function qh(o,e,t){const n=o.nodes.getNode(0).getAttribute(e);if(n==t)return null;const i=new V(o.position,o.position.getShiftedBy(o.howMany));return new Me(i,e,n,t,0)}function Uh(o,e){return o.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany)===null}function jn(o,e){const t=[];for(let n=0;n<o.length;n++){const i=o[n],r=new ce(i.start,i.end.offset-i.start.offset,e,0);t.push(r);for(let s=n+1;s<o.length;s++)o[s]=o[s]._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)[0];e=e._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)}return t}ae(Me,Me,(o,e,t)=>{if(o.key===e.key&&o.range.start.hasSameParentAs(e.range.start)){const n=o.range.getDifference(e.range).map(r=>new Me(r,o.key,o.oldValue,o.newValue,0)),i=o.range.getIntersection(e.range);return i&&t.aIsStrong&&n.push(new Me(i,e.key,e.newValue,o.newValue,0)),n.length==0?[new je(0)]:n}return[o]}),ae(Me,$e,(o,e)=>{if(o.range.start.hasSameParentAs(e.position)&&o.range.containsPosition(e.position)){const t=o.range._getTransformedByInsertion(e.position,e.howMany,!e.shouldReceiveAttributes).map(n=>new Me(n,o.key,o.oldValue,o.newValue,o.baseVersion));if(e.shouldReceiveAttributes){const n=qh(e,o.key,o.oldValue);n&&t.unshift(n)}return t}return o.range=o.range._getTransformedByInsertion(e.position,e.howMany,!1)[0],[o]}),ae(Me,Re,(o,e)=>{const t=[];o.range.start.hasSameParentAs(e.deletionPosition)&&(o.range.containsPosition(e.deletionPosition)||o.range.start.isEqual(e.deletionPosition))&&t.push(V._createFromPositionAndShift(e.graveyardPosition,1));const n=o.range._getTransformedByMergeOperation(e);return n.isCollapsed||t.push(n),t.map(i=>new Me(i,o.key,o.oldValue,o.newValue,o.baseVersion))}),ae(Me,ce,(o,e)=>function(n,i){const r=V._createFromPositionAndShift(i.sourcePosition,i.howMany);let s=null,a=[];r.containsRange(n,!0)?s=n:n.start.hasSameParentAs(r.start)?(a=n.getDifference(r),s=n.getIntersection(r)):a=[n];const l=[];for(let c of a){c=c._getTransformedByDeletion(i.sourcePosition,i.howMany);const d=i.getMovedRangeStart(),u=c.start.hasSameParentAs(d),g=c._getTransformedByInsertion(d,i.howMany,u);l.push(...g)}return s&&l.push(s._getTransformedByMove(i.sourcePosition,i.targetPosition,i.howMany,!1)[0]),l}(o.range,e).map(n=>new Me(n,o.key,o.oldValue,o.newValue,o.baseVersion))),ae(Me,be,(o,e)=>{if(o.range.end.isEqual(e.insertionPosition))return e.graveyardPosition||o.range.end.offset++,[o];if(o.range.start.hasSameParentAs(e.splitPosition)&&o.range.containsPosition(e.splitPosition)){const t=o.clone();return t.range=new V(e.moveTargetPosition.clone(),o.range.end._getCombined(e.splitPosition,e.moveTargetPosition)),o.range.end=e.splitPosition.clone(),o.range.end.stickiness="toPrevious",[o,t]}return o.range=o.range._getTransformedBySplitOperation(e),[o]}),ae($e,Me,(o,e)=>{const t=[o];if(o.shouldReceiveAttributes&&o.position.hasSameParentAs(e.range.start)&&e.range.containsPosition(o.position)){const n=qh(o,e.key,e.newValue);n&&t.push(n)}return t}),ae($e,$e,(o,e,t)=>(o.position.isEqual(e.position)&&t.aIsStrong||(o.position=o.position._getTransformedByInsertOperation(e)),[o])),ae($e,ce,(o,e)=>(o.position=o.position._getTransformedByMoveOperation(e),[o])),ae($e,be,(o,e)=>(o.position=o.position._getTransformedBySplitOperation(e),[o])),ae($e,Re,(o,e)=>(o.position=o.position._getTransformedByMergeOperation(e),[o])),ae(Ge,$e,(o,e)=>(o.oldRange&&(o.oldRange=o.oldRange._getTransformedByInsertOperation(e)[0]),o.newRange&&(o.newRange=o.newRange._getTransformedByInsertOperation(e)[0]),[o])),ae(Ge,Ge,(o,e,t)=>{if(o.name==e.name){if(!t.aIsStrong)return[new je(0)];o.oldRange=e.newRange?e.newRange.clone():null}return[o]}),ae(Ge,Re,(o,e)=>(o.oldRange&&(o.oldRange=o.oldRange._getTransformedByMergeOperation(e)),o.newRange&&(o.newRange=o.newRange._getTransformedByMergeOperation(e)),[o])),ae(Ge,ce,(o,e,t)=>{if(o.oldRange&&(o.oldRange=V._createFromRanges(o.oldRange._getTransformedByMoveOperation(e))),o.newRange){if(t.abRelation){const n=V._createFromRanges(o.newRange._getTransformedByMoveOperation(e));if(t.abRelation.side=="left"&&e.targetPosition.isEqual(o.newRange.start))return o.newRange.end=n.end,o.newRange.start.path=t.abRelation.path,[o];if(t.abRelation.side=="right"&&e.targetPosition.isEqual(o.newRange.end))return o.newRange.start=n.start,o.newRange.end.path=t.abRelation.path,[o]}o.newRange=V._createFromRanges(o.newRange._getTransformedByMoveOperation(e))}return[o]}),ae(Ge,be,(o,e,t)=>{if(o.oldRange&&(o.oldRange=o.oldRange._getTransformedBySplitOperation(e)),o.newRange){if(t.abRelation){const n=o.newRange._getTransformedBySplitOperation(e);return o.newRange.start.isEqual(e.splitPosition)&&t.abRelation.wasStartBeforeMergedElement?o.newRange.start=H._createAt(e.insertionPosition):o.newRange.start.isEqual(e.splitPosition)&&!t.abRelation.wasInLeftElement&&(o.newRange.start=H._createAt(e.moveTargetPosition)),o.newRange.end.isEqual(e.splitPosition)&&t.abRelation.wasInRightElement?o.newRange.end=H._createAt(e.moveTargetPosition):o.newRange.end.isEqual(e.splitPosition)&&t.abRelation.wasEndBeforeMergedElement?o.newRange.end=H._createAt(e.insertionPosition):o.newRange.end=n.end,[o]}o.newRange=o.newRange._getTransformedBySplitOperation(e)}return[o]}),ae(Re,$e,(o,e)=>(o.sourcePosition.hasSameParentAs(e.position)&&(o.howMany+=e.howMany),o.sourcePosition=o.sourcePosition._getTransformedByInsertOperation(e),o.targetPosition=o.targetPosition._getTransformedByInsertOperation(e),[o])),ae(Re,Re,(o,e,t)=>{if(o.sourcePosition.isEqual(e.sourcePosition)&&o.targetPosition.isEqual(e.targetPosition)){if(t.bWasUndone){const n=e.graveyardPosition.path.slice();return n.push(0),o.sourcePosition=new H(e.graveyardPosition.root,n),o.howMany=0,[o]}return[new je(0)]}if(o.sourcePosition.isEqual(e.sourcePosition)&&!o.targetPosition.isEqual(e.targetPosition)&&!t.bWasUndone&&t.abRelation!="splitAtSource"){const n=o.targetPosition.root.rootName=="$graveyard",i=e.targetPosition.root.rootName=="$graveyard";if(i&&!n||!(n&&!i)&&t.aIsStrong){const r=e.targetPosition._getTransformedByMergeOperation(e),s=o.targetPosition._getTransformedByMergeOperation(e);return[new ce(r,o.howMany,s,0)]}return[new je(0)]}return o.sourcePosition.hasSameParentAs(e.targetPosition)&&(o.howMany+=e.howMany),o.sourcePosition=o.sourcePosition._getTransformedByMergeOperation(e),o.targetPosition=o.targetPosition._getTransformedByMergeOperation(e),o.graveyardPosition.isEqual(e.graveyardPosition)&&t.aIsStrong||(o.graveyardPosition=o.graveyardPosition._getTransformedByMergeOperation(e)),[o]}),ae(Re,ce,(o,e,t)=>{const n=V._createFromPositionAndShift(e.sourcePosition,e.howMany);return e.type=="remove"&&!t.bWasUndone&&!t.forceWeakRemove&&o.deletionPosition.hasSameParentAs(e.sourcePosition)&&n.containsPosition(o.sourcePosition)?[new je(0)]:(o.sourcePosition.hasSameParentAs(e.targetPosition)&&(o.howMany+=e.howMany),o.sourcePosition.hasSameParentAs(e.sourcePosition)&&(o.howMany-=e.howMany),o.sourcePosition=o.sourcePosition._getTransformedByMoveOperation(e),o.targetPosition=o.targetPosition._getTransformedByMoveOperation(e),o.graveyardPosition.isEqual(e.targetPosition)||(o.graveyardPosition=o.graveyardPosition._getTransformedByMoveOperation(e)),[o])}),ae(Re,be,(o,e,t)=>{if(e.graveyardPosition&&(o.graveyardPosition=o.graveyardPosition._getTransformedByDeletion(e.graveyardPosition,1),o.deletionPosition.isEqual(e.graveyardPosition)&&(o.howMany=e.howMany)),o.targetPosition.isEqual(e.splitPosition)){const n=e.howMany!=0,i=e.graveyardPosition&&o.deletionPosition.isEqual(e.graveyardPosition);if(n||i||t.abRelation=="mergeTargetNotMoved")return o.sourcePosition=o.sourcePosition._getTransformedBySplitOperation(e),[o]}if(o.sourcePosition.isEqual(e.splitPosition)){if(t.abRelation=="mergeSourceNotMoved")return o.howMany=0,o.targetPosition=o.targetPosition._getTransformedBySplitOperation(e),[o];if(t.abRelation=="mergeSameElement"||o.sourcePosition.offset>0)return o.sourcePosition=e.moveTargetPosition.clone(),o.targetPosition=o.targetPosition._getTransformedBySplitOperation(e),[o]}return o.sourcePosition.hasSameParentAs(e.splitPosition)&&(o.howMany=e.splitPosition.offset),o.sourcePosition=o.sourcePosition._getTransformedBySplitOperation(e),o.targetPosition=o.targetPosition._getTransformedBySplitOperation(e),[o]}),ae(ce,$e,(o,e)=>{const t=V._createFromPositionAndShift(o.sourcePosition,o.howMany)._getTransformedByInsertOperation(e,!1)[0];return o.sourcePosition=t.start,o.howMany=t.end.offset-t.start.offset,o.targetPosition.isEqual(e.position)||(o.targetPosition=o.targetPosition._getTransformedByInsertOperation(e)),[o]}),ae(ce,ce,(o,e,t)=>{const n=V._createFromPositionAndShift(o.sourcePosition,o.howMany),i=V._createFromPositionAndShift(e.sourcePosition,e.howMany);let r,s=t.aIsStrong,a=!t.aIsStrong;if(t.abRelation=="insertBefore"||t.baRelation=="insertAfter"?a=!0:t.abRelation!="insertAfter"&&t.baRelation!="insertBefore"||(a=!1),r=o.targetPosition.isEqual(e.targetPosition)&&a?o.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany):o.targetPosition._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),Uh(o,e)&&Uh(e,o))return[e.getReversed()];if(n.containsPosition(e.targetPosition)&&n.containsRange(i,!0))return n.start=n.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),n.end=n.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),jn([n],r);if(i.containsPosition(o.targetPosition)&&i.containsRange(n,!0))return n.start=n.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),n.end=n.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),jn([n],r);const l=Ue(o.sourcePosition.getParentPath(),e.sourcePosition.getParentPath());if(l=="prefix"||l=="extension")return n.start=n.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),n.end=n.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),jn([n],r);o.type!="remove"||e.type=="remove"||t.aWasUndone||t.forceWeakRemove?o.type=="remove"||e.type!="remove"||t.bWasUndone||t.forceWeakRemove||(s=!1):s=!0;const c=[],d=n.getDifference(i);for(const g of d){g.start=g.start._getTransformedByDeletion(e.sourcePosition,e.howMany),g.end=g.end._getTransformedByDeletion(e.sourcePosition,e.howMany);const f=Ue(g.start.getParentPath(),e.getMovedRangeStart().getParentPath())=="same",b=g._getTransformedByInsertion(e.getMovedRangeStart(),e.howMany,f);c.push(...b)}const u=n.getIntersection(i);return u!==null&&s&&(u.start=u.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),u.end=u.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),c.length===0?c.push(u):c.length==1?i.start.isBefore(n.start)||i.start.isEqual(n.start)?c.unshift(u):c.push(u):c.splice(1,0,u)),c.length===0?[new je(o.baseVersion)]:jn(c,r)}),ae(ce,be,(o,e,t)=>{let n=o.targetPosition.clone();o.targetPosition.isEqual(e.insertionPosition)&&e.graveyardPosition&&t.abRelation!="moveTargetAfter"||(n=o.targetPosition._getTransformedBySplitOperation(e));const i=V._createFromPositionAndShift(o.sourcePosition,o.howMany);if(i.end.isEqual(e.insertionPosition))return e.graveyardPosition||o.howMany++,o.targetPosition=n,[o];if(i.start.hasSameParentAs(e.splitPosition)&&i.containsPosition(e.splitPosition)){let s=new V(e.splitPosition,i.end);return s=s._getTransformedBySplitOperation(e),jn([new V(i.start,e.splitPosition),s],n)}o.targetPosition.isEqual(e.splitPosition)&&t.abRelation=="insertAtSource"&&(n=e.moveTargetPosition),o.targetPosition.isEqual(e.insertionPosition)&&t.abRelation=="insertBetween"&&(n=o.targetPosition);const r=[i._getTransformedBySplitOperation(e)];if(e.graveyardPosition){const s=i.start.isEqual(e.graveyardPosition)||i.containsPosition(e.graveyardPosition);o.howMany>1&&s&&!t.aWasUndone&&r.push(V._createFromPositionAndShift(e.insertionPosition,1))}return jn(r,n)}),ae(ce,Re,(o,e,t)=>{const n=V._createFromPositionAndShift(o.sourcePosition,o.howMany);if(e.deletionPosition.hasSameParentAs(o.sourcePosition)&&n.containsPosition(e.sourcePosition)){if(o.type!="remove"||t.forceWeakRemove){if(o.howMany==1)return t.bWasUndone?(o.sourcePosition=e.graveyardPosition.clone(),o.targetPosition=o.targetPosition._getTransformedByMergeOperation(e),[o]):[new je(0)]}else if(!t.aWasUndone){const r=[];let s=e.graveyardPosition.clone(),a=e.targetPosition._getTransformedByMergeOperation(e);o.howMany>1&&(r.push(new ce(o.sourcePosition,o.howMany-1,o.targetPosition,0)),s=s._getTransformedByMove(o.sourcePosition,o.targetPosition,o.howMany-1),a=a._getTransformedByMove(o.sourcePosition,o.targetPosition,o.howMany-1));const l=e.deletionPosition._getCombined(o.sourcePosition,o.targetPosition),c=new ce(s,1,l,0),d=c.getMovedRangeStart().path.slice();d.push(0);const u=new H(c.targetPosition.root,d);a=a._getTransformedByMove(s,l,1);const g=new ce(a,e.howMany,u,0);return r.push(c),r.push(g),r}}const i=V._createFromPositionAndShift(o.sourcePosition,o.howMany)._getTransformedByMergeOperation(e);return o.sourcePosition=i.start,o.howMany=i.end.offset-i.start.offset,o.targetPosition=o.targetPosition._getTransformedByMergeOperation(e),[o]}),ae(Ze,$e,(o,e)=>(o.position=o.position._getTransformedByInsertOperation(e),[o])),ae(Ze,Re,(o,e)=>o.position.isEqual(e.deletionPosition)?(o.position=e.graveyardPosition.clone(),o.position.stickiness="toNext",[o]):(o.position=o.position._getTransformedByMergeOperation(e),[o])),ae(Ze,ce,(o,e)=>(o.position=o.position._getTransformedByMoveOperation(e),[o])),ae(Ze,Ze,(o,e,t)=>{if(o.position.isEqual(e.position)){if(!t.aIsStrong)return[new je(0)];o.oldName=e.newName}return[o]}),ae(Ze,be,(o,e)=>{if(Ue(o.position.path,e.splitPosition.getParentPath())=="same"&&!e.graveyardPosition){const t=new Ze(o.position.getShiftedBy(1),o.oldName,o.newName,0);return[o,t]}return o.position=o.position._getTransformedBySplitOperation(e),[o]}),ae(Tt,Tt,(o,e,t)=>{if(o.root===e.root&&o.key===e.key){if(!t.aIsStrong||o.newValue===e.newValue)return[new je(0)];o.oldValue=e.newValue}return[o]}),ae(yt,yt,(o,e,t)=>o.rootName!==e.rootName||o.isAdd!==e.isAdd||t.bWasUndone?[o]:[new je(0)]),ae(be,$e,(o,e)=>(o.splitPosition.hasSameParentAs(e.position)&&o.splitPosition.offset<e.position.offset&&(o.howMany+=e.howMany),o.splitPosition=o.splitPosition._getTransformedByInsertOperation(e),o.insertionPosition=o.insertionPosition._getTransformedByInsertOperation(e),[o])),ae(be,Re,(o,e,t)=>{if(!o.graveyardPosition&&!t.bWasUndone&&o.splitPosition.hasSameParentAs(e.sourcePosition)){const n=e.graveyardPosition.path.slice();n.push(0);const i=new H(e.graveyardPosition.root,n),r=be.getInsertionPosition(new H(e.graveyardPosition.root,n)),s=new be(i,0,r,null,0);return o.splitPosition=o.splitPosition._getTransformedByMergeOperation(e),o.insertionPosition=be.getInsertionPosition(o.splitPosition),o.graveyardPosition=s.insertionPosition.clone(),o.graveyardPosition.stickiness="toNext",[s,o]}return o.splitPosition.hasSameParentAs(e.deletionPosition)&&!o.splitPosition.isAfter(e.deletionPosition)&&o.howMany--,o.splitPosition.hasSameParentAs(e.targetPosition)&&(o.howMany+=e.howMany),o.splitPosition=o.splitPosition._getTransformedByMergeOperation(e),o.insertionPosition=be.getInsertionPosition(o.splitPosition),o.graveyardPosition&&(o.graveyardPosition=o.graveyardPosition._getTransformedByMergeOperation(e)),[o]}),ae(be,ce,(o,e,t)=>{const n=V._createFromPositionAndShift(e.sourcePosition,e.howMany);if(o.graveyardPosition){const r=n.start.isEqual(o.graveyardPosition)||n.containsPosition(o.graveyardPosition);if(!t.bWasUndone&&r){const s=o.splitPosition._getTransformedByMoveOperation(e),a=o.graveyardPosition._getTransformedByMoveOperation(e),l=a.path.slice();l.push(0);const c=new H(a.root,l);return[new ce(s,o.howMany,c,0)]}o.graveyardPosition=o.graveyardPosition._getTransformedByMoveOperation(e)}const i=o.splitPosition.isEqual(e.targetPosition);if(i&&(t.baRelation=="insertAtSource"||t.abRelation=="splitBefore"))return o.howMany+=e.howMany,o.splitPosition=o.splitPosition._getTransformedByDeletion(e.sourcePosition,e.howMany),o.insertionPosition=be.getInsertionPosition(o.splitPosition),[o];if(i&&t.abRelation&&t.abRelation.howMany){const{howMany:r,offset:s}=t.abRelation;return o.howMany+=r,o.splitPosition=o.splitPosition.getShiftedBy(s),[o]}if(o.splitPosition.hasSameParentAs(e.sourcePosition)&&n.containsPosition(o.splitPosition)){const r=e.howMany-(o.splitPosition.offset-e.sourcePosition.offset);return o.howMany-=r,o.splitPosition.hasSameParentAs(e.targetPosition)&&o.splitPosition.offset<e.targetPosition.offset&&(o.howMany+=e.howMany),o.splitPosition=e.sourcePosition.clone(),o.insertionPosition=be.getInsertionPosition(o.splitPosition),[o]}return e.sourcePosition.isEqual(e.targetPosition)||(o.splitPosition.hasSameParentAs(e.sourcePosition)&&o.splitPosition.offset<=e.sourcePosition.offset&&(o.howMany-=e.howMany),o.splitPosition.hasSameParentAs(e.targetPosition)&&o.splitPosition.offset<e.targetPosition.offset&&(o.howMany+=e.howMany)),o.splitPosition.stickiness="toNone",o.splitPosition=o.splitPosition._getTransformedByMoveOperation(e),o.splitPosition.stickiness="toNext",o.graveyardPosition?o.insertionPosition=o.insertionPosition._getTransformedByMoveOperation(e):o.insertionPosition=be.getInsertionPosition(o.splitPosition),[o]}),ae(be,be,(o,e,t)=>{if(o.splitPosition.isEqual(e.splitPosition)){if(!o.graveyardPosition&&!e.graveyardPosition)return[new je(0)];if(o.graveyardPosition&&e.graveyardPosition&&o.graveyardPosition.isEqual(e.graveyardPosition))return[new je(0)];if(t.abRelation=="splitBefore")return o.howMany=0,o.graveyardPosition=o.graveyardPosition._getTransformedBySplitOperation(e),[o]}if(o.graveyardPosition&&e.graveyardPosition&&o.graveyardPosition.isEqual(e.graveyardPosition)){const n=o.splitPosition.root.rootName=="$graveyard",i=e.splitPosition.root.rootName=="$graveyard";if(i&&!n||!(n&&!i)&&t.aIsStrong){const r=[];return e.howMany&&r.push(new ce(e.moveTargetPosition,e.howMany,e.splitPosition,0)),o.howMany&&r.push(new ce(o.splitPosition,o.howMany,o.moveTargetPosition,0)),r}return[new je(0)]}if(o.graveyardPosition&&(o.graveyardPosition=o.graveyardPosition._getTransformedBySplitOperation(e)),o.splitPosition.isEqual(e.insertionPosition)&&t.abRelation=="splitBefore")return o.howMany++,[o];if(e.splitPosition.isEqual(o.insertionPosition)&&t.baRelation=="splitBefore"){const n=e.insertionPosition.path.slice();n.push(0);const i=new H(e.insertionPosition.root,n);return[o,new ce(o.insertionPosition,1,i,0)]}return o.splitPosition.hasSameParentAs(e.splitPosition)&&o.splitPosition.offset<e.splitPosition.offset&&(o.howMany-=e.howMany),o.splitPosition=o.splitPosition._getTransformedBySplitOperation(e),o.insertionPosition=be.getInsertionPosition(o.splitPosition),[o]});class Je extends me(H){constructor(e,t,n="toNone"){if(super(e,t,n),!this.root.is("rootElement"))throw new I("model-liveposition-root-not-rootelement",e);l1.call(this)}detach(){this.stopListening()}toPosition(){return new H(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}function l1(){this.listenTo(this.root.document.model,"applyOperation",(o,e)=>{const t=e[0];t.isDocumentOperation&&c1.call(this,t)},{priority:"low"})}function c1(o){const e=this.getTransformedByOperation(o);if(!this.isEqual(e)){const t=this.toPosition();this.path=e.path,this.root=e.root,this.fire("change",t)}}Je.prototype.is=function(o){return o==="livePosition"||o==="model:livePosition"||o=="position"||o==="model:position"};class $n{constructor(e={}){typeof e=="string"&&(e=e==="transparent"?{isUndoable:!1}:{},Q("batch-constructor-deprecated-string-type"));const{isUndoable:t=!0,isLocal:n=!0,isUndo:i=!1,isTyping:r=!1}=e;this.operations=[],this.isUndoable=t,this.isLocal=n,this.isUndo=i,this.isTyping=r}get type(){return Q("batch-type-deprecated"),"default"}get baseVersion(){for(const e of this.operations)if(e.baseVersion!==null)return e.baseVersion;return null}addOperation(e){return e.batch=this,this.operations.push(e),e}}var d1=Object.defineProperty,Wh=Object.getOwnPropertySymbols,h1=Object.prototype.hasOwnProperty,u1=Object.prototype.propertyIsEnumerable,Kh=(o,e,t)=>e in o?d1(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;class m1{constructor(e){this._changesInElement=new Map,this._elementSnapshots=new Map,this._changedMarkers=new Map,this._changedRoots=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null,this._refreshedItems=new Set,this._markerCollection=e}get isEmpty(){return this._changesInElement.size==0&&this._changedMarkers.size==0&&this._changedRoots.size==0}bufferOperation(e){const t=e;switch(t.type){case"insert":if(this._isInInsertedElement(t.position.parent))return;this._markInsert(t.position.parent,t.position.offset,t.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(const n of t.range.getItems({shallow:!0}))this._isInInsertedElement(n.parent)||this._markAttribute(n);break;case"remove":case"move":case"reinsert":{if(t.sourcePosition.isEqual(t.targetPosition)||t.sourcePosition.getShiftedBy(t.howMany).isEqual(t.targetPosition))return;const n=this._isInInsertedElement(t.sourcePosition.parent),i=this._isInInsertedElement(t.targetPosition.parent);n||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),i||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);break}case"rename":{if(this._isInInsertedElement(t.position.parent))return;this._markRemove(t.position.parent,t.position.offset,1),this._markInsert(t.position.parent,t.position.offset,1);const n=V._createFromPositionAndShift(t.position,1);for(const i of this._markerCollection.getMarkersIntersectingRange(n)){const r=i.getData();this.bufferMarkerChange(i.name,r,r)}break}case"split":{const n=t.splitPosition.parent;this._isInInsertedElement(n)||this._markRemove(n,t.splitPosition.offset,t.howMany),this._isInInsertedElement(t.insertionPosition.parent)||this._markInsert(t.insertionPosition.parent,t.insertionPosition.offset,1),t.graveyardPosition&&this._markRemove(t.graveyardPosition.parent,t.graveyardPosition.offset,1);break}case"merge":{const n=t.sourcePosition.parent;this._isInInsertedElement(n.parent)||this._markRemove(n.parent,n.startOffset,1);const i=t.graveyardPosition.parent;this._markInsert(i,t.graveyardPosition.offset,1);const r=t.targetPosition.parent;this._isInInsertedElement(r)||this._markInsert(r,t.targetPosition.offset,n.maxOffset);break}case"detachRoot":case"addRoot":this._bufferRootStateChange(t.rootName,t.isAdd);break;case"addRootAttribute":case"removeRootAttribute":case"changeRootAttribute":{const n=t.root.rootName;this._bufferRootAttributeChange(n,t.key,t.oldValue,t.newValue);break}}this._cachedChanges=null}bufferMarkerChange(e,t,n){const i=this._changedMarkers.get(e);i?(i.newMarkerData=n,i.oldMarkerData.range==null&&n.range==null&&this._changedMarkers.delete(e)):this._changedMarkers.set(e,{newMarkerData:n,oldMarkerData:t})}getMarkersToRemove(){const e=[];for(const[t,n]of this._changedMarkers)n.oldMarkerData.range!=null&&e.push({name:t,range:n.oldMarkerData.range});return e}getMarkersToAdd(){const e=[];for(const[t,n]of this._changedMarkers)n.newMarkerData.range!=null&&e.push({name:t,range:n.newMarkerData.range});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map(([e,t])=>({name:e,data:{oldRange:t.oldMarkerData.range,newRange:t.newMarkerData.range}}))}hasDataChanges(){if(this._changesInElement.size>0||this._changedRoots.size>0)return!0;for(const{newMarkerData:e,oldMarkerData:t}of this._changedMarkers.values()){if(e.affectsData!==t.affectsData)return!0;if(e.affectsData){const n=e.range&&!t.range,i=!e.range&&t.range,r=e.range&&t.range&&!e.range.isEqual(t.range);if(n||i||r)return!0}}return!1}getChanges(e={}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let t=[];for(const n of this._changesInElement.keys()){const i=this._changesInElement.get(n).sort((d,u)=>d.offset===u.offset?d.type!=u.type?d.type=="remove"?-1:1:0:d.offset<u.offset?-1:1),r=this._elementSnapshots.get(n),s=Gh(n.getChildren()),a=g1(r.length,i);let l=0,c=0;for(const d of a)if(d==="i")t.push(this._getInsertDiff(n,l,s[l])),l++;else if(d==="r")t.push(this._getRemoveDiff(n,l,r[c])),c++;else if(d==="a"){const u=s[l].attributes,g=r[c].attributes;let f;if(s[l].name=="$text")f=new V(H._createAt(n,l),H._createAt(n,l+1));else{const b=n.offsetToIndex(l);f=new V(H._createAt(n,l),H._createAt(n.getChild(b),0))}t.push(...this._getAttributesDiff(f,g,u)),l++,c++}else l++,c++}t.sort((n,i)=>n.position.root!=i.position.root?n.position.root.rootName<i.position.root.rootName?-1:1:n.position.isEqual(i.position)?n.changeCount-i.changeCount:n.position.isBefore(i.position)?-1:1);for(let n=1,i=0;n<t.length;n++){const r=t[i],s=t[n],a=r.type=="remove"&&s.type=="remove"&&r.name=="$text"&&s.name=="$text"&&r.position.isEqual(s.position),l=r.type=="insert"&&s.type=="insert"&&r.name=="$text"&&s.name=="$text"&&r.position.parent==s.position.parent&&r.position.offset+r.length==s.position.offset,c=r.type=="attribute"&&s.type=="attribute"&&r.position.parent==s.position.parent&&r.range.isFlat&&s.range.isFlat&&r.position.offset+r.length==s.position.offset&&r.attributeKey==s.attributeKey&&r.attributeOldValue==s.attributeOldValue&&r.attributeNewValue==s.attributeNewValue;a||l||c?(r.length++,c&&(r.range.end=r.range.end.getShiftedBy(1)),t[n]=null):i=n}t=t.filter(n=>n);for(const n of t)delete n.changeCount,n.type=="attribute"&&(delete n.position,delete n.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t,this._cachedChanges=t.filter(p1),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}getChangedRoots(){return Array.from(this._changedRoots.values()).map(e=>{const t=((n,i)=>{for(var r in i||(i={}))h1.call(i,r)&&Kh(n,r,i[r]);if(Wh)for(var r of Wh(i))u1.call(i,r)&&Kh(n,r,i[r]);return n})({},e);return t.state!==void 0&&delete t.attributes,t})}getRefreshedItems(){return new Set(this._refreshedItems)}reset(){this._changesInElement.clear(),this._elementSnapshots.clear(),this._changedMarkers.clear(),this._changedRoots.clear(),this._refreshedItems=new Set,this._cachedChanges=null}_bufferRootStateChange(e,t){if(!this._changedRoots.has(e))return void this._changedRoots.set(e,{name:e,state:t?"attached":"detached"});const n=this._changedRoots.get(e);n.state!==void 0?(delete n.state,n.attributes===void 0&&this._changedRoots.delete(e)):n.state=t?"attached":"detached"}_bufferRootAttributeChange(e,t,n,i){const r=this._changedRoots.get(e)||{name:e},s=r.attributes||{};if(s[t]){const a=s[t];i===a.oldValue?delete s[t]:a.newValue=i}else s[t]={oldValue:n,newValue:i};Object.entries(s).length===0?(delete r.attributes,r.state===void 0&&this._changedRoots.delete(e)):(r.attributes=s,this._changedRoots.set(e,r))}_refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize),this._refreshedItems.add(e);const t=V._createOn(e);for(const n of this._markerCollection.getMarkersIntersectingRange(t)){const i=n.getData();this.bufferMarkerChange(n.name,i,i)}this._cachedChanges=null}_markInsert(e,t,n){const i={type:"insert",offset:t,howMany:n,count:this._changeCount++};this._markChange(e,i)}_markRemove(e,t,n){const i={type:"remove",offset:t,howMany:n,count:this._changeCount++};this._markChange(e,i),this._removeAllNestedChanges(e,t,n)}_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 n=this._getChangesForElement(e);this._handleChange(t,n),n.push(t);for(let i=0;i<n.length;i++)n[i].howMany<1&&(n.splice(i,1),i--)}_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,Gh(e.getChildren()))}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const n of t){const i=e.offset+e.howMany,r=n.offset+n.howMany;if(e.type=="insert"&&(n.type=="insert"&&(e.offset<=n.offset?n.offset+=e.howMany:e.offset<r&&(n.howMany+=e.nodesToHandle,e.nodesToHandle=0)),n.type=="remove"&&e.offset<n.offset&&(n.offset+=e.howMany),n.type=="attribute")){if(e.offset<=n.offset)n.offset+=e.howMany;else if(e.offset<r){const s=n.howMany;n.howMany=e.offset-n.offset,t.unshift({type:"attribute",offset:i,howMany:s-n.howMany,count:this._changeCount++})}}if(e.type=="remove"){if(n.type=="insert"){if(i<=n.offset)n.offset-=e.howMany;else if(i<=r)if(e.offset<n.offset){const s=i-n.offset;n.offset=e.offset,n.howMany-=s,e.nodesToHandle-=s}else n.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=n.offset)e.nodesToHandle-=n.howMany,n.howMany=0;else if(e.offset<r){const s=r-e.offset;n.howMany-=s,e.nodesToHandle-=s}}if(n.type=="remove"&&(i<=n.offset?n.offset-=e.howMany:e.offset<n.offset&&(e.nodesToHandle+=n.howMany,n.howMany=0)),n.type=="attribute"){if(i<=n.offset)n.offset-=e.howMany;else if(e.offset<n.offset){const s=i-n.offset;n.offset=e.offset,n.howMany-=s}else if(e.offset<r)if(i<=r){const s=n.howMany;n.howMany=e.offset-n.offset;const a=s-n.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:a,count:this._changeCount++})}else n.howMany-=r-e.offset}}if(e.type=="attribute"){if(n.type=="insert")if(e.offset<n.offset&&i>n.offset){if(i>r){const s={type:"attribute",offset:r,howMany:i-r,count:this._changeCount++};this._handleChange(s,t),t.push(s)}e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=n.offset&&e.offset<r&&(i>r?(e.nodesToHandle=i-r,e.offset=r):e.nodesToHandle=0);if(n.type=="remove"&&e.offset<n.offset&&i>n.offset){const s={type:"attribute",offset:n.offset,howMany:i-n.offset,count:this._changeCount++};this._handleChange(s,t),t.push(s),e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}n.type=="attribute"&&(e.offset>=n.offset&&i<=r?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=n.offset&&i>=r&&(n.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,n){return{type:"insert",position:H._createAt(e,t),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++}}_getRemoveDiff(e,t,n){return{type:"remove",position:H._createAt(e,t),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,n){const i=[];n=new Map(n);for(const[r,s]of t){const a=n.has(r)?n.get(r):null;a!==s&&i.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:r,attributeOldValue:s,attributeNewValue:a,changeCount:this._changeCount++}),n.delete(r)}for(const[r,s]of n)i.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:r,attributeOldValue:null,attributeNewValue:s,changeCount:this._changeCount++});return i}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const n=this._changesInElement.get(t),i=e.startOffset;if(n){for(const r of n)if(r.type=="insert"&&i>=r.offset&&i<r.offset+r.howMany)return!0}return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,n){const i=new V(H._createAt(e,t),H._createAt(e,t+n));for(const r of i.getItems({shallow:!0}))r.is("element")&&(this._elementSnapshots.delete(r),this._changesInElement.delete(r),this._removeAllNestedChanges(r,0,r.maxOffset))}}function Gh(o){const e=[];for(const t of o)if(t.is("$text"))for(let n=0;n<t.data.length;n++)e.push({name:"$text",attributes:new Map(t.getAttributes())});else e.push({name:t.name,attributes:new Map(t.getAttributes())});return e}function g1(o,e){const t=[];let n=0,i=0;for(const r of e){if(r.offset>n){for(let s=0;s<r.offset-n;s++)t.push("e");i+=r.offset-n}if(r.type=="insert"){for(let s=0;s<r.howMany;s++)t.push("i");n=r.offset+r.howMany}else if(r.type=="remove"){for(let s=0;s<r.howMany;s++)t.push("r");n=r.offset,i+=r.howMany}else t.push(..."a".repeat(r.howMany).split("")),n=r.offset+r.howMany,i+=r.howMany}if(i<o)for(let r=0;r<o-i-n;r++)t.push("e");return t}function p1(o){const e="position"in o&&o.position.root.rootName=="$graveyard",t="range"in o&&o.range.root.rootName=="$graveyard";return!e&&!t}class f1{constructor(){this._operations=[],this._undoPairs=new Map,this._undoneOperations=new Set,this._baseVersionToOperationIndex=new Map,this._version=0,this._gaps=new Map}get version(){return this._version}set version(e){this._operations.length&&e>this._version+1&&this._gaps.set(this._version,e),this._version=e}get lastOperation(){return this._operations[this._operations.length-1]}addOperation(e){if(e.baseVersion!==this.version)throw new I("model-document-history-addoperation-incorrect-version",this,{operation:e,historyVersion:this.version});this._operations.push(e),this._version++,this._baseVersionToOperationIndex.set(e.baseVersion,this._operations.length-1)}getOperations(e,t=this.version){if(!this._operations.length)return[];const n=this._operations[0];e===void 0&&(e=n.baseVersion);let i=t-1;for(const[a,l]of this._gaps)e>a&&e<l&&(e=l),i>a&&i<l&&(i=a-1);if(i<n.baseVersion||e>this.lastOperation.baseVersion)return[];let r=this._baseVersionToOperationIndex.get(e);r===void 0&&(r=0);let s=this._baseVersionToOperationIndex.get(i);return s===void 0&&(s=this._operations.length-1),this._operations.slice(r,s+1)}getOperation(e){const t=this._baseVersionToOperationIndex.get(e);if(t!==void 0)return this._operations[t]}setOperationAsUndone(e,t){this._undoPairs.set(t,e),this._undoneOperations.add(e)}isUndoingOperation(e){return this._undoPairs.has(e)}isUndoneOperation(e){return this._undoneOperations.has(e)}getUndoneOperation(e){return this._undoPairs.get(e)}reset(){this._version=0,this._undoPairs=new Map,this._operations=[],this._undoneOperations=new Set,this._gaps=new Map,this._baseVersionToOperationIndex=new Map}}class Di extends ke{constructor(e,t,n="main"){super(t),this._isAttached=!0,this._document=e,this.rootName=n}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}}Di.prototype.is=function(o,e){return e?e===this.name&&(o==="rootElement"||o==="model:rootElement"||o==="element"||o==="model:element"):o==="rootElement"||o==="model:rootElement"||o==="element"||o==="model:element"||o==="node"||o==="model:node"};var k1=Object.defineProperty,b1=Object.defineProperties,w1=Object.getOwnPropertyDescriptors,Zh=Object.getOwnPropertySymbols,A1=Object.prototype.hasOwnProperty,_1=Object.prototype.propertyIsEnumerable,Jh=(o,e,t)=>e in o?k1(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Yh=(o,e)=>{for(var t in e||(e={}))A1.call(e,t)&&Jh(o,t,e[t]);if(Zh)for(var t of Zh(e))_1.call(e,t)&&Jh(o,t,e[t]);return o},Qh=(o,e)=>b1(o,w1(e));const Ps="$graveyard";class C1 extends me(){constructor(e){super(),this.model=e,this.history=new f1,this.selection=new mt(this),this.roots=new at({idProperty:"rootName"}),this.differ=new m1(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",Ps),this.listenTo(e,"applyOperation",(t,n)=>{const i=n[0];i.isDocumentOperation&&this.differ.bufferOperation(i)},{priority:"high"}),this.listenTo(e,"applyOperation",(t,n)=>{const i=n[0];i.isDocumentOperation&&this.history.addOperation(i)},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(t,n,i,r,s)=>{const a=Qh(Yh({},n.getData()),{range:r});this.differ.bufferMarkerChange(n.name,s,a),i===null&&n.on("change",(l,c)=>{const d=n.getData();this.differ.bufferMarkerChange(n.name,Qh(Yh({},d),{range:c}),d)})}),this.registerPostFixer(t=>{let n=!1;for(const i of this.roots)i.isAttached()||i.isEmpty||(t.remove(t.createRangeIn(i)),n=!0);for(const i of this.model.markers)i.getRange().root.isAttached()||(t.removeMarker(i),n=!0);return n})}get version(){return this.history.version}set version(e){this.history.version=e}get graveyard(){return this.getRoot(Ps)}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new I("model-document-createroot-name-exists",this,{name:t});const n=new Di(this,e,t);return this.roots.add(n),n}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(e=!1){return Array.from(this.roots).filter(t=>t.rootName!=Ps&&(e||t.isAttached())).map(t=>t.rootName)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=md(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,n=t.schema,i=t.createPositionFromPath(e,[0]);return n.getNearestSelectionRange(i)||t.createRange(i)}_validateSelectionRange(e){return Xh(e.start)&&Xh(e.end)}_callPostFixers(e){let t=!1;do for(const n of this._postFixers)if(this.selection.refresh(),t=n(e),t)break;while(t)}}function Xh(o){const e=o.textNode;if(e){const t=e.data,n=o.offset-e.startOffset;return!Wr(t,n)&&!Kr(t,n)}return!0}var v1=Object.defineProperty,y1=Object.defineProperties,E1=Object.getOwnPropertyDescriptors,eu=Object.getOwnPropertySymbols,x1=Object.prototype.hasOwnProperty,S1=Object.prototype.propertyIsEnumerable,tu=(o,e,t)=>e in o?v1(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;class D1 extends me(){constructor(){super(...arguments),this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof Hn?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,n=!1,i=!1){const r=e instanceof Hn?e.name:e;if(r.includes(","))throw new I("markercollection-incorrect-marker-name",this);const s=this._markers.get(r);if(s){const d=s.getData(),u=s.getRange();let g=!1;return u.isEqual(t)||(s._attachLiveRange(Bt.fromRange(t)),g=!0),n!=s.managedUsingOperations&&(s._managedUsingOperations=n,g=!0),typeof i=="boolean"&&i!=s.affectsData&&(s._affectsData=i,g=!0),g&&this.fire(`update:${r}`,s,u,t,d),s}const a=Bt.fromRange(t),l=new Hn(r,a,n,i);var c;return this._markers.set(r,l),this.fire(`update:${r}`,l,null,t,(c=((d,u)=>{for(var g in u||(u={}))x1.call(u,g)&&tu(d,g,u[g]);if(eu)for(var g of eu(u))S1.call(u,g)&&tu(d,g,u[g]);return d})({},l.getData()),y1(c,E1({range:null})))),l}_remove(e){const t=e instanceof Hn?e.name:e,n=this._markers.get(t);return!!n&&(this._markers.delete(t),this.fire(`update:${t}`,n,n.getRange(),null,n.getData()),this._destroyMarker(n),!0)}_refresh(e){const t=e instanceof Hn?e.name:e,n=this._markers.get(t);if(!n)throw new I("markercollection-refresh-marker-not-exists",this);const i=n.getRange();this.fire(`update:${t}`,n,i,i,n.getData())}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)t.getRange().getIntersection(e)!==null&&(yield t)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const t of this._markers.values())t.name.startsWith(e+":")&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}class Hn extends me(Ht){constructor(e,t,n,i){super(),this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=n,this._affectsData=i}get managedUsingOperations(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._liveRange.toRange()}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}Hn.prototype.is=function(o){return o==="marker"||o==="model:marker"};class B1 extends ot{constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}get affectedSelectable(){return null}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new I("detach-operation-on-document-node",this)}_execute(){Vh(V._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}class It extends Ht{constructor(e){super(),this.markers=new Map,this._children=new yo,e&&this._insertChild(0,e)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return this.childCount===0}get nextSibling(){return null}get previousSibling(){return null}get root(){return this}get parent(){return null}get document(){return null}isAttached(){return!1}getAncestors(){return[]}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(const n of e)t=t.getChild(t.offsetToIndex(n));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 n of e)n.name?t.push(ke.fromJSON(n)):t.push(fe.fromJSON(n));return new It(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const n=function(i){return typeof i=="string"?[new fe(i)]:(Xe(i)||(i=[i]),Array.from(i).map(r=>typeof r=="string"?new fe(r):r instanceof ut?new fe(r.data,r.getAttributes()):r))}(t);for(const i of n)i.parent!==null&&i._remove(),i.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){const n=this._children._removeNodes(e,t);for(const i of n)i.parent=null;return n}}It.prototype.is=function(o){return o==="documentFragment"||o==="model:documentFragment"};class T1{constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new fe(e,t)}createElement(e,t){return new ke(e,t)}createDocumentFragment(){return new It}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,n=0){if(this._assertWriterUsedCorrectly(),e instanceof fe&&e.data=="")return;const i=H._createAt(t,n);if(e.parent){if(iu(e.root,i.root))return void this.move(V._createOn(e),i);if(e.root.document)throw new I("model-writer-insert-forbidden-move",this);this.remove(e)}const r=i.root.document?i.root.document.version:null,s=new $e(i,e,r);if(e instanceof fe&&(s.shouldReceiveAttributes=!0),this.batch.addOperation(s),this.model.applyOperation(s),e instanceof It)for(const[a,l]of e.markers){const c=H._createAt(l.root,0),d={range:new V(l.start._getCombined(c,i),l.end._getCombined(c,i)),usingOperation:!0,affectsData:!0};this.model.markers.has(a)?this.updateMarker(a,d):this.addMarker(a,d)}}insertText(e,t,n,i){t instanceof It||t instanceof ke||t instanceof H?this.insert(this.createText(e),t,n):this.insert(this.createText(e,t),n,i)}insertElement(e,t,n,i){t instanceof It||t instanceof ke||t instanceof H?this.insert(this.createElement(e),t,n):this.insert(this.createElement(e,t),n,i)}append(e,t){this.insert(e,t,"end")}appendText(e,t,n){t instanceof It||t instanceof ke?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),n,"end")}appendElement(e,t,n){t instanceof It||t instanceof ke?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),n,"end")}setAttribute(e,t,n){if(this._assertWriterUsedCorrectly(),n instanceof V){const i=n.getMinimalFlatRanges();for(const r of i)nu(this,e,t,r)}else ou(this,e,t,n)}setAttributes(e,t){for(const[n,i]of Dt(e))this.setAttribute(n,i,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof V){const n=t.getMinimalFlatRanges();for(const i of n)nu(this,e,null,i)}else ou(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=n=>{for(const i of n.getAttributeKeys())this.removeAttribute(i,n)};if(e instanceof V)for(const n of e.getItems())t(n);else t(e)}move(e,t,n){if(this._assertWriterUsedCorrectly(),!(e instanceof V))throw new I("writer-move-invalid-range",this);if(!e.isFlat)throw new I("writer-move-range-not-flat",this);const i=H._createAt(t,n);if(i.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!iu(e.root,i.root))throw new I("writer-move-different-document",this);const r=e.root.document?e.root.document.version:null,s=new ce(e.start,e.end.offset-e.start.offset,i,r);this.batch.addOperation(s),this.model.applyOperation(s)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof V?e:V._createOn(e)).getMinimalFlatRanges().reverse();for(const n of t)this._addOperationForAffectedMarkers("move",n),I1(n.start,n.end.offset-n.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,n=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof ke))throw new I("writer-merge-no-element-before",this);if(!(n instanceof ke))throw new I("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,n){return this.model.createPositionFromPath(e,t,n)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(...e){return this.model.createSelection(...e)}_mergeDetached(e){const t=e.nodeBefore,n=e.nodeAfter;this.move(V._createIn(n),H._createAt(t,"end")),this.remove(n)}_merge(e){const t=H._createAt(e.nodeBefore,"end"),n=H._createAt(e.nodeAfter,0),i=e.root.document.graveyard,r=new H(i,[0]),s=e.root.document.version,a=new Re(n,e.nodeAfter.maxOffset,t,r,s);this.batch.addOperation(a),this.model.applyOperation(a)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof ke))throw new I("writer-rename-not-element-instance",this);const n=e.root.document?e.root.document.version:null,i=new Ze(H._createBefore(e),e.name,t,n);this.batch.addOperation(i),this.model.applyOperation(i)}split(e,t){this._assertWriterUsedCorrectly();let n,i,r=e.parent;if(!r.parent)throw new I("writer-split-element-no-parent",this);if(t||(t=r.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new I("writer-split-invalid-limit-element",this);do{const s=r.root.document?r.root.document.version:null,a=r.maxOffset-e.offset,l=be.getInsertionPosition(e),c=new be(e,a,l,null,s);this.batch.addOperation(c),this.model.applyOperation(c),n||i||(n=r,i=e.parent.nextSibling),r=(e=this.createPositionAfter(e.parent)).parent}while(r!==t);return{position:e,range:new V(H._createAt(n,"end"),H._createAt(i,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new I("writer-wrap-range-not-flat",this);const n=t instanceof ke?t:new ke(t);if(n.childCount>0)throw new I("writer-wrap-element-not-empty",this);if(n.parent!==null)throw new I("writer-wrap-element-attached",this);this.insert(n,e.start);const i=new V(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(i,H._createAt(n,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),e.parent===null)throw new I("writer-unwrap-element-no-parent",this);this.move(V._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||typeof t.usingOperation!="boolean")throw new I("writer-addmarker-no-usingoperation",this);const n=t.usingOperation,i=t.range,r=t.affectsData!==void 0&&t.affectsData;if(this.model.markers.has(e))throw new I("writer-addmarker-marker-exists",this);if(!i)throw new I("writer-addmarker-no-range",this);return n?(Io(this,e,null,i,r),this.model.markers.get(e)):this.model.markers._set(e,i,n,r)}updateMarker(e,t){this._assertWriterUsedCorrectly();const n=typeof e=="string"?e:e.name,i=this.model.markers.get(n);if(!i)throw new I("writer-updatemarker-marker-not-exists",this);if(!t)return Q("writer-updatemarker-reconvert-using-editingcontroller",{markerName:n}),void this.model.markers._refresh(i);const r=typeof t.usingOperation=="boolean",s=typeof t.affectsData=="boolean",a=s?t.affectsData:i.affectsData;if(!r&&!t.range&&!s)throw new I("writer-updatemarker-wrong-options",this);const l=i.getRange(),c=t.range?t.range:l;r&&t.usingOperation!==i.managedUsingOperations?t.usingOperation?Io(this,n,null,c,a):(Io(this,n,l,null,a),this.model.markers._set(n,c,void 0,a)):i.managedUsingOperations?Io(this,n,l,c,a):this.model.markers._set(n,c,void 0,a)}removeMarker(e){this._assertWriterUsedCorrectly();const t=typeof e=="string"?e:e.name;if(!this.model.markers.has(t))throw new I("writer-removemarker-no-marker",this);const n=this.model.markers.get(t);if(!n.managedUsingOperations)return void this.model.markers._remove(t);Io(this,t,n.getRange(),null,n.affectsData)}addRoot(e,t="$root"){this._assertWriterUsedCorrectly();const n=this.model.document.getRoot(e);if(n&&n.isAttached())throw new I("writer-addroot-root-exists",this);const i=this.model.document,r=new yt(e,t,!0,i,i.version);return this.batch.addOperation(r),this.model.applyOperation(r),this.model.document.getRoot(e)}detachRoot(e){this._assertWriterUsedCorrectly();const t=typeof e=="string"?this.model.document.getRoot(e):e;if(!t||!t.isAttached())throw new I("writer-detachroot-no-root",this);for(const r of this.model.markers)r.getRange().root===t&&this.removeMarker(r);for(const r of t.getAttributeKeys())this.removeAttribute(r,t);this.remove(this.createRangeIn(t));const n=this.model.document,i=new yt(t.rootName,t.name,!1,n,n.version);this.batch.addOperation(i),this.model.applyOperation(i)}setSelection(...e){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(...e)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),typeof e=="string")this._setSelectionAttribute(e,t);else for(const[n,i]of Dt(e))this._setSelectionAttribute(n,i)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),typeof e=="string")this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const n=this.model.document.selection;if(n.isCollapsed&&n.anchor.parent.isEmpty){const i=mt._getStoreAttributeKey(e);this.setAttribute(i,t,n.anchor.parent)}n._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const n=mt._getStoreAttributeKey(e);this.removeAttribute(n,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new I("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const n of this.model.markers){if(!n.managedUsingOperations)continue;const i=n.getRange();let r=!1;if(e==="move"){const s=t;r=s.containsPosition(i.start)||s.start.isEqual(i.start)||s.containsPosition(i.end)||s.end.isEqual(i.end)}else{const s=t,a=s.nodeBefore,l=s.nodeAfter,c=i.start.parent==a&&i.start.isAtEnd,d=i.end.parent==l&&i.end.offset==0,u=i.end.nodeAfter==l,g=i.start.nodeAfter==l;r=c||d||u||g}r&&this.updateMarker(n.name,{range:i})}}}function nu(o,e,t,n){const i=o.model,r=i.document;let s,a,l,c=n.start;for(const u of n.getWalker({shallow:!0}))l=u.item.getAttribute(e),s&&a!=l&&(a!=t&&d(),c=s),s=u.nextPosition,a=l;function d(){const u=new V(c,s),g=u.root.document?r.version:null,f=new Me(u,e,a,t,g);o.batch.addOperation(f),i.applyOperation(f)}s instanceof H&&s!=c&&a!=t&&d()}function ou(o,e,t,n){const i=o.model,r=i.document,s=n.getAttribute(e);let a,l;if(s!=t){if(n.root===n){const c=n.document?r.version:null;l=new Tt(n,e,s,t,c)}else{a=new V(H._createBefore(n),o.createPositionAfter(n));const c=a.root.document?r.version:null;l=new Me(a,e,s,t,c)}o.batch.addOperation(l),i.applyOperation(l)}}function Io(o,e,t,n,i){const r=o.model,s=r.document,a=new Ge(e,t,n,r.markers,!!i,s.version);o.batch.addOperation(a),r.applyOperation(a)}function I1(o,e,t,n){let i;if(o.root.document){const r=n.document,s=new H(r.graveyard,[0]);i=new ce(o,e,s,r.version)}else i=new B1(o,e);t.addOperation(i),n.applyOperation(i)}function iu(o,e){return o===e||o instanceof Di&&e instanceof Di}function P1(o,e,t={}){if(e.isCollapsed)return;const n=e.getFirstRange();if(n.root.rootName=="$graveyard")return;const i=o.schema;o.change(r=>{if(!t.doNotResetEntireContent&&function(c,d){const u=c.getLimitElement(d);if(!d.containsEntireContent(u))return!1;const g=d.getFirstRange();return g.start.parent==g.end.parent?!1:c.checkChild(u,"paragraph")}(i,e))return void function(c,d){const u=c.model.schema.getLimitElement(d);c.remove(c.createRangeIn(u)),au(c,c.createPositionAt(u,0),d)}(r,e);const s={};if(!t.doNotAutoparagraph){const c=e.getSelectedElement();c&&Object.assign(s,i.getAttributesWithProperty(c,"copyOnReplace",!0))}const[a,l]=function(c){const d=c.root.document.model,u=c.start;let g=c.end;if(d.hasContent(c,{ignoreMarkers:!0})){const f=function(b){const A=b.parent,E=A.root.document.model.schema,P=A.getAncestors({parentFirst:!0,includeSelf:!0});for(const z of P){if(E.isLimit(z))return null;if(E.isBlock(z))return z}}(g);if(f&&g.isTouching(d.createPositionAt(f,0))){const b=d.createSelection(c);d.modifySelection(b,{direction:"backward"});const A=b.getLastPosition(),E=d.createRange(A,g);d.hasContent(E,{ignoreMarkers:!0})||(g=A)}}return[Je.fromPosition(u,"toPrevious"),Je.fromPosition(g,"toNext")]}(n);a.isTouching(l)||r.remove(r.createRange(a,l)),t.leaveUnmerged||(function(c,d,u){const g=c.model;if(!Rs(c.model.schema,d,u))return;const[f,b]=function(A,E){const P=A.getAncestors(),z=E.getAncestors();let j=0;for(;P[j]&&P[j]==z[j];)j++;return[P[j],z[j]]}(d,u);!f||!b||(!g.hasContent(f,{ignoreMarkers:!0})&&g.hasContent(b,{ignoreMarkers:!0})?su(c,d,u,f.parent):ru(c,d,u,f.parent))}(r,a,l),i.removeDisallowedAttributes(a.parent.getChildren(),r)),lu(r,e,a),!t.doNotAutoparagraph&&function(c,d){const u=c.checkChild(d,"$text"),g=c.checkChild(d,"paragraph");return!u&&g}(i,a)&&au(r,a,e,s),a.detach(),l.detach()})}function ru(o,e,t,n){const i=e.parent,r=t.parent;if(i!=n&&r!=n){for(e=o.createPositionAfter(i),(t=o.createPositionBefore(r)).isEqual(e)||o.insert(r,e),o.merge(e);t.parent.isEmpty;){const s=t.parent;t=o.createPositionBefore(s),o.remove(s)}Rs(o.model.schema,e,t)&&ru(o,e,t,n)}}function su(o,e,t,n){const i=e.parent,r=t.parent;if(i!=n&&r!=n){for(e=o.createPositionAfter(i),(t=o.createPositionBefore(r)).isEqual(e)||o.insert(i,t);e.parent.isEmpty;){const s=e.parent;e=o.createPositionBefore(s),o.remove(s)}t=o.createPositionBefore(r),function(s,a){const l=a.nodeBefore,c=a.nodeAfter;l.name!=c.name&&s.rename(l,c.name),s.clearAttributes(l),s.setAttributes(Object.fromEntries(c.getAttributes()),l),s.merge(a)}(o,t),Rs(o.model.schema,e,t)&&su(o,e,t,n)}}function Rs(o,e,t){const n=e.parent,i=t.parent;return n!=i&&!o.isLimit(n)&&!o.isLimit(i)&&function(r,s,a){const l=new V(r,s);for(const c of l.getWalker())if(a.isLimit(c.item))return!1;return!0}(e,t,o)}function au(o,e,t,n={}){const i=o.createElement("paragraph");o.model.schema.setAllowedAttributes(i,n,o),o.insert(i,e),lu(o,t,o.createPositionAt(i,0))}function lu(o,e,t){e instanceof mt?o.setSelection(t):e.setTo(t)}function cu(o,e){const t=[];Array.from(o.getItems({direction:"backward"})).map(n=>e.createRangeOn(n)).filter(n=>(n.start.isAfter(o.start)||n.start.isEqual(o.start))&&(n.end.isBefore(o.end)||n.end.isEqual(o.end))).forEach(n=>{t.push(n.start.parent),e.remove(n)}),t.forEach(n=>{let i=n;for(;i.parent&&i.isEmpty;){const r=e.createRangeOn(i);i=i.parent,e.remove(r)}})}class R1{constructor(e,t,n){this._firstNode=null,this._lastNode=null,this._lastAutoParagraph=null,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null,this._nodeToSelect=null,this.model=e,this.writer=t,this.position=n,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._documentFragment=t.createDocumentFragment(),this._documentFragmentPosition=t.createPositionAt(this._documentFragment,0)}handleNodes(e){for(const t of Array.from(e))this._handleNode(t);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}_updateLastNodeFromAutoParagraph(e){const t=this.writer.createPositionAfter(this._lastNode),n=this.writer.createPositionAfter(e);if(n.isAfter(t)){if(this._lastNode=e,this.position.parent!=e||!this.position.isAtEnd)throw new I("insertcontent-invalid-insertion-position",this);this.position=n,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this._nodeToSelect?V._createOn(this._nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new V(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=Je.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 I("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=Je.fromPosition(e,"toPrevious")),this._affectedEnd&&!this._affectedEnd.isBefore(e)||(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=Je.fromPosition(e,"toNext"))}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof ke)||!this._canMergeLeft(e))return;const t=Je._createBefore(e);t.stickiness="toNext";const n=Je.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=Je._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=Je._createAt(t.nodeBefore,"end","toNext")),this.position=n.toPosition(),n.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_mergeOnRight(){const e=this._lastNode;if(!(e instanceof ke)||!this._canMergeRight(e))return;const t=Je._createAfter(e);if(t.stickiness="toNext",!this.position.isEqual(t))throw new I("insertcontent-invalid-insertion-position",this);this.position=H._createAt(t.nodeBefore,"end");const n=Je.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=Je._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=Je._createAt(t.nodeBefore,0,"toPrevious")),this.position=n.toPosition(),n.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_canMergeLeft(e){const t=e.previousSibling;return t instanceof ke&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){const t=e.nextSibling;return t instanceof ke&&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 n=this.position.parent;this.position=this.writer.createPositionBefore(n),n.isEmpty&&n.parent===t&&this.writer.remove(n)}else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const n=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=n,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 du(o,e,t="auto"){const n=o.getSelectedElement();if(n&&e.schema.isObject(n)&&!e.schema.isInline(n))return t=="before"||t=="after"?e.createRange(e.createPositionAt(n,t)):e.createRangeOn(n);const i=ze(o.getSelectedBlocks());if(!i)return e.createRange(o.focus);if(i.isEmpty)return e.createRange(e.createPositionAt(i,0));const r=e.createPositionAfter(i);return o.focus.isTouching(r)?e.createRange(r):e.createRange(e.createPositionBefore(i))}function O1(o,e,t,n={}){if(!o.schema.isObject(e))throw new I("insertobject-element-not-an-object",o,{object:e});const i=t||o.document.selection;let r=i;n.findOptimalPosition&&o.schema.isBlock(e)&&(r=o.createSelection(du(i,o,n.findOptimalPosition)));const s=ze(i.getSelectedBlocks()),a={};return s&&Object.assign(a,o.schema.getAttributesWithProperty(s,"copyOnReplace",!0)),o.change(l=>{r.isCollapsed||o.deleteContent(r,{doNotAutoparagraph:!0});let c=e;const d=r.anchor.parent;!o.schema.checkChild(d,e)&&o.schema.checkChild(d,"paragraph")&&o.schema.checkChild("paragraph",e)&&(c=l.createElement("paragraph"),l.insert(e,c)),o.schema.setAllowedAttributes(c,a,l);const u=o.insertContent(c,r);return u.isCollapsed||n.setSelection&&function(g,f,b,A){const E=g.model;if(b=="on")return void g.setSelection(f,"on");if(b!="after")throw new I("insertobject-invalid-place-parameter-value",E);let P=f.nextSibling;if(E.schema.isInline(f))return void g.setSelection(f,"after");!(P&&E.schema.checkChild(P,"$text"))&&E.schema.checkChild(f.parent,"paragraph")&&(P=g.createElement("paragraph"),E.schema.setAllowedAttributes(P,A,g),E.insertContent(P,g.createPositionAfter(f))),P&&g.setSelection(P,0)}(l,e,n.setSelection,a),u})}const N1=' ,.?!:;"-()';function z1(o,e){const{isForward:t,walker:n,unit:i,schema:r,treatEmojiAsSingleUnit:s}=o,{type:a,item:l,nextPosition:c}=e;if(a=="text")return o.unit==="word"?function(d,u){let g=d.position.textNode;for(g||(g=u?d.position.nodeAfter:d.position.nodeBefore);g&&g.is("$text");){const f=d.position.offset-g.startOffset;if(V1(g,f,u))g=u?d.position.nodeAfter:d.position.nodeBefore;else{if(F1(g.data,f,u))break;d.next()}}return d.position}(n,t):function(d,u,g){const f=d.position.textNode;if(f){const b=f.data;let A=d.position.offset-f.startOffset;for(;Wr(b,A)||u=="character"&&Kr(b,A)||g&&Rc(b,A);)d.next(),A=d.position.offset-f.startOffset}return d.position}(n,i,s);if(a==(t?"elementStart":"elementEnd")){if(r.isSelectable(l))return H._createAt(l,t?"after":"before");if(r.checkChild(c,"$text"))return c}else{if(r.isLimit(l))return void n.skip(()=>!0);if(r.checkChild(c,"$text"))return c}}function M1(o,e){const t=o.root,n=H._createAt(t,e?"end":0);return e?new V(o,n):new V(n,o)}function F1(o,e,t){const n=e+(t?0:-1);return N1.includes(o.charAt(n))}function V1(o,e,t){return e===(t?o.offsetSize:0)}class L1 extends ge(){constructor(){super(),this.markers=new D1,this.document=new C1(this),this.schema=new zy,this._pendingChanges=[],this._currentWriter=null,["deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach(e=>this.decorate(e)),this.on("applyOperation",(e,t)=>{t[0]._validate()},{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$container",{allowIn:["$root","$container"]}),this.schema.register("$block",{allowIn:["$root","$container"],isBlock:!0}),this.schema.register("$blockObject",{allowWhere:"$block",isBlock:!0,isObject:!0}),this.schema.register("$inlineObject",{allowWhere:"$text",allowAttributesOf:"$text",isInline:!0,isObject:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$documentFragment",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$marker"),this.schema.addChildCheck((e,t)=>{if(t.name==="$marker")return!0}),Ry(this),this.document.registerPostFixer(vh),this.on("insertContent",(e,[t,n])=>{e.return=function(i,r,s){return i.change(a=>{const l=s||i.document.selection;l.isCollapsed||i.deleteContent(l,{doNotAutoparagraph:!0});const c=new R1(i,a,l.anchor),d=[];let u;if(r.is("documentFragment")){if(r.markers.size){const b=[];for(const[A,E]of r.markers){const{start:P,end:z}=E,j=P.isEqual(z);b.push({position:P,name:A,isCollapsed:j},{position:z,name:A,isCollapsed:j})}b.sort(({position:A},{position:E})=>A.isBefore(E)?1:-1);for(const{position:A,name:E,isCollapsed:P}of b){let z=null,j=null;const Y=A.parent===r&&A.isAtStart,ie=A.parent===r&&A.isAtEnd;Y||ie?P&&(j=Y?"start":"end"):(z=a.createElement("$marker"),a.insert(z,A)),d.push({name:E,element:z,collapsed:j})}}u=r.getChildren()}else u=[r];c.handleNodes(u);let g=c.getSelectionRange();if(r.is("documentFragment")&&d.length){const b=g?Bt.fromRange(g):null,A={};for(let E=d.length-1;E>=0;E--){const{name:P,element:z,collapsed:j}=d[E],Y=!A[P];if(Y&&(A[P]=[]),z){const ie=a.createPositionAt(z,"before");A[P].push(ie),a.remove(z)}else{const ie=c.getAffectedRange();if(!ie){j&&A[P].push(c.position);continue}j?A[P].push(ie[j]):A[P].push(Y?ie.start:ie.end)}}for(const[E,[P,z]]of Object.entries(A))P&&z&&P.root===z.root&&a.addMarker(E,{usingOperation:!0,affectsData:!0,range:new V(P,z)});b&&(g=b.toRange(),b.detach())}g&&(l instanceof mt?a.setSelection(g):l.setTo(g));const f=c.getAffectedRange()||i.createRange(l.anchor);return c.destroy(),f})}(this,t,n)}),this.on("insertObject",(e,[t,n,i])=>{e.return=O1(this,t,n,i)}),this.on("canEditAt",e=>{const t=!this.document.isReadOnly;e.return=t,t||e.stop()})}change(e){try{return this._pendingChanges.length===0?(this._pendingChanges.push({batch:new $n,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(t){I.rethrowUnexpectedError(t,this)}}enqueueChange(e,t){try{e?typeof e=="function"?(t=e,e=new $n):e instanceof $n||(e=new $n(e)):e=new $n,this._pendingChanges.push({batch:e,callback:t}),this._pendingChanges.length==1&&this._runPendingChanges()}catch(n){I.rethrowUnexpectedError(n,this)}}applyOperation(e){e._execute()}insertContent(e,t,n,...i){const r=Os(t,n);return this.fire("insertContent",[e,r,n,...i])}insertObject(e,t,n,i,...r){const s=Os(t,n);return this.fire("insertObject",[e,s,i,i,...r])}deleteContent(e,t){P1(this,e,t)}modifySelection(e,t){(function(n,i,r={}){const s=n.schema,a=r.direction!="backward",l=r.unit?r.unit:"character",c=!!r.treatEmojiAsSingleUnit,d=i.focus,u=new vt({boundaries:M1(d,a),singleCharacters:!0,direction:a?"forward":"backward"}),g={walker:u,schema:s,isForward:a,unit:l,treatEmojiAsSingleUnit:c};let f;for(;f=u.next();){if(f.done)return;const b=z1(g,f.value);if(b)return void(i instanceof mt?n.change(A=>{A.setSelectionFocus(b)}):i.setFocus(b))}})(this,e,t)}getSelectedContent(e){return function(t,n){return t.change(i=>{const r=i.createDocumentFragment(),s=n.getFirstRange();if(!s||s.isCollapsed)return r;const a=s.start.root,l=s.start.getCommonPath(s.end),c=a.getNodeByPath(l);let d;d=s.start.parent==s.end.parent?s:i.createRange(i.createPositionAt(c,s.start.path[l.length]),i.createPositionAt(c,s.end.path[l.length]+1));const u=d.end.offset-d.start.offset;for(const g of d.getItems({shallow:!0}))g.is("$textProxy")?i.appendText(g.data,g.getAttributes(),r):i.append(i.cloneElement(g,!0),r);if(d!=s){const g=s._getTransformedByMove(d.start,i.createPositionAt(r,0),u)[0],f=i.createRange(i.createPositionAt(r,0),g.start);cu(i.createRange(g.end,i.createPositionAt(r,"end")),i),cu(f,i)}return r})}(this,e)}hasContent(e,t={}){const n=e instanceof V?e:V._createIn(e);if(n.isCollapsed)return!1;const{ignoreWhitespaces:i=!1,ignoreMarkers:r=!1}=t;if(!r){for(const s of this.markers.getMarkersIntersectingRange(n))if(s.affectsData)return!0}for(const s of n.getItems())if(this.schema.isContent(s)&&(!s.is("$textProxy")||!i||s.data.search(/\S/)!==-1))return!0;return!1}canEditAt(e){const t=Os(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,n){return new H(e,t,n)}createPositionAt(e,t){return H._createAt(e,t)}createPositionAfter(e){return H._createAfter(e)}createPositionBefore(e){return H._createBefore(e)}createRange(e,t){return new V(e,t)}createRangeIn(e){return V._createIn(e)}createRangeOn(e){return V._createOn(e)}createSelection(...e){return new nt(...e)}createBatch(e){return new $n(e)}createOperationFromJSON(e){return i1.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];this.fire("_beforeChanges");try{for(;this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new T1(this,t);const n=this._pendingChanges[0].callback(this._currentWriter);e.push(n),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}}finally{this._pendingChanges.length=0,this._currentWriter=null,this.fire("_afterChanges")}return e}}function Os(o,e){if(o)return o instanceof nt||o instanceof mt?o:o instanceof hn?e||e===0?new nt(o,e):o.is("rootElement")?new nt(o,"in"):new nt(o,"on"):new nt(o)}class j1 extends $t{constructor(){super(...arguments),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}class Ns extends $t{constructor(){super(...arguments),this.domEventType=["mousedown","mouseup","mouseover","mouseout"]}onDomEvent(e){this.fire(e.type,e)}}class Bi{constructor(e){this.document=e}createDocumentFragment(e){return new dn(this.document,e)}createElement(e,t,n){return new et(this.document,e,t,n)}createText(e){return new pe(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,n){return n._insertChild(e,t)}removeChildren(e,t,n){return n._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const n=e.parent;if(n){const i=n.getChildIndex(e);return this.removeChildren(i,1,n),this.insertChild(i,t,n),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const n=t.getChildIndex(e);this.remove(e),this.insertChild(n,e.getChildren(),t)}}rename(e,t){const n=new et(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,n)?n:null}setAttribute(e,t,n){n._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){Ke(e)&&n===void 0?t._setStyle(e):n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return U._createAt(e,t)}createPositionAfter(e){return U._createAfter(e)}createPositionBefore(e){return U._createBefore(e)}createRange(e,t){return new X(e,t)}createRangeOn(e){return X._createOn(e)}createRangeIn(e){return X._createIn(e)}createSelection(...e){return new At(...e)}}function $1(o=""){if(o==="")return{top:void 0,right:void 0,bottom:void 0,left:void 0};const e=o.replace(/, /g,",").split(" ").map(r=>r.replace(/,/g,", ")),t=e[0],n=e[2]||t,i=e[1]||t;return{top:t,bottom:n,right:i,left:e[3]||i}}function H1({top:o,right:e,bottom:t,left:n}){const i=[];return n!==e?i.push(o,e,t,n):t!==o?i.push(o,e,t):e!==o?i.push(o,e):i.push(o),i.join(" ")}function q1(o){var e,t;o.setNormalizer("margin",(e="margin",n=>({path:e,value:$1(n)}))),o.setNormalizer("margin-top",n=>({path:"margin.top",value:n})),o.setNormalizer("margin-right",n=>({path:"margin.right",value:n})),o.setNormalizer("margin-bottom",n=>({path:"margin.bottom",value:n})),o.setNormalizer("margin-left",n=>({path:"margin.left",value:n})),o.setReducer("margin",(t="margin",n=>{const{top:i,right:r,bottom:s,left:a}=n,l=[];return[i,r,a,s].every(c=>!!c)?l.push([t,H1(n)]):(i&&l.push([t+"-top",i]),r&&l.push([t+"-right",r]),s&&l.push([t+"-bottom",s]),a&&l.push([t+"-left",a])),l})),o.setStyleRelation("margin",["margin-top","margin-right","margin-bottom","margin-left"])}class U1{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const n=this.get(e);if(!n)throw new I("commandcollection-command-not-found",this,{commandName:e});return n.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 W1 extends ge(){constructor(e={}){super();const t=this.constructor,n=e.language||t.defaultConfig&&t.defaultConfig.language;this._context=e.context||new dd({language:n}),this._context._addEditor(this,!e.context);const i=Array.from(t.builtinPlugins||[]);this.config=new hc(e,t.defaultConfig),this.config.define("plugins",i),this.config.define(this._context._getEditorConfig()),this.plugins=new cd(this,i,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new U1,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.model=new L1,this.on("change:isReadOnly",()=>{this.model.document.isReadOnly=this.isReadOnly});const r=new kv;this.data=new n1(this.model,r),this.editing=new Oy(this.model,r),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new o1([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 FC(this),this.keystrokes.listenTo(this.editing.view.document)}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new I("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new I("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)||(this._readOnlyLocks.add(e),this._readOnlyLocks.size===1&&this.fire("change:isReadOnly","isReadOnly",!0,!1))}disableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new I("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)&&(this._readOnlyLocks.delete(e),this._readOnlyLocks.size===0&&this.fire("change:isReadOnly","isReadOnly",!1,!0))}initPlugins(){const e=this.config,t=e.get("plugins"),n=e.get("removePlugins")||[],i=e.get("extraPlugins")||[],r=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(i),n,r)}destroy(){let e=Promise.resolve();return this.state=="initializing"&&(e=new Promise(t=>this.once("ready",t))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(e,...t){try{return this.commands.execute(e,...t)}catch(n){I.rethrowUnexpectedError(n,this)}}focus(){this.editing.view.focus()}static create(...e){throw new Error("This is an abstract method.")}}function Ti(o){return class extends o{setData(e){this.data.set(e)}getData(e){return this.data.get(e)}}}{const o=Ti(Object);Ti.setData=o.prototype.setData,Ti.getData=o.prototype.getData}function zs(o){return class extends o{updateSourceElement(e=this.data.get()){if(!this.sourceElement)throw new I("editor-missing-sourceelement",this);const t=this.config.get("updateSourceElementOnDestroy"),n=this.sourceElement instanceof HTMLTextAreaElement;lC(this.sourceElement,t||n?e:"")}}}zs.updateSourceElement=zs(Object).prototype.updateSourceElement;class Ii extends ui{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new at({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if(typeof e!="string")throw new I("pendingactions-add-invalid-message",this);const t=new(ge());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 ve={bold:'<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>',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>',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>',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>',importExport:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#a)"><path clip-rule="evenodd" d="M19 4.5 14 0H3v12.673l.868-1.041c.185-.222.4-.402.632-.54V1.5h8v5h5v7.626a2.24 2.24 0 0 1 1.5.822V4.5ZM14 5V2l3.3 3H14Zm-3.692 12.5c.062.105.133.206.213.303L11.52 19H8v-.876a2.243 2.243 0 0 0 1.82-.624h.488Zm7.518-.657a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0l2.346-2.815Zm-15.056-.38a.75.75 0 0 1-.096-1.056l2.346-2.815a.95.95 0 0 1 1.46 0l2.346 2.815a.75.75 0 1 1-1.152.96L6.5 14.96V20H5v-5.04l-1.174 1.408a.75.75 0 0 1-1.056.096Z"/></g><defs><clipPath id="a"><path d="M0 0h20v20H0z"/></clipPath></defs></svg>',paragraph:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5zM5 3h6.5v.025a5 5 0 0 1 0 9.95V13H7v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/></svg>',plus:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 2a1 1 0 0 0-1 1v6H3a1 1 0 1 0 0 2h6v6a1 1 0 1 0 2 0v-6h6a1 1 0 1 0 0-2h-6V3a1 1 0 0 0-1-1Z"/></svg>',text:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#a)"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555Zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13Z"/><path clip-rule="evenodd" d="m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17h-.023Zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254l-1.641 3.813Z"/></g><defs><clipPath id="a"><path d="M0 0h20v20H0z"/></clipPath></defs></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>'};var hu=D(5542),K1={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(hu.Z,K1),hu.Z.locals;const{threeVerticalDots:uu}=ve,G1={alignLeft:ve.alignLeft,bold:ve.bold,importExport:ve.importExport,paragraph:ve.paragraph,plus:ve.plus,text:ve.text,threeVerticalDots:ve.threeVerticalDots};class Ms extends re{constructor(e,t){super(e);const n=this.bindTemplate,i=this.t;this.options=t||{},this.set("ariaLabel",i("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new ht,this.keystrokes=new St,this.set("class",void 0),this.set("isCompact",!1),this.itemsView=new Z1(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const r=e.uiLanguageDirection==="rtl";this._focusCycler=new bo({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[r?"arrowright":"arrowleft","arrowup"],focusNext:[r?"arrowleft":"arrowright","arrowdown"]}});const s=["ck","ck-toolbar",n.to("class"),n.if("isCompact","ck-toolbar_compact")];var a;this.options.shouldGroupWhenFull&&this.options.isFloating&&s.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:s,role:"toolbar","aria-label":n.to("ariaLabel"),style:{maxWidth:n.to("maxWidth")},tabindex:-1},children:this.children,on:{mousedown:(a=this,a.bindTemplate.to(l=>{l.target===a.element&&l.preventDefault()}))}}),this._behavior=this.options.shouldGroupWhenFull?new Y1(this):new J1(this)}render(){super.render(),this.focusTracker.add(this.element);for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t,n){this.items.addMany(this._buildItemsFromConfig(e,t,n))}_buildItemsFromConfig(e,t,n){const i=rd(e),r=n||i.removeItems;return this._cleanItemsConfiguration(i.items,t,r).map(s=>xe(s)?this._createNestedToolbarDropdown(s,t,r):s==="|"?new id:s==="-"?new MC:t.create(s)).filter(s=>!!s)}_cleanItemsConfiguration(e,t,n){const i=e.filter((r,s,a)=>r==="|"||n.indexOf(r)===-1&&(r==="-"?!this.options.shouldGroupWhenFull||(Q("toolbarview-line-break-ignored-when-grouping-items",a),!1):!(!xe(r)&&!t.has(r))||(Q("toolbarview-item-unavailable",{item:r}),!1)));return this._cleanSeparatorsAndLineBreaks(i)}_cleanSeparatorsAndLineBreaks(e){const t=s=>s!=="-"&&s!=="|",n=e.length,i=e.findIndex(t);if(i===-1)return[];const r=n-e.slice().reverse().findIndex(t);return e.slice(i,r).filter((s,a,l)=>t(s)?!0:!(a>0&&l[a-1]===s))}_createNestedToolbarDropdown(e,t,n){let{label:i,icon:r,items:s,tooltip:a=!0,withText:l=!1}=e;if(s=this._cleanItemsConfiguration(s,t,n),!s.length)return null;const c=Pt(this.locale);return i||Q("toolbarview-nested-toolbar-dropdown-missing-label",e),c.class="ck-toolbar__nested-toolbar-dropdown",c.buttonView.set({label:i,tooltip:a,withText:!!l}),r!==!1?c.buttonView.icon=G1[r]||r||uu:c.buttonView.withText=!0,Pi(c,()=>c.toolbarView._buildItemsFromConfig(s,t,n)),c}}class Z1 extends re{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class J1{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using(n=>n),e.focusables.bindTo(e.items).using(n=>n),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class Y1{constructor(e){this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.ungroupedItems=e.createCollection(),this.groupedItems=e.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),e.itemsView.children.bindTo(this.ungroupedItems).using(t=>t),this.ungroupedItems.on("change",this._updateFocusCycleableItems.bind(this)),e.children.on("change",this._updateFocusCycleableItems.bind(this)),e.items.on("change",(t,n)=>{const i=n.index,r=Array.from(n.added);for(const s of n.removed)i>=this.ungroupedItems.length?this.groupedItems.remove(s):this.ungroupedItems.remove(s);for(let s=i;s<i+r.length;s++){const a=r[s-i];s>this.ungroupedItems.length?this.groupedItems.add(a,s-this.ungroupedItems.length):this.ungroupedItems.add(a,s)}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(!nn(this.viewElement))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,n=new De(e.lastChild),i=new De(e);if(!this.cachedPadding){const r=oe.window.getComputedStyle(e),s=t==="ltr"?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(r[s])}return t==="ltr"?n.right>i.right-this.cachedPadding:n.left<i.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new si(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 id),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,n=Pt(e);return n.class="ck-toolbar__grouped-dropdown",n.panelPosition=e.uiLanguageDirection==="ltr"?"sw":"se",Pi(n,this.groupedItems),n.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:e.uiLanguageDirection==="rtl"?"se":"sw",icon:uu}),n}_updateFocusCycleableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}var mu=D(1046),Q1={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(mu.Z,Q1),mu.Z.locals;class X1 extends re{constructor(e){super(e);const t=this.bindTemplate;this.items=this.createCollection(),this.focusTracker=new ht,this.keystrokes=new St,this._focusCycler=new bo({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.set("ariaLabel",void 0),this.set("role",void 0),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"],role:t.to("role"),"aria-label":t.to("ariaLabel")},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)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}class gu extends re{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!0),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item",t.if("isVisible","ck-hidden",n=>!n)],role:"presentation"},children:this.children})}focus(){this.children.first.focus()}}class eE extends re{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}var pu=D(7686),tE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(pu.Z,tE),pu.Z.locals;class Fs extends re{constructor(e){super(e);const t=this.bindTemplate;this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isToggleable",!1),this.set("isVisible",!0),this.set("keystroke",void 0),this.set("withKeystroke",!1),this.set("label",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.children=this.createCollection(),this.actionView=this._createActionView(),this.arrowView=this._createArrowView(),this.keystrokes=new St,this.focusTracker=new ht,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",t.to("class"),t.if("isVisible","ck-hidden",n=>!n),this.arrowView.bindTemplate.if("isOn","ck-splitbutton_open")]},children:this.children})}render(){super.render(),this.children.add(this.actionView),this.children.add(this.arrowView),this.focusTracker.add(this.actionView.element),this.focusTracker.add(this.arrowView.element),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",(e,t)=>{this.focusTracker.focusedElement===this.actionView.element&&(this.arrowView.focus(),t())}),this.keystrokes.set("arrowleft",(e,t)=>{this.focusTracker.focusedElement===this.arrowView.element&&(this.actionView.focus(),t())})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.actionView.focus()}_createActionView(){const e=new Ae;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 Ae,t=e.bindTemplate;return e.icon=nd,e.extendTemplate({attributes:{class:["ck-splitbutton__arrow"],"data-cke-tooltip-disabled":t.to("isOn"),"aria-haspopup":!0,"aria-expanded":t.to("isOn",n=>String(n))}}),e.bind("isEnabled").to(this),e.bind("label").to(this),e.bind("tooltip").to(this),e.delegate("execute").to(this,"open"),e}}var fu=D(7339),nE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(fu.Z,nE),fu.Z.locals;var ku=D(3949),oE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(ku.Z,oE),ku.Z.locals;function Pt(o,e=od){const t=new e(o),n=new NC(o),i=new Yr(o,t,n);return t.bind("isEnabled").to(i),t instanceof Fs?t.arrowView.bind("isOn").to(i,"isOpen"):t.bind("isOn").to(i,"isOpen"),function(r){(function(s){s.on("render",()=>{w({emitter:s,activator:()=>s.isOpen,callback:()=>{s.isOpen=!1},contextElements:[s.element]})})})(r),function(s){s.on("execute",a=>{a.source instanceof hi||(s.isOpen=!1)})}(r),function(s){s.focusTracker.on("change:isFocused",(a,l,c)=>{s.isOpen&&!c&&(s.isOpen=!1)})}(r),function(s){s.keystrokes.set("arrowdown",(a,l)=>{s.isOpen&&(s.panelView.focus(),l())}),s.keystrokes.set("arrowup",(a,l)=>{s.isOpen&&(s.panelView.focusLast(),l())})}(r),function(s){s.on("change:isOpen",(a,l,c)=>{if(c)return;const d=s.panelView.element;d&&d.contains(oe.document.activeElement)&&s.buttonView.focus()})}(r),function(s){s.on("change:isOpen",(a,l,c)=>{c&&s.panelView.focus()},{priority:"low"})}(r)}(i),i}function Pi(o,e,t={}){o.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),o.isOpen?bu(o,e,t):o.once("change:isOpen",()=>bu(o,e,t),{priority:"highest"}),t.enableActiveItemFocusOnDropdownOpen&&Au(o,()=>o.toolbarView.items.find(n=>n.isOn))}function bu(o,e,t){const n=o.locale,i=n.t,r=o.toolbarView=new Ms(n),s=typeof e=="function"?e():e;r.ariaLabel=t.ariaLabel||i("Dropdown toolbar"),t.maxWidth&&(r.maxWidth=t.maxWidth),t.class&&(r.class=t.class),t.isCompact&&(r.isCompact=t.isCompact),t.isVertical&&(r.isVertical=!0),s instanceof on?r.items.bindTo(s).using(a=>a):r.items.addMany(s),o.panelView.children.add(r),r.items.delegate("execute").to(o)}function Vs(o,e,t={}){o.isOpen?wu(o,e,t):o.once("change:isOpen",()=>wu(o,e,t),{priority:"highest"}),Au(o,()=>o.listView.items.find(n=>n instanceof gu&&n.children.first.isOn))}function wu(o,e,t){const n=o.locale,i=o.listView=new X1(n),r=typeof e=="function"?e():e;i.ariaLabel=t.ariaLabel,i.role=t.role,i.items.bindTo(r).using(s=>{if(s.type==="separator")return new eE(n);if(s.type==="button"||s.type==="switchbutton"){const a=new gu(n);let l;return l=s.type==="button"?new Ae(n):new hi(n),l.bind(...Object.keys(s.model)).to(s.model),l.delegate("execute").to(a),a.children.add(l),a}return null}),o.panelView.children.add(i),i.items.delegate("execute").to(o)}function Au(o,e){o.on("change:isOpen",()=>{if(!o.isOpen)return;const t=e();t&&(typeof t.focus=="function"?t.focus():Q("ui-dropdown-focus-child-on-open-child-missing-focus",{view:t}))},{priority:te.low-10})}function _u(o,e,t){const n=new OC(o.locale);return n.set({id:e,ariaDescribedById:t}),n.bind("isReadOnly").to(o,"isEnabled",i=>!i),n.bind("hasError").to(o,"errorText",i=>!!i),n.on("input",()=>{o.errorText=null}),o.bind("isEmpty","isFocused","placeholder").to(n),n}const Po=(o,e=0,t=1)=>o>t?t:o<e?e:o,He=(o,e=0,t=Math.pow(10,e))=>Math.round(t*o)/t,Ls=o=>(o[0]==="#"&&(o=o.substring(1)),o.length<6?{r:parseInt(o[0]+o[0],16),g:parseInt(o[1]+o[1],16),b:parseInt(o[2]+o[2],16),a:o.length===4?He(parseInt(o[3]+o[3],16)/255,2):1}:{r:parseInt(o.substring(0,2),16),g:parseInt(o.substring(2,4),16),b:parseInt(o.substring(4,6),16),a:o.length===8?He(parseInt(o.substring(6,8),16)/255,2):1}),iE=({h:o,s:e,v:t,a:n})=>{const i=(200-e)*t/100;return{h:He(o),s:He(i>0&&i<200?e*t/100/(i<=100?i:200-i)*100:0),l:He(i/2),a:He(n,2)}},js=o=>{const{h:e,s:t,l:n}=iE(o);return`hsl(${e}, ${t}%, ${n}%)`},rE=({h:o,s:e,v:t,a:n})=>{o=o/360*6,e/=100,t/=100;const i=Math.floor(o),r=t*(1-e),s=t*(1-(o-i)*e),a=t*(1-(1-o+i)*e),l=i%6;return{r:He(255*[t,s,r,r,a,t][l]),g:He(255*[a,t,t,s,r,r][l]),b:He(255*[r,r,a,t,t,s][l]),a:He(n,2)}},Ri=o=>{const e=o.toString(16);return e.length<2?"0"+e:e},sE=({r:o,g:e,b:t,a:n})=>{const i=n<1?Ri(He(255*n)):"";return"#"+Ri(o)+Ri(e)+Ri(t)+i},aE=({r:o,g:e,b:t,a:n})=>{const i=Math.max(o,e,t),r=i-Math.min(o,e,t),s=r?i===o?(e-t)/r:i===e?2+(t-o)/r:4+(o-e)/r:0;return{h:He(60*(s<0?s+6:s)),s:He(i?r/i*100:0),v:He(i/255*100),a:n}},Cu=(o,e)=>{if(o===e)return!0;for(const t in o)if(o[t]!==e[t])return!1;return!0},vu={},yu=o=>{let e=vu[o];return e||(e=document.createElement("template"),e.innerHTML=o,vu[o]=e),e},$s=(o,e,t)=>{o.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))};let qn=!1;const Hs=o=>"touches"in o,Eu=(o,e)=>{const t=Hs(e)?e.touches[0]:e,n=o.el.getBoundingClientRect();$s(o.el,"move",o.getMove({x:Po((t.pageX-(n.left+window.pageXOffset))/n.width),y:Po((t.pageY-(n.top+window.pageYOffset))/n.height)}))};class xu{constructor(e,t,n,i){const r=yu(`<div role="slider" tabindex="0" part="${t}" ${n}><div part="${t}-pointer"></div></div>`);e.appendChild(r.content.cloneNode(!0));const s=e.querySelector(`[part=${t}]`);s.addEventListener("mousedown",this),s.addEventListener("touchstart",this),s.addEventListener("keydown",this),this.el=s,this.xy=i,this.nodes=[s.firstChild,s]}set dragging(e){const t=e?document.addEventListener:document.removeEventListener;t(qn?"touchmove":"mousemove",this),t(qn?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!(t=>!(qn&&!Hs(t)||(qn||(qn=Hs(t)),0)))(e)||!qn&&e.button!=0)return;this.el.focus(),Eu(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),Eu(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":((t,n)=>{const i=n.keyCode;i>40||t.xy&&i<37||i<33||(n.preventDefault(),$s(t.el,"move",t.getMove({x:i===39?.01:i===37?-.01:i===34?.05:i===33?-.05:i===35?1:i===36?-1:0,y:i===40?.01:i===38?-.01:0},!0)))})(this,e)}}style(e){e.forEach((t,n)=>{for(const i in t)this.nodes[n].style.setProperty(i,t[i])})}}class lE extends xu{constructor(e){super(e,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:e}){this.h=e,this.style([{left:e/360*100+"%",color:js({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${He(e)}`)}getMove(e,t){return{h:t?Po(this.h+360*e.x,0,360):360*e.x}}}class cE extends xu{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:100-e.v+"%",left:`${e.s}%`,color:js(e)},{"background-color":js({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${He(e.s)}%, Brightness ${He(e.v)}%`)}getMove(e,t){return{s:t?Po(this.hsva.s+100*e.x,0,100):100*e.x,v:t?Po(this.hsva.v-100*e.y,0,100):Math.round(100-100*e.y)}}}const Oi=Symbol("same"),qs=Symbol("color"),Su=Symbol("hsva"),Us=Symbol("update"),Du=Symbol("parts"),Bu=Symbol("css"),Tu=Symbol("sliders");class dE extends HTMLElement{static get observedAttributes(){return["color"]}get[Bu](){return[':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}',"[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}","[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}"]}get[Tu](){return[cE,lE]}get color(){return this[qs]}set color(e){if(!this[Oi](e)){const t=this.colorModel.toHsva(e);this[Us](t),this[qs]=e}}constructor(){super();const e=yu(`<style>${this[Bu].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[Du]=this[Tu].map(n=>new n(t))}connectedCallback(){if(this.hasOwnProperty("color")){const e=this.color;delete this.color,this.color=e}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(e,t,n){const i=this.colorModel.fromAttr(n);this[Oi](i)||(this.color=i)}handleEvent(e){const t=this[Su],n={...t,...e.detail};let i;this[Us](n),Cu(n,t)||this[Oi](i=this.colorModel.fromHsva(n))||(this[qs]=i,$s(this,"color-changed",{value:i}))}[Oi](e){return this.color&&this.colorModel.equal(e,this.color)}[Us](e){this[Su]=e,this[Du].forEach(t=>t.update(e))}}const hE={defaultColor:"#000",toHsva:o=>aE(Ls(o)),fromHsva:({h:o,s:e,v:t})=>sE(rE({h:o,s:e,v:t,a:1})),equal:(o,e)=>o.toLowerCase()===e.toLowerCase()||Cu(Ls(o),Ls(e)),fromAttr:o=>o};class uE extends dE{get colorModel(){return hE}}customElements.define("hex-color-picker",class extends uE{});var Iu=D(3398),mE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Iu.Z,mE),Iu.Z.locals;class gE{constructor(e){this._components=new Map,this.editor=e}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(Ws(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new I("componentfactory-item-missing",this,{name:e});return this._components.get(Ws(e)).callback(this.editor.locale)}has(e){return this._components.has(Ws(e))}}function Ws(o){return String(o).toLowerCase()}var Pu=D(8793),pE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Pu.Z,pE),Pu.Z.locals;var fE=Object.defineProperty,Ru=Object.getOwnPropertySymbols,kE=Object.prototype.hasOwnProperty,bE=Object.prototype.propertyIsEnumerable,Ou=(o,e,t)=>e in o?fE(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,le=(o,e)=>{for(var t in e||(e={}))kE.call(e,t)&&Ou(o,t,e[t]);if(Ru)for(var t of Ru(e))bE.call(e,t)&&Ou(o,t,e[t]);return o};const Nu=jr("px"),zu=oe.document.body,Ks=class extends re{constructor(o){super(o);const e=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class",void 0),this._pinWhenIsVisibleCallback=null,this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",e.to("position",t=>`ck-balloon-panel_${t}`),e.if("isVisible","ck-balloon-panel_visible"),e.if("withArrow","ck-balloon-panel_with-arrow"),e.to("class")],style:{top:e.to("top",Nu),left:e.to("left",Nu)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(o){this.show();const e=Ks.defaultPositions,t=Object.assign({},{element:this.element,positions:[e.southArrowNorth,e.southArrowNorthMiddleWest,e.southArrowNorthMiddleEast,e.southArrowNorthWest,e.southArrowNorthEast,e.northArrowSouth,e.northArrowSouthMiddleWest,e.northArrowSouthMiddleEast,e.northArrowSouthWest,e.northArrowSouthEast,e.viewportStickyNorth],limiter:zu,fitInViewport:!0},o),n=Ks._getOptimalPosition(t),i=parseInt(n.left),r=parseInt(n.top),s=n.name,a=n.config||{},{withArrow:l=!0}=a;this.top=r,this.left=i,this.position=s,this.withArrow=l}pin(o){this.unpin(),this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(o):this._stopPinning()},this._startPinning(o),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(o){this.attachTo(o);const e=Gs(o.target),t=o.limiter?Gs(o.limiter):zu;this.listenTo(oe.document,"scroll",(n,i)=>{const r=i.target,s=e&&r.contains(e),a=t&&r.contains(t);!s&&!a&&e&&t||this.attachTo(o)},{useCapture:!0}),this.listenTo(oe.window,"resize",()=>{this.attachTo(o)})}_stopPinning(){this.stopListening(oe.document,"scroll"),this.stopListening(oe.window,"resize")}};let Ye=Ks;function Gs(o){return Rn(o)?o:ii(o)?o.commonAncestorContainer:typeof o=="function"?Gs(o()):null}function Mu(o={}){const{sideOffset:e=Ye.arrowSideOffset,heightOffset:t=Ye.arrowHeightOffset,stickyVerticalOffset:n=Ye.stickyVerticalOffset,config:i}=o;return{northWestArrowSouthWest:(a,l)=>le({top:r(a,l),left:a.left-e,name:"arrow_sw"},i&&{config:i}),northWestArrowSouthMiddleWest:(a,l)=>le({top:r(a,l),left:a.left-.25*l.width-e,name:"arrow_smw"},i&&{config:i}),northWestArrowSouth:(a,l)=>le({top:r(a,l),left:a.left-l.width/2,name:"arrow_s"},i&&{config:i}),northWestArrowSouthMiddleEast:(a,l)=>le({top:r(a,l),left:a.left-.75*l.width+e,name:"arrow_sme"},i&&{config:i}),northWestArrowSouthEast:(a,l)=>le({top:r(a,l),left:a.left-l.width+e,name:"arrow_se"},i&&{config:i}),northArrowSouthWest:(a,l)=>le({top:r(a,l),left:a.left+a.width/2-e,name:"arrow_sw"},i&&{config:i}),northArrowSouthMiddleWest:(a,l)=>le({top:r(a,l),left:a.left+a.width/2-.25*l.width-e,name:"arrow_smw"},i&&{config:i}),northArrowSouth:(a,l)=>le({top:r(a,l),left:a.left+a.width/2-l.width/2,name:"arrow_s"},i&&{config:i}),northArrowSouthMiddleEast:(a,l)=>le({top:r(a,l),left:a.left+a.width/2-.75*l.width+e,name:"arrow_sme"},i&&{config:i}),northArrowSouthEast:(a,l)=>le({top:r(a,l),left:a.left+a.width/2-l.width+e,name:"arrow_se"},i&&{config:i}),northEastArrowSouthWest:(a,l)=>le({top:r(a,l),left:a.right-e,name:"arrow_sw"},i&&{config:i}),northEastArrowSouthMiddleWest:(a,l)=>le({top:r(a,l),left:a.right-.25*l.width-e,name:"arrow_smw"},i&&{config:i}),northEastArrowSouth:(a,l)=>le({top:r(a,l),left:a.right-l.width/2,name:"arrow_s"},i&&{config:i}),northEastArrowSouthMiddleEast:(a,l)=>le({top:r(a,l),left:a.right-.75*l.width+e,name:"arrow_sme"},i&&{config:i}),northEastArrowSouthEast:(a,l)=>le({top:r(a,l),left:a.right-l.width+e,name:"arrow_se"},i&&{config:i}),southWestArrowNorthWest:a=>le({top:s(a),left:a.left-e,name:"arrow_nw"},i&&{config:i}),southWestArrowNorthMiddleWest:(a,l)=>le({top:s(a),left:a.left-.25*l.width-e,name:"arrow_nmw"},i&&{config:i}),southWestArrowNorth:(a,l)=>le({top:s(a),left:a.left-l.width/2,name:"arrow_n"},i&&{config:i}),southWestArrowNorthMiddleEast:(a,l)=>le({top:s(a),left:a.left-.75*l.width+e,name:"arrow_nme"},i&&{config:i}),southWestArrowNorthEast:(a,l)=>le({top:s(a),left:a.left-l.width+e,name:"arrow_ne"},i&&{config:i}),southArrowNorthWest:a=>le({top:s(a),left:a.left+a.width/2-e,name:"arrow_nw"},i&&{config:i}),southArrowNorthMiddleWest:(a,l)=>le({top:s(a),left:a.left+a.width/2-.25*l.width-e,name:"arrow_nmw"},i&&{config:i}),southArrowNorth:(a,l)=>le({top:s(a),left:a.left+a.width/2-l.width/2,name:"arrow_n"},i&&{config:i}),southArrowNorthMiddleEast:(a,l)=>le({top:s(a),left:a.left+a.width/2-.75*l.width+e,name:"arrow_nme"},i&&{config:i}),southArrowNorthEast:(a,l)=>le({top:s(a),left:a.left+a.width/2-l.width+e,name:"arrow_ne"},i&&{config:i}),southEastArrowNorthWest:a=>le({top:s(a),left:a.right-e,name:"arrow_nw"},i&&{config:i}),southEastArrowNorthMiddleWest:(a,l)=>le({top:s(a),left:a.right-.25*l.width-e,name:"arrow_nmw"},i&&{config:i}),southEastArrowNorth:(a,l)=>le({top:s(a),left:a.right-l.width/2,name:"arrow_n"},i&&{config:i}),southEastArrowNorthMiddleEast:(a,l)=>le({top:s(a),left:a.right-.75*l.width+e,name:"arrow_nme"},i&&{config:i}),southEastArrowNorthEast:(a,l)=>le({top:s(a),left:a.right-l.width+e,name:"arrow_ne"},i&&{config:i}),westArrowEast:(a,l)=>le({top:a.top+a.height/2-l.height/2,left:a.left-l.width-t,name:"arrow_e"},i&&{config:i}),eastArrowWest:(a,l)=>le({top:a.top+a.height/2-l.height/2,left:a.right+t,name:"arrow_w"},i&&{config:i}),viewportStickyNorth:(a,l,c)=>a.getIntersection(c)?{top:c.top+n,left:a.left+a.width/2-l.width/2,name:"arrowless",config:le({withArrow:!1},i)}:null};function r(a,l){return a.top-l.height-t}function s(a){return a.bottom+t}}Ye.arrowSideOffset=25,Ye.arrowHeightOffset=10,Ye.stickyVerticalOffset=20,Ye._getOptimalPosition=vc,Ye.defaultPositions=Mu();var Fu=D(3332),wE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Fu.Z,wE),Fu.Z.locals;const Vu="ck-tooltip",Qe=class extends jt(){constructor(o){if(super(),this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._resizeObserver=null,Qe._editors.add(o),Qe._instance)return Qe._instance;Qe._instance=this,this.tooltipTextView=new re(o.locale),this.tooltipTextView.set("text",""),this.tooltipTextView.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:this.tooltipTextView.bindTemplate.to("text")}]}),this.balloonPanelView=new Ye(o.locale),this.balloonPanelView.class=Vu,this.balloonPanelView.content.add(this.tooltipTextView),this._pinTooltipDebounced=vo(this._pinTooltip,600),this.listenTo(oe.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(oe.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(oe.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(oe.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(oe.document,"scroll",this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(o){const e=o.ui.view&&o.ui.view.body;Qe._editors.delete(o),this.stopListening(o.ui),e&&e.has(this.balloonPanelView)&&e.remove(this.balloonPanelView),Qe._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),Qe._instance=null)}static getPositioningFunctions(o){const e=Qe.defaultBalloonPositions;return{s:[e.southArrowNorth,e.southArrowNorthEast,e.southArrowNorthWest],n:[e.northArrowSouth],e:[e.eastArrowWest],w:[e.westArrowEast],sw:[e.southArrowNorthEast],se:[e.southArrowNorthWest]}[o]}_onEnterOrFocus(o,{target:e}){const t=Zs(e);var n;t&&t!==this._currentElementWithTooltip&&(this._unpinTooltip(),this._pinTooltipDebounced(t,{text:(n=t).dataset.ckeTooltipText,position:n.dataset.ckeTooltipPosition||"s",cssClass:n.dataset.ckeTooltipClass||""}))}_onLeaveOrBlur(o,{target:e,relatedTarget:t}){if(o.name==="mouseleave"){if(!Rn(e)||this._currentElementWithTooltip&&e!==this._currentElementWithTooltip)return;const n=Zs(e),i=Zs(t);n&&n!==i&&this._unpinTooltip()}else{if(this._currentElementWithTooltip&&e!==this._currentElementWithTooltip)return;this._unpinTooltip()}}_onScroll(o,{target:e}){this._currentElementWithTooltip&&(e.contains(this.balloonPanelView.element)&&e.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(o,{text:e,position:t,cssClass:n}){const i=ze(Qe._editors.values()).ui.view.body;i.has(this.balloonPanelView)||i.add(this.balloonPanelView),this.tooltipTextView.text=e,this.balloonPanelView.pin({target:o,positions:Qe.getPositioningFunctions(t)}),this._resizeObserver=new si(o,()=>{nn(o)||this._unpinTooltip()}),this.balloonPanelView.class=[Vu,n].filter(r=>r).join(" ");for(const r of Qe._editors)this.listenTo(r.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=o,this._currentTooltipPosition=t}_unpinTooltip(){this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const o of Qe._editors)this.stopListening(o.ui,"update");this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._resizeObserver&&this._resizeObserver.destroy()}_updateTooltipPosition(){nn(this._currentElementWithTooltip)?this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:Qe.getPositioningFunctions(this._currentTooltipPosition)}):this._unpinTooltip()}};let Ni=Qe;function Zs(o){return Rn(o)?o.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}Ni.defaultBalloonPositions=Mu({heightOffset:5,sideOffset:13}),Ni._editors=new Set,Ni._instance=null;const Js=function(o,e,t){var n=!0,i=!0;if(typeof o!="function")throw new TypeError("Expected a function");return xe(t)&&(n="leading"in t?!!t.leading:n,i="trailing"in t?!!t.trailing:i),vo(o,e,{leading:n,maxWait:e,trailing:i})};var AE=Object.defineProperty,Lu=Object.getOwnPropertySymbols,_E=Object.prototype.hasOwnProperty,CE=Object.prototype.propertyIsEnumerable,ju=(o,e,t)=>e in o?AE(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,vE=(o,e)=>{for(var t in e||(e={}))_E.call(e,t)&&ju(o,t,e[t]);if(Lu)for(var t of Lu(e))CE.call(e,t)&&ju(o,t,e[t]);return o};const yE=50,EE=350,xE="Powered by",zi={top:-99999,left:-99999,name:"invalid",config:{withArrow:!1}};class SE extends jt(){constructor(e){super(),this.editor=e,this._balloonView=null,this._lastFocusedEditableElement=null,this._showBalloonThrottled=Js(this._showBalloon.bind(this),50,{leading:!0}),e.on("ready",this._handleEditorReady.bind(this))}destroy(){const e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){const e=this.editor;(function(t){function n(f){return f.match(/^[a-zA-Z0-9+/=$]+$/g)&&f.length>=40&&f.length<=255?"VALID":"INVALID"}let i="",r="";if(!t)return"INVALID";try{i=atob(t)}catch{return"INVALID"}const s=i.split("-"),a=s[0],l=s[1];if(!l)return n(t);try{atob(l)}catch{try{if(atob(a),!atob(a).length)return n(t)}catch{return n(t)}}if(a.length<40||a.length>255)return"INVALID";try{atob(a)}catch{return"INVALID"}try{r=atob(l)}catch{return"INVALID"}if(r.length!==8)return"INVALID";const c=Number(r.substring(0,4)),d=Number(r.substring(4,6))-1,u=Number(r.substring(6,8)),g=new Date(c,d,u);return g<Ft||isNaN(Number(g))?"INVALID":"VALID"})(e.config.get("licenseKey"))!=="VALID"&&e.ui.view&&(e.ui.focusTracker.on("change:isFocused",(t,n,i)=>{this._updateLastFocusedEditableElement(),i?this._showBalloon():this._hideBalloon()}),e.ui.focusTracker.on("change:focusedElement",(t,n,i)=>{this._updateLastFocusedEditableElement(),i&&this._showBalloon()}),e.ui.on("update",()=>{this._showBalloonThrottled()}))}_createBalloonView(){const e=this.editor,t=this._balloonView=new Ye,n=Hu(e),i=new DE(e.locale,n.label);t.content.add(i),t.set({class:"ck-powered-by-balloon"}),e.ui.view.body.add(t),e.ui.focusTracker.add(t.element),this._balloonView=t}_showBalloon(){if(!this._lastFocusedEditableElement)return;const e=function(t,n){const i=Hu(t),r=i.side==="right"?function(s,a){return $u(s,a,(l,c)=>l.left+l.width-c.width-a.horizontalOffset)}(n,i):function(s,a){return $u(s,a,l=>l.left+a.horizontalOffset)}(n,i);return{target:n,positions:[r]}}(this.editor,this._lastFocusedEditableElement);e&&(this._balloonView||this._createBalloonView(),this._balloonView.pin(e))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_updateLastFocusedEditableElement(){const e=this.editor,t=e.ui.focusTracker.isFocused,n=e.ui.focusTracker.focusedElement;if(!t||!n)return void(this._lastFocusedEditableElement=null);const i=Array.from(e.ui.getEditableElementsNames()).map(r=>e.ui.getEditableElement(r));i.includes(n)?this._lastFocusedEditableElement=n:this._lastFocusedEditableElement=i[0]}}class DE extends re{constructor(e,t){super(e);const n=new ko,i=this.bindTemplate;n.set({content:`<svg xmlns="http://www.w3.org/2000/svg" width="53" height="10" viewBox="0 0 53 10"><g clip-path="url(#a)"><path fill="#1C2331" d="M31.724 1.492a15.139 15.139 0 0 0 .045 1.16 2.434 2.434 0 0 0-.687-.34 3.68 3.68 0 0 0-1.103-.166 2.332 2.332 0 0 0-1.14.255 1.549 1.549 0 0 0-.686.87c-.15.41-.225.98-.225 1.712 0 .939.148 1.659.444 2.161.297.503.792.754 1.487.754.452.015.9-.094 1.294-.316.296-.174.557-.4.771-.669l.14.852h1.282V.007h-1.623v1.485ZM31 6.496a1.77 1.77 0 0 1-.494.061.964.964 0 0 1-.521-.127.758.758 0 0 1-.296-.466 3.984 3.984 0 0 1-.093-.992 4.208 4.208 0 0 1 .098-1.052.753.753 0 0 1 .307-.477 1.08 1.08 0 0 1 .55-.122c.233-.004.466.026.69.089l.483.144v2.553c-.11.076-.213.143-.307.2a1.73 1.73 0 0 1-.417.189ZM35.68 0l-.702.004c-.322.002-.482.168-.48.497l.004.581c.002.33.164.493.486.49l.702-.004c.322-.002.481-.167.48-.496L36.165.49c-.002-.33-.164-.493-.486-.491ZM36.145 2.313l-1.612.01.034 5.482 1.613-.01-.035-5.482ZM39.623.79 37.989.8 38 2.306l-.946.056.006 1.009.949-.006.024 2.983c.003.476.143.844.419 1.106.275.26.658.39 1.148.387.132 0 .293-.01.483-.03.19-.02.38-.046.57-.08.163-.028.324-.068.482-.119l-.183-1.095-.702.004a.664.664 0 0 1-.456-.123.553.553 0 0 1-.14-.422l-.016-2.621 1.513-.01-.006-1.064-1.514.01-.01-1.503ZM46.226 2.388c-.41-.184-.956-.274-1.636-.27-.673.004-1.215.101-1.627.29-.402.179-.72.505-.888.91-.18.419-.268.979-.264 1.68.004.688.1 1.24.285 1.655.172.404.495.724.9.894.414.18.957.268 1.63.264.68-.004 1.224-.099 1.632-.284.4-.176.714-.501.878-.905.176-.418.263-.971.258-1.658-.004-.702-.097-1.261-.28-1.677a1.696 1.696 0 0 0-.888-.9Zm-.613 3.607a.77.77 0 0 1-.337.501 1.649 1.649 0 0 1-1.317.009.776.776 0 0 1-.343-.497 4.066 4.066 0 0 1-.105-1.02 4.136 4.136 0 0 1 .092-1.03.786.786 0 0 1 .337-.507 1.59 1.59 0 0 1 1.316-.008.79.79 0 0 1 .344.502c.078.337.113.683.105 1.03.012.343-.019.685-.092 1.02ZM52.114 2.07a2.67 2.67 0 0 0-1.128.278c-.39.191-.752.437-1.072.73l-.157-.846-1.273.008.036 5.572 1.623-.01-.024-3.78c.35-.124.646-.22.887-.286.26-.075.53-.114.8-.118l.45-.003.144-1.546-.286.001ZM22.083 7.426l-1.576-2.532a2.137 2.137 0 0 0-.172-.253 1.95 1.95 0 0 0-.304-.29.138.138 0 0 1 .042-.04 1.7 1.7 0 0 0 .328-.374l1.75-2.71c.01-.015.025-.028.024-.048-.01-.01-.021-.007-.031-.007L20.49 1.17a.078.078 0 0 0-.075.045l-.868 1.384c-.23.366-.46.732-.688 1.099a.108.108 0 0 1-.112.06c-.098-.005-.196-.001-.294-.002-.018 0-.038.006-.055-.007.002-.02.002-.039.005-.058a4.6 4.6 0 0 0 .046-.701V1.203c0-.02-.009-.032-.03-.03h-.033L16.93 1.17c-.084 0-.073-.01-.073.076v6.491c-.001.018.006.028.025.027h1.494c.083 0 .072.007.072-.071v-2.19c0-.055-.003-.11-.004-.166a3.366 3.366 0 0 0-.05-.417h.06c.104 0 .209.002.313-.002a.082.082 0 0 1 .084.05c.535.913 1.07 1.824 1.607 2.736a.104.104 0 0 0 .103.062c.554-.003 1.107-.002 1.66-.002l.069-.003-.019-.032-.188-.304ZM27.112 6.555c-.005-.08-.004-.08-.082-.08h-2.414c-.053 0-.106-.003-.159-.011a.279.279 0 0 1-.246-.209.558.558 0 0 1-.022-.15c0-.382 0-.762-.002-1.143 0-.032.007-.049.042-.044h2.504c.029.003.037-.012.034-.038V3.814c0-.089.013-.078-.076-.078h-2.44c-.07 0-.062.003-.062-.06v-.837c0-.047.004-.093.013-.14a.283.283 0 0 1 .241-.246.717.717 0 0 1 .146-.011h2.484c.024.002.035-.009.036-.033l.003-.038.03-.496c.01-.183.024-.365.034-.548.005-.085.003-.087-.082-.094-.218-.018-.437-.038-.655-.05a17.845 17.845 0 0 0-.657-.026 72.994 72.994 0 0 0-1.756-.016 1.7 1.7 0 0 0-.471.064 1.286 1.286 0 0 0-.817.655c-.099.196-.149.413-.145.633v3.875c0 .072.003.144.011.216a1.27 1.27 0 0 0 .711 1.029c.228.113.48.167.734.158.757-.005 1.515.002 2.272-.042.274-.016.548-.034.82-.053.03-.002.043-.008.04-.041-.008-.104-.012-.208-.019-.312a69.964 69.964 0 0 1-.05-.768ZM16.14 7.415l-.127-1.075c-.004-.03-.014-.04-.044-.037a13.125 13.125 0 0 1-.998.073c-.336.01-.672.02-1.008.016-.116-.001-.233-.014-.347-.039a.746.746 0 0 1-.45-.262c-.075-.1-.132-.211-.167-.33a3.324 3.324 0 0 1-.126-.773 9.113 9.113 0 0 1-.015-.749c0-.285.022-.57.065-.852.023-.158.066-.312.127-.46a.728.728 0 0 1 .518-.443 1.64 1.64 0 0 1 .397-.048c.628-.001 1.255.003 1.882.05.022.001.033-.006.036-.026l.003-.031.06-.55c.019-.177.036-.355.057-.532.004-.034-.005-.046-.04-.056a5.595 5.595 0 0 0-1.213-.21 10.783 10.783 0 0 0-.708-.02c-.24-.003-.48.01-.719.041a3.477 3.477 0 0 0-.625.14 1.912 1.912 0 0 0-.807.497c-.185.2-.33.433-.424.688a4.311 4.311 0 0 0-.24 1.096c-.031.286-.045.572-.042.86-.006.43.024.86.091 1.286.04.25.104.497.193.734.098.279.26.53.473.734.214.205.473.358.756.446.344.11.702.17 1.063.177a8.505 8.505 0 0 0 1.578-.083 6.11 6.11 0 0 0 .766-.18c.03-.008.047-.023.037-.057a.157.157 0 0 1-.003-.025Z"/><path fill="#AFE229" d="M6.016 6.69a1.592 1.592 0 0 0-.614.21c-.23.132-.422.32-.56.546-.044.072-.287.539-.287.539l-.836 1.528.009.006c.038.025.08.046.123.063.127.046.26.07.395.073.505.023 1.011-.007 1.517-.003.29.009.58.002.869-.022a.886.886 0 0 0 .395-.116.962.962 0 0 0 .312-.286c.056-.083.114-.163.164-.249.24-.408.48-.816.718-1.226.075-.128.148-.257.222-.386l.112-.192a1.07 1.07 0 0 0 .153-.518l-1.304.023s-1.258-.005-1.388.01Z"/><path fill="#771BFF" d="m2.848 9.044.76-1.39.184-.352c-.124-.067-.245-.14-.367-.21-.346-.204-.706-.384-1.045-.6a.984.984 0 0 1-.244-.207c-.108-.134-.136-.294-.144-.46-.021-.409-.002-.818-.009-1.227-.003-.195 0-.39.003-.585.004-.322.153-.553.427-.713l.833-.488c.22-.13.44-.257.662-.385.05-.029.105-.052.158-.077.272-.128.519-.047.76.085l.044.028c.123.06.242.125.358.196.318.178.635.357.952.537.095.056.187.117.275.184.194.144.254.35.266.578.016.284.007.569.006.853-.001.28.004.558 0 .838.592-.003 1.259 0 1.259 0l.723-.013c-.003-.292-.007-.584-.007-.876 0-.524.015-1.048-.016-1.571-.024-.42-.135-.8-.492-1.067a5.02 5.02 0 0 0-.506-.339A400.52 400.52 0 0 0 5.94.787C5.722.664 5.513.524 5.282.423 5.255.406 5.228.388 5.2.373 4.758.126 4.305-.026 3.807.21c-.097.046-.197.087-.29.14A699.896 699.896 0 0 0 .783 1.948c-.501.294-.773.717-.778 1.31-.004.36-.009.718-.001 1.077.016.754-.017 1.508.024 2.261.016.304.07.6.269.848.127.15.279.28.448.382.622.4 1.283.734 1.92 1.11l.183.109Z"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h52.4v10H0z"/></clipPath></defs></svg>
|
|
6521
|
-
`,isColorInherited:!1}),n.extendTemplate({attributes:{style:{width:"53px",height:"10px"}}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-powered-by"],"aria-hidden":!0},children:[{tag:"a",attributes:{href:"https://ckeditor.com/?utm_source=ckeditor&utm_medium=referral&utm_campaign=701Dn000000hVgmIAE_powered_by_ckeditor_logo",target:"_blank",tabindex:"-1"},children:[...t?[{tag:"span",attributes:{class:["ck","ck-powered-by__label"]},children:[t]}]:[],n],on:{dragstart:i.to(r=>r.preventDefault())}}]})}}function $u(o,e,t){return(n,i)=>{const r=n.getVisible();if(!r||n.width<EE||n.height<yE)return zi;let s;s=e.position==="inside"?n.bottom-i.height:n.bottom-i.height/2,s-=e.verticalOffset;const a=t(n,i);if(e.position==="inside"){const l=i.clone().moveTo(a,s);if(l.getIntersectionArea(r)<l.getArea())return zi}else{const l=function(c){let d=c.parentElement;if(!d)return null;for(;d.tagName!="BODY";){const u=d.style.overflowY||oe.window.getComputedStyle(d).overflowY;if(u==="auto"||u==="scroll")break;if(d=d.parentElement,!d)return null}return d}(o);if(l){const c=new De(l);if(r.bottom+i.height/2>c.bottom)return zi}}return{top:s,left:a,name:`position_${e.position}-side_${e.side}`,config:{withArrow:!1}}}}function Hu(o){const e=o.config.get("ui.poweredBy"),t=e&&e.position||"border";return vE({position:t,label:xE,verticalOffset:t==="inside"?5:0,horizontalOffset:5,side:o.locale.contentLanguageDirection==="ltr"?"right":"left"},e)}class BE extends ge(){constructor(e){super(),this.isReady=!1,this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[],this.editor=e,this.componentFactory=new gE(e),this.focusTracker=new ht,this.tooltipManager=new Ni(e),this.poweredBy=new SE(e),this.set("viewportOffset",this._readViewportOffsetFromConfig()),this.once("ready",()=>{this.isReady=!0}),this.listenTo(e.editing.view.document,"layoutChanged",()=>this.update()),this._initFocusTracking()}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null,this.editor.keystrokes.stopListening(e);this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[]}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor),this.focusTracker.add(t);const n=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t)};this.isReady?n():this.once("ready",n)}removeEditableElement(e){const t=this._editableElementsMap.get(e);t&&(this._editableElementsMap.delete(e),this.editor.keystrokes.stopListening(t),this.focusTracker.remove(t),t.ckeditorInstance=null)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}addToolbar(e,t={}){e.isRendered?(this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)):e.once("render",()=>{this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)}),this._focusableToolbarDefinitions.push({toolbarView:e,options:t})}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}_readViewportOffsetFromConfig(){const e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;const n=e.config.get("toolbar.viewportTopOffset");return n?(console.warn("editor-ui-deprecated-viewport-offset-config: The `toolbar.vieportTopOffset` configuration option is deprecated. It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead."),{top:n}):{top:0}}_initFocusTracking(){const e=this.editor,t=e.editing.view;let n,i;e.keystrokes.set("Alt+F10",(r,s)=>{const a=this.focusTracker.focusedElement;Array.from(this._editableElementsMap.values()).includes(a)&&!Array.from(t.domRoots.values()).includes(a)&&(n=a);const l=this._getCurrentFocusedToolbarDefinition();l&&i||(i=this._getFocusableCandidateToolbarDefinitions());for(let c=0;c<i.length;c++){const d=i.shift();if(i.push(d),d!==l&&this._focusFocusableCandidateToolbar(d)){l&&l.options.afterBlur&&l.options.afterBlur();break}}s()}),e.keystrokes.set("Esc",(r,s)=>{const a=this._getCurrentFocusedToolbarDefinition();a&&(n?(n.focus(),n=null):e.editing.view.focus(),a.options.afterBlur&&a.options.afterBlur(),s())})}_getFocusableCandidateToolbarDefinitions(){const e=[];for(const t of this._focusableToolbarDefinitions){const{toolbarView:n,options:i}=t;(nn(n.element)||i.beforeFocus)&&e.push(t)}return e.sort((t,n)=>qu(t)-qu(n)),e}_getCurrentFocusedToolbarDefinition(){for(const e of this._focusableToolbarDefinitions)if(e.toolbarView.element&&e.toolbarView.element.contains(this.focusTracker.focusedElement))return e;return null}_focusFocusableCandidateToolbar(e){const{toolbarView:t,options:{beforeFocus:n}}=e;return n&&n(),!!nn(t.element)&&(t.focus(),!0)}}function qu(o){const{toolbarView:e,options:t}=o;let n=10;return nn(e.element)&&n--,t.isContextual&&n--,n}var Uu=D(9688),TE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Uu.Z,TE),Uu.Z.locals;class IE extends re{constructor(e){super(e),this.body=new EC(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}class PE extends IE{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 Yc;return t.text=e("Rich Text Editor"),t.extendTemplate({attributes:{class:"ck-voice-label"}}),t}}class RE extends re{constructor(e,t,n){super(e),this.name=null,this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.set("isFocused",!1),this._editableElement=n,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",()=>this._updateIsFocusedClasses()),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}get hasExternalElement(){return this._hasExternalElement}_updateIsFocusedClasses(){const e=this._editingView;function t(n){e.change(i=>{const r=e.document.getRoot(n.name);i.addClass(n.isFocused?"ck-focused":"ck-blurred",r),i.removeClass(n.isFocused?"ck-blurred":"ck-focused",r)})}e.isRenderingInProgress?function n(i){e.once("change:isRenderingInProgress",(r,s,a)=>{a?n(i):t(i)})}(this):t(this)}}class OE extends RE{constructor(e,t,n,i={}){super(e,t,n);const r=e.t;this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}}),this._generateLabel=i.label||(()=>r("Editor editing area: %0",this.name))}render(){super.render();const e=this._editingView;e.change(t=>{const n=e.document.getRoot(this.name);t.setAttribute("aria-label",this._generateLabel(this),n)})}}var Wu=D(8847),NE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Wu.Z,NE),Wu.Z.locals;class Ku extends ui{static get pluginName(){return"Notification"}init(){this.on("show:warning",(e,t)=>{window.alert(t.message)},{priority:"lowest"})}showSuccess(e,t={}){this._showNotification({message:e,type:"success",namespace:t.namespace,title:t.title})}showInfo(e,t={}){this._showNotification({message:e,type:"info",namespace:t.namespace,title:t.title})}showWarning(e,t={}){this._showNotification({message:e,type:"warning",namespace:t.namespace,title:t.title})}_showNotification(e){const t=e.namespace?`show:${e.type}:${e.namespace}`:`show:${e.type}`;this.fire(t,{message:e.message,type:e.type,title:e.title||""})}}class Ys extends ge(){constructor(e,t){super(),t&&Wd(this,t),e&&this.set(e)}}var Gu=D(4650),zE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Gu.Z,zE),Gu.Z.locals;var Zu=D(7676),ME={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Zu.Z,ME),Zu.Z.locals;const Mi=jr("px");class Fi extends q{constructor(e){super(e),this._viewToStack=new Map,this._idToStack=new Map,this._view=null,this._rotatorView=null,this._fakePanelsView=null,this.positionLimiter=()=>{const t=this.editor.editing.view,n=t.document.selection.editableElement;return n?t.domConverter.mapViewToDom(n.root):null},this.set("visibleView",null),this.set("_numberOfStacks",0),this.set("_singleViewMode",!1)}static get pluginName(){return"ContextualBalloon"}destroy(){super.destroy(),this._view&&this._view.destroy(),this._rotatorView&&this._rotatorView.destroy(),this._fakePanelsView&&this._fakePanelsView.destroy()}get view(){return this._view||this._createPanelView(),this._view}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this._view||this._createPanelView(),this.hasView(e.view))throw new I("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 n=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),n.set(e.view,e),this._viewToStack.set(e.view,n),n===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new I("contextualballoon-remove-view-not-exist",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(t.size===1?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),t.size===1?(this._idToStack.delete(this._getStackId(t)),this._numberOfStacks=this._idToStack.size):t.delete(e),this._viewToStack.delete(e)}updatePosition(e){e&&(this._visibleStack.get(this.visibleView).position=e),this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new I("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}_createPanelView(){this._view=new Ye(this.editor.locale),this.editor.ui.view.body.add(this._view),this.editor.ui.focusTracker.add(this._view.element),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find(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 FE(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(n,i)=>!i&&n>1),e.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(n,i)=>{if(i<2)return"";const r=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[r,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 VE(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(t,n)=>!n&&t>=2?Math.min(t-1,2):0),e.listenTo(this.view,"change:top",()=>e.updatePosition()),e.listenTo(this.view,"change:left",()=>e.updatePosition()),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:n=!0,singleViewMode:i=!1}){this.view.class=t,this.view.withArrow=n,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),i&&(this._singleViewMode=!0)}_getBalloonPosition(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&(e.limiter||(e=Object.assign({},e,{limiter:this.positionLimiter})),e=Object.assign({},e,{viewportOffsetConfig:this.editor.ui.viewportOffset})),e}}class FE extends re{constructor(e){super(e);const t=e.t,n=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new ht,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",n.to("isNavigationVisible",i=>i?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:n.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}destroy(){super.destroy(),this.focusTracker.destroy()}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const n=new Ae(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n}}class VE extends re{constructor(e,t){super(e);const n=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",n.to("numberOfPanels",i=>i?"":"ck-hidden")],style:{top:n.to("top",Mi),left:n.to("left",Mi),width:n.to("width",Mi),height:n.to("height",Mi)}},children:this.content}),this.on("change:numberOfPanels",(i,r,s,a)=>{s>a?this._addPanels(s-a):this._removePanels(a-s),this.updatePosition()})}_addPanels(e){for(;e--;){const t=new re;t.setTemplate({tag:"div"}),this.content.add(t),this.registerChild(t)}}_removePanels(e){for(;e--;){const t=this.content.last;this.content.remove(t),this.deregisterChild(t),t.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:n,height:i}=new De(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:n,height:i})}}}var Ju=D(5868),LE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Ju.Z,LE),Ju.Z.locals;const Ro=jr("px");class jE extends re{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 bt({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",n=>n?"block":"none"),height:t.to("isSticky",n=>n?Ro(this._panelRect.height):null)}}}).render(),this._contentPanel=new bt({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",n=>n?Ro(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:t.to("_hasViewportTopOffset",n=>n?Ro(this.viewportTopOffset):null),bottom:t.to("_isStickyToTheLimiter",n=>n?Ro(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(oe.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:Ro(-oe.window.scrollX)):(this._isStickyToTheLimiter=!1,this._hasViewportTopOffset=!1,this._marginLeft=null)}}var Yu=D(9695),$E={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Yu.Z,$E),Yu.Z.locals;class HE extends BE{constructor(e,t){super(e),this.view=t,this._toolbarConfig=rd(e.config.get("toolbar")),this._elementReplacer=new Cl}get element(){return this.view.element}init(e){const t=this.editor,n=this.view,i=t.editing.view,r=n.editable,s=i.document.getRoot();r.name=s.rootName,n.render();const a=r.element;this.setEditableElement(r.name,a),n.editable.bind("isFocused").to(this.focusTracker),i.attachDomRoot(a),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.view;e.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),e.stickyPanel.limiterElement=e.element,e.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",({top:t})=>t||0),e.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(e.toolbar)}_initPlaceholder(){const e=this.editor,t=e.editing.view,n=t.document.getRoot(),i=e.sourceElement;let r;const s=e.config.get("placeholder");s&&(r=typeof s=="string"?s:s[this.view.editable.name]),!r&&i&&i.tagName.toLowerCase()==="textarea"&&(r=i.getAttribute("placeholder")),r&&function({view:a,element:l,text:c,isDirectHost:d=!0,keepOnFocus:u=!1}){const g=a.document;mi.has(g)||(mi.set(g,new Map),g.registerPostFixer(f=>Xr(g,f)),g.on("change:isComposing",()=>{a.change(f=>Xr(g,f))},{priority:"high"})),mi.get(g).set(l,{text:c,isDirectHost:d,keepOnFocus:u,hostElement:d?l:null}),a.change(f=>Xr(g,f))}({view:t,element:n,text:r,isDirectHost:!1,keepOnFocus:!0})}}var Qu=D(3143),qE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Qu.Z,qE),Qu.Z.locals;class UE extends PE{constructor(e,t,n={}){super(e),this.stickyPanel=new jE(e),this.toolbar=new Ms(e,{shouldGroupWhenFull:n.shouldToolbarGroupWhenFull}),this.editable=new OE(e,t)}render(){super.render(),this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}class Xu{constructor(e){if(this.crashes=[],this.state="initializing",this._now=Date.now,this.crashes=[],this._crashNumberLimit=typeof e.crashNumberLimit=="number"?e.crashNumberLimit:3,this._minimumNonErrorTimePeriod=typeof e.minimumNonErrorTimePeriod=="number"?e.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=t=>{const n="error"in t?t.error:t.reason;n instanceof Error&&this._handleError(n,t)},this._listeners={},!this._restart)throw new Error("The Watchdog class was split into the abstract `Watchdog` class and the `EditorWatchdog` class. Please, use `EditorWatchdog` if you have used the `Watchdog` class previously.")}destroy(){this._stopErrorHandling(),this._listeners={}}on(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){this._listeners[e]=this._listeners[e].filter(n=>n!==t)}_fire(e,...t){const n=this._listeners[e]||[];for(const i of n)i.apply(this,[null,...t])}_startErrorHandling(){window.addEventListener("error",this._boundErrorHandler),window.addEventListener("unhandledrejection",this._boundErrorHandler)}_stopErrorHandling(){window.removeEventListener("error",this._boundErrorHandler),window.removeEventListener("unhandledrejection",this._boundErrorHandler)}_handleError(e,t){if(this._shouldReactToError(e)){this.crashes.push({message:e.message,stack:e.stack,filename:t instanceof ErrorEvent?t.filename:void 0,lineno:t instanceof ErrorEvent?t.lineno:void 0,colno:t instanceof ErrorEvent?t.colno:void 0,date:this._now()});const n=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:e,causesRestart:n}),n?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(e){return e.is&&e.is("CKEditorError")&&e.context!==void 0&&e.context!==null&&this.state==="ready"&&this._isErrorComingFromThisItem(e)}_shouldRestart(){return this.crashes.length<=this._crashNumberLimit?!0:(this.crashes[this.crashes.length-1].date-this.crashes[this.crashes.length-1-this._crashNumberLimit].date)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}function Qs(o,e=new Set){const t=[o],n=new Set;let i=0;for(;t.length>i;){const r=t[i++];if(!n.has(r)&&WE(r)&&!e.has(r))if(n.add(r),Symbol.iterator in r)try{for(const s of r)t.push(s)}catch{}else for(const s in r)s!=="defaultValue"&&t.push(r[s])}return n}function WE(o){const e=Object.prototype.toString.call(o),t=typeof o;return!(t==="number"||t==="boolean"||t==="string"||t==="symbol"||t==="function"||e==="[object Date]"||e==="[object RegExp]"||e==="[object Module]"||o==null||o._watchdogExcluded||o instanceof EventTarget||o instanceof Event)}function em(o,e,t=new Set){if(o===e&&typeof(n=o)=="object"&&n!==null)return!0;var n;const i=Qs(o,t),r=Qs(e,t);for(const s of i)if(r.has(s))return!0;return!1}class tm extends Xu{constructor(e,t={}){super(t),this._editor=null,this._throttledSave=Js(this._save.bind(this),typeof t.saveInterval=="number"?t.saveInterval:5e3),e&&(this._creator=(n,i)=>e.create(n,i)),this._destructor=n=>n.destroy()}get editor(){return this._editor}get _item(){return this._editor}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}_restart(){return Promise.resolve().then(()=>(this.state="initializing",this._fire("stateChange"),this._destroy())).catch(e=>{console.error("An error happened during the editor destroying.",e)}).then(()=>{if(typeof this._elementOrData=="string")return this.create(this._data,this._config,this._config.context);{const e=Object.assign({},this._config,{initialData:this._data});return this.create(this._elementOrData,e,e.context)}}).then(()=>{this._fire("restart")})}create(e=this._elementOrData,t=this._config,n){return Promise.resolve().then(()=>(super._startErrorHandling(),this._elementOrData=e,this._config=this._cloneEditorConfiguration(t)||{},this._config.context=n,this._creator(e,this._config))).then(i=>{this._editor=i,i.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=i.model.document.version,this._data=this._getData(),this.state="ready",this._fire("stateChange")})}destroy(){return Promise.resolve().then(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling(),this._throttledSave.flush();const e=this._editor;return this._editor=null,e.model.document.off("change:data",this._throttledSave),this._destructor(e)})}_save(){const e=this._editor.model.document.version;try{this._data=this._getData(),this._lastDocumentVersion=e}catch(t){console.error(t,"An error happened during restoring editor data. Editor will be restored from the previously saved data.")}}_setExcludedProperties(e){this._excludedProps=e}_getData(){const e={};for(const t of this._editor.model.document.getRootNames())e[t]=this._editor.data.get({rootName:t});return e}_isErrorComingFromThisItem(e){return em(this._editor,e.context,this._excludedProps)}_cloneEditorConfiguration(e){return Vr(e,(t,n)=>Rn(t)||n==="context"?t:void 0)}}const Oo=Symbol("MainQueueId");class KE{constructor(){this._onEmptyCallbacks=[],this._queues=new Map,this._activeActions=0}onEmpty(e){this._onEmptyCallbacks.push(e)}enqueue(e,t){const n=e===Oo;this._activeActions++,this._queues.get(e)||this._queues.set(e,Promise.resolve());const i=(n?Promise.all(this._queues.values()):Promise.all([this._queues.get(Oo),this._queues.get(e)])).then(t),r=i.catch(()=>{});return this._queues.set(e,r),i.finally(()=>{this._activeActions--,this._queues.get(e)===r&&this._activeActions===0&&this._onEmptyCallbacks.forEach(s=>s())})}}function nm(o){return Array.isArray(o)?o:[o]}class Vi extends Ti(zs(W1)){constructor(e,t={}){if(!Li(e)&&t.initialData!==void 0)throw new I("editor-create-initial-data",null);super(t),this.config.get("initialData")===void 0&&this.config.set("initialData",function(r){return Li(r)?(s=r,s instanceof HTMLTextAreaElement?s.value:s.innerHTML):r;var s}(e)),Li(e)&&(this.sourceElement=e),this.model.document.createRoot();const n=!this.config.get("toolbar.shouldNotGroupWhenFull"),i=new UE(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:n});this.ui=new HE(this,i),function(r){if(!Qt(r.updateSourceElement))throw new I("attachtoform-missing-elementapi-interface",r);const s=r.sourceElement;if(function(a){return!!a&&a.tagName.toLowerCase()==="textarea"}(s)&&s.form){let a;const l=s.form,c=()=>r.updateSourceElement();Qt(l.submit)&&(a=l.submit,l.submit=()=>{c(),a.apply(l)}),l.addEventListener("submit",c),r.on("destroy",()=>{l.removeEventListener("submit",c),a&&(l.submit=a)})}}(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise(n=>{const i=new this(e,t);n(i.initPlugins().then(()=>i.ui.init(Li(e)?e:null)).then(()=>i.data.init(i.config.get("initialData"))).then(()=>i.fire("ready")).then(()=>i))})}}function Li(o){return Rn(o)}Vi.Context=dd,Vi.EditorWatchdog=tm,Vi.ContextWatchdog=class extends Xu{constructor(o,e={}){super(e),this._watchdogs=new Map,this._context=null,this._contextProps=new Set,this._actionQueues=new KE,this._watchdogConfig=e,this._creator=t=>o.create(t),this._destructor=t=>t.destroy(),this._actionQueues.onEmpty(()=>{this.state==="initializing"&&(this.state="ready",this._fire("stateChange"))})}setCreator(o){this._creator=o}setDestructor(o){this._destructor=o}get context(){return this._context}create(o={}){return this._actionQueues.enqueue(Oo,()=>(this._contextConfig=o,this._create()))}getItem(o){return this._getWatchdog(o)._item}getItemState(o){return this._getWatchdog(o).state}add(o){const e=nm(o);return Promise.all(e.map(t=>this._actionQueues.enqueue(t.id,()=>{if(this.state==="destroyed")throw new Error("Cannot add items to destroyed watchdog.");if(!this._context)throw new Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");let n;if(this._watchdogs.has(t.id))throw new Error(`Item with the given id is already added: '${t.id}'.`);if(t.type==="editor")return n=new tm(null,this._watchdogConfig),n.setCreator(t.creator),n._setExcludedProperties(this._contextProps),t.destructor&&n.setDestructor(t.destructor),this._watchdogs.set(t.id,n),n.on("error",(i,{error:r,causesRestart:s})=>{this._fire("itemError",{itemId:t.id,error:r}),s&&this._actionQueues.enqueue(t.id,()=>new Promise(a=>{const l=()=>{n.off("restart",l),this._fire("itemRestart",{itemId:t.id}),a()};n.on("restart",l)}))}),n.create(t.sourceElementOrData,t.config,this._context);throw new Error(`Not supported item type: '${t.type}'.`)})))}remove(o){const e=nm(o);return Promise.all(e.map(t=>this._actionQueues.enqueue(t,()=>{const n=this._getWatchdog(t);return this._watchdogs.delete(t),n.destroy()})))}destroy(){return this._actionQueues.enqueue(Oo,()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_restart(){return this._actionQueues.enqueue(Oo,()=>(this.state="initializing",this._fire("stateChange"),this._destroy().catch(o=>{console.error("An error happened during destroying the context or items.",o)}).then(()=>this._create()).then(()=>this._fire("restart"))))}_create(){return Promise.resolve().then(()=>(this._startErrorHandling(),this._creator(this._contextConfig))).then(o=>(this._context=o,this._contextProps=Qs(this._context),Promise.all(Array.from(this._watchdogs.values()).map(e=>(e._setExcludedProperties(this._contextProps),e.create(void 0,void 0,this._context))))))}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling();const o=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map(e=>e.destroy())).then(()=>this._destructor(o))})}_getWatchdog(o){const e=this._watchdogs.get(o);if(!e)throw new Error(`Item with the given id was not registered: ${o}.`);return e}_isErrorComingFromThisItem(o){for(const e of this._watchdogs.values())if(e._isErrorComingFromThisItem(o))return!1;return em(this._context,o.context)}};class Xs extends $t{constructor(e){super(e),this.domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];const t=this.document;function n(i){return(r,s)=>{s.preventDefault();const a=s.dropRange?[s.dropRange]:null,l=new $(t,i);t.fire(l,{dataTransfer:s.dataTransfer,method:r.name,targetRanges:a,target:s.target,domEvent:s.domEvent}),l.stop.called&&s.stopPropagation()}}this.listenTo(t,"paste",n("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",n("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",n("dragging"),{priority:"low"})}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,n=e.type=="drop"||e.type=="paste",i={dataTransfer:new th(t,{cacheFiles:n})};e.type!="drop"&&e.type!="dragover"||(i.dropRange=function(r,s){const a=s.target.ownerDocument,l=s.clientX,c=s.clientY;let d;return a.caretRangeFromPoint&&a.caretRangeFromPoint(l,c)?d=a.caretRangeFromPoint(l,c):s.rangeParent&&(d=a.createRange(),d.setStart(s.rangeParent,s.rangeOffset),d.collapse(!0)),d?r.domConverter.domRangeToView(d):null}(this.view,e)),this.fire(e.type,e,i)}}const om=["figcaption","li"];function im(o){let e="";if(o.is("$text")||o.is("$textProxy"))e=o.data;else if(o.is("element","img")&&o.hasAttribute("alt"))e=o.getAttribute("alt");else if(o.is("element","br"))e=`
|
|
6520
|
+
`)){const l=s.split(/\n{1,2}/g);let c=a;for(let d=0;d<l.length;d++){const u=l[d];u!=""&&(this.fire(e.type,e,{data:u,dataTransfer:r,targetRanges:c,inputType:e.inputType,isComposing:e.isComposing}),c=[i.selection.getFirstRange()]),d+1<l.length&&(this.fire(e.type,e,{inputType:"insertParagraph",targetRanges:c}),c=[i.selection.getFirstRange()])}}else this.fire(e.type,e,{data:s,dataTransfer:r,targetRanges:a,inputType:e.inputType,isComposing:e.isComposing})}}class ny extends _t{constructor(e){super(e),this.document.on("keydown",(t,n)=>{if(this.isEnabled&&((i=n.keyCode)==se.arrowright||i==se.arrowleft||i==se.arrowup||i==se.arrowdown)){const r=new Fn(this.document,"arrowKey",this.document.selection.getFirstRange());this.document.fire(r,n),r.stop.called&&t.stop()}var i})}observe(){}stopObserving(){}}class oy extends _t{constructor(e){super(e);const t=this.document;t.on("keydown",(n,i)=>{if(!this.isEnabled||i.keyCode!=se.tab||i.ctrlKey)return;const r=new Fn(t,"tab",t.selection.getFirstRange());t.fire(r,i),r.stop.called&&n.stop()})}observe(){}stopObserving(){}}class iy extends ge(){constructor(e){super(),this.domRoots=new Map,this._initialDomRootAttributes=new WeakMap,this._observers=new Map,this._ongoingChange=!1,this._postFixersInProgress=!1,this._renderingDisabled=!1,this._hasChangedSinceTheLastRendering=!1,this.document=new Dd(e),this.domConverter=new $d(this.document),this.set("isRenderingInProgress",!1),this.set("hasDomSelection",!1),this._renderer=new _v(this.domConverter,this.document.selection),this._renderer.bind("isFocused","isSelecting","isComposing").to(this.document,"isFocused","isSelecting","isComposing"),this._writer=new Bd(this.document),this.addObserver(eh),this.addObserver(Cs),this.addObserver(Xv),this.addObserver(Dv),this.addObserver(Vv),this.addObserver(ey),this.addObserver(ny),this.addObserver(ty),this.addObserver(oy),this.document.on("arrowKey",wv,{priority:"low"}),gv(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 n=this.document.getRoot(t);n._name=e.tagName.toLowerCase();const i={};for(const{name:s,value:a}of Array.from(e.attributes))i[s]=a,s==="class"?this._writer.addClass(a.split(" "),n):this._writer.setAttribute(s,a,n);this._initialDomRootAttributes.set(e,i);const r=()=>{this._writer.setAttribute("contenteditable",(!n.isReadOnly).toString(),n),n.isReadOnly?this._writer.addClass("ck-read-only",n):this._writer.removeClass("ck-read-only",n)};r(),this.domRoots.set(t,e),this.domConverter.bindElements(e,n),this._renderer.markToSync("children",n),this._renderer.markToSync("attributes",n),this._renderer.domDocuments.add(e.ownerDocument),n.on("change:children",(s,a)=>this._renderer.markToSync("children",a)),n.on("change:attributes",(s,a)=>this._renderer.markToSync("attributes",a)),n.on("change:text",(s,a)=>this._renderer.markToSync("text",a)),n.on("change:isReadOnly",()=>this.change(r)),n.on("change",()=>{this._hasChangedSinceTheLastRendering=!0});for(const s of this._observers.values())s.observe(e,t)}detachDomRoot(e){const t=this.domRoots.get(e);Array.from(t.attributes).forEach(({name:i})=>t.removeAttribute(i));const n=this._initialDomRootAttributes.get(t);for(const i in n)t.setAttribute(i,n[i]);this.domRoots.delete(e),this.domConverter.unbindDomElement(t);for(const i of this._observers.values())i.stopObserving(t)}getDomRoot(e="main"){return this.domRoots.get(e)}addObserver(e){let t=this._observers.get(e);if(t)return t;t=new e(this),this._observers.set(e,t);for(const[n,i]of this.domRoots)t.observe(i,n);return t.enable(),t}getObserver(e){return this._observers.get(e)}disableObservers(){for(const e of this._observers.values())e.disable()}enableObservers(){for(const e of this._observers.values())e.enable()}scrollToTheSelection({alignToTop:e,forceScroll:t,viewportOffset:n=20,ancestorOffset:i=20}={}){const r=this.document.selection.getFirstRange();r&&function({target:s,viewportOffset:a=0,ancestorOffset:l=0,alignToTop:c,forceScroll:d}){const u=Hr(s);let g=u,f=null;for(;g;){let b;b=rC(g==u?s:f),iC({parent:b,getRect:()=>Tc(s,g),alignToTop:c,ancestorOffset:l,forceScroll:d});const A=Tc(s,g);if(oC({window:g,rect:A,viewportOffset:a,alignToTop:c,forceScroll:d}),g.parent!=g){if(f=g.frameElement,g=g.parent,!f)return}else g=null}}({target:this.domConverter.viewRangeToDom(r),viewportOffset:n,ancestorOffset:i,alignToTop:e,forceScroll:t})}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 I("cannot-change-view-tree",this);try{if(this._ongoingChange)return e(this._writer);this._ongoingChange=!0;const t=e(this._writer);return this._ongoingChange=!1,!this._renderingDisabled&&this._hasChangedSinceTheLastRendering&&(this._postFixersInProgress=!0,this.document._callPostFixers(this._writer),this._postFixersInProgress=!1,this.fire("render")),t}catch(t){I.rethrowUnexpectedError(t,this)}}forceRender(){this._hasChangedSinceTheLastRendering=!0,this.getObserver(Cs).flush(),this.change(()=>{})}destroy(){for(const e of this._observers.values())e.destroy();this.document.destroy(),this.stopListening()}createPositionAt(e,t){return U._createAt(e,t)}createPositionAfter(e){return U._createAfter(e)}createPositionBefore(e){return U._createBefore(e)}createRange(e,t){return new X(e,t)}createRangeOn(e){return X._createOn(e)}createRangeIn(e){return X._createIn(e)}createSelection(...e){return new wt(...e)}_disableRendering(e){this._renderingDisabled=e,e==0&&this.change(()=>{})}_render(){this.isRenderingInProgress=!0,this.disableObservers(),this._renderer.render(),this.enableObservers(),this.isRenderingInProgress=!1}}class Ht{is(){throw new Error("is() method is abstract")}}class hn extends Ht{constructor(e){super(),this.parent=null,this._attrs=St(e)}get document(){return null}get index(){let e;if(!this.parent)return null;if((e=this.parent.getChildIndex(this))===null)throw new I("model-node-not-found-in-parent",this);return e}get startOffset(){let e;if(!this.parent)return null;if((e=this.parent.getChildStartOffset(this))===null)throw new I("model-node-not-found-in-parent",this);return e}get offsetSize(){return 1}get endOffset(){return this.parent?this.startOffset+this.offsetSize:null}get nextSibling(){const e=this.index;return e!==null&&this.parent.getChild(e+1)||null}get previousSibling(){const e=this.index;return e!==null&&this.parent.getChild(e-1)||null}get root(){let e=this;for(;e.parent;)e=e.parent;return e}isAttached(){return this.parent!==null&&this.root.isAttached()}getPath(){const e=[];let t=this;for(;t.parent;)e.unshift(t.startOffset),t=t.parent;return e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.parent;return t}getCommonAncestor(e,t={}){const n=this.getAncestors(t),i=e.getAncestors(t);let r=0;for(;n[r]==i[r]&&n[r];)r++;return r===0?null:n[r-1]}isBefore(e){if(this==e||this.root!==e.root)return!1;const t=this.getPath(),n=e.getPath(),i=Ue(t,n);switch(i){case"prefix":return!0;case"extension":return!1;default:return t[i]<n[i]}}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((t,n)=>(t[n[0]]=n[1],t),{})),e}_clone(e){return new this.constructor(this._attrs)}_remove(){this.parent._removeChildren(this.index)}_setAttribute(e,t){this._attrs.set(e,t)}_setAttributesTo(e){this._attrs=St(e)}_removeAttribute(e){return this._attrs.delete(e)}_clearAttributes(){this._attrs.clear()}}hn.prototype.is=function(o){return o==="node"||o==="model:node"};class yo{constructor(e){this._nodes=[],e&&this._insertNodes(0,e)}[Symbol.iterator](){return this._nodes[Symbol.iterator]()}get length(){return this._nodes.length}get maxOffset(){return this._nodes.reduce((e,t)=>e+t.offsetSize,0)}getNode(e){return this._nodes[e]||null}getNodeIndex(e){const t=this._nodes.indexOf(e);return t==-1?null:t}getNodeStartOffset(e){const t=this.getNodeIndex(e);return t===null?null:this._nodes.slice(0,t).reduce((n,i)=>n+i.offsetSize,0)}indexToOffset(e){if(e==this._nodes.length)return this.maxOffset;const t=this._nodes[e];if(!t)throw new I("model-nodelist-index-out-of-bounds",this);return this.getNodeStartOffset(t)}offsetToIndex(e){let t=0;for(const n of this._nodes){if(e>=t&&e<t+n.offsetSize)return this.getNodeIndex(n);t+=n.offsetSize}if(t!=e)throw new I("model-nodelist-offset-out-of-bounds",this,{offset:e,nodeList:this});return this.length}_insertNodes(e,t){for(const n of t)if(!(n instanceof hn))throw new I("model-nodelist-insertnodes-not-node",this);this._nodes=function(n,i,r,s){if(Math.max(i.length,n.length)>1e4)return n.slice(0,r).concat(i).concat(n.slice(r+s,n.length));{const a=Array.from(n);return a.splice(r,s,...i),a}}(this._nodes,Array.from(t),e,0)}_removeNodes(e,t=1){return this._nodes.splice(e,t)}toJSON(){return this._nodes.map(e=>e.toJSON())}}class fe extends hn{constructor(e,t){super(t),this._data=e||""}get offsetSize(){return this.data.length}get data(){return this._data}toJSON(){const e=super.toJSON();return e.data=this.data,e}_clone(){return new fe(this.data,this.getAttributes())}static fromJSON(e){return new fe(e.data,e.attributes)}}fe.prototype.is=function(o){return o==="$text"||o==="model:$text"||o==="text"||o==="model:text"||o==="node"||o==="model:node"};class ht extends Ht{constructor(e,t,n){if(super(),this.textNode=e,t<0||t>e.offsetSize)throw new I("model-textproxy-wrong-offsetintext",this);if(n<0||t+n>e.offsetSize)throw new I("model-textproxy-wrong-length",this);this.data=e.data.substring(t,t+n),this.offsetInText=t}get startOffset(){return this.textNode.startOffset!==null?this.textNode.startOffset+this.offsetInText:null}get offsetSize(){return this.data.length}get endOffset(){return this.startOffset!==null?this.startOffset+this.offsetSize:null}get isPartial(){return this.offsetSize!==this.textNode.offsetSize}get parent(){return this.textNode.parent}get root(){return this.textNode.root}getPath(){const e=this.textNode.getPath();return e.length>0&&(e[e.length-1]+=this.offsetInText),e}getAncestors(e={}){const t=[];let n=e.includeSelf?this:this.parent;for(;n;)t[e.parentFirst?"push":"unshift"](n),n=n.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()}}ht.prototype.is=function(o){return o==="$textProxy"||o==="model:$textProxy"||o==="textProxy"||o==="model:textProxy"};class ke extends hn{constructor(e,t,n){super(t),this._children=new yo,this.name=e,n&&this._insertChild(0,n)}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return this.childCount===0}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}offsetToIndex(e){return this._children.offsetToIndex(e)}getNodeByPath(e){let t=this;for(const n of e)t=t.getChild(t.offsetToIndex(n));return t}findAncestor(e,t={}){let n=t.includeSelf?this:this.parent;for(;n;){if(n.name===e)return n;n=n.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(n=>n._clone(!0)):void 0;return new ke(this.name,this.getAttributes(),t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const n=function(i){return typeof i=="string"?[new fe(i)]:(Xe(i)||(i=[i]),Array.from(i).map(r=>typeof r=="string"?new fe(r):r instanceof ht?new fe(r.data,r.getAttributes()):r))}(t);for(const i of n)i.parent!==null&&i._remove(),i.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){const n=this._children._removeNodes(e,t);for(const i of n)i.parent=null;return n}static fromJSON(e){let t;if(e.children){t=[];for(const n of e.children)n.name?t.push(ke.fromJSON(n)):t.push(fe.fromJSON(n))}return new ke(e.name,e.attributes,t)}}ke.prototype.is=function(o,e){return e?e===this.name&&(o==="element"||o==="model:element"):o==="element"||o==="model:element"||o==="node"||o==="model:node"};class Ct{constructor(e){if(!e||!e.boundaries&&!e.startPosition)throw new I("model-tree-walker-no-start-position",null);const t=e.direction||"forward";if(t!="forward"&&t!="backward")throw new I("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=H._createAt(this.boundaries[this.direction=="backward"?"end":"start"]),this.position.stickiness="toNone",this.singleCharacters=!!e.singleCharacters,this.shallow=!!e.shallow,this.ignoreElementEnd=!!e.ignoreElementEnd,this._boundaryStartParent=this.boundaries?this.boundaries.start.parent:null,this._boundaryEndParent=this.boundaries?this.boundaries.end.parent:null,this._visitedParent=this.position.parent}[Symbol.iterator](){return this}get position(){return this._position}skip(e){let t,n,i,r;do i=this.position,r=this._visitedParent,{done:t,value:n}=this.next();while(!t&&e(n));t||(this._position=i,this._visitedParent=r)}next(){return this.direction=="forward"?this._next():this._previous()}_next(){const e=this.position,t=this.position.clone(),n=this._visitedParent;if(n.parent===null&&t.offset===n.maxOffset)return{done:!0,value:void 0};if(n===this._boundaryEndParent&&t.offset==this.boundaries.end.offset)return{done:!0,value:void 0};const i=Eo(t,n),r=i||oh(t,n,i);if(r instanceof ke)return this.shallow?t.offset++:(t.path.push(0),this._visitedParent=r),this._position=t,un("elementStart",r,e,t,1);if(r instanceof fe){let s;if(this.singleCharacters)s=1;else{let c=r.endOffset;this._boundaryEndParent==n&&this.boundaries.end.offset<c&&(c=this.boundaries.end.offset),s=c-t.offset}const a=t.offset-r.startOffset,l=new ht(r,a,s);return t.offset+=s,this._position=t,un("text",l,e,t,s)}return t.path.pop(),t.offset++,this._position=t,this._visitedParent=n.parent,this.ignoreElementEnd?this._next():un("elementEnd",n,e,t)}_previous(){const e=this.position,t=this.position.clone(),n=this._visitedParent;if(n.parent===null&&t.offset===0)return{done:!0,value:void 0};if(n==this._boundaryStartParent&&t.offset==this.boundaries.start.offset)return{done:!0,value:void 0};const i=t.parent,r=Eo(t,i),s=r||ih(t,i,r);if(s instanceof ke)return t.offset--,this.shallow?(this._position=t,un("elementStart",s,e,t,1)):(t.path.push(s.maxOffset),this._position=t,this._visitedParent=s,this.ignoreElementEnd?this._previous():un("elementEnd",s,e,t));if(s instanceof fe){let a;if(this.singleCharacters)a=1;else{let d=s.startOffset;this._boundaryStartParent==n&&this.boundaries.start.offset>d&&(d=this.boundaries.start.offset),a=t.offset-d}const l=t.offset-s.startOffset,c=new ht(s,l-a,a);return t.offset-=a,this._position=t,un("text",c,e,t,a)}return t.path.pop(),this._position=t,this._visitedParent=n.parent,un("elementStart",n,e,t,1)}}function un(o,e,t,n,i){return{done:!1,value:{type:o,item:e,previousPosition:t,nextPosition:n,length:i}}}class H extends Ht{constructor(e,t,n="toNone"){if(super(),!e.is("element")&&!e.is("documentFragment"))throw new I("model-position-root-invalid",e);if(!(t instanceof Array)||t.length===0)throw new I("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=n}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 I("model-position-path-incorrect",this,{position:this});if(e.is("$text"))throw new I("model-position-path-incorrect",this,{position:this});return e}get index(){return this.parent.offsetToIndex(this.offset)}get textNode(){return Eo(this,this.parent)}get nodeAfter(){const e=this.parent;return oh(this,e,Eo(this,e))}get nodeBefore(){const e=this.parent;return ih(this,e,Eo(this,e))}get isAtStart(){return this.offset===0}get isAtEnd(){return this.offset==this.parent.maxOffset}compareWith(e){if(this.root!=e.root)return"different";const t=Ue(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 n=new Ct(t);return n.skip(e),n.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=Ue(this.path,e.path),n=typeof t=="string"?Math.min(this.path.length,e.path.length):t;return this.path.slice(0,n)}getCommonAncestor(e){const t=this.getAncestors(),n=e.getAncestors();let i=0;for(;t[i]==n[i]&&t[i];)i++;return i===0?null:t[i-1]}getShiftedBy(e){const t=this.clone(),n=t.offset+e;return t.offset=n<0?0:n,t}isAfter(e){return this.compareWith(e)=="after"}isBefore(e){return this.compareWith(e)=="before"}isEqual(e){return this.compareWith(e)=="same"}isTouching(e){if(this.root!==e.root)return!1;const t=Math.min(this.path.length,e.path.length);for(let n=0;n<t;n++){const i=this.path[n]-e.path[n];if(i<-1||i>1)return!1;if(i===1)return rh(e,this,n);if(i===-1)return rh(this,e,n)}return this.path.length===e.path.length||(this.path.length>e.path.length?vs(this.path,t):vs(e.path,t))}hasSameParentAs(e){return this.root!==e.root?!1:Ue(this.getParentPath(),e.getParentPath())=="same"}getTransformedByOperation(e){let t;switch(e.type){case"insert":t=this._getTransformedByInsertOperation(e);break;case"move":case"remove":case"reinsert":t=this._getTransformedByMoveOperation(e);break;case"split":t=this._getTransformedBySplitOperation(e);break;case"merge":t=this._getTransformedByMergeOperation(e);break;default:t=H._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)&&this.stickiness=="toNext"?this._getCombined(e.splitPosition,e.moveTargetPosition):e.graveyardPosition?this._getTransformedByMove(e.graveyardPosition,e.insertionPosition,1):this._getTransformedByInsertion(e.insertionPosition,1)}_getTransformedByMergeOperation(e){const t=e.movedRange;let n;return t.containsPosition(this)||t.start.isEqual(this)?(n=this._getCombined(e.sourcePosition,e.targetPosition),e.sourcePosition.isBefore(e.targetPosition)&&(n=n._getTransformedByDeletion(e.deletionPosition,1))):n=this.isEqual(e.deletionPosition)?H._createAt(e.deletionPosition):this._getTransformedByMove(e.deletionPosition,e.graveyardPosition,1),n}_getTransformedByDeletion(e,t){const n=H._createAt(this);if(this.root!=e.root)return n;if(Ue(e.getParentPath(),this.getParentPath())=="same"){if(e.offset<this.offset){if(e.offset+t>this.offset)return null;n.offset-=t}}else if(Ue(e.getParentPath(),this.getParentPath())=="prefix"){const i=e.path.length-1;if(e.offset<=this.path[i]){if(e.offset+t>this.path[i])return null;n.path[i]-=t}}return n}_getTransformedByInsertion(e,t){const n=H._createAt(this);if(this.root!=e.root)return n;if(Ue(e.getParentPath(),this.getParentPath())=="same")(e.offset<this.offset||e.offset==this.offset&&this.stickiness!="toPrevious")&&(n.offset+=t);else if(Ue(e.getParentPath(),this.getParentPath())=="prefix"){const i=e.path.length-1;e.offset<=this.path[i]&&(n.path[i]+=t)}return n}_getTransformedByMove(e,t,n){if(t=t._getTransformedByDeletion(e,n),e.isEqual(t))return H._createAt(this);const i=this._getTransformedByDeletion(e,n);return i===null||e.isEqual(this)&&this.stickiness=="toNext"||e.getShiftedBy(n).isEqual(this)&&this.stickiness=="toPrevious"?this._getCombined(e,t):i._getTransformedByInsertion(t,n)}_getCombined(e,t){const n=e.path.length-1,i=H._createAt(t);return i.stickiness=this.stickiness,i.offset=i.offset+this.path[n]-e.offset,i.path=[...i.path,...this.path.slice(n+1)],i}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,n="toNone"){if(e instanceof H)return new H(e.root,e.path,e.stickiness);{const i=e;if(t=="end")t=i.maxOffset;else{if(t=="before")return this._createBefore(i,n);if(t=="after")return this._createAfter(i,n);if(t!==0&&!t)throw new I("model-createpositionat-offset-required",[this,e])}if(!i.is("element")&&!i.is("documentFragment"))throw new I("model-position-parent-incorrect",[this,e]);const r=i.getPath();return r.push(t),new this(i.root,r,n)}}static _createAfter(e,t){if(!e.parent)throw new I("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 I("model-position-before-root",e,{root:e});return this._createAt(e.parent,e.startOffset,t)}static fromJSON(e,t){if(e.root==="$graveyard"){const n=new H(t.graveyard,e.path);return n.stickiness=e.stickiness,n}if(!t.getRoot(e.root))throw new I("model-position-fromjson-no-root",t,{rootName:e.root});return new H(t.getRoot(e.root),e.path,e.stickiness)}}function Eo(o,e){const t=e.getChild(e.offsetToIndex(o.offset));return t&&t.is("$text")&&t.startOffset<o.offset?t:null}function oh(o,e,t){return t!==null?null:e.getChild(e.offsetToIndex(o.offset))}function ih(o,e,t){return t!==null?null:e.getChild(e.offsetToIndex(o.offset)-1)}function rh(o,e,t){return t+1!==o.path.length&&!!vs(e.path,t+1)&&!!function(n,i){let r=n.parent,s=n.path.length-1,a=0;for(;s>=i;){if(n.path[s]+a!==r.maxOffset)return!1;a=1,s--,r=r.parent}return!0}(o,t+1)}function vs(o,e){for(;e<o.length;){if(o[e]!==0)return!1;e++}return!0}H.prototype.is=function(o){return o==="position"||o==="model:position"};class V extends Ht{constructor(e,t){super(),this.start=H._createAt(e),this.end=t?H._createAt(t):H._createAt(e),this.start.stickiness=this.isCollapsed?"toNone":"toNext",this.end.stickiness=this.isCollapsed?"toNone":"toPrevious"}*[Symbol.iterator](){yield*new Ct({boundaries:this,ignoreElementEnd:!0})}get isCollapsed(){return this.start.isEqual(this.end)}get isFlat(){return Ue(this.start.getParentPath(),this.end.getParentPath())=="same"}get root(){return this.start.root}containsPosition(e){return e.isAfter(this.start)&&e.isBefore(this.end)}containsRange(e,t=!1){e.isCollapsed&&(t=!1);const n=this.containsPosition(e.start)||t&&this.start.isEqual(e.start),i=this.containsPosition(e.end)||t&&this.end.isEqual(e.end);return n&&i}containsItem(e){const t=H._createBefore(e);return this.containsPosition(t)||this.start.isEqual(t)}isEqual(e){return this.start.isEqual(e.start)&&this.end.isEqual(e.end)}isIntersecting(e){return this.start.isBefore(e.end)&&this.end.isAfter(e.start)}getDifference(e){const t=[];return this.isIntersecting(e)?(this.containsPosition(e.start)&&t.push(new V(this.start,e.start)),this.containsPosition(e.end)&&t.push(new V(e.end,this.end))):t.push(new V(this.start,this.end)),t}getIntersection(e){if(this.isIntersecting(e)){let t=this.start,n=this.end;return this.containsPosition(e.start)&&(t=e.start),this.containsPosition(e.end)&&(n=e.end),new V(t,n)}return null}getJoined(e,t=!1){let n=this.isIntersecting(e);if(n||(n=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)),!n)return null;let i=this.start,r=this.end;return e.start.isBefore(i)&&(i=e.start),e.end.isAfter(r)&&(r=e.end),new V(i,r)}getMinimalFlatRanges(){const e=[],t=this.start.getCommonPath(this.end).length,n=H._createAt(this.start);let i=n.parent;for(;n.path.length>t+1;){const r=i.maxOffset-n.offset;r!==0&&e.push(new V(n,n.getShiftedBy(r))),n.path=n.path.slice(0,-1),n.offset++,i=i.parent}for(;n.path.length<=this.end.path.length;){const r=this.end.path[n.path.length-1],s=r-n.offset;s!==0&&e.push(new V(n,n.getShiftedBy(s))),n.offset=r,n.path.push(0)}return e}getWalker(e={}){return e.boundaries=this,new Ct(e)}*getItems(e={}){e.boundaries=this,e.ignoreElementEnd=!0;const t=new Ct(e);for(const n of t)yield n.item}*getPositions(e={}){e.boundaries=this;const t=new Ct(e);yield t.position;for(const n of t)yield n.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 V(this.start,this.end)]}getTransformedByOperations(e){const t=[new V(this.start,this.end)];for(const n of e)for(let i=0;i<t.length;i++){const r=t[i].getTransformedByOperation(n);t.splice(i,1,...r),i+=r.length-1}for(let n=0;n<t.length;n++){const i=t[n];for(let r=n+1;r<t.length;r++){const s=t[r];(i.containsRange(s)||s.containsRange(i)||i.isEqual(s))&&t.splice(r,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 n=e.sourcePosition,i=e.howMany,r=e.targetPosition;return this._getTransformedByMove(n,r,i,t)}_getTransformedBySplitOperation(e){const t=this.start._getTransformedBySplitOperation(e);let n=this.end._getTransformedBySplitOperation(e);return this.end.isEqual(e.insertionPosition)&&(n=this.end.getShiftedBy(1)),t.root!=n.root&&(n=this.end.getShiftedBy(-1)),new V(t,n)}_getTransformedByMergeOperation(e){if(this.start.isEqual(e.targetPosition)&&this.end.isEqual(e.deletionPosition))return new V(this.start);let t=this.start._getTransformedByMergeOperation(e),n=this.end._getTransformedByMergeOperation(e);return t.root!=n.root&&(n=this.end.getShiftedBy(-1)),t.isAfter(n)?(e.sourcePosition.isBefore(e.targetPosition)?(t=H._createAt(n),t.offset=0):(e.deletionPosition.isEqual(t)||(n=e.deletionPosition),t=e.targetPosition),new V(t,n)):new V(t,n)}_getTransformedByInsertion(e,t,n=!1){if(n&&this.containsPosition(e))return[new V(this.start,e),new V(e.getShiftedBy(t),this.end._getTransformedByInsertion(e,t))];{const i=new V(this.start,this.end);return i.start=i.start._getTransformedByInsertion(e,t),i.end=i.end._getTransformedByInsertion(e,t),[i]}}_getTransformedByMove(e,t,n,i=!1){if(this.isCollapsed){const u=this.start._getTransformedByMove(e,t,n);return[new V(u)]}const r=V._createFromPositionAndShift(e,n),s=t._getTransformedByDeletion(e,n);if(this.containsPosition(t)&&!i&&(r.containsPosition(this.start)||r.containsPosition(this.end))){const u=this.start._getTransformedByMove(e,t,n),g=this.end._getTransformedByMove(e,t,n);return[new V(u,g)]}let a;const l=this.getDifference(r);let c=null;const d=this.getIntersection(r);if(l.length==1?c=new V(l[0].start._getTransformedByDeletion(e,n),l[0].end._getTransformedByDeletion(e,n)):l.length==2&&(c=new V(this.start,this.end._getTransformedByDeletion(e,n))),a=c?c._getTransformedByInsertion(s,n,d!==null||i):[],d){const u=new V(d.start._getCombined(r.start,s),d.end._getCombined(r.start,s));a.length==2?a.splice(1,0,u):a.push(u)}return a}_getTransformedByDeletion(e,t){let n=this.start._getTransformedByDeletion(e,t),i=this.end._getTransformedByDeletion(e,t);return n==null&&i==null?null:(n==null&&(n=e),i==null&&(i=e),new V(n,i))}static _createFromPositionAndShift(e,t){const n=e,i=e.getShiftedBy(t);return t>0?new this(n,i):new this(i,n)}static _createIn(e){return new this(H._createAt(e,0),H._createAt(e,e.maxOffset))}static _createOn(e){return this._createFromPositionAndShift(H._createBefore(e),e.offsetSize)}static _createFromRanges(e){if(e.length===0)throw new I("range-create-from-ranges-empty-array",null);if(e.length==1)return e[0].clone();const t=e[0];e.sort((r,s)=>r.start.isAfter(s.start)?1:-1);const n=e.indexOf(t),i=new this(t.start,t.end);if(n>0)for(let r=n-1;e[r].end.isEqual(i.start);r++)i.start=H._createAt(e[r].start);for(let r=n+1;r<e.length&&e[r].start.isEqual(i.end);r++)i.end=H._createAt(e[r].end);return i}static fromJSON(e,t){return new this(H.fromJSON(e.start,t),H.fromJSON(e.end,t))}}V.prototype.is=function(o){return o==="range"||o==="model:range"};class sh extends me(){constructor(){super(),this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._viewToModelLengthCallbacks=new Map,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._deferredBindingRemovals=new Map,this._unboundMarkerNames=new Set,this.on("modelToViewPosition",(e,t)=>{if(t.viewPosition)return;const n=this._modelToViewMapping.get(t.modelPosition.parent);if(!n)throw new I("mapping-model-position-view-parent-not-found",this,{modelPosition:t.modelPosition});t.viewPosition=this.findPositionIn(n,t.modelPosition.offset)},{priority:"low"}),this.on("viewToModelPosition",(e,t)=>{if(t.modelPosition)return;const n=this.findMappedViewAncestor(t.viewPosition),i=this._viewToModelMapping.get(n),r=this._toModelOffset(t.viewPosition.parent,t.viewPosition.offset,n);t.modelPosition=H._createAt(i,r)},{priority:"low"})}bindElements(e,t){this._modelToViewMapping.set(e,t),this._viewToModelMapping.set(t,e)}unbindViewElement(e,t={}){const n=this.toModelElement(e);if(this._elementToMarkerNames.has(e))for(const i of this._elementToMarkerNames.get(e))this._unboundMarkerNames.add(i);t.defer?this._deferredBindingRemovals.set(e,e.root):(this._viewToModelMapping.delete(e),this._modelToViewMapping.get(n)==e&&this._modelToViewMapping.delete(n))}unbindModelElement(e){const t=this.toViewElement(e);this._modelToViewMapping.delete(e),this._viewToModelMapping.get(t)==e&&this._viewToModelMapping.delete(t)}bindElementToMarker(e,t){const n=this._markerNameToElements.get(t)||new Set;n.add(e);const i=this._elementToMarkerNames.get(e)||new Set;i.add(t),this._markerNameToElements.set(t,n),this._elementToMarkerNames.set(e,i)}unbindElementFromMarkerName(e,t){const n=this._markerNameToElements.get(t);n&&(n.delete(e),n.size==0&&this._markerNameToElements.delete(t));const i=this._elementToMarkerNames.get(e);i&&(i.delete(t),i.size==0&&this._elementToMarkerNames.delete(e))}flushUnboundMarkerNames(){const e=Array.from(this._unboundMarkerNames);return this._unboundMarkerNames.clear(),e}flushDeferredBindings(){for(const[e,t]of this._deferredBindingRemovals)e.root==t&&this.unbindViewElement(e);this._deferredBindingRemovals=new Map}clearBindings(){this._modelToViewMapping=new WeakMap,this._viewToModelMapping=new WeakMap,this._markerNameToElements=new Map,this._elementToMarkerNames=new Map,this._unboundMarkerNames=new Set,this._deferredBindingRemovals=new Map}toModelElement(e){return this._viewToModelMapping.get(e)}toViewElement(e){return this._modelToViewMapping.get(e)}toModelRange(e){return new V(this.toModelPosition(e.start),this.toModelPosition(e.end))}toViewRange(e){return new X(this.toViewPosition(e.start),this.toViewPosition(e.end))}toModelPosition(e){const t={viewPosition:e,mapper:this};return this.fire("viewToModelPosition",t),t.modelPosition}toViewPosition(e,t={}){const n={modelPosition:e,mapper:this,isPhantom:t.isPhantom};return this.fire("modelToViewPosition",n),n.viewPosition}markerNameToElements(e){const t=this._markerNameToElements.get(e);if(!t)return null;const n=new Set;for(const i of t)if(i.is("attributeElement"))for(const r of i.getElementsWithSameId())n.add(r);else n.add(i);return n}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,n){if(n!=e)return this._toModelOffset(e.parent,e.index,n)+this._toModelOffset(e,t,e);if(e.is("$text"))return t;let i=0;for(let r=0;r<t;r++)i+=this.getModelLength(e.getChild(r));return i}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 n of e.getChildren())t+=this.getModelLength(n);return t}}findPositionIn(e,t){let n,i=0,r=0,s=0;if(e.is("$text"))return new U(e,t);for(;r<t;)n=e.getChild(s),i=this.getModelLength(n),r+=i,s++;return r==t?this._moveViewPositionToTextNode(new U(e,s)):this.findPositionIn(n,t-(r-i))}_moveViewPositionToTextNode(e){const t=e.nodeBefore,n=e.nodeAfter;return t instanceof pe?new U(t,t.data.length):n instanceof pe?new U(n,0):e}}class ry{constructor(){this._consumable=new Map,this._textProxyRegistry=new Map}add(e,t){t=vi(t),e instanceof ht&&(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=vi(t),e instanceof ht&&(e=this._getSymbolForTextProxy(e)),!!this.test(e,t)&&(this._consumable.get(e).set(t,!1),!0)}test(e,t){t=vi(t),e instanceof ht&&(e=this._getSymbolForTextProxy(e));const n=this._consumable.get(e);if(n===void 0)return null;const i=n.get(t);return i===void 0?null:i}revert(e,t){t=vi(t),e instanceof ht&&(e=this._getSymbolForTextProxy(e));const n=this.test(e,t);return n===!1?(this._consumable.get(e).set(t,!0),!0):n!==!0&&null}verifyAllConsumed(e){const t=[];for(const[n,i]of this._consumable)for(const[r,s]of i){const a=r.split(":")[0];s&&e==a&&t.push({event:r,item:n.name||n.description})}if(t.length)throw new I("conversion-model-consumable-not-consumed",null,{items:t})}_getSymbolForTextProxy(e){let t=null;const n=this._textProxyRegistry.get(e.startOffset);if(n){const i=n.get(e.endOffset);i&&(t=i.get(e.parent))}return t||(t=this._addSymbolForTextProxy(e)),t}_addSymbolForTextProxy(e){const t=e.startOffset,n=e.endOffset,i=e.parent,r=Symbol("$textProxy:"+e.data);let s,a;return s=this._textProxyRegistry.get(t),s||(s=new Map,this._textProxyRegistry.set(t,s)),a=s.get(n),a||(a=new Map,s.set(n,a)),a.set(i,r),r}}function vi(o){const e=o.split(":");return e[0]=="insert"?e[0]:e[0]=="addMarker"||e[0]=="removeMarker"?o:e.length>1?e[0]+":"+e[1]:e[0]}var sy=Object.defineProperty,ay=Object.defineProperties,ly=Object.getOwnPropertyDescriptors,ah=Object.getOwnPropertySymbols,cy=Object.prototype.hasOwnProperty,dy=Object.prototype.propertyIsEnumerable,lh=(o,e,t)=>e in o?sy(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,ys=(o,e)=>{for(var t in e||(e={}))cy.call(e,t)&&lh(o,t,e[t]);if(ah)for(var t of ah(e))dy.call(e,t)&&lh(o,t,e[t]);return o},ch=(o,e)=>ay(o,ly(e));class dh extends me(){constructor(e){super(),this._conversionApi=ys({dispatcher:this},e),this._firedEventsMap=new WeakMap}convertChanges(e,t,n){const i=this._createConversionApi(n,e.getRefreshedItems());for(const s of e.getMarkersToRemove())this._convertMarkerRemove(s.name,s.range,i);const r=this._reduceChanges(e.getChanges());for(const s of r)s.type==="insert"?this._convertInsert(V._createFromPositionAndShift(s.position,s.length),i):s.type==="reinsert"?this._convertReinsert(V._createFromPositionAndShift(s.position,s.length),i):s.type==="remove"?this._convertRemove(s.position,s.length,s.name,i):this._convertAttribute(s.range,s.attributeKey,s.attributeOldValue,s.attributeNewValue,i);for(const s of i.mapper.flushUnboundMarkerNames()){const a=t.get(s).getRange();this._convertMarkerRemove(s,a,i),this._convertMarkerAdd(s,a,i)}for(const s of e.getMarkersToAdd())this._convertMarkerAdd(s.name,s.range,i);i.mapper.flushDeferredBindings(),i.consumable.verifyAllConsumed("insert")}convert(e,t,n,i={}){const r=this._createConversionApi(n,void 0,i);this._convertInsert(e,r);for(const[s,a]of t)this._convertMarkerAdd(s,a,r);r.consumable.verifyAllConsumed("insert")}convertSelection(e,t,n){const i=Array.from(t.getMarkersAtPosition(e.getFirstPosition())),r=this._createConversionApi(n);if(this._addConsumablesForSelection(r.consumable,e,i),this.fire("selection",{selection:e},r),e.isCollapsed){for(const s of i){const a=s.getRange();if(!hy(e.getFirstPosition(),s,r.mapper))continue;const l={item:e,markerName:s.name,markerRange:a};r.consumable.test(e,"addMarker:"+s.name)&&this.fire(`addMarker:${s.name}`,l,r)}for(const s of e.getAttributeKeys()){const a={item:e,range:e.getFirstRange(),attributeKey:s,attributeOldValue:null,attributeNewValue:e.getAttribute(s)};r.consumable.test(e,"attribute:"+a.attributeKey)&&this.fire(`attribute:${a.attributeKey}:$text`,a,r)}}}_convertInsert(e,t,n={}){n.doNotAddConsumables||this._addConsumablesForInsert(t.consumable,Array.from(e));for(const i of Array.from(e.getWalker({shallow:!0})).map(hh))this._testAndFire("insert",i,t)}_convertRemove(e,t,n,i){this.fire(`remove:${n}`,{position:e,length:t},i)}_convertAttribute(e,t,n,i,r){this._addConsumablesForRange(r.consumable,e,`attribute:${t}`);for(const s of e){const a={item:s.item,range:V._createFromPositionAndShift(s.previousPosition,s.length),attributeKey:t,attributeOldValue:n,attributeNewValue:i};this._testAndFire(`attribute:${t}`,a,r)}}_convertReinsert(e,t){const n=Array.from(e.getWalker({shallow:!0}));this._addConsumablesForInsert(t.consumable,n);for(const i of n.map(hh))this._testAndFire("insert",ch(ys({},i),{reconversion:!0}),t)}_convertMarkerAdd(e,t,n){if(t.root.rootName=="$graveyard")return;const i=`addMarker:${e}`;if(n.consumable.add(t,i),this.fire(i,{markerName:e,markerRange:t},n),n.consumable.consume(t,i)){this._addConsumablesForRange(n.consumable,t,i);for(const r of t.getItems()){if(!n.consumable.test(r,i))continue;const s={item:r,range:V._createOn(r),markerName:e,markerRange:t};this.fire(i,s,n)}}}_convertMarkerRemove(e,t,n){t.root.rootName!="$graveyard"&&this.fire(`removeMarker:${e}`,{markerName:e,markerRange:t},n)}_reduceChanges(e){const t={changes:e};return this.fire("reduceChanges",t),t.changes}_addConsumablesForInsert(e,t){for(const n of t){const i=n.item;if(e.test(i,"insert")===null){e.add(i,"insert");for(const r of i.getAttributeKeys())e.add(i,"attribute:"+r)}}return e}_addConsumablesForRange(e,t,n){for(const i of t.getItems())e.add(i,n);return e}_addConsumablesForSelection(e,t,n){e.add(t,"selection");for(const i of n)e.add(t,"addMarker:"+i.name);for(const i of t.getAttributeKeys())e.add(t,"attribute:"+i);return e}_testAndFire(e,t,n){const i=function(l,c){const d=c.item.is("element")?c.item.name:"$text";return`${l}:${d}`}(e,t),r=t.item.is("$textProxy")?n.consumable._getSymbolForTextProxy(t.item):t.item,s=this._firedEventsMap.get(n),a=s.get(r);if(a){if(a.has(i))return;a.add(i)}else s.set(r,new Set([i]));this.fire(i,t,n)}_testAndFireAddAttributes(e,t){const n={item:e,range:V._createOn(e)};for(const i of n.item.getAttributeKeys())n.attributeKey=i,n.attributeOldValue=null,n.attributeNewValue=n.item.getAttribute(i),this._testAndFire(`attribute:${i}`,n,t)}_createConversionApi(e,t=new Set,n={}){const i=ch(ys({},this._conversionApi),{consumable:new ry,writer:e,options:n,convertItem:r=>this._convertInsert(V._createOn(r),i),convertChildren:r=>this._convertInsert(V._createIn(r),i,{doNotAddConsumables:!0}),convertAttributes:r=>this._testAndFireAddAttributes(r,i),canReuseView:r=>!t.has(i.mapper.toModelElement(r))});return this._firedEventsMap.set(i,new Map),i}}function hy(o,e,t){const n=e.getRange(),i=Array.from(o.getAncestors());return i.shift(),i.reverse(),!i.some(r=>{if(n.containsItem(r))return!!t.toViewElement(r).getCustomProperty("addHighlight")})}function hh(o){return{item:o.item,range:V._createFromPositionAndShift(o.previousPosition,o.length)}}class nt extends me(Ht){constructor(...e){super(),this._lastRangeBackward=!1,this._attrs=new Map,this._ranges=[],e.length&&this.setTo(...e)}get anchor(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.end:e.start}return null}get focus(){if(this._ranges.length>0){const e=this._ranges[this._ranges.length-1];return this._lastRangeBackward?e.start:e.end}return null}get isCollapsed(){return this._ranges.length===1&&this._ranges[0].isCollapsed}get rangeCount(){return this._ranges.length}get isBackward(){return!this.isCollapsed&&this._lastRangeBackward}isEqual(e){if(this.rangeCount!=e.rangeCount)return!1;if(this.rangeCount===0)return!0;if(!this.anchor.isEqual(e.anchor)||!this.focus.isEqual(e.focus))return!1;for(const t of this._ranges){let n=!1;for(const i of e._ranges)if(t.isEqual(i)){n=!0;break}if(!n)return!1}return!0}*getRanges(){for(const e of this._ranges)yield new V(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 V(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 V(e.start,e.end):null}getFirstPosition(){const e=this.getFirstRange();return e?e.start.clone():null}getLastPosition(){const e=this.getLastRange();return e?e.end.clone():null}setTo(...e){let[t,n,i]=e;if(typeof n=="object"&&(i=n,n=void 0),t===null)this._setRanges([]);else if(t instanceof nt)this._setRanges(t.getRanges(),t.isBackward);else if(t&&typeof t.getRanges=="function")this._setRanges(t.getRanges(),t.isBackward);else if(t instanceof V)this._setRanges([t],!!i&&!!i.backward);else if(t instanceof H)this._setRanges([new V(t)]);else if(t instanceof hn){const r=!!i&&!!i.backward;let s;if(n=="in")s=V._createIn(t);else if(n=="on")s=V._createOn(t);else{if(n===void 0)throw new I("model-selection-setto-required-second-parameter",[this,t]);s=new V(H._createAt(t,n))}this._setRanges([s],r)}else{if(!Xe(t))throw new I("model-selection-setto-not-selectable",[this,t]);this._setRanges(t,i&&!!i.backward)}}_setRanges(e,t=!1){const n=Array.from(e),i=n.some(r=>{if(!(r instanceof V))throw new I("model-selection-set-ranges-not-range",[this,e]);return this._ranges.every(s=>!s.isEqual(r))});(n.length!==this._ranges.length||i)&&(this._replaceAllRanges(n),this._lastRangeBackward=!!t,this.fire("change:range",{directChange:!0}))}setFocus(e,t){if(this.anchor===null)throw new I("model-selection-setfocus-no-ranges",[this,e]);const n=H._createAt(e,t);if(n.compareWith(this.focus)=="same")return;const i=this.anchor;this._ranges.length&&this._popRange(),n.compareWith(i)=="before"?(this._pushRange(new V(n,i)),this._lastRangeBackward=!0):(this._pushRange(new V(i,n)),this._lastRangeBackward=!1),this.fire("change:range",{directChange:!0})}getAttribute(e){return this._attrs.get(e)}getAttributes(){return this._attrs.entries()}getAttributeKeys(){return this._attrs.keys()}hasAttribute(e){return this._attrs.has(e)}removeAttribute(e){this.hasAttribute(e)&&(this._attrs.delete(e),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}setAttribute(e,t){this.getAttribute(e)!==t&&(this._attrs.set(e,t),this.fire("change:attribute",{attributeKeys:[e],directChange:!0}))}getSelectedElement(){return this.rangeCount!==1?null:this.getFirstRange().getContainedElement()}*getSelectedBlocks(){const e=new WeakSet;for(const t of this.getRanges()){const n=mh(t.start,e);my(n,t)&&(yield n);for(const r of t.getWalker()){const s=r.item;r.type=="elementEnd"&&uy(s,e,t)&&(yield s)}const i=mh(t.end,e);gy(i,t)&&(yield i)}}containsEntireContent(e=this.anchor.root){const t=H._createAt(e,0),n=H._createAt(e,"end");return t.isTouching(this.getFirstPosition())&&n.isTouching(this.getLastPosition())}_pushRange(e){this._checkRange(e),this._ranges.push(new V(e.start,e.end))}_checkRange(e){for(let t=0;t<this._ranges.length;t++)if(e.isIntersecting(this._ranges[t]))throw new I("model-selection-range-intersects",[this,e],{addedRange:e,intersectingRange:this._ranges[t]})}_replaceAllRanges(e){this._removeAllRanges();for(const t of e)this._pushRange(t)}_removeAllRanges(){for(;this._ranges.length>0;)this._popRange()}_popRange(){this._ranges.pop()}}function uh(o,e){return!e.has(o)&&(e.add(o),o.root.document.model.schema.isBlock(o)&&!!o.parent)}function uy(o,e,t){return uh(o,e)&&Es(o,t)}function mh(o,e){const t=o.parent.root.document.model.schema,n=o.parent.getAncestors({parentFirst:!0,includeSelf:!0});let i=!1;const r=n.find(s=>!i&&(i=t.isLimit(s),!i&&uh(s,e)));return n.forEach(s=>e.add(s)),r}function Es(o,e){const t=function(n){const i=n.root.document.model.schema;let r=n.parent;for(;r;){if(i.isBlock(r))return r;r=r.parent}}(o);return t?!e.containsRange(V._createOn(t),!0):!0}function my(o,e){return!!o&&(!(!e.isCollapsed&&!o.isEmpty)||!e.start.isTouching(H._createAt(o,o.maxOffset))&&Es(o,e))}function gy(o,e){return!!o&&(!(!e.isCollapsed&&!o.isEmpty)||!e.end.isTouching(H._createAt(o,0))&&Es(o,e))}nt.prototype.is=function(o){return o==="selection"||o==="model:selection"};class Dt extends me(V){constructor(e,t){super(e,t),py.call(this)}detach(){this.stopListening()}toRange(){return new V(this.start,this.end)}static fromRange(e){return new Dt(e.start,e.end)}}function py(){this.listenTo(this.root.document.model,"applyOperation",(o,e)=>{const t=e[0];t.isDocumentOperation&&fy.call(this,t)},{priority:"low"})}function fy(o){const e=this.getTransformedByOperation(o),t=V._createFromRanges(e),n=!t.isEqual(this),i=function(s,a){switch(a.type){case"insert":return s.containsPosition(a.position);case"move":case"remove":case"reinsert":case"merge":return s.containsPosition(a.sourcePosition)||s.start.isEqual(a.sourcePosition)||s.containsPosition(a.targetPosition);case"split":return s.containsPosition(a.splitPosition)||s.containsPosition(a.insertionPosition)}return!1}(this,o);let r=null;if(n){t.root.rootName=="$graveyard"&&(r=o.type=="remove"?o.sourcePosition:o.deletionPosition);const s=this.toRange();this.start=t.start,this.end=t.end,this.fire("change:range",s,{deletionPosition:r})}else i&&this.fire("change:content",this.toRange(),{deletionPosition:r})}Dt.prototype.is=function(o){return o==="liveRange"||o==="model:liveRange"||o=="range"||o==="model:range"};const yi="selection:";class ut extends me(Ht){constructor(e){super(),this._selection=new ky(e),this._selection.delegate("change:range").to(this),this._selection.delegate("change:attribute").to(this),this._selection.delegate("change:marker").to(this)}get isCollapsed(){return this._selection.isCollapsed}get anchor(){return this._selection.anchor}get focus(){return this._selection.focus}get rangeCount(){return this._selection.rangeCount}get hasOwnRange(){return this._selection.hasOwnRange}get isBackward(){return this._selection.isBackward}get isGravityOverridden(){return this._selection.isGravityOverridden}get markers(){return this._selection.markers}get _ranges(){return this._selection._ranges}getRanges(){return this._selection.getRanges()}getFirstPosition(){return this._selection.getFirstPosition()}getLastPosition(){return this._selection.getLastPosition()}getFirstRange(){return this._selection.getFirstRange()}getLastRange(){return this._selection.getLastRange()}getSelectedBlocks(){return this._selection.getSelectedBlocks()}getSelectedElement(){return this._selection.getSelectedElement()}containsEntireContent(e){return this._selection.containsEntireContent(e)}destroy(){this._selection.destroy()}getAttributeKeys(){return this._selection.getAttributeKeys()}getAttributes(){return this._selection.getAttributes()}getAttribute(e){return this._selection.getAttribute(e)}hasAttribute(e){return this._selection.hasAttribute(e)}refresh(){this._selection.updateMarkers(),this._selection._updateAttributes(!1)}observeMarkers(e){this._selection.observeMarkers(e)}_setFocus(e,t){this._selection.setFocus(e,t)}_setTo(...e){this._selection.setTo(...e)}_setAttribute(e,t){this._selection.setAttribute(e,t)}_removeAttribute(e){this._selection.removeAttribute(e)}_getStoredAttributes(){return this._selection.getStoredAttributes()}_overrideGravity(){return this._selection.overrideGravity()}_restoreGravity(e){this._selection.restoreGravity(e)}static _getStoreAttributeKey(e){return yi+e}static _isStoreAttributeKey(e){return e.startsWith(yi)}}ut.prototype.is=function(o){return o==="selection"||o=="model:selection"||o=="documentSelection"||o=="model:documentSelection"};class ky extends nt{constructor(e){super(),this.markers=new st({idProperty:"name"}),this._attributePriority=new Map,this._selectionRestorePosition=null,this._hasChangedRange=!1,this._overriddenGravityRegister=new Set,this._observedMarkers=new Set,this._model=e.model,this._document=e,this.listenTo(this._model,"applyOperation",(t,n)=>{const i=n[0];i.isDocumentOperation&&i.type!="marker"&&i.type!="rename"&&i.type!="noop"&&(this._ranges.length==0&&this._selectionRestorePosition&&this._fixGraveyardSelection(this._selectionRestorePosition),this._selectionRestorePosition=null,this._hasChangedRange&&(this._hasChangedRange=!1,this.fire("change:range",{directChange:!1})))},{priority:"lowest"}),this.on("change:range",()=>{this._validateSelectionRanges(this.getRanges())}),this.listenTo(this._model.markers,"update",(t,n,i,r)=>{this._updateMarker(n,r)}),this.listenTo(this._document,"change",(t,n)=>{(function(i,r){const s=i.document.differ;for(const a of s.getChanges()){if(a.type!="insert")continue;const l=a.position.parent;a.length===l.maxOffset&&i.enqueueChange(r,c=>{const d=Array.from(l.getAttributeKeys()).filter(u=>u.startsWith(yi));for(const u of d)c.removeAttribute(u,l)})}})(this._model,n)})}get isCollapsed(){return this._ranges.length===0?this._document._getDefaultRange().isCollapsed:super.isCollapsed}get anchor(){return super.anchor||this._document._getDefaultRange().start}get focus(){return super.focus||this._document._getDefaultRange().end}get rangeCount(){return this._ranges.length?this._ranges.length:1}get hasOwnRange(){return this._ranges.length>0}get isGravityOverridden(){return!!this._overriddenGravityRegister.size}destroy(){for(let e=0;e<this._ranges.length;e++)this._ranges[e].detach();this.stopListening()}*getRanges(){this._ranges.length?yield*super.getRanges():yield this._document._getDefaultRange()}getFirstRange(){return super.getFirstRange()||this._document._getDefaultRange()}getLastRange(){return super.getLastRange()||this._document._getDefaultRange()}setTo(...e){super.setTo(...e),this._updateAttributes(!0),this.updateMarkers()}setFocus(e,t){super.setFocus(e,t),this._updateAttributes(!0),this.updateMarkers()}setAttribute(e,t){if(this._setAttribute(e,t)){const n=[e];this.fire("change:attribute",{attributeKeys:n,directChange:!0})}}removeAttribute(e){if(this._removeAttribute(e)){const t=[e];this.fire("change:attribute",{attributeKeys:t,directChange:!0})}}overrideGravity(){const e=J();return this._overriddenGravityRegister.add(e),this._overriddenGravityRegister.size===1&&this._updateAttributes(!0),e}restoreGravity(e){if(!this._overriddenGravityRegister.has(e))throw new I("document-selection-gravity-wrong-restore",this,{uid:e});this._overriddenGravityRegister.delete(e),this.isGravityOverridden||this._updateAttributes(!0)}observeMarkers(e){this._observedMarkers.add(e),this.updateMarkers()}_replaceAllRanges(e){this._validateSelectionRanges(e),super._replaceAllRanges(e)}_popRange(){this._ranges.pop().detach()}_pushRange(e){const t=this._prepareRange(e);t&&this._ranges.push(t)}_validateSelectionRanges(e){for(const t of e)if(!this._document._validateSelectionRange(t))throw new I("document-selection-wrong-position",this,{range:t})}_prepareRange(e){if(this._checkRange(e),e.root==this._document.graveyard)return;const t=Dt.fromRange(e);return t.on("change:range",(n,i,r)=>{if(this._hasChangedRange=!0,t.root==this._document.graveyard){this._selectionRestorePosition=r.deletionPosition;const s=this._ranges.indexOf(t);this._ranges.splice(s,1),t.detach()}}),t}updateMarkers(){if(!this._observedMarkers.size)return;const e=[];let t=!1;for(const i of this._model.markers){const r=i.name.split(":",1)[0];if(!this._observedMarkers.has(r))continue;const s=i.getRange();for(const a of this.getRanges())s.containsRange(a,!a.isCollapsed)&&e.push(i)}const n=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:n,directChange:!1})}_updateMarker(e,t){const n=e.name.split(":",1)[0];if(!this._observedMarkers.has(n))return;let i=!1;const r=Array.from(this.markers),s=this.markers.has(e);if(t){let a=!1;for(const l of this.getRanges())if(t.containsRange(l,!l.isCollapsed)){a=!0;break}a&&!s?(this.markers.add(e),i=!0):!a&&s&&(this.markers.remove(e),i=!0)}else s&&(this.markers.remove(e),i=!0);i&&this.fire("change:marker",{oldMarkers:r,directChange:!1})}_updateAttributes(e){const t=St(this._getSurroundingAttributes()),n=St(this.getAttributes());if(e)this._attributePriority=new Map,this._attrs=new Map;else for(const[r,s]of this._attributePriority)s=="low"&&(this._attrs.delete(r),this._attributePriority.delete(r));this._setAttributesTo(t);const i=[];for(const[r,s]of this.getAttributes())n.has(r)&&n.get(r)===s||i.push(r);for(const[r]of n)this.hasAttribute(r)||i.push(r);i.length>0&&this.fire("change:attribute",{attributeKeys:i,directChange:!1})}_setAttribute(e,t,n=!0){const i=n?"normal":"low";return i=="low"&&this._attributePriority.get(e)=="normal"?!1:super.getAttribute(e)!==t&&(this._attrs.set(e,t),this._attributePriority.set(e,i),!0)}_removeAttribute(e,t=!0){const n=t?"normal":"low";return(n!="low"||this._attributePriority.get(e)!="normal")&&(this._attributePriority.set(e,n),!!super.hasAttribute(e)&&(this._attrs.delete(e),!0))}_setAttributesTo(e){const t=new Set;for(const[n,i]of this.getAttributes())e.get(n)!==i&&this._removeAttribute(n,!1);for(const[n,i]of e)this._setAttribute(n,i,!1)&&t.add(n);return t}*getStoredAttributes(){const e=this.getFirstPosition().parent;if(this.isCollapsed&&e.isEmpty)for(const t of e.getAttributeKeys())t.startsWith(yi)&&(yield[t.substr(10),e.getAttribute(t)])}_getSurroundingAttributes(){const e=this.getFirstPosition(),t=this._model.schema;let n=null;if(this.isCollapsed){const i=e.textNode?e.textNode:e.nodeBefore,r=e.textNode?e.textNode:e.nodeAfter;if(this.isGravityOverridden||(n=Ei(i)),n||(n=Ei(r)),!this.isGravityOverridden&&!n){let s=i;for(;s&&!t.isInline(s)&&!n;)s=s.previousSibling,n=Ei(s)}if(!n){let s=r;for(;s&&!t.isInline(s)&&!n;)s=s.nextSibling,n=Ei(s)}n||(n=this.getStoredAttributes())}else{const i=this.getFirstRange();for(const r of i){if(r.item.is("element")&&t.isObject(r.item))break;if(r.type=="text"){n=r.item.getAttributes();break}}}return n}_fixGraveyardSelection(e){const t=this._model.schema.getNearestSelectionRange(e);t&&this._pushRange(t)}}function Ei(o){return o instanceof ht||o instanceof fe?o.getAttributes():null}class gh{constructor(e){this._dispatchers=e}add(e){for(const t of this._dispatchers)e(t);return this}}const qt=function(o){return Fr(o,5)};class by extends gh{elementToElement(e){return this.add(function(t){const n=kh(t.model),i=xo(t.view,"container");return n.attributes.length&&(n.children=!0),r=>{r.on(`insert:${n.name}`,function(s,a=Ay){return(l,c,d)=>{if(!a(c.item,d.consumable,{preflight:!0}))return;const u=s(c.item,d,c);if(!u)return;a(c.item,d.consumable);const g=d.mapper.toViewPosition(c.range.start);d.mapper.bindElements(c.item,u),d.writer.insert(g,u),d.convertAttributes(c.item),Ch(u,c.item.getChildren(),d,{reconversion:c.reconversion})}}(i,_h(n)),{priority:t.converterPriority||"normal"}),(n.children||n.attributes.length)&&r.on("reduceChanges",Ah(n),{priority:"low"})}}(e))}elementToStructure(e){return this.add(function(t){const n=kh(t.model),i=xo(t.view,"container");return n.children=!0,r=>{if(r._conversionApi.schema.checkChild(n.name,"$text"))throw new I("conversion-element-to-structure-disallowed-text",r,{elementName:n.name});var s,a;r.on(`insert:${n.name}`,(s=i,a=_h(n),(l,c,d)=>{if(!a(c.item,d.consumable,{preflight:!0}))return;const u=new Map;d.writer._registerSlotFactory(function(b,A,E){return(P,z)=>{const j=P.createContainerElement("$slot");let Y=null;if(z==="children")Y=Array.from(b.getChildren());else{if(typeof z!="function")throw new I("conversion-slot-mode-unknown",E.dispatcher,{modeOrFilter:z});Y=Array.from(b.getChildren()).filter(ie=>z(ie))}return A.set(j,Y),j}}(c.item,u,d));const g=s(c.item,d,c);if(d.writer._clearSlotFactory(),!g)return;(function(b,A,E){const P=Array.from(A.values()).flat(),z=new Set(P);if(z.size!=P.length)throw new I("conversion-slot-filter-overlap",E.dispatcher,{element:b});if(z.size!=b.childCount)throw new I("conversion-slot-filter-incomplete",E.dispatcher,{element:b})})(c.item,u,d),a(c.item,d.consumable);const f=d.mapper.toViewPosition(c.range.start);d.mapper.bindElements(c.item,g),d.writer.insert(f,g),d.convertAttributes(c.item),function(b,A,E,P){E.mapper.on("modelToViewPosition",Y,{priority:"highest"});let z=null,j=null;for([z,j]of A)Ch(b,j,E,P),E.writer.move(E.writer.createRangeIn(z),E.writer.createPositionBefore(z)),E.writer.remove(z);function Y(ie,Ee){const he=Ee.modelPosition.nodeAfter,zt=j.indexOf(he);zt<0||(Ee.viewPosition=Ee.mapper.findPositionIn(z,zt))}E.mapper.off("modelToViewPosition",Y)}(g,u,d,{reconversion:c.reconversion})}),{priority:t.converterPriority||"normal"}),r.on("reduceChanges",Ah(n),{priority:"low"})}}(e))}attributeToElement(e){return this.add(function(t){t=qt(t);let n=t.model;typeof n=="string"&&(n={key:n});let i=`attribute:${n.key}`;if(n.name&&(i+=":"+n.name),n.values)for(const s of n.values)t.view[s]=xo(t.view[s],"attribute");else t.view=xo(t.view,"attribute");const r=bh(t);return s=>{s.on(i,function(a){return(l,c,d)=>{if(!d.consumable.test(c.item,l.name))return;const u=a(c.attributeOldValue,d,c),g=a(c.attributeNewValue,d,c);if(!u&&!g)return;d.consumable.consume(c.item,l.name);const f=d.writer,b=f.document.selection;if(c.item instanceof nt||c.item instanceof ut)f.wrap(b.getFirstRange(),g);else{let A=d.mapper.toViewRange(c.range);c.attributeOldValue!==null&&u&&(A=f.unwrap(A,u)),c.attributeNewValue!==null&&g&&f.wrap(A,g)}}}(r),{priority:t.converterPriority||"normal"})}}(e))}attributeToAttribute(e){return this.add(function(t){t=qt(t);let n=t.model;typeof n=="string"&&(n={key:n});let i=`attribute:${n.key}`;if(n.name&&(i+=":"+n.name),n.values)for(const s of n.values)t.view[s]=wh(t.view[s]);else t.view=wh(t.view);const r=bh(t);return s=>{var a;s.on(i,(a=r,(l,c,d)=>{if(!d.consumable.test(c.item,l.name))return;const u=a(c.attributeOldValue,d,c),g=a(c.attributeNewValue,d,c);if(!u&&!g)return;d.consumable.consume(c.item,l.name);const f=d.mapper.toViewElement(c.item),b=d.writer;if(!f)throw new I("conversion-attribute-to-attribute-on-text",d.dispatcher,c);if(c.attributeOldValue!==null&&u)if(u.key=="class"){const A=Pe(u.value);for(const E of A)b.removeClass(E,f)}else if(u.key=="style"){const A=Object.keys(u.value);for(const E of A)b.removeStyle(E,f)}else b.removeAttribute(u.key,f);if(c.attributeNewValue!==null&&g)if(g.key=="class"){const A=Pe(g.value);for(const E of A)b.addClass(E,f)}else if(g.key=="style"){const A=Object.keys(g.value);for(const E of A)b.setStyle(E,g.value[E],f)}else b.setAttribute(g.key,g.value,f)}),{priority:t.converterPriority||"normal"})}}(e))}markerToElement(e){return this.add(function(t){const n=xo(t.view,"ui");return i=>{var r;i.on(`addMarker:${t.model}`,(r=n,(s,a,l)=>{a.isOpening=!0;const c=r(a,l);a.isOpening=!1;const d=r(a,l);if(!c||!d)return;const u=a.markerRange;if(u.isCollapsed&&!l.consumable.consume(u,s.name))return;for(const b of u)if(!l.consumable.consume(b.item,s.name))return;const g=l.mapper,f=l.writer;f.insert(g.toViewPosition(u.start),c),l.mapper.bindElementToMarker(c,a.markerName),u.isCollapsed||(f.insert(g.toViewPosition(u.end),d),l.mapper.bindElementToMarker(d,a.markerName)),s.stop()}),{priority:t.converterPriority||"normal"}),i.on(`removeMarker:${t.model}`,(s,a,l)=>{const c=l.mapper.markerNameToElements(a.markerName);if(c){for(const d of c)l.mapper.unbindElementFromMarkerName(d,a.markerName),l.writer.clear(l.writer.createRangeOn(d),d);l.writer.clearClonedElementsGroup(a.markerName),s.stop()}},{priority:t.converterPriority||"normal"})}}(e))}markerToHighlight(e){return this.add(function(t){return n=>{var i;n.on(`addMarker:${t.model}`,(i=t.view,(r,s,a)=>{if(!s.item||!(s.item instanceof nt||s.item instanceof ut||s.item.is("$textProxy")))return;const l=xs(i,s,a);if(!l||!a.consumable.consume(s.item,r.name))return;const c=a.writer,d=ph(c,l),u=c.document.selection;if(s.item instanceof nt||s.item instanceof ut)c.wrap(u.getFirstRange(),d);else{const g=a.mapper.toViewRange(s.range),f=c.wrap(g,d);for(const b of f.getItems())if(b.is("attributeElement")&&b.isSimilar(d)){a.mapper.bindElementToMarker(b,s.markerName);break}}}),{priority:t.converterPriority||"normal"}),n.on(`addMarker:${t.model}`,function(r){return(s,a,l)=>{if(!a.item||!(a.item instanceof ke))return;const c=xs(r,a,l);if(!c||!l.consumable.test(a.item,s.name))return;const d=l.mapper.toViewElement(a.item);if(d&&d.getCustomProperty("addHighlight")){l.consumable.consume(a.item,s.name);for(const u of V._createIn(a.item))l.consumable.consume(u.item,s.name);d.getCustomProperty("addHighlight")(d,c,l.writer),l.mapper.bindElementToMarker(d,a.markerName)}}}(t.view),{priority:t.converterPriority||"normal"}),n.on(`removeMarker:${t.model}`,function(r){return(s,a,l)=>{if(a.markerRange.isCollapsed)return;const c=xs(r,a,l);if(!c)return;const d=ph(l.writer,c),u=l.mapper.markerNameToElements(a.markerName);if(u){for(const g of u)l.mapper.unbindElementFromMarkerName(g,a.markerName),g.is("attributeElement")?l.writer.unwrap(l.writer.createRangeOn(g),d):g.getCustomProperty("removeHighlight")(g,c.id,l.writer);l.writer.clearClonedElementsGroup(a.markerName),s.stop()}}}(t.view),{priority:t.converterPriority||"normal"})}}(e))}markerToData(e){return this.add(function(t){t=qt(t);const n=t.model;let i=t.view;return i||(i=r=>({group:n,name:r.substr(t.model.length+1)})),r=>{var s;r.on(`addMarker:${n}`,(s=i,(a,l,c)=>{const d=s(l.markerName,c);if(!d)return;const u=l.markerRange;c.consumable.consume(u,a.name)&&(fh(u,!1,c,l,d),fh(u,!0,c,l,d),a.stop())}),{priority:t.converterPriority||"normal"}),r.on(`removeMarker:${n}`,function(a){return(l,c,d)=>{const u=a(c.markerName,d);if(!u)return;const g=d.mapper.markerNameToElements(c.markerName);if(g){for(const b of g)d.mapper.unbindElementFromMarkerName(b,c.markerName),b.is("containerElement")?(f(`data-${u.group}-start-before`,b),f(`data-${u.group}-start-after`,b),f(`data-${u.group}-end-before`,b),f(`data-${u.group}-end-after`,b)):d.writer.clear(d.writer.createRangeOn(b),b);d.writer.clearClonedElementsGroup(c.markerName),l.stop()}function f(b,A){if(A.hasAttribute(b)){const E=new Set(A.getAttribute(b).split(","));E.delete(u.name),E.size==0?d.writer.removeAttribute(b,A):d.writer.setAttribute(b,Array.from(E).join(","),A)}}}}(i),{priority:t.converterPriority||"normal"})}}(e))}}function ph(o,e){const t=o.createAttributeElement("span",e.attributes);return e.classes&&t._addClass(e.classes),typeof e.priority=="number"&&(t._priority=e.priority),t._id=e.id,t}function fh(o,e,t,n,i){const r=e?o.start:o.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 l,c;e&&s||!e&&!a?(l=s,c=!0):(l=a,c=!1);const d=t.mapper.toViewElement(l);if(d)return void function(u,g,f,b,A,E){const P=`data-${E.group}-${g?"start":"end"}-${f?"before":"after"}`,z=u.hasAttribute(P)?u.getAttribute(P).split(","):[];z.unshift(E.name),b.writer.setAttribute(P,z.join(","),u),b.mapper.bindElementToMarker(u,A.markerName)}(d,e,c,t,n,i)}(function(l,c,d,u,g){const f=`${g.group}-${c?"start":"end"}`,b=g.name?{name:g.name}:null,A=d.writer.createUIElement(f,b);d.writer.insert(l,A),d.mapper.bindElementToMarker(A,u.markerName)})(t.mapper.toViewPosition(r),e,t,n,i)}function kh(o){return typeof o=="string"&&(o={name:o}),o.attributes?Array.isArray(o.attributes)||(o.attributes=[o.attributes]):o.attributes=[],o.children=!!o.children,o}function xo(o,e){return typeof o=="function"?o:(t,n)=>function(i,r,s){typeof i=="string"&&(i={name:i});let a;const l=r.writer,c=Object.assign({},i.attributes);if(s=="container")a=l.createContainerElement(i.name,c);else if(s=="attribute"){const d={priority:i.priority||cn.DEFAULT_PRIORITY};a=l.createAttributeElement(i.name,c,d)}else a=l.createUIElement(i.name,c);if(i.styles){const d=Object.keys(i.styles);for(const u of d)l.setStyle(u,i.styles[u],a)}if(i.classes){const d=i.classes;if(typeof d=="string")l.addClass(d,a);else for(const u of d)l.addClass(u,a)}return a}(o,n,e)}function bh(o){return o.model.values?(e,t,n)=>{const i=o.view[e];return i?i(e,t,n):null}:o.view}function wh(o){return typeof o=="string"?e=>({key:o,value:e}):typeof o=="object"?o.value?()=>o:e=>({key:o.key,value:e}):o}function xs(o,e,t){const n=typeof o=="function"?o(e,t):o;return n?(n.priority||(n.priority=10),n.id||(n.id=e.markerName),n):null}function Ah(o){const e=function(t){return(n,i)=>{if(!n.is("element",t.name))return!1;if(i.type=="attribute"){if(t.attributes.includes(i.attributeKey))return!0}else if(t.children)return!0;return!1}}(o);return(t,n)=>{const i=[];n.reconvertedElements||(n.reconvertedElements=new Set);for(const r of n.changes){const s=r.type=="attribute"?r.range.start.nodeAfter:r.position.parent;if(s&&e(s,r)){if(!n.reconvertedElements.has(s)){n.reconvertedElements.add(s);const a=H._createBefore(s);let l=i.length;for(let c=i.length-1;c>=0;c--){const d=i[c],u=(d.type=="attribute"?d.range.start:d.position).compareWith(a);if(u=="before"||d.type=="remove"&&u=="same")break;l=c}i.splice(l,0,{type:"remove",name:s.name,position:a,length:1},{type:"reinsert",name:s.name,position:a,length:1})}}else i.push(r)}n.changes=i}}function _h(o){return(e,t,n={})=>{const i=["insert"];for(const r of o.attributes)e.hasAttribute(r)&&i.push(`attribute:${r}`);return!!i.every(r=>t.test(e,r))&&(n.preflight||i.forEach(r=>t.consume(e,r)),!0)}}function Ch(o,e,t,n){for(const i of e)wy(o.root,i,t,n)||t.convertItem(i)}function wy(o,e,t,n){const{writer:i,mapper:r}=t;if(!n.reconversion)return!1;const s=r.toViewElement(e);return!(!s||s.root==o)&&!!t.canReuseView(s)&&(i.move(i.createRangeOn(s),r.toViewPosition(H._createBefore(e))),!0)}function Ay(o,e,{preflight:t}={}){return t?e.test(o,"insert"):e.consume(o,"insert")}function vh(o){const{schema:e,document:t}=o.model;for(const n of t.getRootNames()){const i=t.getRoot(n);if(i.isEmpty&&!e.checkChild(i,"$text")&&e.checkChild(i,"paragraph"))return o.insertElement("paragraph",i),!0}return!1}function yh(o,e,t){const n=t.createContext(o);return!!t.checkChild(n,"paragraph")&&!!t.checkChild(n.push("paragraph"),e)}function Eh(o,e){const t=e.createElement("paragraph");return e.insert(t,o),e.createPositionAt(t,0)}var _y=Object.defineProperty,Cy=Object.defineProperties,vy=Object.getOwnPropertyDescriptors,xh=Object.getOwnPropertySymbols,yy=Object.prototype.hasOwnProperty,Ey=Object.prototype.propertyIsEnumerable,Sh=(o,e,t)=>e in o?_y(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;class xy extends gh{elementToElement(e){return this.add(Dh(e))}elementToAttribute(e){return this.add(function(t){t=qt(t),Bh(t);const n=Th(t,!1),i=Ss(t.view),r=i?`element:${i}`:"element";return s=>{s.on(r,n,{priority:t.converterPriority||"low"})}}(e))}attributeToAttribute(e){return this.add(function(t){t=qt(t);let n=null;(typeof t.view=="string"||t.view.key)&&(n=function(r){typeof r.view=="string"&&(r.view={key:r.view});const s=r.view.key;let a;return s=="class"||s=="style"?a={[s=="class"?"classes":"styles"]:r.view.value}:a={attributes:{[s]:r.view.value===void 0?/[\s\S]*/:r.view.value}},r.view.name&&(a.name=r.view.name),r.view=a,s}(t)),Bh(t,n);const i=Th(t,!0);return r=>{r.on("element",i,{priority:t.converterPriority||"low"})}}(e))}elementToMarker(e){return this.add(function(t){const n=function(s){return(a,l)=>{const c=typeof s=="string"?s:s(a,l);return l.writer.createElement("$marker",{"data-name":c})}}(t.model);return Dh((i=((s,a)=>{for(var l in a||(a={}))yy.call(a,l)&&Sh(s,l,a[l]);if(xh)for(var l of xh(a))Ey.call(a,l)&&Sh(s,l,a[l]);return s})({},t),r={model:n},Cy(i,vy(r))));var i,r}(e))}dataToMarker(e){return this.add(function(t){t=qt(t),t.model||(t.model=s=>s?t.view+":"+s:t.view);const n={view:t.view,model:t.model},i=Ds(Ih(n,"start")),r=Ds(Ih(n,"end"));return s=>{s.on(`element:${t.view}-start`,i,{priority:t.converterPriority||"normal"}),s.on(`element:${t.view}-end`,r,{priority:t.converterPriority||"normal"});const a=te.get("low"),l=te.get("highest"),c=te.get(t.converterPriority)/l;s.on("element",function(d){return(u,g,f)=>{const b=`data-${d.view}`;function A(E,P){for(const z of P){const j=d.model(z,f),Y=f.writer.createElement("$marker",{"data-name":j});f.writer.insert(Y,E),g.modelCursor.isEqual(E)?g.modelCursor=g.modelCursor.getShiftedBy(1):g.modelCursor=g.modelCursor._getTransformedByInsertion(E,1),g.modelRange=g.modelRange._getTransformedByInsertion(E,1)[0]}}(f.consumable.test(g.viewItem,{attributes:b+"-end-after"})||f.consumable.test(g.viewItem,{attributes:b+"-start-after"})||f.consumable.test(g.viewItem,{attributes:b+"-end-before"})||f.consumable.test(g.viewItem,{attributes:b+"-start-before"}))&&(g.modelRange||Object.assign(g,f.convertChildren(g.viewItem,g.modelCursor)),f.consumable.consume(g.viewItem,{attributes:b+"-end-after"})&&A(g.modelRange.end,g.viewItem.getAttribute(b+"-end-after").split(",")),f.consumable.consume(g.viewItem,{attributes:b+"-start-after"})&&A(g.modelRange.end,g.viewItem.getAttribute(b+"-start-after").split(",")),f.consumable.consume(g.viewItem,{attributes:b+"-end-before"})&&A(g.modelRange.start,g.viewItem.getAttribute(b+"-end-before").split(",")),f.consumable.consume(g.viewItem,{attributes:b+"-start-before"})&&A(g.modelRange.start,g.viewItem.getAttribute(b+"-start-before").split(",")))}}(n),{priority:a+c})}}(e))}}function Dh(o){const e=Ds(o=qt(o)),t=Ss(o.view),n=t?`element:${t}`:"element";return i=>{i.on(n,e,{priority:o.converterPriority||"normal"})}}function Ss(o){return typeof o=="string"?o:typeof o=="object"&&typeof o.name=="string"?o.name:null}function Ds(o){const e=new Mn(o.view);return(t,n,i)=>{const r=e.match(n.viewItem);if(!r)return;const s=r.match;if(s.name=!0,!i.consumable.test(n.viewItem,s))return;const a=function(l,c,d){return l instanceof Function?l(c,d):d.writer.createElement(l)}(o.model,n.viewItem,i);a&&i.safeInsert(a,n.modelCursor)&&(i.consumable.consume(n.viewItem,s),i.convertChildren(n.viewItem,a),i.updateConversionResult(a,n))}}function Bh(o,e=null){const t=e===null||(r=>r.getAttribute(e)),n=typeof o.model!="object"?o.model:o.model.key,i=typeof o.model!="object"||o.model.value===void 0?t:o.model.value;o.model={key:n,value:i}}function Th(o,e){const t=new Mn(o.view);return(n,i,r)=>{if(!i.modelRange&&e)return;const s=t.match(i.viewItem);if(!s||(function(d,u){const g=typeof d=="function"?d(u):d;return typeof g=="object"&&!Ss(g)?!1:!g.classes&&!g.attributes&&!g.styles}(o.view,i.viewItem)?s.match.name=!0:delete s.match.name,!r.consumable.test(i.viewItem,s.match)))return;const a=o.model.key,l=typeof o.model.value=="function"?o.model.value(i.viewItem,r):o.model.value;if(l===null)return;i.modelRange||Object.assign(i,r.convertChildren(i.viewItem,i.modelCursor)),function(d,u,g,f){let b=!1;for(const A of Array.from(d.getItems({shallow:g})))f.schema.checkAttribute(A,u.key)&&(b=!0,A.hasAttribute(u.key)||f.writer.setAttribute(u.key,u.value,A));return b}(i.modelRange,{key:a,value:l},e,r)&&(r.consumable.test(i.viewItem,{name:!0})&&(s.match.name=!0),r.consumable.consume(i.viewItem,s.match))}}function Ih(o,e){return{view:`${o.view}-${e}`,model:(t,n)=>{const i=t.getAttribute("name"),r=o.model(i,n);return n.writer.createElement("$marker",{"data-name":r})}}}function Sy(o){o.document.registerPostFixer(e=>function(t,n){const i=n.document.selection,r=n.schema,s=[];let a=!1;for(const l of i.getRanges()){const c=Ph(l,r);c&&!c.isEqual(l)?(s.push(c),a=!0):s.push(l)}return a&&t.setSelection(function(l){const c=[...l],d=new Set;let u=1;for(;u<c.length;){const g=c[u],f=c.slice(0,u);for(const[b,A]of f.entries())if(!d.has(b)){if(g.isEqual(A))d.add(b);else if(g.isIntersecting(A)){d.add(b),d.add(u);const E=g.getJoined(A);c.push(E)}}u++}return c.filter((g,f)=>!d.has(f))}(s),{backward:i.isBackward}),!1}(e,o))}function Ph(o,e){return o.isCollapsed?function(t,n){const i=t.start,r=n.getNearestSelectionRange(i);if(!r){const a=i.getAncestors().reverse().find(l=>n.isObject(l));return a?V._createOn(a):null}if(!r.isCollapsed)return r;const s=r.start;return i.isEqual(s)?null:new V(s)}(o,e):function(t,n){const{start:i,end:r}=t,s=n.checkChild(i,"$text"),a=n.checkChild(r,"$text"),l=n.getLimitElement(i),c=n.getLimitElement(r);if(l===c){if(s&&a)return null;if(function(g,f,b){const A=g.nodeAfter&&!b.isLimit(g.nodeAfter)||b.checkChild(g,"$text"),E=f.nodeBefore&&!b.isLimit(f.nodeBefore)||b.checkChild(f,"$text");return A||E}(i,r,n)){const g=i.nodeAfter&&n.isSelectable(i.nodeAfter)?null:n.getNearestSelectionRange(i,"forward"),f=r.nodeBefore&&n.isSelectable(r.nodeBefore)?null:n.getNearestSelectionRange(r,"backward"),b=g?g.start:i,A=f?f.end:r;return new V(b,A)}}const d=l&&!l.is("rootElement"),u=c&&!c.is("rootElement");if(d||u){const g=i.nodeAfter&&r.nodeBefore&&i.nodeAfter.parent===r.nodeBefore.parent,f=d&&(!g||!Oh(i.nodeAfter,n)),b=u&&(!g||!Oh(r.nodeBefore,n));let A=i,E=r;return f&&(A=H._createBefore(Rh(l,n))),b&&(E=H._createAfter(Rh(c,n))),new V(A,E)}return null}(o,e)}function Rh(o,e){let t=o,n=t;for(;e.isLimit(n)&&n.parent;)t=n,n=n.parent;return t}function Oh(o,e){return o&&e.isSelectable(o)}class Dy extends ge(){constructor(e,t){super(),this.model=e,this.view=new iy(t),this.mapper=new sh,this.downcastDispatcher=new dh({mapper:this.mapper,schema:e.schema});const n=this.model.document,i=n.selection,r=this.model.markers;var s,a,l;this.listenTo(this.model,"_beforeChanges",()=>{this.view._disableRendering(!0)},{priority:"highest"}),this.listenTo(this.model,"_afterChanges",()=>{this.view._disableRendering(!1)},{priority:"lowest"}),this.listenTo(n,"change",()=>{this.view.change(c=>{this.downcastDispatcher.convertChanges(n.differ,r,c),this.downcastDispatcher.convertSelection(i,r,c)})},{priority:"low"}),this.listenTo(this.view.document,"selectionChange",function(c,d){return(u,g)=>{const f=g.newSelection,b=[];for(const E of f.getRanges())b.push(d.toModelRange(E));const A=c.createSelection(b,{backward:f.isBackward});A.isEqual(c.document.selection)||c.change(E=>{E.setSelection(A)})}}(this.model,this.mapper)),this.listenTo(this.view.document,"beforeinput",(s=this.mapper,a=this.model.schema,l=this.view,(c,d)=>{if(!l.document.isComposing||k.isAndroid)for(let u=0;u<d.targetRanges.length;u++){const g=d.targetRanges[u],f=s.toModelRange(g),b=Ph(f,a);b&&!b.isEqual(f)&&(d.targetRanges[u]=s.toViewRange(b))}}),{priority:"high"}),this.downcastDispatcher.on("insert:$text",(c,d,u)=>{if(!u.consumable.consume(d.item,c.name))return;const g=u.writer,f=u.mapper.toViewPosition(d.range.start),b=g.createText(d.item.data);g.insert(f,b)},{priority:"lowest"}),this.downcastDispatcher.on("insert",(c,d,u)=>{u.convertAttributes(d.item),d.reconversion||!d.item.is("element")||d.item.isEmpty||u.convertChildren(d.item)},{priority:"lowest"}),this.downcastDispatcher.on("remove",(c,d,u)=>{const g=u.mapper.toViewPosition(d.position),f=d.position.getShiftedBy(d.length),b=u.mapper.toViewPosition(f,{isPhantom:!0}),A=u.writer.createRange(g,b),E=u.writer.remove(A.getTrimmed());for(const P of u.writer.createRangeIn(E).getItems())u.mapper.unbindViewElement(P,{defer:!0})},{priority:"low"}),this.downcastDispatcher.on("selection",(c,d,u)=>{const g=u.writer,f=g.document.selection;for(const b of f.getRanges())b.isCollapsed&&b.end.parent.isAttached()&&u.writer.mergeAttributes(b.start);g.setSelection(null)},{priority:"high"}),this.downcastDispatcher.on("selection",(c,d,u)=>{const g=d.selection;if(g.isCollapsed||!u.consumable.consume(g,"selection"))return;const f=[];for(const b of g.getRanges())f.push(u.mapper.toViewRange(b));u.writer.setSelection(f,{backward:g.isBackward})},{priority:"low"}),this.downcastDispatcher.on("selection",(c,d,u)=>{const g=d.selection;if(!g.isCollapsed||!u.consumable.consume(g,"selection"))return;const f=u.writer,b=g.getFirstPosition(),A=u.mapper.toViewPosition(b),E=f.breakAttributes(A);f.setSelection(E)},{priority:"low"}),this.view.document.roots.bindTo(this.model.document.roots).using(c=>{if(c.rootName=="$graveyard")return null;const d=new xd(this.view.document,c.name);return d.rootName=c.rootName,this.mapper.bindElements(c,d),d})}destroy(){this.view.destroy(),this.stopListening()}reconvertMarker(e){const t=typeof e=="string"?e:e.name,n=this.model.markers.get(t);if(!n)throw new I("editingcontroller-reconvertmarker-marker-not-exist",this,{markerName:t});this.model.change(()=>{this.model.markers._refresh(n)})}reconvertItem(e){this.model.change(()=>{this.model.document.differ._refreshItem(e)})}}class So{constructor(){this._consumables=new Map}add(e,t){let n;e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):(this._consumables.has(e)?n=this._consumables.get(e):(n=new By(e),this._consumables.set(e,n)),n.add(t))}test(e,t){const n=this._consumables.get(e);return n===void 0?null:e.is("$text")||e.is("documentFragment")?n:n.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 n=this._consumables.get(e);n!==void 0&&(e.is("$text")||e.is("documentFragment")?this._consumables.set(e,!0):n.revert(t))}static consumablesFromElement(e){const t={element:e,name:!0,attributes:[],classes:[],styles:[]},n=e.getAttributeKeys();for(const s of n)s!="style"&&s!="class"&&t.attributes.push(s);const i=e.getClassNames();for(const s of i)t.classes.push(s);const r=e.getStyleNames();for(const s of r)t.styles.push(s);return t}static createFrom(e,t){if(t||(t=new So),e.is("$text"))return t.add(e),t;e.is("element")&&t.add(e,So.consumablesFromElement(e)),e.is("documentFragment")&&t.add(e);for(const n of e.getChildren())t=So.createFrom(n,t);return t}}const xi=["attributes","classes","styles"];class By{constructor(e){this.element=e,this._canConsumeName=null,this._consumables={attributes:new Map,styles:new Map,classes:new Map}}add(e){e.name&&(this._canConsumeName=!0);for(const t of xi)t in e&&this._add(t,e[t])}test(e){if(e.name&&!this._canConsumeName)return this._canConsumeName;for(const t of xi)if(t in e){const n=this._test(t,e[t]);if(n!==!0)return n}return!0}consume(e){e.name&&(this._canConsumeName=!1);for(const t of xi)t in e&&this._consume(t,e[t])}revert(e){e.name&&(this._canConsumeName=!0);for(const t of xi)t in e&&this._revert(t,e[t])}_add(e,t){const n=We(t)?t:[t],i=this._consumables[e];for(const r of n){if(e==="attributes"&&(r==="class"||r==="style"))throw new I("viewconsumable-invalid-attribute",this);if(i.set(r,!0),e==="styles")for(const s of this.element.document.stylesProcessor.getRelatedStyles(r))i.set(s,!0)}}_test(e,t){const n=We(t)?t:[t],i=this._consumables[e];for(const r of n)if(e!=="attributes"||r!=="class"&&r!=="style"){const s=i.get(r);if(s===void 0)return null;if(!s)return!1}else{const s=r=="class"?"classes":"styles",a=this._test(s,[...this._consumables[s].keys()]);if(a!==!0)return a}return!0}_consume(e,t){const n=We(t)?t:[t],i=this._consumables[e];for(const r of n)if(e!=="attributes"||r!=="class"&&r!=="style"){if(i.set(r,!1),e=="styles")for(const s of this.element.document.stylesProcessor.getRelatedStyles(r))i.set(s,!1)}else{const s=r=="class"?"classes":"styles";this._consume(s,[...this._consumables[s].keys()])}}_revert(e,t){const n=We(t)?t:[t],i=this._consumables[e];for(const r of n)if(e!=="attributes"||r!=="class"&&r!=="style")i.get(r)===!1&&i.set(r,!0);else{const s=r=="class"?"classes":"styles";this._revert(s,[...this._consumables[s].keys()])}}}class Ty extends ge(){constructor(){super(),this._sourceDefinitions={},this._attributeProperties={},this.decorate("checkChild"),this.decorate("checkAttribute"),this.on("checkAttribute",(e,t)=>{t[0]=new mn(t[0])},{priority:"highest"}),this.on("checkChild",(e,t)=>{t[0]=new mn(t[0]),t[1]=this.getDefinition(t[1])},{priority:"highest"})}register(e,t){if(this._sourceDefinitions[e])throw new I("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 I("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=typeof e=="string"?e:"is"in e&&(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 n=this.getDefinition(e.last);return!!n&&n.allowAttributes.includes(t)}checkMerge(e,t){if(e instanceof H){const n=e.nodeBefore,i=e.nodeAfter;if(!(n instanceof ke))throw new I("schema-check-merge-no-element-before",this);if(!(i instanceof ke))throw new I("schema-check-merge-no-element-after",this);return this.checkMerge(n,i)}for(const n of t.getChildren())if(!this.checkChild(e,n))return!1;return!0}addChildCheck(e){this.on("checkChild",(t,[n,i])=>{if(!i)return;const r=e(n,i);typeof r=="boolean"&&(t.stop(),t.return=r)},{priority:"high"})}addAttributeCheck(e){this.on("checkAttribute",(t,[n,i])=>{const r=e(n,i);typeof r=="boolean"&&(t.stop(),t.return=r)},{priority:"high"})}setAttributeProperties(e,t){this._attributeProperties[e]=Object.assign(this.getAttributeProperties(e),t)}getAttributeProperties(e){return this._attributeProperties[e]||{}}getLimitElement(e){let t;for(e instanceof H?t=e.parent:t=(e instanceof V?[e]:Array.from(e.getRanges())).reduce((n,i)=>{const r=i.getCommonAncestor();return n?n.getCommonAncestor(r,{includeSelf:!0}):r},null);!this.isLimit(t)&&t.parent;)t=t.parent;return t}checkAttributeInSelection(e,t){if(e.isCollapsed){const n=[...e.getFirstPosition().getAncestors(),new fe("",e.getAttributes())];return this.checkAttribute(n,t)}{const n=e.getRanges();for(const i of n)for(const r of i)if(this.checkAttribute(r.item,t))return!0}return!1}*getValidRanges(e,t){e=function*(n){for(const i of n)yield*i.getMinimalFlatRanges()}(e);for(const n of e)yield*this._getValidRangesForRange(n,t)}getNearestSelectionRange(e,t="both"){if(this.checkChild(e,"$text"))return new V(e);let n,i;const r=e.getAncestors().reverse().find(s=>this.isLimit(s))||e.root;t!="both"&&t!="backward"||(n=new Ct({boundaries:V._createIn(r),startPosition:e,direction:"backward"})),t!="both"&&t!="forward"||(i=new Ct({boundaries:V._createIn(r),startPosition:e}));for(const s of function*(a,l){let c=!1;for(;!c;){if(c=!0,a){const d=a.next();d.done||(c=!1,yield{walker:a,value:d.value})}if(l){const d=l.next();d.done||(c=!1,yield{walker:l,value:d.value})}}}(n,i)){const a=s.walker==n?"elementEnd":"elementStart",l=s.value;if(l.type==a&&this.isObject(l.item))return V._createOn(l.item);if(this.checkChild(l.nextPosition,"$text"))return new V(l.nextPosition)}return null}findAllowedParent(e,t){let n=e.parent;for(;n;){if(this.checkChild(n,t))return n;if(this.isLimit(n))return null;n=n.parent}return null}setAllowedAttributes(e,t,n){const i=n.model;for(const[r,s]of Object.entries(t))i.schema.checkAttribute(e,r)&&n.setAttribute(r,s,e)}removeDisallowedAttributes(e,t){for(const n of e)if(n.is("$text"))Nh(this,n,t);else{const i=V._createIn(n).getPositions();for(const r of i)Nh(this,r.nodeBefore||r.parent,t)}}getAttributesWithProperty(e,t,n){const i={};for(const[r,s]of e.getAttributes()){const a=this.getAttributeProperties(r);a[t]!==void 0&&(n!==void 0&&n!==a[t]||(i[r]=s))}return i}createContext(e){return new mn(e)}_clearCache(){this._compiledDefinitions=null}_compile(){const e={},t=this._sourceDefinitions,n=Object.keys(t);for(const i of n)e[i]=Iy(t[i],i);for(const i of n)Py(e,i);for(const i of n)Ry(e,i);for(const i of n)Oy(e,i);for(const i of n)Ny(e,i),zy(e,i);for(const i of n)My(e,i),Fy(e,i),Vy(e,i);this._compiledDefinitions=e}_checkContextMatch(e,t,n=t.length-1){const i=t.getItem(n);if(e.allowIn.includes(i.name)){if(n==0)return!0;{const r=this.getDefinition(i);return this._checkContextMatch(r,t,n-1)}}return!1}*_getValidRangesForRange(e,t){let n=e.start,i=e.start;for(const r of e.getItems({shallow:!0}))r.is("element")&&(yield*this._getValidRangesForRange(V._createIn(r),t)),this.checkAttribute(r,t)||(n.isEqual(i)||(yield new V(n,i)),n=H._createAfter(r)),i=H._createAfter(r);n.isEqual(i)||(yield new V(n,i))}}class mn{constructor(e){if(e instanceof mn)return e;let t;t=typeof e=="string"?[e]:Array.isArray(e)?e:e.getAncestors({includeSelf:!0}),this._items=t.map(jy)}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 mn([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 Iy(o,e){const t={name:e,allowIn:[],allowContentOf:[],allowWhere:[],allowAttributes:[],allowAttributesOf:[],allowChildren:[],inheritTypesFrom:[]};return function(n,i){for(const r of n){const s=Object.keys(r).filter(a=>a.startsWith("is"));for(const a of s)i[a]=!!r[a]}}(o,t),gn(o,t,"allowIn"),gn(o,t,"allowContentOf"),gn(o,t,"allowWhere"),gn(o,t,"allowAttributes"),gn(o,t,"allowAttributesOf"),gn(o,t,"allowChildren"),gn(o,t,"inheritTypesFrom"),function(n,i){for(const r of n){const s=r.inheritAllFrom;s&&(i.allowContentOf.push(s),i.allowWhere.push(s),i.allowAttributesOf.push(s),i.inheritTypesFrom.push(s))}}(o,t),t}function Py(o,e){const t=o[e];for(const n of t.allowChildren){const i=o[n];i&&i.allowIn.push(e)}t.allowChildren.length=0}function Ry(o,e){for(const t of o[e].allowContentOf)o[t]&&Ly(o,t).forEach(n=>{n.allowIn.push(e)});delete o[e].allowContentOf}function Oy(o,e){for(const t of o[e].allowWhere){const n=o[t];if(n){const i=n.allowIn;o[e].allowIn.push(...i)}}delete o[e].allowWhere}function Ny(o,e){for(const t of o[e].allowAttributesOf){const n=o[t];if(n){const i=n.allowAttributes;o[e].allowAttributes.push(...i)}}delete o[e].allowAttributesOf}function zy(o,e){const t=o[e];for(const n of t.inheritTypesFrom){const i=o[n];if(i){const r=Object.keys(i).filter(s=>s.startsWith("is"));for(const s of r)s in t||(t[s]=i[s])}}delete t.inheritTypesFrom}function My(o,e){const t=o[e],n=t.allowIn.filter(i=>o[i]);t.allowIn=Array.from(new Set(n))}function Fy(o,e){const t=o[e];for(const n of t.allowIn)o[n].allowChildren.push(e)}function Vy(o,e){const t=o[e];t.allowAttributes=Array.from(new Set(t.allowAttributes))}function gn(o,e,t){for(const n of o){const i=n[t];typeof i=="string"?e[t].push(i):Array.isArray(i)&&e[t].push(...i)}}function Ly(o,e){const t=o[e];return(n=o,Object.keys(n).map(i=>n[i])).filter(i=>i.allowIn.includes(t.name));var n}function jy(o){return typeof o=="string"||o.is("documentFragment")?{name:typeof o=="string"?o:"$documentFragment",*getAttributeKeys(){},getAttribute(){}}:{name:o.is("element")?o.name:"$text",*getAttributeKeys(){yield*o.getAttributeKeys()},getAttribute:e=>o.getAttribute(e)}}function Nh(o,e,t){for(const n of e.getAttributeKeys())o.checkAttribute(e,n)||t.removeAttribute(n,e)}var $y=Object.defineProperty,Hy=Object.defineProperties,qy=Object.getOwnPropertyDescriptors,zh=Object.getOwnPropertySymbols,Uy=Object.prototype.hasOwnProperty,Wy=Object.prototype.propertyIsEnumerable,Mh=(o,e,t)=>e in o?$y(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;class Ky extends me(){constructor(e){var t;super(),this._splitParts=new Map,this._cursorParents=new Map,this._modelCursor=null,this._emptyElementsToKeep=new Set,this.conversionApi=(t=((n,i)=>{for(var r in i||(i={}))Uy.call(i,r)&&Mh(n,r,i[r]);if(zh)for(var r of zh(i))Wy.call(i,r)&&Mh(n,r,i[r]);return n})({},e),Hy(t,qy({consumable:null,writer:null,store:null,convertItem:(n,i)=>this._convertItem(n,i),convertChildren:(n,i)=>this._convertChildren(n,i),safeInsert:(n,i)=>this._safeInsert(n,i),updateConversionResult:(n,i)=>this._updateConversionResult(n,i),splitToAllowedParent:(n,i)=>this._splitToAllowedParent(n,i),getSplitParts:n=>this._getSplitParts(n),keepEmptyElement:n=>this._keepEmptyElement(n)})))}convert(e,t,n=["$root"]){this.fire("viewCleanup",e),this._modelCursor=function(s,a){let l;for(const c of new mn(s)){const d={};for(const g of c.getAttributeKeys())d[g]=c.getAttribute(g);const u=a.createElement(c.name,d);l&&a.insert(u,l),l=H._createAt(u,0)}return l}(n,t),this.conversionApi.writer=t,this.conversionApi.consumable=So.createFrom(e),this.conversionApi.store={};const{modelRange:i}=this._convertItem(e,this._modelCursor),r=t.createDocumentFragment();if(i){this._removeEmptyElements();for(const s of Array.from(this._modelCursor.parent.getChildren()))t.append(s,r);r.markers=function(s,a){const l=new Set,c=new Map,d=V._createIn(s).getItems();for(const u of d)u.is("element","$marker")&&l.add(u);for(const u of l){const g=u.getAttribute("data-name"),f=a.createPositionBefore(u);c.has(g)?c.get(g).end=f.clone():c.set(g,new V(f.clone())),a.remove(u)}return c}(r,t)}return this._modelCursor=null,this._splitParts.clear(),this._cursorParents.clear(),this._emptyElementsToKeep.clear(),this.conversionApi.writer=null,this.conversionApi.store=null,r}_convertItem(e,t){const n={viewItem:e,modelCursor:t,modelRange:null};if(e.is("element")?this.fire(`element:${e.name}`,n,this.conversionApi):e.is("$text")?this.fire("text",n,this.conversionApi):this.fire("documentFragment",n,this.conversionApi),n.modelRange&&!(n.modelRange instanceof V))throw new I("view-conversion-dispatcher-incorrect-result",this);return{modelRange:n.modelRange,modelCursor:n.modelCursor}}_convertChildren(e,t){let n=t.is("position")?t:H._createAt(t,0);const i=new V(n);for(const r of Array.from(e.getChildren())){const s=this._convertItem(r,n);s.modelRange instanceof V&&(i.end=s.modelRange.end,n=s.modelCursor)}return{modelRange:i,modelCursor:n}}_safeInsert(e,t){const n=this._splitToAllowedParent(e,t);return!!n&&(this.conversionApi.writer.insert(e,n.position),!0)}_updateConversionResult(e,t){const n=this._getSplitParts(e),i=this.conversionApi.writer;t.modelRange||(t.modelRange=i.createRange(i.createPositionBefore(e),i.createPositionAfter(n[n.length-1])));const r=this._cursorParents.get(e);t.modelCursor=r?i.createPositionAt(r,0):t.modelRange.end}_splitToAllowedParent(e,t){const{schema:n,writer:i}=this.conversionApi;let r=n.findAllowedParent(t,e);if(r){if(r===t.parent)return{position:t};this._modelCursor.parent.getAncestors().includes(r)&&(r=null)}if(!r)return yh(t,e,n)?{position:Eh(t,i)}:null;const s=this.conversionApi.writer.split(t,r),a=[];for(const c of s.range.getWalker())if(c.type=="elementEnd")a.push(c.item);else{const d=a.pop(),u=c.item;this._registerSplitPair(d,u)}const l=s.range.end.parent;return this._cursorParents.set(e,l),{position:s.position,cursorParent:l}}_registerSplitPair(e,t){this._splitParts.has(e)||this._splitParts.set(e,[e]);const n=this._splitParts.get(e);this._splitParts.set(t,n),n.push(t)}_getSplitParts(e){let t;return t=this._splitParts.has(e)?this._splitParts.get(e):[e],t}_keepEmptyElement(e){this._emptyElementsToKeep.add(e)}_removeEmptyElements(){let e=!1;for(const t of this._splitParts.keys())t.isEmpty&&!this._emptyElementsToKeep.has(t)&&(this.conversionApi.writer.remove(t),this._splitParts.delete(t),e=!0);e&&this._removeEmptyElements()}}class Gy{getHtml(e){const t=document.implementation.createHTMLDocument("").createElement("div");return t.appendChild(e),t.innerHTML}}class Zy{constructor(e){this.skipComments=!0,this.domParser=new DOMParser,this.domConverter=new $d(e,{renderingMode:"data"}),this.htmlWriter=new Gy}toData(e){const t=this.domConverter.viewToDom(e);return this.htmlWriter.getHtml(t)}toView(e){const t=this._toDom(e);return this.domConverter.domToView(t,{skipComments:this.skipComments})}registerRawContentMatcher(e){this.domConverter.registerRawContentMatcher(e)}useFillerType(e){this.domConverter.blockFillerMode=e=="marked"?"markedNbsp":"nbsp"}_toDom(e){e.match(/<(?:html|body|head|meta)(?:\s[^>]*)?>/i)||(e=`<body>${e}</body>`);const t=this.domParser.parseFromString(e,"text/html"),n=t.createDocumentFragment(),i=t.body.childNodes;for(;i.length>0;)n.appendChild(i[0]);return n}}class Jy extends me(){constructor(e,t){super(),this.model=e,this.mapper=new sh,this.downcastDispatcher=new dh({mapper:this.mapper,schema:e.schema}),this.downcastDispatcher.on("insert:$text",(n,i,r)=>{if(!r.consumable.consume(i.item,n.name))return;const s=r.writer,a=r.mapper.toViewPosition(i.range.start),l=s.createText(i.item.data);s.insert(a,l)},{priority:"lowest"}),this.downcastDispatcher.on("insert",(n,i,r)=>{r.convertAttributes(i.item),i.reconversion||!i.item.is("element")||i.item.isEmpty||r.convertChildren(i.item)},{priority:"lowest"}),this.upcastDispatcher=new Ky({schema:e.schema}),this.viewDocument=new Dd(t),this.stylesProcessor=t,this.htmlProcessor=new Zy(this.viewDocument),this.processor=this.htmlProcessor,this._viewWriter=new Bd(this.viewDocument),this.upcastDispatcher.on("text",(n,i,{schema:r,consumable:s,writer:a})=>{let l=i.modelCursor;if(!s.test(i.viewItem))return;if(!r.checkChild(l,"$text")){if(!yh(l,"$text",r)||i.viewItem.data.trim().length==0)return;const d=l.nodeBefore;l=Eh(l,a),d&&d.is("element","$marker")&&(a.move(a.createRangeOn(d),l),l=a.createPositionAfter(d))}s.consume(i.viewItem);const c=a.createText(i.viewItem.data);a.insert(c,l),i.modelRange=a.createRange(l,l.getShiftedBy(c.offsetSize)),i.modelCursor=i.modelRange.end},{priority:"lowest"}),this.upcastDispatcher.on("element",(n,i,r)=>{if(!i.modelRange&&r.consumable.consume(i.viewItem,{name:!0})){const{modelRange:s,modelCursor:a}=r.convertChildren(i.viewItem,i.modelCursor);i.modelRange=s,i.modelCursor=a}},{priority:"lowest"}),this.upcastDispatcher.on("documentFragment",(n,i,r)=>{if(!i.modelRange&&r.consumable.consume(i.viewItem,{name:!0})){const{modelRange:s,modelCursor:a}=r.convertChildren(i.viewItem,i.modelCursor);i.modelRange=s,i.modelCursor=a}},{priority:"lowest"}),ge().prototype.decorate.call(this,"init"),ge().prototype.decorate.call(this,"set"),ge().prototype.decorate.call(this,"get"),ge().prototype.decorate.call(this,"toView"),ge().prototype.decorate.call(this,"toModel"),this.on("init",()=>{this.fire("ready")},{priority:"lowest"}),this.on("ready",()=>{this.model.enqueueChange({isUndoable:!1},vh)},{priority:"lowest"})}get(e={}){const{rootName:t="main",trim:n="empty"}=e;if(!this._checkIfRootsExists([t]))throw new I("datacontroller-get-non-existent-root",this);const i=this.model.document.getRoot(t);return i.isAttached()||Q("datacontroller-get-detached-root",this),n!=="empty"||this.model.hasContent(i,{ignoreWhitespaces:!0})?this.stringify(i,e):""}stringify(e,t={}){const n=this.toView(e,t);return this.processor.toData(n)}toView(e,t={}){const n=this.viewDocument,i=this._viewWriter;this.mapper.clearBindings();const r=V._createIn(e),s=new dn(n);this.mapper.bindElements(e,s);const a=e.is("documentFragment")?e.markers:function(l){const c=[],d=l.root.document;if(!d)return new Map;const u=V._createIn(l);for(const g of d.model.markers){const f=g.getRange(),b=f.isCollapsed,A=f.start.isEqual(u.start)||f.end.isEqual(u.end);if(b&&A)c.push([g.name,f]);else{const E=u.getIntersection(f);E&&c.push([g.name,E])}}return c.sort(([g,f],[b,A])=>{if(f.end.compareWith(A.start)!=="after")return 1;if(f.start.compareWith(A.end)!=="before")return-1;switch(f.start.compareWith(A.start)){case"before":return 1;case"after":return-1;default:switch(f.end.compareWith(A.end)){case"before":return 1;case"after":return-1;default:return b.localeCompare(g)}}}),new Map(c)}(e);return this.downcastDispatcher.convert(r,a,i,t),s}init(e){if(this.model.document.version)throw new I("datacontroller-init-document-not-empty",this);let t={};if(typeof e=="string"?t.main=e:t=e,!this._checkIfRootsExists(Object.keys(t)))throw new I("datacontroller-init-non-existent-root",this);return this.model.enqueueChange({isUndoable:!1},n=>{for(const i of Object.keys(t)){const r=this.model.document.getRoot(i);n.insert(this.parse(t[i],r),r,0)}}),Promise.resolve()}set(e,t={}){let n={};if(typeof e=="string"?n.main=e:n=e,!this._checkIfRootsExists(Object.keys(n)))throw new I("datacontroller-set-non-existent-root",this);this.model.enqueueChange(t.batchType||{},i=>{i.setSelection(null),i.removeSelectionAttribute(this.model.document.selection.getAttributeKeys());for(const r of Object.keys(n)){const s=this.model.document.getRoot(r);i.remove(i.createRangeIn(s)),i.insert(this.parse(n[r],s),s,0)}})}parse(e,t="$root"){const n=this.processor.toView(e);return this.toModel(n,t)}toModel(e,t="$root"){return this.model.change(n=>this.upcastDispatcher.convert(e,n,t))}addStyleProcessorRules(e){e(this.stylesProcessor)}registerRawContentMatcher(e){this.processor&&this.processor!==this.htmlProcessor&&this.processor.registerRawContentMatcher(e),this.htmlProcessor.registerRawContentMatcher(e)}destroy(){this.stopListening()}_checkIfRootsExists(e){for(const t of e)if(!this.model.document.getRoot(t))return!1;return!0}}class Yy{constructor(e,t){this._helpers=new Map,this._downcast=Pe(e),this._createConversionHelpers({name:"downcast",dispatchers:this._downcast,isDowncast:!0}),this._upcast=Pe(t),this._createConversionHelpers({name:"upcast",dispatchers:this._upcast,isDowncast:!1})}addAlias(e,t){const n=this._downcast.includes(t);if(!this._upcast.includes(t)&&!n)throw new I("conversion-add-alias-dispatcher-not-registered",this);this._createConversionHelpers({name:e,dispatchers:[t],isDowncast:n})}for(e){if(!this._helpers.has(e))throw new I("conversion-for-unknown-group",this);return this._helpers.get(e)}elementToElement(e){this.for("downcast").elementToElement(e);for(const{model:t,view:n}of Bs(e))this.for("upcast").elementToElement({model:t,view:n,converterPriority:e.converterPriority})}attributeToElement(e){this.for("downcast").attributeToElement(e);for(const{model:t,view:n}of Bs(e))this.for("upcast").elementToAttribute({view:n,model:t,converterPriority:e.converterPriority})}attributeToAttribute(e){this.for("downcast").attributeToAttribute(e);for(const{model:t,view:n}of Bs(e))this.for("upcast").attributeToAttribute({view:n,model:t})}_createConversionHelpers({name:e,dispatchers:t,isDowncast:n}){if(this._helpers.has(e))throw new I("conversion-group-exists",this);const i=n?new by(t):new xy(t);this._helpers.set(e,i)}}function*Bs(o){if(o.model.values)for(const e of o.model.values){const t={key:o.model.key,value:e},n=o.view[e],i=o.upcastAlso?o.upcastAlso[e]:void 0;yield*Fh(t,n,i)}else yield*Fh(o.model,o.view,o.upcastAlso)}function*Fh(o,e,t){if(yield{model:o,view:e},t)for(const n of Pe(t))yield{model:o,view:n}}class ot{constructor(e){this.baseVersion=e,this.isDocumentOperation=this.baseVersion!==null,this.batch=null}_validate(){}toJSON(){const e=Object.assign({},this);return e.__className=this.constructor.className,delete e.batch,delete e.isDocumentOperation,e}static get className(){return"Operation"}static fromJSON(e,t){return new this(e.baseVersion)}}function Ts(o,e){const t=Lh(e),n=t.reduce((s,a)=>s+a.offsetSize,0),i=o.parent;To(o);const r=o.index;return i._insertChild(r,t),Bo(i,r+t.length),Bo(i,r),new V(o,o.getShiftedBy(n))}function Vh(o){if(!o.isFlat)throw new I("operation-utils-remove-range-not-flat",this);const e=o.start.parent;To(o.start),To(o.end);const t=e._removeChildren(o.start.index,o.end.index-o.start.index);return Bo(e,o.start.index),t}function Do(o,e){if(!o.isFlat)throw new I("operation-utils-move-range-not-flat",this);const t=Vh(o);return Ts(e=e._getTransformedByDeletion(o.start,o.end.offset-o.start.offset),t)}function Lh(o){const e=[];(function t(n){if(typeof n=="string")e.push(new fe(n));else if(n instanceof ht)e.push(new fe(n.data,n.getAttributes()));else if(n instanceof hn)e.push(n);else if(Xe(n))for(const i of n)t(i)})(o);for(let t=1;t<e.length;t++){const n=e[t],i=e[t-1];n instanceof fe&&i instanceof fe&&jh(n,i)&&(e.splice(t-1,2,new fe(i.data+n.data,i.getAttributes())),t--)}return e}function Bo(o,e){const t=o.getChild(e-1),n=o.getChild(e);if(t&&n&&t.is("$text")&&n.is("$text")&&jh(t,n)){const i=new fe(t.data+n.data,t.getAttributes());o._removeChildren(e-1,2),o._insertChild(e-1,i)}}function To(o){const e=o.textNode,t=o.parent;if(e){const n=o.offset-e.startOffset,i=e.index;t._removeChildren(i,1);const r=new fe(e.data.substr(0,n),e.getAttributes()),s=new fe(e.data.substr(n),e.getAttributes());t._insertChild(i,[r,s])}}function jh(o,e){const t=o.getAttributes(),n=e.getAttributes();for(const i of t){if(i[1]!==e.getAttribute(i[0]))return!1;n.next()}return n.next().done}class ce extends ot{constructor(e,t,n,i){super(i),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toNext",this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNone"}get type(){return this.targetPosition.root.rootName=="$graveyard"?"remove":this.sourcePosition.root.rootName=="$graveyard"?"reinsert":"move"}get affectedSelectable(){return[V._createFromPositionAndShift(this.sourcePosition,this.howMany),V._createFromPositionAndShift(this.targetPosition,0)]}clone(){return new ce(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 ce(this.getMovedRangeStart(),this.howMany,e,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent,n=this.sourcePosition.offset,i=this.targetPosition.offset;if(n+this.howMany>e.maxOffset)throw new I("move-operation-nodes-do-not-exist",this);if(e===t&&n<i&&i<n+this.howMany)throw new I("move-operation-range-into-itself",this);if(this.sourcePosition.root==this.targetPosition.root&&Ue(this.sourcePosition.getParentPath(),this.targetPosition.getParentPath())=="prefix"){const r=this.sourcePosition.path.length-1;if(this.targetPosition.path[r]>=n&&this.targetPosition.path[r]<n+this.howMany)throw new I("move-operation-node-into-itself",this)}}_execute(){Do(V._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 n=H.fromJSON(e.sourcePosition,t),i=H.fromJSON(e.targetPosition,t);return new this(n,e.howMany,i,e.baseVersion)}}class $e extends ot{constructor(e,t,n){super(n),this.position=e.clone(),this.position.stickiness="toNone",this.nodes=new yo(Lh(t)),this.shouldReceiveAttributes=!1}get type(){return"insert"}get howMany(){return this.nodes.maxOffset}get affectedSelectable(){return this.position.clone()}clone(){const e=new yo([...this.nodes].map(n=>n._clone(!0))),t=new $e(this.position,e,this.baseVersion);return t.shouldReceiveAttributes=this.shouldReceiveAttributes,t}getReversed(){const e=this.position.root.document.graveyard,t=new H(e,[0]);return new ce(this.position,this.nodes.maxOffset,t,this.baseVersion+1)}_validate(){const e=this.position.parent;if(!e||e.maxOffset<this.position.offset)throw new I("insert-operation-position-invalid",this)}_execute(){const e=this.nodes;this.nodes=new yo([...e].map(t=>t._clone(!0))),Ts(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 n=[];for(const r of e.nodes)r.name?n.push(ke.fromJSON(r)):n.push(fe.fromJSON(r));const i=new $e(H.fromJSON(e.position,t),n,e.baseVersion);return i.shouldReceiveAttributes=e.shouldReceiveAttributes,i}}class be extends ot{constructor(e,t,n,i,r){super(r),this.splitPosition=e.clone(),this.splitPosition.stickiness="toNext",this.howMany=t,this.insertionPosition=n,this.graveyardPosition=i?i.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 H(this.insertionPosition.root,e)}get movedRange(){const e=this.splitPosition.getShiftedBy(Number.POSITIVE_INFINITY);return new V(this.splitPosition,e)}get affectedSelectable(){const e=[V._createFromPositionAndShift(this.splitPosition,0),V._createFromPositionAndShift(this.insertionPosition,0)];return this.graveyardPosition&&e.push(V._createFromPositionAndShift(this.graveyardPosition,0)),e}clone(){return new be(this.splitPosition,this.howMany,this.insertionPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.splitPosition.root.document.graveyard,t=new H(e,[0]);return new Re(this.moveTargetPosition,this.howMany,this.splitPosition,t,this.baseVersion+1)}_validate(){const e=this.splitPosition.parent,t=this.splitPosition.offset;if(!e||e.maxOffset<t)throw new I("split-operation-position-invalid",this);if(!e.parent)throw new I("split-operation-split-in-root",this);if(this.howMany!=e.maxOffset-this.splitPosition.offset)throw new I("split-operation-how-many-invalid",this);if(this.graveyardPosition&&!this.graveyardPosition.nodeAfter)throw new I("split-operation-graveyard-position-invalid",this)}_execute(){const e=this.splitPosition.parent;if(this.graveyardPosition)Do(V._createFromPositionAndShift(this.graveyardPosition,1),this.insertionPosition);else{const t=e._clone();Ts(this.insertionPosition,t)}Do(new V(H._createAt(e,this.splitPosition.offset),H._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 H(e.root,t,"toPrevious")}static fromJSON(e,t){const n=H.fromJSON(e.splitPosition,t),i=H.fromJSON(e.insertionPosition,t),r=e.graveyardPosition?H.fromJSON(e.graveyardPosition,t):null;return new this(n,e.howMany,i,r,e.baseVersion)}}class Re extends ot{constructor(e,t,n,i,r){super(r),this.sourcePosition=e.clone(),this.sourcePosition.stickiness="toPrevious",this.howMany=t,this.targetPosition=n.clone(),this.targetPosition.stickiness="toNext",this.graveyardPosition=i.clone()}get type(){return"merge"}get deletionPosition(){return new H(this.sourcePosition.root,this.sourcePosition.path.slice(0,-1))}get movedRange(){const e=this.sourcePosition.getShiftedBy(Number.POSITIVE_INFINITY);return new V(this.sourcePosition,e)}get affectedSelectable(){const e=this.sourcePosition.parent;return[V._createOn(e),V._createFromPositionAndShift(this.targetPosition,0),V._createFromPositionAndShift(this.graveyardPosition,0)]}clone(){return new Re(this.sourcePosition,this.howMany,this.targetPosition,this.graveyardPosition,this.baseVersion)}getReversed(){const e=this.targetPosition._getTransformedByMergeOperation(this),t=this.sourcePosition.path.slice(0,-1),n=new H(this.sourcePosition.root,t)._getTransformedByMergeOperation(this);return new be(e,this.howMany,n,this.graveyardPosition,this.baseVersion+1)}_validate(){const e=this.sourcePosition.parent,t=this.targetPosition.parent;if(!e.parent)throw new I("merge-operation-source-position-invalid",this);if(!t.parent)throw new I("merge-operation-target-position-invalid",this);if(this.howMany!=e.maxOffset)throw new I("merge-operation-how-many-invalid",this)}_execute(){const e=this.sourcePosition.parent;Do(V._createIn(e),this.targetPosition),Do(V._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 n=H.fromJSON(e.sourcePosition,t),i=H.fromJSON(e.targetPosition,t),r=H.fromJSON(e.graveyardPosition,t);return new this(n,e.howMany,i,r,e.baseVersion)}}class Ge extends ot{constructor(e,t,n,i,r,s){super(s),this.name=e,this.oldRange=t?t.clone():null,this.newRange=n?n.clone():null,this.affectsData=r,this._markers=i}get type(){return"marker"}get affectedSelectable(){const e=[];return this.oldRange&&e.push(this.oldRange.clone()),this.newRange&&(this.oldRange?e.push(...this.newRange.getDifference(this.oldRange)):e.push(this.newRange.clone())),e}clone(){return new Ge(this.name,this.oldRange,this.newRange,this._markers,this.affectsData,this.baseVersion)}getReversed(){return new Ge(this.name,this.newRange,this.oldRange,this._markers,this.affectsData,this.baseVersion+1)}_execute(){this.newRange?this._markers._set(this.name,this.newRange,!0,this.affectsData):this._markers._remove(this.name)}toJSON(){const e=super.toJSON();return this.oldRange&&(e.oldRange=this.oldRange.toJSON()),this.newRange&&(e.newRange=this.newRange.toJSON()),delete e._markers,e}static get className(){return"MarkerOperation"}static fromJSON(e,t){return new Ge(e.name,e.oldRange?V.fromJSON(e.oldRange,t):null,e.newRange?V.fromJSON(e.newRange,t):null,t.model.markers,e.affectsData,e.baseVersion)}}const Si=function(o,e){return Xd(o,e)};class Me extends ot{constructor(e,t,n,i,r){super(r),this.range=e.clone(),this.key=t,this.oldValue=n===void 0?null:n,this.newValue=i===void 0?null:i}get type(){return this.oldValue===null?"addAttribute":this.newValue===null?"removeAttribute":"changeAttribute"}get affectedSelectable(){return this.range.clone()}clone(){return new Me(this.range,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Me(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 I("attribute-operation-range-not-flat",this);for(const e of this.range.getItems({shallow:!0})){if(this.oldValue!==null&&!Si(e.getAttribute(this.key),this.oldValue))throw new I("attribute-operation-wrong-old-value",this,{item:e,key:this.key,value:this.oldValue});if(this.oldValue===null&&this.newValue!==null&&e.hasAttribute(this.key))throw new I("attribute-operation-attribute-exists",this,{node:e,key:this.key})}}_execute(){Si(this.oldValue,this.newValue)||function(e,t,n){To(e.start),To(e.end);for(const i of e.getItems({shallow:!0})){const r=i.is("$textProxy")?i.textNode:i;n!==null?r._setAttribute(t,n):r._removeAttribute(t),Bo(r.parent,r.index)}Bo(e.end.parent,e.end.index)}(this.range,this.key,this.newValue)}static get className(){return"AttributeOperation"}static fromJSON(e,t){return new Me(V.fromJSON(e.range,t),e.key,e.oldValue,e.newValue,e.baseVersion)}}class je extends ot{get type(){return"noop"}get affectedSelectable(){return null}clone(){return new je(this.baseVersion)}getReversed(){return new je(this.baseVersion+1)}_execute(){}static get className(){return"NoOperation"}}class Ze extends ot{constructor(e,t,n,i){super(i),this.position=e,this.position.stickiness="toNext",this.oldName=t,this.newName=n}get type(){return"rename"}get affectedSelectable(){return this.position.nodeAfter}clone(){return new Ze(this.position.clone(),this.oldName,this.newName,this.baseVersion)}getReversed(){return new Ze(this.position.clone(),this.newName,this.oldName,this.baseVersion+1)}_validate(){const e=this.position.nodeAfter;if(!(e instanceof ke))throw new I("rename-operation-wrong-position",this);if(e.name!==this.oldName)throw new I("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 Ze(H.fromJSON(e.position,t),e.oldName,e.newName,e.baseVersion)}}class Bt extends ot{constructor(e,t,n,i,r){super(r),this.root=e,this.key=t,this.oldValue=n===void 0?null:n,this.newValue=i===void 0?null:i}get type(){return this.oldValue===null?"addRootAttribute":this.newValue===null?"removeRootAttribute":"changeRootAttribute"}get affectedSelectable(){return this.root}clone(){return new Bt(this.root,this.key,this.oldValue,this.newValue,this.baseVersion)}getReversed(){return new Bt(this.root,this.key,this.newValue,this.oldValue,this.baseVersion+1)}_validate(){if(this.root!=this.root.root||this.root.is("documentFragment"))throw new I("rootattribute-operation-not-a-root",this,{root:this.root,key:this.key});if(this.oldValue!==null&&this.root.getAttribute(this.key)!==this.oldValue)throw new I("rootattribute-operation-wrong-old-value",this,{root:this.root,key:this.key});if(this.oldValue===null&&this.newValue!==null&&this.root.hasAttribute(this.key))throw new I("rootattribute-operation-attribute-exists",this,{root:this.root,key:this.key})}_execute(){this.newValue!==null?this.root._setAttribute(this.key,this.newValue):this.root._removeAttribute(this.key)}toJSON(){const e=super.toJSON();return e.root=this.root.toJSON(),e}static get className(){return"RootAttributeOperation"}static fromJSON(e,t){if(!t.getRoot(e.root))throw new I("rootattribute-operation-fromjson-no-root",this,{rootName:e.root});return new Bt(t.getRoot(e.root),e.key,e.oldValue,e.newValue,e.baseVersion)}}class vt extends ot{constructor(e,t,n,i,r){super(r),this.rootName=e,this.elementName=t,this.isAdd=n,this._document=i,!this._document.getRoot(this.rootName)&&(this._document.createRoot(this.elementName,this.rootName)._isAttached=!1)}get type(){return this.isAdd?"addRoot":"detachRoot"}get affectedSelectable(){return this._document.getRoot(this.rootName)}clone(){return new vt(this.rootName,this.elementName,this.isAdd,this._document,this.baseVersion)}getReversed(){return new vt(this.rootName,this.elementName,!this.isAdd,this._document,this.baseVersion+1)}_validate(){const e=this._document.getRoot(this.rootName);if(e.isAttached()&&this.isAdd)throw new I("root-operation-root-attached",this);if(!e.isAttached()&&!this.isAdd)throw new I("root-operation-root-detached",this)}_execute(){this._document.getRoot(this.rootName)._isAttached=this.isAdd}toJSON(){const e=super.toJSON();return delete e._document,e}static get className(){return"RootOperation"}static fromJSON(e,t){return new vt(e.rootName,e.elementName,e.isAdd,t,e.baseVersion)}}const at={};at[Me.className]=Me,at[$e.className]=$e,at[Ge.className]=Ge,at[ce.className]=ce,at[je.className]=je,at[ot.className]=ot,at[Ze.className]=Ze,at[Bt.className]=Bt,at[vt.className]=vt,at[be.className]=be,at[Re.className]=Re;class Qy{static fromJSON(e,t){return at[e.__className].fromJSON(e,t)}}const Is=new Map;function ae(o,e,t){let n=Is.get(o);n||(n=new Map,Is.set(o,n)),n.set(e,t)}function Xy(o){return[o]}function $h(o,e,t={}){const n=function(i,r){const s=Is.get(i);return s&&s.has(r)?s.get(r):Xy}(o.constructor,e.constructor);try{return n(o=o.clone(),e,t)}catch(i){throw i}}function e1(o,e,t){o=o.slice(),e=e.slice();const n=new t1(t.document,t.useRelations,t.forceWeakRemove);n.setOriginalOperations(o),n.setOriginalOperations(e);const i=n.originalOperations;if(o.length==0||e.length==0)return{operationsA:o,operationsB:e,originalOperations:i};const r=new WeakMap;for(const l of o)r.set(l,0);const s={nextBaseVersionA:o[o.length-1].baseVersion+1,nextBaseVersionB:e[e.length-1].baseVersion+1,originalOperationsACount:o.length,originalOperationsBCount:e.length};let a=0;for(;a<o.length;){const l=o[a],c=r.get(l);if(c==e.length){a++;continue}const d=e[c],u=$h(l,d,n.getContext(l,d,!0)),g=$h(d,l,n.getContext(d,l,!1));n.updateRelation(l,d),n.setOriginalOperations(u,l),n.setOriginalOperations(g,d);for(const f of u)r.set(f,c+g.length);o.splice(a,1,...u),e.splice(c,1,...g)}return Hh(o,s.nextBaseVersionB),Hh(e,s.nextBaseVersionA),{operationsA:o,operationsB:e,originalOperations:i}}class t1{constructor(e,t,n=!1){this.originalOperations=new Map,this._history=e.history,this._useRelations=t,this._forceWeakRemove=!!n,this._relations=new Map}setOriginalOperations(e,t=null){const n=t?this.originalOperations.get(t):null;for(const i of e)this.originalOperations.set(i,n||i)}updateRelation(e,t){if(e instanceof ce)t instanceof Re?e.targetPosition.isEqual(t.sourcePosition)||t.movedRange.containsPosition(e.targetPosition)?this._setRelation(e,t,"insertAtSource"):e.targetPosition.isEqual(t.deletionPosition)?this._setRelation(e,t,"insertBetween"):e.targetPosition.isAfter(t.sourcePosition)&&this._setRelation(e,t,"moveTargetAfter"):t instanceof ce&&(e.targetPosition.isEqual(t.sourcePosition)||e.targetPosition.isBefore(t.sourcePosition)?this._setRelation(e,t,"insertBefore"):this._setRelation(e,t,"insertAfter"));else if(e instanceof be){if(t instanceof Re)e.splitPosition.isBefore(t.sourcePosition)&&this._setRelation(e,t,"splitBefore");else if(t instanceof ce)if(e.splitPosition.isEqual(t.sourcePosition)||e.splitPosition.isBefore(t.sourcePosition))this._setRelation(e,t,"splitBefore");else{const n=V._createFromPositionAndShift(t.sourcePosition,t.howMany);if(e.splitPosition.hasSameParentAs(t.sourcePosition)&&n.containsPosition(e.splitPosition)){const i=n.end.offset-e.splitPosition.offset,r=e.splitPosition.offset-n.start.offset;this._setRelation(e,t,{howMany:i,offset:r})}}}else if(e instanceof Re)t instanceof Re?(e.targetPosition.isEqual(t.sourcePosition)||this._setRelation(e,t,"mergeTargetNotMoved"),e.sourcePosition.isEqual(t.targetPosition)&&this._setRelation(e,t,"mergeSourceNotMoved"),e.sourcePosition.isEqual(t.sourcePosition)&&this._setRelation(e,t,"mergeSameElement")):t instanceof be&&e.sourcePosition.isEqual(t.splitPosition)&&this._setRelation(e,t,"splitAtSource");else if(e instanceof Ge){const n=e.newRange;if(!n)return;if(t instanceof ce){const i=V._createFromPositionAndShift(t.sourcePosition,t.howMany),r=i.containsPosition(n.start)||i.start.isEqual(n.start),s=i.containsPosition(n.end)||i.end.isEqual(n.end);!r&&!s||i.containsRange(n)||this._setRelation(e,t,{side:r?"left":"right",path:r?n.start.path.slice():n.end.path.slice()})}else if(t instanceof Re){const i=n.start.isEqual(t.targetPosition),r=n.start.isEqual(t.deletionPosition),s=n.end.isEqual(t.deletionPosition),a=n.end.isEqual(t.sourcePosition);(i||r||s||a)&&this._setRelation(e,t,{wasInLeftElement:i,wasStartBeforeMergedElement:r,wasEndBeforeMergedElement:s,wasInRightElement:a})}}}getContext(e,t,n){return{aIsStrong:n,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 n=this.originalOperations.get(t),i=this._history.getUndoneOperation(n);if(!i)return null;const r=this.originalOperations.get(e),s=this._relations.get(r);return s&&s.get(i)||null}_setRelation(e,t,n){const i=this.originalOperations.get(e),r=this.originalOperations.get(t);let s=this._relations.get(i);s||(s=new Map,this._relations.set(i,s)),s.set(r,n)}}function Hh(o,e){for(const t of o)t.baseVersion=e++}function qh(o,e,t){const n=o.nodes.getNode(0).getAttribute(e);if(n==t)return null;const i=new V(o.position,o.position.getShiftedBy(o.howMany));return new Me(i,e,n,t,0)}function Uh(o,e){return o.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany)===null}function jn(o,e){const t=[];for(let n=0;n<o.length;n++){const i=o[n],r=new ce(i.start,i.end.offset-i.start.offset,e,0);t.push(r);for(let s=n+1;s<o.length;s++)o[s]=o[s]._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)[0];e=e._getTransformedByMove(r.sourcePosition,r.targetPosition,r.howMany)}return t}ae(Me,Me,(o,e,t)=>{if(o.key===e.key&&o.range.start.hasSameParentAs(e.range.start)){const n=o.range.getDifference(e.range).map(r=>new Me(r,o.key,o.oldValue,o.newValue,0)),i=o.range.getIntersection(e.range);return i&&t.aIsStrong&&n.push(new Me(i,e.key,e.newValue,o.newValue,0)),n.length==0?[new je(0)]:n}return[o]}),ae(Me,$e,(o,e)=>{if(o.range.start.hasSameParentAs(e.position)&&o.range.containsPosition(e.position)){const t=o.range._getTransformedByInsertion(e.position,e.howMany,!e.shouldReceiveAttributes).map(n=>new Me(n,o.key,o.oldValue,o.newValue,o.baseVersion));if(e.shouldReceiveAttributes){const n=qh(e,o.key,o.oldValue);n&&t.unshift(n)}return t}return o.range=o.range._getTransformedByInsertion(e.position,e.howMany,!1)[0],[o]}),ae(Me,Re,(o,e)=>{const t=[];o.range.start.hasSameParentAs(e.deletionPosition)&&(o.range.containsPosition(e.deletionPosition)||o.range.start.isEqual(e.deletionPosition))&&t.push(V._createFromPositionAndShift(e.graveyardPosition,1));const n=o.range._getTransformedByMergeOperation(e);return n.isCollapsed||t.push(n),t.map(i=>new Me(i,o.key,o.oldValue,o.newValue,o.baseVersion))}),ae(Me,ce,(o,e)=>function(n,i){const r=V._createFromPositionAndShift(i.sourcePosition,i.howMany);let s=null,a=[];r.containsRange(n,!0)?s=n:n.start.hasSameParentAs(r.start)?(a=n.getDifference(r),s=n.getIntersection(r)):a=[n];const l=[];for(let c of a){c=c._getTransformedByDeletion(i.sourcePosition,i.howMany);const d=i.getMovedRangeStart(),u=c.start.hasSameParentAs(d),g=c._getTransformedByInsertion(d,i.howMany,u);l.push(...g)}return s&&l.push(s._getTransformedByMove(i.sourcePosition,i.targetPosition,i.howMany,!1)[0]),l}(o.range,e).map(n=>new Me(n,o.key,o.oldValue,o.newValue,o.baseVersion))),ae(Me,be,(o,e)=>{if(o.range.end.isEqual(e.insertionPosition))return e.graveyardPosition||o.range.end.offset++,[o];if(o.range.start.hasSameParentAs(e.splitPosition)&&o.range.containsPosition(e.splitPosition)){const t=o.clone();return t.range=new V(e.moveTargetPosition.clone(),o.range.end._getCombined(e.splitPosition,e.moveTargetPosition)),o.range.end=e.splitPosition.clone(),o.range.end.stickiness="toPrevious",[o,t]}return o.range=o.range._getTransformedBySplitOperation(e),[o]}),ae($e,Me,(o,e)=>{const t=[o];if(o.shouldReceiveAttributes&&o.position.hasSameParentAs(e.range.start)&&e.range.containsPosition(o.position)){const n=qh(o,e.key,e.newValue);n&&t.push(n)}return t}),ae($e,$e,(o,e,t)=>(o.position.isEqual(e.position)&&t.aIsStrong||(o.position=o.position._getTransformedByInsertOperation(e)),[o])),ae($e,ce,(o,e)=>(o.position=o.position._getTransformedByMoveOperation(e),[o])),ae($e,be,(o,e)=>(o.position=o.position._getTransformedBySplitOperation(e),[o])),ae($e,Re,(o,e)=>(o.position=o.position._getTransformedByMergeOperation(e),[o])),ae(Ge,$e,(o,e)=>(o.oldRange&&(o.oldRange=o.oldRange._getTransformedByInsertOperation(e)[0]),o.newRange&&(o.newRange=o.newRange._getTransformedByInsertOperation(e)[0]),[o])),ae(Ge,Ge,(o,e,t)=>{if(o.name==e.name){if(!t.aIsStrong)return[new je(0)];o.oldRange=e.newRange?e.newRange.clone():null}return[o]}),ae(Ge,Re,(o,e)=>(o.oldRange&&(o.oldRange=o.oldRange._getTransformedByMergeOperation(e)),o.newRange&&(o.newRange=o.newRange._getTransformedByMergeOperation(e)),[o])),ae(Ge,ce,(o,e,t)=>{if(o.oldRange&&(o.oldRange=V._createFromRanges(o.oldRange._getTransformedByMoveOperation(e))),o.newRange){if(t.abRelation){const n=V._createFromRanges(o.newRange._getTransformedByMoveOperation(e));if(t.abRelation.side=="left"&&e.targetPosition.isEqual(o.newRange.start))return o.newRange.end=n.end,o.newRange.start.path=t.abRelation.path,[o];if(t.abRelation.side=="right"&&e.targetPosition.isEqual(o.newRange.end))return o.newRange.start=n.start,o.newRange.end.path=t.abRelation.path,[o]}o.newRange=V._createFromRanges(o.newRange._getTransformedByMoveOperation(e))}return[o]}),ae(Ge,be,(o,e,t)=>{if(o.oldRange&&(o.oldRange=o.oldRange._getTransformedBySplitOperation(e)),o.newRange){if(t.abRelation){const n=o.newRange._getTransformedBySplitOperation(e);return o.newRange.start.isEqual(e.splitPosition)&&t.abRelation.wasStartBeforeMergedElement?o.newRange.start=H._createAt(e.insertionPosition):o.newRange.start.isEqual(e.splitPosition)&&!t.abRelation.wasInLeftElement&&(o.newRange.start=H._createAt(e.moveTargetPosition)),o.newRange.end.isEqual(e.splitPosition)&&t.abRelation.wasInRightElement?o.newRange.end=H._createAt(e.moveTargetPosition):o.newRange.end.isEqual(e.splitPosition)&&t.abRelation.wasEndBeforeMergedElement?o.newRange.end=H._createAt(e.insertionPosition):o.newRange.end=n.end,[o]}o.newRange=o.newRange._getTransformedBySplitOperation(e)}return[o]}),ae(Re,$e,(o,e)=>(o.sourcePosition.hasSameParentAs(e.position)&&(o.howMany+=e.howMany),o.sourcePosition=o.sourcePosition._getTransformedByInsertOperation(e),o.targetPosition=o.targetPosition._getTransformedByInsertOperation(e),[o])),ae(Re,Re,(o,e,t)=>{if(o.sourcePosition.isEqual(e.sourcePosition)&&o.targetPosition.isEqual(e.targetPosition)){if(t.bWasUndone){const n=e.graveyardPosition.path.slice();return n.push(0),o.sourcePosition=new H(e.graveyardPosition.root,n),o.howMany=0,[o]}return[new je(0)]}if(o.sourcePosition.isEqual(e.sourcePosition)&&!o.targetPosition.isEqual(e.targetPosition)&&!t.bWasUndone&&t.abRelation!="splitAtSource"){const n=o.targetPosition.root.rootName=="$graveyard",i=e.targetPosition.root.rootName=="$graveyard";if(i&&!n||!(n&&!i)&&t.aIsStrong){const r=e.targetPosition._getTransformedByMergeOperation(e),s=o.targetPosition._getTransformedByMergeOperation(e);return[new ce(r,o.howMany,s,0)]}return[new je(0)]}return o.sourcePosition.hasSameParentAs(e.targetPosition)&&(o.howMany+=e.howMany),o.sourcePosition=o.sourcePosition._getTransformedByMergeOperation(e),o.targetPosition=o.targetPosition._getTransformedByMergeOperation(e),o.graveyardPosition.isEqual(e.graveyardPosition)&&t.aIsStrong||(o.graveyardPosition=o.graveyardPosition._getTransformedByMergeOperation(e)),[o]}),ae(Re,ce,(o,e,t)=>{const n=V._createFromPositionAndShift(e.sourcePosition,e.howMany);return e.type=="remove"&&!t.bWasUndone&&!t.forceWeakRemove&&o.deletionPosition.hasSameParentAs(e.sourcePosition)&&n.containsPosition(o.sourcePosition)?[new je(0)]:(o.sourcePosition.hasSameParentAs(e.targetPosition)&&(o.howMany+=e.howMany),o.sourcePosition.hasSameParentAs(e.sourcePosition)&&(o.howMany-=e.howMany),o.sourcePosition=o.sourcePosition._getTransformedByMoveOperation(e),o.targetPosition=o.targetPosition._getTransformedByMoveOperation(e),o.graveyardPosition.isEqual(e.targetPosition)||(o.graveyardPosition=o.graveyardPosition._getTransformedByMoveOperation(e)),[o])}),ae(Re,be,(o,e,t)=>{if(e.graveyardPosition&&(o.graveyardPosition=o.graveyardPosition._getTransformedByDeletion(e.graveyardPosition,1),o.deletionPosition.isEqual(e.graveyardPosition)&&(o.howMany=e.howMany)),o.targetPosition.isEqual(e.splitPosition)){const n=e.howMany!=0,i=e.graveyardPosition&&o.deletionPosition.isEqual(e.graveyardPosition);if(n||i||t.abRelation=="mergeTargetNotMoved")return o.sourcePosition=o.sourcePosition._getTransformedBySplitOperation(e),[o]}if(o.sourcePosition.isEqual(e.splitPosition)){if(t.abRelation=="mergeSourceNotMoved")return o.howMany=0,o.targetPosition=o.targetPosition._getTransformedBySplitOperation(e),[o];if(t.abRelation=="mergeSameElement"||o.sourcePosition.offset>0)return o.sourcePosition=e.moveTargetPosition.clone(),o.targetPosition=o.targetPosition._getTransformedBySplitOperation(e),[o]}return o.sourcePosition.hasSameParentAs(e.splitPosition)&&(o.howMany=e.splitPosition.offset),o.sourcePosition=o.sourcePosition._getTransformedBySplitOperation(e),o.targetPosition=o.targetPosition._getTransformedBySplitOperation(e),[o]}),ae(ce,$e,(o,e)=>{const t=V._createFromPositionAndShift(o.sourcePosition,o.howMany)._getTransformedByInsertOperation(e,!1)[0];return o.sourcePosition=t.start,o.howMany=t.end.offset-t.start.offset,o.targetPosition.isEqual(e.position)||(o.targetPosition=o.targetPosition._getTransformedByInsertOperation(e)),[o]}),ae(ce,ce,(o,e,t)=>{const n=V._createFromPositionAndShift(o.sourcePosition,o.howMany),i=V._createFromPositionAndShift(e.sourcePosition,e.howMany);let r,s=t.aIsStrong,a=!t.aIsStrong;if(t.abRelation=="insertBefore"||t.baRelation=="insertAfter"?a=!0:t.abRelation!="insertAfter"&&t.baRelation!="insertBefore"||(a=!1),r=o.targetPosition.isEqual(e.targetPosition)&&a?o.targetPosition._getTransformedByDeletion(e.sourcePosition,e.howMany):o.targetPosition._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),Uh(o,e)&&Uh(e,o))return[e.getReversed()];if(n.containsPosition(e.targetPosition)&&n.containsRange(i,!0))return n.start=n.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),n.end=n.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),jn([n],r);if(i.containsPosition(o.targetPosition)&&i.containsRange(n,!0))return n.start=n.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),n.end=n.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),jn([n],r);const l=Ue(o.sourcePosition.getParentPath(),e.sourcePosition.getParentPath());if(l=="prefix"||l=="extension")return n.start=n.start._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),n.end=n.end._getTransformedByMove(e.sourcePosition,e.targetPosition,e.howMany),jn([n],r);o.type!="remove"||e.type=="remove"||t.aWasUndone||t.forceWeakRemove?o.type=="remove"||e.type!="remove"||t.bWasUndone||t.forceWeakRemove||(s=!1):s=!0;const c=[],d=n.getDifference(i);for(const g of d){g.start=g.start._getTransformedByDeletion(e.sourcePosition,e.howMany),g.end=g.end._getTransformedByDeletion(e.sourcePosition,e.howMany);const f=Ue(g.start.getParentPath(),e.getMovedRangeStart().getParentPath())=="same",b=g._getTransformedByInsertion(e.getMovedRangeStart(),e.howMany,f);c.push(...b)}const u=n.getIntersection(i);return u!==null&&s&&(u.start=u.start._getCombined(e.sourcePosition,e.getMovedRangeStart()),u.end=u.end._getCombined(e.sourcePosition,e.getMovedRangeStart()),c.length===0?c.push(u):c.length==1?i.start.isBefore(n.start)||i.start.isEqual(n.start)?c.unshift(u):c.push(u):c.splice(1,0,u)),c.length===0?[new je(o.baseVersion)]:jn(c,r)}),ae(ce,be,(o,e,t)=>{let n=o.targetPosition.clone();o.targetPosition.isEqual(e.insertionPosition)&&e.graveyardPosition&&t.abRelation!="moveTargetAfter"||(n=o.targetPosition._getTransformedBySplitOperation(e));const i=V._createFromPositionAndShift(o.sourcePosition,o.howMany);if(i.end.isEqual(e.insertionPosition))return e.graveyardPosition||o.howMany++,o.targetPosition=n,[o];if(i.start.hasSameParentAs(e.splitPosition)&&i.containsPosition(e.splitPosition)){let s=new V(e.splitPosition,i.end);return s=s._getTransformedBySplitOperation(e),jn([new V(i.start,e.splitPosition),s],n)}o.targetPosition.isEqual(e.splitPosition)&&t.abRelation=="insertAtSource"&&(n=e.moveTargetPosition),o.targetPosition.isEqual(e.insertionPosition)&&t.abRelation=="insertBetween"&&(n=o.targetPosition);const r=[i._getTransformedBySplitOperation(e)];if(e.graveyardPosition){const s=i.start.isEqual(e.graveyardPosition)||i.containsPosition(e.graveyardPosition);o.howMany>1&&s&&!t.aWasUndone&&r.push(V._createFromPositionAndShift(e.insertionPosition,1))}return jn(r,n)}),ae(ce,Re,(o,e,t)=>{const n=V._createFromPositionAndShift(o.sourcePosition,o.howMany);if(e.deletionPosition.hasSameParentAs(o.sourcePosition)&&n.containsPosition(e.sourcePosition)){if(o.type!="remove"||t.forceWeakRemove){if(o.howMany==1)return t.bWasUndone?(o.sourcePosition=e.graveyardPosition.clone(),o.targetPosition=o.targetPosition._getTransformedByMergeOperation(e),[o]):[new je(0)]}else if(!t.aWasUndone){const r=[];let s=e.graveyardPosition.clone(),a=e.targetPosition._getTransformedByMergeOperation(e);o.howMany>1&&(r.push(new ce(o.sourcePosition,o.howMany-1,o.targetPosition,0)),s=s._getTransformedByMove(o.sourcePosition,o.targetPosition,o.howMany-1),a=a._getTransformedByMove(o.sourcePosition,o.targetPosition,o.howMany-1));const l=e.deletionPosition._getCombined(o.sourcePosition,o.targetPosition),c=new ce(s,1,l,0),d=c.getMovedRangeStart().path.slice();d.push(0);const u=new H(c.targetPosition.root,d);a=a._getTransformedByMove(s,l,1);const g=new ce(a,e.howMany,u,0);return r.push(c),r.push(g),r}}const i=V._createFromPositionAndShift(o.sourcePosition,o.howMany)._getTransformedByMergeOperation(e);return o.sourcePosition=i.start,o.howMany=i.end.offset-i.start.offset,o.targetPosition=o.targetPosition._getTransformedByMergeOperation(e),[o]}),ae(Ze,$e,(o,e)=>(o.position=o.position._getTransformedByInsertOperation(e),[o])),ae(Ze,Re,(o,e)=>o.position.isEqual(e.deletionPosition)?(o.position=e.graveyardPosition.clone(),o.position.stickiness="toNext",[o]):(o.position=o.position._getTransformedByMergeOperation(e),[o])),ae(Ze,ce,(o,e)=>(o.position=o.position._getTransformedByMoveOperation(e),[o])),ae(Ze,Ze,(o,e,t)=>{if(o.position.isEqual(e.position)){if(!t.aIsStrong)return[new je(0)];o.oldName=e.newName}return[o]}),ae(Ze,be,(o,e)=>{if(Ue(o.position.path,e.splitPosition.getParentPath())=="same"&&!e.graveyardPosition){const t=new Ze(o.position.getShiftedBy(1),o.oldName,o.newName,0);return[o,t]}return o.position=o.position._getTransformedBySplitOperation(e),[o]}),ae(Bt,Bt,(o,e,t)=>{if(o.root===e.root&&o.key===e.key){if(!t.aIsStrong||o.newValue===e.newValue)return[new je(0)];o.oldValue=e.newValue}return[o]}),ae(vt,vt,(o,e,t)=>o.rootName!==e.rootName||o.isAdd!==e.isAdd||t.bWasUndone?[o]:[new je(0)]),ae(be,$e,(o,e)=>(o.splitPosition.hasSameParentAs(e.position)&&o.splitPosition.offset<e.position.offset&&(o.howMany+=e.howMany),o.splitPosition=o.splitPosition._getTransformedByInsertOperation(e),o.insertionPosition=o.insertionPosition._getTransformedByInsertOperation(e),[o])),ae(be,Re,(o,e,t)=>{if(!o.graveyardPosition&&!t.bWasUndone&&o.splitPosition.hasSameParentAs(e.sourcePosition)){const n=e.graveyardPosition.path.slice();n.push(0);const i=new H(e.graveyardPosition.root,n),r=be.getInsertionPosition(new H(e.graveyardPosition.root,n)),s=new be(i,0,r,null,0);return o.splitPosition=o.splitPosition._getTransformedByMergeOperation(e),o.insertionPosition=be.getInsertionPosition(o.splitPosition),o.graveyardPosition=s.insertionPosition.clone(),o.graveyardPosition.stickiness="toNext",[s,o]}return o.splitPosition.hasSameParentAs(e.deletionPosition)&&!o.splitPosition.isAfter(e.deletionPosition)&&o.howMany--,o.splitPosition.hasSameParentAs(e.targetPosition)&&(o.howMany+=e.howMany),o.splitPosition=o.splitPosition._getTransformedByMergeOperation(e),o.insertionPosition=be.getInsertionPosition(o.splitPosition),o.graveyardPosition&&(o.graveyardPosition=o.graveyardPosition._getTransformedByMergeOperation(e)),[o]}),ae(be,ce,(o,e,t)=>{const n=V._createFromPositionAndShift(e.sourcePosition,e.howMany);if(o.graveyardPosition){const r=n.start.isEqual(o.graveyardPosition)||n.containsPosition(o.graveyardPosition);if(!t.bWasUndone&&r){const s=o.splitPosition._getTransformedByMoveOperation(e),a=o.graveyardPosition._getTransformedByMoveOperation(e),l=a.path.slice();l.push(0);const c=new H(a.root,l);return[new ce(s,o.howMany,c,0)]}o.graveyardPosition=o.graveyardPosition._getTransformedByMoveOperation(e)}const i=o.splitPosition.isEqual(e.targetPosition);if(i&&(t.baRelation=="insertAtSource"||t.abRelation=="splitBefore"))return o.howMany+=e.howMany,o.splitPosition=o.splitPosition._getTransformedByDeletion(e.sourcePosition,e.howMany),o.insertionPosition=be.getInsertionPosition(o.splitPosition),[o];if(i&&t.abRelation&&t.abRelation.howMany){const{howMany:r,offset:s}=t.abRelation;return o.howMany+=r,o.splitPosition=o.splitPosition.getShiftedBy(s),[o]}if(o.splitPosition.hasSameParentAs(e.sourcePosition)&&n.containsPosition(o.splitPosition)){const r=e.howMany-(o.splitPosition.offset-e.sourcePosition.offset);return o.howMany-=r,o.splitPosition.hasSameParentAs(e.targetPosition)&&o.splitPosition.offset<e.targetPosition.offset&&(o.howMany+=e.howMany),o.splitPosition=e.sourcePosition.clone(),o.insertionPosition=be.getInsertionPosition(o.splitPosition),[o]}return e.sourcePosition.isEqual(e.targetPosition)||(o.splitPosition.hasSameParentAs(e.sourcePosition)&&o.splitPosition.offset<=e.sourcePosition.offset&&(o.howMany-=e.howMany),o.splitPosition.hasSameParentAs(e.targetPosition)&&o.splitPosition.offset<e.targetPosition.offset&&(o.howMany+=e.howMany)),o.splitPosition.stickiness="toNone",o.splitPosition=o.splitPosition._getTransformedByMoveOperation(e),o.splitPosition.stickiness="toNext",o.graveyardPosition?o.insertionPosition=o.insertionPosition._getTransformedByMoveOperation(e):o.insertionPosition=be.getInsertionPosition(o.splitPosition),[o]}),ae(be,be,(o,e,t)=>{if(o.splitPosition.isEqual(e.splitPosition)){if(!o.graveyardPosition&&!e.graveyardPosition)return[new je(0)];if(o.graveyardPosition&&e.graveyardPosition&&o.graveyardPosition.isEqual(e.graveyardPosition))return[new je(0)];if(t.abRelation=="splitBefore")return o.howMany=0,o.graveyardPosition=o.graveyardPosition._getTransformedBySplitOperation(e),[o]}if(o.graveyardPosition&&e.graveyardPosition&&o.graveyardPosition.isEqual(e.graveyardPosition)){const n=o.splitPosition.root.rootName=="$graveyard",i=e.splitPosition.root.rootName=="$graveyard";if(i&&!n||!(n&&!i)&&t.aIsStrong){const r=[];return e.howMany&&r.push(new ce(e.moveTargetPosition,e.howMany,e.splitPosition,0)),o.howMany&&r.push(new ce(o.splitPosition,o.howMany,o.moveTargetPosition,0)),r}return[new je(0)]}if(o.graveyardPosition&&(o.graveyardPosition=o.graveyardPosition._getTransformedBySplitOperation(e)),o.splitPosition.isEqual(e.insertionPosition)&&t.abRelation=="splitBefore")return o.howMany++,[o];if(e.splitPosition.isEqual(o.insertionPosition)&&t.baRelation=="splitBefore"){const n=e.insertionPosition.path.slice();n.push(0);const i=new H(e.insertionPosition.root,n);return[o,new ce(o.insertionPosition,1,i,0)]}return o.splitPosition.hasSameParentAs(e.splitPosition)&&o.splitPosition.offset<e.splitPosition.offset&&(o.howMany-=e.howMany),o.splitPosition=o.splitPosition._getTransformedBySplitOperation(e),o.insertionPosition=be.getInsertionPosition(o.splitPosition),[o]});class Je extends me(H){constructor(e,t,n="toNone"){if(super(e,t,n),!this.root.is("rootElement"))throw new I("model-liveposition-root-not-rootelement",e);n1.call(this)}detach(){this.stopListening()}toPosition(){return new H(this.root,this.path.slice(),this.stickiness)}static fromPosition(e,t){return new this(e.root,e.path.slice(),t||e.stickiness)}}function n1(){this.listenTo(this.root.document.model,"applyOperation",(o,e)=>{const t=e[0];t.isDocumentOperation&&o1.call(this,t)},{priority:"low"})}function o1(o){const e=this.getTransformedByOperation(o);if(!this.isEqual(e)){const t=this.toPosition();this.path=e.path,this.root=e.root,this.fire("change",t)}}Je.prototype.is=function(o){return o==="livePosition"||o==="model:livePosition"||o=="position"||o==="model:position"};class $n{constructor(e={}){typeof e=="string"&&(e=e==="transparent"?{isUndoable:!1}:{},Q("batch-constructor-deprecated-string-type"));const{isUndoable:t=!0,isLocal:n=!0,isUndo:i=!1,isTyping:r=!1}=e;this.operations=[],this.isUndoable=t,this.isLocal=n,this.isUndo=i,this.isTyping=r}get type(){return Q("batch-type-deprecated"),"default"}get baseVersion(){for(const e of this.operations)if(e.baseVersion!==null)return e.baseVersion;return null}addOperation(e){return e.batch=this,this.operations.push(e),e}}var i1=Object.defineProperty,Wh=Object.getOwnPropertySymbols,r1=Object.prototype.hasOwnProperty,s1=Object.prototype.propertyIsEnumerable,Kh=(o,e,t)=>e in o?i1(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;class a1{constructor(e){this._changesInElement=new Map,this._elementSnapshots=new Map,this._changedMarkers=new Map,this._changedRoots=new Map,this._changeCount=0,this._cachedChanges=null,this._cachedChangesWithGraveyard=null,this._refreshedItems=new Set,this._markerCollection=e}get isEmpty(){return this._changesInElement.size==0&&this._changedMarkers.size==0&&this._changedRoots.size==0}bufferOperation(e){const t=e;switch(t.type){case"insert":if(this._isInInsertedElement(t.position.parent))return;this._markInsert(t.position.parent,t.position.offset,t.nodes.maxOffset);break;case"addAttribute":case"removeAttribute":case"changeAttribute":for(const n of t.range.getItems({shallow:!0}))this._isInInsertedElement(n.parent)||this._markAttribute(n);break;case"remove":case"move":case"reinsert":{if(t.sourcePosition.isEqual(t.targetPosition)||t.sourcePosition.getShiftedBy(t.howMany).isEqual(t.targetPosition))return;const n=this._isInInsertedElement(t.sourcePosition.parent),i=this._isInInsertedElement(t.targetPosition.parent);n||this._markRemove(t.sourcePosition.parent,t.sourcePosition.offset,t.howMany),i||this._markInsert(t.targetPosition.parent,t.getMovedRangeStart().offset,t.howMany);break}case"rename":{if(this._isInInsertedElement(t.position.parent))return;this._markRemove(t.position.parent,t.position.offset,1),this._markInsert(t.position.parent,t.position.offset,1);const n=V._createFromPositionAndShift(t.position,1);for(const i of this._markerCollection.getMarkersIntersectingRange(n)){const r=i.getData();this.bufferMarkerChange(i.name,r,r)}break}case"split":{const n=t.splitPosition.parent;this._isInInsertedElement(n)||this._markRemove(n,t.splitPosition.offset,t.howMany),this._isInInsertedElement(t.insertionPosition.parent)||this._markInsert(t.insertionPosition.parent,t.insertionPosition.offset,1),t.graveyardPosition&&this._markRemove(t.graveyardPosition.parent,t.graveyardPosition.offset,1);break}case"merge":{const n=t.sourcePosition.parent;this._isInInsertedElement(n.parent)||this._markRemove(n.parent,n.startOffset,1);const i=t.graveyardPosition.parent;this._markInsert(i,t.graveyardPosition.offset,1);const r=t.targetPosition.parent;this._isInInsertedElement(r)||this._markInsert(r,t.targetPosition.offset,n.maxOffset);break}case"detachRoot":case"addRoot":this._bufferRootStateChange(t.rootName,t.isAdd);break;case"addRootAttribute":case"removeRootAttribute":case"changeRootAttribute":{const n=t.root.rootName;this._bufferRootAttributeChange(n,t.key,t.oldValue,t.newValue);break}}this._cachedChanges=null}bufferMarkerChange(e,t,n){const i=this._changedMarkers.get(e);i?(i.newMarkerData=n,i.oldMarkerData.range==null&&n.range==null&&this._changedMarkers.delete(e)):this._changedMarkers.set(e,{newMarkerData:n,oldMarkerData:t})}getMarkersToRemove(){const e=[];for(const[t,n]of this._changedMarkers)n.oldMarkerData.range!=null&&e.push({name:t,range:n.oldMarkerData.range});return e}getMarkersToAdd(){const e=[];for(const[t,n]of this._changedMarkers)n.newMarkerData.range!=null&&e.push({name:t,range:n.newMarkerData.range});return e}getChangedMarkers(){return Array.from(this._changedMarkers).map(([e,t])=>({name:e,data:{oldRange:t.oldMarkerData.range,newRange:t.newMarkerData.range}}))}hasDataChanges(){if(this._changesInElement.size>0||this._changedRoots.size>0)return!0;for(const{newMarkerData:e,oldMarkerData:t}of this._changedMarkers.values()){if(e.affectsData!==t.affectsData)return!0;if(e.affectsData){const n=e.range&&!t.range,i=!e.range&&t.range,r=e.range&&t.range&&!e.range.isEqual(t.range);if(n||i||r)return!0}}return!1}getChanges(e={}){if(this._cachedChanges)return e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice();let t=[];for(const n of this._changesInElement.keys()){const i=this._changesInElement.get(n).sort((d,u)=>d.offset===u.offset?d.type!=u.type?d.type=="remove"?-1:1:0:d.offset<u.offset?-1:1),r=this._elementSnapshots.get(n),s=Gh(n.getChildren()),a=l1(r.length,i);let l=0,c=0;for(const d of a)if(d==="i")t.push(this._getInsertDiff(n,l,s[l])),l++;else if(d==="r")t.push(this._getRemoveDiff(n,l,r[c])),c++;else if(d==="a"){const u=s[l].attributes,g=r[c].attributes;let f;if(s[l].name=="$text")f=new V(H._createAt(n,l),H._createAt(n,l+1));else{const b=n.offsetToIndex(l);f=new V(H._createAt(n,l),H._createAt(n.getChild(b),0))}t.push(...this._getAttributesDiff(f,g,u)),l++,c++}else l++,c++}t.sort((n,i)=>n.position.root!=i.position.root?n.position.root.rootName<i.position.root.rootName?-1:1:n.position.isEqual(i.position)?n.changeCount-i.changeCount:n.position.isBefore(i.position)?-1:1);for(let n=1,i=0;n<t.length;n++){const r=t[i],s=t[n],a=r.type=="remove"&&s.type=="remove"&&r.name=="$text"&&s.name=="$text"&&r.position.isEqual(s.position),l=r.type=="insert"&&s.type=="insert"&&r.name=="$text"&&s.name=="$text"&&r.position.parent==s.position.parent&&r.position.offset+r.length==s.position.offset,c=r.type=="attribute"&&s.type=="attribute"&&r.position.parent==s.position.parent&&r.range.isFlat&&s.range.isFlat&&r.position.offset+r.length==s.position.offset&&r.attributeKey==s.attributeKey&&r.attributeOldValue==s.attributeOldValue&&r.attributeNewValue==s.attributeNewValue;a||l||c?(r.length++,c&&(r.range.end=r.range.end.getShiftedBy(1)),t[n]=null):i=n}t=t.filter(n=>n);for(const n of t)delete n.changeCount,n.type=="attribute"&&(delete n.position,delete n.length);return this._changeCount=0,this._cachedChangesWithGraveyard=t,this._cachedChanges=t.filter(c1),e.includeChangesInGraveyard?this._cachedChangesWithGraveyard.slice():this._cachedChanges.slice()}getChangedRoots(){return Array.from(this._changedRoots.values()).map(e=>{const t=((n,i)=>{for(var r in i||(i={}))r1.call(i,r)&&Kh(n,r,i[r]);if(Wh)for(var r of Wh(i))s1.call(i,r)&&Kh(n,r,i[r]);return n})({},e);return t.state!==void 0&&delete t.attributes,t})}getRefreshedItems(){return new Set(this._refreshedItems)}reset(){this._changesInElement.clear(),this._elementSnapshots.clear(),this._changedMarkers.clear(),this._changedRoots.clear(),this._refreshedItems=new Set,this._cachedChanges=null}_bufferRootStateChange(e,t){if(!this._changedRoots.has(e))return void this._changedRoots.set(e,{name:e,state:t?"attached":"detached"});const n=this._changedRoots.get(e);n.state!==void 0?(delete n.state,n.attributes===void 0&&this._changedRoots.delete(e)):n.state=t?"attached":"detached"}_bufferRootAttributeChange(e,t,n,i){const r=this._changedRoots.get(e)||{name:e},s=r.attributes||{};if(s[t]){const a=s[t];i===a.oldValue?delete s[t]:a.newValue=i}else s[t]={oldValue:n,newValue:i};Object.entries(s).length===0?(delete r.attributes,r.state===void 0&&this._changedRoots.delete(e)):(r.attributes=s,this._changedRoots.set(e,r))}_refreshItem(e){if(this._isInInsertedElement(e.parent))return;this._markRemove(e.parent,e.startOffset,e.offsetSize),this._markInsert(e.parent,e.startOffset,e.offsetSize),this._refreshedItems.add(e);const t=V._createOn(e);for(const n of this._markerCollection.getMarkersIntersectingRange(t)){const i=n.getData();this.bufferMarkerChange(n.name,i,i)}this._cachedChanges=null}_markInsert(e,t,n){const i={type:"insert",offset:t,howMany:n,count:this._changeCount++};this._markChange(e,i)}_markRemove(e,t,n){const i={type:"remove",offset:t,howMany:n,count:this._changeCount++};this._markChange(e,i),this._removeAllNestedChanges(e,t,n)}_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 n=this._getChangesForElement(e);this._handleChange(t,n),n.push(t);for(let i=0;i<n.length;i++)n[i].howMany<1&&(n.splice(i,1),i--)}_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,Gh(e.getChildren()))}_handleChange(e,t){e.nodesToHandle=e.howMany;for(const n of t){const i=e.offset+e.howMany,r=n.offset+n.howMany;if(e.type=="insert"&&(n.type=="insert"&&(e.offset<=n.offset?n.offset+=e.howMany:e.offset<r&&(n.howMany+=e.nodesToHandle,e.nodesToHandle=0)),n.type=="remove"&&e.offset<n.offset&&(n.offset+=e.howMany),n.type=="attribute")){if(e.offset<=n.offset)n.offset+=e.howMany;else if(e.offset<r){const s=n.howMany;n.howMany=e.offset-n.offset,t.unshift({type:"attribute",offset:i,howMany:s-n.howMany,count:this._changeCount++})}}if(e.type=="remove"){if(n.type=="insert"){if(i<=n.offset)n.offset-=e.howMany;else if(i<=r)if(e.offset<n.offset){const s=i-n.offset;n.offset=e.offset,n.howMany-=s,e.nodesToHandle-=s}else n.howMany-=e.nodesToHandle,e.nodesToHandle=0;else if(e.offset<=n.offset)e.nodesToHandle-=n.howMany,n.howMany=0;else if(e.offset<r){const s=r-e.offset;n.howMany-=s,e.nodesToHandle-=s}}if(n.type=="remove"&&(i<=n.offset?n.offset-=e.howMany:e.offset<n.offset&&(e.nodesToHandle+=n.howMany,n.howMany=0)),n.type=="attribute"){if(i<=n.offset)n.offset-=e.howMany;else if(e.offset<n.offset){const s=i-n.offset;n.offset=e.offset,n.howMany-=s}else if(e.offset<r)if(i<=r){const s=n.howMany;n.howMany=e.offset-n.offset;const a=s-n.howMany-e.nodesToHandle;t.unshift({type:"attribute",offset:e.offset,howMany:a,count:this._changeCount++})}else n.howMany-=r-e.offset}}if(e.type=="attribute"){if(n.type=="insert")if(e.offset<n.offset&&i>n.offset){if(i>r){const s={type:"attribute",offset:r,howMany:i-r,count:this._changeCount++};this._handleChange(s,t),t.push(s)}e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}else e.offset>=n.offset&&e.offset<r&&(i>r?(e.nodesToHandle=i-r,e.offset=r):e.nodesToHandle=0);if(n.type=="remove"&&e.offset<n.offset&&i>n.offset){const s={type:"attribute",offset:n.offset,howMany:i-n.offset,count:this._changeCount++};this._handleChange(s,t),t.push(s),e.nodesToHandle=n.offset-e.offset,e.howMany=e.nodesToHandle}n.type=="attribute"&&(e.offset>=n.offset&&i<=r?(e.nodesToHandle=0,e.howMany=0,e.offset=0):e.offset<=n.offset&&i>=r&&(n.howMany=0))}}e.howMany=e.nodesToHandle,delete e.nodesToHandle}_getInsertDiff(e,t,n){return{type:"insert",position:H._createAt(e,t),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++}}_getRemoveDiff(e,t,n){return{type:"remove",position:H._createAt(e,t),name:n.name,attributes:new Map(n.attributes),length:1,changeCount:this._changeCount++}}_getAttributesDiff(e,t,n){const i=[];n=new Map(n);for(const[r,s]of t){const a=n.has(r)?n.get(r):null;a!==s&&i.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:r,attributeOldValue:s,attributeNewValue:a,changeCount:this._changeCount++}),n.delete(r)}for(const[r,s]of n)i.push({type:"attribute",position:e.start,range:e.clone(),length:1,attributeKey:r,attributeOldValue:null,attributeNewValue:s,changeCount:this._changeCount++});return i}_isInInsertedElement(e){const t=e.parent;if(!t)return!1;const n=this._changesInElement.get(t),i=e.startOffset;if(n){for(const r of n)if(r.type=="insert"&&i>=r.offset&&i<r.offset+r.howMany)return!0}return this._isInInsertedElement(t)}_removeAllNestedChanges(e,t,n){const i=new V(H._createAt(e,t),H._createAt(e,t+n));for(const r of i.getItems({shallow:!0}))r.is("element")&&(this._elementSnapshots.delete(r),this._changesInElement.delete(r),this._removeAllNestedChanges(r,0,r.maxOffset))}}function Gh(o){const e=[];for(const t of o)if(t.is("$text"))for(let n=0;n<t.data.length;n++)e.push({name:"$text",attributes:new Map(t.getAttributes())});else e.push({name:t.name,attributes:new Map(t.getAttributes())});return e}function l1(o,e){const t=[];let n=0,i=0;for(const r of e){if(r.offset>n){for(let s=0;s<r.offset-n;s++)t.push("e");i+=r.offset-n}if(r.type=="insert"){for(let s=0;s<r.howMany;s++)t.push("i");n=r.offset+r.howMany}else if(r.type=="remove"){for(let s=0;s<r.howMany;s++)t.push("r");n=r.offset,i+=r.howMany}else t.push(..."a".repeat(r.howMany).split("")),n=r.offset+r.howMany,i+=r.howMany}if(i<o)for(let r=0;r<o-i-n;r++)t.push("e");return t}function c1(o){const e="position"in o&&o.position.root.rootName=="$graveyard",t="range"in o&&o.range.root.rootName=="$graveyard";return!e&&!t}class d1{constructor(){this._operations=[],this._undoPairs=new Map,this._undoneOperations=new Set,this._baseVersionToOperationIndex=new Map,this._version=0,this._gaps=new Map}get version(){return this._version}set version(e){this._operations.length&&e>this._version+1&&this._gaps.set(this._version,e),this._version=e}get lastOperation(){return this._operations[this._operations.length-1]}addOperation(e){if(e.baseVersion!==this.version)throw new I("model-document-history-addoperation-incorrect-version",this,{operation:e,historyVersion:this.version});this._operations.push(e),this._version++,this._baseVersionToOperationIndex.set(e.baseVersion,this._operations.length-1)}getOperations(e,t=this.version){if(!this._operations.length)return[];const n=this._operations[0];e===void 0&&(e=n.baseVersion);let i=t-1;for(const[a,l]of this._gaps)e>a&&e<l&&(e=l),i>a&&i<l&&(i=a-1);if(i<n.baseVersion||e>this.lastOperation.baseVersion)return[];let r=this._baseVersionToOperationIndex.get(e);r===void 0&&(r=0);let s=this._baseVersionToOperationIndex.get(i);return s===void 0&&(s=this._operations.length-1),this._operations.slice(r,s+1)}getOperation(e){const t=this._baseVersionToOperationIndex.get(e);if(t!==void 0)return this._operations[t]}setOperationAsUndone(e,t){this._undoPairs.set(t,e),this._undoneOperations.add(e)}isUndoingOperation(e){return this._undoPairs.has(e)}isUndoneOperation(e){return this._undoneOperations.has(e)}getUndoneOperation(e){return this._undoPairs.get(e)}reset(){this._version=0,this._undoPairs=new Map,this._operations=[],this._undoneOperations=new Set,this._gaps=new Map,this._baseVersionToOperationIndex=new Map}}class Di extends ke{constructor(e,t,n="main"){super(t),this._isAttached=!0,this._document=e,this.rootName=n}get document(){return this._document}isAttached(){return this._isAttached}toJSON(){return this.rootName}}Di.prototype.is=function(o,e){return e?e===this.name&&(o==="rootElement"||o==="model:rootElement"||o==="element"||o==="model:element"):o==="rootElement"||o==="model:rootElement"||o==="element"||o==="model:element"||o==="node"||o==="model:node"};var h1=Object.defineProperty,u1=Object.defineProperties,m1=Object.getOwnPropertyDescriptors,Zh=Object.getOwnPropertySymbols,g1=Object.prototype.hasOwnProperty,p1=Object.prototype.propertyIsEnumerable,Jh=(o,e,t)=>e in o?h1(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Yh=(o,e)=>{for(var t in e||(e={}))g1.call(e,t)&&Jh(o,t,e[t]);if(Zh)for(var t of Zh(e))p1.call(e,t)&&Jh(o,t,e[t]);return o},Qh=(o,e)=>u1(o,m1(e));const Ps="$graveyard";class f1 extends me(){constructor(e){super(),this.model=e,this.history=new d1,this.selection=new ut(this),this.roots=new st({idProperty:"rootName"}),this.differ=new a1(e.markers),this.isReadOnly=!1,this._postFixers=new Set,this._hasSelectionChangedFromTheLastChangeBlock=!1,this.createRoot("$root",Ps),this.listenTo(e,"applyOperation",(t,n)=>{const i=n[0];i.isDocumentOperation&&this.differ.bufferOperation(i)},{priority:"high"}),this.listenTo(e,"applyOperation",(t,n)=>{const i=n[0];i.isDocumentOperation&&this.history.addOperation(i)},{priority:"low"}),this.listenTo(this.selection,"change",()=>{this._hasSelectionChangedFromTheLastChangeBlock=!0}),this.listenTo(e.markers,"update",(t,n,i,r,s)=>{const a=Qh(Yh({},n.getData()),{range:r});this.differ.bufferMarkerChange(n.name,s,a),i===null&&n.on("change",(l,c)=>{const d=n.getData();this.differ.bufferMarkerChange(n.name,Qh(Yh({},d),{range:c}),d)})}),this.registerPostFixer(t=>{let n=!1;for(const i of this.roots)i.isAttached()||i.isEmpty||(t.remove(t.createRangeIn(i)),n=!0);for(const i of this.model.markers)i.getRange().root.isAttached()||(t.removeMarker(i),n=!0);return n})}get version(){return this.history.version}set version(e){this.history.version=e}get graveyard(){return this.getRoot(Ps)}createRoot(e="$root",t="main"){if(this.roots.get(t))throw new I("model-document-createroot-name-exists",this,{name:t});const n=new Di(this,e,t);return this.roots.add(n),n}destroy(){this.selection.destroy(),this.stopListening()}getRoot(e="main"){return this.roots.get(e)}getRootNames(e=!1){return Array.from(this.roots).filter(t=>t.rootName!=Ps&&(e||t.isAttached())).map(t=>t.rootName)}registerPostFixer(e){this._postFixers.add(e)}toJSON(){const e=md(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,n=t.schema,i=t.createPositionFromPath(e,[0]);return n.getNearestSelectionRange(i)||t.createRange(i)}_validateSelectionRange(e){return Xh(e.start)&&Xh(e.end)}_callPostFixers(e){let t=!1;do for(const n of this._postFixers)if(this.selection.refresh(),t=n(e),t)break;while(t)}}function Xh(o){const e=o.textNode;if(e){const t=e.data,n=o.offset-e.startOffset;return!Wr(t,n)&&!Kr(t,n)}return!0}var k1=Object.defineProperty,b1=Object.defineProperties,w1=Object.getOwnPropertyDescriptors,eu=Object.getOwnPropertySymbols,A1=Object.prototype.hasOwnProperty,_1=Object.prototype.propertyIsEnumerable,tu=(o,e,t)=>e in o?k1(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;class C1 extends me(){constructor(){super(...arguments),this._markers=new Map}[Symbol.iterator](){return this._markers.values()}has(e){const t=e instanceof Hn?e.name:e;return this._markers.has(t)}get(e){return this._markers.get(e)||null}_set(e,t,n=!1,i=!1){const r=e instanceof Hn?e.name:e;if(r.includes(","))throw new I("markercollection-incorrect-marker-name",this);const s=this._markers.get(r);if(s){const d=s.getData(),u=s.getRange();let g=!1;return u.isEqual(t)||(s._attachLiveRange(Dt.fromRange(t)),g=!0),n!=s.managedUsingOperations&&(s._managedUsingOperations=n,g=!0),typeof i=="boolean"&&i!=s.affectsData&&(s._affectsData=i,g=!0),g&&this.fire(`update:${r}`,s,u,t,d),s}const a=Dt.fromRange(t),l=new Hn(r,a,n,i);var c;return this._markers.set(r,l),this.fire(`update:${r}`,l,null,t,(c=((d,u)=>{for(var g in u||(u={}))A1.call(u,g)&&tu(d,g,u[g]);if(eu)for(var g of eu(u))_1.call(u,g)&&tu(d,g,u[g]);return d})({},l.getData()),b1(c,w1({range:null})))),l}_remove(e){const t=e instanceof Hn?e.name:e,n=this._markers.get(t);return!!n&&(this._markers.delete(t),this.fire(`update:${t}`,n,n.getRange(),null,n.getData()),this._destroyMarker(n),!0)}_refresh(e){const t=e instanceof Hn?e.name:e,n=this._markers.get(t);if(!n)throw new I("markercollection-refresh-marker-not-exists",this);const i=n.getRange();this.fire(`update:${t}`,n,i,i,n.getData())}*getMarkersAtPosition(e){for(const t of this)t.getRange().containsPosition(e)&&(yield t)}*getMarkersIntersectingRange(e){for(const t of this)t.getRange().getIntersection(e)!==null&&(yield t)}destroy(){for(const e of this._markers.values())this._destroyMarker(e);this._markers=null,this.stopListening()}*getMarkersGroup(e){for(const t of this._markers.values())t.name.startsWith(e+":")&&(yield t)}_destroyMarker(e){e.stopListening(),e._detachLiveRange()}}class Hn extends me(Ht){constructor(e,t,n,i){super(),this.name=e,this._liveRange=this._attachLiveRange(t),this._managedUsingOperations=n,this._affectsData=i}get managedUsingOperations(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._managedUsingOperations}get affectsData(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._affectsData}getData(){return{range:this.getRange(),affectsData:this.affectsData,managedUsingOperations:this.managedUsingOperations}}getStart(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._liveRange.start.clone()}getEnd(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._liveRange.end.clone()}getRange(){if(!this._liveRange)throw new I("marker-destroyed",this);return this._liveRange.toRange()}_attachLiveRange(e){return this._liveRange&&this._detachLiveRange(),e.delegate("change:range").to(this),e.delegate("change:content").to(this),this._liveRange=e,e}_detachLiveRange(){this._liveRange.stopDelegating("change:range",this),this._liveRange.stopDelegating("change:content",this),this._liveRange.detach(),this._liveRange=null}}Hn.prototype.is=function(o){return o==="marker"||o==="model:marker"};class v1 extends ot{constructor(e,t){super(null),this.sourcePosition=e.clone(),this.howMany=t}get type(){return"detach"}get affectedSelectable(){return null}toJSON(){const e=super.toJSON();return e.sourcePosition=this.sourcePosition.toJSON(),e}_validate(){if(this.sourcePosition.root.document)throw new I("detach-operation-on-document-node",this)}_execute(){Vh(V._createFromPositionAndShift(this.sourcePosition,this.howMany))}static get className(){return"DetachOperation"}}class Tt extends Ht{constructor(e){super(),this.markers=new Map,this._children=new yo,e&&this._insertChild(0,e)}[Symbol.iterator](){return this.getChildren()}get childCount(){return this._children.length}get maxOffset(){return this._children.maxOffset}get isEmpty(){return this.childCount===0}get nextSibling(){return null}get previousSibling(){return null}get root(){return this}get parent(){return null}get document(){return null}isAttached(){return!1}getAncestors(){return[]}getChild(e){return this._children.getNode(e)}getChildren(){return this._children[Symbol.iterator]()}getChildIndex(e){return this._children.getNodeIndex(e)}getChildStartOffset(e){return this._children.getNodeStartOffset(e)}getPath(){return[]}getNodeByPath(e){let t=this;for(const n of e)t=t.getChild(t.offsetToIndex(n));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 n of e)n.name?t.push(ke.fromJSON(n)):t.push(fe.fromJSON(n));return new Tt(t)}_appendChild(e){this._insertChild(this.childCount,e)}_insertChild(e,t){const n=function(i){return typeof i=="string"?[new fe(i)]:(Xe(i)||(i=[i]),Array.from(i).map(r=>typeof r=="string"?new fe(r):r instanceof ht?new fe(r.data,r.getAttributes()):r))}(t);for(const i of n)i.parent!==null&&i._remove(),i.parent=this;this._children._insertNodes(e,n)}_removeChildren(e,t=1){const n=this._children._removeNodes(e,t);for(const i of n)i.parent=null;return n}}Tt.prototype.is=function(o){return o==="documentFragment"||o==="model:documentFragment"};class y1{constructor(e,t){this.model=e,this.batch=t}createText(e,t){return new fe(e,t)}createElement(e,t){return new ke(e,t)}createDocumentFragment(){return new Tt}cloneElement(e,t=!0){return e._clone(t)}insert(e,t,n=0){if(this._assertWriterUsedCorrectly(),e instanceof fe&&e.data=="")return;const i=H._createAt(t,n);if(e.parent){if(iu(e.root,i.root))return void this.move(V._createOn(e),i);if(e.root.document)throw new I("model-writer-insert-forbidden-move",this);this.remove(e)}const r=i.root.document?i.root.document.version:null,s=new $e(i,e,r);if(e instanceof fe&&(s.shouldReceiveAttributes=!0),this.batch.addOperation(s),this.model.applyOperation(s),e instanceof Tt)for(const[a,l]of e.markers){const c=H._createAt(l.root,0),d={range:new V(l.start._getCombined(c,i),l.end._getCombined(c,i)),usingOperation:!0,affectsData:!0};this.model.markers.has(a)?this.updateMarker(a,d):this.addMarker(a,d)}}insertText(e,t,n,i){t instanceof Tt||t instanceof ke||t instanceof H?this.insert(this.createText(e),t,n):this.insert(this.createText(e,t),n,i)}insertElement(e,t,n,i){t instanceof Tt||t instanceof ke||t instanceof H?this.insert(this.createElement(e),t,n):this.insert(this.createElement(e,t),n,i)}append(e,t){this.insert(e,t,"end")}appendText(e,t,n){t instanceof Tt||t instanceof ke?this.insert(this.createText(e),t,"end"):this.insert(this.createText(e,t),n,"end")}appendElement(e,t,n){t instanceof Tt||t instanceof ke?this.insert(this.createElement(e),t,"end"):this.insert(this.createElement(e,t),n,"end")}setAttribute(e,t,n){if(this._assertWriterUsedCorrectly(),n instanceof V){const i=n.getMinimalFlatRanges();for(const r of i)nu(this,e,t,r)}else ou(this,e,t,n)}setAttributes(e,t){for(const[n,i]of St(e))this.setAttribute(n,i,t)}removeAttribute(e,t){if(this._assertWriterUsedCorrectly(),t instanceof V){const n=t.getMinimalFlatRanges();for(const i of n)nu(this,e,null,i)}else ou(this,e,null,t)}clearAttributes(e){this._assertWriterUsedCorrectly();const t=n=>{for(const i of n.getAttributeKeys())this.removeAttribute(i,n)};if(e instanceof V)for(const n of e.getItems())t(n);else t(e)}move(e,t,n){if(this._assertWriterUsedCorrectly(),!(e instanceof V))throw new I("writer-move-invalid-range",this);if(!e.isFlat)throw new I("writer-move-range-not-flat",this);const i=H._createAt(t,n);if(i.isEqual(e.start))return;if(this._addOperationForAffectedMarkers("move",e),!iu(e.root,i.root))throw new I("writer-move-different-document",this);const r=e.root.document?e.root.document.version:null,s=new ce(e.start,e.end.offset-e.start.offset,i,r);this.batch.addOperation(s),this.model.applyOperation(s)}remove(e){this._assertWriterUsedCorrectly();const t=(e instanceof V?e:V._createOn(e)).getMinimalFlatRanges().reverse();for(const n of t)this._addOperationForAffectedMarkers("move",n),E1(n.start,n.end.offset-n.start.offset,this.batch,this.model)}merge(e){this._assertWriterUsedCorrectly();const t=e.nodeBefore,n=e.nodeAfter;if(this._addOperationForAffectedMarkers("merge",e),!(t instanceof ke))throw new I("writer-merge-no-element-before",this);if(!(n instanceof ke))throw new I("writer-merge-no-element-after",this);e.root.document?this._merge(e):this._mergeDetached(e)}createPositionFromPath(e,t,n){return this.model.createPositionFromPath(e,t,n)}createPositionAt(e,t){return this.model.createPositionAt(e,t)}createPositionAfter(e){return this.model.createPositionAfter(e)}createPositionBefore(e){return this.model.createPositionBefore(e)}createRange(e,t){return this.model.createRange(e,t)}createRangeIn(e){return this.model.createRangeIn(e)}createRangeOn(e){return this.model.createRangeOn(e)}createSelection(...e){return this.model.createSelection(...e)}_mergeDetached(e){const t=e.nodeBefore,n=e.nodeAfter;this.move(V._createIn(n),H._createAt(t,"end")),this.remove(n)}_merge(e){const t=H._createAt(e.nodeBefore,"end"),n=H._createAt(e.nodeAfter,0),i=e.root.document.graveyard,r=new H(i,[0]),s=e.root.document.version,a=new Re(n,e.nodeAfter.maxOffset,t,r,s);this.batch.addOperation(a),this.model.applyOperation(a)}rename(e,t){if(this._assertWriterUsedCorrectly(),!(e instanceof ke))throw new I("writer-rename-not-element-instance",this);const n=e.root.document?e.root.document.version:null,i=new Ze(H._createBefore(e),e.name,t,n);this.batch.addOperation(i),this.model.applyOperation(i)}split(e,t){this._assertWriterUsedCorrectly();let n,i,r=e.parent;if(!r.parent)throw new I("writer-split-element-no-parent",this);if(t||(t=r.parent),!e.parent.getAncestors({includeSelf:!0}).includes(t))throw new I("writer-split-invalid-limit-element",this);do{const s=r.root.document?r.root.document.version:null,a=r.maxOffset-e.offset,l=be.getInsertionPosition(e),c=new be(e,a,l,null,s);this.batch.addOperation(c),this.model.applyOperation(c),n||i||(n=r,i=e.parent.nextSibling),r=(e=this.createPositionAfter(e.parent)).parent}while(r!==t);return{position:e,range:new V(H._createAt(n,"end"),H._createAt(i,0))}}wrap(e,t){if(this._assertWriterUsedCorrectly(),!e.isFlat)throw new I("writer-wrap-range-not-flat",this);const n=t instanceof ke?t:new ke(t);if(n.childCount>0)throw new I("writer-wrap-element-not-empty",this);if(n.parent!==null)throw new I("writer-wrap-element-attached",this);this.insert(n,e.start);const i=new V(e.start.getShiftedBy(1),e.end.getShiftedBy(1));this.move(i,H._createAt(n,0))}unwrap(e){if(this._assertWriterUsedCorrectly(),e.parent===null)throw new I("writer-unwrap-element-no-parent",this);this.move(V._createIn(e),this.createPositionAfter(e)),this.remove(e)}addMarker(e,t){if(this._assertWriterUsedCorrectly(),!t||typeof t.usingOperation!="boolean")throw new I("writer-addmarker-no-usingoperation",this);const n=t.usingOperation,i=t.range,r=t.affectsData!==void 0&&t.affectsData;if(this.model.markers.has(e))throw new I("writer-addmarker-marker-exists",this);if(!i)throw new I("writer-addmarker-no-range",this);return n?(Io(this,e,null,i,r),this.model.markers.get(e)):this.model.markers._set(e,i,n,r)}updateMarker(e,t){this._assertWriterUsedCorrectly();const n=typeof e=="string"?e:e.name,i=this.model.markers.get(n);if(!i)throw new I("writer-updatemarker-marker-not-exists",this);if(!t)return Q("writer-updatemarker-reconvert-using-editingcontroller",{markerName:n}),void this.model.markers._refresh(i);const r=typeof t.usingOperation=="boolean",s=typeof t.affectsData=="boolean",a=s?t.affectsData:i.affectsData;if(!r&&!t.range&&!s)throw new I("writer-updatemarker-wrong-options",this);const l=i.getRange(),c=t.range?t.range:l;r&&t.usingOperation!==i.managedUsingOperations?t.usingOperation?Io(this,n,null,c,a):(Io(this,n,l,null,a),this.model.markers._set(n,c,void 0,a)):i.managedUsingOperations?Io(this,n,l,c,a):this.model.markers._set(n,c,void 0,a)}removeMarker(e){this._assertWriterUsedCorrectly();const t=typeof e=="string"?e:e.name;if(!this.model.markers.has(t))throw new I("writer-removemarker-no-marker",this);const n=this.model.markers.get(t);if(!n.managedUsingOperations)return void this.model.markers._remove(t);Io(this,t,n.getRange(),null,n.affectsData)}addRoot(e,t="$root"){this._assertWriterUsedCorrectly();const n=this.model.document.getRoot(e);if(n&&n.isAttached())throw new I("writer-addroot-root-exists",this);const i=this.model.document,r=new vt(e,t,!0,i,i.version);return this.batch.addOperation(r),this.model.applyOperation(r),this.model.document.getRoot(e)}detachRoot(e){this._assertWriterUsedCorrectly();const t=typeof e=="string"?this.model.document.getRoot(e):e;if(!t||!t.isAttached())throw new I("writer-detachroot-no-root",this);for(const r of this.model.markers)r.getRange().root===t&&this.removeMarker(r);for(const r of t.getAttributeKeys())this.removeAttribute(r,t);this.remove(this.createRangeIn(t));const n=this.model.document,i=new vt(t.rootName,t.name,!1,n,n.version);this.batch.addOperation(i),this.model.applyOperation(i)}setSelection(...e){this._assertWriterUsedCorrectly(),this.model.document.selection._setTo(...e)}setSelectionFocus(e,t){this._assertWriterUsedCorrectly(),this.model.document.selection._setFocus(e,t)}setSelectionAttribute(e,t){if(this._assertWriterUsedCorrectly(),typeof e=="string")this._setSelectionAttribute(e,t);else for(const[n,i]of St(e))this._setSelectionAttribute(n,i)}removeSelectionAttribute(e){if(this._assertWriterUsedCorrectly(),typeof e=="string")this._removeSelectionAttribute(e);else for(const t of e)this._removeSelectionAttribute(t)}overrideSelectionGravity(){return this.model.document.selection._overrideGravity()}restoreSelectionGravity(e){this.model.document.selection._restoreGravity(e)}_setSelectionAttribute(e,t){const n=this.model.document.selection;if(n.isCollapsed&&n.anchor.parent.isEmpty){const i=ut._getStoreAttributeKey(e);this.setAttribute(i,t,n.anchor.parent)}n._setAttribute(e,t)}_removeSelectionAttribute(e){const t=this.model.document.selection;if(t.isCollapsed&&t.anchor.parent.isEmpty){const n=ut._getStoreAttributeKey(e);this.removeAttribute(n,t.anchor.parent)}t._removeAttribute(e)}_assertWriterUsedCorrectly(){if(this.model._currentWriter!==this)throw new I("writer-incorrect-use",this)}_addOperationForAffectedMarkers(e,t){for(const n of this.model.markers){if(!n.managedUsingOperations)continue;const i=n.getRange();let r=!1;if(e==="move"){const s=t;r=s.containsPosition(i.start)||s.start.isEqual(i.start)||s.containsPosition(i.end)||s.end.isEqual(i.end)}else{const s=t,a=s.nodeBefore,l=s.nodeAfter,c=i.start.parent==a&&i.start.isAtEnd,d=i.end.parent==l&&i.end.offset==0,u=i.end.nodeAfter==l,g=i.start.nodeAfter==l;r=c||d||u||g}r&&this.updateMarker(n.name,{range:i})}}}function nu(o,e,t,n){const i=o.model,r=i.document;let s,a,l,c=n.start;for(const u of n.getWalker({shallow:!0}))l=u.item.getAttribute(e),s&&a!=l&&(a!=t&&d(),c=s),s=u.nextPosition,a=l;function d(){const u=new V(c,s),g=u.root.document?r.version:null,f=new Me(u,e,a,t,g);o.batch.addOperation(f),i.applyOperation(f)}s instanceof H&&s!=c&&a!=t&&d()}function ou(o,e,t,n){const i=o.model,r=i.document,s=n.getAttribute(e);let a,l;if(s!=t){if(n.root===n){const c=n.document?r.version:null;l=new Bt(n,e,s,t,c)}else{a=new V(H._createBefore(n),o.createPositionAfter(n));const c=a.root.document?r.version:null;l=new Me(a,e,s,t,c)}o.batch.addOperation(l),i.applyOperation(l)}}function Io(o,e,t,n,i){const r=o.model,s=r.document,a=new Ge(e,t,n,r.markers,!!i,s.version);o.batch.addOperation(a),r.applyOperation(a)}function E1(o,e,t,n){let i;if(o.root.document){const r=n.document,s=new H(r.graveyard,[0]);i=new ce(o,e,s,r.version)}else i=new v1(o,e);t.addOperation(i),n.applyOperation(i)}function iu(o,e){return o===e||o instanceof Di&&e instanceof Di}function x1(o,e,t={}){if(e.isCollapsed)return;const n=e.getFirstRange();if(n.root.rootName=="$graveyard")return;const i=o.schema;o.change(r=>{if(!t.doNotResetEntireContent&&function(c,d){const u=c.getLimitElement(d);if(!d.containsEntireContent(u))return!1;const g=d.getFirstRange();return g.start.parent==g.end.parent?!1:c.checkChild(u,"paragraph")}(i,e))return void function(c,d){const u=c.model.schema.getLimitElement(d);c.remove(c.createRangeIn(u)),au(c,c.createPositionAt(u,0),d)}(r,e);const s={};if(!t.doNotAutoparagraph){const c=e.getSelectedElement();c&&Object.assign(s,i.getAttributesWithProperty(c,"copyOnReplace",!0))}const[a,l]=function(c){const d=c.root.document.model,u=c.start;let g=c.end;if(d.hasContent(c,{ignoreMarkers:!0})){const f=function(b){const A=b.parent,E=A.root.document.model.schema,P=A.getAncestors({parentFirst:!0,includeSelf:!0});for(const z of P){if(E.isLimit(z))return null;if(E.isBlock(z))return z}}(g);if(f&&g.isTouching(d.createPositionAt(f,0))){const b=d.createSelection(c);d.modifySelection(b,{direction:"backward"});const A=b.getLastPosition(),E=d.createRange(A,g);d.hasContent(E,{ignoreMarkers:!0})||(g=A)}}return[Je.fromPosition(u,"toPrevious"),Je.fromPosition(g,"toNext")]}(n);a.isTouching(l)||r.remove(r.createRange(a,l)),t.leaveUnmerged||(function(c,d,u){const g=c.model;if(!Rs(c.model.schema,d,u))return;const[f,b]=function(A,E){const P=A.getAncestors(),z=E.getAncestors();let j=0;for(;P[j]&&P[j]==z[j];)j++;return[P[j],z[j]]}(d,u);!f||!b||(!g.hasContent(f,{ignoreMarkers:!0})&&g.hasContent(b,{ignoreMarkers:!0})?su(c,d,u,f.parent):ru(c,d,u,f.parent))}(r,a,l),i.removeDisallowedAttributes(a.parent.getChildren(),r)),lu(r,e,a),!t.doNotAutoparagraph&&function(c,d){const u=c.checkChild(d,"$text"),g=c.checkChild(d,"paragraph");return!u&&g}(i,a)&&au(r,a,e,s),a.detach(),l.detach()})}function ru(o,e,t,n){const i=e.parent,r=t.parent;if(i!=n&&r!=n){for(e=o.createPositionAfter(i),(t=o.createPositionBefore(r)).isEqual(e)||o.insert(r,e),o.merge(e);t.parent.isEmpty;){const s=t.parent;t=o.createPositionBefore(s),o.remove(s)}Rs(o.model.schema,e,t)&&ru(o,e,t,n)}}function su(o,e,t,n){const i=e.parent,r=t.parent;if(i!=n&&r!=n){for(e=o.createPositionAfter(i),(t=o.createPositionBefore(r)).isEqual(e)||o.insert(i,t);e.parent.isEmpty;){const s=e.parent;e=o.createPositionBefore(s),o.remove(s)}t=o.createPositionBefore(r),function(s,a){const l=a.nodeBefore,c=a.nodeAfter;l.name!=c.name&&s.rename(l,c.name),s.clearAttributes(l),s.setAttributes(Object.fromEntries(c.getAttributes()),l),s.merge(a)}(o,t),Rs(o.model.schema,e,t)&&su(o,e,t,n)}}function Rs(o,e,t){const n=e.parent,i=t.parent;return n!=i&&!o.isLimit(n)&&!o.isLimit(i)&&function(r,s,a){const l=new V(r,s);for(const c of l.getWalker())if(a.isLimit(c.item))return!1;return!0}(e,t,o)}function au(o,e,t,n={}){const i=o.createElement("paragraph");o.model.schema.setAllowedAttributes(i,n,o),o.insert(i,e),lu(o,t,o.createPositionAt(i,0))}function lu(o,e,t){e instanceof ut?o.setSelection(t):e.setTo(t)}function cu(o,e){const t=[];Array.from(o.getItems({direction:"backward"})).map(n=>e.createRangeOn(n)).filter(n=>(n.start.isAfter(o.start)||n.start.isEqual(o.start))&&(n.end.isBefore(o.end)||n.end.isEqual(o.end))).forEach(n=>{t.push(n.start.parent),e.remove(n)}),t.forEach(n=>{let i=n;for(;i.parent&&i.isEmpty;){const r=e.createRangeOn(i);i=i.parent,e.remove(r)}})}class S1{constructor(e,t,n){this._firstNode=null,this._lastNode=null,this._lastAutoParagraph=null,this._filterAttributesOf=[],this._affectedStart=null,this._affectedEnd=null,this._nodeToSelect=null,this.model=e,this.writer=t,this.position=n,this.canMergeWith=new Set([this.position.parent]),this.schema=e.schema,this._documentFragment=t.createDocumentFragment(),this._documentFragmentPosition=t.createPositionAt(this._documentFragment,0)}handleNodes(e){for(const t of Array.from(e))this._handleNode(t);this._insertPartialFragment(),this._lastAutoParagraph&&this._updateLastNodeFromAutoParagraph(this._lastAutoParagraph),this._mergeOnRight(),this.schema.removeDisallowedAttributes(this._filterAttributesOf,this.writer),this._filterAttributesOf=[]}_updateLastNodeFromAutoParagraph(e){const t=this.writer.createPositionAfter(this._lastNode),n=this.writer.createPositionAfter(e);if(n.isAfter(t)){if(this._lastNode=e,this.position.parent!=e||!this.position.isAtEnd)throw new I("insertcontent-invalid-insertion-position",this);this.position=n,this._setAffectedBoundaries(this.position)}}getSelectionRange(){return this._nodeToSelect?V._createOn(this._nodeToSelect):this.model.schema.getNearestSelectionRange(this.position)}getAffectedRange(){return this._affectedStart?new V(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=Je.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 I("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=Je.fromPosition(e,"toPrevious")),this._affectedEnd&&!this._affectedEnd.isBefore(e)||(this._affectedEnd&&this._affectedEnd.detach(),this._affectedEnd=Je.fromPosition(e,"toNext"))}_mergeOnLeft(){const e=this._firstNode;if(!(e instanceof ke)||!this._canMergeLeft(e))return;const t=Je._createBefore(e);t.stickiness="toNext";const n=Je.fromPosition(this.position,"toNext");this._affectedStart.isEqual(t)&&(this._affectedStart.detach(),this._affectedStart=Je._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=Je._createAt(t.nodeBefore,"end","toNext")),this.position=n.toPosition(),n.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_mergeOnRight(){const e=this._lastNode;if(!(e instanceof ke)||!this._canMergeRight(e))return;const t=Je._createAfter(e);if(t.stickiness="toNext",!this.position.isEqual(t))throw new I("insertcontent-invalid-insertion-position",this);this.position=H._createAt(t.nodeBefore,"end");const n=Je.fromPosition(this.position,"toPrevious");this._affectedEnd.isEqual(t)&&(this._affectedEnd.detach(),this._affectedEnd=Je._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=Je._createAt(t.nodeBefore,0,"toPrevious")),this.position=n.toPosition(),n.detach(),this._filterAttributesOf.push(this.position.parent),t.detach()}_canMergeLeft(e){const t=e.previousSibling;return t instanceof ke&&this.canMergeWith.has(t)&&this.model.schema.checkMerge(t,e)}_canMergeRight(e){const t=e.nextSibling;return t instanceof ke&&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 n=this.position.parent;this.position=this.writer.createPositionBefore(n),n.isEmpty&&n.parent===t&&this.writer.remove(n)}else if(this.position.isAtEnd)this.position=this.writer.createPositionAfter(this.position.parent);else{const n=this.writer.createPositionAfter(this.position.parent);this._setAffectedBoundaries(this.position),this.writer.split(this.position),this.position=n,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 du(o,e,t="auto"){const n=o.getSelectedElement();if(n&&e.schema.isObject(n)&&!e.schema.isInline(n))return t=="before"||t=="after"?e.createRange(e.createPositionAt(n,t)):e.createRangeOn(n);const i=ze(o.getSelectedBlocks());if(!i)return e.createRange(o.focus);if(i.isEmpty)return e.createRange(e.createPositionAt(i,0));const r=e.createPositionAfter(i);return o.focus.isTouching(r)?e.createRange(r):e.createRange(e.createPositionBefore(i))}function D1(o,e,t,n={}){if(!o.schema.isObject(e))throw new I("insertobject-element-not-an-object",o,{object:e});const i=t||o.document.selection;let r=i;n.findOptimalPosition&&o.schema.isBlock(e)&&(r=o.createSelection(du(i,o,n.findOptimalPosition)));const s=ze(i.getSelectedBlocks()),a={};return s&&Object.assign(a,o.schema.getAttributesWithProperty(s,"copyOnReplace",!0)),o.change(l=>{r.isCollapsed||o.deleteContent(r,{doNotAutoparagraph:!0});let c=e;const d=r.anchor.parent;!o.schema.checkChild(d,e)&&o.schema.checkChild(d,"paragraph")&&o.schema.checkChild("paragraph",e)&&(c=l.createElement("paragraph"),l.insert(e,c)),o.schema.setAllowedAttributes(c,a,l);const u=o.insertContent(c,r);return u.isCollapsed||n.setSelection&&function(g,f,b,A){const E=g.model;if(b=="on")return void g.setSelection(f,"on");if(b!="after")throw new I("insertobject-invalid-place-parameter-value",E);let P=f.nextSibling;if(E.schema.isInline(f))return void g.setSelection(f,"after");!(P&&E.schema.checkChild(P,"$text"))&&E.schema.checkChild(f.parent,"paragraph")&&(P=g.createElement("paragraph"),E.schema.setAllowedAttributes(P,A,g),E.insertContent(P,g.createPositionAfter(f))),P&&g.setSelection(P,0)}(l,e,n.setSelection,a),u})}const B1=' ,.?!:;"-()';function T1(o,e){const{isForward:t,walker:n,unit:i,schema:r,treatEmojiAsSingleUnit:s}=o,{type:a,item:l,nextPosition:c}=e;if(a=="text")return o.unit==="word"?function(d,u){let g=d.position.textNode;for(g||(g=u?d.position.nodeAfter:d.position.nodeBefore);g&&g.is("$text");){const f=d.position.offset-g.startOffset;if(R1(g,f,u))g=u?d.position.nodeAfter:d.position.nodeBefore;else{if(P1(g.data,f,u))break;d.next()}}return d.position}(n,t):function(d,u,g){const f=d.position.textNode;if(f){const b=f.data;let A=d.position.offset-f.startOffset;for(;Wr(b,A)||u=="character"&&Kr(b,A)||g&&Rc(b,A);)d.next(),A=d.position.offset-f.startOffset}return d.position}(n,i,s);if(a==(t?"elementStart":"elementEnd")){if(r.isSelectable(l))return H._createAt(l,t?"after":"before");if(r.checkChild(c,"$text"))return c}else{if(r.isLimit(l))return void n.skip(()=>!0);if(r.checkChild(c,"$text"))return c}}function I1(o,e){const t=o.root,n=H._createAt(t,e?"end":0);return e?new V(o,n):new V(n,o)}function P1(o,e,t){const n=e+(t?0:-1);return B1.includes(o.charAt(n))}function R1(o,e,t){return e===(t?o.offsetSize:0)}class O1 extends ge(){constructor(){super(),this.markers=new C1,this.document=new f1(this),this.schema=new Ty,this._pendingChanges=[],this._currentWriter=null,["deleteContent","modifySelection","getSelectedContent","applyOperation"].forEach(e=>this.decorate(e)),this.on("applyOperation",(e,t)=>{t[0]._validate()},{priority:"highest"}),this.schema.register("$root",{isLimit:!0}),this.schema.register("$container",{allowIn:["$root","$container"]}),this.schema.register("$block",{allowIn:["$root","$container"],isBlock:!0}),this.schema.register("$blockObject",{allowWhere:"$block",isBlock:!0,isObject:!0}),this.schema.register("$inlineObject",{allowWhere:"$text",allowAttributesOf:"$text",isInline:!0,isObject:!0}),this.schema.register("$text",{allowIn:"$block",isInline:!0,isContent:!0}),this.schema.register("$clipboardHolder",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$documentFragment",{allowContentOf:"$root",allowChildren:"$text",isLimit:!0}),this.schema.register("$marker"),this.schema.addChildCheck((e,t)=>{if(t.name==="$marker")return!0}),Sy(this),this.document.registerPostFixer(vh),this.on("insertContent",(e,[t,n])=>{e.return=function(i,r,s){return i.change(a=>{const l=s||i.document.selection;l.isCollapsed||i.deleteContent(l,{doNotAutoparagraph:!0});const c=new S1(i,a,l.anchor),d=[];let u;if(r.is("documentFragment")){if(r.markers.size){const b=[];for(const[A,E]of r.markers){const{start:P,end:z}=E,j=P.isEqual(z);b.push({position:P,name:A,isCollapsed:j},{position:z,name:A,isCollapsed:j})}b.sort(({position:A},{position:E})=>A.isBefore(E)?1:-1);for(const{position:A,name:E,isCollapsed:P}of b){let z=null,j=null;const Y=A.parent===r&&A.isAtStart,ie=A.parent===r&&A.isAtEnd;Y||ie?P&&(j=Y?"start":"end"):(z=a.createElement("$marker"),a.insert(z,A)),d.push({name:E,element:z,collapsed:j})}}u=r.getChildren()}else u=[r];c.handleNodes(u);let g=c.getSelectionRange();if(r.is("documentFragment")&&d.length){const b=g?Dt.fromRange(g):null,A={};for(let E=d.length-1;E>=0;E--){const{name:P,element:z,collapsed:j}=d[E],Y=!A[P];if(Y&&(A[P]=[]),z){const ie=a.createPositionAt(z,"before");A[P].push(ie),a.remove(z)}else{const ie=c.getAffectedRange();if(!ie){j&&A[P].push(c.position);continue}j?A[P].push(ie[j]):A[P].push(Y?ie.start:ie.end)}}for(const[E,[P,z]]of Object.entries(A))P&&z&&P.root===z.root&&a.addMarker(E,{usingOperation:!0,affectsData:!0,range:new V(P,z)});b&&(g=b.toRange(),b.detach())}g&&(l instanceof ut?a.setSelection(g):l.setTo(g));const f=c.getAffectedRange()||i.createRange(l.anchor);return c.destroy(),f})}(this,t,n)}),this.on("insertObject",(e,[t,n,i])=>{e.return=D1(this,t,n,i)}),this.on("canEditAt",e=>{const t=!this.document.isReadOnly;e.return=t,t||e.stop()})}change(e){try{return this._pendingChanges.length===0?(this._pendingChanges.push({batch:new $n,callback:e}),this._runPendingChanges()[0]):e(this._currentWriter)}catch(t){I.rethrowUnexpectedError(t,this)}}enqueueChange(e,t){try{e?typeof e=="function"?(t=e,e=new $n):e instanceof $n||(e=new $n(e)):e=new $n,this._pendingChanges.push({batch:e,callback:t}),this._pendingChanges.length==1&&this._runPendingChanges()}catch(n){I.rethrowUnexpectedError(n,this)}}applyOperation(e){e._execute()}insertContent(e,t,n,...i){const r=Os(t,n);return this.fire("insertContent",[e,r,n,...i])}insertObject(e,t,n,i,...r){const s=Os(t,n);return this.fire("insertObject",[e,s,i,i,...r])}deleteContent(e,t){x1(this,e,t)}modifySelection(e,t){(function(n,i,r={}){const s=n.schema,a=r.direction!="backward",l=r.unit?r.unit:"character",c=!!r.treatEmojiAsSingleUnit,d=i.focus,u=new Ct({boundaries:I1(d,a),singleCharacters:!0,direction:a?"forward":"backward"}),g={walker:u,schema:s,isForward:a,unit:l,treatEmojiAsSingleUnit:c};let f;for(;f=u.next();){if(f.done)return;const b=T1(g,f.value);if(b)return void(i instanceof ut?n.change(A=>{A.setSelectionFocus(b)}):i.setFocus(b))}})(this,e,t)}getSelectedContent(e){return function(t,n){return t.change(i=>{const r=i.createDocumentFragment(),s=n.getFirstRange();if(!s||s.isCollapsed)return r;const a=s.start.root,l=s.start.getCommonPath(s.end),c=a.getNodeByPath(l);let d;d=s.start.parent==s.end.parent?s:i.createRange(i.createPositionAt(c,s.start.path[l.length]),i.createPositionAt(c,s.end.path[l.length]+1));const u=d.end.offset-d.start.offset;for(const g of d.getItems({shallow:!0}))g.is("$textProxy")?i.appendText(g.data,g.getAttributes(),r):i.append(i.cloneElement(g,!0),r);if(d!=s){const g=s._getTransformedByMove(d.start,i.createPositionAt(r,0),u)[0],f=i.createRange(i.createPositionAt(r,0),g.start);cu(i.createRange(g.end,i.createPositionAt(r,"end")),i),cu(f,i)}return r})}(this,e)}hasContent(e,t={}){const n=e instanceof V?e:V._createIn(e);if(n.isCollapsed)return!1;const{ignoreWhitespaces:i=!1,ignoreMarkers:r=!1}=t;if(!r){for(const s of this.markers.getMarkersIntersectingRange(n))if(s.affectsData)return!0}for(const s of n.getItems())if(this.schema.isContent(s)&&(!s.is("$textProxy")||!i||s.data.search(/\S/)!==-1))return!0;return!1}canEditAt(e){const t=Os(e);return this.fire("canEditAt",[t])}createPositionFromPath(e,t,n){return new H(e,t,n)}createPositionAt(e,t){return H._createAt(e,t)}createPositionAfter(e){return H._createAfter(e)}createPositionBefore(e){return H._createBefore(e)}createRange(e,t){return new V(e,t)}createRangeIn(e){return V._createIn(e)}createRangeOn(e){return V._createOn(e)}createSelection(...e){return new nt(...e)}createBatch(e){return new $n(e)}createOperationFromJSON(e){return Qy.fromJSON(e,this.document)}destroy(){this.document.destroy(),this.stopListening()}_runPendingChanges(){const e=[];this.fire("_beforeChanges");try{for(;this._pendingChanges.length;){const t=this._pendingChanges[0].batch;this._currentWriter=new y1(this,t);const n=this._pendingChanges[0].callback(this._currentWriter);e.push(n),this.document._handleChangeBlock(this._currentWriter),this._pendingChanges.shift(),this._currentWriter=null}}finally{this._pendingChanges.length=0,this._currentWriter=null,this.fire("_afterChanges")}return e}}function Os(o,e){if(o)return o instanceof nt||o instanceof ut?o:o instanceof hn?e||e===0?new nt(o,e):o.is("rootElement")?new nt(o,"in"):new nt(o,"on"):new nt(o)}class N1 extends $t{constructor(){super(...arguments),this.domEventType="click"}onDomEvent(e){this.fire(e.type,e)}}class Ns extends $t{constructor(){super(...arguments),this.domEventType=["mousedown","mouseup","mouseover","mouseout"]}onDomEvent(e){this.fire(e.type,e)}}class Bi{constructor(e){this.document=e}createDocumentFragment(e){return new dn(this.document,e)}createElement(e,t,n){return new et(this.document,e,t,n)}createText(e){return new pe(this.document,e)}clone(e,t=!1){return e._clone(t)}appendChild(e,t){return t._appendChild(e)}insertChild(e,t,n){return n._insertChild(e,t)}removeChildren(e,t,n){return n._removeChildren(e,t)}remove(e){const t=e.parent;return t?this.removeChildren(t.getChildIndex(e),1,t):[]}replace(e,t){const n=e.parent;if(n){const i=n.getChildIndex(e);return this.removeChildren(i,1,n),this.insertChild(i,t,n),!0}return!1}unwrapElement(e){const t=e.parent;if(t){const n=t.getChildIndex(e);this.remove(e),this.insertChild(n,e.getChildren(),t)}}rename(e,t){const n=new et(this.document,e,t.getAttributes(),t.getChildren());return this.replace(t,n)?n:null}setAttribute(e,t,n){n._setAttribute(e,t)}removeAttribute(e,t){t._removeAttribute(e)}addClass(e,t){t._addClass(e)}removeClass(e,t){t._removeClass(e)}setStyle(e,t,n){Ke(e)&&n===void 0?t._setStyle(e):n._setStyle(e,t)}removeStyle(e,t){t._removeStyle(e)}setCustomProperty(e,t,n){n._setCustomProperty(e,t)}removeCustomProperty(e,t){return t._removeCustomProperty(e)}createPositionAt(e,t){return U._createAt(e,t)}createPositionAfter(e){return U._createAfter(e)}createPositionBefore(e){return U._createBefore(e)}createRange(e,t){return new X(e,t)}createRangeOn(e){return X._createOn(e)}createRangeIn(e){return X._createIn(e)}createSelection(...e){return new wt(...e)}}function z1(o=""){if(o==="")return{top:void 0,right:void 0,bottom:void 0,left:void 0};const e=o.replace(/, /g,",").split(" ").map(r=>r.replace(/,/g,", ")),t=e[0],n=e[2]||t,i=e[1]||t;return{top:t,bottom:n,right:i,left:e[3]||i}}function M1({top:o,right:e,bottom:t,left:n}){const i=[];return n!==e?i.push(o,e,t,n):t!==o?i.push(o,e,t):e!==o?i.push(o,e):i.push(o),i.join(" ")}function F1(o){var e,t;o.setNormalizer("margin",(e="margin",n=>({path:e,value:z1(n)}))),o.setNormalizer("margin-top",n=>({path:"margin.top",value:n})),o.setNormalizer("margin-right",n=>({path:"margin.right",value:n})),o.setNormalizer("margin-bottom",n=>({path:"margin.bottom",value:n})),o.setNormalizer("margin-left",n=>({path:"margin.left",value:n})),o.setReducer("margin",(t="margin",n=>{const{top:i,right:r,bottom:s,left:a}=n,l=[];return[i,r,a,s].every(c=>!!c)?l.push([t,M1(n)]):(i&&l.push([t+"-top",i]),r&&l.push([t+"-right",r]),s&&l.push([t+"-bottom",s]),a&&l.push([t+"-left",a])),l})),o.setStyleRelation("margin",["margin-top","margin-right","margin-bottom","margin-left"])}class V1{constructor(){this._commands=new Map}add(e,t){this._commands.set(e,t)}get(e){return this._commands.get(e)}execute(e,...t){const n=this.get(e);if(!n)throw new I("commandcollection-command-not-found",this,{commandName:e});return n.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 L1 extends ge(){constructor(e={}){super();const t=this.constructor,n=e.language||t.defaultConfig&&t.defaultConfig.language;this._context=e.context||new dd({language:n}),this._context._addEditor(this,!e.context);const i=Array.from(t.builtinPlugins||[]);this.config=new hc(e,t.defaultConfig),this.config.define("plugins",i),this.config.define(this._context._getEditorConfig()),this.plugins=new cd(this,i,this._context.plugins),this.locale=this._context.locale,this.t=this.locale.t,this._readOnlyLocks=new Set,this.commands=new V1,this.set("state","initializing"),this.once("ready",()=>this.state="ready",{priority:"high"}),this.once("destroy",()=>this.state="destroyed",{priority:"high"}),this.model=new O1,this.on("change:isReadOnly",()=>{this.model.document.isReadOnly=this.isReadOnly});const r=new hv;this.data=new Jy(this.model,r),this.editing=new Dy(this.model,r),this.editing.view.document.bind("isReadOnly").to(this),this.conversion=new Yy([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 PC(this),this.keystrokes.listenTo(this.editing.view.document)}get isReadOnly(){return this._readOnlyLocks.size>0}set isReadOnly(e){throw new I("editor-isreadonly-has-no-setter")}enableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new I("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)||(this._readOnlyLocks.add(e),this._readOnlyLocks.size===1&&this.fire("change:isReadOnly","isReadOnly",!0,!1))}disableReadOnlyMode(e){if(typeof e!="string"&&typeof e!="symbol")throw new I("editor-read-only-lock-id-invalid",null,{lockId:e});this._readOnlyLocks.has(e)&&(this._readOnlyLocks.delete(e),this._readOnlyLocks.size===0&&this.fire("change:isReadOnly","isReadOnly",!1,!0))}initPlugins(){const e=this.config,t=e.get("plugins"),n=e.get("removePlugins")||[],i=e.get("extraPlugins")||[],r=e.get("substitutePlugins")||[];return this.plugins.init(t.concat(i),n,r)}destroy(){let e=Promise.resolve();return this.state=="initializing"&&(e=new Promise(t=>this.once("ready",t))),e.then(()=>{this.fire("destroy"),this.stopListening(),this.commands.destroy()}).then(()=>this.plugins.destroy()).then(()=>{this.model.destroy(),this.data.destroy(),this.editing.destroy(),this.keystrokes.destroy()}).then(()=>this._context._removeEditor(this))}execute(e,...t){try{return this.commands.execute(e,...t)}catch(n){I.rethrowUnexpectedError(n,this)}}focus(){this.editing.view.focus()}static create(...e){throw new Error("This is an abstract method.")}}function Ti(o){return class extends o{setData(e){this.data.set(e)}getData(e){return this.data.get(e)}}}{const o=Ti(Object);Ti.setData=o.prototype.setData,Ti.getData=o.prototype.getData}function zs(o){return class extends o{updateSourceElement(e=this.data.get()){if(!this.sourceElement)throw new I("editor-missing-sourceelement",this);const t=this.config.get("updateSourceElementOnDestroy"),n=this.sourceElement instanceof HTMLTextAreaElement;nC(this.sourceElement,t||n?e:"")}}}zs.updateSourceElement=zs(Object).prototype.updateSourceElement;class Ii extends ui{static get pluginName(){return"PendingActions"}init(){this.set("hasAny",!1),this._actions=new st({idProperty:"_id"}),this._actions.delegate("add","remove").to(this)}add(e){if(typeof e!="string")throw new I("pendingactions-add-invalid-message",this);const t=new(ge());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 ve={bold:'<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>',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>',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>',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>',importExport:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#a)"><path clip-rule="evenodd" d="M19 4.5 14 0H3v12.673l.868-1.041c.185-.222.4-.402.632-.54V1.5h8v5h5v7.626a2.24 2.24 0 0 1 1.5.822V4.5ZM14 5V2l3.3 3H14Zm-3.692 12.5c.062.105.133.206.213.303L11.52 19H8v-.876a2.243 2.243 0 0 0 1.82-.624h.488Zm7.518-.657a.75.75 0 0 0-1.152-.96L15.5 17.29V12H14v5.29l-1.174-1.408a.75.75 0 0 0-1.152.96l2.346 2.816a.95.95 0 0 0 1.46 0l2.346-2.815Zm-15.056-.38a.75.75 0 0 1-.096-1.056l2.346-2.815a.95.95 0 0 1 1.46 0l2.346 2.815a.75.75 0 1 1-1.152.96L6.5 14.96V20H5v-5.04l-1.174 1.408a.75.75 0 0 1-1.056.096Z"/></g><defs><clipPath id="a"><path d="M0 0h20v20H0z"/></clipPath></defs></svg>',paragraph:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10.5 5.5H7v5h3.5a2.5 2.5 0 1 0 0-5zM5 3h6.5v.025a5 5 0 0 1 0 9.95V13H7v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/></svg>',plus:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 2a1 1 0 0 0-1 1v6H3a1 1 0 1 0 0 2h6v6a1 1 0 1 0 2 0v-6h6a1 1 0 1 0 0-2h-6V3a1 1 0 0 0-1-1Z"/></svg>',text:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#a)"><path d="M9.816 11.5 7.038 4.785 4.261 11.5h5.555Zm.62 1.5H3.641l-1.666 4.028H.312l5.789-14h1.875l5.789 14h-1.663L10.436 13Z"/><path clip-rule="evenodd" d="m12.09 17-.534-1.292.848-1.971.545 1.319L12.113 17h-.023Zm1.142-5.187.545 1.319L15.5 9.13l1.858 4.316h-3.45l.398.965h3.467L18.887 17H20l-3.873-9h-1.254l-1.641 3.813Z"/></g><defs><clipPath id="a"><path d="M0 0h20v20H0z"/></clipPath></defs></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>'};var hu=D(5542),j1={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(hu.Z,j1),hu.Z.locals;const{threeVerticalDots:uu}=ve,$1={alignLeft:ve.alignLeft,bold:ve.bold,importExport:ve.importExport,paragraph:ve.paragraph,plus:ve.plus,text:ve.text,threeVerticalDots:ve.threeVerticalDots};class Ms extends re{constructor(e,t){super(e);const n=this.bindTemplate,i=this.t;this.options=t||{},this.set("ariaLabel",i("Editor toolbar")),this.set("maxWidth","auto"),this.items=this.createCollection(),this.focusTracker=new dt,this.keystrokes=new xt,this.set("class",void 0),this.set("isCompact",!1),this.itemsView=new H1(e),this.children=this.createCollection(),this.children.add(this.itemsView),this.focusables=this.createCollection();const r=e.uiLanguageDirection==="rtl";this._focusCycler=new bo({focusables:this.focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:[r?"arrowright":"arrowleft","arrowup"],focusNext:[r?"arrowleft":"arrowright","arrowdown"]}});const s=["ck","ck-toolbar",n.to("class"),n.if("isCompact","ck-toolbar_compact")];var a;this.options.shouldGroupWhenFull&&this.options.isFloating&&s.push("ck-toolbar_floating"),this.setTemplate({tag:"div",attributes:{class:s,role:"toolbar","aria-label":n.to("ariaLabel"),style:{maxWidth:n.to("maxWidth")},tabindex:-1},children:this.children,on:{mousedown:(a=this,a.bindTemplate.to(l=>{l.target===a.element&&l.preventDefault()}))}}),this._behavior=this.options.shouldGroupWhenFull?new U1(this):new q1(this)}render(){super.render(),this.focusTracker.add(this.element);for(const e of this.items)this.focusTracker.add(e.element);this.items.on("add",(e,t)=>{this.focusTracker.add(t.element)}),this.items.on("remove",(e,t)=>{this.focusTracker.remove(t.element)}),this.keystrokes.listenTo(this.element),this._behavior.render(this)}destroy(){return this._behavior.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy(),super.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}fillFromConfig(e,t,n){this.items.addMany(this._buildItemsFromConfig(e,t,n))}_buildItemsFromConfig(e,t,n){const i=rd(e),r=n||i.removeItems;return this._cleanItemsConfiguration(i.items,t,r).map(s=>xe(s)?this._createNestedToolbarDropdown(s,t,r):s==="|"?new id:s==="-"?new IC:t.create(s)).filter(s=>!!s)}_cleanItemsConfiguration(e,t,n){const i=e.filter((r,s,a)=>r==="|"||n.indexOf(r)===-1&&(r==="-"?!this.options.shouldGroupWhenFull||(Q("toolbarview-line-break-ignored-when-grouping-items",a),!1):!(!xe(r)&&!t.has(r))||(Q("toolbarview-item-unavailable",{item:r}),!1)));return this._cleanSeparatorsAndLineBreaks(i)}_cleanSeparatorsAndLineBreaks(e){const t=s=>s!=="-"&&s!=="|",n=e.length,i=e.findIndex(t);if(i===-1)return[];const r=n-e.slice().reverse().findIndex(t);return e.slice(i,r).filter((s,a,l)=>t(s)?!0:!(a>0&&l[a-1]===s))}_createNestedToolbarDropdown(e,t,n){let{label:i,icon:r,items:s,tooltip:a=!0,withText:l=!1}=e;if(s=this._cleanItemsConfiguration(s,t,n),!s.length)return null;const c=It(this.locale);return i||Q("toolbarview-nested-toolbar-dropdown-missing-label",e),c.class="ck-toolbar__nested-toolbar-dropdown",c.buttonView.set({label:i,tooltip:a,withText:!!l}),r!==!1?c.buttonView.icon=$1[r]||r||uu:c.buttonView.withText=!0,Pi(c,()=>c.toolbarView._buildItemsFromConfig(s,t,n)),c}}class H1 extends re{constructor(e){super(e),this.children=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-toolbar__items"]},children:this.children})}}class q1{constructor(e){const t=e.bindTemplate;e.set("isVertical",!1),e.itemsView.children.bindTo(e.items).using(n=>n),e.focusables.bindTo(e.items).using(n=>n),e.extendTemplate({attributes:{class:[t.if("isVertical","ck-toolbar_vertical")]}})}render(){}destroy(){}}class U1{constructor(e){this.resizeObserver=null,this.cachedPadding=null,this.shouldUpdateGroupingOnNextResize=!1,this.view=e,this.viewChildren=e.children,this.viewFocusables=e.focusables,this.viewItemsView=e.itemsView,this.viewFocusTracker=e.focusTracker,this.viewLocale=e.locale,this.ungroupedItems=e.createCollection(),this.groupedItems=e.createCollection(),this.groupedItemsDropdown=this._createGroupedItemsDropdown(),e.itemsView.children.bindTo(this.ungroupedItems).using(t=>t),this.ungroupedItems.on("change",this._updateFocusCycleableItems.bind(this)),e.children.on("change",this._updateFocusCycleableItems.bind(this)),e.items.on("change",(t,n)=>{const i=n.index,r=Array.from(n.added);for(const s of n.removed)i>=this.ungroupedItems.length?this.groupedItems.remove(s):this.ungroupedItems.remove(s);for(let s=i;s<i+r.length;s++){const a=r[s-i];s>this.ungroupedItems.length?this.groupedItems.add(a,s-this.ungroupedItems.length):this.ungroupedItems.add(a,s)}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(!nn(this.viewElement))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,n=new De(e.lastChild),i=new De(e);if(!this.cachedPadding){const r=oe.window.getComputedStyle(e),s=t==="ltr"?"paddingRight":"paddingLeft";this.cachedPadding=Number.parseInt(r[s])}return t==="ltr"?n.right>i.right-this.cachedPadding:n.left<i.left+this.cachedPadding}_enableGroupingOnResize(){let e;this.resizeObserver=new si(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 id),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,n=It(e);return n.class="ck-toolbar__grouped-dropdown",n.panelPosition=e.uiLanguageDirection==="ltr"?"sw":"se",Pi(n,this.groupedItems),n.buttonView.set({label:t("Show more items"),tooltip:!0,tooltipPosition:e.uiLanguageDirection==="rtl"?"se":"sw",icon:uu}),n}_updateFocusCycleableItems(){this.viewFocusables.clear(),this.ungroupedItems.map(e=>{this.viewFocusables.add(e)}),this.groupedItems.length&&this.viewFocusables.add(this.groupedItemsDropdown)}}var mu=D(1046),W1={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(mu.Z,W1),mu.Z.locals;class K1 extends re{constructor(e){super(e);const t=this.bindTemplate;this.items=this.createCollection(),this.focusTracker=new dt,this.keystrokes=new xt,this._focusCycler=new bo({focusables:this.items,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"arrowup",focusNext:"arrowdown"}}),this.set("ariaLabel",void 0),this.set("role",void 0),this.setTemplate({tag:"ul",attributes:{class:["ck","ck-reset","ck-list"],role:t.to("role"),"aria-label":t.to("ariaLabel")},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)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}focusLast(){this._focusCycler.focusLast()}}class gu extends re{constructor(e){super(e);const t=this.bindTemplate;this.set("isVisible",!0),this.children=this.createCollection(),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__item",t.if("isVisible","ck-hidden",n=>!n)],role:"presentation"},children:this.children})}focus(){this.children.first.focus()}}class G1 extends re{constructor(e){super(e),this.setTemplate({tag:"li",attributes:{class:["ck","ck-list__separator"]}})}}var pu=D(7686),Z1={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(pu.Z,Z1),pu.Z.locals;class Fs extends re{constructor(e){super(e);const t=this.bindTemplate;this.set("class",void 0),this.set("labelStyle",void 0),this.set("icon",void 0),this.set("isEnabled",!0),this.set("isOn",!1),this.set("isToggleable",!1),this.set("isVisible",!0),this.set("keystroke",void 0),this.set("withKeystroke",!1),this.set("label",void 0),this.set("tabindex",-1),this.set("tooltip",!1),this.set("tooltipPosition","s"),this.set("type","button"),this.set("withText",!1),this.children=this.createCollection(),this.actionView=this._createActionView(),this.arrowView=this._createArrowView(),this.keystrokes=new xt,this.focusTracker=new dt,this.setTemplate({tag:"div",attributes:{class:["ck","ck-splitbutton",t.to("class"),t.if("isVisible","ck-hidden",n=>!n),this.arrowView.bindTemplate.if("isOn","ck-splitbutton_open")]},children:this.children})}render(){super.render(),this.children.add(this.actionView),this.children.add(this.arrowView),this.focusTracker.add(this.actionView.element),this.focusTracker.add(this.arrowView.element),this.keystrokes.listenTo(this.element),this.keystrokes.set("arrowright",(e,t)=>{this.focusTracker.focusedElement===this.actionView.element&&(this.arrowView.focus(),t())}),this.keystrokes.set("arrowleft",(e,t)=>{this.focusTracker.focusedElement===this.arrowView.element&&(this.actionView.focus(),t())})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this.actionView.focus()}_createActionView(){const e=new Ae;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 Ae,t=e.bindTemplate;return e.icon=nd,e.extendTemplate({attributes:{class:["ck-splitbutton__arrow"],"data-cke-tooltip-disabled":t.to("isOn"),"aria-haspopup":!0,"aria-expanded":t.to("isOn",n=>String(n))}}),e.bind("isEnabled").to(this),e.bind("label").to(this),e.bind("tooltip").to(this),e.delegate("execute").to(this,"open"),e}}var fu=D(7339),J1={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(fu.Z,J1),fu.Z.locals;var ku=D(3949),Y1={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(ku.Z,Y1),ku.Z.locals;function It(o,e=od){const t=new e(o),n=new BC(o),i=new Yr(o,t,n);return t.bind("isEnabled").to(i),t instanceof Fs?t.arrowView.bind("isOn").to(i,"isOpen"):t.bind("isOn").to(i,"isOpen"),function(r){(function(s){s.on("render",()=>{w({emitter:s,activator:()=>s.isOpen,callback:()=>{s.isOpen=!1},contextElements:[s.element]})})})(r),function(s){s.on("execute",a=>{a.source instanceof hi||(s.isOpen=!1)})}(r),function(s){s.focusTracker.on("change:isFocused",(a,l,c)=>{s.isOpen&&!c&&(s.isOpen=!1)})}(r),function(s){s.keystrokes.set("arrowdown",(a,l)=>{s.isOpen&&(s.panelView.focus(),l())}),s.keystrokes.set("arrowup",(a,l)=>{s.isOpen&&(s.panelView.focusLast(),l())})}(r),function(s){s.on("change:isOpen",(a,l,c)=>{if(c)return;const d=s.panelView.element;d&&d.contains(oe.document.activeElement)&&s.buttonView.focus()})}(r),function(s){s.on("change:isOpen",(a,l,c)=>{c&&s.panelView.focus()},{priority:"low"})}(r)}(i),i}function Pi(o,e,t={}){o.extendTemplate({attributes:{class:["ck-toolbar-dropdown"]}}),o.isOpen?bu(o,e,t):o.once("change:isOpen",()=>bu(o,e,t),{priority:"highest"}),t.enableActiveItemFocusOnDropdownOpen&&Au(o,()=>o.toolbarView.items.find(n=>n.isOn))}function bu(o,e,t){const n=o.locale,i=n.t,r=o.toolbarView=new Ms(n),s=typeof e=="function"?e():e;r.ariaLabel=t.ariaLabel||i("Dropdown toolbar"),t.maxWidth&&(r.maxWidth=t.maxWidth),t.class&&(r.class=t.class),t.isCompact&&(r.isCompact=t.isCompact),t.isVertical&&(r.isVertical=!0),s instanceof on?r.items.bindTo(s).using(a=>a):r.items.addMany(s),o.panelView.children.add(r),r.items.delegate("execute").to(o)}function Vs(o,e,t={}){o.isOpen?wu(o,e,t):o.once("change:isOpen",()=>wu(o,e,t),{priority:"highest"}),Au(o,()=>o.listView.items.find(n=>n instanceof gu&&n.children.first.isOn))}function wu(o,e,t){const n=o.locale,i=o.listView=new K1(n),r=typeof e=="function"?e():e;i.ariaLabel=t.ariaLabel,i.role=t.role,i.items.bindTo(r).using(s=>{if(s.type==="separator")return new G1(n);if(s.type==="button"||s.type==="switchbutton"){const a=new gu(n);let l;return l=s.type==="button"?new Ae(n):new hi(n),l.bind(...Object.keys(s.model)).to(s.model),l.delegate("execute").to(a),a.children.add(l),a}return null}),o.panelView.children.add(i),i.items.delegate("execute").to(o)}function Au(o,e){o.on("change:isOpen",()=>{if(!o.isOpen)return;const t=e();t&&(typeof t.focus=="function"?t.focus():Q("ui-dropdown-focus-child-on-open-child-missing-focus",{view:t}))},{priority:te.low-10})}function _u(o,e,t){const n=new DC(o.locale);return n.set({id:e,ariaDescribedById:t}),n.bind("isReadOnly").to(o,"isEnabled",i=>!i),n.bind("hasError").to(o,"errorText",i=>!!i),n.on("input",()=>{o.errorText=null}),o.bind("isEmpty","isFocused","placeholder").to(n),n}const Po=(o,e=0,t=1)=>o>t?t:o<e?e:o,He=(o,e=0,t=Math.pow(10,e))=>Math.round(t*o)/t,Ls=o=>(o[0]==="#"&&(o=o.substring(1)),o.length<6?{r:parseInt(o[0]+o[0],16),g:parseInt(o[1]+o[1],16),b:parseInt(o[2]+o[2],16),a:o.length===4?He(parseInt(o[3]+o[3],16)/255,2):1}:{r:parseInt(o.substring(0,2),16),g:parseInt(o.substring(2,4),16),b:parseInt(o.substring(4,6),16),a:o.length===8?He(parseInt(o.substring(6,8),16)/255,2):1}),Q1=({h:o,s:e,v:t,a:n})=>{const i=(200-e)*t/100;return{h:He(o),s:He(i>0&&i<200?e*t/100/(i<=100?i:200-i)*100:0),l:He(i/2),a:He(n,2)}},js=o=>{const{h:e,s:t,l:n}=Q1(o);return`hsl(${e}, ${t}%, ${n}%)`},X1=({h:o,s:e,v:t,a:n})=>{o=o/360*6,e/=100,t/=100;const i=Math.floor(o),r=t*(1-e),s=t*(1-(o-i)*e),a=t*(1-(1-o+i)*e),l=i%6;return{r:He(255*[t,s,r,r,a,t][l]),g:He(255*[a,t,t,s,r,r][l]),b:He(255*[r,r,a,t,t,s][l]),a:He(n,2)}},Ri=o=>{const e=o.toString(16);return e.length<2?"0"+e:e},eE=({r:o,g:e,b:t,a:n})=>{const i=n<1?Ri(He(255*n)):"";return"#"+Ri(o)+Ri(e)+Ri(t)+i},tE=({r:o,g:e,b:t,a:n})=>{const i=Math.max(o,e,t),r=i-Math.min(o,e,t),s=r?i===o?(e-t)/r:i===e?2+(t-o)/r:4+(o-e)/r:0;return{h:He(60*(s<0?s+6:s)),s:He(i?r/i*100:0),v:He(i/255*100),a:n}},Cu=(o,e)=>{if(o===e)return!0;for(const t in o)if(o[t]!==e[t])return!1;return!0},vu={},yu=o=>{let e=vu[o];return e||(e=document.createElement("template"),e.innerHTML=o,vu[o]=e),e},$s=(o,e,t)=>{o.dispatchEvent(new CustomEvent(e,{bubbles:!0,detail:t}))};let qn=!1;const Hs=o=>"touches"in o,Eu=(o,e)=>{const t=Hs(e)?e.touches[0]:e,n=o.el.getBoundingClientRect();$s(o.el,"move",o.getMove({x:Po((t.pageX-(n.left+window.pageXOffset))/n.width),y:Po((t.pageY-(n.top+window.pageYOffset))/n.height)}))};class xu{constructor(e,t,n,i){const r=yu(`<div role="slider" tabindex="0" part="${t}" ${n}><div part="${t}-pointer"></div></div>`);e.appendChild(r.content.cloneNode(!0));const s=e.querySelector(`[part=${t}]`);s.addEventListener("mousedown",this),s.addEventListener("touchstart",this),s.addEventListener("keydown",this),this.el=s,this.xy=i,this.nodes=[s.firstChild,s]}set dragging(e){const t=e?document.addEventListener:document.removeEventListener;t(qn?"touchmove":"mousemove",this),t(qn?"touchend":"mouseup",this)}handleEvent(e){switch(e.type){case"mousedown":case"touchstart":if(e.preventDefault(),!(t=>!(qn&&!Hs(t)||(qn||(qn=Hs(t)),0)))(e)||!qn&&e.button!=0)return;this.el.focus(),Eu(this,e),this.dragging=!0;break;case"mousemove":case"touchmove":e.preventDefault(),Eu(this,e);break;case"mouseup":case"touchend":this.dragging=!1;break;case"keydown":((t,n)=>{const i=n.keyCode;i>40||t.xy&&i<37||i<33||(n.preventDefault(),$s(t.el,"move",t.getMove({x:i===39?.01:i===37?-.01:i===34?.05:i===33?-.05:i===35?1:i===36?-1:0,y:i===40?.01:i===38?-.01:0},!0)))})(this,e)}}style(e){e.forEach((t,n)=>{for(const i in t)this.nodes[n].style.setProperty(i,t[i])})}}class nE extends xu{constructor(e){super(e,"hue",'aria-label="Hue" aria-valuemin="0" aria-valuemax="360"',!1)}update({h:e}){this.h=e,this.style([{left:e/360*100+"%",color:js({h:e,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuenow",`${He(e)}`)}getMove(e,t){return{h:t?Po(this.h+360*e.x,0,360):360*e.x}}}class oE extends xu{constructor(e){super(e,"saturation",'aria-label="Color"',!0)}update(e){this.hsva=e,this.style([{top:100-e.v+"%",left:`${e.s}%`,color:js(e)},{"background-color":js({h:e.h,s:100,v:100,a:1})}]),this.el.setAttribute("aria-valuetext",`Saturation ${He(e.s)}%, Brightness ${He(e.v)}%`)}getMove(e,t){return{s:t?Po(this.hsva.s+100*e.x,0,100):100*e.x,v:t?Po(this.hsva.v-100*e.y,0,100):Math.round(100-100*e.y)}}}const Oi=Symbol("same"),qs=Symbol("color"),Su=Symbol("hsva"),Us=Symbol("update"),Du=Symbol("parts"),Bu=Symbol("css"),Tu=Symbol("sliders");class iE extends HTMLElement{static get observedAttributes(){return["color"]}get[Bu](){return[':host{display:flex;flex-direction:column;position:relative;width:200px;height:200px;user-select:none;-webkit-user-select:none;cursor:default}:host([hidden]){display:none!important}[role=slider]{position:relative;touch-action:none;user-select:none;-webkit-user-select:none;outline:0}[role=slider]:last-child{border-radius:0 0 8px 8px}[part$=pointer]{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;display:flex;place-content:center center;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}[part$=pointer]::after{content:"";width:100%;height:100%;border-radius:inherit;background-color:currentColor}[role=slider]:focus [part$=pointer]{transform:translate(-50%,-50%) scale(1.1)}',"[part=hue]{flex:0 0 24px;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}[part=hue-pointer]{top:50%;z-index:2}","[part=saturation]{flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,rgba(255,255,255,0));box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}[part=saturation-pointer]{z-index:3}"]}get[Tu](){return[oE,nE]}get color(){return this[qs]}set color(e){if(!this[Oi](e)){const t=this.colorModel.toHsva(e);this[Us](t),this[qs]=e}}constructor(){super();const e=yu(`<style>${this[Bu].join("")}</style>`),t=this.attachShadow({mode:"open"});t.appendChild(e.content.cloneNode(!0)),t.addEventListener("move",this),this[Du]=this[Tu].map(n=>new n(t))}connectedCallback(){if(this.hasOwnProperty("color")){const e=this.color;delete this.color,this.color=e}else this.color||(this.color=this.colorModel.defaultColor)}attributeChangedCallback(e,t,n){const i=this.colorModel.fromAttr(n);this[Oi](i)||(this.color=i)}handleEvent(e){const t=this[Su],n={...t,...e.detail};let i;this[Us](n),Cu(n,t)||this[Oi](i=this.colorModel.fromHsva(n))||(this[qs]=i,$s(this,"color-changed",{value:i}))}[Oi](e){return this.color&&this.colorModel.equal(e,this.color)}[Us](e){this[Su]=e,this[Du].forEach(t=>t.update(e))}}const rE={defaultColor:"#000",toHsva:o=>tE(Ls(o)),fromHsva:({h:o,s:e,v:t})=>eE(X1({h:o,s:e,v:t,a:1})),equal:(o,e)=>o.toLowerCase()===e.toLowerCase()||Cu(Ls(o),Ls(e)),fromAttr:o=>o};class sE extends iE{get colorModel(){return rE}}customElements.define("hex-color-picker",class extends sE{});var Iu=D(3398),aE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Iu.Z,aE),Iu.Z.locals;class lE{constructor(e){this._components=new Map,this.editor=e}*names(){for(const e of this._components.values())yield e.originalName}add(e,t){this._components.set(Ws(e),{callback:t,originalName:e})}create(e){if(!this.has(e))throw new I("componentfactory-item-missing",this,{name:e});return this._components.get(Ws(e)).callback(this.editor.locale)}has(e){return this._components.has(Ws(e))}}function Ws(o){return String(o).toLowerCase()}var Pu=D(8793),cE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Pu.Z,cE),Pu.Z.locals;var dE=Object.defineProperty,Ru=Object.getOwnPropertySymbols,hE=Object.prototype.hasOwnProperty,uE=Object.prototype.propertyIsEnumerable,Ou=(o,e,t)=>e in o?dE(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,le=(o,e)=>{for(var t in e||(e={}))hE.call(e,t)&&Ou(o,t,e[t]);if(Ru)for(var t of Ru(e))uE.call(e,t)&&Ou(o,t,e[t]);return o};const Nu=jr("px"),zu=oe.document.body,Ks=class extends re{constructor(o){super(o);const e=this.bindTemplate;this.set("top",0),this.set("left",0),this.set("position","arrow_nw"),this.set("isVisible",!1),this.set("withArrow",!0),this.set("class",void 0),this._pinWhenIsVisibleCallback=null,this.content=this.createCollection(),this.setTemplate({tag:"div",attributes:{class:["ck","ck-balloon-panel",e.to("position",t=>`ck-balloon-panel_${t}`),e.if("isVisible","ck-balloon-panel_visible"),e.if("withArrow","ck-balloon-panel_with-arrow"),e.to("class")],style:{top:e.to("top",Nu),left:e.to("left",Nu)}},children:this.content})}show(){this.isVisible=!0}hide(){this.isVisible=!1}attachTo(o){this.show();const e=Ks.defaultPositions,t=Object.assign({},{element:this.element,positions:[e.southArrowNorth,e.southArrowNorthMiddleWest,e.southArrowNorthMiddleEast,e.southArrowNorthWest,e.southArrowNorthEast,e.northArrowSouth,e.northArrowSouthMiddleWest,e.northArrowSouthMiddleEast,e.northArrowSouthWest,e.northArrowSouthEast,e.viewportStickyNorth],limiter:zu,fitInViewport:!0},o),n=Ks._getOptimalPosition(t),i=parseInt(n.left),r=parseInt(n.top),s=n.name,a=n.config||{},{withArrow:l=!0}=a;this.top=r,this.left=i,this.position=s,this.withArrow=l}pin(o){this.unpin(),this._pinWhenIsVisibleCallback=()=>{this.isVisible?this._startPinning(o):this._stopPinning()},this._startPinning(o),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(o){this.attachTo(o);const e=Gs(o.target),t=o.limiter?Gs(o.limiter):zu;this.listenTo(oe.document,"scroll",(n,i)=>{const r=i.target,s=e&&r.contains(e),a=t&&r.contains(t);!s&&!a&&e&&t||this.attachTo(o)},{useCapture:!0}),this.listenTo(oe.window,"resize",()=>{this.attachTo(o)})}_stopPinning(){this.stopListening(oe.document,"scroll"),this.stopListening(oe.window,"resize")}};let Ye=Ks;function Gs(o){return Rn(o)?o:ii(o)?o.commonAncestorContainer:typeof o=="function"?Gs(o()):null}function Mu(o={}){const{sideOffset:e=Ye.arrowSideOffset,heightOffset:t=Ye.arrowHeightOffset,stickyVerticalOffset:n=Ye.stickyVerticalOffset,config:i}=o;return{northWestArrowSouthWest:(a,l)=>le({top:r(a,l),left:a.left-e,name:"arrow_sw"},i&&{config:i}),northWestArrowSouthMiddleWest:(a,l)=>le({top:r(a,l),left:a.left-.25*l.width-e,name:"arrow_smw"},i&&{config:i}),northWestArrowSouth:(a,l)=>le({top:r(a,l),left:a.left-l.width/2,name:"arrow_s"},i&&{config:i}),northWestArrowSouthMiddleEast:(a,l)=>le({top:r(a,l),left:a.left-.75*l.width+e,name:"arrow_sme"},i&&{config:i}),northWestArrowSouthEast:(a,l)=>le({top:r(a,l),left:a.left-l.width+e,name:"arrow_se"},i&&{config:i}),northArrowSouthWest:(a,l)=>le({top:r(a,l),left:a.left+a.width/2-e,name:"arrow_sw"},i&&{config:i}),northArrowSouthMiddleWest:(a,l)=>le({top:r(a,l),left:a.left+a.width/2-.25*l.width-e,name:"arrow_smw"},i&&{config:i}),northArrowSouth:(a,l)=>le({top:r(a,l),left:a.left+a.width/2-l.width/2,name:"arrow_s"},i&&{config:i}),northArrowSouthMiddleEast:(a,l)=>le({top:r(a,l),left:a.left+a.width/2-.75*l.width+e,name:"arrow_sme"},i&&{config:i}),northArrowSouthEast:(a,l)=>le({top:r(a,l),left:a.left+a.width/2-l.width+e,name:"arrow_se"},i&&{config:i}),northEastArrowSouthWest:(a,l)=>le({top:r(a,l),left:a.right-e,name:"arrow_sw"},i&&{config:i}),northEastArrowSouthMiddleWest:(a,l)=>le({top:r(a,l),left:a.right-.25*l.width-e,name:"arrow_smw"},i&&{config:i}),northEastArrowSouth:(a,l)=>le({top:r(a,l),left:a.right-l.width/2,name:"arrow_s"},i&&{config:i}),northEastArrowSouthMiddleEast:(a,l)=>le({top:r(a,l),left:a.right-.75*l.width+e,name:"arrow_sme"},i&&{config:i}),northEastArrowSouthEast:(a,l)=>le({top:r(a,l),left:a.right-l.width+e,name:"arrow_se"},i&&{config:i}),southWestArrowNorthWest:a=>le({top:s(a),left:a.left-e,name:"arrow_nw"},i&&{config:i}),southWestArrowNorthMiddleWest:(a,l)=>le({top:s(a),left:a.left-.25*l.width-e,name:"arrow_nmw"},i&&{config:i}),southWestArrowNorth:(a,l)=>le({top:s(a),left:a.left-l.width/2,name:"arrow_n"},i&&{config:i}),southWestArrowNorthMiddleEast:(a,l)=>le({top:s(a),left:a.left-.75*l.width+e,name:"arrow_nme"},i&&{config:i}),southWestArrowNorthEast:(a,l)=>le({top:s(a),left:a.left-l.width+e,name:"arrow_ne"},i&&{config:i}),southArrowNorthWest:a=>le({top:s(a),left:a.left+a.width/2-e,name:"arrow_nw"},i&&{config:i}),southArrowNorthMiddleWest:(a,l)=>le({top:s(a),left:a.left+a.width/2-.25*l.width-e,name:"arrow_nmw"},i&&{config:i}),southArrowNorth:(a,l)=>le({top:s(a),left:a.left+a.width/2-l.width/2,name:"arrow_n"},i&&{config:i}),southArrowNorthMiddleEast:(a,l)=>le({top:s(a),left:a.left+a.width/2-.75*l.width+e,name:"arrow_nme"},i&&{config:i}),southArrowNorthEast:(a,l)=>le({top:s(a),left:a.left+a.width/2-l.width+e,name:"arrow_ne"},i&&{config:i}),southEastArrowNorthWest:a=>le({top:s(a),left:a.right-e,name:"arrow_nw"},i&&{config:i}),southEastArrowNorthMiddleWest:(a,l)=>le({top:s(a),left:a.right-.25*l.width-e,name:"arrow_nmw"},i&&{config:i}),southEastArrowNorth:(a,l)=>le({top:s(a),left:a.right-l.width/2,name:"arrow_n"},i&&{config:i}),southEastArrowNorthMiddleEast:(a,l)=>le({top:s(a),left:a.right-.75*l.width+e,name:"arrow_nme"},i&&{config:i}),southEastArrowNorthEast:(a,l)=>le({top:s(a),left:a.right-l.width+e,name:"arrow_ne"},i&&{config:i}),westArrowEast:(a,l)=>le({top:a.top+a.height/2-l.height/2,left:a.left-l.width-t,name:"arrow_e"},i&&{config:i}),eastArrowWest:(a,l)=>le({top:a.top+a.height/2-l.height/2,left:a.right+t,name:"arrow_w"},i&&{config:i}),viewportStickyNorth:(a,l,c)=>a.getIntersection(c)?{top:c.top+n,left:a.left+a.width/2-l.width/2,name:"arrowless",config:le({withArrow:!1},i)}:null};function r(a,l){return a.top-l.height-t}function s(a){return a.bottom+t}}Ye.arrowSideOffset=25,Ye.arrowHeightOffset=10,Ye.stickyVerticalOffset=20,Ye._getOptimalPosition=vc,Ye.defaultPositions=Mu();var Fu=D(3332),mE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Fu.Z,mE),Fu.Z.locals;const Vu="ck-tooltip",Qe=class extends jt(){constructor(o){if(super(),this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._resizeObserver=null,Qe._editors.add(o),Qe._instance)return Qe._instance;Qe._instance=this,this.tooltipTextView=new re(o.locale),this.tooltipTextView.set("text",""),this.tooltipTextView.setTemplate({tag:"span",attributes:{class:["ck","ck-tooltip__text"]},children:[{text:this.tooltipTextView.bindTemplate.to("text")}]}),this.balloonPanelView=new Ye(o.locale),this.balloonPanelView.class=Vu,this.balloonPanelView.content.add(this.tooltipTextView),this._pinTooltipDebounced=vo(this._pinTooltip,600),this.listenTo(oe.document,"mouseenter",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(oe.document,"mouseleave",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(oe.document,"focus",this._onEnterOrFocus.bind(this),{useCapture:!0}),this.listenTo(oe.document,"blur",this._onLeaveOrBlur.bind(this),{useCapture:!0}),this.listenTo(oe.document,"scroll",this._onScroll.bind(this),{useCapture:!0}),this._watchdogExcluded=!0}destroy(o){const e=o.ui.view&&o.ui.view.body;Qe._editors.delete(o),this.stopListening(o.ui),e&&e.has(this.balloonPanelView)&&e.remove(this.balloonPanelView),Qe._editors.size||(this._unpinTooltip(),this.balloonPanelView.destroy(),this.stopListening(),Qe._instance=null)}static getPositioningFunctions(o){const e=Qe.defaultBalloonPositions;return{s:[e.southArrowNorth,e.southArrowNorthEast,e.southArrowNorthWest],n:[e.northArrowSouth],e:[e.eastArrowWest],w:[e.westArrowEast],sw:[e.southArrowNorthEast],se:[e.southArrowNorthWest]}[o]}_onEnterOrFocus(o,{target:e}){const t=Zs(e);var n;t&&t!==this._currentElementWithTooltip&&(this._unpinTooltip(),this._pinTooltipDebounced(t,{text:(n=t).dataset.ckeTooltipText,position:n.dataset.ckeTooltipPosition||"s",cssClass:n.dataset.ckeTooltipClass||""}))}_onLeaveOrBlur(o,{target:e,relatedTarget:t}){if(o.name==="mouseleave"){if(!Rn(e)||this._currentElementWithTooltip&&e!==this._currentElementWithTooltip)return;const n=Zs(e),i=Zs(t);n&&n!==i&&this._unpinTooltip()}else{if(this._currentElementWithTooltip&&e!==this._currentElementWithTooltip)return;this._unpinTooltip()}}_onScroll(o,{target:e}){this._currentElementWithTooltip&&(e.contains(this.balloonPanelView.element)&&e.contains(this._currentElementWithTooltip)||this._unpinTooltip())}_pinTooltip(o,{text:e,position:t,cssClass:n}){const i=ze(Qe._editors.values()).ui.view.body;i.has(this.balloonPanelView)||i.add(this.balloonPanelView),this.tooltipTextView.text=e,this.balloonPanelView.pin({target:o,positions:Qe.getPositioningFunctions(t)}),this._resizeObserver=new si(o,()=>{nn(o)||this._unpinTooltip()}),this.balloonPanelView.class=[Vu,n].filter(r=>r).join(" ");for(const r of Qe._editors)this.listenTo(r.ui,"update",this._updateTooltipPosition.bind(this),{priority:"low"});this._currentElementWithTooltip=o,this._currentTooltipPosition=t}_unpinTooltip(){this._pinTooltipDebounced.cancel(),this.balloonPanelView.unpin();for(const o of Qe._editors)this.stopListening(o.ui,"update");this._currentElementWithTooltip=null,this._currentTooltipPosition=null,this._resizeObserver&&this._resizeObserver.destroy()}_updateTooltipPosition(){nn(this._currentElementWithTooltip)?this.balloonPanelView.pin({target:this._currentElementWithTooltip,positions:Qe.getPositioningFunctions(this._currentTooltipPosition)}):this._unpinTooltip()}};let Ni=Qe;function Zs(o){return Rn(o)?o.closest("[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])"):null}Ni.defaultBalloonPositions=Mu({heightOffset:5,sideOffset:13}),Ni._editors=new Set,Ni._instance=null;const Js=function(o,e,t){var n=!0,i=!0;if(typeof o!="function")throw new TypeError("Expected a function");return xe(t)&&(n="leading"in t?!!t.leading:n,i="trailing"in t?!!t.trailing:i),vo(o,e,{leading:n,maxWait:e,trailing:i})};var gE=Object.defineProperty,Lu=Object.getOwnPropertySymbols,pE=Object.prototype.hasOwnProperty,fE=Object.prototype.propertyIsEnumerable,ju=(o,e,t)=>e in o?gE(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,kE=(o,e)=>{for(var t in e||(e={}))pE.call(e,t)&&ju(o,t,e[t]);if(Lu)for(var t of Lu(e))fE.call(e,t)&&ju(o,t,e[t]);return o};const bE=50,wE=350,AE="Powered by",zi={top:-99999,left:-99999,name:"invalid",config:{withArrow:!1}};class _E extends jt(){constructor(e){super(),this.editor=e,this._balloonView=null,this._lastFocusedEditableElement=null,this._showBalloonThrottled=Js(this._showBalloon.bind(this),50,{leading:!0}),e.on("ready",this._handleEditorReady.bind(this))}destroy(){const e=this._balloonView;e&&(e.unpin(),this._balloonView=null),this._showBalloonThrottled.cancel(),this.stopListening()}_handleEditorReady(){const e=this.editor;(function(t){function n(f){return f.match(/^[a-zA-Z0-9+/=$]+$/g)&&f.length>=40&&f.length<=255?"VALID":"INVALID"}let i="",r="";if(!t)return"INVALID";try{i=atob(t)}catch{return"INVALID"}const s=i.split("-"),a=s[0],l=s[1];if(!l)return n(t);try{atob(l)}catch{try{if(atob(a),!atob(a).length)return n(t)}catch{return n(t)}}if(a.length<40||a.length>255)return"INVALID";try{atob(a)}catch{return"INVALID"}try{r=atob(l)}catch{return"INVALID"}if(r.length!==8)return"INVALID";const c=Number(r.substring(0,4)),d=Number(r.substring(4,6))-1,u=Number(r.substring(6,8)),g=new Date(c,d,u);return g<Ft||isNaN(Number(g))?"INVALID":"VALID"})(e.config.get("licenseKey"))!=="VALID"&&e.ui.view&&(e.ui.focusTracker.on("change:isFocused",(t,n,i)=>{this._updateLastFocusedEditableElement(),i?this._showBalloon():this._hideBalloon()}),e.ui.focusTracker.on("change:focusedElement",(t,n,i)=>{this._updateLastFocusedEditableElement(),i&&this._showBalloon()}),e.ui.on("update",()=>{this._showBalloonThrottled()}))}_createBalloonView(){const e=this.editor,t=this._balloonView=new Ye,n=Hu(e),i=new CE(e.locale,n.label);t.content.add(i),t.set({class:"ck-powered-by-balloon"}),e.ui.view.body.add(t),e.ui.focusTracker.add(t.element),this._balloonView=t}_showBalloon(){if(!this._lastFocusedEditableElement)return;const e=function(t,n){const i=Hu(t),r=i.side==="right"?function(s,a){return $u(s,a,(l,c)=>l.left+l.width-c.width-a.horizontalOffset)}(n,i):function(s,a){return $u(s,a,l=>l.left+a.horizontalOffset)}(n,i);return{target:n,positions:[r]}}(this.editor,this._lastFocusedEditableElement);e&&(this._balloonView||this._createBalloonView(),this._balloonView.pin(e))}_hideBalloon(){this._balloonView&&this._balloonView.unpin()}_updateLastFocusedEditableElement(){const e=this.editor,t=e.ui.focusTracker.isFocused,n=e.ui.focusTracker.focusedElement;if(!t||!n)return void(this._lastFocusedEditableElement=null);const i=Array.from(e.ui.getEditableElementsNames()).map(r=>e.ui.getEditableElement(r));i.includes(n)?this._lastFocusedEditableElement=n:this._lastFocusedEditableElement=i[0]}}class CE extends re{constructor(e,t){super(e);const n=new ko,i=this.bindTemplate;n.set({content:`<svg xmlns="http://www.w3.org/2000/svg" width="53" height="10" viewBox="0 0 53 10"><g clip-path="url(#a)"><path fill="#1C2331" d="M31.724 1.492a15.139 15.139 0 0 0 .045 1.16 2.434 2.434 0 0 0-.687-.34 3.68 3.68 0 0 0-1.103-.166 2.332 2.332 0 0 0-1.14.255 1.549 1.549 0 0 0-.686.87c-.15.41-.225.98-.225 1.712 0 .939.148 1.659.444 2.161.297.503.792.754 1.487.754.452.015.9-.094 1.294-.316.296-.174.557-.4.771-.669l.14.852h1.282V.007h-1.623v1.485ZM31 6.496a1.77 1.77 0 0 1-.494.061.964.964 0 0 1-.521-.127.758.758 0 0 1-.296-.466 3.984 3.984 0 0 1-.093-.992 4.208 4.208 0 0 1 .098-1.052.753.753 0 0 1 .307-.477 1.08 1.08 0 0 1 .55-.122c.233-.004.466.026.69.089l.483.144v2.553c-.11.076-.213.143-.307.2a1.73 1.73 0 0 1-.417.189ZM35.68 0l-.702.004c-.322.002-.482.168-.48.497l.004.581c.002.33.164.493.486.49l.702-.004c.322-.002.481-.167.48-.496L36.165.49c-.002-.33-.164-.493-.486-.491ZM36.145 2.313l-1.612.01.034 5.482 1.613-.01-.035-5.482ZM39.623.79 37.989.8 38 2.306l-.946.056.006 1.009.949-.006.024 2.983c.003.476.143.844.419 1.106.275.26.658.39 1.148.387.132 0 .293-.01.483-.03.19-.02.38-.046.57-.08.163-.028.324-.068.482-.119l-.183-1.095-.702.004a.664.664 0 0 1-.456-.123.553.553 0 0 1-.14-.422l-.016-2.621 1.513-.01-.006-1.064-1.514.01-.01-1.503ZM46.226 2.388c-.41-.184-.956-.274-1.636-.27-.673.004-1.215.101-1.627.29-.402.179-.72.505-.888.91-.18.419-.268.979-.264 1.68.004.688.1 1.24.285 1.655.172.404.495.724.9.894.414.18.957.268 1.63.264.68-.004 1.224-.099 1.632-.284.4-.176.714-.501.878-.905.176-.418.263-.971.258-1.658-.004-.702-.097-1.261-.28-1.677a1.696 1.696 0 0 0-.888-.9Zm-.613 3.607a.77.77 0 0 1-.337.501 1.649 1.649 0 0 1-1.317.009.776.776 0 0 1-.343-.497 4.066 4.066 0 0 1-.105-1.02 4.136 4.136 0 0 1 .092-1.03.786.786 0 0 1 .337-.507 1.59 1.59 0 0 1 1.316-.008.79.79 0 0 1 .344.502c.078.337.113.683.105 1.03.012.343-.019.685-.092 1.02ZM52.114 2.07a2.67 2.67 0 0 0-1.128.278c-.39.191-.752.437-1.072.73l-.157-.846-1.273.008.036 5.572 1.623-.01-.024-3.78c.35-.124.646-.22.887-.286.26-.075.53-.114.8-.118l.45-.003.144-1.546-.286.001ZM22.083 7.426l-1.576-2.532a2.137 2.137 0 0 0-.172-.253 1.95 1.95 0 0 0-.304-.29.138.138 0 0 1 .042-.04 1.7 1.7 0 0 0 .328-.374l1.75-2.71c.01-.015.025-.028.024-.048-.01-.01-.021-.007-.031-.007L20.49 1.17a.078.078 0 0 0-.075.045l-.868 1.384c-.23.366-.46.732-.688 1.099a.108.108 0 0 1-.112.06c-.098-.005-.196-.001-.294-.002-.018 0-.038.006-.055-.007.002-.02.002-.039.005-.058a4.6 4.6 0 0 0 .046-.701V1.203c0-.02-.009-.032-.03-.03h-.033L16.93 1.17c-.084 0-.073-.01-.073.076v6.491c-.001.018.006.028.025.027h1.494c.083 0 .072.007.072-.071v-2.19c0-.055-.003-.11-.004-.166a3.366 3.366 0 0 0-.05-.417h.06c.104 0 .209.002.313-.002a.082.082 0 0 1 .084.05c.535.913 1.07 1.824 1.607 2.736a.104.104 0 0 0 .103.062c.554-.003 1.107-.002 1.66-.002l.069-.003-.019-.032-.188-.304ZM27.112 6.555c-.005-.08-.004-.08-.082-.08h-2.414c-.053 0-.106-.003-.159-.011a.279.279 0 0 1-.246-.209.558.558 0 0 1-.022-.15c0-.382 0-.762-.002-1.143 0-.032.007-.049.042-.044h2.504c.029.003.037-.012.034-.038V3.814c0-.089.013-.078-.076-.078h-2.44c-.07 0-.062.003-.062-.06v-.837c0-.047.004-.093.013-.14a.283.283 0 0 1 .241-.246.717.717 0 0 1 .146-.011h2.484c.024.002.035-.009.036-.033l.003-.038.03-.496c.01-.183.024-.365.034-.548.005-.085.003-.087-.082-.094-.218-.018-.437-.038-.655-.05a17.845 17.845 0 0 0-.657-.026 72.994 72.994 0 0 0-1.756-.016 1.7 1.7 0 0 0-.471.064 1.286 1.286 0 0 0-.817.655c-.099.196-.149.413-.145.633v3.875c0 .072.003.144.011.216a1.27 1.27 0 0 0 .711 1.029c.228.113.48.167.734.158.757-.005 1.515.002 2.272-.042.274-.016.548-.034.82-.053.03-.002.043-.008.04-.041-.008-.104-.012-.208-.019-.312a69.964 69.964 0 0 1-.05-.768ZM16.14 7.415l-.127-1.075c-.004-.03-.014-.04-.044-.037a13.125 13.125 0 0 1-.998.073c-.336.01-.672.02-1.008.016-.116-.001-.233-.014-.347-.039a.746.746 0 0 1-.45-.262c-.075-.1-.132-.211-.167-.33a3.324 3.324 0 0 1-.126-.773 9.113 9.113 0 0 1-.015-.749c0-.285.022-.57.065-.852.023-.158.066-.312.127-.46a.728.728 0 0 1 .518-.443 1.64 1.64 0 0 1 .397-.048c.628-.001 1.255.003 1.882.05.022.001.033-.006.036-.026l.003-.031.06-.55c.019-.177.036-.355.057-.532.004-.034-.005-.046-.04-.056a5.595 5.595 0 0 0-1.213-.21 10.783 10.783 0 0 0-.708-.02c-.24-.003-.48.01-.719.041a3.477 3.477 0 0 0-.625.14 1.912 1.912 0 0 0-.807.497c-.185.2-.33.433-.424.688a4.311 4.311 0 0 0-.24 1.096c-.031.286-.045.572-.042.86-.006.43.024.86.091 1.286.04.25.104.497.193.734.098.279.26.53.473.734.214.205.473.358.756.446.344.11.702.17 1.063.177a8.505 8.505 0 0 0 1.578-.083 6.11 6.11 0 0 0 .766-.18c.03-.008.047-.023.037-.057a.157.157 0 0 1-.003-.025Z"/><path fill="#AFE229" d="M6.016 6.69a1.592 1.592 0 0 0-.614.21c-.23.132-.422.32-.56.546-.044.072-.287.539-.287.539l-.836 1.528.009.006c.038.025.08.046.123.063.127.046.26.07.395.073.505.023 1.011-.007 1.517-.003.29.009.58.002.869-.022a.886.886 0 0 0 .395-.116.962.962 0 0 0 .312-.286c.056-.083.114-.163.164-.249.24-.408.48-.816.718-1.226.075-.128.148-.257.222-.386l.112-.192a1.07 1.07 0 0 0 .153-.518l-1.304.023s-1.258-.005-1.388.01Z"/><path fill="#771BFF" d="m2.848 9.044.76-1.39.184-.352c-.124-.067-.245-.14-.367-.21-.346-.204-.706-.384-1.045-.6a.984.984 0 0 1-.244-.207c-.108-.134-.136-.294-.144-.46-.021-.409-.002-.818-.009-1.227-.003-.195 0-.39.003-.585.004-.322.153-.553.427-.713l.833-.488c.22-.13.44-.257.662-.385.05-.029.105-.052.158-.077.272-.128.519-.047.76.085l.044.028c.123.06.242.125.358.196.318.178.635.357.952.537.095.056.187.117.275.184.194.144.254.35.266.578.016.284.007.569.006.853-.001.28.004.558 0 .838.592-.003 1.259 0 1.259 0l.723-.013c-.003-.292-.007-.584-.007-.876 0-.524.015-1.048-.016-1.571-.024-.42-.135-.8-.492-1.067a5.02 5.02 0 0 0-.506-.339A400.52 400.52 0 0 0 5.94.787C5.722.664 5.513.524 5.282.423 5.255.406 5.228.388 5.2.373 4.758.126 4.305-.026 3.807.21c-.097.046-.197.087-.29.14A699.896 699.896 0 0 0 .783 1.948c-.501.294-.773.717-.778 1.31-.004.36-.009.718-.001 1.077.016.754-.017 1.508.024 2.261.016.304.07.6.269.848.127.15.279.28.448.382.622.4 1.283.734 1.92 1.11l.183.109Z"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h52.4v10H0z"/></clipPath></defs></svg>
|
|
6521
|
+
`,isColorInherited:!1}),n.extendTemplate({attributes:{style:{width:"53px",height:"10px"}}}),this.setTemplate({tag:"div",attributes:{class:["ck","ck-powered-by"],"aria-hidden":!0},children:[{tag:"a",attributes:{href:"https://ckeditor.com/?utm_source=ckeditor&utm_medium=referral&utm_campaign=701Dn000000hVgmIAE_powered_by_ckeditor_logo",target:"_blank",tabindex:"-1"},children:[...t?[{tag:"span",attributes:{class:["ck","ck-powered-by__label"]},children:[t]}]:[],n],on:{dragstart:i.to(r=>r.preventDefault())}}]})}}function $u(o,e,t){return(n,i)=>{const r=n.getVisible();if(!r||n.width<wE||n.height<bE)return zi;let s;s=e.position==="inside"?n.bottom-i.height:n.bottom-i.height/2,s-=e.verticalOffset;const a=t(n,i);if(e.position==="inside"){const l=i.clone().moveTo(a,s);if(l.getIntersectionArea(r)<l.getArea())return zi}else{const l=function(c){let d=c.parentElement;if(!d)return null;for(;d.tagName!="BODY";){const u=d.style.overflowY||oe.window.getComputedStyle(d).overflowY;if(u==="auto"||u==="scroll")break;if(d=d.parentElement,!d)return null}return d}(o);if(l){const c=new De(l);if(r.bottom+i.height/2>c.bottom)return zi}}return{top:s,left:a,name:`position_${e.position}-side_${e.side}`,config:{withArrow:!1}}}}function Hu(o){const e=o.config.get("ui.poweredBy"),t=e&&e.position||"border";return kE({position:t,label:AE,verticalOffset:t==="inside"?5:0,horizontalOffset:5,side:o.locale.contentLanguageDirection==="ltr"?"right":"left"},e)}class vE extends ge(){constructor(e){super(),this.isReady=!1,this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[],this.editor=e,this.componentFactory=new lE(e),this.focusTracker=new dt,this.tooltipManager=new Ni(e),this.poweredBy=new _E(e),this.set("viewportOffset",this._readViewportOffsetFromConfig()),this.once("ready",()=>{this.isReady=!0}),this.listenTo(e.editing.view.document,"layoutChanged",()=>this.update()),this._initFocusTracking()}get element(){return null}update(){this.fire("update")}destroy(){this.stopListening(),this.focusTracker.destroy(),this.tooltipManager.destroy(this.editor),this.poweredBy.destroy();for(const e of this._editableElementsMap.values())e.ckeditorInstance=null,this.editor.keystrokes.stopListening(e);this._editableElementsMap=new Map,this._focusableToolbarDefinitions=[]}setEditableElement(e,t){this._editableElementsMap.set(e,t),t.ckeditorInstance||(t.ckeditorInstance=this.editor),this.focusTracker.add(t);const n=()=>{this.editor.editing.view.getDomRoot(e)||this.editor.keystrokes.listenTo(t)};this.isReady?n():this.once("ready",n)}removeEditableElement(e){const t=this._editableElementsMap.get(e);t&&(this._editableElementsMap.delete(e),this.editor.keystrokes.stopListening(t),this.focusTracker.remove(t),t.ckeditorInstance=null)}getEditableElement(e="main"){return this._editableElementsMap.get(e)}getEditableElementsNames(){return this._editableElementsMap.keys()}addToolbar(e,t={}){e.isRendered?(this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)):e.once("render",()=>{this.focusTracker.add(e.element),this.editor.keystrokes.listenTo(e.element)}),this._focusableToolbarDefinitions.push({toolbarView:e,options:t})}get _editableElements(){return console.warn("editor-ui-deprecated-editable-elements: The EditorUI#_editableElements property has been deprecated and will be removed in the near future.",{editorUI:this}),this._editableElementsMap}_readViewportOffsetFromConfig(){const e=this.editor,t=e.config.get("ui.viewportOffset");if(t)return t;const n=e.config.get("toolbar.viewportTopOffset");return n?(console.warn("editor-ui-deprecated-viewport-offset-config: The `toolbar.vieportTopOffset` configuration option is deprecated. It will be removed from future CKEditor versions. Use `ui.viewportOffset.top` instead."),{top:n}):{top:0}}_initFocusTracking(){const e=this.editor,t=e.editing.view;let n,i;e.keystrokes.set("Alt+F10",(r,s)=>{const a=this.focusTracker.focusedElement;Array.from(this._editableElementsMap.values()).includes(a)&&!Array.from(t.domRoots.values()).includes(a)&&(n=a);const l=this._getCurrentFocusedToolbarDefinition();l&&i||(i=this._getFocusableCandidateToolbarDefinitions());for(let c=0;c<i.length;c++){const d=i.shift();if(i.push(d),d!==l&&this._focusFocusableCandidateToolbar(d)){l&&l.options.afterBlur&&l.options.afterBlur();break}}s()}),e.keystrokes.set("Esc",(r,s)=>{const a=this._getCurrentFocusedToolbarDefinition();a&&(n?(n.focus(),n=null):e.editing.view.focus(),a.options.afterBlur&&a.options.afterBlur(),s())})}_getFocusableCandidateToolbarDefinitions(){const e=[];for(const t of this._focusableToolbarDefinitions){const{toolbarView:n,options:i}=t;(nn(n.element)||i.beforeFocus)&&e.push(t)}return e.sort((t,n)=>qu(t)-qu(n)),e}_getCurrentFocusedToolbarDefinition(){for(const e of this._focusableToolbarDefinitions)if(e.toolbarView.element&&e.toolbarView.element.contains(this.focusTracker.focusedElement))return e;return null}_focusFocusableCandidateToolbar(e){const{toolbarView:t,options:{beforeFocus:n}}=e;return n&&n(),!!nn(t.element)&&(t.focus(),!0)}}function qu(o){const{toolbarView:e,options:t}=o;let n=10;return nn(e.element)&&n--,t.isContextual&&n--,n}var Uu=D(9688),yE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Uu.Z,yE),Uu.Z.locals;class EE extends re{constructor(e){super(e),this.body=new wC(e)}render(){super.render(),this.body.attachToDom()}destroy(){return this.body.detachFromDom(),super.destroy()}}class xE extends EE{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 Yc;return t.text=e("Rich Text Editor"),t.extendTemplate({attributes:{class:"ck-voice-label"}}),t}}class SE extends re{constructor(e,t,n){super(e),this.name=null,this.setTemplate({tag:"div",attributes:{class:["ck","ck-content","ck-editor__editable","ck-rounded-corners"],lang:e.contentLanguage,dir:e.contentLanguageDirection}}),this.set("isFocused",!1),this._editableElement=n,this._hasExternalElement=!!this._editableElement,this._editingView=t}render(){super.render(),this._hasExternalElement?this.template.apply(this.element=this._editableElement):this._editableElement=this.element,this.on("change:isFocused",()=>this._updateIsFocusedClasses()),this._updateIsFocusedClasses()}destroy(){this._hasExternalElement&&this.template.revert(this._editableElement),super.destroy()}get hasExternalElement(){return this._hasExternalElement}_updateIsFocusedClasses(){const e=this._editingView;function t(n){e.change(i=>{const r=e.document.getRoot(n.name);i.addClass(n.isFocused?"ck-focused":"ck-blurred",r),i.removeClass(n.isFocused?"ck-blurred":"ck-focused",r)})}e.isRenderingInProgress?function n(i){e.once("change:isRenderingInProgress",(r,s,a)=>{a?n(i):t(i)})}(this):t(this)}}class DE extends SE{constructor(e,t,n,i={}){super(e,t,n);const r=e.t;this.extendTemplate({attributes:{role:"textbox",class:"ck-editor__editable_inline"}}),this._generateLabel=i.label||(()=>r("Editor editing area: %0",this.name))}render(){super.render();const e=this._editingView;e.change(t=>{const n=e.document.getRoot(this.name);t.setAttribute("aria-label",this._generateLabel(this),n)})}}var Wu=D(8847),BE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Wu.Z,BE),Wu.Z.locals;class Ku extends ui{static get pluginName(){return"Notification"}init(){this.on("show:warning",(e,t)=>{window.alert(t.message)},{priority:"lowest"})}showSuccess(e,t={}){this._showNotification({message:e,type:"success",namespace:t.namespace,title:t.title})}showInfo(e,t={}){this._showNotification({message:e,type:"info",namespace:t.namespace,title:t.title})}showWarning(e,t={}){this._showNotification({message:e,type:"warning",namespace:t.namespace,title:t.title})}_showNotification(e){const t=e.namespace?`show:${e.type}:${e.namespace}`:`show:${e.type}`;this.fire(t,{message:e.message,type:e.type,title:e.title||""})}}class Ys extends ge(){constructor(e,t){super(),t&&Wd(this,t),e&&this.set(e)}}var Gu=D(4650),TE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Gu.Z,TE),Gu.Z.locals;var Zu=D(7676),IE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Zu.Z,IE),Zu.Z.locals;const Mi=jr("px");class Fi extends q{constructor(e){super(e),this._viewToStack=new Map,this._idToStack=new Map,this._view=null,this._rotatorView=null,this._fakePanelsView=null,this.positionLimiter=()=>{const t=this.editor.editing.view,n=t.document.selection.editableElement;return n?t.domConverter.mapViewToDom(n.root):null},this.set("visibleView",null),this.set("_numberOfStacks",0),this.set("_singleViewMode",!1)}static get pluginName(){return"ContextualBalloon"}destroy(){super.destroy(),this._view&&this._view.destroy(),this._rotatorView&&this._rotatorView.destroy(),this._fakePanelsView&&this._fakePanelsView.destroy()}get view(){return this._view||this._createPanelView(),this._view}hasView(e){return Array.from(this._viewToStack.keys()).includes(e)}add(e){if(this._view||this._createPanelView(),this.hasView(e.view))throw new I("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 n=this._idToStack.get(t);e.singleViewMode&&this.showStack(t),n.set(e.view,e),this._viewToStack.set(e.view,n),n===this._visibleStack&&this._showView(e)}remove(e){if(!this.hasView(e))throw new I("contextualballoon-remove-view-not-exist",[this,e]);const t=this._viewToStack.get(e);this._singleViewMode&&this.visibleView===e&&(this._singleViewMode=!1),this.visibleView===e&&(t.size===1?this._idToStack.size>1?this._showNextStack():(this.view.hide(),this.visibleView=null,this._rotatorView.hideView()):this._showView(Array.from(t.values())[t.size-2])),t.size===1?(this._idToStack.delete(this._getStackId(t)),this._numberOfStacks=this._idToStack.size):t.delete(e),this._viewToStack.delete(e)}updatePosition(e){e&&(this._visibleStack.get(this.visibleView).position=e),this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition()}showStack(e){this.visibleStack=e;const t=this._idToStack.get(e);if(!t)throw new I("contextualballoon-showstack-stack-not-exist",this);this._visibleStack!==t&&this._showView(Array.from(t.values()).pop())}_createPanelView(){this._view=new Ye(this.editor.locale),this.editor.ui.view.body.add(this._view),this.editor.ui.focusTracker.add(this._view.element),this._rotatorView=this._createRotatorView(),this._fakePanelsView=this._createFakePanelsView()}get _visibleStack(){return this._viewToStack.get(this.visibleView)}_getStackId(e){return Array.from(this._idToStack.entries()).find(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 PE(this.editor.locale),t=this.editor.locale.t;return this.view.content.add(e),e.bind("isNavigationVisible").to(this,"_numberOfStacks",this,"_singleViewMode",(n,i)=>!i&&n>1),e.on("change:isNavigationVisible",()=>this.updatePosition(),{priority:"low"}),e.bind("counter").to(this,"visibleView",this,"_numberOfStacks",(n,i)=>{if(i<2)return"";const r=Array.from(this._idToStack.values()).indexOf(this._visibleStack)+1;return t("%0 of %1",[r,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 RE(this.editor.locale,this.view);return e.bind("numberOfPanels").to(this,"_numberOfStacks",this,"_singleViewMode",(t,n)=>!n&&t>=2?Math.min(t-1,2):0),e.listenTo(this.view,"change:top",()=>e.updatePosition()),e.listenTo(this.view,"change:left",()=>e.updatePosition()),this.editor.ui.view.body.add(e),e}_showView({view:e,balloonClassName:t="",withArrow:n=!0,singleViewMode:i=!1}){this.view.class=t,this.view.withArrow=n,this._rotatorView.showView(e),this.visibleView=e,this.view.pin(this._getBalloonPosition()),this._fakePanelsView.updatePosition(),i&&(this._singleViewMode=!0)}_getBalloonPosition(){let e=Array.from(this._visibleStack.values()).pop().position;return e&&(e.limiter||(e=Object.assign({},e,{limiter:this.positionLimiter})),e=Object.assign({},e,{viewportOffsetConfig:this.editor.ui.viewportOffset})),e}}class PE extends re{constructor(e){super(e);const t=e.t,n=this.bindTemplate;this.set("isNavigationVisible",!0),this.focusTracker=new dt,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",n.to("isNavigationVisible",i=>i?"":"ck-hidden")]},children:[this.buttonPrevView,{tag:"span",attributes:{class:["ck-balloon-rotator__counter"]},children:[{text:n.to("counter")}]},this.buttonNextView]},{tag:"div",attributes:{class:"ck-balloon-rotator__content"},children:this.content}]})}render(){super.render(),this.focusTracker.add(this.element)}destroy(){super.destroy(),this.focusTracker.destroy()}showView(e){this.hideView(),this.content.add(e)}hideView(){this.content.clear()}_createButtonView(e,t){const n=new Ae(this.locale);return n.set({label:e,icon:t,tooltip:!0}),n}}class RE extends re{constructor(e,t){super(e);const n=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",n.to("numberOfPanels",i=>i?"":"ck-hidden")],style:{top:n.to("top",Mi),left:n.to("left",Mi),width:n.to("width",Mi),height:n.to("height",Mi)}},children:this.content}),this.on("change:numberOfPanels",(i,r,s,a)=>{s>a?this._addPanels(s-a):this._removePanels(a-s),this.updatePosition()})}_addPanels(e){for(;e--;){const t=new re;t.setTemplate({tag:"div"}),this.content.add(t),this.registerChild(t)}}_removePanels(e){for(;e--;){const t=this.content.last;this.content.remove(t),this.deregisterChild(t),t.destroy()}}updatePosition(){if(this.numberOfPanels){const{top:e,left:t}=this._balloonPanelView,{width:n,height:i}=new De(this._balloonPanelView.element);Object.assign(this,{top:e,left:t,width:n,height:i})}}}var Ju=D(5868),OE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Ju.Z,OE),Ju.Z.locals;const Ro=jr("px");class NE extends re{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 kt({tag:"div",attributes:{class:["ck","ck-sticky-panel__placeholder"],style:{display:t.to("isSticky",n=>n?"block":"none"),height:t.to("isSticky",n=>n?Ro(this._panelRect.height):null)}}}).render(),this._contentPanel=new kt({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",n=>n?Ro(this._contentPanelPlaceholder.getBoundingClientRect().width):null),top:t.to("_hasViewportTopOffset",n=>n?Ro(this.viewportTopOffset):null),bottom:t.to("_isStickyToTheLimiter",n=>n?Ro(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(oe.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:Ro(-oe.window.scrollX)):(this._isStickyToTheLimiter=!1,this._hasViewportTopOffset=!1,this._marginLeft=null)}}var Yu=D(9695),zE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Yu.Z,zE),Yu.Z.locals;class ME extends vE{constructor(e,t){super(e),this.view=t,this._toolbarConfig=rd(e.config.get("toolbar")),this._elementReplacer=new Cl}get element(){return this.view.element}init(e){const t=this.editor,n=this.view,i=t.editing.view,r=n.editable,s=i.document.getRoot();r.name=s.rootName,n.render();const a=r.element;this.setEditableElement(r.name,a),n.editable.bind("isFocused").to(this.focusTracker),i.attachDomRoot(a),e&&this._elementReplacer.replace(e,this.element),this._initPlaceholder(),this._initToolbar(),this.fire("ready")}destroy(){super.destroy();const e=this.view,t=this.editor.editing.view;this._elementReplacer.restore(),t.detachDomRoot(e.editable.name),e.destroy()}_initToolbar(){const e=this.view;e.stickyPanel.bind("isActive").to(this.focusTracker,"isFocused"),e.stickyPanel.limiterElement=e.element,e.stickyPanel.bind("viewportTopOffset").to(this,"viewportOffset",({top:t})=>t||0),e.toolbar.fillFromConfig(this._toolbarConfig,this.componentFactory),this.addToolbar(e.toolbar)}_initPlaceholder(){const e=this.editor,t=e.editing.view,n=t.document.getRoot(),i=e.sourceElement;let r;const s=e.config.get("placeholder");s&&(r=typeof s=="string"?s:s[this.view.editable.name]),!r&&i&&i.tagName.toLowerCase()==="textarea"&&(r=i.getAttribute("placeholder")),r&&function({view:a,element:l,text:c,isDirectHost:d=!0,keepOnFocus:u=!1}){const g=a.document;mi.has(g)||(mi.set(g,new Map),g.registerPostFixer(f=>Xr(g,f)),g.on("change:isComposing",()=>{a.change(f=>Xr(g,f))},{priority:"high"})),mi.get(g).set(l,{text:c,isDirectHost:d,keepOnFocus:u,hostElement:d?l:null}),a.change(f=>Xr(g,f))}({view:t,element:n,text:r,isDirectHost:!1,keepOnFocus:!0})}}var Qu=D(3143),FE={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Qu.Z,FE),Qu.Z.locals;class VE extends xE{constructor(e,t,n={}){super(e),this.stickyPanel=new NE(e),this.toolbar=new Ms(e,{shouldGroupWhenFull:n.shouldToolbarGroupWhenFull}),this.editable=new DE(e,t)}render(){super.render(),this.stickyPanel.content.add(this.toolbar),this.top.add(this.stickyPanel),this.main.add(this.editable)}}class Xu{constructor(e){if(this.crashes=[],this.state="initializing",this._now=Date.now,this.crashes=[],this._crashNumberLimit=typeof e.crashNumberLimit=="number"?e.crashNumberLimit:3,this._minimumNonErrorTimePeriod=typeof e.minimumNonErrorTimePeriod=="number"?e.minimumNonErrorTimePeriod:5e3,this._boundErrorHandler=t=>{const n="error"in t?t.error:t.reason;n instanceof Error&&this._handleError(n,t)},this._listeners={},!this._restart)throw new Error("The Watchdog class was split into the abstract `Watchdog` class and the `EditorWatchdog` class. Please, use `EditorWatchdog` if you have used the `Watchdog` class previously.")}destroy(){this._stopErrorHandling(),this._listeners={}}on(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)}off(e,t){this._listeners[e]=this._listeners[e].filter(n=>n!==t)}_fire(e,...t){const n=this._listeners[e]||[];for(const i of n)i.apply(this,[null,...t])}_startErrorHandling(){window.addEventListener("error",this._boundErrorHandler),window.addEventListener("unhandledrejection",this._boundErrorHandler)}_stopErrorHandling(){window.removeEventListener("error",this._boundErrorHandler),window.removeEventListener("unhandledrejection",this._boundErrorHandler)}_handleError(e,t){if(this._shouldReactToError(e)){this.crashes.push({message:e.message,stack:e.stack,filename:t instanceof ErrorEvent?t.filename:void 0,lineno:t instanceof ErrorEvent?t.lineno:void 0,colno:t instanceof ErrorEvent?t.colno:void 0,date:this._now()});const n=this._shouldRestart();this.state="crashed",this._fire("stateChange"),this._fire("error",{error:e,causesRestart:n}),n?this._restart():(this.state="crashedPermanently",this._fire("stateChange"))}}_shouldReactToError(e){return e.is&&e.is("CKEditorError")&&e.context!==void 0&&e.context!==null&&this.state==="ready"&&this._isErrorComingFromThisItem(e)}_shouldRestart(){return this.crashes.length<=this._crashNumberLimit?!0:(this.crashes[this.crashes.length-1].date-this.crashes[this.crashes.length-1-this._crashNumberLimit].date)/this._crashNumberLimit>this._minimumNonErrorTimePeriod}}function Qs(o,e=new Set){const t=[o],n=new Set;let i=0;for(;t.length>i;){const r=t[i++];if(!n.has(r)&&LE(r)&&!e.has(r))if(n.add(r),Symbol.iterator in r)try{for(const s of r)t.push(s)}catch{}else for(const s in r)s!=="defaultValue"&&t.push(r[s])}return n}function LE(o){const e=Object.prototype.toString.call(o),t=typeof o;return!(t==="number"||t==="boolean"||t==="string"||t==="symbol"||t==="function"||e==="[object Date]"||e==="[object RegExp]"||e==="[object Module]"||o==null||o._watchdogExcluded||o instanceof EventTarget||o instanceof Event)}function em(o,e,t=new Set){if(o===e&&typeof(n=o)=="object"&&n!==null)return!0;var n;const i=Qs(o,t),r=Qs(e,t);for(const s of i)if(r.has(s))return!0;return!1}class tm extends Xu{constructor(e,t={}){super(t),this._editor=null,this._throttledSave=Js(this._save.bind(this),typeof t.saveInterval=="number"?t.saveInterval:5e3),e&&(this._creator=(n,i)=>e.create(n,i)),this._destructor=n=>n.destroy()}get editor(){return this._editor}get _item(){return this._editor}setCreator(e){this._creator=e}setDestructor(e){this._destructor=e}_restart(){return Promise.resolve().then(()=>(this.state="initializing",this._fire("stateChange"),this._destroy())).catch(e=>{console.error("An error happened during the editor destroying.",e)}).then(()=>{if(typeof this._elementOrData=="string")return this.create(this._data,this._config,this._config.context);{const e=Object.assign({},this._config,{initialData:this._data});return this.create(this._elementOrData,e,e.context)}}).then(()=>{this._fire("restart")})}create(e=this._elementOrData,t=this._config,n){return Promise.resolve().then(()=>(super._startErrorHandling(),this._elementOrData=e,this._config=this._cloneEditorConfiguration(t)||{},this._config.context=n,this._creator(e,this._config))).then(i=>{this._editor=i,i.model.document.on("change:data",this._throttledSave),this._lastDocumentVersion=i.model.document.version,this._data=this._getData(),this.state="ready",this._fire("stateChange")})}destroy(){return Promise.resolve().then(()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling(),this._throttledSave.flush();const e=this._editor;return this._editor=null,e.model.document.off("change:data",this._throttledSave),this._destructor(e)})}_save(){const e=this._editor.model.document.version;try{this._data=this._getData(),this._lastDocumentVersion=e}catch(t){console.error(t,"An error happened during restoring editor data. Editor will be restored from the previously saved data.")}}_setExcludedProperties(e){this._excludedProps=e}_getData(){const e={};for(const t of this._editor.model.document.getRootNames())e[t]=this._editor.data.get({rootName:t});return e}_isErrorComingFromThisItem(e){return em(this._editor,e.context,this._excludedProps)}_cloneEditorConfiguration(e){return Vr(e,(t,n)=>Rn(t)||n==="context"?t:void 0)}}const Oo=Symbol("MainQueueId");class jE{constructor(){this._onEmptyCallbacks=[],this._queues=new Map,this._activeActions=0}onEmpty(e){this._onEmptyCallbacks.push(e)}enqueue(e,t){const n=e===Oo;this._activeActions++,this._queues.get(e)||this._queues.set(e,Promise.resolve());const i=(n?Promise.all(this._queues.values()):Promise.all([this._queues.get(Oo),this._queues.get(e)])).then(t),r=i.catch(()=>{});return this._queues.set(e,r),i.finally(()=>{this._activeActions--,this._queues.get(e)===r&&this._activeActions===0&&this._onEmptyCallbacks.forEach(s=>s())})}}function nm(o){return Array.isArray(o)?o:[o]}class Vi extends Ti(zs(L1)){constructor(e,t={}){if(!Li(e)&&t.initialData!==void 0)throw new I("editor-create-initial-data",null);super(t),this.config.get("initialData")===void 0&&this.config.set("initialData",function(r){return Li(r)?(s=r,s instanceof HTMLTextAreaElement?s.value:s.innerHTML):r;var s}(e)),Li(e)&&(this.sourceElement=e),this.model.document.createRoot();const n=!this.config.get("toolbar.shouldNotGroupWhenFull"),i=new VE(this.locale,this.editing.view,{shouldToolbarGroupWhenFull:n});this.ui=new ME(this,i),function(r){if(!Qt(r.updateSourceElement))throw new I("attachtoform-missing-elementapi-interface",r);const s=r.sourceElement;if(function(a){return!!a&&a.tagName.toLowerCase()==="textarea"}(s)&&s.form){let a;const l=s.form,c=()=>r.updateSourceElement();Qt(l.submit)&&(a=l.submit,l.submit=()=>{c(),a.apply(l)}),l.addEventListener("submit",c),r.on("destroy",()=>{l.removeEventListener("submit",c),a&&(l.submit=a)})}}(this)}destroy(){return this.sourceElement&&this.updateSourceElement(),this.ui.destroy(),super.destroy()}static create(e,t={}){return new Promise(n=>{const i=new this(e,t);n(i.initPlugins().then(()=>i.ui.init(Li(e)?e:null)).then(()=>i.data.init(i.config.get("initialData"))).then(()=>i.fire("ready")).then(()=>i))})}}function Li(o){return Rn(o)}Vi.Context=dd,Vi.EditorWatchdog=tm,Vi.ContextWatchdog=class extends Xu{constructor(o,e={}){super(e),this._watchdogs=new Map,this._context=null,this._contextProps=new Set,this._actionQueues=new jE,this._watchdogConfig=e,this._creator=t=>o.create(t),this._destructor=t=>t.destroy(),this._actionQueues.onEmpty(()=>{this.state==="initializing"&&(this.state="ready",this._fire("stateChange"))})}setCreator(o){this._creator=o}setDestructor(o){this._destructor=o}get context(){return this._context}create(o={}){return this._actionQueues.enqueue(Oo,()=>(this._contextConfig=o,this._create()))}getItem(o){return this._getWatchdog(o)._item}getItemState(o){return this._getWatchdog(o).state}add(o){const e=nm(o);return Promise.all(e.map(t=>this._actionQueues.enqueue(t.id,()=>{if(this.state==="destroyed")throw new Error("Cannot add items to destroyed watchdog.");if(!this._context)throw new Error("Context was not created yet. You should call the `ContextWatchdog#create()` method first.");let n;if(this._watchdogs.has(t.id))throw new Error(`Item with the given id is already added: '${t.id}'.`);if(t.type==="editor")return n=new tm(null,this._watchdogConfig),n.setCreator(t.creator),n._setExcludedProperties(this._contextProps),t.destructor&&n.setDestructor(t.destructor),this._watchdogs.set(t.id,n),n.on("error",(i,{error:r,causesRestart:s})=>{this._fire("itemError",{itemId:t.id,error:r}),s&&this._actionQueues.enqueue(t.id,()=>new Promise(a=>{const l=()=>{n.off("restart",l),this._fire("itemRestart",{itemId:t.id}),a()};n.on("restart",l)}))}),n.create(t.sourceElementOrData,t.config,this._context);throw new Error(`Not supported item type: '${t.type}'.`)})))}remove(o){const e=nm(o);return Promise.all(e.map(t=>this._actionQueues.enqueue(t,()=>{const n=this._getWatchdog(t);return this._watchdogs.delete(t),n.destroy()})))}destroy(){return this._actionQueues.enqueue(Oo,()=>(this.state="destroyed",this._fire("stateChange"),super.destroy(),this._destroy()))}_restart(){return this._actionQueues.enqueue(Oo,()=>(this.state="initializing",this._fire("stateChange"),this._destroy().catch(o=>{console.error("An error happened during destroying the context or items.",o)}).then(()=>this._create()).then(()=>this._fire("restart"))))}_create(){return Promise.resolve().then(()=>(this._startErrorHandling(),this._creator(this._contextConfig))).then(o=>(this._context=o,this._contextProps=Qs(this._context),Promise.all(Array.from(this._watchdogs.values()).map(e=>(e._setExcludedProperties(this._contextProps),e.create(void 0,void 0,this._context))))))}_destroy(){return Promise.resolve().then(()=>{this._stopErrorHandling();const o=this._context;return this._context=null,this._contextProps=new Set,Promise.all(Array.from(this._watchdogs.values()).map(e=>e.destroy())).then(()=>this._destructor(o))})}_getWatchdog(o){const e=this._watchdogs.get(o);if(!e)throw new Error(`Item with the given id was not registered: ${o}.`);return e}_isErrorComingFromThisItem(o){for(const e of this._watchdogs.values())if(e._isErrorComingFromThisItem(o))return!1;return em(this._context,o.context)}};class Xs extends $t{constructor(e){super(e),this.domEventType=["paste","copy","cut","drop","dragover","dragstart","dragend","dragenter","dragleave"];const t=this.document;function n(i){return(r,s)=>{s.preventDefault();const a=s.dropRange?[s.dropRange]:null,l=new $(t,i);t.fire(l,{dataTransfer:s.dataTransfer,method:r.name,targetRanges:a,target:s.target,domEvent:s.domEvent}),l.stop.called&&s.stopPropagation()}}this.listenTo(t,"paste",n("clipboardInput"),{priority:"low"}),this.listenTo(t,"drop",n("clipboardInput"),{priority:"low"}),this.listenTo(t,"dragover",n("dragging"),{priority:"low"})}onDomEvent(e){const t="clipboardData"in e?e.clipboardData:e.dataTransfer,n=e.type=="drop"||e.type=="paste",i={dataTransfer:new th(t,{cacheFiles:n})};e.type!="drop"&&e.type!="dragover"||(i.dropRange=function(r,s){const a=s.target.ownerDocument,l=s.clientX,c=s.clientY;let d;return a.caretRangeFromPoint&&a.caretRangeFromPoint(l,c)?d=a.caretRangeFromPoint(l,c):s.rangeParent&&(d=a.createRange(),d.setStart(s.rangeParent,s.rangeOffset),d.collapse(!0)),d?r.domConverter.domRangeToView(d):null}(this.view,e)),this.fire(e.type,e,i)}}const om=["figcaption","li"];function im(o){let e="";if(o.is("$text")||o.is("$textProxy"))e=o.data;else if(o.is("element","img")&&o.hasAttribute("alt"))e=o.getAttribute("alt");else if(o.is("element","br"))e=`
|
|
6522
6522
|
`;else{let t=null;for(const n of o.getChildren()){const i=im(n);t&&(t.is("containerElement")||n.is("containerElement"))&&(om.includes(t.name)||om.includes(n.name)?e+=`
|
|
6523
6523
|
`:e+=`
|
|
6524
6524
|
|
|
6525
|
-
`),e+=i,t=n}}return e}class Rt extends q{static get pluginName(){return"ClipboardPipeline"}init(){this.editor.editing.view.addObserver(Xs),this._setupPasteDrop(),this._setupCopyCut()}_setupPasteDrop(){const e=this.editor,t=e.model,n=e.editing.view,i=n.document;this.listenTo(i,"clipboardInput",(r,s)=>{s.method!="paste"||e.model.canEditAt(e.model.document.selection)||r.stop()},{priority:"highest"}),this.listenTo(i,"clipboardInput",(r,s)=>{const a=s.dataTransfer;let l;if(s.content)l=s.content;else{let u="";a.getData("text/html")?u=function(g){return g.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(f,b)=>b.length==1?" ":b).replace(/<!--[\s\S]*?-->/g,"")}(a.getData("text/html")):a.getData("text/plain")&&(((c=(c=a.getData("text/plain")).replace(/</g,"<").replace(/>/g,">").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("</p><p>")||c.includes("<br>"))&&(c=`<p>${c}</p>`),u=c),l=this.editor.data.htmlProcessor.toView(u)}var c;const d=new $(this,"inputTransformation");this.fire(d,{content:l,dataTransfer:a,targetRanges:s.targetRanges,method:s.method}),d.stop.called&&r.stop(),n.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(r,s)=>{if(s.content.isEmpty)return;const a=this.editor.data.toModel(s.content,"$clipboardHolder");a.childCount!=0&&(r.stop(),t.change(()=>{this.fire("contentInsertion",{content:a,method:s.method,dataTransfer:s.dataTransfer,targetRanges:s.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(r,s)=>{s.resultRange=t.insertContent(s.content)},{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,n=e.editing.view.document,i=(r,s)=>{const a=s.dataTransfer;s.preventDefault();const l=e.data.toView(e.model.getSelectedContent(t.selection));n.fire("clipboardOutput",{dataTransfer:a,content:l,method:r.name})};this.listenTo(n,"copy",i,{priority:"low"}),this.listenTo(n,"cut",(r,s)=>{e.model.canEditAt(e.model.document.selection)?i(r,s):s.preventDefault()},{priority:"low"}),this.listenTo(n,"clipboardOutput",(r,s)=>{s.content.isEmpty||(s.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(s.content)),s.dataTransfer.setData("text/plain",im(s.content))),s.method=="cut"&&e.model.deleteContent(t.selection)},{priority:"low"})}}class rm{constructor(e,t=20){this._batch=null,this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(n,i)=>{i.isLocal&&i.isUndoable&&i!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e=!1){this.isLocked&&!e||(this._batch=null,this._size=0)}}class GE extends ne{constructor(e,t){super(e),this._buffer=new rm(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,n=t.document,i=e.text||"",r=i.length;let s=n.selection;if(e.selection?s=e.selection:e.range&&(s=t.createSelection(e.range)),!t.canEditAt(s))return;const a=e.resultRange;t.enqueueChange(this._buffer.batch,l=>{this._buffer.lock(),t.deleteContent(s),i&&t.insertContent(l.createText(i,n.selection.getAttributes()),s),a?l.setSelection(a):s.is("documentSelection")||l.setSelection(s),this._buffer.unlock(),this._buffer.input(r)})}}const sm=["insertText","insertReplacementText"];class ZE extends Ct{constructor(e){super(e),k.isAndroid&&sm.push("insertCompositionText");const t=e.document;t.on("beforeinput",(n,i)=>{if(!this.isEnabled)return;const{data:r,targetRanges:s,inputType:a,domEvent:l}=i;if(!sm.includes(a))return;const c=new $(t,"insertText");t.fire(c,new Ln(e,l,{text:r,selection:e.createSelection(s)})),c.stop.called&&n.stop()}),t.on("compositionend",(n,{data:i,domEvent:r})=>{this.isEnabled&&!k.isAndroid&&i&&t.fire("insertText",new Ln(e,r,{text:i,selection:t.selection}))},{priority:"lowest"})}observe(){}stopObserving(){}}class am extends q{static get pluginName(){return"Input"}init(){const e=this.editor,t=e.model,n=e.editing.view,i=t.document.selection;n.addObserver(ZE);const r=new GE(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",r),e.commands.add("input",r),this.listenTo(n.document,"insertText",(s,a)=>{n.document.isComposing||a.preventDefault();const{text:l,selection:c,resultRange:d}=a,u=Array.from(c.getRanges()).map(b=>e.editing.mapper.toModelRange(b));let g=l;if(k.isAndroid){const b=Array.from(u[0].getItems()).reduce((A,E)=>A+(E.is("$textProxy")?E.data:""),"");b&&(b.length<=g.length?g.startsWith(b)&&(g=g.substring(b.length),u[0].start=u[0].start.getShiftedBy(b.length)):b.startsWith(g)&&(u[0].start=u[0].start.getShiftedBy(g.length),g=""))}const f={text:g,selection:t.createSelection(u)};d&&(f.resultRange=e.editing.mapper.toModelRange(d)),e.execute("insertText",f)}),k.isAndroid?this.listenTo(n.document,"keydown",(s,a)=>{!i.isCollapsed&&a.keyCode==229&&n.document.isComposing&&lm(t,r)}):this.listenTo(n.document,"compositionstart",()=>{i.isCollapsed||lm(t,r)})}}function lm(o,e){if(!e.isEnabled)return;const t=e.buffer;t.lock(),o.enqueueChange(t.batch,()=>{o.deleteContent(o.document.selection)}),t.unlock()}class cm extends ne{constructor(e,t){super(e),this.direction=t,this._buffer=new rm(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,n=t.document;t.enqueueChange(this._buffer.batch,i=>{this._buffer.lock();const r=i.createSelection(e.selection||n.selection);if(!t.canEditAt(r))return;const s=e.sequence||1,a=r.isCollapsed;if(r.isCollapsed&&t.modifySelection(r,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(s))return void this._replaceEntireContentWithParagraph(i);if(this._shouldReplaceFirstBlockWithParagraph(r,s))return void this.editor.execute("paragraph",{selection:r});if(r.isCollapsed)return;let l=0;r.getFirstRange().getMinimalFlatRanges().forEach(c=>{l+=kr(c.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(r,{doNotResetEntireContent:a,direction:this.direction}),this._buffer.input(l),i.setSelection(r),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,n=t.document.selection,i=t.schema.getLimitElement(n);if(!(n.isCollapsed&&n.containsEntireContent(i))||!t.schema.checkChild(i,"paragraph"))return!1;const r=i.getChild(0);return!r||!r.is("element","paragraph")}_replaceEntireContentWithParagraph(e){const t=this.editor.model,n=t.document.selection,i=t.schema.getLimitElement(n),r=e.createElement("paragraph");e.remove(e.createRangeIn(i)),e.insert(r,i),e.setSelection(r,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const n=this.editor.model;if(t>1||this.direction!="backward"||!e.isCollapsed)return!1;const i=e.getFirstPosition(),r=n.schema.getLimitElement(i),s=r.getChild(0);return i.parent==s&&!!e.containsEntireContent(s)&&!!n.schema.checkChild(r,"paragraph")&&s.name!="paragraph"}}const dm="word",Ut="selection",Un="backward",No="forward",hm={deleteContent:{unit:Ut,direction:Un},deleteContentBackward:{unit:"codePoint",direction:Un},deleteWordBackward:{unit:dm,direction:Un},deleteHardLineBackward:{unit:Ut,direction:Un},deleteSoftLineBackward:{unit:Ut,direction:Un},deleteContentForward:{unit:"character",direction:No},deleteWordForward:{unit:dm,direction:No},deleteHardLineForward:{unit:Ut,direction:No},deleteSoftLineForward:{unit:Ut,direction:No}};class JE extends Ct{constructor(e){super(e);const t=e.document;let n=0;t.on("keydown",()=>{n++}),t.on("keyup",()=>{n=0}),t.on("beforeinput",(i,r)=>{if(!this.isEnabled)return;const{targetRanges:s,domEvent:a,inputType:l}=r,c=hm[l];if(!c)return;const d={direction:c.direction,unit:c.unit,sequence:n};d.unit==Ut&&(d.selectionToRemove=e.createSelection(s[0])),l==="deleteContentBackward"&&(k.isAndroid&&(d.sequence=1),function(g){if(g.length!=1||g[0].isCollapsed)return!1;const f=g[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let b=0;for(const{nextPosition:A}of f){if(A.parent.is("$text")){const E=A.parent.data,P=A.offset;if(Wr(E,P)||Kr(E,P)||Rc(E,P))continue;b++}else b++;if(b>1)return!0}return!1}(s)&&(d.unit=Ut,d.selectionToRemove=e.createSelection(s)));const u=new Fn(t,"delete",s[0]);t.fire(u,new Ln(e,a,d)),u.stop.called&&i.stop()}),k.isBlink&&function(i){const r=i.view,s=r.document;let a=null,l=!1;function c(u){return u==se.backspace||u==se.delete}function d(u){return u==se.backspace?Un:No}s.on("keydown",(u,{keyCode:g})=>{a=g,l=!1}),s.on("keyup",(u,{keyCode:g,domEvent:f})=>{const b=s.selection,A=i.isEnabled&&g==a&&c(g)&&!b.isCollapsed&&!l;if(a=null,A){const E=b.getFirstRange(),P=new Fn(s,"delete",E),z={unit:Ut,direction:d(g),selectionToRemove:b};s.fire(P,new Ln(r,f,z))}}),s.on("beforeinput",(u,{inputType:g})=>{const f=hm[g];c(a)&&f&&f.direction==d(a)&&(l=!0)},{priority:"high"}),s.on("beforeinput",(u,{inputType:g,data:f})=>{a==se.delete&&g=="insertText"&&f==""&&u.stop()},{priority:"high"})}(this)}observe(){}stopObserving(){}}class Wn extends q{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,n=t.document,i=e.model.document;t.addObserver(JE),this._undoOnBackspace=!1;const r=new cm(e,"forward");e.commands.add("deleteForward",r),e.commands.add("forwardDelete",r),e.commands.add("delete",new cm(e,"backward")),this.listenTo(n,"delete",(s,a)=>{n.isComposing||a.preventDefault();const{direction:l,sequence:c,selectionToRemove:d,unit:u}=a,g=l==="forward"?"deleteForward":"delete",f={sequence:c};if(u=="selection"){const b=Array.from(d.getRanges()).map(A=>e.editing.mapper.toModelRange(A));f.selection=e.model.createSelection(b)}else f.unit=u;e.execute(g,f),t.scrollToTheSelection()},{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",(s,a)=>{this._undoOnBackspace&&a.direction=="backward"&&a.sequence==1&&a.unit=="codePoint"&&(this._undoOnBackspace=!1,e.execute("undo"),a.preventDefault(),s.stop())},{context:"$capture"}),this.listenTo(i,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class YE extends q{static get requires(){return[am,Wn]}static get pluginName(){return"Typing"}}function um(o,e){let t=o.start;return{text:Array.from(o.getItems()).reduce((n,i)=>i.is("$text")||i.is("$textProxy")?n+i.data:(t=e.createPositionAfter(i),""),""),range:e.createRange(t,o.end)}}class mm extends ge(){constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",(t,{directChange:n})=>{n&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1))}),this.listenTo(e,"change:data",(t,n)=>{!n.isUndo&&n.isLocal&&this._evaluateTextBeforeSelection("data",{batch:n})})}_evaluateTextBeforeSelection(e,t={}){const n=this.model,i=n.document.selection,r=n.createRange(n.createPositionAt(i.focus.parent,0),i.focus),{text:s,range:a}=um(r,n),l=this.testCallback(s);if(!l&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!l,l){const c=Object.assign(t,{text:s,range:a});typeof l=="object"&&Object.assign(c,l),this.fire(`matched:${e}`,c)}}}class gm extends q{constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}static get pluginName(){return"TwoStepCaretMovement"}init(){const e=this.editor,t=e.model,n=e.editing.view,i=e.locale,r=t.document.selection;this.listenTo(n.document,"arrowKey",(s,a)=>{if(!r.isCollapsed||a.shiftKey||a.altKey||a.ctrlKey)return;const l=a.keyCode==se.arrowright,c=a.keyCode==se.arrowleft;if(!l&&!c)return;const d=i.contentLanguageDirection;let u=!1;u=d==="ltr"&&l||d==="rtl"&&c?this._handleForwardMovement(a):this._handleBackwardMovement(a),u===!0&&s.stop()},{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(r,"change:range",(s,a)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!a.directChange&&$i(r.getFirstPosition(),this.attributes)||this._restoreGravity())})}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,n=this.editor.model.document.selection,i=n.getFirstPosition();return!this._isGravityOverridden&&(!i.isAtStart||!ea(n,t))&&!!$i(i,t)&&(ji(e),this._overrideGravity(),!0)}_handleBackwardMovement(e){const t=this.attributes,n=this.editor.model,i=n.document.selection,r=i.getFirstPosition();return this._isGravityOverridden?(ji(e),this._restoreGravity(),ta(n,t,r),!0):r.isAtStart?!!ea(i,t)&&(ji(e),ta(n,t,r),!0):!!function(s,a){const l=s.getShiftedBy(-1);return $i(l,a)}(r,t)&&(r.isAtEnd&&!ea(i,t)&&$i(r,t)?(ji(e),ta(n,t,r),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1))}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 ea(o,e){for(const t of e)if(o.hasAttribute(t))return!0;return!1}function ta(o,e,t){const n=t.nodeBefore;o.change(i=>{n?i.setSelectionAttribute(n.getAttributes()):i.removeSelectionAttribute(e)})}function ji(o){o.preventDefault()}function $i(o,e){const{nodeBefore:t,nodeAfter:n}=o;for(const i of e){const r=t?t.getAttribute(i):void 0;if((n?n.getAttribute(i):void 0)!==r)return!0}return!1}var pm=/[\\^$.*+?()[\]{}|]/g,QE=RegExp(pm.source);const XE=function(o){return(o=ns(o))&&QE.test(o)?o.replace(pm,"\\$&"):o},fm={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},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:Kn('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:Kn("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:Kn("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:Kn('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:Kn('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:Kn("'"),to:[null,"‚",null,"’"]}},km={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},e2=["symbols","mathematical","typography","quotes"];function t2(o){return typeof o=="string"?new RegExp(`(${XE(o)})$`):o}function n2(o){return typeof o=="string"?()=>[o]:o instanceof Array?()=>o:o}function o2(o){return(o.textNode?o.textNode:o.nodeAfter).getAttributes()}function Kn(o){return new RegExp(`(^|\\s)(${o})([^${o}]*)(${o})$`)}function Gn(o,e,t,n){return n.createRange(bm(o,e,t,!0,n),bm(o,e,t,!1,n))}function bm(o,e,t,n,i){let r=o.textNode||(n?o.nodeBefore:o.nodeAfter),s=null;for(;r&&r.getAttribute(e)==t;)s=r,r=n?r.previousSibling:r.nextSibling;return s?i.createPositionAt(s,n?"before":"after"):o}function*wm(o,e){for(const t of e)t&&o.getAttributeProperties(t[0]).copyOnEnter&&(yield t)}class i2 extends ne{execute(){this.editor.model.change(e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})})}enterBlock(e){const t=this.editor.model,n=t.document.selection,i=t.schema,r=n.isCollapsed,s=n.getFirstRange(),a=s.start.parent,l=s.end.parent;if(i.isLimit(a)||i.isLimit(l))return r||a!=l||t.deleteContent(n),!1;if(r){const c=wm(e.model.schema,n.getAttributes());return Am(e,s.start),e.setSelectionAttribute(c),!0}{const c=!(s.start.isAtStart&&s.end.isAtEnd),d=a==l;if(t.deleteContent(n,{leaveUnmerged:c}),c){if(d)return Am(e,n.focus),!0;e.setSelection(l,0)}}return!1}}function Am(o,e){o.split(e),o.setSelection(e.parent.nextSibling,0)}const r2={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class _m extends Ct{constructor(e){super(e);const t=this.document;let n=!1;t.on("keydown",(i,r)=>{n=r.shiftKey}),t.on("beforeinput",(i,r)=>{if(!this.isEnabled)return;let s=r.inputType;k.isSafari&&n&&s=="insertParagraph"&&(s="insertLineBreak");const a=r.domEvent,l=r2[s];if(!l)return;const c=new Fn(t,"enter",r.targetRanges[0]);t.fire(c,new Ln(e,a,{isSoft:l.isSoft})),c.stop.called&&i.stop()})}observe(){}stopObserving(){}}class zo extends q{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,n=t.document;t.addObserver(_m),e.commands.add("enter",new i2(e)),this.listenTo(n,"enter",(i,r)=>{n.isComposing||r.preventDefault(),r.isSoft||(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"})}}class s2 extends ne{execute(){const e=this.editor.model,t=e.document;e.change(n=>{(function(i,r,s){const a=s.isCollapsed,l=s.getFirstRange(),c=l.start.parent,d=l.end.parent,u=c==d;if(a){const g=wm(i.schema,s.getAttributes());Cm(i,r,l.end),r.removeSelectionAttribute(s.getAttributeKeys()),r.setSelectionAttribute(g)}else{const g=!(l.start.isAtStart&&l.end.isAtEnd);i.deleteContent(s,{leaveUnmerged:g}),u?Cm(i,r,s.focus):g&&r.setSelection(d,0)}})(e,n,t.selection),this.fire("afterExecute",{writer:n})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(n,i){if(i.rangeCount>1)return!1;const r=i.anchor;if(!r||!n.checkChild(r,"softBreak"))return!1;const s=i.getFirstRange(),a=s.start.parent,l=s.end.parent;return!((na(a,n)||na(l,n))&&a!==l)}(e.schema,t.selection)}}function Cm(o,e,t){const n=e.createElement("softBreak");o.insertContent(n,t),e.setSelection(n,"after")}function na(o,e){return!o.is("rootElement")&&(e.isLimit(o)||na(o.parent,e))}class a2 extends q{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,n=e.conversion,i=e.editing.view,r=i.document;t.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(s,{writer:a})=>a.createEmptyElement("br")}),i.addObserver(_m),e.commands.add("shiftEnter",new s2(e)),this.listenTo(r,"enter",(s,a)=>{r.isComposing||a.preventDefault(),a.isSoft&&(e.execute("shiftEnter"),i.scrollToTheSelection())},{priority:"low"})}}class l2 extends me(){constructor(){super(...arguments),this._stack=[]}add(e,t){const n=this._stack,i=n[0];this._insertDescriptor(e);const r=n[0];i===r||oa(i,r)||this.fire("change:top",{oldDescriptor:i,newDescriptor:r,writer:t})}remove(e,t){const n=this._stack,i=n[0];this._removeDescriptor(e);const r=n[0];i===r||oa(i,r)||this.fire("change:top",{oldDescriptor:i,newDescriptor:r,writer:t})}_insertDescriptor(e){const t=this._stack,n=t.findIndex(r=>r.id===e.id);if(oa(e,t[n]))return;n>-1&&t.splice(n,1);let i=0;for(;t[i]&&c2(t[i],e);)i++;t.splice(i,0,e)}_removeDescriptor(e){const t=this._stack,n=t.findIndex(i=>i.id===e);n>-1&&t.splice(n,1)}}function oa(o,e){return o&&e&&o.priority==e.priority&&Hi(o.classes)==Hi(e.classes)}function c2(o,e){return o.priority>e.priority||!(o.priority<e.priority)&&Hi(o.classes)>Hi(e.classes)}function Hi(o){return Array.isArray(o)?o.sort().join(","):o}const d2='<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>',h2="ck-widget",vm="ck-widget_selected";function Be(o){return!!o.is("element")&&!!o.getCustomProperty("widget")}function ia(o,e,t={}){if(!o.is("containerElement"))throw new I("widget-to-widget-wrong-element-type",null,{element:o});return e.setAttribute("contenteditable","false",o),e.addClass(h2,o),e.setCustomProperty("widget",!0,o),o.getFillerOffset=p2,e.setCustomProperty("widgetLabel",[],o),t.label&&function(n,i){n.getCustomProperty("widgetLabel").push(i)}(o,t.label),t.hasSelectionHandle&&function(n,i){const r=i.createUIElement("div",{class:"ck ck-widget__selection-handle"},function(s){const a=this.toDomElement(s),l=new ko;return l.set("content",d2),l.render(),a.appendChild(l.element),a});i.insert(i.createPositionAt(n,0),r),i.addClass(["ck-widget_with-selection-handle"],n)}(o,e),ym(o,e),o}function u2(o,e,t){if(e.classes&&t.addClass(Pe(e.classes),o),e.attributes)for(const n in e.attributes)t.setAttribute(n,e.attributes[n],o)}function m2(o,e,t){if(e.classes&&t.removeClass(Pe(e.classes),o),e.attributes)for(const n in e.attributes)t.removeAttribute(n,o)}function ym(o,e,t=u2,n=m2){const i=new l2;i.on("change:top",(r,s)=>{s.oldDescriptor&&n(o,s.oldDescriptor,s.writer),s.newDescriptor&&t(o,s.newDescriptor,s.writer)}),e.setCustomProperty("addHighlight",(r,s,a)=>i.add(s,a),o),e.setCustomProperty("removeHighlight",(r,s,a)=>i.remove(s,a),o)}function g2(o,e,t={}){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],o),e.setAttribute("role","textbox",o),t.label&&e.setAttribute("aria-label",t.label,o),e.setAttribute("contenteditable",o.isReadOnly?"false":"true",o),o.on("change:isReadOnly",(n,i,r)=>{e.setAttribute("contenteditable",r?"false":"true",o)}),o.on("change:isFocused",(n,i,r)=>{r?e.addClass("ck-editor__nested-editable_focused",o):e.removeClass("ck-editor__nested-editable_focused",o)}),ym(o,e),o}function p2(){return null}const Ot="widget-type-around";function pn(o,e,t){return!!o&&Be(o)&&!t.isInline(e)}function Wt(o){return o.getAttribute(Ot)}var Em=D(4921),f2={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Em.Z,f2),Em.Z.locals;const xm=["before","after"],k2=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,Sm="ck-widget__type-around_disabled";class b2 extends q{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[zo,Wn]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(n,i,r)=>{t.change(s=>{for(const a of t.document.roots)r?s.removeClass(Sm,a):s.addClass(Sm,a)}),r||e.model.change(s=>{s.removeSelectionAttribute(Ot)})}),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){super.destroy(),this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const n=this.editor,i=n.editing.view,r=n.model.schema.getAttributesWithProperty(e,"copyOnReplace",!0);n.execute("insertParagraph",{position:n.model.createPositionAt(e,t),attributes:r}),i.focus(),i.scrollToTheSelection()}_listenToIfEnabled(e,t,n,i){this.listenTo(e,t,(...r)=>{this.isEnabled&&n(...r)},i)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=Wt(e);if(!t)return!1;const n=e.getSelectedElement();return this._insertParagraph(n,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,n=e.locale.t,i={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(r,s,a)=>{const l=a.mapper.toViewElement(s.item);l&&pn(l,s.item,t)&&(function(c,d,u){const g=c.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},function(f){const b=this.toDomElement(f);return function(A,E){for(const P of xm){const z=new bt({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${P}`],title:E[P],"aria-hidden":"true"},children:[A.ownerDocument.importNode(k2,!0)]});A.appendChild(z.render())}}(b,d),function(A){const E=new bt({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});A.appendChild(E.render())}(b),b});c.insert(c.createPositionAt(u,"end"),g)}(a.writer,i,l),l.getCustomProperty("widgetLabel").push(()=>this.isEnabled?n("Press Enter to type after or press Shift + Enter to type before the widget"):""))},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,n=t.document.selection,i=t.schema,r=e.editing.view;function s(a){return`ck-widget_type-around_show-fake-caret_${a}`}this._listenToIfEnabled(r.document,"arrowKey",(a,l)=>{this._handleArrowKeyPress(a,l)},{context:[Be,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",(a,l)=>{l.directChange&&e.model.change(c=>{c.removeSelectionAttribute(Ot)})}),this._listenToIfEnabled(t.document,"change:data",()=>{const a=n.getSelectedElement();a&&pn(e.editing.mapper.toViewElement(a),a,i)||e.model.change(l=>{l.removeSelectionAttribute(Ot)})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(a,l,c)=>{const d=c.writer;if(this._currentFakeCaretModelElement){const b=c.mapper.toViewElement(this._currentFakeCaretModelElement);b&&(d.removeClass(xm.map(s),b),this._currentFakeCaretModelElement=null)}const u=l.selection.getSelectedElement();if(!u)return;const g=c.mapper.toViewElement(u);if(!pn(g,u,i))return;const f=Wt(l.selection);f&&(d.addClass(s(f),g),this._currentFakeCaretModelElement=u)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(a,l,c)=>{c||e.model.change(d=>{d.removeSelectionAttribute(Ot)})})}_handleArrowKeyPress(e,t){const n=this.editor,i=n.model,r=i.document.selection,s=i.schema,a=n.editing.view,l=function(u,g){const f=qr(u,g);return f==="down"||f==="right"}(t.keyCode,n.locale.contentLanguageDirection),c=a.document.selection.getSelectedElement();let d;pn(c,n.editing.mapper.toModelElement(c),s)?d=this._handleArrowKeyPressOnSelectedWidget(l):r.isCollapsed?d=this._handleArrowKeyPressWhenSelectionNextToAWidget(l):t.shiftKey||(d=this._handleArrowKeyPressWhenNonCollapsedSelection(l)),d&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const t=this.editor.model,n=Wt(t.document.selection);return t.change(i=>n?n!==(e?"after":"before")?(i.removeSelectionAttribute(Ot),!0):!1:(i.setSelectionAttribute(Ot,e?"after":"before"),!0))}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,n=t.model,i=n.schema,r=t.plugins.get("Widget"),s=r._getObjectElementNextToSelection(e);return!!pn(t.editing.mapper.toViewElement(s),s,i)&&(n.change(a=>{r._setSelectionOverElement(s),a.setSelectionAttribute(Ot,e?"before":"after")}),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,n=t.model,i=n.schema,r=t.editing.mapper,s=n.document.selection,a=e?s.getLastPosition().nodeBefore:s.getFirstPosition().nodeAfter;return!!pn(r.toViewElement(a),a,i)&&(n.change(l=>{l.setSelection(a,"on"),l.setSelectionAttribute(Ot,e?"after":"before")}),!0)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(n,i)=>{const r=i.domTarget.closest(".ck-widget__type-around__button");if(!r)return;const s=function(c){return c.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(r),a=function(c,d){const u=c.closest(".ck-widget");return d.mapDomToView(u)}(r,t.domConverter),l=e.editing.mapper.toModelElement(a);this._insertParagraph(l,s),i.preventDefault(),n.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,n=e.editing.view;this._listenToIfEnabled(n.document,"enter",(i,r)=>{if(i.eventPhase!="atTarget")return;const s=t.getSelectedElement(),a=e.editing.mapper.toViewElement(s),l=e.model.schema;let c;this._insertParagraphAccordingToFakeCaretPosition()?c=!0:pn(a,s,l)&&(this._insertParagraph(s,r.isSoft?"before":"after"),c=!0),c&&(r.preventDefault(),i.stop())},{context:Be})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view.document;this._listenToIfEnabled(e,"insertText",(t,n)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(n.selection=e.selection)},{priority:"high"}),k.isAndroid?this._listenToIfEnabled(e,"keydown",(t,n)=>{n.keyCode==229&&this._insertParagraphAccordingToFakeCaretPosition()}):this._listenToIfEnabled(e,"compositionstart",()=>{this._insertParagraphAccordingToFakeCaretPosition()},{priority:"high"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,n=e.model,i=n.schema;this._listenToIfEnabled(t.document,"delete",(r,s)=>{if(r.eventPhase!="atTarget")return;const a=Wt(n.document.selection);if(!a)return;const l=s.direction,c=n.document.selection.getSelectedElement(),d=l=="forward";if(a==="before"===d)e.execute("delete",{selection:n.createSelection(c,"on")});else{const u=i.getNearestSelectionRange(n.createPositionAt(c,a),l);if(u)if(u.isCollapsed){const g=n.createSelection(u.start);if(n.modifySelection(g,{direction:l}),g.focus.isEqual(u.start)){const f=function(b,A){let E=A;for(const P of A.getAncestors({parentFirst:!0})){if(P.childCount>1||b.isLimit(P))break;E=P}return E}(i,u.start.parent);n.deleteContent(n.createSelection(f,"on"),{doNotAutoparagraph:!0})}else n.change(f=>{f.setSelection(u),e.execute(d?"deleteForward":"delete")})}else n.change(g=>{g.setSelection(u),e.execute(d?"deleteForward":"delete")})}s.preventDefault(),r.stop()},{context:Be})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,n=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(i,[r,s])=>{if(s&&!s.is("documentSelection"))return;const a=Wt(n);return a?(i.stop(),t.change(l=>{const c=n.getSelectedElement(),d=t.createPositionAt(c,a),u=l.createSelection(d),g=t.insertContent(r,u);return l.setSelection(u),g})):void 0},{priority:"high"})}_enableInsertObjectIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"insertObject",(n,i)=>{const[,r,s={}]=i;if(r&&!r.is("documentSelection"))return;const a=Wt(t);a&&(s.findOptimalPosition=a,i[3]=s)},{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",(n,[i])=>{i&&!i.is("documentSelection")||Wt(t)&&n.stop()},{priority:"high"})}}function w2(o){const e=o.model;return(t,n)=>{const i=n.keyCode==se.arrowup,r=n.keyCode==se.arrowdown,s=n.shiftKey,a=e.document.selection;if(!i&&!r)return;const l=r;if(s&&function(d,u){return!d.isCollapsed&&d.isBackward==u}(a,l))return;const c=function(d,u,g){const f=d.model;if(g){const b=u.isCollapsed?u.focus:u.getLastPosition(),A=Dm(f,b,"forward");if(!A)return null;const E=f.createRange(b,A),P=Bm(f.schema,E,"backward");return P?f.createRange(b,P):null}{const b=u.isCollapsed?u.focus:u.getFirstPosition(),A=Dm(f,b,"backward");if(!A)return null;const E=f.createRange(A,b),P=Bm(f.schema,E,"forward");return P?f.createRange(P,b):null}}(o,a,l);if(c){if(c.isCollapsed&&(a.isCollapsed||s))return;(c.isCollapsed||function(d,u,g){const f=d.model,b=d.view.domConverter;if(g){const j=f.createSelection(u.start);f.modifySelection(j),j.focus.isAtEnd||u.start.isEqual(j.focus)||(u=f.createRange(j.focus,u.end))}const A=d.mapper.toViewRange(u),E=b.viewRangeToDom(A),P=De.getDomRangeRects(E);let z;for(const j of P)if(z!==void 0){if(Math.round(j.top)>=z)return!1;z=Math.max(z,Math.round(j.bottom))}else z=Math.round(j.bottom);return!0}(o,c,l))&&(e.change(d=>{const u=l?c.end:c.start;if(s){const g=e.createSelection(a.anchor);g.setFocus(u),d.setSelection(g)}else d.setSelection(u)}),t.stop(),n.preventDefault(),n.stopPropagation())}}}function Dm(o,e,t){const n=o.schema,i=o.createRangeIn(e.root),r=t=="forward"?"elementStart":"elementEnd";for(const{previousPosition:s,item:a,type:l}of i.getWalker({startPosition:e,direction:t})){if(n.isLimit(a)&&!n.isInline(a))return s;if(l==r&&n.isBlock(a))return null}return null}function Bm(o,e,t){const n=t=="backward"?e.end:e.start;if(o.checkChild(n,"$text"))return n;for(const{nextPosition:i}of e.getWalker({direction:t}))if(o.checkChild(i,"$text"))return i;return null}var Tm=D(3488),A2={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Tm.Z,A2),Tm.Z.locals;class Mo extends q{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[b2,Wn]}init(){const e=this.editor,t=e.editing.view,n=t.document;this.editor.editing.downcastDispatcher.on("selection",(i,r,s)=>{const a=s.writer,l=r.selection;if(l.isCollapsed)return;const c=l.getSelectedElement();if(!c)return;const d=e.editing.mapper.toViewElement(c);var u;Be(d)&&s.consumable.consume(l,"selection")&&a.setSelection(a.createRangeOn(d),{fake:!0,label:(u=d,u.getCustomProperty("widgetLabel").reduce((g,f)=>typeof f=="function"?g?g+". "+f():f():g?g+". "+f:f,""))})}),this.editor.editing.downcastDispatcher.on("selection",(i,r,s)=>{this._clearPreviouslySelectedWidgets(s.writer);const a=s.writer,l=a.document.selection;let c=null;for(const d of l.getRanges())for(const u of d){const g=u.item;Be(g)&&!_2(g,c)&&(a.addClass(vm,g),this._previouslySelected.add(g),c=g)}},{priority:"low"}),t.addObserver(Ns),this.listenTo(n,"mousedown",(...i)=>this._onMousedown(...i)),this.listenTo(n,"arrowKey",(...i)=>{this._handleSelectionChangeOnArrowKeyPress(...i)},{context:[Be,"$text"]}),this.listenTo(n,"arrowKey",(...i)=>{this._preventDefaultOnArrowKeyPress(...i)},{context:"$root"}),this.listenTo(n,"arrowKey",w2(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",(i,r)=>{this._handleDelete(r.direction=="forward")&&(r.preventDefault(),i.stop())},{context:"$root"})}_onMousedown(e,t){const n=this.editor,i=n.editing.view,r=i.document;let s=t.target;if(function(l){let c=l;for(;c;){if(c.is("editableElement")&&!c.is("rootElement"))return!0;if(Be(c))return!1;c=c.parent}return!1}(s)){if((k.isSafari||k.isGecko)&&t.domEvent.detail>=3){const l=n.editing.mapper,c=s.is("attributeElement")?s.findAncestor(u=>!u.is("attributeElement")):s,d=l.toModelElement(c);t.preventDefault(),this.editor.model.change(u=>{u.setSelection(d,"in")})}return}if(!Be(s)&&(s=s.findAncestor(Be),!s))return;k.isAndroid&&t.preventDefault(),r.isFocused||i.focus();const a=n.editing.mapper.toModelElement(s);this._setSelectionOverElement(a)}_handleSelectionChangeOnArrowKeyPress(e,t){const n=t.keyCode,i=this.editor.model,r=i.schema,s=i.document.selection,a=s.getSelectedElement(),l=qr(n,this.editor.locale.contentLanguageDirection),c=l=="down"||l=="right",d=l=="up"||l=="down";if(a&&r.isObject(a)){const g=c?s.getLastPosition():s.getFirstPosition(),f=r.getNearestSelectionRange(g,c?"forward":"backward");return void(f&&(i.change(b=>{b.setSelection(f)}),t.preventDefault(),e.stop()))}if(!s.isCollapsed&&!t.shiftKey){const g=s.getFirstPosition(),f=s.getLastPosition(),b=g.nodeAfter,A=f.nodeBefore;return void((b&&r.isObject(b)||A&&r.isObject(A))&&(i.change(E=>{E.setSelection(c?f:g)}),t.preventDefault(),e.stop()))}if(!s.isCollapsed)return;const u=this._getObjectElementNextToSelection(c);if(u&&r.isObject(u)){if(r.isInline(u)&&d)return;this._setSelectionOverElement(u),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){const n=this.editor.model,i=n.schema,r=n.document.selection.getSelectedElement();r&&i.isObject(r)&&(t.preventDefault(),e.stop())}_handleDelete(e){const t=this.editor.model.document.selection;if(!this.editor.model.canEditAt(t)||!t.isCollapsed)return;const n=this._getObjectElementNextToSelection(e);return n?(this.editor.model.change(i=>{let r=t.anchor.parent;for(;r.isEmpty;){const s=r;r=s.parent,i.remove(s)}this._setSelectionOverElement(n)}),!0):void 0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,n=t.schema,i=t.document.selection,r=t.createSelection(i);if(t.modifySelection(r,{direction:e?"forward":"backward"}),r.isEqual(i))return null;const s=e?r.focus.nodeBefore:r.focus.nodeAfter;return s&&n.isObject(s)?s:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(vm,t);this._previouslySelected.clear()}}function _2(o,e){return!!e&&Array.from(o.getAncestors()).includes(e)}class qi extends q{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[Fi]}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",n=>{(function(i){const r=i.getSelectedElement();return!(!r||!Be(r))})(e.editing.view.document.selection)&&n.stop()},{priority:"high"})}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui,"update",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility()},{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:n,getRelatedElement:i,balloonClassName:r="ck-toolbar-container"}){if(!n.length)return void Q("widget-toolbar-no-items",{toolbarId:e});const s=this.editor,a=s.t,l=new Ms(s.locale);if(l.ariaLabel=t||a("Widget toolbar"),this._toolbarDefinitions.has(e))throw new I("widget-toolbar-duplicated",this,{toolbarId:e});const c={view:l,getRelatedElement:i,balloonClassName:r,itemsConfig:n,initialized:!1};s.ui.addToolbar(l,{isContextual:!0,beforeFocus:()=>{const d=i(s.editing.view.document.selection);d&&this._showToolbar(c,d)},afterBlur:()=>{this._hideToolbar(c)}}),this._toolbarDefinitions.set(e,c)}_updateToolbarsVisibility(){let e=0,t=null,n=null;for(const i of this._toolbarDefinitions.values()){const r=i.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&r)if(this.editor.ui.focusTracker.isFocused){const s=r.getAncestors().length;s>e&&(e=s,t=r,n=i)}else this._isToolbarVisible(i)&&this._hideToolbar(i);else this._isToolbarInBalloon(i)&&this._hideToolbar(i)}n&&this._showToolbar(n,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?Im(this.editor,t):this._isToolbarInBalloon(e)||(e.initialized||(e.initialized=!0,e.view.fillFromConfig(e.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:e.view,position:Pm(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const n of this._toolbarDefinitions.values())if(this._isToolbarVisible(n)){const i=n.getRelatedElement(this.editor.editing.view.document.selection);Im(this.editor,i)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function Im(o,e){const t=o.plugins.get("ContextualBalloon"),n=Pm(o,e);t.updatePosition(n)}function Pm(o,e){const t=o.editing.view,n=Ye.defaultPositions;return{target:t.domConverter.mapViewToDom(e),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}var Rm=D(8506),C2={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Rm.Z,C2),Rm.Z.locals;var Om=D(903),v2={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Om.Z,v2),Om.Z.locals;class y2 extends q{static get pluginName(){return"DragDrop"}static get requires(){return[Rt,Mo]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,this._updateDropMarkerThrottled=Js(n=>this._updateDropMarker(n),40),this._removeDropMarkerDelayed=Ur(()=>this._removeDropMarker(),40),this._clearDraggableAttributesDelayed=Ur(()=>this._clearDraggableAttributes(),40),e.plugins.has("DragDropExperimental")?this.forceDisabled("DragDropExperimental"):(t.addObserver(Xs),t.addObserver(Ns),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDropMarker(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(n,i,r)=>{r?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(n,i,r)=>{r||this._finalizeDragging(!1)}),k.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,n=t.document,i=e.editing.view,r=i.document;this.listenTo(r,"dragstart",(s,a)=>{const l=n.selection;if(a.target&&a.target.is("editableElement"))return void a.preventDefault();const c=a.target?Mm(a.target):null;if(c){const f=e.editing.mapper.toModelElement(c);this._draggedRange=Bt.fromRange(t.createRangeOn(f)),e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}else if(!r.selection.isCollapsed){const f=r.selection.getSelectedElement();f&&Be(f)||(this._draggedRange=Bt.fromRange(l.getFirstRange()))}if(!this._draggedRange)return void a.preventDefault();this._draggingUid=J();const d=this.isEnabled&&e.model.canEditAt(this._draggedRange);a.dataTransfer.effectAllowed=d?"copyMove":"copy",a.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const u=t.createSelection(this._draggedRange.toRange()),g=e.data.toView(t.getSelectedContent(u));r.fire("clipboardOutput",{dataTransfer:a.dataTransfer,content:g,method:"dragstart"}),d||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(r,"dragend",(s,a)=>{this._finalizeDragging(!a.dataTransfer.isCanceled&&a.dataTransfer.dropEffect=="move")},{priority:"low"}),this.listenTo(r,"dragenter",()=>{this.isEnabled&&i.focus()}),this.listenTo(r,"dragleave",()=>{this._removeDropMarkerDelayed()}),this.listenTo(r,"dragging",(s,a)=>{if(!this.isEnabled)return void(a.dataTransfer.dropEffect="none");this._removeDropMarkerDelayed.cancel();const l=Nm(e,a.targetRanges,a.target);e.model.canEditAt(l)?(this._draggedRange||(a.dataTransfer.dropEffect="copy"),k.isGecko||(a.dataTransfer.effectAllowed=="copy"?a.dataTransfer.dropEffect="copy":["all","copyMove"].includes(a.dataTransfer.effectAllowed)&&(a.dataTransfer.dropEffect="move")),l&&this._updateDropMarkerThrottled(l)):a.dataTransfer.dropEffect="none"},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"clipboardInput",(n,i)=>{if(i.method!="drop")return;const r=Nm(e,i.targetRanges,i.target);if(this._removeDropMarker(),!r||!e.model.canEditAt(r))return this._finalizeDragging(!1),void n.stop();if(this._draggedRange&&this._draggingUid!=i.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),zm(i.dataTransfer)=="move"&&this._draggedRange&&this._draggedRange.containsRange(r,!0))return this._finalizeDragging(!1),void n.stop();i.targetRanges=[e.editing.mapper.toViewRange(r)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(Rt);e.on("contentInsertion",(t,n)=>{if(!this.isEnabled||n.method!=="drop")return;const i=n.targetRanges.map(r=>this.editor.editing.mapper.toModelRange(r));this.editor.model.change(r=>r.setSelection(i))},{priority:"high"}),e.on("contentInsertion",(t,n)=>{if(!this.isEnabled||n.method!=="drop")return;const i=zm(n.dataTransfer)=="move",r=!n.resultRange||!n.resultRange.isCollapsed;this._finalizeDragging(r&&i)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,n=t.document;this.listenTo(n,"mousedown",(i,r)=>{if(k.isAndroid||!r)return;this._clearDraggableAttributesDelayed.cancel();let s=Mm(r.target);if(k.isBlink&&!s&&!n.selection.isCollapsed){const a=n.selection.getSelectedElement();if(!a||!Be(a)){const l=n.selection.editableElement;l&&!l.isReadOnly&&(s=l)}}s&&(t.change(a=>{a.setAttribute("draggable","true",s)}),this._draggableElement=e.editing.mapper.toModelElement(s))}),this.listenTo(n,"mouseup",()=>{k.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change(t=>{this._draggableElement&&this._draggableElement.root.rootName!="$graveyard"&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_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:n})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return n.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},function(i){const r=this.toDomElement(i);return r.append("",i.createElement("span"),""),r})}})}_updateDropMarker(e){const t=this.editor,n=t.model.markers;t.model.change(i=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(e)||i.updateMarker("drop-target",{range:e}):i.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(t=>{t.removeMarker("drop-target")})}_finalizeDragging(e){const t=this.editor,n=t.model;this._removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._draggedRange&&(e&&this.isEnabled&&n.deleteContent(n.createSelection(this._draggedRange),{doNotAutoparagraph:!0}),this._draggedRange.detach(),this._draggedRange=null)}}function Nm(o,e,t){const n=o.model,i=o.editing.mapper;let r=null;const s=e?e[0].start:null;if(t.is("uiElement")&&(t=t.parent),r=function(c,d){const u=c.model,g=c.editing.mapper;if(Be(d))return u.createRangeOn(g.toModelElement(d));if(!d.is("editableElement")){const f=d.findAncestor(b=>Be(b)||b.is("editableElement"));if(Be(f))return u.createRangeOn(g.toModelElement(f))}return null}(o,t),r)return r;const a=function(c,d){const u=c.editing.mapper,g=c.editing.view,f=u.toModelElement(d);if(f)return f;const b=g.createPositionBefore(d),A=u.findMappedViewAncestor(b);return u.toModelElement(A)}(o,t),l=s?i.toModelPosition(s):null;return l?(r=function(c,d,u){const g=c.model;if(!g.schema.checkChild(u,"$block"))return null;const f=g.createPositionAt(u,0),b=d.path.slice(0,f.path.length),A=g.createPositionFromPath(d.root,b),E=A.nodeAfter;return E&&g.schema.isObject(E)?g.createRangeOn(E):null}(o,l,a),r||(r=n.schema.getNearestSelectionRange(l,k.isGecko?"forward":"backward"),r||function(c,d){const u=c.model;let g=d;for(;g;){if(u.schema.isObject(g))return u.createRangeOn(g);g=g.parent}return null}(o,l.parent))):function(c,d){const u=c.model,g=u.schema,f=u.createPositionAt(d,0);return g.getNearestSelectionRange(f,"forward")}(o,a)}function zm(o){return k.isGecko?o.dropEffect:["all","copyMove"].includes(o.effectAllowed)?"move":"copy"}function Mm(o){if(o.is("editableElement"))return null;if(o.hasClass("ck-widget__selection-handle"))return o.findAncestor(Be);if(Be(o))return o;const e=o.findAncestor(t=>Be(t)||t.is("editableElement"));return Be(e)?e:null}class E2 extends q{static get pluginName(){return"PastePlainText"}static get requires(){return[Rt]}init(){const e=this.editor,t=e.model,n=e.editing.view,i=n.document,r=t.document.selection;let s=!1;n.addObserver(Xs),this.listenTo(i,"keydown",(a,l)=>{s=l.shiftKey}),e.plugins.get(Rt).on("contentInsertion",(a,l)=>{(s||function(c,d){if(c.childCount>1)return!1;const u=c.getChild(0);return d.isObject(u)?!1:Array.from(u.getAttributeKeys()).length==0}(l.content,t.schema))&&t.change(c=>{const d=Array.from(r.getAttributes()).filter(([g])=>t.schema.getAttributeProperties(g).isFormatting);r.isCollapsed||t.deleteContent(r,{doNotAutoparagraph:!0}),d.push(...r.getAttributes());const u=c.createRangeIn(l.content);for(const g of u.getItems())g.is("$textProxy")&&c.setAttributes(d,g)})})}}class x2 extends q{static get pluginName(){return"Clipboard"}static get requires(){return[Rt,y2,E2]}}class S2 extends ne{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let n=e.schema.getLimitElement(t);if(t.containsEntireContent(n)||!Fm(e.schema,n))do if(n=n.parent,!n)return;while(!Fm(e.schema,n));e.change(i=>{i.setSelection(n,"in")})}}function Fm(o,e){return o.isLimit(e)&&(o.checkChild(e,"$text")||o.checkChild(e,"paragraph"))}const D2=li("Ctrl+A");class B2 extends q{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,t=e.editing.view.document;e.commands.add("selectAll",new S2(e)),this.listenTo(t,"keydown",(n,i)=>{Nn(i)===D2&&(e.execute("selectAll"),i.preventDefault())})}}class T2 extends q{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",t=>{const n=e.commands.get("selectAll"),i=new Ae(t),r=t.t;return i.set({label:r("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}),i.bind("isEnabled").to(n,"isEnabled"),this.listenTo(i,"execute",()=>{e.execute("selectAll"),e.editing.view.focus()}),i})}}class I2 extends q{static get requires(){return[B2,T2]}static get pluginName(){return"SelectAll"}}var P2=Object.defineProperty,Vm=Object.getOwnPropertySymbols,R2=Object.prototype.hasOwnProperty,O2=Object.prototype.propertyIsEnumerable,Lm=(o,e,t)=>e in o?P2(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;class jm extends ne{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,"set",(t,n)=>{n[1]=((r,s)=>{for(var a in s||(s={}))R2.call(s,a)&&Lm(r,a,s[a]);if(Vm)for(var a of Vm(s))O2.call(s,a)&&Lm(r,a,s[a]);return r})({},n[1]);const i=n[1];i.batchType||(i.batchType={isUndoable:!1})},{priority:"high"}),this.listenTo(e.data,"set",(t,n)=>{n[1].batchType.isUndoable||this.clearStack()})}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(e){const t=this.editor.model.document.selection,n={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,n){const i=this.editor.model,r=i.document,s=[],a=e.map(c=>c.getTransformedByOperations(n)),l=a.flat();for(const c of a){const d=c.filter(u=>u.root!=r.graveyard).filter(u=>!z2(u,l));d.length&&(N2(d),s.push(d[0]))}s.length&&i.change(c=>{c.setSelection(s,{backward:t})})}_undo(e,t){const n=this.editor.model,i=n.document;this._createdBatches.add(t);const r=e.operations.slice().filter(s=>s.isDocumentOperation);r.reverse();for(const s of r){const a=s.baseVersion+1,l=Array.from(i.history.getOperations(a)),c=s1([s.getReversed()],l,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let d of c){const u=d.affectedSelectable;u&&!n.canEditAt(u)&&(d=new je(d.baseVersion)),t.addOperation(d),n.applyOperation(d),i.history.setOperationAsUndone(s,d)}}}}function N2(o){o.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let e=1;e<o.length;e++){const t=o[e-1].getJoined(o[e],!0);t&&(e--,o.splice(e,2,t))}}function z2(o,e){return e.some(t=>t!==o&&t.containsRange(o,!0))}class M2 extends jm{execute(e=null){const t=e?this._stack.findIndex(r=>r.batch==e):this._stack.length-1,n=this._stack.splice(t,1)[0],i=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(i,()=>{this._undo(n.batch,i);const r=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,r),this.fire("revert",n.batch,i)}),this.refresh()}}class F2 extends jm{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(t,()=>{const n=e.batch.operations[e.batch.operations.length-1].baseVersion+1,i=this.editor.model.document.history.getOperations(n);this._restoreSelection(e.selection.ranges,e.selection.isBackward,i),this._undo(e.batch,t)}),this.refresh()}}class V2 extends q{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}init(){const e=this.editor;this._undoCommand=new M2(e),this._redoCommand=new F2(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(t,n)=>{const i=n[0];if(!i.isDocumentOperation)return;const r=i.batch,s=this._redoCommand.createdBatches.has(r),a=this._undoCommand.createdBatches.has(r);this._batchRegistry.has(r)||(this._batchRegistry.add(r),r.isUndoable&&(s?this._undoCommand.addBatch(r):a||(this._undoCommand.addBatch(r),this._redoCommand.clearStack())))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(t,n,i)=>{this._redoCommand.addBatch(i)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo")}}const $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>',Hm='<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 L2 extends q{static get pluginName(){return"UndoUI"}init(){const e=this.editor,t=e.locale,n=e.t,i=t.uiLanguageDirection=="ltr"?$m:Hm,r=t.uiLanguageDirection=="ltr"?Hm:$m;this._addButton("undo",n("Undo"),"CTRL+Z",i),this._addButton("redo",n("Redo"),"CTRL+Y",r)}_addButton(e,t,n,i){const r=this.editor;r.ui.componentFactory.add(e,s=>{const a=r.commands.get(e),l=new Ae(s);return l.set({label:t,icon:i,keystroke:n,tooltip:!0}),l.bind("isEnabled").to(a,"isEnabled"),this.listenTo(l,"execute",()=>{r.execute(e),r.editing.view.focus()}),l})}}class j2 extends q{static get requires(){return[V2,L2]}static get pluginName(){return"Undo"}}class $2 extends ge(){constructor(){super();const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=t=>{this.loaded=t.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;return this.total=e.size,new Promise((n,i)=>{t.onload=()=>{const r=t.result;this._data=r,n(r)},t.onerror=()=>{i("error")},t.onabort=()=>{i("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}class Nt extends q{constructor(){super(...arguments),this.loaders=new at,this._loadersMap=new Map,this._pendingAction=null}static get pluginName(){return"FileRepository"}static get requires(){return[Ii]}init(){this.loaders.on("change",()=>this._updatePendingAction()),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,t)=>t?e/t*100:0)}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter)return Q("filerepository-no-upload-adapter"),null;const t=new qm(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then(n=>{this._loadersMap.set(n,t)}).catch(()=>{}),t.on("change:uploaded",()=>{let n=0;for(const i of this.loaders)n+=i.uploaded;this.uploaded=n}),t.on("change:uploadTotal",()=>{let n=0;for(const i of this.loaders)i.uploadTotal&&(n+=i.uploadTotal);this.uploadTotal=n}),t}destroyLoader(e){const t=e instanceof qm?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((n,i)=>{n===t&&this._loadersMap.delete(i)})}_updatePendingAction(){const e=this.editor.plugins.get(Ii);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,n=i=>`${t("Upload in progress")} ${parseInt(i)}%.`;this._pendingAction=e.add(n(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",n)}}else e.remove(this._pendingAction),this._pendingAction=null}}class qm extends ge(){constructor(e,t){super(),this.id=J(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new $2,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(n,i)=>i?n/i*100:0),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null):Promise.resolve(null)}get data(){return this._reader.data}read(){if(this.status!="idle")throw new I("filerepository-read-wrong-status",this);return this.status="reading",this.file.then(e=>this._reader.read(e)).then(e=>{if(this.status!=="reading")throw this.status;return this.status="idle",e}).catch(e=>{throw e==="aborted"?(this.status="aborted","aborted"):(this.status="error",this._reader.error?this._reader.error:e)})}upload(){if(this.status!="idle")throw new I("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then(()=>this._adapter.upload()).then(e=>(this.uploadResponse=e,this.status="idle",e)).catch(e=>{throw this.status==="aborted"?"aborted":(this.status="error",e)})}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?e=="reading"?this._reader.abort():e=="uploading"&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch(()=>{}),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise((n,i)=>{t.rejecter=i,t.isFulfilled=!1,e.then(r=>{t.isFulfilled=!0,n(r)}).catch(r=>{t.isFulfilled=!0,i(r)})}),t}}class H2 extends re{constructor(e){super(e),this.buttonView=new Ae(e),this._fileInputView=new q2(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 q2 extends re{constructor(e){super(e),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to(()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}const Um="ckCsrfToken",Wm="abcdefghijklmnopqrstuvwxyz0123456789";function U2(){let o=function(n){n=n.toLowerCase();const i=document.cookie.split(";");for(const r of i){const s=r.split("=");if(decodeURIComponent(s[0].trim().toLowerCase())===n)return decodeURIComponent(s[1])}return null}(Um);var e,t;return o&&o.length==40||(o=function(n){let i="";const r=new Uint8Array(n);window.crypto.getRandomValues(r);for(let s=0;s<r.length;s++){const a=Wm.charAt(r[s]%Wm.length);i+=Math.random()>.5?a.toUpperCase():a}return i}(40),e=Um,t=o,document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(t)+";path=/"),o}class W2{constructor(e,t,n){this.loader=e,this.url=t,this.t=n}upload(){return this.loader.file.then(e=>new Promise((t,n)=>{this._initRequest(),this._initListeners(t,n,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,n){const i=this.xhr,r=this.loader,s=(0,this.t)("Cannot upload file:")+` ${n.name}.`;i.addEventListener("error",()=>t(s)),i.addEventListener("abort",()=>t()),i.addEventListener("load",()=>{const a=i.response;if(!a||!a.uploaded)return t(a&&a.error&&a.error.message?a.error.message:s);e({default:a.url})}),i.upload&&i.upload.addEventListener("progress",a=>{a.lengthComputable&&(r.uploadTotal=a.total,r.uploaded=a.loaded)})}_sendRequest(e){const t=new FormData;t.append("upload",e),t.append("ckCsrfToken",U2()),this.xhr.send(t)}}class ra extends ne{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,n=t.document.selection,i=e.forceValue===void 0?!this.value:e.forceValue;t.change(r=>{if(n.isCollapsed)i?r.setSelectionAttribute(this.attributeKey,!0):r.removeSelectionAttribute(this.attributeKey);else{const s=t.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const a of s)i?r.setAttribute(this.attributeKey,i,a):r.removeAttribute(this.attributeKey,a)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,n=e.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const i of n.getRanges())for(const r of i.getItems())if(t.checkAttribute(r,this.attributeKey))return r.hasAttribute(this.attributeKey);return!1}}const Zn="bold";class K2 extends q{static get pluginName(){return"BoldEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Zn}),e.model.schema.setAttributeProperties(Zn,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Zn,view:"strong",upcastAlso:["b",t=>{const n=t.getStyle("font-weight");return n&&(n=="bold"||Number(n)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(Zn,new ra(e,Zn)),e.keystrokes.set("CTRL+B",Zn)}}const sa="bold";class G2 extends q{static get pluginName(){return"BoldUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(sa,n=>{const i=e.commands.get(sa),r=new Ae(n);return r.set({label:t("Bold"),icon:ve.bold,keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(r,"execute",()=>{e.execute(sa),e.editing.view.focus()}),r})}}var Km=D(8603),Z2={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Km.Z,Z2),Km.Z.locals;const Jn="italic";class J2 extends q{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Jn}),e.model.schema.setAttributeProperties(Jn,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Jn,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(Jn,new ra(e,Jn)),e.keystrokes.set("CTRL+I",Jn)}}const aa="italic";class Y2 extends q{static get pluginName(){return"ItalicUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(aa,n=>{const i=e.commands.get(aa),r=new Ae(n);return r.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}),r.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(r,"execute",()=>{e.execute(aa),e.editing.view.focus()}),r})}}const Fo="underline";class Q2 extends q{static get pluginName(){return"UnderlineEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Fo}),e.model.schema.setAttributeProperties(Fo,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Fo,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add(Fo,new ra(e,Fo)),e.keystrokes.set("CTRL+U","underline")}}const la="underline";class X2 extends q{static get pluginName(){return"UnderlineUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(la,n=>{const i=e.commands.get(la),r=new Ae(n);return r.set({label:t("Underline"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8 1.9 0 3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4z"/></svg>',keystroke:"CTRL+U",tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(r,"execute",()=>{e.execute(la),e.editing.view.focus()}),r})}}class ex extends ne{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,n=t.schema,i=t.document.selection,r=Array.from(i.getSelectedBlocks()),s=e.forceValue===void 0?!this.value:e.forceValue;t.change(a=>{if(s){const l=r.filter(c=>Ui(c)||Zm(n,c));this._applyQuote(a,l)}else this._removeQuote(a,r.filter(Ui))})}_getValue(){const e=ze(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!Ui(e))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,n=ze(e.getSelectedBlocks());return!!n&&Zm(t,n)}_removeQuote(e,t){Gm(e,t).reverse().forEach(n=>{if(n.start.isAtStart&&n.end.isAtEnd)return void e.unwrap(n.start.parent);if(n.start.isAtStart){const r=e.createPositionBefore(n.start.parent);return void e.move(n,r)}n.end.isAtEnd||e.split(n.end);const i=e.createPositionAfter(n.end.parent);e.move(n,i)})}_applyQuote(e,t){const n=[];Gm(e,t).reverse().forEach(i=>{let r=Ui(i.start);r||(r=e.createElement("blockQuote"),e.wrap(i,r)),n.push(r)}),n.reverse().reduce((i,r)=>i.nextSibling==r?(e.merge(e.createPositionAfter(i)),i):r)}}function Ui(o){return o.parent.name=="blockQuote"?o.parent:null}function Gm(o,e){let t,n=0;const i=[];for(;n<e.length;){const r=e[n],s=e[n+1];t||(t=o.createPositionBefore(r)),s&&r.nextSibling==s||(i.push(o.createRange(t,o.createPositionAfter(r))),t=null),n++}return i}function Zm(o,e){const t=o.checkChild(e.parent,"blockQuote"),n=o.checkChild(["$root","blockQuote"],e);return t&&n}class tx extends q{static get pluginName(){return"BlockQuoteEditing"}static get requires(){return[zo,Wn]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new ex(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(s=>{const a=e.model.document.differ.getChanges();for(const l of a)if(l.type=="insert"){const c=l.position.nodeAfter;if(!c)continue;if(c.is("element","blockQuote")&&c.isEmpty)return s.remove(c),!0;if(c.is("element","blockQuote")&&!t.checkChild(l.position,c))return s.unwrap(c),!0;if(c.is("element")){const d=s.createRangeIn(c);for(const u of d.getItems())if(u.is("element","blockQuote")&&!t.checkChild(s.createPositionBefore(u),u))return s.unwrap(u),!0}}else if(l.type=="remove"){const c=l.position.parent;if(c.is("element","blockQuote")&&c.isEmpty)return s.remove(c),!0}return!1});const n=this.editor.editing.view.document,i=e.model.document.selection,r=e.commands.get("blockQuote");this.listenTo(n,"enter",(s,a)=>{!i.isCollapsed||!r.value||i.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),a.preventDefault(),s.stop())},{context:"blockquote"}),this.listenTo(n,"delete",(s,a)=>{if(a.direction!="backward"||!i.isCollapsed||!r.value)return;const l=i.getLastPosition().parent;l.isEmpty&&!l.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),a.preventDefault(),s.stop())},{context:"blockquote"})}}var Jm=D(3062),nx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Jm.Z,nx),Jm.Z.locals;class ox extends q{static get pluginName(){return"BlockQuoteUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("blockQuote",n=>{const i=e.commands.get("blockQuote"),r=new Ae(n);return r.set({label:t("Block quote"),icon:ve.quote,tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(r,"execute",()=>{e.execute("blockQuote"),e.editing.view.focus()}),r})}}class ix extends q{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",Nt]}init(){const e=this.editor,t=e.plugins.get("CloudServices"),n=t.token,i=t.uploadUrl;if(!n)return;const r=e.plugins.get("CloudServicesCore");this._uploadGateway=r.createUploadGateway(n,i),e.plugins.get(Nt).createUploadAdapter=s=>new rx(this._uploadGateway,s)}}class rx{constructor(e,t){this.uploadGateway=e,this.loader=t}upload(){return this.loader.file.then(e=>(this.fileUploader=this.uploadGateway.upload(e),this.fileUploader.on("progress",(t,n)=>{this.loader.uploadTotal=n.total,this.loader.uploaded=n.uploaded}),this.fileUploader.send()))}abort(){this.fileUploader.abort()}}class sx extends ne{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=ze(e.document.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&Ym(t,e.schema)}execute(e={}){const t=this.editor.model,n=t.document,i=e.selection||n.selection;t.canEditAt(i)&&t.change(r=>{const s=i.getSelectedBlocks();for(const a of s)!a.is("element","paragraph")&&Ym(a,t.schema)&&r.rename(a,"paragraph")})}}function Ym(o,e){return e.checkChild(o.parent,"paragraph")&&!e.isObject(o)}class ax extends ne{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const t=this.editor.model,n=e.attributes;let i=e.position;t.canEditAt(i)&&t.change(r=>{const s=r.createElement("paragraph");if(n&&t.schema.setAllowedAttributes(s,n,r),!t.schema.checkChild(i.parent,s)){const a=t.schema.findAllowedParent(i,s);if(!a)return;i=r.split(i,a).position}t.insertContent(s,i),r.setSelection(s,"in")})}}const Qm=class extends q{static get pluginName(){return"Paragraph"}init(){const o=this.editor,e=o.model;o.commands.add("paragraph",new sx(o)),o.commands.add("insertParagraph",new ax(o)),e.schema.register("paragraph",{inheritAllFrom:"$block"}),o.conversion.elementToElement({model:"paragraph",view:"p"}),o.conversion.for("upcast").elementToElement({model:(t,{writer:n})=>Qm.paragraphLikeElements.has(t.name)?t.isEmpty?null:n.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}};let ca=Qm;ca.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class lx extends ne{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=ze(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>Xm(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,n=t.document,i=e.value;t.change(r=>{const s=Array.from(n.selection.getSelectedBlocks()).filter(a=>Xm(a,i,t.schema));for(const a of s)a.is("element",i)||r.rename(a,i)})}}function Xm(o,e,t){return t.checkChild(o.parent,e)&&!t.isObject(o)}const eg="paragraph";class cx extends q{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[ca]}init(){const e=this.editor,t=e.config.get("heading.options"),n=[];for(const i of t)i.model!=="paragraph"&&(e.model.schema.register(i.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(i),n.push(i.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new lx(e,n))}afterInit(){const e=this.editor,t=e.commands.get("enter"),n=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(i,r)=>{const s=e.model.document.selection.getFirstPosition().parent;n.some(a=>s.is("element",a.model))&&!s.is("element",eg)&&s.childCount===0&&r.writer.rename(s,eg)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:te.get("low")+1})}}var tg=D(8733),dx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(tg.Z,dx),tg.Z.locals;class hx extends q{static get pluginName(){return"HeadingUI"}init(){const e=this.editor,t=e.t,n=function(s){const a=s.t,l={Paragraph:a("Paragraph"),"Heading 1":a("Heading 1"),"Heading 2":a("Heading 2"),"Heading 3":a("Heading 3"),"Heading 4":a("Heading 4"),"Heading 5":a("Heading 5"),"Heading 6":a("Heading 6")};return s.config.get("heading.options").map(c=>{const d=l[c.title];return d&&d!=c.title&&(c.title=d),c})}(e),i=t("Choose heading"),r=t("Heading");e.ui.componentFactory.add("heading",s=>{const a={},l=new at,c=e.commands.get("heading"),d=e.commands.get("paragraph"),u=[c];for(const f of n){const b={type:"button",model:new Ys({label:f.title,class:f.class,role:"menuitemradio",withText:!0})};f.model==="paragraph"?(b.model.bind("isOn").to(d,"value"),b.model.set("commandName","paragraph"),u.push(d)):(b.model.bind("isOn").to(c,"value",A=>A===f.model),b.model.set({commandName:"heading",commandValue:f.model})),l.add(b),a[f.model]=f.title}const g=Pt(s);return Vs(g,l,{ariaLabel:r,role:"menu"}),g.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),g.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),g.bind("isEnabled").toMany(u,"isEnabled",(...f)=>f.some(b=>b)),g.buttonView.bind("label").to(c,"value",d,"value",(f,b)=>{const A=f||b&&"paragraph";return typeof A=="boolean"?i:a[A]?a[A]:i}),this.listenTo(g,"execute",f=>{const{commandName:b,commandValue:A}=f.source;e.execute(b,A?{value:A}:void 0),e.editing.view.focus()}),g})}}function ng(o){return o.createContainerElement("figure",{class:"image"},[o.createEmptyElement("img"),o.createSlot("children")])}function og(o,e){const t=o.plugins.get("ImageUtils"),n=o.plugins.has("ImageInlineEditing")&&o.plugins.has("ImageBlockEditing");return r=>t.isInlineImageView(r)?n&&(r.getStyle("display")=="block"||r.findAncestor(t.isBlockImageView)?"imageBlock":"imageInline")!==e?null:i(r):null;function i(r){const s={name:!0};return r.hasAttribute("src")&&(s.attributes=["src"]),s}}function da(o,e){const t=ze(e.getSelectedBlocks());return!t||o.isObject(t)||t.isEmpty&&t.name!="listItem"?"imageBlock":"imageInline"}var ux=Object.defineProperty,ig=Object.getOwnPropertySymbols,mx=Object.prototype.hasOwnProperty,gx=Object.prototype.propertyIsEnumerable,rg=(o,e,t)=>e in o?ux(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,sg=(o,e)=>{for(var t in e||(e={}))mx.call(e,t)&&rg(o,t,e[t]);if(ig)for(var t of ig(e))gx.call(e,t)&&rg(o,t,e[t]);return o};class zt extends q{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,n=null){const i=this.editor,r=i.model,s=r.document.selection;n=ag(i,t||s,n),e=sg(sg({},Object.fromEntries(s.getAttributes())),e);for(const a in e)r.schema.checkAttribute(n,a)||delete e[a];return r.change(a=>{const l=a.createElement(n,e);return r.insertObject(l,t,null,{setSelection:"on",findOptimalPosition:t||n=="imageInline"?void 0:"auto"}),l.parent?l:null})}getClosestSelectedImageWidget(e){const t=e.getFirstPosition();if(!t)return null;const n=e.getSelectedElement();if(n&&this.isImageWidget(n))return n;let i=t.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(t,n){if(ag(t,n,null)=="imageBlock"){const r=function(s,a){const l=function(d,u){const g=d.getSelectedElement();if(g){const f=Wt(d);if(f)return u.createRange(u.createPositionAt(g,f))}return du(d,u)}(s,a),c=l.start.parent;return c.isEmpty&&!c.is("element","$root")?c.parent:c}(n,t.model);if(t.model.schema.checkChild(r,"imageBlock"))return!0}else if(t.model.schema.checkChild(n.focus,"imageInline"))return!0;return!1}(this.editor,e)&&function(t){return[...t.focus.getAncestors()].every(n=>!n.is("element","imageBlock"))}(e)}toImageWidget(e,t,n){return t.setCustomProperty("image",!0,e),ia(e,t,{label:()=>{const i=this.findViewImgElement(e).getAttribute("alt");return i?`${i} ${n}`:n}})}isImageWidget(e){return!!e.getCustomProperty("image")&&Be(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:n}of t.createRangeIn(e))if(this.isInlineImageView(n))return n}}function ag(o,e,t){const n=o.model.schema,i=o.config.get("image.insert.type");return o.plugins.has("ImageBlockEditing")?o.plugins.has("ImageInlineEditing")?t||(i==="inline"?"imageInline":i==="block"?"imageBlock":e.is("selection")?da(n,e):n.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}class px extends ne{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,n=t.plugins.get("ImageUtils"),i=t.model,r=n.getClosestSelectedImageElement(i.document.selection);i.change(s=>{s.setAttribute("alt",e.newValue,r)})}}class fx extends q{static get requires(){return[zt]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new px(this.editor))}}var lg=D(1905),kx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(lg.Z,kx),lg.Z.locals;var cg=D(6764),bx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(cg.Z,bx),cg.Z.locals;class wx extends re{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new ht,this.keystrokes=new St,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),ve.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),ve.cancel,"ck-button-cancel","cancel"),this._focusables=new on,this._focusCycler=new bo({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),p({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(e,t,n,i){const r=new Ae(this.locale);return r.set({label:e,icon:t,tooltip:!0}),r.extendTemplate({attributes:{class:n}}),i&&r.delegate("execute").to(this,i),r}_createLabeledInputView(){const e=this.locale.t,t=new Xc(this.locale,_u);return t.label=e("Text alternative"),t}}function dg(o){const e=o.editing.view,t=Ye.defaultPositions,n=o.plugins.get("ImageUtils");return{target:e.domConverter.mapViewToDom(n.getClosestSelectedImageWidget(e.document.selection)),positions:[t.northArrowSouth,t.northArrowSouthWest,t.northArrowSouthEast,t.southArrowNorth,t.southArrowNorthWest,t.southArrowNorthEast,t.viewportStickyNorth]}}class Ax extends q{static get requires(){return[Fi]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",n=>{const i=e.commands.get("imageTextAlternative"),r=new Ae(n);return r.set({label:t("Change image text alternative"),icon:ve.lowVision,tooltip:!0}),r.bind("isEnabled").to(i,"isEnabled"),r.bind("isOn").to(i,"value",s=>!!s),this.listenTo(r,"execute",()=>{this._showForm()}),r})}_createForm(){const e=this.editor,t=e.editing.view.document,n=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(S(wx))(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",(i,r)=>{this._hideForm(!0),r()}),this.listenTo(e.ui,"update",()=>{n.getClosestSelectedImageWidget(t.selection)?this._isVisible&&function(i){const r=i.plugins.get("ContextualBalloon");if(i.plugins.get("ImageUtils").getClosestSelectedImageWidget(i.editing.view.document.selection)){const s=dg(i);r.updatePosition(s)}}(e):this._hideForm(!0)}),w({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();const e=this.editor,t=e.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:dg(e)}),n.fieldView.value=n.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}class hg extends q{static get requires(){return[fx,Ax]}static get pluginName(){return"ImageTextAlternative"}}function ug(o,e){const t=(n,i,r)=>{if(!r.consumable.consume(i.item,n.name))return;const s=r.writer,a=r.mapper.toViewElement(i.item),l=o.findViewImgElement(a);if(i.attributeNewValue===null){const c=i.attributeOldValue;c&&c.data&&(s.removeAttribute("srcset",l),s.removeAttribute("sizes",l),c.width&&s.removeAttribute("width",l))}else{const c=i.attributeNewValue;c&&c.data&&(s.setAttribute("srcset",c.data,l),s.setAttribute("sizes","100vw",l),c.width&&s.setAttribute("width",c.width,l))}};return n=>{n.on(`attribute:srcset:${e}`,t)}}function Wi(o,e,t){const n=(i,r,s)=>{if(!s.consumable.consume(r.item,i.name))return;const a=s.writer,l=s.mapper.toViewElement(r.item),c=o.findViewImgElement(l);a.setAttribute(r.attributeKey,r.attributeNewValue||"",c)};return i=>{i.on(`attribute:${t}:${e}`,n)}}class _x extends Ct{observe(e){this.listenTo(e,"load",(t,n)=>{const i=n.target;this.checkShouldIgnoreEventFromTarget(i)||i.tagName=="IMG"&&this._fireEvents(n)},{useCapture:!0})}stopObserving(e){this.stopListening(e)}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}var Cx=Object.defineProperty,mg=Object.getOwnPropertySymbols,vx=Object.prototype.hasOwnProperty,yx=Object.prototype.propertyIsEnumerable,gg=(o,e,t)=>e in o?Cx(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Ki=(o,e)=>{for(var t in e||(e={}))vx.call(e,t)&&gg(o,t,e[t]);if(mg)for(var t of mg(e))yx.call(e,t)&&gg(o,t,e[t]);return o};class Ex extends ne{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||t==="block"&&Q("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||t==="inline"&&Q("image-inline-plugin-required")}refresh(){const e=this.editor.plugins.get("ImageUtils");this.isEnabled=e.isImageAllowed()}execute(e){const t=Pe(e.source),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),r=Object.fromEntries(n.getAttributes());t.forEach((s,a)=>{const l=n.getSelectedElement();if(typeof s=="string"&&(s={src:s}),a&&l&&i.isImage(l)){const c=this.editor.model.createPositionAfter(l);i.insertImage(Ki(Ki({},s),r),c)}else i.insertImage(Ki(Ki({},s),r))})}}class xx extends ne{refresh(){const e=this.editor.plugins.get("ImageUtils"),t=this.editor.model.document.selection.getSelectedElement();this.isEnabled=e.isImage(t),this.value=this.isEnabled?t.getAttribute("src"):null}execute(e){const t=this.editor.model.document.selection.getSelectedElement();this.editor.model.change(n=>{n.setAttribute("src",e.source,t),n.removeAttribute("srcset",t),n.removeAttribute("sizes",t)})}}class pg extends q{static get requires(){return[zt]}static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(_x),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:r=>{const s={data:r.getAttribute("srcset")};return r.hasAttribute("width")&&(s.width=r.getAttribute("width")),s}}});const n=new Ex(e),i=new xx(e);e.commands.add("insertImage",n),e.commands.add("replaceImageSource",i),e.commands.add("imageInsert",n)}}class fg extends ne{constructor(e,t){super(e),this._modelElementName=t}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=e.getClosestSelectedImageElement(this.editor.model.document.selection);this._modelElementName==="imageBlock"?this.isEnabled=e.isInlineImage(t):this.isEnabled=e.isBlockImage(t)}execute(){const e=this.editor,t=this.editor.model,n=e.plugins.get("ImageUtils"),i=n.getClosestSelectedImageElement(t.document.selection),r=Object.fromEntries(i.getAttributes());return r.src||r.uploadId?t.change(s=>{const a=Array.from(t.markers).filter(d=>d.getRange().containsItem(i)),l=n.insertImage(r,t.createSelection(i,"on"),this._modelElementName);if(!l)return null;const c=s.createRangeOn(l);for(const d of a){const u=d.getRange(),g=u.root.rootName!="$graveyard"?u.getJoined(c,!0):c;s.updateMarker(d,{range:g})}return{oldElement:i,newElement:l}}):null}}class Sx extends q{static get requires(){return[pg,zt,Rt]}static get pluginName(){return"ImageBlockEditing"}init(){const e=this.editor;e.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),e.plugins.has("ImageInlineEditing")&&(e.commands.add("imageTypeBlock",new fg(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,n=e.conversion,i=e.plugins.get("ImageUtils");n.for("dataDowncast").elementToStructure({model:"imageBlock",view:(r,{writer:s})=>ng(s)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(r,{writer:s})=>i.toImageWidget(ng(s),s,t("image widget"))}),n.for("downcast").add(Wi(i,"imageBlock","src")).add(Wi(i,"imageBlock","alt")).add(ug(i,"imageBlock")),n.for("upcast").elementToElement({view:og(e,"imageBlock"),model:(r,{writer:s})=>s.createElement("imageBlock",r.hasAttribute("src")?{src:r.getAttribute("src")}:void 0)}).add(function(r){const s=(a,l,c)=>{if(!c.consumable.test(l.viewItem,{name:!0,classes:"image"}))return;const d=r.findViewImgElement(l.viewItem);if(!d||!c.consumable.test(d,{name:!0}))return;c.consumable.consume(l.viewItem,{name:!0,classes:"image"});const u=ze(c.convertItem(d,l.modelCursor).modelRange.getItems());u?(c.convertChildren(l.viewItem,u),c.updateConversionResult(u,l)):c.consumable.revert(l.viewItem,{name:!0,classes:"image"})};return a=>{a.on("element:figure",s)}}(i))}_setupClipboardIntegration(){const e=this.editor,t=e.model,n=e.editing.view,i=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline");this.listenTo(r,"inputTransformation",(s,a)=>{const l=Array.from(a.content.getChildren());let c;if(!l.every(i.isInlineImageView))return;c=a.targetRanges?e.editing.mapper.toModelRange(a.targetRanges[0]):t.document.selection.getFirstRange();const d=t.createSelection(c);if(da(t.schema,d)==="imageBlock"){const u=new Bi(n.document),g=l.map(f=>u.createElement("figure",{class:"image"},f));a.content=u.createDocumentFragment(g)}})}}var kg=D(3508),Dx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(kg.Z,Dx),kg.Z.locals;class Bx extends q{static get requires(){return[Sx,Mo,hg]}static get pluginName(){return"ImageBlock"}}class Tx extends q{static get requires(){return[pg,zt,Rt]}static get pluginName(){return"ImageInlineEditing"}init(){const e=this.editor,t=e.model.schema;t.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),t.addChildCheck((n,i)=>{if(n.endsWith("caption")&&i.name==="imageInline")return!1}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new fg(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,n=e.conversion,i=e.plugins.get("ImageUtils");n.for("dataDowncast").elementToElement({model:"imageInline",view:(r,{writer:s})=>s.createEmptyElement("img")}),n.for("editingDowncast").elementToStructure({model:"imageInline",view:(r,{writer:s})=>i.toImageWidget(function(a){return a.createContainerElement("span",{class:"image-inline"},a.createEmptyElement("img"))}(s),s,t("image widget"))}),n.for("downcast").add(Wi(i,"imageInline","src")).add(Wi(i,"imageInline","alt")).add(ug(i,"imageInline")),n.for("upcast").elementToElement({view:og(e,"imageInline"),model:(r,{writer:s})=>s.createElement("imageInline",r.hasAttribute("src")?{src:r.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const e=this.editor,t=e.model,n=e.editing.view,i=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline");this.listenTo(r,"inputTransformation",(s,a)=>{const l=Array.from(a.content.getChildren());let c;if(!l.every(i.isBlockImageView))return;c=a.targetRanges?e.editing.mapper.toModelRange(a.targetRanges[0]):t.document.selection.getFirstRange();const d=t.createSelection(c);if(da(t.schema,d)==="imageInline"){const u=new Bi(n.document),g=l.map(f=>f.childCount===1?(Array.from(f.getAttributes()).forEach(b=>u.setAttribute(...b,i.findViewImgElement(f))),f.getChild(0)):f);a.content=u.createDocumentFragment(g)}})}}class Ix extends q{static get requires(){return[Tx,Mo,hg]}static get pluginName(){return"ImageInline"}}var bg=D(2640),Px={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(bg.Z,Px),bg.Z.locals;function wg(o){const e=o.map(t=>t.replace("+","\\+"));return new RegExp(`^image\\/(${e.join("|")})$`)}function Rx(o){return new Promise((e,t)=>{const n=o.getAttribute("src");fetch(n).then(i=>i.blob()).then(i=>{const r=Ag(i,n),s=r.replace("image/",""),a=new File([i],`image.${s}`,{type:r});e(a)}).catch(i=>i&&i.name==="TypeError"?function(r){return function(s){return new Promise((a,l)=>{const c=oe.document.createElement("img");c.addEventListener("load",()=>{const d=oe.document.createElement("canvas");d.width=c.width,d.height=c.height,d.getContext("2d").drawImage(c,0,0),d.toBlob(u=>u?a(u):l())}),c.addEventListener("error",()=>l()),c.src=s})}(r).then(s=>{const a=Ag(s,r),l=a.replace("image/","");return new File([s],`image.${l}`,{type:a})})}(n).then(e).catch(t):t(i))})}function Ag(o,e){return o.type?o.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class Ox extends q{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=e.t,n=i=>{const r=new H2(i),s=e.commands.get("uploadImage"),a=e.config.get("image.upload.types"),l=wg(a);return r.set({acceptedType:a.map(c=>`image/${c}`).join(","),allowMultipleFiles:!0}),r.buttonView.set({label:t("Insert image"),icon:ve.image,tooltip:!0}),r.buttonView.bind("isEnabled").to(s),r.on("done",(c,d)=>{const u=Array.from(d).filter(g=>l.test(g.type));u.length&&(e.execute("uploadImage",{file:u}),e.editing.view.focus())}),r};e.ui.componentFactory.add("uploadImage",n),e.ui.componentFactory.add("imageUpload",n)}}var _g=D(3689),Nx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(_g.Z,Nx),_g.Z.locals;var Cg=D(4036),zx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Cg.Z,zx),Cg.Z.locals;var vg=D(3773),Mx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(vg.Z,Mx),vg.Z.locals;class Fx extends q{constructor(e){super(e),this.uploadStatusChange=(t,n,i)=>{const r=this.editor,s=n.item,a=s.getAttribute("uploadId");if(!i.consumable.consume(n.item,t.name))return;const l=r.plugins.get("ImageUtils"),c=r.plugins.get(Nt),d=a?n.attributeNewValue:null,u=this.placeholder,g=r.editing.mapper.toViewElement(s),f=i.writer;if(d=="reading")return yg(g,f),void Eg(l,u,g,f);if(d=="uploading"){const b=c.loaders.get(a);return yg(g,f),void(b?(xg(g,f),function(A,E,P,z){const j=function(Y){const ie=Y.createUIElement("div",{class:"ck-progress-bar"});return Y.setCustomProperty("progressBar",!0,ie),ie}(E);E.insert(E.createPositionAt(A,"end"),j),P.on("change:uploadedPercent",(Y,ie,Ee)=>{z.change(he=>{he.setStyle("width",Ee+"%",j)})})}(g,f,b,r.editing.view),function(A,E,P,z){if(z.data){const j=A.findViewImgElement(E);P.setAttribute("src",z.data,j)}}(l,g,f,b)):Eg(l,u,g,f))}d=="complete"&&c.loaders.get(a)&&function(b,A,E){const P=A.createUIElement("div",{class:"ck-image-upload-complete-icon"});A.insert(A.createPositionAt(b,"end"),P),setTimeout(()=>{E.change(z=>z.remove(z.createRangeOn(P)))},3e3)}(g,f,r.editing.view),function(b,A){Dg(b,A,"progressBar")}(g,f),xg(g,f),function(b,A){A.removeClass("ck-appear",b)}(g,f)},this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}static get pluginName(){return"ImageUploadProgress"}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),e.plugins.has("ImageInlineEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}}function yg(o,e){o.hasClass("ck-appear")||e.addClass("ck-appear",o)}function Eg(o,e,t,n){t.hasClass("ck-image-upload-placeholder")||n.addClass("ck-image-upload-placeholder",t);const i=o.findViewImgElement(t);i.getAttribute("src")!==e&&n.setAttribute("src",e,i),Sg(t,"placeholder")||n.insert(n.createPositionAfter(i),function(r){const s=r.createUIElement("div",{class:"ck-upload-placeholder-loader"});return r.setCustomProperty("placeholder",!0,s),s}(n))}function xg(o,e){o.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",o),Dg(o,e,"placeholder")}function Sg(o,e){for(const t of o.getChildren())if(t.getCustomProperty(e))return t}function Dg(o,e,t){const n=Sg(o,t);n&&e.remove(e.createRangeOn(n))}var Vx=Object.defineProperty,Lx=Object.defineProperties,jx=Object.getOwnPropertyDescriptors,Bg=Object.getOwnPropertySymbols,$x=Object.prototype.hasOwnProperty,Hx=Object.prototype.propertyIsEnumerable,Tg=(o,e,t)=>e in o?Vx(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;class qx extends ne{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils"),n=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(n)}execute(e){const t=Pe(e.file),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),r=Object.fromEntries(n.getAttributes());t.forEach((s,a)=>{const l=n.getSelectedElement();if(a&&l&&i.isImage(l)){const c=this.editor.model.createPositionAfter(l);this._uploadImage(s,r,c)}else this._uploadImage(s,r)})}_uploadImage(e,t,n){const i=this.editor,r=i.plugins.get(Nt).createLoader(e),s=i.plugins.get("ImageUtils");var a,l;r&&s.insertImage((a=((c,d)=>{for(var u in d||(d={}))$x.call(d,u)&&Tg(c,u,d[u]);if(Bg)for(var u of Bg(d))Hx.call(d,u)&&Tg(c,u,d[u]);return c})({},t),l={uploadId:r.id},Lx(a,jx(l))),n)}}class Ux extends q{constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}static get requires(){return[Nt,Ku,Rt,zt]}static get pluginName(){return"ImageUploadEditing"}init(){const e=this.editor,t=e.model.document,n=e.conversion,i=e.plugins.get(Nt),r=e.plugins.get("ImageUtils"),s=e.plugins.get("ClipboardPipeline"),a=wg(e.config.get("image.upload.types")),l=new qx(e);e.commands.add("uploadImage",l),e.commands.add("imageUpload",l),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(c,d)=>{if(u=d.dataTransfer,Array.from(u.types).includes("text/html")&&u.getData("text/html")!=="")return;var u;const g=Array.from(d.dataTransfer.files).filter(f=>!!f&&a.test(f.type));g.length&&(c.stop(),e.model.change(f=>{d.targetRanges&&f.setSelection(d.targetRanges.map(b=>e.editing.mapper.toModelRange(b))),e.model.enqueueChange(()=>{e.execute("uploadImage",{file:g})})}))}),this.listenTo(s,"inputTransformation",(c,d)=>{const u=Array.from(e.editing.view.createRangeIn(d.content)).map(f=>f.item).filter(f=>function(b,A){return!(!b.isInlineImageView(A)||!A.getAttribute("src")||!A.getAttribute("src").match(/^data:image\/\w+;base64,/g)&&!A.getAttribute("src").match(/^blob:/g))}(r,f)&&!f.getAttribute("uploadProcessed")).map(f=>({promise:Rx(f),imageElement:f}));if(!u.length)return;const g=new Bi(e.editing.view.document);for(const f of u){g.setAttribute("uploadProcessed",!0,f.imageElement);const b=i.createLoader(f.promise);b&&(g.setAttribute("src","",f.imageElement),g.setAttribute("uploadId",b.id,f.imageElement))}}),e.editing.view.document.on("dragover",(c,d)=>{d.preventDefault()}),t.on("change",()=>{const c=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),d=new Set;for(const u of c)if(u.type=="insert"&&u.name!="$text"){const g=u.position.nodeAfter,f=u.position.root.rootName=="$graveyard";for(const b of Wx(e,g)){const A=b.getAttribute("uploadId");if(!A)continue;const E=i.loaders.get(A);E&&(f?d.has(A)||E.abort():(d.add(A),this._uploadImageElements.set(A,b),E.status=="idle"&&this._readAndUpload(E)))}}}),this.on("uploadComplete",(c,{imageElement:d,data:u})=>{const g=u.urls?u.urls:u;this.editor.model.change(f=>{f.setAttribute("src",g.default,d),this._parseAndSetSrcsetAttributeOnImage(g,d,f)})},{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,n=t.model,i=t.locale.t,r=t.plugins.get(Nt),s=t.plugins.get(Ku),a=t.plugins.get("ImageUtils"),l=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},d=>{d.setAttribute("uploadStatus","reading",l.get(e.id))}),e.read().then(()=>{const d=e.upload(),u=l.get(e.id);if(k.isSafari){const g=t.editing.mapper.toViewElement(u),f=a.findViewImgElement(g);t.editing.view.once("render",()=>{if(!f.parent)return;const b=t.editing.view.domConverter.mapViewToDom(f.parent);if(!b)return;const A=b.style.display;b.style.display="none",b._ckHack=b.offsetHeight,b.style.display=A})}return n.enqueueChange({isUndoable:!1},g=>{g.setAttribute("uploadStatus","uploading",u)}),d}).then(d=>{n.enqueueChange({isUndoable:!1},u=>{const g=l.get(e.id);u.setAttribute("uploadStatus","complete",g),this.fire("uploadComplete",{data:d,imageElement:g})}),c()}).catch(d=>{if(e.status!=="error"&&e.status!=="aborted")throw d;e.status=="error"&&d&&s.showWarning(d,{title:i("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},u=>{u.remove(l.get(e.id))}),c()});function c(){n.enqueueChange({isUndoable:!1},d=>{const u=l.get(e.id);d.removeAttribute("uploadId",u),d.removeAttribute("uploadStatus",u),l.delete(e.id)}),r.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,n){let i=0;const r=Object.keys(e).filter(s=>{const a=parseInt(s,10);if(!isNaN(a))return i=Math.max(i,a),!0}).map(s=>`${e[s]} ${s}w`).join(", ");r!=""&&n.setAttribute("srcset",{data:r,width:i},t)}}function Wx(o,e){const t=o.plugins.get("ImageUtils");return Array.from(o.model.createRangeOn(e)).filter(n=>t.isImage(n.item)).map(n=>n.item)}var Ig=D(1568),Kx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Ig.Z,Kx),Ig.Z.locals;var Pg=D(3535),Gx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Pg.Z,Gx),Pg.Z.locals;class Zx extends ne{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,n=t.model,i=t.plugins.get("ImageUtils").getClosestSelectedImageElement(n.document.selection);this.value={width:e.width,height:null},i&&n.change(r=>{r.setAttribute("width",e.width,i)})}}class Jx extends q{static get requires(){return[zt]}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 Zx(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(n=>n.on(`attribute:width:${e}`,(i,r,s)=>{if(!s.consumable.consume(r.item,i.name))return;const a=s.writer,l=s.mapper.toViewElement(r.item);r.attributeNewValue!==null?(a.setStyle("width",r.attributeNewValue,l),a.addClass("image_resized",l)):(a.removeStyle("width",l),a.removeClass("image_resized",l))})),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{width:/.+/}},model:{key:"width",value:n=>n.getStyle("width")}})}}const ha={small:ve.objectSizeSmall,medium:ve.objectSizeMedium,large:ve.objectSizeLarge,original:ve.objectSizeFull};function Rg(o){return e=>o===null&&e===o||e!==null&&e.width===o}var Og=D(6270),Yx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Og.Z,Yx),Og.Z.locals;class Qx extends ne{constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map(n=>{if(n.isDefault)for(const i of n.modelElements)this._defaultStyles[i]=n.name;return[n.name,n]}))}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,n=t.model,i=t.plugins.get("ImageUtils");n.change(r=>{const s=e.value;let a=i.getClosestSelectedImageElement(n.document.selection);s&&this.shouldConvertImageType(s,a)&&(this.editor.execute(i.isBlockImage(a)?"imageTypeInline":"imageTypeBlock"),a=i.getClosestSelectedImageElement(n.document.selection)),!s||this._styles.get(s).isDefault?r.removeAttribute("imageStyle",a):r.setAttribute("imageStyle",s,a)})}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}}var Xx=Object.defineProperty,Ng=Object.getOwnPropertySymbols,e5=Object.prototype.hasOwnProperty,t5=Object.prototype.propertyIsEnumerable,zg=(o,e,t)=>e in o?Xx(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Mg=(o,e)=>{for(var t in e||(e={}))e5.call(e,t)&&zg(o,t,e[t]);if(Ng)for(var t of Ng(e))t5.call(e,t)&&zg(o,t,e[t]);return o};const{objectFullWidth:n5,objectInline:Fg,objectLeft:Vg,objectRight:ua,objectCenter:ma,objectBlockLeft:Lg,objectBlockRight:jg}=ve,Gi={get inline(){return{name:"inline",title:"In line",icon:Fg,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Vg,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:Lg,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:ma,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:ua,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:jg,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:ma,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:ua,modelElements:["imageBlock"],className:"image-style-side"}}},$g={full:n5,left:Lg,right:jg,center:ma,inlineLeft:Vg,inlineRight:ua,inline:Fg},Hg=[{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 qg(o){Q("image-style-configuration-definition-invalid",o)}const ga={normalizeStyles:function(o){return(o.configuredStyles.options||[]).map(e=>function(t){return t=typeof t=="string"?Gi[t]?Mg({},Gi[t]):{name:t}:function(n,i){const r=Mg({},i);for(const s in n)Object.prototype.hasOwnProperty.call(i,s)||(r[s]=n[s]);return r}(Gi[t.name],t),typeof t.icon=="string"&&(t.icon=$g[t.icon]||t.icon),t}(e)).filter(e=>function(t,{isBlockPluginLoaded:n,isInlinePluginLoaded:i}){const{modelElements:r,name:s}=t;if(!(r&&r.length&&s))return qg({style:t}),!1;{const a=[n?"imageBlock":null,i?"imageInline":null];if(!r.some(l=>a.includes(l)))return Q("image-style-missing-dependency",{style:t,missingPlugins:r.map(l=>l==="imageBlock"?"ImageBlockEditing":"ImageInlineEditing")}),!1}return!0}(e,o))},getDefaultStylesConfiguration:function(o,e){return o&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:o?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(o){return o.has("ImageBlockEditing")&&o.has("ImageInlineEditing")?[...Hg]:[]},warnInvalidStyle:qg,DEFAULT_OPTIONS:Gi,DEFAULT_ICONS:$g,DEFAULT_DROPDOWN_DEFINITIONS:Hg};function Ug(o,e){for(const t of e)if(t.name===o)return t}class Wg extends q{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[zt]}init(){const{normalizeStyles:e,getDefaultStylesConfiguration:t}=ga,n=this.editor,i=n.plugins.has("ImageBlockEditing"),r=n.plugins.has("ImageInlineEditing");n.config.define("image.styles",t(i,r)),this.normalizedStyles=e({configuredStyles:n.config.get("image.styles"),isBlockPluginLoaded:i,isInlinePluginLoaded:r}),this._setupConversion(i,r),this._setupPostFixer(),n.commands.add("imageStyle",new Qx(n,this.normalizedStyles))}_setupConversion(e,t){const n=this.editor,i=n.model.schema,r=(s=this.normalizedStyles,(l,c,d)=>{if(!d.consumable.consume(c.item,l.name))return;const u=Ug(c.attributeNewValue,s),g=Ug(c.attributeOldValue,s),f=d.mapper.toViewElement(c.item),b=d.writer;g&&b.removeClass(g.className,f),u&&b.addClass(u.className,f)});var s;const a=function(l){const c={imageInline:l.filter(d=>!d.isDefault&&d.modelElements.includes("imageInline")),imageBlock:l.filter(d=>!d.isDefault&&d.modelElements.includes("imageBlock"))};return(d,u,g)=>{if(!u.modelRange)return;const f=u.viewItem,b=ze(u.modelRange.getItems());if(b&&g.schema.checkAttribute(b,"imageStyle"))for(const A of c[b.name])g.consumable.consume(f,{classes:A.className})&&g.writer.setAttribute("imageStyle",A.name,b)}}(this.normalizedStyles);n.editing.downcastDispatcher.on("attribute:imageStyle",r),n.data.downcastDispatcher.on("attribute:imageStyle",r),e&&(i.extend("imageBlock",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:figure",a,{priority:"low"})),t&&(i.extend("imageInline",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:img",a,{priority:"low"}))}_setupPostFixer(){const e=this.editor,t=e.model.document,n=e.plugins.get(zt),i=new Map(this.normalizedStyles.map(r=>[r.name,r]));t.registerPostFixer(r=>{let s=!1;for(const a of t.differ.getChanges())if(a.type=="insert"||a.type=="attribute"&&a.attributeKey=="imageStyle"){let l=a.type=="insert"?a.position.nodeAfter:a.range.start.nodeAfter;if(l&&l.is("element","paragraph")&&l.childCount>0&&(l=l.getChild(0)),!n.isImage(l))continue;const c=l.getAttribute("imageStyle");if(!c)continue;const d=i.get(c);d&&d.modelElements.includes(l.name)||(r.removeAttribute("imageStyle",l),s=!0)}return s})}}var Kg=D(5083),o5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Kg.Z,o5),Kg.Z.locals;class i5 extends q{static get requires(){return[Wg]}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")||[],n=Gg(e.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const r of n)this._createButton(r);const i=Gg([...t.filter(xe),...ga.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const r of i)this._createDropdown(r,n)}_createDropdown(e,t){const n=this.editor.ui.componentFactory;n.add(e.name,i=>{let r;const{defaultItem:s,items:a,title:l}=e,c=a.filter(f=>t.find(({name:b})=>Zg(b)===f)).map(f=>{const b=n.create(f);return f===s&&(r=b),b});a.length!==c.length&&ga.warnInvalidStyle({dropdown:e});const d=Pt(i,Fs),u=d.buttonView,g=u.arrowView;return Pi(d,c,{enableActiveItemFocusOnDropdownOpen:!0}),u.set({label:Jg(l,r.label),class:null,tooltip:!0}),g.unbind("label"),g.set({label:l}),u.bind("icon").toMany(c,"isOn",(...f)=>{const b=f.findIndex(an);return b<0?r.icon:c[b].icon}),u.bind("label").toMany(c,"isOn",(...f)=>{const b=f.findIndex(an);return Jg(l,b<0?r.label:c[b].label)}),u.bind("isOn").toMany(c,"isOn",(...f)=>f.some(an)),u.bind("class").toMany(c,"isOn",(...f)=>f.some(an)?"ck-splitbutton_flatten":void 0),u.on("execute",()=>{c.some(({isOn:f})=>f)?d.isOpen=!d.isOpen:r.fire("execute")}),d.bind("isEnabled").toMany(c,"isEnabled",(...f)=>f.some(an)),this.listenTo(d,"execute",()=>{this.editor.editing.view.focus()}),d})}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(Zg(t),n=>{const i=this.editor.commands.get("imageStyle"),r=new Ae(n);return r.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),r.bind("isEnabled").to(i,"isEnabled"),r.bind("isOn").to(i,"value",s=>s===t),r.on("execute",this._executeCommand.bind(this,t)),r})}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus()}}function Gg(o,e){for(const t of o)e[t.title]&&(t.title=e[t.title]);return o}function Zg(o){return`imageStyle:${o}`}function Jg(o,e){return(o?o+": ":"")+e}class r5 extends q{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new ld(e)),e.commands.add("outdent",new ld(e))}}const Yg='<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>',Qg='<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 s5 extends q{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,n=e.t,i=t.uiLanguageDirection=="ltr"?Yg:Qg,r=t.uiLanguageDirection=="ltr"?Qg:Yg;this._defineButton("indent",n("Increase indent"),i),this._defineButton("outdent",n("Decrease indent"),r)}_defineButton(e,t,n){const i=this.editor;i.ui.componentFactory.add(e,r=>{const s=i.commands.get(e),a=new Ae(r);return a.set({label:t,icon:n,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",()=>{i.execute(e),i.editing.view.focus()}),a})}}class Zi extends ne{constructor(e,t){super(e),this._indentBehavior=t}refresh(){const e=this.editor.model,t=ze(e.document.selection.getSelectedBlocks());t&&e.schema.checkAttribute(t,"blockIndent")?this.isEnabled=this._indentBehavior.checkEnabled(t.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const e=this.editor.model,t=function(n){const i=n.document.selection,r=n.schema;return Array.from(i.getSelectedBlocks()).filter(s=>r.checkAttribute(s,"blockIndent"))}(e);e.change(n=>{for(const i of t){const r=i.getAttribute("blockIndent"),s=this._indentBehavior.getNextIndent(r);s?n.setAttribute("blockIndent",s,i):n.removeAttribute("blockIndent",i)}})}}class Xg{constructor(e){this.isForward=e.direction==="forward",this.offset=e.offset,this.unit=e.unit}checkEnabled(e){const t=parseFloat(e||"0");return this.isForward||t>0}getNextIndent(e){const t=parseFloat(e||"0");if(!(!e||e.endsWith(this.unit)))return this.isForward?this.offset+this.unit:void 0;const n=t+(this.isForward?this.offset:-this.offset);return n>0?n+this.unit:void 0}}class ep{constructor(e){this.isForward=e.direction==="forward",this.classes=e.classes}checkEnabled(e){const t=this.classes.indexOf(e);return this.isForward?t<this.classes.length-1:t>=0}getNextIndent(e){const t=this.classes.indexOf(e),n=this.isForward?1:-1;return this.classes[t+n]}}const a5=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class l5{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(t=>this._definitions.add(t)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(t,n,i)=>{if(!i.consumable.test(n.item,"attribute:linkHref")||!n.item.is("selection")&&!i.schema.isInline(n.item))return;const r=i.writer,s=r.document.selection;for(const a of this._definitions){const l=r.createAttributeElement("a",a.attributes,{priority:5});a.classes&&r.addClass(a.classes,l);for(const c in a.styles)r.setStyle(c,a.styles[c],l);r.setCustomProperty("link",!0,l),a.callback(n.attributeNewValue)?n.item.is("selection")?r.wrap(s.getFirstRange(),l):r.wrap(i.mapper.toViewRange(n.range),l):r.unwrap(i.mapper.toViewRange(n.range),l)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",(t,n,{writer:i,mapper:r})=>{const s=r.toViewElement(n.item),a=Array.from(s.getChildren()).find(l=>l.is("element","a"));for(const l of this._definitions){const c=Dt(l.attributes);if(l.callback(n.attributeNewValue)){for(const[d,u]of c)d==="class"?i.addClass(u,a):i.setAttribute(d,u,a);l.classes&&i.addClass(l.classes,a);for(const d in l.styles)i.setStyle(d,l.styles[d],a)}else{for(const[d,u]of c)d==="class"?i.removeClass(u,a):i.removeAttribute(d,a);l.classes&&i.removeClass(l.classes,a);for(const d in l.styles)i.removeStyle(d,a)}}})}}}const c5=function(o,e,t){var n=o.length;return t=t===void 0?n:t,!e&&t>=n?o:bd(o,e,t)};var d5=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const tp=function(o){return d5.test(o)},h5=function(o){return o.split("")};var np="\\ud800-\\udfff",u5="["+np+"]",pa="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",fa="\\ud83c[\\udffb-\\udfff]",op="[^"+np+"]",ip="(?:\\ud83c[\\udde6-\\uddff]){2}",rp="[\\ud800-\\udbff][\\udc00-\\udfff]",sp="(?:"+pa+"|"+fa+")?",ap="[\\ufe0e\\ufe0f]?",m5=ap+sp+("(?:\\u200d(?:"+[op,ip,rp].join("|")+")"+ap+sp+")*"),g5="(?:"+[op+pa+"?",pa,ip,rp,u5].join("|")+")",p5=RegExp(fa+"(?="+fa+")|"+g5+m5,"g");const f5=function(o){return o.match(p5)||[]},k5=function(o){return tp(o)?f5(o):h5(o)},b5=function(o){return function(e){e=ns(e);var t=tp(e)?k5(e):void 0,n=t?t[0]:e.charAt(0),i=t?c5(t,1).join(""):e.slice(1);return n[o]()+i}}("toUpperCase"),w5=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,A5=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,_5=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,C5=/^((\w+:(\/{2,})?)|(\W))/i,ka="Ctrl+K";function lp(o,{writer:e}){const t=e.createAttributeElement("a",{href:o},{priority:5});return e.setCustomProperty("link",!0,t),t}function cp(o){const e=String(o);return function(t){return!!t.replace(w5,"").match(A5)}(e)?e:"#"}function ba(o,e){return!!o&&e.checkAttribute(o.name,"linkHref")}function wa(o,e){const t=(n=o,_5.test(n)?"mailto:":e);var n;const i=!!t&&!dp(o);return o&&i?t+o:o}function dp(o){return C5.test(o)}function hp(o){window.open(o,"_blank","noopener")}class v5 extends ne{constructor(){super(...arguments),this.manualDecorators=new at,this.automaticDecorators=new l5}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,n=t.getSelectedElement()||ze(t.getSelectedBlocks());ba(n,e.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(n,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const i of this.manualDecorators)i.value=this._getDecoratorStateFromModel(i.id)}execute(e,t={}){const n=this.editor.model,i=n.document.selection,r=[],s=[];for(const a in t)t[a]?r.push(a):s.push(a);n.change(a=>{if(i.isCollapsed){const l=i.getFirstPosition();if(i.hasAttribute("linkHref")){const c=up(i);let d=Gn(l,"linkHref",i.getAttribute("linkHref"),n);i.getAttribute("linkHref")===c&&(d=this._updateLinkContent(n,a,d,e)),a.setAttribute("linkHref",e,d),r.forEach(u=>{a.setAttribute(u,!0,d)}),s.forEach(u=>{a.removeAttribute(u,d)}),a.setSelection(a.createPositionAfter(d.end.nodeBefore))}else if(e!==""){const c=Dt(i.getAttributes());c.set("linkHref",e),r.forEach(u=>{c.set(u,!0)});const{end:d}=n.insertContent(a.createText(e,c),l);a.setSelection(d)}["linkHref",...r,...s].forEach(c=>{a.removeSelectionAttribute(c)})}else{const l=n.schema.getValidRanges(i.getRanges(),"linkHref"),c=[];for(const u of i.getSelectedBlocks())n.schema.checkAttribute(u,"linkHref")&&c.push(a.createRangeOn(u));const d=c.slice();for(const u of l)this._isRangeToUpdate(u,c)&&d.push(u);for(const u of d){let g=u;if(d.length===1){const f=up(i);i.getAttribute("linkHref")===f&&(g=this._updateLinkContent(n,a,u,e),a.setSelection(a.createSelection(g)))}a.setAttribute("linkHref",e,g),r.forEach(f=>{a.setAttribute(f,!0,g)}),s.forEach(f=>{a.removeAttribute(f,g)})}}})}_getDecoratorStateFromModel(e){const t=this.editor.model,n=t.document.selection,i=n.getSelectedElement();return ba(i,t.schema)?i.getAttribute(e):n.getAttribute(e)}_isRangeToUpdate(e,t){for(const n of t)if(n.containsRange(e))return!1;return!0}_updateLinkContent(e,t,n,i){const r=t.createText(i,{linkHref:i});return e.insertContent(r,n)}}function up(o){if(o.isCollapsed){const e=o.getFirstPosition();return e.textNode&&e.textNode.data}{const e=Array.from(o.getFirstRange().getItems());if(e.length>1)return null;const t=e[0];return t.is("$text")||t.is("$textProxy")?t.data:null}}class y5 extends ne{refresh(){const e=this.editor.model,t=e.document.selection,n=t.getSelectedElement();ba(n,e.schema)?this.isEnabled=e.schema.checkAttribute(n,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,n=t.document.selection,i=e.commands.get("link");t.change(r=>{const s=n.isCollapsed?[Gn(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),t)]:t.schema.getValidRanges(n.getRanges(),"linkHref");for(const a of s)if(r.removeAttribute("linkHref",a),i)for(const l of i.manualDecorators)r.removeAttribute(l.id,a)})}}class E5 extends ge(){constructor({id:e,label:t,attributes:n,classes:i,styles:r,defaultValue:s}){super(),this.id=e,this.set("value",void 0),this.defaultValue=s,this.label=t,this.attributes=n,this.classes=i,this.styles=r}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}var mp=D(9773),x5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(mp.Z,x5),mp.Z.locals;var S5=Object.defineProperty,gp=Object.getOwnPropertySymbols,D5=Object.prototype.hasOwnProperty,B5=Object.prototype.propertyIsEnumerable,pp=(o,e,t)=>e in o?S5(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,T5=(o,e)=>{for(var t in e||(e={}))D5.call(e,t)&&pp(o,t,e[t]);if(gp)for(var t of gp(e))B5.call(e,t)&&pp(o,t,e[t]);return o};const fp="automatic",I5=/^(https?:)?\/\//;class P5 extends q{static get pluginName(){return"LinkEditing"}static get requires(){return[gm,am,Rt]}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:lp}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(n,i)=>lp(cp(n),i)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:n=>n.getAttribute("href")}}),e.commands.add("link",new v5(e)),e.commands.add("unlink",new y5(e));const t=function(n,i){const r={"Open in a new tab":n("Open in a new tab"),Downloadable:n("Downloadable")};return i.forEach(s=>("label"in s&&r[s.label]&&(s.label=r[s.label]),s)),i}(e.t,function(n){const i=[];if(n)for(const[r,s]of Object.entries(n)){const a=Object.assign({},s,{id:`link${b5(r)}`});i.push(a)}return i}(e.config.get("link.decorators")));this._enableAutomaticDecorators(t.filter(n=>n.mode===fp)),this._enableManualDecorators(t.filter(n=>n.mode==="manual")),e.plugins.get(gm).registerAttribute("linkHref"),function(n,i,r,s){const a=n.editing.view,l=new Set;a.document.registerPostFixer(c=>{const d=n.model.document.selection;let u=!1;if(d.hasAttribute(i)){const g=Gn(d.getFirstPosition(),i,d.getAttribute(i),n.model),f=n.editing.mapper.toViewRange(g);for(const b of f.getItems())b.is("element",r)&&!b.hasClass(s)&&(c.addClass(s,b),l.add(b),u=!0)}return u}),n.conversion.for("editingDowncast").add(c=>{function d(){a.change(u=>{for(const g of l.values())u.removeClass(s,g),l.delete(g)})}c.on("insert",d,{priority:"highest"}),c.on("remove",d,{priority:"highest"}),c.on("attribute",d,{priority:"highest"}),c.on("selection",d,{priority:"highest"})})}(e,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){const t=this.editor,n=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:fp,callback:i=>!!i&&I5.test(i),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(e),n.length&&t.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,n=t.commands.get("link").manualDecorators;e.forEach(i=>{t.model.schema.extend("$text",{allowAttributes:i.id});const r=new E5(i);n.add(r),t.conversion.for("downcast").attributeToElement({model:r.id,view:(s,{writer:a,schema:l},{item:c})=>{if((c.is("selection")||l.isInline(c))&&s){const d=a.createAttributeElement("a",r.attributes,{priority:5});r.classes&&a.addClass(r.classes,d);for(const u in r.styles)a.setStyle(u,r.styles[u],d);return a.setCustomProperty("link",!0,d),d}}}),t.conversion.for("upcast").elementToAttribute({view:T5({name:"a"},r._createPattern()),model:{key:r.id}})})}_enableLinkOpen(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(n,i)=>{if(!(k.isMac?i.domEvent.metaKey:i.domEvent.ctrlKey))return;let r=i.domTarget;if(r.tagName.toLowerCase()!="a"&&(r=r.closest("a")),!r)return;const s=r.getAttribute("href");s&&(n.stop(),i.preventDefault(),hp(s))},{context:"$capture"}),this.listenTo(t,"keydown",(n,i)=>{const r=e.commands.get("link").value;r&&i.keyCode===se.enter&&i.altKey&&(n.stop(),hp(r))})}_enableInsertContentSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection;this.listenTo(e,"insertContent",()=>{const n=t.anchor.nodeBefore,i=t.anchor.nodeAfter;t.hasAttribute("linkHref")&&n&&n.hasAttribute("linkHref")&&(i&&i.hasAttribute("linkHref")||e.change(r=>{Aa(r,_a(e.schema))}))},{priority:"low"})}_enableClickingAfterLink(){const e=this.editor,t=e.model;e.editing.view.addObserver(Ns);let n=!1;this.listenTo(e.editing.view.document,"mousedown",()=>{n=!0}),this.listenTo(e.editing.view.document,"selectionChange",()=>{if(!n)return;n=!1;const i=t.document.selection;if(!i.isCollapsed||!i.hasAttribute("linkHref"))return;const r=i.getFirstPosition(),s=Gn(r,"linkHref",i.getAttribute("linkHref"),t);(r.isTouching(s.start)||r.isTouching(s.end))&&t.change(a=>{Aa(a,_a(t.schema))})})}_enableTypingOverLink(){const e=this.editor,t=e.editing.view;let n=null,i=!1;this.listenTo(t.document,"delete",()=>{i=!0},{priority:"high"}),this.listenTo(e.model,"deleteContent",()=>{const r=e.model.document.selection;r.isCollapsed||(i?i=!1:kp(e)&&function(s){const a=s.document.selection,l=a.getFirstPosition(),c=a.getLastPosition(),d=l.nodeAfter;if(!d||!d.is("$text")||!d.hasAttribute("linkHref"))return!1;const u=c.textNode||c.nodeBefore;return d===u?!0:Gn(l,"linkHref",d.getAttribute("linkHref"),s).containsRange(s.createRange(l,c),!0)}(e.model)&&(n=r.getAttributes()))},{priority:"high"}),this.listenTo(e.model,"insertContent",(r,[s])=>{i=!1,kp(e)&&n&&(e.model.change(a=>{for(const[l,c]of n)a.setAttribute(l,c,s)}),n=null)},{priority:"high"})}_handleDeleteContentAfterLink(){const e=this.editor,t=e.model,n=t.document.selection,i=e.editing.view;let r=!1,s=!1;this.listenTo(i.document,"delete",(a,l)=>{s=l.direction==="backward"},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{r=!1;const a=n.getFirstPosition(),l=n.getAttribute("linkHref");if(!l)return;const c=Gn(a,"linkHref",l,t);r=c.containsPosition(a)||c.end.isEqual(a)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{s&&(s=!1,r||e.model.enqueueChange(a=>{Aa(a,_a(t.schema))}))},{priority:"low"})}_enableClipboardIntegration(){const e=this.editor,t=e.model,n=this.editor.config.get("link.defaultProtocol");n&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(i,r)=>{t.change(s=>{const a=s.createRangeIn(r.content);for(const l of a.getItems())if(l.hasAttribute("linkHref")){const c=wa(l.getAttribute("linkHref"),n);s.setAttribute("linkHref",c,l)}})})}}function Aa(o,e){o.removeSelectionAttribute("linkHref");for(const t of e)o.removeSelectionAttribute(t)}function kp(o){return o.model.change(e=>e.batch).isTyping}function _a(o){return o.getDefinition("$text").allowAttributes.filter(e=>e.startsWith("link"))}var bp=D(7754),R5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(bp.Z,R5),bp.Z.locals;class O5 extends re{constructor(e,t){super(e),this.focusTracker=new ht,this.keystrokes=new St,this._focusables=new on;const n=e.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),ve.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),ve.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new bo({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const i=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&i.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:i,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),p({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)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const e=this.locale.t,t=new Xc(this.locale,_u);return t.label=e("Link URL"),t}_createButton(e,t,n,i){const r=new Ae(this.locale);return r.set({label:e,icon:t,tooltip:!0}),r.extendTemplate({attributes:{class:n}}),i&&r.delegate("execute").to(this,i),r}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const n of e.manualDecorators){const i=new hi(this.locale);i.set({name:n.id,label:n.label,withText:!0}),i.bind("isOn").toMany([n,e],"value",(r,s)=>s===void 0&&r===void 0?!!n.defaultValue:!!r),i.on("execute",()=>{n.set("value",!i.isOn)}),t.add(i)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const n=new re;n.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map(i=>({tag:"li",children:[i],attributes:{class:["ck","ck-list__item"]}})),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(n)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}var wp=D(2347),N5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(wp.Z,N5),wp.Z.locals;class z5 extends re{constructor(e){super(e),this.focusTracker=new ht,this.keystrokes=new St,this._focusables=new on;const t=e.t;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"),ve.pencil,"edit"),this.set("href",void 0),this._focusCycler=new bo({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)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,n){const i=new Ae(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.delegate("execute").to(this,n),i}_createPreviewButton(){const e=new Ae(this.locale),t=this.bindTemplate,n=this.t;return e.set({withText:!0,tooltip:n("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",i=>i&&cp(i)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",i=>i||n("This link has no URL")),e.bind("isEnabled").to(this,"href",i=>!!i),e.template.tag="a",e.template.eventListeners={},e}}const Et="link-ui";class M5 extends q{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[Fi]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(j1),this._balloon=e.plugins.get(Fi),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:Et,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:Et,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new z5(e.locale),n=e.commands.get("link"),i=e.commands.get("unlink");return t.bind("href").to(n,"value"),t.editButtonView.bind("isEnabled").to(n),t.unlinkButtonView.bind("isEnabled").to(i),this.listenTo(t,"edit",()=>{this._addFormView()}),this.listenTo(t,"unlink",()=>{e.execute("unlink"),this._hideUI()}),t.keystrokes.set("Esc",(r,s)=>{this._hideUI(),s()}),t.keystrokes.set(ka,(r,s)=>{this._addFormView(),s()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),n=e.config.get("link.defaultProtocol"),i=new(S(O5))(e.locale,t);return i.urlInputView.fieldView.bind("value").to(t,"value"),i.urlInputView.bind("isEnabled").to(t,"isEnabled"),i.saveButtonView.bind("isEnabled").to(t),this.listenTo(i,"submit",()=>{const{value:r}=i.urlInputView.fieldView.element,s=wa(r,n);e.execute("link",s,i.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(i,"cancel",()=>{this._closeFormView()}),i.keystrokes.set("Esc",(r,s)=>{this._closeFormView(),s()}),i}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),n=e.t;e.ui.componentFactory.add("link",i=>{const r=new Ae(i);return r.isEnabled=!0,r.label=n("Link"),r.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>',r.keystroke=ka,r.tooltip=!0,r.isToggleable=!0,r.bind("isEnabled").to(t,"isEnabled"),r.bind("isOn").to(t,"value",s=>!!s),this.listenTo(r,"execute",()=>this._showUI(!0)),r})}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(ka,(n,i)=>{i(),e.commands.get("link").isEnabled&&this._showUI(!0)})}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),w({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const 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(),e.value!==void 0?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.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let n=this._getSelectedLinkElement(),i=s();const r=()=>{const a=this._getSelectedLinkElement(),l=s();n&&!a||!n&&l!==i?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=a,i=l};function s(){return t.selection.focus.getAncestors().reverse().find(a=>a.is("element"))}this.listenTo(e.ui,"update",r),this.listenTo(this._balloon,"change:visibleView",r)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,n=e.document;let i;if(t.markers.has(Et)){const r=Array.from(this.editor.editing.mapper.markerNameToElements(Et)),s=e.createRange(e.createPositionBefore(r[0]),e.createPositionAfter(r[r.length-1]));i=e.domConverter.viewRangeToDom(s)}else i=()=>{const r=this._getSelectedLinkElement();return r?e.domConverter.mapViewToDom(r):e.domConverter.viewRangeToDom(n.selection.getFirstRange())};return{target:i}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,n=t.getSelectedElement();if(t.isCollapsed||n&&Be(n))return Ca(t.getFirstPosition());{const i=t.getFirstRange().getTrimmed(),r=Ca(i.start),s=Ca(i.end);return r&&r==s&&e.createRangeIn(r).getTrimmed().isEqual(i)?r:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const n=e.document.selection.getFirstRange();if(e.markers.has(Et))t.updateMarker(Et,{range:n});else if(n.start.isAtEnd){const i=n.start.getLastMatchingPosition(({item:r})=>!e.schema.isContent(r),{boundaries:n});t.addMarker(Et,{usingOperation:!1,affectsData:!1,range:t.createRange(i,n.end)})}else t.addMarker(Et,{usingOperation:!1,affectsData:!1,range:n})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(Et)&&e.change(t=>{t.removeMarker(Et)})}}function Ca(o){return o.getAncestors().find(e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t})||null}const F5=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 V5 extends q{static get requires(){return[Wn]}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 mm(e.model,n=>{if(!function(r){return r.length>4&&r[r.length-1]===" "&&r[r.length-2]!==" "}(n))return;const i=Ap(n.substr(0,n.length-1));return i?{url:i}:void 0});t.on("matched:data",(n,i)=>{const{batch:r,range:s,url:a}=i;if(!r.isTyping)return;const l=s.end.getShiftedBy(-1),c=l.getShiftedBy(-a.length),d=e.model.createRange(c,l);this._applyAutoLink(a,d)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,n=e.commands.get("enter");n&&n.on("execute",()=>{const i=t.document.selection.getFirstPosition();if(!i.parent.previousSibling)return;const r=t.createRangeIn(i.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(r)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,n=e.commands.get("shiftEnter");n&&n.on("execute",()=>{const i=t.document.selection.getFirstPosition(),r=t.createRange(t.createPositionAt(i.parent,0),i.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(r)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:n,range:i}=um(e,t),r=Ap(n);if(r){const s=t.createRange(i.end.getShiftedBy(-r.length),i.end);this._applyAutoLink(r,s)}}_applyAutoLink(e,t){const n=this.editor.model,i=wa(e,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(r,s){return s.schema.checkAttributeInSelection(s.createSelection(r),"linkHref")}(t,n)&&dp(i)&&!function(r){const s=r.start.nodeAfter;return!!s&&s.hasAttribute("linkHref")}(t)&&this._persistAutoLink(i,t)}_persistAutoLink(e,t){const n=this.editor.model,i=this.editor.plugins.get("Delete");n.enqueueChange(r=>{r.setAttribute("linkHref",e,t),n.enqueueChange(()=>{i.requestUndoOnBackspace()})})}}function Ap(o){const e=F5.exec(o);return e?e[2]:null}var _p=D(111),L5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(_p.Z,L5),_p.Z.locals;var Cp=D(5730),j5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Cp.Z,j5),Cp.Z.locals;var vp=D(4564),$5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(vp.Z,$5),vp.Z.locals;function H5(o,e){const t=e.mapper,n=e.writer,i=o.getAttribute("listType")=="numbered"?"ol":"ul",r=function(a){const l=a.createContainerElement("li");return l.getFillerOffset=W5,l}(n),s=n.createContainerElement(i,null);return n.insert(n.createPositionAt(s,0),r),t.bindElements(o,r),r}function yp(o,e,t,n){const i=e.parent,r=t.mapper,s=t.writer;let a=r.toViewPosition(n.createPositionBefore(o));const l=xp(o.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:o.getAttribute("listIndent")}),c=o.previousSibling;if(l&&l.getAttribute("listIndent")==o.getAttribute("listIndent")){const d=r.toViewElement(l);a=s.breakContainer(s.createPositionAfter(d))}else if(c&&c.name=="listItem"){a=r.toViewPosition(n.createPositionAt(c,"end"));const d=r.findMappedViewAncestor(a),u=function(g){for(const f of g.getChildren())if(f.name=="ul"||f.name=="ol")return f;return null}(d);a=u?s.createPositionBefore(u):s.createPositionAt(d,"end")}else a=r.toViewPosition(n.createPositionBefore(o));if(a=Ep(a),s.insert(a,i),c&&c.name=="listItem"){const d=r.toViewElement(c),u=s.createRange(s.createPositionAt(d,0),a).getWalker({ignoreElementEnd:!0});for(const g of u)if(g.item.is("element","li")){const f=s.breakContainer(s.createPositionBefore(g.item)),b=g.item.parent,A=s.createPositionAt(e,"end");ct(s,A.nodeBefore,A.nodeAfter),s.move(s.createRangeOn(b),A),u._position=f}}else{const d=i.nextSibling;if(d&&(d.is("element","ul")||d.is("element","ol"))){let u=null;for(const g of d.getChildren()){const f=r.toModelElement(g);if(!(f&&f.getAttribute("listIndent")>o.getAttribute("listIndent")))break;u=g}u&&(s.breakContainer(s.createPositionAfter(u)),s.move(s.createRangeOn(u.parent),s.createPositionAt(e,"end")))}}ct(s,i,i.nextSibling),ct(s,i.previousSibling,i)}function ct(o,e,t){return!e||!t||e.name!="ul"&&e.name!="ol"||e.name!=t.name||e.getAttribute("class")!==t.getAttribute("class")?null:o.mergeContainers(o.createPositionAfter(e))}function Ep(o){return o.getLastMatchingPosition(e=>e.item.is("uiElement"))}function xp(o,e){const t=!!e.sameIndent,n=!!e.smallerIndent,i=e.listIndent;let r=o;for(;r&&r.name=="listItem";){const s=r.getAttribute("listIndent");if(t&&i==s||n&&i>s)return r;r=e.direction==="forward"?r.nextSibling:r.previousSibling}return null}function Sp(o,e,t,n){o.ui.componentFactory.add(e,i=>{const r=o.commands.get(e),s=new Ae(i);return s.set({label:t,icon:n,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",()=>{o.execute(e),o.editing.view.focus()}),s})}function va(o,e){const t=[],n=o.parent,i={ignoreElementEnd:!1,startPosition:o,shallow:!0,direction:e},r=n.getAttribute("listIndent"),s=[...new vt(i)].filter(a=>a.item.is("element")).map(a=>a.item);for(const a of s){if(!a.is("element","listItem")||a.getAttribute("listIndent")<r)break;if(!(a.getAttribute("listIndent")>r)){if(a.getAttribute("listType")!==n.getAttribute("listType")||a.getAttribute("listStyle")!==n.getAttribute("listStyle")||a.getAttribute("listReversed")!==n.getAttribute("listReversed")||a.getAttribute("listStart")!==n.getAttribute("listStart"))break;e==="backward"?t.unshift(a):t.push(a)}}return t}const q5=["disc","circle","square"],U5=["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"];function W5(){const o=!this.isEmpty&&(this.getChild(0).name=="ul"||this.getChild(0).name=="ol");return this.isEmpty||o?0:yd.call(this)}class K5 extends q{static get pluginName(){return"ListUI"}init(){const e=this.editor.t;Sp(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>'),Sp(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>')}}const G5=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"}];for(const{listStyle:o,typeAttribute:e,listType:t}of G5);var Dp=D(4721),Z5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Dp.Z,Z5),Dp.Z.locals;var Bp=D(6082),J5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Bp.Z,J5),Bp.Z.locals;var Tp=D(2417),Y5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Tp.Z,Y5),Tp.Z.locals;class Ip extends ne{constructor(e,t){super(e),this._indentBy=t=="forward"?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=e.document;let n=Array.from(t.selection.getSelectedBlocks());e.change(i=>{const r=n[n.length-1];let s=r.nextSibling;for(;s&&s.name=="listItem"&&s.getAttribute("listIndent")>r.getAttribute("listIndent");)n.push(s),s=s.nextSibling;this._indentBy<0&&(n=n.reverse());for(const a of n){const l=a.getAttribute("listIndent")+this._indentBy;l<0?i.rename(a,"paragraph"):i.setAttribute("listIndent",l,a)}this.fire("_executeCleanup",n)})}_checkEnabled(){const e=ze(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("element","listItem"))return!1;if(this._indentBy>0){const t=e.getAttribute("listIndent"),n=e.getAttribute("listType");let i=e.previousSibling;for(;i&&i.is("element","listItem")&&i.getAttribute("listIndent")>=t;){if(i.getAttribute("listIndent")==t)return i.getAttribute("listType")==n;i=i.previousSibling}return!1}return!0}}class Pp extends ne{constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,n=t.document,i=Array.from(n.selection.getSelectedBlocks()).filter(s=>Op(s,t.schema)),r=e.forceValue!==void 0?!e.forceValue:this.value;t.change(s=>{if(r){let a=i[i.length-1].nextSibling,l=Number.POSITIVE_INFINITY,c=[];for(;a&&a.name=="listItem"&&a.getAttribute("listIndent")!==0;){const d=a.getAttribute("listIndent");d<l&&(l=d);const u=d-l;c.push({element:a,listIndent:u}),a=a.nextSibling}c=c.reverse();for(const d of c)s.setAttribute("listIndent",d.listIndent,d.element)}if(!r){let a=Number.POSITIVE_INFINITY;for(const l of i)l.is("element","listItem")&&l.getAttribute("listIndent")<a&&(a=l.getAttribute("listIndent"));a=a===0?1:a,Rp(i,!0,a),Rp(i,!1,a)}for(const a of i.reverse())r&&a.name=="listItem"?s.rename(a,"paragraph"):r||a.name=="listItem"?r||a.name!="listItem"||a.getAttribute("listType")==this.type||s.setAttribute("listType",this.type,a):(s.setAttributes({listType:this.type,listIndent:0},a),s.rename(a,"listItem"));this.fire("_executeCleanup",i)})}_getValue(){const e=ze(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,n=ze(e.getSelectedBlocks());return!!n&&Op(n,t)}}function Rp(o,e,t){const n=e?o[0]:o[o.length-1];if(n.is("element","listItem")){let i=n[e?"previousSibling":"nextSibling"],r=n.getAttribute("listIndent");for(;i&&i.is("element","listItem")&&i.getAttribute("listIndent")>=t;)r>i.getAttribute("listIndent")&&(r=i.getAttribute("listIndent")),i.getAttribute("listIndent")==r&&o[e?"unshift":"push"](i),i=i[e?"previousSibling":"nextSibling"]}}function Op(o,e){return e.checkChild(o.parent,"listItem")&&!e.isObject(o)}class Q5 extends q{static get pluginName(){return"ListUtils"}getListTypeFromListStyleType(e){return function(t){return q5.includes(t)?"bulleted":U5.includes(t)?"numbered":null}(e)}getSelectedListItems(e){return function(t){let n=[...t.document.selection.getSelectedBlocks()].filter(i=>i.is("element","listItem")).map(i=>{const r=t.change(s=>s.createPositionAt(i,0));return[...va(r,"backward"),...va(r,"forward")]}).flat();return n=[...new Set(n)],n}(e)}getSiblingNodes(e,t){return va(e,t)}}function Np(o){return(e,t,n)=>{const i=n.consumable;if(!i.test(t.item,"insert")||!i.test(t.item,"attribute:listType")||!i.test(t.item,"attribute:listIndent"))return;i.consume(t.item,"insert"),i.consume(t.item,"attribute:listType"),i.consume(t.item,"attribute:listIndent");const r=t.item;yp(r,H5(r,n),n,o)}}const X5=(o,e,t)=>{if(!t.consumable.test(e.item,o.name))return;const n=t.mapper.toViewElement(e.item),i=t.writer;i.breakContainer(i.createPositionBefore(n)),i.breakContainer(i.createPositionAfter(n));const r=n.parent,s=e.attributeNewValue=="numbered"?"ol":"ul";i.rename(s,r)},eS=(o,e,t)=>{t.consumable.consume(e.item,o.name);const n=t.mapper.toViewElement(e.item).parent,i=t.writer;ct(i,n,n.nextSibling),ct(i,n.previousSibling,n)},zp=(o,e,t)=>{if(t.consumable.test(e.item,o.name)&&e.item.name!="listItem"){let n=t.mapper.toViewPosition(e.range.start);const i=t.writer,r=[];for(;(n.parent.name=="ul"||n.parent.name=="ol")&&(n=i.breakContainer(n),n.parent.name=="li");){const s=n,a=i.createPositionAt(n.parent,"end");if(!s.isEqual(a)){const l=i.remove(i.createRange(s,a));r.push(l)}n=i.createPositionAfter(n.parent)}if(r.length>0){for(let s=0;s<r.length;s++){const a=n.nodeBefore;if(n=i.insert(n,r[s]).end,s>0){const l=ct(i,a,a.nextSibling);l&&l.parent==a&&n.offset--}}ct(i,n.nodeBefore,n.nodeAfter)}}},tS=(o,e,t)=>{const n=t.mapper.toViewPosition(e.position),i=n.nodeBefore,r=n.nodeAfter;ct(t.writer,i,r)},nS=(o,e,t)=>{if(t.consumable.consume(e.viewItem,{name:!0})){const n=t.writer,i=n.createElement("listItem"),r=function(l){let c=0,d=l.parent;for(;d;){if(d.is("element","li"))c++;else{const u=d.previousSibling;u&&u.is("element","li")&&c++}d=d.parent}return c}(e.viewItem);n.setAttribute("listIndent",r,i);const s=e.viewItem.parent&&e.viewItem.parent.name=="ol"?"numbered":"bulleted";if(n.setAttribute("listType",s,i),!t.safeInsert(i,e.modelCursor))return;const a=function(l,c,d){const{writer:u,schema:g}=d;let f=u.createPositionAfter(l);for(const b of c)if(b.name=="ul"||b.name=="ol")f=d.convertItem(b,f).modelCursor;else{const A=d.convertItem(b,u.createPositionAt(l,"end")),E=A.modelRange.start.nodeAfter;E&&E.is("element")&&!g.checkChild(l,E.name)&&(l=A.modelCursor.parent.is("element","listItem")?A.modelCursor.parent:rS(A.modelCursor),f=u.createPositionAfter(l))}return f}(i,e.viewItem.getChildren(),t);e.modelRange=n.createRange(e.modelCursor,a),t.updateConversionResult(i,e)}},Mp=(o,e,t)=>{if(t.consumable.test(e.viewItem,{name:!0})){const n=Array.from(e.viewItem.getChildren());for(const i of n)!(i.is("element","li")||Yn(i))&&i._remove()}},oS=(o,e,t)=>{if(t.consumable.test(e.viewItem,{name:!0})){if(e.viewItem.childCount===0)return;const n=[...e.viewItem.getChildren()];let i=!1;for(const r of n)i&&!Yn(r)&&r._remove(),Yn(r)&&(i=!0)}};function Fp(o){return(e,t)=>{if(t.isPhantom)return;const n=t.modelPosition.nodeBefore;if(n&&n.is("element","listItem")){const i=t.mapper.toViewElement(n),r=i.getAncestors().find(Yn),s=o.createPositionAt(i,0).getWalker();for(const a of s){if(a.type=="elementStart"&&a.item.is("element","li")){t.viewPosition=a.previousPosition;break}if(a.type=="elementEnd"&&a.item==r){t.viewPosition=a.nextPosition;break}}}}}const iS=function(o,[e,t]){const n=this;let i,r=e.is("documentFragment")?e.getChild(0):e;if(i=t?n.createSelection(t):n.document.selection,r&&r.is("element","listItem")){const s=i.getFirstPosition();let a=null;if(s.parent.is("element","listItem")?a=s.parent:s.nodeBefore&&s.nodeBefore.is("element","listItem")&&(a=s.nodeBefore),a){const l=a.getAttribute("listIndent");if(l>0)for(;r&&r.is("element","listItem");)r._setAttribute("listIndent",r.getAttribute("listIndent")+l),r=r.nextSibling}}};function rS(o){const e=new vt({startPosition:o});let t;do t=e.next();while(!t.value.item.is("element","listItem"));return t.value.item}function Vp(o,e,t,n,i,r){const s=xp(e.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:o}),a=i.mapper,l=i.writer,c=s?s.getAttribute("listIndent"):null;let d;if(s)if(c==o){const u=a.toViewElement(s).parent;d=l.createPositionAfter(u)}else{const u=r.createPositionAt(s,"end");d=a.toViewPosition(u)}else d=t;d=Ep(d);for(const u of[...n.getChildren()])Yn(u)&&(d=l.move(l.createRangeOn(u),d).end,ct(l,u,u.nextSibling),ct(l,u.previousSibling,u))}function Yn(o){return o.is("element","ol")||o.is("element","ul")}class sS extends q{static get pluginName(){return"ListEditing"}static get requires(){return[zo,Wn,Q5]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const t=e.data,n=e.editing;var i;e.model.document.registerPostFixer(s=>function(a,l){const c=a.document.differ.getChanges(),d=new Map;let u=!1;for(const A of c)if(A.type=="insert"&&A.name=="listItem")g(A.position);else if(A.type=="insert"&&A.name!="listItem"){if(A.name!="$text"){const E=A.position.nodeAfter;E.hasAttribute("listIndent")&&(l.removeAttribute("listIndent",E),u=!0),E.hasAttribute("listType")&&(l.removeAttribute("listType",E),u=!0),E.hasAttribute("listStyle")&&(l.removeAttribute("listStyle",E),u=!0),E.hasAttribute("listReversed")&&(l.removeAttribute("listReversed",E),u=!0),E.hasAttribute("listStart")&&(l.removeAttribute("listStart",E),u=!0);for(const P of Array.from(a.createRangeIn(E)).filter(z=>z.item.is("element","listItem")))g(P.previousPosition)}g(A.position.getShiftedBy(A.length))}else A.type=="remove"&&A.name=="listItem"?g(A.position):(A.type=="attribute"&&A.attributeKey=="listIndent"||A.type=="attribute"&&A.attributeKey=="listType")&&g(A.range.start);for(const A of d.values())f(A),b(A);return u;function g(A){const E=A.nodeBefore;if(E&&E.is("element","listItem")){let P=E;if(d.has(P))return;for(let z=P.previousSibling;z&&z.is("element","listItem");z=P.previousSibling)if(P=z,d.has(P))return;d.set(E,P)}else{const P=A.nodeAfter;P&&P.is("element","listItem")&&d.set(P,P)}}function f(A){let E=0,P=null;for(;A&&A.is("element","listItem");){const z=A.getAttribute("listIndent");if(z>E){let j;P===null?(P=z-E,j=E):(P>z&&(P=z),j=z-P),l.setAttribute("listIndent",j,A),u=!0}else P=null,E=A.getAttribute("listIndent")+1;A=A.nextSibling}}function b(A){let E=[],P=null;for(;A&&A.is("element","listItem");){const z=A.getAttribute("listIndent");if(P&&P.getAttribute("listIndent")>z&&(E=E.slice(0,z+1)),z!=0)if(E[z]){const j=E[z];A.getAttribute("listType")!=j&&(l.setAttribute("listType",j,A),u=!0)}else E[z]=A.getAttribute("listType");P=A,A=A.nextSibling}}}(e.model,s)),n.mapper.registerViewToModelLength("li",ya),t.mapper.registerViewToModelLength("li",ya),n.mapper.on("modelToViewPosition",Fp(n.view)),n.mapper.on("viewToModelPosition",(i=e.model,(s,a)=>{const l=a.viewPosition,c=l.parent,d=a.mapper;if(c.name=="ul"||c.name=="ol"){if(l.isAtEnd){const u=d.toModelElement(l.nodeBefore),g=d.getModelLength(l.nodeBefore);a.modelPosition=i.createPositionBefore(u).getShiftedBy(g)}else{const u=d.toModelElement(l.nodeAfter);a.modelPosition=i.createPositionBefore(u)}s.stop()}else if(c.name=="li"&&l.nodeBefore&&(l.nodeBefore.name=="ul"||l.nodeBefore.name=="ol")){const u=d.toModelElement(c);let g=1,f=l.nodeBefore;for(;f&&Yn(f);)g+=d.getModelLength(f),f=f.previousSibling;a.modelPosition=i.createPositionBefore(u).getShiftedBy(g),s.stop()}})),t.mapper.on("modelToViewPosition",Fp(n.view)),e.conversion.for("editingDowncast").add(s=>{s.on("insert",zp,{priority:"high"}),s.on("insert:listItem",Np(e.model)),s.on("attribute:listType:listItem",X5,{priority:"high"}),s.on("attribute:listType:listItem",eS,{priority:"low"}),s.on("attribute:listIndent:listItem",function(a){return(l,c,d)=>{if(!d.consumable.consume(c.item,"attribute:listIndent"))return;const u=d.mapper.toViewElement(c.item),g=d.writer;g.breakContainer(g.createPositionBefore(u)),g.breakContainer(g.createPositionAfter(u));const f=u.parent,b=f.previousSibling,A=g.createRangeOn(f);g.remove(A),b&&b.nextSibling&&ct(g,b,b.nextSibling),Vp(c.attributeOldValue+1,c.range.start,A.start,u,d,a),yp(c.item,u,d,a);for(const E of c.item.getChildren())d.consumable.consume(E,"insert")}}(e.model)),s.on("remove:listItem",function(a){return(l,c,d)=>{const u=d.mapper.toViewPosition(c.position).getLastMatchingPosition(P=>!P.item.is("element","li")).nodeAfter,g=d.writer;g.breakContainer(g.createPositionBefore(u)),g.breakContainer(g.createPositionAfter(u));const f=u.parent,b=f.previousSibling,A=g.createRangeOn(f),E=g.remove(A);b&&b.nextSibling&&ct(g,b,b.nextSibling),Vp(d.mapper.toModelElement(u).getAttribute("listIndent")+1,c.position,A.start,u,d,a);for(const P of g.createRangeIn(E).getItems())d.mapper.unbindViewElement(P);l.stop()}}(e.model)),s.on("remove",tS,{priority:"low"})}),e.conversion.for("dataDowncast").add(s=>{s.on("insert",zp,{priority:"high"}),s.on("insert:listItem",Np(e.model))}),e.conversion.for("upcast").add(s=>{s.on("element:ul",Mp,{priority:"high"}),s.on("element:ol",Mp,{priority:"high"}),s.on("element:li",oS,{priority:"high"}),s.on("element:li",nS)}),e.model.on("insertContent",iS,{priority:"high"}),e.commands.add("numberedList",new Pp(e,"numbered")),e.commands.add("bulletedList",new Pp(e,"bulleted")),e.commands.add("indentList",new Ip(e,"forward")),e.commands.add("outdentList",new Ip(e,"backward"));const r=n.view.document;this.listenTo(r,"enter",(s,a)=>{const l=this.editor.model.document,c=l.selection.getLastPosition().parent;l.selection.isCollapsed&&c.name=="listItem"&&c.isEmpty&&(this.editor.execute("outdentList"),a.preventDefault(),s.stop())},{context:"li"}),this.listenTo(r,"delete",(s,a)=>{if(a.direction!=="backward")return;const l=this.editor.model.document.selection;if(!l.isCollapsed)return;const c=l.getFirstPosition();if(!c.isAtStart)return;const d=c.parent;d.name==="listItem"&&(d.previousSibling&&d.previousSibling.name==="listItem"||(this.editor.execute("outdentList"),a.preventDefault(),s.stop()))},{context:"li"}),this.listenTo(e.editing.view.document,"tab",(s,a)=>{const l=a.shiftKey?"outdentList":"indentList";this.editor.commands.get(l).isEnabled&&(e.execute(l),a.stopPropagation(),a.preventDefault(),s.stop())},{context:"li"})}afterInit(){const e=this.editor.commands,t=e.get("indent"),n=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),n&&n.registerChildCommand(e.get("outdentList"))}}function ya(o){let e=1;for(const t of o.getChildren())if(t.name=="ul"||t.name=="ol")for(const n of t.getChildren())e+=ya(n);return e}li("Ctrl+Enter");var Lp=D(1199),aS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Lp.Z,aS),Lp.Z.locals;function Oe(o,e,t,n,i=1){e!=null&&i!=null&&e>i?n.setAttribute(o,e,t):n.removeAttribute(o,t)}function fn(o,e,t={}){const n=o.createElement("tableCell",t);return o.insertElement("paragraph",n),o.insert(n,e),n}function Ea(o,e){const t=e.parent.parent,n=parseInt(t.getAttribute("headingColumns")||"0"),{column:i}=o.getCellLocation(e);return!!n&&i<n}function lS(){return o=>{o.on("element:table",(e,t,n)=>{const i=t.viewItem;if(!n.consumable.test(i,{name:!0}))return;const{rows:r,headingRows:s,headingColumns:a}=function(d){let u,g=0;const f=[],b=[];let A;for(const E of Array.from(d.getChildren())){if(E.name!=="tbody"&&E.name!=="thead"&&E.name!=="tfoot")continue;E.name!=="thead"||A||(A=E);const P=Array.from(E.getChildren()).filter(z=>z.is("element","tr"));for(const z of P)if(A&&E===A||E.name==="tbody"&&Array.from(z.getChildren()).length&&Array.from(z.getChildren()).every(j=>j.is("element","th")))g++,f.push(z);else{b.push(z);const j=cS(z);(!u||j<u)&&(u=j)}}return{headingRows:g,headingColumns:u||0,rows:[...f,...b]}}(i),l={};a&&(l.headingColumns=a),s&&(l.headingRows=s);const c=n.writer.createElement("table",l);if(n.safeInsert(c,t.modelCursor)){if(n.consumable.consume(i,{name:!0}),r.forEach(d=>n.convertItem(d,n.writer.createPositionAt(c,"end"))),n.convertChildren(i,n.writer.createPositionAt(c,"end")),c.isEmpty){const d=n.writer.createElement("tableRow");n.writer.insert(d,n.writer.createPositionAt(c,"end")),fn(n.writer,n.writer.createPositionAt(d,"end"))}n.updateConversionResult(c,t)}})}}function jp(o){return e=>{e.on(`element:${o}`,(t,n,{writer:i})=>{if(!n.modelRange)return;const r=n.modelRange.start.nodeAfter,s=i.createPositionAt(r,0);if(n.viewItem.isEmpty)return void i.insertElement("paragraph",s);const a=Array.from(r.getChildren());if(a.every(l=>l.is("element","$marker"))){const l=i.createElement("paragraph");i.insert(l,i.createPositionAt(r,0));for(const c of a)i.move(i.createRangeOn(c),i.createPositionAt(l,"end"))}},{priority:"low"})}}function cS(o){let e=0,t=0;const n=Array.from(o.getChildren()).filter(i=>i.name==="th"||i.name==="td");for(;t<n.length&&n[t].name==="th";){const i=n[t];e+=parseInt(i.getAttribute("colspan")||"1"),t++}return e}class ue{constructor(e,t={}){this._table=e,this._startRow=t.row!==void 0?t.row:t.startRow||0,this._endRow=t.row!==void 0?t.row:t.endRow,this._startColumn=t.column!==void 0?t.column:t.startColumn||0,this._endColumn=t.column!==void 0?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){const e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const n=this._getSpanned();if(n)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(n.cell,n.row,n.column));else{const i=e.getChild(this._cellIndex);if(!i)return this._advanceToNextRow();const r=parseInt(i.getAttribute("colspan")||"1"),s=parseInt(i.getAttribute("rowspan")||"1");(r>1||s>1)&&this._recordSpans(i,s,r),this._shouldSkipSlot()||(t=this._formatOutValue(i)),this._nextCellAtColumn=this._column+r}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return this._endRow!==void 0&&this._row>this._endRow}_isOverEndColumn(){return this._endColumn!==void 0&&this._column>this._endColumn}_formatOutValue(e,t=this._row,n=this._column){return{done:!1,value:new dS(this,e,t,n)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,n=this._column<this._startColumn,i=this._endColumn!==void 0&&this._column>this._endColumn;return e||t||n||i}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,n){const i={cell:e,row:this._row,column:this._column};for(let r=this._row;r<this._row+t;r++)for(let s=this._column;s<this._column+n;s++)r==this._row&&s==this._column||this._markSpannedCell(r,s,i)}_markSpannedCell(e,t,n){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,n)}}class dS{constructor(e,t,n,i){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=n,this.cellAnchorColumn=i,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 $p(o,e){return(t,{writer:n})=>{const i=t.getAttribute("headingRows")||0,r=n.createContainerElement("table",null,[]),s=n.createContainerElement("figure",{class:"table"},r);i>0&&n.insert(n.createPositionAt(r,"end"),n.createContainerElement("thead",null,n.createSlot(a=>a.is("element","tableRow")&&a.index<i))),i<o.getRows(t)&&n.insert(n.createPositionAt(r,"end"),n.createContainerElement("tbody",null,n.createSlot(a=>a.is("element","tableRow")&&a.index>=i)));for(const{positionOffset:a,filter:l}of e.additionalSlots)n.insert(n.createPositionAt(r,a),n.createSlot(l));return n.insert(n.createPositionAt(r,"after"),n.createSlot(a=>!a.is("element","tableRow")&&!e.additionalSlots.some(({filter:l})=>l(a)))),e.asWidget?function(a,l){return l.setCustomProperty("table",!0,a),ia(a,l,{hasSelectionHandle:!0})}(s,n):s}}function Hp(o={}){return(e,{writer:t})=>{const n=e.parent,i=n.parent,r=i.getChildIndex(n),s=new ue(i,{row:r}),a=i.getAttribute("headingRows")||0,l=i.getAttribute("headingColumns")||0;let c=null;for(const d of s)if(d.cell==e){const u=d.row<a||d.column<l?"th":"td";c=o.asWidget?g2(t.createEditableElement(u),t):t.createContainerElement(u);break}return c}}function qp(o={}){return(e,{writer:t})=>{if(!e.parent.is("element","tableCell")||!Up(e))return null;if(o.asWidget)return t.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const n=t.createContainerElement("p");return t.setCustomProperty("dataPipeline:transparentRendering",!0,n),n}}}function Up(o){return o.parent.childCount==1&&!!o.getAttributeKeys().next().done}class hS extends ne{refresh(){const e=this.editor.model,t=e.document.selection,n=e.schema;this.isEnabled=function(i,r){const s=i.getFirstPosition().parent,a=s===s.root?s:s.parent;return r.checkChild(a,"table")}(t,n)}execute(e={}){const t=this.editor,n=t.model,i=t.plugins.get("TableUtils"),r=t.config.get("table.defaultHeadings.rows"),s=t.config.get("table.defaultHeadings.columns");e.headingRows===void 0&&r&&(e.headingRows=r),e.headingColumns===void 0&&s&&(e.headingColumns=s),n.change(a=>{const l=i.createTable(a,e);n.insertObject(l,null,null,{findOptimalPosition:"auto"}),a.setSelection(a.createPositionAt(l.getNodeByPath([0,0,0]),0))})}}class Wp extends ne{constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("TableUtils"),i=this.order==="above",r=n.getSelectionAffectedTableCells(t),s=n.getRowIndexes(r),a=i?s.first:s.last,l=r[0].findAncestor("table");n.insertRows(l,{at:i?a:a+1,copyStructureFromAbove:!i})}}class Kp extends ne{constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("TableUtils"),i=this.order==="left",r=n.getSelectionAffectedTableCells(t),s=n.getColumnIndexes(r),a=i?s.first:s.last,l=r[0].findAncestor("table");n.insertColumns(l,{columns:1,at:i?a:a+1})}}class Gp extends ne{constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length===1}execute(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];this.direction==="horizontally"?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}function Zp(o,e,t){const{startRow:n,startColumn:i,endRow:r,endColumn:s}=e,a=t.createElement("table"),l=r-n+1;for(let d=0;d<l;d++)t.insertElement("tableRow",a,"end");const c=[...new ue(o,{startRow:n,endRow:r,startColumn:i,endColumn:s,includeAllSlots:!0})];for(const{row:d,column:u,cell:g,isAnchor:f,cellAnchorRow:b,cellAnchorColumn:A}of c){const E=d-n,P=a.getChild(E);if(f){const z=t.cloneElement(g);t.append(z,P),ef(z,d,u,r,s,t)}else(b<n||A<i)&&fn(t,t.createPositionAt(P,"end"))}return function(d,u,g,f,b){const A=parseInt(u.getAttribute("headingRows")||"0");A>0&&Oe("headingRows",A-g,d,b,0);const E=parseInt(u.getAttribute("headingColumns")||"0");E>0&&Oe("headingColumns",E-f,d,b,0)}(a,o,n,i,t),a}function Jp(o,e,t=0){const n=[],i=new ue(o,{startRow:t,endRow:e-1});for(const r of i){const{row:s,cellHeight:a}=r;s<e&&e<=s+a-1&&n.push(r)}return n}function Yp(o,e,t){const n=o.parent,i=n.parent,r=n.index,s=e-r,a={},l=parseInt(o.getAttribute("rowspan"))-s;l>1&&(a.rowspan=l);const c=parseInt(o.getAttribute("colspan")||"1");c>1&&(a.colspan=c);const d=r+s,u=[...new ue(i,{startRow:r,endRow:d,includeAllSlots:!0})];let g,f=null;for(const b of u){const{row:A,column:E,cell:P}=b;P===o&&g===void 0&&(g=E),g!==void 0&&g===E&&A===d&&(f=fn(t,b.getPositionBefore(),a))}return Oe("rowspan",s,o,t),f}function Qp(o,e){const t=[],n=new ue(o);for(const i of n){const{column:r,cellWidth:s}=i;r<e&&e<=r+s-1&&t.push(i)}return t}function Xp(o,e,t,n){const i=t-e,r={},s=parseInt(o.getAttribute("colspan"))-i;s>1&&(r.colspan=s);const a=parseInt(o.getAttribute("rowspan")||"1");a>1&&(r.rowspan=a);const l=fn(n,n.createPositionAfter(o),r);return Oe("colspan",i,o,n),l}function ef(o,e,t,n,i,r){const s=parseInt(o.getAttribute("colspan")||"1"),a=parseInt(o.getAttribute("rowspan")||"1");t+s-1>i&&Oe("colspan",i-t+1,o,r,1),e+a-1>n&&Oe("rowspan",n-e+1,o,r,1)}function xa(o,e){const t=e.getColumns(o),n=new Array(t).fill(0);for(const{column:r}of new ue(o))n[r]++;const i=n.reduce((r,s,a)=>s?r:[...r,a],[]);if(i.length>0){const r=i[i.length-1];return e.removeColumns(o,{at:r}),!0}return!1}function Sa(o,e){const t=[],n=e.getRows(o);for(let i=0;i<n;i++)o.getChild(i).isEmpty&&t.push(i);if(t.length>0){const i=t[t.length-1];return e.removeRows(o,{at:i}),!0}return!1}function Da(o,e){xa(o,e)||Sa(o,e)}function tf(o,e){const t=Array.from(new ue(o,{startColumn:e.firstColumn,endColumn:e.lastColumn,row:e.lastRow}));if(t.every(({cellHeight:i})=>i===1))return e.lastRow;const n=t[0].cellHeight-1;return e.lastRow+n}function nf(o,e){const t=Array.from(new ue(o,{startRow:e.firstRow,endRow:e.lastRow,column:e.lastColumn}));if(t.every(({cellWidth:i})=>i===1))return e.lastColumn;const n=t[0].cellWidth-1;return e.lastColumn+n}class Ji extends ne{constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal=this.direction=="right"||this.direction=="left"}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=e.document,n=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],i=this.value,r=this.direction;e.change(s=>{const a=r=="right"||r=="down",l=a?n:i,c=a?i:n,d=c.parent;(function(A,E,P){of(A)||(of(E)&&P.remove(P.createRangeIn(E)),P.move(P.createRangeIn(A),P.createPositionAt(E,"end"))),P.remove(A)})(c,l,s);const u=this.isHorizontal?"colspan":"rowspan",g=parseInt(n.getAttribute(u)||"1"),f=parseInt(i.getAttribute(u)||"1");s.setAttribute(u,g+f,l),s.setSelection(s.createRangeIn(l));const b=this.editor.plugins.get("TableUtils");Da(d.findAncestor("table"),b)})}_getMergeableCell(){const e=this.editor.model.document,t=this.editor.plugins.get("TableUtils"),n=t.getTableCellsContainingSelection(e.selection)[0];if(!n)return;const i=this.isHorizontal?function(a,l,c){const d=a.parent,u=d.parent,g=l=="right"?a.nextSibling:a.previousSibling,f=(u.getAttribute("headingColumns")||0)>0;if(!g)return;const b=l=="right"?a:g,A=l=="right"?g:a,{column:E}=c.getCellLocation(b),{column:P}=c.getCellLocation(A),z=parseInt(b.getAttribute("colspan")||"1"),j=Ea(c,b),Y=Ea(c,A);if(!(f&&j!=Y))return E+z===P?g:void 0}(n,this.direction,t):function(a,l,c){const d=a.parent,u=d.parent,g=u.getChildIndex(d);if(l=="down"&&g===c.getRows(u)-1||l=="up"&&g===0)return null;const f=parseInt(a.getAttribute("rowspan")||"1"),b=u.getAttribute("headingRows")||0,A=l=="down"&&g+f===b,E=l=="up"&&g===b;if(b&&(A||E))return null;const P=parseInt(a.getAttribute("rowspan")||"1"),z=l=="down"?g+P:g,j=[...new ue(u,{endRow:z})],Y=j.find(he=>he.cell===a),ie=Y.column,Ee=j.find(({row:he,cellHeight:Mt,column:it})=>it===ie&&(l=="down"?he===z:z===he+Mt));return Ee&&Ee.cell?Ee.cell:null}(n,this.direction,t);if(!i)return;const r=this.isHorizontal?"rowspan":"colspan",s=parseInt(n.getAttribute(r)||"1");return parseInt(i.getAttribute(r)||"1")===s?i:void 0}}function of(o){const e=o.getChild(0);return o.childCount==1&&e.is("element","paragraph")&&e.isEmpty}class uS extends ne{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),n=t[0];if(n){const i=n.findAncestor("table"),r=e.getRows(i)-1,s=e.getRowIndexes(t),a=s.first===0&&s.last===r;this.isEnabled=!a}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(n),r=n[0],s=r.findAncestor("table"),a=t.getCellLocation(r).column;e.change(l=>{const c=i.last-i.first+1;t.removeRows(s,{at:i.first,rows:c});const d=function(u,g,f,b){const A=u.getChild(Math.min(g,b-1));let E=A.getChild(0),P=0;for(const z of A.getChildren()){if(P>f)return E;E=z,P+=parseInt(z.getAttribute("colspan")||"1")}return E}(s,i.first,a,t.getRows(s));l.setSelection(l.createPositionAt(d,0))})}}class mS extends ne{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),n=t[0];if(n){const i=n.findAncestor("table"),r=e.getColumns(i),{first:s,last:a}=e.getColumnIndexes(t);this.isEnabled=a-s<r-1}else this.isEnabled=!1}execute(){const e=this.editor.plugins.get("TableUtils"),[t,n]=function(l,c){const d=c.getSelectionAffectedTableCells(l),u=d[0],g=d.pop(),f=[u,g];return u.isBefore(g)?f:f.reverse()}(this.editor.model.document.selection,e),i=t.parent.parent,r=[...new ue(i)],s={first:r.find(l=>l.cell===t).column,last:r.find(l=>l.cell===n).column},a=function(l,c,d,u){return parseInt(d.getAttribute("colspan")||"1")>1?d:c.previousSibling||d.nextSibling?d.nextSibling||c.previousSibling:u.first?l.reverse().find(({column:f})=>f<u.first).cell:l.reverse().find(({column:f})=>f>u.last).cell}(r,t,n,s);this.editor.model.change(l=>{const c=s.last-s.first+1;e.removeColumns(i,{at:s.first,columns:c}),l.setSelection(l.createPositionAt(a,0))})}}class gS extends ne{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection),i=n.length>0;this.isEnabled=i,this.value=i&&n.every(r=>this._isInHeading(r,r.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),n=this.editor.model,i=t.getSelectionAffectedTableCells(n.document.selection),r=i[0].findAncestor("table"),{first:s,last:a}=t.getRowIndexes(i),l=this.value?s:a+1,c=r.getAttribute("headingRows")||0;n.change(d=>{if(l){const u=Jp(r,l,l>c?c:0);for(const{cell:g}of u)Yp(g,l,d)}Oe("headingRows",l,r,d,0)})}_isInHeading(e,t){const n=parseInt(t.getAttribute("headingRows")||"0");return!!n&&e.parent.index<n}}class pS extends ne{refresh(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),i=n.length>0;this.isEnabled=i,this.value=i&&n.every(r=>Ea(t,r))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),n=this.editor.model,i=t.getSelectionAffectedTableCells(n.document.selection),r=i[0].findAncestor("table"),{first:s,last:a}=t.getColumnIndexes(i),l=this.value?s:a+1;n.change(c=>{if(l){const d=Qp(r,l);for(const{cell:u,column:g}of d)Xp(u,g,l,c)}Oe("headingColumns",l,r,c,0)})}}class qe extends q{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,n=t.parent,i=n.getChildIndex(t),r=new ue(n,{row:i});for(const{cell:s,row:a,column:l}of r)if(s===e)return{row:a,column:l}}createTable(e,t){const n=e.createElement("table"),i=t.rows||2,r=t.columns||2;return Ba(e,n,0,i,r),t.headingRows&&Oe("headingRows",Math.min(t.headingRows,i),n,e,0),t.headingColumns&&Oe("headingColumns",Math.min(t.headingColumns,r),n,e,0),n}insertRows(e,t={}){const n=this.editor.model,i=t.at||0,r=t.rows||1,s=t.copyStructureFromAbove!==void 0,a=t.copyStructureFromAbove?i-1:i,l=this.getRows(e),c=this.getColumns(e);if(i>l)throw new I("tableutils-insertrows-insert-out-of-range",this,{options:t});n.change(d=>{const u=e.getAttribute("headingRows")||0;if(u>i&&Oe("headingRows",u+r,e,d,0),!s&&(i===0||i===l))return void Ba(d,e,i,r,c);const g=s?Math.max(i,a):i,f=new ue(e,{endRow:g}),b=new Array(c).fill(1);for(const{row:A,column:E,cellHeight:P,cellWidth:z,cell:j}of f){const Y=A+P-1,ie=A<=a&&a<=Y;A<i&&i<=Y?(d.setAttribute("rowspan",P+r,j),b[E]=-z):s&&ie&&(b[E]=z)}for(let A=0;A<r;A++){const E=d.createElement("tableRow");d.insert(E,e,i);for(let P=0;P<b.length;P++){const z=b[P],j=d.createPositionAt(E,"end");z>0&&fn(d,j,z>1?{colspan:z}:void 0),P+=Math.abs(z)-1}}})}insertColumns(e,t={}){const n=this.editor.model,i=t.at||0,r=t.columns||1;n.change(s=>{const a=e.getAttribute("headingColumns");i<a&&s.setAttribute("headingColumns",a+r,e);const l=this.getColumns(e);if(i===0||l===i){for(const d of e.getChildren())d.is("element","tableRow")&&Qn(r,s,s.createPositionAt(d,i?"end":0));return}const c=new ue(e,{column:i,includeAllSlots:!0});for(const d of c){const{row:u,cell:g,cellAnchorColumn:f,cellAnchorRow:b,cellWidth:A,cellHeight:E}=d;if(f<i){s.setAttribute("colspan",A+r,g);const P=b+E-1;for(let z=u;z<=P;z++)c.skipRow(z)}else Qn(r,s,d.getPositionBefore())}})}removeRows(e,t){const n=this.editor.model,i=t.rows||1,r=this.getRows(e),s=t.at,a=s+i-1;if(a>r-1)throw new I("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});n.change(l=>{const c={first:s,last:a},{cellsToMove:d,cellsToTrim:u}=function(g,{first:f,last:b}){const A=new Map,E=[];for(const{row:P,column:z,cellHeight:j,cell:Y}of new ue(g,{endRow:b})){const ie=P+j-1;if(P>=f&&P<=b&&ie>b){const Ee=j-(b-P+1);A.set(z,{cell:Y,rowspan:Ee})}if(P<f&&ie>=f){let Ee;Ee=ie>=b?b-f+1:ie-f+1,E.push({cell:Y,rowspan:j-Ee})}}return{cellsToMove:A,cellsToTrim:E}}(e,c);d.size&&function(g,f,b,A){const E=new ue(g,{includeAllSlots:!0,row:f}),P=[...E],z=g.getChild(f);let j;for(const{column:Y,cell:ie,isAnchor:Ee}of P)if(b.has(Y)){const{cell:he,rowspan:Mt}=b.get(Y),it=j?A.createPositionAfter(j):A.createPositionAt(z,0);A.move(A.createRangeOn(he),it),Oe("rowspan",Mt,he,A),j=he}else Ee&&(j=ie)}(e,a+1,d,l);for(let g=a;g>=s;g--)l.remove(e.getChild(g));for(const{rowspan:g,cell:f}of u)Oe("rowspan",g,f,l);(function(g,{first:f,last:b},A){const E=g.getAttribute("headingRows")||0;f<E&&Oe("headingRows",b<E?E-(b-f+1):f,g,A,0)})(e,c,l),xa(e,this)||Sa(e,this)})}removeColumns(e,t){const n=this.editor.model,i=t.at,r=t.columns||1,s=t.at+r-1;n.change(a=>{(function(l,c,d){const u=l.getAttribute("headingColumns")||0;if(u&&c.first<u){const g=Math.min(u-1,c.last)-c.first+1;d.setAttribute("headingColumns",u-g,l)}})(e,{first:i,last:s},a);for(let l=s;l>=i;l--)for(const{cell:c,column:d,cellWidth:u}of[...new ue(e)])d<=l&&u>1&&d+u>l?Oe("colspan",u-1,c,a):d===l&&a.remove(c);Sa(e,this)||xa(e,this)})}splitCellVertically(e,t=2){const n=this.editor.model,i=e.parent.parent,r=parseInt(e.getAttribute("rowspan")||"1"),s=parseInt(e.getAttribute("colspan")||"1");n.change(a=>{if(s>1){const{newCellsSpan:l,updatedSpan:c}=rf(s,t);Oe("colspan",c,e,a);const d={};l>1&&(d.colspan=l),r>1&&(d.rowspan=r),Qn(s>t?t-1:s-1,a,a.createPositionAfter(e),d)}if(s<t){const l=t-s,c=[...new ue(i)],{column:d}=c.find(({cell:b})=>b===e),u=c.filter(({cell:b,cellWidth:A,column:E})=>b!==e&&E===d||E<d&&E+A>d);for(const{cell:b,cellWidth:A}of u)a.setAttribute("colspan",A+l,b);const g={};r>1&&(g.rowspan=r),Qn(l,a,a.createPositionAfter(e),g);const f=i.getAttribute("headingColumns")||0;f>d&&Oe("headingColumns",f+l,i,a)}})}splitCellHorizontally(e,t=2){const n=this.editor.model,i=e.parent,r=i.parent,s=r.getChildIndex(i),a=parseInt(e.getAttribute("rowspan")||"1"),l=parseInt(e.getAttribute("colspan")||"1");n.change(c=>{if(a>1){const d=[...new ue(r,{startRow:s,endRow:s+a-1,includeAllSlots:!0})],{newCellsSpan:u,updatedSpan:g}=rf(a,t);Oe("rowspan",g,e,c);const{column:f}=d.find(({cell:A})=>A===e),b={};u>1&&(b.rowspan=u),l>1&&(b.colspan=l);for(const A of d){const{column:E,row:P}=A;P>=s+g&&E===f&&(P+s+g)%u==0&&Qn(1,c,A.getPositionBefore(),b)}}if(a<t){const d=t-a,u=[...new ue(r,{startRow:0,endRow:s})];for(const{cell:b,cellHeight:A,row:E}of u)if(b!==e&&E+A>s){const P=A+d;c.setAttribute("rowspan",P,b)}const g={};l>1&&(g.colspan=l),Ba(c,r,s+1,d,1,g);const f=r.getAttribute("headingRows")||0;f>s&&Oe("headingRows",f+d,r,c)}})}getColumns(e){return[...e.getChild(0).getChildren()].reduce((t,n)=>t+parseInt(n.getAttribute("colspan")||"1"),0)}getRows(e){return Array.from(e.getChildren()).reduce((t,n)=>n.is("element","tableRow")?t+1:t,0)}createTableWalker(e,t={}){return new ue(e,t)}getSelectedTableCells(e){const t=[];for(const n of this.sortRanges(e.getRanges())){const i=n.getContainedElement();i&&i.is("element","tableCell")&&t.push(i)}return t}getTableCellsContainingSelection(e){const t=[];for(const n of e.getRanges()){const i=n.start.findAncestor("tableCell");i&&t.push(i)}return t}getSelectionAffectedTableCells(e){const t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){const t=e.map(n=>n.parent.index);return this._getFirstLastIndexesObject(t)}getColumnIndexes(e){const t=e[0].findAncestor("table"),n=[...new ue(t)].filter(i=>e.includes(i.cell)).map(i=>i.column);return this._getFirstLastIndexesObject(n)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;const t=new Set,n=new Set;let i=0;for(const s of e){const{row:a,column:l}=this.getCellLocation(s),c=parseInt(s.getAttribute("rowspan"))||1,d=parseInt(s.getAttribute("colspan"))||1;t.add(a),n.add(l),c>1&&t.add(a+c-1),d>1&&n.add(l+d-1),i+=c*d}return function(s,a){const l=Array.from(s.values()),c=Array.from(a.values()),d=Math.max(...l),u=Math.min(...l),g=Math.max(...c),f=Math.min(...c);return(d-u+1)*(g-f+1)}(t,n)==i}sortRanges(e){return Array.from(e).sort(fS)}_getFirstLastIndexesObject(e){const t=e.sort((n,i)=>n-i);return{first:t[0],last:t[t.length-1]}}_areCellInTheSameTableSection(e){const t=e[0].findAncestor("table"),n=this.getRowIndexes(e),i=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(n,i))return!1;const r=this.getColumnIndexes(e),s=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(r,s)}_areIndexesInSameSection({first:e,last:t},n){return e<n==t<n}}function Ba(o,e,t,n,i,r={}){for(let s=0;s<n;s++){const a=o.createElement("tableRow");o.insert(a,e,t),Qn(i,o,o.createPositionAt(a,"end"),r)}}function Qn(o,e,t,n={}){for(let i=0;i<o;i++)fn(e,t,n)}function rf(o,e){if(o<e)return{newCellsSpan:1,updatedSpan:1};const t=Math.floor(o/e);return{newCellsSpan:t,updatedSpan:o-t*e+t}}function fS(o,e){const t=o.start,n=e.start;return t.isBefore(n)?-1:1}class kS extends ne{refresh(){const e=this.editor.plugins.get(qe),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){const e=this.editor.model,t=this.editor.plugins.get(qe);e.change(n=>{const i=t.getSelectedTableCells(e.document.selection),r=i.shift(),{mergeWidth:s,mergeHeight:a}=function(l,c,d){let u=0,g=0;for(const P of c){const{row:z,column:j}=d.getCellLocation(P);u=af(P,j,u,"colspan"),g=af(P,z,g,"rowspan")}const{row:f,column:b}=d.getCellLocation(l),A=u-b,E=g-f;return{mergeWidth:A,mergeHeight:E}}(r,i,t);Oe("colspan",s,r,n),Oe("rowspan",a,r,n);for(const l of i)bS(l,r,n);Da(r.findAncestor("table"),t),n.setSelection(r,"in")})}}function bS(o,e,t){sf(o)||(sf(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(o),t.createPositionAt(e,"end"))),t.remove(o)}function sf(o){const e=o.getChild(0);return o.childCount==1&&e.is("element","paragraph")&&e.isEmpty}function af(o,e,t,n){const i=parseInt(o.getAttribute(n)||"1");return Math.max(t,e+i)}class wS extends ne{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(n),r=n[0].findAncestor("table"),s=[];for(let a=i.first;a<=i.last;a++)for(const l of r.getChild(a).getChildren())s.push(e.createRangeOn(l));e.change(a=>{a.setSelection(s)})}}class AS extends ne{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection),i=n[0],r=n.pop(),s=i.findAncestor("table"),a=e.getCellLocation(i),l=e.getCellLocation(r),c=Math.min(a.column,l.column),d=Math.max(a.column,l.column),u=[];for(const g of new ue(s,{startColumn:c,endColumn:d}))u.push(t.createRangeOn(g.cell));t.change(g=>{g.setSelection(u)})}}function _S(o){o.document.registerPostFixer(e=>function(t,n){const i=n.document.differ.getChanges();let r=!1;const s=new Set;for(const a of i){let l=null;a.type=="insert"&&a.name=="table"&&(l=a.position.nodeAfter),a.type!="insert"&&a.type!="remove"||a.name!="tableRow"&&a.name!="tableCell"||(l=a.position.findAncestor("table")),yS(a)&&(l=a.range.start.findAncestor("table")),l&&!s.has(l)&&(r=CS(l,t)||r,r=vS(l,t)||r,s.add(l))}return r}(e,o))}function CS(o,e){let t=!1;const n=function(i){const r=parseInt(i.getAttribute("headingRows")||"0"),s=Array.from(i.getChildren()).reduce((l,c)=>c.is("element","tableRow")?l+1:l,0),a=[];for(const{row:l,cell:c,cellHeight:d}of new ue(i)){if(d<2)continue;const u=l<r?r:s;if(l+d>u){const g=u-l;a.push({cell:c,rowspan:g})}}return a}(o);if(n.length){t=!0;for(const i of n)Oe("rowspan",i.rowspan,i.cell,e,1)}return t}function vS(o,e){let t=!1;const n=function(a){const l=new Array(a.childCount).fill(0);for(const{rowIndex:c}of new ue(a,{includeAllSlots:!0}))l[c]++;return l}(o),i=[];for(const[a,l]of n.entries())!l&&o.getChild(a).is("element","tableRow")&&i.push(a);if(i.length){t=!0;for(const a of i.reverse())e.remove(o.getChild(a)),n.splice(a,1)}const r=n.filter((a,l)=>o.getChild(l).is("element","tableRow")),s=r[0];if(!r.every(a=>a===s)){const a=r.reduce((l,c)=>c>l?c:l,0);for(const[l,c]of r.entries()){const d=a-c;if(d){for(let u=0;u<d;u++)fn(e,e.createPositionAt(o.getChild(l),"end"));t=!0}}}return t}function yS(o){if(o.type!=="attribute")return!1;const e=o.attributeKey;return e==="headingRows"||e==="colspan"||e==="rowspan"}function ES(o){o.document.registerPostFixer(e=>function(t,n){const i=n.document.differ.getChanges();let r=!1;for(const s of i)s.type=="insert"&&s.name=="table"&&(r=xS(s.position.nodeAfter,t)||r),s.type=="insert"&&s.name=="tableRow"&&(r=lf(s.position.nodeAfter,t)||r),s.type=="insert"&&s.name=="tableCell"&&(r=Ta(s.position.nodeAfter,t)||r),s.type!="remove"&&s.type!="insert"||!SS(s)||(r=Ta(s.position.parent,t)||r);return r}(e,o))}function xS(o,e){let t=!1;for(const n of o.getChildren())n.is("element","tableRow")&&(t=lf(n,e)||t);return t}function lf(o,e){let t=!1;for(const n of o.getChildren())t=Ta(n,e)||t;return t}function Ta(o,e){if(o.childCount==0)return e.insertElement("paragraph",o),!0;const t=Array.from(o.getChildren()).filter(n=>n.is("$text"));for(const n of t)e.wrap(e.createRangeOn(n),"paragraph");return!!t.length}function SS(o){return!!o.position.parent.is("element","tableCell")&&(o.type=="insert"&&o.name=="$text"||o.type=="remove")}function DS(o,e){if(!o.is("element","paragraph"))return!1;const t=e.toViewElement(o);return!!t&&Up(o)!==t.is("element","span")}var cf=D(3881),BS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(cf.Z,BS),cf.Z.locals;class TS extends q{constructor(e){super(e),this._additionalSlots=[]}static get pluginName(){return"TableEditing"}static get requires(){return[qe]}init(){const e=this.editor,t=e.model,n=t.schema,i=e.conversion,r=e.plugins.get(qe);n.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),n.register("tableRow",{allowIn:"table",isLimit:!0}),n.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),i.for("upcast").add(s=>{s.on("element:figure",(a,l,c)=>{if(!c.consumable.test(l.viewItem,{name:!0,classes:"table"}))return;const d=function(g){for(const f of g.getChildren())if(f.is("element","table"))return f}(l.viewItem);if(!d||!c.consumable.test(d,{name:!0}))return;c.consumable.consume(l.viewItem,{name:!0,classes:"table"});const u=ze(c.convertItem(d,l.modelCursor).modelRange.getItems());u?(c.convertChildren(l.viewItem,c.writer.createPositionAt(u,"end")),c.updateConversionResult(u,l)):c.consumable.revert(l.viewItem,{name:!0,classes:"table"})})}),i.for("upcast").add(lS()),i.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:$p(r,{asWidget:!0,additionalSlots:this._additionalSlots})}),i.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:$p(r,{additionalSlots:this._additionalSlots})}),i.for("upcast").elementToElement({model:"tableRow",view:"tr"}),i.for("upcast").add(s=>{s.on("element:tr",(a,l)=>{l.viewItem.isEmpty&&l.modelCursor.index==0&&a.stop()},{priority:"high"})}),i.for("downcast").elementToElement({model:"tableRow",view:(s,{writer:a})=>s.isEmpty?a.createEmptyElement("tr"):a.createContainerElement("tr")}),i.for("upcast").elementToElement({model:"tableCell",view:"td"}),i.for("upcast").elementToElement({model:"tableCell",view:"th"}),i.for("upcast").add(jp("td")),i.for("upcast").add(jp("th")),i.for("editingDowncast").elementToElement({model:"tableCell",view:Hp({asWidget:!0})}),i.for("dataDowncast").elementToElement({model:"tableCell",view:Hp()}),i.for("editingDowncast").elementToElement({model:"paragraph",view:qp({asWidget:!0}),converterPriority:"high"}),i.for("dataDowncast").elementToElement({model:"paragraph",view:qp(),converterPriority:"high"}),i.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),i.for("upcast").attributeToAttribute({model:{key:"colspan",value:df("colspan")},view:"colspan"}),i.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),i.for("upcast").attributeToAttribute({model:{key:"rowspan",value:df("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new hS(e)),e.commands.add("insertTableRowAbove",new Wp(e,{order:"above"})),e.commands.add("insertTableRowBelow",new Wp(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new Kp(e,{order:"left"})),e.commands.add("insertTableColumnRight",new Kp(e,{order:"right"})),e.commands.add("removeTableRow",new uS(e)),e.commands.add("removeTableColumn",new mS(e)),e.commands.add("splitTableCellVertically",new Gp(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new Gp(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new kS(e)),e.commands.add("mergeTableCellRight",new Ji(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new Ji(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new Ji(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new Ji(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new pS(e)),e.commands.add("setTableRowHeader",new gS(e)),e.commands.add("selectTableRow",new wS(e)),e.commands.add("selectTableColumn",new AS(e)),_S(t),ES(t),this.listenTo(t.document,"change:data",()=>{(function(s,a){const l=s.document.differ;for(const c of l.getChanges()){let d,u=!1;if(c.type=="attribute"){const A=c.range.start.nodeAfter;if(!A||!A.is("element","table")||c.attributeKey!="headingRows"&&c.attributeKey!="headingColumns")continue;d=A,u=c.attributeKey=="headingRows"}else c.name!="tableRow"&&c.name!="tableCell"||(d=c.position.findAncestor("table"),u=c.name=="tableRow");if(!d)continue;const g=d.getAttribute("headingRows")||0,f=d.getAttribute("headingColumns")||0,b=new ue(d);for(const A of b){const E=A.row<g||A.column<f?"th":"td",P=a.mapper.toViewElement(A.cell);P&&P.is("element")&&P.name!=E&&a.reconvertItem(u?A.cell.parent:A.cell)}}})(t,e.editing),function(s,a){const l=s.document.differ,c=new Set;for(const d of l.getChanges()){const u=d.type=="attribute"?d.range.start.parent:d.position.parent;u.is("element","tableCell")&&c.add(u)}for(const d of c.values()){const u=Array.from(d.getChildren()).filter(g=>DS(g,a.mapper));for(const g of u)a.reconvertItem(g)}}(t,e.editing)})}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function df(o){return e=>{const t=parseInt(e.getAttribute(o));return Number.isNaN(t)||t<=0?null:t}}var hf=D(1613),IS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(hf.Z,IS),hf.Z.locals;class PS extends re{constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new St,this.focusTracker=new ht,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(n,i)=>`${i} × ${n}`),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:t.to("label")}]}],on:{mousedown:t.to(n=>{n.preventDefault()}),click:t.to(()=>{this.fire("execute")})}}),this.on("boxover",(n,i)=>{const{row:r,column:s}=i.target.dataset;this.items.get(10*(parseInt(r,10)-1)+(parseInt(s,10)-1)).focus()}),this.focusTracker.on("change:focusedElement",(n,i,r)=>{if(!r)return;const{row:s,column:a}=r.dataset;this.set({rows:parseInt(s),columns:parseInt(a)})}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes())}render(){super.render(),function({keystrokeHandler:e,focusTracker:t,gridItems:n,numberOfColumns:i,uiLanguageDirection:r}){const s=typeof i=="number"?()=>i:i;function a(d){return u=>{const g=n.find(A=>A.element===t.focusedElement),f=n.getIndex(g),b=d(f,n);n.get(b).focus(),u.stopPropagation(),u.preventDefault()}}function l(d,u){return d===u-1?0:d+1}function c(d,u){return d===0?u-1:d-1}e.set("arrowright",a((d,u)=>r==="rtl"?c(d,u.length):l(d,u.length))),e.set("arrowleft",a((d,u)=>r==="rtl"?l(d,u.length):c(d,u.length))),e.set("arrowup",a((d,u)=>{let g=d-s();return g<0&&(g=d+s()*Math.floor(u.length/s()),g>u.length-1&&(g-=s())),g})),e.set("arrowdown",a((d,u)=>{let g=d+s();return g>u.length-1&&(g=d%s()),g}))}({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map((n,i)=>{const r=Math.floor(i/10)<e&&i%10<t;n.set("isOn",r)})}_createGridButton(e,t,n,i){const r=new Ae(e);return r.set({label:i,class:"ck-insert-table-dropdown-grid-box"}),r.extendTemplate({attributes:{"data-row":t,"data-column":n}}),r}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const n=Math.floor(t/10),i=t%10,r=`${n+1} × ${i+1}`;e.push(this._createGridButton(this.locale,n+1,i+1,r))}return this.createCollection(e)}}class RS extends q{static get pluginName(){return"TableUI"}init(){const e=this.editor,t=this.editor.t,n=e.locale.contentLanguageDirection==="ltr";e.ui.componentFactory.add("insertTable",i=>{const r=e.commands.get("insertTable"),s=Pt(i);let a;return s.bind("isEnabled").to(r),s.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}),s.on("change:isOpen",()=>{a||(a=new PS(i),s.panelView.children.add(a),a.delegate("execute").to(s),s.on("execute",()=>{e.execute("insertTable",{rows:a.rows,columns:a.columns}),e.editing.view.focus()}))}),s}),e.ui.componentFactory.add("tableColumn",i=>{const r=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:n?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:n?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),'<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>',r,i)}),e.ui.componentFactory.add("tableRow",i=>{const r=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),'<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>',r,i)}),e.ui.componentFactory.add("mergeTableCells",i=>{const r=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:n?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:n?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),'<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>',r,i)})}_prepareDropdown(e,t,n,i){const r=this.editor,s=Pt(i),a=this._fillDropdownWithListOptions(s,n);return s.buttonView.set({label:e,icon:t,tooltip:!0}),s.bind("isEnabled").toMany(a,"isEnabled",(...l)=>l.some(c=>c)),this.listenTo(s,"execute",l=>{r.execute(l.source.commandName),l.source instanceof hi||r.editing.view.focus()}),s}_prepareMergeSplitButtonDropdown(e,t,n,i){const r=this.editor,s=Pt(i,Fs),a="mergeTableCells",l=r.commands.get(a),c=this._fillDropdownWithListOptions(s,n);return s.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),s.bind("isEnabled").toMany([l,...c],"isEnabled",(...d)=>d.some(u=>u)),this.listenTo(s.buttonView,"execute",()=>{r.execute(a),r.editing.view.focus()}),this.listenTo(s,"execute",d=>{r.execute(d.source.commandName),r.editing.view.focus()}),s}_fillDropdownWithListOptions(e,t){const n=this.editor,i=[],r=new at;for(const s of t)OS(s,n,i,r);return Vs(e,r),i}}function OS(o,e,t,n){if(o.type==="button"||o.type==="switchbutton"){const i=o.model=new Ys(o.model),{commandName:r,bindIsOn:s}=o.model,a=e.commands.get(r);t.push(a),i.set({commandName:r}),i.bind("isEnabled").to(a),s&&i.bind("isOn").to(a,"value"),i.set({withText:!0})}n.add(o)}var uf=D(6945),NS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(uf.Z,NS),uf.Z.locals;class kn extends q{static get pluginName(){return"TableSelection"}static get requires(){return[qe,qe]}init(){const e=this.editor,t=e.model,n=e.editing.view;this.listenTo(t,"deleteContent",(i,r)=>this._handleDeleteContent(i,r),{priority:"high"}),this.listenTo(n.document,"insertText",(i,r)=>this._handleInsertTextEvent(i,r),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=this.editor.plugins.get(qe),t=this.editor.model.document.selection,n=e.getSelectedTableCells(t);return n.length==0?null:n}getSelectionAsFragment(){const e=this.editor.plugins.get(qe),t=this.getSelectedTableCells();return t?this.editor.model.change(n=>{const i=n.createDocumentFragment(),{first:r,last:s}=e.getColumnIndexes(t),{first:a,last:l}=e.getRowIndexes(t),c=t[0].findAncestor("table");let d=l,u=s;if(e.isSelectionRectangular(t)){const f={firstColumn:r,lastColumn:s,firstRow:a,lastRow:l};d=tf(c,f),u=nf(c,f)}const g=Zp(c,{startRow:a,startColumn:r,endRow:d,endColumn:u},n);return n.insert(g,i,0),i}):null}setCellSelection(e,t){const n=this._getCellsToSelect(e,t);this.editor.model.change(i=>{i.setSelection(n.cells.map(r=>i.createRangeOn(r)),{backward:n.backward})})}getFocusCell(){const e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){const e=ze(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(n=>n.on("selection",(i,r,s)=>{const a=s.writer;(function(d){for(const u of t)d.removeClass("ck-editor__editable_selected",u);t.clear()})(a);const l=this.getSelectedTableCells();if(!l)return;for(const d of l){const u=s.mapper.toViewElement(d);a.addClass("ck-editor__editable_selected",u),t.add(u)}const c=s.mapper.toViewElement(l[l.length-1]);a.setSelection(c,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(n=>{const i=n.createPositionAt(t[0],0),r=e.model.schema.getNearestSelectionRange(i);n.setSelection(r)})}})}_handleDeleteContent(e,t){const n=this.editor.plugins.get(qe),i=t[0],r=t[1],s=this.editor.model,a=!r||r.direction=="backward",l=n.getSelectedTableCells(i);l.length&&(e.stop(),s.change(c=>{const d=l[a?l.length-1:0];s.change(g=>{for(const f of l)s.deleteContent(g.createSelection(f,"in"))});const u=s.schema.getNearestSelectionRange(c.createPositionAt(d,0));i.is("documentSelection")?c.setSelection(u):i.setTo(u)}))}_handleInsertTextEvent(e,t){const n=this.editor,i=this.getSelectedTableCells();if(!i)return;const r=n.editing.view,s=n.editing.mapper,a=i.map(l=>r.createRangeOn(s.toViewElement(l)));t.selection=r.createSelection(a)}_getCellsToSelect(e,t){const n=this.editor.plugins.get("TableUtils"),i=n.getCellLocation(e),r=n.getCellLocation(t),s=Math.min(i.row,r.row),a=Math.max(i.row,r.row),l=Math.min(i.column,r.column),c=Math.max(i.column,r.column),d=new Array(a-s+1).fill(null).map(()=>[]),u={startRow:s,endRow:a,startColumn:l,endColumn:c};for(const{row:b,cell:A}of new ue(e.findAncestor("table"),u))d[b-s].push(A);const g=r.row<i.row,f=r.column<i.column;return g&&d.reverse(),f&&d.forEach(b=>b.reverse()),{cells:d.flat(),backward:g||f}}}class zS extends q{static get pluginName(){return"TableClipboard"}static get requires(){return[kn,qe]}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",(n,i)=>this._onCopyCut(n,i)),this.listenTo(t,"cut",(n,i)=>this._onCopyCut(n,i)),this.listenTo(e.model,"insertContent",(n,[i,r])=>this._onInsertContent(n,i,r),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){const n=this.editor.plugins.get(kn);if(!n.getSelectedTableCells()||e.name=="cut"&&!this.editor.model.canEditAt(this.editor.model.document.selection))return;t.preventDefault(),e.stop();const i=this.editor.data,r=this.editor.editing.view.document,s=i.toView(n.getSelectionAsFragment());r.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:s,method:e.name})}_onInsertContent(e,t,n){if(n&&!n.is("documentSelection"))return;const i=this.editor.model,r=this.editor.plugins.get(qe);let s=this.getTableIfOnlyTableInContent(t,i);if(!s)return;const a=r.getSelectionAffectedTableCells(i.document.selection);a.length?(e.stop(),i.change(l=>{const c={width:r.getColumns(s),height:r.getRows(s)},d=function(E,P,z,j){const Y=E[0].findAncestor("table"),ie=j.getColumnIndexes(E),Ee=j.getRowIndexes(E),he={firstColumn:ie.first,lastColumn:ie.last,firstRow:Ee.first,lastRow:Ee.last},Mt=E.length===1;return Mt&&(he.lastRow+=P.height-1,he.lastColumn+=P.width-1,function(it,nr,_n,Gt){const no=Gt.getColumns(it),oo=Gt.getRows(it);_n>no&&Gt.insertColumns(it,{at:no,columns:_n-no}),nr>oo&&Gt.insertRows(it,{at:oo,rows:nr-oo})}(Y,he.lastRow+1,he.lastColumn+1,j)),Mt||!j.isSelectionRectangular(E)?function(it,nr,_n){const{firstRow:Gt,lastRow:no,firstColumn:oo,lastColumn:Kf}=nr,Gf={first:Gt,last:no},Zf={first:oo,last:Kf};Pa(it,oo,Gf,_n),Pa(it,Kf+1,Gf,_n),Ia(it,Gt,Zf,_n),Ia(it,no+1,Zf,_n,Gt)}(Y,he,z):(he.lastRow=tf(Y,he),he.lastColumn=nf(Y,he)),he}(a,c,l,r),u=d.lastRow-d.firstRow+1,g=d.lastColumn-d.firstColumn+1,f={startRow:0,startColumn:0,endRow:Math.min(u,c.height)-1,endColumn:Math.min(g,c.width)-1};s=Zp(s,f,l);const b=a[0].findAncestor("table"),A=this._replaceSelectedCellsWithPasted(s,c,b,d,l);if(this.editor.plugins.get("TableSelection").isEnabled){const E=r.sortRanges(A.map(P=>l.createRangeOn(P)));l.setSelection(E)}else l.setSelection(A[0],0)})):Da(s,r)}_replaceSelectedCellsWithPasted(e,t,n,i,r){const{width:s,height:a}=t,l=function(E,P,z){const j=new Array(z).fill(null).map(()=>new Array(P).fill(null));for(const{column:Y,row:ie,cell:Ee}of new ue(E))j[ie][Y]=Ee;return j}(e,s,a),c=[...new ue(n,{startRow:i.firstRow,endRow:i.lastRow,startColumn:i.firstColumn,endColumn:i.lastColumn,includeAllSlots:!0})],d=[];let u;for(const E of c){const{row:P,column:z}=E;z===i.firstColumn&&(u=E.getPositionBefore());const j=P-i.firstRow,Y=z-i.firstColumn,ie=l[j%a][Y%s],Ee=ie?r.cloneElement(ie):null,he=this._replaceTableSlotCell(E,Ee,u,r);he&&(ef(he,P,z,i.lastRow,i.lastColumn,r),d.push(he),u=r.createPositionAfter(he))}const g=parseInt(n.getAttribute("headingRows")||"0"),f=parseInt(n.getAttribute("headingColumns")||"0"),b=i.firstRow<g&&g<=i.lastRow,A=i.firstColumn<f&&f<=i.lastColumn;if(b){const E=Ia(n,g,{first:i.firstColumn,last:i.lastColumn},r,i.firstRow);d.push(...E)}if(A){const E=Pa(n,f,{first:i.firstRow,last:i.lastRow},r);d.push(...E)}return d}_replaceTableSlotCell(e,t,n,i){const{cell:r,isAnchor:s}=e;return s&&i.remove(r),t?(i.insert(t,n),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(e.childCount==1&&e.getChild(0).is("element","table"))return e.getChild(0);const n=t.createRangeIn(e);for(const i of n.getItems())if(i.is("element","table")){const r=t.createRange(n.start,t.createPositionBefore(i));if(t.hasContent(r,{ignoreWhitespaces:!0}))return null;const s=t.createRange(t.createPositionAfter(i),n.end);return t.hasContent(s,{ignoreWhitespaces:!0})?null:i}return null}}function Ia(o,e,t,n,i=0){if(!(e<1))return Jp(o,e,i).filter(({column:r,cellWidth:s})=>mf(r,s,t)).map(({cell:r})=>Yp(r,e,n))}function Pa(o,e,t,n){if(!(e<1))return Qp(o,e).filter(({row:i,cellHeight:r})=>mf(i,r,t)).map(({cell:i,column:r})=>Xp(i,r,e,n))}function mf(o,e,t){const n=o+e-1,{first:i,last:r}=t;return o>=i&&o<=r||o<i&&n>=i}class MS extends q{static get pluginName(){return"TableKeyboard"}static get requires(){return[kn,qe]}init(){const e=this.editor.editing.view.document;this.listenTo(e,"arrowKey",(...t)=>this._onArrowKey(...t),{context:"table"}),this.listenTo(e,"tab",(...t)=>this._handleTabOnSelectedTable(...t),{context:"figure"}),this.listenTo(e,"tab",(...t)=>this._handleTab(...t),{context:["th","td"]})}_handleTabOnSelectedTable(e,t){const n=this.editor,i=n.model.document.selection.getSelectedElement();i&&i.is("element","table")&&(t.preventDefault(),t.stopPropagation(),e.stop(),n.model.change(r=>{r.setSelection(r.createRangeIn(i.getChild(0).getChild(0)))}))}_handleTab(e,t){const n=this.editor,i=this.editor.plugins.get(qe),r=this.editor.plugins.get("TableSelection"),s=n.model.document.selection,a=!t.shiftKey;let l=i.getTableCellsContainingSelection(s)[0];if(l||(l=r.getFocusCell()),!l)return;t.preventDefault(),t.stopPropagation(),e.stop();const c=l.parent,d=c.parent,u=d.getChildIndex(c),g=c.getChildIndex(l),f=g===0;if(!a&&f&&u===0)return void n.model.change(P=>{P.setSelection(P.createRangeOn(d))});const b=g===c.childCount-1,A=u===i.getRows(d)-1;if(a&&A&&b&&(n.execute("insertTableRowBelow"),u===i.getRows(d)-1))return void n.model.change(P=>{P.setSelection(P.createRangeOn(d))});let E;if(a&&b)E=d.getChild(u+1).getChild(0);else if(!a&&f){const P=d.getChild(u-1);E=P.getChild(P.childCount-1)}else E=c.getChild(g+(a?1:-1));n.model.change(P=>{P.setSelection(P.createRangeIn(E))})}_onArrowKey(e,t){const n=this.editor,i=qr(t.keyCode,n.locale.contentLanguageDirection);this._handleArrowKeys(i,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const n=this.editor.plugins.get(qe),i=this.editor.plugins.get("TableSelection"),r=this.editor.model,s=r.document.selection,a=["right","down"].includes(e),l=n.getSelectedTableCells(s);if(l.length){let d;return d=t?i.getFocusCell():a?l[l.length-1]:l[0],this._navigateFromCellInDirection(d,e,t),!0}const c=s.focus.findAncestor("tableCell");if(!c)return!1;if(!s.isCollapsed)if(t){if(s.isBackward==a&&!s.containsEntireContent(c))return!1}else{const d=s.getSelectedElement();if(!d||!r.schema.isObject(d))return!1}return!!this._isSelectionAtCellEdge(s,c,a)&&(this._navigateFromCellInDirection(c,e,t),!0)}_isSelectionAtCellEdge(e,t,n){const i=this.editor.model,r=this.editor.model.schema,s=n?e.getLastPosition():e.getFirstPosition();if(!r.getLimitElement(s).is("element","tableCell"))return i.createPositionAt(t,n?"end":0).isTouching(s);const a=i.createSelection(s);return i.modifySelection(a,{direction:n?"forward":"backward"}),s.isEqual(a.focus)}_navigateFromCellInDirection(e,t,n=!1){const i=this.editor.model,r=e.findAncestor("table"),s=[...new ue(r,{includeAllSlots:!0})],{row:a,column:l}=s[s.length-1],c=s.find(({cell:A})=>A==e);let{row:d,column:u}=c;switch(t){case"left":u--;break;case"up":d--;break;case"right":u+=c.cellWidth;break;case"down":d+=c.cellHeight}if(d<0||d>a||u<0&&d<=0||u>l&&d>=a)return void i.change(A=>{A.setSelection(A.createRangeOn(r))});u<0?(u=n?0:l,d--):u>l&&(u=n?l:0,d++);const g=s.find(A=>A.row==d&&A.column==u).cell,f=["right","down"].includes(t),b=this.editor.plugins.get("TableSelection");if(n&&b.isEnabled){const A=b.getAnchorCell()||e;b.setCellSelection(A,g)}else{const A=i.createPositionAt(g,f?0:"end");i.change(E=>{E.setSelection(A)})}}}class FS extends $t{constructor(){super(...arguments),this.domEventType=["mousemove","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}class VS extends q{static get pluginName(){return"TableMouse"}static get requires(){return[kn,qe]}init(){this.editor.editing.view.addObserver(FS),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor,t=e.plugins.get(qe);let n=!1;const i=e.plugins.get(kn);this.listenTo(e.editing.view.document,"mousedown",(r,s)=>{const a=e.model.document.selection;if(!this.isEnabled||!i.isEnabled||!s.domEvent.shiftKey)return;const l=i.getAnchorCell()||t.getTableCellsContainingSelection(a)[0];if(!l)return;const c=this._getModelTableCellFromDomEvent(s);c&&gf(l,c)&&(n=!0,i.setCellSelection(l,c),s.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{n=!1}),this.listenTo(e.editing.view.document,"selectionChange",r=>{n&&r.stop()},{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,n,i=!1,r=!1;const s=e.plugins.get(kn);this.listenTo(e.editing.view.document,"mousedown",(a,l)=>{this.isEnabled&&s.isEnabled&&(l.domEvent.shiftKey||l.domEvent.ctrlKey||l.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(l)))}),this.listenTo(e.editing.view.document,"mousemove",(a,l)=>{if(!l.domEvent.buttons||!t)return;const c=this._getModelTableCellFromDomEvent(l);c&&gf(t,c)&&(n=c,i||n==t||(i=!0)),i&&(r=!0,s.setCellSelection(t,n),l.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{i=!1,r=!1,t=null,n=null}),this.listenTo(e.editing.view.document,"selectionChange",a=>{r&&a.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,n=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(n).parent.findAncestor("tableCell",{includeSelf:!0})}}function gf(o,e){return o.parent.parent==e.parent.parent}var pf=D(6306),LS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(pf.Z,LS),pf.Z.locals;function jS(o){const e=o.getSelectedElement();return e&&ff(e)?e:null}function $S(o){const e=o.getFirstPosition();if(!e)return null;let t=e.parent;for(;t;){if(t.is("element")&&ff(t))return t;t=t.parent}return null}function ff(o){return!!o.getCustomProperty("table")&&Be(o)}var kf=D(7368),HS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(kf.Z,HS),kf.Z.locals;var bf=D(9247),qS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(bf.Z,qS),bf.Z.locals;var wf=D(4070),US={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(wf.Z,US),wf.Z.locals;var Af=D(6237),WS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Af.Z,WS),Af.Z.locals;var _f=D(5087),KS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(_f.Z,KS),_f.Z.locals;const bn=Ye.defaultPositions;bn.northArrowSouth,bn.northArrowSouthWest,bn.northArrowSouthEast,bn.southArrowNorth,bn.southArrowNorthWest,bn.southArrowNorthEast,bn.viewportStickyNorth;var Cf=D(7341),GS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Cf.Z,GS),Cf.Z.locals;var vf=D(2128),ZS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(vf.Z,ZS),vf.Z.locals;var yf=D(4101),JS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(yf.Z,JS),yf.Z.locals;var YS=Object.defineProperty,Ef=Object.getOwnPropertySymbols,QS=Object.prototype.hasOwnProperty,XS=Object.prototype.propertyIsEnumerable,xf=(o,e,t)=>e in o?YS(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Sf=(o,e)=>{for(var t in e||(e={}))QS.call(e,t)&&xf(o,t,e[t]);if(Ef)for(var t of Ef(e))XS.call(e,t)&&xf(o,t,e[t]);return o};const eD={autoRefresh:!0},Df=36e5;class Ra extends ge(){constructor(e,t={}){if(super(),!e)throw new I("token-missing-token-url",this);t.initValue&&this._validateTokenValue(t.initValue),this.set("value",t.initValue),this._refresh=typeof e=="function"?e:()=>{return n=e,new Promise((i,r)=>{const s=new XMLHttpRequest;s.open("GET",n),s.addEventListener("load",()=>{const a=s.status,l=s.response;return a<200||a>299?r(new I("token-cannot-download-new-token",null)):i(l)}),s.addEventListener("error",()=>r(new Error("Network Error"))),s.addEventListener("abort",()=>r(new Error("Abort"))),s.send()});var n},this._options=Sf(Sf({},eD),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(),this))}destroy(){clearTimeout(this._tokenRefreshTimeout)}_validateTokenValue(e){const t=typeof e=="string",n=!/^".*"$/.test(e),i=t&&e.split(".").length===3;if(!n||!i)throw new I("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));return t?Math.floor((1e3*t-Date.now())/2):Df}catch{return Df}}static create(e,t={}){return new Ra(e,t).init()}}const Oa=/^data:(\S*?);base64,/;class tD extends me(){constructor(e,t,n){if(super(),!e)throw new I("fileuploader-missing-file",null);if(!t)throw new I("fileuploader-missing-token",null);if(!n)throw new I("fileuploader-missing-api-address",null);this.file=function(i){if(typeof i!="string")return!1;const r=i.match(Oa);return!(!r||!r.length)}(e)?function(i,r=512){try{const s=i.match(Oa)[1],a=atob(i.replace(Oa,"")),l=[];for(let c=0;c<a.length;c+=r){const d=a.slice(c,c+r),u=new Array(d.length);for(let g=0;g<d.length;g++)u[g]=d.charCodeAt(g);l.push(new Uint8Array(u))}return new Blob(l,{type:s})}catch{throw new I("fileuploader-decoding-image-data-error",null)}}(e):e,this._token=t,this._apiAddress=n}onProgress(e){return this.on("progress",(t,n)=>e(n)),this}onError(e){return this.once("error",(t,n)=>e(n)),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.xhr,t=n=>()=>this.fire("error",n);e.addEventListener("error",t("Network Error")),e.addEventListener("abort",t("Abort")),e.upload&&e.upload.addEventListener("progress",n=>{n.lengthComputable&&this.fire("progress",{total:n.total,uploaded:n.loaded})}),e.addEventListener("load",()=>{const n=e.status,i=e.response;if(n<200||n>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((n,i)=>{t.addEventListener("load",()=>{const r=t.status,s=t.response;return r<200||r>299?s.message?i(new I("fileuploader-uploading-data-failed",this,{message:s.message})):i(s.error):n(s)}),t.addEventListener("error",()=>i(new Error("Network Error"))),t.addEventListener("abort",()=>i(new Error("Abort"))),t.send(e)})}}class nD{constructor(e,t){if(!e)throw new I("uploadgateway-missing-token",null);if(!t)throw new I("uploadgateway-missing-api-address",null);this._token=e,this._apiAddress=t}upload(e){return new tD(e,this._token,this._apiAddress)}}class oD extends ui{static get pluginName(){return"CloudServicesCore"}createToken(e,t){return new Ra(e,t)}createUploadGateway(e,t){return new nD(e,t)}}var Bf=(o,e,t)=>new Promise((n,i)=>{var r=l=>{try{a(t.next(l))}catch(c){i(c)}},s=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(r,s);a((t=t.apply(o,e)).next())});const Na=["left","right","center","justify"];function Tf(o){return Na.includes(o)}function If(o,e){return e.contentLanguageDirection=="rtl"?o==="right":o==="left"}function Pf(o){const e=o.map(n=>{let i;return i=typeof n=="string"?{name:n}:n,i}).filter(n=>{const i=Na.includes(n.name);return i||Q("alignment-config-name-not-recognized",{option:n}),i}),t=e.filter(n=>!!n.className).length;if(t&&t<e.length)throw new I("alignment-config-classnames-are-missing",{configuredOptions:o});return e.forEach((n,i,r)=>{const s=r.slice(i+1);if(s.some(a=>a.name==n.name))throw new I("alignment-config-name-already-defined",{option:n,configuredOptions:o});if(n.className&&s.some(a=>a.className==n.className))throw new I("alignment-config-classname-already-defined",{option:n,configuredOptions:o})}),e}const za="alignment";class iD extends ne{refresh(){const e=this.editor.locale,t=ze(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=!!t&&this._canBeAligned(t),this.isEnabled&&t.hasAttribute("alignment")?this.value=t.getAttribute("alignment"):this.value=e.contentLanguageDirection==="rtl"?"right":"left"}execute(e={}){const t=this.editor,n=t.locale,i=t.model,r=i.document,s=e.value;i.change(a=>{const l=Array.from(r.selection.getSelectedBlocks()).filter(d=>this._canBeAligned(d)),c=l[0].getAttribute("alignment");If(s,n)||c===s||!s?function(d,u){for(const g of d)u.removeAttribute(za,g)}(l,a):function(d,u,g){for(const f of d)u.setAttribute(za,g,f)}(l,a,s)})}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,za)}}class rD extends q{static get pluginName(){return"AlignmentEditing"}constructor(e){super(e),e.config.define("alignment",{options:Na.map(t=>({name:t}))})}init(){const e=this.editor,t=e.locale,n=e.model.schema,i=Pf(e.config.get("alignment.options")).filter(l=>Tf(l.name)&&!If(l.name,t)),r=i.some(l=>!!l.className);n.extend("$block",{allowAttributes:"alignment"}),e.model.schema.setAttributeProperties("alignment",{isFormatting:!0}),r?e.conversion.attributeToAttribute(function(l){const c={};for(const u of l)c[u.name]={key:"class",value:u.className};return{model:{key:"alignment",values:l.map(u=>u.name)},view:c}}(i)):e.conversion.for("downcast").attributeToAttribute(function(l){const c={};for(const{name:u}of l)c[u]={key:"style",value:{"text-align":u}};return{model:{key:"alignment",values:l.map(u=>u.name)},view:c}}(i));const s=function(l){const c=[];for(const{name:d}of l)c.push({view:{key:"style",value:{"text-align":d}},model:{key:"alignment",value:d}});return c}(i);for(const l of s)e.conversion.for("upcast").attributeToAttribute(l);const a=function(l){const c=[];for(const{name:d}of l)c.push({view:{key:"align",value:d},model:{key:"alignment",value:d}});return c}(i);for(const l of a)e.conversion.for("upcast").attributeToAttribute(l);e.commands.add("alignment",new iD(e))}}const Yi=new Map([["left",ve.alignLeft],["right",ve.alignRight],["center",ve.alignCenter],["justify",ve.alignJustify]]);class sD extends q{get localizedOptionTitles(){const e=this.editor.t;return{left:e("Align left"),right:e("Align right"),center:e("Align center"),justify:e("Justify")}}static get pluginName(){return"AlignmentUI"}init(){const e=this.editor,t=e.ui.componentFactory,n=e.t,i=Pf(e.config.get("alignment.options"));i.map(r=>r.name).filter(Tf).forEach(r=>this._addButton(r)),t.add("alignment",r=>{const s=Pt(r);Pi(s,()=>i.map(c=>t.create(`alignment:${c.name}`)),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:n("Text alignment toolbar")}),s.buttonView.set({label:n("Text alignment"),tooltip:!0}),s.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const a=r.contentLanguageDirection==="rtl"?Yi.get("right"):Yi.get("left"),l=e.commands.get("alignment");return s.buttonView.bind("icon").to(l,"value",c=>Yi.get(c)||a),s.bind("isEnabled").to(l,"isEnabled"),this.listenTo(s,"execute",()=>{e.editing.view.focus()}),s})}_addButton(e){const t=this.editor;t.ui.componentFactory.add(`alignment:${e}`,n=>{const i=t.commands.get("alignment"),r=new Ae(n);return r.set({label:this.localizedOptionTitles[e],icon:Yi.get(e),tooltip:!0,isToggleable:!0}),r.bind("isEnabled").to(i),r.bind("isOn").to(i,"value",s=>s===e),this.listenTo(r,"execute",()=>{t.execute("alignment",{value:e}),t.editing.view.focus()}),r})}}function aD(o){const e=[{name:"address",isVoid:!1},{name:"article",isVoid:!1},{name:"aside",isVoid:!1},{name:"blockquote",isVoid:!1},{name:"br",isVoid:!0},{name:"details",isVoid:!1},{name:"dialog",isVoid:!1},{name:"dd",isVoid:!1},{name:"div",isVoid:!1},{name:"dl",isVoid:!1},{name:"dt",isVoid:!1},{name:"fieldset",isVoid:!1},{name:"figcaption",isVoid:!1},{name:"figure",isVoid:!1},{name:"footer",isVoid:!1},{name:"form",isVoid:!1},{name:"h1",isVoid:!1},{name:"h2",isVoid:!1},{name:"h3",isVoid:!1},{name:"h4",isVoid:!1},{name:"h5",isVoid:!1},{name:"h6",isVoid:!1},{name:"header",isVoid:!1},{name:"hgroup",isVoid:!1},{name:"hr",isVoid:!0},{name:"input",isVoid:!0},{name:"li",isVoid:!1},{name:"main",isVoid:!1},{name:"nav",isVoid:!1},{name:"ol",isVoid:!1},{name:"p",isVoid:!1},{name:"section",isVoid:!1},{name:"table",isVoid:!1},{name:"tbody",isVoid:!1},{name:"td",isVoid:!1},{name:"textarea",isVoid:!1},{name:"th",isVoid:!1},{name:"thead",isVoid:!1},{name:"tr",isVoid:!1},{name:"ul",isVoid:!1}],t=e.map(r=>r.name).join("|"),n=o.replace(new RegExp(`</?(${t})( .*?)?>`,"g"),`
|
|
6525
|
+
`),e+=i,t=n}}return e}class Pt extends q{static get pluginName(){return"ClipboardPipeline"}init(){this.editor.editing.view.addObserver(Xs),this._setupPasteDrop(),this._setupCopyCut()}_setupPasteDrop(){const e=this.editor,t=e.model,n=e.editing.view,i=n.document;this.listenTo(i,"clipboardInput",(r,s)=>{s.method!="paste"||e.model.canEditAt(e.model.document.selection)||r.stop()},{priority:"highest"}),this.listenTo(i,"clipboardInput",(r,s)=>{const a=s.dataTransfer;let l;if(s.content)l=s.content;else{let u="";a.getData("text/html")?u=function(g){return g.replace(/<span(?: class="Apple-converted-space"|)>(\s+)<\/span>/g,(f,b)=>b.length==1?" ":b).replace(/<!--[\s\S]*?-->/g,"")}(a.getData("text/html")):a.getData("text/plain")&&(((c=(c=a.getData("text/plain")).replace(/</g,"<").replace(/>/g,">").replace(/\r?\n\r?\n/g,"</p><p>").replace(/\r?\n/g,"<br>").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("</p><p>")||c.includes("<br>"))&&(c=`<p>${c}</p>`),u=c),l=this.editor.data.htmlProcessor.toView(u)}var c;const d=new $(this,"inputTransformation");this.fire(d,{content:l,dataTransfer:a,targetRanges:s.targetRanges,method:s.method}),d.stop.called&&r.stop(),n.scrollToTheSelection()},{priority:"low"}),this.listenTo(this,"inputTransformation",(r,s)=>{if(s.content.isEmpty)return;const a=this.editor.data.toModel(s.content,"$clipboardHolder");a.childCount!=0&&(r.stop(),t.change(()=>{this.fire("contentInsertion",{content:a,method:s.method,dataTransfer:s.dataTransfer,targetRanges:s.targetRanges})}))},{priority:"low"}),this.listenTo(this,"contentInsertion",(r,s)=>{s.resultRange=t.insertContent(s.content)},{priority:"low"})}_setupCopyCut(){const e=this.editor,t=e.model.document,n=e.editing.view.document,i=(r,s)=>{const a=s.dataTransfer;s.preventDefault();const l=e.data.toView(e.model.getSelectedContent(t.selection));n.fire("clipboardOutput",{dataTransfer:a,content:l,method:r.name})};this.listenTo(n,"copy",i,{priority:"low"}),this.listenTo(n,"cut",(r,s)=>{e.model.canEditAt(e.model.document.selection)?i(r,s):s.preventDefault()},{priority:"low"}),this.listenTo(n,"clipboardOutput",(r,s)=>{s.content.isEmpty||(s.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(s.content)),s.dataTransfer.setData("text/plain",im(s.content))),s.method=="cut"&&e.model.deleteContent(t.selection)},{priority:"low"})}}class rm{constructor(e,t=20){this._batch=null,this.model=e,this._size=0,this.limit=t,this._isLocked=!1,this._changeCallback=(n,i)=>{i.isLocal&&i.isUndoable&&i!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(e){this._size+=e,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(e=!1){this.isLocked&&!e||(this._batch=null,this._size=0)}}class $E extends ne{constructor(e,t){super(e),this._buffer=new rm(e.model,t),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(e={}){const t=this.editor.model,n=t.document,i=e.text||"",r=i.length;let s=n.selection;if(e.selection?s=e.selection:e.range&&(s=t.createSelection(e.range)),!t.canEditAt(s))return;const a=e.resultRange;t.enqueueChange(this._buffer.batch,l=>{this._buffer.lock(),t.deleteContent(s),i&&t.insertContent(l.createText(i,n.selection.getAttributes()),s),a?l.setSelection(a):s.is("documentSelection")||l.setSelection(s),this._buffer.unlock(),this._buffer.input(r)})}}const sm=["insertText","insertReplacementText"];class HE extends _t{constructor(e){super(e),k.isAndroid&&sm.push("insertCompositionText");const t=e.document;t.on("beforeinput",(n,i)=>{if(!this.isEnabled)return;const{data:r,targetRanges:s,inputType:a,domEvent:l}=i;if(!sm.includes(a))return;const c=new $(t,"insertText");t.fire(c,new Ln(e,l,{text:r,selection:e.createSelection(s)})),c.stop.called&&n.stop()}),t.on("compositionend",(n,{data:i,domEvent:r})=>{this.isEnabled&&!k.isAndroid&&i&&t.fire("insertText",new Ln(e,r,{text:i,selection:t.selection}))},{priority:"lowest"})}observe(){}stopObserving(){}}class am extends q{static get pluginName(){return"Input"}init(){const e=this.editor,t=e.model,n=e.editing.view,i=t.document.selection;n.addObserver(HE);const r=new $E(e,e.config.get("typing.undoStep")||20);e.commands.add("insertText",r),e.commands.add("input",r),this.listenTo(n.document,"insertText",(s,a)=>{n.document.isComposing||a.preventDefault();const{text:l,selection:c,resultRange:d}=a,u=Array.from(c.getRanges()).map(b=>e.editing.mapper.toModelRange(b));let g=l;if(k.isAndroid){const b=Array.from(u[0].getItems()).reduce((A,E)=>A+(E.is("$textProxy")?E.data:""),"");b&&(b.length<=g.length?g.startsWith(b)&&(g=g.substring(b.length),u[0].start=u[0].start.getShiftedBy(b.length)):b.startsWith(g)&&(u[0].start=u[0].start.getShiftedBy(g.length),g=""))}const f={text:g,selection:t.createSelection(u)};d&&(f.resultRange=e.editing.mapper.toModelRange(d)),e.execute("insertText",f)}),k.isAndroid?this.listenTo(n.document,"keydown",(s,a)=>{!i.isCollapsed&&a.keyCode==229&&n.document.isComposing&&lm(t,r)}):this.listenTo(n.document,"compositionstart",()=>{i.isCollapsed||lm(t,r)})}}function lm(o,e){if(!e.isEnabled)return;const t=e.buffer;t.lock(),o.enqueueChange(t.batch,()=>{o.deleteContent(o.document.selection)}),t.unlock()}class cm extends ne{constructor(e,t){super(e),this.direction=t,this._buffer=new rm(e.model,e.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(e={}){const t=this.editor.model,n=t.document;t.enqueueChange(this._buffer.batch,i=>{this._buffer.lock();const r=i.createSelection(e.selection||n.selection);if(!t.canEditAt(r))return;const s=e.sequence||1,a=r.isCollapsed;if(r.isCollapsed&&t.modifySelection(r,{direction:this.direction,unit:e.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(s))return void this._replaceEntireContentWithParagraph(i);if(this._shouldReplaceFirstBlockWithParagraph(r,s))return void this.editor.execute("paragraph",{selection:r});if(r.isCollapsed)return;let l=0;r.getFirstRange().getMinimalFlatRanges().forEach(c=>{l+=kr(c.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))}),t.deleteContent(r,{doNotResetEntireContent:a,direction:this.direction}),this._buffer.input(l),i.setSelection(r),this._buffer.unlock()})}_shouldEntireContentBeReplacedWithParagraph(e){if(e>1)return!1;const t=this.editor.model,n=t.document.selection,i=t.schema.getLimitElement(n);if(!(n.isCollapsed&&n.containsEntireContent(i))||!t.schema.checkChild(i,"paragraph"))return!1;const r=i.getChild(0);return!r||!r.is("element","paragraph")}_replaceEntireContentWithParagraph(e){const t=this.editor.model,n=t.document.selection,i=t.schema.getLimitElement(n),r=e.createElement("paragraph");e.remove(e.createRangeIn(i)),e.insert(r,i),e.setSelection(r,0)}_shouldReplaceFirstBlockWithParagraph(e,t){const n=this.editor.model;if(t>1||this.direction!="backward"||!e.isCollapsed)return!1;const i=e.getFirstPosition(),r=n.schema.getLimitElement(i),s=r.getChild(0);return i.parent==s&&!!e.containsEntireContent(s)&&!!n.schema.checkChild(r,"paragraph")&&s.name!="paragraph"}}const dm="word",Ut="selection",Un="backward",No="forward",hm={deleteContent:{unit:Ut,direction:Un},deleteContentBackward:{unit:"codePoint",direction:Un},deleteWordBackward:{unit:dm,direction:Un},deleteHardLineBackward:{unit:Ut,direction:Un},deleteSoftLineBackward:{unit:Ut,direction:Un},deleteContentForward:{unit:"character",direction:No},deleteWordForward:{unit:dm,direction:No},deleteHardLineForward:{unit:Ut,direction:No},deleteSoftLineForward:{unit:Ut,direction:No}};class qE extends _t{constructor(e){super(e);const t=e.document;let n=0;t.on("keydown",()=>{n++}),t.on("keyup",()=>{n=0}),t.on("beforeinput",(i,r)=>{if(!this.isEnabled)return;const{targetRanges:s,domEvent:a,inputType:l}=r,c=hm[l];if(!c)return;const d={direction:c.direction,unit:c.unit,sequence:n};d.unit==Ut&&(d.selectionToRemove=e.createSelection(s[0])),l==="deleteContentBackward"&&(k.isAndroid&&(d.sequence=1),function(g){if(g.length!=1||g[0].isCollapsed)return!1;const f=g[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let b=0;for(const{nextPosition:A}of f){if(A.parent.is("$text")){const E=A.parent.data,P=A.offset;if(Wr(E,P)||Kr(E,P)||Rc(E,P))continue;b++}else b++;if(b>1)return!0}return!1}(s)&&(d.unit=Ut,d.selectionToRemove=e.createSelection(s)));const u=new Fn(t,"delete",s[0]);t.fire(u,new Ln(e,a,d)),u.stop.called&&i.stop()}),k.isBlink&&function(i){const r=i.view,s=r.document;let a=null,l=!1;function c(u){return u==se.backspace||u==se.delete}function d(u){return u==se.backspace?Un:No}s.on("keydown",(u,{keyCode:g})=>{a=g,l=!1}),s.on("keyup",(u,{keyCode:g,domEvent:f})=>{const b=s.selection,A=i.isEnabled&&g==a&&c(g)&&!b.isCollapsed&&!l;if(a=null,A){const E=b.getFirstRange(),P=new Fn(s,"delete",E),z={unit:Ut,direction:d(g),selectionToRemove:b};s.fire(P,new Ln(r,f,z))}}),s.on("beforeinput",(u,{inputType:g})=>{const f=hm[g];c(a)&&f&&f.direction==d(a)&&(l=!0)},{priority:"high"}),s.on("beforeinput",(u,{inputType:g,data:f})=>{a==se.delete&&g=="insertText"&&f==""&&u.stop()},{priority:"high"})}(this)}observe(){}stopObserving(){}}class Wn extends q{static get pluginName(){return"Delete"}init(){const e=this.editor,t=e.editing.view,n=t.document,i=e.model.document;t.addObserver(qE),this._undoOnBackspace=!1;const r=new cm(e,"forward");e.commands.add("deleteForward",r),e.commands.add("forwardDelete",r),e.commands.add("delete",new cm(e,"backward")),this.listenTo(n,"delete",(s,a)=>{n.isComposing||a.preventDefault();const{direction:l,sequence:c,selectionToRemove:d,unit:u}=a,g=l==="forward"?"deleteForward":"delete",f={sequence:c};if(u=="selection"){const b=Array.from(d.getRanges()).map(A=>e.editing.mapper.toModelRange(A));f.selection=e.model.createSelection(b)}else f.unit=u;e.execute(g,f),t.scrollToTheSelection()},{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",(s,a)=>{this._undoOnBackspace&&a.direction=="backward"&&a.sequence==1&&a.unit=="codePoint"&&(this._undoOnBackspace=!1,e.execute("undo"),a.preventDefault(),s.stop())},{context:"$capture"}),this.listenTo(i,"change",()=>{this._undoOnBackspace=!1}))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class UE extends q{static get requires(){return[am,Wn]}static get pluginName(){return"Typing"}}function um(o,e){let t=o.start;return{text:Array.from(o.getItems()).reduce((n,i)=>i.is("$text")||i.is("$textProxy")?n+i.data:(t=e.createPositionAfter(i),""),""),range:e.createRange(t,o.end)}}class mm extends ge(){constructor(e,t){super(),this.model=e,this.testCallback=t,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",()=>{this.isEnabled?this._startListening():(this.stopListening(e.document.selection),this.stopListening(e.document))}),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const e=this.model.document;this.listenTo(e.selection,"change:range",(t,{directChange:n})=>{n&&(e.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1))}),this.listenTo(e,"change:data",(t,n)=>{!n.isUndo&&n.isLocal&&this._evaluateTextBeforeSelection("data",{batch:n})})}_evaluateTextBeforeSelection(e,t={}){const n=this.model,i=n.document.selection,r=n.createRange(n.createPositionAt(i.focus.parent,0),i.focus),{text:s,range:a}=um(r,n),l=this.testCallback(s);if(!l&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!l,l){const c=Object.assign(t,{text:s,range:a});typeof l=="object"&&Object.assign(c,l),this.fire(`matched:${e}`,c)}}}class gm extends q{constructor(e){super(e),this.attributes=new Set,this._overrideUid=null}static get pluginName(){return"TwoStepCaretMovement"}init(){const e=this.editor,t=e.model,n=e.editing.view,i=e.locale,r=t.document.selection;this.listenTo(n.document,"arrowKey",(s,a)=>{if(!r.isCollapsed||a.shiftKey||a.altKey||a.ctrlKey)return;const l=a.keyCode==se.arrowright,c=a.keyCode==se.arrowleft;if(!l&&!c)return;const d=i.contentLanguageDirection;let u=!1;u=d==="ltr"&&l||d==="rtl"&&c?this._handleForwardMovement(a):this._handleBackwardMovement(a),u===!0&&s.stop()},{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(r,"change:range",(s,a)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!a.directChange&&$i(r.getFirstPosition(),this.attributes)||this._restoreGravity())})}registerAttribute(e){this.attributes.add(e)}_handleForwardMovement(e){const t=this.attributes,n=this.editor.model.document.selection,i=n.getFirstPosition();return!this._isGravityOverridden&&(!i.isAtStart||!ea(n,t))&&!!$i(i,t)&&(ji(e),this._overrideGravity(),!0)}_handleBackwardMovement(e){const t=this.attributes,n=this.editor.model,i=n.document.selection,r=i.getFirstPosition();return this._isGravityOverridden?(ji(e),this._restoreGravity(),ta(n,t,r),!0):r.isAtStart?!!ea(i,t)&&(ji(e),ta(n,t,r),!0):!!function(s,a){const l=s.getShiftedBy(-1);return $i(l,a)}(r,t)&&(r.isAtEnd&&!ea(i,t)&&$i(r,t)?(ji(e),ta(n,t,r),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1))}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 ea(o,e){for(const t of e)if(o.hasAttribute(t))return!0;return!1}function ta(o,e,t){const n=t.nodeBefore;o.change(i=>{n?i.setSelectionAttribute(n.getAttributes()):i.removeSelectionAttribute(e)})}function ji(o){o.preventDefault()}function $i(o,e){const{nodeBefore:t,nodeAfter:n}=o;for(const i of e){const r=t?t.getAttribute(i):void 0;if((n?n.getAttribute(i):void 0)!==r)return!0}return!1}var pm=/[\\^$.*+?()[\]{}|]/g,WE=RegExp(pm.source);const KE=function(o){return(o=ns(o))&&WE.test(o)?o.replace(pm,"\\$&"):o},fm={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},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:Kn('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:Kn("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:Kn("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:Kn('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:Kn('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:Kn("'"),to:[null,"‚",null,"’"]}},km={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},GE=["symbols","mathematical","typography","quotes"];function ZE(o){return typeof o=="string"?new RegExp(`(${KE(o)})$`):o}function JE(o){return typeof o=="string"?()=>[o]:o instanceof Array?()=>o:o}function YE(o){return(o.textNode?o.textNode:o.nodeAfter).getAttributes()}function Kn(o){return new RegExp(`(^|\\s)(${o})([^${o}]*)(${o})$`)}function Gn(o,e,t,n){return n.createRange(bm(o,e,t,!0,n),bm(o,e,t,!1,n))}function bm(o,e,t,n,i){let r=o.textNode||(n?o.nodeBefore:o.nodeAfter),s=null;for(;r&&r.getAttribute(e)==t;)s=r,r=n?r.previousSibling:r.nextSibling;return s?i.createPositionAt(s,n?"before":"after"):o}function*wm(o,e){for(const t of e)t&&o.getAttributeProperties(t[0]).copyOnEnter&&(yield t)}class QE extends ne{execute(){this.editor.model.change(e=>{this.enterBlock(e),this.fire("afterExecute",{writer:e})})}enterBlock(e){const t=this.editor.model,n=t.document.selection,i=t.schema,r=n.isCollapsed,s=n.getFirstRange(),a=s.start.parent,l=s.end.parent;if(i.isLimit(a)||i.isLimit(l))return r||a!=l||t.deleteContent(n),!1;if(r){const c=wm(e.model.schema,n.getAttributes());return Am(e,s.start),e.setSelectionAttribute(c),!0}{const c=!(s.start.isAtStart&&s.end.isAtEnd),d=a==l;if(t.deleteContent(n,{leaveUnmerged:c}),c){if(d)return Am(e,n.focus),!0;e.setSelection(l,0)}}return!1}}function Am(o,e){o.split(e),o.setSelection(e.parent.nextSibling,0)}const XE={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class _m extends _t{constructor(e){super(e);const t=this.document;let n=!1;t.on("keydown",(i,r)=>{n=r.shiftKey}),t.on("beforeinput",(i,r)=>{if(!this.isEnabled)return;let s=r.inputType;k.isSafari&&n&&s=="insertParagraph"&&(s="insertLineBreak");const a=r.domEvent,l=XE[s];if(!l)return;const c=new Fn(t,"enter",r.targetRanges[0]);t.fire(c,new Ln(e,a,{isSoft:l.isSoft})),c.stop.called&&i.stop()})}observe(){}stopObserving(){}}class zo extends q{static get pluginName(){return"Enter"}init(){const e=this.editor,t=e.editing.view,n=t.document;t.addObserver(_m),e.commands.add("enter",new QE(e)),this.listenTo(n,"enter",(i,r)=>{n.isComposing||r.preventDefault(),r.isSoft||(e.execute("enter"),t.scrollToTheSelection())},{priority:"low"})}}class e2 extends ne{execute(){const e=this.editor.model,t=e.document;e.change(n=>{(function(i,r,s){const a=s.isCollapsed,l=s.getFirstRange(),c=l.start.parent,d=l.end.parent,u=c==d;if(a){const g=wm(i.schema,s.getAttributes());Cm(i,r,l.end),r.removeSelectionAttribute(s.getAttributeKeys()),r.setSelectionAttribute(g)}else{const g=!(l.start.isAtStart&&l.end.isAtEnd);i.deleteContent(s,{leaveUnmerged:g}),u?Cm(i,r,s.focus):g&&r.setSelection(d,0)}})(e,n,t.selection),this.fire("afterExecute",{writer:n})})}refresh(){const e=this.editor.model,t=e.document;this.isEnabled=function(n,i){if(i.rangeCount>1)return!1;const r=i.anchor;if(!r||!n.checkChild(r,"softBreak"))return!1;const s=i.getFirstRange(),a=s.start.parent,l=s.end.parent;return!((na(a,n)||na(l,n))&&a!==l)}(e.schema,t.selection)}}function Cm(o,e,t){const n=e.createElement("softBreak");o.insertContent(n,t),e.setSelection(n,"after")}function na(o,e){return!o.is("rootElement")&&(e.isLimit(o)||na(o.parent,e))}class t2 extends q{static get pluginName(){return"ShiftEnter"}init(){const e=this.editor,t=e.model.schema,n=e.conversion,i=e.editing.view,r=i.document;t.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(s,{writer:a})=>a.createEmptyElement("br")}),i.addObserver(_m),e.commands.add("shiftEnter",new e2(e)),this.listenTo(r,"enter",(s,a)=>{r.isComposing||a.preventDefault(),a.isSoft&&(e.execute("shiftEnter"),i.scrollToTheSelection())},{priority:"low"})}}class n2 extends me(){constructor(){super(...arguments),this._stack=[]}add(e,t){const n=this._stack,i=n[0];this._insertDescriptor(e);const r=n[0];i===r||oa(i,r)||this.fire("change:top",{oldDescriptor:i,newDescriptor:r,writer:t})}remove(e,t){const n=this._stack,i=n[0];this._removeDescriptor(e);const r=n[0];i===r||oa(i,r)||this.fire("change:top",{oldDescriptor:i,newDescriptor:r,writer:t})}_insertDescriptor(e){const t=this._stack,n=t.findIndex(r=>r.id===e.id);if(oa(e,t[n]))return;n>-1&&t.splice(n,1);let i=0;for(;t[i]&&o2(t[i],e);)i++;t.splice(i,0,e)}_removeDescriptor(e){const t=this._stack,n=t.findIndex(i=>i.id===e);n>-1&&t.splice(n,1)}}function oa(o,e){return o&&e&&o.priority==e.priority&&Hi(o.classes)==Hi(e.classes)}function o2(o,e){return o.priority>e.priority||!(o.priority<e.priority)&&Hi(o.classes)>Hi(e.classes)}function Hi(o){return Array.isArray(o)?o.sort().join(","):o}const i2='<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>',r2="ck-widget",vm="ck-widget_selected";function Be(o){return!!o.is("element")&&!!o.getCustomProperty("widget")}function ia(o,e,t={}){if(!o.is("containerElement"))throw new I("widget-to-widget-wrong-element-type",null,{element:o});return e.setAttribute("contenteditable","false",o),e.addClass(r2,o),e.setCustomProperty("widget",!0,o),o.getFillerOffset=c2,e.setCustomProperty("widgetLabel",[],o),t.label&&function(n,i){n.getCustomProperty("widgetLabel").push(i)}(o,t.label),t.hasSelectionHandle&&function(n,i){const r=i.createUIElement("div",{class:"ck ck-widget__selection-handle"},function(s){const a=this.toDomElement(s),l=new ko;return l.set("content",i2),l.render(),a.appendChild(l.element),a});i.insert(i.createPositionAt(n,0),r),i.addClass(["ck-widget_with-selection-handle"],n)}(o,e),ym(o,e),o}function s2(o,e,t){if(e.classes&&t.addClass(Pe(e.classes),o),e.attributes)for(const n in e.attributes)t.setAttribute(n,e.attributes[n],o)}function a2(o,e,t){if(e.classes&&t.removeClass(Pe(e.classes),o),e.attributes)for(const n in e.attributes)t.removeAttribute(n,o)}function ym(o,e,t=s2,n=a2){const i=new n2;i.on("change:top",(r,s)=>{s.oldDescriptor&&n(o,s.oldDescriptor,s.writer),s.newDescriptor&&t(o,s.newDescriptor,s.writer)}),e.setCustomProperty("addHighlight",(r,s,a)=>i.add(s,a),o),e.setCustomProperty("removeHighlight",(r,s,a)=>i.remove(s,a),o)}function l2(o,e,t={}){return e.addClass(["ck-editor__editable","ck-editor__nested-editable"],o),e.setAttribute("role","textbox",o),t.label&&e.setAttribute("aria-label",t.label,o),e.setAttribute("contenteditable",o.isReadOnly?"false":"true",o),o.on("change:isReadOnly",(n,i,r)=>{e.setAttribute("contenteditable",r?"false":"true",o)}),o.on("change:isFocused",(n,i,r)=>{r?e.addClass("ck-editor__nested-editable_focused",o):e.removeClass("ck-editor__nested-editable_focused",o)}),ym(o,e),o}function c2(){return null}const Rt="widget-type-around";function pn(o,e,t){return!!o&&Be(o)&&!t.isInline(e)}function Wt(o){return o.getAttribute(Rt)}var Em=D(4921),d2={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Em.Z,d2),Em.Z.locals;const xm=["before","after"],h2=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,Sm="ck-widget__type-around_disabled";class u2 extends q{constructor(){super(...arguments),this._currentFakeCaretModelElement=null}static get pluginName(){return"WidgetTypeAround"}static get requires(){return[zo,Wn]}init(){const e=this.editor,t=e.editing.view;this.on("change:isEnabled",(n,i,r)=>{t.change(s=>{for(const a of t.document.roots)r?s.removeClass(Sm,a):s.addClass(Sm,a)}),r||e.model.change(s=>{s.removeSelectionAttribute(Rt)})}),this._enableTypeAroundUIInjection(),this._enableInsertingParagraphsOnButtonClick(),this._enableInsertingParagraphsOnEnterKeypress(),this._enableInsertingParagraphsOnTypingKeystroke(),this._enableTypeAroundFakeCaretActivationUsingKeyboardArrows(),this._enableDeleteIntegration(),this._enableInsertContentIntegration(),this._enableInsertObjectIntegration(),this._enableDeleteContentIntegration()}destroy(){super.destroy(),this._currentFakeCaretModelElement=null}_insertParagraph(e,t){const n=this.editor,i=n.editing.view,r=n.model.schema.getAttributesWithProperty(e,"copyOnReplace",!0);n.execute("insertParagraph",{position:n.model.createPositionAt(e,t),attributes:r}),i.focus(),i.scrollToTheSelection()}_listenToIfEnabled(e,t,n,i){this.listenTo(e,t,(...r)=>{this.isEnabled&&n(...r)},i)}_insertParagraphAccordingToFakeCaretPosition(){const e=this.editor.model.document.selection,t=Wt(e);if(!t)return!1;const n=e.getSelectedElement();return this._insertParagraph(n,t),!0}_enableTypeAroundUIInjection(){const e=this.editor,t=e.model.schema,n=e.locale.t,i={before:n("Insert paragraph before block"),after:n("Insert paragraph after block")};e.editing.downcastDispatcher.on("insert",(r,s,a)=>{const l=a.mapper.toViewElement(s.item);l&&pn(l,s.item,t)&&(function(c,d,u){const g=c.createUIElement("div",{class:"ck ck-reset_all ck-widget__type-around"},function(f){const b=this.toDomElement(f);return function(A,E){for(const P of xm){const z=new kt({tag:"div",attributes:{class:["ck","ck-widget__type-around__button",`ck-widget__type-around__button_${P}`],title:E[P],"aria-hidden":"true"},children:[A.ownerDocument.importNode(h2,!0)]});A.appendChild(z.render())}}(b,d),function(A){const E=new kt({tag:"div",attributes:{class:["ck","ck-widget__type-around__fake-caret"]}});A.appendChild(E.render())}(b),b});c.insert(c.createPositionAt(u,"end"),g)}(a.writer,i,l),l.getCustomProperty("widgetLabel").push(()=>this.isEnabled?n("Press Enter to type after or press Shift + Enter to type before the widget"):""))},{priority:"low"})}_enableTypeAroundFakeCaretActivationUsingKeyboardArrows(){const e=this.editor,t=e.model,n=t.document.selection,i=t.schema,r=e.editing.view;function s(a){return`ck-widget_type-around_show-fake-caret_${a}`}this._listenToIfEnabled(r.document,"arrowKey",(a,l)=>{this._handleArrowKeyPress(a,l)},{context:[Be,"$text"],priority:"high"}),this._listenToIfEnabled(n,"change:range",(a,l)=>{l.directChange&&e.model.change(c=>{c.removeSelectionAttribute(Rt)})}),this._listenToIfEnabled(t.document,"change:data",()=>{const a=n.getSelectedElement();a&&pn(e.editing.mapper.toViewElement(a),a,i)||e.model.change(l=>{l.removeSelectionAttribute(Rt)})}),this._listenToIfEnabled(e.editing.downcastDispatcher,"selection",(a,l,c)=>{const d=c.writer;if(this._currentFakeCaretModelElement){const b=c.mapper.toViewElement(this._currentFakeCaretModelElement);b&&(d.removeClass(xm.map(s),b),this._currentFakeCaretModelElement=null)}const u=l.selection.getSelectedElement();if(!u)return;const g=c.mapper.toViewElement(u);if(!pn(g,u,i))return;const f=Wt(l.selection);f&&(d.addClass(s(f),g),this._currentFakeCaretModelElement=u)}),this._listenToIfEnabled(e.ui.focusTracker,"change:isFocused",(a,l,c)=>{c||e.model.change(d=>{d.removeSelectionAttribute(Rt)})})}_handleArrowKeyPress(e,t){const n=this.editor,i=n.model,r=i.document.selection,s=i.schema,a=n.editing.view,l=function(u,g){const f=qr(u,g);return f==="down"||f==="right"}(t.keyCode,n.locale.contentLanguageDirection),c=a.document.selection.getSelectedElement();let d;pn(c,n.editing.mapper.toModelElement(c),s)?d=this._handleArrowKeyPressOnSelectedWidget(l):r.isCollapsed?d=this._handleArrowKeyPressWhenSelectionNextToAWidget(l):t.shiftKey||(d=this._handleArrowKeyPressWhenNonCollapsedSelection(l)),d&&(t.preventDefault(),e.stop())}_handleArrowKeyPressOnSelectedWidget(e){const t=this.editor.model,n=Wt(t.document.selection);return t.change(i=>n?n!==(e?"after":"before")?(i.removeSelectionAttribute(Rt),!0):!1:(i.setSelectionAttribute(Rt,e?"after":"before"),!0))}_handleArrowKeyPressWhenSelectionNextToAWidget(e){const t=this.editor,n=t.model,i=n.schema,r=t.plugins.get("Widget"),s=r._getObjectElementNextToSelection(e);return!!pn(t.editing.mapper.toViewElement(s),s,i)&&(n.change(a=>{r._setSelectionOverElement(s),a.setSelectionAttribute(Rt,e?"before":"after")}),!0)}_handleArrowKeyPressWhenNonCollapsedSelection(e){const t=this.editor,n=t.model,i=n.schema,r=t.editing.mapper,s=n.document.selection,a=e?s.getLastPosition().nodeBefore:s.getFirstPosition().nodeAfter;return!!pn(r.toViewElement(a),a,i)&&(n.change(l=>{l.setSelection(a,"on"),l.setSelectionAttribute(Rt,e?"after":"before")}),!0)}_enableInsertingParagraphsOnButtonClick(){const e=this.editor,t=e.editing.view;this._listenToIfEnabled(t.document,"mousedown",(n,i)=>{const r=i.domTarget.closest(".ck-widget__type-around__button");if(!r)return;const s=function(c){return c.classList.contains("ck-widget__type-around__button_before")?"before":"after"}(r),a=function(c,d){const u=c.closest(".ck-widget");return d.mapDomToView(u)}(r,t.domConverter),l=e.editing.mapper.toModelElement(a);this._insertParagraph(l,s),i.preventDefault(),n.stop()})}_enableInsertingParagraphsOnEnterKeypress(){const e=this.editor,t=e.model.document.selection,n=e.editing.view;this._listenToIfEnabled(n.document,"enter",(i,r)=>{if(i.eventPhase!="atTarget")return;const s=t.getSelectedElement(),a=e.editing.mapper.toViewElement(s),l=e.model.schema;let c;this._insertParagraphAccordingToFakeCaretPosition()?c=!0:pn(a,s,l)&&(this._insertParagraph(s,r.isSoft?"before":"after"),c=!0),c&&(r.preventDefault(),i.stop())},{context:Be})}_enableInsertingParagraphsOnTypingKeystroke(){const e=this.editor.editing.view.document;this._listenToIfEnabled(e,"insertText",(t,n)=>{this._insertParagraphAccordingToFakeCaretPosition()&&(n.selection=e.selection)},{priority:"high"}),k.isAndroid?this._listenToIfEnabled(e,"keydown",(t,n)=>{n.keyCode==229&&this._insertParagraphAccordingToFakeCaretPosition()}):this._listenToIfEnabled(e,"compositionstart",()=>{this._insertParagraphAccordingToFakeCaretPosition()},{priority:"high"})}_enableDeleteIntegration(){const e=this.editor,t=e.editing.view,n=e.model,i=n.schema;this._listenToIfEnabled(t.document,"delete",(r,s)=>{if(r.eventPhase!="atTarget")return;const a=Wt(n.document.selection);if(!a)return;const l=s.direction,c=n.document.selection.getSelectedElement(),d=l=="forward";if(a==="before"===d)e.execute("delete",{selection:n.createSelection(c,"on")});else{const u=i.getNearestSelectionRange(n.createPositionAt(c,a),l);if(u)if(u.isCollapsed){const g=n.createSelection(u.start);if(n.modifySelection(g,{direction:l}),g.focus.isEqual(u.start)){const f=function(b,A){let E=A;for(const P of A.getAncestors({parentFirst:!0})){if(P.childCount>1||b.isLimit(P))break;E=P}return E}(i,u.start.parent);n.deleteContent(n.createSelection(f,"on"),{doNotAutoparagraph:!0})}else n.change(f=>{f.setSelection(u),e.execute(d?"deleteForward":"delete")})}else n.change(g=>{g.setSelection(u),e.execute(d?"deleteForward":"delete")})}s.preventDefault(),r.stop()},{context:Be})}_enableInsertContentIntegration(){const e=this.editor,t=this.editor.model,n=t.document.selection;this._listenToIfEnabled(e.model,"insertContent",(i,[r,s])=>{if(s&&!s.is("documentSelection"))return;const a=Wt(n);return a?(i.stop(),t.change(l=>{const c=n.getSelectedElement(),d=t.createPositionAt(c,a),u=l.createSelection(d),g=t.insertContent(r,u);return l.setSelection(u),g})):void 0},{priority:"high"})}_enableInsertObjectIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"insertObject",(n,i)=>{const[,r,s={}]=i;if(r&&!r.is("documentSelection"))return;const a=Wt(t);a&&(s.findOptimalPosition=a,i[3]=s)},{priority:"high"})}_enableDeleteContentIntegration(){const e=this.editor,t=this.editor.model.document.selection;this._listenToIfEnabled(e.model,"deleteContent",(n,[i])=>{i&&!i.is("documentSelection")||Wt(t)&&n.stop()},{priority:"high"})}}function m2(o){const e=o.model;return(t,n)=>{const i=n.keyCode==se.arrowup,r=n.keyCode==se.arrowdown,s=n.shiftKey,a=e.document.selection;if(!i&&!r)return;const l=r;if(s&&function(d,u){return!d.isCollapsed&&d.isBackward==u}(a,l))return;const c=function(d,u,g){const f=d.model;if(g){const b=u.isCollapsed?u.focus:u.getLastPosition(),A=Dm(f,b,"forward");if(!A)return null;const E=f.createRange(b,A),P=Bm(f.schema,E,"backward");return P?f.createRange(b,P):null}{const b=u.isCollapsed?u.focus:u.getFirstPosition(),A=Dm(f,b,"backward");if(!A)return null;const E=f.createRange(A,b),P=Bm(f.schema,E,"forward");return P?f.createRange(P,b):null}}(o,a,l);if(c){if(c.isCollapsed&&(a.isCollapsed||s))return;(c.isCollapsed||function(d,u,g){const f=d.model,b=d.view.domConverter;if(g){const j=f.createSelection(u.start);f.modifySelection(j),j.focus.isAtEnd||u.start.isEqual(j.focus)||(u=f.createRange(j.focus,u.end))}const A=d.mapper.toViewRange(u),E=b.viewRangeToDom(A),P=De.getDomRangeRects(E);let z;for(const j of P)if(z!==void 0){if(Math.round(j.top)>=z)return!1;z=Math.max(z,Math.round(j.bottom))}else z=Math.round(j.bottom);return!0}(o,c,l))&&(e.change(d=>{const u=l?c.end:c.start;if(s){const g=e.createSelection(a.anchor);g.setFocus(u),d.setSelection(g)}else d.setSelection(u)}),t.stop(),n.preventDefault(),n.stopPropagation())}}}function Dm(o,e,t){const n=o.schema,i=o.createRangeIn(e.root),r=t=="forward"?"elementStart":"elementEnd";for(const{previousPosition:s,item:a,type:l}of i.getWalker({startPosition:e,direction:t})){if(n.isLimit(a)&&!n.isInline(a))return s;if(l==r&&n.isBlock(a))return null}return null}function Bm(o,e,t){const n=t=="backward"?e.end:e.start;if(o.checkChild(n,"$text"))return n;for(const{nextPosition:i}of e.getWalker({direction:t}))if(o.checkChild(i,"$text"))return i;return null}var Tm=D(3488),g2={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Tm.Z,g2),Tm.Z.locals;class Mo extends q{constructor(){super(...arguments),this._previouslySelected=new Set}static get pluginName(){return"Widget"}static get requires(){return[u2,Wn]}init(){const e=this.editor,t=e.editing.view,n=t.document;this.editor.editing.downcastDispatcher.on("selection",(i,r,s)=>{const a=s.writer,l=r.selection;if(l.isCollapsed)return;const c=l.getSelectedElement();if(!c)return;const d=e.editing.mapper.toViewElement(c);var u;Be(d)&&s.consumable.consume(l,"selection")&&a.setSelection(a.createRangeOn(d),{fake:!0,label:(u=d,u.getCustomProperty("widgetLabel").reduce((g,f)=>typeof f=="function"?g?g+". "+f():f():g?g+". "+f:f,""))})}),this.editor.editing.downcastDispatcher.on("selection",(i,r,s)=>{this._clearPreviouslySelectedWidgets(s.writer);const a=s.writer,l=a.document.selection;let c=null;for(const d of l.getRanges())for(const u of d){const g=u.item;Be(g)&&!p2(g,c)&&(a.addClass(vm,g),this._previouslySelected.add(g),c=g)}},{priority:"low"}),t.addObserver(Ns),this.listenTo(n,"mousedown",(...i)=>this._onMousedown(...i)),this.listenTo(n,"arrowKey",(...i)=>{this._handleSelectionChangeOnArrowKeyPress(...i)},{context:[Be,"$text"]}),this.listenTo(n,"arrowKey",(...i)=>{this._preventDefaultOnArrowKeyPress(...i)},{context:"$root"}),this.listenTo(n,"arrowKey",m2(this.editor.editing),{context:"$text"}),this.listenTo(n,"delete",(i,r)=>{this._handleDelete(r.direction=="forward")&&(r.preventDefault(),i.stop())},{context:"$root"})}_onMousedown(e,t){const n=this.editor,i=n.editing.view,r=i.document;let s=t.target;if(function(l){let c=l;for(;c;){if(c.is("editableElement")&&!c.is("rootElement"))return!0;if(Be(c))return!1;c=c.parent}return!1}(s)){if((k.isSafari||k.isGecko)&&t.domEvent.detail>=3){const l=n.editing.mapper,c=s.is("attributeElement")?s.findAncestor(u=>!u.is("attributeElement")):s,d=l.toModelElement(c);t.preventDefault(),this.editor.model.change(u=>{u.setSelection(d,"in")})}return}if(!Be(s)&&(s=s.findAncestor(Be),!s))return;k.isAndroid&&t.preventDefault(),r.isFocused||i.focus();const a=n.editing.mapper.toModelElement(s);this._setSelectionOverElement(a)}_handleSelectionChangeOnArrowKeyPress(e,t){const n=t.keyCode,i=this.editor.model,r=i.schema,s=i.document.selection,a=s.getSelectedElement(),l=qr(n,this.editor.locale.contentLanguageDirection),c=l=="down"||l=="right",d=l=="up"||l=="down";if(a&&r.isObject(a)){const g=c?s.getLastPosition():s.getFirstPosition(),f=r.getNearestSelectionRange(g,c?"forward":"backward");return void(f&&(i.change(b=>{b.setSelection(f)}),t.preventDefault(),e.stop()))}if(!s.isCollapsed&&!t.shiftKey){const g=s.getFirstPosition(),f=s.getLastPosition(),b=g.nodeAfter,A=f.nodeBefore;return void((b&&r.isObject(b)||A&&r.isObject(A))&&(i.change(E=>{E.setSelection(c?f:g)}),t.preventDefault(),e.stop()))}if(!s.isCollapsed)return;const u=this._getObjectElementNextToSelection(c);if(u&&r.isObject(u)){if(r.isInline(u)&&d)return;this._setSelectionOverElement(u),t.preventDefault(),e.stop()}}_preventDefaultOnArrowKeyPress(e,t){const n=this.editor.model,i=n.schema,r=n.document.selection.getSelectedElement();r&&i.isObject(r)&&(t.preventDefault(),e.stop())}_handleDelete(e){const t=this.editor.model.document.selection;if(!this.editor.model.canEditAt(t)||!t.isCollapsed)return;const n=this._getObjectElementNextToSelection(e);return n?(this.editor.model.change(i=>{let r=t.anchor.parent;for(;r.isEmpty;){const s=r;r=s.parent,i.remove(s)}this._setSelectionOverElement(n)}),!0):void 0}_setSelectionOverElement(e){this.editor.model.change(t=>{t.setSelection(t.createRangeOn(e))})}_getObjectElementNextToSelection(e){const t=this.editor.model,n=t.schema,i=t.document.selection,r=t.createSelection(i);if(t.modifySelection(r,{direction:e?"forward":"backward"}),r.isEqual(i))return null;const s=e?r.focus.nodeBefore:r.focus.nodeAfter;return s&&n.isObject(s)?s:null}_clearPreviouslySelectedWidgets(e){for(const t of this._previouslySelected)e.removeClass(vm,t);this._previouslySelected.clear()}}function p2(o,e){return!!e&&Array.from(o.getAncestors()).includes(e)}class qi extends q{constructor(){super(...arguments),this._toolbarDefinitions=new Map}static get requires(){return[Fi]}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",n=>{(function(i){const r=i.getSelectedElement();return!(!r||!Be(r))})(e.editing.view.document.selection)&&n.stop()},{priority:"high"})}this._balloon=this.editor.plugins.get("ContextualBalloon"),this.on("change:isEnabled",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui,"update",()=>{this._updateToolbarsVisibility()}),this.listenTo(e.ui.focusTracker,"change:isFocused",()=>{this._updateToolbarsVisibility()},{priority:"low"})}destroy(){super.destroy();for(const e of this._toolbarDefinitions.values())e.view.destroy()}register(e,{ariaLabel:t,items:n,getRelatedElement:i,balloonClassName:r="ck-toolbar-container"}){if(!n.length)return void Q("widget-toolbar-no-items",{toolbarId:e});const s=this.editor,a=s.t,l=new Ms(s.locale);if(l.ariaLabel=t||a("Widget toolbar"),this._toolbarDefinitions.has(e))throw new I("widget-toolbar-duplicated",this,{toolbarId:e});const c={view:l,getRelatedElement:i,balloonClassName:r,itemsConfig:n,initialized:!1};s.ui.addToolbar(l,{isContextual:!0,beforeFocus:()=>{const d=i(s.editing.view.document.selection);d&&this._showToolbar(c,d)},afterBlur:()=>{this._hideToolbar(c)}}),this._toolbarDefinitions.set(e,c)}_updateToolbarsVisibility(){let e=0,t=null,n=null;for(const i of this._toolbarDefinitions.values()){const r=i.getRelatedElement(this.editor.editing.view.document.selection);if(this.isEnabled&&r)if(this.editor.ui.focusTracker.isFocused){const s=r.getAncestors().length;s>e&&(e=s,t=r,n=i)}else this._isToolbarVisible(i)&&this._hideToolbar(i);else this._isToolbarInBalloon(i)&&this._hideToolbar(i)}n&&this._showToolbar(n,t)}_hideToolbar(e){this._balloon.remove(e.view),this.stopListening(this._balloon,"change:visibleView")}_showToolbar(e,t){this._isToolbarVisible(e)?Im(this.editor,t):this._isToolbarInBalloon(e)||(e.initialized||(e.initialized=!0,e.view.fillFromConfig(e.itemsConfig,this.editor.ui.componentFactory)),this._balloon.add({view:e.view,position:Pm(this.editor,t),balloonClassName:e.balloonClassName}),this.listenTo(this._balloon,"change:visibleView",()=>{for(const n of this._toolbarDefinitions.values())if(this._isToolbarVisible(n)){const i=n.getRelatedElement(this.editor.editing.view.document.selection);Im(this.editor,i)}}))}_isToolbarVisible(e){return this._balloon.visibleView===e.view}_isToolbarInBalloon(e){return this._balloon.hasView(e.view)}}function Im(o,e){const t=o.plugins.get("ContextualBalloon"),n=Pm(o,e);t.updatePosition(n)}function Pm(o,e){const t=o.editing.view,n=Ye.defaultPositions;return{target:t.domConverter.mapViewToDom(e),positions:[n.northArrowSouth,n.northArrowSouthWest,n.northArrowSouthEast,n.southArrowNorth,n.southArrowNorthWest,n.southArrowNorthEast,n.viewportStickyNorth]}}var Rm=D(8506),f2={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Rm.Z,f2),Rm.Z.locals;var Om=D(903),k2={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Om.Z,k2),Om.Z.locals;class b2 extends q{static get pluginName(){return"DragDrop"}static get requires(){return[Pt,Mo]}init(){const e=this.editor,t=e.editing.view;this._draggedRange=null,this._draggingUid="",this._draggableElement=null,this._updateDropMarkerThrottled=Js(n=>this._updateDropMarker(n),40),this._removeDropMarkerDelayed=Ur(()=>this._removeDropMarker(),40),this._clearDraggableAttributesDelayed=Ur(()=>this._clearDraggableAttributes(),40),e.plugins.has("DragDropExperimental")?this.forceDisabled("DragDropExperimental"):(t.addObserver(Xs),t.addObserver(Ns),this._setupDragging(),this._setupContentInsertionIntegration(),this._setupClipboardInputIntegration(),this._setupDropMarker(),this._setupDraggableAttributeHandling(),this.listenTo(e,"change:isReadOnly",(n,i,r)=>{r?this.forceDisabled("readOnlyMode"):this.clearForceDisabled("readOnlyMode")}),this.on("change:isEnabled",(n,i,r)=>{r||this._finalizeDragging(!1)}),k.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,n=t.document,i=e.editing.view,r=i.document;this.listenTo(r,"dragstart",(s,a)=>{const l=n.selection;if(a.target&&a.target.is("editableElement"))return void a.preventDefault();const c=a.target?Mm(a.target):null;if(c){const f=e.editing.mapper.toModelElement(c);this._draggedRange=Dt.fromRange(t.createRangeOn(f)),e.plugins.has("WidgetToolbarRepository")&&e.plugins.get("WidgetToolbarRepository").forceDisabled("dragDrop")}else if(!r.selection.isCollapsed){const f=r.selection.getSelectedElement();f&&Be(f)||(this._draggedRange=Dt.fromRange(l.getFirstRange()))}if(!this._draggedRange)return void a.preventDefault();this._draggingUid=J();const d=this.isEnabled&&e.model.canEditAt(this._draggedRange);a.dataTransfer.effectAllowed=d?"copyMove":"copy",a.dataTransfer.setData("application/ckeditor5-dragging-uid",this._draggingUid);const u=t.createSelection(this._draggedRange.toRange()),g=e.data.toView(t.getSelectedContent(u));r.fire("clipboardOutput",{dataTransfer:a.dataTransfer,content:g,method:"dragstart"}),d||(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid="")},{priority:"low"}),this.listenTo(r,"dragend",(s,a)=>{this._finalizeDragging(!a.dataTransfer.isCanceled&&a.dataTransfer.dropEffect=="move")},{priority:"low"}),this.listenTo(r,"dragenter",()=>{this.isEnabled&&i.focus()}),this.listenTo(r,"dragleave",()=>{this._removeDropMarkerDelayed()}),this.listenTo(r,"dragging",(s,a)=>{if(!this.isEnabled)return void(a.dataTransfer.dropEffect="none");this._removeDropMarkerDelayed.cancel();const l=Nm(e,a.targetRanges,a.target);e.model.canEditAt(l)?(this._draggedRange||(a.dataTransfer.dropEffect="copy"),k.isGecko||(a.dataTransfer.effectAllowed=="copy"?a.dataTransfer.dropEffect="copy":["all","copyMove"].includes(a.dataTransfer.effectAllowed)&&(a.dataTransfer.dropEffect="move")),l&&this._updateDropMarkerThrottled(l)):a.dataTransfer.dropEffect="none"},{priority:"low"})}_setupClipboardInputIntegration(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"clipboardInput",(n,i)=>{if(i.method!="drop")return;const r=Nm(e,i.targetRanges,i.target);if(this._removeDropMarker(),!r||!e.model.canEditAt(r))return this._finalizeDragging(!1),void n.stop();if(this._draggedRange&&this._draggingUid!=i.dataTransfer.getData("application/ckeditor5-dragging-uid")&&(this._draggedRange.detach(),this._draggedRange=null,this._draggingUid=""),zm(i.dataTransfer)=="move"&&this._draggedRange&&this._draggedRange.containsRange(r,!0))return this._finalizeDragging(!1),void n.stop();i.targetRanges=[e.editing.mapper.toViewRange(r)]},{priority:"high"})}_setupContentInsertionIntegration(){const e=this.editor.plugins.get(Pt);e.on("contentInsertion",(t,n)=>{if(!this.isEnabled||n.method!=="drop")return;const i=n.targetRanges.map(r=>this.editor.editing.mapper.toModelRange(r));this.editor.model.change(r=>r.setSelection(i))},{priority:"high"}),e.on("contentInsertion",(t,n)=>{if(!this.isEnabled||n.method!=="drop")return;const i=zm(n.dataTransfer)=="move",r=!n.resultRange||!n.resultRange.isCollapsed;this._finalizeDragging(r&&i)},{priority:"lowest"})}_setupDraggableAttributeHandling(){const e=this.editor,t=e.editing.view,n=t.document;this.listenTo(n,"mousedown",(i,r)=>{if(k.isAndroid||!r)return;this._clearDraggableAttributesDelayed.cancel();let s=Mm(r.target);if(k.isBlink&&!s&&!n.selection.isCollapsed){const a=n.selection.getSelectedElement();if(!a||!Be(a)){const l=n.selection.editableElement;l&&!l.isReadOnly&&(s=l)}}s&&(t.change(a=>{a.setAttribute("draggable","true",s)}),this._draggableElement=e.editing.mapper.toModelElement(s))}),this.listenTo(n,"mouseup",()=>{k.isAndroid||this._clearDraggableAttributesDelayed()})}_clearDraggableAttributes(){const e=this.editor.editing;e.view.change(t=>{this._draggableElement&&this._draggableElement.root.rootName!="$graveyard"&&t.removeAttribute("draggable",e.mapper.toViewElement(this._draggableElement)),this._draggableElement=null})}_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:n})=>{if(e.model.schema.checkChild(t.markerRange.start,"$text"))return n.createUIElement("span",{class:"ck ck-clipboard-drop-target-position"},function(i){const r=this.toDomElement(i);return r.append("",i.createElement("span"),""),r})}})}_updateDropMarker(e){const t=this.editor,n=t.model.markers;t.model.change(i=>{n.has("drop-target")?n.get("drop-target").getRange().isEqual(e)||i.updateMarker("drop-target",{range:e}):i.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(t=>{t.removeMarker("drop-target")})}_finalizeDragging(e){const t=this.editor,n=t.model;this._removeDropMarker(),this._clearDraggableAttributes(),t.plugins.has("WidgetToolbarRepository")&&t.plugins.get("WidgetToolbarRepository").clearForceDisabled("dragDrop"),this._draggingUid="",this._draggedRange&&(e&&this.isEnabled&&n.deleteContent(n.createSelection(this._draggedRange),{doNotAutoparagraph:!0}),this._draggedRange.detach(),this._draggedRange=null)}}function Nm(o,e,t){const n=o.model,i=o.editing.mapper;let r=null;const s=e?e[0].start:null;if(t.is("uiElement")&&(t=t.parent),r=function(c,d){const u=c.model,g=c.editing.mapper;if(Be(d))return u.createRangeOn(g.toModelElement(d));if(!d.is("editableElement")){const f=d.findAncestor(b=>Be(b)||b.is("editableElement"));if(Be(f))return u.createRangeOn(g.toModelElement(f))}return null}(o,t),r)return r;const a=function(c,d){const u=c.editing.mapper,g=c.editing.view,f=u.toModelElement(d);if(f)return f;const b=g.createPositionBefore(d),A=u.findMappedViewAncestor(b);return u.toModelElement(A)}(o,t),l=s?i.toModelPosition(s):null;return l?(r=function(c,d,u){const g=c.model;if(!g.schema.checkChild(u,"$block"))return null;const f=g.createPositionAt(u,0),b=d.path.slice(0,f.path.length),A=g.createPositionFromPath(d.root,b),E=A.nodeAfter;return E&&g.schema.isObject(E)?g.createRangeOn(E):null}(o,l,a),r||(r=n.schema.getNearestSelectionRange(l,k.isGecko?"forward":"backward"),r||function(c,d){const u=c.model;let g=d;for(;g;){if(u.schema.isObject(g))return u.createRangeOn(g);g=g.parent}return null}(o,l.parent))):function(c,d){const u=c.model,g=u.schema,f=u.createPositionAt(d,0);return g.getNearestSelectionRange(f,"forward")}(o,a)}function zm(o){return k.isGecko?o.dropEffect:["all","copyMove"].includes(o.effectAllowed)?"move":"copy"}function Mm(o){if(o.is("editableElement"))return null;if(o.hasClass("ck-widget__selection-handle"))return o.findAncestor(Be);if(Be(o))return o;const e=o.findAncestor(t=>Be(t)||t.is("editableElement"));return Be(e)?e:null}class w2 extends q{static get pluginName(){return"PastePlainText"}static get requires(){return[Pt]}init(){const e=this.editor,t=e.model,n=e.editing.view,i=n.document,r=t.document.selection;let s=!1;n.addObserver(Xs),this.listenTo(i,"keydown",(a,l)=>{s=l.shiftKey}),e.plugins.get(Pt).on("contentInsertion",(a,l)=>{(s||function(c,d){if(c.childCount>1)return!1;const u=c.getChild(0);return d.isObject(u)?!1:Array.from(u.getAttributeKeys()).length==0}(l.content,t.schema))&&t.change(c=>{const d=Array.from(r.getAttributes()).filter(([g])=>t.schema.getAttributeProperties(g).isFormatting);r.isCollapsed||t.deleteContent(r,{doNotAutoparagraph:!0}),d.push(...r.getAttributes());const u=c.createRangeIn(l.content);for(const g of u.getItems())g.is("$textProxy")&&c.setAttributes(d,g)})})}}class A2 extends q{static get pluginName(){return"Clipboard"}static get requires(){return[Pt,b2,w2]}}class _2 extends ne{constructor(e){super(e),this.affectsData=!1}execute(){const e=this.editor.model,t=e.document.selection;let n=e.schema.getLimitElement(t);if(t.containsEntireContent(n)||!Fm(e.schema,n))do if(n=n.parent,!n)return;while(!Fm(e.schema,n));e.change(i=>{i.setSelection(n,"in")})}}function Fm(o,e){return o.isLimit(e)&&(o.checkChild(e,"$text")||o.checkChild(e,"paragraph"))}const C2=li("Ctrl+A");class v2 extends q{static get pluginName(){return"SelectAllEditing"}init(){const e=this.editor,t=e.editing.view.document;e.commands.add("selectAll",new _2(e)),this.listenTo(t,"keydown",(n,i)=>{Nn(i)===C2&&(e.execute("selectAll"),i.preventDefault())})}}class y2 extends q{static get pluginName(){return"SelectAllUI"}init(){const e=this.editor;e.ui.componentFactory.add("selectAll",t=>{const n=e.commands.get("selectAll"),i=new Ae(t),r=t.t;return i.set({label:r("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}),i.bind("isEnabled").to(n,"isEnabled"),this.listenTo(i,"execute",()=>{e.execute("selectAll"),e.editing.view.focus()}),i})}}class E2 extends q{static get requires(){return[v2,y2]}static get pluginName(){return"SelectAll"}}var x2=Object.defineProperty,Vm=Object.getOwnPropertySymbols,S2=Object.prototype.hasOwnProperty,D2=Object.prototype.propertyIsEnumerable,Lm=(o,e,t)=>e in o?x2(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;class jm extends ne{constructor(e){super(e),this._stack=[],this._createdBatches=new WeakSet,this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(e.data,"set",(t,n)=>{n[1]=((r,s)=>{for(var a in s||(s={}))S2.call(s,a)&&Lm(r,a,s[a]);if(Vm)for(var a of Vm(s))D2.call(s,a)&&Lm(r,a,s[a]);return r})({},n[1]);const i=n[1];i.batchType||(i.batchType={isUndoable:!1})},{priority:"high"}),this.listenTo(e.data,"set",(t,n)=>{n[1].batchType.isUndoable||this.clearStack()})}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(e){const t=this.editor.model.document.selection,n={ranges:t.hasOwnRange?Array.from(t.getRanges()):[],isBackward:t.isBackward};this._stack.push({batch:e,selection:n}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(e,t,n){const i=this.editor.model,r=i.document,s=[],a=e.map(c=>c.getTransformedByOperations(n)),l=a.flat();for(const c of a){const d=c.filter(u=>u.root!=r.graveyard).filter(u=>!T2(u,l));d.length&&(B2(d),s.push(d[0]))}s.length&&i.change(c=>{c.setSelection(s,{backward:t})})}_undo(e,t){const n=this.editor.model,i=n.document;this._createdBatches.add(t);const r=e.operations.slice().filter(s=>s.isDocumentOperation);r.reverse();for(const s of r){const a=s.baseVersion+1,l=Array.from(i.history.getOperations(a)),c=e1([s.getReversed()],l,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let d of c){const u=d.affectedSelectable;u&&!n.canEditAt(u)&&(d=new je(d.baseVersion)),t.addOperation(d),n.applyOperation(d),i.history.setOperationAsUndone(s,d)}}}}function B2(o){o.sort((e,t)=>e.start.isBefore(t.start)?-1:1);for(let e=1;e<o.length;e++){const t=o[e-1].getJoined(o[e],!0);t&&(e--,o.splice(e,2,t))}}function T2(o,e){return e.some(t=>t!==o&&t.containsRange(o,!0))}class I2 extends jm{execute(e=null){const t=e?this._stack.findIndex(r=>r.batch==e):this._stack.length-1,n=this._stack.splice(t,1)[0],i=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(i,()=>{this._undo(n.batch,i);const r=this.editor.model.document.history.getOperations(n.batch.baseVersion);this._restoreSelection(n.selection.ranges,n.selection.isBackward,r),this.fire("revert",n.batch,i)}),this.refresh()}}class P2 extends jm{execute(){const e=this._stack.pop(),t=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(t,()=>{const n=e.batch.operations[e.batch.operations.length-1].baseVersion+1,i=this.editor.model.document.history.getOperations(n);this._restoreSelection(e.selection.ranges,e.selection.isBackward,i),this._undo(e.batch,t)}),this.refresh()}}class R2 extends q{constructor(){super(...arguments),this._batchRegistry=new WeakSet}static get pluginName(){return"UndoEditing"}init(){const e=this.editor;this._undoCommand=new I2(e),this._redoCommand=new P2(e),e.commands.add("undo",this._undoCommand),e.commands.add("redo",this._redoCommand),this.listenTo(e.model,"applyOperation",(t,n)=>{const i=n[0];if(!i.isDocumentOperation)return;const r=i.batch,s=this._redoCommand.createdBatches.has(r),a=this._undoCommand.createdBatches.has(r);this._batchRegistry.has(r)||(this._batchRegistry.add(r),r.isUndoable&&(s?this._undoCommand.addBatch(r):a||(this._undoCommand.addBatch(r),this._redoCommand.clearStack())))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(t,n,i)=>{this._redoCommand.addBatch(i)}),e.keystrokes.set("CTRL+Z","undo"),e.keystrokes.set("CTRL+Y","redo"),e.keystrokes.set("CTRL+SHIFT+Z","redo")}}const $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>',Hm='<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 O2 extends q{static get pluginName(){return"UndoUI"}init(){const e=this.editor,t=e.locale,n=e.t,i=t.uiLanguageDirection=="ltr"?$m:Hm,r=t.uiLanguageDirection=="ltr"?Hm:$m;this._addButton("undo",n("Undo"),"CTRL+Z",i),this._addButton("redo",n("Redo"),"CTRL+Y",r)}_addButton(e,t,n,i){const r=this.editor;r.ui.componentFactory.add(e,s=>{const a=r.commands.get(e),l=new Ae(s);return l.set({label:t,icon:i,keystroke:n,tooltip:!0}),l.bind("isEnabled").to(a,"isEnabled"),this.listenTo(l,"execute",()=>{r.execute(e),r.editing.view.focus()}),l})}}class N2 extends q{static get requires(){return[R2,O2]}static get pluginName(){return"Undo"}}class z2 extends ge(){constructor(){super();const e=new window.FileReader;this._reader=e,this._data=void 0,this.set("loaded",0),e.onprogress=t=>{this.loaded=t.loaded}}get error(){return this._reader.error}get data(){return this._data}read(e){const t=this._reader;return this.total=e.size,new Promise((n,i)=>{t.onload=()=>{const r=t.result;this._data=r,n(r)},t.onerror=()=>{i("error")},t.onabort=()=>{i("aborted")},this._reader.readAsDataURL(e)})}abort(){this._reader.abort()}}class Ot extends q{constructor(){super(...arguments),this.loaders=new st,this._loadersMap=new Map,this._pendingAction=null}static get pluginName(){return"FileRepository"}static get requires(){return[Ii]}init(){this.loaders.on("change",()=>this._updatePendingAction()),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(e,t)=>t?e/t*100:0)}getLoader(e){return this._loadersMap.get(e)||null}createLoader(e){if(!this.createUploadAdapter)return Q("filerepository-no-upload-adapter"),null;const t=new qm(Promise.resolve(e),this.createUploadAdapter);return this.loaders.add(t),this._loadersMap.set(e,t),e instanceof Promise&&t.file.then(n=>{this._loadersMap.set(n,t)}).catch(()=>{}),t.on("change:uploaded",()=>{let n=0;for(const i of this.loaders)n+=i.uploaded;this.uploaded=n}),t.on("change:uploadTotal",()=>{let n=0;for(const i of this.loaders)i.uploadTotal&&(n+=i.uploadTotal);this.uploadTotal=n}),t}destroyLoader(e){const t=e instanceof qm?e:this.getLoader(e);t._destroy(),this.loaders.remove(t),this._loadersMap.forEach((n,i)=>{n===t&&this._loadersMap.delete(i)})}_updatePendingAction(){const e=this.editor.plugins.get(Ii);if(this.loaders.length){if(!this._pendingAction){const t=this.editor.t,n=i=>`${t("Upload in progress")} ${parseInt(i)}%.`;this._pendingAction=e.add(n(this.uploadedPercent)),this._pendingAction.bind("message").to(this,"uploadedPercent",n)}}else e.remove(this._pendingAction),this._pendingAction=null}}class qm extends ge(){constructor(e,t){super(),this.id=J(),this._filePromiseWrapper=this._createFilePromiseWrapper(e),this._adapter=t(this),this._reader=new z2,this.set("status","idle"),this.set("uploaded",0),this.set("uploadTotal",null),this.bind("uploadedPercent").to(this,"uploaded",this,"uploadTotal",(n,i)=>i?n/i*100:0),this.set("uploadResponse",null)}get file(){return this._filePromiseWrapper?this._filePromiseWrapper.promise.then(e=>this._filePromiseWrapper?e:null):Promise.resolve(null)}get data(){return this._reader.data}read(){if(this.status!="idle")throw new I("filerepository-read-wrong-status",this);return this.status="reading",this.file.then(e=>this._reader.read(e)).then(e=>{if(this.status!=="reading")throw this.status;return this.status="idle",e}).catch(e=>{throw e==="aborted"?(this.status="aborted","aborted"):(this.status="error",this._reader.error?this._reader.error:e)})}upload(){if(this.status!="idle")throw new I("filerepository-upload-wrong-status",this);return this.status="uploading",this.file.then(()=>this._adapter.upload()).then(e=>(this.uploadResponse=e,this.status="idle",e)).catch(e=>{throw this.status==="aborted"?"aborted":(this.status="error",e)})}abort(){const e=this.status;this.status="aborted",this._filePromiseWrapper.isFulfilled?e=="reading"?this._reader.abort():e=="uploading"&&this._adapter.abort&&this._adapter.abort():(this._filePromiseWrapper.promise.catch(()=>{}),this._filePromiseWrapper.rejecter("aborted")),this._destroy()}_destroy(){this._filePromiseWrapper=void 0,this._reader=void 0,this._adapter=void 0,this.uploadResponse=void 0}_createFilePromiseWrapper(e){const t={};return t.promise=new Promise((n,i)=>{t.rejecter=i,t.isFulfilled=!1,e.then(r=>{t.isFulfilled=!0,n(r)}).catch(r=>{t.isFulfilled=!0,i(r)})}),t}}class M2 extends re{constructor(e){super(e),this.buttonView=new Ae(e),this._fileInputView=new F2(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 F2 extends re{constructor(e){super(e),this.set("acceptedType",void 0),this.set("allowMultipleFiles",!1);const t=this.bindTemplate;this.setTemplate({tag:"input",attributes:{class:["ck-hidden"],type:"file",tabindex:"-1",accept:t.to("acceptedType"),multiple:t.to("allowMultipleFiles")},on:{change:t.to(()=>{this.element&&this.element.files&&this.element.files.length&&this.fire("done",this.element.files),this.element.value=""})}})}open(){this.element.click()}}const Um="ckCsrfToken",Wm="abcdefghijklmnopqrstuvwxyz0123456789";function V2(){let o=function(n){n=n.toLowerCase();const i=document.cookie.split(";");for(const r of i){const s=r.split("=");if(decodeURIComponent(s[0].trim().toLowerCase())===n)return decodeURIComponent(s[1])}return null}(Um);var e,t;return o&&o.length==40||(o=function(n){let i="";const r=new Uint8Array(n);window.crypto.getRandomValues(r);for(let s=0;s<r.length;s++){const a=Wm.charAt(r[s]%Wm.length);i+=Math.random()>.5?a.toUpperCase():a}return i}(40),e=Um,t=o,document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(t)+";path=/"),o}class L2{constructor(e,t,n){this.loader=e,this.url=t,this.t=n}upload(){return this.loader.file.then(e=>new Promise((t,n)=>{this._initRequest(),this._initListeners(t,n,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,n){const i=this.xhr,r=this.loader,s=(0,this.t)("Cannot upload file:")+` ${n.name}.`;i.addEventListener("error",()=>t(s)),i.addEventListener("abort",()=>t()),i.addEventListener("load",()=>{const a=i.response;if(!a||!a.uploaded)return t(a&&a.error&&a.error.message?a.error.message:s);e({default:a.url})}),i.upload&&i.upload.addEventListener("progress",a=>{a.lengthComputable&&(r.uploadTotal=a.total,r.uploaded=a.loaded)})}_sendRequest(e){const t=new FormData;t.append("upload",e),t.append("ckCsrfToken",V2()),this.xhr.send(t)}}class ra extends ne{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,n=t.document.selection,i=e.forceValue===void 0?!this.value:e.forceValue;t.change(r=>{if(n.isCollapsed)i?r.setSelectionAttribute(this.attributeKey,!0):r.removeSelectionAttribute(this.attributeKey);else{const s=t.schema.getValidRanges(n.getRanges(),this.attributeKey);for(const a of s)i?r.setAttribute(this.attributeKey,i,a):r.removeAttribute(this.attributeKey,a)}})}_getValueFromFirstAllowedNode(){const e=this.editor.model,t=e.schema,n=e.document.selection;if(n.isCollapsed)return n.hasAttribute(this.attributeKey);for(const i of n.getRanges())for(const r of i.getItems())if(t.checkAttribute(r,this.attributeKey))return r.hasAttribute(this.attributeKey);return!1}}const Zn="bold";class j2 extends q{static get pluginName(){return"BoldEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Zn}),e.model.schema.setAttributeProperties(Zn,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Zn,view:"strong",upcastAlso:["b",t=>{const n=t.getStyle("font-weight");return n&&(n=="bold"||Number(n)>=600)?{name:!0,styles:["font-weight"]}:null}]}),e.commands.add(Zn,new ra(e,Zn)),e.keystrokes.set("CTRL+B",Zn)}}const sa="bold";class $2 extends q{static get pluginName(){return"BoldUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(sa,n=>{const i=e.commands.get(sa),r=new Ae(n);return r.set({label:t("Bold"),icon:ve.bold,keystroke:"CTRL+B",tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(r,"execute",()=>{e.execute(sa),e.editing.view.focus()}),r})}}var Km=D(8603),H2={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Km.Z,H2),Km.Z.locals;const Jn="italic";class q2 extends q{static get pluginName(){return"ItalicEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Jn}),e.model.schema.setAttributeProperties(Jn,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Jn,view:"i",upcastAlso:["em",{styles:{"font-style":"italic"}}]}),e.commands.add(Jn,new ra(e,Jn)),e.keystrokes.set("CTRL+I",Jn)}}const aa="italic";class U2 extends q{static get pluginName(){return"ItalicUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(aa,n=>{const i=e.commands.get(aa),r=new Ae(n);return r.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}),r.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(r,"execute",()=>{e.execute(aa),e.editing.view.focus()}),r})}}const Fo="underline";class W2 extends q{static get pluginName(){return"UnderlineEditing"}init(){const e=this.editor;e.model.schema.extend("$text",{allowAttributes:Fo}),e.model.schema.setAttributeProperties(Fo,{isFormatting:!0,copyOnEnter:!0}),e.conversion.attributeToElement({model:Fo,view:"u",upcastAlso:{styles:{"text-decoration":"underline"}}}),e.commands.add(Fo,new ra(e,Fo)),e.keystrokes.set("CTRL+U","underline")}}const la="underline";class K2 extends q{static get pluginName(){return"UnderlineUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(la,n=>{const i=e.commands.get(la),r=new Ae(n);return r.set({label:t("Underline"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M3 18v-1.5h14V18zm2.2-8V3.6c0-.4.4-.6.8-.6.3 0 .7.2.7.6v6.2c0 2 1.3 2.8 3.2 2.8 1.9 0 3.4-.9 3.4-2.9V3.6c0-.3.4-.5.8-.5.3 0 .7.2.7.5V10c0 2.7-2.2 4-4.9 4-2.6 0-4.7-1.2-4.7-4z"/></svg>',keystroke:"CTRL+U",tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(r,"execute",()=>{e.execute(la),e.editing.view.focus()}),r})}}class G2 extends ne{refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,n=t.schema,i=t.document.selection,r=Array.from(i.getSelectedBlocks()),s=e.forceValue===void 0?!this.value:e.forceValue;t.change(a=>{if(s){const l=r.filter(c=>Ui(c)||Zm(n,c));this._applyQuote(a,l)}else this._removeQuote(a,r.filter(Ui))})}_getValue(){const e=ze(this.editor.model.document.selection.getSelectedBlocks());return!(!e||!Ui(e))}_checkEnabled(){if(this.value)return!0;const e=this.editor.model.document.selection,t=this.editor.model.schema,n=ze(e.getSelectedBlocks());return!!n&&Zm(t,n)}_removeQuote(e,t){Gm(e,t).reverse().forEach(n=>{if(n.start.isAtStart&&n.end.isAtEnd)return void e.unwrap(n.start.parent);if(n.start.isAtStart){const r=e.createPositionBefore(n.start.parent);return void e.move(n,r)}n.end.isAtEnd||e.split(n.end);const i=e.createPositionAfter(n.end.parent);e.move(n,i)})}_applyQuote(e,t){const n=[];Gm(e,t).reverse().forEach(i=>{let r=Ui(i.start);r||(r=e.createElement("blockQuote"),e.wrap(i,r)),n.push(r)}),n.reverse().reduce((i,r)=>i.nextSibling==r?(e.merge(e.createPositionAfter(i)),i):r)}}function Ui(o){return o.parent.name=="blockQuote"?o.parent:null}function Gm(o,e){let t,n=0;const i=[];for(;n<e.length;){const r=e[n],s=e[n+1];t||(t=o.createPositionBefore(r)),s&&r.nextSibling==s||(i.push(o.createRange(t,o.createPositionAfter(r))),t=null),n++}return i}function Zm(o,e){const t=o.checkChild(e.parent,"blockQuote"),n=o.checkChild(["$root","blockQuote"],e);return t&&n}class Z2 extends q{static get pluginName(){return"BlockQuoteEditing"}static get requires(){return[zo,Wn]}init(){const e=this.editor,t=e.model.schema;e.commands.add("blockQuote",new G2(e)),t.register("blockQuote",{inheritAllFrom:"$container"}),e.conversion.elementToElement({model:"blockQuote",view:"blockquote"}),e.model.document.registerPostFixer(s=>{const a=e.model.document.differ.getChanges();for(const l of a)if(l.type=="insert"){const c=l.position.nodeAfter;if(!c)continue;if(c.is("element","blockQuote")&&c.isEmpty)return s.remove(c),!0;if(c.is("element","blockQuote")&&!t.checkChild(l.position,c))return s.unwrap(c),!0;if(c.is("element")){const d=s.createRangeIn(c);for(const u of d.getItems())if(u.is("element","blockQuote")&&!t.checkChild(s.createPositionBefore(u),u))return s.unwrap(u),!0}}else if(l.type=="remove"){const c=l.position.parent;if(c.is("element","blockQuote")&&c.isEmpty)return s.remove(c),!0}return!1});const n=this.editor.editing.view.document,i=e.model.document.selection,r=e.commands.get("blockQuote");this.listenTo(n,"enter",(s,a)=>{!i.isCollapsed||!r.value||i.getLastPosition().parent.isEmpty&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),a.preventDefault(),s.stop())},{context:"blockquote"}),this.listenTo(n,"delete",(s,a)=>{if(a.direction!="backward"||!i.isCollapsed||!r.value)return;const l=i.getLastPosition().parent;l.isEmpty&&!l.previousSibling&&(e.execute("blockQuote"),e.editing.view.scrollToTheSelection(),a.preventDefault(),s.stop())},{context:"blockquote"})}}var Jm=D(3062),J2={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Jm.Z,J2),Jm.Z.locals;class Y2 extends q{static get pluginName(){return"BlockQuoteUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add("blockQuote",n=>{const i=e.commands.get("blockQuote"),r=new Ae(n);return r.set({label:t("Block quote"),icon:ve.quote,tooltip:!0,isToggleable:!0}),r.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(r,"execute",()=>{e.execute("blockQuote"),e.editing.view.focus()}),r})}}class Q2 extends q{static get pluginName(){return"CloudServicesUploadAdapter"}static get requires(){return["CloudServices",Ot]}init(){const e=this.editor,t=e.plugins.get("CloudServices"),n=t.token,i=t.uploadUrl;if(!n)return;const r=e.plugins.get("CloudServicesCore");this._uploadGateway=r.createUploadGateway(n,i),e.plugins.get(Ot).createUploadAdapter=s=>new X2(this._uploadGateway,s)}}class X2{constructor(e,t){this.uploadGateway=e,this.loader=t}upload(){return this.loader.file.then(e=>(this.fileUploader=this.uploadGateway.upload(e),this.fileUploader.on("progress",(t,n)=>{this.loader.uploadTotal=n.total,this.loader.uploaded=n.uploaded}),this.fileUploader.send()))}abort(){this.fileUploader.abort()}}class ex extends ne{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}refresh(){const e=this.editor.model,t=ze(e.document.selection.getSelectedBlocks());this.value=!!t&&t.is("element","paragraph"),this.isEnabled=!!t&&Ym(t,e.schema)}execute(e={}){const t=this.editor.model,n=t.document,i=e.selection||n.selection;t.canEditAt(i)&&t.change(r=>{const s=i.getSelectedBlocks();for(const a of s)!a.is("element","paragraph")&&Ym(a,t.schema)&&r.rename(a,"paragraph")})}}function Ym(o,e){return e.checkChild(o.parent,"paragraph")&&!e.isObject(o)}class tx extends ne{constructor(e){super(e),this._isEnabledBasedOnSelection=!1}execute(e){const t=this.editor.model,n=e.attributes;let i=e.position;t.canEditAt(i)&&t.change(r=>{const s=r.createElement("paragraph");if(n&&t.schema.setAllowedAttributes(s,n,r),!t.schema.checkChild(i.parent,s)){const a=t.schema.findAllowedParent(i,s);if(!a)return;i=r.split(i,a).position}t.insertContent(s,i),r.setSelection(s,"in")})}}const Qm=class extends q{static get pluginName(){return"Paragraph"}init(){const o=this.editor,e=o.model;o.commands.add("paragraph",new ex(o)),o.commands.add("insertParagraph",new tx(o)),e.schema.register("paragraph",{inheritAllFrom:"$block"}),o.conversion.elementToElement({model:"paragraph",view:"p"}),o.conversion.for("upcast").elementToElement({model:(t,{writer:n})=>Qm.paragraphLikeElements.has(t.name)?t.isEmpty?null:n.createElement("paragraph"):null,view:/.+/,converterPriority:"low"})}};let ca=Qm;ca.paragraphLikeElements=new Set(["blockquote","dd","div","dt","h1","h2","h3","h4","h5","h6","li","p","td","th"]);class nx extends ne{constructor(e,t){super(e),this.modelElements=t}refresh(){const e=ze(this.editor.model.document.selection.getSelectedBlocks());this.value=!!e&&this.modelElements.includes(e.name)&&e.name,this.isEnabled=!!e&&this.modelElements.some(t=>Xm(e,t,this.editor.model.schema))}execute(e){const t=this.editor.model,n=t.document,i=e.value;t.change(r=>{const s=Array.from(n.selection.getSelectedBlocks()).filter(a=>Xm(a,i,t.schema));for(const a of s)a.is("element",i)||r.rename(a,i)})}}function Xm(o,e,t){return t.checkChild(o.parent,e)&&!t.isObject(o)}const eg="paragraph";class ox extends q{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[ca]}init(){const e=this.editor,t=e.config.get("heading.options"),n=[];for(const i of t)i.model!=="paragraph"&&(e.model.schema.register(i.model,{inheritAllFrom:"$block"}),e.conversion.elementToElement(i),n.push(i.model));this._addDefaultH1Conversion(e),e.commands.add("heading",new nx(e,n))}afterInit(){const e=this.editor,t=e.commands.get("enter"),n=e.config.get("heading.options");t&&this.listenTo(t,"afterExecute",(i,r)=>{const s=e.model.document.selection.getFirstPosition().parent;n.some(a=>s.is("element",a.model))&&!s.is("element",eg)&&s.childCount===0&&r.writer.rename(s,eg)})}_addDefaultH1Conversion(e){e.conversion.for("upcast").elementToElement({model:"heading1",view:"h1",converterPriority:te.get("low")+1})}}var tg=D(8733),ix={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(tg.Z,ix),tg.Z.locals;class rx extends q{static get pluginName(){return"HeadingUI"}init(){const e=this.editor,t=e.t,n=function(s){const a=s.t,l={Paragraph:a("Paragraph"),"Heading 1":a("Heading 1"),"Heading 2":a("Heading 2"),"Heading 3":a("Heading 3"),"Heading 4":a("Heading 4"),"Heading 5":a("Heading 5"),"Heading 6":a("Heading 6")};return s.config.get("heading.options").map(c=>{const d=l[c.title];return d&&d!=c.title&&(c.title=d),c})}(e),i=t("Choose heading"),r=t("Heading");e.ui.componentFactory.add("heading",s=>{const a={},l=new st,c=e.commands.get("heading"),d=e.commands.get("paragraph"),u=[c];for(const f of n){const b={type:"button",model:new Ys({label:f.title,class:f.class,role:"menuitemradio",withText:!0})};f.model==="paragraph"?(b.model.bind("isOn").to(d,"value"),b.model.set("commandName","paragraph"),u.push(d)):(b.model.bind("isOn").to(c,"value",A=>A===f.model),b.model.set({commandName:"heading",commandValue:f.model})),l.add(b),a[f.model]=f.title}const g=It(s);return Vs(g,l,{ariaLabel:r,role:"menu"}),g.buttonView.set({ariaLabel:r,ariaLabelledBy:void 0,isOn:!1,withText:!0,tooltip:r}),g.extendTemplate({attributes:{class:["ck-heading-dropdown"]}}),g.bind("isEnabled").toMany(u,"isEnabled",(...f)=>f.some(b=>b)),g.buttonView.bind("label").to(c,"value",d,"value",(f,b)=>{const A=f||b&&"paragraph";return typeof A=="boolean"?i:a[A]?a[A]:i}),this.listenTo(g,"execute",f=>{const{commandName:b,commandValue:A}=f.source;e.execute(b,A?{value:A}:void 0),e.editing.view.focus()}),g})}}function ng(o){return o.createContainerElement("figure",{class:"image"},[o.createEmptyElement("img"),o.createSlot("children")])}function og(o,e){const t=o.plugins.get("ImageUtils"),n=o.plugins.has("ImageInlineEditing")&&o.plugins.has("ImageBlockEditing");return r=>t.isInlineImageView(r)?n&&(r.getStyle("display")=="block"||r.findAncestor(t.isBlockImageView)?"imageBlock":"imageInline")!==e?null:i(r):null;function i(r){const s={name:!0};return r.hasAttribute("src")&&(s.attributes=["src"]),s}}function da(o,e){const t=ze(e.getSelectedBlocks());return!t||o.isObject(t)||t.isEmpty&&t.name!="listItem"?"imageBlock":"imageInline"}var sx=Object.defineProperty,ig=Object.getOwnPropertySymbols,ax=Object.prototype.hasOwnProperty,lx=Object.prototype.propertyIsEnumerable,rg=(o,e,t)=>e in o?sx(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,sg=(o,e)=>{for(var t in e||(e={}))ax.call(e,t)&&rg(o,t,e[t]);if(ig)for(var t of ig(e))lx.call(e,t)&&rg(o,t,e[t]);return o};class Nt extends q{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,n=null){const i=this.editor,r=i.model,s=r.document.selection;n=ag(i,t||s,n),e=sg(sg({},Object.fromEntries(s.getAttributes())),e);for(const a in e)r.schema.checkAttribute(n,a)||delete e[a];return r.change(a=>{const l=a.createElement(n,e);return r.insertObject(l,t,null,{setSelection:"on",findOptimalPosition:t||n=="imageInline"?void 0:"auto"}),l.parent?l:null})}getClosestSelectedImageWidget(e){const t=e.getFirstPosition();if(!t)return null;const n=e.getSelectedElement();if(n&&this.isImageWidget(n))return n;let i=t.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(t,n){if(ag(t,n,null)=="imageBlock"){const r=function(s,a){const l=function(d,u){const g=d.getSelectedElement();if(g){const f=Wt(d);if(f)return u.createRange(u.createPositionAt(g,f))}return du(d,u)}(s,a),c=l.start.parent;return c.isEmpty&&!c.is("element","$root")?c.parent:c}(n,t.model);if(t.model.schema.checkChild(r,"imageBlock"))return!0}else if(t.model.schema.checkChild(n.focus,"imageInline"))return!0;return!1}(this.editor,e)&&function(t){return[...t.focus.getAncestors()].every(n=>!n.is("element","imageBlock"))}(e)}toImageWidget(e,t,n){return t.setCustomProperty("image",!0,e),ia(e,t,{label:()=>{const i=this.findViewImgElement(e).getAttribute("alt");return i?`${i} ${n}`:n}})}isImageWidget(e){return!!e.getCustomProperty("image")&&Be(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:n}of t.createRangeIn(e))if(this.isInlineImageView(n))return n}}function ag(o,e,t){const n=o.model.schema,i=o.config.get("image.insert.type");return o.plugins.has("ImageBlockEditing")?o.plugins.has("ImageInlineEditing")?t||(i==="inline"?"imageInline":i==="block"?"imageBlock":e.is("selection")?da(n,e):n.checkChild(e,"imageInline")?"imageInline":"imageBlock"):"imageBlock":"imageInline"}class cx extends ne{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,n=t.plugins.get("ImageUtils"),i=t.model,r=n.getClosestSelectedImageElement(i.document.selection);i.change(s=>{s.setAttribute("alt",e.newValue,r)})}}class dx extends q{static get requires(){return[Nt]}static get pluginName(){return"ImageTextAlternativeEditing"}init(){this.editor.commands.add("imageTextAlternative",new cx(this.editor))}}var lg=D(1905),hx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(lg.Z,hx),lg.Z.locals;var cg=D(6764),ux={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(cg.Z,ux),cg.Z.locals;class mx extends re{constructor(e){super(e);const t=this.locale.t;this.focusTracker=new dt,this.keystrokes=new xt,this.labeledInput=this._createLabeledInputView(),this.saveButtonView=this._createButton(t("Save"),ve.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(t("Cancel"),ve.cancel,"ck-button-cancel","cancel"),this._focusables=new on,this._focusCycler=new bo({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}}),this.setTemplate({tag:"form",attributes:{class:["ck","ck-text-alternative-form","ck-responsive-form"],tabindex:"-1"},children:[this.labeledInput,this.saveButtonView,this.cancelButtonView]})}render(){super.render(),this.keystrokes.listenTo(this.element),p({view:this}),[this.labeledInput,this.saveButtonView,this.cancelButtonView].forEach(e=>{this._focusables.add(e),this.focusTracker.add(e.element)})}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}_createButton(e,t,n,i){const r=new Ae(this.locale);return r.set({label:e,icon:t,tooltip:!0}),r.extendTemplate({attributes:{class:n}}),i&&r.delegate("execute").to(this,i),r}_createLabeledInputView(){const e=this.locale.t,t=new Xc(this.locale,_u);return t.label=e("Text alternative"),t}}function dg(o){const e=o.editing.view,t=Ye.defaultPositions,n=o.plugins.get("ImageUtils");return{target:e.domConverter.mapViewToDom(n.getClosestSelectedImageWidget(e.document.selection)),positions:[t.northArrowSouth,t.northArrowSouthWest,t.northArrowSouthEast,t.southArrowNorth,t.southArrowNorthWest,t.southArrowNorthEast,t.viewportStickyNorth]}}class gx extends q{static get requires(){return[Fi]}static get pluginName(){return"ImageTextAlternativeUI"}init(){this._createButton()}destroy(){super.destroy(),this._form&&this._form.destroy()}_createButton(){const e=this.editor,t=e.t;e.ui.componentFactory.add("imageTextAlternative",n=>{const i=e.commands.get("imageTextAlternative"),r=new Ae(n);return r.set({label:t("Change image text alternative"),icon:ve.lowVision,tooltip:!0}),r.bind("isEnabled").to(i,"isEnabled"),r.bind("isOn").to(i,"value",s=>!!s),this.listenTo(r,"execute",()=>{this._showForm()}),r})}_createForm(){const e=this.editor,t=e.editing.view.document,n=e.plugins.get("ImageUtils");this._balloon=this.editor.plugins.get("ContextualBalloon"),this._form=new(S(mx))(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",(i,r)=>{this._hideForm(!0),r()}),this.listenTo(e.ui,"update",()=>{n.getClosestSelectedImageWidget(t.selection)?this._isVisible&&function(i){const r=i.plugins.get("ContextualBalloon");if(i.plugins.get("ImageUtils").getClosestSelectedImageWidget(i.editing.view.document.selection)){const s=dg(i);r.updatePosition(s)}}(e):this._hideForm(!0)}),w({emitter:this._form,activator:()=>this._isVisible,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideForm()})}_showForm(){if(this._isVisible)return;this._form||this._createForm();const e=this.editor,t=e.commands.get("imageTextAlternative"),n=this._form.labeledInput;this._form.disableCssTransitions(),this._isInBalloon||this._balloon.add({view:this._form,position:dg(e)}),n.fieldView.value=n.fieldView.element.value=t.value||"",this._form.labeledInput.fieldView.select(),this._form.enableCssTransitions()}_hideForm(e=!1){this._isInBalloon&&(this._form.focusTracker.isFocused&&this._form.saveButtonView.focus(),this._balloon.remove(this._form),e&&this.editor.editing.view.focus())}get _isVisible(){return!!this._balloon&&this._balloon.visibleView===this._form}get _isInBalloon(){return!!this._balloon&&this._balloon.hasView(this._form)}}class hg extends q{static get requires(){return[dx,gx]}static get pluginName(){return"ImageTextAlternative"}}function ug(o,e){const t=(n,i,r)=>{if(!r.consumable.consume(i.item,n.name))return;const s=r.writer,a=r.mapper.toViewElement(i.item),l=o.findViewImgElement(a);if(i.attributeNewValue===null){const c=i.attributeOldValue;c&&c.data&&(s.removeAttribute("srcset",l),s.removeAttribute("sizes",l),c.width&&s.removeAttribute("width",l))}else{const c=i.attributeNewValue;c&&c.data&&(s.setAttribute("srcset",c.data,l),s.setAttribute("sizes","100vw",l),c.width&&s.setAttribute("width",c.width,l))}};return n=>{n.on(`attribute:srcset:${e}`,t)}}function Wi(o,e,t){const n=(i,r,s)=>{if(!s.consumable.consume(r.item,i.name))return;const a=s.writer,l=s.mapper.toViewElement(r.item),c=o.findViewImgElement(l);a.setAttribute(r.attributeKey,r.attributeNewValue||"",c)};return i=>{i.on(`attribute:${t}:${e}`,n)}}class px extends _t{observe(e){this.listenTo(e,"load",(t,n)=>{const i=n.target;this.checkShouldIgnoreEventFromTarget(i)||i.tagName=="IMG"&&this._fireEvents(n)},{useCapture:!0})}stopObserving(e){this.stopListening(e)}_fireEvents(e){this.isEnabled&&(this.document.fire("layoutChanged"),this.document.fire("imageLoaded",e))}}var fx=Object.defineProperty,mg=Object.getOwnPropertySymbols,kx=Object.prototype.hasOwnProperty,bx=Object.prototype.propertyIsEnumerable,gg=(o,e,t)=>e in o?fx(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Ki=(o,e)=>{for(var t in e||(e={}))kx.call(e,t)&&gg(o,t,e[t]);if(mg)for(var t of mg(e))bx.call(e,t)&&gg(o,t,e[t]);return o};class wx extends ne{constructor(e){super(e);const t=e.config.get("image.insert.type");e.plugins.has("ImageBlockEditing")||t==="block"&&Q("image-block-plugin-required"),e.plugins.has("ImageInlineEditing")||t==="inline"&&Q("image-inline-plugin-required")}refresh(){const e=this.editor.plugins.get("ImageUtils");this.isEnabled=e.isImageAllowed()}execute(e){const t=Pe(e.source),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),r=Object.fromEntries(n.getAttributes());t.forEach((s,a)=>{const l=n.getSelectedElement();if(typeof s=="string"&&(s={src:s}),a&&l&&i.isImage(l)){const c=this.editor.model.createPositionAfter(l);i.insertImage(Ki(Ki({},s),r),c)}else i.insertImage(Ki(Ki({},s),r))})}}class Ax extends ne{refresh(){const e=this.editor.plugins.get("ImageUtils"),t=this.editor.model.document.selection.getSelectedElement();this.isEnabled=e.isImage(t),this.value=this.isEnabled?t.getAttribute("src"):null}execute(e){const t=this.editor.model.document.selection.getSelectedElement();this.editor.model.change(n=>{n.setAttribute("src",e.source,t),n.removeAttribute("srcset",t),n.removeAttribute("sizes",t)})}}class pg extends q{static get requires(){return[Nt]}static get pluginName(){return"ImageEditing"}init(){const e=this.editor,t=e.conversion;e.editing.view.addObserver(px),t.for("upcast").attributeToAttribute({view:{name:"img",key:"alt"},model:"alt"}).attributeToAttribute({view:{name:"img",key:"srcset"},model:{key:"srcset",value:r=>{const s={data:r.getAttribute("srcset")};return r.hasAttribute("width")&&(s.width=r.getAttribute("width")),s}}});const n=new wx(e),i=new Ax(e);e.commands.add("insertImage",n),e.commands.add("replaceImageSource",i),e.commands.add("imageInsert",n)}}class fg extends ne{constructor(e,t){super(e),this._modelElementName=t}refresh(){const e=this.editor.plugins.get("ImageUtils"),t=e.getClosestSelectedImageElement(this.editor.model.document.selection);this._modelElementName==="imageBlock"?this.isEnabled=e.isInlineImage(t):this.isEnabled=e.isBlockImage(t)}execute(){const e=this.editor,t=this.editor.model,n=e.plugins.get("ImageUtils"),i=n.getClosestSelectedImageElement(t.document.selection),r=Object.fromEntries(i.getAttributes());return r.src||r.uploadId?t.change(s=>{const a=Array.from(t.markers).filter(d=>d.getRange().containsItem(i)),l=n.insertImage(r,t.createSelection(i,"on"),this._modelElementName);if(!l)return null;const c=s.createRangeOn(l);for(const d of a){const u=d.getRange(),g=u.root.rootName!="$graveyard"?u.getJoined(c,!0):c;s.updateMarker(d,{range:g})}return{oldElement:i,newElement:l}}):null}}class _x extends q{static get requires(){return[pg,Nt,Pt]}static get pluginName(){return"ImageBlockEditing"}init(){const e=this.editor;e.model.schema.register("imageBlock",{inheritAllFrom:"$blockObject",allowAttributes:["alt","src","srcset"]}),this._setupConversion(),e.plugins.has("ImageInlineEditing")&&(e.commands.add("imageTypeBlock",new fg(this.editor,"imageBlock")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,n=e.conversion,i=e.plugins.get("ImageUtils");n.for("dataDowncast").elementToStructure({model:"imageBlock",view:(r,{writer:s})=>ng(s)}),n.for("editingDowncast").elementToStructure({model:"imageBlock",view:(r,{writer:s})=>i.toImageWidget(ng(s),s,t("image widget"))}),n.for("downcast").add(Wi(i,"imageBlock","src")).add(Wi(i,"imageBlock","alt")).add(ug(i,"imageBlock")),n.for("upcast").elementToElement({view:og(e,"imageBlock"),model:(r,{writer:s})=>s.createElement("imageBlock",r.hasAttribute("src")?{src:r.getAttribute("src")}:void 0)}).add(function(r){const s=(a,l,c)=>{if(!c.consumable.test(l.viewItem,{name:!0,classes:"image"}))return;const d=r.findViewImgElement(l.viewItem);if(!d||!c.consumable.test(d,{name:!0}))return;c.consumable.consume(l.viewItem,{name:!0,classes:"image"});const u=ze(c.convertItem(d,l.modelCursor).modelRange.getItems());u?(c.convertChildren(l.viewItem,u),c.updateConversionResult(u,l)):c.consumable.revert(l.viewItem,{name:!0,classes:"image"})};return a=>{a.on("element:figure",s)}}(i))}_setupClipboardIntegration(){const e=this.editor,t=e.model,n=e.editing.view,i=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline");this.listenTo(r,"inputTransformation",(s,a)=>{const l=Array.from(a.content.getChildren());let c;if(!l.every(i.isInlineImageView))return;c=a.targetRanges?e.editing.mapper.toModelRange(a.targetRanges[0]):t.document.selection.getFirstRange();const d=t.createSelection(c);if(da(t.schema,d)==="imageBlock"){const u=new Bi(n.document),g=l.map(f=>u.createElement("figure",{class:"image"},f));a.content=u.createDocumentFragment(g)}})}}var kg=D(3508),Cx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(kg.Z,Cx),kg.Z.locals;class vx extends q{static get requires(){return[_x,Mo,hg]}static get pluginName(){return"ImageBlock"}}class yx extends q{static get requires(){return[pg,Nt,Pt]}static get pluginName(){return"ImageInlineEditing"}init(){const e=this.editor,t=e.model.schema;t.register("imageInline",{inheritAllFrom:"$inlineObject",allowAttributes:["alt","src","srcset"]}),t.addChildCheck((n,i)=>{if(n.endsWith("caption")&&i.name==="imageInline")return!1}),this._setupConversion(),e.plugins.has("ImageBlockEditing")&&(e.commands.add("imageTypeInline",new fg(this.editor,"imageInline")),this._setupClipboardIntegration())}_setupConversion(){const e=this.editor,t=e.t,n=e.conversion,i=e.plugins.get("ImageUtils");n.for("dataDowncast").elementToElement({model:"imageInline",view:(r,{writer:s})=>s.createEmptyElement("img")}),n.for("editingDowncast").elementToStructure({model:"imageInline",view:(r,{writer:s})=>i.toImageWidget(function(a){return a.createContainerElement("span",{class:"image-inline"},a.createEmptyElement("img"))}(s),s,t("image widget"))}),n.for("downcast").add(Wi(i,"imageInline","src")).add(Wi(i,"imageInline","alt")).add(ug(i,"imageInline")),n.for("upcast").elementToElement({view:og(e,"imageInline"),model:(r,{writer:s})=>s.createElement("imageInline",r.hasAttribute("src")?{src:r.getAttribute("src")}:void 0)})}_setupClipboardIntegration(){const e=this.editor,t=e.model,n=e.editing.view,i=e.plugins.get("ImageUtils"),r=e.plugins.get("ClipboardPipeline");this.listenTo(r,"inputTransformation",(s,a)=>{const l=Array.from(a.content.getChildren());let c;if(!l.every(i.isBlockImageView))return;c=a.targetRanges?e.editing.mapper.toModelRange(a.targetRanges[0]):t.document.selection.getFirstRange();const d=t.createSelection(c);if(da(t.schema,d)==="imageInline"){const u=new Bi(n.document),g=l.map(f=>f.childCount===1?(Array.from(f.getAttributes()).forEach(b=>u.setAttribute(...b,i.findViewImgElement(f))),f.getChild(0)):f);a.content=u.createDocumentFragment(g)}})}}class Ex extends q{static get requires(){return[yx,Mo,hg]}static get pluginName(){return"ImageInline"}}var bg=D(2640),xx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(bg.Z,xx),bg.Z.locals;function wg(o){const e=o.map(t=>t.replace("+","\\+"));return new RegExp(`^image\\/(${e.join("|")})$`)}function Sx(o){return new Promise((e,t)=>{const n=o.getAttribute("src");fetch(n).then(i=>i.blob()).then(i=>{const r=Ag(i,n),s=r.replace("image/",""),a=new File([i],`image.${s}`,{type:r});e(a)}).catch(i=>i&&i.name==="TypeError"?function(r){return function(s){return new Promise((a,l)=>{const c=oe.document.createElement("img");c.addEventListener("load",()=>{const d=oe.document.createElement("canvas");d.width=c.width,d.height=c.height,d.getContext("2d").drawImage(c,0,0),d.toBlob(u=>u?a(u):l())}),c.addEventListener("error",()=>l()),c.src=s})}(r).then(s=>{const a=Ag(s,r),l=a.replace("image/","");return new File([s],`image.${l}`,{type:a})})}(n).then(e).catch(t):t(i))})}function Ag(o,e){return o.type?o.type:e.match(/data:(image\/\w+);base64/)?e.match(/data:(image\/\w+);base64/)[1].toLowerCase():"image/jpeg"}class Dx extends q{static get pluginName(){return"ImageUploadUI"}init(){const e=this.editor,t=e.t,n=i=>{const r=new M2(i),s=e.commands.get("uploadImage"),a=e.config.get("image.upload.types"),l=wg(a);return r.set({acceptedType:a.map(c=>`image/${c}`).join(","),allowMultipleFiles:!0}),r.buttonView.set({label:t("Insert image"),icon:ve.image,tooltip:!0}),r.buttonView.bind("isEnabled").to(s),r.on("done",(c,d)=>{const u=Array.from(d).filter(g=>l.test(g.type));u.length&&(e.execute("uploadImage",{file:u}),e.editing.view.focus())}),r};e.ui.componentFactory.add("uploadImage",n),e.ui.componentFactory.add("imageUpload",n)}}var _g=D(3689),Bx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(_g.Z,Bx),_g.Z.locals;var Cg=D(4036),Tx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Cg.Z,Tx),Cg.Z.locals;var vg=D(3773),Ix={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(vg.Z,Ix),vg.Z.locals;class Px extends q{constructor(e){super(e),this.uploadStatusChange=(t,n,i)=>{const r=this.editor,s=n.item,a=s.getAttribute("uploadId");if(!i.consumable.consume(n.item,t.name))return;const l=r.plugins.get("ImageUtils"),c=r.plugins.get(Ot),d=a?n.attributeNewValue:null,u=this.placeholder,g=r.editing.mapper.toViewElement(s),f=i.writer;if(d=="reading")return yg(g,f),void Eg(l,u,g,f);if(d=="uploading"){const b=c.loaders.get(a);return yg(g,f),void(b?(xg(g,f),function(A,E,P,z){const j=function(Y){const ie=Y.createUIElement("div",{class:"ck-progress-bar"});return Y.setCustomProperty("progressBar",!0,ie),ie}(E);E.insert(E.createPositionAt(A,"end"),j),P.on("change:uploadedPercent",(Y,ie,Ee)=>{z.change(he=>{he.setStyle("width",Ee+"%",j)})})}(g,f,b,r.editing.view),function(A,E,P,z){if(z.data){const j=A.findViewImgElement(E);P.setAttribute("src",z.data,j)}}(l,g,f,b)):Eg(l,u,g,f))}d=="complete"&&c.loaders.get(a)&&function(b,A,E){const P=A.createUIElement("div",{class:"ck-image-upload-complete-icon"});A.insert(A.createPositionAt(b,"end"),P),setTimeout(()=>{E.change(z=>z.remove(z.createRangeOn(P)))},3e3)}(g,f,r.editing.view),function(b,A){Dg(b,A,"progressBar")}(g,f),xg(g,f),function(b,A){A.removeClass("ck-appear",b)}(g,f)},this.placeholder="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="}static get pluginName(){return"ImageUploadProgress"}init(){const e=this.editor;e.plugins.has("ImageBlockEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageBlock",this.uploadStatusChange),e.plugins.has("ImageInlineEditing")&&e.editing.downcastDispatcher.on("attribute:uploadStatus:imageInline",this.uploadStatusChange)}}function yg(o,e){o.hasClass("ck-appear")||e.addClass("ck-appear",o)}function Eg(o,e,t,n){t.hasClass("ck-image-upload-placeholder")||n.addClass("ck-image-upload-placeholder",t);const i=o.findViewImgElement(t);i.getAttribute("src")!==e&&n.setAttribute("src",e,i),Sg(t,"placeholder")||n.insert(n.createPositionAfter(i),function(r){const s=r.createUIElement("div",{class:"ck-upload-placeholder-loader"});return r.setCustomProperty("placeholder",!0,s),s}(n))}function xg(o,e){o.hasClass("ck-image-upload-placeholder")&&e.removeClass("ck-image-upload-placeholder",o),Dg(o,e,"placeholder")}function Sg(o,e){for(const t of o.getChildren())if(t.getCustomProperty(e))return t}function Dg(o,e,t){const n=Sg(o,t);n&&e.remove(e.createRangeOn(n))}var Rx=Object.defineProperty,Ox=Object.defineProperties,Nx=Object.getOwnPropertyDescriptors,Bg=Object.getOwnPropertySymbols,zx=Object.prototype.hasOwnProperty,Mx=Object.prototype.propertyIsEnumerable,Tg=(o,e,t)=>e in o?Rx(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;class Fx extends ne{refresh(){const e=this.editor,t=e.plugins.get("ImageUtils"),n=e.model.document.selection.getSelectedElement();this.isEnabled=t.isImageAllowed()||t.isImage(n)}execute(e){const t=Pe(e.file),n=this.editor.model.document.selection,i=this.editor.plugins.get("ImageUtils"),r=Object.fromEntries(n.getAttributes());t.forEach((s,a)=>{const l=n.getSelectedElement();if(a&&l&&i.isImage(l)){const c=this.editor.model.createPositionAfter(l);this._uploadImage(s,r,c)}else this._uploadImage(s,r)})}_uploadImage(e,t,n){const i=this.editor,r=i.plugins.get(Ot).createLoader(e),s=i.plugins.get("ImageUtils");var a,l;r&&s.insertImage((a=((c,d)=>{for(var u in d||(d={}))zx.call(d,u)&&Tg(c,u,d[u]);if(Bg)for(var u of Bg(d))Mx.call(d,u)&&Tg(c,u,d[u]);return c})({},t),l={uploadId:r.id},Ox(a,Nx(l))),n)}}class Vx extends q{constructor(e){super(e),e.config.define("image",{upload:{types:["jpeg","png","gif","bmp","webp","tiff"]}}),this._uploadImageElements=new Map}static get requires(){return[Ot,Ku,Pt,Nt]}static get pluginName(){return"ImageUploadEditing"}init(){const e=this.editor,t=e.model.document,n=e.conversion,i=e.plugins.get(Ot),r=e.plugins.get("ImageUtils"),s=e.plugins.get("ClipboardPipeline"),a=wg(e.config.get("image.upload.types")),l=new Fx(e);e.commands.add("uploadImage",l),e.commands.add("imageUpload",l),n.for("upcast").attributeToAttribute({view:{name:"img",key:"uploadId"},model:"uploadId"}),this.listenTo(e.editing.view.document,"clipboardInput",(c,d)=>{if(u=d.dataTransfer,Array.from(u.types).includes("text/html")&&u.getData("text/html")!=="")return;var u;const g=Array.from(d.dataTransfer.files).filter(f=>!!f&&a.test(f.type));g.length&&(c.stop(),e.model.change(f=>{d.targetRanges&&f.setSelection(d.targetRanges.map(b=>e.editing.mapper.toModelRange(b))),e.model.enqueueChange(()=>{e.execute("uploadImage",{file:g})})}))}),this.listenTo(s,"inputTransformation",(c,d)=>{const u=Array.from(e.editing.view.createRangeIn(d.content)).map(f=>f.item).filter(f=>function(b,A){return!(!b.isInlineImageView(A)||!A.getAttribute("src")||!A.getAttribute("src").match(/^data:image\/\w+;base64,/g)&&!A.getAttribute("src").match(/^blob:/g))}(r,f)&&!f.getAttribute("uploadProcessed")).map(f=>({promise:Sx(f),imageElement:f}));if(!u.length)return;const g=new Bi(e.editing.view.document);for(const f of u){g.setAttribute("uploadProcessed",!0,f.imageElement);const b=i.createLoader(f.promise);b&&(g.setAttribute("src","",f.imageElement),g.setAttribute("uploadId",b.id,f.imageElement))}}),e.editing.view.document.on("dragover",(c,d)=>{d.preventDefault()}),t.on("change",()=>{const c=t.differ.getChanges({includeChangesInGraveyard:!0}).reverse(),d=new Set;for(const u of c)if(u.type=="insert"&&u.name!="$text"){const g=u.position.nodeAfter,f=u.position.root.rootName=="$graveyard";for(const b of Lx(e,g)){const A=b.getAttribute("uploadId");if(!A)continue;const E=i.loaders.get(A);E&&(f?d.has(A)||E.abort():(d.add(A),this._uploadImageElements.set(A,b),E.status=="idle"&&this._readAndUpload(E)))}}}),this.on("uploadComplete",(c,{imageElement:d,data:u})=>{const g=u.urls?u.urls:u;this.editor.model.change(f=>{f.setAttribute("src",g.default,d),this._parseAndSetSrcsetAttributeOnImage(g,d,f)})},{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,n=t.model,i=t.locale.t,r=t.plugins.get(Ot),s=t.plugins.get(Ku),a=t.plugins.get("ImageUtils"),l=this._uploadImageElements;return n.enqueueChange({isUndoable:!1},d=>{d.setAttribute("uploadStatus","reading",l.get(e.id))}),e.read().then(()=>{const d=e.upload(),u=l.get(e.id);if(k.isSafari){const g=t.editing.mapper.toViewElement(u),f=a.findViewImgElement(g);t.editing.view.once("render",()=>{if(!f.parent)return;const b=t.editing.view.domConverter.mapViewToDom(f.parent);if(!b)return;const A=b.style.display;b.style.display="none",b._ckHack=b.offsetHeight,b.style.display=A})}return n.enqueueChange({isUndoable:!1},g=>{g.setAttribute("uploadStatus","uploading",u)}),d}).then(d=>{n.enqueueChange({isUndoable:!1},u=>{const g=l.get(e.id);u.setAttribute("uploadStatus","complete",g),this.fire("uploadComplete",{data:d,imageElement:g})}),c()}).catch(d=>{if(e.status!=="error"&&e.status!=="aborted")throw d;e.status=="error"&&d&&s.showWarning(d,{title:i("Upload failed"),namespace:"upload"}),n.enqueueChange({isUndoable:!1},u=>{u.remove(l.get(e.id))}),c()});function c(){n.enqueueChange({isUndoable:!1},d=>{const u=l.get(e.id);d.removeAttribute("uploadId",u),d.removeAttribute("uploadStatus",u),l.delete(e.id)}),r.destroyLoader(e)}}_parseAndSetSrcsetAttributeOnImage(e,t,n){let i=0;const r=Object.keys(e).filter(s=>{const a=parseInt(s,10);if(!isNaN(a))return i=Math.max(i,a),!0}).map(s=>`${e[s]} ${s}w`).join(", ");r!=""&&n.setAttribute("srcset",{data:r,width:i},t)}}function Lx(o,e){const t=o.plugins.get("ImageUtils");return Array.from(o.model.createRangeOn(e)).filter(n=>t.isImage(n.item)).map(n=>n.item)}var Ig=D(1568),jx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Ig.Z,jx),Ig.Z.locals;var Pg=D(3535),$x={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Pg.Z,$x),Pg.Z.locals;class Hx extends ne{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,n=t.model,i=t.plugins.get("ImageUtils").getClosestSelectedImageElement(n.document.selection);this.value={width:e.width,height:null},i&&n.change(r=>{r.setAttribute("width",e.width,i)})}}class qx extends q{static get requires(){return[Nt]}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 Hx(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(n=>n.on(`attribute:width:${e}`,(i,r,s)=>{if(!s.consumable.consume(r.item,i.name))return;const a=s.writer,l=s.mapper.toViewElement(r.item);r.attributeNewValue!==null?(a.setStyle("width",r.attributeNewValue,l),a.addClass("image_resized",l)):(a.removeStyle("width",l),a.removeClass("image_resized",l))})),t.conversion.for("upcast").attributeToAttribute({view:{name:e==="imageBlock"?"figure":"img",styles:{width:/.+/}},model:{key:"width",value:n=>n.getStyle("width")}})}}const ha={small:ve.objectSizeSmall,medium:ve.objectSizeMedium,large:ve.objectSizeLarge,original:ve.objectSizeFull};function Rg(o){return e=>o===null&&e===o||e!==null&&e.width===o}var Og=D(6270),Ux={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Og.Z,Ux),Og.Z.locals;class Wx extends ne{constructor(e,t){super(e),this._defaultStyles={imageBlock:!1,imageInline:!1},this._styles=new Map(t.map(n=>{if(n.isDefault)for(const i of n.modelElements)this._defaultStyles[i]=n.name;return[n.name,n]}))}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,n=t.model,i=t.plugins.get("ImageUtils");n.change(r=>{const s=e.value;let a=i.getClosestSelectedImageElement(n.document.selection);s&&this.shouldConvertImageType(s,a)&&(this.editor.execute(i.isBlockImage(a)?"imageTypeInline":"imageTypeBlock"),a=i.getClosestSelectedImageElement(n.document.selection)),!s||this._styles.get(s).isDefault?r.removeAttribute("imageStyle",a):r.setAttribute("imageStyle",s,a)})}shouldConvertImageType(e,t){return!this._styles.get(e).modelElements.includes(t.name)}}var Kx=Object.defineProperty,Ng=Object.getOwnPropertySymbols,Gx=Object.prototype.hasOwnProperty,Zx=Object.prototype.propertyIsEnumerable,zg=(o,e,t)=>e in o?Kx(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Mg=(o,e)=>{for(var t in e||(e={}))Gx.call(e,t)&&zg(o,t,e[t]);if(Ng)for(var t of Ng(e))Zx.call(e,t)&&zg(o,t,e[t]);return o};const{objectFullWidth:Jx,objectInline:Fg,objectLeft:Vg,objectRight:ua,objectCenter:ma,objectBlockLeft:Lg,objectBlockRight:jg}=ve,Gi={get inline(){return{name:"inline",title:"In line",icon:Fg,modelElements:["imageInline"],isDefault:!0}},get alignLeft(){return{name:"alignLeft",title:"Left aligned image",icon:Vg,modelElements:["imageBlock","imageInline"],className:"image-style-align-left"}},get alignBlockLeft(){return{name:"alignBlockLeft",title:"Left aligned image",icon:Lg,modelElements:["imageBlock"],className:"image-style-block-align-left"}},get alignCenter(){return{name:"alignCenter",title:"Centered image",icon:ma,modelElements:["imageBlock"],className:"image-style-align-center"}},get alignRight(){return{name:"alignRight",title:"Right aligned image",icon:ua,modelElements:["imageBlock","imageInline"],className:"image-style-align-right"}},get alignBlockRight(){return{name:"alignBlockRight",title:"Right aligned image",icon:jg,modelElements:["imageBlock"],className:"image-style-block-align-right"}},get block(){return{name:"block",title:"Centered image",icon:ma,modelElements:["imageBlock"],isDefault:!0}},get side(){return{name:"side",title:"Side image",icon:ua,modelElements:["imageBlock"],className:"image-style-side"}}},$g={full:Jx,left:Lg,right:jg,center:ma,inlineLeft:Vg,inlineRight:ua,inline:Fg},Hg=[{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 qg(o){Q("image-style-configuration-definition-invalid",o)}const ga={normalizeStyles:function(o){return(o.configuredStyles.options||[]).map(e=>function(t){return t=typeof t=="string"?Gi[t]?Mg({},Gi[t]):{name:t}:function(n,i){const r=Mg({},i);for(const s in n)Object.prototype.hasOwnProperty.call(i,s)||(r[s]=n[s]);return r}(Gi[t.name],t),typeof t.icon=="string"&&(t.icon=$g[t.icon]||t.icon),t}(e)).filter(e=>function(t,{isBlockPluginLoaded:n,isInlinePluginLoaded:i}){const{modelElements:r,name:s}=t;if(!(r&&r.length&&s))return qg({style:t}),!1;{const a=[n?"imageBlock":null,i?"imageInline":null];if(!r.some(l=>a.includes(l)))return Q("image-style-missing-dependency",{style:t,missingPlugins:r.map(l=>l==="imageBlock"?"ImageBlockEditing":"ImageInlineEditing")}),!1}return!0}(e,o))},getDefaultStylesConfiguration:function(o,e){return o&&e?{options:["inline","alignLeft","alignRight","alignCenter","alignBlockLeft","alignBlockRight","block","side"]}:o?{options:["block","side"]}:e?{options:["inline","alignLeft","alignRight"]}:{}},getDefaultDropdownDefinitions:function(o){return o.has("ImageBlockEditing")&&o.has("ImageInlineEditing")?[...Hg]:[]},warnInvalidStyle:qg,DEFAULT_OPTIONS:Gi,DEFAULT_ICONS:$g,DEFAULT_DROPDOWN_DEFINITIONS:Hg};function Ug(o,e){for(const t of e)if(t.name===o)return t}class Wg extends q{static get pluginName(){return"ImageStyleEditing"}static get requires(){return[Nt]}init(){const{normalizeStyles:e,getDefaultStylesConfiguration:t}=ga,n=this.editor,i=n.plugins.has("ImageBlockEditing"),r=n.plugins.has("ImageInlineEditing");n.config.define("image.styles",t(i,r)),this.normalizedStyles=e({configuredStyles:n.config.get("image.styles"),isBlockPluginLoaded:i,isInlinePluginLoaded:r}),this._setupConversion(i,r),this._setupPostFixer(),n.commands.add("imageStyle",new Wx(n,this.normalizedStyles))}_setupConversion(e,t){const n=this.editor,i=n.model.schema,r=(s=this.normalizedStyles,(l,c,d)=>{if(!d.consumable.consume(c.item,l.name))return;const u=Ug(c.attributeNewValue,s),g=Ug(c.attributeOldValue,s),f=d.mapper.toViewElement(c.item),b=d.writer;g&&b.removeClass(g.className,f),u&&b.addClass(u.className,f)});var s;const a=function(l){const c={imageInline:l.filter(d=>!d.isDefault&&d.modelElements.includes("imageInline")),imageBlock:l.filter(d=>!d.isDefault&&d.modelElements.includes("imageBlock"))};return(d,u,g)=>{if(!u.modelRange)return;const f=u.viewItem,b=ze(u.modelRange.getItems());if(b&&g.schema.checkAttribute(b,"imageStyle"))for(const A of c[b.name])g.consumable.consume(f,{classes:A.className})&&g.writer.setAttribute("imageStyle",A.name,b)}}(this.normalizedStyles);n.editing.downcastDispatcher.on("attribute:imageStyle",r),n.data.downcastDispatcher.on("attribute:imageStyle",r),e&&(i.extend("imageBlock",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:figure",a,{priority:"low"})),t&&(i.extend("imageInline",{allowAttributes:"imageStyle"}),n.data.upcastDispatcher.on("element:img",a,{priority:"low"}))}_setupPostFixer(){const e=this.editor,t=e.model.document,n=e.plugins.get(Nt),i=new Map(this.normalizedStyles.map(r=>[r.name,r]));t.registerPostFixer(r=>{let s=!1;for(const a of t.differ.getChanges())if(a.type=="insert"||a.type=="attribute"&&a.attributeKey=="imageStyle"){let l=a.type=="insert"?a.position.nodeAfter:a.range.start.nodeAfter;if(l&&l.is("element","paragraph")&&l.childCount>0&&(l=l.getChild(0)),!n.isImage(l))continue;const c=l.getAttribute("imageStyle");if(!c)continue;const d=i.get(c);d&&d.modelElements.includes(l.name)||(r.removeAttribute("imageStyle",l),s=!0)}return s})}}var Kg=D(5083),Yx={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Kg.Z,Yx),Kg.Z.locals;class Qx extends q{static get requires(){return[Wg]}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")||[],n=Gg(e.get("ImageStyleEditing").normalizedStyles,this.localizedDefaultStylesTitles);for(const r of n)this._createButton(r);const i=Gg([...t.filter(xe),...ga.getDefaultDropdownDefinitions(e)],this.localizedDefaultStylesTitles);for(const r of i)this._createDropdown(r,n)}_createDropdown(e,t){const n=this.editor.ui.componentFactory;n.add(e.name,i=>{let r;const{defaultItem:s,items:a,title:l}=e,c=a.filter(f=>t.find(({name:b})=>Zg(b)===f)).map(f=>{const b=n.create(f);return f===s&&(r=b),b});a.length!==c.length&&ga.warnInvalidStyle({dropdown:e});const d=It(i,Fs),u=d.buttonView,g=u.arrowView;return Pi(d,c,{enableActiveItemFocusOnDropdownOpen:!0}),u.set({label:Jg(l,r.label),class:null,tooltip:!0}),g.unbind("label"),g.set({label:l}),u.bind("icon").toMany(c,"isOn",(...f)=>{const b=f.findIndex(an);return b<0?r.icon:c[b].icon}),u.bind("label").toMany(c,"isOn",(...f)=>{const b=f.findIndex(an);return Jg(l,b<0?r.label:c[b].label)}),u.bind("isOn").toMany(c,"isOn",(...f)=>f.some(an)),u.bind("class").toMany(c,"isOn",(...f)=>f.some(an)?"ck-splitbutton_flatten":void 0),u.on("execute",()=>{c.some(({isOn:f})=>f)?d.isOpen=!d.isOpen:r.fire("execute")}),d.bind("isEnabled").toMany(c,"isEnabled",(...f)=>f.some(an)),this.listenTo(d,"execute",()=>{this.editor.editing.view.focus()}),d})}_createButton(e){const t=e.name;this.editor.ui.componentFactory.add(Zg(t),n=>{const i=this.editor.commands.get("imageStyle"),r=new Ae(n);return r.set({label:e.title,icon:e.icon,tooltip:!0,isToggleable:!0}),r.bind("isEnabled").to(i,"isEnabled"),r.bind("isOn").to(i,"value",s=>s===t),r.on("execute",this._executeCommand.bind(this,t)),r})}_executeCommand(e){this.editor.execute("imageStyle",{value:e}),this.editor.editing.view.focus()}}function Gg(o,e){for(const t of o)e[t.title]&&(t.title=e[t.title]);return o}function Zg(o){return`imageStyle:${o}`}function Jg(o,e){return(o?o+": ":"")+e}class Xx extends q{static get pluginName(){return"IndentEditing"}init(){const e=this.editor;e.commands.add("indent",new ld(e)),e.commands.add("outdent",new ld(e))}}const Yg='<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>',Qg='<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 e5 extends q{static get pluginName(){return"IndentUI"}init(){const e=this.editor,t=e.locale,n=e.t,i=t.uiLanguageDirection=="ltr"?Yg:Qg,r=t.uiLanguageDirection=="ltr"?Qg:Yg;this._defineButton("indent",n("Increase indent"),i),this._defineButton("outdent",n("Decrease indent"),r)}_defineButton(e,t,n){const i=this.editor;i.ui.componentFactory.add(e,r=>{const s=i.commands.get(e),a=new Ae(r);return a.set({label:t,icon:n,tooltip:!0}),a.bind("isEnabled").to(s,"isEnabled"),this.listenTo(a,"execute",()=>{i.execute(e),i.editing.view.focus()}),a})}}class Zi extends ne{constructor(e,t){super(e),this._indentBehavior=t}refresh(){const e=this.editor.model,t=ze(e.document.selection.getSelectedBlocks());t&&e.schema.checkAttribute(t,"blockIndent")?this.isEnabled=this._indentBehavior.checkEnabled(t.getAttribute("blockIndent")):this.isEnabled=!1}execute(){const e=this.editor.model,t=function(n){const i=n.document.selection,r=n.schema;return Array.from(i.getSelectedBlocks()).filter(s=>r.checkAttribute(s,"blockIndent"))}(e);e.change(n=>{for(const i of t){const r=i.getAttribute("blockIndent"),s=this._indentBehavior.getNextIndent(r);s?n.setAttribute("blockIndent",s,i):n.removeAttribute("blockIndent",i)}})}}class Xg{constructor(e){this.isForward=e.direction==="forward",this.offset=e.offset,this.unit=e.unit}checkEnabled(e){const t=parseFloat(e||"0");return this.isForward||t>0}getNextIndent(e){const t=parseFloat(e||"0");if(!(!e||e.endsWith(this.unit)))return this.isForward?this.offset+this.unit:void 0;const n=t+(this.isForward?this.offset:-this.offset);return n>0?n+this.unit:void 0}}class ep{constructor(e){this.isForward=e.direction==="forward",this.classes=e.classes}checkEnabled(e){const t=this.classes.indexOf(e);return this.isForward?t<this.classes.length-1:t>=0}getNextIndent(e){const t=this.classes.indexOf(e),n=this.isForward?1:-1;return this.classes[t+n]}}const t5=["paragraph","heading1","heading2","heading3","heading4","heading5","heading6"];class n5{constructor(){this._definitions=new Set}get length(){return this._definitions.size}add(e){Array.isArray(e)?e.forEach(t=>this._definitions.add(t)):this._definitions.add(e)}getDispatcher(){return e=>{e.on("attribute:linkHref",(t,n,i)=>{if(!i.consumable.test(n.item,"attribute:linkHref")||!n.item.is("selection")&&!i.schema.isInline(n.item))return;const r=i.writer,s=r.document.selection;for(const a of this._definitions){const l=r.createAttributeElement("a",a.attributes,{priority:5});a.classes&&r.addClass(a.classes,l);for(const c in a.styles)r.setStyle(c,a.styles[c],l);r.setCustomProperty("link",!0,l),a.callback(n.attributeNewValue)?n.item.is("selection")?r.wrap(s.getFirstRange(),l):r.wrap(i.mapper.toViewRange(n.range),l):r.unwrap(i.mapper.toViewRange(n.range),l)}},{priority:"high"})}}getDispatcherForLinkedImage(){return e=>{e.on("attribute:linkHref:imageBlock",(t,n,{writer:i,mapper:r})=>{const s=r.toViewElement(n.item),a=Array.from(s.getChildren()).find(l=>l.is("element","a"));for(const l of this._definitions){const c=St(l.attributes);if(l.callback(n.attributeNewValue)){for(const[d,u]of c)d==="class"?i.addClass(u,a):i.setAttribute(d,u,a);l.classes&&i.addClass(l.classes,a);for(const d in l.styles)i.setStyle(d,l.styles[d],a)}else{for(const[d,u]of c)d==="class"?i.removeClass(u,a):i.removeAttribute(d,a);l.classes&&i.removeClass(l.classes,a);for(const d in l.styles)i.removeStyle(d,a)}}})}}}const o5=function(o,e,t){var n=o.length;return t=t===void 0?n:t,!e&&t>=n?o:bd(o,e,t)};var i5=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");const tp=function(o){return i5.test(o)},r5=function(o){return o.split("")};var np="\\ud800-\\udfff",s5="["+np+"]",pa="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",fa="\\ud83c[\\udffb-\\udfff]",op="[^"+np+"]",ip="(?:\\ud83c[\\udde6-\\uddff]){2}",rp="[\\ud800-\\udbff][\\udc00-\\udfff]",sp="(?:"+pa+"|"+fa+")?",ap="[\\ufe0e\\ufe0f]?",a5=ap+sp+("(?:\\u200d(?:"+[op,ip,rp].join("|")+")"+ap+sp+")*"),l5="(?:"+[op+pa+"?",pa,ip,rp,s5].join("|")+")",c5=RegExp(fa+"(?="+fa+")|"+l5+a5,"g");const d5=function(o){return o.match(c5)||[]},h5=function(o){return tp(o)?d5(o):r5(o)},u5=function(o){return function(e){e=ns(e);var t=tp(e)?h5(e):void 0,n=t?t[0]:e.charAt(0),i=t?o5(t,1).join(""):e.slice(1);return n[o]()+i}}("toUpperCase"),m5=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,g5=/^(?:(?:https?|ftps?|mailto):|[^a-z]|[a-z+.-]+(?:[^a-z+.:-]|$))/i,p5=/^[\S]+@((?![-_])(?:[-\w\u00a1-\uffff]{0,63}[^-_]\.))+(?:[a-z\u00a1-\uffff]{2,})$/i,f5=/^((\w+:(\/{2,})?)|(\W))/i,ka="Ctrl+K";function lp(o,{writer:e}){const t=e.createAttributeElement("a",{href:o},{priority:5});return e.setCustomProperty("link",!0,t),t}function cp(o){const e=String(o);return function(t){return!!t.replace(m5,"").match(g5)}(e)?e:"#"}function ba(o,e){return!!o&&e.checkAttribute(o.name,"linkHref")}function wa(o,e){const t=(n=o,p5.test(n)?"mailto:":e);var n;const i=!!t&&!dp(o);return o&&i?t+o:o}function dp(o){return f5.test(o)}function hp(o){window.open(o,"_blank","noopener")}class k5 extends ne{constructor(){super(...arguments),this.manualDecorators=new st,this.automaticDecorators=new n5}restoreManualDecoratorStates(){for(const e of this.manualDecorators)e.value=this._getDecoratorStateFromModel(e.id)}refresh(){const e=this.editor.model,t=e.document.selection,n=t.getSelectedElement()||ze(t.getSelectedBlocks());ba(n,e.schema)?(this.value=n.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttribute(n,"linkHref")):(this.value=t.getAttribute("linkHref"),this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref"));for(const i of this.manualDecorators)i.value=this._getDecoratorStateFromModel(i.id)}execute(e,t={}){const n=this.editor.model,i=n.document.selection,r=[],s=[];for(const a in t)t[a]?r.push(a):s.push(a);n.change(a=>{if(i.isCollapsed){const l=i.getFirstPosition();if(i.hasAttribute("linkHref")){const c=up(i);let d=Gn(l,"linkHref",i.getAttribute("linkHref"),n);i.getAttribute("linkHref")===c&&(d=this._updateLinkContent(n,a,d,e)),a.setAttribute("linkHref",e,d),r.forEach(u=>{a.setAttribute(u,!0,d)}),s.forEach(u=>{a.removeAttribute(u,d)}),a.setSelection(a.createPositionAfter(d.end.nodeBefore))}else if(e!==""){const c=St(i.getAttributes());c.set("linkHref",e),r.forEach(u=>{c.set(u,!0)});const{end:d}=n.insertContent(a.createText(e,c),l);a.setSelection(d)}["linkHref",...r,...s].forEach(c=>{a.removeSelectionAttribute(c)})}else{const l=n.schema.getValidRanges(i.getRanges(),"linkHref"),c=[];for(const u of i.getSelectedBlocks())n.schema.checkAttribute(u,"linkHref")&&c.push(a.createRangeOn(u));const d=c.slice();for(const u of l)this._isRangeToUpdate(u,c)&&d.push(u);for(const u of d){let g=u;if(d.length===1){const f=up(i);i.getAttribute("linkHref")===f&&(g=this._updateLinkContent(n,a,u,e),a.setSelection(a.createSelection(g)))}a.setAttribute("linkHref",e,g),r.forEach(f=>{a.setAttribute(f,!0,g)}),s.forEach(f=>{a.removeAttribute(f,g)})}}})}_getDecoratorStateFromModel(e){const t=this.editor.model,n=t.document.selection,i=n.getSelectedElement();return ba(i,t.schema)?i.getAttribute(e):n.getAttribute(e)}_isRangeToUpdate(e,t){for(const n of t)if(n.containsRange(e))return!1;return!0}_updateLinkContent(e,t,n,i){const r=t.createText(i,{linkHref:i});return e.insertContent(r,n)}}function up(o){if(o.isCollapsed){const e=o.getFirstPosition();return e.textNode&&e.textNode.data}{const e=Array.from(o.getFirstRange().getItems());if(e.length>1)return null;const t=e[0];return t.is("$text")||t.is("$textProxy")?t.data:null}}class b5 extends ne{refresh(){const e=this.editor.model,t=e.document.selection,n=t.getSelectedElement();ba(n,e.schema)?this.isEnabled=e.schema.checkAttribute(n,"linkHref"):this.isEnabled=e.schema.checkAttributeInSelection(t,"linkHref")}execute(){const e=this.editor,t=this.editor.model,n=t.document.selection,i=e.commands.get("link");t.change(r=>{const s=n.isCollapsed?[Gn(n.getFirstPosition(),"linkHref",n.getAttribute("linkHref"),t)]:t.schema.getValidRanges(n.getRanges(),"linkHref");for(const a of s)if(r.removeAttribute("linkHref",a),i)for(const l of i.manualDecorators)r.removeAttribute(l.id,a)})}}class w5 extends ge(){constructor({id:e,label:t,attributes:n,classes:i,styles:r,defaultValue:s}){super(),this.id=e,this.set("value",void 0),this.defaultValue=s,this.label=t,this.attributes=n,this.classes=i,this.styles=r}_createPattern(){return{attributes:this.attributes,classes:this.classes,styles:this.styles}}}var mp=D(9773),A5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(mp.Z,A5),mp.Z.locals;var _5=Object.defineProperty,gp=Object.getOwnPropertySymbols,C5=Object.prototype.hasOwnProperty,v5=Object.prototype.propertyIsEnumerable,pp=(o,e,t)=>e in o?_5(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,y5=(o,e)=>{for(var t in e||(e={}))C5.call(e,t)&&pp(o,t,e[t]);if(gp)for(var t of gp(e))v5.call(e,t)&&pp(o,t,e[t]);return o};const fp="automatic",E5=/^(https?:)?\/\//;class x5 extends q{static get pluginName(){return"LinkEditing"}static get requires(){return[gm,am,Pt]}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:lp}),e.conversion.for("editingDowncast").attributeToElement({model:"linkHref",view:(n,i)=>lp(cp(n),i)}),e.conversion.for("upcast").elementToAttribute({view:{name:"a",attributes:{href:!0}},model:{key:"linkHref",value:n=>n.getAttribute("href")}}),e.commands.add("link",new k5(e)),e.commands.add("unlink",new b5(e));const t=function(n,i){const r={"Open in a new tab":n("Open in a new tab"),Downloadable:n("Downloadable")};return i.forEach(s=>("label"in s&&r[s.label]&&(s.label=r[s.label]),s)),i}(e.t,function(n){const i=[];if(n)for(const[r,s]of Object.entries(n)){const a=Object.assign({},s,{id:`link${u5(r)}`});i.push(a)}return i}(e.config.get("link.decorators")));this._enableAutomaticDecorators(t.filter(n=>n.mode===fp)),this._enableManualDecorators(t.filter(n=>n.mode==="manual")),e.plugins.get(gm).registerAttribute("linkHref"),function(n,i,r,s){const a=n.editing.view,l=new Set;a.document.registerPostFixer(c=>{const d=n.model.document.selection;let u=!1;if(d.hasAttribute(i)){const g=Gn(d.getFirstPosition(),i,d.getAttribute(i),n.model),f=n.editing.mapper.toViewRange(g);for(const b of f.getItems())b.is("element",r)&&!b.hasClass(s)&&(c.addClass(s,b),l.add(b),u=!0)}return u}),n.conversion.for("editingDowncast").add(c=>{function d(){a.change(u=>{for(const g of l.values())u.removeClass(s,g),l.delete(g)})}c.on("insert",d,{priority:"highest"}),c.on("remove",d,{priority:"highest"}),c.on("attribute",d,{priority:"highest"}),c.on("selection",d,{priority:"highest"})})}(e,"linkHref","a","ck-link_selected"),this._enableLinkOpen(),this._enableInsertContentSelectionAttributesFixer(),this._enableClickingAfterLink(),this._enableTypingOverLink(),this._handleDeleteContentAfterLink(),this._enableClipboardIntegration()}_enableAutomaticDecorators(e){const t=this.editor,n=t.commands.get("link").automaticDecorators;t.config.get("link.addTargetToExternalLinks")&&n.add({id:"linkIsExternal",mode:fp,callback:i=>!!i&&E5.test(i),attributes:{target:"_blank",rel:"noopener noreferrer"}}),n.add(e),n.length&&t.conversion.for("downcast").add(n.getDispatcher())}_enableManualDecorators(e){if(!e.length)return;const t=this.editor,n=t.commands.get("link").manualDecorators;e.forEach(i=>{t.model.schema.extend("$text",{allowAttributes:i.id});const r=new w5(i);n.add(r),t.conversion.for("downcast").attributeToElement({model:r.id,view:(s,{writer:a,schema:l},{item:c})=>{if((c.is("selection")||l.isInline(c))&&s){const d=a.createAttributeElement("a",r.attributes,{priority:5});r.classes&&a.addClass(r.classes,d);for(const u in r.styles)a.setStyle(u,r.styles[u],d);return a.setCustomProperty("link",!0,d),d}}}),t.conversion.for("upcast").elementToAttribute({view:y5({name:"a"},r._createPattern()),model:{key:r.id}})})}_enableLinkOpen(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",(n,i)=>{if(!(k.isMac?i.domEvent.metaKey:i.domEvent.ctrlKey))return;let r=i.domTarget;if(r.tagName.toLowerCase()!="a"&&(r=r.closest("a")),!r)return;const s=r.getAttribute("href");s&&(n.stop(),i.preventDefault(),hp(s))},{context:"$capture"}),this.listenTo(t,"keydown",(n,i)=>{const r=e.commands.get("link").value;r&&i.keyCode===se.enter&&i.altKey&&(n.stop(),hp(r))})}_enableInsertContentSelectionAttributesFixer(){const e=this.editor.model,t=e.document.selection;this.listenTo(e,"insertContent",()=>{const n=t.anchor.nodeBefore,i=t.anchor.nodeAfter;t.hasAttribute("linkHref")&&n&&n.hasAttribute("linkHref")&&(i&&i.hasAttribute("linkHref")||e.change(r=>{Aa(r,_a(e.schema))}))},{priority:"low"})}_enableClickingAfterLink(){const e=this.editor,t=e.model;e.editing.view.addObserver(Ns);let n=!1;this.listenTo(e.editing.view.document,"mousedown",()=>{n=!0}),this.listenTo(e.editing.view.document,"selectionChange",()=>{if(!n)return;n=!1;const i=t.document.selection;if(!i.isCollapsed||!i.hasAttribute("linkHref"))return;const r=i.getFirstPosition(),s=Gn(r,"linkHref",i.getAttribute("linkHref"),t);(r.isTouching(s.start)||r.isTouching(s.end))&&t.change(a=>{Aa(a,_a(t.schema))})})}_enableTypingOverLink(){const e=this.editor,t=e.editing.view;let n=null,i=!1;this.listenTo(t.document,"delete",()=>{i=!0},{priority:"high"}),this.listenTo(e.model,"deleteContent",()=>{const r=e.model.document.selection;r.isCollapsed||(i?i=!1:kp(e)&&function(s){const a=s.document.selection,l=a.getFirstPosition(),c=a.getLastPosition(),d=l.nodeAfter;if(!d||!d.is("$text")||!d.hasAttribute("linkHref"))return!1;const u=c.textNode||c.nodeBefore;return d===u?!0:Gn(l,"linkHref",d.getAttribute("linkHref"),s).containsRange(s.createRange(l,c),!0)}(e.model)&&(n=r.getAttributes()))},{priority:"high"}),this.listenTo(e.model,"insertContent",(r,[s])=>{i=!1,kp(e)&&n&&(e.model.change(a=>{for(const[l,c]of n)a.setAttribute(l,c,s)}),n=null)},{priority:"high"})}_handleDeleteContentAfterLink(){const e=this.editor,t=e.model,n=t.document.selection,i=e.editing.view;let r=!1,s=!1;this.listenTo(i.document,"delete",(a,l)=>{s=l.direction==="backward"},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{r=!1;const a=n.getFirstPosition(),l=n.getAttribute("linkHref");if(!l)return;const c=Gn(a,"linkHref",l,t);r=c.containsPosition(a)||c.end.isEqual(a)},{priority:"high"}),this.listenTo(t,"deleteContent",()=>{s&&(s=!1,r||e.model.enqueueChange(a=>{Aa(a,_a(t.schema))}))},{priority:"low"})}_enableClipboardIntegration(){const e=this.editor,t=e.model,n=this.editor.config.get("link.defaultProtocol");n&&this.listenTo(e.plugins.get("ClipboardPipeline"),"contentInsertion",(i,r)=>{t.change(s=>{const a=s.createRangeIn(r.content);for(const l of a.getItems())if(l.hasAttribute("linkHref")){const c=wa(l.getAttribute("linkHref"),n);s.setAttribute("linkHref",c,l)}})})}}function Aa(o,e){o.removeSelectionAttribute("linkHref");for(const t of e)o.removeSelectionAttribute(t)}function kp(o){return o.model.change(e=>e.batch).isTyping}function _a(o){return o.getDefinition("$text").allowAttributes.filter(e=>e.startsWith("link"))}var bp=D(7754),S5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(bp.Z,S5),bp.Z.locals;class D5 extends re{constructor(e,t){super(e),this.focusTracker=new dt,this.keystrokes=new xt,this._focusables=new on;const n=e.t;this.urlInputView=this._createUrlInput(),this.saveButtonView=this._createButton(n("Save"),ve.check,"ck-button-save"),this.saveButtonView.type="submit",this.cancelButtonView=this._createButton(n("Cancel"),ve.cancel,"ck-button-cancel","cancel"),this._manualDecoratorSwitches=this._createManualDecoratorSwitches(t),this.children=this._createFormChildren(t.manualDecorators),this._focusCycler=new bo({focusables:this._focusables,focusTracker:this.focusTracker,keystrokeHandler:this.keystrokes,actions:{focusPrevious:"shift + tab",focusNext:"tab"}});const i=["ck","ck-link-form","ck-responsive-form"];t.manualDecorators.length&&i.push("ck-link-form_layout-vertical","ck-vertical-form"),this.setTemplate({tag:"form",attributes:{class:i,tabindex:"-1"},children:this.children})}getDecoratorSwitchesState(){return Array.from(this._manualDecoratorSwitches).reduce((e,t)=>(e[t.name]=t.isOn,e),{})}render(){super.render(),p({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)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createUrlInput(){const e=this.locale.t,t=new Xc(this.locale,_u);return t.label=e("Link URL"),t}_createButton(e,t,n,i){const r=new Ae(this.locale);return r.set({label:e,icon:t,tooltip:!0}),r.extendTemplate({attributes:{class:n}}),i&&r.delegate("execute").to(this,i),r}_createManualDecoratorSwitches(e){const t=this.createCollection();for(const n of e.manualDecorators){const i=new hi(this.locale);i.set({name:n.id,label:n.label,withText:!0}),i.bind("isOn").toMany([n,e],"value",(r,s)=>s===void 0&&r===void 0?!!n.defaultValue:!!r),i.on("execute",()=>{n.set("value",!i.isOn)}),t.add(i)}return t}_createFormChildren(e){const t=this.createCollection();if(t.add(this.urlInputView),e.length){const n=new re;n.setTemplate({tag:"ul",children:this._manualDecoratorSwitches.map(i=>({tag:"li",children:[i],attributes:{class:["ck","ck-list__item"]}})),attributes:{class:["ck","ck-reset","ck-list"]}}),t.add(n)}return t.add(this.saveButtonView),t.add(this.cancelButtonView),t}}var wp=D(2347),B5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(wp.Z,B5),wp.Z.locals;class T5 extends re{constructor(e){super(e),this.focusTracker=new dt,this.keystrokes=new xt,this._focusables=new on;const t=e.t;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"),ve.pencil,"edit"),this.set("href",void 0),this._focusCycler=new bo({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)}destroy(){super.destroy(),this.focusTracker.destroy(),this.keystrokes.destroy()}focus(){this._focusCycler.focusFirst()}_createButton(e,t,n){const i=new Ae(this.locale);return i.set({label:e,icon:t,tooltip:!0}),i.delegate("execute").to(this,n),i}_createPreviewButton(){const e=new Ae(this.locale),t=this.bindTemplate,n=this.t;return e.set({withText:!0,tooltip:n("Open link in new tab")}),e.extendTemplate({attributes:{class:["ck","ck-link-actions__preview"],href:t.to("href",i=>i&&cp(i)),target:"_blank",rel:"noopener noreferrer"}}),e.bind("label").to(this,"href",i=>i||n("This link has no URL")),e.bind("isEnabled").to(this,"href",i=>!!i),e.template.tag="a",e.template.eventListeners={},e}}const yt="link-ui";class I5 extends q{constructor(){super(...arguments),this.actionsView=null,this.formView=null}static get requires(){return[Fi]}static get pluginName(){return"LinkUI"}init(){const e=this.editor;e.editing.view.addObserver(N1),this._balloon=e.plugins.get(Fi),this._createToolbarLinkButton(),this._enableBalloonActivators(),e.conversion.for("editingDowncast").markerToHighlight({model:yt,view:{classes:["ck-fake-link-selection"]}}),e.conversion.for("editingDowncast").markerToElement({model:yt,view:{name:"span",classes:["ck-fake-link-selection","ck-fake-link-selection_collapsed"]}})}destroy(){super.destroy(),this.formView&&this.formView.destroy(),this.actionsView&&this.actionsView.destroy()}_createViews(){this.actionsView=this._createActionsView(),this.formView=this._createFormView(),this._enableUserBalloonInteractions()}_createActionsView(){const e=this.editor,t=new T5(e.locale),n=e.commands.get("link"),i=e.commands.get("unlink");return t.bind("href").to(n,"value"),t.editButtonView.bind("isEnabled").to(n),t.unlinkButtonView.bind("isEnabled").to(i),this.listenTo(t,"edit",()=>{this._addFormView()}),this.listenTo(t,"unlink",()=>{e.execute("unlink"),this._hideUI()}),t.keystrokes.set("Esc",(r,s)=>{this._hideUI(),s()}),t.keystrokes.set(ka,(r,s)=>{this._addFormView(),s()}),t}_createFormView(){const e=this.editor,t=e.commands.get("link"),n=e.config.get("link.defaultProtocol"),i=new(S(D5))(e.locale,t);return i.urlInputView.fieldView.bind("value").to(t,"value"),i.urlInputView.bind("isEnabled").to(t,"isEnabled"),i.saveButtonView.bind("isEnabled").to(t),this.listenTo(i,"submit",()=>{const{value:r}=i.urlInputView.fieldView.element,s=wa(r,n);e.execute("link",s,i.getDecoratorSwitchesState()),this._closeFormView()}),this.listenTo(i,"cancel",()=>{this._closeFormView()}),i.keystrokes.set("Esc",(r,s)=>{this._closeFormView(),s()}),i}_createToolbarLinkButton(){const e=this.editor,t=e.commands.get("link"),n=e.t;e.ui.componentFactory.add("link",i=>{const r=new Ae(i);return r.isEnabled=!0,r.label=n("Link"),r.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>',r.keystroke=ka,r.tooltip=!0,r.isToggleable=!0,r.bind("isEnabled").to(t,"isEnabled"),r.bind("isOn").to(t,"value",s=>!!s),this.listenTo(r,"execute",()=>this._showUI(!0)),r})}_enableBalloonActivators(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"click",()=>{this._getSelectedLinkElement()&&this._showUI()}),e.keystrokes.set(ka,(n,i)=>{i(),e.commands.get("link").isEnabled&&this._showUI(!0)})}_enableUserBalloonInteractions(){this.editor.keystrokes.set("Tab",(e,t)=>{this._areActionsVisible&&!this.actionsView.focusTracker.isFocused&&(this.actionsView.focus(),t())},{priority:"high"}),this.editor.keystrokes.set("Esc",(e,t)=>{this._isUIVisible&&(this._hideUI(),t())}),w({emitter:this.formView,activator:()=>this._isUIInPanel,contextElements:()=>[this._balloon.view.element],callback:()=>this._hideUI()})}_addActionsView(){this.actionsView||this._createViews(),this._areActionsInPanel||this._balloon.add({view:this.actionsView,position:this._getBalloonPositionData()})}_addFormView(){if(this.formView||this._createViews(),this._isFormInPanel)return;const 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(),e.value!==void 0?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.formView||this._createViews(),this._getSelectedLinkElement()?(this._areActionsVisible?this._addFormView():this._addActionsView(),e&&this._balloon.showStack("main")):(this._showFakeVisualSelection(),this._addActionsView(),e&&this._balloon.showStack("main"),this._addFormView()),this._startUpdatingUI()}_hideUI(){if(!this._isUIInPanel)return;const e=this.editor;this.stopListening(e.ui,"update"),this.stopListening(this._balloon,"change:visibleView"),e.editing.view.focus(),this._removeFormView(),this._balloon.remove(this.actionsView),this._hideFakeVisualSelection()}_startUpdatingUI(){const e=this.editor,t=e.editing.view.document;let n=this._getSelectedLinkElement(),i=s();const r=()=>{const a=this._getSelectedLinkElement(),l=s();n&&!a||!n&&l!==i?this._hideUI():this._isUIVisible&&this._balloon.updatePosition(this._getBalloonPositionData()),n=a,i=l};function s(){return t.selection.focus.getAncestors().reverse().find(a=>a.is("element"))}this.listenTo(e.ui,"update",r),this.listenTo(this._balloon,"change:visibleView",r)}get _isFormInPanel(){return!!this.formView&&this._balloon.hasView(this.formView)}get _areActionsInPanel(){return!!this.actionsView&&this._balloon.hasView(this.actionsView)}get _areActionsVisible(){return!!this.actionsView&&this._balloon.visibleView===this.actionsView}get _isUIInPanel(){return this._isFormInPanel||this._areActionsInPanel}get _isUIVisible(){const e=this._balloon.visibleView;return!!this.formView&&e==this.formView||this._areActionsVisible}_getBalloonPositionData(){const e=this.editor.editing.view,t=this.editor.model,n=e.document;let i;if(t.markers.has(yt)){const r=Array.from(this.editor.editing.mapper.markerNameToElements(yt)),s=e.createRange(e.createPositionBefore(r[0]),e.createPositionAfter(r[r.length-1]));i=e.domConverter.viewRangeToDom(s)}else i=()=>{const r=this._getSelectedLinkElement();return r?e.domConverter.mapViewToDom(r):e.domConverter.viewRangeToDom(n.selection.getFirstRange())};return{target:i}}_getSelectedLinkElement(){const e=this.editor.editing.view,t=e.document.selection,n=t.getSelectedElement();if(t.isCollapsed||n&&Be(n))return Ca(t.getFirstPosition());{const i=t.getFirstRange().getTrimmed(),r=Ca(i.start),s=Ca(i.end);return r&&r==s&&e.createRangeIn(r).getTrimmed().isEqual(i)?r:null}}_showFakeVisualSelection(){const e=this.editor.model;e.change(t=>{const n=e.document.selection.getFirstRange();if(e.markers.has(yt))t.updateMarker(yt,{range:n});else if(n.start.isAtEnd){const i=n.start.getLastMatchingPosition(({item:r})=>!e.schema.isContent(r),{boundaries:n});t.addMarker(yt,{usingOperation:!1,affectsData:!1,range:t.createRange(i,n.end)})}else t.addMarker(yt,{usingOperation:!1,affectsData:!1,range:n})})}_hideFakeVisualSelection(){const e=this.editor.model;e.markers.has(yt)&&e.change(t=>{t.removeMarker(yt)})}}function Ca(o){return o.getAncestors().find(e=>{return(t=e).is("attributeElement")&&!!t.getCustomProperty("link");var t})||null}const P5=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 R5 extends q{static get requires(){return[Wn]}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 mm(e.model,n=>{if(!function(r){return r.length>4&&r[r.length-1]===" "&&r[r.length-2]!==" "}(n))return;const i=Ap(n.substr(0,n.length-1));return i?{url:i}:void 0});t.on("matched:data",(n,i)=>{const{batch:r,range:s,url:a}=i;if(!r.isTyping)return;const l=s.end.getShiftedBy(-1),c=l.getShiftedBy(-a.length),d=e.model.createRange(c,l);this._applyAutoLink(a,d)}),t.bind("isEnabled").to(this)}_enableEnterHandling(){const e=this.editor,t=e.model,n=e.commands.get("enter");n&&n.on("execute",()=>{const i=t.document.selection.getFirstPosition();if(!i.parent.previousSibling)return;const r=t.createRangeIn(i.parent.previousSibling);this._checkAndApplyAutoLinkOnRange(r)})}_enableShiftEnterHandling(){const e=this.editor,t=e.model,n=e.commands.get("shiftEnter");n&&n.on("execute",()=>{const i=t.document.selection.getFirstPosition(),r=t.createRange(t.createPositionAt(i.parent,0),i.getShiftedBy(-1));this._checkAndApplyAutoLinkOnRange(r)})}_checkAndApplyAutoLinkOnRange(e){const t=this.editor.model,{text:n,range:i}=um(e,t),r=Ap(n);if(r){const s=t.createRange(i.end.getShiftedBy(-r.length),i.end);this._applyAutoLink(r,s)}}_applyAutoLink(e,t){const n=this.editor.model,i=wa(e,this.editor.config.get("link.defaultProtocol"));this.isEnabled&&function(r,s){return s.schema.checkAttributeInSelection(s.createSelection(r),"linkHref")}(t,n)&&dp(i)&&!function(r){const s=r.start.nodeAfter;return!!s&&s.hasAttribute("linkHref")}(t)&&this._persistAutoLink(i,t)}_persistAutoLink(e,t){const n=this.editor.model,i=this.editor.plugins.get("Delete");n.enqueueChange(r=>{r.setAttribute("linkHref",e,t),n.enqueueChange(()=>{i.requestUndoOnBackspace()})})}}function Ap(o){const e=P5.exec(o);return e?e[2]:null}var _p=D(111),O5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(_p.Z,O5),_p.Z.locals;var Cp=D(5730),N5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Cp.Z,N5),Cp.Z.locals;var vp=D(4564),z5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(vp.Z,z5),vp.Z.locals;function M5(o,e){const t=e.mapper,n=e.writer,i=o.getAttribute("listType")=="numbered"?"ol":"ul",r=function(a){const l=a.createContainerElement("li");return l.getFillerOffset=L5,l}(n),s=n.createContainerElement(i,null);return n.insert(n.createPositionAt(s,0),r),t.bindElements(o,r),r}function yp(o,e,t,n){const i=e.parent,r=t.mapper,s=t.writer;let a=r.toViewPosition(n.createPositionBefore(o));const l=xp(o.previousSibling,{sameIndent:!0,smallerIndent:!0,listIndent:o.getAttribute("listIndent")}),c=o.previousSibling;if(l&&l.getAttribute("listIndent")==o.getAttribute("listIndent")){const d=r.toViewElement(l);a=s.breakContainer(s.createPositionAfter(d))}else if(c&&c.name=="listItem"){a=r.toViewPosition(n.createPositionAt(c,"end"));const d=r.findMappedViewAncestor(a),u=function(g){for(const f of g.getChildren())if(f.name=="ul"||f.name=="ol")return f;return null}(d);a=u?s.createPositionBefore(u):s.createPositionAt(d,"end")}else a=r.toViewPosition(n.createPositionBefore(o));if(a=Ep(a),s.insert(a,i),c&&c.name=="listItem"){const d=r.toViewElement(c),u=s.createRange(s.createPositionAt(d,0),a).getWalker({ignoreElementEnd:!0});for(const g of u)if(g.item.is("element","li")){const f=s.breakContainer(s.createPositionBefore(g.item)),b=g.item.parent,A=s.createPositionAt(e,"end");lt(s,A.nodeBefore,A.nodeAfter),s.move(s.createRangeOn(b),A),u._position=f}}else{const d=i.nextSibling;if(d&&(d.is("element","ul")||d.is("element","ol"))){let u=null;for(const g of d.getChildren()){const f=r.toModelElement(g);if(!(f&&f.getAttribute("listIndent")>o.getAttribute("listIndent")))break;u=g}u&&(s.breakContainer(s.createPositionAfter(u)),s.move(s.createRangeOn(u.parent),s.createPositionAt(e,"end")))}}lt(s,i,i.nextSibling),lt(s,i.previousSibling,i)}function lt(o,e,t){return!e||!t||e.name!="ul"&&e.name!="ol"||e.name!=t.name||e.getAttribute("class")!==t.getAttribute("class")?null:o.mergeContainers(o.createPositionAfter(e))}function Ep(o){return o.getLastMatchingPosition(e=>e.item.is("uiElement"))}function xp(o,e){const t=!!e.sameIndent,n=!!e.smallerIndent,i=e.listIndent;let r=o;for(;r&&r.name=="listItem";){const s=r.getAttribute("listIndent");if(t&&i==s||n&&i>s)return r;r=e.direction==="forward"?r.nextSibling:r.previousSibling}return null}function Sp(o,e,t,n){o.ui.componentFactory.add(e,i=>{const r=o.commands.get(e),s=new Ae(i);return s.set({label:t,icon:n,tooltip:!0,isToggleable:!0}),s.bind("isOn","isEnabled").to(r,"value","isEnabled"),s.on("execute",()=>{o.execute(e),o.editing.view.focus()}),s})}function va(o,e){const t=[],n=o.parent,i={ignoreElementEnd:!1,startPosition:o,shallow:!0,direction:e},r=n.getAttribute("listIndent"),s=[...new Ct(i)].filter(a=>a.item.is("element")).map(a=>a.item);for(const a of s){if(!a.is("element","listItem")||a.getAttribute("listIndent")<r)break;if(!(a.getAttribute("listIndent")>r)){if(a.getAttribute("listType")!==n.getAttribute("listType")||a.getAttribute("listStyle")!==n.getAttribute("listStyle")||a.getAttribute("listReversed")!==n.getAttribute("listReversed")||a.getAttribute("listStart")!==n.getAttribute("listStart"))break;e==="backward"?t.unshift(a):t.push(a)}}return t}const F5=["disc","circle","square"],V5=["decimal","decimal-leading-zero","lower-roman","upper-roman","lower-latin","upper-latin"];function L5(){const o=!this.isEmpty&&(this.getChild(0).name=="ul"||this.getChild(0).name=="ol");return this.isEmpty||o?0:yd.call(this)}class j5 extends q{static get pluginName(){return"ListUI"}init(){const e=this.editor.t;Sp(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>'),Sp(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>')}}const $5=[{listStyle:"disc",typeAttribute:"disc",listType:"bulleted"},{listStyle:"circle",typeAttribute:"circle",listType:"bulleted"},{listStyle:"square",typeAttribute:"square",listType:"bulleted"},{listStyle:"decimal",typeAttribute:"1",listType:"numbered"},{listStyle:"decimal-leading-zero",typeAttribute:null,listType:"numbered"},{listStyle:"lower-roman",typeAttribute:"i",listType:"numbered"},{listStyle:"upper-roman",typeAttribute:"I",listType:"numbered"},{listStyle:"lower-alpha",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-alpha",typeAttribute:"A",listType:"numbered"},{listStyle:"lower-latin",typeAttribute:"a",listType:"numbered"},{listStyle:"upper-latin",typeAttribute:"A",listType:"numbered"}];for(const{listStyle:o,typeAttribute:e,listType:t}of $5);var Dp=D(4721),H5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Dp.Z,H5),Dp.Z.locals;var Bp=D(6082),q5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Bp.Z,q5),Bp.Z.locals;var Tp=D(2417),U5={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Tp.Z,U5),Tp.Z.locals;class Ip extends ne{constructor(e,t){super(e),this._indentBy=t=="forward"?1:-1}refresh(){this.isEnabled=this._checkEnabled()}execute(){const e=this.editor.model,t=e.document;let n=Array.from(t.selection.getSelectedBlocks());e.change(i=>{const r=n[n.length-1];let s=r.nextSibling;for(;s&&s.name=="listItem"&&s.getAttribute("listIndent")>r.getAttribute("listIndent");)n.push(s),s=s.nextSibling;this._indentBy<0&&(n=n.reverse());for(const a of n){const l=a.getAttribute("listIndent")+this._indentBy;l<0?i.rename(a,"paragraph"):i.setAttribute("listIndent",l,a)}this.fire("_executeCleanup",n)})}_checkEnabled(){const e=ze(this.editor.model.document.selection.getSelectedBlocks());if(!e||!e.is("element","listItem"))return!1;if(this._indentBy>0){const t=e.getAttribute("listIndent"),n=e.getAttribute("listType");let i=e.previousSibling;for(;i&&i.is("element","listItem")&&i.getAttribute("listIndent")>=t;){if(i.getAttribute("listIndent")==t)return i.getAttribute("listType")==n;i=i.previousSibling}return!1}return!0}}class Pp extends ne{constructor(e,t){super(e),this.type=t}refresh(){this.value=this._getValue(),this.isEnabled=this._checkEnabled()}execute(e={}){const t=this.editor.model,n=t.document,i=Array.from(n.selection.getSelectedBlocks()).filter(s=>Op(s,t.schema)),r=e.forceValue!==void 0?!e.forceValue:this.value;t.change(s=>{if(r){let a=i[i.length-1].nextSibling,l=Number.POSITIVE_INFINITY,c=[];for(;a&&a.name=="listItem"&&a.getAttribute("listIndent")!==0;){const d=a.getAttribute("listIndent");d<l&&(l=d);const u=d-l;c.push({element:a,listIndent:u}),a=a.nextSibling}c=c.reverse();for(const d of c)s.setAttribute("listIndent",d.listIndent,d.element)}if(!r){let a=Number.POSITIVE_INFINITY;for(const l of i)l.is("element","listItem")&&l.getAttribute("listIndent")<a&&(a=l.getAttribute("listIndent"));a=a===0?1:a,Rp(i,!0,a),Rp(i,!1,a)}for(const a of i.reverse())r&&a.name=="listItem"?s.rename(a,"paragraph"):r||a.name=="listItem"?r||a.name!="listItem"||a.getAttribute("listType")==this.type||s.setAttribute("listType",this.type,a):(s.setAttributes({listType:this.type,listIndent:0},a),s.rename(a,"listItem"));this.fire("_executeCleanup",i)})}_getValue(){const e=ze(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,n=ze(e.getSelectedBlocks());return!!n&&Op(n,t)}}function Rp(o,e,t){const n=e?o[0]:o[o.length-1];if(n.is("element","listItem")){let i=n[e?"previousSibling":"nextSibling"],r=n.getAttribute("listIndent");for(;i&&i.is("element","listItem")&&i.getAttribute("listIndent")>=t;)r>i.getAttribute("listIndent")&&(r=i.getAttribute("listIndent")),i.getAttribute("listIndent")==r&&o[e?"unshift":"push"](i),i=i[e?"previousSibling":"nextSibling"]}}function Op(o,e){return e.checkChild(o.parent,"listItem")&&!e.isObject(o)}class W5 extends q{static get pluginName(){return"ListUtils"}getListTypeFromListStyleType(e){return function(t){return F5.includes(t)?"bulleted":V5.includes(t)?"numbered":null}(e)}getSelectedListItems(e){return function(t){let n=[...t.document.selection.getSelectedBlocks()].filter(i=>i.is("element","listItem")).map(i=>{const r=t.change(s=>s.createPositionAt(i,0));return[...va(r,"backward"),...va(r,"forward")]}).flat();return n=[...new Set(n)],n}(e)}getSiblingNodes(e,t){return va(e,t)}}function Np(o){return(e,t,n)=>{const i=n.consumable;if(!i.test(t.item,"insert")||!i.test(t.item,"attribute:listType")||!i.test(t.item,"attribute:listIndent"))return;i.consume(t.item,"insert"),i.consume(t.item,"attribute:listType"),i.consume(t.item,"attribute:listIndent");const r=t.item;yp(r,M5(r,n),n,o)}}const K5=(o,e,t)=>{if(!t.consumable.test(e.item,o.name))return;const n=t.mapper.toViewElement(e.item),i=t.writer;i.breakContainer(i.createPositionBefore(n)),i.breakContainer(i.createPositionAfter(n));const r=n.parent,s=e.attributeNewValue=="numbered"?"ol":"ul";i.rename(s,r)},G5=(o,e,t)=>{t.consumable.consume(e.item,o.name);const n=t.mapper.toViewElement(e.item).parent,i=t.writer;lt(i,n,n.nextSibling),lt(i,n.previousSibling,n)},zp=(o,e,t)=>{if(t.consumable.test(e.item,o.name)&&e.item.name!="listItem"){let n=t.mapper.toViewPosition(e.range.start);const i=t.writer,r=[];for(;(n.parent.name=="ul"||n.parent.name=="ol")&&(n=i.breakContainer(n),n.parent.name=="li");){const s=n,a=i.createPositionAt(n.parent,"end");if(!s.isEqual(a)){const l=i.remove(i.createRange(s,a));r.push(l)}n=i.createPositionAfter(n.parent)}if(r.length>0){for(let s=0;s<r.length;s++){const a=n.nodeBefore;if(n=i.insert(n,r[s]).end,s>0){const l=lt(i,a,a.nextSibling);l&&l.parent==a&&n.offset--}}lt(i,n.nodeBefore,n.nodeAfter)}}},Z5=(o,e,t)=>{const n=t.mapper.toViewPosition(e.position),i=n.nodeBefore,r=n.nodeAfter;lt(t.writer,i,r)},J5=(o,e,t)=>{if(t.consumable.consume(e.viewItem,{name:!0})){const n=t.writer,i=n.createElement("listItem"),r=function(l){let c=0,d=l.parent;for(;d;){if(d.is("element","li"))c++;else{const u=d.previousSibling;u&&u.is("element","li")&&c++}d=d.parent}return c}(e.viewItem);n.setAttribute("listIndent",r,i);const s=e.viewItem.parent&&e.viewItem.parent.name=="ol"?"numbered":"bulleted";if(n.setAttribute("listType",s,i),!t.safeInsert(i,e.modelCursor))return;const a=function(l,c,d){const{writer:u,schema:g}=d;let f=u.createPositionAfter(l);for(const b of c)if(b.name=="ul"||b.name=="ol")f=d.convertItem(b,f).modelCursor;else{const A=d.convertItem(b,u.createPositionAt(l,"end")),E=A.modelRange.start.nodeAfter;E&&E.is("element")&&!g.checkChild(l,E.name)&&(l=A.modelCursor.parent.is("element","listItem")?A.modelCursor.parent:X5(A.modelCursor),f=u.createPositionAfter(l))}return f}(i,e.viewItem.getChildren(),t);e.modelRange=n.createRange(e.modelCursor,a),t.updateConversionResult(i,e)}},Mp=(o,e,t)=>{if(t.consumable.test(e.viewItem,{name:!0})){const n=Array.from(e.viewItem.getChildren());for(const i of n)!(i.is("element","li")||Yn(i))&&i._remove()}},Y5=(o,e,t)=>{if(t.consumable.test(e.viewItem,{name:!0})){if(e.viewItem.childCount===0)return;const n=[...e.viewItem.getChildren()];let i=!1;for(const r of n)i&&!Yn(r)&&r._remove(),Yn(r)&&(i=!0)}};function Fp(o){return(e,t)=>{if(t.isPhantom)return;const n=t.modelPosition.nodeBefore;if(n&&n.is("element","listItem")){const i=t.mapper.toViewElement(n),r=i.getAncestors().find(Yn),s=o.createPositionAt(i,0).getWalker();for(const a of s){if(a.type=="elementStart"&&a.item.is("element","li")){t.viewPosition=a.previousPosition;break}if(a.type=="elementEnd"&&a.item==r){t.viewPosition=a.nextPosition;break}}}}}const Q5=function(o,[e,t]){const n=this;let i,r=e.is("documentFragment")?e.getChild(0):e;if(i=t?n.createSelection(t):n.document.selection,r&&r.is("element","listItem")){const s=i.getFirstPosition();let a=null;if(s.parent.is("element","listItem")?a=s.parent:s.nodeBefore&&s.nodeBefore.is("element","listItem")&&(a=s.nodeBefore),a){const l=a.getAttribute("listIndent");if(l>0)for(;r&&r.is("element","listItem");)r._setAttribute("listIndent",r.getAttribute("listIndent")+l),r=r.nextSibling}}};function X5(o){const e=new Ct({startPosition:o});let t;do t=e.next();while(!t.value.item.is("element","listItem"));return t.value.item}function Vp(o,e,t,n,i,r){const s=xp(e.nodeBefore,{sameIndent:!0,smallerIndent:!0,listIndent:o}),a=i.mapper,l=i.writer,c=s?s.getAttribute("listIndent"):null;let d;if(s)if(c==o){const u=a.toViewElement(s).parent;d=l.createPositionAfter(u)}else{const u=r.createPositionAt(s,"end");d=a.toViewPosition(u)}else d=t;d=Ep(d);for(const u of[...n.getChildren()])Yn(u)&&(d=l.move(l.createRangeOn(u),d).end,lt(l,u,u.nextSibling),lt(l,u.previousSibling,u))}function Yn(o){return o.is("element","ol")||o.is("element","ul")}class eS extends q{static get pluginName(){return"ListEditing"}static get requires(){return[zo,Wn,W5]}init(){const e=this.editor;e.model.schema.register("listItem",{inheritAllFrom:"$block",allowAttributes:["listType","listIndent"]});const t=e.data,n=e.editing;var i;e.model.document.registerPostFixer(s=>function(a,l){const c=a.document.differ.getChanges(),d=new Map;let u=!1;for(const A of c)if(A.type=="insert"&&A.name=="listItem")g(A.position);else if(A.type=="insert"&&A.name!="listItem"){if(A.name!="$text"){const E=A.position.nodeAfter;E.hasAttribute("listIndent")&&(l.removeAttribute("listIndent",E),u=!0),E.hasAttribute("listType")&&(l.removeAttribute("listType",E),u=!0),E.hasAttribute("listStyle")&&(l.removeAttribute("listStyle",E),u=!0),E.hasAttribute("listReversed")&&(l.removeAttribute("listReversed",E),u=!0),E.hasAttribute("listStart")&&(l.removeAttribute("listStart",E),u=!0);for(const P of Array.from(a.createRangeIn(E)).filter(z=>z.item.is("element","listItem")))g(P.previousPosition)}g(A.position.getShiftedBy(A.length))}else A.type=="remove"&&A.name=="listItem"?g(A.position):(A.type=="attribute"&&A.attributeKey=="listIndent"||A.type=="attribute"&&A.attributeKey=="listType")&&g(A.range.start);for(const A of d.values())f(A),b(A);return u;function g(A){const E=A.nodeBefore;if(E&&E.is("element","listItem")){let P=E;if(d.has(P))return;for(let z=P.previousSibling;z&&z.is("element","listItem");z=P.previousSibling)if(P=z,d.has(P))return;d.set(E,P)}else{const P=A.nodeAfter;P&&P.is("element","listItem")&&d.set(P,P)}}function f(A){let E=0,P=null;for(;A&&A.is("element","listItem");){const z=A.getAttribute("listIndent");if(z>E){let j;P===null?(P=z-E,j=E):(P>z&&(P=z),j=z-P),l.setAttribute("listIndent",j,A),u=!0}else P=null,E=A.getAttribute("listIndent")+1;A=A.nextSibling}}function b(A){let E=[],P=null;for(;A&&A.is("element","listItem");){const z=A.getAttribute("listIndent");if(P&&P.getAttribute("listIndent")>z&&(E=E.slice(0,z+1)),z!=0)if(E[z]){const j=E[z];A.getAttribute("listType")!=j&&(l.setAttribute("listType",j,A),u=!0)}else E[z]=A.getAttribute("listType");P=A,A=A.nextSibling}}}(e.model,s)),n.mapper.registerViewToModelLength("li",ya),t.mapper.registerViewToModelLength("li",ya),n.mapper.on("modelToViewPosition",Fp(n.view)),n.mapper.on("viewToModelPosition",(i=e.model,(s,a)=>{const l=a.viewPosition,c=l.parent,d=a.mapper;if(c.name=="ul"||c.name=="ol"){if(l.isAtEnd){const u=d.toModelElement(l.nodeBefore),g=d.getModelLength(l.nodeBefore);a.modelPosition=i.createPositionBefore(u).getShiftedBy(g)}else{const u=d.toModelElement(l.nodeAfter);a.modelPosition=i.createPositionBefore(u)}s.stop()}else if(c.name=="li"&&l.nodeBefore&&(l.nodeBefore.name=="ul"||l.nodeBefore.name=="ol")){const u=d.toModelElement(c);let g=1,f=l.nodeBefore;for(;f&&Yn(f);)g+=d.getModelLength(f),f=f.previousSibling;a.modelPosition=i.createPositionBefore(u).getShiftedBy(g),s.stop()}})),t.mapper.on("modelToViewPosition",Fp(n.view)),e.conversion.for("editingDowncast").add(s=>{s.on("insert",zp,{priority:"high"}),s.on("insert:listItem",Np(e.model)),s.on("attribute:listType:listItem",K5,{priority:"high"}),s.on("attribute:listType:listItem",G5,{priority:"low"}),s.on("attribute:listIndent:listItem",function(a){return(l,c,d)=>{if(!d.consumable.consume(c.item,"attribute:listIndent"))return;const u=d.mapper.toViewElement(c.item),g=d.writer;g.breakContainer(g.createPositionBefore(u)),g.breakContainer(g.createPositionAfter(u));const f=u.parent,b=f.previousSibling,A=g.createRangeOn(f);g.remove(A),b&&b.nextSibling&<(g,b,b.nextSibling),Vp(c.attributeOldValue+1,c.range.start,A.start,u,d,a),yp(c.item,u,d,a);for(const E of c.item.getChildren())d.consumable.consume(E,"insert")}}(e.model)),s.on("remove:listItem",function(a){return(l,c,d)=>{const u=d.mapper.toViewPosition(c.position).getLastMatchingPosition(P=>!P.item.is("element","li")).nodeAfter,g=d.writer;g.breakContainer(g.createPositionBefore(u)),g.breakContainer(g.createPositionAfter(u));const f=u.parent,b=f.previousSibling,A=g.createRangeOn(f),E=g.remove(A);b&&b.nextSibling&<(g,b,b.nextSibling),Vp(d.mapper.toModelElement(u).getAttribute("listIndent")+1,c.position,A.start,u,d,a);for(const P of g.createRangeIn(E).getItems())d.mapper.unbindViewElement(P);l.stop()}}(e.model)),s.on("remove",Z5,{priority:"low"})}),e.conversion.for("dataDowncast").add(s=>{s.on("insert",zp,{priority:"high"}),s.on("insert:listItem",Np(e.model))}),e.conversion.for("upcast").add(s=>{s.on("element:ul",Mp,{priority:"high"}),s.on("element:ol",Mp,{priority:"high"}),s.on("element:li",Y5,{priority:"high"}),s.on("element:li",J5)}),e.model.on("insertContent",Q5,{priority:"high"}),e.commands.add("numberedList",new Pp(e,"numbered")),e.commands.add("bulletedList",new Pp(e,"bulleted")),e.commands.add("indentList",new Ip(e,"forward")),e.commands.add("outdentList",new Ip(e,"backward"));const r=n.view.document;this.listenTo(r,"enter",(s,a)=>{const l=this.editor.model.document,c=l.selection.getLastPosition().parent;l.selection.isCollapsed&&c.name=="listItem"&&c.isEmpty&&(this.editor.execute("outdentList"),a.preventDefault(),s.stop())},{context:"li"}),this.listenTo(r,"delete",(s,a)=>{if(a.direction!=="backward")return;const l=this.editor.model.document.selection;if(!l.isCollapsed)return;const c=l.getFirstPosition();if(!c.isAtStart)return;const d=c.parent;d.name==="listItem"&&(d.previousSibling&&d.previousSibling.name==="listItem"||(this.editor.execute("outdentList"),a.preventDefault(),s.stop()))},{context:"li"}),this.listenTo(e.editing.view.document,"tab",(s,a)=>{const l=a.shiftKey?"outdentList":"indentList";this.editor.commands.get(l).isEnabled&&(e.execute(l),a.stopPropagation(),a.preventDefault(),s.stop())},{context:"li"})}afterInit(){const e=this.editor.commands,t=e.get("indent"),n=e.get("outdent");t&&t.registerChildCommand(e.get("indentList")),n&&n.registerChildCommand(e.get("outdentList"))}}function ya(o){let e=1;for(const t of o.getChildren())if(t.name=="ul"||t.name=="ol")for(const n of t.getChildren())e+=ya(n);return e}li("Ctrl+Enter");var Lp=D(1199),tS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Lp.Z,tS),Lp.Z.locals;function Oe(o,e,t,n,i=1){e!=null&&i!=null&&e>i?n.setAttribute(o,e,t):n.removeAttribute(o,t)}function fn(o,e,t={}){const n=o.createElement("tableCell",t);return o.insertElement("paragraph",n),o.insert(n,e),n}function Ea(o,e){const t=e.parent.parent,n=parseInt(t.getAttribute("headingColumns")||"0"),{column:i}=o.getCellLocation(e);return!!n&&i<n}function nS(){return o=>{o.on("element:table",(e,t,n)=>{const i=t.viewItem;if(!n.consumable.test(i,{name:!0}))return;const{rows:r,headingRows:s,headingColumns:a}=function(d){let u,g=0;const f=[],b=[];let A;for(const E of Array.from(d.getChildren())){if(E.name!=="tbody"&&E.name!=="thead"&&E.name!=="tfoot")continue;E.name!=="thead"||A||(A=E);const P=Array.from(E.getChildren()).filter(z=>z.is("element","tr"));for(const z of P)if(A&&E===A||E.name==="tbody"&&Array.from(z.getChildren()).length&&Array.from(z.getChildren()).every(j=>j.is("element","th")))g++,f.push(z);else{b.push(z);const j=oS(z);(!u||j<u)&&(u=j)}}return{headingRows:g,headingColumns:u||0,rows:[...f,...b]}}(i),l={};a&&(l.headingColumns=a),s&&(l.headingRows=s);const c=n.writer.createElement("table",l);if(n.safeInsert(c,t.modelCursor)){if(n.consumable.consume(i,{name:!0}),r.forEach(d=>n.convertItem(d,n.writer.createPositionAt(c,"end"))),n.convertChildren(i,n.writer.createPositionAt(c,"end")),c.isEmpty){const d=n.writer.createElement("tableRow");n.writer.insert(d,n.writer.createPositionAt(c,"end")),fn(n.writer,n.writer.createPositionAt(d,"end"))}n.updateConversionResult(c,t)}})}}function jp(o){return e=>{e.on(`element:${o}`,(t,n,{writer:i})=>{if(!n.modelRange)return;const r=n.modelRange.start.nodeAfter,s=i.createPositionAt(r,0);if(n.viewItem.isEmpty)return void i.insertElement("paragraph",s);const a=Array.from(r.getChildren());if(a.every(l=>l.is("element","$marker"))){const l=i.createElement("paragraph");i.insert(l,i.createPositionAt(r,0));for(const c of a)i.move(i.createRangeOn(c),i.createPositionAt(l,"end"))}},{priority:"low"})}}function oS(o){let e=0,t=0;const n=Array.from(o.getChildren()).filter(i=>i.name==="th"||i.name==="td");for(;t<n.length&&n[t].name==="th";){const i=n[t];e+=parseInt(i.getAttribute("colspan")||"1"),t++}return e}class ue{constructor(e,t={}){this._table=e,this._startRow=t.row!==void 0?t.row:t.startRow||0,this._endRow=t.row!==void 0?t.row:t.endRow,this._startColumn=t.column!==void 0?t.column:t.startColumn||0,this._endColumn=t.column!==void 0?t.column:t.endColumn,this._includeAllSlots=!!t.includeAllSlots,this._skipRows=new Set,this._row=0,this._rowIndex=0,this._column=0,this._cellIndex=0,this._spannedCells=new Map,this._nextCellAtColumn=-1}[Symbol.iterator](){return this}next(){const e=this._table.getChild(this._rowIndex);if(!e||this._isOverEndRow())return{done:!0,value:void 0};if(!e.is("element","tableRow"))return this._rowIndex++,this.next();if(this._isOverEndColumn())return this._advanceToNextRow();let t=null;const n=this._getSpanned();if(n)this._includeAllSlots&&!this._shouldSkipSlot()&&(t=this._formatOutValue(n.cell,n.row,n.column));else{const i=e.getChild(this._cellIndex);if(!i)return this._advanceToNextRow();const r=parseInt(i.getAttribute("colspan")||"1"),s=parseInt(i.getAttribute("rowspan")||"1");(r>1||s>1)&&this._recordSpans(i,s,r),this._shouldSkipSlot()||(t=this._formatOutValue(i)),this._nextCellAtColumn=this._column+r}return this._column++,this._column==this._nextCellAtColumn&&this._cellIndex++,t||this.next()}skipRow(e){this._skipRows.add(e)}_advanceToNextRow(){return this._row++,this._rowIndex++,this._column=0,this._cellIndex=0,this._nextCellAtColumn=-1,this.next()}_isOverEndRow(){return this._endRow!==void 0&&this._row>this._endRow}_isOverEndColumn(){return this._endColumn!==void 0&&this._column>this._endColumn}_formatOutValue(e,t=this._row,n=this._column){return{done:!1,value:new iS(this,e,t,n)}}_shouldSkipSlot(){const e=this._skipRows.has(this._row),t=this._row<this._startRow,n=this._column<this._startColumn,i=this._endColumn!==void 0&&this._column>this._endColumn;return e||t||n||i}_getSpanned(){const e=this._spannedCells.get(this._row);return e&&e.get(this._column)||null}_recordSpans(e,t,n){const i={cell:e,row:this._row,column:this._column};for(let r=this._row;r<this._row+t;r++)for(let s=this._column;s<this._column+n;s++)r==this._row&&s==this._column||this._markSpannedCell(r,s,i)}_markSpannedCell(e,t,n){this._spannedCells.has(e)||this._spannedCells.set(e,new Map),this._spannedCells.get(e).set(t,n)}}class iS{constructor(e,t,n,i){this.cell=t,this.row=e._row,this.column=e._column,this.cellAnchorRow=n,this.cellAnchorColumn=i,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 $p(o,e){return(t,{writer:n})=>{const i=t.getAttribute("headingRows")||0,r=n.createContainerElement("table",null,[]),s=n.createContainerElement("figure",{class:"table"},r);i>0&&n.insert(n.createPositionAt(r,"end"),n.createContainerElement("thead",null,n.createSlot(a=>a.is("element","tableRow")&&a.index<i))),i<o.getRows(t)&&n.insert(n.createPositionAt(r,"end"),n.createContainerElement("tbody",null,n.createSlot(a=>a.is("element","tableRow")&&a.index>=i)));for(const{positionOffset:a,filter:l}of e.additionalSlots)n.insert(n.createPositionAt(r,a),n.createSlot(l));return n.insert(n.createPositionAt(r,"after"),n.createSlot(a=>!a.is("element","tableRow")&&!e.additionalSlots.some(({filter:l})=>l(a)))),e.asWidget?function(a,l){return l.setCustomProperty("table",!0,a),ia(a,l,{hasSelectionHandle:!0})}(s,n):s}}function Hp(o={}){return(e,{writer:t})=>{const n=e.parent,i=n.parent,r=i.getChildIndex(n),s=new ue(i,{row:r}),a=i.getAttribute("headingRows")||0,l=i.getAttribute("headingColumns")||0;let c=null;for(const d of s)if(d.cell==e){const u=d.row<a||d.column<l?"th":"td";c=o.asWidget?l2(t.createEditableElement(u),t):t.createContainerElement(u);break}return c}}function qp(o={}){return(e,{writer:t})=>{if(!e.parent.is("element","tableCell")||!Up(e))return null;if(o.asWidget)return t.createContainerElement("span",{class:"ck-table-bogus-paragraph"});{const n=t.createContainerElement("p");return t.setCustomProperty("dataPipeline:transparentRendering",!0,n),n}}}function Up(o){return o.parent.childCount==1&&!!o.getAttributeKeys().next().done}class rS extends ne{refresh(){const e=this.editor.model,t=e.document.selection,n=e.schema;this.isEnabled=function(i,r){const s=i.getFirstPosition().parent,a=s===s.root?s:s.parent;return r.checkChild(a,"table")}(t,n)}execute(e={}){const t=this.editor,n=t.model,i=t.plugins.get("TableUtils"),r=t.config.get("table.defaultHeadings.rows"),s=t.config.get("table.defaultHeadings.columns");e.headingRows===void 0&&r&&(e.headingRows=r),e.headingColumns===void 0&&s&&(e.headingColumns=s),n.change(a=>{const l=i.createTable(a,e);n.insertObject(l,null,null,{findOptimalPosition:"auto"}),a.setSelection(a.createPositionAt(l.getNodeByPath([0,0,0]),0))})}}class Wp extends ne{constructor(e,t={}){super(e),this.order=t.order||"below"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("TableUtils"),i=this.order==="above",r=n.getSelectionAffectedTableCells(t),s=n.getRowIndexes(r),a=i?s.first:s.last,l=r[0].findAncestor("table");n.insertRows(l,{at:i?a:a+1,copyStructureFromAbove:!i})}}class Kp extends ne{constructor(e,t={}){super(e),this.order=t.order||"right"}refresh(){const e=this.editor.model.document.selection,t=!!this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(e).length;this.isEnabled=t}execute(){const e=this.editor,t=e.model.document.selection,n=e.plugins.get("TableUtils"),i=this.order==="left",r=n.getSelectionAffectedTableCells(t),s=n.getColumnIndexes(r),a=i?s.first:s.last,l=r[0].findAncestor("table");n.insertColumns(l,{columns:1,at:i?a:a+1})}}class Gp extends ne{constructor(e,t={}){super(e),this.direction=t.direction||"horizontally"}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length===1}execute(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection)[0];this.direction==="horizontally"?e.splitCellHorizontally(t,2):e.splitCellVertically(t,2)}}function Zp(o,e,t){const{startRow:n,startColumn:i,endRow:r,endColumn:s}=e,a=t.createElement("table"),l=r-n+1;for(let d=0;d<l;d++)t.insertElement("tableRow",a,"end");const c=[...new ue(o,{startRow:n,endRow:r,startColumn:i,endColumn:s,includeAllSlots:!0})];for(const{row:d,column:u,cell:g,isAnchor:f,cellAnchorRow:b,cellAnchorColumn:A}of c){const E=d-n,P=a.getChild(E);if(f){const z=t.cloneElement(g);t.append(z,P),ef(z,d,u,r,s,t)}else(b<n||A<i)&&fn(t,t.createPositionAt(P,"end"))}return function(d,u,g,f,b){const A=parseInt(u.getAttribute("headingRows")||"0");A>0&&Oe("headingRows",A-g,d,b,0);const E=parseInt(u.getAttribute("headingColumns")||"0");E>0&&Oe("headingColumns",E-f,d,b,0)}(a,o,n,i,t),a}function Jp(o,e,t=0){const n=[],i=new ue(o,{startRow:t,endRow:e-1});for(const r of i){const{row:s,cellHeight:a}=r;s<e&&e<=s+a-1&&n.push(r)}return n}function Yp(o,e,t){const n=o.parent,i=n.parent,r=n.index,s=e-r,a={},l=parseInt(o.getAttribute("rowspan"))-s;l>1&&(a.rowspan=l);const c=parseInt(o.getAttribute("colspan")||"1");c>1&&(a.colspan=c);const d=r+s,u=[...new ue(i,{startRow:r,endRow:d,includeAllSlots:!0})];let g,f=null;for(const b of u){const{row:A,column:E,cell:P}=b;P===o&&g===void 0&&(g=E),g!==void 0&&g===E&&A===d&&(f=fn(t,b.getPositionBefore(),a))}return Oe("rowspan",s,o,t),f}function Qp(o,e){const t=[],n=new ue(o);for(const i of n){const{column:r,cellWidth:s}=i;r<e&&e<=r+s-1&&t.push(i)}return t}function Xp(o,e,t,n){const i=t-e,r={},s=parseInt(o.getAttribute("colspan"))-i;s>1&&(r.colspan=s);const a=parseInt(o.getAttribute("rowspan")||"1");a>1&&(r.rowspan=a);const l=fn(n,n.createPositionAfter(o),r);return Oe("colspan",i,o,n),l}function ef(o,e,t,n,i,r){const s=parseInt(o.getAttribute("colspan")||"1"),a=parseInt(o.getAttribute("rowspan")||"1");t+s-1>i&&Oe("colspan",i-t+1,o,r,1),e+a-1>n&&Oe("rowspan",n-e+1,o,r,1)}function xa(o,e){const t=e.getColumns(o),n=new Array(t).fill(0);for(const{column:r}of new ue(o))n[r]++;const i=n.reduce((r,s,a)=>s?r:[...r,a],[]);if(i.length>0){const r=i[i.length-1];return e.removeColumns(o,{at:r}),!0}return!1}function Sa(o,e){const t=[],n=e.getRows(o);for(let i=0;i<n;i++)o.getChild(i).isEmpty&&t.push(i);if(t.length>0){const i=t[t.length-1];return e.removeRows(o,{at:i}),!0}return!1}function Da(o,e){xa(o,e)||Sa(o,e)}function tf(o,e){const t=Array.from(new ue(o,{startColumn:e.firstColumn,endColumn:e.lastColumn,row:e.lastRow}));if(t.every(({cellHeight:i})=>i===1))return e.lastRow;const n=t[0].cellHeight-1;return e.lastRow+n}function nf(o,e){const t=Array.from(new ue(o,{startRow:e.firstRow,endRow:e.lastRow,column:e.lastColumn}));if(t.every(({cellWidth:i})=>i===1))return e.lastColumn;const n=t[0].cellWidth-1;return e.lastColumn+n}class Ji extends ne{constructor(e,t){super(e),this.direction=t.direction,this.isHorizontal=this.direction=="right"||this.direction=="left"}refresh(){const e=this._getMergeableCell();this.value=e,this.isEnabled=!!e}execute(){const e=this.editor.model,t=e.document,n=this.editor.plugins.get("TableUtils").getTableCellsContainingSelection(t.selection)[0],i=this.value,r=this.direction;e.change(s=>{const a=r=="right"||r=="down",l=a?n:i,c=a?i:n,d=c.parent;(function(A,E,P){of(A)||(of(E)&&P.remove(P.createRangeIn(E)),P.move(P.createRangeIn(A),P.createPositionAt(E,"end"))),P.remove(A)})(c,l,s);const u=this.isHorizontal?"colspan":"rowspan",g=parseInt(n.getAttribute(u)||"1"),f=parseInt(i.getAttribute(u)||"1");s.setAttribute(u,g+f,l),s.setSelection(s.createRangeIn(l));const b=this.editor.plugins.get("TableUtils");Da(d.findAncestor("table"),b)})}_getMergeableCell(){const e=this.editor.model.document,t=this.editor.plugins.get("TableUtils"),n=t.getTableCellsContainingSelection(e.selection)[0];if(!n)return;const i=this.isHorizontal?function(a,l,c){const d=a.parent,u=d.parent,g=l=="right"?a.nextSibling:a.previousSibling,f=(u.getAttribute("headingColumns")||0)>0;if(!g)return;const b=l=="right"?a:g,A=l=="right"?g:a,{column:E}=c.getCellLocation(b),{column:P}=c.getCellLocation(A),z=parseInt(b.getAttribute("colspan")||"1"),j=Ea(c,b),Y=Ea(c,A);if(!(f&&j!=Y))return E+z===P?g:void 0}(n,this.direction,t):function(a,l,c){const d=a.parent,u=d.parent,g=u.getChildIndex(d);if(l=="down"&&g===c.getRows(u)-1||l=="up"&&g===0)return null;const f=parseInt(a.getAttribute("rowspan")||"1"),b=u.getAttribute("headingRows")||0,A=l=="down"&&g+f===b,E=l=="up"&&g===b;if(b&&(A||E))return null;const P=parseInt(a.getAttribute("rowspan")||"1"),z=l=="down"?g+P:g,j=[...new ue(u,{endRow:z})],Y=j.find(he=>he.cell===a),ie=Y.column,Ee=j.find(({row:he,cellHeight:zt,column:it})=>it===ie&&(l=="down"?he===z:z===he+zt));return Ee&&Ee.cell?Ee.cell:null}(n,this.direction,t);if(!i)return;const r=this.isHorizontal?"rowspan":"colspan",s=parseInt(n.getAttribute(r)||"1");return parseInt(i.getAttribute(r)||"1")===s?i:void 0}}function of(o){const e=o.getChild(0);return o.childCount==1&&e.is("element","paragraph")&&e.isEmpty}class sS extends ne{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),n=t[0];if(n){const i=n.findAncestor("table"),r=e.getRows(i)-1,s=e.getRowIndexes(t),a=s.first===0&&s.last===r;this.isEnabled=!a}else this.isEnabled=!1}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(n),r=n[0],s=r.findAncestor("table"),a=t.getCellLocation(r).column;e.change(l=>{const c=i.last-i.first+1;t.removeRows(s,{at:i.first,rows:c});const d=function(u,g,f,b){const A=u.getChild(Math.min(g,b-1));let E=A.getChild(0),P=0;for(const z of A.getChildren()){if(P>f)return E;E=z,P+=parseInt(z.getAttribute("colspan")||"1")}return E}(s,i.first,a,t.getRows(s));l.setSelection(l.createPositionAt(d,0))})}}class aS extends ne{refresh(){const e=this.editor.plugins.get("TableUtils"),t=e.getSelectionAffectedTableCells(this.editor.model.document.selection),n=t[0];if(n){const i=n.findAncestor("table"),r=e.getColumns(i),{first:s,last:a}=e.getColumnIndexes(t);this.isEnabled=a-s<r-1}else this.isEnabled=!1}execute(){const e=this.editor.plugins.get("TableUtils"),[t,n]=function(l,c){const d=c.getSelectionAffectedTableCells(l),u=d[0],g=d.pop(),f=[u,g];return u.isBefore(g)?f:f.reverse()}(this.editor.model.document.selection,e),i=t.parent.parent,r=[...new ue(i)],s={first:r.find(l=>l.cell===t).column,last:r.find(l=>l.cell===n).column},a=function(l,c,d,u){return parseInt(d.getAttribute("colspan")||"1")>1?d:c.previousSibling||d.nextSibling?d.nextSibling||c.previousSibling:u.first?l.reverse().find(({column:f})=>f<u.first).cell:l.reverse().find(({column:f})=>f>u.last).cell}(r,t,n,s);this.editor.model.change(l=>{const c=s.last-s.first+1;e.removeColumns(i,{at:s.first,columns:c}),l.setSelection(l.createPositionAt(a,0))})}}class lS extends ne{refresh(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection),i=n.length>0;this.isEnabled=i,this.value=i&&n.every(r=>this._isInHeading(r,r.parent.parent))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),n=this.editor.model,i=t.getSelectionAffectedTableCells(n.document.selection),r=i[0].findAncestor("table"),{first:s,last:a}=t.getRowIndexes(i),l=this.value?s:a+1,c=r.getAttribute("headingRows")||0;n.change(d=>{if(l){const u=Jp(r,l,l>c?c:0);for(const{cell:g}of u)Yp(g,l,d)}Oe("headingRows",l,r,d,0)})}_isInHeading(e,t){const n=parseInt(t.getAttribute("headingRows")||"0");return!!n&&e.parent.index<n}}class cS extends ne{refresh(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),i=n.length>0;this.isEnabled=i,this.value=i&&n.every(r=>Ea(t,r))}execute(e={}){if(e.forceValue===this.value)return;const t=this.editor.plugins.get("TableUtils"),n=this.editor.model,i=t.getSelectionAffectedTableCells(n.document.selection),r=i[0].findAncestor("table"),{first:s,last:a}=t.getColumnIndexes(i),l=this.value?s:a+1;n.change(c=>{if(l){const d=Qp(r,l);for(const{cell:u,column:g}of d)Xp(u,g,l,c)}Oe("headingColumns",l,r,c,0)})}}class qe extends q{static get pluginName(){return"TableUtils"}init(){this.decorate("insertColumns"),this.decorate("insertRows")}getCellLocation(e){const t=e.parent,n=t.parent,i=n.getChildIndex(t),r=new ue(n,{row:i});for(const{cell:s,row:a,column:l}of r)if(s===e)return{row:a,column:l}}createTable(e,t){const n=e.createElement("table"),i=t.rows||2,r=t.columns||2;return Ba(e,n,0,i,r),t.headingRows&&Oe("headingRows",Math.min(t.headingRows,i),n,e,0),t.headingColumns&&Oe("headingColumns",Math.min(t.headingColumns,r),n,e,0),n}insertRows(e,t={}){const n=this.editor.model,i=t.at||0,r=t.rows||1,s=t.copyStructureFromAbove!==void 0,a=t.copyStructureFromAbove?i-1:i,l=this.getRows(e),c=this.getColumns(e);if(i>l)throw new I("tableutils-insertrows-insert-out-of-range",this,{options:t});n.change(d=>{const u=e.getAttribute("headingRows")||0;if(u>i&&Oe("headingRows",u+r,e,d,0),!s&&(i===0||i===l))return void Ba(d,e,i,r,c);const g=s?Math.max(i,a):i,f=new ue(e,{endRow:g}),b=new Array(c).fill(1);for(const{row:A,column:E,cellHeight:P,cellWidth:z,cell:j}of f){const Y=A+P-1,ie=A<=a&&a<=Y;A<i&&i<=Y?(d.setAttribute("rowspan",P+r,j),b[E]=-z):s&&ie&&(b[E]=z)}for(let A=0;A<r;A++){const E=d.createElement("tableRow");d.insert(E,e,i);for(let P=0;P<b.length;P++){const z=b[P],j=d.createPositionAt(E,"end");z>0&&fn(d,j,z>1?{colspan:z}:void 0),P+=Math.abs(z)-1}}})}insertColumns(e,t={}){const n=this.editor.model,i=t.at||0,r=t.columns||1;n.change(s=>{const a=e.getAttribute("headingColumns");i<a&&s.setAttribute("headingColumns",a+r,e);const l=this.getColumns(e);if(i===0||l===i){for(const d of e.getChildren())d.is("element","tableRow")&&Qn(r,s,s.createPositionAt(d,i?"end":0));return}const c=new ue(e,{column:i,includeAllSlots:!0});for(const d of c){const{row:u,cell:g,cellAnchorColumn:f,cellAnchorRow:b,cellWidth:A,cellHeight:E}=d;if(f<i){s.setAttribute("colspan",A+r,g);const P=b+E-1;for(let z=u;z<=P;z++)c.skipRow(z)}else Qn(r,s,d.getPositionBefore())}})}removeRows(e,t){const n=this.editor.model,i=t.rows||1,r=this.getRows(e),s=t.at,a=s+i-1;if(a>r-1)throw new I("tableutils-removerows-row-index-out-of-range",this,{table:e,options:t});n.change(l=>{const c={first:s,last:a},{cellsToMove:d,cellsToTrim:u}=function(g,{first:f,last:b}){const A=new Map,E=[];for(const{row:P,column:z,cellHeight:j,cell:Y}of new ue(g,{endRow:b})){const ie=P+j-1;if(P>=f&&P<=b&&ie>b){const Ee=j-(b-P+1);A.set(z,{cell:Y,rowspan:Ee})}if(P<f&&ie>=f){let Ee;Ee=ie>=b?b-f+1:ie-f+1,E.push({cell:Y,rowspan:j-Ee})}}return{cellsToMove:A,cellsToTrim:E}}(e,c);d.size&&function(g,f,b,A){const E=new ue(g,{includeAllSlots:!0,row:f}),P=[...E],z=g.getChild(f);let j;for(const{column:Y,cell:ie,isAnchor:Ee}of P)if(b.has(Y)){const{cell:he,rowspan:zt}=b.get(Y),it=j?A.createPositionAfter(j):A.createPositionAt(z,0);A.move(A.createRangeOn(he),it),Oe("rowspan",zt,he,A),j=he}else Ee&&(j=ie)}(e,a+1,d,l);for(let g=a;g>=s;g--)l.remove(e.getChild(g));for(const{rowspan:g,cell:f}of u)Oe("rowspan",g,f,l);(function(g,{first:f,last:b},A){const E=g.getAttribute("headingRows")||0;f<E&&Oe("headingRows",b<E?E-(b-f+1):f,g,A,0)})(e,c,l),xa(e,this)||Sa(e,this)})}removeColumns(e,t){const n=this.editor.model,i=t.at,r=t.columns||1,s=t.at+r-1;n.change(a=>{(function(l,c,d){const u=l.getAttribute("headingColumns")||0;if(u&&c.first<u){const g=Math.min(u-1,c.last)-c.first+1;d.setAttribute("headingColumns",u-g,l)}})(e,{first:i,last:s},a);for(let l=s;l>=i;l--)for(const{cell:c,column:d,cellWidth:u}of[...new ue(e)])d<=l&&u>1&&d+u>l?Oe("colspan",u-1,c,a):d===l&&a.remove(c);Sa(e,this)||xa(e,this)})}splitCellVertically(e,t=2){const n=this.editor.model,i=e.parent.parent,r=parseInt(e.getAttribute("rowspan")||"1"),s=parseInt(e.getAttribute("colspan")||"1");n.change(a=>{if(s>1){const{newCellsSpan:l,updatedSpan:c}=rf(s,t);Oe("colspan",c,e,a);const d={};l>1&&(d.colspan=l),r>1&&(d.rowspan=r),Qn(s>t?t-1:s-1,a,a.createPositionAfter(e),d)}if(s<t){const l=t-s,c=[...new ue(i)],{column:d}=c.find(({cell:b})=>b===e),u=c.filter(({cell:b,cellWidth:A,column:E})=>b!==e&&E===d||E<d&&E+A>d);for(const{cell:b,cellWidth:A}of u)a.setAttribute("colspan",A+l,b);const g={};r>1&&(g.rowspan=r),Qn(l,a,a.createPositionAfter(e),g);const f=i.getAttribute("headingColumns")||0;f>d&&Oe("headingColumns",f+l,i,a)}})}splitCellHorizontally(e,t=2){const n=this.editor.model,i=e.parent,r=i.parent,s=r.getChildIndex(i),a=parseInt(e.getAttribute("rowspan")||"1"),l=parseInt(e.getAttribute("colspan")||"1");n.change(c=>{if(a>1){const d=[...new ue(r,{startRow:s,endRow:s+a-1,includeAllSlots:!0})],{newCellsSpan:u,updatedSpan:g}=rf(a,t);Oe("rowspan",g,e,c);const{column:f}=d.find(({cell:A})=>A===e),b={};u>1&&(b.rowspan=u),l>1&&(b.colspan=l);for(const A of d){const{column:E,row:P}=A;P>=s+g&&E===f&&(P+s+g)%u==0&&Qn(1,c,A.getPositionBefore(),b)}}if(a<t){const d=t-a,u=[...new ue(r,{startRow:0,endRow:s})];for(const{cell:b,cellHeight:A,row:E}of u)if(b!==e&&E+A>s){const P=A+d;c.setAttribute("rowspan",P,b)}const g={};l>1&&(g.colspan=l),Ba(c,r,s+1,d,1,g);const f=r.getAttribute("headingRows")||0;f>s&&Oe("headingRows",f+d,r,c)}})}getColumns(e){return[...e.getChild(0).getChildren()].reduce((t,n)=>t+parseInt(n.getAttribute("colspan")||"1"),0)}getRows(e){return Array.from(e.getChildren()).reduce((t,n)=>n.is("element","tableRow")?t+1:t,0)}createTableWalker(e,t={}){return new ue(e,t)}getSelectedTableCells(e){const t=[];for(const n of this.sortRanges(e.getRanges())){const i=n.getContainedElement();i&&i.is("element","tableCell")&&t.push(i)}return t}getTableCellsContainingSelection(e){const t=[];for(const n of e.getRanges()){const i=n.start.findAncestor("tableCell");i&&t.push(i)}return t}getSelectionAffectedTableCells(e){const t=this.getSelectedTableCells(e);return t.length?t:this.getTableCellsContainingSelection(e)}getRowIndexes(e){const t=e.map(n=>n.parent.index);return this._getFirstLastIndexesObject(t)}getColumnIndexes(e){const t=e[0].findAncestor("table"),n=[...new ue(t)].filter(i=>e.includes(i.cell)).map(i=>i.column);return this._getFirstLastIndexesObject(n)}isSelectionRectangular(e){if(e.length<2||!this._areCellInTheSameTableSection(e))return!1;const t=new Set,n=new Set;let i=0;for(const s of e){const{row:a,column:l}=this.getCellLocation(s),c=parseInt(s.getAttribute("rowspan"))||1,d=parseInt(s.getAttribute("colspan"))||1;t.add(a),n.add(l),c>1&&t.add(a+c-1),d>1&&n.add(l+d-1),i+=c*d}return function(s,a){const l=Array.from(s.values()),c=Array.from(a.values()),d=Math.max(...l),u=Math.min(...l),g=Math.max(...c),f=Math.min(...c);return(d-u+1)*(g-f+1)}(t,n)==i}sortRanges(e){return Array.from(e).sort(dS)}_getFirstLastIndexesObject(e){const t=e.sort((n,i)=>n-i);return{first:t[0],last:t[t.length-1]}}_areCellInTheSameTableSection(e){const t=e[0].findAncestor("table"),n=this.getRowIndexes(e),i=parseInt(t.getAttribute("headingRows"))||0;if(!this._areIndexesInSameSection(n,i))return!1;const r=this.getColumnIndexes(e),s=parseInt(t.getAttribute("headingColumns"))||0;return this._areIndexesInSameSection(r,s)}_areIndexesInSameSection({first:e,last:t},n){return e<n==t<n}}function Ba(o,e,t,n,i,r={}){for(let s=0;s<n;s++){const a=o.createElement("tableRow");o.insert(a,e,t),Qn(i,o,o.createPositionAt(a,"end"),r)}}function Qn(o,e,t,n={}){for(let i=0;i<o;i++)fn(e,t,n)}function rf(o,e){if(o<e)return{newCellsSpan:1,updatedSpan:1};const t=Math.floor(o/e);return{newCellsSpan:t,updatedSpan:o-t*e+t}}function dS(o,e){const t=o.start,n=e.start;return t.isBefore(n)?-1:1}class hS extends ne{refresh(){const e=this.editor.plugins.get(qe),t=e.getSelectedTableCells(this.editor.model.document.selection);this.isEnabled=e.isSelectionRectangular(t)}execute(){const e=this.editor.model,t=this.editor.plugins.get(qe);e.change(n=>{const i=t.getSelectedTableCells(e.document.selection),r=i.shift(),{mergeWidth:s,mergeHeight:a}=function(l,c,d){let u=0,g=0;for(const P of c){const{row:z,column:j}=d.getCellLocation(P);u=af(P,j,u,"colspan"),g=af(P,z,g,"rowspan")}const{row:f,column:b}=d.getCellLocation(l),A=u-b,E=g-f;return{mergeWidth:A,mergeHeight:E}}(r,i,t);Oe("colspan",s,r,n),Oe("rowspan",a,r,n);for(const l of i)uS(l,r,n);Da(r.findAncestor("table"),t),n.setSelection(r,"in")})}}function uS(o,e,t){sf(o)||(sf(e)&&t.remove(t.createRangeIn(e)),t.move(t.createRangeIn(o),t.createPositionAt(e,"end"))),t.remove(o)}function sf(o){const e=o.getChild(0);return o.childCount==1&&e.is("element","paragraph")&&e.isEmpty}function af(o,e,t,n){const i=parseInt(o.getAttribute(n)||"1");return Math.max(t,e+i)}class mS extends ne{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.model,t=this.editor.plugins.get("TableUtils"),n=t.getSelectionAffectedTableCells(e.document.selection),i=t.getRowIndexes(n),r=n[0].findAncestor("table"),s=[];for(let a=i.first;a<=i.last;a++)for(const l of r.getChild(a).getChildren())s.push(e.createRangeOn(l));e.change(a=>{a.setSelection(s)})}}class gS extends ne{constructor(e){super(e),this.affectsData=!1}refresh(){const e=this.editor.plugins.get("TableUtils").getSelectionAffectedTableCells(this.editor.model.document.selection);this.isEnabled=e.length>0}execute(){const e=this.editor.plugins.get("TableUtils"),t=this.editor.model,n=e.getSelectionAffectedTableCells(t.document.selection),i=n[0],r=n.pop(),s=i.findAncestor("table"),a=e.getCellLocation(i),l=e.getCellLocation(r),c=Math.min(a.column,l.column),d=Math.max(a.column,l.column),u=[];for(const g of new ue(s,{startColumn:c,endColumn:d}))u.push(t.createRangeOn(g.cell));t.change(g=>{g.setSelection(u)})}}function pS(o){o.document.registerPostFixer(e=>function(t,n){const i=n.document.differ.getChanges();let r=!1;const s=new Set;for(const a of i){let l=null;a.type=="insert"&&a.name=="table"&&(l=a.position.nodeAfter),a.type!="insert"&&a.type!="remove"||a.name!="tableRow"&&a.name!="tableCell"||(l=a.position.findAncestor("table")),bS(a)&&(l=a.range.start.findAncestor("table")),l&&!s.has(l)&&(r=fS(l,t)||r,r=kS(l,t)||r,s.add(l))}return r}(e,o))}function fS(o,e){let t=!1;const n=function(i){const r=parseInt(i.getAttribute("headingRows")||"0"),s=Array.from(i.getChildren()).reduce((l,c)=>c.is("element","tableRow")?l+1:l,0),a=[];for(const{row:l,cell:c,cellHeight:d}of new ue(i)){if(d<2)continue;const u=l<r?r:s;if(l+d>u){const g=u-l;a.push({cell:c,rowspan:g})}}return a}(o);if(n.length){t=!0;for(const i of n)Oe("rowspan",i.rowspan,i.cell,e,1)}return t}function kS(o,e){let t=!1;const n=function(a){const l=new Array(a.childCount).fill(0);for(const{rowIndex:c}of new ue(a,{includeAllSlots:!0}))l[c]++;return l}(o),i=[];for(const[a,l]of n.entries())!l&&o.getChild(a).is("element","tableRow")&&i.push(a);if(i.length){t=!0;for(const a of i.reverse())e.remove(o.getChild(a)),n.splice(a,1)}const r=n.filter((a,l)=>o.getChild(l).is("element","tableRow")),s=r[0];if(!r.every(a=>a===s)){const a=r.reduce((l,c)=>c>l?c:l,0);for(const[l,c]of r.entries()){const d=a-c;if(d){for(let u=0;u<d;u++)fn(e,e.createPositionAt(o.getChild(l),"end"));t=!0}}}return t}function bS(o){if(o.type!=="attribute")return!1;const e=o.attributeKey;return e==="headingRows"||e==="colspan"||e==="rowspan"}function wS(o){o.document.registerPostFixer(e=>function(t,n){const i=n.document.differ.getChanges();let r=!1;for(const s of i)s.type=="insert"&&s.name=="table"&&(r=AS(s.position.nodeAfter,t)||r),s.type=="insert"&&s.name=="tableRow"&&(r=lf(s.position.nodeAfter,t)||r),s.type=="insert"&&s.name=="tableCell"&&(r=Ta(s.position.nodeAfter,t)||r),s.type!="remove"&&s.type!="insert"||!_S(s)||(r=Ta(s.position.parent,t)||r);return r}(e,o))}function AS(o,e){let t=!1;for(const n of o.getChildren())n.is("element","tableRow")&&(t=lf(n,e)||t);return t}function lf(o,e){let t=!1;for(const n of o.getChildren())t=Ta(n,e)||t;return t}function Ta(o,e){if(o.childCount==0)return e.insertElement("paragraph",o),!0;const t=Array.from(o.getChildren()).filter(n=>n.is("$text"));for(const n of t)e.wrap(e.createRangeOn(n),"paragraph");return!!t.length}function _S(o){return!!o.position.parent.is("element","tableCell")&&(o.type=="insert"&&o.name=="$text"||o.type=="remove")}function CS(o,e){if(!o.is("element","paragraph"))return!1;const t=e.toViewElement(o);return!!t&&Up(o)!==t.is("element","span")}var cf=D(3881),vS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(cf.Z,vS),cf.Z.locals;class yS extends q{constructor(e){super(e),this._additionalSlots=[]}static get pluginName(){return"TableEditing"}static get requires(){return[qe]}init(){const e=this.editor,t=e.model,n=t.schema,i=e.conversion,r=e.plugins.get(qe);n.register("table",{inheritAllFrom:"$blockObject",allowAttributes:["headingRows","headingColumns"]}),n.register("tableRow",{allowIn:"table",isLimit:!0}),n.register("tableCell",{allowContentOf:"$container",allowIn:"tableRow",allowAttributes:["colspan","rowspan"],isLimit:!0,isSelectable:!0}),i.for("upcast").add(s=>{s.on("element:figure",(a,l,c)=>{if(!c.consumable.test(l.viewItem,{name:!0,classes:"table"}))return;const d=function(g){for(const f of g.getChildren())if(f.is("element","table"))return f}(l.viewItem);if(!d||!c.consumable.test(d,{name:!0}))return;c.consumable.consume(l.viewItem,{name:!0,classes:"table"});const u=ze(c.convertItem(d,l.modelCursor).modelRange.getItems());u?(c.convertChildren(l.viewItem,c.writer.createPositionAt(u,"end")),c.updateConversionResult(u,l)):c.consumable.revert(l.viewItem,{name:!0,classes:"table"})})}),i.for("upcast").add(nS()),i.for("editingDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:$p(r,{asWidget:!0,additionalSlots:this._additionalSlots})}),i.for("dataDowncast").elementToStructure({model:{name:"table",attributes:["headingRows"]},view:$p(r,{additionalSlots:this._additionalSlots})}),i.for("upcast").elementToElement({model:"tableRow",view:"tr"}),i.for("upcast").add(s=>{s.on("element:tr",(a,l)=>{l.viewItem.isEmpty&&l.modelCursor.index==0&&a.stop()},{priority:"high"})}),i.for("downcast").elementToElement({model:"tableRow",view:(s,{writer:a})=>s.isEmpty?a.createEmptyElement("tr"):a.createContainerElement("tr")}),i.for("upcast").elementToElement({model:"tableCell",view:"td"}),i.for("upcast").elementToElement({model:"tableCell",view:"th"}),i.for("upcast").add(jp("td")),i.for("upcast").add(jp("th")),i.for("editingDowncast").elementToElement({model:"tableCell",view:Hp({asWidget:!0})}),i.for("dataDowncast").elementToElement({model:"tableCell",view:Hp()}),i.for("editingDowncast").elementToElement({model:"paragraph",view:qp({asWidget:!0}),converterPriority:"high"}),i.for("dataDowncast").elementToElement({model:"paragraph",view:qp(),converterPriority:"high"}),i.for("downcast").attributeToAttribute({model:"colspan",view:"colspan"}),i.for("upcast").attributeToAttribute({model:{key:"colspan",value:df("colspan")},view:"colspan"}),i.for("downcast").attributeToAttribute({model:"rowspan",view:"rowspan"}),i.for("upcast").attributeToAttribute({model:{key:"rowspan",value:df("rowspan")},view:"rowspan"}),e.config.define("table.defaultHeadings.rows",0),e.config.define("table.defaultHeadings.columns",0),e.commands.add("insertTable",new rS(e)),e.commands.add("insertTableRowAbove",new Wp(e,{order:"above"})),e.commands.add("insertTableRowBelow",new Wp(e,{order:"below"})),e.commands.add("insertTableColumnLeft",new Kp(e,{order:"left"})),e.commands.add("insertTableColumnRight",new Kp(e,{order:"right"})),e.commands.add("removeTableRow",new sS(e)),e.commands.add("removeTableColumn",new aS(e)),e.commands.add("splitTableCellVertically",new Gp(e,{direction:"vertically"})),e.commands.add("splitTableCellHorizontally",new Gp(e,{direction:"horizontally"})),e.commands.add("mergeTableCells",new hS(e)),e.commands.add("mergeTableCellRight",new Ji(e,{direction:"right"})),e.commands.add("mergeTableCellLeft",new Ji(e,{direction:"left"})),e.commands.add("mergeTableCellDown",new Ji(e,{direction:"down"})),e.commands.add("mergeTableCellUp",new Ji(e,{direction:"up"})),e.commands.add("setTableColumnHeader",new cS(e)),e.commands.add("setTableRowHeader",new lS(e)),e.commands.add("selectTableRow",new mS(e)),e.commands.add("selectTableColumn",new gS(e)),pS(t),wS(t),this.listenTo(t.document,"change:data",()=>{(function(s,a){const l=s.document.differ;for(const c of l.getChanges()){let d,u=!1;if(c.type=="attribute"){const A=c.range.start.nodeAfter;if(!A||!A.is("element","table")||c.attributeKey!="headingRows"&&c.attributeKey!="headingColumns")continue;d=A,u=c.attributeKey=="headingRows"}else c.name!="tableRow"&&c.name!="tableCell"||(d=c.position.findAncestor("table"),u=c.name=="tableRow");if(!d)continue;const g=d.getAttribute("headingRows")||0,f=d.getAttribute("headingColumns")||0,b=new ue(d);for(const A of b){const E=A.row<g||A.column<f?"th":"td",P=a.mapper.toViewElement(A.cell);P&&P.is("element")&&P.name!=E&&a.reconvertItem(u?A.cell.parent:A.cell)}}})(t,e.editing),function(s,a){const l=s.document.differ,c=new Set;for(const d of l.getChanges()){const u=d.type=="attribute"?d.range.start.parent:d.position.parent;u.is("element","tableCell")&&c.add(u)}for(const d of c.values()){const u=Array.from(d.getChildren()).filter(g=>CS(g,a.mapper));for(const g of u)a.reconvertItem(g)}}(t,e.editing)})}registerAdditionalSlot(e){this._additionalSlots.push(e)}}function df(o){return e=>{const t=parseInt(e.getAttribute(o));return Number.isNaN(t)||t<=0?null:t}}var hf=D(1613),ES={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(hf.Z,ES),hf.Z.locals;class xS extends re{constructor(e){super(e);const t=this.bindTemplate;this.items=this._createGridCollection(),this.keystrokes=new xt,this.focusTracker=new dt,this.set("rows",0),this.set("columns",0),this.bind("label").to(this,"columns",this,"rows",(n,i)=>`${i} × ${n}`),this.setTemplate({tag:"div",attributes:{class:["ck"]},children:[{tag:"div",attributes:{class:["ck-insert-table-dropdown__grid"]},on:{"mouseover@.ck-insert-table-dropdown-grid-box":t.to("boxover")},children:this.items},{tag:"div",attributes:{class:["ck","ck-insert-table-dropdown__label"],"aria-hidden":!0},children:[{text:t.to("label")}]}],on:{mousedown:t.to(n=>{n.preventDefault()}),click:t.to(()=>{this.fire("execute")})}}),this.on("boxover",(n,i)=>{const{row:r,column:s}=i.target.dataset;this.items.get(10*(parseInt(r,10)-1)+(parseInt(s,10)-1)).focus()}),this.focusTracker.on("change:focusedElement",(n,i,r)=>{if(!r)return;const{row:s,column:a}=r.dataset;this.set({rows:parseInt(s),columns:parseInt(a)})}),this.on("change:columns",()=>this._highlightGridBoxes()),this.on("change:rows",()=>this._highlightGridBoxes())}render(){super.render(),function({keystrokeHandler:e,focusTracker:t,gridItems:n,numberOfColumns:i,uiLanguageDirection:r}){const s=typeof i=="number"?()=>i:i;function a(d){return u=>{const g=n.find(A=>A.element===t.focusedElement),f=n.getIndex(g),b=d(f,n);n.get(b).focus(),u.stopPropagation(),u.preventDefault()}}function l(d,u){return d===u-1?0:d+1}function c(d,u){return d===0?u-1:d-1}e.set("arrowright",a((d,u)=>r==="rtl"?c(d,u.length):l(d,u.length))),e.set("arrowleft",a((d,u)=>r==="rtl"?l(d,u.length):c(d,u.length))),e.set("arrowup",a((d,u)=>{let g=d-s();return g<0&&(g=d+s()*Math.floor(u.length/s()),g>u.length-1&&(g-=s())),g})),e.set("arrowdown",a((d,u)=>{let g=d+s();return g>u.length-1&&(g=d%s()),g}))}({keystrokeHandler:this.keystrokes,focusTracker:this.focusTracker,gridItems:this.items,numberOfColumns:10,uiLanguageDirection:this.locale&&this.locale.uiLanguageDirection});for(const e of this.items)this.focusTracker.add(e.element);this.keystrokes.listenTo(this.element)}focus(){this.items.get(0).focus()}focusLast(){this.items.get(0).focus()}_highlightGridBoxes(){const e=this.rows,t=this.columns;this.items.map((n,i)=>{const r=Math.floor(i/10)<e&&i%10<t;n.set("isOn",r)})}_createGridButton(e,t,n,i){const r=new Ae(e);return r.set({label:i,class:"ck-insert-table-dropdown-grid-box"}),r.extendTemplate({attributes:{"data-row":t,"data-column":n}}),r}_createGridCollection(){const e=[];for(let t=0;t<100;t++){const n=Math.floor(t/10),i=t%10,r=`${n+1} × ${i+1}`;e.push(this._createGridButton(this.locale,n+1,i+1,r))}return this.createCollection(e)}}class SS extends q{static get pluginName(){return"TableUI"}init(){const e=this.editor,t=this.editor.t,n=e.locale.contentLanguageDirection==="ltr";e.ui.componentFactory.add("insertTable",i=>{const r=e.commands.get("insertTable"),s=It(i);let a;return s.bind("isEnabled").to(r),s.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}),s.on("change:isOpen",()=>{a||(a=new xS(i),s.panelView.children.add(a),a.delegate("execute").to(s),s.on("execute",()=>{e.execute("insertTable",{rows:a.rows,columns:a.columns}),e.editing.view.focus()}))}),s}),e.ui.componentFactory.add("tableColumn",i=>{const r=[{type:"switchbutton",model:{commandName:"setTableColumnHeader",label:t("Header column"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:n?"insertTableColumnLeft":"insertTableColumnRight",label:t("Insert column left")}},{type:"button",model:{commandName:n?"insertTableColumnRight":"insertTableColumnLeft",label:t("Insert column right")}},{type:"button",model:{commandName:"removeTableColumn",label:t("Delete column")}},{type:"button",model:{commandName:"selectTableColumn",label:t("Select column")}}];return this._prepareDropdown(t("Column"),'<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>',r,i)}),e.ui.componentFactory.add("tableRow",i=>{const r=[{type:"switchbutton",model:{commandName:"setTableRowHeader",label:t("Header row"),bindIsOn:!0}},{type:"separator"},{type:"button",model:{commandName:"insertTableRowAbove",label:t("Insert row above")}},{type:"button",model:{commandName:"insertTableRowBelow",label:t("Insert row below")}},{type:"button",model:{commandName:"removeTableRow",label:t("Delete row")}},{type:"button",model:{commandName:"selectTableRow",label:t("Select row")}}];return this._prepareDropdown(t("Row"),'<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>',r,i)}),e.ui.componentFactory.add("mergeTableCells",i=>{const r=[{type:"button",model:{commandName:"mergeTableCellUp",label:t("Merge cell up")}},{type:"button",model:{commandName:n?"mergeTableCellRight":"mergeTableCellLeft",label:t("Merge cell right")}},{type:"button",model:{commandName:"mergeTableCellDown",label:t("Merge cell down")}},{type:"button",model:{commandName:n?"mergeTableCellLeft":"mergeTableCellRight",label:t("Merge cell left")}},{type:"separator"},{type:"button",model:{commandName:"splitTableCellVertically",label:t("Split cell vertically")}},{type:"button",model:{commandName:"splitTableCellHorizontally",label:t("Split cell horizontally")}}];return this._prepareMergeSplitButtonDropdown(t("Merge cells"),'<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>',r,i)})}_prepareDropdown(e,t,n,i){const r=this.editor,s=It(i),a=this._fillDropdownWithListOptions(s,n);return s.buttonView.set({label:e,icon:t,tooltip:!0}),s.bind("isEnabled").toMany(a,"isEnabled",(...l)=>l.some(c=>c)),this.listenTo(s,"execute",l=>{r.execute(l.source.commandName),l.source instanceof hi||r.editing.view.focus()}),s}_prepareMergeSplitButtonDropdown(e,t,n,i){const r=this.editor,s=It(i,Fs),a="mergeTableCells",l=r.commands.get(a),c=this._fillDropdownWithListOptions(s,n);return s.buttonView.set({label:e,icon:t,tooltip:!0,isEnabled:!0}),s.bind("isEnabled").toMany([l,...c],"isEnabled",(...d)=>d.some(u=>u)),this.listenTo(s.buttonView,"execute",()=>{r.execute(a),r.editing.view.focus()}),this.listenTo(s,"execute",d=>{r.execute(d.source.commandName),r.editing.view.focus()}),s}_fillDropdownWithListOptions(e,t){const n=this.editor,i=[],r=new st;for(const s of t)DS(s,n,i,r);return Vs(e,r),i}}function DS(o,e,t,n){if(o.type==="button"||o.type==="switchbutton"){const i=o.model=new Ys(o.model),{commandName:r,bindIsOn:s}=o.model,a=e.commands.get(r);t.push(a),i.set({commandName:r}),i.bind("isEnabled").to(a),s&&i.bind("isOn").to(a,"value"),i.set({withText:!0})}n.add(o)}var uf=D(6945),BS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(uf.Z,BS),uf.Z.locals;class kn extends q{static get pluginName(){return"TableSelection"}static get requires(){return[qe,qe]}init(){const e=this.editor,t=e.model,n=e.editing.view;this.listenTo(t,"deleteContent",(i,r)=>this._handleDeleteContent(i,r),{priority:"high"}),this.listenTo(n.document,"insertText",(i,r)=>this._handleInsertTextEvent(i,r),{priority:"high"}),this._defineSelectionConverter(),this._enablePluginDisabling()}getSelectedTableCells(){const e=this.editor.plugins.get(qe),t=this.editor.model.document.selection,n=e.getSelectedTableCells(t);return n.length==0?null:n}getSelectionAsFragment(){const e=this.editor.plugins.get(qe),t=this.getSelectedTableCells();return t?this.editor.model.change(n=>{const i=n.createDocumentFragment(),{first:r,last:s}=e.getColumnIndexes(t),{first:a,last:l}=e.getRowIndexes(t),c=t[0].findAncestor("table");let d=l,u=s;if(e.isSelectionRectangular(t)){const f={firstColumn:r,lastColumn:s,firstRow:a,lastRow:l};d=tf(c,f),u=nf(c,f)}const g=Zp(c,{startRow:a,startColumn:r,endRow:d,endColumn:u},n);return n.insert(g,i,0),i}):null}setCellSelection(e,t){const n=this._getCellsToSelect(e,t);this.editor.model.change(i=>{i.setSelection(n.cells.map(r=>i.createRangeOn(r)),{backward:n.backward})})}getFocusCell(){const e=[...this.editor.model.document.selection.getRanges()].pop().getContainedElement();return e&&e.is("element","tableCell")?e:null}getAnchorCell(){const e=ze(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(n=>n.on("selection",(i,r,s)=>{const a=s.writer;(function(d){for(const u of t)d.removeClass("ck-editor__editable_selected",u);t.clear()})(a);const l=this.getSelectedTableCells();if(!l)return;for(const d of l){const u=s.mapper.toViewElement(d);a.addClass("ck-editor__editable_selected",u),t.add(u)}const c=s.mapper.toViewElement(l[l.length-1]);a.setSelection(c,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(n=>{const i=n.createPositionAt(t[0],0),r=e.model.schema.getNearestSelectionRange(i);n.setSelection(r)})}})}_handleDeleteContent(e,t){const n=this.editor.plugins.get(qe),i=t[0],r=t[1],s=this.editor.model,a=!r||r.direction=="backward",l=n.getSelectedTableCells(i);l.length&&(e.stop(),s.change(c=>{const d=l[a?l.length-1:0];s.change(g=>{for(const f of l)s.deleteContent(g.createSelection(f,"in"))});const u=s.schema.getNearestSelectionRange(c.createPositionAt(d,0));i.is("documentSelection")?c.setSelection(u):i.setTo(u)}))}_handleInsertTextEvent(e,t){const n=this.editor,i=this.getSelectedTableCells();if(!i)return;const r=n.editing.view,s=n.editing.mapper,a=i.map(l=>r.createRangeOn(s.toViewElement(l)));t.selection=r.createSelection(a)}_getCellsToSelect(e,t){const n=this.editor.plugins.get("TableUtils"),i=n.getCellLocation(e),r=n.getCellLocation(t),s=Math.min(i.row,r.row),a=Math.max(i.row,r.row),l=Math.min(i.column,r.column),c=Math.max(i.column,r.column),d=new Array(a-s+1).fill(null).map(()=>[]),u={startRow:s,endRow:a,startColumn:l,endColumn:c};for(const{row:b,cell:A}of new ue(e.findAncestor("table"),u))d[b-s].push(A);const g=r.row<i.row,f=r.column<i.column;return g&&d.reverse(),f&&d.forEach(b=>b.reverse()),{cells:d.flat(),backward:g||f}}}class TS extends q{static get pluginName(){return"TableClipboard"}static get requires(){return[kn,qe]}init(){const e=this.editor,t=e.editing.view.document;this.listenTo(t,"copy",(n,i)=>this._onCopyCut(n,i)),this.listenTo(t,"cut",(n,i)=>this._onCopyCut(n,i)),this.listenTo(e.model,"insertContent",(n,[i,r])=>this._onInsertContent(n,i,r),{priority:"high"}),this.decorate("_replaceTableSlotCell")}_onCopyCut(e,t){const n=this.editor.plugins.get(kn);if(!n.getSelectedTableCells()||e.name=="cut"&&!this.editor.model.canEditAt(this.editor.model.document.selection))return;t.preventDefault(),e.stop();const i=this.editor.data,r=this.editor.editing.view.document,s=i.toView(n.getSelectionAsFragment());r.fire("clipboardOutput",{dataTransfer:t.dataTransfer,content:s,method:e.name})}_onInsertContent(e,t,n){if(n&&!n.is("documentSelection"))return;const i=this.editor.model,r=this.editor.plugins.get(qe);let s=this.getTableIfOnlyTableInContent(t,i);if(!s)return;const a=r.getSelectionAffectedTableCells(i.document.selection);a.length?(e.stop(),i.change(l=>{const c={width:r.getColumns(s),height:r.getRows(s)},d=function(E,P,z,j){const Y=E[0].findAncestor("table"),ie=j.getColumnIndexes(E),Ee=j.getRowIndexes(E),he={firstColumn:ie.first,lastColumn:ie.last,firstRow:Ee.first,lastRow:Ee.last},zt=E.length===1;return zt&&(he.lastRow+=P.height-1,he.lastColumn+=P.width-1,function(it,nr,_n,Gt){const no=Gt.getColumns(it),oo=Gt.getRows(it);_n>no&&Gt.insertColumns(it,{at:no,columns:_n-no}),nr>oo&&Gt.insertRows(it,{at:oo,rows:nr-oo})}(Y,he.lastRow+1,he.lastColumn+1,j)),zt||!j.isSelectionRectangular(E)?function(it,nr,_n){const{firstRow:Gt,lastRow:no,firstColumn:oo,lastColumn:Kf}=nr,Gf={first:Gt,last:no},Zf={first:oo,last:Kf};Pa(it,oo,Gf,_n),Pa(it,Kf+1,Gf,_n),Ia(it,Gt,Zf,_n),Ia(it,no+1,Zf,_n,Gt)}(Y,he,z):(he.lastRow=tf(Y,he),he.lastColumn=nf(Y,he)),he}(a,c,l,r),u=d.lastRow-d.firstRow+1,g=d.lastColumn-d.firstColumn+1,f={startRow:0,startColumn:0,endRow:Math.min(u,c.height)-1,endColumn:Math.min(g,c.width)-1};s=Zp(s,f,l);const b=a[0].findAncestor("table"),A=this._replaceSelectedCellsWithPasted(s,c,b,d,l);if(this.editor.plugins.get("TableSelection").isEnabled){const E=r.sortRanges(A.map(P=>l.createRangeOn(P)));l.setSelection(E)}else l.setSelection(A[0],0)})):Da(s,r)}_replaceSelectedCellsWithPasted(e,t,n,i,r){const{width:s,height:a}=t,l=function(E,P,z){const j=new Array(z).fill(null).map(()=>new Array(P).fill(null));for(const{column:Y,row:ie,cell:Ee}of new ue(E))j[ie][Y]=Ee;return j}(e,s,a),c=[...new ue(n,{startRow:i.firstRow,endRow:i.lastRow,startColumn:i.firstColumn,endColumn:i.lastColumn,includeAllSlots:!0})],d=[];let u;for(const E of c){const{row:P,column:z}=E;z===i.firstColumn&&(u=E.getPositionBefore());const j=P-i.firstRow,Y=z-i.firstColumn,ie=l[j%a][Y%s],Ee=ie?r.cloneElement(ie):null,he=this._replaceTableSlotCell(E,Ee,u,r);he&&(ef(he,P,z,i.lastRow,i.lastColumn,r),d.push(he),u=r.createPositionAfter(he))}const g=parseInt(n.getAttribute("headingRows")||"0"),f=parseInt(n.getAttribute("headingColumns")||"0"),b=i.firstRow<g&&g<=i.lastRow,A=i.firstColumn<f&&f<=i.lastColumn;if(b){const E=Ia(n,g,{first:i.firstColumn,last:i.lastColumn},r,i.firstRow);d.push(...E)}if(A){const E=Pa(n,f,{first:i.firstRow,last:i.lastRow},r);d.push(...E)}return d}_replaceTableSlotCell(e,t,n,i){const{cell:r,isAnchor:s}=e;return s&&i.remove(r),t?(i.insert(t,n),t):null}getTableIfOnlyTableInContent(e,t){if(!e.is("documentFragment")&&!e.is("element"))return null;if(e.is("element","table"))return e;if(e.childCount==1&&e.getChild(0).is("element","table"))return e.getChild(0);const n=t.createRangeIn(e);for(const i of n.getItems())if(i.is("element","table")){const r=t.createRange(n.start,t.createPositionBefore(i));if(t.hasContent(r,{ignoreWhitespaces:!0}))return null;const s=t.createRange(t.createPositionAfter(i),n.end);return t.hasContent(s,{ignoreWhitespaces:!0})?null:i}return null}}function Ia(o,e,t,n,i=0){if(!(e<1))return Jp(o,e,i).filter(({column:r,cellWidth:s})=>mf(r,s,t)).map(({cell:r})=>Yp(r,e,n))}function Pa(o,e,t,n){if(!(e<1))return Qp(o,e).filter(({row:i,cellHeight:r})=>mf(i,r,t)).map(({cell:i,column:r})=>Xp(i,r,e,n))}function mf(o,e,t){const n=o+e-1,{first:i,last:r}=t;return o>=i&&o<=r||o<i&&n>=i}class IS extends q{static get pluginName(){return"TableKeyboard"}static get requires(){return[kn,qe]}init(){const e=this.editor.editing.view.document;this.listenTo(e,"arrowKey",(...t)=>this._onArrowKey(...t),{context:"table"}),this.listenTo(e,"tab",(...t)=>this._handleTabOnSelectedTable(...t),{context:"figure"}),this.listenTo(e,"tab",(...t)=>this._handleTab(...t),{context:["th","td"]})}_handleTabOnSelectedTable(e,t){const n=this.editor,i=n.model.document.selection.getSelectedElement();i&&i.is("element","table")&&(t.preventDefault(),t.stopPropagation(),e.stop(),n.model.change(r=>{r.setSelection(r.createRangeIn(i.getChild(0).getChild(0)))}))}_handleTab(e,t){const n=this.editor,i=this.editor.plugins.get(qe),r=this.editor.plugins.get("TableSelection"),s=n.model.document.selection,a=!t.shiftKey;let l=i.getTableCellsContainingSelection(s)[0];if(l||(l=r.getFocusCell()),!l)return;t.preventDefault(),t.stopPropagation(),e.stop();const c=l.parent,d=c.parent,u=d.getChildIndex(c),g=c.getChildIndex(l),f=g===0;if(!a&&f&&u===0)return void n.model.change(P=>{P.setSelection(P.createRangeOn(d))});const b=g===c.childCount-1,A=u===i.getRows(d)-1;if(a&&A&&b&&(n.execute("insertTableRowBelow"),u===i.getRows(d)-1))return void n.model.change(P=>{P.setSelection(P.createRangeOn(d))});let E;if(a&&b)E=d.getChild(u+1).getChild(0);else if(!a&&f){const P=d.getChild(u-1);E=P.getChild(P.childCount-1)}else E=c.getChild(g+(a?1:-1));n.model.change(P=>{P.setSelection(P.createRangeIn(E))})}_onArrowKey(e,t){const n=this.editor,i=qr(t.keyCode,n.locale.contentLanguageDirection);this._handleArrowKeys(i,t.shiftKey)&&(t.preventDefault(),t.stopPropagation(),e.stop())}_handleArrowKeys(e,t){const n=this.editor.plugins.get(qe),i=this.editor.plugins.get("TableSelection"),r=this.editor.model,s=r.document.selection,a=["right","down"].includes(e),l=n.getSelectedTableCells(s);if(l.length){let d;return d=t?i.getFocusCell():a?l[l.length-1]:l[0],this._navigateFromCellInDirection(d,e,t),!0}const c=s.focus.findAncestor("tableCell");if(!c)return!1;if(!s.isCollapsed)if(t){if(s.isBackward==a&&!s.containsEntireContent(c))return!1}else{const d=s.getSelectedElement();if(!d||!r.schema.isObject(d))return!1}return!!this._isSelectionAtCellEdge(s,c,a)&&(this._navigateFromCellInDirection(c,e,t),!0)}_isSelectionAtCellEdge(e,t,n){const i=this.editor.model,r=this.editor.model.schema,s=n?e.getLastPosition():e.getFirstPosition();if(!r.getLimitElement(s).is("element","tableCell"))return i.createPositionAt(t,n?"end":0).isTouching(s);const a=i.createSelection(s);return i.modifySelection(a,{direction:n?"forward":"backward"}),s.isEqual(a.focus)}_navigateFromCellInDirection(e,t,n=!1){const i=this.editor.model,r=e.findAncestor("table"),s=[...new ue(r,{includeAllSlots:!0})],{row:a,column:l}=s[s.length-1],c=s.find(({cell:A})=>A==e);let{row:d,column:u}=c;switch(t){case"left":u--;break;case"up":d--;break;case"right":u+=c.cellWidth;break;case"down":d+=c.cellHeight}if(d<0||d>a||u<0&&d<=0||u>l&&d>=a)return void i.change(A=>{A.setSelection(A.createRangeOn(r))});u<0?(u=n?0:l,d--):u>l&&(u=n?l:0,d++);const g=s.find(A=>A.row==d&&A.column==u).cell,f=["right","down"].includes(t),b=this.editor.plugins.get("TableSelection");if(n&&b.isEnabled){const A=b.getAnchorCell()||e;b.setCellSelection(A,g)}else{const A=i.createPositionAt(g,f?0:"end");i.change(E=>{E.setSelection(A)})}}}class PS extends $t{constructor(){super(...arguments),this.domEventType=["mousemove","mouseleave"]}onDomEvent(e){this.fire(e.type,e)}}class RS extends q{static get pluginName(){return"TableMouse"}static get requires(){return[kn,qe]}init(){this.editor.editing.view.addObserver(PS),this._enableShiftClickSelection(),this._enableMouseDragSelection()}_enableShiftClickSelection(){const e=this.editor,t=e.plugins.get(qe);let n=!1;const i=e.plugins.get(kn);this.listenTo(e.editing.view.document,"mousedown",(r,s)=>{const a=e.model.document.selection;if(!this.isEnabled||!i.isEnabled||!s.domEvent.shiftKey)return;const l=i.getAnchorCell()||t.getTableCellsContainingSelection(a)[0];if(!l)return;const c=this._getModelTableCellFromDomEvent(s);c&&gf(l,c)&&(n=!0,i.setCellSelection(l,c),s.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{n=!1}),this.listenTo(e.editing.view.document,"selectionChange",r=>{n&&r.stop()},{priority:"highest"})}_enableMouseDragSelection(){const e=this.editor;let t,n,i=!1,r=!1;const s=e.plugins.get(kn);this.listenTo(e.editing.view.document,"mousedown",(a,l)=>{this.isEnabled&&s.isEnabled&&(l.domEvent.shiftKey||l.domEvent.ctrlKey||l.domEvent.altKey||(t=this._getModelTableCellFromDomEvent(l)))}),this.listenTo(e.editing.view.document,"mousemove",(a,l)=>{if(!l.domEvent.buttons||!t)return;const c=this._getModelTableCellFromDomEvent(l);c&&gf(t,c)&&(n=c,i||n==t||(i=!0)),i&&(r=!0,s.setCellSelection(t,n),l.preventDefault())}),this.listenTo(e.editing.view.document,"mouseup",()=>{i=!1,r=!1,t=null,n=null}),this.listenTo(e.editing.view.document,"selectionChange",a=>{r&&a.stop()},{priority:"highest"})}_getModelTableCellFromDomEvent(e){const t=e.target,n=this.editor.editing.view.createPositionAt(t,0);return this.editor.editing.mapper.toModelPosition(n).parent.findAncestor("tableCell",{includeSelf:!0})}}function gf(o,e){return o.parent.parent==e.parent.parent}var pf=D(6306),OS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(pf.Z,OS),pf.Z.locals;function NS(o){const e=o.getSelectedElement();return e&&ff(e)?e:null}function zS(o){const e=o.getFirstPosition();if(!e)return null;let t=e.parent;for(;t;){if(t.is("element")&&ff(t))return t;t=t.parent}return null}function ff(o){return!!o.getCustomProperty("table")&&Be(o)}var kf=D(7368),MS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(kf.Z,MS),kf.Z.locals;var bf=D(9247),FS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(bf.Z,FS),bf.Z.locals;var wf=D(4070),VS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(wf.Z,VS),wf.Z.locals;var Af=D(6237),LS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Af.Z,LS),Af.Z.locals;var _f=D(5087),jS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(_f.Z,jS),_f.Z.locals;const bn=Ye.defaultPositions;bn.northArrowSouth,bn.northArrowSouthWest,bn.northArrowSouthEast,bn.southArrowNorth,bn.southArrowNorthWest,bn.southArrowNorthEast,bn.viewportStickyNorth;var Cf=D(7341),$S={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Cf.Z,$S),Cf.Z.locals;var vf=D(2128),HS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(vf.Z,HS),vf.Z.locals;var yf=D(4101),qS={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(yf.Z,qS),yf.Z.locals;var US=Object.defineProperty,Ef=Object.getOwnPropertySymbols,WS=Object.prototype.hasOwnProperty,KS=Object.prototype.propertyIsEnumerable,xf=(o,e,t)=>e in o?US(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Sf=(o,e)=>{for(var t in e||(e={}))WS.call(e,t)&&xf(o,t,e[t]);if(Ef)for(var t of Ef(e))KS.call(e,t)&&xf(o,t,e[t]);return o};const GS={autoRefresh:!0},Df=36e5;class Ra extends ge(){constructor(e,t={}){if(super(),!e)throw new I("token-missing-token-url",this);t.initValue&&this._validateTokenValue(t.initValue),this.set("value",t.initValue),this._refresh=typeof e=="function"?e:()=>{return n=e,new Promise((i,r)=>{const s=new XMLHttpRequest;s.open("GET",n),s.addEventListener("load",()=>{const a=s.status,l=s.response;return a<200||a>299?r(new I("token-cannot-download-new-token",null)):i(l)}),s.addEventListener("error",()=>r(new Error("Network Error"))),s.addEventListener("abort",()=>r(new Error("Abort"))),s.send()});var n},this._options=Sf(Sf({},GS),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(),this))}destroy(){clearTimeout(this._tokenRefreshTimeout)}_validateTokenValue(e){const t=typeof e=="string",n=!/^".*"$/.test(e),i=t&&e.split(".").length===3;if(!n||!i)throw new I("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));return t?Math.floor((1e3*t-Date.now())/2):Df}catch{return Df}}static create(e,t={}){return new Ra(e,t).init()}}const Oa=/^data:(\S*?);base64,/;class ZS extends me(){constructor(e,t,n){if(super(),!e)throw new I("fileuploader-missing-file",null);if(!t)throw new I("fileuploader-missing-token",null);if(!n)throw new I("fileuploader-missing-api-address",null);this.file=function(i){if(typeof i!="string")return!1;const r=i.match(Oa);return!(!r||!r.length)}(e)?function(i,r=512){try{const s=i.match(Oa)[1],a=atob(i.replace(Oa,"")),l=[];for(let c=0;c<a.length;c+=r){const d=a.slice(c,c+r),u=new Array(d.length);for(let g=0;g<d.length;g++)u[g]=d.charCodeAt(g);l.push(new Uint8Array(u))}return new Blob(l,{type:s})}catch{throw new I("fileuploader-decoding-image-data-error",null)}}(e):e,this._token=t,this._apiAddress=n}onProgress(e){return this.on("progress",(t,n)=>e(n)),this}onError(e){return this.once("error",(t,n)=>e(n)),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.xhr,t=n=>()=>this.fire("error",n);e.addEventListener("error",t("Network Error")),e.addEventListener("abort",t("Abort")),e.upload&&e.upload.addEventListener("progress",n=>{n.lengthComputable&&this.fire("progress",{total:n.total,uploaded:n.loaded})}),e.addEventListener("load",()=>{const n=e.status,i=e.response;if(n<200||n>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((n,i)=>{t.addEventListener("load",()=>{const r=t.status,s=t.response;return r<200||r>299?s.message?i(new I("fileuploader-uploading-data-failed",this,{message:s.message})):i(s.error):n(s)}),t.addEventListener("error",()=>i(new Error("Network Error"))),t.addEventListener("abort",()=>i(new Error("Abort"))),t.send(e)})}}class JS{constructor(e,t){if(!e)throw new I("uploadgateway-missing-token",null);if(!t)throw new I("uploadgateway-missing-api-address",null);this._token=e,this._apiAddress=t}upload(e){return new ZS(e,this._token,this._apiAddress)}}class YS extends ui{static get pluginName(){return"CloudServicesCore"}createToken(e,t){return new Ra(e,t)}createUploadGateway(e,t){return new JS(e,t)}}var Bf=(o,e,t)=>new Promise((n,i)=>{var r=l=>{try{a(t.next(l))}catch(c){i(c)}},s=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(r,s);a((t=t.apply(o,e)).next())});const Na=["left","right","center","justify"];function Tf(o){return Na.includes(o)}function If(o,e){return e.contentLanguageDirection=="rtl"?o==="right":o==="left"}function Pf(o){const e=o.map(n=>{let i;return i=typeof n=="string"?{name:n}:n,i}).filter(n=>{const i=Na.includes(n.name);return i||Q("alignment-config-name-not-recognized",{option:n}),i}),t=e.filter(n=>!!n.className).length;if(t&&t<e.length)throw new I("alignment-config-classnames-are-missing",{configuredOptions:o});return e.forEach((n,i,r)=>{const s=r.slice(i+1);if(s.some(a=>a.name==n.name))throw new I("alignment-config-name-already-defined",{option:n,configuredOptions:o});if(n.className&&s.some(a=>a.className==n.className))throw new I("alignment-config-classname-already-defined",{option:n,configuredOptions:o})}),e}const za="alignment";class QS extends ne{refresh(){const e=this.editor.locale,t=ze(this.editor.model.document.selection.getSelectedBlocks());this.isEnabled=!!t&&this._canBeAligned(t),this.isEnabled&&t.hasAttribute("alignment")?this.value=t.getAttribute("alignment"):this.value=e.contentLanguageDirection==="rtl"?"right":"left"}execute(e={}){const t=this.editor,n=t.locale,i=t.model,r=i.document,s=e.value;i.change(a=>{const l=Array.from(r.selection.getSelectedBlocks()).filter(d=>this._canBeAligned(d)),c=l[0].getAttribute("alignment");If(s,n)||c===s||!s?function(d,u){for(const g of d)u.removeAttribute(za,g)}(l,a):function(d,u,g){for(const f of d)u.setAttribute(za,g,f)}(l,a,s)})}_canBeAligned(e){return this.editor.model.schema.checkAttribute(e,za)}}class XS extends q{static get pluginName(){return"AlignmentEditing"}constructor(e){super(e),e.config.define("alignment",{options:Na.map(t=>({name:t}))})}init(){const e=this.editor,t=e.locale,n=e.model.schema,i=Pf(e.config.get("alignment.options")).filter(l=>Tf(l.name)&&!If(l.name,t)),r=i.some(l=>!!l.className);n.extend("$block",{allowAttributes:"alignment"}),e.model.schema.setAttributeProperties("alignment",{isFormatting:!0}),r?e.conversion.attributeToAttribute(function(l){const c={};for(const u of l)c[u.name]={key:"class",value:u.className};return{model:{key:"alignment",values:l.map(u=>u.name)},view:c}}(i)):e.conversion.for("downcast").attributeToAttribute(function(l){const c={};for(const{name:u}of l)c[u]={key:"style",value:{"text-align":u}};return{model:{key:"alignment",values:l.map(u=>u.name)},view:c}}(i));const s=function(l){const c=[];for(const{name:d}of l)c.push({view:{key:"style",value:{"text-align":d}},model:{key:"alignment",value:d}});return c}(i);for(const l of s)e.conversion.for("upcast").attributeToAttribute(l);const a=function(l){const c=[];for(const{name:d}of l)c.push({view:{key:"align",value:d},model:{key:"alignment",value:d}});return c}(i);for(const l of a)e.conversion.for("upcast").attributeToAttribute(l);e.commands.add("alignment",new QS(e))}}const Yi=new Map([["left",ve.alignLeft],["right",ve.alignRight],["center",ve.alignCenter],["justify",ve.alignJustify]]);class eD extends q{get localizedOptionTitles(){const e=this.editor.t;return{left:e("Align left"),right:e("Align right"),center:e("Align center"),justify:e("Justify")}}static get pluginName(){return"AlignmentUI"}init(){const e=this.editor,t=e.ui.componentFactory,n=e.t,i=Pf(e.config.get("alignment.options"));i.map(r=>r.name).filter(Tf).forEach(r=>this._addButton(r)),t.add("alignment",r=>{const s=It(r);Pi(s,()=>i.map(c=>t.create(`alignment:${c.name}`)),{enableActiveItemFocusOnDropdownOpen:!0,isVertical:!0,ariaLabel:n("Text alignment toolbar")}),s.buttonView.set({label:n("Text alignment"),tooltip:!0}),s.extendTemplate({attributes:{class:"ck-alignment-dropdown"}});const a=r.contentLanguageDirection==="rtl"?Yi.get("right"):Yi.get("left"),l=e.commands.get("alignment");return s.buttonView.bind("icon").to(l,"value",c=>Yi.get(c)||a),s.bind("isEnabled").to(l,"isEnabled"),this.listenTo(s,"execute",()=>{e.editing.view.focus()}),s})}_addButton(e){const t=this.editor;t.ui.componentFactory.add(`alignment:${e}`,n=>{const i=t.commands.get("alignment"),r=new Ae(n);return r.set({label:this.localizedOptionTitles[e],icon:Yi.get(e),tooltip:!0,isToggleable:!0}),r.bind("isEnabled").to(i),r.bind("isOn").to(i,"value",s=>s===e),this.listenTo(r,"execute",()=>{t.execute("alignment",{value:e}),t.editing.view.focus()}),r})}}function tD(o){const e=[{name:"address",isVoid:!1},{name:"article",isVoid:!1},{name:"aside",isVoid:!1},{name:"blockquote",isVoid:!1},{name:"br",isVoid:!0},{name:"details",isVoid:!1},{name:"dialog",isVoid:!1},{name:"dd",isVoid:!1},{name:"div",isVoid:!1},{name:"dl",isVoid:!1},{name:"dt",isVoid:!1},{name:"fieldset",isVoid:!1},{name:"figcaption",isVoid:!1},{name:"figure",isVoid:!1},{name:"footer",isVoid:!1},{name:"form",isVoid:!1},{name:"h1",isVoid:!1},{name:"h2",isVoid:!1},{name:"h3",isVoid:!1},{name:"h4",isVoid:!1},{name:"h5",isVoid:!1},{name:"h6",isVoid:!1},{name:"header",isVoid:!1},{name:"hgroup",isVoid:!1},{name:"hr",isVoid:!0},{name:"input",isVoid:!0},{name:"li",isVoid:!1},{name:"main",isVoid:!1},{name:"nav",isVoid:!1},{name:"ol",isVoid:!1},{name:"p",isVoid:!1},{name:"section",isVoid:!1},{name:"table",isVoid:!1},{name:"tbody",isVoid:!1},{name:"td",isVoid:!1},{name:"textarea",isVoid:!1},{name:"th",isVoid:!1},{name:"thead",isVoid:!1},{name:"tr",isVoid:!1},{name:"ul",isVoid:!1}],t=e.map(r=>r.name).join("|"),n=o.replace(new RegExp(`</?(${t})( .*?)?>`,"g"),`
|
|
6526
6526
|
$&
|
|
6527
6527
|
`).split(`
|
|
6528
6528
|
`);let i=0;return n.filter(r=>r.length).map(r=>function(s,a){return a.some(l=>!l.isVoid&&!!new RegExp(`<${l.name}( .*?)?>`).test(s))}(r,e)?Ma(r,i++):function(s,a){return a.some(l=>new RegExp(`</${l.name}>`).test(s))}(r,e)?Ma(r,--i):Ma(r,i)).join(`
|
|
6529
|
-
`)}function Ma(o,e,t=" "){return`${t.repeat(Math.max(0,e))}${o}`}var Rf=D(2896),lD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Rf.Z,lD),Rf.Z.locals;const Of="SourceEditingMode";function cD(o){return function(e){return e.startsWith("<")}(o)?aD(o):o}const Fa="removeFormat";class dD extends q{static get pluginName(){return"RemoveFormatUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(Fa,n=>{const i=e.commands.get(Fa),r=new Ae(n);return r.set({label:t("Remove Format"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.69 14.915c.053.052.173.083.36.093a.366.366 0 0 1 .345.485l-.003.01a.738.738 0 0 1-.697.497h-2.67a.374.374 0 0 1-.353-.496l.013-.038a.681.681 0 0 1 .644-.458c.197-.012.325-.043.386-.093a.28.28 0 0 0 .072-.11L9.592 4.5H6.269c-.359-.017-.609.013-.75.09-.142.078-.289.265-.442.563-.192.29-.516.464-.864.464H4.17a.43.43 0 0 1-.407-.569L4.46 3h13.08l-.62 2.043a.81.81 0 0 1-.775.574h-.114a.486.486 0 0 1-.486-.486c.001-.284-.054-.464-.167-.54-.112-.076-.367-.106-.766-.091h-3.28l-2.68 10.257c-.006.074.007.127.038.158zM3 17h8a.5.5 0 1 1 0 1H3a.5.5 0 1 1 0-1zm11.299 1.17a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.06-1.06l1.415 1.414 1.414-1.415a.75.75 0 1 1 1.06 1.06l-1.413 1.415 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414-1.414 1.414z"/></svg>',tooltip:!0}),r.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(r,"execute",()=>{e.execute(Fa),e.editing.view.focus()}),r})}}class hD extends ne{refresh(){const e=this.editor.model;this.isEnabled=!!ze(this._getFormattingItems(e.document.selection,e.schema))}execute(){const e=this.editor.model,t=e.schema;e.change(n=>{for(const i of this._getFormattingItems(e.document.selection,t))if(i.is("selection"))for(const r of this._getFormattingAttributes(i,t))n.removeSelectionAttribute(r);else{const r=n.createRangeOn(i);for(const s of this._getFormattingAttributes(i,t))n.removeAttribute(s,r)}})}*_getFormattingItems(e,t){const n=i=>!!ze(this._getFormattingAttributes(i,t));for(const i of e.getRanges())for(const r of i.getItems())!t.isBlock(r)&&n(r)&&(yield r);for(const i of e.getSelectedBlocks())n(i)&&(yield i);n(e)&&(yield e)}*_getFormattingAttributes(e,t){for(const[n]of e.getAttributes()){const i=t.getAttributeProperties(n);i&&i.isFormatting&&(yield n)}}}class uD extends q{static get pluginName(){return"RemoveFormatEditing"}init(){const e=this.editor;e.commands.add("removeFormat",new hD(e))}}var mD=Object.defineProperty,Nf=Object.getOwnPropertySymbols,gD=Object.prototype.hasOwnProperty,pD=Object.prototype.propertyIsEnumerable,zf=(o,e,t)=>e in o?mD(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Mf=(o,e)=>{for(var t in e||(e={}))gD.call(e,t)&&zf(o,t,e[t]);if(Nf)for(var t of Nf(e))pD.call(e,t)&&zf(o,t,e[t]);return o};function wn(o,e,t,n){e&&function(i,r,s){if(r.attributes)for(const[a]of Object.entries(r.attributes))i.removeAttribute(a,s);if(r.styles)for(const a of Object.keys(r.styles))i.removeStyle(a,s);r.classes&&i.removeClass(r.classes,s)}(o,e,n),t&&Kt(o,t,n)}function Kt(o,e,t){if(e.attributes)for(const[n,i]of Object.entries(e.attributes))o.setAttribute(n,i,t);e.styles&&o.setStyle(e.styles,t),e.classes&&o.addClass(e.classes,t)}function fD(o,e){const t=qt(o);let n="attributes";for(n in e)t[n]=n=="classes"?Array.from(new Set([...o[n]||[],...e[n]])):Mf(Mf({},o[n]),e[n]);return t}function An(o,e,t,n,i){const r=e.getAttribute(t),s={};for(const a of["attributes","styles","classes"]){if(a!=n){r&&r[a]&&(s[a]=r[a]);continue}if(n=="classes"){const c=new Set(r&&r.classes||[]);i(c),c.size&&(s[a]=Array.from(c));continue}const l=new Map(Object.entries(r&&r[a]||{}));i(l),l.size&&(s[a]=Object.fromEntries(l))}Object.keys(s).length?e.is("documentSelection")?o.setSelectionAttribute(t,s):o.setAttribute(t,s,e):r&&(e.is("documentSelection")?o.removeSelectionAttribute(t):o.removeAttribute(t,e))}function Va({model:o}){return(e,t)=>t.writer.createElement(o,{htmlContent:e.getCustomProperty("$rawContent")})}function kD(o,{view:e,isInline:t}){const n=o.t;return(i,{writer:r})=>{const s=n("HTML object"),a=Qi(e,i,r),l=i.getAttribute("htmlAttributes");return r.addClass("html-object-embed__content",a),l&&Kt(r,l,a),ia(r.createContainerElement(t?"span":"div",{class:"html-object-embed","data-html-object-embed-label":s},a),r,{label:s})}}function Qi(o,e,t){return t.createRawElement(o,null,(n,i)=>{i.setContentOf(n,e.getAttribute("htmlContent"))})}function bD({priority:o,view:e}){return(t,n)=>{if(!t)return;const{writer:i}=n,r=i.createAttributeElement(e,null,{priority:o});return Kt(i,t,r),r}}function Vo({view:o},e){return t=>{t.on(`element:${o}`,(n,i,r)=>{if(!i.modelRange||i.modelRange.isCollapsed)return;const s=e.processViewAttributes(i.viewItem,r);s&&r.writer.setAttribute("htmlAttributes",s,i.modelRange)},{priority:"low"})}}function Lo({model:o}){return e=>{e.on(`attribute:htmlAttributes:${o}`,(t,n,i)=>{if(!i.consumable.consume(n.item,t.name))return;const{attributeOldValue:r,attributeNewValue:s}=n;wn(i.writer,r,s,i.mapper.toViewElement(n.item))})}}const wD=[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"tableColumnGroup",view:"colgroup"},{model:"tableColumn",view:"col"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!1}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:!1}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:!1}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isLimit:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!1}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:"$text",allowIn:"htmlDetails",isBlock:!1}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:!1}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:!1}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!1}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDivDl",view:"div",modelSchema:{allowChildren:["htmlDt","htmlDd"],allowIn:"htmlDl"}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDivDl"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}}],AD=[{model:"htmlLiAttributes",view:"li",appliesToBlock:!0},{model:"htmlListAttributes",view:"ol",appliesToBlock:!0},{model:"htmlListAttributes",view:"ul",appliesToBlock:!0},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"table"},{model:"htmlTheadAttributes",view:"thead",appliesToBlock:"table"},{model:"htmlTbodyAttributes",view:"tbody",appliesToBlock:"table"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"imageBlock"},{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref",attributeProperties:{copyOnEnter:!0}},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],isInline:!0}}],_D=as(function(o,e,t,n){wd(o,e,t,n)});var CD=Object.defineProperty,vD=Object.defineProperties,yD=Object.getOwnPropertyDescriptors,Ff=Object.getOwnPropertySymbols,ED=Object.prototype.hasOwnProperty,xD=Object.prototype.propertyIsEnumerable,Vf=(o,e,t)=>e in o?CD(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Xi=(o,e)=>{for(var t in e||(e={}))ED.call(e,t)&&Vf(o,t,e[t]);if(Ff)for(var t of Ff(e))xD.call(e,t)&&Vf(o,t,e[t]);return o},er=(o,e)=>vD(o,yD(e));class Xn extends q{constructor(){super(...arguments),this._definitions=[]}static get pluginName(){return"DataSchema"}init(){for(const e of wD)this.registerBlockElement(e);for(const e of AD)this.registerInlineElement(e)}registerBlockElement(e){this._definitions.push(er(Xi({},e),{isBlock:!0}))}registerInlineElement(e){this._definitions.push(er(Xi({},e),{isInline:!0}))}extendBlockElement(e){this._extendDefinition(er(Xi({},e),{isBlock:!0}))}extendInlineElement(e){this._extendDefinition(er(Xi({},e),{isInline:!0}))}getDefinitionsForView(e,t=!1){const n=new Set;for(const i of this._getMatchingViewDefinitions(e)){if(t)for(const r of this._getReferences(i.model))n.add(r);n.add(i)}return n}getDefinitionsForModel(e){return this._definitions.filter(t=>t.model==e)}_getMatchingViewDefinitions(e){return this._definitions.filter(t=>t.view&&function(n,i){return typeof n=="string"?n===i:n instanceof RegExp?n.test(i):!1}(e,t.view))}*_getReferences(e){const t=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],n=this._definitions.filter(i=>i.model==e);for(const{modelSchema:i}of n)if(i)for(const r of t)for(const s of Pe(i[r]||[])){const a=this._definitions.filter(l=>l.model==s);for(const l of a)s!==e&&(yield*this._getReferences(l.model),yield l)}}_extendDefinition(e){const t=Array.from(this._definitions.entries()).filter(([,n])=>n.model==e.model);if(t.length!=0)for(const[n,i]of t)this._definitions[n]=_D({},i,e,(r,s)=>Array.isArray(r)?r.concat(s):void 0);else this._definitions.push(e)}}const SD=function(o,e,t,n){for(var i=o.length,r=t+-1;++r<i;)if(e(o[r],r,o))return r;return-1},DD=function(o){return o!=o},BD=function(o,e,t){for(var n=t-1,i=o.length;++n<i;)if(o[n]===e)return n;return-1},TD=function(o,e,t){return e==e?BD(o,e,t):SD(o,DD,t)};var Lf=Array.prototype.splice;const ID=function(o,e,t,n){var i=TD,r=-1,s=e.length,a=o;for(o===e&&(e=Tr(e)),t;++r<s;)for(var l=0,c=e[r],d=c;(l=i(a,d,l))>-1;)a!==o&&Lf.call(a,l,1),Lf.call(o,l,1);return o},PD=_d(function(o,e){return o&&o.length&&e&&e.length?ID(o,e):o});var jf=D(5049),RD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(jf.Z,RD),jf.Z.locals;class Fe extends q{constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new Mn,this._disallowedAttributes=new Mn,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=!1,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerModelPostFixer()}static get pluginName(){return"DataFilter"}static get requires(){return[Xn,Mo]}loadAllowedConfig(e){for(const t of e){const n=t.name||/[\s\S]+/,i=qf(t);this.allowElement(n),i.forEach(r=>this.allowAttributes(r))}}loadDisallowedConfig(e){for(const t of e){const n=t.name||/[\s\S]+/,i=qf(t);i.length==0?this.disallowElement(n):i.forEach(r=>this.disallowAttributes(r))}}allowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(t),this._coupledAttributes=null}disallowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(t.view)}allowAttributes(e){this._allowedAttributes.add(e)}disallowAttributes(e){this._disallowedAttributes.add(e)}processViewAttributes(e,t){return $f(e,t,this._disallowedAttributes),$f(e,t,this._allowedAttributes)}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&typeof e.appliesToBlock=="string")for(const t of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))t.isBlock&&this._addAllowedElement(t);this._dataInitialized&&this.editor.data.once("set",()=>{this._fireRegisterEvent(e)},{priority:te.get("highest")+1})}}_registerElementsAfterInit(){this.editor.data.on("init",()=>{this._dataInitialized=!0;for(const e of this._allowedElements)this._fireRegisterEvent(e)},{priority:te.get("highest")+1})}_registerElementHandlers(){this.on("register",(e,t)=>{const n=this.editor.model.schema;if(t.isObject&&!n.isRegistered(t.model))this._registerObjectElement(t);else if(t.isBlock)this._registerBlockElement(t);else{if(!t.isInline)throw new I("data-filter-invalid-definition",null,t);this._registerInlineElement(t)}e.stop()},{priority:"lowest"})}_registerModelPostFixer(){const e=this.editor.model;e.document.registerPostFixer(t=>{const n=e.document.differ.getChanges();let i=!1;const r=this._getCoupledAttributesMap();for(const s of n){if(s.type!="attribute"||s.attributeNewValue!==null)continue;const a=r.get(s.attributeKey);if(a)for(const{item:l}of s.range.getWalker({shallow:!0}))for(const c of a)l.hasAttribute(c)&&(t.removeAttribute(c,l),i=!0)}return i})}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const e of this._allowedElements)if(e.coupledAttribute&&e.model){const t=this._coupledAttributes.get(e.coupledAttribute);t?t.push(e.model):this._coupledAttributes.set(e.coupledAttribute,[e.model])}return this._coupledAttributes}_fireRegisterEvent(e){e.view&&this._disallowedElements.has(e.view)||this.fire(e.view?`register:${e.view}`:"register",e)}_registerObjectElement(e){const t=this.editor,n=t.model.schema,i=t.conversion,{view:r,model:s}=e;n.register(s,e.modelSchema),r&&(n.extend(e.model,{allowAttributes:["htmlAttributes","htmlContent"]}),t.data.registerRawContentMatcher({name:r}),i.for("upcast").elementToElement({view:r,model:Va(e),converterPriority:te.get("low")+1}),i.for("upcast").add(Vo(e,this)),i.for("editingDowncast").elementToStructure({model:{name:s,attributes:["htmlAttributes"]},view:kD(t,e)}),i.for("dataDowncast").elementToElement({model:s,view:(a,{writer:l})=>Qi(r,a,l)}),i.for("dataDowncast").add(Lo(e)))}_registerBlockElement(e){const t=this.editor,n=t.model.schema,i=t.conversion,{view:r,model:s}=e;if(!n.isRegistered(e.model)){if(n.register(e.model,e.modelSchema),!r)return;i.for("upcast").elementToElement({model:s,view:r,converterPriority:te.get("low")+1}),i.for("downcast").elementToElement({model:s,view:r})}r&&(n.extend(e.model,{allowAttributes:"htmlAttributes"}),i.for("upcast").add(Vo(e,this)),i.for("downcast").add(Lo(e)))}_registerInlineElement(e){const t=this.editor,n=t.model.schema,i=t.conversion,r=e.model;e.appliesToBlock||(n.extend("$text",{allowAttributes:r}),e.attributeProperties&&n.setAttributeProperties(r,e.attributeProperties),i.for("upcast").add(function({view:s,model:a},l){return c=>{c.on(`element:${s}`,(d,u,g)=>{let f=l.processViewAttributes(u.viewItem,g);if(f||g.consumable.test(u.viewItem,{name:!0})){f=f||{},g.consumable.consume(u.viewItem,{name:!0}),u.modelRange||(u=Object.assign(u,g.convertChildren(u.viewItem,u.modelCursor)));for(const b of u.modelRange.getItems())if(g.schema.checkAttribute(b,a)){const A=fD(f,b.getAttribute(a)||{});g.writer.setAttribute(a,A,b)}}},{priority:"low"})}}(e,this)),i.for("downcast").attributeToElement({model:r,view:bD(e)}))}}function $f(o,e,t){const n=function(l,{consumable:c},d){const u=d.matchAll(l)||[],g=[];for(const f of u)OD(c,l,f),delete f.match.name,c.consume(l,f.match),g.push(f);return g}(o,e,t),{attributes:i,styles:r,classes:s}=function(l){const c={attributes:new Set,classes:new Set,styles:new Set};for(const d of l)for(const u in c)(d.match[u]||[]).forEach(g=>c[u].add(g));return c}(n),a={};if(i.size)for(const l of i)_c(l)||i.delete(l);return i.size&&(a.attributes=Hf(i,l=>o.getAttribute(l))),r.size&&(a.styles=Hf(r,l=>o.getStyle(l))),s.size&&(a.classes=Array.from(s)),Object.keys(a).length?a:null}function OD(o,e,t){for(const n of["attributes","classes","styles"]){const i=t.match[n];if(i)for(const r of Array.from(i))o.test(e,{[n]:[r]})||PD(i,r)}}function Hf(o,e){const t={};for(const n of o)e(n)!==void 0&&(t[n]=e(n));return t}function La(o,e){const{name:t}=o,n=o[e];return Ke(n)?Object.entries(n).map(([i,r])=>({name:t,[e]:{[i]:r}})):Array.isArray(n)?n.map(i=>({name:t,[e]:[i]})):[o]}function qf(o){const{name:e,attributes:t,classes:n,styles:i}=o,r=[];return t&&r.push(...La({name:e,attributes:t},"attributes")),n&&r.push(...La({name:e,classes:n},"classes")),i&&r.push(...La({name:e,styles:i},"styles")),r}class ND extends q{static get requires(){return[Fe]}static get pluginName(){return"CodeBlockElementSupport"}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const e=this.editor.plugins.get(Fe);e.on("register:pre",(t,n)=>{if(n.model!=="codeBlock")return;const i=this.editor,r=i.model.schema,s=i.conversion;r.extend("codeBlock",{allowAttributes:["htmlAttributes","htmlContentAttributes"]}),s.for("upcast").add(function(a){return l=>{l.on("element:code",(c,d,u)=>{const g=d.viewItem,f=g.parent;function b(A,E){const P=a.processViewAttributes(A,u);P&&u.writer.setAttribute(E,P,d.modelRange)}f&&f.is("element","pre")&&(b(f,"htmlAttributes"),b(g,"htmlContentAttributes"))},{priority:"low"})}}(e)),s.for("downcast").add(a=>{a.on("attribute:htmlAttributes:codeBlock",(l,c,d)=>{if(!d.consumable.consume(c.item,l.name))return;const{attributeOldValue:u,attributeNewValue:g}=c,f=d.mapper.toViewElement(c.item).parent;wn(d.writer,u,g,f)}),a.on("attribute:htmlContentAttributes:codeBlock",(l,c,d)=>{if(!d.consumable.consume(c.item,l.name))return;const{attributeOldValue:u,attributeNewValue:g}=c,f=d.mapper.toViewElement(c.item);wn(d.writer,u,g,f)})}),t.stop()})}}class zD extends q{static get requires(){return[Fe]}static get pluginName(){return"DualContentModelElementSupport"}init(){this.editor.plugins.get(Fe).on("register",(e,t)=>{const n=t,i=this.editor,r=i.model.schema,s=i.conversion;if(!n.paragraphLikeModel||r.isRegistered(n.model)||r.isRegistered(n.paragraphLikeModel))return;const a={model:n.paragraphLikeModel,view:n.view};r.register(n.model,n.modelSchema),r.register(a.model,{inheritAllFrom:"$block"}),s.for("upcast").elementToElement({view:n.view,model:(l,{writer:c})=>this._hasBlockContent(l)?c.createElement(n.model):c.createElement(a.model),converterPriority:te.get("low")+.5}),s.for("downcast").elementToElement({view:n.view,model:n.model}),this._addAttributeConversion(n),s.for("downcast").elementToElement({view:a.view,model:a.model}),this._addAttributeConversion(a),e.stop()})}_hasBlockContent(e){const t=this.editor.editing.view,n=t.domConverter.blockElements;for(const i of t.createRangeIn(e).getItems())if(i.is("element")&&n.includes(i.name))return!0;return!1}_addAttributeConversion(e){const t=this.editor,n=t.conversion,i=t.plugins.get(Fe);t.model.schema.extend(e.model,{allowAttributes:"htmlAttributes"}),n.for("upcast").add(Vo(e,i)),n.for("downcast").add(Lo(e))}}class MD extends q{static get requires(){return[Xn,zo]}static get pluginName(){return"HeadingElementSupport"}init(){const e=this.editor;if(!e.plugins.has("HeadingEditing"))return;const t=e.config.get("heading.options");this.registerHeadingElements(e,t),this.removeClassesOnEnter(e,t)}registerHeadingElements(e,t){const n=e.plugins.get(Xn),i=[];for(const r of t)"model"in r&&"view"in r&&(n.registerBlockElement({view:r.view,model:r.model}),i.push(r.model));n.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:i}})}removeClassesOnEnter(e,t){const n=e.commands.get("enter");this.listenTo(n,"afterExecute",(i,r)=>{const s=e.model.document.selection.getFirstPosition().parent;t.some(a=>s.is("element",a.model))&&s.childCount===0&&An(r.writer,s,"htmlAttributes","classes",a=>a.clear())})}}function tr(o,e,t){const n=o.createRangeOn(e);for(const{item:i}of n.getWalker())if(i.is("element",t))return i}class FD extends q{static get requires(){return[Fe]}static get pluginName(){return"ImageElementSupport"}init(){const e=this.editor;if(!e.plugins.has("ImageInlineEditing")&&!e.plugins.has("ImageBlockEditing"))return;const t=e.model.schema,n=e.conversion,i=e.plugins.get(Fe);i.on("register:figure",()=>{n.for("upcast").add(function(r){return s=>{s.on("element:figure",(a,l,c)=>{const d=l.viewItem;if(!l.modelRange||!d.hasClass("image"))return;const u=r.processViewAttributes(d,c);u&&c.writer.setAttribute("htmlFigureAttributes",u,l.modelRange)},{priority:"low"})}}(i))}),i.on("register:img",(r,s)=>{s.model!=="imageBlock"&&s.model!=="imageInline"||(t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["htmlAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["htmlA","htmlAttributes"]}),n.for("upcast").add(function(a){return l=>{l.on("element:img",(c,d,u)=>{if(!d.modelRange)return;const g=d.viewItem,f=g.parent;function b(E,P){const z=a.processViewAttributes(E,u);z&&u.writer.setAttribute(P,z,d.modelRange)}function A(E){d.modelRange&&d.modelRange.getContainedElement().is("element","imageBlock")&&b(E,"htmlLinkAttributes")}b(g,"htmlAttributes"),f.is("element","a")&&A(f)},{priority:"low"})}}(i)),n.for("downcast").add(a=>{function l(d){a.on(`attribute:${d}:imageInline`,(u,g,f)=>{if(!f.consumable.consume(g.item,u.name))return;const{attributeOldValue:b,attributeNewValue:A}=g,E=f.mapper.toViewElement(g.item);wn(f.writer,b,A,E)},{priority:"low"})}function c(d,u){a.on(`attribute:${u}:imageBlock`,(g,f,b)=>{if(!b.consumable.test(f.item,g.name))return;const{attributeOldValue:A,attributeNewValue:E}=f,P=b.mapper.toViewElement(f.item),z=tr(b.writer,P,d);z&&(wn(b.writer,A,E,z),b.consumable.consume(f.item,g.name))},{priority:"low"}),d==="a"&&a.on("attribute:linkHref:imageBlock",(g,f,b)=>{if(!b.consumable.consume(f.item,"attribute:htmlLinkAttributes:imageBlock"))return;const A=b.mapper.toViewElement(f.item),E=tr(b.writer,A,"a");Kt(b.writer,f.item.getAttribute("htmlLinkAttributes"),E)},{priority:"low"})}l("htmlAttributes"),c("img","htmlAttributes"),c("figure","htmlFigureAttributes"),c("a","htmlLinkAttributes")}),r.stop())})}}class VD extends q{static get requires(){return[Fe]}static get pluginName(){return"MediaEmbedElementSupport"}init(){const e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;const t=e.model.schema,n=e.conversion,i=this.editor.plugins.get(Fe),r=this.editor.plugins.get(Xn),s=e.config.get("mediaEmbed.elementName");r.registerBlockElement({model:"media",view:s}),i.on("register:figure",()=>{n.for("upcast").add(function(a){return l=>{l.on("element:figure",(c,d,u)=>{const g=d.viewItem;if(!d.modelRange||!g.hasClass("media"))return;const f=a.processViewAttributes(g,u);f&&u.writer.setAttribute("htmlFigureAttributes",f,d.modelRange)},{priority:"low"})}}(i))}),i.on(`register:${s}`,(a,l)=>{l.model==="media"&&(t.extend("media",{allowAttributes:["htmlAttributes","htmlFigureAttributes"]}),n.for("upcast").add(function(c,d){const u=(g,f,b)=>{function A(E,P){const z=c.processViewAttributes(E,b);z&&b.writer.setAttribute(P,z,f.modelRange)}A(f.viewItem,"htmlAttributes")};return g=>{g.on(`element:${d}`,u,{priority:"low"})}}(i,s)),n.for("dataDowncast").add(function(c){return d=>{function u(g,f){d.on(`attribute:${f}:media`,(b,A,E)=>{if(!E.consumable.consume(A.item,b.name))return;const{attributeOldValue:P,attributeNewValue:z}=A,j=E.mapper.toViewElement(A.item),Y=tr(E.writer,j,g);wn(E.writer,P,z,Y)})}u(c,"htmlAttributes"),u("figure","htmlFigureAttributes")}}(s)),a.stop())})}}class LD extends q{static get requires(){return[Fe]}static get pluginName(){return"ScriptElementSupport"}init(){const e=this.editor.plugins.get(Fe);e.on("register:script",(t,n)=>{const i=this.editor,r=i.model.schema,s=i.conversion;r.register("htmlScript",n.modelSchema),r.extend("htmlScript",{allowAttributes:["htmlAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"script"}),s.for("upcast").elementToElement({view:"script",model:Va(n)}),s.for("upcast").add(Vo(n,e)),s.for("downcast").elementToElement({model:"htmlScript",view:(a,{writer:l})=>Qi("script",a,l)}),s.for("downcast").add(Lo(n)),t.stop()})}}class jD extends q{static get requires(){return[Fe]}static get pluginName(){return"TableElementSupport"}init(){const e=this.editor;if(!e.plugins.has("TableEditing"))return;const t=e.model.schema,n=e.conversion,i=e.plugins.get(Fe),r=e.plugins.get("TableUtils");i.on("register:figure",()=>{n.for("upcast").add(function(s){return a=>{a.on("element:figure",(l,c,d)=>{const u=c.viewItem;if(!c.modelRange||!u.hasClass("table"))return;const g=s.processViewAttributes(u,d);g&&d.writer.setAttribute("htmlFigureAttributes",g,c.modelRange)},{priority:"low"})}}(i))}),i.on("register:table",(s,a)=>{a.model==="table"&&(t.extend("table",{allowAttributes:["htmlAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),n.for("upcast").add(function(l){return c=>{c.on("element:table",(d,u,g)=>{if(!u.modelRange)return;const f=u.viewItem;b(f,"htmlAttributes");for(const A of f.getChildren())A.is("element","thead")&&b(A,"htmlTheadAttributes"),A.is("element","tbody")&&b(A,"htmlTbodyAttributes");function b(A,E){const P=l.processViewAttributes(A,g);P&&g.writer.setAttribute(E,P,u.modelRange)}},{priority:"low"})}}(i)),n.for("downcast").add(l=>{function c(d,u){l.on(`attribute:${u}:table`,(g,f,b)=>{if(!b.consumable.test(f.item,g.name))return;const A=b.mapper.toViewElement(f.item),E=tr(b.writer,A,d);E&&(b.consumable.consume(f.item,g.name),wn(b.writer,f.attributeOldValue,f.attributeNewValue,E))})}c("table","htmlAttributes"),c("figure","htmlFigureAttributes"),c("thead","htmlTheadAttributes"),c("tbody","htmlTbodyAttributes")}),e.model.document.registerPostFixer(function(l,c){return d=>{const u=l.document.differ.getChanges();let g=!1;for(const f of u){if(f.type!="attribute"||f.attributeKey!="headingRows")continue;const b=f.range.start.nodeAfter,A=b.getAttribute("htmlTheadAttributes"),E=b.getAttribute("htmlTbodyAttributes");A&&!f.attributeNewValue?(d.removeAttribute("htmlTheadAttributes",b),g=!0):E&&f.attributeNewValue==c.getRows(b)&&(d.removeAttribute("htmlTbodyAttributes",b),g=!0)}return g}}(e.model,r)),s.stop())})}}class $D extends q{static get requires(){return[Fe]}static get pluginName(){return"StyleElementSupport"}init(){const e=this.editor.plugins.get(Fe);e.on("register:style",(t,n)=>{const i=this.editor,r=i.model.schema,s=i.conversion;r.register("htmlStyle",n.modelSchema),r.extend("htmlStyle",{allowAttributes:["htmlAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"style"}),s.for("upcast").elementToElement({view:"style",model:Va(n)}),s.for("upcast").add(Vo(n,e)),s.for("downcast").elementToElement({model:"htmlStyle",view:(a,{writer:l})=>Qi("style",a,l)}),s.for("downcast").add(Lo(n)),t.stop()})}}class HD extends q{static get requires(){return[Fe]}static get pluginName(){return"DocumentListElementSupport"}init(){const e=this.editor;if(!e.plugins.has("DocumentListEditing"))return;const t=e.model.schema,n=e.conversion,i=e.plugins.get(Fe),r=e.plugins.get("DocumentListEditing");r.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast(s,a,l){Kt(s,a,l)}}),r.registerDowncastStrategy({scope:"list",attributeName:"htmlListAttributes",setAttributeOnDowncast(s,a,l){Kt(s,a,l)}}),i.on("register",(s,a)=>{["ul","ol","li"].includes(a.view)&&(s.stop(),t.checkAttribute("$block","htmlListAttributes")||(t.extend("$block",{allowAttributes:["htmlListAttributes","htmlLiAttributes"]}),t.extend("$blockObject",{allowAttributes:["htmlListAttributes","htmlLiAttributes"]}),t.extend("$container",{allowAttributes:["htmlListAttributes","htmlLiAttributes"]}),n.for("upcast").add(l=>{l.on("element:ul",ja("htmlListAttributes",i),{priority:"low"}),l.on("element:ol",ja("htmlListAttributes",i),{priority:"low"}),l.on("element:li",ja("htmlLiAttributes",i),{priority:"low"})})))}),r.on("postFixer",(s,{listNodes:a,writer:l})=>{const c=[];for(const{node:d,previous:u}of a){if(!u)continue;const g=d.getAttribute("listIndent"),f=u.getAttribute("listIndent");let b=null;if(g>f?c[f]=u:g<f?(b=c[g],c.length=g):b=u,b){if(b.getAttribute("listType")==d.getAttribute("listType")){const A=b.getAttribute("htmlListAttributes");Si(d.getAttribute("htmlListAttributes"),A)||(l.setAttribute("htmlListAttributes",A,d),s.return=!0)}if(b.getAttribute("listItemId")==d.getAttribute("listItemId")){const A=b.getAttribute("htmlLiAttributes");Si(d.getAttribute("htmlLiAttributes"),A)||(l.setAttribute("htmlLiAttributes",A,d),s.return=!0)}}}})}afterInit(){const e=this.editor;if(!e.commands.get("indentList"))return;const t=e.commands.get("indentList");this.listenTo(t,"afterExecute",(n,i)=>{e.model.change(r=>{for(const s of i)r.setAttribute("htmlListAttributes",{},s)})})}}function ja(o,e){return(t,n,i)=>{const r=n.viewItem;n.modelRange||Object.assign(n,i.convertChildren(n.viewItem,n.modelCursor));const s=e.processViewAttributes(r,i);for(const a of n.modelRange.getItems({shallow:!0}))a.hasAttribute("listItemId")&&(a.hasAttribute(o)||i.writer.setAttribute(o,s||{},a))}}class qD extends q{static get requires(){return[Fe,Xn]}static get pluginName(){return"CustomElementSupport"}init(){const e=this.editor.plugins.get(Fe),t=this.editor.plugins.get(Xn);e.on("register:$customElement",(n,i)=>{n.stop();const r=this.editor,s=r.model.schema,a=r.conversion,l=r.editing.view.domConverter.unsafeElements,c=r.data.htmlProcessor.domConverter.preElements;s.register(i.model,i.modelSchema),s.extend(i.model,{allowAttributes:["htmlElementName","htmlAttributes","htmlContent"],isContent:!0}),a.for("upcast").elementToElement({view:/.*/,model:(d,u)=>{if(d.name=="$comment"||!function(E){try{document.createElement(E)}catch{return!1}return!0}(d.name)||t.getDefinitionsForView(d.name).size)return null;l.includes(d.name)||l.push(d.name),c.includes(d.name)||c.push(d.name);const g=u.writer.createElement(i.model,{htmlElementName:d.name}),f=e.processViewAttributes(d,u);f&&u.writer.setAttribute("htmlAttributes",f,g);const b=new Bi(d.document).createDocumentFragment(d),A=r.data.processor.toData(b);u.writer.setAttribute("htmlContent",A,g);for(const{item:E}of r.editing.view.createRangeIn(d))u.consumable.consume(E,{name:!0});return g},converterPriority:"low"}),a.for("editingDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlAttributes","htmlContent"]},view:(d,{writer:u})=>{const g=d.getAttribute("htmlElementName"),f=u.createRawElement(g);return d.hasAttribute("htmlAttributes")&&Kt(u,d.getAttribute("htmlAttributes"),f),f}}),a.for("dataDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlAttributes","htmlContent"]},view:(d,{writer:u})=>{const g=d.getAttribute("htmlElementName"),f=d.getAttribute("htmlContent"),b=u.createRawElement(g,null,(A,E)=>{E.setContentOf(A,f);const P=A.firstChild;for(P.remove();P.firstChild;)A.appendChild(P.firstChild)});return d.hasAttribute("htmlAttributes")&&Kt(u,d.getAttribute("htmlAttributes"),b),b}})})}}function*eo(o,e,t){if(e)if(!(Symbol.iterator in e)&&e.is("documentSelection")&&e.isCollapsed)o.schema.checkAttributeInSelection(e,t)&&(yield e);else for(const n of function(i,r,s){return!(Symbol.iterator in r)&&(r.is("node")||r.is("$text")||r.is("$textProxy"))?i.schema.checkAttribute(r,s)?[i.createRangeOn(r)]:[]:i.schema.getValidRanges(i.createSelection(r).getRanges(),s)}(o,e,t))yield*n.getItems({shallow:!0})}var to=(o,e,t)=>new Promise((n,i)=>{var r=l=>{try{a(t.next(l))}catch(c){i(c)}},s=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(r,s);a((t=t.apply(o,e)).next())});function Uf(o,e){let t=new URL(o);if(e&&Object.keys(e).length>0){const n=new URLSearchParams;for(const[i,r]of Object.entries(e))if(Array.isArray(r))for(const s of r)n.append(i,s);else n.append(i,r);t.search=n.toString()}return t.toString()}class UD{constructor(e,t){this.loader=e,this.api_url=t}_getUploadUrl(e,t){return to(this,null,function*(){const n=yield fetch(this.api_url+"/vi/skey",{credentials:"include"}).catch(a=>{t(a)}),i=yield n.json(),r={fileName:e.name,mimeType:e.type||"application/octet-stream",size:e.size.toString(),skey:i},s=yield fetch(Uf(this.api_url+"/vi/file/getUploadURL",r),{method:"POST",credentials:"include"}).catch(a=>{t(a)});return this.loader.uploaded=10,s})}fileUpload(e,t,n){return to(this,null,function*(){yield fetch(t.values.uploadUrl,{mode:"no-cors",method:"POST",body:e}).catch(l=>{n(l)}),this.loader.uploaded=50;const i=yield fetch(this.api_url+"/vi/skey",{credentials:"include"}).catch(l=>{n(l)}),r=yield i.json(),s={key:t.values.uploadKey,node:void 0,skelType:"leaf",skey:r},a=yield fetch(Uf(this.api_url+"/vi/file/add",s),{method:"POST",credentials:"include"}).catch(l=>{n(l)});return this.loader.uploaded=75,a})}upload(){return to(this,null,function*(){return this.loader.uploadTotal=100,this.loader.uploaded=0,this.loader.file.then(e=>to(this,null,function*(){return new Promise((t,n)=>{this._getUploadUrl(e,n).then(i=>to(this,null,function*(){const r=yield i.json();this.fileUpload(e,r,n).then(s=>to(this,null,function*(){const a=yield s.json();this.loader.uploaded=100,t({default:this.api_url+a.values.downloadUrl})}))}))})}))})}abort(){this.xhr&&this.xhr.abort()}}var Wf=D(2245),WD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Wf.Z,WD),Wf.Z.locals;class $a extends Vi{}$a.builtinPlugins=[class extends q{static get requires(){return[x2,zo,I2,a2,YE,j2]}static get pluginName(){return"Essentials"}},class extends q{static get requires(){return[Nt]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const o=this.editor.config.get("ckfinder.uploadUrl");o&&(this.editor.plugins.get(Nt).createUploadAdapter=e=>new W2(e,o,this.editor.t))}},class extends ui{constructor(){super(...arguments),this.token=null,this._tokens=new Map}static get pluginName(){return"CloudServices"}static get requires(){return[oD]}init(){return Bf(this,null,function*(){const o=this.context.config.get("cloudServices")||{};for(const[t,n]of Object.entries(o))this[t]=n;if(!this.tokenUrl)return void(this.token=null);const e=this.context.plugins.get("CloudServicesCore");this.token=yield e.createToken(this.tokenUrl).init(),this._tokens.set(this.tokenUrl,this.token)})}registerTokenUrl(o){return Bf(this,null,function*(){if(this._tokens.has(o))return this.getTokenFor(o);const e=this.context.plugins.get("CloudServicesCore"),t=yield e.createToken(o).init();return this._tokens.set(o,t),t})}getTokenFor(o){const e=this._tokens.get(o);if(!e)throw new I("cloudservices-token-not-registered",this);return e}destroy(){super.destroy();for(const o of this._tokens.values())o.destroy()}},class extends q{static get requires(){return[K2,G2]}static get pluginName(){return"Bold"}},class extends q{static get requires(){return[J2,Y2]}static get pluginName(){return"Italic"}},class extends q{static get requires(){return[tx,ox]}static get pluginName(){return"BlockQuote"}},class extends q{static get pluginName(){return"EasyImage"}static get requires(){return[ix,"ImageUpload"]}init(){const o=this.editor;o.plugins.has("ImageBlockEditing")||o.plugins.has("ImageInlineEditing")||Q("easy-image-image-feature-missing",o)}},class extends q{static get requires(){return[cx,hx]}static get pluginName(){return"Heading"}},class extends q{static get requires(){return[Bx,Ix]}static get pluginName(){return"Image"}},class extends q{static get requires(){return[Wg,i5]}static get pluginName(){return"ImageStyle"}},class extends q{static get requires(){return[qi,zt]}static get pluginName(){return"ImageToolbar"}afterInit(){const o=this.editor,e=o.t,t=o.plugins.get(qi),n=o.plugins.get("ImageUtils");var i;t.register("image",{ariaLabel:e("Image toolbar"),items:(i=o.config.get("image.toolbar")||[],i.map(r=>xe(r)?r.name:r)),getRelatedElement:r=>n.getClosestSelectedImageWidget(r)})}},class extends q{static get pluginName(){return"ImageUpload"}static get requires(){return[Ux,Ox,Fx]}},class extends q{constructor(o){super(o),this._resizeUnit=o.config.get("image.resizeUnit")}static get requires(){return[Jx]}static get pluginName(){return"ImageResizeButtons"}init(){const o=this.editor,e=o.config.get("image.resizeOptions"),t=o.commands.get("resizeImage");this.bind("isEnabled").to(t);for(const n of e)this._registerImageResizeButton(n);this._registerImageResizeDropdown(e)}_registerImageResizeButton(o){const e=this.editor,{name:t,value:n,icon:i}=o,r=n?n+this._resizeUnit:null;e.ui.componentFactory.add(t,s=>{const a=new Ae(s),l=e.commands.get("resizeImage"),c=this._getOptionLabelValue(o,!0);if(!ha[i])throw new I("imageresizebuttons-missing-icon",e,o);return a.set({label:c,icon:ha[i],tooltip:c,isToggleable:!0}),a.bind("isEnabled").to(this),a.bind("isOn").to(l,"value",Rg(r)),this.listenTo(a,"execute",()=>{e.execute("resizeImage",{width:r})}),a})}_registerImageResizeDropdown(o){const e=this.editor,t=e.t,n=o.find(r=>!r.value),i=r=>{const s=e.commands.get("resizeImage"),a=Pt(r,od),l=a.buttonView,c=t("Resize image");return l.set({tooltip:c,commandValue:n.value,icon:ha.medium,isToggleable:!0,label:this._getOptionLabelValue(n),withText:!0,class:"ck-resize-image-button",ariaLabel:c,ariaLabelledBy:void 0}),l.bind("label").to(s,"value",d=>d&&d.width?d.width:this._getOptionLabelValue(n)),a.bind("isEnabled").to(this),Vs(a,()=>this._getResizeDropdownListItemDefinitions(o,s),{ariaLabel:t("Image resize list"),role:"menu"}),this.listenTo(a,"execute",d=>{e.execute(d.source.commandName,{width:d.source.commandValue}),e.editing.view.focus()}),a};e.ui.componentFactory.add("resizeImage",i),e.ui.componentFactory.add("imageResize",i)}_getOptionLabelValue(o,e=!1){const t=this.editor.t;return o.label?o.label:e?o.value?t("Resize image to %0",o.value+this._resizeUnit):t("Resize image to the original size"):o.value?o.value+this._resizeUnit:t("Original")}_getResizeDropdownListItemDefinitions(o,e){const t=new at;return o.map(n=>{const i=n.value?n.value+this._resizeUnit:null,r={type:"button",model:new Ys({commandName:"resizeImage",commandValue:i,label:this._getOptionLabelValue(n),role:"menuitemradio",withText:!0,icon:null})};r.model.bind("isOn").to(e,"value",Rg(i)),t.add(r)}),t}},class extends q{static get pluginName(){return"Indent"}static get requires(){return[r5,s5]}},class extends q{constructor(o){super(o),o.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}init(){const o=this.editor,e=o.config.get("indentBlock");e.classes&&e.classes.length?(this._setupConversionUsingClasses(e.classes),o.commands.add("indentBlock",new Zi(o,new ep({direction:"forward",classes:e.classes}))),o.commands.add("outdentBlock",new Zi(o,new ep({direction:"backward",classes:e.classes})))):(o.data.addStyleProcessorRules(q1),this._setupConversionUsingOffset(),o.commands.add("indentBlock",new Zi(o,new Xg({direction:"forward",offset:e.offset,unit:e.unit}))),o.commands.add("outdentBlock",new Zi(o,new Xg({direction:"backward",offset:e.offset,unit:e.unit}))))}afterInit(){const o=this.editor,e=o.model.schema,t=o.commands.get("indent"),n=o.commands.get("outdent"),i=o.config.get("heading.options");(i&&i.map(r=>r.model)||a5).forEach(r=>{e.isRegistered(r)&&e.extend(r,{allowAttributes:"blockIndent"})}),e.setAttributeProperties("blockIndent",{isFormatting:!0}),t.registerChildCommand(o.commands.get("indentBlock")),n.registerChildCommand(o.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const o=this.editor.conversion,e=this.editor.locale.contentLanguageDirection==="rtl"?"margin-right":"margin-left";o.for("upcast").attributeToAttribute({view:{styles:{[e]:/[\s\S]+/}},model:{key:"blockIndent",value:t=>t.getStyle(e)}}),o.for("downcast").attributeToAttribute({model:"blockIndent",view:t=>({key:"style",value:{[e]:t}})})}_setupConversionUsingClasses(o){const e={model:{key:"blockIndent",values:[]},view:{}};for(const t of o)e.model.values.push(t),e.view[t]={key:"class",value:[t]};this.editor.conversion.attributeToAttribute(e)}},class extends q{static get requires(){return[P5,M5,V5]}static get pluginName(){return"Link"}},class extends q{static get requires(){return[sS,K5]}static get pluginName(){return"List"}},ca,class extends q{static get requires(){return[TS,RS,kn,VS,MS,zS,Mo]}static get pluginName(){return"Table"}},class extends q{static get requires(){return[qi]}static get pluginName(){return"TableToolbar"}afterInit(){const o=this.editor,e=o.t,t=o.plugins.get(qi),n=o.config.get("table.contentToolbar"),i=o.config.get("table.tableToolbar");n&&t.register("tableContent",{ariaLabel:e("Table toolbar"),items:n,getRelatedElement:$S}),i&&t.register("table",{ariaLabel:e("Table toolbar"),items:i,getRelatedElement:jS})}},class extends q{static get requires(){return["Delete","Input"]}static get pluginName(){return"TextTransformation"}constructor(o){super(o),o.config.define("typing",{transformations:{include:e2}})}init(){const o=this.editor.model.document.selection;o.on("change:range",()=>{this.isEnabled=!o.anchor.parent.is("element","codeBlock")}),this._enableTransformationWatchers()}_enableTransformationWatchers(){const o=this.editor,e=o.model,t=o.plugins.get("Delete"),n=function(r){const s=r.extra||[],a=r.remove||[],l=c=>!a.includes(c);return function(c){const d=new Set;for(const u of c)if(typeof u=="string"&&km[u])for(const g of km[u])d.add(g);else d.add(u);return Array.from(d)}(r.include.concat(s).filter(l)).filter(l).map(c=>typeof c=="string"&&fm[c]?fm[c]:c).filter(c=>typeof c=="object").map(c=>({from:t2(c.from),to:n2(c.to)}))}(o.config.get("typing.transformations")),i=new mm(o.model,r=>{for(const s of n)if(s.from.test(r))return{normalizedTransformation:s}});i.on("matched:data",(r,s)=>{if(!s.batch.isTyping)return;const{from:a,to:l}=s.normalizedTransformation,c=a.exec(s.text),d=l(c.slice(1)),u=s.range;let g=c.index;e.enqueueChange(f=>{for(let b=1;b<c.length;b++){const A=c[b],E=d[b-1];if(E==null){g+=A.length;continue}const P=u.start.getShiftedBy(g),z=e.createRange(P,P.getShiftedBy(A.length)),j=o2(P);e.insertContent(f.createText(E,j),z),g+=E.length}e.enqueueChange(()=>{t.requestUndoOnBackspace()})})}),i.bind("isEnabled").to(this)}},class extends q{static get requires(){return[Q2,X2]}static get pluginName(){return"Underline"}},class extends q{static get requires(){return[rD,sD]}static get pluginName(){return"Alignment"}},class extends q{constructor(o){super(o),this.set("isSourceEditingMode",!1),this._elementReplacer=new Cl,this._replacedRoots=new Map,this._dataFromRoots=new Map}static get pluginName(){return"SourceEditing"}static get requires(){return[Ii]}init(){const o=this.editor;o.t,o.ui.componentFactory.add("sourceEditing",e=>{const t=new Ae(e);return t.set({icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 0 5 4.5v15.003h-16V0h11zM3 1.5v3.25l-1.497 1-.003 8 1.5 1v3.254L7.685 18l-.001 1.504H17.5V8.002L16 9.428l-.004-4.22-4.222-3.692L3 1.5z"/><path d="M4.06 6.64a.75.75 0 0 1 .958 1.15l-.085.07L2.29 9.75l2.646 1.89c.302.216.4.62.232.951l-.058.095a.75.75 0 0 1-.951.232l-.095-.058-3.5-2.5V9.14l3.496-2.5zm4.194 6.22a.75.75 0 0 1-.958-1.149l.085-.07 2.643-1.89-2.646-1.89a.75.75 0 0 1-.232-.952l.058-.095a.75.75 0 0 1 .95-.232l.096.058 3.5 2.5v1.22l-3.496 2.5zm7.644-.836 2.122 2.122-5.825 5.809-2.125-.005.003-2.116zm2.539-1.847 1.414 1.414a.5.5 0 0 1 0 .707l-1.06 1.06-2.122-2.12 1.061-1.061a.5.5 0 0 1 .707 0z"/></svg>',tooltip:!0,withText:!0,class:"ck-source-editing-button"}),t.bind("isOn").to(this,"isSourceEditingMode"),t.bind("isEnabled").to(this,"isEnabled",o,"isReadOnly",o.plugins.get(Ii),"hasAny",(n,i,r)=>!!n&&!i&&!r),this.listenTo(t,"execute",()=>{this.isSourceEditingMode=!this.isSourceEditingMode}),t}),this._isAllowedToHandleSourceEditingMode()&&(this.on("change:isSourceEditingMode",(e,t,n)=>{n?(this._showSourceEditing(),this._disableCommands()):(this._hideSourceEditing(),this._enableCommands())}),this.on("change:isEnabled",(e,t,n)=>this._handleReadOnlyMode(!n)),this.listenTo(o,"change:isReadOnly",(e,t,n)=>this._handleReadOnlyMode(n))),o.data.on("get",()=>{this.isSourceEditingMode&&this.updateEditorData()},{priority:"high"})}afterInit(){const o=this.editor;["RealTimeCollaborativeEditing","CommentsEditing","TrackChangesEditing","RevisionHistory"].some(e=>o.plugins.has(e))&&console.warn("You initialized the editor with the source editing feature and at least one of the collaboration features. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the collaboration features."),o.plugins.has("RestrictedEditingModeEditing")&&console.warn("You initialized the editor with the source editing feature and restricted editing feature. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the restricted editing feature.")}updateEditorData(){const o=this.editor,e={};for(const[t,n]of this._replacedRoots){const i=this._dataFromRoots.get(t),r=n.dataset.value;i!==r&&(e[t]=r)}Object.keys(e).length&&o.data.set(e,{batchType:{isUndoable:!0}})}_showSourceEditing(){const o=this.editor,e=o.editing.view,t=o.model;t.change(n=>{n.setSelection(null),n.removeSelectionAttribute(t.document.selection.getAttributeKeys())});for(const[n,i]of e.domRoots){const r=cD(o.data.get({rootName:n})),s=br(i.ownerDocument,"textarea",{rows:"1","aria-label":"Source code editing area"}),a=br(i.ownerDocument,"div",{class:"ck-source-editing-area","data-value":r},[s]);s.value=r,s.setSelectionRange(0,0),s.addEventListener("input",()=>{a.dataset.value=s.value,o.ui.update()}),e.change(l=>{const c=e.document.getRoot(n);l.addClass("ck-hidden",c)}),o.ui.setEditableElement("sourceEditing:"+n,s),this._replacedRoots.set(n,a),this._elementReplacer.replace(i,a),this._dataFromRoots.set(n,r)}this._focusSourceEditing()}_hideSourceEditing(){const o=this.editor.editing.view;this.updateEditorData(),o.change(e=>{for(const[t]of this._replacedRoots)e.removeClass("ck-hidden",o.document.getRoot(t))}),this._elementReplacer.restore(),this._replacedRoots.clear(),this._dataFromRoots.clear(),o.focus()}_focusSourceEditing(){const o=this.editor,[e]=this._replacedRoots.values(),t=e.querySelector("textarea");o.editing.view.document.isFocused=!1,t.focus()}_disableCommands(){const o=this.editor;for(const e of o.commands.commands())e.forceDisabled(Of)}_enableCommands(){const o=this.editor;for(const e of o.commands.commands())e.clearForceDisabled(Of)}_handleReadOnlyMode(o){if(this.isSourceEditingMode)for(const[,e]of this._replacedRoots)e.querySelector("textarea").readOnly=o}_isAllowedToHandleSourceEditingMode(){const o=this.editor.ui.view.editable;return o&&!o.hasExternalElement}},class extends q{static get requires(){return[uD,dD]}static get pluginName(){return"RemoveFormat"}},class extends q{static get pluginName(){return"GeneralHtmlSupport"}static get requires(){return[Fe,ND,zD,MD,FD,VD,LD,jD,$D,HD,qD]}init(){const o=this.editor,e=o.plugins.get(Fe);e.loadAllowedConfig(o.config.get("htmlSupport.allow")||[]),e.loadDisallowedConfig(o.config.get("htmlSupport.disallow")||[])}getGhsAttributeNameForElement(o){const e=this.editor.plugins.get("DataSchema"),t=Array.from(e.getDefinitionsForView(o,!1)),n=t.find(i=>i.isInline&&!t[0].isObject);return n?n.model:"htmlAttributes"}addModelHtmlClass(o,e,t){const n=this.editor.model,i=this.getGhsAttributeNameForElement(o);n.change(r=>{for(const s of eo(n,t,i))An(r,s,i,"classes",a=>{for(const l of Pe(e))a.add(l)})})}removeModelHtmlClass(o,e,t){const n=this.editor.model,i=this.getGhsAttributeNameForElement(o);n.change(r=>{for(const s of eo(n,t,i))An(r,s,i,"classes",a=>{for(const l of Pe(e))a.delete(l)})})}setModelHtmlAttributes(o,e,t){const n=this.editor.model,i=this.getGhsAttributeNameForElement(o);n.change(r=>{for(const s of eo(n,t,i))An(r,s,i,"attributes",a=>{for(const[l,c]of Object.entries(e))a.set(l,c)})})}removeModelHtmlAttributes(o,e,t){const n=this.editor.model,i=this.getGhsAttributeNameForElement(o);n.change(r=>{for(const s of eo(n,t,i))An(r,s,i,"attributes",a=>{for(const l of Pe(e))a.delete(l)})})}setModelHtmlStyles(o,e,t){const n=this.editor.model,i=this.getGhsAttributeNameForElement(o);n.change(r=>{for(const s of eo(n,t,i))An(r,s,i,"styles",a=>{for(const[l,c]of Object.entries(e))a.set(l,c)})})}removeModelHtmlStyles(o,e,t){const n=this.editor.model,i=this.getGhsAttributeNameForElement(o);n.change(r=>{for(const s of eo(n,t,i))An(r,s,i,"styles",a=>{for(const l of Pe(e))a.delete(l)})})}}],$a.defaultConfig={extraPlugins:[function(o){o.plugins.get("FileRepository").createUploadAdapter=e=>new UD(e,o.config.get("viur_api_url"))},function(o){o.conversion.attributeToElement({model:"bold",view:"b",upcastAlso:[e=>{const t=e.getStyle("font-weight");return t&&(t=="bold"||Number(t)>=600)?{name:!0,styles:["font-weight"]}:null}]})}],toolbar:{items:["heading","|","bold","italic","underline","|","alignment","numberedList","bulletedList","blockQuote","|","indent","outdent","|","link","insertTable","imageUpload","|","undo","redo","RemoveFormat","sourceEditing"]},image:{toolbar:["imageStyle:inline","imageStyle:block","imageStyle:side","|","resizeImage:50","resizeImage:75","resizeImage:original","imageTextAlternative"],resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]},table:{contentToolbar:["tableColumn","tableRow","mergeTableCells"]},heading:{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h1",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h2",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h3",title:"Heading 3",class:"ck-heading_heading3"},{model:"heading4",view:"h4",title:"Heading 4",class:"ck-heading_heading4"},{model:"heading5",view:"h5",title:"Heading 5",class:"ck-heading_heading5"},{model:"heading6",view:"h6",title:"Heading 6",class:"ck-heading_heading6"}]},alignment:{options:[{name:"left",className:"viur-txt-align--left"},{name:"right",className:"viur-txt-align--right"},{name:"center",className:"viur-txt-align--center"},{name:"justify",className:"viur-txt-align--justify"}]},indentBlock:{classes:["viur-txt-indent--1","viur-txt-indent--2","viur-txt-indent--3","viur-txt-indent--4","viur-txt-indent--5","viur-txt-indent--6","viur-txt-indent--7","viur-txt-indent--8","viur-txt-indent--9","viur-txt-indent--10"]},htmlSupport:{allow:[{name:"a",attributes:{target:!0,rel:!0}}]},language:"de",viur_api_url:"http://localhost:8080"}})(),M=M.default})())}(Wo,Wo.exports);var Kw=Wo.exports;const rl=Ww(Kw),Gw=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value:"",editorConfig:{},editor:h.computed(()=>rl)});function D(S){x.emit("change",m.name,N.value,m.lang,m.index)}function M(S){N.value=S.target.value,x.emit("change",m.name,N.value,m.lang,m.index)}h.onMounted(()=>{m.value!==null&&(N.value=m.value),x.emit("change",m.name,m.value,m.lang,m.index)});function w(S){S.editing.view.change(p=>{p.setStyle("min-height","250px",S.editing.view.document.getRoot())})}return h.watch(()=>m.value,(S,p)=>{N.value=S}),{state:N,ClassicEditor:rl,boneState:C,changeEvent:D,onReady:w,changeEventTextarea:M}}}),Zw=["disabled","value"];function Jw(m,x,C,N,D,M){var S,p,y,B;const w=h.resolveComponent("ckeditor");return m.state.editor?(h.openBlock(),h.createElementBlock(h.Fragment,{key:0},[(S=m.boneState.bonestructure)!=null&&S.valid_html||(p=m.boneState.bonestructure)!=null&&p.validHtml?(h.openBlock(),h.createBlock(w,{key:0,modelValue:m.state.value,"onUpdate:modelValue":x[0]||(x[0]=v=>m.state.value=v),editor:m.state.editor,config:m.state.editorConfig,disabled:(y=m.boneState)==null?void 0:y.readonly,onReady:m.onReady,onInput:m.changeEvent},null,8,["modelValue","editor","config","disabled","onReady","onInput"])):(h.openBlock(),h.createElementBlock("sl-textarea",{key:1,disabled:(B=m.boneState)==null?void 0:B.readonly,value:m.value,onInput:x[1]||(x[1]=(...v)=>m.changeEventTextarea&&m.changeEventTextarea(...v))},null,40,Zw))],64)):h.createCommentVNode("",!0)}const sl=de(Gw,[["render",Jw]]),Yw=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({valueLat:null,valueLng:null});function D(){x.emit("change",m.name,[N.valueLat,N.valueLng],m.lang,m.index)}return h.onMounted(()=>{try{N.valueLat=m.value[0],N.valueLng=m.value[1]}catch{}x.emit("change",m.name,[N.valueLat,N.valueLng],m.lang,m.index)}),{state:N,boneState:C,changeEvent:D}}}),Qw=["name","min","max","disabled"],Xw=["name","min","max","disabled"];function eA(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock(h.Fragment,null,[h.withDirectives(h.createElementVNode("sl-input",{"onUpdate:modelValue":x[0]||(x[0]=w=>m.state.valueLat=w),index:"lat",type:"number",name:m.name,min:m.boneState.bonestructure.boundslat[0],max:m.boneState.bonestructure.boundslat[1],disabled:m.boneState.readonly,"value-as-number":"",step:"0.000001",onSlChange:x[1]||(x[1]=(...w)=>m.changeEvent&&m.changeEvent(...w)),placeholder:"Lat"},null,40,Qw),[[h.vModelText,m.state.valueLat]]),h.withDirectives(h.createElementVNode("sl-input",{"onUpdate:modelValue":x[2]||(x[2]=w=>m.state.valueLng=w),index:"lng",type:"number",name:m.name,min:m.boneState.bonestructure.boundslat[0],max:m.boneState.bonestructure.boundslat[1],disabled:m.boneState.readonly,"value-as-number":"",step:"0.000001",onSlChange:x[3]||(x[3]=(...w)=>m.changeEvent&&m.changeEvent(...w)),placeholder:"Long"},null,40,Xw),[[h.vModelText,m.state.valueLng]])],64)}const al=de(Yw,[["render",eA],["__scopeId","data-v-7bc31020"]]),tA=h.defineComponent({props:{name:String,value:Object,index:Number,lang:String,readonly:Boolean,params:Object},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({counter:0,debounce:null}),D=h.inject("addMultipleEntry"),M=h.inject("removeMultipleEntries");function w(){N.counter+=1;let p=200;N.counter>1&&(p=500),N.debounce&&clearTimeout(N.debounce),N.debounce=setTimeout(()=>{for(let y=N.counter;y--;)D(m.lang);N.counter=0},p)}function S(){let p=200;N.debounce&&clearTimeout(N.debounce),N.debounce=setTimeout(()=>{M(m.lang)},p)}return h.onMounted(()=>{(!m.value||m.value.length===0)&&x.emit("change",m.name,[],m.lang)}),{state:N,boneState:C,handleAdd:w,handleRemove:S,removeMultipleEntries:M}}}),ll=m=>(h.pushScopeId("data-v-63e75dee"),m=m(),h.popScopeId(),m),nA={class:"actionbar"},oA=["title"],iA=[ll(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"x-lg"},null,-1))],rA=["title"],sA=ll(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"plus-lg"},null,-1));function aA(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("div",nA,[m.boneState.multiple&&!m.readonly?(h.openBlock(),h.createElementBlock("sl-button",{key:0,variant:"danger",title:m.$t("bone.del"),outline:"",class:"delete-btn",onClick:x[0]||(x[0]=w=>m.handleRemove(m.lang))},iA,8,oA)):h.createCommentVNode("",!0),m.boneState.multiple&&!m.readonly?(h.openBlock(),h.createElementBlock("sl-button",{key:1,variant:"success",title:m.$t("bone.add"),outline:"",class:"add-btn",onClick:x[1]||(x[1]=w=>m.handleAdd(m.lang))},[sA,h.createTextVNode(" "+h.toDisplayString(m.$t("bone.add"))+" ",1),m.state.counter>1?(h.openBlock(),h.createElementBlock(h.Fragment,{key:0},[h.createTextVNode("("+h.toDisplayString(m.state.counter)+")",1)],64)):h.createCommentVNode("",!0)],8,rA)):h.createCommentVNode("",!0)])}const lA=de(tA,[["render",aA],["__scopeId","data-v-63e75dee"]]);var cA={VITE_API_URL:"",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const dA=h.defineComponent({props:{name:String,value:Object,index:Number,lang:String,readonly:Boolean,params:Object},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.inject("addMultipleEntry"),D=h.inject("formatString"),M=null,w=h.reactive({skels:{},hasUsing:h.computed(()=>C==null?void 0:C.bonestructure.using)});function S(p){let y="";return C.bonestructure.type==="relational.tree.leaf.file"?y="skelType=leaf&":C.bonestructure.type==="relational.tree.node.file"&&(y="skelType=node&"),we.get(`/${cA.VITE_DEFAULT_RENDERER||"vi"}/${C.bonestructure.module}/list?${y}limit=99`).then(async B=>{var k;const v=await B.json();return w.skels=v.skellist.reduce((_,R)=>(_[R.key]=R,_),{}),(k=v.skellist)==null?void 0:k.map(_=>({text:D(C.bonestructure.format,{dest:_}),value:_.key,data:_}))})}return h.onMounted(()=>{(!m.value||m.value.length===0)&&x.emit("change",m.name,[],m.lang)}),{state:w,boneState:C,addMultipleEntry:N,removeMultipleEntries:M,getList:S}}}),cl=m=>(h.pushScopeId("data-v-eeea51c6"),m=m(),h.popScopeId(),m),hA={class:"actionbar"},uA=["title"],mA=[cl(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"x-lg"},null,-1))],gA=["source"],pA=["title"],fA=cl(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"plus-lg"},null,-1));function kA(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("div",hA,[m.boneState.multiple&&!m.readonly?(h.openBlock(),h.createElementBlock("sl-button",{key:0,variant:"danger",title:m.$t("bone.del"),outline:"",class:"delete-btn",onClick:x[0]||(x[0]=w=>m.openSelector())},mA,8,uA)):h.createCommentVNode("",!0),h.createElementVNode("sl-combobox",{source:m.getList,hoist:"",onSlItemSelect:x[1]||(x[1]=w=>{var S;return m.addMultipleEntry(m.lang,{dest:(S=m.state.skels)==null?void 0:S[w.detail.item.value],rel:m.state.hasUsing?void 0:null})})},null,40,gA),m.boneState.multiple&&!m.readonly?(h.openBlock(),h.createElementBlock("sl-button",{key:1,variant:"success",title:m.$t("bone.add"),outline:"",class:"add-btn",onClick:x[2]||(x[2]=w=>m.addMultipleEntry(m.lang))},[fA,h.createTextVNode(" "+h.toDisplayString(m.$t("bone.list")),1)],8,pA)):h.createCommentVNode("",!0)])}const bA=de(dA,[["render",kA],["__scopeId","data-v-eeea51c6"]]);var dl={VITE_API_URL:"",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const wA=h.defineComponent({props:{name:String,value:Object,index:Number,lang:String,readonly:Boolean,params:Object},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.inject("addMultipleEntry");h.inject("formatString");const D=null,M=h.ref(),w=h.reactive({skels:{},uploadinput:null,loading:!1,droparea:!1,hasUsing:h.computed(()=>C==null?void 0:C.bonestructure.using)});function S(B){const v={fileName:B.name,mimeType:B.type||"application/octet-stream",size:B.size.toString()};return new Promise((k,_)=>{we.securePost(`/${dl.VITE_DEFAULT_RENDERER||"vi"}/file/getUploadURL`,{dataObj:v}).then(async R=>{let T=await R.json();fetch(T.values.uploadUrl,{body:B,method:"POST",mode:"no-cors"}).then(async O=>{const F={key:T.values.uploadKey,node:void 0,skelType:"leaf"};we.securePost(`/${dl.VITE_DEFAULT_RENDERER||"vi"}/file/add`,{dataObj:F}).then(async L=>{let $=await L.json();$.action==="addSuccess"?k($.values):_($)}).catch(L=>{_(L)})}).catch(O=>{_(O)})}).catch(R=>{_(R)})})}async function p(B){w.loading=!0;for(let v of B.target.files){let k=await S(v);M.value.value=null;let _=null;w.hasUsing&&(_=void 0),N(m.lang,{dest:k,rel:_})}w.loading=!1}async function y(B){w.loading=!0,w.droparea=!1;for(let v of B.dataTransfer.files){let k=await S(v);M.value.value=null;let _=null;w.hasUsing&&(_=void 0),N(m.lang,{dest:k,rel:_})}w.loading=!1}return h.onMounted(()=>{(!m.value||m.value.length===0)&&x.emit("change",m.name,[],m.lang)}),{state:w,boneState:C,addMultipleEntry:N,removeMultipleEntries:D,uploadFile:S,uploadinput:M,handleUpload:p,handleDrop:y}}}),cr=m=>(h.pushScopeId("data-v-9bac9f8a"),m=m(),h.popScopeId(),m),AA=["title"],_A=[cr(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"x-lg"},null,-1))],CA={key:1,class:"droparea"},vA=["multiple"],yA=["title"],EA=[cr(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"plus-lg"},null,-1))],xA=["title"],SA=cr(()=>h.createElementVNode("sl-icon",{name:"upload"},null,-1)),DA={key:0,slot:"suffix"};function BA(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("div",{class:"actionbar",onDragover:x[4]||(x[4]=h.withModifiers(w=>m.state.droparea=!0,["prevent"])),onDragleave:x[5]||(x[5]=w=>m.state.droparea=!1),onDrop:x[6]||(x[6]=h.withModifiers((...w)=>m.handleDrop&&m.handleDrop(...w),["prevent"]))},[m.boneState.multiple&&!m.readonly?(h.openBlock(),h.createElementBlock("sl-button",{key:0,variant:"danger",title:m.$t("bone.del"),outline:"",class:"delete-btn",onClick:x[0]||(x[0]=w=>m.openSelector())},_A,8,AA)):h.createCommentVNode("",!0),m.state.droparea?(h.openBlock(),h.createElementBlock("div",CA," Dateien hier hinziehen ")):h.createCommentVNode("",!0),h.createElementVNode("input",{ref:"uploadinput",hidden:"",type:"file",multiple:m.boneState.multiple,onChange:x[1]||(x[1]=(...w)=>m.handleUpload&&m.handleUpload(...w))},null,40,vA),m.boneState.multiple&&!m.readonly?(h.openBlock(),h.createElementBlock("sl-button",{key:2,outline:"",title:m.$t("bone.list"),class:"add-btn",onClick:x[2]||(x[2]=w=>m.addMultipleEntry(m.lang))},EA,8,yA)):h.createCommentVNode("",!0),m.boneState.multiple&&!m.readonly?(h.openBlock(),h.createElementBlock("sl-button",{key:3,variant:"success",outline:"",title:m.$t("bone.upload"),class:"upload-btn",onClick:x[3]||(x[3]=w=>m.uploadinput.click())},[SA,h.createTextVNode(" "+h.toDisplayString(m.$t("bone.upload"))+" ",1),m.state.loading?(h.openBlock(),h.createElementBlock("sl-spinner",DA)):h.createCommentVNode("",!0)],8,xA)):h.createCommentVNode("",!0)],32)}const TA=de(wA,[["render",BA],["__scopeId","data-v-9bac9f8a"]]),dr=or.defineStore("boneStore",()=>{const m=h.reactive({additionalBones:h.shallowRef({}),defaultBones:h.shallowRef({rawBone:ar,keyBone:Ua,stringBone:Wa,emailBone:Ka,dateBone:Ga,booleanBone:Ja,selectBone:Za,passwordBone:Ya,recordBone:Xa,numericBone:tl,colorBone:el,relationalBone:nl,jsonBone:xw,fileBone:il,textBone:sl,spatialBone:al}),actionbars:h.shallowRef({"relational.tree.leaf.file.file":TA,"relational.":bA}),multibones:h.shallowRef(["select","select."])});function x(w,S){m.additionalBones[w]=S}function C(){let w=m.defaultBones;for(const[S,p]of Object.entries(m.additionalBones))w.add(p);return w}function N(w){if(Object.keys(m.additionalBones).includes(w))return m.additionalBones[w];{let S=w.split("."),p=Object.entries(m.additionalBones).filter(y=>y[0].startsWith(S[0]+"."));if(p.length>0){p.sort((y,B)=>B.length-y.length);for(let y of p)if(w.startsWith(y[0]))return m.additionalBones[y[0]]}}return w==="date"?Ga:w==="key"?Ua:w==="str.email"?Ka:w==="str"||w.startsWith("str.")?Wa:w==="select"||w.startsWith("select.")?Za:w==="bool"?Ja:w==="password"?Ya:w==="record"?Xa:w==="numeric"||w.startsWith("numeric.")?tl:w==="relational.tree.leaf.file.file"?il:w==="relational"||w.startsWith("relational.")?nl:w==="color"?el:w==="text"?sl:w==="spatial"?al:ar}function D(w,S){m.actionbars[w]=S}function M(w){if(Object.keys(m.actionbars).includes(w))return m.actionbars[w];{let S=w.split("."),p=Object.entries(m.actionbars).filter(y=>y[0].startsWith(S[0]+"."));if(p.length>0){p.sort((y,B)=>B.length-y.length);for(let y of p)if(w.startsWith(y[0]))return m.actionbars[y[0]]}}return lA}return{state:m,addBoneWidget:x,getBoneWidget:N,importWidgets:C,addBoneActionbar:D,getBoneActionbar:M}});function IA(m){return dr().getBoneActionbar(m)}function Jt(m){return dr().getBoneWidget(m)}function PA(m){const x=dr();if(x.state.multibones.includes(m))return!0;{let C=m.split("."),N=Object.entries(x.state.multibones).filter(D=>D[1].startsWith(C[0]+"."));if(N.length>0){N.sort((D,M)=>M.length-D.length);for(let D of N)if(m.startsWith(D[1]))return!0}}return!1}const hr=m=>(h.pushScopeId("data-v-25f20336"),m=m(),h.popScopeId(),m),RA=hr(()=>h.createElementVNode("h2",{class:"viur-shop-form-headline headline"},"Nutzterdaten",-1)),OA=hr(()=>h.createElementVNode("h2",{class:"viur-shop-form-headline headline"},"Lieferadresse",-1)),NA={key:0},zA=hr(()=>h.createElementVNode("h2",{class:"viur-shop-form-headline headline"},"Rechnungsadresse",-1)),MA=de({__name:"UserInformation",props:{mode:{type:String,default:"form"},conditions:{type:Function}},setup(m){const x=vn(),C=h.reactive({formValues:{},requiredFieldsFilled:h.computed(()=>{if(C.isCustomAdress)return Object.keys(C.formValues).includes("city")&&Object.keys(C.formValues).includes("street")&&Object.keys(C.formValues).includes("billing.city")&&Object.keys(C.formValues).includes("billing.street")&&Object.keys(C.formValues).includes("email")&&Object.keys(C.formValues).includes("firstname")&&Object.keys(C.formValues).includes("lastname");if(!C.isCustomAdress)return Object.keys(C.formValues).includes("city")&&Object.keys(C.formValues).includes("street")&&Object.keys(C.formValues).includes("email")&&Object.keys(C.formValues).includes("firstname")&&Object.keys(C.formValues).includes("lastname")}),isCustomAdress:!1,addSkel:null,errors:{}});function N(w){w.target.checked&&(C.isCustomAdress=!1),w.target.checked||(C.isCustomAdress=!0)}function D(w,S){for(const[p,y]of Object.entries(S.value[0]))C.formValues[p]=y}function M(w){let S={};return w.forEach(p=>{let y=p[0],B=p[1];S[y]=B}),S}return h.watch(C.formValues,w=>{Object.entries(w).forEach(([S,p])=>{p===""&&delete C.formValues[S]})}),h.onBeforeMount(async()=>{await x.getAdressStructure(),C.addSkel=x.state.structure.address}),(w,S)=>{const p=h.resolveComponent("bone");return h.openBlock(),h.createElementBlock(h.Fragment,null,[h.createElementVNode("div",null,[RA,(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(C.addSkel,y=>(h.openBlock(),h.createElementBlock(h.Fragment,{key:y[0]},[y[1].visible&&y[1].params.group==="Customer Info"?(h.openBlock(),h.createBlock(p,{key:0,is:h.unref(Jt)(y[1].type),name:y[0],structure:M(C.addSkel),errors:C.errors[y[0]]?C.errors[y[0]]:[],skel:C.formValues,onChange:B=>D(y[0],B),class:"viur-shop-form-grid-w-2"},null,8,["is","name","structure","errors","skel","onChange"])):h.createCommentVNode("",!0)],64))),128))]),h.createElementVNode("div",null,[OA,(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(C.addSkel,y=>(h.openBlock(),h.createElementBlock(h.Fragment,{key:y[0]},[y[1].visible&&y[1].params.group==="Customer Address"?(h.openBlock(),h.createBlock(p,{key:0,is:h.unref(Jt)(y[1].type),name:y[0],structure:M(C.addSkel),errors:C.errors[y[0]]?C.errors[y[0]]:[],skel:C.formValues,onChange:B=>D(y[0],B)},null,8,["is","name","structure","errors","skel","onChange"])):h.createCommentVNode("",!0)],64))),128))]),C.isCustomAdress?(h.openBlock(),h.createElementBlock("div",NA,[zA,(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(C.addSkel,y=>(h.openBlock(),h.createElementBlock(h.Fragment,{key:y[0]},[y[1].visible&&y[1].params.group==="Customer Address"?(h.openBlock(),h.createBlock(p,{key:0,is:h.unref(Jt)(y[1].type),name:y[0],structure:M(C.addSkel),errors:C.errors[y[0]]?C.errors[y[0]]:[],skel:C.formValues,onChange:B=>D(y[0],B)},null,8,["is","name","structure","errors","skel","onChange"])):h.createCommentVNode("",!0)],64))),128))])):h.createCommentVNode("",!0),h.createElementVNode("sl-checkbox",{onSlChange:N,checked:""}," Rechnungsadresse wie Lieferadresse ",32)],64)}}},[["__scopeId","data-v-25f20336"]]),FA=h.defineComponent({props:{isDragging:Boolean,draggingLineBottom:Boolean,draggingLineTop:Boolean},components:{},emits:["change","delete","handleDragStart","handleDragEnd","handleDragOver","handleDrop"],setup(m,x){const C=h.inject("boneState");return{state:h.reactive({isDraggable:!1}),boneState:C}}}),hl=m=>(h.pushScopeId("data-v-141aaf9b"),m=m(),h.popScopeId(),m),VA=["draggable"],LA=["disabled"],jA=[hl(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"grip-vertical"},null,-1))],$A={class:"value"},HA=["disabled","title"],qA=[hl(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"x-lg"},null,-1))];function UA(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("div",{class:h.normalizeClass(["value-line",{"is-dragging":m.isDragging,"dragging-line-bottom":m.draggingLineBottom,"dragging-line-top":m.draggingLineTop}]),draggable:m.state.isDraggable,onDragover:x[2]||(x[2]=w=>m.$emit("handleDragOver",w)),onDrop:x[3]||(x[3]=w=>m.$emit("handleDrop",w)),onDragstart:x[4]||(x[4]=w=>m.$emit("handleDragStart",w)),onDragend:x[5]||(x[5]=w=>m.$emit("handleDragEnd"))},[h.createElementVNode("sl-button",{disabled:m.boneState.readonly,class:"drag-button",onMousedown:x[0]||(x[0]=w=>m.state.isDraggable=!0)},jA,40,LA),h.createElementVNode("div",$A,[h.renderSlot(m.$slots,"default",{},void 0,!0)]),h.createElementVNode("sl-button",{variant:"danger",disabled:m.boneState.readonly,outline:"",title:m.$t("bone.del"),class:"delete-btn",onClick:x[1]||(x[1]=w=>m.$emit("delete"))},qA,8,HA)],42,VA)}const WA=de(FA,[["render",UA],["__scopeId","data-v-141aaf9b"]]),KA=h.defineComponent({props:{name:String,value:Object,index:Number,lang:String,readonly:Boolean,params:Object},components:{},emits:["change","handleClick"],setup(m,x){const C=h.inject("boneState");return{state:h.reactive({debug:!1}),boneState:C}}}),GA={class:"bone-name"},ZA={key:0},JA={class:"bone"};function YA(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock(h.Fragment,null,[h.createElementVNode("label",GA,[h.renderSlot(m.$slots,"default",{},void 0,!0),h.createCommentVNode("",!0)]),m.state.debug?(h.openBlock(),h.createElementBlock("div",ZA,[h.createElementVNode("div",JA,h.toDisplayString(m.name),1),h.createElementVNode("pre",null," "+h.toDisplayString(m.boneState)+`
|
|
6530
|
-
`,1)])):h.createCommentVNode("",!0)],64)}const QA=de(KA,[["render",YA],["__scopeId","data-v-b7149172"]]),XA=h.defineComponent({inheritAttrs:!1,emits:["change","change-internal","handleClick"],components:{wrapperMultiple:WA,BoneLabel:QA},props:{is:{type:Object,default:ar},name:{type:String,required:!0},languages:Array,multiple:Boolean,readonly:Boolean,required:Boolean,params:Object,value:[Object,String,Number,Boolean,Array],structure:{type:Object,required:!0},skel:{type:null,required:!0},errors:Object,showLabelInfo:{type:Boolean,required:!1,default:!1},autofocus:{type:Boolean,required:!1,default:!1}},setup(m,x){const C=h.reactive({bonestructure:h.computed(()=>{var T;return(T=m.structure)==null?void 0:T[m.name]}),bonevalue:null,dragStartIndex:{lang:null,index:Number},dropIndex:{lang:null,index:Number},draggingLineBottom:{lang:String,index:Number},draggingLineTop:{lang:String,index:Number},isDragging:{lang:String,index:Number},multilanguage:h.computed(()=>{var T;return((T=C.languages)==null?void 0:T.length)&&C.languages.length>0}),languages:h.computed(()=>m.languages?m.languages:C.bonestructure&&Object.keys(C.bonestructure).includes("languages")?C.bonestructure.languages:[]),readonly:h.computed(()=>m.readonly?m.readonly:C.bonestructure&&Object.keys(C.bonestructure).includes("readonly")?C.bonestructure.readonly:!1),required:h.computed(()=>m.required?m.required:C.bonestructure&&Object.keys(C.bonestructure).includes("required")?C.bonestructure.required:!1),hasTooltip:h.computed(()=>!!(C.bonestructure&&Object.keys(C.bonestructure.params).includes("tooltip"))),multiple:h.computed(()=>m.multiple?m.multiple:C.bonestructure&&Object.keys(C.bonestructure).includes("multiple")?C.bonestructure.multiple:!1),params:h.computed(()=>m.params?m.params:C.bonestructure&&Object.keys(C.bonestructure).includes("params")?C.bonestructure.params:{}),actionbar:h.computed(()=>{var T;return IA((T=C.bonestructure)==null?void 0:T.type)}),isEmpty:h.computed(()=>{function T(O){for(const[F,L]of Object.entries(O))if(L!==null){if(Array.isArray(L)&&L.length>0)return!1;if(!Array.isArray(L))return!1}return!0}return C.readonly?!1:!C.bonevalue||Array.isArray(C.bonevalue)&&C.bonevalue.length===0?!0:C.bonevalue===Object(C.bonevalue)&&!Array.isArray(C.bonevalue)?T(C.bonevalue):!1}),errors:[],errorMessages:h.computed(()=>{let T=[];for(let O of m.errors)O.fieldPath[0]===m.name&&(O.severity>2||C.required&&(O.severity===2||O.severity===0))&&T.push(O.errorMessage);return T})});h.provide("boneState",C);function N(T,O,F){w(O,T,"isDragging"),w(O,T,"dragStartIndex")}function D(T,O,F){F.preventDefault();const L=F.clientY-F.target.getBoundingClientRect().top,$=F.target.closest(".value-line");L<$.offsetHeight/2?(w(O,T,"draggingLineTop"),S("draggingLineBottom"),C.dropIndex.index=T):(w(O,T,"draggingLineBottom"),S("draggingLineTop"),C.dropIndex.index=T+1);let K=O?C.bonevalue[O]:C.bonevalue;C.dropIndex.index>K.length-1&&(C.dropIndex.index-=1)}function M(T,O,F){let L=null;C.dragStartIndex.index!==C.dropIndex.index&&(O?(L=C.bonevalue[O].splice(C.dragStartIndex.index,1)[0],C.bonevalue[O].splice(C.dropIndex.index,0,L)):(L=C.bonevalue.splice(C.dragStartIndex.index,1)[0],C.bonevalue.splice(C.dropIndex.index,0,L)),console.dir(C.bonevalue[0]),x.emit("change",{name:m.name,value:y(),lang:O,index:T})),S("draggingLineBottom","draggingLineTop","isDragging","dragStartIndex","dropIndex")}function w(T,O,F){C[F].lang=T||null,C[F].index=O}function S(...T){T.forEach(O=>{C[O]={lang:null,index:Number}})}function p(T,O,F=null,L=null,$){if(O===void 0||(F?(C.bonevalue||(C.bonevalue={}),Object.keys(C.bonevalue).includes(F)&&L!==null?C.bonevalue[F][L]=O:C.bonevalue[F]=O):L!==null?C.bonevalue[L]=O:$===!1||(C.bonevalue=O),C.readonly))return!1;let K={name:T,value:y(),lang:F,index:L},J={name:T,value:O,lang:F,index:L};$!=null&&(K.pwMatch=$,J.pwMatch=$),x.emit("change",K),x.emit("change-internal",J)}function y(){function T(F,L=null){let $=[];if(Array.isArray(F))if(C.bonestructure.type=="spatial"&&F.length===2&&!Array.isArray(F[0]))$.push({[L+".lat"]:F[0]}),$.push({[L+".lng"]:F[1]});else if(Object.values(F).filter(K=>K===Object(K)).length>0)for(const[K,J]of F.entries())J.rel!==null?$.push(T(J,L+"."+K)):$.push(T(J,L));else for(const[K,J]of F.entries())$.push(T(J,L));else if(F===Object(F))for(const[K,J]of Object.entries(F))L?L.endsWith(".dest")||L.endsWith(".rel")?L.endsWith(".dest")&&K==="key"?(/\.[0-9]*\.dest$/.test(L)?$.push(T(J,L.replace(/\.[0-9]*\.dest/,""))):$.push(T(J,L.replace(/\.dest/,""))),$.push(T(J,L.replace(/\.dest/,"")+"."+K))):L.endsWith(".rel")&&$.push(T(J,L.replace(/\.rel/,"")+"."+K)):$.push(T(J,L+"."+K)):$.push(T(J,K));else F==null&&(F=""),L!==null&&$.push({[L]:F});return $}let O=T(C.bonevalue,m.name);return O=O.flat(10),O}function B(T=null,O=""){T?Object.keys(C.bonevalue).includes(T)?C.bonevalue[T].push(O):C.bonevalue[T]=[O]:C.bonevalue?C.bonevalue.push(O):C.bonevalue=[O]}h.provide("addMultipleEntry",B);function v(T,O=null){var F;O?(F=C.bonevalue)==null||F[O].splice(T,1):C.bonevalue.splice(T,1),x.emit("change",{name:m.name,value:y(),lang:O,index:T}),x.emit("change-internal",{name:m.name,value:y(),lang:O,index:T})}function k(T=null){var O;T?(O=C.bonevalue)==null||O[T].splice(0):C.bonevalue.splice(0),x.emit("change",{name:m.name,value:y(),lang:T}),x.emit("change-internal",{name:m.name,value:y(),lang:T})}h.provide("removeMultipleEntries",k);function _(T=null,O=""){B(T,O)}function R(T,O){function F(J){let te=[],Z=[],ee=/\$\((.*?)\)/g;for(;Z;){if(Z=ee.exec(J),!Z){Z=!1;continue}te.push(Z[1])}return te}function L(J,te){let Z=J.split("."),ee=J.split("."),I=te;for(let Q of Z)if(ee.shift(),I&&I!=="-"&&Object.keys(I).includes(Q)&&I[Q])if(Array.isArray(I[Q])){let _e=[];for(let Se of I[Q])_e.push(L(ee.join("."),Se));I=_e.join(", ")}else I=I[Q];else(!I||typeof I[Q]=="object"&&!I[Q])&&(I="-");return I}let $=F(T),K=[];Array.isArray(O)||(O=[O]);for(let J of O){let te=T;for(let Z of $){let ee=L(Z,J);te=te.replace("$("+Z+")",ee)}K.push(te)}return K.join(", ")}return h.provide("formatString",R),h.onBeforeMount(()=>{var T;m.value?C.bonevalue=m.value:C.bonevalue=(T=m.skel)==null?void 0:T[m.name]}),h.watch(()=>m.skel,(T,O)=>{var F;C.bonevalue=(F=m.skel)==null?void 0:F[m.name]}),h.watch(()=>{var T;return(T=m.errors)==null?void 0:T[m.name]},(T,O)=>{C.errors=m.errors}),{state:C,updateValue:p,addMultipleEntry:B,removeMultipleEntry:v,removeMultipleEntries:k,BoneHasMultipleHandling:PA,multipleBonePressEnter:_,handleDragStart:N,handleDragOver:D,handleDrop:M,setStateProperties:w,resetStateProperties:S}}}),so=m=>(h.pushScopeId("data-v-dee63f3c"),m=m(),h.popScopeId(),m),e0={key:0,class:"required"},t0=["content"],n0=[so(()=>h.createElementVNode("div",{class:"tooltip"},[h.createElementVNode("sl-icon",{name:"question"})],-1))],o0={key:0,variant:"info",open:"",class:"label-info"},i0=so(()=>h.createElementVNode("sl-icon",{slot:"icon",library:"bootstrap",name:"info-circle-fill"},null,-1)),r0={class:"bone-inner-wrap"},s0={key:0,class:"lang-tab",placement:"bottom"},a0=["panel"],l0=["name"],c0=[so(()=>h.createElementVNode("sl-input",{readonly:"",size:"medium",placeholder:"Keine Einträge"},null,-1))],d0={key:1,class:"multiple-placeholder"},h0=[so(()=>h.createElementVNode("sl-input",{readonly:"",size:"medium",placeholder:"Keine Einträge"},null,-1))],u0={open:"",summary:"Errors",variant:"info"},m0=so(()=>h.createElementVNode("sl-icon",{slot:"icon",name:"exclamation-triangle"},null,-1)),g0={class:"error-msg"};function p0(m,x,C,N,D,M){var p;const w=h.resolveComponent("bone-label"),S=h.resolveComponent("wrapper-multiple");return h.openBlock(),h.createElementBlock("div",{class:h.normalizeClass(["bone-wrapper",(""+m.state.bonestructure.type.split(".")[0],{"has-subbones":m.state.bonestructure.using})])},[h.createVNode(w,{name:m.name},{default:h.withCtx(()=>[h.createElementVNode("span",{class:h.normalizeClass({required:m.state.required})},h.toDisplayString(m.state.bonestructure.descr),3),m.state.required?(h.openBlock(),h.createElementBlock("span",e0," *")):h.createCommentVNode("",!0),m.state.hasTooltip&&!m.showLabelInfo?(h.openBlock(),h.createElementBlock("sl-tooltip",{key:1,content:m.state.bonestructure.params.tooltip,placement:"top-center"},n0,8,t0)):h.createCommentVNode("",!0)]),_:1},8,["name"]),m.showLabelInfo&&m.state.hasTooltip?(h.openBlock(),h.createElementBlock("sl-alert",o0,[i0,h.createTextVNode(" "+h.toDisplayString(m.state.bonestructure.params.tooltip),1)])):h.createCommentVNode("",!0),h.createElementVNode("div",r0,[m.state.multilanguage?(h.openBlock(),h.createElementBlock("sl-tab-group",s0,[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(m.state.languages,y=>{var B,v,k,_;return h.openBlock(),h.createElementBlock(h.Fragment,{key:y+"_tab"},[h.createElementVNode("sl-tab",{slot:"nav",panel:"lang_"+y},h.toDisplayString(m.$t(y)),9,a0),h.createElementVNode("sl-tab-panel",{name:"lang_"+y},[m.state.multiple&&!m.BoneHasMultipleHandling(m.state.bonestructure.type)?(h.openBlock(),h.createElementBlock(h.Fragment,{key:0},[(B=m.state.bonevalue)!=null&&B[y].length?(h.openBlock(!0),h.createElementBlock(h.Fragment,{key:0},h.renderList((v=m.state.bonevalue)==null?void 0:v[y],(R,T)=>(h.openBlock(),h.createElementBlock("div",{key:T,class:"multiple-bone"},[h.createVNode(S,{readonly:!m.state.readonly,"is-dragging":m.state.isDragging.lang===y&&m.state.isDragging.index===T,"dragging-line-bottom":m.state.draggingLineBottom.lang===y&&m.state.draggingLineBottom.index===T,"dragging-line-top":m.state.draggingLineTop.lang===y&&m.state.draggingLineTop.index===T,onDelete:O=>m.removeMultipleEntry(T,y),onHandleDragStart:O=>m.handleDragStart(T,y,O),onHandleDragOver:O=>m.handleDragOver(T,y,O),onHandleDrop:O=>m.handleDrop(T,y,O)},{default:h.withCtx(()=>[(h.openBlock(),h.createBlock(h.resolveDynamicComponent(m.is),{value:R,index:T,lang:y,name:m.name,onChange:m.updateValue,onKeydown:h.withKeys(O=>m.multipleBonePressEnter(y),["enter"])},null,40,["value","index","lang","name","onChange","onKeydown"]))]),_:2},1032,["readonly","is-dragging","dragging-line-bottom","dragging-line-top","onDelete","onHandleDragStart","onHandleDragOver","onHandleDrop"])]))),128)):(h.openBlock(),h.createElementBlock("div",{key:1,class:h.normalizeClass(["multiple-placeholder",{readonly:m.state.readonly}])},c0,2)),m.state.readonly?h.createCommentVNode("",!0):(h.openBlock(),h.createBlock(h.resolveDynamicComponent(m.state.actionbar),{key:2,value:(k=m.state.bonevalue)==null?void 0:k[y],name:m.name,lang:y,onChange:m.updateValue},null,40,["value","name","lang","onChange"]))],64)):(h.openBlock(),h.createBlock(h.resolveDynamicComponent(m.is),{key:1,value:(_=m.state.bonevalue)==null?void 0:_[y],index:null,lang:y,name:m.name,onChange:m.updateValue},null,40,["value","lang","name","onChange"]))],8,l0)],64)}),128))])):(h.openBlock(),h.createElementBlock(h.Fragment,{key:1},[m.state.multiple&&!m.BoneHasMultipleHandling(m.state.bonestructure.type)?(h.openBlock(),h.createElementBlock(h.Fragment,{key:0},[(p=m.state.bonevalue)!=null&&p.length?(h.openBlock(!0),h.createElementBlock(h.Fragment,{key:0},h.renderList(m.state.bonevalue,(y,B)=>(h.openBlock(),h.createElementBlock("div",{key:B,class:"multiple-bone"},[h.createVNode(S,{readonly:!m.state.readonly,"is-dragging":m.state.isDragging.index===B,"dragging-line-bottom":m.state.draggingLineBottom.index===B,"dragging-line-top":m.state.draggingLineTop.index===B,onDelete:v=>m.removeMultipleEntry(B),onHandleDragStart:v=>m.handleDragStart(B,m.lang=null,v),onHandleDragOver:v=>m.handleDragOver(B,m.lang=null,v),onHandleDrop:v=>m.handleDrop(B,m.lang=null,v)},{default:h.withCtx(()=>[(h.openBlock(),h.createBlock(h.resolveDynamicComponent(m.is),{value:y,index:B,name:m.name,onChange:m.updateValue,onKeydown:x[0]||(x[0]=h.withKeys(v=>m.multipleBonePressEnter(),["enter"]))},null,40,["value","index","name","onChange"]))]),_:2},1032,["readonly","is-dragging","dragging-line-bottom","dragging-line-top","onDelete","onHandleDragStart","onHandleDragOver","onHandleDrop"])]))),128)):(h.openBlock(),h.createElementBlock("div",d0,h0)),m.state.readonly?h.createCommentVNode("",!0):(h.openBlock(),h.createBlock(h.resolveDynamicComponent(m.state.actionbar),{key:2,value:m.state.bonevalue,name:m.name,onChange:m.updateValue},null,40,["value","name","onChange"]))],64)):(h.openBlock(),h.createBlock(h.resolveDynamicComponent(m.is),{key:1,value:m.state.bonevalue,name:m.name,index:null,autofocus:m.autofocus,onChange:m.updateValue,onKeypress:h.withKeys(m.updateValue,["enter"])},null,40,["value","name","autofocus","onChange","onKeypress"]))],64)),(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(m.state.errorMessages,y=>(h.openBlock(),h.createElementBlock("sl-alert",u0,[m0,h.createElementVNode("div",g0,h.toDisplayString(y),1)]))),256))])],2)}const ur=de(XA,[["render",p0],["__scopeId","data-v-dee63f3c"]]),Yt=m=>(h.pushScopeId("data-v-71a3c8c9"),m=m(),h.popScopeId(),m),f0=Yt(()=>h.createElementVNode("h2",{class:"viur-shop-form-headline headline"},"Nutzterdaten",-1)),k0=Yt(()=>h.createElementVNode("h2",{class:"viur-shop-form-headline headline"},"Lieferadresse",-1)),b0=["onSlChange","onSlClear","label"],w0=["value"],A0={key:0},_0=Yt(()=>h.createElementVNode("h2",{class:"viur-shop-form-headline headline"},"Rechnungsadresse",-1)),C0=[Yt(()=>h.createElementVNode("sl-icon",{name:"x-lg",slot:"prefix"},null,-1))],v0=Yt(()=>h.createElementVNode("sl-icon",{name:"plus-lg",slot:"prefix"},null,-1)),y0=Yt(()=>h.createElementVNode("sl-icon",{slot:"icon",name:"exclamation-triangle"},null,-1)),E0=Yt(()=>h.createElementVNode("br",null,null,-1)),x0=de({__name:"UserInfoMulti",props:{mode:{type:String,default:"form"}},setup(m){const x=vn(),C=h.reactive({formValues:{},requiredFieldsFilled:h.computed(()=>{if(C.isCustomAdress)return Object.keys(C.formValues).includes("city")&&Object.keys(C.formValues).includes("street")&&Object.keys(C.formValues).includes("billing.city")&&Object.keys(C.formValues).includes("billing.street")&&Object.keys(C.formValues).includes("email")&&Object.keys(C.formValues).includes("firstname")&&Object.keys(C.formValues).includes("lastname");if(!C.isCustomAdress)return Object.keys(C.formValues).includes("city")&&Object.keys(C.formValues).includes("street")&&Object.keys(C.formValues).includes("email")&&Object.keys(C.formValues).includes("firstname")&&Object.keys(C.formValues).includes("lastname")}),isCustomAdress:!1,shippingAdressAmount:1,maxShippingAdress:h.computed(()=>Object.keys(x.state.carts).length+2),amountAlert:{title:"",msg:""},items:null,addSkel:null,errors:{},selectedItem:{},isInit:h.computed(()=>!!x.state.carts[x.state.basket])}),N=h.ref(null),D=h.ref(null);function M(k){k.target.checked&&(C.isCustomAdress=!1),k.target.checked||(C.isCustomAdress=!0)}function w(){if(C.shippingAdressAmount===C.maxShippingAdress){C.amountAlert.title="Zu viele Lieferadressen",C.amountAlert.msg=`Sie können nur maximal: "${C.maxShippingAdress}" Lieferadressen verwenden.`,D.value.show();return}C.shippingAdressAmount+=1}function S(k,_){for(const[R,T]of Object.entries(_.value[0]))C.formValues[R]=T}function p(){if(C.shippingAdressAmount===1){C.amountAlert.title="Zu wenig Lieferadressen",C.amountAlert.msg="Mindestens eine Lieferadresse muss angegeben werden.",D.value.show();return}C.shippingAdressAmount-=1}function y(k,_){if(console.log(k.target.value),!k.target.value.length){B();return}C.selectedItem[_]=k.target.value,C.isItemSelected=!0}function B(k,_){console.log("clearing..."),delete C.selectedItem[_],C.isItemSelected=!1}function v(k){let _={};return k.forEach(R=>{let T=R[0],O=R[1];_[T]=O}),_}return h.watch(C.formValues,k=>{Object.entries(k).forEach(([_,R])=>{R===""&&delete C.formValues[_]})}),h.onBeforeMount(async()=>{await x.getAdressStructure(),C.addSkel=x.state.structure.address}),(k,_)=>(h.openBlock(),h.createElementBlock(h.Fragment,null,[h.createElementVNode("div",null,[f0,(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(C.addSkel,R=>(h.openBlock(),h.createElementBlock(h.Fragment,{key:R[0]},[R[1].visible&&R[1].params.group==="Customer Info"?(h.openBlock(),h.createBlock(ur,{key:0,is:h.unref(Jt)(R[1].type),name:R[0],structure:v(C.addSkel),errors:C.errors[R[0]]?C.errors[R[0]]:[],skel:C.formValues,onChange:T=>S(R[0],T),class:"viur-shop-form-grid-w-2"},null,8,["is","name","structure","errors","skel","onChange"])):h.createCommentVNode("",!0)],64))),128))]),k0,(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(C.shippingAdressAmount,R=>(h.openBlock(),h.createElementBlock("div",{key:R},[h.createElementVNode("sl-select",{clearable:"",ref_for:!0,ref_key:"itemSelection",ref:N,onSlChange:T=>y(T,R),onSlClear:T=>B(T,R),label:C.selectedItem[R]?h.unref(x).state.carts[C.selectedItem[R]].info.name:"Warenkorb für Adresse wählen.",class:"grid-w-4"},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(h.unref(x).state.carts,(T,O)=>(h.openBlock(),h.createElementBlock("sl-option",{value:O},h.toDisplayString(T.info.name),9,w0))),256))],40,b0),(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(C.addSkel,T=>(h.openBlock(),h.createElementBlock(h.Fragment,{key:T[0]},[T[1].visible&&T[1].params.group==="Customer Address"?(h.openBlock(),h.createBlock(ur,{key:0,is:h.unref(Jt)(T[1].type),name:T[0],structure:v(C.addSkel),errors:C.errors[T[0]]?C.errors[T[0]]:[],skel:C.formValues,onChange:O=>S(T[0],O)},null,8,["is","name","structure","errors","skel","onChange"])):h.createCommentVNode("",!0)],64))),128))]))),128)),C.isCustomAdress?(h.openBlock(),h.createElementBlock("div",A0,[_0,(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(C.addSkel,R=>(h.openBlock(),h.createElementBlock(h.Fragment,{key:R[0]},[R[1].visible&&R[1].params.group==="Customer Address"?(h.openBlock(),h.createBlock(ur,{key:0,is:h.unref(Jt)(R[1].type),name:R[0],structure:v(C.addSkel),errors:C.errors[R[0]]?C.errors[R[0]]:[],skel:C.formValues,onChange:T=>S(R[0],T)},null,8,["is","name","structure","errors","skel","onChange"])):h.createCommentVNode("",!0)],64))),128))])):h.createCommentVNode("",!0),h.createElementVNode("div",{class:"viur-shop-form-btn-wrap"},[h.createElementVNode("sl-button",{size:"medium",onClick:p,title:"Lieferadresse entfernen"},C0),h.createElementVNode("sl-button",{size:"medium",variant:"primary",onClick:w},[v0,h.createTextVNode(" Lieferadresse hinzufügen ")])]),h.createElementVNode("sl-alert",{variant:"warning",duration:"2000",ref_key:"shippingWarning",ref:D,closable:""},[y0,h.createElementVNode("strong",null,h.toDisplayString(C.amountAlert.title),1),E0,h.createTextVNode(" "+h.toDisplayString(C.amountAlert.msg),1)],512),h.createElementVNode("sl-checkbox",{onSlChange:M,checked:""}," Rechnungsadresse wie Lieferadresse ",32)],64))}},[["__scopeId","data-v-71a3c8c9"]]),ul={__name:"ExampleUsage",setup(m){const x=vn(),C=h.computed(()=>x.state.basketRootNode.key?x.state.basketRootNode.key:""),N=h.reactive({rootNode:{},tabs:{cart:{component:h.shallowRef(rr),props:{sidebar:!0,mode:"basket",cartKey:C},displayName:"Warenkorb",icon:{name:"cart",library:"hsk"},position:2,disabled:!1,atShow:null,atHide:null},confirm:{component:h.shallowRef(sr),props:{},displayName:"Bestellung prüfen",icon:{name:"order-check",library:"hsk"},position:5,disabled:!1,atShow:null,atHide:null},orderComplete:{component:h.shallowRef(fb),props:{},displayName:"Bestellung Abgeschlossen",icon:{name:"order-confirmed",library:"hsk"},position:6,disabled:!0,atShow:null,atHide:null},userInfo:{component:h.shallowRef(MA),props:{},displayName:"Daten Eingeben",icon:{name:"user",library:"hsk"},position:3,disabled:!1,atShow:null,atHide:null},userInfoMulti:{component:h.shallowRef(x0),props:{},displayName:"Daten Eingeben (Multi)",icon:{name:"user",library:"hsk"},position:4,disabled:!1,atShow:null,atHide:null}}});function D(M){(M==null?void 0:M.detail.name)==="confirm"&&(N.tabs.orderComplete.disabled=!1)}return h.onBeforeMount(async()=>{await x.init(),await x.getAdressStructure(),console.log("debug init exampleusage :",x.state.basketRootNode)}),(M,w)=>(h.openBlock(),h.createBlock(hb,{tabs:N.tabs,onTabChange:D},null,8,["tabs"]))}},S0={install(m){m.component("CartView",rr),m.component("ExampleUsage",ul),m.component("ConfirmView",sr)}};Ve.CartView=rr,Ve.ConfirmView=sr,Ve.ExampleUsage=ul,Ve.default=S0,Ve.useCartStore=vn,Object.defineProperties(Ve,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
6529
|
+
`)}function Ma(o,e,t=" "){return`${t.repeat(Math.max(0,e))}${o}`}var Rf=D(2896),nD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Rf.Z,nD),Rf.Z.locals;const Of="SourceEditingMode";function oD(o){return function(e){return e.startsWith("<")}(o)?tD(o):o}const Fa="removeFormat";class iD extends q{static get pluginName(){return"RemoveFormatUI"}init(){const e=this.editor,t=e.t;e.ui.componentFactory.add(Fa,n=>{const i=e.commands.get(Fa),r=new Ae(n);return r.set({label:t("Remove Format"),icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M8.69 14.915c.053.052.173.083.36.093a.366.366 0 0 1 .345.485l-.003.01a.738.738 0 0 1-.697.497h-2.67a.374.374 0 0 1-.353-.496l.013-.038a.681.681 0 0 1 .644-.458c.197-.012.325-.043.386-.093a.28.28 0 0 0 .072-.11L9.592 4.5H6.269c-.359-.017-.609.013-.75.09-.142.078-.289.265-.442.563-.192.29-.516.464-.864.464H4.17a.43.43 0 0 1-.407-.569L4.46 3h13.08l-.62 2.043a.81.81 0 0 1-.775.574h-.114a.486.486 0 0 1-.486-.486c.001-.284-.054-.464-.167-.54-.112-.076-.367-.106-.766-.091h-3.28l-2.68 10.257c-.006.074.007.127.038.158zM3 17h8a.5.5 0 1 1 0 1H3a.5.5 0 1 1 0-1zm11.299 1.17a.75.75 0 1 1-1.06-1.06l1.414-1.415-1.415-1.414a.75.75 0 0 1 1.06-1.06l1.415 1.414 1.414-1.415a.75.75 0 1 1 1.06 1.06l-1.413 1.415 1.414 1.415a.75.75 0 0 1-1.06 1.06l-1.415-1.414-1.414 1.414z"/></svg>',tooltip:!0}),r.bind("isOn","isEnabled").to(i,"value","isEnabled"),this.listenTo(r,"execute",()=>{e.execute(Fa),e.editing.view.focus()}),r})}}class rD extends ne{refresh(){const e=this.editor.model;this.isEnabled=!!ze(this._getFormattingItems(e.document.selection,e.schema))}execute(){const e=this.editor.model,t=e.schema;e.change(n=>{for(const i of this._getFormattingItems(e.document.selection,t))if(i.is("selection"))for(const r of this._getFormattingAttributes(i,t))n.removeSelectionAttribute(r);else{const r=n.createRangeOn(i);for(const s of this._getFormattingAttributes(i,t))n.removeAttribute(s,r)}})}*_getFormattingItems(e,t){const n=i=>!!ze(this._getFormattingAttributes(i,t));for(const i of e.getRanges())for(const r of i.getItems())!t.isBlock(r)&&n(r)&&(yield r);for(const i of e.getSelectedBlocks())n(i)&&(yield i);n(e)&&(yield e)}*_getFormattingAttributes(e,t){for(const[n]of e.getAttributes()){const i=t.getAttributeProperties(n);i&&i.isFormatting&&(yield n)}}}class sD extends q{static get pluginName(){return"RemoveFormatEditing"}init(){const e=this.editor;e.commands.add("removeFormat",new rD(e))}}var aD=Object.defineProperty,Nf=Object.getOwnPropertySymbols,lD=Object.prototype.hasOwnProperty,cD=Object.prototype.propertyIsEnumerable,zf=(o,e,t)=>e in o?aD(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Mf=(o,e)=>{for(var t in e||(e={}))lD.call(e,t)&&zf(o,t,e[t]);if(Nf)for(var t of Nf(e))cD.call(e,t)&&zf(o,t,e[t]);return o};function wn(o,e,t,n){e&&function(i,r,s){if(r.attributes)for(const[a]of Object.entries(r.attributes))i.removeAttribute(a,s);if(r.styles)for(const a of Object.keys(r.styles))i.removeStyle(a,s);r.classes&&i.removeClass(r.classes,s)}(o,e,n),t&&Kt(o,t,n)}function Kt(o,e,t){if(e.attributes)for(const[n,i]of Object.entries(e.attributes))o.setAttribute(n,i,t);e.styles&&o.setStyle(e.styles,t),e.classes&&o.addClass(e.classes,t)}function dD(o,e){const t=qt(o);let n="attributes";for(n in e)t[n]=n=="classes"?Array.from(new Set([...o[n]||[],...e[n]])):Mf(Mf({},o[n]),e[n]);return t}function An(o,e,t,n,i){const r=e.getAttribute(t),s={};for(const a of["attributes","styles","classes"]){if(a!=n){r&&r[a]&&(s[a]=r[a]);continue}if(n=="classes"){const c=new Set(r&&r.classes||[]);i(c),c.size&&(s[a]=Array.from(c));continue}const l=new Map(Object.entries(r&&r[a]||{}));i(l),l.size&&(s[a]=Object.fromEntries(l))}Object.keys(s).length?e.is("documentSelection")?o.setSelectionAttribute(t,s):o.setAttribute(t,s,e):r&&(e.is("documentSelection")?o.removeSelectionAttribute(t):o.removeAttribute(t,e))}function Va({model:o}){return(e,t)=>t.writer.createElement(o,{htmlContent:e.getCustomProperty("$rawContent")})}function hD(o,{view:e,isInline:t}){const n=o.t;return(i,{writer:r})=>{const s=n("HTML object"),a=Qi(e,i,r),l=i.getAttribute("htmlAttributes");return r.addClass("html-object-embed__content",a),l&&Kt(r,l,a),ia(r.createContainerElement(t?"span":"div",{class:"html-object-embed","data-html-object-embed-label":s},a),r,{label:s})}}function Qi(o,e,t){return t.createRawElement(o,null,(n,i)=>{i.setContentOf(n,e.getAttribute("htmlContent"))})}function uD({priority:o,view:e}){return(t,n)=>{if(!t)return;const{writer:i}=n,r=i.createAttributeElement(e,null,{priority:o});return Kt(i,t,r),r}}function Vo({view:o},e){return t=>{t.on(`element:${o}`,(n,i,r)=>{if(!i.modelRange||i.modelRange.isCollapsed)return;const s=e.processViewAttributes(i.viewItem,r);s&&r.writer.setAttribute("htmlAttributes",s,i.modelRange)},{priority:"low"})}}function Lo({model:o}){return e=>{e.on(`attribute:htmlAttributes:${o}`,(t,n,i)=>{if(!i.consumable.consume(n.item,t.name))return;const{attributeOldValue:r,attributeNewValue:s}=n;wn(i.writer,r,s,i.mapper.toViewElement(n.item))})}}const mD=[{model:"codeBlock",view:"pre"},{model:"paragraph",view:"p"},{model:"blockQuote",view:"blockquote"},{model:"listItem",view:"li"},{model:"pageBreak",view:"div"},{model:"rawHtml",view:"div"},{model:"table",view:"table"},{model:"tableRow",view:"tr"},{model:"tableCell",view:"td"},{model:"tableCell",view:"th"},{model:"tableColumnGroup",view:"colgroup"},{model:"tableColumn",view:"col"},{model:"caption",view:"caption"},{model:"caption",view:"figcaption"},{model:"imageBlock",view:"img"},{model:"imageInline",view:"img"},{model:"htmlP",view:"p",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlBlockquote",view:"blockquote",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlTable",view:"table",modelSchema:{allowWhere:"$block",isBlock:!0}},{model:"htmlTbody",view:"tbody",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlThead",view:"thead",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlTfoot",view:"tfoot",modelSchema:{allowIn:"htmlTable",isBlock:!1}},{model:"htmlCaption",view:"caption",modelSchema:{allowIn:"htmlTable",allowChildren:"$text",isBlock:!1}},{model:"htmlColgroup",view:"colgroup",modelSchema:{allowIn:"htmlTable",allowChildren:"col",isBlock:!1}},{model:"htmlCol",view:"col",modelSchema:{allowIn:"htmlColgroup",isBlock:!1}},{model:"htmlTr",view:"tr",modelSchema:{allowIn:["htmlTable","htmlThead","htmlTbody"],isLimit:!0}},{model:"htmlTd",view:"td",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlTh",view:"th",modelSchema:{allowIn:"htmlTr",allowContentOf:"$container",isLimit:!0,isBlock:!1}},{model:"htmlFigure",view:"figure",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFigcaption",view:"figcaption",modelSchema:{allowIn:"htmlFigure",allowChildren:"$text",isBlock:!1}},{model:"htmlAddress",view:"address",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlAside",view:"aside",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlMain",view:"main",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDetails",view:"details",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSummary",view:"summary",modelSchema:{allowChildren:"$text",allowIn:"htmlDetails",isBlock:!1}},{model:"htmlDiv",view:"div",paragraphLikeModel:"htmlDivParagraph",modelSchema:{inheritAllFrom:"$container"}},{model:"htmlFieldset",view:"fieldset",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlLegend",view:"legend",modelSchema:{allowIn:"htmlFieldset",allowChildren:"$text"}},{model:"htmlHeader",view:"header",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlFooter",view:"footer",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlForm",view:"form",modelSchema:{inheritAllFrom:"$container",isBlock:!0}},{model:"htmlHgroup",view:"hgroup",modelSchema:{allowChildren:["htmlH1","htmlH2","htmlH3","htmlH4","htmlH5","htmlH6"],isBlock:!1}},{model:"htmlH1",view:"h1",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH2",view:"h2",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH3",view:"h3",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH4",view:"h4",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH5",view:"h5",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlH6",view:"h6",modelSchema:{inheritAllFrom:"$block"}},{model:"$htmlList",modelSchema:{allowWhere:"$container",allowChildren:["$htmlList","htmlLi"],isBlock:!1}},{model:"htmlDir",view:"dir",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlMenu",view:"menu",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlUl",view:"ul",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlOl",view:"ol",modelSchema:{inheritAllFrom:"$htmlList"}},{model:"htmlLi",view:"li",modelSchema:{allowIn:"$htmlList",allowChildren:"$text",isBlock:!1}},{model:"htmlPre",view:"pre",modelSchema:{inheritAllFrom:"$block"}},{model:"htmlArticle",view:"article",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlSection",view:"section",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlNav",view:"nav",modelSchema:{inheritAllFrom:"$container",isBlock:!1}},{model:"htmlDivDl",view:"div",modelSchema:{allowChildren:["htmlDt","htmlDd"],allowIn:"htmlDl"}},{model:"htmlDl",view:"dl",modelSchema:{allowWhere:"$container",allowChildren:["htmlDt","htmlDd","htmlDivDl"],isBlock:!1}},{model:"htmlDt",view:"dt",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlDd",view:"dd",modelSchema:{allowChildren:"$block",isBlock:!1}},{model:"htmlCenter",view:"center",modelSchema:{inheritAllFrom:"$container",isBlock:!1}}],gD=[{model:"htmlLiAttributes",view:"li",appliesToBlock:!0},{model:"htmlListAttributes",view:"ol",appliesToBlock:!0},{model:"htmlListAttributes",view:"ul",appliesToBlock:!0},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"table"},{model:"htmlTheadAttributes",view:"thead",appliesToBlock:"table"},{model:"htmlTbodyAttributes",view:"tbody",appliesToBlock:"table"},{model:"htmlFigureAttributes",view:"figure",appliesToBlock:"imageBlock"},{model:"htmlAcronym",view:"acronym",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTt",view:"tt",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlFont",view:"font",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlTime",view:"time",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlVar",view:"var",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBig",view:"big",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSmall",view:"small",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSamp",view:"samp",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlQ",view:"q",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlOutput",view:"output",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlKbd",view:"kbd",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdi",view:"bdi",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlBdo",view:"bdo",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlAbbr",view:"abbr",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlA",view:"a",priority:5,coupledAttribute:"linkHref",attributeProperties:{copyOnEnter:!0}},{model:"htmlStrong",view:"strong",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlB",view:"b",coupledAttribute:"bold",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlI",view:"i",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlEm",view:"em",coupledAttribute:"italic",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlS",view:"s",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDel",view:"del",coupledAttribute:"strikethrough",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlIns",view:"ins",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlU",view:"u",coupledAttribute:"underline",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSub",view:"sub",coupledAttribute:"subscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSup",view:"sup",coupledAttribute:"superscript",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCode",view:"code",coupledAttribute:"code",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlMark",view:"mark",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlSpan",view:"span",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlCite",view:"cite",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlLabel",view:"label",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlDfn",view:"dfn",attributeProperties:{copyOnEnter:!0,isFormatting:!0}},{model:"htmlObject",view:"object",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlIframe",view:"iframe",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlInput",view:"input",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlButton",view:"button",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlTextarea",view:"textarea",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlSelect",view:"select",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlVideo",view:"video",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlEmbed",view:"embed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlOembed",view:"oembed",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlAudio",view:"audio",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlImg",view:"img",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlCanvas",view:"canvas",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlMeter",view:"meter",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlProgress",view:"progress",isObject:!0,modelSchema:{inheritAllFrom:"$inlineObject"}},{model:"htmlScript",view:"script",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlStyle",view:"style",modelSchema:{allowWhere:["$text","$block"],isInline:!0}},{model:"htmlCustomElement",view:"$customElement",modelSchema:{allowWhere:["$text","$block"],isInline:!0}}],pD=as(function(o,e,t,n){wd(o,e,t,n)});var fD=Object.defineProperty,kD=Object.defineProperties,bD=Object.getOwnPropertyDescriptors,Ff=Object.getOwnPropertySymbols,wD=Object.prototype.hasOwnProperty,AD=Object.prototype.propertyIsEnumerable,Vf=(o,e,t)=>e in o?fD(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,Xi=(o,e)=>{for(var t in e||(e={}))wD.call(e,t)&&Vf(o,t,e[t]);if(Ff)for(var t of Ff(e))AD.call(e,t)&&Vf(o,t,e[t]);return o},er=(o,e)=>kD(o,bD(e));class Xn extends q{constructor(){super(...arguments),this._definitions=[]}static get pluginName(){return"DataSchema"}init(){for(const e of mD)this.registerBlockElement(e);for(const e of gD)this.registerInlineElement(e)}registerBlockElement(e){this._definitions.push(er(Xi({},e),{isBlock:!0}))}registerInlineElement(e){this._definitions.push(er(Xi({},e),{isInline:!0}))}extendBlockElement(e){this._extendDefinition(er(Xi({},e),{isBlock:!0}))}extendInlineElement(e){this._extendDefinition(er(Xi({},e),{isInline:!0}))}getDefinitionsForView(e,t=!1){const n=new Set;for(const i of this._getMatchingViewDefinitions(e)){if(t)for(const r of this._getReferences(i.model))n.add(r);n.add(i)}return n}getDefinitionsForModel(e){return this._definitions.filter(t=>t.model==e)}_getMatchingViewDefinitions(e){return this._definitions.filter(t=>t.view&&function(n,i){return typeof n=="string"?n===i:n instanceof RegExp?n.test(i):!1}(e,t.view))}*_getReferences(e){const t=["inheritAllFrom","inheritTypesFrom","allowWhere","allowContentOf","allowAttributesOf"],n=this._definitions.filter(i=>i.model==e);for(const{modelSchema:i}of n)if(i)for(const r of t)for(const s of Pe(i[r]||[])){const a=this._definitions.filter(l=>l.model==s);for(const l of a)s!==e&&(yield*this._getReferences(l.model),yield l)}}_extendDefinition(e){const t=Array.from(this._definitions.entries()).filter(([,n])=>n.model==e.model);if(t.length!=0)for(const[n,i]of t)this._definitions[n]=pD({},i,e,(r,s)=>Array.isArray(r)?r.concat(s):void 0);else this._definitions.push(e)}}const _D=function(o,e,t,n){for(var i=o.length,r=t+-1;++r<i;)if(e(o[r],r,o))return r;return-1},CD=function(o){return o!=o},vD=function(o,e,t){for(var n=t-1,i=o.length;++n<i;)if(o[n]===e)return n;return-1},yD=function(o,e,t){return e==e?vD(o,e,t):_D(o,CD,t)};var Lf=Array.prototype.splice;const ED=function(o,e,t,n){var i=yD,r=-1,s=e.length,a=o;for(o===e&&(e=Tr(e)),t;++r<s;)for(var l=0,c=e[r],d=c;(l=i(a,d,l))>-1;)a!==o&&Lf.call(a,l,1),Lf.call(o,l,1);return o},xD=_d(function(o,e){return o&&o.length&&e&&e.length?ED(o,e):o});var jf=D(5049),SD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(jf.Z,SD),jf.Z.locals;class Fe extends q{constructor(e){super(e),this._dataSchema=e.plugins.get("DataSchema"),this._allowedAttributes=new Mn,this._disallowedAttributes=new Mn,this._allowedElements=new Set,this._disallowedElements=new Set,this._dataInitialized=!1,this._coupledAttributes=null,this._registerElementsAfterInit(),this._registerElementHandlers(),this._registerModelPostFixer()}static get pluginName(){return"DataFilter"}static get requires(){return[Xn,Mo]}loadAllowedConfig(e){for(const t of e){const n=t.name||/[\s\S]+/,i=qf(t);this.allowElement(n),i.forEach(r=>this.allowAttributes(r))}}loadDisallowedConfig(e){for(const t of e){const n=t.name||/[\s\S]+/,i=qf(t);i.length==0?this.disallowElement(n):i.forEach(r=>this.disallowAttributes(r))}}allowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!0))this._addAllowedElement(t),this._coupledAttributes=null}disallowElement(e){for(const t of this._dataSchema.getDefinitionsForView(e,!1))this._disallowedElements.add(t.view)}allowAttributes(e){this._allowedAttributes.add(e)}disallowAttributes(e){this._disallowedAttributes.add(e)}processViewAttributes(e,t){return $f(e,t,this._disallowedAttributes),$f(e,t,this._allowedAttributes)}_addAllowedElement(e){if(!this._allowedElements.has(e)){if(this._allowedElements.add(e),"appliesToBlock"in e&&typeof e.appliesToBlock=="string")for(const t of this._dataSchema.getDefinitionsForModel(e.appliesToBlock))t.isBlock&&this._addAllowedElement(t);this._dataInitialized&&this.editor.data.once("set",()=>{this._fireRegisterEvent(e)},{priority:te.get("highest")+1})}}_registerElementsAfterInit(){this.editor.data.on("init",()=>{this._dataInitialized=!0;for(const e of this._allowedElements)this._fireRegisterEvent(e)},{priority:te.get("highest")+1})}_registerElementHandlers(){this.on("register",(e,t)=>{const n=this.editor.model.schema;if(t.isObject&&!n.isRegistered(t.model))this._registerObjectElement(t);else if(t.isBlock)this._registerBlockElement(t);else{if(!t.isInline)throw new I("data-filter-invalid-definition",null,t);this._registerInlineElement(t)}e.stop()},{priority:"lowest"})}_registerModelPostFixer(){const e=this.editor.model;e.document.registerPostFixer(t=>{const n=e.document.differ.getChanges();let i=!1;const r=this._getCoupledAttributesMap();for(const s of n){if(s.type!="attribute"||s.attributeNewValue!==null)continue;const a=r.get(s.attributeKey);if(a)for(const{item:l}of s.range.getWalker({shallow:!0}))for(const c of a)l.hasAttribute(c)&&(t.removeAttribute(c,l),i=!0)}return i})}_getCoupledAttributesMap(){if(this._coupledAttributes)return this._coupledAttributes;this._coupledAttributes=new Map;for(const e of this._allowedElements)if(e.coupledAttribute&&e.model){const t=this._coupledAttributes.get(e.coupledAttribute);t?t.push(e.model):this._coupledAttributes.set(e.coupledAttribute,[e.model])}return this._coupledAttributes}_fireRegisterEvent(e){e.view&&this._disallowedElements.has(e.view)||this.fire(e.view?`register:${e.view}`:"register",e)}_registerObjectElement(e){const t=this.editor,n=t.model.schema,i=t.conversion,{view:r,model:s}=e;n.register(s,e.modelSchema),r&&(n.extend(e.model,{allowAttributes:["htmlAttributes","htmlContent"]}),t.data.registerRawContentMatcher({name:r}),i.for("upcast").elementToElement({view:r,model:Va(e),converterPriority:te.get("low")+1}),i.for("upcast").add(Vo(e,this)),i.for("editingDowncast").elementToStructure({model:{name:s,attributes:["htmlAttributes"]},view:hD(t,e)}),i.for("dataDowncast").elementToElement({model:s,view:(a,{writer:l})=>Qi(r,a,l)}),i.for("dataDowncast").add(Lo(e)))}_registerBlockElement(e){const t=this.editor,n=t.model.schema,i=t.conversion,{view:r,model:s}=e;if(!n.isRegistered(e.model)){if(n.register(e.model,e.modelSchema),!r)return;i.for("upcast").elementToElement({model:s,view:r,converterPriority:te.get("low")+1}),i.for("downcast").elementToElement({model:s,view:r})}r&&(n.extend(e.model,{allowAttributes:"htmlAttributes"}),i.for("upcast").add(Vo(e,this)),i.for("downcast").add(Lo(e)))}_registerInlineElement(e){const t=this.editor,n=t.model.schema,i=t.conversion,r=e.model;e.appliesToBlock||(n.extend("$text",{allowAttributes:r}),e.attributeProperties&&n.setAttributeProperties(r,e.attributeProperties),i.for("upcast").add(function({view:s,model:a},l){return c=>{c.on(`element:${s}`,(d,u,g)=>{let f=l.processViewAttributes(u.viewItem,g);if(f||g.consumable.test(u.viewItem,{name:!0})){f=f||{},g.consumable.consume(u.viewItem,{name:!0}),u.modelRange||(u=Object.assign(u,g.convertChildren(u.viewItem,u.modelCursor)));for(const b of u.modelRange.getItems())if(g.schema.checkAttribute(b,a)){const A=dD(f,b.getAttribute(a)||{});g.writer.setAttribute(a,A,b)}}},{priority:"low"})}}(e,this)),i.for("downcast").attributeToElement({model:r,view:uD(e)}))}}function $f(o,e,t){const n=function(l,{consumable:c},d){const u=d.matchAll(l)||[],g=[];for(const f of u)DD(c,l,f),delete f.match.name,c.consume(l,f.match),g.push(f);return g}(o,e,t),{attributes:i,styles:r,classes:s}=function(l){const c={attributes:new Set,classes:new Set,styles:new Set};for(const d of l)for(const u in c)(d.match[u]||[]).forEach(g=>c[u].add(g));return c}(n),a={};if(i.size)for(const l of i)_c(l)||i.delete(l);return i.size&&(a.attributes=Hf(i,l=>o.getAttribute(l))),r.size&&(a.styles=Hf(r,l=>o.getStyle(l))),s.size&&(a.classes=Array.from(s)),Object.keys(a).length?a:null}function DD(o,e,t){for(const n of["attributes","classes","styles"]){const i=t.match[n];if(i)for(const r of Array.from(i))o.test(e,{[n]:[r]})||xD(i,r)}}function Hf(o,e){const t={};for(const n of o)e(n)!==void 0&&(t[n]=e(n));return t}function La(o,e){const{name:t}=o,n=o[e];return Ke(n)?Object.entries(n).map(([i,r])=>({name:t,[e]:{[i]:r}})):Array.isArray(n)?n.map(i=>({name:t,[e]:[i]})):[o]}function qf(o){const{name:e,attributes:t,classes:n,styles:i}=o,r=[];return t&&r.push(...La({name:e,attributes:t},"attributes")),n&&r.push(...La({name:e,classes:n},"classes")),i&&r.push(...La({name:e,styles:i},"styles")),r}class BD extends q{static get requires(){return[Fe]}static get pluginName(){return"CodeBlockElementSupport"}init(){if(!this.editor.plugins.has("CodeBlockEditing"))return;const e=this.editor.plugins.get(Fe);e.on("register:pre",(t,n)=>{if(n.model!=="codeBlock")return;const i=this.editor,r=i.model.schema,s=i.conversion;r.extend("codeBlock",{allowAttributes:["htmlAttributes","htmlContentAttributes"]}),s.for("upcast").add(function(a){return l=>{l.on("element:code",(c,d,u)=>{const g=d.viewItem,f=g.parent;function b(A,E){const P=a.processViewAttributes(A,u);P&&u.writer.setAttribute(E,P,d.modelRange)}f&&f.is("element","pre")&&(b(f,"htmlAttributes"),b(g,"htmlContentAttributes"))},{priority:"low"})}}(e)),s.for("downcast").add(a=>{a.on("attribute:htmlAttributes:codeBlock",(l,c,d)=>{if(!d.consumable.consume(c.item,l.name))return;const{attributeOldValue:u,attributeNewValue:g}=c,f=d.mapper.toViewElement(c.item).parent;wn(d.writer,u,g,f)}),a.on("attribute:htmlContentAttributes:codeBlock",(l,c,d)=>{if(!d.consumable.consume(c.item,l.name))return;const{attributeOldValue:u,attributeNewValue:g}=c,f=d.mapper.toViewElement(c.item);wn(d.writer,u,g,f)})}),t.stop()})}}class TD extends q{static get requires(){return[Fe]}static get pluginName(){return"DualContentModelElementSupport"}init(){this.editor.plugins.get(Fe).on("register",(e,t)=>{const n=t,i=this.editor,r=i.model.schema,s=i.conversion;if(!n.paragraphLikeModel||r.isRegistered(n.model)||r.isRegistered(n.paragraphLikeModel))return;const a={model:n.paragraphLikeModel,view:n.view};r.register(n.model,n.modelSchema),r.register(a.model,{inheritAllFrom:"$block"}),s.for("upcast").elementToElement({view:n.view,model:(l,{writer:c})=>this._hasBlockContent(l)?c.createElement(n.model):c.createElement(a.model),converterPriority:te.get("low")+.5}),s.for("downcast").elementToElement({view:n.view,model:n.model}),this._addAttributeConversion(n),s.for("downcast").elementToElement({view:a.view,model:a.model}),this._addAttributeConversion(a),e.stop()})}_hasBlockContent(e){const t=this.editor.editing.view,n=t.domConverter.blockElements;for(const i of t.createRangeIn(e).getItems())if(i.is("element")&&n.includes(i.name))return!0;return!1}_addAttributeConversion(e){const t=this.editor,n=t.conversion,i=t.plugins.get(Fe);t.model.schema.extend(e.model,{allowAttributes:"htmlAttributes"}),n.for("upcast").add(Vo(e,i)),n.for("downcast").add(Lo(e))}}class ID extends q{static get requires(){return[Xn,zo]}static get pluginName(){return"HeadingElementSupport"}init(){const e=this.editor;if(!e.plugins.has("HeadingEditing"))return;const t=e.config.get("heading.options");this.registerHeadingElements(e,t),this.removeClassesOnEnter(e,t)}registerHeadingElements(e,t){const n=e.plugins.get(Xn),i=[];for(const r of t)"model"in r&&"view"in r&&(n.registerBlockElement({view:r.view,model:r.model}),i.push(r.model));n.extendBlockElement({model:"htmlHgroup",modelSchema:{allowChildren:i}})}removeClassesOnEnter(e,t){const n=e.commands.get("enter");this.listenTo(n,"afterExecute",(i,r)=>{const s=e.model.document.selection.getFirstPosition().parent;t.some(a=>s.is("element",a.model))&&s.childCount===0&&An(r.writer,s,"htmlAttributes","classes",a=>a.clear())})}}function tr(o,e,t){const n=o.createRangeOn(e);for(const{item:i}of n.getWalker())if(i.is("element",t))return i}class PD extends q{static get requires(){return[Fe]}static get pluginName(){return"ImageElementSupport"}init(){const e=this.editor;if(!e.plugins.has("ImageInlineEditing")&&!e.plugins.has("ImageBlockEditing"))return;const t=e.model.schema,n=e.conversion,i=e.plugins.get(Fe);i.on("register:figure",()=>{n.for("upcast").add(function(r){return s=>{s.on("element:figure",(a,l,c)=>{const d=l.viewItem;if(!l.modelRange||!d.hasClass("image"))return;const u=r.processViewAttributes(d,c);u&&c.writer.setAttribute("htmlFigureAttributes",u,l.modelRange)},{priority:"low"})}}(i))}),i.on("register:img",(r,s)=>{s.model!=="imageBlock"&&s.model!=="imageInline"||(t.isRegistered("imageBlock")&&t.extend("imageBlock",{allowAttributes:["htmlAttributes","htmlFigureAttributes","htmlLinkAttributes"]}),t.isRegistered("imageInline")&&t.extend("imageInline",{allowAttributes:["htmlA","htmlAttributes"]}),n.for("upcast").add(function(a){return l=>{l.on("element:img",(c,d,u)=>{if(!d.modelRange)return;const g=d.viewItem,f=g.parent;function b(E,P){const z=a.processViewAttributes(E,u);z&&u.writer.setAttribute(P,z,d.modelRange)}function A(E){d.modelRange&&d.modelRange.getContainedElement().is("element","imageBlock")&&b(E,"htmlLinkAttributes")}b(g,"htmlAttributes"),f.is("element","a")&&A(f)},{priority:"low"})}}(i)),n.for("downcast").add(a=>{function l(d){a.on(`attribute:${d}:imageInline`,(u,g,f)=>{if(!f.consumable.consume(g.item,u.name))return;const{attributeOldValue:b,attributeNewValue:A}=g,E=f.mapper.toViewElement(g.item);wn(f.writer,b,A,E)},{priority:"low"})}function c(d,u){a.on(`attribute:${u}:imageBlock`,(g,f,b)=>{if(!b.consumable.test(f.item,g.name))return;const{attributeOldValue:A,attributeNewValue:E}=f,P=b.mapper.toViewElement(f.item),z=tr(b.writer,P,d);z&&(wn(b.writer,A,E,z),b.consumable.consume(f.item,g.name))},{priority:"low"}),d==="a"&&a.on("attribute:linkHref:imageBlock",(g,f,b)=>{if(!b.consumable.consume(f.item,"attribute:htmlLinkAttributes:imageBlock"))return;const A=b.mapper.toViewElement(f.item),E=tr(b.writer,A,"a");Kt(b.writer,f.item.getAttribute("htmlLinkAttributes"),E)},{priority:"low"})}l("htmlAttributes"),c("img","htmlAttributes"),c("figure","htmlFigureAttributes"),c("a","htmlLinkAttributes")}),r.stop())})}}class RD extends q{static get requires(){return[Fe]}static get pluginName(){return"MediaEmbedElementSupport"}init(){const e=this.editor;if(!e.plugins.has("MediaEmbed")||e.config.get("mediaEmbed.previewsInData"))return;const t=e.model.schema,n=e.conversion,i=this.editor.plugins.get(Fe),r=this.editor.plugins.get(Xn),s=e.config.get("mediaEmbed.elementName");r.registerBlockElement({model:"media",view:s}),i.on("register:figure",()=>{n.for("upcast").add(function(a){return l=>{l.on("element:figure",(c,d,u)=>{const g=d.viewItem;if(!d.modelRange||!g.hasClass("media"))return;const f=a.processViewAttributes(g,u);f&&u.writer.setAttribute("htmlFigureAttributes",f,d.modelRange)},{priority:"low"})}}(i))}),i.on(`register:${s}`,(a,l)=>{l.model==="media"&&(t.extend("media",{allowAttributes:["htmlAttributes","htmlFigureAttributes"]}),n.for("upcast").add(function(c,d){const u=(g,f,b)=>{function A(E,P){const z=c.processViewAttributes(E,b);z&&b.writer.setAttribute(P,z,f.modelRange)}A(f.viewItem,"htmlAttributes")};return g=>{g.on(`element:${d}`,u,{priority:"low"})}}(i,s)),n.for("dataDowncast").add(function(c){return d=>{function u(g,f){d.on(`attribute:${f}:media`,(b,A,E)=>{if(!E.consumable.consume(A.item,b.name))return;const{attributeOldValue:P,attributeNewValue:z}=A,j=E.mapper.toViewElement(A.item),Y=tr(E.writer,j,g);wn(E.writer,P,z,Y)})}u(c,"htmlAttributes"),u("figure","htmlFigureAttributes")}}(s)),a.stop())})}}class OD extends q{static get requires(){return[Fe]}static get pluginName(){return"ScriptElementSupport"}init(){const e=this.editor.plugins.get(Fe);e.on("register:script",(t,n)=>{const i=this.editor,r=i.model.schema,s=i.conversion;r.register("htmlScript",n.modelSchema),r.extend("htmlScript",{allowAttributes:["htmlAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"script"}),s.for("upcast").elementToElement({view:"script",model:Va(n)}),s.for("upcast").add(Vo(n,e)),s.for("downcast").elementToElement({model:"htmlScript",view:(a,{writer:l})=>Qi("script",a,l)}),s.for("downcast").add(Lo(n)),t.stop()})}}class ND extends q{static get requires(){return[Fe]}static get pluginName(){return"TableElementSupport"}init(){const e=this.editor;if(!e.plugins.has("TableEditing"))return;const t=e.model.schema,n=e.conversion,i=e.plugins.get(Fe),r=e.plugins.get("TableUtils");i.on("register:figure",()=>{n.for("upcast").add(function(s){return a=>{a.on("element:figure",(l,c,d)=>{const u=c.viewItem;if(!c.modelRange||!u.hasClass("table"))return;const g=s.processViewAttributes(u,d);g&&d.writer.setAttribute("htmlFigureAttributes",g,c.modelRange)},{priority:"low"})}}(i))}),i.on("register:table",(s,a)=>{a.model==="table"&&(t.extend("table",{allowAttributes:["htmlAttributes","htmlFigureAttributes","htmlTheadAttributes","htmlTbodyAttributes"]}),n.for("upcast").add(function(l){return c=>{c.on("element:table",(d,u,g)=>{if(!u.modelRange)return;const f=u.viewItem;b(f,"htmlAttributes");for(const A of f.getChildren())A.is("element","thead")&&b(A,"htmlTheadAttributes"),A.is("element","tbody")&&b(A,"htmlTbodyAttributes");function b(A,E){const P=l.processViewAttributes(A,g);P&&g.writer.setAttribute(E,P,u.modelRange)}},{priority:"low"})}}(i)),n.for("downcast").add(l=>{function c(d,u){l.on(`attribute:${u}:table`,(g,f,b)=>{if(!b.consumable.test(f.item,g.name))return;const A=b.mapper.toViewElement(f.item),E=tr(b.writer,A,d);E&&(b.consumable.consume(f.item,g.name),wn(b.writer,f.attributeOldValue,f.attributeNewValue,E))})}c("table","htmlAttributes"),c("figure","htmlFigureAttributes"),c("thead","htmlTheadAttributes"),c("tbody","htmlTbodyAttributes")}),e.model.document.registerPostFixer(function(l,c){return d=>{const u=l.document.differ.getChanges();let g=!1;for(const f of u){if(f.type!="attribute"||f.attributeKey!="headingRows")continue;const b=f.range.start.nodeAfter,A=b.getAttribute("htmlTheadAttributes"),E=b.getAttribute("htmlTbodyAttributes");A&&!f.attributeNewValue?(d.removeAttribute("htmlTheadAttributes",b),g=!0):E&&f.attributeNewValue==c.getRows(b)&&(d.removeAttribute("htmlTbodyAttributes",b),g=!0)}return g}}(e.model,r)),s.stop())})}}class zD extends q{static get requires(){return[Fe]}static get pluginName(){return"StyleElementSupport"}init(){const e=this.editor.plugins.get(Fe);e.on("register:style",(t,n)=>{const i=this.editor,r=i.model.schema,s=i.conversion;r.register("htmlStyle",n.modelSchema),r.extend("htmlStyle",{allowAttributes:["htmlAttributes","htmlContent"],isContent:!0}),i.data.registerRawContentMatcher({name:"style"}),s.for("upcast").elementToElement({view:"style",model:Va(n)}),s.for("upcast").add(Vo(n,e)),s.for("downcast").elementToElement({model:"htmlStyle",view:(a,{writer:l})=>Qi("style",a,l)}),s.for("downcast").add(Lo(n)),t.stop()})}}class MD extends q{static get requires(){return[Fe]}static get pluginName(){return"DocumentListElementSupport"}init(){const e=this.editor;if(!e.plugins.has("DocumentListEditing"))return;const t=e.model.schema,n=e.conversion,i=e.plugins.get(Fe),r=e.plugins.get("DocumentListEditing");r.registerDowncastStrategy({scope:"item",attributeName:"htmlLiAttributes",setAttributeOnDowncast(s,a,l){Kt(s,a,l)}}),r.registerDowncastStrategy({scope:"list",attributeName:"htmlListAttributes",setAttributeOnDowncast(s,a,l){Kt(s,a,l)}}),i.on("register",(s,a)=>{["ul","ol","li"].includes(a.view)&&(s.stop(),t.checkAttribute("$block","htmlListAttributes")||(t.extend("$block",{allowAttributes:["htmlListAttributes","htmlLiAttributes"]}),t.extend("$blockObject",{allowAttributes:["htmlListAttributes","htmlLiAttributes"]}),t.extend("$container",{allowAttributes:["htmlListAttributes","htmlLiAttributes"]}),n.for("upcast").add(l=>{l.on("element:ul",ja("htmlListAttributes",i),{priority:"low"}),l.on("element:ol",ja("htmlListAttributes",i),{priority:"low"}),l.on("element:li",ja("htmlLiAttributes",i),{priority:"low"})})))}),r.on("postFixer",(s,{listNodes:a,writer:l})=>{const c=[];for(const{node:d,previous:u}of a){if(!u)continue;const g=d.getAttribute("listIndent"),f=u.getAttribute("listIndent");let b=null;if(g>f?c[f]=u:g<f?(b=c[g],c.length=g):b=u,b){if(b.getAttribute("listType")==d.getAttribute("listType")){const A=b.getAttribute("htmlListAttributes");Si(d.getAttribute("htmlListAttributes"),A)||(l.setAttribute("htmlListAttributes",A,d),s.return=!0)}if(b.getAttribute("listItemId")==d.getAttribute("listItemId")){const A=b.getAttribute("htmlLiAttributes");Si(d.getAttribute("htmlLiAttributes"),A)||(l.setAttribute("htmlLiAttributes",A,d),s.return=!0)}}}})}afterInit(){const e=this.editor;if(!e.commands.get("indentList"))return;const t=e.commands.get("indentList");this.listenTo(t,"afterExecute",(n,i)=>{e.model.change(r=>{for(const s of i)r.setAttribute("htmlListAttributes",{},s)})})}}function ja(o,e){return(t,n,i)=>{const r=n.viewItem;n.modelRange||Object.assign(n,i.convertChildren(n.viewItem,n.modelCursor));const s=e.processViewAttributes(r,i);for(const a of n.modelRange.getItems({shallow:!0}))a.hasAttribute("listItemId")&&(a.hasAttribute(o)||i.writer.setAttribute(o,s||{},a))}}class FD extends q{static get requires(){return[Fe,Xn]}static get pluginName(){return"CustomElementSupport"}init(){const e=this.editor.plugins.get(Fe),t=this.editor.plugins.get(Xn);e.on("register:$customElement",(n,i)=>{n.stop();const r=this.editor,s=r.model.schema,a=r.conversion,l=r.editing.view.domConverter.unsafeElements,c=r.data.htmlProcessor.domConverter.preElements;s.register(i.model,i.modelSchema),s.extend(i.model,{allowAttributes:["htmlElementName","htmlAttributes","htmlContent"],isContent:!0}),a.for("upcast").elementToElement({view:/.*/,model:(d,u)=>{if(d.name=="$comment"||!function(E){try{document.createElement(E)}catch{return!1}return!0}(d.name)||t.getDefinitionsForView(d.name).size)return null;l.includes(d.name)||l.push(d.name),c.includes(d.name)||c.push(d.name);const g=u.writer.createElement(i.model,{htmlElementName:d.name}),f=e.processViewAttributes(d,u);f&&u.writer.setAttribute("htmlAttributes",f,g);const b=new Bi(d.document).createDocumentFragment(d),A=r.data.processor.toData(b);u.writer.setAttribute("htmlContent",A,g);for(const{item:E}of r.editing.view.createRangeIn(d))u.consumable.consume(E,{name:!0});return g},converterPriority:"low"}),a.for("editingDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlAttributes","htmlContent"]},view:(d,{writer:u})=>{const g=d.getAttribute("htmlElementName"),f=u.createRawElement(g);return d.hasAttribute("htmlAttributes")&&Kt(u,d.getAttribute("htmlAttributes"),f),f}}),a.for("dataDowncast").elementToElement({model:{name:i.model,attributes:["htmlElementName","htmlAttributes","htmlContent"]},view:(d,{writer:u})=>{const g=d.getAttribute("htmlElementName"),f=d.getAttribute("htmlContent"),b=u.createRawElement(g,null,(A,E)=>{E.setContentOf(A,f);const P=A.firstChild;for(P.remove();P.firstChild;)A.appendChild(P.firstChild)});return d.hasAttribute("htmlAttributes")&&Kt(u,d.getAttribute("htmlAttributes"),b),b}})})}}function*eo(o,e,t){if(e)if(!(Symbol.iterator in e)&&e.is("documentSelection")&&e.isCollapsed)o.schema.checkAttributeInSelection(e,t)&&(yield e);else for(const n of function(i,r,s){return!(Symbol.iterator in r)&&(r.is("node")||r.is("$text")||r.is("$textProxy"))?i.schema.checkAttribute(r,s)?[i.createRangeOn(r)]:[]:i.schema.getValidRanges(i.createSelection(r).getRanges(),s)}(o,e,t))yield*n.getItems({shallow:!0})}var to=(o,e,t)=>new Promise((n,i)=>{var r=l=>{try{a(t.next(l))}catch(c){i(c)}},s=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(r,s);a((t=t.apply(o,e)).next())});function Uf(o,e){let t=new URL(o);if(e&&Object.keys(e).length>0){const n=new URLSearchParams;for(const[i,r]of Object.entries(e))if(Array.isArray(r))for(const s of r)n.append(i,s);else n.append(i,r);t.search=n.toString()}return t.toString()}class VD{constructor(e,t){this.loader=e,this.api_url=t}_getUploadUrl(e,t){return to(this,null,function*(){const n=yield fetch(this.api_url+"/vi/skey",{credentials:"include"}).catch(a=>{t(a)}),i=yield n.json(),r={fileName:e.name,mimeType:e.type||"application/octet-stream",size:e.size.toString(),skey:i},s=yield fetch(Uf(this.api_url+"/vi/file/getUploadURL",r),{method:"POST",credentials:"include"}).catch(a=>{t(a)});return this.loader.uploaded=10,s})}fileUpload(e,t,n){return to(this,null,function*(){yield fetch(t.values.uploadUrl,{mode:"no-cors",method:"POST",body:e}).catch(l=>{n(l)}),this.loader.uploaded=50;const i=yield fetch(this.api_url+"/vi/skey",{credentials:"include"}).catch(l=>{n(l)}),r=yield i.json(),s={key:t.values.uploadKey,node:void 0,skelType:"leaf",skey:r},a=yield fetch(Uf(this.api_url+"/vi/file/add",s),{method:"POST",credentials:"include"}).catch(l=>{n(l)});return this.loader.uploaded=75,a})}upload(){return to(this,null,function*(){return this.loader.uploadTotal=100,this.loader.uploaded=0,this.loader.file.then(e=>to(this,null,function*(){return new Promise((t,n)=>{this._getUploadUrl(e,n).then(i=>to(this,null,function*(){const r=yield i.json();this.fileUpload(e,r,n).then(s=>to(this,null,function*(){const a=yield s.json();this.loader.uploaded=100,t({default:this.api_url+a.values.downloadUrl})}))}))})}))})}abort(){this.xhr&&this.xhr.abort()}}var Wf=D(2245),LD={injectType:"singletonStyleTag",attributes:{"data-cke":!0},insert:"head",singleton:!0};G()(Wf.Z,LD),Wf.Z.locals;class $a extends Vi{}$a.builtinPlugins=[class extends q{static get requires(){return[A2,zo,E2,t2,UE,N2]}static get pluginName(){return"Essentials"}},class extends q{static get requires(){return[Ot]}static get pluginName(){return"CKFinderUploadAdapter"}init(){const o=this.editor.config.get("ckfinder.uploadUrl");o&&(this.editor.plugins.get(Ot).createUploadAdapter=e=>new L2(e,o,this.editor.t))}},class extends ui{constructor(){super(...arguments),this.token=null,this._tokens=new Map}static get pluginName(){return"CloudServices"}static get requires(){return[YS]}init(){return Bf(this,null,function*(){const o=this.context.config.get("cloudServices")||{};for(const[t,n]of Object.entries(o))this[t]=n;if(!this.tokenUrl)return void(this.token=null);const e=this.context.plugins.get("CloudServicesCore");this.token=yield e.createToken(this.tokenUrl).init(),this._tokens.set(this.tokenUrl,this.token)})}registerTokenUrl(o){return Bf(this,null,function*(){if(this._tokens.has(o))return this.getTokenFor(o);const e=this.context.plugins.get("CloudServicesCore"),t=yield e.createToken(o).init();return this._tokens.set(o,t),t})}getTokenFor(o){const e=this._tokens.get(o);if(!e)throw new I("cloudservices-token-not-registered",this);return e}destroy(){super.destroy();for(const o of this._tokens.values())o.destroy()}},class extends q{static get requires(){return[j2,$2]}static get pluginName(){return"Bold"}},class extends q{static get requires(){return[q2,U2]}static get pluginName(){return"Italic"}},class extends q{static get requires(){return[Z2,Y2]}static get pluginName(){return"BlockQuote"}},class extends q{static get pluginName(){return"EasyImage"}static get requires(){return[Q2,"ImageUpload"]}init(){const o=this.editor;o.plugins.has("ImageBlockEditing")||o.plugins.has("ImageInlineEditing")||Q("easy-image-image-feature-missing",o)}},class extends q{static get requires(){return[ox,rx]}static get pluginName(){return"Heading"}},class extends q{static get requires(){return[vx,Ex]}static get pluginName(){return"Image"}},class extends q{static get requires(){return[Wg,Qx]}static get pluginName(){return"ImageStyle"}},class extends q{static get requires(){return[qi,Nt]}static get pluginName(){return"ImageToolbar"}afterInit(){const o=this.editor,e=o.t,t=o.plugins.get(qi),n=o.plugins.get("ImageUtils");var i;t.register("image",{ariaLabel:e("Image toolbar"),items:(i=o.config.get("image.toolbar")||[],i.map(r=>xe(r)?r.name:r)),getRelatedElement:r=>n.getClosestSelectedImageWidget(r)})}},class extends q{static get pluginName(){return"ImageUpload"}static get requires(){return[Vx,Dx,Px]}},class extends q{constructor(o){super(o),this._resizeUnit=o.config.get("image.resizeUnit")}static get requires(){return[qx]}static get pluginName(){return"ImageResizeButtons"}init(){const o=this.editor,e=o.config.get("image.resizeOptions"),t=o.commands.get("resizeImage");this.bind("isEnabled").to(t);for(const n of e)this._registerImageResizeButton(n);this._registerImageResizeDropdown(e)}_registerImageResizeButton(o){const e=this.editor,{name:t,value:n,icon:i}=o,r=n?n+this._resizeUnit:null;e.ui.componentFactory.add(t,s=>{const a=new Ae(s),l=e.commands.get("resizeImage"),c=this._getOptionLabelValue(o,!0);if(!ha[i])throw new I("imageresizebuttons-missing-icon",e,o);return a.set({label:c,icon:ha[i],tooltip:c,isToggleable:!0}),a.bind("isEnabled").to(this),a.bind("isOn").to(l,"value",Rg(r)),this.listenTo(a,"execute",()=>{e.execute("resizeImage",{width:r})}),a})}_registerImageResizeDropdown(o){const e=this.editor,t=e.t,n=o.find(r=>!r.value),i=r=>{const s=e.commands.get("resizeImage"),a=It(r,od),l=a.buttonView,c=t("Resize image");return l.set({tooltip:c,commandValue:n.value,icon:ha.medium,isToggleable:!0,label:this._getOptionLabelValue(n),withText:!0,class:"ck-resize-image-button",ariaLabel:c,ariaLabelledBy:void 0}),l.bind("label").to(s,"value",d=>d&&d.width?d.width:this._getOptionLabelValue(n)),a.bind("isEnabled").to(this),Vs(a,()=>this._getResizeDropdownListItemDefinitions(o,s),{ariaLabel:t("Image resize list"),role:"menu"}),this.listenTo(a,"execute",d=>{e.execute(d.source.commandName,{width:d.source.commandValue}),e.editing.view.focus()}),a};e.ui.componentFactory.add("resizeImage",i),e.ui.componentFactory.add("imageResize",i)}_getOptionLabelValue(o,e=!1){const t=this.editor.t;return o.label?o.label:e?o.value?t("Resize image to %0",o.value+this._resizeUnit):t("Resize image to the original size"):o.value?o.value+this._resizeUnit:t("Original")}_getResizeDropdownListItemDefinitions(o,e){const t=new st;return o.map(n=>{const i=n.value?n.value+this._resizeUnit:null,r={type:"button",model:new Ys({commandName:"resizeImage",commandValue:i,label:this._getOptionLabelValue(n),role:"menuitemradio",withText:!0,icon:null})};r.model.bind("isOn").to(e,"value",Rg(i)),t.add(r)}),t}},class extends q{static get pluginName(){return"Indent"}static get requires(){return[Xx,e5]}},class extends q{constructor(o){super(o),o.config.define("indentBlock",{offset:40,unit:"px"})}static get pluginName(){return"IndentBlock"}init(){const o=this.editor,e=o.config.get("indentBlock");e.classes&&e.classes.length?(this._setupConversionUsingClasses(e.classes),o.commands.add("indentBlock",new Zi(o,new ep({direction:"forward",classes:e.classes}))),o.commands.add("outdentBlock",new Zi(o,new ep({direction:"backward",classes:e.classes})))):(o.data.addStyleProcessorRules(F1),this._setupConversionUsingOffset(),o.commands.add("indentBlock",new Zi(o,new Xg({direction:"forward",offset:e.offset,unit:e.unit}))),o.commands.add("outdentBlock",new Zi(o,new Xg({direction:"backward",offset:e.offset,unit:e.unit}))))}afterInit(){const o=this.editor,e=o.model.schema,t=o.commands.get("indent"),n=o.commands.get("outdent"),i=o.config.get("heading.options");(i&&i.map(r=>r.model)||t5).forEach(r=>{e.isRegistered(r)&&e.extend(r,{allowAttributes:"blockIndent"})}),e.setAttributeProperties("blockIndent",{isFormatting:!0}),t.registerChildCommand(o.commands.get("indentBlock")),n.registerChildCommand(o.commands.get("outdentBlock"))}_setupConversionUsingOffset(){const o=this.editor.conversion,e=this.editor.locale.contentLanguageDirection==="rtl"?"margin-right":"margin-left";o.for("upcast").attributeToAttribute({view:{styles:{[e]:/[\s\S]+/}},model:{key:"blockIndent",value:t=>t.getStyle(e)}}),o.for("downcast").attributeToAttribute({model:"blockIndent",view:t=>({key:"style",value:{[e]:t}})})}_setupConversionUsingClasses(o){const e={model:{key:"blockIndent",values:[]},view:{}};for(const t of o)e.model.values.push(t),e.view[t]={key:"class",value:[t]};this.editor.conversion.attributeToAttribute(e)}},class extends q{static get requires(){return[x5,I5,R5]}static get pluginName(){return"Link"}},class extends q{static get requires(){return[eS,j5]}static get pluginName(){return"List"}},ca,class extends q{static get requires(){return[yS,SS,kn,RS,IS,TS,Mo]}static get pluginName(){return"Table"}},class extends q{static get requires(){return[qi]}static get pluginName(){return"TableToolbar"}afterInit(){const o=this.editor,e=o.t,t=o.plugins.get(qi),n=o.config.get("table.contentToolbar"),i=o.config.get("table.tableToolbar");n&&t.register("tableContent",{ariaLabel:e("Table toolbar"),items:n,getRelatedElement:zS}),i&&t.register("table",{ariaLabel:e("Table toolbar"),items:i,getRelatedElement:NS})}},class extends q{static get requires(){return["Delete","Input"]}static get pluginName(){return"TextTransformation"}constructor(o){super(o),o.config.define("typing",{transformations:{include:GE}})}init(){const o=this.editor.model.document.selection;o.on("change:range",()=>{this.isEnabled=!o.anchor.parent.is("element","codeBlock")}),this._enableTransformationWatchers()}_enableTransformationWatchers(){const o=this.editor,e=o.model,t=o.plugins.get("Delete"),n=function(r){const s=r.extra||[],a=r.remove||[],l=c=>!a.includes(c);return function(c){const d=new Set;for(const u of c)if(typeof u=="string"&&km[u])for(const g of km[u])d.add(g);else d.add(u);return Array.from(d)}(r.include.concat(s).filter(l)).filter(l).map(c=>typeof c=="string"&&fm[c]?fm[c]:c).filter(c=>typeof c=="object").map(c=>({from:ZE(c.from),to:JE(c.to)}))}(o.config.get("typing.transformations")),i=new mm(o.model,r=>{for(const s of n)if(s.from.test(r))return{normalizedTransformation:s}});i.on("matched:data",(r,s)=>{if(!s.batch.isTyping)return;const{from:a,to:l}=s.normalizedTransformation,c=a.exec(s.text),d=l(c.slice(1)),u=s.range;let g=c.index;e.enqueueChange(f=>{for(let b=1;b<c.length;b++){const A=c[b],E=d[b-1];if(E==null){g+=A.length;continue}const P=u.start.getShiftedBy(g),z=e.createRange(P,P.getShiftedBy(A.length)),j=YE(P);e.insertContent(f.createText(E,j),z),g+=E.length}e.enqueueChange(()=>{t.requestUndoOnBackspace()})})}),i.bind("isEnabled").to(this)}},class extends q{static get requires(){return[W2,K2]}static get pluginName(){return"Underline"}},class extends q{static get requires(){return[XS,eD]}static get pluginName(){return"Alignment"}},class extends q{constructor(o){super(o),this.set("isSourceEditingMode",!1),this._elementReplacer=new Cl,this._replacedRoots=new Map,this._dataFromRoots=new Map}static get pluginName(){return"SourceEditing"}static get requires(){return[Ii]}init(){const o=this.editor;o.t,o.ui.componentFactory.add("sourceEditing",e=>{const t=new Ae(e);return t.set({icon:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m12.5 0 5 4.5v15.003h-16V0h11zM3 1.5v3.25l-1.497 1-.003 8 1.5 1v3.254L7.685 18l-.001 1.504H17.5V8.002L16 9.428l-.004-4.22-4.222-3.692L3 1.5z"/><path d="M4.06 6.64a.75.75 0 0 1 .958 1.15l-.085.07L2.29 9.75l2.646 1.89c.302.216.4.62.232.951l-.058.095a.75.75 0 0 1-.951.232l-.095-.058-3.5-2.5V9.14l3.496-2.5zm4.194 6.22a.75.75 0 0 1-.958-1.149l.085-.07 2.643-1.89-2.646-1.89a.75.75 0 0 1-.232-.952l.058-.095a.75.75 0 0 1 .95-.232l.096.058 3.5 2.5v1.22l-3.496 2.5zm7.644-.836 2.122 2.122-5.825 5.809-2.125-.005.003-2.116zm2.539-1.847 1.414 1.414a.5.5 0 0 1 0 .707l-1.06 1.06-2.122-2.12 1.061-1.061a.5.5 0 0 1 .707 0z"/></svg>',tooltip:!0,withText:!0,class:"ck-source-editing-button"}),t.bind("isOn").to(this,"isSourceEditingMode"),t.bind("isEnabled").to(this,"isEnabled",o,"isReadOnly",o.plugins.get(Ii),"hasAny",(n,i,r)=>!!n&&!i&&!r),this.listenTo(t,"execute",()=>{this.isSourceEditingMode=!this.isSourceEditingMode}),t}),this._isAllowedToHandleSourceEditingMode()&&(this.on("change:isSourceEditingMode",(e,t,n)=>{n?(this._showSourceEditing(),this._disableCommands()):(this._hideSourceEditing(),this._enableCommands())}),this.on("change:isEnabled",(e,t,n)=>this._handleReadOnlyMode(!n)),this.listenTo(o,"change:isReadOnly",(e,t,n)=>this._handleReadOnlyMode(n))),o.data.on("get",()=>{this.isSourceEditingMode&&this.updateEditorData()},{priority:"high"})}afterInit(){const o=this.editor;["RealTimeCollaborativeEditing","CommentsEditing","TrackChangesEditing","RevisionHistory"].some(e=>o.plugins.has(e))&&console.warn("You initialized the editor with the source editing feature and at least one of the collaboration features. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the collaboration features."),o.plugins.has("RestrictedEditingModeEditing")&&console.warn("You initialized the editor with the source editing feature and restricted editing feature. Please be advised that the source editing feature may not work, and be careful when editing document source that contains markers created by the restricted editing feature.")}updateEditorData(){const o=this.editor,e={};for(const[t,n]of this._replacedRoots){const i=this._dataFromRoots.get(t),r=n.dataset.value;i!==r&&(e[t]=r)}Object.keys(e).length&&o.data.set(e,{batchType:{isUndoable:!0}})}_showSourceEditing(){const o=this.editor,e=o.editing.view,t=o.model;t.change(n=>{n.setSelection(null),n.removeSelectionAttribute(t.document.selection.getAttributeKeys())});for(const[n,i]of e.domRoots){const r=oD(o.data.get({rootName:n})),s=br(i.ownerDocument,"textarea",{rows:"1","aria-label":"Source code editing area"}),a=br(i.ownerDocument,"div",{class:"ck-source-editing-area","data-value":r},[s]);s.value=r,s.setSelectionRange(0,0),s.addEventListener("input",()=>{a.dataset.value=s.value,o.ui.update()}),e.change(l=>{const c=e.document.getRoot(n);l.addClass("ck-hidden",c)}),o.ui.setEditableElement("sourceEditing:"+n,s),this._replacedRoots.set(n,a),this._elementReplacer.replace(i,a),this._dataFromRoots.set(n,r)}this._focusSourceEditing()}_hideSourceEditing(){const o=this.editor.editing.view;this.updateEditorData(),o.change(e=>{for(const[t]of this._replacedRoots)e.removeClass("ck-hidden",o.document.getRoot(t))}),this._elementReplacer.restore(),this._replacedRoots.clear(),this._dataFromRoots.clear(),o.focus()}_focusSourceEditing(){const o=this.editor,[e]=this._replacedRoots.values(),t=e.querySelector("textarea");o.editing.view.document.isFocused=!1,t.focus()}_disableCommands(){const o=this.editor;for(const e of o.commands.commands())e.forceDisabled(Of)}_enableCommands(){const o=this.editor;for(const e of o.commands.commands())e.clearForceDisabled(Of)}_handleReadOnlyMode(o){if(this.isSourceEditingMode)for(const[,e]of this._replacedRoots)e.querySelector("textarea").readOnly=o}_isAllowedToHandleSourceEditingMode(){const o=this.editor.ui.view.editable;return o&&!o.hasExternalElement}},class extends q{static get requires(){return[sD,iD]}static get pluginName(){return"RemoveFormat"}},class extends q{static get pluginName(){return"GeneralHtmlSupport"}static get requires(){return[Fe,BD,TD,ID,PD,RD,OD,ND,zD,MD,FD]}init(){const o=this.editor,e=o.plugins.get(Fe);e.loadAllowedConfig(o.config.get("htmlSupport.allow")||[]),e.loadDisallowedConfig(o.config.get("htmlSupport.disallow")||[])}getGhsAttributeNameForElement(o){const e=this.editor.plugins.get("DataSchema"),t=Array.from(e.getDefinitionsForView(o,!1)),n=t.find(i=>i.isInline&&!t[0].isObject);return n?n.model:"htmlAttributes"}addModelHtmlClass(o,e,t){const n=this.editor.model,i=this.getGhsAttributeNameForElement(o);n.change(r=>{for(const s of eo(n,t,i))An(r,s,i,"classes",a=>{for(const l of Pe(e))a.add(l)})})}removeModelHtmlClass(o,e,t){const n=this.editor.model,i=this.getGhsAttributeNameForElement(o);n.change(r=>{for(const s of eo(n,t,i))An(r,s,i,"classes",a=>{for(const l of Pe(e))a.delete(l)})})}setModelHtmlAttributes(o,e,t){const n=this.editor.model,i=this.getGhsAttributeNameForElement(o);n.change(r=>{for(const s of eo(n,t,i))An(r,s,i,"attributes",a=>{for(const[l,c]of Object.entries(e))a.set(l,c)})})}removeModelHtmlAttributes(o,e,t){const n=this.editor.model,i=this.getGhsAttributeNameForElement(o);n.change(r=>{for(const s of eo(n,t,i))An(r,s,i,"attributes",a=>{for(const l of Pe(e))a.delete(l)})})}setModelHtmlStyles(o,e,t){const n=this.editor.model,i=this.getGhsAttributeNameForElement(o);n.change(r=>{for(const s of eo(n,t,i))An(r,s,i,"styles",a=>{for(const[l,c]of Object.entries(e))a.set(l,c)})})}removeModelHtmlStyles(o,e,t){const n=this.editor.model,i=this.getGhsAttributeNameForElement(o);n.change(r=>{for(const s of eo(n,t,i))An(r,s,i,"styles",a=>{for(const l of Pe(e))a.delete(l)})})}}],$a.defaultConfig={extraPlugins:[function(o){o.plugins.get("FileRepository").createUploadAdapter=e=>new VD(e,o.config.get("viur_api_url"))},function(o){o.conversion.attributeToElement({model:"bold",view:"b",upcastAlso:[e=>{const t=e.getStyle("font-weight");return t&&(t=="bold"||Number(t)>=600)?{name:!0,styles:["font-weight"]}:null}]})}],toolbar:{items:["heading","|","bold","italic","underline","|","alignment","numberedList","bulletedList","blockQuote","|","indent","outdent","|","link","insertTable","imageUpload","|","undo","redo","RemoveFormat","sourceEditing"]},image:{toolbar:["imageStyle:inline","imageStyle:block","imageStyle:side","|","resizeImage:50","resizeImage:75","resizeImage:original","imageTextAlternative"],resizeOptions:[{name:"resizeImage:original",value:null,icon:"original"},{name:"resizeImage:50",value:"50",icon:"medium"},{name:"resizeImage:75",value:"75",icon:"large"}]},table:{contentToolbar:["tableColumn","tableRow","mergeTableCells"]},heading:{options:[{model:"paragraph",title:"Paragraph",class:"ck-heading_paragraph"},{model:"heading1",view:"h1",title:"Heading 1",class:"ck-heading_heading1"},{model:"heading2",view:"h2",title:"Heading 2",class:"ck-heading_heading2"},{model:"heading3",view:"h3",title:"Heading 3",class:"ck-heading_heading3"},{model:"heading4",view:"h4",title:"Heading 4",class:"ck-heading_heading4"},{model:"heading5",view:"h5",title:"Heading 5",class:"ck-heading_heading5"},{model:"heading6",view:"h6",title:"Heading 6",class:"ck-heading_heading6"}]},alignment:{options:[{name:"left",className:"viur-txt-align--left"},{name:"right",className:"viur-txt-align--right"},{name:"center",className:"viur-txt-align--center"},{name:"justify",className:"viur-txt-align--justify"}]},indentBlock:{classes:["viur-txt-indent--1","viur-txt-indent--2","viur-txt-indent--3","viur-txt-indent--4","viur-txt-indent--5","viur-txt-indent--6","viur-txt-indent--7","viur-txt-indent--8","viur-txt-indent--9","viur-txt-indent--10"]},htmlSupport:{allow:[{name:"a",attributes:{target:!0,rel:!0}}]},language:"de",viur_api_url:"http://localhost:8080"}})(),M=M.default})())}(Wo,Wo.exports);var jw=Wo.exports;const rl=Lw(jw),$w=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({value:"",editorConfig:{},editor:h.computed(()=>rl)});function D(S){x.emit("change",m.name,N.value,m.lang,m.index)}function M(S){N.value=S.target.value,x.emit("change",m.name,N.value,m.lang,m.index)}h.onMounted(()=>{m.value!==null&&(N.value=m.value),x.emit("change",m.name,m.value,m.lang,m.index)});function w(S){S.editing.view.change(p=>{p.setStyle("min-height","250px",S.editing.view.document.getRoot())})}return h.watch(()=>m.value,(S,p)=>{N.value=S}),{state:N,ClassicEditor:rl,boneState:C,changeEvent:D,onReady:w,changeEventTextarea:M}}}),Hw=["disabled","value"];function qw(m,x,C,N,D,M){var S,p,y,B;const w=h.resolveComponent("ckeditor");return m.state.editor?(h.openBlock(),h.createElementBlock(h.Fragment,{key:0},[(S=m.boneState.bonestructure)!=null&&S.valid_html||(p=m.boneState.bonestructure)!=null&&p.validHtml?(h.openBlock(),h.createBlock(w,{key:0,modelValue:m.state.value,"onUpdate:modelValue":x[0]||(x[0]=v=>m.state.value=v),editor:m.state.editor,config:m.state.editorConfig,disabled:(y=m.boneState)==null?void 0:y.readonly,onReady:m.onReady,onInput:m.changeEvent},null,8,["modelValue","editor","config","disabled","onReady","onInput"])):(h.openBlock(),h.createElementBlock("sl-textarea",{key:1,disabled:(B=m.boneState)==null?void 0:B.readonly,value:m.value,onInput:x[1]||(x[1]=(...v)=>m.changeEventTextarea&&m.changeEventTextarea(...v))},null,40,Hw))],64)):h.createCommentVNode("",!0)}const sl=de($w,[["render",qw]]),Uw=h.defineComponent({inheritAttrs:!1,props:{name:String,value:[Object,String,Number,Boolean,Array],index:Number,lang:String},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({valueLat:null,valueLng:null});function D(){x.emit("change",m.name,[N.valueLat,N.valueLng],m.lang,m.index)}return h.onMounted(()=>{try{N.valueLat=m.value[0],N.valueLng=m.value[1]}catch{}x.emit("change",m.name,[N.valueLat,N.valueLng],m.lang,m.index)}),{state:N,boneState:C,changeEvent:D}}}),Ww=["name","min","max","disabled"],Kw=["name","min","max","disabled"];function Gw(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock(h.Fragment,null,[h.withDirectives(h.createElementVNode("sl-input",{"onUpdate:modelValue":x[0]||(x[0]=w=>m.state.valueLat=w),index:"lat",type:"number",name:m.name,min:m.boneState.bonestructure.boundslat[0],max:m.boneState.bonestructure.boundslat[1],disabled:m.boneState.readonly,"value-as-number":"",step:"0.000001",onSlChange:x[1]||(x[1]=(...w)=>m.changeEvent&&m.changeEvent(...w)),placeholder:"Lat"},null,40,Ww),[[h.vModelText,m.state.valueLat]]),h.withDirectives(h.createElementVNode("sl-input",{"onUpdate:modelValue":x[2]||(x[2]=w=>m.state.valueLng=w),index:"lng",type:"number",name:m.name,min:m.boneState.bonestructure.boundslat[0],max:m.boneState.bonestructure.boundslat[1],disabled:m.boneState.readonly,"value-as-number":"",step:"0.000001",onSlChange:x[3]||(x[3]=(...w)=>m.changeEvent&&m.changeEvent(...w)),placeholder:"Long"},null,40,Kw),[[h.vModelText,m.state.valueLng]])],64)}const al=de(Uw,[["render",Gw],["__scopeId","data-v-7bc31020"]]),Zw=h.defineComponent({props:{name:String,value:Object,index:Number,lang:String,readonly:Boolean,params:Object},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.reactive({counter:0,debounce:null}),D=h.inject("addMultipleEntry"),M=h.inject("removeMultipleEntries");function w(){N.counter+=1;let p=200;N.counter>1&&(p=500),N.debounce&&clearTimeout(N.debounce),N.debounce=setTimeout(()=>{for(let y=N.counter;y--;)D(m.lang);N.counter=0},p)}function S(){let p=200;N.debounce&&clearTimeout(N.debounce),N.debounce=setTimeout(()=>{M(m.lang)},p)}return h.onMounted(()=>{(!m.value||m.value.length===0)&&x.emit("change",m.name,[],m.lang)}),{state:N,boneState:C,handleAdd:w,handleRemove:S,removeMultipleEntries:M}}}),ll=m=>(h.pushScopeId("data-v-63e75dee"),m=m(),h.popScopeId(),m),Jw={class:"actionbar"},Yw=["title"],Qw=[ll(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"x-lg"},null,-1))],Xw=["title"],eA=ll(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"plus-lg"},null,-1));function tA(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("div",Jw,[m.boneState.multiple&&!m.readonly?(h.openBlock(),h.createElementBlock("sl-button",{key:0,variant:"danger",title:m.$t("bone.del"),outline:"",class:"delete-btn",onClick:x[0]||(x[0]=w=>m.handleRemove(m.lang))},Qw,8,Yw)):h.createCommentVNode("",!0),m.boneState.multiple&&!m.readonly?(h.openBlock(),h.createElementBlock("sl-button",{key:1,variant:"success",title:m.$t("bone.add"),outline:"",class:"add-btn",onClick:x[1]||(x[1]=w=>m.handleAdd(m.lang))},[eA,h.createTextVNode(" "+h.toDisplayString(m.$t("bone.add"))+" ",1),m.state.counter>1?(h.openBlock(),h.createElementBlock(h.Fragment,{key:0},[h.createTextVNode("("+h.toDisplayString(m.state.counter)+")",1)],64)):h.createCommentVNode("",!0)],8,Xw)):h.createCommentVNode("",!0)])}const nA=de(Zw,[["render",tA],["__scopeId","data-v-63e75dee"]]);var oA={VITE_API_URL:"",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const iA=h.defineComponent({props:{name:String,value:Object,index:Number,lang:String,readonly:Boolean,params:Object},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.inject("addMultipleEntry"),D=h.inject("formatString"),M=null,w=h.reactive({skels:{},hasUsing:h.computed(()=>C==null?void 0:C.bonestructure.using)});function S(p){let y="";return C.bonestructure.type==="relational.tree.leaf.file"?y="skelType=leaf&":C.bonestructure.type==="relational.tree.node.file"&&(y="skelType=node&"),we.get(`/${oA.VITE_DEFAULT_RENDERER||"vi"}/${C.bonestructure.module}/list?${y}limit=99`).then(async B=>{var k;const v=await B.json();return w.skels=v.skellist.reduce((_,R)=>(_[R.key]=R,_),{}),(k=v.skellist)==null?void 0:k.map(_=>({text:D(C.bonestructure.format,{dest:_}),value:_.key,data:_}))})}return h.onMounted(()=>{(!m.value||m.value.length===0)&&x.emit("change",m.name,[],m.lang)}),{state:w,boneState:C,addMultipleEntry:N,removeMultipleEntries:M,getList:S}}}),cl=m=>(h.pushScopeId("data-v-eeea51c6"),m=m(),h.popScopeId(),m),rA={class:"actionbar"},sA=["title"],aA=[cl(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"x-lg"},null,-1))],lA=["source"],cA=["title"],dA=cl(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"plus-lg"},null,-1));function hA(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("div",rA,[m.boneState.multiple&&!m.readonly?(h.openBlock(),h.createElementBlock("sl-button",{key:0,variant:"danger",title:m.$t("bone.del"),outline:"",class:"delete-btn",onClick:x[0]||(x[0]=w=>m.openSelector())},aA,8,sA)):h.createCommentVNode("",!0),h.createElementVNode("sl-combobox",{source:m.getList,hoist:"",onSlItemSelect:x[1]||(x[1]=w=>{var S;return m.addMultipleEntry(m.lang,{dest:(S=m.state.skels)==null?void 0:S[w.detail.item.value],rel:m.state.hasUsing?void 0:null})})},null,40,lA),m.boneState.multiple&&!m.readonly?(h.openBlock(),h.createElementBlock("sl-button",{key:1,variant:"success",title:m.$t("bone.add"),outline:"",class:"add-btn",onClick:x[2]||(x[2]=w=>m.addMultipleEntry(m.lang))},[dA,h.createTextVNode(" "+h.toDisplayString(m.$t("bone.list")),1)],8,cA)):h.createCommentVNode("",!0)])}const uA=de(iA,[["render",hA],["__scopeId","data-v-eeea51c6"]]);var dl={VITE_API_URL:"",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const mA=h.defineComponent({props:{name:String,value:Object,index:Number,lang:String,readonly:Boolean,params:Object},components:{},emits:["change"],setup(m,x){const C=h.inject("boneState"),N=h.inject("addMultipleEntry");h.inject("formatString");const D=null,M=h.ref(),w=h.reactive({skels:{},uploadinput:null,loading:!1,droparea:!1,hasUsing:h.computed(()=>C==null?void 0:C.bonestructure.using)});function S(B){const v={fileName:B.name,mimeType:B.type||"application/octet-stream",size:B.size.toString()};return new Promise((k,_)=>{we.securePost(`/${dl.VITE_DEFAULT_RENDERER||"vi"}/file/getUploadURL`,{dataObj:v}).then(async R=>{let T=await R.json();fetch(T.values.uploadUrl,{body:B,method:"POST",mode:"no-cors"}).then(async O=>{const F={key:T.values.uploadKey,node:void 0,skelType:"leaf"};we.securePost(`/${dl.VITE_DEFAULT_RENDERER||"vi"}/file/add`,{dataObj:F}).then(async L=>{let $=await L.json();$.action==="addSuccess"?k($.values):_($)}).catch(L=>{_(L)})}).catch(O=>{_(O)})}).catch(R=>{_(R)})})}async function p(B){w.loading=!0;for(let v of B.target.files){let k=await S(v);M.value.value=null;let _=null;w.hasUsing&&(_=void 0),N(m.lang,{dest:k,rel:_})}w.loading=!1}async function y(B){w.loading=!0,w.droparea=!1;for(let v of B.dataTransfer.files){let k=await S(v);M.value.value=null;let _=null;w.hasUsing&&(_=void 0),N(m.lang,{dest:k,rel:_})}w.loading=!1}return h.onMounted(()=>{(!m.value||m.value.length===0)&&x.emit("change",m.name,[],m.lang)}),{state:w,boneState:C,addMultipleEntry:N,removeMultipleEntries:D,uploadFile:S,uploadinput:M,handleUpload:p,handleDrop:y}}}),cr=m=>(h.pushScopeId("data-v-9bac9f8a"),m=m(),h.popScopeId(),m),gA=["title"],pA=[cr(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"x-lg"},null,-1))],fA={key:1,class:"droparea"},kA=["multiple"],bA=["title"],wA=[cr(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"plus-lg"},null,-1))],AA=["title"],_A=cr(()=>h.createElementVNode("sl-icon",{name:"upload"},null,-1)),CA={key:0,slot:"suffix"};function vA(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("div",{class:"actionbar",onDragover:x[4]||(x[4]=h.withModifiers(w=>m.state.droparea=!0,["prevent"])),onDragleave:x[5]||(x[5]=w=>m.state.droparea=!1),onDrop:x[6]||(x[6]=h.withModifiers((...w)=>m.handleDrop&&m.handleDrop(...w),["prevent"]))},[m.boneState.multiple&&!m.readonly?(h.openBlock(),h.createElementBlock("sl-button",{key:0,variant:"danger",title:m.$t("bone.del"),outline:"",class:"delete-btn",onClick:x[0]||(x[0]=w=>m.openSelector())},pA,8,gA)):h.createCommentVNode("",!0),m.state.droparea?(h.openBlock(),h.createElementBlock("div",fA," Dateien hier hinziehen ")):h.createCommentVNode("",!0),h.createElementVNode("input",{ref:"uploadinput",hidden:"",type:"file",multiple:m.boneState.multiple,onChange:x[1]||(x[1]=(...w)=>m.handleUpload&&m.handleUpload(...w))},null,40,kA),m.boneState.multiple&&!m.readonly?(h.openBlock(),h.createElementBlock("sl-button",{key:2,outline:"",title:m.$t("bone.list"),class:"add-btn",onClick:x[2]||(x[2]=w=>m.addMultipleEntry(m.lang))},wA,8,bA)):h.createCommentVNode("",!0),m.boneState.multiple&&!m.readonly?(h.openBlock(),h.createElementBlock("sl-button",{key:3,variant:"success",outline:"",title:m.$t("bone.upload"),class:"upload-btn",onClick:x[3]||(x[3]=w=>m.uploadinput.click())},[_A,h.createTextVNode(" "+h.toDisplayString(m.$t("bone.upload"))+" ",1),m.state.loading?(h.openBlock(),h.createElementBlock("sl-spinner",CA)):h.createCommentVNode("",!0)],8,AA)):h.createCommentVNode("",!0)],32)}const yA=de(mA,[["render",vA],["__scopeId","data-v-9bac9f8a"]]),dr=or.defineStore("boneStore",()=>{const m=h.reactive({additionalBones:h.shallowRef({}),defaultBones:h.shallowRef({rawBone:ar,keyBone:Ua,stringBone:Wa,emailBone:Ka,dateBone:Ga,booleanBone:Ja,selectBone:Za,passwordBone:Ya,recordBone:Xa,numericBone:tl,colorBone:el,relationalBone:nl,jsonBone:Aw,fileBone:il,textBone:sl,spatialBone:al}),actionbars:h.shallowRef({"relational.tree.leaf.file.file":yA,"relational.":uA}),multibones:h.shallowRef(["select","select."])});function x(w,S){m.additionalBones[w]=S}function C(){let w=m.defaultBones;for(const[S,p]of Object.entries(m.additionalBones))w.add(p);return w}function N(w){if(Object.keys(m.additionalBones).includes(w))return m.additionalBones[w];{let S=w.split("."),p=Object.entries(m.additionalBones).filter(y=>y[0].startsWith(S[0]+"."));if(p.length>0){p.sort((y,B)=>B.length-y.length);for(let y of p)if(w.startsWith(y[0]))return m.additionalBones[y[0]]}}return w==="date"?Ga:w==="key"?Ua:w==="str.email"?Ka:w==="str"||w.startsWith("str.")?Wa:w==="select"||w.startsWith("select.")?Za:w==="bool"?Ja:w==="password"?Ya:w==="record"?Xa:w==="numeric"||w.startsWith("numeric.")?tl:w==="relational.tree.leaf.file.file"?il:w==="relational"||w.startsWith("relational.")?nl:w==="color"?el:w==="text"?sl:w==="spatial"?al:ar}function D(w,S){m.actionbars[w]=S}function M(w){if(Object.keys(m.actionbars).includes(w))return m.actionbars[w];{let S=w.split("."),p=Object.entries(m.actionbars).filter(y=>y[0].startsWith(S[0]+"."));if(p.length>0){p.sort((y,B)=>B.length-y.length);for(let y of p)if(w.startsWith(y[0]))return m.actionbars[y[0]]}}return nA}return{state:m,addBoneWidget:x,getBoneWidget:N,importWidgets:C,addBoneActionbar:D,getBoneActionbar:M}});function EA(m){return dr().getBoneActionbar(m)}function Jt(m){return dr().getBoneWidget(m)}function xA(m){const x=dr();if(x.state.multibones.includes(m))return!0;{let C=m.split("."),N=Object.entries(x.state.multibones).filter(D=>D[1].startsWith(C[0]+"."));if(N.length>0){N.sort((D,M)=>M.length-D.length);for(let D of N)if(m.startsWith(D[1]))return!0}}return!1}const hr=m=>(h.pushScopeId("data-v-96ba7336"),m=m(),h.popScopeId(),m),SA=hr(()=>h.createElementVNode("h2",{class:"viur-shop-form-headline headline"},"Nutzterdaten",-1)),DA=hr(()=>h.createElementVNode("h2",{class:"viur-shop-form-headline headline"},"Lieferadresse",-1)),BA={key:0},TA=hr(()=>h.createElementVNode("h2",{class:"viur-shop-form-headline headline"},"Rechnungsadresse",-1)),IA=de({__name:"UserInformation",props:{mode:{type:String,default:"form"},conditions:{type:Function}},setup(m){const x=vn(),C=h.reactive({formValues:{},requiredFieldsFilled:h.computed(()=>{if(C.isCustomAdress)return Object.keys(C.formValues).includes("city")&&Object.keys(C.formValues).includes("street")&&Object.keys(C.formValues).includes("billing.city")&&Object.keys(C.formValues).includes("billing.street")&&Object.keys(C.formValues).includes("email")&&Object.keys(C.formValues).includes("firstname")&&Object.keys(C.formValues).includes("lastname");if(!C.isCustomAdress)return Object.keys(C.formValues).includes("city")&&Object.keys(C.formValues).includes("street")&&Object.keys(C.formValues).includes("email")&&Object.keys(C.formValues).includes("firstname")&&Object.keys(C.formValues).includes("lastname")}),isCustomAdress:!1,addSkel:null,errors:{}});function N(w){w.target.checked&&(C.isCustomAdress=!1),w.target.checked||(C.isCustomAdress=!0)}function D(w,S){for(const[p,y]of Object.entries(S.value[0]))C.formValues[p]=y}function M(w){let S={};return w instanceof Object?w:(w.forEach(p=>{let y=p[0],B=p[1];S[y]=B}),S)}return h.watch(C.formValues,w=>{Object.entries(w).forEach(([S,p])=>{p===""&&delete C.formValues[S]})}),h.onBeforeMount(async()=>{await x.getAdressStructure(),C.addSkel=x.state.structure.address}),(w,S)=>{const p=h.resolveComponent("bone");return h.openBlock(),h.createElementBlock(h.Fragment,null,[h.createElementVNode("div",null,[SA,(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(M(C.addSkel),(y,B)=>(h.openBlock(),h.createElementBlock(h.Fragment,{key:y},[B.visible&&B.params.group==="Customer Info"?(h.openBlock(),h.createBlock(p,{key:0,is:h.unref(Jt)(B.type),name:y,structure:M(C.addSkel),errors:C.errors[y]?C.errors[y]:[],skel:C.formValues,onChange:v=>D(y,v),class:"viur-shop-form-grid-w-2"},null,8,["is","name","structure","errors","skel","onChange"])):h.createCommentVNode("",!0)],64))),128))]),h.createElementVNode("div",null,[DA,(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(C.addSkel,y=>(h.openBlock(),h.createElementBlock(h.Fragment,{key:y[0]},[y[1].visible&&y[1].params.group==="Customer Address"?(h.openBlock(),h.createBlock(p,{key:0,is:h.unref(Jt)(y[1].type),name:y[0],structure:M(C.addSkel),errors:C.errors[y[0]]?C.errors[y[0]]:[],skel:C.formValues,onChange:B=>D(y[0],B)},null,8,["is","name","structure","errors","skel","onChange"])):h.createCommentVNode("",!0)],64))),128))]),C.isCustomAdress?(h.openBlock(),h.createElementBlock("div",BA,[TA,(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(C.addSkel,y=>(h.openBlock(),h.createElementBlock(h.Fragment,{key:y[0]},[y[1].visible&&y[1].params.group==="Customer Address"?(h.openBlock(),h.createBlock(p,{key:0,is:h.unref(Jt)(y[1].type),name:y[0],structure:M(C.addSkel),errors:C.errors[y[0]]?C.errors[y[0]]:[],skel:C.formValues,onChange:B=>D(y[0],B)},null,8,["is","name","structure","errors","skel","onChange"])):h.createCommentVNode("",!0)],64))),128))])):h.createCommentVNode("",!0),h.createElementVNode("sl-checkbox",{onSlChange:N,checked:""}," Rechnungsadresse wie Lieferadresse ",32)],64)}}},[["__scopeId","data-v-96ba7336"]]),PA=h.defineComponent({props:{isDragging:Boolean,draggingLineBottom:Boolean,draggingLineTop:Boolean},components:{},emits:["change","delete","handleDragStart","handleDragEnd","handleDragOver","handleDrop"],setup(m,x){const C=h.inject("boneState");return{state:h.reactive({isDraggable:!1}),boneState:C}}}),hl=m=>(h.pushScopeId("data-v-141aaf9b"),m=m(),h.popScopeId(),m),RA=["draggable"],OA=["disabled"],NA=[hl(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"grip-vertical"},null,-1))],zA={class:"value"},MA=["disabled","title"],FA=[hl(()=>h.createElementVNode("sl-icon",{slot:"prefix",name:"x-lg"},null,-1))];function VA(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock("div",{class:h.normalizeClass(["value-line",{"is-dragging":m.isDragging,"dragging-line-bottom":m.draggingLineBottom,"dragging-line-top":m.draggingLineTop}]),draggable:m.state.isDraggable,onDragover:x[2]||(x[2]=w=>m.$emit("handleDragOver",w)),onDrop:x[3]||(x[3]=w=>m.$emit("handleDrop",w)),onDragstart:x[4]||(x[4]=w=>m.$emit("handleDragStart",w)),onDragend:x[5]||(x[5]=w=>m.$emit("handleDragEnd"))},[h.createElementVNode("sl-button",{disabled:m.boneState.readonly,class:"drag-button",onMousedown:x[0]||(x[0]=w=>m.state.isDraggable=!0)},NA,40,OA),h.createElementVNode("div",zA,[h.renderSlot(m.$slots,"default",{},void 0,!0)]),h.createElementVNode("sl-button",{variant:"danger",disabled:m.boneState.readonly,outline:"",title:m.$t("bone.del"),class:"delete-btn",onClick:x[1]||(x[1]=w=>m.$emit("delete"))},FA,8,MA)],42,RA)}const LA=de(PA,[["render",VA],["__scopeId","data-v-141aaf9b"]]),jA=h.defineComponent({props:{name:String,value:Object,index:Number,lang:String,readonly:Boolean,params:Object},components:{},emits:["change","handleClick"],setup(m,x){const C=h.inject("boneState");return{state:h.reactive({debug:!1}),boneState:C}}}),$A={class:"bone-name"},HA={key:0},qA={class:"bone"};function UA(m,x,C,N,D,M){return h.openBlock(),h.createElementBlock(h.Fragment,null,[h.createElementVNode("label",$A,[h.renderSlot(m.$slots,"default",{},void 0,!0),h.createCommentVNode("",!0)]),m.state.debug?(h.openBlock(),h.createElementBlock("div",HA,[h.createElementVNode("div",qA,h.toDisplayString(m.name),1),h.createElementVNode("pre",null," "+h.toDisplayString(m.boneState)+`
|
|
6530
|
+
`,1)])):h.createCommentVNode("",!0)],64)}const WA=de(jA,[["render",UA],["__scopeId","data-v-b7149172"]]),KA=h.defineComponent({inheritAttrs:!1,emits:["change","change-internal","handleClick"],components:{wrapperMultiple:LA,BoneLabel:WA},props:{is:{type:Object,default:ar},name:{type:String,required:!0},languages:Array,multiple:Boolean,readonly:Boolean,required:Boolean,params:Object,value:[Object,String,Number,Boolean,Array],structure:{type:Object,required:!0},skel:{type:null,required:!0},errors:Object,showLabelInfo:{type:Boolean,required:!1,default:!1},autofocus:{type:Boolean,required:!1,default:!1}},setup(m,x){const C=h.reactive({bonestructure:h.computed(()=>{var T;return(T=m.structure)==null?void 0:T[m.name]}),bonevalue:null,dragStartIndex:{lang:null,index:Number},dropIndex:{lang:null,index:Number},draggingLineBottom:{lang:String,index:Number},draggingLineTop:{lang:String,index:Number},isDragging:{lang:String,index:Number},multilanguage:h.computed(()=>{var T;return((T=C.languages)==null?void 0:T.length)&&C.languages.length>0}),languages:h.computed(()=>m.languages?m.languages:C.bonestructure&&Object.keys(C.bonestructure).includes("languages")?C.bonestructure.languages:[]),readonly:h.computed(()=>m.readonly?m.readonly:C.bonestructure&&Object.keys(C.bonestructure).includes("readonly")?C.bonestructure.readonly:!1),required:h.computed(()=>m.required?m.required:C.bonestructure&&Object.keys(C.bonestructure).includes("required")?C.bonestructure.required:!1),hasTooltip:h.computed(()=>!!(C.bonestructure&&Object.keys(C.bonestructure.params).includes("tooltip"))),multiple:h.computed(()=>m.multiple?m.multiple:C.bonestructure&&Object.keys(C.bonestructure).includes("multiple")?C.bonestructure.multiple:!1),params:h.computed(()=>m.params?m.params:C.bonestructure&&Object.keys(C.bonestructure).includes("params")?C.bonestructure.params:{}),actionbar:h.computed(()=>{var T;return EA((T=C.bonestructure)==null?void 0:T.type)}),isEmpty:h.computed(()=>{function T(O){for(const[F,L]of Object.entries(O))if(L!==null){if(Array.isArray(L)&&L.length>0)return!1;if(!Array.isArray(L))return!1}return!0}return C.readonly?!1:!C.bonevalue||Array.isArray(C.bonevalue)&&C.bonevalue.length===0?!0:C.bonevalue===Object(C.bonevalue)&&!Array.isArray(C.bonevalue)?T(C.bonevalue):!1}),errors:[],errorMessages:h.computed(()=>{let T=[];for(let O of m.errors)O.fieldPath[0]===m.name&&(O.severity>2||C.required&&(O.severity===2||O.severity===0))&&T.push(O.errorMessage);return T})});h.provide("boneState",C);function N(T,O,F){w(O,T,"isDragging"),w(O,T,"dragStartIndex")}function D(T,O,F){F.preventDefault();const L=F.clientY-F.target.getBoundingClientRect().top,$=F.target.closest(".value-line");L<$.offsetHeight/2?(w(O,T,"draggingLineTop"),S("draggingLineBottom"),C.dropIndex.index=T):(w(O,T,"draggingLineBottom"),S("draggingLineTop"),C.dropIndex.index=T+1);let K=O?C.bonevalue[O]:C.bonevalue;C.dropIndex.index>K.length-1&&(C.dropIndex.index-=1)}function M(T,O,F){let L=null;C.dragStartIndex.index!==C.dropIndex.index&&(O?(L=C.bonevalue[O].splice(C.dragStartIndex.index,1)[0],C.bonevalue[O].splice(C.dropIndex.index,0,L)):(L=C.bonevalue.splice(C.dragStartIndex.index,1)[0],C.bonevalue.splice(C.dropIndex.index,0,L)),console.dir(C.bonevalue[0]),x.emit("change",{name:m.name,value:y(),lang:O,index:T})),S("draggingLineBottom","draggingLineTop","isDragging","dragStartIndex","dropIndex")}function w(T,O,F){C[F].lang=T||null,C[F].index=O}function S(...T){T.forEach(O=>{C[O]={lang:null,index:Number}})}function p(T,O,F=null,L=null,$){if(O===void 0||(F?(C.bonevalue||(C.bonevalue={}),Object.keys(C.bonevalue).includes(F)&&L!==null?C.bonevalue[F][L]=O:C.bonevalue[F]=O):L!==null?C.bonevalue[L]=O:$===!1||(C.bonevalue=O),C.readonly))return!1;let K={name:T,value:y(),lang:F,index:L},J={name:T,value:O,lang:F,index:L};$!=null&&(K.pwMatch=$,J.pwMatch=$),x.emit("change",K),x.emit("change-internal",J)}function y(){function T(F,L=null){let $=[];if(Array.isArray(F))if(C.bonestructure.type=="spatial"&&F.length===2&&!Array.isArray(F[0]))$.push({[L+".lat"]:F[0]}),$.push({[L+".lng"]:F[1]});else if(Object.values(F).filter(K=>K===Object(K)).length>0)for(const[K,J]of F.entries())J.rel!==null?$.push(T(J,L+"."+K)):$.push(T(J,L));else for(const[K,J]of F.entries())$.push(T(J,L));else if(F===Object(F))for(const[K,J]of Object.entries(F))L?L.endsWith(".dest")||L.endsWith(".rel")?L.endsWith(".dest")&&K==="key"?(/\.[0-9]*\.dest$/.test(L)?$.push(T(J,L.replace(/\.[0-9]*\.dest/,""))):$.push(T(J,L.replace(/\.dest/,""))),$.push(T(J,L.replace(/\.dest/,"")+"."+K))):L.endsWith(".rel")&&$.push(T(J,L.replace(/\.rel/,"")+"."+K)):$.push(T(J,L+"."+K)):$.push(T(J,K));else F==null&&(F=""),L!==null&&$.push({[L]:F});return $}let O=T(C.bonevalue,m.name);return O=O.flat(10),O}function B(T=null,O=""){T?Object.keys(C.bonevalue).includes(T)?C.bonevalue[T].push(O):C.bonevalue[T]=[O]:C.bonevalue?C.bonevalue.push(O):C.bonevalue=[O]}h.provide("addMultipleEntry",B);function v(T,O=null){var F;O?(F=C.bonevalue)==null||F[O].splice(T,1):C.bonevalue.splice(T,1),x.emit("change",{name:m.name,value:y(),lang:O,index:T}),x.emit("change-internal",{name:m.name,value:y(),lang:O,index:T})}function k(T=null){var O;T?(O=C.bonevalue)==null||O[T].splice(0):C.bonevalue.splice(0),x.emit("change",{name:m.name,value:y(),lang:T}),x.emit("change-internal",{name:m.name,value:y(),lang:T})}h.provide("removeMultipleEntries",k);function _(T=null,O=""){B(T,O)}function R(T,O){function F(J){let te=[],Z=[],ee=/\$\((.*?)\)/g;for(;Z;){if(Z=ee.exec(J),!Z){Z=!1;continue}te.push(Z[1])}return te}function L(J,te){let Z=J.split("."),ee=J.split("."),I=te;for(let Q of Z)if(ee.shift(),I&&I!=="-"&&Object.keys(I).includes(Q)&&I[Q])if(Array.isArray(I[Q])){let _e=[];for(let Se of I[Q])_e.push(L(ee.join("."),Se));I=_e.join(", ")}else I=I[Q];else(!I||typeof I[Q]=="object"&&!I[Q])&&(I="-");return I}let $=F(T),K=[];Array.isArray(O)||(O=[O]);for(let J of O){let te=T;for(let Z of $){let ee=L(Z,J);te=te.replace("$("+Z+")",ee)}K.push(te)}return K.join(", ")}return h.provide("formatString",R),h.onBeforeMount(()=>{var T;m.value?C.bonevalue=m.value:C.bonevalue=(T=m.skel)==null?void 0:T[m.name]}),h.watch(()=>m.skel,(T,O)=>{var F;C.bonevalue=(F=m.skel)==null?void 0:F[m.name]}),h.watch(()=>{var T;return(T=m.errors)==null?void 0:T[m.name]},(T,O)=>{C.errors=m.errors}),{state:C,updateValue:p,addMultipleEntry:B,removeMultipleEntry:v,removeMultipleEntries:k,BoneHasMultipleHandling:xA,multipleBonePressEnter:_,handleDragStart:N,handleDragOver:D,handleDrop:M,setStateProperties:w,resetStateProperties:S}}}),so=m=>(h.pushScopeId("data-v-dee63f3c"),m=m(),h.popScopeId(),m),GA={key:0,class:"required"},ZA=["content"],JA=[so(()=>h.createElementVNode("div",{class:"tooltip"},[h.createElementVNode("sl-icon",{name:"question"})],-1))],YA={key:0,variant:"info",open:"",class:"label-info"},QA=so(()=>h.createElementVNode("sl-icon",{slot:"icon",library:"bootstrap",name:"info-circle-fill"},null,-1)),XA={class:"bone-inner-wrap"},e0={key:0,class:"lang-tab",placement:"bottom"},t0=["panel"],n0=["name"],o0=[so(()=>h.createElementVNode("sl-input",{readonly:"",size:"medium",placeholder:"Keine Einträge"},null,-1))],i0={key:1,class:"multiple-placeholder"},r0=[so(()=>h.createElementVNode("sl-input",{readonly:"",size:"medium",placeholder:"Keine Einträge"},null,-1))],s0={open:"",summary:"Errors",variant:"info"},a0=so(()=>h.createElementVNode("sl-icon",{slot:"icon",name:"exclamation-triangle"},null,-1)),l0={class:"error-msg"};function c0(m,x,C,N,D,M){var p;const w=h.resolveComponent("bone-label"),S=h.resolveComponent("wrapper-multiple");return h.openBlock(),h.createElementBlock("div",{class:h.normalizeClass(["bone-wrapper",(""+m.state.bonestructure.type.split(".")[0],{"has-subbones":m.state.bonestructure.using})])},[h.createVNode(w,{name:m.name},{default:h.withCtx(()=>[h.createElementVNode("span",{class:h.normalizeClass({required:m.state.required})},h.toDisplayString(m.state.bonestructure.descr),3),m.state.required?(h.openBlock(),h.createElementBlock("span",GA," *")):h.createCommentVNode("",!0),m.state.hasTooltip&&!m.showLabelInfo?(h.openBlock(),h.createElementBlock("sl-tooltip",{key:1,content:m.state.bonestructure.params.tooltip,placement:"top-center"},JA,8,ZA)):h.createCommentVNode("",!0)]),_:1},8,["name"]),m.showLabelInfo&&m.state.hasTooltip?(h.openBlock(),h.createElementBlock("sl-alert",YA,[QA,h.createTextVNode(" "+h.toDisplayString(m.state.bonestructure.params.tooltip),1)])):h.createCommentVNode("",!0),h.createElementVNode("div",XA,[m.state.multilanguage?(h.openBlock(),h.createElementBlock("sl-tab-group",e0,[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(m.state.languages,y=>{var B,v,k,_;return h.openBlock(),h.createElementBlock(h.Fragment,{key:y+"_tab"},[h.createElementVNode("sl-tab",{slot:"nav",panel:"lang_"+y},h.toDisplayString(m.$t(y)),9,t0),h.createElementVNode("sl-tab-panel",{name:"lang_"+y},[m.state.multiple&&!m.BoneHasMultipleHandling(m.state.bonestructure.type)?(h.openBlock(),h.createElementBlock(h.Fragment,{key:0},[(B=m.state.bonevalue)!=null&&B[y].length?(h.openBlock(!0),h.createElementBlock(h.Fragment,{key:0},h.renderList((v=m.state.bonevalue)==null?void 0:v[y],(R,T)=>(h.openBlock(),h.createElementBlock("div",{key:T,class:"multiple-bone"},[h.createVNode(S,{readonly:!m.state.readonly,"is-dragging":m.state.isDragging.lang===y&&m.state.isDragging.index===T,"dragging-line-bottom":m.state.draggingLineBottom.lang===y&&m.state.draggingLineBottom.index===T,"dragging-line-top":m.state.draggingLineTop.lang===y&&m.state.draggingLineTop.index===T,onDelete:O=>m.removeMultipleEntry(T,y),onHandleDragStart:O=>m.handleDragStart(T,y,O),onHandleDragOver:O=>m.handleDragOver(T,y,O),onHandleDrop:O=>m.handleDrop(T,y,O)},{default:h.withCtx(()=>[(h.openBlock(),h.createBlock(h.resolveDynamicComponent(m.is),{value:R,index:T,lang:y,name:m.name,onChange:m.updateValue,onKeydown:h.withKeys(O=>m.multipleBonePressEnter(y),["enter"])},null,40,["value","index","lang","name","onChange","onKeydown"]))]),_:2},1032,["readonly","is-dragging","dragging-line-bottom","dragging-line-top","onDelete","onHandleDragStart","onHandleDragOver","onHandleDrop"])]))),128)):(h.openBlock(),h.createElementBlock("div",{key:1,class:h.normalizeClass(["multiple-placeholder",{readonly:m.state.readonly}])},o0,2)),m.state.readonly?h.createCommentVNode("",!0):(h.openBlock(),h.createBlock(h.resolveDynamicComponent(m.state.actionbar),{key:2,value:(k=m.state.bonevalue)==null?void 0:k[y],name:m.name,lang:y,onChange:m.updateValue},null,40,["value","name","lang","onChange"]))],64)):(h.openBlock(),h.createBlock(h.resolveDynamicComponent(m.is),{key:1,value:(_=m.state.bonevalue)==null?void 0:_[y],index:null,lang:y,name:m.name,onChange:m.updateValue},null,40,["value","lang","name","onChange"]))],8,n0)],64)}),128))])):(h.openBlock(),h.createElementBlock(h.Fragment,{key:1},[m.state.multiple&&!m.BoneHasMultipleHandling(m.state.bonestructure.type)?(h.openBlock(),h.createElementBlock(h.Fragment,{key:0},[(p=m.state.bonevalue)!=null&&p.length?(h.openBlock(!0),h.createElementBlock(h.Fragment,{key:0},h.renderList(m.state.bonevalue,(y,B)=>(h.openBlock(),h.createElementBlock("div",{key:B,class:"multiple-bone"},[h.createVNode(S,{readonly:!m.state.readonly,"is-dragging":m.state.isDragging.index===B,"dragging-line-bottom":m.state.draggingLineBottom.index===B,"dragging-line-top":m.state.draggingLineTop.index===B,onDelete:v=>m.removeMultipleEntry(B),onHandleDragStart:v=>m.handleDragStart(B,m.lang=null,v),onHandleDragOver:v=>m.handleDragOver(B,m.lang=null,v),onHandleDrop:v=>m.handleDrop(B,m.lang=null,v)},{default:h.withCtx(()=>[(h.openBlock(),h.createBlock(h.resolveDynamicComponent(m.is),{value:y,index:B,name:m.name,onChange:m.updateValue,onKeydown:x[0]||(x[0]=h.withKeys(v=>m.multipleBonePressEnter(),["enter"]))},null,40,["value","index","name","onChange"]))]),_:2},1032,["readonly","is-dragging","dragging-line-bottom","dragging-line-top","onDelete","onHandleDragStart","onHandleDragOver","onHandleDrop"])]))),128)):(h.openBlock(),h.createElementBlock("div",i0,r0)),m.state.readonly?h.createCommentVNode("",!0):(h.openBlock(),h.createBlock(h.resolveDynamicComponent(m.state.actionbar),{key:2,value:m.state.bonevalue,name:m.name,onChange:m.updateValue},null,40,["value","name","onChange"]))],64)):(h.openBlock(),h.createBlock(h.resolveDynamicComponent(m.is),{key:1,value:m.state.bonevalue,name:m.name,index:null,autofocus:m.autofocus,onChange:m.updateValue,onKeypress:h.withKeys(m.updateValue,["enter"])},null,40,["value","name","autofocus","onChange","onKeypress"]))],64)),(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(m.state.errorMessages,y=>(h.openBlock(),h.createElementBlock("sl-alert",s0,[a0,h.createElementVNode("div",l0,h.toDisplayString(y),1)]))),256))])],2)}const ur=de(KA,[["render",c0],["__scopeId","data-v-dee63f3c"]]),Yt=m=>(h.pushScopeId("data-v-71a3c8c9"),m=m(),h.popScopeId(),m),d0=Yt(()=>h.createElementVNode("h2",{class:"viur-shop-form-headline headline"},"Nutzterdaten",-1)),h0=Yt(()=>h.createElementVNode("h2",{class:"viur-shop-form-headline headline"},"Lieferadresse",-1)),u0=["onSlChange","onSlClear","label"],m0=["value"],g0={key:0},p0=Yt(()=>h.createElementVNode("h2",{class:"viur-shop-form-headline headline"},"Rechnungsadresse",-1)),f0=[Yt(()=>h.createElementVNode("sl-icon",{name:"x-lg",slot:"prefix"},null,-1))],k0=Yt(()=>h.createElementVNode("sl-icon",{name:"plus-lg",slot:"prefix"},null,-1)),b0=Yt(()=>h.createElementVNode("sl-icon",{slot:"icon",name:"exclamation-triangle"},null,-1)),w0=Yt(()=>h.createElementVNode("br",null,null,-1)),A0=de({__name:"UserInfoMulti",props:{mode:{type:String,default:"form"}},setup(m){const x=vn(),C=h.reactive({formValues:{},requiredFieldsFilled:h.computed(()=>{if(C.isCustomAdress)return Object.keys(C.formValues).includes("city")&&Object.keys(C.formValues).includes("street")&&Object.keys(C.formValues).includes("billing.city")&&Object.keys(C.formValues).includes("billing.street")&&Object.keys(C.formValues).includes("email")&&Object.keys(C.formValues).includes("firstname")&&Object.keys(C.formValues).includes("lastname");if(!C.isCustomAdress)return Object.keys(C.formValues).includes("city")&&Object.keys(C.formValues).includes("street")&&Object.keys(C.formValues).includes("email")&&Object.keys(C.formValues).includes("firstname")&&Object.keys(C.formValues).includes("lastname")}),isCustomAdress:!1,shippingAdressAmount:1,maxShippingAdress:h.computed(()=>Object.keys(x.state.carts).length+2),amountAlert:{title:"",msg:""},items:null,addSkel:null,errors:{},selectedItem:{},isInit:h.computed(()=>!!x.state.carts[x.state.basket])}),N=h.ref(null),D=h.ref(null);function M(k){k.target.checked&&(C.isCustomAdress=!1),k.target.checked||(C.isCustomAdress=!0)}function w(){if(C.shippingAdressAmount===C.maxShippingAdress){C.amountAlert.title="Zu viele Lieferadressen",C.amountAlert.msg=`Sie können nur maximal: "${C.maxShippingAdress}" Lieferadressen verwenden.`,D.value.show();return}C.shippingAdressAmount+=1}function S(k,_){for(const[R,T]of Object.entries(_.value[0]))C.formValues[R]=T}function p(){if(C.shippingAdressAmount===1){C.amountAlert.title="Zu wenig Lieferadressen",C.amountAlert.msg="Mindestens eine Lieferadresse muss angegeben werden.",D.value.show();return}C.shippingAdressAmount-=1}function y(k,_){if(console.log(k.target.value),!k.target.value.length){B();return}C.selectedItem[_]=k.target.value,C.isItemSelected=!0}function B(k,_){console.log("clearing..."),delete C.selectedItem[_],C.isItemSelected=!1}function v(k){let _={};return k.forEach(R=>{let T=R[0],O=R[1];_[T]=O}),_}return h.watch(C.formValues,k=>{Object.entries(k).forEach(([_,R])=>{R===""&&delete C.formValues[_]})}),h.onBeforeMount(async()=>{await x.getAdressStructure(),C.addSkel=x.state.structure.address}),(k,_)=>(h.openBlock(),h.createElementBlock(h.Fragment,null,[h.createElementVNode("div",null,[d0,(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(C.addSkel,R=>(h.openBlock(),h.createElementBlock(h.Fragment,{key:R[0]},[R[1].visible&&R[1].params.group==="Customer Info"?(h.openBlock(),h.createBlock(ur,{key:0,is:h.unref(Jt)(R[1].type),name:R[0],structure:v(C.addSkel),errors:C.errors[R[0]]?C.errors[R[0]]:[],skel:C.formValues,onChange:T=>S(R[0],T),class:"viur-shop-form-grid-w-2"},null,8,["is","name","structure","errors","skel","onChange"])):h.createCommentVNode("",!0)],64))),128))]),h0,(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(C.shippingAdressAmount,R=>(h.openBlock(),h.createElementBlock("div",{key:R},[h.createElementVNode("sl-select",{clearable:"",ref_for:!0,ref_key:"itemSelection",ref:N,onSlChange:T=>y(T,R),onSlClear:T=>B(T,R),label:C.selectedItem[R]?h.unref(x).state.carts[C.selectedItem[R]].info.name:"Warenkorb für Adresse wählen.",class:"grid-w-4"},[(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(h.unref(x).state.carts,(T,O)=>(h.openBlock(),h.createElementBlock("sl-option",{value:O},h.toDisplayString(T.info.name),9,m0))),256))],40,u0),(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(C.addSkel,T=>(h.openBlock(),h.createElementBlock(h.Fragment,{key:T[0]},[T[1].visible&&T[1].params.group==="Customer Address"?(h.openBlock(),h.createBlock(ur,{key:0,is:h.unref(Jt)(T[1].type),name:T[0],structure:v(C.addSkel),errors:C.errors[T[0]]?C.errors[T[0]]:[],skel:C.formValues,onChange:O=>S(T[0],O)},null,8,["is","name","structure","errors","skel","onChange"])):h.createCommentVNode("",!0)],64))),128))]))),128)),C.isCustomAdress?(h.openBlock(),h.createElementBlock("div",g0,[p0,(h.openBlock(!0),h.createElementBlock(h.Fragment,null,h.renderList(C.addSkel,R=>(h.openBlock(),h.createElementBlock(h.Fragment,{key:R[0]},[R[1].visible&&R[1].params.group==="Customer Address"?(h.openBlock(),h.createBlock(ur,{key:0,is:h.unref(Jt)(R[1].type),name:R[0],structure:v(C.addSkel),errors:C.errors[R[0]]?C.errors[R[0]]:[],skel:C.formValues,onChange:T=>S(R[0],T)},null,8,["is","name","structure","errors","skel","onChange"])):h.createCommentVNode("",!0)],64))),128))])):h.createCommentVNode("",!0),h.createElementVNode("div",{class:"viur-shop-form-btn-wrap"},[h.createElementVNode("sl-button",{size:"medium",onClick:p,title:"Lieferadresse entfernen"},f0),h.createElementVNode("sl-button",{size:"medium",variant:"primary",onClick:w},[k0,h.createTextVNode(" Lieferadresse hinzufügen ")])]),h.createElementVNode("sl-alert",{variant:"warning",duration:"2000",ref_key:"shippingWarning",ref:D,closable:""},[b0,h.createElementVNode("strong",null,h.toDisplayString(C.amountAlert.title),1),w0,h.createTextVNode(" "+h.toDisplayString(C.amountAlert.msg),1)],512),h.createElementVNode("sl-checkbox",{onSlChange:M,checked:""}," Rechnungsadresse wie Lieferadresse ",32)],64))}},[["__scopeId","data-v-71a3c8c9"]]),ul={__name:"ExampleUsage",setup(m){const x=vn(),C=h.computed(()=>x.state.basketRootNode.key?x.state.basketRootNode.key:""),N=h.reactive({rootNode:{},tabs:{cart:{component:h.shallowRef(rr),props:{sidebar:!0,mode:"basket",cartKey:C},displayName:"Warenkorb",icon:{name:"cart",library:"hsk"},position:2,disabled:!1,atShow:null,atHide:null},confirm:{component:h.shallowRef(sr),props:{},displayName:"Bestellung prüfen",icon:{name:"order-check",library:"hsk"},position:5,disabled:!1,atShow:null,atHide:null},orderComplete:{component:h.shallowRef(db),props:{},displayName:"Bestellung Abgeschlossen",icon:{name:"order-confirmed",library:"hsk"},position:6,disabled:!0,atShow:null,atHide:null},userInfo:{component:h.shallowRef(IA),props:{},displayName:"Daten Eingeben",icon:{name:"user",library:"hsk"},position:3,disabled:!1,atShow:null,atHide:null},userInfoMulti:{component:h.shallowRef(A0),props:{},displayName:"Daten Eingeben (Multi)",icon:{name:"user",library:"hsk"},position:4,disabled:!1,atShow:null,atHide:null}}});function D(M){(M==null?void 0:M.detail.name)==="confirm"&&(N.tabs.orderComplete.disabled=!1)}return h.onBeforeMount(async()=>{await x.init(),await x.getAdressStructure(),console.log("debug init exampleusage :",x.state.basketRootNode)}),(M,w)=>(h.openBlock(),h.createBlock(rb,{tabs:N.tabs,onTabChange:D},null,8,["tabs"]))}},_0={install(m){m.component("CartView",rr),m.component("ExampleUsage",ul),m.component("ConfirmView",sr)}};Ve.CartView=rr,Ve.ConfirmView=sr,Ve.ExampleUsage=ul,Ve.default=_0,Ve.useCartStore=vn,Object.defineProperties(Ve,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|