@ones-editor/editor 1.1.17-beta.7 → 1.1.17-beta.9
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/index.js
CHANGED
|
@@ -610,7 +610,7 @@ ${t}
|
|
|
610
610
|
</clipPath>
|
|
611
611
|
</defs>
|
|
612
612
|
</svg>
|
|
613
|
-
`,IO=Object.freeze(Object.defineProperty({__proto__:null,ClearIcon:XT,CloseIcon:qh,PrevIcon:fT,NextIcon:dT,MoreIcon:zp,TextColorIcon:Gp,ArrowDownIcon:Xh,ArrowUpIcon:mO,ArrowLeftIcon:gO,ArrowRightIcon:Wp,DeleteRowIcon:hT,DeleteColIcon:mT,MergeCellIcon:gT,SplitCellIcon:pT,DeleteTableIcon:CT,Heading1Icon:Yh,Heading2Icon:Qh,Heading3Icon:Jh,Heading4Icon:Zh,Heading5Icon:t0,Heading6Icon:e0,Heading7Icon:n0,Heading8Icon:r0,HeadingNIcon:pO,OrderedListIcon:ET,UnorderedListIcon:xT,CheckListIcon:AT,BlockquoteIcon:bT,AlignCenterIcon:o0,AlignLeftIcon:Pa,AlignRightIcon:i0,ImageIcon:vT,ImageMenuIcon:BT,ImageErrorIcon:Xp,ImageEmptyIcon:yT,LinkIcon:Zp,LinkOffIcon:kT,WarningIcon:qp,PasteSpecialIcon:TT,LaunchIcon:Yp,CodeIcon:KT,AudioIcon:OT,GraphIcon:CO,VideoIcon:NT,FileIcon:EO,MathIcon:AO,MathMenuIcon:RT,TableIcon:bO,TableMenuIcon:wT,BilibiliIcon:LT,YoukuIcon:IT,ModaoIcon:_T,FigmaIcon:DT,EditIcon:s0,CommentIcon:ul,RefreshIcon:ST,HelpIcon:Qp,CheckMarkIcon:Jp,TextIcon:Fa,RightArrowIcon:xO,TencentVideoIcon:MT,WebPageIcon:UT,UmlIcon:PT,DividingLineIcon:FT,HeadingH1Icon:vO,HeadingH2Icon:BO,HeadingH3Icon:TO,HeadingH4Icon:yO,HeadingH5Icon:kO,HeadingH6Icon:RO,HeadingH7Icon:wO,HeadingH8Icon:SO,CheckboxIcon:tC,QuoteIcon:eC,LinkHrefIcon:LO,OrderedIcon:rC,UnorderedIcon:nC,CopyIcon:VT,CutIcon:$T,DeleteIcon:HT,LockBlockIcon:jT,UnLockBlockIcon:zT,InsertBeforeIcon:GT,InsertAfterIcon:WT,MentionIcon:qT,CircleAddIcon:YT,LoadingIcon:QT,DragIcon:iC,UmlBrandIcon:l0,OnesLoadingIcon:JT,BoldIcon:ZT,ItalicIcon:ty,UnderlineIcon:ey,LineThroughIcon:ny,SubscriptIcon:iy,SuperscriptIcon:oy,InlineCodeIcon:ry,ToMindMapIcon:sy,FitIcon:ly,FullScreenIcon:oC,ExitFullScreenIcon:ay,CaretDownIcon:cy,StatusIcon:uy},Symbol.toStringTag,{value:"Module"}));function fy(){const n=v("span",["editor-loading-icon"],null);return n.innerHTML=JT,n}const Mlt="";function DO(n,t){const e=v("button",["editor-checkbox-wrapper"],null);e.setAttribute("data-button-id",n),t!=null&&t.includes("checked")&&z(e,"checked"),t!=null&&t.includes("disabled")&&(e.disabled=!0);const r=v("span",["editor-checkbox"],e);return v("span",["editor-checkbox-inner"],r),e}const Ult="",Ka=I("ui-command-bar-base"),_O={itemElementTag:"div",tippyArrow:!1},wx=class extends ye.TypedEmitter{constructor(e,r,i){var o,s;super();m(this,"content");m(this,"items");m(this,"subBar",null);m(this,"parentItem",null);m(this,"closeable",null);m(this,"closeReason",null);m(this,"options");m(this,"id");m(this,"header",null);m(this,"footer",null);m(this,"handleDocumentKeydown",e=>{var r,i;if(!!this.isVisible&&!e.isComposing&&!pa(e.target)){if(this.subBar){this.subBar.handleDocumentKeydown(e);return}if(this.items.length!==0){if(e.key==="Escape"){if((i=(r=this.options).beforeClose)!=null&&i.call(r))return;this.close("cancelBar");return}if(e.key==="ArrowUp"){const o=this.getPrevItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[o].id),e.preventDefault(),e.stopPropagation()}else if(e.key==="ArrowDown"){const o=this.getNextItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[o].id),e.preventDefault(),e.stopPropagation()}else if(e.key==="ArrowRight"){const o=this.getSelectedItem();o&&o.children&&this.showSubCommandBar(o.childrenMenuId)}else if(e.key==="ArrowLeft")this.parentItem&&this.close("switchItem");else if(e.key==="Enter"){const o=this.getSelectedItemIndex();if(o===-1)return;const s=this.items[o],l=this.getItemElementById(s.id);l&&this.emit("click",this,s,l)}}}});m(this,"handleDocumentMouseDown",e=>{var r,i;if(e.target instanceof Element){if((i=(r=this.options).beforeClose)!=null&&i.call(r,e))return;if(!this.isInCommandBar(e.target)){const o=this.listeners("closing");for(let s=0;s<o.length;s++)if(o[s](this,e)===!1)return;this.close("clickBackground")}}});m(this,"handleHidden",()=>{this.closeReason!=="fromHover"&&this.emit("close",this),this.close(null),Hg(this.id)});m(this,"handleShow",()=>{this.popper&&(this.popper.setAttribute("data-command-bar-id",this.id),this.options.classes&&z(this.popper,...this.options.classes),this.options.refuseOverflow&&this.popper.classList.add("reference-hidden")),this.emit("show",this),this.options.disablePageScroll&&$g(this.id)});m(this,"lastEnterPauseTime",0);m(this,"startPauseMouseEnter",()=>{this.lastEnterPauseTime=Date.now()});m(this,"handleItemMouseEnter",e=>{if(Date.now()-this.lastEnterPauseTime<100)return;const r=this.getParentCommandItemElement(e.target);if(!r)return;const i=this.getItemElementId(r),o=this.getItemById(i);if(this.selectItem(i),o.manualShowChildren)return;const s=o.childrenMenuId||"";this.showSubCommandBar(s)});m(this,"handleItemMouseLeave",e=>{var i,o;const r=this.getParentCommandItemElement(e.target);!r||((o=(i=this.subBar)==null?void 0:i.parentItem)==null?void 0:o.id)!==this.getItemElementId(r)&&(ot(r,"selected"),this.emit("selectionChange",this,""))});m(this,"handleItemClick",e=>{var s,l;const r=this.getParentCommandItemElement(e.target);if(!r)return;const i=this.getItemElementId(r),o=this.items.find(c=>c.id===i);if(!!o&&!(o.states&&o.states.indexOf("disabled")!==-1)){if(o.children&&o.children.length>0&&o.manualShowChildren){this.showSubCommandBar(o.childrenMenuId);return}if(!o.element&&(this.emit("click",this,o,r),this.options.autoClose)){if((l=(s=this.options).beforeClose)!=null&&l.call(s,e))return;this.close("clickItem")}}});m(this,"handleWheel",e=>{if(!this.options.disablePageScroll&&!document.querySelector(".editor-disable-scroll"))return;const r=e.target;if(!r||!(r instanceof Node))return;const i=r instanceof HTMLElement?r:r.parentElement;if(!i)return;const o=Xe(i);if(!re(this.content,o)){e.stopPropagation(),e.preventDefault();return}e.deltaY<0?o.scrollTop===0&&(e.stopPropagation(),e.preventDefault()):e.deltaY>0&&o.scrollTop+o.clientHeight>=o.scrollHeight&&(e.stopPropagation(),e.preventDefault())});this.id=(o=i==null?void 0:i.id)!=null?o:et(),this.options={..._O,...i},this.items=e,this.parentItem=(s=i==null?void 0:i.parentItem)!=null?s:null,this.closeable=r!=null?r:null,this.content=this.createCommandBarContent(e)}close(e){this.closeReason=e,this.subBar&&this.subBar.close(e),document.removeEventListener("keydown",this.handleDocumentKeydown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}click(e,r){this.emit("click",this,e,r)}createPopperOptions(){var i,o;const e={modifiers:[]},r=this.options.overflowBoundary;return r&&((i=e==null?void 0:e.modifiers)==null||i.push({name:"flip",options:{boundary:r,fallbackPlacements:["top","bottom"]}})),this.options.padding&&((o=e==null?void 0:e.modifiers)==null||o.push({name:"preventOverflow",options:{padding:this.options.padding}})),e}destroy(){var e;this.close(null),this.removeAllListeners(),(e=this.subBar)==null||e.destroy(),this.subBar=null,this.closeable=null,this.content.removeEventListener("wheel",this.handleWheel)}get isSubCommandBar(){return!!this.parentItem}updateItems(e){var i;this.subBar&&e.findIndex(s=>{var l,c;return s.id===((c=(l=this.subBar)==null?void 0:l.parentItem)==null?void 0:c.id)})===-1&&((i=this.subBar)==null||i.destroy(),this.subBar=null),this.items=e;const r=this.createCommandBarContent(e);this.content.innerHTML="",Array.from(r.children).forEach(o=>{this.content.appendChild(o)})}get popper(){return this.content.closest("[data-tippy-root]")}getSelectedItemIndex(){const e=this.getSelectedItem();return e?this.items.indexOf(e):-1}getPrevItemIndex(e){if(e<=0)return this.items.length-1;let r=e-1;for(;;){const i=this.items[r],o=i.type,l=!(i.states&&i.states.indexOf("disabled")!==-1);if(o!=="separator"&&o!=="section"&&l)return r;if(r-=1,r<0)return this.items.length-1}}getNextItemIndex(e){let r=e+1;for(;;){if(!this.items[r])return this.getNextItemIndex(-1);const i=this.items[r],o=i.type,l=!(i.states&&i.states.indexOf("disabled")!==-1);if(o!=="separator"&&o!=="section"&&l)return r;if(r+=1,r>this.items.length-1)return 0}}clearSelectedItem(){const e=this.getSelectedItem();if(!e)return;const r=this.getItemElementById(e.id);r&&ot(r,"selected")}selectItem(e){const r=this.getSelectedItem();if(r){if(r.id===e)return;const o=r.id,s=this.getItemElementById(o);s&&ot(s,"selected")}const i=this.getItemElementById(e);i?(z(i,"selected"),this.emit("selectionChange",this,i.getAttribute("data-id")||""),this.options.disableSelectedScroll||i.scrollIntoView({block:"nearest"})):this.emit("selectionChange",this,"")}showSubCommandBar(e){var s,l,c,d;const r=this.getSelectedItem();if(!r||!r.children&&((l=(s=this.subBar)==null?void 0:s.parentItem)==null?void 0:l.manualShowChildren))return;if(this.subBar){if(((c=this.subBar.parentItem)==null?void 0:c.id)===r.id){r.manualShowChildren&&this.subBar.close("switchItem");return}this.subBar.destroy(),this.subBar=null}if(!r.children)return;const i=this.getItemElementById(r.id);if(!i)return;const o=wx.createSubCommandBar(r,(d=this.closeable)!=null?d:this,e?{id:e}:{});this.subBar=o,this.subBar.on("click",(h,C,E)=>{this.emit("click",h,C,E)}),this.subBar.on("close",()=>{var h;(h=this.subBar)==null||h.destroy(),this.subBar=null,ot(i,"active")}),r.beforePopup&&r.beforePopup(o),this.subBar.manualShow(i,this.getSubBarOptions(r)),z(i,"active")}isInCommandBar(e){if(!e||!(e instanceof Node))return!1;const r=this.getCommandBarRoot();return r&&re(r,e)||re(this.content,e)?!0:this.subBar?this.subBar.isInCommandBar(e):!1}createCommandItem(e){var o,s,l,c;let r=(o=this.options.itemElementTag)!=null?o:"div";e.element&&(r="div");const i=v(r,["command-item"],null);return i.setAttribute("data-id",e.id),e.type==="separator"?i.classList.add("separator"):e.type==="section"?(i.classList.add("section","text"),e.element&&(typeof e.element=="function"?i.appendChild(e.element(e)):i.appendChild(e.element))):((s=e.states)!=null&&s.includes("selected")&&i.classList.add("selected"),(l=e.states)!=null&&l.includes("checked")&&i.classList.add("checked"),(c=e.states)!=null&&c.includes("disabled")&&i.classList.add("disabled"),i.onclick=this.handleItemClick,i.onmouseenter=this.handleItemMouseEnter,i.onmouseleave=this.handleItemMouseLeave,e.element?typeof e.element=="function"?i.appendChild(e.element(e)):i.appendChild(e.element):i.classList.add("standard")),this.initItemElement(e,i),i}getItemById(e){const r=this.items.find(i=>i.id===e);return p(Ka,r,`can not find command item for id: ${e}`),r}getSelectedItem(){const e=this.content.querySelector(":scope >.editor-command-bar >.command-item.selected");if(e){const r=this.getItemElementId(e),i=this.items.find(o=>o.id===r);return p(Ka,i,`can not find command item for id: ${r}`),i}return null}getItemElementId(e){const r=e.getAttribute("data-id");return p(Ka,r,"no data-id attribute"),r}getItemElementById(e){const r=this.content.querySelector(`:scope >.editor-command-bar > .command-item[data-id="${e}"]`);return p(Ka,r,`no exists command item, id=${e}`),r}getParentCommandItemElement(e){if(!e||!(e instanceof Element))return null;if(wt(e,"command-item"))return e;const r=e.closest(".command-item");return r||null}createCommandBarContent(e){this.content&&this.content.removeEventListener("wheel",this.handleWheel);const r=v("div",["editor-command-bar-root"],null);if(this.options.header){const o=v("div",["editor-command-bar-header"],null);if(this.options.header instanceof Function){const s=this.options.header();s&&o.appendChild(s)}else o.appendChild(this.options.header);this.header=o,this.header&&r.appendChild(this.header)}const i=v("div",["editor-command-bar"],r);if(e.forEach(o=>{var l;const s=this.createCommandItem(o);i.appendChild(s),o.element&&o.setCloseable&&o.setCloseable((l=this.closeable)!=null?l:this)}),this.options.footer){const o=v("div",["menu-item","editor-command-bar","footer"],null);if(this.options.footer instanceof Function){const s=this.options.footer();s&&o.appendChild(s)}else o.appendChild(this.options.footer);this.footer=o,this.footer&&r.appendChild(this.footer)}return(this.options.header||this.options.footer)&&z(r,"scrollable-bar"),this.initCommandBarElement(i),r.addEventListener("wheel",this.handleWheel,{passive:!1}),r}getSubBarOptions(e){var r;return{placement:(r=e.childrenPlacement)!=null?r:"right-start",offset:e.childrenOffset,arrow:e.childArrow}}static registerManualCommandBar(e,r){this.commandBarCreators.set(e,r)}static createSubCommandBar(e,r,i){var l;p(Ka,e.children&&e.children.length>0,"no item children");const o=(l=e.childrenType)!=null?l:"menu",s=this.commandBarCreators.get(o);return p(Ka,s,`no creator for command type: ${o}`),s(e,r,i)}static hasExistsCommandBar(){return!!document.querySelector("[data-command-bar-id]")}};let fl=wx;m(fl,"commandBarCreators",new Map),I("ui-command-bar");class a0 extends fl{constructor(){super(...arguments);m(this,"tippyInstance",null)}manualShow(e,r){var i,o,s;if(!this.isVisible){if(this.tippyInstance&&(this.tippyInstance.destroy(),this.tippyInstance=null),this.tippyInstance=Z6.default(e,{interactive:!0,content:this.content,trigger:"manual",triggerTarget:null,hideOnClick:!1,placement:(i=r==null?void 0:r.placement)!=null?i:"bottom-start",maxWidth:650,arrow:(o=r==null?void 0:r.arrow)!=null?o:this.options.tippyArrow,appendTo:document.body,onShow:this.handleShow,onHidden:this.handleHidden,theme:r==null?void 0:r.theme,getReferenceClientRect:r==null?void 0:r.getReferenceClientRect,offset:(s=r==null?void 0:r.offset)!=null?s:[0,0],popperOptions:this.createPopperOptions()}),r!=null&&r.point){const{x:l,y:c}=r.point;this.tippyInstance.setProps({getReferenceClientRect:()=>new DOMRect(l,c,0,0)})}this.clearSelectedItem(),this.tippyInstance.show(),this.parentItem||(document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("mousedown",this.handleDocumentMouseDown)),this.popper&&this.options.id&&this.popper.setAttribute("data-command-bar-id",this.options.id)}}close(e){var r;super.close(e),this.isVisible&&((r=this.tippyInstance)==null||r.hide())}destroy(){var e;(e=this.tippyInstance)==null||e.destroy(),this.tippyInstance=null,super.destroy()}getCommandBarRoot(){return this.content.closest("[data-tippy-root]")}get isVisible(){var e,r;return(r=(e=this.tippyInstance)==null?void 0:e.state.isVisible)!=null?r:!1}get popper(){return this.content.closest("[data-tippy-root]")}}const dy=I("ui-base");class Va extends a0{constructor(t,e){var o;const r=(o=e==null?void 0:e.id)!=null?o:`popup-${et()}`,i=[{id:r,name:"",element:t}];super(i,void 0,{disablePageScroll:!0,id:r,beforeClose:e==null?void 0:e.beforeClose})}initCommandBarElement(t){z(t,"popper")}initItemElement(t,e){}get popupContent(){const t=this.items[0];p(dy,t,"no dialog item");const e=typeof t.element=="function"?t.element(t):t.element;return p(dy,e,"no item element"),e}}const fo=I("filterable-list");function hy(n){var e,r;const t=v("div",["list-item"],null);return t.setAttribute("data-id",n.id),t.appendChild(v("div",["list-item-text"],null,n.name)),(e=n.states)!=null&&e.includes("selected")&&(z(t,"selected"),Hs(Jp,["list-item-selected-icon"],t)),(r=n.states)!=null&&r.includes("disabled")&&z(t,"disabled"),t}function my(n){const t=v("div",["list-root"],null);return n.forEach(e=>{t.appendChild(hy(e))}),n.length||t.appendChild(hy({id:"placeholder",states:["disabled"],name:D.t("search.emptyTips")})),t}function gy(n,t){return n.map(e=>({...e,states:t===e.id?["selected"]:[]}))}function MO(n,t){const e=v("div",["filterable-list"],null),r=v("div",["filter"],e),i=v("div",["filter-container"],r),o=v("input",["filter-input"],i);t&&t.placeholder&&(o.placeholder=t.placeholder);const s=v("div",["list"],e),l=my(gy(n,t==null?void 0:t.initialSelectedId));return s.appendChild(l),e}function py(n,t,e){const r=n.querySelector(".list");p(fo,r,"no list root");const i=my(gy(t,e)),o=r.querySelector(".list-root");if(p(fo,o,"no exists menu"),Zc(o,i),e){const s=r.querySelector(".list-item.selected");s&&(p(fo,s,"no selected menu item"),s.scrollIntoView({block:"nearest"}))}}class UO{constructor(t,e){m(this,"root");m(this,"visibleItems");m(this,"selectedId");m(this,"filter","");m(this,"onSelected",null);m(this,"handleKeydown",t=>{this.processKeyDown(t)});m(this,"handleInputChanged",()=>{const t=this.root.querySelector(".filter-input");p(fo,t,"no input");const e=t.value.toLocaleLowerCase();this.setFilter(e)});m(this,"handleClick",t=>{this.processClick(t)});var r;this.items=t,this.options=e,this.root=MO(t,e),this.bindEvents(),this.selectedId=(r=e==null?void 0:e.initialSelectedId)!=null?r:"",this.visibleItems=t}bindEvents(){const t=this.root.querySelector(".filter-input");p(fo,t,"no input"),t.addEventListener("keyup",this.handleInputChanged),t.addEventListener("keydown",this.handleKeydown),this.root.addEventListener("click",this.handleClick)}unbindEvents(){const t=this.root.querySelector(".filter-input");p(fo,t,"no input"),t.removeEventListener("keyup",this.handleInputChanged),t.removeEventListener("keydown",this.handleKeydown),this.root.removeEventListener("click",this.handleClick)}destroy(){this.unbindEvents(),this.onSelected=null}getSelectedIndex(){return this.selectedId?this.visibleItems.findIndex(t=>t.id===this.selectedId):-1}setSelectedId(t){this.selectedId=t,py(this.root,this.visibleItems,t)}focus(){const t=this.root.querySelector(".filter-input");p(fo,t,"no input"),t.focus()}moveSelectedItemIntoView(){const t=this.root.querySelector(".list-item.selected");t&&(p(fo,t,"no selected menu item"),t.scrollIntoView({block:"nearest"}))}reset(){this.setFilter("");const t=this.root.querySelector(".filter-input");p(fo,t,"no input"),t.value=""}setFilter(t){this.filter!==t&&(this.filter=t,this.visibleItems=this.items.filter(e=>e.name.toLocaleLowerCase().includes(t)),py(this.root,this.visibleItems,this.selectedId))}processClick(t){var s,l;const e=t.target;if(!(e instanceof HTMLElement))return;const r=e.closest(".list-item");if(!r)return;const i=(s=r.getAttribute("data-id"))!=null?s:"",o=(l=this.visibleItems.find(c=>c.id===i))!=null?l:null;this.onSelected&&this.onSelected(this,o)}processKeyDown(t){var e;if(t.key==="ArrowUp"){let r=this.getSelectedIndex();r===-1?r=this.visibleItems.length-1:r>0&&(r-=1);let i="";r!==-1&&(i=this.visibleItems[r].id),this.setSelectedId(i);return}if(t.key==="ArrowDown"){let r=this.getSelectedIndex();r===-1?r=0:r<this.visibleItems.length-1&&(r+=1);let i="";r!==-1&&(i=this.visibleItems[r].id),this.setSelectedId(i);return}if(t.key==="Enter"){const r=(e=this.visibleItems.find(i=>i.id===this.selectedId))!=null?e:null;this.onSelected&&this.onSelected(this,r)}}}class OO extends UO{constructor(e,r,i){super(e,i);m(this,"popup");m(this,"onShow",null);m(this,"onHide",null);m(this,"custom",null);m(this,"handleShow",()=>{this.onShow&&this.onShow(this)});m(this,"handleHide",()=>{this.onHide&&this.onHide(this)});m(this,"handleShown",()=>{this.focus()});this.popup=new Va(this.root)}destroy(){super.destroy(),this.onShow=null,this.onHide=null}show(e){this.reset(),this.popup.manualShow(e,{theme:"dropdown-list"}),this.focus(),this.moveSelectedItemIntoView()}processKeyDown(e){super.processKeyDown(e),(e.key==="Esc"||e.key==="Enter")&&this.popup.close("cancelBar")}processClick(e){super.processClick(e);const r=e.target;!(r instanceof HTMLElement)||!r.closest(".list-item")||this.popup.close("clickItem")}}const Olt="",Nlt="";function NO(n,t){const e=document.createElement("div");e.classList.add("toast","show"),t!=null&&t.theme&&e.setAttribute("data-theme",t.theme),t!=null&&t.id&&e.setAttribute("data-id",t.id),t!=null&&t.html?e.innerHTML=n:e.textContent=n,t!=null&&t.position&&(e.style.left=`${t.position.x}px`,e.style.top=`${t.position.y}px`,e.classList.add("positioned")),document.body.appendChild(e),setTimeout(()=>{e.classList.remove("show"),setTimeout(()=>{e.remove()},500)},(t==null?void 0:t.duration)||3e3)}function PO(n,t){var e,r;if(z(t,"menu-item"),!n.element){if(n.type==="section"){const i=v("div",["section-name"],null,n.name);t.appendChild(i)}else if(n.type!=="separator"){if(n.icon){const o=v("div",["menu-item-icon"],null);n.icon&&(o.innerHTML=n.icon),t.appendChild(o)}const i=v("div",["menu-item-name","text"],null);if(v("span",[],i,n.name),n.ellipsisTooltip&&(t.setAttribute("data-editor-tooltip-allow-markdown","true"),t.setAttribute("data-editor-tooltip-offset-y","25"),t.setAttribute("data-editor-tooltip-placement","right"),t.setAttribute("data-editor-tooltip-common",`<div style="word-break: break-word;">${n.ellipsisTooltip}</div>`)),((e=n.states)==null?void 0:e.includes("disabled"))&&n.disableReason&&(t.setAttribute("data-editor-tooltip-placement","right"),t.setAttribute("data-editor-tooltip-common",n.disableReason)),t.appendChild(i),n.subText&&v("div",["item-subtext","text"],t,n.subText),n.children&&!n.element){const o=v("div",["menu-item-sub-indicator"],null);o.innerHTML=Wp,t.appendChild(o)}if((r=n.states)!=null&&r.includes("checked")){const o=v("div",["menu-item-checked-icon"],null);o.innerHTML=Jp,t.appendChild(o)}}}}class ls extends a0{constructor(t,e,r){super(t,e,{autoClose:!0,disablePageScroll:!0,beforeClose:r==null?void 0:r.beforeClose,...r})}manualShow(t,e){const r={theme:"menu",...e};super.manualShow(t,r)}initCommandBarElement(t){z(t,"menu")}initItemElement(t,e){PO(t,e)}}function FO(n,t,e){var r;return new ls((r=n.children)!=null?r:[],t,{...e,parentItem:n})}function Cy(n,t,e){t.setAttribute("data-button-id",n.id),e.tooltipId&&n.name&&!n.disableTooltip&&(t.setAttribute(`data-editor-tooltip-${e.tooltipId}`,n.name),n.desc&&t.setAttribute(`data-editor-tooltip-desc-${e.tooltipId}`,n.desc));const r=t;if(!n.element)if(n.icon){const i=v("span",["toolbar-item-icon-container"],r);n.icon.trim().startsWith("<")?i.innerHTML=n.icon:i.innerText=n.icon}else{const i=v("span",["toolbar-item-name-container"],r);i.innerText=n.name}if(n.dropdown){t.setAttribute("data-dropdown","true");const i=v("span",["toolbar-item-dropdown-container"],r);i.innerHTML=Xh}n.states&&(n.states.indexOf("checked")!==-1&&z(r,"checked"),n.states.indexOf("disabled")!==-1&&(r.disabled=!0))}class ju extends a0{constructor(t,e,r){super(t,e,{itemElementTag:"button",tippyArrow:!1,...r})}getSubBarOptions(t){var i,o;const e=()=>{const s=this.getItemElementById(t.id),c=this.content.getBoundingClientRect(),d=s.getBoundingClientRect();return new DOMRect(d.left,c.top,d.width,c.height)};return{placement:(i=t.childrenPlacement)!=null?i:"top",getReferenceClientRect:e,offset:(o=t.childrenOffset)!=null?o:[0,4]}}manualShow(t,e){const r={theme:"toolbar",...e};super.manualShow(t,r)}initCommandBarElement(t){z(t,"toolbar")}initItemElement(t,e){Cy(t,e,this.options)}}function KO(n,t,e){var r;return new ju((r=n.children)!=null?r:[],t,{...e,parentItem:n})}class VO extends fl{constructor(t,e,r){super(e,void 0,r),t.appendChild(this.content),document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("mousedown",this.handleDocumentMouseDown)}initCommandBarElement(t){z(t,"toolbar","fixed")}initItemElement(t,e){Cy(t,e,this.options)}close(){this.clearSelectedItem(),this.subBar&&(this.subBar.close("cancelBar"),this.subBar=null)}destroy(){this.content.remove(),super.destroy(),document.removeEventListener("keydown",this.handleDocumentKeydown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}getCommandBarRoot(){return this.content.parentElement}get isVisible(){return!0}}const Plt="";fl.registerManualCommandBar("menu",FO),fl.registerManualCommandBar("toolbar",KO);const Flt="",Ey=I("ui-base");class zu extends a0{constructor(e,r){super(zu.getCommandItems(e,r),void 0,{disablePageScroll:!0,...r});m(this,"handleDocumentMouseDown",e=>{})}initCommandBarElement(e){z(e,"dialog","manual")}initItemElement(e,r){}show(e,r){this.manualShow(e,{...r,theme:"light"})}get dialogContent(){const e=this.items[0];p(Ey,e,"no dialog item");const r=e.element;return p(Ey,r,"no item element"),r}static getCommandItems(e,r){var s;return[{id:(s=r==null?void 0:r.id)!=null?s:`manual-dialog-${et()}`,name:"",element:e}]}}const Klt="",$O=I("ui-base");class xy{constructor(t){m(this,"menu");m(this,"currentText","");m(this,"handleSearchText");m(this,"handleClick",ke.default((t,e)=>{this.options.onClickItem(this,e)},300,{leading:!0,trailing:!1}));m(this,"handleShow",t=>{});m(this,"handleClose",()=>{var t,e;(e=(t=this.options).onClose)==null||e.call(t)});m(this,"handleKeydown",t=>{this.menu.handleDocumentKeydown(t)});this.options=t,this.menu=new ls([],void 0,{id:t.id,header:t.header,footer:t.footer,disableSelectedScroll:t.disableSelectedScroll}),this.menu.addListener("click",this.handleClick),this.menu.addListener("close",this.handleClose),this.menu.addListener("show",this.handleShow),this.options.wait?this.handleSearchText=ke.default(async e=>{this.handleSearchTextPure(e)},this.options.wait):this.handleSearchText=this.handleSearchTextPure}setItems(t){if(this.menu.updateItems(t),t.length>0){const e=t.find(r=>r.type!=="section"&&r.type!=="separator");e&&this.menu.selectItem(e.id)}}async popup(t,e){var i,o;if(!(e!=null&&e.noEvent)&&((o=(i=this.options).onShow)==null?void 0:o.call(i,this))===!1)return;this.menu.manualShow(t),this.options.placeholder&&this.showPlaceholder();const r=await this.options.queryItems(this,"");this.highlightText("",r),this.setItems(r)}showLoading(){!this.options.showLoading||(this.options.loadingElement?this.setItems([{id:"loading",name:"",element:this.options.loadingElement,states:["disabled"]}]):this.setItems([{id:"loading",name:"loading",states:["disabled"]}]))}showPlaceholder(){this.setItems([{id:"placeholder",name:"enter text to search",states:["disabled"]}])}showNoResultMessage(t){if(this.options.noResultMessage){const e={name:"",id:"placeholder",states:["disabled"]};typeof this.options.noResultMessage=="string"?e.name=this.options.noResultMessage:(this.options.noResultMessage instanceof HTMLElement||typeof this.options.noResultMessage=="function")&&(e.element=this.options.noResultMessage),this.setItems([e])}else this.setItems([{id:"placeholder",name:this.options.emptyPlaceholder||D.t("search.emptyTips"),states:["disabled"]}])}close(){this.menu.close("cancelBar")}get isVisible(){return this.menu.isVisible}destroy(){this.menu.close("cancelBar"),this.menu.removeAllListeners(),this.menu.destroy()}isInCommandBar(t){return this.menu.isInCommandBar(t)}async handleSearchTextPure(t){this.currentText=t;const e="auto-suggest";try{await Mr.lock(e),this.showLoading();const r=this.currentText,i=await this.options.queryItems(this,t);if(this.currentText===r&&(this.currentText=""),i.length===0){this.showNoResultMessage(t);return}this.setItems(i),this.options.highlight&&this.highlightText(r.replace(/^\s+|\s+$/g,""),i)}finally{Mr.release(e)}}highlightText(t,e){$O.debug(`highlight menu text: ${t}`);const r=this.menu.content,i=(s,l)=>{if(!l)return s;let c="";const d=l.length,h=l.toLocaleLowerCase();let C=0;for(C=0;C<=s.length-d;C){let E=s.substring(C,C+d);if(E.toLocaleLowerCase()===h){C+=d;const x=s.charAt(C);let B=!1;E.endsWith(" ")&&(B=!0,E=E.trimEnd()),c+=`<span class="highlight">${E}${x===" "||B?" ":""}</span>`}else c+=s.charAt(C),C++}return C<s.length&&(c+=s.substring(C)),c},o=s=>{if(wt(s,"text")){const l=e==null?void 0:e.find(h=>h.id===s.getAttribute("data-id"));if(l&&l.element)return;const c=s.textContent;if(!c)return;const d=i(c,t);s.innerHTML=d;return}Array.from(s.children).forEach(o)};o(r)}}class sC{constructor(t,e){m(this,"root");m(this,"input");m(this,"text");m(this,"dropdownIcon");m(this,"clearIcon");m(this,"autoSuggest");m(this,"labels");m(this,"items",[]);m(this,"handleClick",()=>{this.autoSuggest.popup(this.root),this.input.focus()});m(this,"handleClickItem",(t,e)=>{var r,i;(i=(r=this.options)==null?void 0:r.onClickItem)==null||i.call(r,e)});m(this,"handleInput",()=>{this.autoSuggest.handleSearchText(this.input.value),this.updatePlaceholder()});m(this,"handleClear",t=>{var e,r;this.clear(),this.autoSuggest.handleSearchText(""),t.preventDefault(),t.stopPropagation(),(r=(e=this.options)==null?void 0:e.onClear)==null||r.call(e)});m(this,"handleQueryItems",async(t,e)=>this.items.filter(i=>{var o;return(o=this.options)!=null&&o.filter?this.options.filter(i,e):!0}));m(this,"handleShow",()=>{z(this.root,"active"),this.input.focus()});m(this,"handleClose",()=>{var t,e;(e=(t=this.options)==null?void 0:t.onClose)==null||e.call(t),ot(this.root,"active")});var c,d,h,C,E;this.options=e,this.labels=(d=(c=this.options)==null?void 0:c.labels)!=null?d:[];const{root:r,input:i,text:o,clearIcon:s,dropdownIcon:l}=sC.createDropdown(t,this.labels);this.root=r,this.input=i,this.text=o,this.clearIcon=s,this.dropdownIcon=l,this.autoSuggest=new xy({id:(e==null?void 0:e.popupId)||"dropdown-auto-suggest",header:(h=this.options)==null?void 0:h.header,onClickItem:this.handleClickItem,queryItems:this.handleQueryItems,onClose:this.handleClose,onShow:this.handleShow,highlight:e==null?void 0:e.highlight,emptyPlaceholder:e==null?void 0:e.emptyPlaceholder,disableSelectedScroll:e==null?void 0:e.disableSelectedScroll}),this.items=(E=(C=this.options)==null?void 0:C.items)!=null?E:[],this.root.addEventListener("click",this.handleClick),this.input.addEventListener("input",this.handleInput),this.clearIcon.addEventListener("click",this.handleClear)}close(){this.autoSuggest.close()}destroy(){this.input.removeEventListener("input",this.handleInput),this.root.removeEventListener("click",this.handleClick),this.clearIcon.removeEventListener("click",this.handleClear),this.autoSuggest.destroy()}updateItems(t){this.items=t,this.autoSuggest.handleSearchText("")}setText(t){this.text.innerText=t,this.input.value=t,this.updatePlaceholder()}clear(){this.setText(""),this.setLabels([])}setLabels(t){this.labels=t,this.updateLabels()}static createDropdown(t,e){const r=v("div",["editor-dropdown","empty"],t),i=v("input",["dropdown-input"],r),o=v("div",["dropdown-text"],r),s=v("div",["dropdown-labels"],r);for(let d=0;d<e.length;d+=1){const h=e[d];v("span",["dropdown-label"],s,h)}const l=v("div",["dropdown-clear-icon"],r);l.innerHTML=XT;const c=v("div",["dropdown-icon"],r);return c.innerHTML=Xh,{root:r,input:i,text:o,clearIcon:l,dropdownIcon:c}}updateLabels(){const t=this.root.querySelector(".dropdown-labels");if(t){t.innerHTML="";for(let e=0;e<this.labels.length;e+=1){const r=this.labels[e];v("span",["dropdown-label"],t,r)}}}updatePlaceholder(){var t;if(this.input.value===""){const e=(t=this.options)==null?void 0:t.placeholder;e&&(this.input.placeholder=e,this.text.textContent=e),z(this.root,"empty")}else ot(this.root,"empty")}}const HO=[-1,6,0,1,2,3,4,5],jO=[-1,6,0,1,2,3,4,5,14,13,7,8,9,10,11,12],Ay=I("color-palette");function by(n,t,e,r){p(Ay,n>0,"no color in palette");const i=t||1;p(Ay,i>0,`invalid palette rows: ${i}`);const o=n/i,s=v("div",["palette-container",r],null);for(let l=0;l<i;l++){const c=v("div",["palette-container-row"],s);for(let d=0;d<o;d++){const h=e(l*o+d);c.appendChild(h)}}return s}function zO(n){const t=v("button",["color-button"],null),e=HO[n];return t.setAttribute("data-color-index",`${e}`),t.innerHTML=Gp,t}function GO(n){const t=v("button",["background-color-button"],null),e=jO[n];return t.setAttribute("data-color-index",`${e}`),t}function WO(){const n=v("div",["clear-button-container"],null),t=v("button",["clear-button"],n);return t.innerText=D.t("colorPalette.reset"),n}function qO(n){const t=v("div",["color-palette"],null);return n.color!==!1&&(v("div",["bar-desc"],t,D.t("colorPalette.colorDesc")),t.appendChild(by(8,1,zO,"color"))),n.backgroundColor!==!1&&(v("div",["bar-desc"],t,D.t("colorPalette.backgroundDesc")),t.appendChild(by(16,2,GO,"background-color"))),n.clearColorButton!==!1&&t.appendChild(WO()),t}function XO(n,t,e){const r=t==="color"?"color":"background-color",i=n.querySelector(`.${r} button.selected`);i&&ot(i,"selected"),e===null&&(e=-1);const o=n.querySelector(`.${r} button[data-color-index="${e}"]`);o&&z(o,"selected")}const Vlt="",YO={};class QO extends ye.TypedEmitter{constructor(e=YO){super();m(this,"root");m(this,"handleClick",e=>{const r=e.target;if(!r||!(r instanceof Element))return;const i=r.closest("button");if(!i)return;if(wt(i,"clear-button")){this.setColor("backgroundColor",null),this.setColor("color",null),this.emit("onClick","clearColor",0);return}const o=i.getAttribute("data-color-index");if(!o)return;const s=Number.parseInt(o,10);Number.isNaN(s)||(wt(i,"color-button")?s===-1?(this.setColor("color",null),this.emit("onClick","clearColor",1)):(this.setColor("color",s),this.emit("onClick","color",s)):s===-1?(this.setColor("backgroundColor",null),this.emit("onClick","clearColor",2)):(this.setColor("backgroundColor",s),this.emit("onClick","backgroundColor",s)))});this.options=e,this.root=qO(e),this.root.addEventListener("click",this.handleClick)}destroy(){this.removeAllListeners(),this.root.removeEventListener("click",this.handleClick)}setColor(e,r){XO(this.root,e,r)}}class vy{constructor(t,e){m(this,"name","Color Palette");m(this,"element");m(this,"palette");m(this,"closeable",null);this.id=t,this.palette=new QO(e),this.element=this.palette.root}setCloseable(t){this.closeable=t}destroy(){this.palette.destroy(),this.closeable=null}}function JO(){const n=v("button",["color-button"],null);return n.innerHTML=Gp,n}function lC(n,t){const[e,r]=t;e===null?n.removeAttribute("data-color"):n.setAttribute("data-color",`${e}`),r===null?n.removeAttribute("data-background-color"):n.setAttribute("data-background-color",`${r}`)}class By extends ye.TypedEmitter{constructor(e){super();m(this,"id","text-color-item");m(this,"name",D.t("colorPalette.name"));m(this,"dropdown",!0);m(this,"manualShowChildren",!0);m(this,"children",[]);m(this,"element");m(this,"colorPaletteItem");m(this,"latestColors",[null,null]);m(this,"handlePaletteClick",(e,r)=>{this.emit("onClick",e,r)});m(this,"setLatestColors",(e,r)=>{e==="color"||e==="backgroundColor"?e==="color"?this.latestColors[0]=r:this.latestColors[1]=r:this.latestColors=[null,null],lC(this.element,this.latestColors)});m(this,"beforePopup",()=>{this.updatePaletteColor(this.latestColors),this.emit("beforePopup")});this.editor=e,this.colorPaletteItem=new vy("text-color-palette-item"),this.colorPaletteItem.palette.addListener("onClick",this.handlePaletteClick),this.children.push(this.colorPaletteItem),this.element=JO()}destroy(){this.colorPaletteItem.destroy()}updatePaletteColor(e){this.colorPaletteItem.palette.setColor("color",e[0]),this.colorPaletteItem.palette.setColor("backgroundColor",e[1]),this.latestColors=e,lC(this.element,this.latestColors)}updateButtonColor(e){this.latestColors=e,lC(this.element,this.latestColors)}}const $lt="";function c0(n,t){const e=v("div",["editor-input-wrap"],n);if(t!=null&&t.className&&z(e,t==null?void 0:t.className),t.label){const s=v("div",["editor-input-label"],e);v("span",[],s,t.label),t.required&&z(s,"required")}const r=v("div",["editor-input-container"],e),i=v("input",["editor-input"],null);if(t.placeholder&&(i.placeholder=t.placeholder),t.defaultValue&&(i.value=t.defaultValue),t.maxLength&&(i.maxLength=t.maxLength),t.maxLength){const s=v("div",["editor-input-suffix"],r);v("span",[],s,`${i.value.length} / ${t.maxLength}`),i.addEventListener("input",l=>{const c=l.target;s.innerText=`${c.value.length} / ${t.maxLength}`})}r.appendChild(i);const o=v("div",["editor-input-error"],e);return i.addEventListener("input",s=>{var l;(l=t.onChange)==null||l.call(t,s),ot(e,"error")}),Hd(i,(s,l)=>{var c;(c=t.onKeyDown)==null||c.call(t,s,l)}),{getField:()=>i,getInputValue:()=>i.value,setFieldError:s=>{z(e,"error"),o.innerText=s},focus:()=>{setTimeout(()=>{i.focus()})}}}function aC(n){const t=document.getSelection();if(!t)return!0;const e=t.focusNode;if(!e)return!0;const r=t.focusOffset,i=e.childNodes[r];if(!i)return!0;if(i instanceof HTMLElement){const o=i.tagName.toLowerCase();if(i===n.input.inputElement)return!0;if(o==="input"||o==="textarea")return!1}return!0}class ZO extends xy{constructor(e,r){super(r);m(this,"handleClose",()=>{var e,r;aC(this.editor)&&this.editor.focus(),(r=(e=this.options).onClose)==null||r.call(e)});this.editor=e,this.editorOptions=r}async popupInEditor(e,r,i){var d,h;if(((h=(d=this.editorOptions).onShow)==null?void 0:h.call(d,this,e,r,i))===!1)return;this.options.showLoading&&this.showLoading();const o=this.editor.getBlockByIndex(e,r);if(!re(this.editor.rootContainer,o)||dt(this.editor,o)<i)return;const s=Yi(this.editor,o,ve(this.editor,o,i));if(s.length===0)return;const l=s[0],c=Zi(this.editor,o,"editor-auto-suggest-menu",l);super.popup(c,{noEvent:!0})}}const cC=I("auto-suggest-menu");class uC{constructor(t,e){m(this,"order",100);m(this,"menu");m(this,"anchor",null);m(this,"close",()=>{this.menu.close()});m(this,"handleSelectionChanged",t=>{var r,i;if(!((r=this.menu)!=null&&r.isVisible))return;const e=t.selection.range.start;if(e.isSimple()&&e.blockId===((i=this.anchor)==null?void 0:i.blockId)&&e.offset>=this.anchor.offset){const o=t.getBlockById(e.blockId);if(de(Mn(yn(t,o),e.offset).left).startsWith(this.anchor.leftText))return}this.menu.close()});m(this,"deleteTrigger",()=>{const t=this.editor,e=t.selection.range.start;if(!e.isSimple()||!this.anchor)return!1;const{blockId:r,offset:i}=e,o=t.getBlockById(r),s=de(xh(t,o,i));if(p(cC,this.anchor,"no anchor"),!s.startsWith(this.anchor.leftText))return!1;const l=this.anchor.offset-this.anchor.trigger.length,c=i-l;return t.selection.selectBlock(o,l),c&&(t.deleteTextFromBlock(o,l,c),this.anchor.offset-=this.anchor.trigger.length),this.anchor.trigger.length||this.menu.close(),!0});m(this,"onClose",()=>{var t,e;(e=(t=this.options).onClose)==null||e.call(t)});m(this,"onShow",(t,e,r,i)=>{var o;if((o=this.options)!=null&&o.onShow)return this.options.onShow(this,e,r,i)});m(this,"onClickItem",(t,e)=>{!this.anchor||(this.options.autoDeleteTrigger&&this.deleteTrigger(),this.options.onClickItem(this,e,this.anchor))});m(this,"queryItems",(t,e)=>this.options.queryItems(this,e));m(this,"renderMenuItem",(t,e)=>{var i,o;return(o=(i=this.options).renderMenuItem)==null?void 0:o.call(i,this,e)});m(this,"hasExistsMenuThemeCommandBar",()=>!!document.querySelector('div.tippy-box[data-theme="menu"]'));this.editor=t,this.options=e,this.menu=new ZO(t,{id:e.id,showLoading:e.showLoading,loadingElement:e.loadingElement,placeholder:e.placeholder,header:e.header,footer:e.footer,wait:e.wait,noResultMessage:e.noResultMessage,highlight:e.highlight,onClose:this.onClose,onShow:this.onShow,onClickItem:this.onClickItem,queryItems:this.queryItems,renderMenuItem:this.renderMenuItem}),t.input.addHandler(this),t.addListener("selectionChanged",this.handleSelectionChanged)}handleBeforeKeyDown(t,e){var r;return!((r=this.menu)!=null&&r.isVisible)||Pg(e.key)?!1:ev(e)&&!qs(e)?(setTimeout(()=>{this.resetItems()}),!1):Gd(e)?(this.menu.close(),!0):(this.menu.handleKeydown(e),!0)}popup(t,e,r,i){this.anchor={blockId:lt(t),offset:e,leftText:r,trigger:i};const o=ct(it(t)),s=vt(t);this.menu.popupInEditor(o,s,e)}handleAfterInsertText(t,e,r,i,o){var h,C;const s=t.selection.range.start;if(!s.isSimple())return!1;const l=t.getBlockByIndex(e,r);if(qi(l))return!1;const{blockId:c,offset:d}=s;if(lt(l)!==c)return!1;if((h=this.menu)!=null&&h.isVisible)this.resetItems();else if(this.options.trigger.indexOf(o)!==-1){if(i>0&&this.options.needSpaceBeforeTrigger&&(((C=t.getBlockData(l).text)==null?void 0:C.reduce((k,w)=>k+w.insert,""))||"")[i-1].trim().length!==0||this.hasExistsMenuThemeCommandBar())return!1;const E=de(xh(t,l,d));this.popup(l,d,E,o)}return!1}handleUpdateCompositionText(t,e,r,i,o){var d;const s=t.selection.range.start;if(!s.isSimple())return!1;const{blockId:l}=s,c=t.getBlockByIndex(e,r);return lt(c)!==l||(d=this.menu)!=null&&d.isVisible&&this.resetItems(),!1}resetItems(){var l;if(!((l=this.menu)!=null&&l.isVisible))return;const t=this.editor,e=t.selection.range.start;if(!e.isSimple())return;const{blockId:r,offset:i}=e,o=t.getBlockById(r),s=de(xh(t,o,i));if(p(cC,this.anchor,"no anchor"),s.startsWith(this.anchor.leftText)){const c=s.substring(this.anchor.leftText.length);cC.debug(`search text: ${c}`),this.menu.handleSearchText(c)}}destroy(){var t;this.editor.input.removeHandler(this),this.editor.removeListener("selectionChanged",this.handleSelectionChanged),(t=this.menu)==null||t.destroy()}}function tN(){const n={};for(let t=1;t<=8;t++)n[`heading-${t}`]={shortcut:`/h${t}`};return n}const eN={"insert-hr":{shortcut:"/hr"},"insert-uml":{shortcut:"/uml"},"insert-table":{shortcut:"/table"},"insert-image":{shortcut:"/image"},"insert-code":{shortcut:"/code"},"insert-link":{shortcut:"/link"},"insert-drawio":{shortcut:"/uml"},"insert-video":{shortcut:"/video"},"insert-audio":{shortcut:"/audio"},"insert-math":{shortcut:"/math"},"insert-webPage":{shortcut:"/web"},"insert-bilibili":{shortcut:"/bilibili"},"insert-youku":{shortcut:"/youku"},"insert-figma":{shortcut:"/figma"},"insert-modao":{shortcut:"/modao"},"insert-tencent":{shortcut:"/tencent"},"insert-unordered":{shortcut:"/bl"},"insert-ordered":{shortcut:"/nu"},"insert-checkbox":{shortcut:"/todo"},"insert-quote":{shortcut:"/quote"},...tN()};function kn(n){var t;return(t=eN[n])==null?void 0:t.shortcut}function nN(n){var t;return(t=n.subText)!=null?t:""}const yi=I("table-dom");function ki(n){return`${lt(n)}_scroll`}function ze(n){const t=n.querySelector("div[data-type=table-content] >table");return p(yi,t instanceof HTMLTableElement,"invalid table"),t}function Ri(n,t){const r=n.getCustom(ki(t)).contentElement.firstElementChild;p(yi,r instanceof HTMLElement,"invalid table content");let i=r.querySelector(":scope >div[data-type=table-tools]");return i||(i=v("div",[],r),i.setAttribute("data-type","table-tools"),n.domEvents.addEventListener(i,"dblclick",(o,s)=>s.stopPropagation()),n.domEvents.addEventListener(i,"click",(o,s)=>{s.detail===3&&s.stopPropagation()})),p(yi,i,"no table tools"),i}function rN(n,t){return n.findCustom(ki(t))?Ri(n,t):null}function Ty(n){const t=[];return Array.from(n.rows).forEach(e=>{t.push(...Array.from(e.cells))}),t}function Gu(n){const t=n.querySelector(":scope div[data-type=editor-container]");return p(yi,t,"no child container in cell"),t}function iN(n){const r=Ty(n).map(i=>{const o=Gu(i),s=ct(o),l=i.colSpan,c=i.rowSpan;return`${s}/${l}/${c}`}).join();return Md.default(r)}function Ge(n){return Dt(n)==="table"}function fC(n){const t=it(n);if(qt(t))return null;const e=Z(t);return p(yi,e,"no parent block"),Ge(e)?t:fC(e)}function ho(n){if(Ge(n))return n;const t=it(n);if(qt(t))return null;const e=Z(t);return p(yi,e,"no parent block"),Ge(e)?e:ho(e)}function oN(n,t){const e=n.querySelector("colgroup");p(yi,e,"no colgroup");const r=e.children[t];return p(yi,r,"no col"),p(yi,r instanceof HTMLTableColElement,`invalid col: ${r.tagName}`),r}function yy(n){try{return ze(n),!0}catch{return!1}}function sN(n){return oe(n).querySelector(":scope > .block-helper")}function ky(n){const t=Z(n.contentElement);p(yi,t,"no block");const e=sN(t);if(e){const o=Math.min(n.contentElement.offsetLeft+29,n.rootElement.scrollLeft),s=t.getBoundingClientRect().width;e.style.right=`${o+s+5}px`}}function lN(n){const t=n.getComponentOptions("table"),e=t==null?void 0:t.bigTableBoundary;if(!e)return!1;const r=n.rootContainer.querySelectorAll("div[data-type=table-content] >table");let i=!1;return r.forEach(o=>{o.getBoundingClientRect().width>e&&(i=!0)}),i}const Xr=I("doc-table-grid");class aN{constructor(t){m(this,"_cells",[]);for(let e=0;e<t;e++)this._cells.push(void 0)}cols(){return this._cells.length}setCell(t,e){p(Xr,t>=0&&t<this.cols(),`set cell, invalid col: ${t}`),this._cells[t]=e}getCell(t){p(Xr,t>=0&&t<this.cols(),`get cell, invalid col: ${t}`);const e=this._cells[t];return p(Xr,e,"get cell, no cell"),e}getCellAllowEmpty(t){return p(Xr,t>=0&&t<this.cols(),`get cell, invalid col, ${t}`),this._cells[t]}getNextNonVirtualCell(t){return this._cells.slice(t+1).find(e=>!e.virtual)}forEach(t){this._cells.forEach(t)}}class u0{constructor(t){m(this,"_data");m(this,"_rows");this._data=t,this._rows=[];for(let e=0;e<this.rowCount;e++)this._rows.push(new aN(this.colCount));this.fillGrid()}get rowCount(){return this._data.rows}get colCount(){return this._data.cols}getNextEmptyCell(t,e){let r=t,i=e;for(;;){if(r+=1,r===this.colCount&&(r=0,i+=1),i>=this.rowCount)return null;if(this._rows[i].getCellAllowEmpty(r)===void 0)return{col:r,row:i}}}fillGrid(){const t=this._data.children;p(Xr,t,"no children");let e=0,r=0;t.forEach((i,o)=>{const s=this._data[`${i}_colSpan`]||1,l=this._data[`${i}_rowSpan`]||1;for(let d=0;d<l;d++)for(let h=0;h<s;h++)this._rows[r+d].setCell(e+h,{col:e,row:r,containerId:i,virtual:h!==0||d!==0,colSpan:s,rowSpan:l});const c=this.getNextEmptyCell(e,r);c?(e=c.col,r=c.row):p(Xr,o===t.length-1,`invalid table data, no next empty cell: ${JSON.stringify(this._data)}`)}),this._rows.forEach(i=>{i.forEach(o=>{p(Xr,o,"no cell"),p(Xr,o.containerId,"no containerId")})})}getCell(t){const{col:e,row:r}=t,i=this._rows[r];p(Xr,i,`get cell, no row: ${r}`);const o=i.getCell(e);return p(Xr,o,`get cell, no cell: ${e}`),o}getRow(t){const e=this._rows[t];return p(Xr,e,`get row, no row: ${t}`),e}forEach(t){this._rows.forEach(t)}}const f0=I("table-data");function cN(n){const t=n.firstElementChild;return p(f0,t,"no child element for cell"),p(f0,Xi(t),"cell first child is not a container"),p(f0,Fr(t),"cell first child is not a container"),t}function uN(n){const t=Z(n);p(f0,t,"no parent block for table");const e=[],r={};Array.from(n.rows).forEach(l=>{Array.from(l.cells).forEach(c=>{const d=cN(c),h=ct(d);e.push(h),(c.colSpan>1||c.rowSpan>1)&&(r[`${h}_colSpan`]=c.colSpan,r[`${h}_rowSpan`]=c.rowSpan)})});const i=n.rows.length,o=Array.from(n.rows[0].cells).map(l=>l.colSpan).reduce((l,c)=>l+c,0);return{id:lt(t),type:Dt(t),rows:i,cols:o,children:e,colsWidth:Array(o).fill(100),...r}}function dl(n){return new u0(n)}function fN(n){return dl(uN(n))}const Ze=I("table-grid"),dN=60;class hN{constructor(t,e){m(this,"containerId");m(this,"row");m(this,"col");m(this,"colSpan");m(this,"rowSpan");m(this,"virtual");m(this,"table");this.table=t,this.containerId=e.containerId,this.row=e.row,this.col=e.col,this.colSpan=e.colSpan,this.rowSpan=e.rowSpan,this.virtual=e.virtual}get cell(){const e=this.container.closest("td");return p(Ze,e,"no parent cell for child container"),e}get container(){const t=this.table.querySelectorAll(`[data-container-id=${this.containerId}]`);p(Ze,t.length===1,"containers !== 1"),p(Ze,Xi(t[0]),"not a container");const e=t[0];return p(Ze,Fr(e),"not a child container"),e}}class mN{constructor(t,e){m(this,"_cells",[]);e.forEach(r=>{this._cells.push(new hN(t,r))})}get cells(){return this._cells}getCell(t){return p(Ze,t<this._cells.length,"get cell, invalid col"),this._cells[t]}getNextNonVirtualCell(t){return this._cells.slice(t+1).find(e=>!e.virtual)}getSpannedCell(){return this._cells.find(t=>t.virtual||t.colSpan>1||t.rowSpan>1)}}const Sx=class{constructor(t){m(this,"_rows",[]);this.table=t,fN(t).forEach(i=>{this._rows.push(new mN(t,i))});const r=this.colCount;this._rows.forEach(i=>{p(Ze,i.cells.length===r,"row.cells.length !== colCount")})}get rowCount(){return this._rows.length}get colCount(){return this._rows.length===0?0:(p(Ze,this.rowCount>0,"rowCount <= 0"),this.getRow(0).cells.length)}getRow(t){return this._rows[t]}getCell(t){const e=this.getRow(t.row);return p(Ze,e,"no row"),e.getCell(t.col)}getCellContainer(t){return this.getCell(t).container}getFirstCellContainer(){return this.getCellContainer({row:0,col:0})}getLastCellContainer(){const t=this.rowCount-1,e=this.colCount-1;return this.getCellContainer({row:t,col:e})}getColumnCells(t){p(Ze,t>=0&&t<this.colCount,"colIndex out of range");const e=this.rowCount,r=[];for(let i=0;i<e;i++){const o=this.getCell({row:i,col:t});r.push(o)}return r}toRealCells(t){const e=[];return t.forEach(r=>{const i=this.getRealCell(r);e.findIndex(o=>o.containerId===i.containerId)===-1&&e.push(i)}),e}getColumnRealCells(t){const e=this.getColumnCells(t);return this.toRealCells(e)}getRowRealCells(t){const e=this.getRow(t).cells;return this.toRealCells(e)}getFirstSpannedCell(t){p(Ze,t>=0&&t<this.colCount,"colIndex out of range");const e=this.rowCount;for(let r=0;r<e;r++){const i=this.getCell({row:r,col:t});if(i.virtual||i.colSpan>1||i.rowSpan>1)return i}}getRealCell(t){const e=this.getCell(t);if(!e.virtual)return e;const r=this.getCellById(e.containerId);return p(Ze,!r.virtual,"found a virtual cell"),r}getColumnSpannedRange(t){const e=this.getColumnRealCells(t);let r=1e5,i=-1;return e.forEach(o=>{r=Math.min(o.col,r),i=Math.max(o.col+o.colSpan-1,i)}),p(Ze,r<=i,"min > max"),p(Ze,r>=0,"min < 0"),p(Ze,i<this.colCount,"max >= colCount"),[r,i]}getRowSpannedRange(t){const e=this.getRowRealCells(t);let r=1e5,i=-1;return e.forEach(o=>{r=Math.min(o.row,r),i=Math.max(o.row+o.rowSpan-1,i)}),p(Ze,r<=i,"min > max"),p(Ze,r>=0,"min < 0"),p(Ze,i<this.rowCount,"max >= rowCount"),[r,i]}getSpannedRange(t,e){const r=Math.min(t.row,e.row),i=Math.max(t.row,e.row),o=Math.min(t.col,e.col),s=Math.max(t.col,e.col),l=[];for(let x=r;x<=i;x++)for(let B=o;B<=s;B++)l.push(this.getCell({row:x,col:B}));const c=this.toRealCells(l);let d=1e4,h=1e4,C=-1,E=-1;return c.forEach(x=>{h=Math.min(x.col,h),d=Math.min(x.row,d),E=Math.max(x.col+x.colSpan-1,E),C=Math.max(x.row+x.rowSpan-1,C)}),[{row:d,col:h},{row:C,col:E}]}getAllCells(){return this.getCells({col:0,row:0},{col:this.colCount-1,row:this.rowCount-1})}sub(t,e){const r=[];for(let i=t.row;i<=e.row;i++){const o=[];for(let s=t.col;s<=e.col;s++){const l=this.getCell({row:i,col:s});o.push(l)}r.push(o)}return r}getAllContainers(){return this.getAllCells().map(e=>e.container)}getCells(t,e){const r=[],i=this.getSpannedRange(t,e),o=i[0],s=i[1],l=Math.min(o.row,s.row),c=Math.max(o.row,s.row),d=Math.min(o.col,s.col),h=Math.max(o.col,s.col);for(let C=l;C<=c;C++)for(let E=d;E<=h;E++){const x=this.getCell({row:C,col:E});x.virtual||r.push(x)}return r}map(t){const e=[];for(let r=0;r<this.rowCount;r++){const i=[];for(let o=0;o<this.colCount;o++){const s=this.getCell({row:r,col:o});i.push(t(s))}e.push(i)}return e}getBottomCell(t){const e=this.rowCount;let r=t,i=t.row;for(;r.containerId===t.containerId;){if(i+=1,i>=e)return null;r=this.getCell({row:i,col:t.col})}return this.getRealCell(r)}getTopCell(t){let e=t,r=t.row;for(;e.containerId===t.containerId;){if(r-=1,r<0)return null;e=this.getCell({row:r,col:t.col})}return this.getRealCell(e)}get cells(){let t=[];return this._rows.forEach(e=>{t=t.concat(e.cells)}),t}getVirtualCellContainersGrid(){return this.map(t=>t.containerId)}static virtualCellContainersGridToChildren(t){const e=t,r=[];return e.forEach(i=>{i.forEach(o=>{r.indexOf(o)===-1&&r.push(o)})}),r}getCellById(t){const r=this.cells.find(i=>i.containerId===t);return p(Ze,r,"cell not found"),r}getCellByCellElement(t){const e=Gu(t);return this.getCellByContainerId(ct(e))}getCellByContainerId(t){return this.getCellById(t)}static fromTable(t){const e=iN(t),r=this.caches.getSync(e,()=>(Ze.debug("create table grid"),new Sx(t)));return r.table!==t?(this.caches.delete(e),this.fromTable(t)):r}static fromBlock(t){return this.fromTable(ze(t))}};let Mt=Sx;m(Mt,"caches",new Nb(dN));function d0(n,t){Object.entries(n).forEach(([e])=>{e.startsWith(`${t}/`)&&delete n[e]})}const gN=I("table-selection-range");function Yr(n,t,e){var M,F,Y,X;const r=Mt.fromBlock(n),i=t,o=e,s=r.getCellByContainerId(i.childContainerId),l=r.getCellByContainerId(o.childContainerId),c=i.custom,d=o.custom,h=(M=c==null?void 0:c.rowIndex)!=null?M:s.row,C=(F=c==null?void 0:c.colIndex)!=null?F:s.col,E=(Y=d==null?void 0:d.rowIndex)!=null?Y:l.row+l.rowSpan-1,x=(X=d==null?void 0:d.colIndex)!=null?X:l.col+l.colSpan-1,B=Math.min(h,E),k=Math.max(h,E),w=Math.min(C,x),U=Math.max(C,x);return{fromRow:B,toRow:k,fromCol:w,toCol:U}}function dC(n,t){const e=new Set,r=new Set,i=n.selection.range;if(!i.isSimple()&&i.start.blockId===lt(t)){const o=Mt.fromBlock(t),{start:s,end:l}=i;p(gN,!s.isSimple()&&!l.isSimple(),"invalid range");const{fromCol:c,toCol:d,fromRow:h,toRow:C}=Yr(t,s,l);if(h===0&&C===o.rowCount-1)for(let E=c;E<=d;E++)r.add(E);if(c===0&&d===o.colCount-1)for(let E=h;E<=C;E++)e.add(E)}return{selectedRows:e,selectedColumns:r}}function Wu(n,t){let e=null;if(t.isCollapsed()&&t.isSimple()){const r=n.getBlockById(t.start.blockId);if(Ge(r)){const i=it(r),o=Z(i);o&&(e=ho(o))}else e=ho(r)}else{const r=n.getBlockById(t.start.blockId),i=ho(r),o=n.getBlockById(t.end.blockId),s=ho(o);i===s&&(e=i)}return e}const $a=I("delete-columns");function Ry(n,t,e){const{start:r,end:i}=e;if(r.blockId!==i.blockId||e.isSimple()||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{fromRow:s,toRow:l}=Yr(t,e.start,e.end),c=Mt.fromBlock(t);return s===0&&l===c.rowCount-1}function hC(n){const t=n.getEditor();t.undoManager.runInGroup(()=>{var F,Y;const e=t.getBlockById(n.start.blockId);if(!Ry(t,e,n))return;if(n.isSimple()){t.deleteBlock(e);return}const{fromCol:r,toCol:i}=Yr(e,n.start,n.end),o=Mt.fromBlock(e);if(r===0&&i===o.colCount-1){t.deleteBlock(e);return}const s=new Set,l=o.map(X=>X.containerId);for(let X=0;X<l.length;X++){const G=l[X];for(let st=r;st<=i;st++){const pt=G[st];s.add(pt)}G.splice(r,i-r+1)}const c=new Set(l.flat()),d=new Set(Array.from(s).filter(X=>!c.has(X))),h=i-r+1,C=new Map,E=new Map;s.forEach(X=>{if(d.has(X))return;const G=o.getCellByContainerId(X);if(p($a,G.colSpan>1,"invalid effected cell, colSpan === 1"),G.col<r){p($a,c.has(X),"invalid effected cell, not exists");let Gt=G.col+G.colSpan-1;Gt>i&&(Gt=i);const Pe=Gt-r+1,he=G.colSpan-Pe;C.set(X,he);return}p($a,G.col<=i,"invalid effected cell, col > endCol");const st=G.col,pt=G.col+G.colSpan-1,Ct=G.col-r,yt=pt-st+1-h+Ct;p($a,yt>0,"invalid effected cell, newSpanned <= 0");const bt=oo(t.doc);E.set(X,{newContainerId:bt,colSpan:yt})});for(let X=0;X<l.length;X++){const G=l[X];for(let st=r;st<G.length;st++){const pt=G[st],Ct=E.get(pt);Ct&&(G[st]=Ct.newContainerId)}}const x=mt.default(t.getBlockData(e));((F=x.colsWidth)!=null?F:new Array(x.cols).fill(0)).splice(r,i-r+1),d.forEach(X=>{d0(x,X)}),C.forEach((X,G)=>{p($a,X>=1,"invalid modified colSpan, colSpan < 1"),X===1?x[`${G}_colSpan`]=void 0:x[`${G}_colSpan`]=X}),E.forEach((X,G)=>{d0(x,G);const{newContainerId:st,colSpan:pt}=X;p($a,pt>=1,"invalid newContainerData, colSpan < 1"),pt>1&&(x[`${st}_colSpan`]=pt);const Ct=o.getCellByContainerId(G).rowSpan;Ct>1&&(x[`${st}_rowSpan`]=Ct)});const k=(Y=l[0][r])!=null?Y:l[0][r-1],w=t.getChildContainerData(k)[0],U=Mt.virtualCellContainersGridToChildren(l),M={...x,cols:x.cols-h,children:U};dl(M),t.updateBlockData(e,M,ve(t,w.id,0)),t.deleteChildContainers(Array.from(d)),t.deleteChildContainers(Array.from(E.keys()))})}const Ha=I("delete-rows");function wy(n,t,e){const{start:r,end:i}=e;if(r.blockId!==i.blockId||e.isSimple()||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{fromCol:s,toCol:l}=Yr(t,e.start,e.end),c=Mt.fromBlock(t);return s===0&&l===c.colCount-1}function mC(n){const t=n.getEditor();t.undoManager.runInGroup(()=>{const e=t.getBlockById(n.start.blockId);if(!wy(t,e,n))return;if(n.isSimple()){t.deleteBlock(e);return}const{fromRow:r,toRow:i}=Yr(e,n.start,n.end),o=Mt.fromBlock(e);if(r===0&&i===o.rowCount-1){t.deleteBlock(e);return}const s=new Set,l=o.map(M=>M.containerId);for(let M=i;M>=r;M--)l[M].forEach(Y=>s.add(Y)),l.splice(M,1);const c=new Set(l.flat()),d=new Set(Array.from(s).filter(M=>!c.has(M))),h=i-r+1,C=new Map,E=new Map;s.forEach(M=>{if(d.has(M))return;const F=o.getCellByContainerId(M);if(p(Ha,F.rowSpan>1,"invalid effected cell, rowSpan === 1"),F.row<r){p(Ha,c.has(M),"invalid effected cell, not exists");let Ct=F.row+F.rowSpan-1;Ct>i&&(Ct=i);const yt=Ct-r+1,bt=F.rowSpan-yt;C.set(M,bt);return}p(Ha,F.row<=i,"invalid effected cell, col > endCol");const Y=F.row,X=F.row+F.rowSpan-1,G=F.row-r,st=X-Y+1-h+G;p(Ha,st>0,"invalid effected cell, newSpanned <= 0");const pt=oo(t.doc);E.set(M,{newContainerId:pt,rowSpan:st})});for(let M=r;M<l.length;M++){const F=l[M];for(let Y=0;Y<F.length;Y++){const X=F[Y],G=E.get(X);G&&(F[Y]=G.newContainerId)}}const x=mt.default(t.getBlockData(e));d.forEach(M=>{d0(x,M)}),C.forEach((M,F)=>{p(Ha,M>=1,"invalid modified rowSpan, rowSpan < 1"),M===1?x[`${F}_rowSpan`]=void 0:x[`${F}_rowSpan`]=M}),E.forEach((M,F)=>{d0(x,F);const{newContainerId:Y,rowSpan:X}=M;p(Ha,X>=1,"invalid newContainerData, rowSpan < 1"),X>1&&(x[`${Y}_rowSpan`]=X);const G=o.getCellByContainerId(F).colSpan;G>1&&(x[`${Y}_colSpan`]=G)});const B=l[r]?l[r][0]:l[r-1][0],k=t.getChildContainerData(B)[0],w=Mt.virtualCellContainersGridToChildren(l),U={...x,rows:x.rows-h,children:w};dl(U),t.updateBlockData(e,U,ve(t,k.id,0)),t.deleteChildContainers(Array.from(d)),t.deleteChildContainers(Array.from(E.keys()))})}const qu=I("table-range");function h0(n){p(qu,!n.isSimple(),"must be complex selection range");const{anchor:t,focus:e}=n;p(qu,!t.isSimple(),"invalid start pos type"),p(qu,!e.isSimple(),"invalid end pos type");const r=n.getEditor();p(qu,t.blockId===e.blockId,"invalid range, not same block");const i=r.getBlockById(t.blockId);p(qu,Dt(i)==="table","invalid block type, not a table block");const o=ze(i),s=Mt.fromTable(o),l=s.getCellByContainerId(t.childContainerId),c=s.getCellByContainerId(e.childContainerId),d=Math.min(l.row,c.row),h=Math.max(l.row,c.row),C=Math.min(l.col,c.col),E=Math.max(l.col,c.col),x=s.getCell({row:d,col:C}),B=s.getCell({row:h,col:E});return{editor:r,block:i,table:o,startCell:x,endCell:B,startRow:d,startCol:C,endRow:h,endCol:E}}const gC=I("split-cell");function pC(n,t,e){n.undoManager.runInGroup(()=>{const r=Mt.fromBlock(t),i=r.getRealCell(e);p(gC,!i.virtual,"should not split virtual cell"),p(gC,i.colSpan>1||i.rowSpan>1,"cell does not has span data");const o=r.getVirtualCellContainersGrid();for(let C=0;C<i.rowSpan;C++)for(let E=0;E<i.colSpan;E++){if(C===0&&E===0)continue;const x=C+i.row,B=E+i.col,k=oo(n.doc);o[x][B]=k}const s=n.getBlockData(t),l=mt.default(s);l[`${i.containerId}_colSpan`]=null,l[`${i.containerId}_rowSpan`]=null,l.children=Mt.virtualCellContainersGridToChildren(o);const d=n.getChildContainerData(i.containerId)[0];p(gC,d,"no child block");const h=ve(n,d.id,0);dl(l),n.updateBlockData(t,l,h)})}function pN(n,t,e){e.forEach(r=>{const i=Mt.fromBlock(t).getCell(r);(i.virtual||i.colSpan>1||i.rowSpan>1)&&pC(n,t,r)})}function Sy(n,t,e){if(e.isSimple())return!1;const{start:r,end:i}=e;if(r.blockId!==i.blockId||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{startCell:s,endCell:l}=h0(e);return!(s.cell!==l.cell||s.colSpan===1&&s.rowSpan===1)}function CC(n){const{editor:t,block:e,startRow:r,startCol:i,endRow:o,endCol:s}=h0(n),l=[];for(let c=r;c<=o;c++)for(let d=i;d<=s;d++)l.push({row:c,col:d});return pN(t,e,l),!0}const ja=I("merge-cells");function Ly(n,t,e){if(e.isSimple())return!1;const{start:r,end:i}=e;if(r.blockId!==i.blockId||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{startCell:s,endCell:l}=h0(e);return s.cell!==l.cell}function Iy(n){const t=h0(n),e=t.editor;e.undoManager.runInGroup(()=>{const r=t.endCell,i=r.row+r.rowSpan-1,o=r.col+r.colSpan-1,s=lt(t.block);CC(n);const l=e.getBlockById(s),c=ze(l),{startRow:d,startCol:h}=t,C=mt.default(e.getBlockData(l));p(ja,C.children,"no table children");const E=Mt.fromTable(c),x=[];for(let Ct=d;Ct<=i;Ct++)for(let yt=h;yt<=o;yt++){const bt=E.getCell({row:Ct,col:yt});p(ja,!bt.virtual,"cell is virtual"),x.push(bt)}p(ja,x.length>0,"no selected cells");const B=x[0],k=x.slice(1),w=E.getCellByContainerId(B.containerId).container,U=[];k.forEach(Ct=>{const yt=E.getCellByContainerId(Ct.containerId).container,bt=ct(yt);if(!fu(e,yt)){const Gt=H5(e,bt);if(fu(e,w)){const Pe=fe(w)[0];e.insertDocAt(w,0,Gt),e.deleteBlock(Pe)}else e.insertDocAt(w,Or(w),Gt)}U.push(bt)});const M=ct(w),F=o-h+1,Y=i-d+1;C[`${M}_colSpan`]=F,C[`${M}_rowSpan`]=Y,U.forEach(Ct=>{p(ja,C.children,"no table children");const yt=C.children.indexOf(Ct);p(ja,yt>0,"no deleted container"),C.children.splice(yt,1)});const X=C,st=e.getChildContainerData(M)[0];p(ja,st,"no child block");const pt=ve(e,st.id,0);dl(X),e.updateBlockData(l,X,pt),e.deleteChildContainers(U)})}const EC=10,CN=["table/merge-cells","table/split-cell","table/insert-column","table/insert-row","table/delete-rows","table/delete-columns","table/delete"];class m0{constructor(){m(this,"id","TableBlockCommandProvider")}getAvailableCommands(t,e,r){if(Dt(e)!=="table")return[];const i={blockId:lt(e),blockKind:Nr(t,e),blockType:Dt(e)},o=[];Ly(t,e,r)&&o.push({id:"table/merge-cells",name:D.t("table.mergeCell"),icon:gT,groupIndex:EC,...i}),Sy(t,e,r)&&o.push({id:"table/split-cell",name:D.t("table.splitCell"),icon:pT,groupIndex:EC,...i});const s=Ry(t,e,r),l=wy(t,e,r);return s&&l&&o.push({id:"table/delete",name:D.t("table.deleteTable"),icon:CT,groupIndex:EC,...i}),o}executeCommand(t,e,r,i,o,s){return Dt(e)!=="table"||!new Set(CN).has(i.id)?!1:i.id==="table/merge-cells"?(Iy(r),!0):i.id==="table/split-cell"?(CC(r),!0):i.id==="table/delete-columns"?(hC(r),!0):i.id==="table/delete-rows"?(mC(r),!0):i.id==="table/delete"?(t.deleteBlock(e),!0):!1}}var Dy=(n=>(n.COL_TITLE_TABLE="col-title-table",n.COL_TITLE_ITEM="col-title-item",n.STRIPE_STYLE_TABLE="stripe-style-table",n.NO_BORDER="table-no-border",n))(Dy||{});const za=6,Xu=20,xC="table-cell-menu-btn";function EN(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasColTitle:!0};n.updateBlockData(t,r)}function xN(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasColTitle:!1};n.updateBlockData(t,r)}function AN(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasRowTitle:!0};n.updateBlockData(t,r)}function bN(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasRowTitle:!1};n.updateBlockData(t,r)}function vN(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),isStripeStyle:!0};n.updateBlockData(t,r)}function BN(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),isStripeStyle:!1};n.updateBlockData(t,r)}function TN(n,t,e){if(!n.isBlockWritable(t))return;const i={...mt.default(n.getBlockData(t)),noBorder:!e};n.updateBlockData(t,i)}const hl=I("table-cell-dom");function yN(n,t,e){let r=n.getBlockById(e);for(;r;){const i=r.closest("td");p(hl,i,"no parent cell");const o=Z(i);if(p(hl,o,"no parent block"),o===t)return i;r=o}return p(hl,!1,"filed to get cell by child block id"),null}function as(n,t,e){if(n.getBlockById(e.blockId)===t&&!e.isSimple())return p(hl,e.childContainerId,"block position must have childContainerId attribute"),e;const i=yN(n,t,e.blockId),o=ct(Gu(i));return xe(t,o)}function AC(n,t){const e=n.selection.range,r=as(n,t,e.start),i=as(n,t,e.end);return Yr(t,r,i)}function _y(n,t,e,r){p(hl,Ge(t),"invalid table block");const i=Ri(n,t),o=oe(t),s=()=>{const c=i.querySelector(".table-border-bar-container.top");p(hl,c,"no top border bar container"),c.querySelectorAll(".table-border-bar-cell.top").forEach(h=>{const C=parseInt(h.getAttribute("data-top-index")||"0",10);r.includes(C)?z(h,"danger"):ot(h,"danger")})},l=()=>{const c=o.querySelector(".table-border-bar-container.left");p(hl,c,"no left border bar container"),c.querySelectorAll(".table-border-bar-cell.left").forEach(h=>{const C=parseInt(h.getAttribute("data-left-index")||"0",10);e.includes(C)?z(h,"danger"):ot(h,"danger")})};s(),l()}function cs(n,t,e=!0,r){const o=Mt.fromBlock(t).map(h=>h),{fromCol:s,toCol:l,fromRow:c,toRow:d}=AC(n,t);for(let h=0;h<o.length;h++){const C=o[h];for(let E=0;E<C.length;E++){const x=C[E],B=r?E>=s&&E+x.colSpan-1<=l:h>=c&&h+x.rowSpan-1<=d;e&&B?x.virtual||z(x.cell,"danger"):x.virtual||ot(x.cell,"danger")}}}function us(n,t,e=!0,r){const i=new Set,o=new Set;if(!e){_y(n,t,Array.from(i),Array.from(o));return}const{fromCol:s,toCol:l,fromRow:c,toRow:d}=AC(n,t);if(r)for(let h=s;h<=l;h++)o.add(h);else for(let h=c;h<=d;h++)i.add(h);_y(n,t,Array.from(i),Array.from(o))}function My(n,t,e){const{fromCol:r,toCol:i,fromRow:o,toRow:s}=AC(n,t),l=Mt.fromBlock(t);let c=null,d=null;return e?(c=l.getCell({col:r,row:0}),d=l.getCell({col:i,row:l.rowCount-1}),Qe(n,{anchor:xe(t,c.containerId,{colIndex:r,rowIndex:0}),focus:xe(t,d.containerId,{colIndex:i,rowIndex:l.rowCount-1})})):(c=l.getCell({col:0,row:o}),d=l.getCell({col:l.colCount-1,row:s}),Qe(n,{anchor:xe(t,c.containerId,{colIndex:0,rowIndex:o}),focus:xe(t,d.containerId,{colIndex:l.colCount-1,rowIndex:s})}))}const Uy=["style-bg-color-0","style-bg-color-1","style-bg-color-2","style-bg-color-3","style-bg-color-4","style-bg-color-5","style-bg-color-6","style-bg-color-7","style-bg-color-8","style-bg-color-9","style-bg-color-10","style-bg-color-11","style-bg-color-12","style-bg-color-13"];function Oy(n){return`style-bg-color-${n}`}function Yu(n){return`${n}_background`}function kN(n,t,e){const r=ze(n),s=(e!=null?e:Mt.fromTable(r)).getCell(t).cell;for(let l=0;l<Uy.length;l++){const c=Uy[l];if(wt(s,c))return c}}function Ny(n,t,e){if(!n.isBlockWritable(t))return;const r=n.selection.range,o={...mt.default(n.getBlockData(t))},s=as(n,t,r.start),l=as(n,t,r.end);if(r.isSimple()){const c=s.childContainerId;e===-1?o[Yu(c)]=void 0:o[Yu(c)]=Oy(e)}else{const c=Mt.fromBlock(t),d=Yr(t,s,l),h=new Set;for(let C=d.fromRow;C<=d.toRow;C++)for(let E=d.fromCol;E<=d.toCol;E++){const x=c.getCell({row:C,col:E});!h.has(x.containerId)&&x.col>=d.fromCol&&x.row>=d.fromRow&&x.col+x.colSpan-1<=d.toCol&&x.row+x.rowSpan-1<=d.toRow&&(h.add(x.containerId),e===-1?o[Yu(x.containerId)]=void 0:o[Yu(x.containerId)]=Oy(e))}}n.updateBlockData(t,o)}function RN(n,t,e){if(!n.isBlockWritable(t))return;const i={...mt.default(n.getBlockData(t)),chart:e};n.updateBlockData(t,i)}const Py=I("table-chart");function wN(n,t){const e=rN(n,t);if(e){const r=e.querySelector(".editor-table-chart");if(r){const i=r.chartObject;i&&i.destroy(),r.remove()}}}async function SN(n,t){if(!n.contains(t)||!n.isBlockWritable(t))return;if(!!!n.getBlockData(t).chart){wN(n,t);return}const i=[],o=Mt.fromBlock(t),s=["line","bar","pie","radar"];let l=o.getCell({row:0,col:0}).container.innerText.trim().toLowerCase();new Set(s).has(l)||(l=s[0]);const c=[];for(let k=1;k<o.colCount;k++)c.push(o.getCell({row:0,col:k}).container.innerText);for(let k=1;k<o.rowCount;k++){const w=o.getCell({row:k,col:0}),M=w.container.innerText,F=[];for(let Gt=1;Gt<o.colCount;Gt++){const Pe=o.getCell({row:k,col:Gt}).container.innerText,he=Number.parseFloat(Pe)||0;F.push(he)}let Y;const X=kN(t,w,o);X?Y=window.getComputedStyle(n.rootElement).getPropertyValue(`--${X}`).trim():Y=window.getComputedStyle(n.rootElement).getPropertyValue("--background-color").trim();let[G,st,pt,Ct]=Y?Bg.fromString(Y).toRgbaArray():[];if(!G&&!st&&!pt&&!Ct){const Gt=(k-1)%n.options.colors.length;Y=n.options.colors[Gt],[G,st,pt,Ct]=Bg.fromString(Y).toRgbaArray()}const yt=Y,bt=Bg.fromRgba([G,st,pt,Ct/3]).toHexString();i.push({label:M,data:F,borderColor:yt,backgroundColor:bt,borderWidth:2})}const d=Ri(n,t);let h=null,C=d.querySelector(".editor-table-chart");C?h=C.chartObject:C=v("div",["editor-table-chart"],d);const E=C;p(Py,E,"no chart container");const x=n.getComponentOptions("table"),B=(x==null?void 0:x.chartCdn)||"https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js";try{await zs(B,"editor-chartjs");let k=!1;(h&&h.config.data.datasets.length>i.length||h&&h.config.data.datasets[0].data.length>i[0].data.length)&&(k=!0),h&&(l!==h.config.type||k)&&(h.destroy(),h=null,Array.from(C.querySelectorAll(".editor-chartjs-canvas")).forEach(M=>{M.remove()}));const w=yg.default({},{type:l,data:{datasets:i,labels:c},options:{onClick:()=>{n.selection.selectBlock(t,0,0)}}});if(h)yg.default(h.config,w),h.update();else{const M=v("canvas",["editor-chartjs-canvas"],E).getContext("2d");h=new window.Chart(M,w),C.chartObject=h}}catch(k){Py.error(`failed to resolve chart cdn: ${JSON.stringify(k)}`)}}async function Fy(n,t){await Mr.lock("updateTableChart");try{await SN(n,t)}finally{Mr.release("updateTableChart")}}const Ky=ke.default(Fy,1e3);let Vy=null;function bC(n,t,e){if(Vy!==t&&(Ky.flush(),Vy=t),e.updateNow){Fy(n,t);return}Ky(n,t)}function vC(n,t,e){e&&Ge(e)&&bC(n,e,{updateNow:!1})}function LN(n,t){Ge(t)&&bC(n,t,{updateNow:!0})}const vr={SCROLL:"container-scroll-tool",COMMON:"container-border-shadow",RIGHT:"container-right-border-shadow",LEFT:"container-left-border-shadow",LAYOUT_SIGN:"container-layout-border-shadow",ACTIVE:"active"},g0={SCROLL_BAR:"container-scrollbar",FIXED:"fixed"},fs={SCROLL_CONTAINER:"scroll-container",TOOL:"container-scroll-tool",CONTAINER:"scroll-container-root",MAC:"mac",SCROLL_AREA:"scroll-area"};function Qu(n,t){return n.containers.get(t)}function $y(n){return n.closest(`.${fs.SCROLL_CONTAINER}`)}function Qr(n){return n.firstElementChild}function Rn(n){return n.closest(`.${fs.CONTAINER}`)}function Ju(n){const t=Rn(n);let e=t.querySelector(`:scope >.${fs.TOOL}`);return e||(e=v("div",[fs.TOOL],t)),e}function IN(n){return Rn(n).firstElementChild}function DN(n,t){const e=Qu(n,Rn(t));return e!=null&&e.barFloatWindowBottom?typeof e.barFloatWindowBottom=="function"?e.barFloatWindowBottom():e.barFloatWindowBottom:0}function Br(n,t){const e=dr(n);return t/e}function Zu(n){const t=window.getComputedStyle(n),e=dr(n);return{paddingBottom:parseFloat(t.paddingBottom)*e,paddingTop:parseFloat(t.paddingTop)*e,paddingLeft:parseFloat(t.paddingLeft)*e,paddingRight:parseFloat(t.paddingRight)*e}}function Ga(n){const t=dr(n);return{scrollLeft:n.scrollLeft*t,scrollWidth:n.scrollWidth*t,clientWidth:n.clientWidth*t,clientHeight:n.clientHeight*t}}function _N(n,t){const e=dr(n);return n[t]*e}function BC(n,t){const e=Rn(t),r=Qu(n,e),i=(r==null?void 0:r.safeRightSpace)||0,o=(r==null?void 0:r.safeLeftSpace)||0,l=(r==null?void 0:r.locatingContainer).getBoundingClientRect(),c=e.getBoundingClientRect(),d=c.width;let h=Math.floor(c.left-l.left-o);h<0&&(h=0);let C=l.right;C-=i;let E=C-c.right;return E<0&&(E=0),h=Math.round(h),E=Math.round(E),{originWidth:d,maxLeft:h,maxRight:E}}function MN(n,t){const e=BC(n,t),{maxLeft:r}=e;t.style.marginLeft=`${Br(t,0-r)}px`,t.style.paddingLeft=`${Br(t,r)}px`}function UN(n,t){const e=BC(n,t);t.style.marginRight=`${Br(t,0-e.maxRight)}px`}function ON(n){if(n!==document.documentElement&&n!==document.body)return n.getBoundingClientRect();const t=0,e=0,r=document.documentElement.clientWidth,i=document.documentElement.clientHeight;return new DOMRect(t,e,r,i)}const Hy=I("scroll-bar-handle"),NN=2;function Wa(n){const t=Ju(n);let e=t.querySelector(`.${g0.SCROLL_BAR}`);return e||(e=v("div",[g0.SCROLL_BAR],t)),p(Hy,e instanceof HTMLDivElement,"invalid child for container tools"),e.firstElementChild||v("div",[],e),e}function p0(n,t){const e=$y(t),r=Wa(e),{scrollWidth:i,clientWidth:o}=Ga(e),{paddingLeft:s,paddingRight:l}=Zu(t),c=BC(n,e),{originWidth:d,maxRight:h}=c;UN(n,e),MN(n,e);const C=i-o;p(Hy,r.firstElementChild instanceof HTMLDivElement,"invalid child for scroll bar"),r.style.width=`${Br(e,d+h-s-l)}px`,r.firstElementChild.style.width=`${Br(e,d+h+C-s-l)}px`}function PN(n,t){const e=Qr(n),{paddingLeft:r}=Zu(e);if(wt(t,"fixed")){const o=Rn(n).getBoundingClientRect();t.style.left=`${Br(n,o.left+r)}px`}else t.style.left=`${Br(n,r)}px`}function qa(n,t){var M;const e=n.getParentScrollContainer(),r=ON(e),i=t.getBoundingClientRect(),o=Wa(t),s=o.getBoundingClientRect(),l=Qu(n,Rn(t)),c=DN(n,t),d=Qr(t),{paddingTop:h,paddingBottom:C}=Zu(d),{scrollWidth:E,clientWidth:x}=Ga(t),B=document.documentElement.clientHeight-c,k=r.top+Ga(e).clientHeight-B,w=B+Math.min(0,k);if(E>x&&i.top+h<w-s.height&&i.bottom>w-s.height+C&&!((M=l==null?void 0:l.isSetScale)!=null&&M.call(l))){l!=null&&l.allowScrollBarFixed&&z(o,g0.FIXED);const F=k>0?c:0;o.style.bottom=`${Math.max(document.documentElement.clientHeight-r.bottom,0)+NN+F}px`}else ot(o,g0.FIXED),o.style.bottom=`${Br(t,C-s.height)}px`;PN(t,o)}class FN{constructor(t,e){m(this,"intersectionObserver");m(this,"handleIntersection",t=>{t.forEach(e=>{this.containers.get(Rn(e.target))?(this.handleIntersectionEntry(e),this.callback(e)):this.intersectionObserver.unobserve(e.target)})});m(this,"handleIntersectionEntry",t=>{const e=t.target;qa(this.scrollCore,e);const r=Qr(e);p0(this.scrollCore,r)});this.scrollCore=t,this.callback=e;const i={root:this.scrollCore.getParentScrollContainer(),rootMargin:"20px",threshold:0};this.intersectionObserver=new IntersectionObserver(this.handleIntersection,i)}get containers(){return this.scrollCore.containers}bind(t){this.unbind(t),this.intersectionObserver.observe(t)}unbind(t){this.intersectionObserver.unobserve(t)}destroy(){this.intersectionObserver.disconnect()}}const ml=I("container-scroll-shadow");function jy(n,t,e){const r=n,i=t.getBoundingClientRect(),o=e.getBoundingClientRect(),{paddingTop:s,paddingBottom:l}=Zu(e);r.style.top=`${Br(t,o.top-i.top+s)}px`,r.style.bottom=`${Br(t,i.bottom-o.bottom+l)}px`}function zy(n,t){const e=n;t<24?e.style.width=`${(t/3).toFixed(2)}px`:e.style.width=""}function KN(n){const t=Ju(n);p(ml,t,"no container tools");let e=t.querySelector(`.${vr.LEFT}`);if(!e){const l=Qr(n),c=[vr.COMMON,vr.LEFT];e=v("div",c,t),p(ml,e instanceof HTMLDivElement,"invalid child for container tools"),jy(e,n,l)}p(ml,e instanceof HTMLElement,"invalid child for container tools");const i=Rn(n).getBoundingClientRect(),o=n.getBoundingClientRect();e.style.left=`${Br(n,o.left-i.left)}px`;const s=Ga(n).scrollLeft;p(ml,e instanceof HTMLDivElement,"invalid child for container tools"),zy(e,s),z(e,vr.ACTIVE)}function VN(n){const t=Ju(n);let e=t.querySelector(`.${vr.RIGHT}`);if(!e){const h=Qr(n),C=[vr.COMMON,vr.RIGHT];e=v("div",C,t),p(ml,e instanceof HTMLDivElement,"no div, create shadow failed"),jy(e,n,h)}p(ml,e instanceof HTMLElement,"");const i=Rn(n).getBoundingClientRect(),o=n.getBoundingClientRect();e.style.right=`${Br(n,i.right-o.right)}px`;const{scrollWidth:s,scrollLeft:l,clientWidth:c}=Ga(n),d=s-l-c;p(ml,e instanceof HTMLDivElement,"no shadow element"),zy(e,d),z(e,vr.ACTIVE)}function $N(n){const e=Ju(n).querySelector(`.${vr.LEFT}`);e&&ot(e,vr.ACTIVE)}function HN(n){const e=Ju(n).querySelector(`.${vr.RIGHT}`);e&&ot(e,vr.ACTIVE)}function tf(n){const{scrollLeft:t,scrollWidth:e,clientWidth:r}=Ga(n),i=Qr(n),{paddingLeft:o,paddingRight:s}=Zu(i),l=_N(i,"offsetLeft");e-o<=r-s||e-o<=t+r-s?HN(n):VN(n),i&&t>=l+o?KN(n):$N(n)}class jN{constructor(t,e){m(this,"resizeObserver");m(this,"handleResizeEntry",t=>{const e=t.target,r=Qr(e);tf(e),p0(this.scrollCore,r),qa(this.scrollCore,e),this.callback(e)});m(this,"handleContentResize",t=>{t.forEach(e=>{this.containers.get(Rn(e.target))?this.handleResizeEntry(e):this.unbind(e.target)})});this.scrollCore=t,this.callback=e,this.resizeObserver=new Vs(this.handleContentResize)}get containers(){return this.scrollCore.containers}bind(t){this.unbind(t),this.resizeObserver.observe(t)}unbind(t){this.resizeObserver.unobserve(t)}destroy(){this.resizeObserver.disconnect()}}const Gy=I("container-scroll-observer");class zN{constructor(t,e){m(this,"handleContentScroll",t=>{const e=t.target;p(Gy,e instanceof Element,"invalid target for scroll event");const r=Wa(e);r.removeEventListener("scroll",this.handleScroll);const i=!0;this.fixScrollXPos(e,e.scrollLeft,i),this.bind(r),tf(e),this.callback(e)});m(this,"handleScroll",t=>{const e=t.target;p(Gy,e instanceof HTMLElement,"");const r=e.scrollLeft,i=!1,o=IN(e);this.unbindContentScroll(o),this.fixScrollXPos(o,r,i),this.bindContentScroll(o),tf(o),this.callback(o)});m(this,"handlePrevent",t=>{t.stopPropagation()});m(this,"bindContentScrollCore",t=>{this.unbindContentScroll(t),t.addEventListener("scroll",this.handleContentScroll)});m(this,"unbindContentScroll",t=>{t.removeEventListener("scroll",this.handleContentScroll)});m(this,"bindContentScroll",ke.default(this.bindContentScrollCore,300));m(this,"bind",ke.default(this.bindCore,200));this.scrollCore=t,this.callback=e}fixScrollXPos(t,e,r){const i=Wa(t);r||(t.scrollLeft=e),r&&i.scrollLeft!==e&&(i.scrollLeft=e)}bindCore(t){this.unbind(t),t.addEventListener("scroll",this.handleScroll),t.addEventListener("mousedown",this.handlePrevent)}unbind(t){t.removeEventListener("scroll",this.handleScroll),t.removeEventListener("mousedown",this.handlePrevent)}}class GN{constructor(t){m(this,"scrollContainers",new Set);m(this,"handleParentContainerScroll",()=>{this.scrollContainers.forEach(t=>{qa(this.scrollCore,t)})});m(this,"bindScrollContainer",t=>{const e=this.scrollContainers.size===0;this.scrollContainers.add(t),e&&this.eventTarget.addEventListener("scroll",this.handleParentContainerScroll)});m(this,"unbindScrollContainer",t=>{let e=!1;this.scrollContainers.has(t)&&(this.scrollContainers.delete(t),e=this.scrollContainers.size===0),e&&this.eventTarget.removeEventListener("scroll",this.handleParentContainerScroll)});this.scrollCore=t}get eventTarget(){const t=this.scrollCore.getParentScrollContainer();return t===document.documentElement?document:t}destroy(){this.eventTarget.removeEventListener("scroll",this.handleParentContainerScroll),this.scrollContainers.clear()}}const WN=I("scroll-wrap-resize-observer");class qN{constructor(t){m(this,"resizeObserver");m(this,"handleScrollWrapResize",t=>{t.forEach(e=>{this.containers.get(Rn(e.target))?this.handleScrollWrapResizeEntry(e):this.unbind(e.target)})});m(this,"handleScrollWrapResizeEntry",t=>{const e=t.target;p(WN,e instanceof HTMLElement,"invalid target for observer entry");const r=$y(e);p0(this.scrollCore,e),tf(r),qa(this.scrollCore,r)});this.scrollCore=t,this.resizeObserver=new Vs(this.handleScrollWrapResize)}get containers(){return this.scrollCore.containers}bind(t){this.unbind(t),this.resizeObserver.observe(t)}unbind(t){this.resizeObserver.unobserve(t)}destroy(){this.resizeObserver.disconnect()}}class XN{constructor(t,e){m(this,"resizeObserver");m(this,"scrollContainersMap",new Map);m(this,"handleResizeEntry",t=>{t==null||t.forEach(e=>{const r=Qr(e);tf(e),p0(this.scrollCore,r),qa(this.scrollCore,e),this.callback(e)})});m(this,"handleResize",t=>{t.forEach(e=>{const r=this.scrollContainersMap.get(e.target);r!=null&&r.length&&this.handleResizeEntry(r)})});this.scrollCore=t,this.callback=e,this.resizeObserver=new Vs(this.handleResize)}bind(t){var i,o;const e=Rn(t),r=(i=Qu(this.scrollCore,e))==null?void 0:i.locatingContainer;this.scrollContainersMap.has(r)?(o=this.scrollContainersMap.get(r))==null||o.push(t):(this.scrollContainersMap.set(r,[t]),this.resizeObserver.observe(r))}unbind(t){var o,s;const e=Rn(t),r=(o=Qu(this.scrollCore,e))==null?void 0:o.locatingContainer;if(!r)return;const i=this.scrollContainersMap.get(r);this.scrollContainersMap.set(r,(i==null?void 0:i.filter(l=>l!==t))||[]),(s=this.scrollContainersMap.get(r))!=null&&s.length||(this.resizeObserver.unobserve(r),this.scrollContainersMap.delete(r))}destroy(){this.scrollContainersMap.clear(),this.resizeObserver.disconnect()}}const Hlt="";class YN extends ye.TypedEmitter{constructor(e){super();m(this,"containerIntersectionObserver",null);m(this,"containerResizeObserver",null);m(this,"containerScrollObserver",null);m(this,"parentContainerScrollObserver",null);m(this,"scrollWrapResizeObserve",null);m(this,"locatingContainerResizeObserver",null);m(this,"isWindowEventBind",!1);m(this,"containers",new Map);m(this,"handleScrollContainerScroll",e=>{this.emit("scroll",this,e)});m(this,"handleResize",e=>{this.emit("resize",this,e)});m(this,"handleIntersection",e=>{const r=e.target,i=Qr(r);e.isIntersecting?(this.load(),this.bindCore(r,i)):this.unbindCore(r,i)});m(this,"handleWindowEffect",()=>{var e;(e=this.getScrollContainerInViewable())==null||e.forEach(r=>{qa(this,r)})});this.parentContainer=e}load(){this.containerResizeObserver||(this.containerResizeObserver=new jN(this,this.handleResize)),this.containerScrollObserver||(this.containerScrollObserver=new zN(this,this.handleScrollContainerScroll)),this.parentContainerScrollObserver||(this.parentContainerScrollObserver=new GN(this)),this.scrollWrapResizeObserve||(this.scrollWrapResizeObserve=new qN(this)),this.locatingContainerResizeObserver||(this.locatingContainerResizeObserver=new XN(this,this.handleResize)),this.isWindowEventBind||(window.addEventListener("resize",this.handleWindowEffect),this.getParentScrollContainer()!==document.documentElement&&window.addEventListener("scroll",this.handleWindowEffect))}getParentScrollContainer(){return this.parentContainer}getScrollContainerInViewable(){var e;return(e=this.parentContainerScrollObserver)==null?void 0:e.scrollContainers}unbindCore(e,r){var o,s,l,c,d,h;const i=Wa(e);(o=this.containerScrollObserver)==null||o.unbindContentScroll(e),(s=this.containerScrollObserver)==null||s.unbind(i),(l=this.scrollWrapResizeObserve)==null||l.unbind(r),(c=this.containerResizeObserver)==null||c.unbind(e),(d=this.parentContainerScrollObserver)==null||d.unbindScrollContainer(e),(h=this.locatingContainerResizeObserver)==null||h.unbind(e)}bindCore(e,r){var s,l,c,d,h,C;if(this.unbindCore(e,r),!e.closest("body"))return;const i=Wa(e);(s=this.containerScrollObserver)==null||s.bindContentScrollCore(e),(l=this.containerScrollObserver)==null||l.bindCore(i),(c=this.scrollWrapResizeObserve)==null||c.bind(r),(d=this.containerResizeObserver)==null||d.bind(e);const o=this.containers.get(Rn(e));o!=null&&o.allowScrollBarFixed&&((h=this.parentContainerScrollObserver)==null||h.bindScrollContainer(e)),(C=this.locatingContainerResizeObserver)==null||C.bind(e)}bind(e,r){this.containers.set(e,r);const i=e.firstElementChild;this.containerIntersectionObserver||(this.containerIntersectionObserver=new FN(this,this.handleIntersection)),this.containerIntersectionObserver.bind(i)}unbind(e){var o;const r=e.firstElementChild,i=Qr(r);this.unbindCore(r,i),this.containers.delete(e),(o=this.containerIntersectionObserver)==null||o.unbind(r),this.containers.size||this.destroy()}destroy(){var e,r,i,o,s;this.containers.forEach((l,c)=>{this.unbind(c)}),this.containers.clear(),(e=this.parentContainerScrollObserver)==null||e.destroy(),(r=this.containerIntersectionObserver)==null||r.destroy(),(i=this.containerResizeObserver)==null||i.destroy(),(o=this.scrollWrapResizeObserve)==null||o.destroy(),(s=this.locatingContainerResizeObserver)==null||s.destroy(),window.removeEventListener("resize",this.handleWindowEffect),window.removeEventListener("scroll",this.handleWindowEffect)}}const Wy=I("scroll-container"),C0=new Map;class QN extends ye.TypedEmitter{constructor(){super(...arguments);m(this,"scrollListener");m(this,"options");m(this,"scrollContainerElement");m(this,"init",e=>{this.options=e;const r=v("div",[fs.CONTAINER],e.parentElement);ie.isMac&&z(r,fs.MAC);const i=v("div",[fs.SCROLL_CONTAINER],r),o=v("div",[fs.SCROLL_AREA],i);o.style.paddingLeft=e.paddingLeft?`${e.paddingLeft}px`:"",o.style.paddingTop=e.paddingTop?`${e.paddingTop}px`:"",o.style.paddingBottom=e.paddingBottom?`${e.paddingBottom}px`:"",o.style.paddingRight=e.paddingRight?`${e.paddingRight}px`:"",o.appendChild(e.childElement);const s=e.parentContainer;this.scrollListener=C0.get(s),this.scrollListener||(this.scrollListener=new YN(s),C0.set(s,this.scrollListener)),this.scrollListener.unbind(r),this.scrollListener.bind(r,e),this.scrollListener.on("scroll",this.handleContainerScroll),this.scrollListener.on("resize",this.handleResize),this.scrollContainerElement=i});m(this,"handleContainerScroll",(e,r)=>{r===this.scrollContainerElement&&this.emit("scroll",this)});m(this,"handleResize",(e,r)=>{r===this.scrollContainerElement&&this.emit("scroll",this)})}get rootElement(){return this.scrollContainerElement}get contentElement(){return p(Wy,this.scrollContainerElement,"scrollContainerElement cannot be undefined"),Qr(this.scrollContainerElement)}get scrollOptions(){return p(Wy,this.options,"options cannot be undefined"),{...this.options}}handleBaseListenerDestroy(e){e.destroy()}destroy(){var r;(r=this.scrollListener)==null||r.off("scroll",this.handleContainerScroll);const e=Rn(this.contentElement);e&&C0.forEach((i,o)=>{i.unbind(e),i.containers.size===0&&(this.handleBaseListenerDestroy(i),C0.delete(o))})}}function JN(){return new QN}const TC=I("column-width");function ZN(n,t,e){const r=oN(n,t);r.style.width=`${e}px`,r.style.minWidth=`${e}px`}function tP(n){const e=Array.from(n.querySelector("colgroup").children).map(c=>c.getBoundingClientRect().width);if(e[0]!==0)return e;const r=Mt.fromTable(n),i=Array(r.colCount).fill(-1),o=n.getBoundingClientRect().left;r.toRealCells(r.cells).forEach(c=>{const d=c.col+c.colSpan-1;i[d]===-1&&(i[d]=c.cell.getBoundingClientRect().right-o)}),TC.debug(`cellRightOffsets1: ${i.join()}`);for(let c=0;c<i.length;c++){const d=i[c];if(d===-1||c===0)continue;let h=c-1;for(;i[h]===-1&&(h--,h!==-1););const C=h===-1?0:i[h],x=(d-C)/(c-h);for(let B=h+1;B<c;B++)i[B]=C+x*(B-h)}TC.debug(`cellRightOffsets2: ${i.join()}`);const s=[];let l=0;for(let c=0;c<i.length;c++){const d=i[c];s.push(d-l),l=d}return TC.debug(`widths: ${s.join()}`),s}function ef(n){return Array.from(n.querySelector("colgroup").children).map(r=>r.getBoundingClientRect().width||Number.parseInt(r.style.width,10))}const yC=200,eP=40,nP=I("table-resize-gripper"),qy=7,kC=(qy-1)/2,rP=3;function iP(n,t,e){const{rows:r}=n;for(let i=0;i<r.length;i++){const o=r[i],s=Array.from(o.cells);for(let l=0;l<s.length;l++){const c=s[l],d=c.getBoundingClientRect(),h=Math.round(d.right);if(Math.abs(t-h)<=kC&&d.top<=e&&e<=d.bottom)return c}}return null}function oP(n){return!!n.rootContainer.querySelector(".table-resize-gripper")}function RC(n,t){return Ri(n,t).querySelector(".table-resize-gripper")}function Xy(n,t){const e=RC(n,t);p(nP,!e,"resize gripper has already exists");const r=Ri(n,t),i=v("div",["table-resize-gripper","table-indicator"],r);return v("div",["table-resize-gripper-indicator"],i),i}function Yy(n,t,e){let r=RC(n,t);r||(r=Xy(n,t));const o=ze(t).getBoundingClientRect(),s=e.getBoundingClientRect(),l=0,c=o.height,d=n.getCustom(ki(t)).contentElement.getBoundingClientRect(),h=s.right-d.left;r.style.left=`${h-kC-za-Xu}px`,r.style.top=`${l}px`,r.style.height=`${c}px`,r.style.width=`${qy}px`}function wC(n){n.rootContainer.querySelectorAll(".table-resize-gripper").forEach(t=>{t.remove()})}function sP(n,t,e){const i={...n.getBlockData(t),colsWidth:e};n.updateBlockData(t,i)}function lP(n,t,e,r){const i=t,o=Mt.fromTable(e),s=o.getCellByCellElement(i),l=s.col+s.colSpan-1,c=ef(e);let d=r;const h=(E,x)=>{const B=x+1,k=E.col+E.colSpan;return c.slice(B,k).reduce((U,M)=>U+M,0)},C=new Set;for(let E=0;E<o.rowCount;E++){const x=o.getCell({row:E,col:l});if(C.has(x.cell))continue;C.add(x.cell);const B=x.cell,k=B.getBoundingClientRect();let w=r-k.left+kC-rP;const U=Gu(B),M=u1(n,U)||eP*x.colSpan,F=h(x,l),Y=M-F;w<Y&&(w=Y);const X=k.left+w;d=Math.max(d,X)}return d}const aP=I("table-resize-drag-drop");class cP{constructor(t,e,r,i){m(this,"cursor","col-resize");this.editor=t,this.elem=e,this.data=r,this.onEnd=i}onDragStart(t,e,r){}onDragging(t,e,r,i,o){const{table:s,block:l,draggingRefCell:c}=t.data,h=lP(this.editor,c,s,e.x-t.dragOffsetX)-s.getBoundingClientRect().left;p(aP,c,"no dragging cell");const E=Mt.fromTable(s).getCellByCellElement(c),x=E.col+E.colSpan-1,B=ef(s),k=B.slice(0,x).reduce((U,M)=>U+M,0),w=h-k;if(ZN(s,x,w),w){const U=parseFloat(s.style.minWidth);s.style.minWidth=`${U+(w-B[x])}px`}Yy(this.editor,l,c),this.editor.selection.caret.update()}onDragEnd(t,e,r,i,o){const s=ef(t.data.table);sP(this.editor,t.data.block,s),wC(this.editor),this.onEnd&&(this.onEnd(e),this.onEnd=null)}}function uP(n,t){const e=Ae(t.x,t.y);if(!e)return null;const r=Z(e);return!r||!n.contains(r)||!Ge(r)?null:r}I("table-resize");class fP{constructor(t){m(this,"draggingRefCell",null);m(this,"handleMouseMove",(t,e)=>{if(t.readonly||window.isDragging||t.selectionHandler.isSelecting()&&!this.draggingRefCell||this.draggingRefCell)return;const r=e.target;if(!(r instanceof Element)||r.closest(".table-indicator"))return;const o=e,s=uP(t,o);if(!s||!yy(s)||!t.isBlockWritable(s)){wC(t);return}this.updateGripper(s,o.x,o.y)});this.editor=t,t.domEvents.addEventListener(document,"mousemove",this.handleMouseMove)}destroy(){this.editor.domEvents.removeEventListener(document,"mousemove",this.handleMouseMove)}updateGripper(t,e,r){const i=ze(t),o=iP(i,e,r);if(o){if(!RC(this.editor,t)){if(oP(this.editor))return;const l=Xy(this.editor,t),c={block:t,table:i,draggingRefCell:o};Og(new cP(this.editor,l,c,d=>{this.updateGripper(t,d.x,d.y)}))}Yy(this.editor,t,o)}else wC(this.editor)}}function Qy(n){n.addCustom("table-mouse-event-handler",t=>new fP(t))}const Jy=I("table-insert-column");function Zy(n,t,e){n.undoManager.runInGroup(()=>{var E;const r=ze(t),i=Mt.fromTable(r),o=i.colCount;p(Jy,e>=0&&e<=o,`insert index ${e} is out of range [0, ${o}]`);const s=i.map(x=>x.containerId),l=new Set;n.doc.beginBatchUpdate();for(let x=0;x<s.length;x++){const B=s[x],k=B[e-1],w=B[e];if(e===0||e===B.length||k!==w){const U=oo(n.doc);B.splice(e,0,U)}else B.splice(e,0,k),l.add(k)}n.doc.endBatchUpdate();const c=mt.default(n.getBlockData(t));l.forEach(x=>{const B=`${x}_colSpan`,k=c[B];p(Jy,typeof k=="number"&&k>1,`no colSpan for containerId ${x}, ${k}`),c[B]=k+1});const d=((E=c.colsWidth)==null?void 0:E.concat())||new Array(c.cols).fill(0);d.splice(e,0,yC);const h=Mt.virtualCellContainersGridToChildren(s),C={...c,cols:c.cols+1,children:h,colsWidth:d};dl(C),n.updateBlockData(t,C)})}const E0=I("table-insert-row");function SC(n,t,e){n.undoManager.runInGroup(()=>{const r=ze(t),i=Mt.fromTable(r),o=i.rowCount;p(E0,e>=0&&e<=o,`insert index ${e} is out of range [0, ${o}]`);const s=i.map(E=>E.containerId),l=new Set;n.doc.beginBatchUpdate();const c=[];for(let E=0;E<i.colCount;E++){const x=e>0&&s[e-1][E],B=e<i.rowCount&&s[e][E];if(p(E0,x||B,"no top and bottom cell"),e===0||e===i.rowCount||x!==B){const k=oo(n.doc);c.push(k)}else p(E0,x,"no top cell"),c.push(x),l.add(x)}n.doc.endBatchUpdate(),s.splice(e,0,c);const d=mt.default(n.getBlockData(t));l.forEach(E=>{const x=`${E}_rowSpan`,B=d[x];p(E0,typeof B=="number"&&B>1,`no rowSpan for containerId ${E}, ${B}`),d[x]=B+1});const h=Mt.virtualCellContainersGridToChildren(s),C={...d,rows:d.rows+1,children:h};dl(C),n.updateBlockData(t,C)})}const LC=I("paste-table-in-table-block");function dP(n,t,e,r,i){let o=Mt.fromBlock(e);const s=t.blocks.root[0];p(LC,s,"no table data"),p(LC,s.type==="table",`table data type is not table, but ${s.type}`);const l=s,c=o.getCellByCellElement(r),d=l.cols,h=l.rows,C=c.col,E=c.row,x=C+d,B=E+h,k=[];for(let w=C;w<x&&w<o.colCount;w++)for(let U=E;U<B&&U<o.rowCount;U++){const M=o.getCell({col:w,row:U});M.virtual?M.virtual&&k.push({col:w,row:U}):(M.colSpan>1||M.rowSpan>1)&&k.push({col:w,row:U})}n.undoManager.runInGroup(()=>{if(n.doc.beginBatchUpdate(),k.forEach(F=>{const Y=Mt.fromBlock(e).getCell(F);(Y.colSpan>1||Y.rowSpan>1)&&pC(n,e,F)}),x>o.colCount)for(let F=o.colCount;F<x;F++)Zy(n,e,F);if(B>o.rowCount)for(let F=o.rowCount;F<B;F++)SC(n,e,F);o=Mt.fromBlock(e);const w=new u0(l);let U;for(let F=0;F<w.colCount;F++)for(let Y=0;Y<w.rowCount;Y++){const X=w.getCell({col:F,row:Y});if(!X.virtual){const G=ep(n.editorBlocks,t,X.containerId,i),st=C+F,pt=E+Y,Ct={col:st,row:pt},yt=o.getCellContainer(Ct);YB(n,yt,G,i),U=yt}}n.doc.endBatchUpdate(),p(LC,U,"no last container");const M=Ue(U);n.selection.selectBlock(M,dt(n,M))})}const IC=I("paste-in-table-block");class hP{constructor(t){m(this,"pasteData");this.editor=t,setTimeout(()=>{t.input.addHandler(this)})}destroy(){this.pasteData=void 0}async handleBeforePaste(t,e,r,i){return this.pasteData={doc:r,files:i,event:e},!1}async handleBeforePasteDoc(t,e){var E,x,B,k;if(!t.selection.range.isSimple())return this.pasteData=void 0,!1;if(t.selection.range.start.offset!==0)return this.pasteData=void 0,!1;const i=t.selection.startBlock,o=it(i);if(qt(o))return this.pasteData=void 0,!1;if(!fu(t,o))return this.pasteData=void 0,!1;const s=Z(o);if(p(IC,s,"no parent block"),!Ge(s))return this.pasteData=void 0,!1;if(e.blocks.root.length!==1)return this.pasteData=void 0,!1;if(e.blocks.root[0].type!=="table")return this.pasteData=void 0,!1;IC.debug("paste child table in table");const d=Mt.fromBlock(s).getCellByContainerId(ct(o)).cell;Ap(t,e);const h={blockIdMap:new Map,containerIdMap:new Map,boxIdMap:new Map};dP(t,e,s,d,h),p(IC,this.pasteData,"invalid paste data");const C=[];t.input.forEach(w=>{C.push(w)});for(let w=0;w<C.length&&!await((x=(E=C[w]).handleAfterPasteDoc)==null?void 0:x.call(E,t,e,h));w++);for(let w=0;w<C.length&&!await((k=(B=C[w]).handleAfterPaste)==null?void 0:k.call(B,t,this.pasteData.event,this.pasteData.doc));w++);return this.pasteData=void 0,!0}}function tk(n){n.addCustom("table-block-paste-event",t=>new hP(t))}const DC=I("table-select-columns");function mP(n,t,e,r,i){p(DC,Ge(t),"is not a table block");const o=Mt.fromBlock(t);p(DC,e>=0&&e<o.colCount,"invalid from"),p(DC,r>0&&e+r<=o.colCount,"invalid count");const s=o.getCell({row:0,col:e}),l=o.getCell({row:o.rowCount-1,col:e+r-1}),c=xe(t,s.containerId,{colIndex:e,rowIndex:0}),d=xe(t,l.containerId,{colIndex:e+r-1,rowIndex:o.rowCount-1});i!=null&&i.reverse?n.selection.setSelection(d,c):n.selection.setSelection(c,d)}const _C=I("table-select-columns");function gP(n,t,e,r,i){p(_C,Ge(t),"is not a table block");const o=Mt.fromBlock(t);p(_C,e>=0&&e<o.rowCount,"invalid from"),p(_C,r>0&&e+r<=o.rowCount,"invalid count");const s=o.getCell({row:e,col:0}),l=o.getCell({row:e+r-1,col:o.colCount-1}),c=xe(t,s.containerId,{rowIndex:e,colIndex:0}),d=xe(t,l.containerId,{rowIndex:e+r-1,colIndex:o.colCount-1});i!=null&&i.reverse?n.selection.setSelection(d,c):n.selection.setSelection(c,d)}const jlt="",ek=I("get-toolbar-reference-client");function nk(n,t){const e=n.selection.range;if(!e.isSimple()){p(ek,e.start.blockId===e.end.blockId,"invalid selection range");const s=n.getBlockById(e.start.blockId);p(ek,It(n,s),"not a complex block");const l=Qt(n,s);if(l.getTextToolbarReferenceClient){const c=l.getTextToolbarReferenceClient(n,s);if(c)return c}}const r=e.isReverse()?t.start:t.end,i=Qe(n,{anchor:r,focus:r}),o=Yi(n,t.block,i);if(o.length!==0)return o[0]}function pP(n){var t,e;if(n.children){let r=!1;const i=[];for(const o of n.children){if((t=o.states)!=null&&t.includes("checked")){r=!0;break}(e=n.defaultCheckedChildren)!=null&&e.includes(o.id)&&i.push(o)}if(!r&&(i==null?void 0:i.length))for(const o of i)Array.isArray(o.states)?o.states.push("checked"):o.states=["checked"]}}function x0(n){const t=(i,o)=>{const s=i.findIndex(c=>c.id===o.id);if(s===-1){i.push(o);return}const l=i[s];if(l.value!==o.value&&delete l.value,!!l.states){if(!o.states){l.states=[];return}l.states=Rg.default(l.states,o.states)}},e=[],r=new Map;return n.forEach(i=>{var o,s;(o=i.children)!=null&&o.length&&(r.has(i.id)?(s=r.get(i.id))==null||s.push(...i.children):r.set(i.id,[...i.children])),t(e,i)}),r.forEach((i,o)=>{const s=e.find(l=>l.id===o);s&&(s.children=x0(i),pP(s))}),e}function A0(n){return n.findCustom("toolbar-handler")}const zlt="";class CP{constructor(){m(this,"linkPopup",null);m(this,"form",{});m(this,"onFinished",null);m(this,"onClose",null);m(this,"handleOk",async()=>{var t;try{await this.checkValue();const{linkText:e,linkUrl:r}=this.form,i=this.formatUrl(r.getInputValue());(t=this.onFinished)==null||t.call(this,e.getInputValue()||i,i),this._destroy()}catch{}});m(this,"handleClose",()=>{var t;(t=this.onClose)==null||t.call(this),this._destroy()});m(this,"onShow",()=>{setTimeout(()=>{var t;(t=this.form.linkText)==null||t.getField().focus()},400)});m(this,"onChange",()=>{var e;const t=(e=this.linkPopup)==null?void 0:e.content.querySelector('[data-button-id="submit-button"]');t.disabled=!1});m(this,"handleTextKeyboard",(t,e)=>{var r;if(!e){if(t.key==="Enter"){(r=this.form.linkUrl)==null||r.getField().focus(),t.stopPropagation();return}t.key==="Escape"&&this.handleClose()}});m(this,"handleUrlKeyboard",(t,e)=>{if(!e){if(t.key==="Enter"){this.handleOk(),t.preventDefault();return}t.key==="Escape"&&this.handleClose()}})}async checkValue(){const{linkUrl:t}=this.form;if(!t.getInputValue())throw t.setFieldError(D.t("link.urlPlaceholder")),new Error(D.t("link.urlPlaceholder"))}formatUrl(t){if(!t)return"";try{new URL(t)}catch{return`${window.location.protocol}//${t}`}return t}editLink(t){var h,C;const{target:e,linkText:r,linkUrl:i,onFinished:o,onClose:s,placement:l="bottom-start"}=t;this.linkPopup=new Va(this.createPopupContent(r,i)),this.linkPopup.addListener("show",this.onShow),this.linkPopup.manualShow(e,{theme:"light",placement:l}),this.onFinished=o,s&&(this.onClose=s);const c=(h=this.linkPopup)==null?void 0:h.content.querySelector('[data-button-id="submit-button"]'),d=(C=this.linkPopup)==null?void 0:C.content.querySelector('[data-button-id="cancel-button"]');c==null||c.addEventListener("click",this.handleOk),d==null||d.addEventListener("click",this.handleClose)}createPopupContent(t,e){const r=v("div",["link-popup-content"],null);this.form.linkText=c0(r,{label:D.t("link.textLabel"),required:!1,placeholder:D.t("link.textPlaceholder"),defaultValue:t,onChange:this.onChange,onKeyDown:this.handleTextKeyboard}),this.form.linkUrl=c0(r,{className:"link-popup-gap",label:D.t("link.urlLabel"),required:!0,placeholder:D.t("link.urlPlaceholder"),defaultValue:e,onChange:this.onChange,onKeyDown:this.handleUrlKeyboard});const i=v("div",["link-popup-footer"],r),o=br("cancel-button",D.t("link.cancelText"));i.appendChild(o);const s=br("submit-button",D.t("link.submitText"),void 0,["disabled","primary"]);return i.appendChild(s),r}_destroy(){var r,i,o,s;const t=(r=this.linkPopup)==null?void 0:r.content.querySelector('[data-button-id="submit-button"]'),e=(i=this.linkPopup)==null?void 0:i.content.querySelector('[data-button-id="cancel-button"]');t==null||t.removeEventListener("click",this.handleOk),e==null||e.removeEventListener("click",this.handleClose),this.onFinished=null,this.onClose=null,this.form={},(o=this.linkPopup)==null||o.removeAllListeners(),(s=this.linkPopup)==null||s.destroy()}destroy(){this._destroy()}}function nf(n,t){n.addCustom("link-editor",()=>new CP).editLink(t)}const EP=I("link-popup");function xP(n){return wt(n,"link")}function rf(n){var t,e;return(e=(t=n.getAttribute("link"))!=null?t:n.textContent)!=null?e:""}function AP(n,t,e){var i,o,s,l;if(n.isBlockWritable(t)&&e&&Qn(e)){const c=e,d=(o=(i=n.editorBoxes.getBoxClass(su(c))).getBoxProperties)==null?void 0:o.call(i,n,c);if(d!=null&&d.boxCommands){const h=(l=(s=d.boxCommands["hovering-toolbar"])==null?void 0:s.commands)!=null?l:[];return{element:e,commands:h}}return{element:null,commands:[]}}if(n.isWritable()&&e&&rt(n,t)&&xP(e)){const c=v("a",["link-href-button"],null,rf(e));c.href=rf(e),c.target="_blank",c.rel="noopener noreferrer";const d=[{id:"link-text",name:rf(e),disableTooltip:!0,element:c},{id:"edit-link",name:D.t("link.edit"),icon:s0},{id:"remove-link",name:D.t("link.remove"),icon:kT}];return{element:e,commands:d}}return Hv(n,t,"hovering-toolbar")}function rk(n,t,e){var l;const r=Yo(t,e),i=n.getBlockText(t),o={start:0,end:0};let s=(l=e.textContent)!=null?l:"";for(let c=0;c<i.length;c++){const d=i[c];if(o.end+d.insert.length>=r.end){o.end+=d.insert.length,s=d.insert;break}o.start<r.start&&(o.start+=d.insert.length,o.end=o.start)}return[o,s]}function bP(n,t,e){const[r,i]=rk(n,t,e);n.selection.selectBlock(t,r.start,r.end);const o=rf(e),s=(h,C)=>{try{const E=n.getBlockText(t),x=U1(E,r.start,r.end-r.start),B=ro(x,r.start,h,{link:C});n.setBlockText(t,B),n.selection.selectBlock(t,r.start+h.length),n.focus()}catch(E){EP.error(E)}},l=()=>{n.selection.selectBlock(t,r.end),n.focus()},c=Yi(n,t,n.selection.range)[0];if(!c)return;const d=Zi(n,t,"link-button-anchor",c);nf(n,{target:d,linkText:i,linkUrl:o,onFinished:s,onClose:l})}function vP(n,t,e){const[r]=rk(n,t,e),i=n.getBlockText(t),o=rf(e),s=va(r.start,r.end-r.start,i,"link",o);n.setBlockText(t,s),n.selection.selectBlock(t,r.end)}function BP(n,t,e,r){var s,l,c;if(e){if(n.isBlockWritable(t)&&Qn(e)){const h=e,C=(l=(s=n.editorBoxes.getBoxClass(su(h))).getBoxProperties)==null?void 0:l.call(s,n,h);if(C!=null&&C.boxCommands){C.boxCommands["hovering-toolbar"].executeCommand(n,t,h,r);return}return}const d=A0(n);d==null||d.disableTextToolbar(),d==null||d.hide(),setTimeout(()=>{d==null||d.enableTextToolbar()},400),r.id==="edit-link"?bP(n,t,e):r.id==="remove-link"&&vP(n,t,e);return}const i=$v(n,t);if(!i)return;const o=(c=i.blockCommands)==null?void 0:c["hovering-toolbar"];!o||o.executeCommand(n,t,r)}function b0(){let n=8;for(;n>0&&!document.querySelector(`div[data-style-heading='${n}']`);)n--;return n}function Jr(n){const e=n.selection.range;if(e.isCollapsed()||e.start.blockId!==e.end.blockId||!e.start.isSimple()||!e.end.isSimple()||e.end.offset-e.start.offset!==1)return!1;const r=n.getBlockById(e.start.blockId);return!(!rt(n,r)||Cu(n,r,e.start.offset).charType!=="box")}const TP=[Yh,Qh,Jh,Zh,t0,e0,n0,r0];class yP{constructor(t){m(this,"id","BlockTurnIntoCommandProvider");this.editor=t}getHeadingIndex(){let t=b0();return t<=4?t=5:t<8&&(t+=1),t}getAvailableCommands(t,e,r){if(!rt(t,e))return[];if(Jr(t))return[];const i=lt(e),o=Dt(e),s=Nr(t,e),c=t.getBlockData(e).heading,d=[];for(let C=0;C<this.getHeadingIndex();C++)d.push({id:`heading-${C+1}`,name:D.t("commands.heading",{name:`${C+1}`}),icon:TP[C],states:c===C+1?["checked"]:[],value:`${C+1}`});const h=C=>{var x;const E=v("span",["toolbar-item-name-container"],null);for(const B of C.children)if((x=B.states)!=null&&x.includes("checked"))return E.innerHTML=B.icon||Fa,E;return E.innerHTML=Fa,E};return[{id:"turn-into",name:D.t("commands.headingGroup"),blockId:i,blockType:o,blockKind:s,element:h,groupIndex:200,dropdown:!0,manualShowChildren:!0,childrenPlacement:"bottom-start",defaultCheckedChildren:["text"],children:[{id:"text",name:D.t("commands.text"),icon:Fa,states:c?[]:["checked"]},...d],childrenType:"menu"}]}applyHeadingStyle(t,e,r){t.updateBlockData(e,{heading:r})}executeCommand(t,e,r,i){if(Jr(t))return!1;if(rt(t,e)&&(i.id.startsWith("heading-")||i.id==="text")){const o=i.value?Number(i.value):null;return this.applyHeadingStyle(t,e,o),!0}return!1}}const kP=8,Le=I("list-block"),v0=I("list-block");function Ft(n){return Dt(n)==="list"}function Ne(n){p(v0,Ft(n),"not a list block")}function er(n){Ne(n);const t=n.getAttribute("data-list-type");return p(v0,t,"no list type"),t}function B0(n){return Ft(n)&&er(n)==="text-only"}function nr(n){var t,e;return Ne(n),(e=Number.parseInt((t=n.getAttribute("data-list-start"))!=null?t:"1",10))!=null?e:1}function un(n){var t,e;return Ne(n),(e=Number.parseInt((t=n.getAttribute("data-list-level"))!=null?t:"1",10))!=null?e:1}function Xa(n){Ne(n);const t=n.getAttribute("data-list-group-id");return p(v0,t,"no group id"),t}function ds(n){var o,s,l,c,d;Ne(n);const t=(o=n.getAttribute("data-list-type"))!=null?o:"ordered",e=(l=Number.parseInt((s=n.getAttribute("data-list-start"))!=null?s:"1",10))!=null?l:1,r=(d=Number.parseInt((c=n.getAttribute("data-list-level"))!=null?c:"1",10))!=null?d:1,i=n.getAttribute("data-list-group-id");return p(v0,i,"no group id"),{type:t,start:e,level:r,groupId:i}}function MC(n){switch(n){case"ordered":return{ordered:!0,checkbox:null,textOnly:null};case"unordered":return{ordered:!1,checkbox:null,textOnly:null};case"checked":return{checkbox:"checked",ordered:!1,textOnly:null};case"unchecked":return{checkbox:"unchecked",ordered:!1,textOnly:null};case"text-only":return{checkbox:null,ordered:!1,textOnly:!0};default:return{checkbox:null,ordered:!0,textOnly:!1}}}function RP(n){const t={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1};let e="",r=n;return Object.entries(t).forEach(([i,o])=>{for(;r>=o;)e+=i,r-=o}),e.toLowerCase()}const wP="abcdefghijklmnopqrstuvwxyz";function ik(n){if(n<=0)return`${n}`;const t=(n-1)%26,e=Math.floor((n-1)/26),r=wP[t];return e?ik(e)+r:r}function SP(n){return`${n}`}const ok=[SP,ik,RP];function LP(n,t){const e=ok[(n-1)%ok.length];return e(t)}function IP(n){return["\u2022","\u25E6","\u25AA"][(n-1)%3]}function hs(n,t){Ne(n);const{level:e,groupId:r,type:i}=ds(n);let o=Oe(n);for(;o;){if(!Ft(o))return null;const{level:s,groupId:l,type:c}=ds(o);if(s<e)return null;if(e===s&&((t==null?void 0:t.ignoreGroupId)||r===l)&&(c==="text-only"||i==="text-only"||i===c))return o;o=Oe(o)}return null}function sk(n){return hs(n,{ignoreGroupId:!0})}function gl(n){Ne(n);const{level:t,groupId:e,type:r}=ds(n);let i=Jt(n);for(;i;){if(Ft(i)){const{level:o,groupId:s,type:l}=ds(i);if(t===o&&e===s&&(l==="text-only"||r==="text-only"||r===l))return i;if(o<t)return null}i=Jt(i)}return null}function lk(n){Ne(n);const t=[];let e=hs(n);for(;e;)t.unshift(e),e=hs(e);return t}function Ya(n){Ne(n);const t=[];let e=gl(n);for(;e;)t.push(e),e=gl(e);return t}function of(n){Ne(n);let t=hs(n);for(;t;){const e=hs(t);if(!e)return t;t=e}return n}function DP(n){Ne(n);let t=gl(n);for(;t;){const e=gl(t);if(!e)return t;t=e}return null}function ak(n,t){const e=lk(n),r=Ya(n);return t.withSelf?[...e,n,...r]:[...e,...r]}function T0(n){Ne(n);let t=n;const e=lk(n);e.length>0&&(t=e[0]);const r=Oe(t);return!r||!Ft(r)?null:un(r)<un(t)?r:null}function _P(n,t){Ne(n);let e=n;for(;e;){const r=un(e);if(r===t)return e;if(r>t)e=T0(e);else if(r<t)return null}return null}function MP(n){let t=of(n);for(;;){const e=T0(t);if(!e)return t;t=of(e)}}class UP{constructor(){m(this,"nodeMap",new Map);m(this,"rootNodes",[])}addNode(t,e){const r={block:e,children:[]};if(this.nodeMap.set(e,r),t){const i=this.nodeMap.get(t);p(Le,i,"no parent node"),i.children.push(r)}else this.rootNodes.push(r)}}function ck(n,t){const e=MP(t),r=new UP;r.addNode(null,e);let i=Jt(e);for(;i&&Ft(i);){if(B0(i)){r.addNode(null,i),i=Jt(i);continue}if(un(i)===0&&er(i)!==er(e))break;const s=T0(i);r.addNode(s,i),i=Jt(i)}return r.rootNodes}function OP(n){const t=document.fullscreenEnabled||document.mozFullScreenEnabled||document.documentElement.webkitRequestFullScreen,e=r=>{if(r.requestFullscreen)return r.requestFullscreen();if(r.mozRequestFullScreen)return r.mozRequestFullScreen();if(r.webkitRequestFullScreen){try{document.fullscreenElement=n}catch{}return r.webkitRequestFullScreen()}return Promise.resolve(0)};return t?e(n):Promise.resolve(0)}function uk(){const e=(document.exitFullscreen||document.webkitExitFullscreen).bind(document)();try{document.fullscreenElement=null}catch{}return e}function UC(n){return wt(n,"editor-in-mindmap-first")}function OC(n){if(p(Le,Ft(n),"not a list block"),wt(n,"editor-in-mindmap-first")||!Go(n))return!0;const t=n.classList,e="editor-mindmap-root-";return!!Array.from(t).find(i=>{if(i.startsWith(e))return i})}function NP(n,t,e){const r=it(n);if(t){const s=it(t);p(Le,r===s,"invalid block container")}const i=vt(n);if(t){const s=vt(t);p(Le,i<=s,"invalid block index")}if(z(n,...e),!t||t===n)return;let o=Jt(n);for(;o!==t;)p(Le,o,"no next button"),z(o,...e),o=Jt(o);o&&z(o,...e)}function PP(n){const t=`editor-mindmap-root-${n.id}`,r=it(n).querySelectorAll(`.${t}`);return r[r.length-1]}async function FP(n,t,e){const r=oe(t),i=r.querySelector('[data-button-id="mindmap-fullscreen"]');p(Le,i,"no full screen button");const o=()=>{setTimeout(()=>{e.toMindmap(n,t,{},{reset:!0,mindmapTools:e})},300)},s=()=>{ot(r,"fullscreen"),i.innerHTML=oC,i.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,D.t("mindmap.fullScreen")),OC(t)&&setTimeout(()=>{o()},300)};if(document.fullscreenElement===r){try{await uk()}catch(l){Le.error(l)}s()}else{try{z(r,"fullscreen"),await OP(r),o()}catch(l){Le.error(l)}i.innerHTML=ay,i.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,D.t("mindmap.exitFullscreen"))}r.onfullscreenchange=()=>{document.fullscreenElement||s()}}function NC(n,t,e,r,i){if(t.querySelector(`[data-button-id="${e}"]`))return null;const s=br(e,r,i,[]);return s.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,r),z(s,"mindmap-button"),t.appendChild(s),s}function PC(n,t){return n.querySelector(`[data-button-id="${t}"]`)}function KP(n){return PC(n,"mindmap-fullscreen")}function VP(n){return PC(n,"mindmap-fit")}function $P(n){return PC(n,"mindmap-close")}function HP(n,t,e,r){const i=NC(n,t,"mindmap-close",D.t("mindmap.close"),qh);!i||n.domEvents.addEventListener(i,"click",()=>{r.closeMindmap(n,e)})}function jP(n,t,e,r){const i=NC(n,t,"mindmap-fit",D.t("mindmap.autoFit"),ly);!i||n.domEvents.addEventListener(i,"click",()=>{r.fitMindmap(n,e)})}function zP(n,t,e,r){if(navigator.userAgent.includes("Mobile")&&!navigator.userAgent.includes("iPad"))return;const o=NC(n,t,"mindmap-fullscreen",D.t("mindmap.fullScreen"),oC);!o||n.domEvents.addEventListener(o,"click",()=>{FP(n,e,r)})}function GP(n,t){const e=th(t);if(!e)return;const r=VP(e);r&&(r.remove(),n.domEvents.removeAllListeners(r));const i=$P(e);i&&(i.remove(),n.domEvents.removeAllListeners(i));const o=KP(e);o&&(o.remove(),n.domEvents.removeAllListeners(o))}const Qa=new Map;function FC(n,t,e){const r=(s,l)=>{s.forEach(c=>{l?z(c.block,"to-mindmap-highlight"):ot(c.block,"to-mindmap-highlight"),r(c.children,l)})},i=ck(n,t);if(i.length===0)return;const o=i[0].block;if(e){const s=Qa.get(o);s&&(s.forEach(l=>l.cancel()),Qa.delete(o)),r(i,!0)}else{const s=setTimeout(()=>{r(i,!1),Qa.delete(o)},300),l=()=>{clearTimeout(s),Qa.delete(o)},c=Qa.get(o);c?c.push({cancel:l}):Qa.set(o,[{cancel:l}])}}const{Markmap:WP}=e9;function qP(n,t){Ne(t);const e=ck(n,t),r=e[0].block,i=d=>({t:"text",v:Nt(d.block).textContent,d:1,c:d.children.length>0?d.children.map(C=>i(C)):void 0});let o=null;e.length>1?o={t:"root",v:"root",d:0,c:e.length>0?e.map(d=>i(d)):void 0}:o=i(e[0]);const l=d=>{if(d.length===0)return null;const h=d[d.length-1];return h.children&&h.children.length>0?l(h.children):h},c=l(e);return{root:o,block:r,nodes:e,last:c}}function y0(n,t,e,r){const{root:i,block:o,last:s}=qP(n,t);r.selectBlock&&n.selection.selectBlock(o,0,0),FC(n,o,!1),r.saveData&&n.updateBlockData(o,{viewAsMindmap:!0});const l=oe(o);let c=l.querySelector(".editor-mindmap-svg");if(r.reset&&(c&&c.remove(),c=null),c)c.innerHTML="";else{const U="http://www.w3.org/2000/svg",M=l.getBoundingClientRect(),F=document.fullscreenElement===l,Y=F?`${M.width}`:`${t.getBoundingClientRect().width}`,X=F?`${M.height}`:"600",G=document.createElementNS(U,"svg");G.setAttributeNS(null,"viewBox",`0 0 ${Y} ${X}`),G.setAttributeNS(null,"width","100%"),G.setAttributeNS(null,"height",X),G.style.display="block",G.style.width="100%",G.style.height=`${X}px`,G.classList.add("editor-mindmap-svg"),l.appendChild(G),c=G}const d=o,C=`editor-mindmap-root-${lt(o)}`;z(d,"editor-in-mindmap-first",C,"readonly"),d.contentEditable="false";const E=Jt(o);E&&vt(E)<=vt(s.block)&&NP(E,s.block,["block-hidden",C]);const x=(U,M)=>{if(M.length>0){const F=M[0].parentElement;F&&(F.style.width="100vw",F.style.maxWidth="200px")}M.forEach(F=>{z(F,"editor-mindmap-node")})},B=new WP(c,{...e,autoFit:!0});B.viewHooks.transformHtml.tap(x),B.setData(i),B.fit();const k=oe(o);let w=k.querySelector(".mindmap-toolbar");w||(w=v("div",["mindmap-toolbar"],k)),jP(n,w,d,r.mindmapTools),zP(n,w,d,r.mindmapTools),HP(n,w,d,r.mindmapTools),n.domEvents.addEventListener(c,"click",()=>{n.selection.selectBlock(o,0),n.input.focus()}),d.mindMap=B}function XP(n){const t=v("div",["list-to-mindmap-wrap"],null),e=br("list-to-mindmap",D.t("mindmap.viewAsMindMap"),sy,[],n.clientId);return t.appendChild(e),t}async function fk(n,t){const e=`editor-mindmap-root-${t.id}`,r=it(t);fe(r).forEach(l=>{wt(l,e)&&ot(l,e,"editor-in-mindmap-first","block-hidden")});const o=oe(t);document.fullscreenElement===o&&await uk();const s=o.querySelector(".editor-mindmap-svg");!s||(p(Le,s,"no mindmap svg"),s.remove(),n.domEvents.removeAllListeners(s),GP(n,t))}function YP(n){const t=n.classList,e="editor-mindmap-root-";return Array.from(t).find(i=>{if(i.startsWith(e))return i})}async function dk(n,t){!YP(t)||(n.updateBlockData(t,{viewAsMindmap:null}),fk(n,t),n.selection.selectBlock(t,0))}function QP(n,t){const e=t.mindMap;e&&e.fit()}const k0={toMindmap:y0,closeMindmap:dk,fitMindmap:QP},Glt="";class R0{constructor(t){m(this,"toMindmapButton");m(this,"currentBlock",null);m(this,"handleHoveringBlock",t=>{t&&Ft(t)&&er(t)!=="unchecked"&&er(t)!=="checked"&&this.editor.isWritable()?oe(t).appendChild(this.toMindmapButton):this.toMindmapButton.remove()});m(this,"handleMouseEnter",()=>{const t=Z(this.toMindmapButton);p(Le,t&&Ft(t),"no parent list"),FC(this.editor,t,!0),this.currentBlock=t});m(this,"handleMouseLeave",()=>{this.currentBlock&&(FC(this.editor,this.currentBlock,!1),this.currentBlock=null)});m(this,"handleClick",()=>{const t=Z(this.toMindmapButton);p(Le,t&&Ft(t),"no parent list"),y0(this.editor,t,{},{saveData:!0,selectBlock:!0,mindmapTools:k0})});this.editor=t,Re.get(this.editor).addListener("change",this.handleHoveringBlock),this.toMindmapButton=XP(t),t.domEvents.addEventListener(this.toMindmapButton,"mouseenter",this.handleMouseEnter),t.domEvents.addEventListener(this.toMindmapButton,"mouseleave",this.handleMouseLeave),t.domEvents.addEventListener(this.toMindmapButton,"click",this.handleClick)}static get(t){return t.findCustomByType(R0)}destroy(){Re.get(this.editor).removeListener("change",this.handleHoveringBlock)}hide(){this.currentBlock&&(this.currentBlock=null),this.toMindmapButton.remove()}}function JP(n,t,e){var r;t==="beginDrag"&&((r=R0.get(n))==null||r.hide())}function Ja(n,t,e,r){var o;const i=(o=r==null?void 0:r.groupId)!=null?o:et();t.forEach(s=>{const l=n.getBlockData(s);if(l.start!==e||(r==null?void 0:r.resetGroupId)){const c={...l,start:e};r!=null&&r.resetGroupId&&(c.groupId=i),n.updateBlockData(s,c)}l.textOnly||(e+=1)})}function KC(n,t,e,r){const i=ak(t,{withSelf:!0});i.length!==0&&Ja(n,i,e,r)}class w0{constructor(t,e){m(this,"listStart",0);m(this,"listBrother",null);if(this.editor=t,B0(e))return;const r=of(e),i=nr(r);this.listStart=i,r===e?this.listBrother=gl(r):this.listBrother=r}fix(){if(!!this.listBrother){if(qc(this.listBrother)){this.listBrother=null;return}KC(this.editor,this.listBrother,this.listStart)}}}class pl{constructor(t,e,r){m(this,"listStart");m(this,"listBrother",null);this.editor=t,this.options=r;const i=of(e),o=nr(i);this.listStart=o,this.listBrother=i,r!=null&&r.resetStart&&(this.listStart=1)}fix(){!this.listBrother||KC(this.editor,this.listBrother,this.listStart,this.options)}}class hk{constructor(t,e,r){m(this,"listStart");m(this,"listNextBrothers",[]);this.editor=t,this.listNextBrothers=Ya(e);const{start:i,resetStart:o}=r||{};this.listStart=o?1:i!=null?i:1}fix(){!this.listNextBrothers.length||Ja(this.editor,this.listNextBrothers,this.listStart)}}function ZP(n,t,e){n.getBlockData(t).quoted&&(e.quoted=!0)}function VC(n,t,e,r){if(Le.debug("drag a block on a list block"),!rt(n,t))return!1;p(Le,Ft(e),"target is not a list block");const{type:i,start:o,level:s,groupId:l}=ds(e),c=r==="after"?o+1:o,d=n.getBlockData(t),h={id:et(),type:"list",groupId:l,level:s,start:c,text:d.text,...MC(i)};ZP(n,e,h);let C=vt(e);const E=it(e);r==="after"&&(C+=1);let x=null;Ft(t)&&(x=new w0(n,t));const B=n.insertBlock(ct(E),C,h,Ch(h.id,0));return n.deleteBlock(t),new pl(n,B).fix(),x==null||x.fix(),!0}function tF(n,t,e,r){if(Le.debug("drag a list between text blocks"),r==="after"){const d=Jt(e);if(d&&Ft(d))return VC(n,t,d,"before")}if(r==="before"){const d=Oe(e);if(d&&Ft(d))return VC(n,t,d,"after")}const o={...n.getBlockData(t),groupId:et(),start:1,level:1};let s=vt(e);const l=it(e);r==="after"&&(s+=1),n.insertBlock(ct(l),s,o,Ch(o.id,0));const c=new w0(n,t);return n.deleteBlock(t),c.fix(),!0}function eF(n,t,e,r,i){if(Xd(e))return!1;const{blockId:o}=e,s=n.getBlockById(o);p(Le,s,"no dragged block");const{isSourceBlock:l,targetBlock:c}=i;return!l&&c?(p(Le,t===c,"block !== target block"),p(Le,Ft(c),"target is not a list block"),VC(n,s,c,r)):tF(n,s,c,r)}function mk(n,t){if(!n.isWritable())return!1;const e=n.selection.range,i=n.editorCommandProviders.getCommands(e,"shortcut").find(o=>o.id===t);return i?(n.editorCommandProviders.executeCommand(e,i,{}),!0):!1}const nF={"Shift+CtrlOrCmd+L":n=>mk(n,"ordered-list"),"Shift+CtrlOrCmd+U":n=>mk(n,"unordered-list")};function S0(n){const t=n.getAttribute("block-padding-level");return t?Number(t):null}function rF(n,t){let e;const r=S0(t);if(!r)e=1;else{if(r>=12)return e=12,!1;e=r+1}return n.updateBlockData(t,{...n.getBlockData(t),padding:e}),!0}function gk(n,t){const e=S0(t);if(!e)return!1;const r=n.getBlockData(t);return e>1?(n.updateBlockData(t,{...r,padding:e-1}),!0):(n.updateBlockData(t,{...r,padding:null}),!0)}function $C(n){return n.readonly||!n.isWritable()}function iF(n){return n.selection.range.getSelectedBlocks().forEach(e=>{const r=e.block;rt(n,r)&&rF(n,r)}),!0}function oF(n){return n.selection.range.getSelectedBlocks().forEach(e=>{const r=e.block;rt(n,r)&&gk(n,r)}),!0}function sF(n){return $C(n)?!1:n.undoManager.runInGroup(()=>(iF(n),!0))}function lF(n){return $C(n)?!1:n.undoManager.runInGroup(()=>(oF(n),!0))}function aF(n){if($C(n))return!1;if(!n.selection.range.isCollapsed())return;const t=n.selection.focusedBlock;if(!rt(n,t))return;const e=n.selection.range.focus;if(!(!e.isSimple()||e.offset!==0||!S0(t)))return gk(n,t),!0}class HC{renderBlock(t,e,r){const{padding:i}=r;return i?{attributes:{"block-padding-level":i}}:{}}}const Wlt="",cF={Tab:sF,"Shift+Tab":lF,Backspace:aF};function uF(n,t,e=1){if(!t)return null;let r=Oe(n);for(;r;){const i=r.getAttribute("data-style-heading"),o=Number(r.getAttribute("data-list-level"));if(i){if(i<t)return null;if(i===t&&o===e)return Ft(r)?r:null}r=Oe(r)}return null}function fF(n,t){const e=n.getAttribute("data-style-heading"),r=uF(n,e);if(r)return r;const i=Oe(n);if(i&&Ft(i)&&er(i)===t)return i;const o=Jt(n);return o&&Ft(o)&&er(o)===t?o:null}function dF(n,t,e){var k,w,U;const r=(k=e.data)!=null?k:{};let i=1;if(Ft(t))i=un(t);else{const M=S0(t);M&&(i=M+1),i>8&&(i=8)}const o=(w=r.listType)!=null?w:"ordered";if(o==="text-only")return null;const s=n.getBlockData(t);let l=(U=s.text)!=null?U:[],d=de(l);const h=e.offset||0;h<=gn(l)&&(l=Mn(l,h).right,d=d.substring(0,h));let C=1;o==="ordered"&&(C=Number.parseInt(d,10)||1);let E=et();const x=fF(t,o);if(x)if(un(x)===i){if(vt(t)>vt(x))C=nr(x)+1;else{const M=nr(x);M>1&&(C=M-1),new hk(n,x,{start:C+1}).fix()}E=Xa(x)}else{const M=_P(x,i);M&&(C=nr(M)+1)}else Ft(t)&&new hk(n,t,{start:1}).fix();const B={id:et(),type:"list",level:i,start:C,groupId:E,ordered:!1,text:l};return s.quoted&&(B.quoted=!0),s.heading&&(B.heading=s.heading),o==="ordered"?B.ordered=!0:(o==="checked"||o==="unchecked")&&(B.checkbox=o),{blockData:B,onConverted:(M,F)=>{new pl(M,F).fix()}}}function Za(n){return n.textOnly?"text-only":n.checkbox?n.checkbox:n.ordered?"ordered":"unordered"}function hF(n){var e,r;if(n.checkbox)return"";const t=(e=n.level)!=null?e:1;return n.ordered?`${LP(t,(r=n.start)!=null?r:1)}.`:IP(t)}function L0(n){return n==="checked"||n==="unchecked"}function pk(n,t,e,r){const i=t,{containerId:o,blockIndex:s}=r[r.length-1];if(s===0)return!0;const l=e.blocks[o][s-1];if(l.type!=="list")return!0;const c=Za(i),d=Za(l);return c!==d&&(!L0(c)||!L0(d))||(i.level||1)>(l.level||1)}function Ck(n,t,e,r){const i=t,{containerId:o,blockIndex:s}=r[r.length-1];if(s===e.blocks[o].length-1)return!0;const l=e.blocks[o][s+1];if(l.type!=="list")return!0;const c=Za(i),d=Za(l);return c!==d&&(!L0(c)||!L0(d))||(i.level||1)>(l.level||1)}function mF(n,t,e,r,i){var s,l,c;const o=t;if(r==="text")return((s=Nn.convertTo)==null?void 0:s.call(Nn,n,t,e,"text",i))||"";if(r==="markdown"){let d=((l=Nn.convertTo)==null?void 0:l.call(Nn,n,t,e,"markdown",i))||"";o.checkbox==="checked"?d=`[x] ${d}`:o.checkbox==="unchecked"&&(d=`[ ] ${d}`),o.ordered?d=`${o.start}. ${d}`:d=`- ${d}`;const h=o.level||0;return d=(h>0?" ".repeat(h-1):"")+d,pk(n,t,e,i)&&(d=`${d}`),Ck(n,t,e,i)&&(d=`${d}`,h<=1&&(d+=`
|
|
613
|
+
`,IO=Object.freeze(Object.defineProperty({__proto__:null,ClearIcon:XT,CloseIcon:qh,PrevIcon:fT,NextIcon:dT,MoreIcon:zp,TextColorIcon:Gp,ArrowDownIcon:Xh,ArrowUpIcon:mO,ArrowLeftIcon:gO,ArrowRightIcon:Wp,DeleteRowIcon:hT,DeleteColIcon:mT,MergeCellIcon:gT,SplitCellIcon:pT,DeleteTableIcon:CT,Heading1Icon:Yh,Heading2Icon:Qh,Heading3Icon:Jh,Heading4Icon:Zh,Heading5Icon:t0,Heading6Icon:e0,Heading7Icon:n0,Heading8Icon:r0,HeadingNIcon:pO,OrderedListIcon:ET,UnorderedListIcon:xT,CheckListIcon:AT,BlockquoteIcon:bT,AlignCenterIcon:o0,AlignLeftIcon:Pa,AlignRightIcon:i0,ImageIcon:vT,ImageMenuIcon:BT,ImageErrorIcon:Xp,ImageEmptyIcon:yT,LinkIcon:Zp,LinkOffIcon:kT,WarningIcon:qp,PasteSpecialIcon:TT,LaunchIcon:Yp,CodeIcon:KT,AudioIcon:OT,GraphIcon:CO,VideoIcon:NT,FileIcon:EO,MathIcon:AO,MathMenuIcon:RT,TableIcon:bO,TableMenuIcon:wT,BilibiliIcon:LT,YoukuIcon:IT,ModaoIcon:_T,FigmaIcon:DT,EditIcon:s0,CommentIcon:ul,RefreshIcon:ST,HelpIcon:Qp,CheckMarkIcon:Jp,TextIcon:Fa,RightArrowIcon:xO,TencentVideoIcon:MT,WebPageIcon:UT,UmlIcon:PT,DividingLineIcon:FT,HeadingH1Icon:vO,HeadingH2Icon:BO,HeadingH3Icon:TO,HeadingH4Icon:yO,HeadingH5Icon:kO,HeadingH6Icon:RO,HeadingH7Icon:wO,HeadingH8Icon:SO,CheckboxIcon:tC,QuoteIcon:eC,LinkHrefIcon:LO,OrderedIcon:rC,UnorderedIcon:nC,CopyIcon:VT,CutIcon:$T,DeleteIcon:HT,LockBlockIcon:jT,UnLockBlockIcon:zT,InsertBeforeIcon:GT,InsertAfterIcon:WT,MentionIcon:qT,CircleAddIcon:YT,LoadingIcon:QT,DragIcon:iC,UmlBrandIcon:l0,OnesLoadingIcon:JT,BoldIcon:ZT,ItalicIcon:ty,UnderlineIcon:ey,LineThroughIcon:ny,SubscriptIcon:iy,SuperscriptIcon:oy,InlineCodeIcon:ry,ToMindMapIcon:sy,FitIcon:ly,FullScreenIcon:oC,ExitFullScreenIcon:ay,CaretDownIcon:cy,StatusIcon:uy},Symbol.toStringTag,{value:"Module"}));function fy(){const n=v("span",["editor-loading-icon"],null);return n.innerHTML=JT,n}const Mlt="";function DO(n,t){const e=v("button",["editor-checkbox-wrapper"],null);e.setAttribute("data-button-id",n),t!=null&&t.includes("checked")&&z(e,"checked"),t!=null&&t.includes("disabled")&&(e.disabled=!0);const r=v("span",["editor-checkbox"],e);return v("span",["editor-checkbox-inner"],r),e}const Ult="",Ka=I("ui-command-bar-base"),_O={itemElementTag:"div",tippyArrow:!1},wx=class extends ye.TypedEmitter{constructor(e,r,i){var o,s;super();m(this,"content");m(this,"items");m(this,"subBar",null);m(this,"parentItem",null);m(this,"closeable",null);m(this,"closeReason",null);m(this,"options");m(this,"id");m(this,"header",null);m(this,"footer",null);m(this,"handleDocumentKeydown",e=>{var r,i;if(!!this.isVisible&&!e.isComposing&&!pa(e.target)){if(this.subBar){this.subBar.handleDocumentKeydown(e);return}if(this.items.length!==0){if(e.key==="Escape"){if((i=(r=this.options).beforeClose)!=null&&i.call(r))return;this.close("cancelBar");return}if(e.key==="ArrowUp"){const o=this.getPrevItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[o].id),e.preventDefault(),e.stopPropagation()}else if(e.key==="ArrowDown"){const o=this.getNextItemIndex(this.getSelectedItemIndex());this.startPauseMouseEnter(),this.selectItem(this.items[o].id),e.preventDefault(),e.stopPropagation()}else if(e.key==="ArrowRight"){const o=this.getSelectedItem();o&&o.children&&this.showSubCommandBar(o.childrenMenuId)}else if(e.key==="ArrowLeft")this.parentItem&&this.close("switchItem");else if(e.key==="Enter"){const o=this.getSelectedItemIndex();if(o===-1)return;const s=this.items[o],l=this.getItemElementById(s.id);l&&this.emit("click",this,s,l)}}}});m(this,"handleDocumentMouseDown",e=>{var r,i;if(e.target instanceof Element){if((i=(r=this.options).beforeClose)!=null&&i.call(r,e))return;if(!this.isInCommandBar(e.target)){const o=this.listeners("closing");for(let s=0;s<o.length;s++)if(o[s](this,e)===!1)return;this.close("clickBackground")}}});m(this,"handleHidden",()=>{this.closeReason!=="fromHover"&&this.emit("close",this),this.close(null),Hg(this.id)});m(this,"handleShow",()=>{this.popper&&(this.popper.setAttribute("data-command-bar-id",this.id),this.options.classes&&z(this.popper,...this.options.classes),this.options.refuseOverflow&&this.popper.classList.add("reference-hidden")),this.emit("show",this),this.options.disablePageScroll&&$g(this.id)});m(this,"lastEnterPauseTime",0);m(this,"startPauseMouseEnter",()=>{this.lastEnterPauseTime=Date.now()});m(this,"handleItemMouseEnter",e=>{if(Date.now()-this.lastEnterPauseTime<100)return;const r=this.getParentCommandItemElement(e.target);if(!r)return;const i=this.getItemElementId(r),o=this.getItemById(i);if(this.selectItem(i),o.manualShowChildren)return;const s=o.childrenMenuId||"";this.showSubCommandBar(s)});m(this,"handleItemMouseLeave",e=>{var i,o;const r=this.getParentCommandItemElement(e.target);!r||((o=(i=this.subBar)==null?void 0:i.parentItem)==null?void 0:o.id)!==this.getItemElementId(r)&&(ot(r,"selected"),this.emit("selectionChange",this,""))});m(this,"handleItemClick",e=>{var s,l;const r=this.getParentCommandItemElement(e.target);if(!r)return;const i=this.getItemElementId(r),o=this.items.find(c=>c.id===i);if(!!o&&!(o.states&&o.states.indexOf("disabled")!==-1)){if(o.children&&o.children.length>0&&o.manualShowChildren){this.showSubCommandBar(o.childrenMenuId);return}if(!o.element&&(this.emit("click",this,o,r),this.options.autoClose)){if((l=(s=this.options).beforeClose)!=null&&l.call(s,e))return;this.close("clickItem")}}});m(this,"handleWheel",e=>{if(!this.options.disablePageScroll&&!document.querySelector(".editor-disable-scroll"))return;const r=e.target;if(!r||!(r instanceof Node))return;const i=r instanceof HTMLElement?r:r.parentElement;if(!i)return;const o=Xe(i);if(!re(this.content,o)){e.stopPropagation(),e.preventDefault();return}e.deltaY<0?o.scrollTop===0&&(e.stopPropagation(),e.preventDefault()):e.deltaY>0&&o.scrollTop+o.clientHeight>=o.scrollHeight&&(e.stopPropagation(),e.preventDefault())});this.id=(o=i==null?void 0:i.id)!=null?o:et(),this.options={..._O,...i},this.items=e,this.parentItem=(s=i==null?void 0:i.parentItem)!=null?s:null,this.closeable=r!=null?r:null,this.content=this.createCommandBarContent(e)}close(e){this.closeReason=e,this.subBar&&this.subBar.close(e),document.removeEventListener("keydown",this.handleDocumentKeydown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}click(e,r){this.emit("click",this,e,r)}createPopperOptions(){var i,o;const e={modifiers:[]},r=this.options.overflowBoundary;return r&&((i=e==null?void 0:e.modifiers)==null||i.push({name:"flip",options:{boundary:r,fallbackPlacements:["top","bottom"]}})),this.options.padding&&((o=e==null?void 0:e.modifiers)==null||o.push({name:"preventOverflow",options:{padding:this.options.padding}})),e}destroy(){var e;this.close(null),this.removeAllListeners(),(e=this.subBar)==null||e.destroy(),this.subBar=null,this.closeable=null,this.content.removeEventListener("wheel",this.handleWheel)}get isSubCommandBar(){return!!this.parentItem}updateItems(e){var i;this.subBar&&e.findIndex(s=>{var l,c;return s.id===((c=(l=this.subBar)==null?void 0:l.parentItem)==null?void 0:c.id)})===-1&&((i=this.subBar)==null||i.destroy(),this.subBar=null),this.items=e;const r=this.createCommandBarContent(e);this.content.innerHTML="",Array.from(r.children).forEach(o=>{this.content.appendChild(o)})}get popper(){return this.content.closest("[data-tippy-root]")}getSelectedItemIndex(){const e=this.getSelectedItem();return e?this.items.indexOf(e):-1}getPrevItemIndex(e){if(e<=0)return this.items.length-1;let r=e-1;for(;;){const i=this.items[r],o=i.type,l=!(i.states&&i.states.indexOf("disabled")!==-1);if(o!=="separator"&&o!=="section"&&l)return r;if(r-=1,r<0)return this.items.length-1}}getNextItemIndex(e){let r=e+1;for(;;){if(!this.items[r])return this.getNextItemIndex(-1);const i=this.items[r],o=i.type,l=!(i.states&&i.states.indexOf("disabled")!==-1);if(o!=="separator"&&o!=="section"&&l)return r;if(r+=1,r>this.items.length-1)return 0}}clearSelectedItem(){const e=this.getSelectedItem();if(!e)return;const r=this.getItemElementById(e.id);r&&ot(r,"selected")}selectItem(e){const r=this.getSelectedItem();if(r){if(r.id===e)return;const o=r.id,s=this.getItemElementById(o);s&&ot(s,"selected")}const i=this.getItemElementById(e);i?(z(i,"selected"),this.emit("selectionChange",this,i.getAttribute("data-id")||""),this.options.disableSelectedScroll||i.scrollIntoView({block:"nearest"})):this.emit("selectionChange",this,"")}showSubCommandBar(e){var s,l,c,d;const r=this.getSelectedItem();if(!r||!r.children&&((l=(s=this.subBar)==null?void 0:s.parentItem)==null?void 0:l.manualShowChildren))return;if(this.subBar){if(((c=this.subBar.parentItem)==null?void 0:c.id)===r.id){r.manualShowChildren&&this.subBar.close("switchItem");return}this.subBar.destroy(),this.subBar=null}if(!r.children)return;const i=this.getItemElementById(r.id);if(!i)return;const o=wx.createSubCommandBar(r,(d=this.closeable)!=null?d:this,e?{id:e}:{});this.subBar=o,this.subBar.on("click",(h,C,E)=>{this.emit("click",h,C,E)}),this.subBar.on("close",()=>{var h;(h=this.subBar)==null||h.destroy(),this.subBar=null,ot(i,"active")}),r.beforePopup&&r.beforePopup(o),this.subBar.manualShow(i,this.getSubBarOptions(r)),z(i,"active")}isInCommandBar(e){if(!e||!(e instanceof Node))return!1;const r=this.getCommandBarRoot();return r&&re(r,e)||re(this.content,e)?!0:this.subBar?this.subBar.isInCommandBar(e):!1}createCommandItem(e){var o,s,l,c;let r=(o=this.options.itemElementTag)!=null?o:"div";e.element&&(r="div");const i=v(r,["command-item"],null);return i.setAttribute("data-id",e.id),e.type==="separator"?i.classList.add("separator"):e.type==="section"?(i.classList.add("section","text"),e.element&&(typeof e.element=="function"?i.appendChild(e.element(e)):i.appendChild(e.element))):((s=e.states)!=null&&s.includes("selected")&&i.classList.add("selected"),(l=e.states)!=null&&l.includes("checked")&&i.classList.add("checked"),(c=e.states)!=null&&c.includes("disabled")&&i.classList.add("disabled"),i.onclick=this.handleItemClick,i.onmouseenter=this.handleItemMouseEnter,i.onmouseleave=this.handleItemMouseLeave,e.element?typeof e.element=="function"?i.appendChild(e.element(e)):i.appendChild(e.element):i.classList.add("standard")),this.initItemElement(e,i),i}getItemById(e){const r=this.items.find(i=>i.id===e);return p(Ka,r,`can not find command item for id: ${e}`),r}getSelectedItem(){const e=this.content.querySelector(":scope >.editor-command-bar >.command-item.selected");if(e){const r=this.getItemElementId(e),i=this.items.find(o=>o.id===r);return p(Ka,i,`can not find command item for id: ${r}`),i}return null}getItemElementId(e){const r=e.getAttribute("data-id");return p(Ka,r,"no data-id attribute"),r}getItemElementById(e){const r=this.content.querySelector(`:scope >.editor-command-bar > .command-item[data-id="${e}"]`);return p(Ka,r,`no exists command item, id=${e}`),r}getParentCommandItemElement(e){if(!e||!(e instanceof Element))return null;if(wt(e,"command-item"))return e;const r=e.closest(".command-item");return r||null}createCommandBarContent(e){this.content&&this.content.removeEventListener("wheel",this.handleWheel);const r=v("div",["editor-command-bar-root"],null);if(this.options.header){const o=v("div",["editor-command-bar-header"],null);if(this.options.header instanceof Function){const s=this.options.header();s&&o.appendChild(s)}else o.appendChild(this.options.header);this.header=o,this.header&&r.appendChild(this.header)}const i=v("div",["editor-command-bar"],r);if(e.forEach(o=>{var l;const s=this.createCommandItem(o);i.appendChild(s),o.element&&o.setCloseable&&o.setCloseable((l=this.closeable)!=null?l:this)}),this.options.footer){const o=v("div",["menu-item","editor-command-bar","footer"],null);if(this.options.footer instanceof Function){const s=this.options.footer();s&&o.appendChild(s)}else o.appendChild(this.options.footer);this.footer=o,this.footer&&r.appendChild(this.footer)}return(this.options.header||this.options.footer)&&z(r,"scrollable-bar"),this.initCommandBarElement(i),r.addEventListener("wheel",this.handleWheel,{passive:!1}),r}getSubBarOptions(e){var r;return{placement:(r=e.childrenPlacement)!=null?r:"right-start",offset:e.childrenOffset,arrow:e.childArrow}}static registerManualCommandBar(e,r){this.commandBarCreators.set(e,r)}static createSubCommandBar(e,r,i){var l;p(Ka,e.children&&e.children.length>0,"no item children");const o=(l=e.childrenType)!=null?l:"menu",s=this.commandBarCreators.get(o);return p(Ka,s,`no creator for command type: ${o}`),s(e,r,i)}static hasExistsCommandBar(){return!!document.querySelector("[data-command-bar-id]")}};let fl=wx;m(fl,"commandBarCreators",new Map),I("ui-command-bar");class a0 extends fl{constructor(){super(...arguments);m(this,"tippyInstance",null)}manualShow(e,r){var i,o,s;if(!this.isVisible){if(this.tippyInstance&&(this.tippyInstance.destroy(),this.tippyInstance=null),this.tippyInstance=Z6.default(e,{interactive:!0,content:this.content,trigger:"manual",triggerTarget:null,hideOnClick:!1,placement:(i=r==null?void 0:r.placement)!=null?i:"bottom-start",maxWidth:650,arrow:(o=r==null?void 0:r.arrow)!=null?o:this.options.tippyArrow,appendTo:document.body,onShow:this.handleShow,onHidden:this.handleHidden,theme:r==null?void 0:r.theme,getReferenceClientRect:r==null?void 0:r.getReferenceClientRect,offset:(s=r==null?void 0:r.offset)!=null?s:[0,0],popperOptions:this.createPopperOptions()}),r!=null&&r.point){const{x:l,y:c}=r.point;this.tippyInstance.setProps({getReferenceClientRect:()=>new DOMRect(l,c,0,0)})}this.clearSelectedItem(),this.tippyInstance.show(),this.parentItem||(document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("mousedown",this.handleDocumentMouseDown)),this.popper&&this.options.id&&this.popper.setAttribute("data-command-bar-id",this.options.id)}}close(e){var r;super.close(e),this.isVisible&&((r=this.tippyInstance)==null||r.hide())}destroy(){var e;(e=this.tippyInstance)==null||e.destroy(),this.tippyInstance=null,super.destroy()}getCommandBarRoot(){return this.content.closest("[data-tippy-root]")}get isVisible(){var e,r;return(r=(e=this.tippyInstance)==null?void 0:e.state.isVisible)!=null?r:!1}get popper(){return this.content.closest("[data-tippy-root]")}}const dy=I("ui-base");class Va extends a0{constructor(t,e){var o;const r=(o=e==null?void 0:e.id)!=null?o:`popup-${et()}`,i=[{id:r,name:"",element:t}];super(i,void 0,{disablePageScroll:!0,id:r,beforeClose:e==null?void 0:e.beforeClose})}initCommandBarElement(t){z(t,"popper")}initItemElement(t,e){}get popupContent(){const t=this.items[0];p(dy,t,"no dialog item");const e=typeof t.element=="function"?t.element(t):t.element;return p(dy,e,"no item element"),e}}const fo=I("filterable-list");function hy(n){var e,r;const t=v("div",["list-item"],null);return t.setAttribute("data-id",n.id),t.appendChild(v("div",["list-item-text"],null,n.name)),(e=n.states)!=null&&e.includes("selected")&&(z(t,"selected"),Hs(Jp,["list-item-selected-icon"],t)),(r=n.states)!=null&&r.includes("disabled")&&z(t,"disabled"),t}function my(n){const t=v("div",["list-root"],null);return n.forEach(e=>{t.appendChild(hy(e))}),n.length||t.appendChild(hy({id:"placeholder",states:["disabled"],name:D.t("search.emptyTips")})),t}function gy(n,t){return n.map(e=>({...e,states:t===e.id?["selected"]:[]}))}function MO(n,t){const e=v("div",["filterable-list"],null),r=v("div",["filter"],e),i=v("div",["filter-container"],r),o=v("input",["filter-input"],i);t&&t.placeholder&&(o.placeholder=t.placeholder);const s=v("div",["list"],e),l=my(gy(n,t==null?void 0:t.initialSelectedId));return s.appendChild(l),e}function py(n,t,e){const r=n.querySelector(".list");p(fo,r,"no list root");const i=my(gy(t,e)),o=r.querySelector(".list-root");if(p(fo,o,"no exists menu"),Zc(o,i),e){const s=r.querySelector(".list-item.selected");s&&(p(fo,s,"no selected menu item"),s.scrollIntoView({block:"nearest"}))}}class UO{constructor(t,e){m(this,"root");m(this,"visibleItems");m(this,"selectedId");m(this,"filter","");m(this,"onSelected",null);m(this,"handleKeydown",t=>{this.processKeyDown(t)});m(this,"handleInputChanged",()=>{const t=this.root.querySelector(".filter-input");p(fo,t,"no input");const e=t.value.toLocaleLowerCase();this.setFilter(e)});m(this,"handleClick",t=>{this.processClick(t)});var r;this.items=t,this.options=e,this.root=MO(t,e),this.bindEvents(),this.selectedId=(r=e==null?void 0:e.initialSelectedId)!=null?r:"",this.visibleItems=t}bindEvents(){const t=this.root.querySelector(".filter-input");p(fo,t,"no input"),t.addEventListener("keyup",this.handleInputChanged),t.addEventListener("keydown",this.handleKeydown),this.root.addEventListener("click",this.handleClick)}unbindEvents(){const t=this.root.querySelector(".filter-input");p(fo,t,"no input"),t.removeEventListener("keyup",this.handleInputChanged),t.removeEventListener("keydown",this.handleKeydown),this.root.removeEventListener("click",this.handleClick)}destroy(){this.unbindEvents(),this.onSelected=null}getSelectedIndex(){return this.selectedId?this.visibleItems.findIndex(t=>t.id===this.selectedId):-1}setSelectedId(t){this.selectedId=t,py(this.root,this.visibleItems,t)}focus(){const t=this.root.querySelector(".filter-input");p(fo,t,"no input"),t.focus()}moveSelectedItemIntoView(){const t=this.root.querySelector(".list-item.selected");t&&(p(fo,t,"no selected menu item"),t.scrollIntoView({block:"nearest"}))}reset(){this.setFilter("");const t=this.root.querySelector(".filter-input");p(fo,t,"no input"),t.value=""}setFilter(t){this.filter!==t&&(this.filter=t,this.visibleItems=this.items.filter(e=>e.name.toLocaleLowerCase().includes(t)),py(this.root,this.visibleItems,this.selectedId))}processClick(t){var s,l;const e=t.target;if(!(e instanceof HTMLElement))return;const r=e.closest(".list-item");if(!r)return;const i=(s=r.getAttribute("data-id"))!=null?s:"",o=(l=this.visibleItems.find(c=>c.id===i))!=null?l:null;this.onSelected&&this.onSelected(this,o)}processKeyDown(t){var e;if(t.key==="ArrowUp"){let r=this.getSelectedIndex();r===-1?r=this.visibleItems.length-1:r>0&&(r-=1);let i="";r!==-1&&(i=this.visibleItems[r].id),this.setSelectedId(i);return}if(t.key==="ArrowDown"){let r=this.getSelectedIndex();r===-1?r=0:r<this.visibleItems.length-1&&(r+=1);let i="";r!==-1&&(i=this.visibleItems[r].id),this.setSelectedId(i);return}if(t.key==="Enter"){const r=(e=this.visibleItems.find(i=>i.id===this.selectedId))!=null?e:null;this.onSelected&&this.onSelected(this,r)}}}class OO extends UO{constructor(e,r,i){super(e,i);m(this,"popup");m(this,"onShow",null);m(this,"onHide",null);m(this,"custom",null);m(this,"handleShow",()=>{this.onShow&&this.onShow(this)});m(this,"handleHide",()=>{this.onHide&&this.onHide(this)});m(this,"handleShown",()=>{this.focus()});this.popup=new Va(this.root)}destroy(){super.destroy(),this.onShow=null,this.onHide=null}show(e){this.reset(),this.popup.manualShow(e,{theme:"dropdown-list"}),this.focus(),this.moveSelectedItemIntoView()}processKeyDown(e){super.processKeyDown(e),(e.key==="Esc"||e.key==="Enter")&&this.popup.close("cancelBar")}processClick(e){super.processClick(e);const r=e.target;!(r instanceof HTMLElement)||!r.closest(".list-item")||this.popup.close("clickItem")}}const Olt="",Nlt="";function NO(n,t){const e=document.createElement("div");e.classList.add("toast","show"),t!=null&&t.theme&&e.setAttribute("data-theme",t.theme),t!=null&&t.id&&e.setAttribute("data-id",t.id),t!=null&&t.html?e.innerHTML=n:e.textContent=n,t!=null&&t.position&&(e.style.left=`${t.position.x}px`,e.style.top=`${t.position.y}px`,e.classList.add("positioned")),document.body.appendChild(e),setTimeout(()=>{e.classList.remove("show"),setTimeout(()=>{e.remove()},500)},(t==null?void 0:t.duration)||3e3)}function PO(n,t){var e,r;if(z(t,"menu-item"),!n.element){if(n.type==="section"){const i=v("div",["section-name"],null,n.name);t.appendChild(i)}else if(n.type!=="separator"){if(n.icon){const o=v("div",["menu-item-icon"],null);n.icon&&(o.innerHTML=n.icon),t.appendChild(o)}const i=v("div",["menu-item-name","text"],null);if(v("span",[],i,n.name),n.ellipsisTooltip&&(t.setAttribute("data-editor-tooltip-allow-markdown","true"),t.setAttribute("data-editor-tooltip-offset-y","25"),t.setAttribute("data-editor-tooltip-placement","right"),t.setAttribute("data-editor-tooltip-common",`<div style="word-break: break-word;">${n.ellipsisTooltip}</div>`)),((e=n.states)==null?void 0:e.includes("disabled"))&&n.disableReason&&(t.setAttribute("data-editor-tooltip-placement","right"),t.setAttribute("data-editor-tooltip-common",n.disableReason)),t.appendChild(i),n.subText&&v("div",["item-subtext","text"],t,n.subText),n.children&&!n.element){const o=v("div",["menu-item-sub-indicator"],null);o.innerHTML=Wp,t.appendChild(o)}if((r=n.states)!=null&&r.includes("checked")){const o=v("div",["menu-item-checked-icon"],null);o.innerHTML=Jp,t.appendChild(o)}}}}class ls extends a0{constructor(t,e,r){super(t,e,{autoClose:!0,disablePageScroll:!0,beforeClose:r==null?void 0:r.beforeClose,...r})}manualShow(t,e){const r={theme:"menu",...e};super.manualShow(t,r)}initCommandBarElement(t){z(t,"menu")}initItemElement(t,e){PO(t,e)}}function FO(n,t,e){var r;return new ls((r=n.children)!=null?r:[],t,{...e,parentItem:n})}function Cy(n,t,e){t.setAttribute("data-button-id",n.id),e.tooltipId&&n.name&&!n.disableTooltip&&(t.setAttribute(`data-editor-tooltip-${e.tooltipId}`,n.name),n.desc&&t.setAttribute(`data-editor-tooltip-desc-${e.tooltipId}`,n.desc));const r=t;if(!n.element)if(n.icon){const i=v("span",["toolbar-item-icon-container"],r);n.icon.trim().startsWith("<")?i.innerHTML=n.icon:i.innerText=n.icon}else{const i=v("span",["toolbar-item-name-container"],r);i.innerText=n.name}if(n.dropdown){t.setAttribute("data-dropdown","true");const i=v("span",["toolbar-item-dropdown-container"],r);i.innerHTML=Xh}n.states&&(n.states.indexOf("checked")!==-1&&z(r,"checked"),n.states.indexOf("disabled")!==-1&&(r.disabled=!0))}class ju extends a0{constructor(t,e,r){super(t,e,{itemElementTag:"button",tippyArrow:!1,...r})}getSubBarOptions(t){var i,o;const e=()=>{const s=this.getItemElementById(t.id),c=this.content.getBoundingClientRect(),d=s.getBoundingClientRect();return new DOMRect(d.left,c.top,d.width,c.height)};return{placement:(i=t.childrenPlacement)!=null?i:"top",getReferenceClientRect:e,offset:(o=t.childrenOffset)!=null?o:[0,4]}}manualShow(t,e){const r={theme:"toolbar",...e};super.manualShow(t,r)}initCommandBarElement(t){z(t,"toolbar")}initItemElement(t,e){Cy(t,e,this.options)}}function KO(n,t,e){var r;return new ju((r=n.children)!=null?r:[],t,{...e,parentItem:n})}class VO extends fl{constructor(t,e,r){super(e,void 0,r),t.appendChild(this.content),document.addEventListener("keydown",this.handleDocumentKeydown),document.addEventListener("mousedown",this.handleDocumentMouseDown)}initCommandBarElement(t){z(t,"toolbar","fixed")}initItemElement(t,e){Cy(t,e,this.options)}close(){this.clearSelectedItem(),this.subBar&&(this.subBar.close("cancelBar"),this.subBar=null)}destroy(){this.content.remove(),super.destroy(),document.removeEventListener("keydown",this.handleDocumentKeydown),document.removeEventListener("mousedown",this.handleDocumentMouseDown)}getCommandBarRoot(){return this.content.parentElement}get isVisible(){return!0}}const Plt="";fl.registerManualCommandBar("menu",FO),fl.registerManualCommandBar("toolbar",KO);const Flt="",Ey=I("ui-base");class zu extends a0{constructor(e,r){super(zu.getCommandItems(e,r),void 0,{disablePageScroll:!0,...r});m(this,"handleDocumentMouseDown",e=>{})}initCommandBarElement(e){z(e,"dialog","manual")}initItemElement(e,r){}show(e,r){this.manualShow(e,{...r,theme:"light"})}get dialogContent(){const e=this.items[0];p(Ey,e,"no dialog item");const r=e.element;return p(Ey,r,"no item element"),r}static getCommandItems(e,r){var s;return[{id:(s=r==null?void 0:r.id)!=null?s:`manual-dialog-${et()}`,name:"",element:e}]}}const Klt="",$O=I("ui-base");class xy{constructor(t){m(this,"menu");m(this,"currentText","");m(this,"handleSearchText");m(this,"handleClick",ke.default((t,e)=>{this.options.onClickItem(this,e)},300,{leading:!0,trailing:!1}));m(this,"handleShow",t=>{});m(this,"handleClose",()=>{var t,e;(e=(t=this.options).onClose)==null||e.call(t)});m(this,"handleKeydown",t=>{this.menu.handleDocumentKeydown(t)});this.options=t,this.menu=new ls([],void 0,{id:t.id,header:t.header,footer:t.footer,disableSelectedScroll:t.disableSelectedScroll}),this.menu.addListener("click",this.handleClick),this.menu.addListener("close",this.handleClose),this.menu.addListener("show",this.handleShow),this.options.wait?this.handleSearchText=ke.default(async e=>{this.handleSearchTextPure(e)},this.options.wait):this.handleSearchText=this.handleSearchTextPure}setItems(t){if(this.menu.updateItems(t),t.length>0){const e=t.find(r=>r.type!=="section"&&r.type!=="separator");e&&this.menu.selectItem(e.id)}}async popup(t,e){var i,o;if(!(e!=null&&e.noEvent)&&((o=(i=this.options).onShow)==null?void 0:o.call(i,this))===!1)return;this.menu.manualShow(t),this.options.placeholder&&this.showPlaceholder();const r=await this.options.queryItems(this,"");this.highlightText("",r),this.setItems(r)}showLoading(){!this.options.showLoading||(this.options.loadingElement?this.setItems([{id:"loading",name:"",element:this.options.loadingElement,states:["disabled"]}]):this.setItems([{id:"loading",name:"loading",states:["disabled"]}]))}showPlaceholder(){this.setItems([{id:"placeholder",name:"enter text to search",states:["disabled"]}])}showNoResultMessage(t){if(this.options.noResultMessage){const e={name:"",id:"placeholder",states:["disabled"]};typeof this.options.noResultMessage=="string"?e.name=this.options.noResultMessage:(this.options.noResultMessage instanceof HTMLElement||typeof this.options.noResultMessage=="function")&&(e.element=this.options.noResultMessage),this.setItems([e])}else this.setItems([{id:"placeholder",name:this.options.emptyPlaceholder||D.t("search.emptyTips"),states:["disabled"]}])}close(){this.menu.close("cancelBar")}get isVisible(){return this.menu.isVisible}destroy(){this.menu.close("cancelBar"),this.menu.removeAllListeners(),this.menu.destroy()}isInCommandBar(t){return this.menu.isInCommandBar(t)}async handleSearchTextPure(t){this.currentText=t;const e="auto-suggest";try{await Mr.lock(e),this.showLoading();const r=this.currentText,i=await this.options.queryItems(this,t);if(this.currentText===r&&(this.currentText=""),i.length===0){this.showNoResultMessage(t);return}this.setItems(i),this.options.highlight&&this.highlightText(r.replace(/^\s+|\s+$/g,""),i)}finally{Mr.release(e)}}highlightText(t,e){$O.debug(`highlight menu text: ${t}`);const r=this.menu.content,i=(s,l)=>{if(!l)return s;let c="";const d=l.length,h=l.toLocaleLowerCase();let C=0;for(C=0;C<=s.length-d;C){let E=s.substring(C,C+d);if(E.toLocaleLowerCase()===h){C+=d;const x=s.charAt(C);let B=!1;E.endsWith(" ")&&(B=!0,E=E.trimEnd()),c+=`<span class="highlight">${E}${x===" "||B?" ":""}</span>`}else c+=s.charAt(C),C++}return C<s.length&&(c+=s.substring(C)),c},o=s=>{if(wt(s,"text")){const l=e==null?void 0:e.find(h=>h.id===s.getAttribute("data-id"));if(l&&l.element)return;const c=s.textContent;if(!c)return;const d=i(c,t);s.innerHTML=d;return}Array.from(s.children).forEach(o)};o(r)}}class sC{constructor(t,e){m(this,"root");m(this,"input");m(this,"text");m(this,"dropdownIcon");m(this,"clearIcon");m(this,"autoSuggest");m(this,"labels");m(this,"items",[]);m(this,"handleClick",()=>{this.autoSuggest.popup(this.root),this.input.focus()});m(this,"handleClickItem",(t,e)=>{var r,i;(i=(r=this.options)==null?void 0:r.onClickItem)==null||i.call(r,e)});m(this,"handleInput",()=>{this.autoSuggest.handleSearchText(this.input.value),this.updatePlaceholder()});m(this,"handleClear",t=>{var e,r;this.clear(),this.autoSuggest.handleSearchText(""),t.preventDefault(),t.stopPropagation(),(r=(e=this.options)==null?void 0:e.onClear)==null||r.call(e)});m(this,"handleQueryItems",async(t,e)=>this.items.filter(i=>{var o;return(o=this.options)!=null&&o.filter?this.options.filter(i,e):!0}));m(this,"handleShow",()=>{z(this.root,"active"),this.input.focus()});m(this,"handleClose",()=>{var t,e;(e=(t=this.options)==null?void 0:t.onClose)==null||e.call(t),ot(this.root,"active")});var c,d,h,C,E;this.options=e,this.labels=(d=(c=this.options)==null?void 0:c.labels)!=null?d:[];const{root:r,input:i,text:o,clearIcon:s,dropdownIcon:l}=sC.createDropdown(t,this.labels);this.root=r,this.input=i,this.text=o,this.clearIcon=s,this.dropdownIcon=l,this.autoSuggest=new xy({id:(e==null?void 0:e.popupId)||"dropdown-auto-suggest",header:(h=this.options)==null?void 0:h.header,onClickItem:this.handleClickItem,queryItems:this.handleQueryItems,onClose:this.handleClose,onShow:this.handleShow,highlight:e==null?void 0:e.highlight,emptyPlaceholder:e==null?void 0:e.emptyPlaceholder,disableSelectedScroll:e==null?void 0:e.disableSelectedScroll}),this.items=(E=(C=this.options)==null?void 0:C.items)!=null?E:[],this.root.addEventListener("click",this.handleClick),this.input.addEventListener("input",this.handleInput),this.clearIcon.addEventListener("click",this.handleClear)}close(){this.autoSuggest.close()}destroy(){this.input.removeEventListener("input",this.handleInput),this.root.removeEventListener("click",this.handleClick),this.clearIcon.removeEventListener("click",this.handleClear),this.autoSuggest.destroy()}updateItems(t){this.items=t,this.autoSuggest.handleSearchText("")}setText(t){this.text.innerText=t,this.input.value=t,this.updatePlaceholder()}clear(){this.setText(""),this.setLabels([])}setLabels(t){this.labels=t,this.updateLabels()}static createDropdown(t,e){const r=v("div",["editor-dropdown","empty"],t),i=v("input",["dropdown-input"],r),o=v("div",["dropdown-text"],r),s=v("div",["dropdown-labels"],r);for(let d=0;d<e.length;d+=1){const h=e[d];v("span",["dropdown-label"],s,h)}const l=v("div",["dropdown-clear-icon"],r);l.innerHTML=XT;const c=v("div",["dropdown-icon"],r);return c.innerHTML=Xh,{root:r,input:i,text:o,clearIcon:l,dropdownIcon:c}}updateLabels(){const t=this.root.querySelector(".dropdown-labels");if(t){t.innerHTML="";for(let e=0;e<this.labels.length;e+=1){const r=this.labels[e];v("span",["dropdown-label"],t,r)}}}updatePlaceholder(){var t;if(this.input.value===""){const e=(t=this.options)==null?void 0:t.placeholder;e&&(this.input.placeholder=e,this.text.textContent=e),z(this.root,"empty")}else ot(this.root,"empty")}}const HO=[-1,6,0,1,2,3,4,5],jO=[-1,6,0,1,2,3,4,5,14,13,7,8,9,10,11,12],Ay=I("color-palette");function by(n,t,e,r){p(Ay,n>0,"no color in palette");const i=t||1;p(Ay,i>0,`invalid palette rows: ${i}`);const o=n/i,s=v("div",["palette-container",r],null);for(let l=0;l<i;l++){const c=v("div",["palette-container-row"],s);for(let d=0;d<o;d++){const h=e(l*o+d);c.appendChild(h)}}return s}function zO(n){const t=v("button",["color-button"],null),e=HO[n];return t.setAttribute("data-color-index",`${e}`),t.innerHTML=Gp,t}function GO(n){const t=v("button",["background-color-button"],null),e=jO[n];return t.setAttribute("data-color-index",`${e}`),t}function WO(){const n=v("div",["clear-button-container"],null),t=v("button",["clear-button"],n);return t.innerText=D.t("colorPalette.reset"),n}function qO(n){const t=v("div",["color-palette"],null);return n.color!==!1&&(v("div",["bar-desc"],t,D.t("colorPalette.colorDesc")),t.appendChild(by(8,1,zO,"color"))),n.backgroundColor!==!1&&(v("div",["bar-desc"],t,D.t("colorPalette.backgroundDesc")),t.appendChild(by(16,2,GO,"background-color"))),n.clearColorButton!==!1&&t.appendChild(WO()),t}function XO(n,t,e){const r=t==="color"?"color":"background-color",i=n.querySelector(`.${r} button.selected`);i&&ot(i,"selected"),e===null&&(e=-1);const o=n.querySelector(`.${r} button[data-color-index="${e}"]`);o&&z(o,"selected")}const Vlt="",YO={};class QO extends ye.TypedEmitter{constructor(e=YO){super();m(this,"root");m(this,"handleClick",e=>{const r=e.target;if(!r||!(r instanceof Element))return;const i=r.closest("button");if(!i)return;if(wt(i,"clear-button")){this.setColor("backgroundColor",null),this.setColor("color",null),this.emit("onClick","clearColor",0);return}const o=i.getAttribute("data-color-index");if(!o)return;const s=Number.parseInt(o,10);Number.isNaN(s)||(wt(i,"color-button")?s===-1?(this.setColor("color",null),this.emit("onClick","clearColor",1)):(this.setColor("color",s),this.emit("onClick","color",s)):s===-1?(this.setColor("backgroundColor",null),this.emit("onClick","clearColor",2)):(this.setColor("backgroundColor",s),this.emit("onClick","backgroundColor",s)))});this.options=e,this.root=qO(e),this.root.addEventListener("click",this.handleClick)}destroy(){this.removeAllListeners(),this.root.removeEventListener("click",this.handleClick)}setColor(e,r){XO(this.root,e,r)}}class vy{constructor(t,e){m(this,"name","Color Palette");m(this,"element");m(this,"palette");m(this,"closeable",null);this.id=t,this.palette=new QO(e),this.element=this.palette.root}setCloseable(t){this.closeable=t}destroy(){this.palette.destroy(),this.closeable=null}}function JO(){const n=v("button",["color-button"],null);return n.innerHTML=Gp,n}function lC(n,t){const[e,r]=t;e===null?n.removeAttribute("data-color"):n.setAttribute("data-color",`${e}`),r===null?n.removeAttribute("data-background-color"):n.setAttribute("data-background-color",`${r}`)}class By extends ye.TypedEmitter{constructor(e){super();m(this,"id","text-color-item");m(this,"name",D.t("colorPalette.name"));m(this,"dropdown",!0);m(this,"manualShowChildren",!0);m(this,"children",[]);m(this,"element");m(this,"colorPaletteItem");m(this,"latestColors",[null,null]);m(this,"handlePaletteClick",(e,r)=>{this.emit("onClick",e,r)});m(this,"setLatestColors",(e,r)=>{e==="color"||e==="backgroundColor"?e==="color"?this.latestColors[0]=r:this.latestColors[1]=r:this.latestColors=[null,null],lC(this.element,this.latestColors)});m(this,"beforePopup",()=>{this.updatePaletteColor(this.latestColors),this.emit("beforePopup")});this.editor=e,this.colorPaletteItem=new vy("text-color-palette-item"),this.colorPaletteItem.palette.addListener("onClick",this.handlePaletteClick),this.children.push(this.colorPaletteItem),this.element=JO()}destroy(){this.colorPaletteItem.destroy()}updatePaletteColor(e){this.colorPaletteItem.palette.setColor("color",e[0]),this.colorPaletteItem.palette.setColor("backgroundColor",e[1]),this.latestColors=e,lC(this.element,this.latestColors)}updateButtonColor(e){this.latestColors=e,lC(this.element,this.latestColors)}}const $lt="";function c0(n,t){const e=v("div",["editor-input-wrap"],n);if(t!=null&&t.className&&z(e,t==null?void 0:t.className),t.label){const s=v("div",["editor-input-label"],e);v("span",[],s,t.label),t.required&&z(s,"required")}const r=v("div",["editor-input-container"],e),i=v("input",["editor-input"],null);if(t.placeholder&&(i.placeholder=t.placeholder),t.defaultValue&&(i.value=t.defaultValue),t.maxLength&&(i.maxLength=t.maxLength),t.maxLength){const s=v("div",["editor-input-suffix"],r);v("span",[],s,`${i.value.length} / ${t.maxLength}`),i.addEventListener("input",l=>{const c=l.target;s.innerText=`${c.value.length} / ${t.maxLength}`})}r.appendChild(i);const o=v("div",["editor-input-error"],e);return i.addEventListener("input",s=>{var l;(l=t.onChange)==null||l.call(t,s),ot(e,"error")}),Hd(i,(s,l)=>{var c;(c=t.onKeyDown)==null||c.call(t,s,l)}),{getField:()=>i,getInputValue:()=>i.value,setFieldError:s=>{z(e,"error"),o.innerText=s},focus:()=>{setTimeout(()=>{i.focus()})}}}function aC(n){const t=document.getSelection();if(!t)return!0;const e=t.focusNode;if(!e)return!0;const r=t.focusOffset,i=e.childNodes[r];if(!i)return!0;if(i instanceof HTMLElement){const o=i.tagName.toLowerCase();if(i===n.input.inputElement)return!0;if(o==="input"||o==="textarea")return!1}return!0}class ZO extends xy{constructor(e,r){super(r);m(this,"handleClose",()=>{var e,r;aC(this.editor)&&this.editor.focus(),(r=(e=this.options).onClose)==null||r.call(e)});this.editor=e,this.editorOptions=r}async popupInEditor(e,r,i){var d,h;if(((h=(d=this.editorOptions).onShow)==null?void 0:h.call(d,this,e,r,i))===!1)return;this.options.showLoading&&this.showLoading();const o=this.editor.getBlockByIndex(e,r);if(!re(this.editor.rootContainer,o)||dt(this.editor,o)<i)return;const s=Yi(this.editor,o,ve(this.editor,o,i));if(s.length===0)return;const l=s[0],c=Zi(this.editor,o,"editor-auto-suggest-menu",l);super.popup(c,{noEvent:!0})}}const cC=I("auto-suggest-menu");class uC{constructor(t,e){m(this,"order",100);m(this,"menu");m(this,"anchor",null);m(this,"close",()=>{this.menu.close()});m(this,"handleSelectionChanged",t=>{var r,i;if(!((r=this.menu)!=null&&r.isVisible))return;const e=t.selection.range.start;if(e.isSimple()&&e.blockId===((i=this.anchor)==null?void 0:i.blockId)&&e.offset>=this.anchor.offset){const o=t.getBlockById(e.blockId);if(de(Mn(yn(t,o),e.offset).left).startsWith(this.anchor.leftText))return}this.menu.close()});m(this,"deleteTrigger",()=>{const t=this.editor,e=t.selection.range.start;if(!e.isSimple()||!this.anchor)return!1;const{blockId:r,offset:i}=e,o=t.getBlockById(r),s=de(xh(t,o,i));if(p(cC,this.anchor,"no anchor"),!s.startsWith(this.anchor.leftText))return!1;const l=this.anchor.offset-this.anchor.trigger.length,c=i-l;return t.selection.selectBlock(o,l),c&&(t.deleteTextFromBlock(o,l,c),this.anchor.offset-=this.anchor.trigger.length),this.anchor.trigger.length||this.menu.close(),!0});m(this,"onClose",()=>{var t,e;(e=(t=this.options).onClose)==null||e.call(t)});m(this,"onShow",(t,e,r,i)=>{var o;if((o=this.options)!=null&&o.onShow)return this.options.onShow(this,e,r,i)});m(this,"onClickItem",(t,e)=>{!this.anchor||(this.options.autoDeleteTrigger&&this.deleteTrigger(),this.options.onClickItem(this,e,this.anchor))});m(this,"queryItems",(t,e)=>this.options.queryItems(this,e));m(this,"renderMenuItem",(t,e)=>{var i,o;return(o=(i=this.options).renderMenuItem)==null?void 0:o.call(i,this,e)});m(this,"hasExistsMenuThemeCommandBar",()=>!!document.querySelector('div.tippy-box[data-theme="menu"]'));this.editor=t,this.options=e,this.menu=new ZO(t,{id:e.id,showLoading:e.showLoading,loadingElement:e.loadingElement,placeholder:e.placeholder,header:e.header,footer:e.footer,wait:e.wait,noResultMessage:e.noResultMessage,highlight:e.highlight,onClose:this.onClose,onShow:this.onShow,onClickItem:this.onClickItem,queryItems:this.queryItems,renderMenuItem:this.renderMenuItem}),t.input.addHandler(this),t.addListener("selectionChanged",this.handleSelectionChanged)}handleBeforeKeyDown(t,e){var r;return!((r=this.menu)!=null&&r.isVisible)||Pg(e.key)?!1:ev(e)&&!qs(e)?(setTimeout(()=>{this.resetItems()}),!1):Gd(e)?(this.menu.close(),!0):(this.menu.handleKeydown(e),!0)}popup(t,e,r,i){this.anchor={blockId:lt(t),offset:e,leftText:r,trigger:i};const o=ct(it(t)),s=vt(t);this.menu.popupInEditor(o,s,e)}handleAfterInsertText(t,e,r,i,o){var h,C;const s=t.selection.range.start;if(!s.isSimple())return!1;const l=t.getBlockByIndex(e,r);if(qi(l))return!1;const{blockId:c,offset:d}=s;if(lt(l)!==c)return!1;if((h=this.menu)!=null&&h.isVisible)this.resetItems();else if(this.options.trigger.indexOf(o)!==-1){if(i>0&&this.options.needSpaceBeforeTrigger&&(((C=t.getBlockData(l).text)==null?void 0:C.reduce((k,w)=>k+w.insert,""))||"")[i-1].trim().length!==0||this.hasExistsMenuThemeCommandBar())return!1;const E=de(xh(t,l,d));this.popup(l,d,E,o)}return!1}handleUpdateCompositionText(t,e,r,i,o){var d;const s=t.selection.range.start;if(!s.isSimple())return!1;const{blockId:l}=s,c=t.getBlockByIndex(e,r);return lt(c)!==l||(d=this.menu)!=null&&d.isVisible&&this.resetItems(),!1}resetItems(){var l;if(!((l=this.menu)!=null&&l.isVisible))return;const t=this.editor,e=t.selection.range.start;if(!e.isSimple())return;const{blockId:r,offset:i}=e,o=t.getBlockById(r),s=de(xh(t,o,i));if(p(cC,this.anchor,"no anchor"),s.startsWith(this.anchor.leftText)){const c=s.substring(this.anchor.leftText.length);cC.debug(`search text: ${c}`),this.menu.handleSearchText(c)}}destroy(){var t;this.editor.input.removeHandler(this),this.editor.removeListener("selectionChanged",this.handleSelectionChanged),(t=this.menu)==null||t.destroy()}}function tN(){const n={};for(let t=1;t<=8;t++)n[`heading-${t}`]={shortcut:`/h${t}`};return n}const eN={"insert-hr":{shortcut:"/hr"},"insert-uml":{shortcut:"/uml"},"insert-table":{shortcut:"/table"},"insert-image":{shortcut:"/image"},"insert-code":{shortcut:"/code"},"insert-link":{shortcut:"/link"},"insert-drawio":{shortcut:"/uml"},"insert-video":{shortcut:"/video"},"insert-audio":{shortcut:"/audio"},"insert-math":{shortcut:"/math"},"insert-webPage":{shortcut:"/web"},"insert-bilibili":{shortcut:"/bilibili"},"insert-youku":{shortcut:"/youku"},"insert-figma":{shortcut:"/figma"},"insert-modao":{shortcut:"/modao"},"insert-tencent":{shortcut:"/tencent"},"insert-unordered":{shortcut:"/bl"},"insert-ordered":{shortcut:"/nu"},"insert-checkbox":{shortcut:"/todo"},"insert-quote":{shortcut:"/quote"},...tN()};function kn(n){var t;return(t=eN[n])==null?void 0:t.shortcut}function nN(n){var t;return(t=n.subText)!=null?t:""}const yi=I("table-dom");function ki(n){return`${lt(n)}_scroll`}function ze(n){const t=n.querySelector("div[data-type=table-content] >table");return p(yi,t instanceof HTMLTableElement,"invalid table"),t}function Ri(n,t){const r=n.getCustom(ki(t)).contentElement.firstElementChild;p(yi,r instanceof HTMLElement,"invalid table content");let i=r.querySelector(":scope >div[data-type=table-tools]");return i||(i=v("div",[],r),i.setAttribute("data-type","table-tools"),n.domEvents.addEventListener(i,"dblclick",(o,s)=>s.stopPropagation()),n.domEvents.addEventListener(i,"click",(o,s)=>{s.detail===3&&s.stopPropagation()})),p(yi,i,"no table tools"),i}function rN(n,t){return n.findCustom(ki(t))?Ri(n,t):null}function Ty(n){const t=[];return Array.from(n.rows).forEach(e=>{t.push(...Array.from(e.cells))}),t}function Gu(n){const t=n.querySelector(":scope div[data-type=editor-container]");return p(yi,t,"no child container in cell"),t}function iN(n){const r=Ty(n).map(i=>{const o=Gu(i),s=ct(o),l=i.colSpan,c=i.rowSpan;return`${s}/${l}/${c}`}).join();return Md.default(r)}function Ge(n){return Dt(n)==="table"}function fC(n){const t=it(n);if(qt(t))return null;const e=Z(t);return p(yi,e,"no parent block"),Ge(e)?t:fC(e)}function ho(n){if(Ge(n))return n;const t=it(n);if(qt(t))return null;const e=Z(t);return p(yi,e,"no parent block"),Ge(e)?e:ho(e)}function oN(n,t){const e=n.querySelector("colgroup");p(yi,e,"no colgroup");const r=e.children[t];return p(yi,r,"no col"),p(yi,r instanceof HTMLTableColElement,`invalid col: ${r.tagName}`),r}function yy(n){try{return ze(n),!0}catch{return!1}}function sN(n){return oe(n).querySelector(":scope > .block-helper")}function ky(n){const t=Z(n.contentElement);p(yi,t,"no block");const e=sN(t);if(e){const o=Math.min(n.contentElement.offsetLeft+29,n.rootElement.scrollLeft),s=t.getBoundingClientRect().width;e.style.right=`${o+s+5}px`}}function lN(n){const t=n.getComponentOptions("table"),e=t==null?void 0:t.bigTableBoundary;if(!e)return!1;const r=n.rootContainer.querySelectorAll("div[data-type=table-content] >table");let i=!1;return r.forEach(o=>{o.getBoundingClientRect().width>e&&(i=!0)}),i}const Xr=I("doc-table-grid");class aN{constructor(t){m(this,"_cells",[]);for(let e=0;e<t;e++)this._cells.push(void 0)}cols(){return this._cells.length}setCell(t,e){p(Xr,t>=0&&t<this.cols(),`set cell, invalid col: ${t}`),this._cells[t]=e}getCell(t){p(Xr,t>=0&&t<this.cols(),`get cell, invalid col: ${t}`);const e=this._cells[t];return p(Xr,e,"get cell, no cell"),e}getCellAllowEmpty(t){return p(Xr,t>=0&&t<this.cols(),`get cell, invalid col, ${t}`),this._cells[t]}getNextNonVirtualCell(t){return this._cells.slice(t+1).find(e=>!e.virtual)}forEach(t){this._cells.forEach(t)}}class u0{constructor(t){m(this,"_data");m(this,"_rows");this._data=t,this._rows=[];for(let e=0;e<this.rowCount;e++)this._rows.push(new aN(this.colCount));this.fillGrid()}get rowCount(){return this._data.rows}get colCount(){return this._data.cols}getNextEmptyCell(t,e){let r=t,i=e;for(;;){if(r+=1,r===this.colCount&&(r=0,i+=1),i>=this.rowCount)return null;if(this._rows[i].getCellAllowEmpty(r)===void 0)return{col:r,row:i}}}fillGrid(){const t=this._data.children;p(Xr,t,"no children");let e=0,r=0;t.forEach((i,o)=>{const s=this._data[`${i}_colSpan`]||1,l=this._data[`${i}_rowSpan`]||1;for(let d=0;d<l;d++)for(let h=0;h<s;h++)this._rows[r+d].setCell(e+h,{col:e,row:r,containerId:i,virtual:h!==0||d!==0,colSpan:s,rowSpan:l});const c=this.getNextEmptyCell(e,r);c?(e=c.col,r=c.row):p(Xr,o===t.length-1,`invalid table data, no next empty cell: ${JSON.stringify(this._data)}`)}),this._rows.forEach(i=>{i.forEach(o=>{p(Xr,o,"no cell"),p(Xr,o.containerId,"no containerId")})})}getCell(t){const{col:e,row:r}=t,i=this._rows[r];p(Xr,i,`get cell, no row: ${r}`);const o=i.getCell(e);return p(Xr,o,`get cell, no cell: ${e}`),o}getRow(t){const e=this._rows[t];return p(Xr,e,`get row, no row: ${t}`),e}forEach(t){this._rows.forEach(t)}}const f0=I("table-data");function cN(n){const t=n.firstElementChild;return p(f0,t,"no child element for cell"),p(f0,Xi(t),"cell first child is not a container"),p(f0,Fr(t),"cell first child is not a container"),t}function uN(n){const t=Z(n);p(f0,t,"no parent block for table");const e=[],r={};Array.from(n.rows).forEach(l=>{Array.from(l.cells).forEach(c=>{const d=cN(c),h=ct(d);e.push(h),(c.colSpan>1||c.rowSpan>1)&&(r[`${h}_colSpan`]=c.colSpan,r[`${h}_rowSpan`]=c.rowSpan)})});const i=n.rows.length,o=Array.from(n.rows[0].cells).map(l=>l.colSpan).reduce((l,c)=>l+c,0);return{id:lt(t),type:Dt(t),rows:i,cols:o,children:e,colsWidth:Array(o).fill(100),...r}}function dl(n){return new u0(n)}function fN(n){return dl(uN(n))}const Ze=I("table-grid"),dN=60;class hN{constructor(t,e){m(this,"containerId");m(this,"row");m(this,"col");m(this,"colSpan");m(this,"rowSpan");m(this,"virtual");m(this,"table");this.table=t,this.containerId=e.containerId,this.row=e.row,this.col=e.col,this.colSpan=e.colSpan,this.rowSpan=e.rowSpan,this.virtual=e.virtual}get cell(){const e=this.container.closest("td");return p(Ze,e,"no parent cell for child container"),e}get container(){const t=this.table.querySelectorAll(`[data-container-id=${this.containerId}]`);p(Ze,t.length===1,"containers !== 1"),p(Ze,Xi(t[0]),"not a container");const e=t[0];return p(Ze,Fr(e),"not a child container"),e}}class mN{constructor(t,e){m(this,"_cells",[]);e.forEach(r=>{this._cells.push(new hN(t,r))})}get cells(){return this._cells}getCell(t){return p(Ze,t<this._cells.length,"get cell, invalid col"),this._cells[t]}getNextNonVirtualCell(t){return this._cells.slice(t+1).find(e=>!e.virtual)}getSpannedCell(){return this._cells.find(t=>t.virtual||t.colSpan>1||t.rowSpan>1)}}const Sx=class{constructor(t){m(this,"_rows",[]);this.table=t,fN(t).forEach(i=>{this._rows.push(new mN(t,i))});const r=this.colCount;this._rows.forEach(i=>{p(Ze,i.cells.length===r,"row.cells.length !== colCount")})}get rowCount(){return this._rows.length}get colCount(){return this._rows.length===0?0:(p(Ze,this.rowCount>0,"rowCount <= 0"),this.getRow(0).cells.length)}getRow(t){return this._rows[t]}getCell(t){const e=this.getRow(t.row);return p(Ze,e,"no row"),e.getCell(t.col)}getCellContainer(t){return this.getCell(t).container}getFirstCellContainer(){return this.getCellContainer({row:0,col:0})}getLastCellContainer(){const t=this.rowCount-1,e=this.colCount-1;return this.getCellContainer({row:t,col:e})}getColumnCells(t){p(Ze,t>=0&&t<this.colCount,"colIndex out of range");const e=this.rowCount,r=[];for(let i=0;i<e;i++){const o=this.getCell({row:i,col:t});r.push(o)}return r}toRealCells(t){const e=[];return t.forEach(r=>{const i=this.getRealCell(r);e.findIndex(o=>o.containerId===i.containerId)===-1&&e.push(i)}),e}getColumnRealCells(t){const e=this.getColumnCells(t);return this.toRealCells(e)}getRowRealCells(t){const e=this.getRow(t).cells;return this.toRealCells(e)}getFirstSpannedCell(t){p(Ze,t>=0&&t<this.colCount,"colIndex out of range");const e=this.rowCount;for(let r=0;r<e;r++){const i=this.getCell({row:r,col:t});if(i.virtual||i.colSpan>1||i.rowSpan>1)return i}}getRealCell(t){const e=this.getCell(t);if(!e.virtual)return e;const r=this.getCellById(e.containerId);return p(Ze,!r.virtual,"found a virtual cell"),r}getColumnSpannedRange(t){const e=this.getColumnRealCells(t);let r=1e5,i=-1;return e.forEach(o=>{r=Math.min(o.col,r),i=Math.max(o.col+o.colSpan-1,i)}),p(Ze,r<=i,"min > max"),p(Ze,r>=0,"min < 0"),p(Ze,i<this.colCount,"max >= colCount"),[r,i]}getRowSpannedRange(t){const e=this.getRowRealCells(t);let r=1e5,i=-1;return e.forEach(o=>{r=Math.min(o.row,r),i=Math.max(o.row+o.rowSpan-1,i)}),p(Ze,r<=i,"min > max"),p(Ze,r>=0,"min < 0"),p(Ze,i<this.rowCount,"max >= rowCount"),[r,i]}getSpannedRange(t,e){const r=Math.min(t.row,e.row),i=Math.max(t.row,e.row),o=Math.min(t.col,e.col),s=Math.max(t.col,e.col),l=[];for(let x=r;x<=i;x++)for(let B=o;B<=s;B++)l.push(this.getCell({row:x,col:B}));const c=this.toRealCells(l);let d=1e4,h=1e4,C=-1,E=-1;return c.forEach(x=>{h=Math.min(x.col,h),d=Math.min(x.row,d),E=Math.max(x.col+x.colSpan-1,E),C=Math.max(x.row+x.rowSpan-1,C)}),[{row:d,col:h},{row:C,col:E}]}getAllCells(){return this.getCells({col:0,row:0},{col:this.colCount-1,row:this.rowCount-1})}sub(t,e){const r=[];for(let i=t.row;i<=e.row;i++){const o=[];for(let s=t.col;s<=e.col;s++){const l=this.getCell({row:i,col:s});o.push(l)}r.push(o)}return r}getAllContainers(){return this.getAllCells().map(e=>e.container)}getCells(t,e){const r=[],i=this.getSpannedRange(t,e),o=i[0],s=i[1],l=Math.min(o.row,s.row),c=Math.max(o.row,s.row),d=Math.min(o.col,s.col),h=Math.max(o.col,s.col);for(let C=l;C<=c;C++)for(let E=d;E<=h;E++){const x=this.getCell({row:C,col:E});x.virtual||r.push(x)}return r}map(t){const e=[];for(let r=0;r<this.rowCount;r++){const i=[];for(let o=0;o<this.colCount;o++){const s=this.getCell({row:r,col:o});i.push(t(s))}e.push(i)}return e}getBottomCell(t){const e=this.rowCount;let r=t,i=t.row;for(;r.containerId===t.containerId;){if(i+=1,i>=e)return null;r=this.getCell({row:i,col:t.col})}return this.getRealCell(r)}getTopCell(t){let e=t,r=t.row;for(;e.containerId===t.containerId;){if(r-=1,r<0)return null;e=this.getCell({row:r,col:t.col})}return this.getRealCell(e)}get cells(){let t=[];return this._rows.forEach(e=>{t=t.concat(e.cells)}),t}getVirtualCellContainersGrid(){return this.map(t=>t.containerId)}static virtualCellContainersGridToChildren(t){const e=t,r=[];return e.forEach(i=>{i.forEach(o=>{r.indexOf(o)===-1&&r.push(o)})}),r}getCellById(t){const r=this.cells.find(i=>i.containerId===t);return p(Ze,r,"cell not found"),r}getCellByCellElement(t){const e=Gu(t);return this.getCellByContainerId(ct(e))}getCellByContainerId(t){return this.getCellById(t)}static fromTable(t){const e=iN(t),r=this.caches.getSync(e,()=>(Ze.debug("create table grid"),new Sx(t)));return r.table!==t?(this.caches.delete(e),this.fromTable(t)):r}static fromBlock(t){return this.fromTable(ze(t))}};let Mt=Sx;m(Mt,"caches",new Nb(dN));function d0(n,t){Object.entries(n).forEach(([e])=>{e.startsWith(`${t}/`)&&delete n[e]})}const gN=I("table-selection-range");function Yr(n,t,e){var M,F,Y,X;const r=Mt.fromBlock(n),i=t,o=e,s=r.getCellByContainerId(i.childContainerId),l=r.getCellByContainerId(o.childContainerId),c=i.custom,d=o.custom,h=(M=c==null?void 0:c.rowIndex)!=null?M:s.row,C=(F=c==null?void 0:c.colIndex)!=null?F:s.col,E=(Y=d==null?void 0:d.rowIndex)!=null?Y:l.row+l.rowSpan-1,x=(X=d==null?void 0:d.colIndex)!=null?X:l.col+l.colSpan-1,B=Math.min(h,E),k=Math.max(h,E),w=Math.min(C,x),U=Math.max(C,x);return{fromRow:B,toRow:k,fromCol:w,toCol:U}}function dC(n,t){const e=new Set,r=new Set,i=n.selection.range;if(!i.isSimple()&&i.start.blockId===lt(t)){const o=Mt.fromBlock(t),{start:s,end:l}=i;p(gN,!s.isSimple()&&!l.isSimple(),"invalid range");const{fromCol:c,toCol:d,fromRow:h,toRow:C}=Yr(t,s,l);if(h===0&&C===o.rowCount-1)for(let E=c;E<=d;E++)r.add(E);if(c===0&&d===o.colCount-1)for(let E=h;E<=C;E++)e.add(E)}return{selectedRows:e,selectedColumns:r}}function Wu(n,t){let e=null;if(t.isCollapsed()&&t.isSimple()){const r=n.getBlockById(t.start.blockId);if(Ge(r)){const i=it(r),o=Z(i);o&&(e=ho(o))}else e=ho(r)}else{const r=n.getBlockById(t.start.blockId),i=ho(r),o=n.getBlockById(t.end.blockId),s=ho(o);i===s&&(e=i)}return e}const $a=I("delete-columns");function Ry(n,t,e){const{start:r,end:i}=e;if(r.blockId!==i.blockId||e.isSimple()||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{fromRow:s,toRow:l}=Yr(t,e.start,e.end),c=Mt.fromBlock(t);return s===0&&l===c.rowCount-1}function hC(n){const t=n.getEditor();t.undoManager.runInGroup(()=>{var F,Y;const e=t.getBlockById(n.start.blockId);if(!Ry(t,e,n))return;if(n.isSimple()){t.deleteBlock(e);return}const{fromCol:r,toCol:i}=Yr(e,n.start,n.end),o=Mt.fromBlock(e);if(r===0&&i===o.colCount-1){t.deleteBlock(e);return}const s=new Set,l=o.map(X=>X.containerId);for(let X=0;X<l.length;X++){const G=l[X];for(let st=r;st<=i;st++){const pt=G[st];s.add(pt)}G.splice(r,i-r+1)}const c=new Set(l.flat()),d=new Set(Array.from(s).filter(X=>!c.has(X))),h=i-r+1,C=new Map,E=new Map;s.forEach(X=>{if(d.has(X))return;const G=o.getCellByContainerId(X);if(p($a,G.colSpan>1,"invalid effected cell, colSpan === 1"),G.col<r){p($a,c.has(X),"invalid effected cell, not exists");let Gt=G.col+G.colSpan-1;Gt>i&&(Gt=i);const Pe=Gt-r+1,he=G.colSpan-Pe;C.set(X,he);return}p($a,G.col<=i,"invalid effected cell, col > endCol");const st=G.col,pt=G.col+G.colSpan-1,Ct=G.col-r,yt=pt-st+1-h+Ct;p($a,yt>0,"invalid effected cell, newSpanned <= 0");const bt=oo(t.doc);E.set(X,{newContainerId:bt,colSpan:yt})});for(let X=0;X<l.length;X++){const G=l[X];for(let st=r;st<G.length;st++){const pt=G[st],Ct=E.get(pt);Ct&&(G[st]=Ct.newContainerId)}}const x=mt.default(t.getBlockData(e));((F=x.colsWidth)!=null?F:new Array(x.cols).fill(0)).splice(r,i-r+1),d.forEach(X=>{d0(x,X)}),C.forEach((X,G)=>{p($a,X>=1,"invalid modified colSpan, colSpan < 1"),X===1?x[`${G}_colSpan`]=void 0:x[`${G}_colSpan`]=X}),E.forEach((X,G)=>{d0(x,G);const{newContainerId:st,colSpan:pt}=X;p($a,pt>=1,"invalid newContainerData, colSpan < 1"),pt>1&&(x[`${st}_colSpan`]=pt);const Ct=o.getCellByContainerId(G).rowSpan;Ct>1&&(x[`${st}_rowSpan`]=Ct)});const k=(Y=l[0][r])!=null?Y:l[0][r-1],w=t.getChildContainerData(k)[0],U=Mt.virtualCellContainersGridToChildren(l),M={...x,cols:x.cols-h,children:U};dl(M),t.updateBlockData(e,M,ve(t,w.id,0)),t.deleteChildContainers(Array.from(d)),t.deleteChildContainers(Array.from(E.keys()))})}const Ha=I("delete-rows");function wy(n,t,e){const{start:r,end:i}=e;if(r.blockId!==i.blockId||e.isSimple()||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{fromCol:s,toCol:l}=Yr(t,e.start,e.end),c=Mt.fromBlock(t);return s===0&&l===c.colCount-1}function mC(n){const t=n.getEditor();t.undoManager.runInGroup(()=>{const e=t.getBlockById(n.start.blockId);if(!wy(t,e,n))return;if(n.isSimple()){t.deleteBlock(e);return}const{fromRow:r,toRow:i}=Yr(e,n.start,n.end),o=Mt.fromBlock(e);if(r===0&&i===o.rowCount-1){t.deleteBlock(e);return}const s=new Set,l=o.map(M=>M.containerId);for(let M=i;M>=r;M--)l[M].forEach(Y=>s.add(Y)),l.splice(M,1);const c=new Set(l.flat()),d=new Set(Array.from(s).filter(M=>!c.has(M))),h=i-r+1,C=new Map,E=new Map;s.forEach(M=>{if(d.has(M))return;const F=o.getCellByContainerId(M);if(p(Ha,F.rowSpan>1,"invalid effected cell, rowSpan === 1"),F.row<r){p(Ha,c.has(M),"invalid effected cell, not exists");let Ct=F.row+F.rowSpan-1;Ct>i&&(Ct=i);const yt=Ct-r+1,bt=F.rowSpan-yt;C.set(M,bt);return}p(Ha,F.row<=i,"invalid effected cell, col > endCol");const Y=F.row,X=F.row+F.rowSpan-1,G=F.row-r,st=X-Y+1-h+G;p(Ha,st>0,"invalid effected cell, newSpanned <= 0");const pt=oo(t.doc);E.set(M,{newContainerId:pt,rowSpan:st})});for(let M=r;M<l.length;M++){const F=l[M];for(let Y=0;Y<F.length;Y++){const X=F[Y],G=E.get(X);G&&(F[Y]=G.newContainerId)}}const x=mt.default(t.getBlockData(e));d.forEach(M=>{d0(x,M)}),C.forEach((M,F)=>{p(Ha,M>=1,"invalid modified rowSpan, rowSpan < 1"),M===1?x[`${F}_rowSpan`]=void 0:x[`${F}_rowSpan`]=M}),E.forEach((M,F)=>{d0(x,F);const{newContainerId:Y,rowSpan:X}=M;p(Ha,X>=1,"invalid newContainerData, rowSpan < 1"),X>1&&(x[`${Y}_rowSpan`]=X);const G=o.getCellByContainerId(F).colSpan;G>1&&(x[`${Y}_colSpan`]=G)});const B=l[r]?l[r][0]:l[r-1][0],k=t.getChildContainerData(B)[0],w=Mt.virtualCellContainersGridToChildren(l),U={...x,rows:x.rows-h,children:w};dl(U),t.updateBlockData(e,U,ve(t,k.id,0)),t.deleteChildContainers(Array.from(d)),t.deleteChildContainers(Array.from(E.keys()))})}const qu=I("table-range");function h0(n){p(qu,!n.isSimple(),"must be complex selection range");const{anchor:t,focus:e}=n;p(qu,!t.isSimple(),"invalid start pos type"),p(qu,!e.isSimple(),"invalid end pos type");const r=n.getEditor();p(qu,t.blockId===e.blockId,"invalid range, not same block");const i=r.getBlockById(t.blockId);p(qu,Dt(i)==="table","invalid block type, not a table block");const o=ze(i),s=Mt.fromTable(o),l=s.getCellByContainerId(t.childContainerId),c=s.getCellByContainerId(e.childContainerId),d=Math.min(l.row,c.row),h=Math.max(l.row,c.row),C=Math.min(l.col,c.col),E=Math.max(l.col,c.col),x=s.getCell({row:d,col:C}),B=s.getCell({row:h,col:E});return{editor:r,block:i,table:o,startCell:x,endCell:B,startRow:d,startCol:C,endRow:h,endCol:E}}const gC=I("split-cell");function pC(n,t,e){n.undoManager.runInGroup(()=>{const r=Mt.fromBlock(t),i=r.getRealCell(e);p(gC,!i.virtual,"should not split virtual cell"),p(gC,i.colSpan>1||i.rowSpan>1,"cell does not has span data");const o=r.getVirtualCellContainersGrid();for(let C=0;C<i.rowSpan;C++)for(let E=0;E<i.colSpan;E++){if(C===0&&E===0)continue;const x=C+i.row,B=E+i.col,k=oo(n.doc);o[x][B]=k}const s=n.getBlockData(t),l=mt.default(s);l[`${i.containerId}_colSpan`]=null,l[`${i.containerId}_rowSpan`]=null,l.children=Mt.virtualCellContainersGridToChildren(o);const d=n.getChildContainerData(i.containerId)[0];p(gC,d,"no child block");const h=ve(n,d.id,0);dl(l),n.updateBlockData(t,l,h)})}function pN(n,t,e){e.forEach(r=>{const i=Mt.fromBlock(t).getCell(r);(i.virtual||i.colSpan>1||i.rowSpan>1)&&pC(n,t,r)})}function Sy(n,t,e){if(e.isSimple())return!1;const{start:r,end:i}=e;if(r.blockId!==i.blockId||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{startCell:s,endCell:l}=h0(e);return!(s.cell!==l.cell||s.colSpan===1&&s.rowSpan===1)}function CC(n){const{editor:t,block:e,startRow:r,startCol:i,endRow:o,endCol:s}=h0(n),l=[];for(let c=r;c<=o;c++)for(let d=i;d<=s;d++)l.push({row:c,col:d});return pN(t,e,l),!0}const ja=I("merge-cells");function Ly(n,t,e){if(e.isSimple())return!1;const{start:r,end:i}=e;if(r.blockId!==i.blockId||n.getBlockById(r.blockId)!==t||Dt(t)!=="table")return!1;const{startCell:s,endCell:l}=h0(e);return s.cell!==l.cell}function Iy(n){const t=h0(n),e=t.editor;e.undoManager.runInGroup(()=>{const r=t.endCell,i=r.row+r.rowSpan-1,o=r.col+r.colSpan-1,s=lt(t.block);CC(n);const l=e.getBlockById(s),c=ze(l),{startRow:d,startCol:h}=t,C=mt.default(e.getBlockData(l));p(ja,C.children,"no table children");const E=Mt.fromTable(c),x=[];for(let Ct=d;Ct<=i;Ct++)for(let yt=h;yt<=o;yt++){const bt=E.getCell({row:Ct,col:yt});p(ja,!bt.virtual,"cell is virtual"),x.push(bt)}p(ja,x.length>0,"no selected cells");const B=x[0],k=x.slice(1),w=E.getCellByContainerId(B.containerId).container,U=[];k.forEach(Ct=>{const yt=E.getCellByContainerId(Ct.containerId).container,bt=ct(yt);if(!fu(e,yt)){const Gt=H5(e,bt);if(fu(e,w)){const Pe=fe(w)[0];e.insertDocAt(w,0,Gt),e.deleteBlock(Pe)}else e.insertDocAt(w,Or(w),Gt)}U.push(bt)});const M=ct(w),F=o-h+1,Y=i-d+1;C[`${M}_colSpan`]=F,C[`${M}_rowSpan`]=Y,U.forEach(Ct=>{p(ja,C.children,"no table children");const yt=C.children.indexOf(Ct);p(ja,yt>0,"no deleted container"),C.children.splice(yt,1)});const X=C,st=e.getChildContainerData(M)[0];p(ja,st,"no child block");const pt=ve(e,st.id,0);dl(X),e.updateBlockData(l,X,pt),e.deleteChildContainers(U)})}const EC=10,CN=["table/merge-cells","table/split-cell","table/insert-column","table/insert-row","table/delete-rows","table/delete-columns","table/delete"];class m0{constructor(){m(this,"id","TableBlockCommandProvider")}getAvailableCommands(t,e,r){if(Dt(e)!=="table")return[];const i={blockId:lt(e),blockKind:Nr(t,e),blockType:Dt(e)},o=[];Ly(t,e,r)&&o.push({id:"table/merge-cells",name:D.t("table.mergeCell"),icon:gT,groupIndex:EC,...i}),Sy(t,e,r)&&o.push({id:"table/split-cell",name:D.t("table.splitCell"),icon:pT,groupIndex:EC,...i});const s=Ry(t,e,r),l=wy(t,e,r);return s&&l&&o.push({id:"table/delete",name:D.t("table.deleteTable"),icon:CT,groupIndex:EC,...i}),o}executeCommand(t,e,r,i,o,s){return Dt(e)!=="table"||!new Set(CN).has(i.id)?!1:i.id==="table/merge-cells"?(Iy(r),!0):i.id==="table/split-cell"?(CC(r),!0):i.id==="table/delete-columns"?(hC(r),!0):i.id==="table/delete-rows"?(mC(r),!0):i.id==="table/delete"?(t.deleteBlock(e),!0):!1}}var Dy=(n=>(n.COL_TITLE_TABLE="col-title-table",n.COL_TITLE_ITEM="col-title-item",n.STRIPE_STYLE_TABLE="stripe-style-table",n.NO_BORDER="table-no-border",n))(Dy||{});const za=6,Xu=20,xC="table-cell-menu-btn";function EN(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasColTitle:!0};n.updateBlockData(t,r)}function xN(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasColTitle:!1};n.updateBlockData(t,r)}function AN(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasRowTitle:!0};n.updateBlockData(t,r)}function bN(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),hasRowTitle:!1};n.updateBlockData(t,r)}function vN(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),isStripeStyle:!0};n.updateBlockData(t,r)}function BN(n,t){if(!n.isBlockWritable(t))return;const r={...mt.default(n.getBlockData(t)),isStripeStyle:!1};n.updateBlockData(t,r)}function TN(n,t,e){if(!n.isBlockWritable(t))return;const i={...mt.default(n.getBlockData(t)),noBorder:!e};n.updateBlockData(t,i)}const hl=I("table-cell-dom");function yN(n,t,e){let r=n.getBlockById(e);for(;r;){const i=r.closest("td");p(hl,i,"no parent cell");const o=Z(i);if(p(hl,o,"no parent block"),o===t)return i;r=o}return p(hl,!1,"filed to get cell by child block id"),null}function as(n,t,e){if(n.getBlockById(e.blockId)===t&&!e.isSimple())return p(hl,e.childContainerId,"block position must have childContainerId attribute"),e;const i=yN(n,t,e.blockId),o=ct(Gu(i));return xe(t,o)}function AC(n,t){const e=n.selection.range,r=as(n,t,e.start),i=as(n,t,e.end);return Yr(t,r,i)}function _y(n,t,e,r){p(hl,Ge(t),"invalid table block");const i=Ri(n,t),o=oe(t),s=()=>{const c=i.querySelector(".table-border-bar-container.top");p(hl,c,"no top border bar container"),c.querySelectorAll(".table-border-bar-cell.top").forEach(h=>{const C=parseInt(h.getAttribute("data-top-index")||"0",10);r.includes(C)?z(h,"danger"):ot(h,"danger")})},l=()=>{const c=o.querySelector(".table-border-bar-container.left");p(hl,c,"no left border bar container"),c.querySelectorAll(".table-border-bar-cell.left").forEach(h=>{const C=parseInt(h.getAttribute("data-left-index")||"0",10);e.includes(C)?z(h,"danger"):ot(h,"danger")})};s(),l()}function cs(n,t,e=!0,r){const o=Mt.fromBlock(t).map(h=>h),{fromCol:s,toCol:l,fromRow:c,toRow:d}=AC(n,t);for(let h=0;h<o.length;h++){const C=o[h];for(let E=0;E<C.length;E++){const x=C[E],B=r?E>=s&&E+x.colSpan-1<=l:h>=c&&h+x.rowSpan-1<=d;e&&B?x.virtual||z(x.cell,"danger"):x.virtual||ot(x.cell,"danger")}}}function us(n,t,e=!0,r){const i=new Set,o=new Set;if(!e){_y(n,t,Array.from(i),Array.from(o));return}const{fromCol:s,toCol:l,fromRow:c,toRow:d}=AC(n,t);if(r)for(let h=s;h<=l;h++)o.add(h);else for(let h=c;h<=d;h++)i.add(h);_y(n,t,Array.from(i),Array.from(o))}function My(n,t,e){const{fromCol:r,toCol:i,fromRow:o,toRow:s}=AC(n,t),l=Mt.fromBlock(t);let c=null,d=null;return e?(c=l.getCell({col:r,row:0}),d=l.getCell({col:i,row:l.rowCount-1}),Qe(n,{anchor:xe(t,c.containerId,{colIndex:r,rowIndex:0}),focus:xe(t,d.containerId,{colIndex:i,rowIndex:l.rowCount-1})})):(c=l.getCell({col:0,row:o}),d=l.getCell({col:l.colCount-1,row:s}),Qe(n,{anchor:xe(t,c.containerId,{colIndex:0,rowIndex:o}),focus:xe(t,d.containerId,{colIndex:l.colCount-1,rowIndex:s})}))}const Uy=["style-bg-color-0","style-bg-color-1","style-bg-color-2","style-bg-color-3","style-bg-color-4","style-bg-color-5","style-bg-color-6","style-bg-color-7","style-bg-color-8","style-bg-color-9","style-bg-color-10","style-bg-color-11","style-bg-color-12","style-bg-color-13"];function Oy(n){return`style-bg-color-${n}`}function Yu(n){return`${n}_background`}function kN(n,t,e){const r=ze(n),s=(e!=null?e:Mt.fromTable(r)).getCell(t).cell;for(let l=0;l<Uy.length;l++){const c=Uy[l];if(wt(s,c))return c}}function Ny(n,t,e){if(!n.isBlockWritable(t))return;const r=n.selection.range,o={...mt.default(n.getBlockData(t))},s=as(n,t,r.start),l=as(n,t,r.end);if(r.isSimple()){const c=s.childContainerId;e===-1?o[Yu(c)]=void 0:o[Yu(c)]=Oy(e)}else{const c=Mt.fromBlock(t),d=Yr(t,s,l),h=new Set;for(let C=d.fromRow;C<=d.toRow;C++)for(let E=d.fromCol;E<=d.toCol;E++){const x=c.getCell({row:C,col:E});!h.has(x.containerId)&&x.col>=d.fromCol&&x.row>=d.fromRow&&x.col+x.colSpan-1<=d.toCol&&x.row+x.rowSpan-1<=d.toRow&&(h.add(x.containerId),e===-1?o[Yu(x.containerId)]=void 0:o[Yu(x.containerId)]=Oy(e))}}n.updateBlockData(t,o)}function RN(n,t,e){if(!n.isBlockWritable(t))return;const i={...mt.default(n.getBlockData(t)),chart:e};n.updateBlockData(t,i)}const Py=I("table-chart");function wN(n,t){const e=rN(n,t);if(e){const r=e.querySelector(".editor-table-chart");if(r){const i=r.chartObject;i&&i.destroy(),r.remove()}}}async function SN(n,t){if(!n.contains(t)||!n.isBlockWritable(t))return;if(!!!n.getBlockData(t).chart){wN(n,t);return}const i=[],o=Mt.fromBlock(t),s=["line","bar","pie","radar"];let l=o.getCell({row:0,col:0}).container.innerText.trim().toLowerCase();new Set(s).has(l)||(l=s[0]);const c=[];for(let k=1;k<o.colCount;k++)c.push(o.getCell({row:0,col:k}).container.innerText);for(let k=1;k<o.rowCount;k++){const w=o.getCell({row:k,col:0}),M=w.container.innerText,F=[];for(let Gt=1;Gt<o.colCount;Gt++){const Pe=o.getCell({row:k,col:Gt}).container.innerText,he=Number.parseFloat(Pe)||0;F.push(he)}let Y;const X=kN(t,w,o);X?Y=window.getComputedStyle(n.rootElement).getPropertyValue(`--${X}`).trim():Y=window.getComputedStyle(n.rootElement).getPropertyValue("--background-color").trim();let[G,st,pt,Ct]=Y?Bg.fromString(Y).toRgbaArray():[];if(!G&&!st&&!pt&&!Ct){const Gt=(k-1)%n.options.colors.length;Y=n.options.colors[Gt],[G,st,pt,Ct]=Bg.fromString(Y).toRgbaArray()}const yt=Y,bt=Bg.fromRgba([G,st,pt,Ct/3]).toHexString();i.push({label:M,data:F,borderColor:yt,backgroundColor:bt,borderWidth:2})}const d=Ri(n,t);let h=null,C=d.querySelector(".editor-table-chart");C?h=C.chartObject:C=v("div",["editor-table-chart"],d);const E=C;p(Py,E,"no chart container");const x=n.getComponentOptions("table"),B=(x==null?void 0:x.chartCdn)||"https://cdn.jsdelivr.net/npm/chart.js@2.9.4/dist/Chart.min.js";try{await zs(B,"editor-chartjs");let k=!1;(h&&h.config.data.datasets.length>i.length||h&&h.config.data.datasets[0].data.length>i[0].data.length)&&(k=!0),h&&(l!==h.config.type||k)&&(h.destroy(),h=null,Array.from(C.querySelectorAll(".editor-chartjs-canvas")).forEach(M=>{M.remove()}));const w=yg.default({},{type:l,data:{datasets:i,labels:c},options:{onClick:()=>{n.selection.selectBlock(t,0,0)}}});if(h)yg.default(h.config,w),h.update();else{const M=v("canvas",["editor-chartjs-canvas"],E).getContext("2d");h=new window.Chart(M,w),C.chartObject=h}}catch(k){Py.error(`failed to resolve chart cdn: ${JSON.stringify(k)}`)}}async function Fy(n,t){await Mr.lock("updateTableChart");try{await SN(n,t)}finally{Mr.release("updateTableChart")}}const Ky=ke.default(Fy,1e3);let Vy=null;function bC(n,t,e){if(Vy!==t&&(Ky.flush(),Vy=t),e.updateNow){Fy(n,t);return}Ky(n,t)}function vC(n,t,e){e&&Ge(e)&&bC(n,e,{updateNow:!1})}function LN(n,t){Ge(t)&&bC(n,t,{updateNow:!0})}const vr={SCROLL:"container-scroll-tool",COMMON:"container-border-shadow",RIGHT:"container-right-border-shadow",LEFT:"container-left-border-shadow",LAYOUT_SIGN:"container-layout-border-shadow",ACTIVE:"active"},g0={SCROLL_BAR:"container-scrollbar",FIXED:"fixed"},fs={SCROLL_CONTAINER:"scroll-container",TOOL:"container-scroll-tool",CONTAINER:"scroll-container-root",MAC:"mac",SCROLL_AREA:"scroll-area"};function Qu(n,t){return n.containers.get(t)}function $y(n){return n.closest(`.${fs.SCROLL_CONTAINER}`)}function Qr(n){return n.firstElementChild}function Rn(n){return n.closest(`.${fs.CONTAINER}`)}function Ju(n){const t=Rn(n);let e=t.querySelector(`:scope >.${fs.TOOL}`);return e||(e=v("div",[fs.TOOL],t)),e}function IN(n){return Rn(n).firstElementChild}function DN(n,t){const e=Qu(n,Rn(t));return e!=null&&e.barFloatWindowBottom?typeof e.barFloatWindowBottom=="function"?e.barFloatWindowBottom():e.barFloatWindowBottom:0}function Br(n,t){const e=dr(n);return t/e}function Zu(n){const t=window.getComputedStyle(n),e=dr(n);return{paddingBottom:parseFloat(t.paddingBottom)*e,paddingTop:parseFloat(t.paddingTop)*e,paddingLeft:parseFloat(t.paddingLeft)*e,paddingRight:parseFloat(t.paddingRight)*e}}function Ga(n){const t=dr(n);return{scrollLeft:n.scrollLeft*t,scrollWidth:n.scrollWidth*t,clientWidth:n.clientWidth*t,clientHeight:n.clientHeight*t}}function _N(n,t){const e=dr(n);return n[t]*e}function BC(n,t){const e=Rn(t),r=Qu(n,e),i=(r==null?void 0:r.safeRightSpace)||0,o=(r==null?void 0:r.safeLeftSpace)||0,l=(r==null?void 0:r.locatingContainer).getBoundingClientRect(),c=e.getBoundingClientRect(),d=c.width;let h=Math.floor(c.left-l.left-o);h<0&&(h=0);let C=l.right;C-=i;let E=C-c.right;return E<0&&(E=0),h=Math.round(h),E=Math.round(E),{originWidth:d,maxLeft:h,maxRight:E}}function MN(n,t){const e=BC(n,t),{maxLeft:r}=e;t.style.marginLeft=`${Br(t,0-r)}px`,t.style.paddingLeft=`${Br(t,r)}px`}function UN(n,t){const e=BC(n,t);t.style.marginRight=`${Br(t,0-e.maxRight)}px`}function ON(n){if(n!==document.documentElement&&n!==document.body)return n.getBoundingClientRect();const t=0,e=0,r=document.documentElement.clientWidth,i=document.documentElement.clientHeight;return new DOMRect(t,e,r,i)}const Hy=I("scroll-bar-handle"),NN=2;function Wa(n){const t=Ju(n);let e=t.querySelector(`.${g0.SCROLL_BAR}`);return e||(e=v("div",[g0.SCROLL_BAR],t)),p(Hy,e instanceof HTMLDivElement,"invalid child for container tools"),e.firstElementChild||v("div",[],e),e}function p0(n,t){const e=$y(t),r=Wa(e),{scrollWidth:i,clientWidth:o}=Ga(e),{paddingLeft:s,paddingRight:l}=Zu(t),c=BC(n,e),{originWidth:d,maxRight:h}=c;UN(n,e),MN(n,e);const C=i-o;p(Hy,r.firstElementChild instanceof HTMLDivElement,"invalid child for scroll bar"),r.style.width=`${Br(e,d+h-s-l)}px`,r.firstElementChild.style.width=`${Br(e,d+h+C-s-l)}px`}function PN(n,t){const e=Qr(n),{paddingLeft:r}=Zu(e);if(wt(t,"fixed")){const o=Rn(n).getBoundingClientRect();t.style.left=`${Br(n,o.left+r)}px`}else t.style.left=`${Br(n,r)}px`}function qa(n,t){var M;const e=n.getParentScrollContainer(),r=ON(e),i=t.getBoundingClientRect(),o=Wa(t),s=o.getBoundingClientRect(),l=Qu(n,Rn(t)),c=DN(n,t),d=Qr(t),{paddingTop:h,paddingBottom:C}=Zu(d),{scrollWidth:E,clientWidth:x}=Ga(t),B=document.documentElement.clientHeight-c,k=r.top+Ga(e).clientHeight-B,w=B+Math.min(0,k);if(E>x&&i.top+h<w-s.height&&i.bottom>w-s.height+C&&!((M=l==null?void 0:l.isSetScale)!=null&&M.call(l))){l!=null&&l.allowScrollBarFixed&&z(o,g0.FIXED);const F=k>0?c:0;o.style.bottom=`${Math.max(document.documentElement.clientHeight-r.bottom,0)+NN+F}px`}else ot(o,g0.FIXED),o.style.bottom=`${Br(t,C-s.height)}px`;PN(t,o)}class FN{constructor(t,e){m(this,"intersectionObserver");m(this,"handleIntersection",t=>{t.forEach(e=>{this.containers.get(Rn(e.target))?(this.handleIntersectionEntry(e),this.callback(e)):this.intersectionObserver.unobserve(e.target)})});m(this,"handleIntersectionEntry",t=>{const e=t.target;qa(this.scrollCore,e);const r=Qr(e);p0(this.scrollCore,r)});this.scrollCore=t,this.callback=e;const i={root:this.scrollCore.getParentScrollContainer(),rootMargin:"20px",threshold:0};this.intersectionObserver=new IntersectionObserver(this.handleIntersection,i)}get containers(){return this.scrollCore.containers}bind(t){this.unbind(t),this.intersectionObserver.observe(t)}unbind(t){this.intersectionObserver.unobserve(t)}destroy(){this.intersectionObserver.disconnect()}}const ml=I("container-scroll-shadow");function jy(n,t,e){const r=n,i=t.getBoundingClientRect(),o=e.getBoundingClientRect(),{paddingTop:s,paddingBottom:l}=Zu(e);r.style.top=`${Br(t,o.top-i.top+s)}px`,r.style.bottom=`${Br(t,i.bottom-o.bottom+l)}px`}function zy(n,t){const e=n;t<24?e.style.width=`${(t/3).toFixed(2)}px`:e.style.width=""}function KN(n){const t=Ju(n);p(ml,t,"no container tools");let e=t.querySelector(`.${vr.LEFT}`);if(!e){const l=Qr(n),c=[vr.COMMON,vr.LEFT];e=v("div",c,t),p(ml,e instanceof HTMLDivElement,"invalid child for container tools"),jy(e,n,l)}p(ml,e instanceof HTMLElement,"invalid child for container tools");const i=Rn(n).getBoundingClientRect(),o=n.getBoundingClientRect();e.style.left=`${Br(n,o.left-i.left)}px`;const s=Ga(n).scrollLeft;p(ml,e instanceof HTMLDivElement,"invalid child for container tools"),zy(e,s),z(e,vr.ACTIVE)}function VN(n){const t=Ju(n);let e=t.querySelector(`.${vr.RIGHT}`);if(!e){const h=Qr(n),C=[vr.COMMON,vr.RIGHT];e=v("div",C,t),p(ml,e instanceof HTMLDivElement,"no div, create shadow failed"),jy(e,n,h)}p(ml,e instanceof HTMLElement,"");const i=Rn(n).getBoundingClientRect(),o=n.getBoundingClientRect();e.style.right=`${Br(n,i.right-o.right)}px`;const{scrollWidth:s,scrollLeft:l,clientWidth:c}=Ga(n),d=s-l-c;p(ml,e instanceof HTMLDivElement,"no shadow element"),zy(e,d),z(e,vr.ACTIVE)}function $N(n){const e=Ju(n).querySelector(`.${vr.LEFT}`);e&&ot(e,vr.ACTIVE)}function HN(n){const e=Ju(n).querySelector(`.${vr.RIGHT}`);e&&ot(e,vr.ACTIVE)}function tf(n){const{scrollLeft:t,scrollWidth:e,clientWidth:r}=Ga(n),i=Qr(n),{paddingLeft:o,paddingRight:s}=Zu(i),l=_N(i,"offsetLeft");e-o<=r-s||e-o<=t+r-s?HN(n):VN(n),i&&t>=l+o?KN(n):$N(n)}class jN{constructor(t,e){m(this,"resizeObserver");m(this,"handleResizeEntry",t=>{const e=t.target,r=Qr(e);tf(e),p0(this.scrollCore,r),qa(this.scrollCore,e),this.callback(e)});m(this,"handleContentResize",t=>{t.forEach(e=>{this.containers.get(Rn(e.target))?this.handleResizeEntry(e):this.unbind(e.target)})});this.scrollCore=t,this.callback=e,this.resizeObserver=new Vs(this.handleContentResize)}get containers(){return this.scrollCore.containers}bind(t){this.unbind(t),this.resizeObserver.observe(t)}unbind(t){this.resizeObserver.unobserve(t)}destroy(){this.resizeObserver.disconnect()}}const Gy=I("container-scroll-observer");class zN{constructor(t,e){m(this,"handleContentScroll",t=>{const e=t.target;p(Gy,e instanceof Element,"invalid target for scroll event");const r=Wa(e);r.removeEventListener("scroll",this.handleScroll);const i=!0;this.fixScrollXPos(e,e.scrollLeft,i),this.bind(r),tf(e),this.callback(e)});m(this,"handleScroll",t=>{const e=t.target;p(Gy,e instanceof HTMLElement,"");const r=e.scrollLeft,i=!1,o=IN(e);this.unbindContentScroll(o),this.fixScrollXPos(o,r,i),this.bindContentScroll(o),tf(o),this.callback(o)});m(this,"handlePrevent",t=>{t.stopPropagation()});m(this,"bindContentScrollCore",t=>{this.unbindContentScroll(t),t.addEventListener("scroll",this.handleContentScroll)});m(this,"unbindContentScroll",t=>{t.removeEventListener("scroll",this.handleContentScroll)});m(this,"bindContentScroll",ke.default(this.bindContentScrollCore,300));m(this,"bind",ke.default(this.bindCore,200));this.scrollCore=t,this.callback=e}fixScrollXPos(t,e,r){const i=Wa(t);r||(t.scrollLeft=e),r&&i.scrollLeft!==e&&(i.scrollLeft=e)}bindCore(t){this.unbind(t),t.addEventListener("scroll",this.handleScroll),t.addEventListener("mousedown",this.handlePrevent)}unbind(t){t.removeEventListener("scroll",this.handleScroll),t.removeEventListener("mousedown",this.handlePrevent)}}class GN{constructor(t){m(this,"scrollContainers",new Set);m(this,"handleParentContainerScroll",()=>{this.scrollContainers.forEach(t=>{qa(this.scrollCore,t)})});m(this,"bindScrollContainer",t=>{const e=this.scrollContainers.size===0;this.scrollContainers.add(t),e&&this.eventTarget.addEventListener("scroll",this.handleParentContainerScroll)});m(this,"unbindScrollContainer",t=>{let e=!1;this.scrollContainers.has(t)&&(this.scrollContainers.delete(t),e=this.scrollContainers.size===0),e&&this.eventTarget.removeEventListener("scroll",this.handleParentContainerScroll)});this.scrollCore=t}get eventTarget(){const t=this.scrollCore.getParentScrollContainer();return t===document.documentElement?document:t}destroy(){this.eventTarget.removeEventListener("scroll",this.handleParentContainerScroll),this.scrollContainers.clear()}}const WN=I("scroll-wrap-resize-observer");class qN{constructor(t){m(this,"resizeObserver");m(this,"handleScrollWrapResize",t=>{t.forEach(e=>{this.containers.get(Rn(e.target))?this.handleScrollWrapResizeEntry(e):this.unbind(e.target)})});m(this,"handleScrollWrapResizeEntry",t=>{const e=t.target;p(WN,e instanceof HTMLElement,"invalid target for observer entry");const r=$y(e);p0(this.scrollCore,e),tf(r),qa(this.scrollCore,r)});this.scrollCore=t,this.resizeObserver=new Vs(this.handleScrollWrapResize)}get containers(){return this.scrollCore.containers}bind(t){this.unbind(t),this.resizeObserver.observe(t)}unbind(t){this.resizeObserver.unobserve(t)}destroy(){this.resizeObserver.disconnect()}}class XN{constructor(t,e){m(this,"resizeObserver");m(this,"scrollContainersMap",new Map);m(this,"handleResizeEntry",t=>{t==null||t.forEach(e=>{const r=Qr(e);tf(e),p0(this.scrollCore,r),qa(this.scrollCore,e),this.callback(e)})});m(this,"handleResize",t=>{t.forEach(e=>{const r=this.scrollContainersMap.get(e.target);r!=null&&r.length&&this.handleResizeEntry(r)})});this.scrollCore=t,this.callback=e,this.resizeObserver=new Vs(this.handleResize)}bind(t){var i,o;const e=Rn(t),r=(i=Qu(this.scrollCore,e))==null?void 0:i.locatingContainer;this.scrollContainersMap.has(r)?(o=this.scrollContainersMap.get(r))==null||o.push(t):(this.scrollContainersMap.set(r,[t]),this.resizeObserver.observe(r))}unbind(t){var o,s;const e=Rn(t),r=(o=Qu(this.scrollCore,e))==null?void 0:o.locatingContainer;if(!r)return;const i=this.scrollContainersMap.get(r);this.scrollContainersMap.set(r,(i==null?void 0:i.filter(l=>l!==t))||[]),(s=this.scrollContainersMap.get(r))!=null&&s.length||(this.resizeObserver.unobserve(r),this.scrollContainersMap.delete(r))}destroy(){this.scrollContainersMap.clear(),this.resizeObserver.disconnect()}}const Hlt="";class YN extends ye.TypedEmitter{constructor(e){super();m(this,"containerIntersectionObserver",null);m(this,"containerResizeObserver",null);m(this,"containerScrollObserver",null);m(this,"parentContainerScrollObserver",null);m(this,"scrollWrapResizeObserve",null);m(this,"locatingContainerResizeObserver",null);m(this,"isWindowEventBind",!1);m(this,"containers",new Map);m(this,"handleScrollContainerScroll",e=>{this.emit("scroll",this,e)});m(this,"handleResize",e=>{this.emit("resize",this,e)});m(this,"handleIntersection",e=>{const r=e.target,i=Qr(r);e.isIntersecting?(this.load(),this.bindCore(r,i)):this.unbindCore(r,i)});m(this,"handleWindowEffect",()=>{var e;(e=this.getScrollContainerInViewable())==null||e.forEach(r=>{qa(this,r)})});this.parentContainer=e}load(){this.containerResizeObserver||(this.containerResizeObserver=new jN(this,this.handleResize)),this.containerScrollObserver||(this.containerScrollObserver=new zN(this,this.handleScrollContainerScroll)),this.parentContainerScrollObserver||(this.parentContainerScrollObserver=new GN(this)),this.scrollWrapResizeObserve||(this.scrollWrapResizeObserve=new qN(this)),this.locatingContainerResizeObserver||(this.locatingContainerResizeObserver=new XN(this,this.handleResize)),this.isWindowEventBind||(window.addEventListener("resize",this.handleWindowEffect),this.getParentScrollContainer()!==document.documentElement&&window.addEventListener("scroll",this.handleWindowEffect))}getParentScrollContainer(){return this.parentContainer}getScrollContainerInViewable(){var e;return(e=this.parentContainerScrollObserver)==null?void 0:e.scrollContainers}unbindCore(e,r){var o,s,l,c,d,h;const i=Wa(e);(o=this.containerScrollObserver)==null||o.unbindContentScroll(e),(s=this.containerScrollObserver)==null||s.unbind(i),(l=this.scrollWrapResizeObserve)==null||l.unbind(r),(c=this.containerResizeObserver)==null||c.unbind(e),(d=this.parentContainerScrollObserver)==null||d.unbindScrollContainer(e),(h=this.locatingContainerResizeObserver)==null||h.unbind(e)}bindCore(e,r){var s,l,c,d,h,C;if(this.unbindCore(e,r),!e.closest("body"))return;const i=Wa(e);(s=this.containerScrollObserver)==null||s.bindContentScrollCore(e),(l=this.containerScrollObserver)==null||l.bindCore(i),(c=this.scrollWrapResizeObserve)==null||c.bind(r),(d=this.containerResizeObserver)==null||d.bind(e);const o=this.containers.get(Rn(e));o!=null&&o.allowScrollBarFixed&&((h=this.parentContainerScrollObserver)==null||h.bindScrollContainer(e)),(C=this.locatingContainerResizeObserver)==null||C.bind(e)}bind(e,r){this.containers.set(e,r);const i=e.firstElementChild;this.containerIntersectionObserver||(this.containerIntersectionObserver=new FN(this,this.handleIntersection)),this.containerIntersectionObserver.bind(i)}unbind(e){var o;const r=e.firstElementChild,i=Qr(r);this.unbindCore(r,i),this.containers.delete(e),(o=this.containerIntersectionObserver)==null||o.unbind(r),this.containers.size||this.destroy()}destroy(){var e,r,i,o,s;this.containers.forEach((l,c)=>{this.unbind(c)}),this.containers.clear(),(e=this.parentContainerScrollObserver)==null||e.destroy(),(r=this.containerIntersectionObserver)==null||r.destroy(),(i=this.containerResizeObserver)==null||i.destroy(),(o=this.scrollWrapResizeObserve)==null||o.destroy(),(s=this.locatingContainerResizeObserver)==null||s.destroy(),window.removeEventListener("resize",this.handleWindowEffect),window.removeEventListener("scroll",this.handleWindowEffect)}}const Wy=I("scroll-container"),C0=new Map;class QN extends ye.TypedEmitter{constructor(){super(...arguments);m(this,"scrollListener");m(this,"options");m(this,"scrollContainerElement");m(this,"init",e=>{this.options=e;const r=v("div",[fs.CONTAINER],e.parentElement);ie.isMac&&z(r,fs.MAC);const i=v("div",[fs.SCROLL_CONTAINER],r),o=v("div",[fs.SCROLL_AREA],i);o.style.paddingLeft=e.paddingLeft?`${e.paddingLeft}px`:"",o.style.paddingTop=e.paddingTop?`${e.paddingTop}px`:"",o.style.paddingBottom=e.paddingBottom?`${e.paddingBottom}px`:"",o.style.paddingRight=e.paddingRight?`${e.paddingRight}px`:"",o.appendChild(e.childElement);const s=e.parentContainer;this.scrollListener=C0.get(s),this.scrollListener||(this.scrollListener=new YN(s),C0.set(s,this.scrollListener)),this.scrollListener.unbind(r),this.scrollListener.bind(r,e),this.scrollListener.on("scroll",this.handleContainerScroll),this.scrollListener.on("resize",this.handleResize),this.scrollContainerElement=i});m(this,"handleContainerScroll",(e,r)=>{r===this.scrollContainerElement&&this.emit("scroll",this)});m(this,"handleResize",(e,r)=>{r===this.scrollContainerElement&&this.emit("scroll",this)})}get rootElement(){return this.scrollContainerElement}get contentElement(){return p(Wy,this.scrollContainerElement,"scrollContainerElement cannot be undefined"),Qr(this.scrollContainerElement)}get scrollOptions(){return p(Wy,this.options,"options cannot be undefined"),{...this.options}}handleBaseListenerDestroy(e){e.destroy()}destroy(){var r;(r=this.scrollListener)==null||r.off("scroll",this.handleContainerScroll);const e=Rn(this.contentElement);e&&C0.forEach((i,o)=>{i.unbind(e),i.containers.size===0&&(this.handleBaseListenerDestroy(i),C0.delete(o))})}}function JN(){return new QN}const TC=I("column-width");function ZN(n,t,e){const r=oN(n,t);r.style.width=`${e}px`,r.style.minWidth=`${e}px`}function tP(n){const e=Array.from(n.querySelector("colgroup").children).map(c=>c.getBoundingClientRect().width);if(e[0]!==0)return e;const r=Mt.fromTable(n),i=Array(r.colCount).fill(-1),o=n.getBoundingClientRect().left;r.toRealCells(r.cells).forEach(c=>{const d=c.col+c.colSpan-1;i[d]===-1&&(i[d]=c.cell.getBoundingClientRect().right-o)}),TC.debug(`cellRightOffsets1: ${i.join()}`);for(let c=0;c<i.length;c++){const d=i[c];if(d===-1||c===0)continue;let h=c-1;for(;i[h]===-1&&(h--,h!==-1););const C=h===-1?0:i[h],x=(d-C)/(c-h);for(let B=h+1;B<c;B++)i[B]=C+x*(B-h)}TC.debug(`cellRightOffsets2: ${i.join()}`);const s=[];let l=0;for(let c=0;c<i.length;c++){const d=i[c];s.push(d-l),l=d}return TC.debug(`widths: ${s.join()}`),s}function ef(n){return Array.from(n.querySelector("colgroup").children).map(r=>r.getBoundingClientRect().width||Number.parseInt(r.style.width,10))}const yC=200,eP=40,nP=I("table-resize-gripper"),qy=7,kC=(qy-1)/2,rP=3;function iP(n,t,e){const{rows:r}=n;for(let i=0;i<r.length;i++){const o=r[i],s=Array.from(o.cells);for(let l=0;l<s.length;l++){const c=s[l],d=c.getBoundingClientRect(),h=Math.round(d.right);if(Math.abs(t-h)<=kC&&d.top<=e&&e<=d.bottom)return c}}return null}function oP(n){return!!n.rootContainer.querySelector(".table-resize-gripper")}function RC(n,t){return Ri(n,t).querySelector(".table-resize-gripper")}function Xy(n,t){const e=RC(n,t);p(nP,!e,"resize gripper has already exists");const r=Ri(n,t),i=v("div",["table-resize-gripper","table-indicator"],r);return v("div",["table-resize-gripper-indicator"],i),i}function Yy(n,t,e){let r=RC(n,t);r||(r=Xy(n,t));const o=ze(t).getBoundingClientRect(),s=e.getBoundingClientRect(),l=0,c=o.height,d=n.getCustom(ki(t)).contentElement.getBoundingClientRect(),h=s.right-d.left;r.style.left=`${h-kC-za-Xu}px`,r.style.top=`${l}px`,r.style.height=`${c}px`,r.style.width=`${qy}px`}function wC(n){n.rootContainer.querySelectorAll(".table-resize-gripper").forEach(t=>{t.remove()})}function sP(n,t,e){const i={...n.getBlockData(t),colsWidth:e};n.updateBlockData(t,i)}function lP(n,t,e,r){const i=t,o=Mt.fromTable(e),s=o.getCellByCellElement(i),l=s.col+s.colSpan-1,c=ef(e);let d=r;const h=(E,x)=>{const B=x+1,k=E.col+E.colSpan;return c.slice(B,k).reduce((U,M)=>U+M,0)},C=new Set;for(let E=0;E<o.rowCount;E++){const x=o.getCell({row:E,col:l});if(C.has(x.cell))continue;C.add(x.cell);const B=x.cell,k=B.getBoundingClientRect();let w=r-k.left+kC-rP;const U=Gu(B),M=u1(n,U)||eP*x.colSpan,F=h(x,l),Y=M-F;w<Y&&(w=Y);const X=k.left+w;d=Math.max(d,X)}return d}const aP=I("table-resize-drag-drop");class cP{constructor(t,e,r,i){m(this,"cursor","col-resize");this.editor=t,this.elem=e,this.data=r,this.onEnd=i}onDragStart(t,e,r){}onDragging(t,e,r,i,o){const{table:s,block:l,draggingRefCell:c}=t.data,h=lP(this.editor,c,s,e.x-t.dragOffsetX)-s.getBoundingClientRect().left;p(aP,c,"no dragging cell");const E=Mt.fromTable(s).getCellByCellElement(c),x=E.col+E.colSpan-1,B=ef(s),k=B.slice(0,x).reduce((U,M)=>U+M,0),w=h-k;if(ZN(s,x,w),w){const U=parseFloat(s.style.minWidth);s.style.minWidth=`${U+(w-B[x])}px`}Yy(this.editor,l,c),this.editor.selection.caret.update()}onDragEnd(t,e,r,i,o){const s=ef(t.data.table);sP(this.editor,t.data.block,s),wC(this.editor),this.onEnd&&(this.onEnd(e),this.onEnd=null)}}function uP(n,t){const e=Ae(t.x,t.y);if(!e)return null;const r=Z(e);return!r||!n.contains(r)||!Ge(r)?null:r}I("table-resize");class fP{constructor(t){m(this,"draggingRefCell",null);m(this,"handleMouseMove",(t,e)=>{if(t.readonly||window.isDragging||t.selectionHandler.isSelecting()&&!this.draggingRefCell||this.draggingRefCell)return;const r=e.target;if(!(r instanceof Element)||r.closest(".table-indicator"))return;const o=e,s=uP(t,o);if(!s||!yy(s)||!t.isBlockWritable(s)){wC(t);return}this.updateGripper(s,o.x,o.y)});this.editor=t,t.domEvents.addEventListener(document,"mousemove",this.handleMouseMove)}destroy(){this.editor.domEvents.removeEventListener(document,"mousemove",this.handleMouseMove)}updateGripper(t,e,r){const i=ze(t),o=iP(i,e,r);if(o){if(!RC(this.editor,t)){if(oP(this.editor))return;const l=Xy(this.editor,t),c={block:t,table:i,draggingRefCell:o};Og(new cP(this.editor,l,c,d=>{this.updateGripper(t,d.x,d.y)}))}Yy(this.editor,t,o)}else wC(this.editor)}}function Qy(n){n.addCustom("table-mouse-event-handler",t=>new fP(t))}const Jy=I("table-insert-column");function Zy(n,t,e){n.undoManager.runInGroup(()=>{var E;const r=ze(t),i=Mt.fromTable(r),o=i.colCount;p(Jy,e>=0&&e<=o,`insert index ${e} is out of range [0, ${o}]`);const s=i.map(x=>x.containerId),l=new Set;n.doc.beginBatchUpdate();for(let x=0;x<s.length;x++){const B=s[x],k=B[e-1],w=B[e];if(e===0||e===B.length||k!==w){const U=oo(n.doc);B.splice(e,0,U)}else B.splice(e,0,k),l.add(k)}n.doc.endBatchUpdate();const c=mt.default(n.getBlockData(t));l.forEach(x=>{const B=`${x}_colSpan`,k=c[B];p(Jy,typeof k=="number"&&k>1,`no colSpan for containerId ${x}, ${k}`),c[B]=k+1});const d=((E=c.colsWidth)==null?void 0:E.concat())||new Array(c.cols).fill(0);d.splice(e,0,yC);const h=Mt.virtualCellContainersGridToChildren(s),C={...c,cols:c.cols+1,children:h,colsWidth:d};dl(C),n.updateBlockData(t,C)})}const E0=I("table-insert-row");function SC(n,t,e){n.undoManager.runInGroup(()=>{const r=ze(t),i=Mt.fromTable(r),o=i.rowCount;p(E0,e>=0&&e<=o,`insert index ${e} is out of range [0, ${o}]`);const s=i.map(E=>E.containerId),l=new Set;n.doc.beginBatchUpdate();const c=[];for(let E=0;E<i.colCount;E++){const x=e>0&&s[e-1][E],B=e<i.rowCount&&s[e][E];if(p(E0,x||B,"no top and bottom cell"),e===0||e===i.rowCount||x!==B){const k=oo(n.doc);c.push(k)}else p(E0,x,"no top cell"),c.push(x),l.add(x)}n.doc.endBatchUpdate(),s.splice(e,0,c);const d=mt.default(n.getBlockData(t));l.forEach(E=>{const x=`${E}_rowSpan`,B=d[x];p(E0,typeof B=="number"&&B>1,`no rowSpan for containerId ${E}, ${B}`),d[x]=B+1});const h=Mt.virtualCellContainersGridToChildren(s),C={...d,rows:d.rows+1,children:h};dl(C),n.updateBlockData(t,C)})}const LC=I("paste-table-in-table-block");function dP(n,t,e,r,i){let o=Mt.fromBlock(e);const s=t.blocks.root[0];p(LC,s,"no table data"),p(LC,s.type==="table",`table data type is not table, but ${s.type}`);const l=s,c=o.getCellByCellElement(r),d=l.cols,h=l.rows,C=c.col,E=c.row,x=C+d,B=E+h,k=[];for(let w=C;w<x&&w<o.colCount;w++)for(let U=E;U<B&&U<o.rowCount;U++){const M=o.getCell({col:w,row:U});M.virtual?M.virtual&&k.push({col:w,row:U}):(M.colSpan>1||M.rowSpan>1)&&k.push({col:w,row:U})}n.undoManager.runInGroup(()=>{if(n.doc.beginBatchUpdate(),k.forEach(F=>{const Y=Mt.fromBlock(e).getCell(F);(Y.colSpan>1||Y.rowSpan>1)&&pC(n,e,F)}),x>o.colCount)for(let F=o.colCount;F<x;F++)Zy(n,e,F);if(B>o.rowCount)for(let F=o.rowCount;F<B;F++)SC(n,e,F);o=Mt.fromBlock(e);const w=new u0(l);let U;for(let F=0;F<w.colCount;F++)for(let Y=0;Y<w.rowCount;Y++){const X=w.getCell({col:F,row:Y});if(!X.virtual){const G=ep(n.editorBlocks,t,X.containerId,i),st=C+F,pt=E+Y,Ct={col:st,row:pt},yt=o.getCellContainer(Ct);YB(n,yt,G,i),U=yt}}n.doc.endBatchUpdate(),p(LC,U,"no last container");const M=Ue(U);n.selection.selectBlock(M,dt(n,M))})}const IC=I("paste-in-table-block");class hP{constructor(t){m(this,"pasteData");this.editor=t,setTimeout(()=>{t.input.addHandler(this)})}destroy(){this.pasteData=void 0}async handleBeforePaste(t,e,r,i){return this.pasteData={doc:r,files:i,event:e},!1}async handleBeforePasteDoc(t,e){var E,x,B,k;if(!t.selection.range.isSimple())return this.pasteData=void 0,!1;if(t.selection.range.start.offset!==0)return this.pasteData=void 0,!1;const i=t.selection.startBlock,o=it(i);if(qt(o))return this.pasteData=void 0,!1;if(!fu(t,o))return this.pasteData=void 0,!1;const s=Z(o);if(p(IC,s,"no parent block"),!Ge(s))return this.pasteData=void 0,!1;if(e.blocks.root.length!==1)return this.pasteData=void 0,!1;if(e.blocks.root[0].type!=="table")return this.pasteData=void 0,!1;IC.debug("paste child table in table");const d=Mt.fromBlock(s).getCellByContainerId(ct(o)).cell;Ap(t,e);const h={blockIdMap:new Map,containerIdMap:new Map,boxIdMap:new Map};dP(t,e,s,d,h),p(IC,this.pasteData,"invalid paste data");const C=[];t.input.forEach(w=>{C.push(w)});for(let w=0;w<C.length&&!await((x=(E=C[w]).handleAfterPasteDoc)==null?void 0:x.call(E,t,e,h));w++);for(let w=0;w<C.length&&!await((k=(B=C[w]).handleAfterPaste)==null?void 0:k.call(B,t,this.pasteData.event,this.pasteData.doc));w++);return this.pasteData=void 0,!0}}function tk(n){n.addCustom("table-block-paste-event",t=>new hP(t))}const DC=I("table-select-columns");function mP(n,t,e,r,i){p(DC,Ge(t),"is not a table block");const o=Mt.fromBlock(t);p(DC,e>=0&&e<o.colCount,"invalid from"),p(DC,r>0&&e+r<=o.colCount,"invalid count");const s=o.getCell({row:0,col:e}),l=o.getCell({row:o.rowCount-1,col:e+r-1}),c=xe(t,s.containerId,{colIndex:e,rowIndex:0}),d=xe(t,l.containerId,{colIndex:e+r-1,rowIndex:o.rowCount-1});i!=null&&i.reverse?n.selection.setSelection(d,c):n.selection.setSelection(c,d)}const _C=I("table-select-columns");function gP(n,t,e,r,i){p(_C,Ge(t),"is not a table block");const o=Mt.fromBlock(t);p(_C,e>=0&&e<o.rowCount,"invalid from"),p(_C,r>0&&e+r<=o.rowCount,"invalid count");const s=o.getCell({row:e,col:0}),l=o.getCell({row:e+r-1,col:o.colCount-1}),c=xe(t,s.containerId,{rowIndex:e,colIndex:0}),d=xe(t,l.containerId,{rowIndex:e+r-1,colIndex:o.colCount-1});i!=null&&i.reverse?n.selection.setSelection(d,c):n.selection.setSelection(c,d)}const jlt="",ek=I("get-toolbar-reference-client");function nk(n,t){const e=n.selection.range;if(!e.isSimple()){p(ek,e.start.blockId===e.end.blockId,"invalid selection range");const s=n.getBlockById(e.start.blockId);p(ek,It(n,s),"not a complex block");const l=Qt(n,s);if(l.getTextToolbarReferenceClient){const c=l.getTextToolbarReferenceClient(n,s);if(c)return c}}const r=e.isReverse()?t.start:t.end,i=Qe(n,{anchor:r,focus:r}),o=Yi(n,t.block,i);if(o.length!==0)return o[0]}function pP(n){var t,e;if(n.children){let r=!1;const i=[];for(const o of n.children){if((t=o.states)!=null&&t.includes("checked")){r=!0;break}(e=n.defaultCheckedChildren)!=null&&e.includes(o.id)&&i.push(o)}if(!r&&(i==null?void 0:i.length))for(const o of i)Array.isArray(o.states)?o.states.push("checked"):o.states=["checked"]}}function x0(n){const t=(i,o)=>{const s=i.findIndex(c=>c.id===o.id);if(s===-1){i.push(o);return}const l=i[s];if(l.value!==o.value&&delete l.value,!!l.states){if(!o.states){l.states=[];return}l.states=Rg.default(l.states,o.states)}},e=[],r=new Map;return n.forEach(i=>{var o,s;(o=i.children)!=null&&o.length&&(r.has(i.id)?(s=r.get(i.id))==null||s.push(...i.children):r.set(i.id,[...i.children])),t(e,i)}),r.forEach((i,o)=>{const s=e.find(l=>l.id===o);s&&(s.children=x0(i),pP(s))}),e}function A0(n){return n.findCustom("toolbar-handler")}const zlt="";class CP{constructor(){m(this,"linkPopup",null);m(this,"form",{});m(this,"onFinished",null);m(this,"onClose",null);m(this,"handleOk",async()=>{var t;try{await this.checkValue();const{linkText:e,linkUrl:r}=this.form,i=this.formatUrl(r.getInputValue());(t=this.onFinished)==null||t.call(this,e.getInputValue()||i,i),this._destroy()}catch{}});m(this,"handleClose",()=>{var t;(t=this.onClose)==null||t.call(this),this._destroy()});m(this,"onShow",()=>{setTimeout(()=>{var t;(t=this.form.linkText)==null||t.getField().focus()},400)});m(this,"onChange",()=>{var e;const t=(e=this.linkPopup)==null?void 0:e.content.querySelector('[data-button-id="submit-button"]');t.disabled=!1});m(this,"handleTextKeyboard",(t,e)=>{var r;if(!e){if(t.key==="Enter"){(r=this.form.linkUrl)==null||r.getField().focus(),t.stopPropagation();return}t.key==="Escape"&&this.handleClose()}});m(this,"handleUrlKeyboard",(t,e)=>{if(!e){if(t.key==="Enter"){this.handleOk(),t.preventDefault();return}t.key==="Escape"&&this.handleClose()}})}async checkValue(){const{linkUrl:t}=this.form;if(!t.getInputValue())throw t.setFieldError(D.t("link.urlPlaceholder")),new Error(D.t("link.urlPlaceholder"))}formatUrl(t){if(!t)return"";try{new URL(t)}catch{return`${window.location.protocol}//${t}`}return t}editLink(t){var h,C;const{target:e,linkText:r,linkUrl:i,onFinished:o,onClose:s,placement:l="bottom-start"}=t;this.linkPopup=new Va(this.createPopupContent(r,i)),this.linkPopup.addListener("show",this.onShow),this.linkPopup.manualShow(e,{theme:"light",placement:l}),this.onFinished=o,s&&(this.onClose=s);const c=(h=this.linkPopup)==null?void 0:h.content.querySelector('[data-button-id="submit-button"]'),d=(C=this.linkPopup)==null?void 0:C.content.querySelector('[data-button-id="cancel-button"]');c==null||c.addEventListener("click",this.handleOk),d==null||d.addEventListener("click",this.handleClose)}createPopupContent(t,e){const r=v("div",["link-popup-content"],null);this.form.linkText=c0(r,{label:D.t("link.textLabel"),required:!1,placeholder:D.t("link.textPlaceholder"),defaultValue:t,onChange:this.onChange,onKeyDown:this.handleTextKeyboard}),this.form.linkUrl=c0(r,{className:"link-popup-gap",label:D.t("link.urlLabel"),required:!0,placeholder:D.t("link.urlPlaceholder"),defaultValue:e,onChange:this.onChange,onKeyDown:this.handleUrlKeyboard});const i=v("div",["link-popup-footer"],r),o=br("cancel-button",D.t("link.cancelText"));i.appendChild(o);const s=br("submit-button",D.t("link.submitText"),void 0,["disabled","primary"]);return i.appendChild(s),r}_destroy(){var r,i,o,s;const t=(r=this.linkPopup)==null?void 0:r.content.querySelector('[data-button-id="submit-button"]'),e=(i=this.linkPopup)==null?void 0:i.content.querySelector('[data-button-id="cancel-button"]');t==null||t.removeEventListener("click",this.handleOk),e==null||e.removeEventListener("click",this.handleClose),this.onFinished=null,this.onClose=null,this.form={},(o=this.linkPopup)==null||o.removeAllListeners(),(s=this.linkPopup)==null||s.destroy()}destroy(){this._destroy()}}function nf(n,t){n.addCustom("link-editor",()=>new CP).editLink(t)}const EP=I("link-popup");function xP(n){return wt(n,"link")}function rf(n){var t,e;return(e=(t=n.getAttribute("link"))!=null?t:n.textContent)!=null?e:""}function AP(n,t,e){var i,o,s,l;if(n.isBlockWritable(t)&&e&&Qn(e)){const c=e,d=(o=(i=n.editorBoxes.getBoxClass(su(c))).getBoxProperties)==null?void 0:o.call(i,n,c);if(d!=null&&d.boxCommands){const h=(l=(s=d.boxCommands["hovering-toolbar"])==null?void 0:s.commands)!=null?l:[];return{element:e,commands:h}}return{element:null,commands:[]}}if(n.isWritable()&&e&&rt(n,t)&&xP(e)){const c=v("a",["link-href-button"],null,rf(e));c.href=rf(e),c.target="_blank",c.rel="noopener noreferrer";const d=[{id:"link-text",name:rf(e),disableTooltip:!0,element:c},{id:"edit-link",name:D.t("link.edit"),icon:s0},{id:"remove-link",name:D.t("link.remove"),icon:kT}];return{element:e,commands:d}}return Hv(n,t,"hovering-toolbar")}function rk(n,t,e){var l;const r=Yo(t,e),i=n.getBlockText(t),o={start:0,end:0};let s=(l=e.textContent)!=null?l:"";for(let c=0;c<i.length;c++){const d=i[c];if(o.end+d.insert.length>=r.end){o.end+=d.insert.length,s=d.insert;break}o.start<r.start&&(o.start+=d.insert.length,o.end=o.start)}return[o,s]}function bP(n,t,e){const[r,i]=rk(n,t,e);n.selection.selectBlock(t,r.start,r.end);const o=rf(e),s=(h,C)=>{try{const E=n.getBlockText(t),x=U1(E,r.start,r.end-r.start),B=ro(x,r.start,h,{link:C});n.setBlockText(t,B),n.selection.selectBlock(t,r.start+h.length),n.focus()}catch(E){EP.error(E)}},l=()=>{n.selection.selectBlock(t,r.end),n.focus()},c=Yi(n,t,n.selection.range)[0];if(!c)return;const d=Zi(n,t,"link-button-anchor",c);nf(n,{target:d,linkText:i,linkUrl:o,onFinished:s,onClose:l})}function vP(n,t,e){const[r]=rk(n,t,e),i=n.getBlockText(t),o=rf(e),s=va(r.start,r.end-r.start,i,"link",o);n.setBlockText(t,s),n.selection.selectBlock(t,r.end)}function BP(n,t,e,r){var s,l,c;if(e){if(n.isBlockWritable(t)&&Qn(e)){const h=e,C=(l=(s=n.editorBoxes.getBoxClass(su(h))).getBoxProperties)==null?void 0:l.call(s,n,h);if(C!=null&&C.boxCommands){C.boxCommands["hovering-toolbar"].executeCommand(n,t,h,r);return}return}const d=A0(n);d==null||d.disableTextToolbar(),d==null||d.hide(),setTimeout(()=>{d==null||d.enableTextToolbar()},400),r.id==="edit-link"?bP(n,t,e):r.id==="remove-link"&&vP(n,t,e);return}const i=$v(n,t);if(!i)return;const o=(c=i.blockCommands)==null?void 0:c["hovering-toolbar"];!o||o.executeCommand(n,t,r)}function b0(){let n=8;for(;n>0&&!document.querySelector(`div[data-style-heading='${n}']`);)n--;return n}function Jr(n){const e=n.selection.range;if(e.isCollapsed()||e.start.blockId!==e.end.blockId||!e.start.isSimple()||!e.end.isSimple()||e.end.offset-e.start.offset!==1)return!1;const r=n.getBlockById(e.start.blockId);return!(!rt(n,r)||Cu(n,r,e.start.offset).charType!=="box")}const TP=[Yh,Qh,Jh,Zh,t0,e0,n0,r0];class yP{constructor(t){m(this,"id","BlockTurnIntoCommandProvider");this.editor=t}getHeadingIndex(){let t=b0();return t<=4?t=5:t<8&&(t+=1),t}getAvailableCommands(t,e,r){if(!rt(t,e))return[];if(Jr(t))return[];const i=lt(e),o=Dt(e),s=Nr(t,e),c=t.getBlockData(e).heading,d=[];for(let C=0;C<this.getHeadingIndex();C++)d.push({id:`heading-${C+1}`,name:D.t("commands.heading",{name:`${C+1}`}),icon:TP[C],states:c===C+1?["checked"]:[],value:`${C+1}`});const h=C=>{var x;const E=v("span",["toolbar-item-name-container"],null);for(const B of C.children)if((x=B.states)!=null&&x.includes("checked"))return E.innerHTML=B.icon||Fa,E;return E.innerHTML=Fa,E};return[{id:"turn-into",name:D.t("commands.headingGroup"),blockId:i,blockType:o,blockKind:s,element:h,groupIndex:200,dropdown:!0,manualShowChildren:!0,childrenPlacement:"bottom-start",defaultCheckedChildren:["text"],children:[{id:"text",name:D.t("commands.text"),icon:Fa,states:c?[]:["checked"]},...d],childrenType:"menu"}]}applyHeadingStyle(t,e,r){t.updateBlockData(e,{heading:r})}executeCommand(t,e,r,i){if(Jr(t))return!1;if(rt(t,e)&&(i.id.startsWith("heading-")||i.id==="text")){const o=i.value?Number(i.value):null;return this.applyHeadingStyle(t,e,o),!0}return!1}}const kP=8,Le=I("list-block"),v0=I("list-block");function Ft(n){return Dt(n)==="list"}function Ne(n){p(v0,Ft(n),"not a list block")}function er(n){Ne(n);const t=n.getAttribute("data-list-type");return p(v0,t,"no list type"),t}function B0(n){return Ft(n)&&er(n)==="text-only"}function nr(n){var t,e;return Ne(n),(e=Number.parseInt((t=n.getAttribute("data-list-start"))!=null?t:"1",10))!=null?e:1}function un(n){var t,e;return Ne(n),(e=Number.parseInt((t=n.getAttribute("data-list-level"))!=null?t:"1",10))!=null?e:1}function Xa(n){Ne(n);const t=n.getAttribute("data-list-group-id");return p(v0,t,"no group id"),t}function ds(n){var o,s,l,c,d;Ne(n);const t=(o=n.getAttribute("data-list-type"))!=null?o:"ordered",e=(l=Number.parseInt((s=n.getAttribute("data-list-start"))!=null?s:"1",10))!=null?l:1,r=(d=Number.parseInt((c=n.getAttribute("data-list-level"))!=null?c:"1",10))!=null?d:1,i=n.getAttribute("data-list-group-id");return p(v0,i,"no group id"),{type:t,start:e,level:r,groupId:i}}function MC(n){switch(n){case"ordered":return{ordered:!0,checkbox:null,textOnly:null};case"unordered":return{ordered:!1,checkbox:null,textOnly:null};case"checked":return{checkbox:"checked",ordered:!1,textOnly:null};case"unchecked":return{checkbox:"unchecked",ordered:!1,textOnly:null};case"text-only":return{checkbox:null,ordered:!1,textOnly:!0};default:return{checkbox:null,ordered:!0,textOnly:!1}}}function RP(n){const t={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1};let e="",r=n;return Object.entries(t).forEach(([i,o])=>{for(;r>=o;)e+=i,r-=o}),e.toLowerCase()}const wP="abcdefghijklmnopqrstuvwxyz";function ik(n){if(n<=0)return`${n}`;const t=(n-1)%26,e=Math.floor((n-1)/26),r=wP[t];return e?ik(e)+r:r}function SP(n){return`${n}`}const ok=[SP,ik,RP];function LP(n,t){const e=ok[(n-1)%ok.length];return e(t)}function IP(n){return["\u2022","\u25E6","\u25AA"][(n-1)%3]}function hs(n,t){Ne(n);const{level:e,groupId:r,type:i}=ds(n);let o=Oe(n);for(;o;){if(!Ft(o))return null;const{level:s,groupId:l,type:c}=ds(o);if(s<e)return null;if(e===s&&((t==null?void 0:t.ignoreGroupId)||r===l)&&(c==="text-only"||i==="text-only"||i===c))return o;o=Oe(o)}return null}function sk(n){return hs(n,{ignoreGroupId:!0})}function gl(n){Ne(n);const{level:t,groupId:e,type:r}=ds(n);let i=Jt(n);for(;i;){if(Ft(i)){const{level:o,groupId:s,type:l}=ds(i);if(t===o&&e===s&&(l==="text-only"||r==="text-only"||r===l))return i;if(o<t)return null}i=Jt(i)}return null}function lk(n){Ne(n);const t=[];let e=hs(n);for(;e;)t.unshift(e),e=hs(e);return t}function Ya(n){Ne(n);const t=[];let e=gl(n);for(;e;)t.push(e),e=gl(e);return t}function of(n){Ne(n);let t=hs(n);for(;t;){const e=hs(t);if(!e)return t;t=e}return n}function DP(n){Ne(n);let t=gl(n);for(;t;){const e=gl(t);if(!e)return t;t=e}return null}function ak(n,t){const e=lk(n),r=Ya(n);return t.withSelf?[...e,n,...r]:[...e,...r]}function T0(n){Ne(n);let t=n;const e=lk(n);e.length>0&&(t=e[0]);const r=Oe(t);return!r||!Ft(r)?null:un(r)<un(t)?r:null}function _P(n,t){Ne(n);let e=n;for(;e;){const r=un(e);if(r===t)return e;if(r>t)e=T0(e);else if(r<t)return null}return null}function MP(n){let t=of(n);for(;;){const e=T0(t);if(!e)return t;t=of(e)}}class UP{constructor(){m(this,"nodeMap",new Map);m(this,"rootNodes",[])}addNode(t,e){const r={block:e,children:[]};if(this.nodeMap.set(e,r),t){const i=this.nodeMap.get(t);p(Le,i,"no parent node"),i.children.push(r)}else this.rootNodes.push(r)}}function ck(n,t){const e=MP(t),r=new UP;r.addNode(null,e);let i=Jt(e);for(;i&&Ft(i);){if(B0(i)){r.addNode(null,i),i=Jt(i);continue}if(un(i)===0&&er(i)!==er(e))break;const s=T0(i);r.addNode(s,i),i=Jt(i)}return r.rootNodes}function OP(n){const t=document.fullscreenEnabled||document.mozFullScreenEnabled||document.documentElement.webkitRequestFullScreen,e=r=>{if(r.requestFullscreen)return r.requestFullscreen();if(r.mozRequestFullScreen)return r.mozRequestFullScreen();if(r.webkitRequestFullScreen){try{document.fullscreenElement=n}catch{}return r.webkitRequestFullScreen()}return Promise.resolve(0)};return t?e(n):Promise.resolve(0)}function uk(){const e=(document.exitFullscreen||document.webkitExitFullscreen).bind(document)();try{document.fullscreenElement=null}catch{}return e}function UC(n){return wt(n,"editor-in-mindmap-first")}function OC(n){if(p(Le,Ft(n),"not a list block"),wt(n,"editor-in-mindmap-first")||!Go(n))return!0;const t=n.classList,e="editor-mindmap-root-";return!!Array.from(t).find(i=>{if(i.startsWith(e))return i})}function NP(n,t,e){const r=it(n);if(t){const s=it(t);p(Le,r===s,"invalid block container")}const i=vt(n);if(t){const s=vt(t);p(Le,i<=s,"invalid block index")}if(z(n,...e),!t||t===n)return;let o=Jt(n);for(;o!==t;)p(Le,o,"no next button"),z(o,...e),o=Jt(o);o&&z(o,...e)}function PP(n){const t=`editor-mindmap-root-${n.id}`,r=it(n).querySelectorAll(`.${t}`);return r[r.length-1]}async function FP(n,t,e){const r=oe(t),i=r.querySelector('[data-button-id="mindmap-fullscreen"]');p(Le,i,"no full screen button");const o=()=>{setTimeout(()=>{e.toMindmap(n,t,{},{reset:!0,mindmapTools:e})},300)},s=()=>{ot(r,"fullscreen"),i.innerHTML=oC,i.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,D.t("mindmap.fullScreen")),OC(t)&&setTimeout(()=>{o()},300)};if(document.fullscreenElement===r){try{await uk()}catch(l){Le.error(l)}s()}else{try{z(r,"fullscreen"),await OP(r),o()}catch(l){Le.error(l)}i.innerHTML=ay,i.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,D.t("mindmap.exitFullscreen"))}r.onfullscreenchange=()=>{document.fullscreenElement||s()}}function NC(n,t,e,r,i){if(t.querySelector(`[data-button-id="${e}"]`))return null;const s=br(e,r,i,[]);return s.setAttribute(`data-editor-tooltip-${n.clientId}-dynamic`,r),z(s,"mindmap-button"),t.appendChild(s),s}function PC(n,t){return n.querySelector(`[data-button-id="${t}"]`)}function KP(n){return PC(n,"mindmap-fullscreen")}function VP(n){return PC(n,"mindmap-fit")}function $P(n){return PC(n,"mindmap-close")}function HP(n,t,e,r){const i=NC(n,t,"mindmap-close",D.t("mindmap.close"),qh);!i||n.domEvents.addEventListener(i,"click",()=>{r.closeMindmap(n,e)})}function jP(n,t,e,r){const i=NC(n,t,"mindmap-fit",D.t("mindmap.autoFit"),ly);!i||n.domEvents.addEventListener(i,"click",()=>{r.fitMindmap(n,e)})}function zP(n,t,e,r){if(navigator.userAgent.includes("Mobile")&&!navigator.userAgent.includes("iPad"))return;const o=NC(n,t,"mindmap-fullscreen",D.t("mindmap.fullScreen"),oC);!o||n.domEvents.addEventListener(o,"click",()=>{FP(n,e,r)})}function GP(n,t){const e=th(t);if(!e)return;const r=VP(e);r&&(r.remove(),n.domEvents.removeAllListeners(r));const i=$P(e);i&&(i.remove(),n.domEvents.removeAllListeners(i));const o=KP(e);o&&(o.remove(),n.domEvents.removeAllListeners(o))}const Qa=new Map;function FC(n,t,e){const r=(s,l)=>{s.forEach(c=>{l?z(c.block,"to-mindmap-highlight"):ot(c.block,"to-mindmap-highlight"),r(c.children,l)})},i=ck(n,t);if(i.length===0)return;const o=i[0].block;if(e){const s=Qa.get(o);s&&(s.forEach(l=>l.cancel()),Qa.delete(o)),r(i,!0)}else{const s=setTimeout(()=>{r(i,!1),Qa.delete(o)},300),l=()=>{clearTimeout(s),Qa.delete(o)},c=Qa.get(o);c?c.push({cancel:l}):Qa.set(o,[{cancel:l}])}}const{Markmap:WP}=e9;function qP(n,t){Ne(t);const e=ck(n,t),r=e[0].block,i=d=>({type:"text",content:Nt(d.block).textContent,depth:1,children:d.children.length>0?d.children.map(C=>i(C)):void 0});let o=null;e.length>1?o={type:"root",content:"root",depth:0,children:e.length>0?e.map(d=>i(d)):void 0}:o=i(e[0]);const l=d=>{if(d.length===0)return null;const h=d[d.length-1];return h.children&&h.children.length>0?l(h.children):h},c=l(e);return{root:o,block:r,nodes:e,last:c}}function y0(n,t,e,r){const{root:i,block:o,last:s}=qP(n,t);r.selectBlock&&n.selection.selectBlock(o,0,0),FC(n,o,!1),r.saveData&&n.updateBlockData(o,{viewAsMindmap:!0});const l=oe(o);let c=l.querySelector(".editor-mindmap-svg");if(r.reset&&(c&&c.remove(),c=null),c)c.innerHTML="";else{const U="http://www.w3.org/2000/svg",M=l.getBoundingClientRect(),F=document.fullscreenElement===l,Y=F?`${M.width}`:`${t.getBoundingClientRect().width}`,X=F?`${M.height}`:"600",G=document.createElementNS(U,"svg");G.setAttributeNS(null,"viewBox",`0 0 ${Y} ${X}`),G.setAttributeNS(null,"width","100%"),G.setAttributeNS(null,"height",X),G.style.display="block",G.style.width="100%",G.style.height=`${X}px`,G.classList.add("editor-mindmap-svg"),l.appendChild(G),c=G}const d=o,C=`editor-mindmap-root-${lt(o)}`;z(d,"editor-in-mindmap-first",C,"readonly"),d.contentEditable="false";const E=Jt(o);E&&vt(E)<=vt(s.block)&&NP(E,s.block,["block-hidden",C]);const x=(U,M)=>{if(M.length>0){const F=M[0].parentElement;F&&(F.style.width="100vw",F.style.maxWidth="200px")}M.forEach(F=>{z(F,"editor-mindmap-node")})},B=new WP(c,{...e,autoFit:!0});B.viewHooks.transformHtml.tap(x),B.setData(i),B.fit();const k=oe(o);let w=k.querySelector(".mindmap-toolbar");w||(w=v("div",["mindmap-toolbar"],k)),jP(n,w,d,r.mindmapTools),zP(n,w,d,r.mindmapTools),HP(n,w,d,r.mindmapTools),n.domEvents.addEventListener(c,"click",()=>{n.selection.selectBlock(o,0),n.input.focus()}),d.mindMap=B}function XP(n){const t=v("div",["list-to-mindmap-wrap"],null),e=br("list-to-mindmap",D.t("mindmap.viewAsMindMap"),sy,[],n.clientId);return t.appendChild(e),t}async function fk(n,t){const e=`editor-mindmap-root-${t.id}`,r=it(t);fe(r).forEach(l=>{wt(l,e)&&ot(l,e,"editor-in-mindmap-first","block-hidden")});const o=oe(t);document.fullscreenElement===o&&await uk();const s=o.querySelector(".editor-mindmap-svg");!s||(p(Le,s,"no mindmap svg"),s.remove(),n.domEvents.removeAllListeners(s),GP(n,t))}function YP(n){const t=n.classList,e="editor-mindmap-root-";return Array.from(t).find(i=>{if(i.startsWith(e))return i})}async function dk(n,t){!YP(t)||(n.updateBlockData(t,{viewAsMindmap:null}),fk(n,t),n.selection.selectBlock(t,0))}function QP(n,t){const e=t.mindMap;e&&e.fit()}const k0={toMindmap:y0,closeMindmap:dk,fitMindmap:QP},Glt="";class R0{constructor(t){m(this,"toMindmapButton");m(this,"currentBlock",null);m(this,"handleHoveringBlock",t=>{t&&Ft(t)&&er(t)!=="unchecked"&&er(t)!=="checked"&&this.editor.isWritable()?oe(t).appendChild(this.toMindmapButton):this.toMindmapButton.remove()});m(this,"handleMouseEnter",()=>{const t=Z(this.toMindmapButton);p(Le,t&&Ft(t),"no parent list"),FC(this.editor,t,!0),this.currentBlock=t});m(this,"handleMouseLeave",()=>{this.currentBlock&&(FC(this.editor,this.currentBlock,!1),this.currentBlock=null)});m(this,"handleClick",()=>{const t=Z(this.toMindmapButton);p(Le,t&&Ft(t),"no parent list"),y0(this.editor,t,{},{saveData:!0,selectBlock:!0,mindmapTools:k0})});this.editor=t,Re.get(this.editor).addListener("change",this.handleHoveringBlock),this.toMindmapButton=XP(t),t.domEvents.addEventListener(this.toMindmapButton,"mouseenter",this.handleMouseEnter),t.domEvents.addEventListener(this.toMindmapButton,"mouseleave",this.handleMouseLeave),t.domEvents.addEventListener(this.toMindmapButton,"click",this.handleClick)}static get(t){return t.findCustomByType(R0)}destroy(){Re.get(this.editor).removeListener("change",this.handleHoveringBlock)}hide(){this.currentBlock&&(this.currentBlock=null),this.toMindmapButton.remove()}}function JP(n,t,e){var r;t==="beginDrag"&&((r=R0.get(n))==null||r.hide())}function Ja(n,t,e,r){var o;const i=(o=r==null?void 0:r.groupId)!=null?o:et();t.forEach(s=>{const l=n.getBlockData(s);if(l.start!==e||(r==null?void 0:r.resetGroupId)){const c={...l,start:e};r!=null&&r.resetGroupId&&(c.groupId=i),n.updateBlockData(s,c)}l.textOnly||(e+=1)})}function KC(n,t,e,r){const i=ak(t,{withSelf:!0});i.length!==0&&Ja(n,i,e,r)}class w0{constructor(t,e){m(this,"listStart",0);m(this,"listBrother",null);if(this.editor=t,B0(e))return;const r=of(e),i=nr(r);this.listStart=i,r===e?this.listBrother=gl(r):this.listBrother=r}fix(){if(!!this.listBrother){if(qc(this.listBrother)){this.listBrother=null;return}KC(this.editor,this.listBrother,this.listStart)}}}class pl{constructor(t,e,r){m(this,"listStart");m(this,"listBrother",null);this.editor=t,this.options=r;const i=of(e),o=nr(i);this.listStart=o,this.listBrother=i,r!=null&&r.resetStart&&(this.listStart=1)}fix(){!this.listBrother||KC(this.editor,this.listBrother,this.listStart,this.options)}}class hk{constructor(t,e,r){m(this,"listStart");m(this,"listNextBrothers",[]);this.editor=t,this.listNextBrothers=Ya(e);const{start:i,resetStart:o}=r||{};this.listStart=o?1:i!=null?i:1}fix(){!this.listNextBrothers.length||Ja(this.editor,this.listNextBrothers,this.listStart)}}function ZP(n,t,e){n.getBlockData(t).quoted&&(e.quoted=!0)}function VC(n,t,e,r){if(Le.debug("drag a block on a list block"),!rt(n,t))return!1;p(Le,Ft(e),"target is not a list block");const{type:i,start:o,level:s,groupId:l}=ds(e),c=r==="after"?o+1:o,d=n.getBlockData(t),h={id:et(),type:"list",groupId:l,level:s,start:c,text:d.text,...MC(i)};ZP(n,e,h);let C=vt(e);const E=it(e);r==="after"&&(C+=1);let x=null;Ft(t)&&(x=new w0(n,t));const B=n.insertBlock(ct(E),C,h,Ch(h.id,0));return n.deleteBlock(t),new pl(n,B).fix(),x==null||x.fix(),!0}function tF(n,t,e,r){if(Le.debug("drag a list between text blocks"),r==="after"){const d=Jt(e);if(d&&Ft(d))return VC(n,t,d,"before")}if(r==="before"){const d=Oe(e);if(d&&Ft(d))return VC(n,t,d,"after")}const o={...n.getBlockData(t),groupId:et(),start:1,level:1};let s=vt(e);const l=it(e);r==="after"&&(s+=1),n.insertBlock(ct(l),s,o,Ch(o.id,0));const c=new w0(n,t);return n.deleteBlock(t),c.fix(),!0}function eF(n,t,e,r,i){if(Xd(e))return!1;const{blockId:o}=e,s=n.getBlockById(o);p(Le,s,"no dragged block");const{isSourceBlock:l,targetBlock:c}=i;return!l&&c?(p(Le,t===c,"block !== target block"),p(Le,Ft(c),"target is not a list block"),VC(n,s,c,r)):tF(n,s,c,r)}function mk(n,t){if(!n.isWritable())return!1;const e=n.selection.range,i=n.editorCommandProviders.getCommands(e,"shortcut").find(o=>o.id===t);return i?(n.editorCommandProviders.executeCommand(e,i,{}),!0):!1}const nF={"Shift+CtrlOrCmd+L":n=>mk(n,"ordered-list"),"Shift+CtrlOrCmd+U":n=>mk(n,"unordered-list")};function S0(n){const t=n.getAttribute("block-padding-level");return t?Number(t):null}function rF(n,t){let e;const r=S0(t);if(!r)e=1;else{if(r>=12)return e=12,!1;e=r+1}return n.updateBlockData(t,{...n.getBlockData(t),padding:e}),!0}function gk(n,t){const e=S0(t);if(!e)return!1;const r=n.getBlockData(t);return e>1?(n.updateBlockData(t,{...r,padding:e-1}),!0):(n.updateBlockData(t,{...r,padding:null}),!0)}function $C(n){return n.readonly||!n.isWritable()}function iF(n){return n.selection.range.getSelectedBlocks().forEach(e=>{const r=e.block;rt(n,r)&&rF(n,r)}),!0}function oF(n){return n.selection.range.getSelectedBlocks().forEach(e=>{const r=e.block;rt(n,r)&&gk(n,r)}),!0}function sF(n){return $C(n)?!1:n.undoManager.runInGroup(()=>(iF(n),!0))}function lF(n){return $C(n)?!1:n.undoManager.runInGroup(()=>(oF(n),!0))}function aF(n){if($C(n))return!1;if(!n.selection.range.isCollapsed())return;const t=n.selection.focusedBlock;if(!rt(n,t))return;const e=n.selection.range.focus;if(!(!e.isSimple()||e.offset!==0||!S0(t)))return gk(n,t),!0}class HC{renderBlock(t,e,r){const{padding:i}=r;return i?{attributes:{"block-padding-level":i}}:{}}}const Wlt="",cF={Tab:sF,"Shift+Tab":lF,Backspace:aF};function uF(n,t,e=1){if(!t)return null;let r=Oe(n);for(;r;){const i=r.getAttribute("data-style-heading"),o=Number(r.getAttribute("data-list-level"));if(i){if(i<t)return null;if(i===t&&o===e)return Ft(r)?r:null}r=Oe(r)}return null}function fF(n,t){const e=n.getAttribute("data-style-heading"),r=uF(n,e);if(r)return r;const i=Oe(n);if(i&&Ft(i)&&er(i)===t)return i;const o=Jt(n);return o&&Ft(o)&&er(o)===t?o:null}function dF(n,t,e){var k,w,U;const r=(k=e.data)!=null?k:{};let i=1;if(Ft(t))i=un(t);else{const M=S0(t);M&&(i=M+1),i>8&&(i=8)}const o=(w=r.listType)!=null?w:"ordered";if(o==="text-only")return null;const s=n.getBlockData(t);let l=(U=s.text)!=null?U:[],d=de(l);const h=e.offset||0;h<=gn(l)&&(l=Mn(l,h).right,d=d.substring(0,h));let C=1;o==="ordered"&&(C=Number.parseInt(d,10)||1);let E=et();const x=fF(t,o);if(x)if(un(x)===i){if(vt(t)>vt(x))C=nr(x)+1;else{const M=nr(x);M>1&&(C=M-1),new hk(n,x,{start:C+1}).fix()}E=Xa(x)}else{const M=_P(x,i);M&&(C=nr(M)+1)}else Ft(t)&&new hk(n,t,{start:1}).fix();const B={id:et(),type:"list",level:i,start:C,groupId:E,ordered:!1,text:l};return s.quoted&&(B.quoted=!0),s.heading&&(B.heading=s.heading),o==="ordered"?B.ordered=!0:(o==="checked"||o==="unchecked")&&(B.checkbox=o),{blockData:B,onConverted:(M,F)=>{new pl(M,F).fix()}}}function Za(n){return n.textOnly?"text-only":n.checkbox?n.checkbox:n.ordered?"ordered":"unordered"}function hF(n){var e,r;if(n.checkbox)return"";const t=(e=n.level)!=null?e:1;return n.ordered?`${LP(t,(r=n.start)!=null?r:1)}.`:IP(t)}function L0(n){return n==="checked"||n==="unchecked"}function pk(n,t,e,r){const i=t,{containerId:o,blockIndex:s}=r[r.length-1];if(s===0)return!0;const l=e.blocks[o][s-1];if(l.type!=="list")return!0;const c=Za(i),d=Za(l);return c!==d&&(!L0(c)||!L0(d))||(i.level||1)>(l.level||1)}function Ck(n,t,e,r){const i=t,{containerId:o,blockIndex:s}=r[r.length-1];if(s===e.blocks[o].length-1)return!0;const l=e.blocks[o][s+1];if(l.type!=="list")return!0;const c=Za(i),d=Za(l);return c!==d&&(!L0(c)||!L0(d))||(i.level||1)>(l.level||1)}function mF(n,t,e,r,i){var s,l,c;const o=t;if(r==="text")return((s=Nn.convertTo)==null?void 0:s.call(Nn,n,t,e,"text",i))||"";if(r==="markdown"){let d=((l=Nn.convertTo)==null?void 0:l.call(Nn,n,t,e,"markdown",i))||"";o.checkbox==="checked"?d=`[x] ${d}`:o.checkbox==="unchecked"&&(d=`[ ] ${d}`),o.ordered?d=`${o.start}. ${d}`:d=`- ${d}`;const h=o.level||0;return d=(h>0?" ".repeat(h-1):"")+d,pk(n,t,e,i)&&(d=`${d}`),Ck(n,t,e,i)&&(d=`${d}`,h<=1&&(d+=`
|
|
614
614
|
`)),d}if(r==="html"){let d=((c=Nn.convertTo)==null?void 0:c.call(Nn,n,t,e,"html",i))||"";d=d.replace("<p>","").replace("</p>",""),o.checkbox==="checked"?d=`<input type="checkbox" checked="checked" disabled="disabled" /> ${d}`:o.checkbox==="unchecked"&&(d=`<input type="checkbox" disabled="disabled" /> ${d}`);let h="ul",C="";if(o.ordered)switch(d=`<li value="${o.start}">${d}</li>`,h="ol",o.level){case 2:case 5:case 8:C="list-style-type: lower-alpha;";break;case 3:case 6:C="list-style-type: lower-roman;";break}else d=`<li>${d}</li>`;return pk(n,t,e,i)&&(d=`<${h}${C?` style="${C}"`:""}>${d}`),Ck(n,t,e,i)&&(d=`${d}</${h}>`),d}return""}function Ek(n){const t=v("label",["editor-check-list-wrapper"],null);n&&z(t,"editor-check-list-wrapper-checked");const e=v("span",["editor-check-box"],t);return v("span",["editor-check-box-inner"],e),t}function gF(n,t){const e=Za(t);if(e!=="text-only"){if(e==="checked"){n.append(Ek(!0));return}if(e==="unchecked"){n.append(Ek(!1));return}n.innerText=hF(t)}}function pF(n){const t=v("div",["list-container"],null),e=v("button",["list-marker"],t);return gF(e,n),t}function tc(n,t){Ne(t);const e=n.getBlockData(t),r={id:et(),type:"text",text:e.text};e.heading&&(r.heading=e.heading),e.heading&&(r.heading=e.heading);const i=it(t),o=vt(t);n.deleteBlock(t);const s=Ch(r.id,0);if(fu(n,i)&&!qt(i)){const l=be(i);n.insertBlock(ct(i),o,r,s),n.deleteBlock(l)}else n.insertBlock(ct(i),o,r,s)}function CF(n){if(!n.selection.range.isCollapsed())return!1;const t=n.selection.focusedBlock;if(!Ft(t))return!1;const e=n.selection.range.focus;return!e.isSimple()||e.offset!==0?!1:(tc(n,t),!0)}function xk(n){let t=Jt(n);if(!t)return null;const e=gl(n);for(;t!==e;){if(p(Le,t,"no next block"),Ft(t))return un(t)>un(n)?t:null;if(t=Jt(t),!t)return null}return null}function jC(n){const t=[];let e=xk(n);if(!e)return t;for(;e;){const r=gl(e);t.push({block:e,children:jC(e)}),e=r}return t}function EF(n){const t=(r,i)=>{i.push(r.block),r.children.forEach(o=>t(o,i))},e=[];return n.forEach(r=>t(r,e)),e}function Ak(n,t){return un(t)!==1}function bk(n,t,e){t.forEach(r=>{const i=n.getBlockData(r.block);n.updateBlockData(r.block,{...i,groupId:e,level:(i.level||1)-1}),r.children.length&&bk(n,r.children,i.groupId)})}function zC(n,t){if(!Ak(n,t))return!1;const e=un(t);if(e===1)return!1;let r=et(),i=1,o=er(t);const s=e-1,l=T0(t);l&&(r=Xa(l),i=nr(l)+1,o!=="text-only"&&(o=er(l)));const c=jC(t),d=n.getBlockData(t),h={...d,groupId:r,level:s,start:i,...MC(o)};n.updateBlockData(t,h),n.doc.beginBatchUpdate(),bk(n,c,d.groupId),n.doc.endBatchUpdate(),new pl(n,t).fix();const E=xk(t);return E&&new pl(n,E,{resetStart:!0,resetGroupId:!0}).fix(),!0}const xF=I("list-block");function AF(n,t,e){p(xF,Ft(t),"not a list block");const r={...n.getBlockData(t),id:et()};return e!=null&&e.level&&(r.level=e.level),e!=null&&e.start&&(r.start=e.start),e!=null&&e.keepText||delete r.text,(r==null?void 0:r.checkbox)==="checked"&&(r.checkbox="unchecked"),r}function bF(n){if(Ne(n),!B0(n))return n;let t=hs(n);for(;t;){if(!B0(t))return t;t=hs(t)}return null}function vF(n,t,e,r){const i=new pl(n,r),o=nr(r)+1;Sa(n,t,e,{forceInsertAfter:!0,newBlockData:AF(n,r,{start:o})}),i.fix()}function BF(n){var s;if(n.selection.range.isCollapsed()){const l=n.selection.focusedBlock;if(Ft(l)&&dt(n,l)===0)return un(l)===1?tc(n,l):zC(n,l),!0}n.clearSelectedContents();const t=n.selection.focusedBlock;if(!Ft(t))return!1;const e=n.selection.range.focus;if(!e.isSimple())return!1;const r=e.offset,o=(s=r===dt(n,t)?bF(t):t)!=null?s:t;return vF(n,t,r,o),!0}function vk(n){p(Le,Ft(n),"not a list block");const{level:t}=ds(n);let e=Oe(n);for(;e;){if(Ft(e)){const{level:r}=ds(e);if(t===r)return e;if(r<t)return null}e=Oe(e)}return null}function Bk(n,t){return Ne(t),vk(t)?un(t)<kP:!1}function TF(n,t,e){let r=Oe(t);p(Le,r,"no prev brother");const i=un(e);for(;r;){if(r===e)return null;if(Ft(r)&&un(r)===i+1)return r;r=Oe(r)}return null}function Tk(n,t){if(!Bk(n,t))return!1;Ne(t);const e=vk(t);p(Le,e,"no list prev brother");const r=e,i=TF(n,t,r),o=un(r)+1;let s=et(),l=1,c=er(t);i&&(s=Xa(i),l=nr(i)+1,c=er(i));const d=jC(t),C={...n.getBlockData(t),groupId:s,level:o,start:l,...MC(c)};return n.updateBlockData(t,C),n.doc.beginBatchUpdate(),EF(d).forEach(x=>{const B=n.getBlockData(x);n.updateBlockData(x,{...B,level:(B.level||1)+1})}),n.doc.endBatchUpdate(),!0}function yF(n,t,e){return t.length===0||!t.every(r=>Ft(r.block))?!1:e==="increase"?Bk(n,t[0].block):Ak(n,t[0].block)}function yk(n,t,e){if(!yF(n,t,e))return!1;const r=t[0].block,i=un(r),o=t.filter(d=>un(d.block)<=i),s=ak(r,{withSelf:!1}),l=new Set(o.map(d=>d.block)),c=s.filter(d=>!l.has(d));return n.undoManager.runInGroup(()=>{let d=null;c.length>0&&(d=new pl(n,c[0])),o.forEach(h=>{e==="increase"?Tk(n,h.block):zC(n,h.block)}),d==null||d.fix()}),!0}function kF(n,t){return Tk(n,t)}function RF(n,t){return zC(n,t)}function wF(n){const t=n.selection.range.getSelectedBlocks();if(t.length>1)return yk(n,t,"increase"),!0;const e=t[0].block;if(!Ft(e))return!1;const r=new w0(n,e);return kF(n,e)&&(r.fix(),new pl(n,e).fix()),!0}function SF(n){const t=n.selection.range.getSelectedBlocks();if(t.length>1)return yk(n,t,"decrease"),!0;const e=t[0].block;return Ft(e)?(RF(n,e),!0):!1}class LF{constructor(t){this.editor=t}handleBeforeKeyDown(t,e){const r=t.selection.range.getSelectedBlocks();if(r.length===0||!r.some(o=>Ft(o.block)))return!1;switch(e.key){case"Enter":return this.handleEnter(e);case"Backspace":return this.handleBackspace();case"Tab":return this.handleTab(e);default:return!1}}handleEnter(t){const e=this.editor.selection.range.getSelectedBlocks()[0];return!e.block||!Ft(e.block)||di(t,"Shift+Enter")?!1:this.editor.undoManager.runInGroup(()=>BF(this.editor))}handleBackspace(){return this.editor.undoManager.runInGroup(()=>CF(this.editor))}handleTab(t){return di(t,"Shift+Tab")?this.editor.undoManager.runInGroup(()=>SF(this.editor)):this.editor.undoManager.runInGroup(()=>wF(this.editor))}}class IF{constructor(t){m(this,"effectedBlockIds",new Map);m(this,"handleBeforeClearSelection",()=>{this.effectedBlockIds.clear();const t=this.editor.selection.range.getSelectedBlocks();if(t.length===0)return;const e=new Set;t.forEach(i=>{const o=i.block;Ft(o)&&e.add(o)});const r=new Map;Array.from(e.values()).forEach(i=>{var c;const o=of(i),{start:s}=ds(o);r.set(lt(o),s);const l=(c=DP(i))!=null?c:i;r.set(lt(l),s)}),this.effectedBlockIds=r});m(this,"handleAfterClearSelection",()=>{Array.from(this.effectedBlockIds.entries()).forEach(([t,e])=>{const r=this.editor.findBlockById(t);!r||KC(this.editor,r,e)}),this.effectedBlockIds.clear()});this.editor=t,this.editor.addListener("beforeClearSelection",this.handleBeforeClearSelection),this.editor.addListener("afterClearSelection",this.handleAfterClearSelection)}destroy(){this.editor.removeListener("beforeClearSelection",this.handleBeforeClearSelection),this.editor.removeListener("afterClearSelection",this.handleAfterClearSelection)}}const DF=I("customize-list-start-menu");class _F{constructor(t){m(this,"popup");m(this,"block",null);m(this,"show",(t,e)=>{const r=e.querySelector("div.list-container");p(DF,r,"list-block mark does not exist"),this.block=e,this.popup.manualShow(r,{theme:"light"})});m(this,"createDialogContent",()=>{const t=v("div",["customize-start-panel"],null);v("span",["customize-start-panel-title"],t,D.t("list.numberLabel"));const e=this.createNumericInput();t.appendChild(e);const r=v("button",["customize-start-panel-button"],t,D.t("list.confirm"));return this.editor.domEvents.addEventListener(t,"keydown",this.handleKeydown),this.editor.domEvents.addEventListener(r,"click",this.handleOk),t});m(this,"handleDialogShow",()=>{const t=this.block;if(!t)return;const e=this.popup.popupContent,r=e.querySelector("button.customize-start-panel-button"),i=e.querySelector("input.customize-start-panel-input"),o=nr(t);!r||!i||requestAnimationFrame(()=>{i.focus(),i.value=String(o)})});m(this,"handleOk",()=>{const e=this.popup.popupContent.querySelector("input.customize-start-panel-input"),r=this.block;if(!r)return;const i=Number(e.value);!i||(this.editor.undoManager.runInGroup(()=>{Ja(this.editor,[r,...Ya(r)],i,{resetGroupId:!0})}),this.popup.close("clickItem"))});m(this,"handleKeydown",(t,e)=>{const r=e;r.isComposing||(r.key==="Escape"?this.popup.close("cancelBar"):r.key==="Enter"&&this.handleOk())});this.editor=t,this.popup=new Va(this.createDialogContent()),this.popup.on("show",this.handleDialogShow)}destroy(){this.popup.destroy()}createNumericInput(){const t=v("input",["customize-start-panel-input"],null);t.type="number",t.min="1";const e=()=>{const i=t.value.replace(/[^\d]/g,"").replace(/^0+/,""),o=parseInt(i,10);o<=0||Number.isNaN(o)?t.value="":t.value=i};return this.editor.domEvents.addEventListener(t,"input",e),t}}function MF(n,t){return Xa(n)===Xa(t)}function UF(n,t){const e=sk(t);return e?MF(e,t)?nr(e)!==nr(t)-1:!0:!1}function OF(n,t){return hs(t)?!0:nr(t)!==1}function NF(n,t){return Ne(t),[{id:"continue-numbering",name:D.t("list.continueList"),states:UF(n,t)?[]:["disabled"]},{id:"start-new-list",name:D.t("list.restartList"),states:OF(n,t)?[]:["disabled"]},{id:"set-numbering-value",name:D.t("list.changeNumber")}]}function PF(n,t,e){var r,i;if(Ne(t),e.id==="continue-numbering"){const o=sk(t);o&&Ja(n,[t,...Ya(t)],nr(o)+1,{resetGroupId:!0,groupId:Xa(o)})}if(e.id==="start-new-list"&&n.undoManager.runInGroup(()=>{Ja(n,[t,...Ya(t)],1,{resetGroupId:!0})}),e.id==="set-numbering-value"){const o=(r=n.options.componentsOptions)==null?void 0:r.list;if((i=o==null?void 0:o.onChangeStart)!=null&&i.call(o,n,t,e))return;n.addCustom("list-customize-start-dialog",()=>new _F(n)).show(n,t)}}class FF{constructor(t){m(this,"menu");m(this,"handleClick",(t,e)=>{const r=ha(e,"div.list-container");if(r&&this.editor.isWritable()){const i=Z(r);p(Le,i,"no parent block"),Ne(i);const o=t.getBlockData(i);if(o&&o.checkbox){t.updateBlockData(i,{...o,checkbox:o.checkbox==="checked"?"unchecked":"checked"});return}if(er(i)==="unordered")return;this.menu.updateItems(this.getCommandItems(i)),this.menu.manualShow(r),this.activeList(r,!0)}});m(this,"handleMenuClose",()=>{var e;const t=(e=this.menu.tippyInstance)==null?void 0:e.reference;t&&this.activeList(t,!1)});m(this,"handleMenuClick",(t,e)=>{var i;const r=(i=this.menu.tippyInstance)==null?void 0:i.reference;if(r){const o=Z(r);o&&PF(this.editor,o,e)}});this.editor=t,this.editor.addListener("click",this.handleClick),this.menu=new ls([]),this.menu.addListener("close",this.handleMenuClose),this.menu.addListener("click",this.handleMenuClick)}destroy(){this.editor.removeListener("click",this.handleClick),this.menu.removeListener("close",this.handleMenuClose)}getCommandItems(t){return NF(this.editor,t)}activeList(t,e){const r=Z(t);!r||(e?(z(t,"active"),z(r,"active")):(ot(t,"active"),ot(r,"active")))}}class KF{constructor(t){this.editor=t}handleBeforeKeyDown(t,e){const r=t.selection.range.getSelectedBlocks();if(r.length===0)return!1;const i=r[0].block;if(!Ft(i)||!OC(i))return!1;if(e.key==="ArrowUp"||e.key==="ArrowLeft"){const o=mr(i);return o&&t.selection.selectBlock(o,dt(t,o)),!0}if(e.key==="ArrowDown"||e.key==="ArrowRight"){const o=gr(i);return o&&t.selection.selectBlock(o,0),!0}return(e.key==="Delete"||e.key==="Backspace"||e.key==="Escape")&&dk(t,i),!0}}function VF(n,t,e,r,i){vp(n,"list-block-init",()=>{setTimeout(()=>{n.input.addHandler(new KF(n)),n.input.addHandler(new LF(n)),n.addCustom("list-clear-selection-handler",()=>new IF(n)),n.addCustom("list-marker-menu",()=>new FF(n))})});const o=Nn.createBlockContent(n,t,e,r,i),s=i,{level:l,start:c,groupId:d}=s,h=Za(s);r.setAttribute("data-list-level",`${l||1}`),r.setAttribute("data-list-start",`${c||1}`),r.setAttribute("data-list-group-id",`${d}`),r.setAttribute("data-list-type",h);const C=pF(s);return r.insertBefore(C,o),s.viewAsMindmap?setTimeout(()=>{const E=n.getBlockById(i.id);E&&y0(n,E,{},{mindmapTools:k0,saveData:!1})}):setTimeout(()=>{const E=n.getBlockById(i.id);E&&fk(n,E)}),o}const $F={list:{confirm:"\u786E\u5B9A",setStart:"\u8BBE\u7F6E\u7F16\u53F7",continueList:"\u7EE7\u7EED\u7F16\u53F7",restartList:"\u5F00\u59CB\u65B0\u5217\u8868",changeNumber:"\u4FEE\u6539\u7F16\u53F7\u503C",numberLabel:"\u7F16\u53F7\u987A\u5E8F",mention:{tooltip:"\u63D0\u53CA\u4EBA\u5458\u5E76\u901A\u77E5"}},mindmap:{viewAsMindMap:"\u663E\u793A\u4E3A\u8111\u56FE",autoFit:"\u81EA\u52A8\u7F29\u653E",fullScreen:"\u5168\u5C4F\u67E5\u770B",close:"\u5173\u95ED",exitFullscreen:"\u9000\u51FA\u5168\u5C4F"}},HF={list:{confirm:"Confirm",setStart:"Set number",continueList:"Continue numbering",restartList:"Start a new list",changeNumber:"Set numbering value",numberLabel:"Numbering order",mention:{tooltip:"Mention and notify users"}},mindmap:{viewAsMindMap:"View as MindMap",autoFit:"Auto zoom",fullScreen:"Full screen",close:"Close",exitFullscreen:"Exit full screen"}},jF={list:{confirm:"OK",setStart:"\u756A\u53F7\u3092\u8A2D\u5B9A",continueList:"\u9023\u756A\u3092\u8A2D\u5B9A",restartList:"\u65B0\u3057\u3044\u30EA\u30B9\u30C8\u3092\u4F5C\u6210",changeNumber:"\u756A\u53F7\u3092\u7DE8\u96C6",numberLabel:"\u756A\u53F7",mention:{tooltip:"\u30E1\u30F3\u30B7\u30E7\u30F3\u304A\u3088\u3073\u901A\u77E5"}},mindmap:{viewAsMindMap:"\u30DE\u30A4\u30F3\u30C9\u30DE\u30C3\u30D7\u3067\u8868\u793A",autoFit:"\u81EA\u52D5\u30D5\u30A3\u30C3\u30C8",fullScreen:"\u5168\u753B\u9762\u8868\u793A\u306E\u30AA\u30F3",close:"\u9589\u3058\u308B",exitFullscreen:"\u5168\u753B\u9762\u8868\u793A\u306E\u30AA\u30D5"}};D.mergeLang({"zh-CN":$F,"en-US":HF,"ja-JP":jF});const qlt="",kk={...Nn,blockType:"list",createBlockContent:VF,convertFrom:dF,convertTo:mF,handleDrop:eF,notify:JP,handleDeleteBlock:(n,t)=>{if(Ft(t)){const e=new w0(n,t);setTimeout(()=>{e.fix()})}}},GC=I("paragraph");class zF{constructor(t){m(this,"id","BlockParagraphProvider");this.editor=t}isChecked(t,e){return!!(t[e]||t.level&&(t.ordered===!0&&!t.checkbox&&e==="ordered-list"||t.ordered===!1&&!t.checkbox&&e==="unordered-list")||e==="check-list"&&t.checkbox)}getAvailableCommands(t,e){if(!rt(t,e))return[];if(Jr(t))return[];const r=[],i={"unordered-list":[D.t("commands.unordered"),qe("CtrlOrCmd+Shift+U"),xT],"ordered-list":[D.t("commands.ordered"),qe("CtrlOrCmd+Shift+L"),ET],"check-list":[D.t("commands.check"),void 0,AT],link:[D.t("commands.link"),qe("CtrlOrCmd+K"),Zp],quoted:[D.t("commands.quote"),void 0,bT]},o=lt(e),s=Dt(e),l=Nr(t,e),c=t.getBlockData(e);return Object.entries(i).forEach(([d,[h,C,E]])=>{const x=[];if(this.isChecked(c,d)&&x.push("checked"),d==="link"){if(!t.selection.range.isSimple())return;t.selection.range.getSelectedBlocks().length!==1&&x.push("disabled")}r.push({blockId:o,blockType:s,blockKind:l,id:d,name:h,desc:C,states:x,icon:E,groupIndex:600})}),r}convertLink(t,e,r){p(GC,Vr(e.start),""),p(GC,Vr(e.start),"");const i="bottom-start",o=e.start.offset,s=e.end.offset,l=(x,B)=>{t.undoManager.runInGroup(()=>{try{const k=t.selection.range.isCollapsed();let w;if(k){w=ro(t.getBlockText(r),s,x,{link:B}),t.setBlockText(r,w);return}w=mh(t.getBlockText(r),o,s,x),w=mu(o,x.length,w,"link",B),t.setBlockText(r,w),t.selection.selectBlock(r,o+x.length),t.focus()}catch(k){GC.error(k)}})},c=()=>{t.selection.selectBlock(r,s),t.focus()},d=Yi(t,r,e)[0];if(!d)return;const h=Zi(t,r,"link-button-anchor",d),C=t.getBlockText(r),E=Ba(C,o);nf(t,{target:h,linkText:t.getSelectedText(),linkUrl:(E==null?void 0:E.link)||"",onFinished:l,onClose:c,placement:i})}convertToList(t,e,r){const i=nh(t,e,"list",{offset:0,data:{listType:r}});i&&t.undoManager.runInGroup(()=>{const o=vt(e),s=it(e);t.insertBlock(ct(s),o,i.blockData),t.deleteBlock(e)})}executeCommand(t,e,r,i){var c;if(!rt(t,e)||Jr(t))return!1;const o=i.id,s=(c=i.states)==null?void 0:c.includes("checked");let l=!1;if(o==="unordered-list"&&(s?tc(t,e):this.convertToList(t,e,"unordered"),l=!0),o==="ordered-list"&&(s?tc(t,e):this.convertToList(t,e,"ordered"),l=!0),o==="check-list"&&(s?tc(t,e):this.convertToList(t,e,"unchecked"),l=!0),o==="quoted"){const h=t.getBlockData(e).quoted;t.updateBlockData(e,{quoted:h?void 0:!0}),l=!0}if(o==="link"){const d=A0(t);d==null||d.disableTextToolbar(),d==null||d.hide(),setTimeout(()=>{d==null||d.enableTextToolbar()},1e3),this.convertLink(t,r,e),l=!0}return l}}const GF={left:Pa,right:i0,center:o0};class WF{constructor(t){m(this,"id","BlockAlignProvider");this.editor=t}applyAlignStyle(t,e,r){Object.keys(GF).includes(r)?t.updateBlockData(e,{align:r}):t.updateBlockData(e,{align:null})}isChecked(t,e){return t.align===e}getAvailableCommands(t,e,r){if(!rt(t,e))return[];if(Jr(t))return[];const i=lt(e),o=Dt(e),s=Nr(t,e),l=t.getBlockData(e),c=d=>{var C;const h=v("span",["toolbar-item-name-container"],null);for(const E of d.children)if((C=E.states)!=null&&C.includes("checked"))return h.innerHTML=E.icon||Pa,h;return h.innerHTML=Pa,h};return[{id:"align",name:D.t("commands.alignGroup"),blockId:i,blockType:o,blockKind:s,groupIndex:700,dropdown:!0,element:c,manualShowChildren:!0,childrenPlacement:"bottom-start",defaultCheckedChildren:["align-left"],children:[{id:"align-left",name:D.t("commands.alignLeft"),icon:Pa,states:this.isChecked(l,"left")?["checked"]:[]},{id:"align-center",name:D.t("commands.alignCenter"),icon:o0,states:this.isChecked(l,"center")?["checked"]:[]},{id:"align-right",name:D.t("commands.alignRight"),icon:i0,states:this.isChecked(l,"right")?["checked"]:[]}],childrenType:"menu"}]}executeCommand(t,e,r,i){if(!rt(t,e)||Jr(t))return!1;if(i.id.startsWith("align")){const o=i.id.replace(/^align-/,"");return this.applyAlignStyle(t,e,o),!0}return!1}}const qF=I("toolbar-handler"),XF={id:"",name:"",type:"separator"};class ec{constructor(t){m(this,"id","editor-toolbar");m(this,"toolbar");m(this,"toolbarType","object");m(this,"mouseDown",!1);m(this,"oldRange",null);m(this,"hoveringBlock",null);m(this,"hoveringTextChild",null);m(this,"_disableTextToolbar",!1);m(this,"_lastClickTime",0);m(this,"isInToolbar",t=>this.toolbar.isInCommandBar(t.target));m(this,"handleButtonClick",(t,e)=>{const r=this.editor.getCustom("editor-tooltip");r.lastClickButtonId=e.id,this.toolbarType==="text"?(this.editor.editorCommandProviders.executeCommand(this.editor.selection.range,e,{}),this.editor.isWritable()&&this.showTextToolbar("click")):Date.now()-this._lastClickTime>200&&(this.toolbar.close("clickItem"),this.hoveringBlock&&BP(this.editor,this.hoveringBlock,this.hoveringTextChild,e)),this._lastClickTime=Date.now()});m(this,"handleClose",()=>{aC(this.editor)&&this.editor.focus()});m(this,"handleClosing",(t,e)=>{if(this.toolbarType==="object"){const r=Vb(e);if(this.hoveringBlock===r)return!1}return!0});m(this,"handleDocumentMouseDown",t=>{t.button===0&&(document.addEventListener("mouseup",this.handleDocumentMouseUp),this.mouseDown=!0)});m(this,"handleDocumentMouseUp",()=>{document.removeEventListener("mouseup",this.handleDocumentMouseUp),this.mouseDown=!1,this.handleSelectionChange(this.editor)});m(this,"handleHoveringBlockChildChange",(t,e,r,i)=>{if(!(this.hoveringBlock===t&&this.hoveringTextChild===e)&&(this.hoveringBlock=t,this.hoveringTextChild=e,!(this.toolbar.isVisible&&this.toolbarType==="text"))){if(!t){this.toolbar.close("fromHover");return}this.showObjectToolbar(i)}});m(this,"handleSelectionChange",ke.default(t=>{var r;if(p(qF,t===this.editor,"editor mismatch"),t.selection.range.isCollapsed()||this.mouseDown){if(this.toolbarType==="object"){const i=(r=this.toolbar.tippyInstance)==null?void 0:r.reference,o=this.editor.selection.focusedBlock;if(i&&re(i,o))return}this.toolbar.close("selectionChange"),this.oldRange=null;return}if(!this.editor.isWritable()){this.toolbar.close("selectionChange"),this.oldRange=null;return}if(t.selection.range.getSelectedBlocks().length===0){this.toolbar.close("selectionChange"),this.oldRange=null;return}this.oldRange&&this.oldRange.isEqual(t.selection.range)||(this.oldRange=t.selection.range,this.showTextToolbar("selectionChange"))},50));this.editor=t;const e=t.options.componentsOptions.popover;this.toolbar=new ju([],void 0,{tooltipId:t.clientId,id:"editor-toolbar",overflowBoundary:e==null?void 0:e.overflowBoundary,refuseOverflow:!0,padding:20}),this.toolbar.on("click",this.handleButtonClick),this.toolbar.on("close",this.handleClose),this.toolbar.on("closing",this.handleClosing),this.bindEvents(),t.addListener("selectionChanged",this.handleSelectionChange),Re.get(t).addListener("childChange",this.handleHoveringBlockChildChange),Re.get(t).addFilter(this),t.editorCommandProviders.registerCommandProvider(new yP(t)),t.editorCommandProviders.registerCommandProvider(new zF(t)),t.editorCommandProviders.registerCommandProvider(new WF(t))}disableTextToolbar(){this._disableTextToolbar=!0}enableTextToolbar(){this._disableTextToolbar=!1}hide(){this.toolbar.close("selectionChange")}destroy(){this.unbindEvents(),this.toolbar.destroy(),this.editor.removeListener("selectionChanged",this.handleSelectionChange),Re.get(this.editor).removeListener("childChange",this.handleHoveringBlockChildChange)}isInBlock(t,e){return t!==this.hoveringBlock?!1:!!(e.target&&e.target instanceof Node&&this.toolbar.popper&&re(this.toolbar.popper,e.target))}bindEvents(){document.addEventListener("mousedown",this.handleDocumentMouseDown)}unbindEvents(){document.removeEventListener("mousedown",this.handleDocumentMouseDown)}update(t){!this.editor.isWritable()||this.showTextToolbar(t)}showTextToolbar(t){var k,w;if(this._disableTextToolbar)return;const e=this.editor.selection.range,r=e.getSelectedBlocks();if(r.length===0)return;const i=r[0];if(!i)return;if(r.length===1){if(pe(i.block)){t==="click"&&this.showObjectToolbar(null);return}if(It(this.editor,i.block)&&e.isSimple())return}if(qi(i.block)){this.toolbar.close("selectionChange");return}const o=this.editor.editorCommandProviders.getCommands(this.editor.selection.range,this.id),s=new Map;o.forEach(U=>{const M=U.groupIndex,F=s.get(M);F?F.push(U):s.set(M,[U])});const l=[[]],c=Array.from(s.entries()).sort((U,M)=>U[0]-M[0]);for(let U=0;U<c.length;U++){const[,M]=c[U];if(M.length===0)continue;let F=l[l.length-1];F.length>0&&F[F.length-1].groupIndex!==M[M.length-1].groupIndex&&(F=[],l.push(F)),F.push(...x0(M))}if(l.length===0){this.toolbar.close("selectionChange");return}this.toolbarType="text";const d=[];if(l.forEach((U,M)=>{const F=U.sort((Y,X)=>{var G,st;return((G=Y.order)!=null?G:0)-((st=X.order)!=null?st:0)});d.push(...F),M!==l.length-1&&d.push(XF)}),d.length===0){this.toolbar.close("selectionChange");return}this.toolbar.updateItems(d);const h=r[r.length-1],C=!this.editor.selection.range.isReverse()&&h!==i,E=C?h:i,x=nk(this.editor,E),B=Zi(this.editor,E.block,"editor-quick-menu",x);this.toolbar.manualShow(B,{placement:C?"bottom":"top",offset:[0,C?5:10]}),(w=(k=this.toolbar.tippyInstance)==null?void 0:k.popperInstance)==null||w.update()}showObjectToolbar(t){var l,c,d;if(!this.hoveringBlock||this.mouseDown)return;const e=this.hoveringBlock,r=this.hoveringTextChild,{commands:i,element:o}=AP(this.editor,e,r);if(!i.length||!o){this.toolbar.close("fromHover");return}this.toolbarType="object",this.toolbar.isVisible&&((c=(l=this.toolbar)==null?void 0:l.tippyInstance)==null?void 0:c.reference)!==o&&this.toolbar.close("fromHover");const s=()=>{let h;const C=o.getClientRects(),E=[];if(Array.from(C).forEach(x=>{const{y:B}=x;E.includes(B)||E.push(B)}),E.length>1){if(h=r?C[C.length-1]:C[0],t)for(let x=0;x<C.length;x++){const B=C[x],k=new DOMRect(B.x-4,B.y-4,B.width+8,B.height+8);if(k.x<t.clientX&&t.clientX<k.right&&k.y<t.clientY&&t.clientY<k.bottom){h=B;break}}}else{if(h=o.getBoundingClientRect(),r){const x=r.getBoundingClientRect();return new DOMRect(x.x,x.y,x.width,x.height)}return new DOMRect(C[0].x,C[0].y,C[0].width,C[0].height)}if(t){const x=h.y,B=t.clientX;return new DOMRect(B,x,10,h.height)}return h};this.toolbar.updateItems(i),this.toolbar.isVisible||(this.toolbar.manualShow(o,{placement:r?"bottom":"top",getReferenceClientRect:s}),(d=this.toolbar.tippyInstance)!=null&&d.popper&&(this.toolbar.tippyInstance.popper.style.paddingTop="10px",this.toolbar.tippyInstance.popper.style.paddingBottom="5px"))}static register(t){return t.addCustom("toolbar-handler",e=>new ec(e))}static get(t){return t.getCustom("toolbar-handler")}}function I0(n,t,e){n.getBlockData(t).heading===e?n.updateBlockData(t,{heading:null}):n.updateBlockData(t,{heading:e})}function Rk(n,t,e){["left","center","right"].includes(e)?n.updateBlockData(t,{align:e}):n.updateBlockData(t,{align:null})}function WC(n,t){const r=n.getBlockData(t).quoted;n.updateBlockData(t,{quoted:r?void 0:!0})}function qC(n,t){return!!(n[t]||n.level&&(n.ordered===!0&&!n.checkbox&&t==="ordered-list"||n.ordered===!1&&!n.checkbox&&t==="unordered-list")||t==="check-list"&&n.checkbox)}function XC(n,t,e){if(!n.selection.range.focus.isSimple())return;const i=n.getBlockData(t);let o;switch(e){case"unordered-list":o=qC(i,"unordered-list")?void 0:"unordered";break;case"ordered-list":o=qC(i,"ordered-list")?void 0:"ordered";break;case"check-list":o=qC(i,"check-list")?void 0:"unchecked";break}if(o){const s=nh(n,t,"list",{offset:0,data:{listType:o}});s&&n.undoManager.runInGroup(()=>{const l=vt(t),c=it(t);n.deleteBlock(t);const d=n.insertBlock(ct(c),l,s.blockData);s.onConverted&&s.onConverted(n,d)})}else tc(n,t)}const YF=Object.freeze(Object.defineProperty({__proto__:null,applyHeadingStyle:I0,applyAlignStyle:Rk,applyQuoteStyle:WC,applyList:XC},Symbol.toStringTag,{value:"Module"})),QF=[Yh,Qh,Jh,Zh,t0,e0,n0,r0],JF={Unordered:nC,Ordered:rC,Checkbox:tC,Quote:eC};function wk(n,t){const e=n;e.blockOptions=t,e.itemType="insert-block",n.children&&n.children.forEach(r=>wk(r,t))}function ZF(){return{name:"basic",insertBlockCommandItems:[{id:"text",icon:Fa,name:D.t("commands.text"),order:0,group:"basics",value:"text"}]}}function YC(n=1){var i;const t={name:"basic",insertBlockCommandItems:[]};let e=b0();e<=4?e=5:e<8&&(e+=1);let r=n;for(;r<=e;){const o=`heading-${r}`;(i=t.insertBlockCommandItems)==null||i.push({id:o,icon:QF[r-1],name:D.t("quickMenu.basic.heading.title",{heading:String(r)}),order:r,group:"basics",value:String(r),subText:kn(o)}),r++}return t}function tK(){const n={name:"basic",insertBlockCommandItems:[]};return["Unordered","Ordered","Checkbox","Quote"].forEach((e,r)=>{var o;const i=`insert-${e.toLocaleLowerCase()}`;(o=n.insertBlockCommandItems)==null||o.push({id:i,name:D.t(`quickMenu.basic.${e.toLocaleLowerCase()}`),icon:JF[e],value:e.toLocaleLowerCase(),group:"basics",order:10+r,subText:kn(i)})}),n}class Sk{constructor(t){this.withPlainText=t}getCommands(){const t=ZF(),e=YC(),r=tK();return[...this.withPlainText?t.insertBlockCommandItems||[]:[],...e.insertBlockCommandItems||[],...r.insertBlockCommandItems||[]]}updateBlock(t,e,r,i){const{value:o,id:s}=i;return s.startsWith("heading-")?I0(t,r,Number.parseInt(o!=null?o:"1",10)||1):o==="ordered"||o==="unordered"||o==="checkbox"?XC(t,r,{ordered:"ordered-list",unordered:"unordered-list",checkbox:"check-list"}[o]):o==="quote"&&WC(t,r),null}async handleUpdateBlockCore(t,e){const r=t.getBlockByIndex(e.containerId,e.blockIndex);return this.updateBlock(t,e.containerId,r,e.item)}async handleInsertEmptyBlockCore(t,e){const{containerId:r,blockIndex:i}=e,o=t.insertTextBlock(void 0,r,i);return this.updateBlock(t,e.containerId,o,e.item)}async executeCommand(t,e,r){if(r.from==="quick-menu"||r.from==="add-block-menu"){const i=t.getBlockById(r.blockId),o=t.getParentContainer(i),s=ct(o),l=t.getBlockIndex(i);t.undoManager.runInGroup(()=>this.handleUpdateBlockCore(t,{item:e,containerId:s,blockIndex:l})),t.focus()}else r.from==="block-menu"&&(t.undoManager.runInGroup(()=>this.handleInsertEmptyBlockCore(t,{item:e,containerId:r.containerId,blockIndex:r.blockIndex})),t.focus());return null}}const Lk={basics:100,system:200,common:300,thirdParty:400};class QC{constructor(){m(this,"dataUrl","");m(this,"error",null)}destroy(){}setDataUrl(t){this.error=null,this.dataUrl=t}setError(t){this.dataUrl="",this.error=t}}const eK=I("mathjax-converter"),nK="MathJax-script",rK=30,Ik=8;async function iK(n){var r;window.MathJax||(window.MathJax={options:{skipHtmlTags:["script","noscript","style","textarea","pre","code","annotation","annotation-xml","body"]}});const t=n.getComponentOptions("mathjax"),e=((r=t==null?void 0:t.cdn)==null?void 0:r.mathjax)||"https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js";await zs(e,nK)}function oK(){try{window.MathJax&&window.MathJax.texReset()}catch{}}async function JC(n,t){const e="mathjax2Svg";try{await Mr.lock(e),oK(),await iK(n);const r=await window.MathJax.tex2svgPromise(t),i=r.querySelector("merror");if(i)throw new Error(i.textContent);return r.querySelector("svg").outerHTML}catch(r){throw eK.error(r),r}finally{Mr.release(e)}}function sK(n){const t=new DOMParser().parseFromString(n,"image/svg+xml"),e={width:0,height:0};if(t&&t.firstChild){const r=t.firstChild,i=r.getAttribute("height"),o=r.style.minWidth;i&&(e.width=parseInt(o,10)*Ik+rK,e.height=parseInt(i,10)*Ik)}return e}async function Dk(n,t){const e=await JC(n,t);return e?await Vg(e,"image/svg+xml"):""}async function _k(n,t){const r=await JC(n,t),i=new File([r],"math.svg");return(await n.doc.uploadResource(i)).resourceId}async function lK(n,t){const e=await JC(n,t),r=sK(e),i=e,o=new File([i],"math.svg");return{resourceId:(await n.doc.uploadResource(o)).resourceId,...r}}const Mk=I("edit-mathjax");class aK{constructor(){m(this,"editMathjaxPopup",null);m(this,"onChange",null);m(this,"tex","");m(this,"observer",null);m(this,"handleClose",t=>{var r;const e=t.content.querySelector("textarea");if(e){const i=e.value;i!==this.tex&&((r=this.onChange)==null||r.call(this,i,!0))}});m(this,"handleKeyup",t=>{var e;t.isComposing||(t.key==="Escape"&&((e=this.editMathjaxPopup)==null||e.close("cancelBar")),this.handleChange(t.target.value))});m(this,"handleChange",ke.default(t=>{var e;(e=this.onChange)==null||e.call(this,t,!1)},300))}editMathjax(t,e,r,i){if(!this.editMathjaxPopup)this.editMathjaxPopup=new Va(this.createPopupContent(e),{id:"mathjax-popover"});else{const o=this.getTextarea();o.value=e}this.tex=e,this.editMathjaxPopup.manualShow(t,{theme:"light",placement:i==null?void 0:i.placement}),this.editMathjaxPopup.removeAllListeners("close"),this.editMathjaxPopup.addListener("close",this.handleClose),this.onChange=r}createPopupContent(t){const e=v("textarea",["mathjax-editor-textarea"],null);return e.value=t,e.addEventListener("keyup",this.handleKeyup),this.textareaWatcher(e),e}textareaWatcher(t){const e=t;e.onblur=()=>{var i;(i=this.editMathjaxPopup)!=null&&i.isVisible&&t.focus()};const r=()=>{setTimeout(()=>{t.focus()})};this.observer=new IntersectionObserver(r,{}),this.observer.observe(t)}getTextarea(){p(Mk,this.editMathjaxPopup,"no exists mathjax editor popup");const t=this.editMathjaxPopup.content.querySelector("textarea");return p(Mk,t,"no textarea"),t}destroy(){var t,e;this.onChange=null,(t=this.observer)==null||t.disconnect(),(e=this.editMathjaxPopup)==null||e.removeAllListeners()}}function Uk(n,t,e,r,i){n.addCustom("mathjax-editor",()=>new aK).editMathjax(t,e.trim(),r,i)}function Ok(){return{insert:" ",attributes:{id:et(),box:!0,type:"math",tex:" ",src:"",created:Date.now()}}}function D0(n,t){const e=n.getBoxData(t),r=Z(t);if(!r)return;const i=Yo(r,t);n.selection.selectBlock(r,i.start,i.end);const o=async(s,l)=>{if(!s.trim()){n.updateBoxData({...e,tex:s,src:null});return}try{await Mr.lock("convertAndUploadMathjax");const c=await _k(n,s);n.updateBoxData({...e,tex:s,src:c})}catch(c){const d=n.getBoxData(t);n.addCustom(`mathjax-box-${d.id}`,()=>new QC).setError(c),n.updateBoxData({...e,tex:s,src:""})}finally{Mr.release("convertAndUploadMathjax"),l&&n.focus()}};Uk(n,t,e.tex,o)}const Nk=I("mathjax-box");function ZC(n,t){n.selection.updateSelection(null);const e=t.target;!e||!(e instanceof HTMLElement)||n.domEvents.removeEventListener(e,null,ZC)}async function cK(n,t,e){try{if(!t.tex.trim())return;const r=await Dk(n,t.tex),i=n.findBoxById(t.id);if(!i)return;const o=e1(i);o.innerHTML="";const s=v("img",["mathjax"],o);s.src=r,e.setDataUrl(r),n.domEvents.addEventListener(s,"load",ZC)}catch(r){e.setError(r);const i=n.findBoxById(t.id);if(!i)return;const o=i.querySelector(".mathjax-tex-text");z(o,"mathjax-error"),o.innerText=r.message,n.selection.updateSelection(null)}}function uK(n,t,e,r){const i=r,o=n.addCustom(`mathjax-box-${i.id}`,()=>new QC);if(i.src||o.dataUrl){const c=v("img",["mathjax"],e);c.src=n.doc.buildResourceUrl(i.src||o.dataUrl,{syncNewResources:async(d,h)=>{var E,x;await n.doc.addResources([d]);const C=(x=(E=n.doc).getServerMeta)==null?void 0:x.call(E).appId;if(i.src&&i.src!==h&&C&&i.src.includes(C)){const B=Z(e),k=mt.default(i);B&&n.isBlockWritable(B)&&!n.readonly&&(k.src=d,n.updateBoxData(k))}}}),n.domEvents.addEventListener(c,"load",ZC);return}const s=["mathjax-tex-text"];let l=i.tex;l.trim()?o.error&&(l=o.error.message,s.push("mathjax-error")):l=D.t("mathjax.emptyText"),v("span",s,e,l),cK(n,i,o)}function fK(n,t){const e={id:et(),box:!0,type:"math",tex:t,src:"",created:Date.now()};return _k(n,t).then(r=>{if(!n.findBoxById(e.id))return;const o={...e,src:r};n.updateBoxData(o)}).catch(r=>{Nk.error(`failed to convert and upload mathjax: ${JSON.stringify(r)}`)}),e}function dK(n,t,e,r){const i=t;return r==="text"?i.tex:r==="markdown"?` $${i.tex}$ `:i.src?`<img src="${n.doc.buildResourceUrl(i.src,{withToken:!0})}" />`:`<code>$${i.tex}$</code>`}function hK(n,t,e){const r=Z(t);p(Nk,r,"failed to get block"),!(n.readonly||!n.isBlockWritable(r))&&D0(n,t)}function mK(){return{abstract:`[${D.t("mathjax.abstract")}]`}}const Pk={boxType:"math",updateBoxContent:uK,convertFrom:fK,convertTo:dK,handleClickBox:hK,getBoxProperties:mK};async function gK(n,t,e){try{const r=t.embedData,i=await Dk(n,r.mathjaxText),o=n.findBlockById(t.id);if(!o)return;const s=Nt(o);s.innerHTML="";const l=v("img",["mathjax"],s);l.src=i,e.setDataUrl(i)}catch(r){e.setError(r)}}function pK(n,t){if(n.readonly||!t.target||!(t.target instanceof Node))return;const e=Z(t.target);if(!e||!pe(e)||$e(e)!=="math")return;const r=Nt(e),i=r.querySelector("img")||r.querySelector("span.mathjax-tex-text");if(!i||!re(i,t.target))return;const s=n.getBlockData(e).embedData;Uk(n,i,s.mathjaxText,async l=>{const{resourceId:c,width:d,height:h}=await lK(n,l),C={mathjaxText:l,src:c,width:d,height:h};n.updateEmbedData(e,C)},{placement:"bottom"})}function CK(n,t,e){const r=e.embedData,{src:i,width:o}=r,s=n.addCustom(`mathjax-block-${e.id}`,()=>new QC);if(n.domEvents.addEventListener(t,"click",pK),!r.mathjaxText.trim()){v("span",["mathjax-tex-text"],t,D.t("mathjax.emptyText"));return}if(i||s.dataUrl){const l=v("img",["mathjax"],t);l.src=n.doc.buildResourceUrl(i||s.dataUrl,{syncNewResources:async(c,d)=>{var h,C;if(i){await n.doc.addResources([c]);const E=(C=(h=n.doc).getServerMeta)==null?void 0:C.call(h).appId;if(i&&d!==i&&E&&i.includes(E)){const x=Z(t);setTimeout(()=>{if(x&&!n.readonly&&n.isBlockWritable(x)){const B=mt.default(e);B.embedData.src=c,n.updateBlockData(x,B)}})}}}}),o&&(l.style.minWidth=`${o}px`,setTimeout(()=>{const c=t.getBoundingClientRect().width;o>c?(z(t,"mathjax-overflow"),t.style.overflow="auto",t.style.setProperty("--mathjax-width",`${o}px`)):(ot(t,"mathjax-overflow"),t.removeAttribute("data-mathjax-width"),t.style.removeProperty("--mathjax-width"))}));return}s.error,v("span",["mathjax-tex-text"],t,r.mathjaxText),gK(n,e,s)}function EK(n,t,e){if(!rt(n,t))return null;const r=n.getBlockString(t).trim();if(!r||!r.startsWith("$$")||!r.endsWith("$$"))return null;const i=Ng(r,"$");if(!i)return null;const o={mathjaxText:i,src:""};return{blockData:{id:et(),type:"embed",embedType:"math",embedData:o}}}function xK(n){return{name:"Mathjax"}}function AK(n,t){var r;const e=Nt(t);n.domEvents.removeAllListeners(e),n.findCustom("mathjax-editor")&&((r=n.getCustom("mathjax-editor").editMathjaxPopup)==null||r.close("cancelBar"))}function bK(n,t,e,r){const i=t.embedData;return r==="html"?`<img src="${n.doc.buildResourceUrl(i.src,{withToken:!0})}" />`:r==="markdown"?`
|
|
615
615
|
$$${i.mathjaxText}$$
|
|
616
616
|
`:i.mathjaxText}function vK(){return{abstract:D.t("mathjax.abstract")}}const BK={embedType:"math",createEmbedContent:CK,getOptions:xK,convertFrom:EK,handleDeleteBlock:AK,convertTo:bK,getBlockProperties:vK},Xlt="",TK={mathjax:{emptyText:"\u7A7A\u7684\u516C\u5F0F",abstract:"\u516C\u5F0F"}},yK={mathjax:{emptyText:"Empty formula",abstract:"Formula"}},kK={mathjax:{emptyText:"\u6570\u5F0F\u306A\u3057",abstract:"\u6570\u5F0F"}};D.mergeLang({"zh-CN":TK,"en-US":yK,"ja-JP":kK});function RK(n,t,e,r){const i=n.getBlockByIndex(t,e),o=n.getBlockText(i),{left:s}=Mn(o,r);if(!de(s).endsWith("$$$$"))return!1;const c=r-4,d=r,h={id:et(),box:!0,type:"math",tex:" ",src:"",created:Date.now()};return n.undoManager.runInGroup(()=>{n.deleteTextFromBlock(i,c,d-c),n.insertBoxToBlock(i,c,h),setTimeout(()=>{const C=n.getBoxById(h.id);D0(n,C)})}),!0}class wK{handleAfterInsertText(t,e,r,i,o){return!!(o===" "&&RK(t,e,r,i))}}var rr={exports:{}};/**
|
|
@@ -823,7 +823,7 @@ ${s}
|
|
|
823
823
|
<path d="M8 15.8391V15.8391C8 14.8234 8.82338 14 9.83908 14H10C11.1046 14 12 14.8954 12 16V16.0683C12 16.4975 11.7782 16.8963 11.4135 17.1227L10.8496 17.4726C10.3213 17.8006 10 18.3782 10 19V19" stroke="#6C6D6E" stroke-width="2" stroke-linecap="square"/>
|
|
824
824
|
<circle cx="10" cy="22" r="1" fill="#6C6D6E"/>
|
|
825
825
|
</svg>
|
|
826
|
-
`,k4={dwg:[],rvt:[],skp:[],img:["image/png","image/jpg","image/jpeg","image/bmp","image/ico","image/icon","image/gif","image/svg+xml"],txt:["text/plain"],zip:["application/zip","application/x-rar-compressed","application/x-7z-compressed","application/x-tar","application/x-bzip2","application/java-archive"],ppt:["application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation"],excel:["application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],pdf:["application/pdf"],word:["application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"]},ix={dwg:Hq,rvt:jq,skp:zq,img:Gq,txt:Wq,zip:y4,rar:y4,ppt:qq,excel:Xq,pdf:Yq,word:Qq};function R4(n,t){const e=Object.keys(k4);for(let i=0;i<e.length;i+=1){const o=e[i];if(k4[o].includes(t))return ix[o]}const r=eu(n.toLowerCase());return ix[r]?ix[r]:Jq}async function Zq(n,t,e){var k;const{fileName:r,fileType:i,fileSize:o}=e,s=v("div",["card-root"],t),l=v("div",["file-icon"],s),{renderFileCardIcon:c}=((k=n.options.componentsOptions)==null?void 0:k.file)||{};if(!c)l.innerHTML=R4(r,i);else{const w=c&&await c(n,e);w?l.append(w):l.innerHTML=R4(r,i)}const d=v("div",["file-details"],s),h=eu(r),C=r.length-h.length-3,E=v("div",["file-name"],d);C>0?(v("span",["file-name-pre"],E,r.slice(0,C)),v("span",[],E,r.slice(C))):E.textContent=r,v("div",["file-size"],d,uv(o));const x=v("div",["file-actions"],s),B=v("button",["download"],x);return B.innerHTML=rx,{card:s,downloadButton:B}}const yat="";function w4(n,t){const r=n.getBlockData(t).embedData,i=n.options.componentsOptions.file;if(i!=null&&i.onDownloadFile){i.onDownloadFile(n,r,"embed");return}const o=n.doc.buildResourceUrl(r.src,{downloadFileName:r.fileName});Yd(o,r.fileName)}async function tX(n,t,e){const{embedData:r}=e,i=r,{card:o,downloadButton:s}=await Zq(n,t,i);n.domEvents.addEventListener(s,"click",(l,c)=>{if(!c.target)return;const d=Z(c.target);!d||w4(l,d)}),n.domEvents.addEventListener(o,"click",(l,c)=>{if(!c.target)return;const d=Z(c.target);if(!d||ha(c,"button"))return;const h=l.options.componentsOptions.file;if(h!=null&&h.onClick){h.onClick(l,d,c);return}const E=l.getBlockData(d).embedData,x=l.doc.buildResourceUrl(E.src,{downloadFileName:E.fileName});Yd(x,E.fileName)})}class eX{constructor(t){m(this,"group","hovering-toolbar");m(this,"_commands",[{id:"download",name:D.t("file.commands.download"),icon:rx},{id:"add-comment",name:D.t("file.commands.comment"),icon:ul},{id:"sep",name:"",type:"separator"},{id:"to-link",name:D.t("file.commands.toLink"),icon:b4},{id:"to-card",name:D.t("file.commands.toCard"),icon:v4,states:["checked"]}]);this.editor=t}get commands(){if(this.editor.readonly)return[];const{enableComments:t=!0}=this.editor.options;return t?this._commands:this._commands.filter(e=>e.id!=="add-comment")}executeCommand(t,e,r){if(r.id==="to-link"){const i=it(e),o=ct(i),s=vt(e),l=t.getBlockData(e),{embedData:c}=l,d=c,h={id:et(),box:!0,type:"file",created:Date.now(),src:d.src,fileName:d.fileName,fileSize:d.fileSize,fileType:d.fileType};t.undoManager.runInGroup(()=>{t.deleteBlock(e);const
|
|
826
|
+
`,k4={dwg:[],rvt:[],skp:[],img:["image/png","image/jpg","image/jpeg","image/bmp","image/ico","image/icon","image/gif","image/svg+xml"],txt:["text/plain"],zip:["application/zip","application/x-rar-compressed","application/x-7z-compressed","application/x-tar","application/x-bzip2","application/java-archive"],ppt:["application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation"],excel:["application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],pdf:["application/pdf"],word:["application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"]},ix={dwg:Hq,rvt:jq,skp:zq,img:Gq,txt:Wq,zip:y4,rar:y4,ppt:qq,excel:Xq,pdf:Yq,word:Qq};function R4(n,t){const e=Object.keys(k4);for(let i=0;i<e.length;i+=1){const o=e[i];if(k4[o].includes(t))return ix[o]}const r=eu(n.toLowerCase());return ix[r]?ix[r]:Jq}async function Zq(n,t,e){var k;const{fileName:r,fileType:i,fileSize:o}=e,s=v("div",["card-root"],t),l=v("div",["file-icon"],s),{renderFileCardIcon:c}=((k=n.options.componentsOptions)==null?void 0:k.file)||{};if(!c)l.innerHTML=R4(r,i);else{const w=c&&await c(n,e);w?l.append(w):l.innerHTML=R4(r,i)}const d=v("div",["file-details"],s),h=eu(r),C=r.length-h.length-3,E=v("div",["file-name"],d);C>0?(v("span",["file-name-pre"],E,r.slice(0,C)),v("span",[],E,r.slice(C))):E.textContent=r,v("div",["file-size"],d,uv(o));const x=v("div",["file-actions"],s),B=v("button",["download"],x);return B.innerHTML=rx,{card:s,downloadButton:B}}const yat="";function w4(n,t){const r=n.getBlockData(t).embedData,i=n.options.componentsOptions.file;if(i!=null&&i.onDownloadFile){i.onDownloadFile(n,r,"embed");return}const o=n.doc.buildResourceUrl(r.src,{downloadFileName:r.fileName});Yd(o,r.fileName)}async function tX(n,t,e){const{embedData:r}=e,i=r,{card:o,downloadButton:s}=await Zq(n,t,i);n.domEvents.addEventListener(s,"click",(l,c)=>{if(!c.target)return;const d=Z(c.target);!d||w4(l,d)}),n.domEvents.addEventListener(o,"click",(l,c)=>{if(!c.target)return;const d=Z(c.target);if(!d||ha(c,"button"))return;const h=l.options.componentsOptions.file;if(h!=null&&h.onClick){h.onClick(l,d,c);return}const E=l.getBlockData(d).embedData,x=l.doc.buildResourceUrl(E.src,{downloadFileName:E.fileName});Yd(x,E.fileName)})}class eX{constructor(t){m(this,"group","hovering-toolbar");m(this,"_commands",[{id:"download",name:D.t("file.commands.download"),icon:rx},{id:"add-comment",name:D.t("file.commands.comment"),icon:ul},{id:"sep",name:"",type:"separator"},{id:"to-link",name:D.t("file.commands.toLink"),icon:b4},{id:"to-card",name:D.t("file.commands.toCard"),icon:v4,states:["checked"]}]);this.editor=t}get commands(){if(this.editor.readonly)return[];const{enableComments:t=!0}=this.editor.options;return t?this._commands:this._commands.filter(e=>e.id!=="add-comment")}executeCommand(t,e,r){if(r.id==="to-link"){const i=it(e),o=ct(i),s=vt(e),l=t.getBlockData(e),{embedData:c}=l,d=c,h={id:et(),box:!0,type:"file",created:Date.now(),src:d.src,fileName:d.fileName,fileSize:d.fileSize,fileType:d.fileType},C=l.comments||[];for(const E of C){const x=`comment-${E.toLocaleLowerCase()}`,B=E;h[x]=B}t.undoManager.runInGroup(()=>{t.deleteBlock(e);const E=[cB(h)];t.insertTextBlock(E,o,s)})}else r.id==="download"?w4(t,e):r.id==="add-comment"&&If(t,e)}}function nX(n,t){const e=n.getBlockData(t),{embedData:r}=e,i=r;return{blockCommands:{"hovering-toolbar":new eX(n)},abstract:i.fileName}}function rX(n,t,e,r){const{embedData:i}=t,o=i;return r==="html"?o.src?`<p><a href="${n.doc.buildResourceUrl(o.src,{withToken:!0})}" >${o.fileName}</a></p>`:`<p>[${o.fileName}]</p>`:r==="markdown"?o.src?`[${o.fileName}](${n.doc.buildResourceUrl(o.src,{withToken:!0})})
|
|
827
827
|
`:`[${o.fileName}]
|
|
828
828
|
`:o.src?`[${o.fileName}](${n.doc.buildResourceUrl(o.src,{withToken:!0})})`:`[${o.fileName}]`}async function iX(n,t,e,r){const{onGetFileDownloadUrl:i}=n.getComponentOptions("file")||{},o=t.embedData,s=i?await i(n,o):void 0;return{blocks:{root:[{type:"embed",id:et(),embedType:"webpage",embedData:{src:s||o.src,title:o.fileName}}]},meta:{},comments:{}}}function oX(){return[]}const sX={embedType:"office",createEmbedContent:tX,getBlockProperties:nX,convertTo:rX,toStandardDoc:iX,getResources:oX},lX={file:{abstract:"\u9644\u4EF6",commands:{download:"\u4E0B\u8F7D",toLink:"\u8F6C\u4E3A\u6807\u9898",toCard:"\u8F6C\u4E3A\u5361\u7247",comment:"\u6279\u6CE8"}}},aX={file:{abstract:"Attachment",commands:{download:"Download",toLink:"To Link",toCard:"To Card",comment:"Annotation"}}},cX={file:{abstract:"\u6DFB\u4ED8\u30D5\u30A1\u30A4\u30EB",commands:{download:"\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9",toLink:"\u30BF\u30A4\u30C8\u30EB\u306B\u5909\u63DB",toCard:"\u30AB\u30FC\u30C9\u306B\u5909\u63DB",comment:"\u6CE8\u91C8"}}};D.mergeLang({"zh-CN":lX,"en-US":aX,"ja-JP":cX});function uX(n){const t=/(\s|^)(http|https):\/\/[\w\-]+(\.[\w\-]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?$/;return t.test(n)?n.search(t):-1}function fX(n){const t=n.selection.range;if(!t.isCollapsed()||!t.isSimple())return;const{start:e}=t,r=n.getBlockById(e.blockId);if(!rt(n,r))return;const i=n.getBlockText(r),s=N1(i).slice(0,e.offset),l=uX(s);if(l===-1)return;const c=s.slice(l),d=s.length;let h=mu(l,d-l,i,"link",c);return h=ro(h,d," ",null),n.setBlockText(r,h),n.selection.selectBlock(r,d+1),!0}const dX={Space:fX},kat="",hX={version:{latest:"\u6700\u65B0\u7248\u672C",insert:"{name} \u6DFB\u52A0",delete:"{name} \u5220\u9664",goBack:"\u8FD4\u56DE",revertVersion:"\u8FD8\u539F\u5185\u5BB9",play:"\u64AD\u653E\u5386\u53F2\u64CD\u4F5C",versionList:"\u5386\u53F2\u7248\u672C ({count})",versionListHeader:"\u5386\u53F2\u7248\u672C",unknown:"\u672A\u77E5\u7248\u672C",restoreFrom:"\u56DE\u6EDA\u81EA\u7248\u672C\u300C{from}\u300D",restoreInfo:"\u56DE\u6EDA\u7684\u7248\u672C\u6682\u4E0D\u652F\u6301\u4E0E\u4E0A\u4E00\u7248\u672C\u5BF9\u6BD4",versionInfoLeft:'<span class="text-1">\u5F53\u524D\u7248\u672C: </span><span class="name">{versionName}</span><span class="text-2"> \u4E0E</span>',versionInfoRight:'<span class="text-3">\u5BF9\u6BD4</span>',noSelectedVersion:"\u672A\u9009\u62E9\u7248\u672C",noMemoedVersion:"\u6682\u65E0\u5DF2\u5907\u6CE8\u7684\u5386\u53F2\u7248\u672C",noFilterVersion:"\u6682\u65E0\u5339\u914D\u7ED3\u679C",memo:"\u5907\u6CE8",revert:"\u56DE\u6EDA",filter:{all:"\u5168\u90E8",memoed:"\u5DF2\u5907\u6CE8",allVersions:"\u5168\u90E8\u5386\u53F2\u7248\u672C",memoVersions:"\u5DF2\u5907\u6CE8\u7684\u5386\u53F2\u7248\u672C"},textarea:{placeholder:"\u8BF7\u8F93\u5165\u7248\u672C\u5907\u6CE8"},tooltip:{help:`1. \u56DE\u6EDA\u7248\u672C\u4E0D\u652F\u6301\u4E0E\u56DE\u6EDA\u524D\u7248\u672C\u8FDB\u884C\u5BF9\u6BD4\uFF1B
|
|
829
829
|
2. \u82E5\u4E24\u4E2A\u7248\u672C\u4E4B\u95F4\u5B58\u5728\u56DE\u6EDA\u7248\u672C\uFF0C\u5219\u4E0D\u652F\u6301\u5BF9\u6BD4\u3002`,user:"\u7248\u672C\u53D1\u5E03\u8005\uFF1A{name}",auth:"\u6682\u65E0\u9875\u9762\u7F16\u8F91\u6743\u9650\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458"},dropdownHeader:"\u4EC5\u5C55\u793A\u53EF\u4E0E\u5F53\u524D\u7248\u672C\u8FDB\u884C\u5BF9\u6BD4\u7684\u5386\u53F2\u7248\u672C",dropdown:{header:"\u6240\u6709\u53EF\u5BF9\u6BD4\u7684\u7248\u672C"},noVersions:"\u6682\u65E0\u53EF\u5BF9\u6BD4\u7684\u7248\u672C",lastVersion:"\u4E0A\u4E00\u7248\u672C",filterMemoed:"\u7B5B\u9009\u5DF2\u5907\u6CE8\u7684\u7248\u672C"}},mX={version:{latest:"Latest",insert:"Added by {name}",delete:"Deleted by {name}",goBack:"Back",revertVersion:"Revert",play:"Play",versionList:"Historical versions ({count})",versionListHeader:"Historical versions",unknown:"Unknown version",restoreFrom:"Rolled back from version {from}",restoreInfo:"The rolled back version does not currently support comparison with the previous version.",versionInfoLeft:'<span class="text-1">Current version: </span><span class="name">{versionName}</span><span class="text-2"> Compare with</span>',versionInfoRight:'<span class="text-3"></span>',noSelectedVersion:"Not selected",noMemoedVersion:"No historical commented versions",noFilterVersion:"No result",memo:"Comment",revert:"Roll back",filter:{all:"All",memoed:"Commented",allVersions:"All historical versions",memoVersions:"Historical versions with comments"},textarea:{placeholder:"Enter comment"},tooltip:{help:`1. A rolled back version can't be compared with versions before it.
|
|
@@ -959,4 +959,4 @@ ${o.mermaidText}
|
|
|
959
959
|
${o.flowchartText}
|
|
960
960
|
\`\`\`\`\`\``}return""}const LJ={embedType:"flowchart",convertFrom:RJ,handleUpdateBlock:kJ,createEmbedContent:yJ,getBlockProperties:wJ,convertTo:SJ},IJ=I("plantuml-helper");function yS(n,t){var l;let r=((l=(n.getComponentOptions("plantuml")||{}).cdn)==null?void 0:l.plantuml)||aJ;r.endsWith("/")||(r+="/");const i=i9.default.encode(t);p(IJ,i,i),r+=i;const s=new URLSearchParams(document.location.search).get("doc");return Fg(r,{id:`${s}-${et()}`})}async function DJ(n,t){try{const e=await xx(n,t);return(await n.doc.uploadResource(e)).resourceId}catch{return Promise.resolve(t)}}class Cc extends Bx{constructor(t){super(t,"plantuml","plantumlText")}static get(t,e){return t.addCustom(`plantuml-${e.id}`,()=>new Cc(t))}code2ObjectUrl(t){return Promise.resolve(yS(this.editor,t))}code2ResourceId(t){const e=yS(this.editor,t);return DJ(this.editor,e)}destroy(){}}function _J(n,t,e){Cc.get(n,e).createEmbedContent(t,e)}function MJ(n,t,e){const r=Cc.get(n,e),i=Nt(t);return r.updateEmbedContent(i,e),!0}function UJ(n,t,e){const{data:r}=e,i=n.getBlockString(t).trim();if(!r||r.embedType!=="plantuml"||i!=="```plantuml"||!rt(n,t))return null;const o={src:"",plantumlText:""};return{blockData:{id:et(),type:"embed",embedType:"plantuml",embedData:o},onConverted:(c,d)=>{Cc.get(c,c.getBlockData(d)).editGraph(Nt(d))}}}function OJ(n,t){return Cc.get(n,n.getBlockData(t)).getBlockProperties(t)}function NJ(n,t,e,r){const{embedData:i}=t,o=i;if(r==="html")return o.src?`<img src="${n.doc.buildResourceUrl(o.src,{withToken:!0})}" />`:o.flowchartText?`<div>${o.flowchartText}</div>`:"<p>[plantuml]</p>";if(r==="markdown"){if(o.src)return`})`;if(o.flowchartText)return`\`\`\`plantuml\`\`\`
|
|
961
961
|
${o.flowchartText}
|
|
962
|
-
\`\`\`\`\`\``}return""}const PJ={embedType:"plantuml",convertFrom:UJ,handleUpdateBlock:MJ,createEmbedContent:_J,getBlockProperties:OJ,convertTo:NJ},Hat="",FJ="hr",KJ={dividingLine:{type:"\u5206\u5272\u7EBF",abstract:"\u5206\u5272\u7EBF"}},VJ={dividingLine:{type:"Dividing-Line",abstract:"Dividing-Line"}},$J={dividingLine:{type:"\u533A\u5207\u308A\u7DDA",abstract:"\u533A\u5207\u308A\u7DDA"}};D.mergeLang({"zh-CN":KJ,"en-US":VJ,"ja-JP":$J});function HJ(n,t){const e=v("div",["editor-embed-container"],t);v("hr",["editor-embed-hr"],e)}function jJ(n,t,e,r){return r==="html"?"<hr />":r==="markdown"?"---":"------------"}function zJ(){return{name:"hr",insertEmbedCommandItems:[{id:"insert-hr",name:D.t("dividingLine.type"),icon:FT,order:500,group:"common",subText:kn("insert-hr")}],handleInsertEmptyEmbed:async(n,t)=>{const{containerId:e,blockIndex:r}=t;return n.insertEmbed(e,r,FJ,{})}}}function GJ(n,t,e){const{data:r}=e;if(!r||r.embedType!=="dividing-line"||!rt(n,t))return null;const i={};return{blockData:{id:et(),type:"embed",embedType:"hr",embedData:i}}}function WJ(){return{abstract:D.t("dividingLine.abstract")}}const qJ={embedType:"hr",createEmbedContent:HJ,convertTo:jJ,getOptions:zJ,convertFrom:GJ,getBlockProperties:WJ},jat="",zat="",XJ={media:{upload:{failed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>',maxSizeFailed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC7\u9650\u5236\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6</div>'},load:{failed:'<div class="line-1">{name}\u52A0\u8F7D\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>'},audio:{menuItem:"\u97F3\u9891",abstract:"\u97F3\u9891"},video:{menuItem:"\u89C6\u9891",abstract:"\u89C6\u9891"}}},YJ={media:{upload:{failed:'<div class="line-1">{name} upload failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>',maxSizeFailed:'<div class="line-1">{name} upload failed</div><div class="line-2">The file size exceeds limit. Please choose another file.</div>'},load:{failed:'<div class="line-1">{name} loading failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>'},audio:{menuItem:"Audio",abstract:"Audio"},video:{menuItem:"Video",abstract:"Video"}}},QJ={media:{upload:{failed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>',maxSizeFailed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u30D5\u30A1\u30A4\u30EB\u306E\u30B5\u30A4\u30BA\u304C\u4E0A\u9650\u3092\u8D85\u3048\u3066\u3044\u308B\u305F\u3081\u3001\u4ED6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044</div>'},load:{failed:'<div class="line-1">{name}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>'},audio:{menuItem:"\u97F3\u58F0",abstract:"\u97F3\u58F0"},video:{menuItem:"\u52D5\u753B",abstract:"\u52D5\u753B"}}};D.mergeLang({"zh-CN":XJ,"en-US":YJ,"ja-JP":QJ});var ni=(n=>(n.AUDIO="audio",n.VIDEO="video",n))(ni||{}),Of=(n=>(n.Empty="empty",n.Progress="progress",n.Error="error",n))(Of||{});const kS=10*1024*1024,JJ=["wav","mp3","aac","ogg","webm","flac"],ZJ=["ogg","mp4","webm"],tZ=()=>{};function RS(n){var h,C,E,x,B,k;const t=(h=n.getComponentOptions("media"))!=null?h:{},{allowedMedias:e,maxSize:r,callbacks:i}=t,o=(C=e==null?void 0:e.audio)!=null?C:JJ,s=(E=e==null?void 0:e.video)!=null?E:ZJ,l=(x=r==null?void 0:r.audio)!=null?x:kS,c=(B=r==null?void 0:r.video)!=null?B:kS,d=(k=i==null?void 0:i.onError)!=null?k:tZ;return{allowedMedias:{audio:o,video:s},maxSize:{audio:l,video:c},callbacks:{onError:d}}}function eZ(n,t){const e=o=>o.map(s=>`.${s}`).join(","),{allowedMedias:r}=RS(n),i=r[t];return i?e(i):"*"}function nZ(n,t,e){const{maxSize:r,callbacks:i,allowedMedias:o}=RS(t),{[e]:s}=r,{[e]:l}=o;if(s&&n.size>s){const d=new Error("media is too large");throw d.code=`MaxMediaSize-${e}`,i!=null&&i.onError&&(i==null||i.onError(t,d)),d}const c=eu(n.name);if(l&&!l.includes(c.toLowerCase())){const d=new Error(`media file is not allowed: ${c}`);throw d.code="NotAllowedFile",i!=null&&i.onError&&(i==null||i.onError(t,d)),d}}function rZ(n){return n===Of.Empty||n===Of.Error}const en=I("media");class iZ extends ye.TypedEmitter{constructor(e){super();m(this,"mediaContainer",null);m(this,"media",null);m(this,"abstract",null);m(this,"handleMediaLoadError",(e,r)=>{if(!r.target||!(r.target instanceof Node)||!(r.target instanceof Element?r.target:r.target.parentElement))return;const o=Z(r.target);if(!o||!o.contains(this.mediaContainer))return;const s=this.renderError();this.updateMediaContent(s),this.emit("mediaError",e,"load_error",lt(o))});m(this,"handleUploadFile",async e=>{p(en,this.abstract,"no abstract"),p(en,this.mediaContainer,"The media element not exist");const{editor:r}=this.options,i=Z(this.mediaContainer);p(en,i,"The block element not exist");const o=r.getBlockData(i);try{const{resourceId:s}=await r.doc.uploadResource(e,{onProgress:C=>{this.renderProgress(C,e)}}),{name:l,type:c,size:d}=e,h={...o,embedData:{...o.embedData,src:s,fileName:l,fileSize:d,fileType:c}};r.updateBlockData(i,h)}catch(s){en.error(s),this.emit("mediaError",r,"upload_error",o.id),this.renderRetry(e,s)}ot(i,"media-block-uploading")});m(this,"destroy",()=>{this.mediaContainer=null});this.options=e}bindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.addEventListener(this.media,"error",this.handleMediaLoadError)}unbindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.removeEventListener(this.media,"error",this.handleMediaLoadError)}updateMediaContent(e){p(en,this.mediaContainer,"The media element not exist"),this.mediaContainer.innerHTML="",this.mediaContainer.append(e)}renderError(){p(en,this.abstract,"no abstract");const{editor:e,createMediaElement:r}=this.options,{mediaIcon:i,mediaName:o}=this.abstract;p(en,this.mediaContainer,"The media element not exist");const s=Z(this.mediaContainer);p(en,s,"The block element not exist");const l=e.getBlockData(s),c=v("div",["media-error","embed-selected-content","embed-hover-content"],null),d=v("span",["media-error-icon"],c);d.innerHTML=i;const h=v("div",[],c);h.innerHTML=D.t("media.load.failed",{name:o}),c.appendChild(h);const C=h.querySelector(".retry-upload");return p(en,C,"The element not exist"),e.domEvents.addEventListener(C,"click",(E,x)=>{const B=v("div",["media-element"],null),k=this.getResourceUrl(l),w=r(E,B,l,k);this.unbindMediaEvent(),this.media=w,this.bindMediaEvent(),this.updateMediaContent(B)}),this.setFullScreen(),c}renderRetry(e,r){var E,x;p(en,this.abstract,"no abstract");const{editor:i}=this.options,{mediaIcon:o,mediaName:s}=this.abstract,l=v("div",["media-error","embed-selected-content","embed-hover-content"],null),c=v("span",["media-error-icon"],l);c.innerHTML=o;const d=v("div",[],l);let h=D.t("media.upload.failed",{name:s});(((E=r.response)==null?void 0:E.status)===420||((x=r.response)==null?void 0:x.status)===413)&&(h=D.t("media.upload.maxSizeFailed",{name:s})),d.innerHTML=h,l.appendChild(d);const C=d.querySelector(".retry-upload");C&&i.domEvents.addEventListener(C,"click",()=>{i.readonly||(p(en,this.abstract,"no abstract"),this.handleUploadFile(e))}),this.updateMediaContent(l),this.setFullScreen()}renderProgress(e,r){p(en,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope .media-progress"),o=e===-1||e===100?100:e;if(i){const{updateProgressElement:s}=this.options;s(i,o)}else{const{createProgressElement:s}=this.options,l=Z(this.mediaContainer);p(en,l,"The element not exist"),z(l,"media-block-uploading");const c=v("div",["media-progress"],null);s(c,o,r),this.updateMediaContent(c)}this.setFullScreen()}renderMediaElement(e,r){p(en,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope > .media-element"),{createMediaElement:o,updateMediaElement:s,editor:l}=this.options,c=this.getResourceUrl(e,r);if(i){const d=s(l,i,e,c);this.unbindMediaEvent(),this.media=d,this.bindMediaEvent()}else{const d=v("div",["media-element"],null),h=o(l,d,e,c);this.unbindMediaEvent(),this.media=h,this.bindMediaEvent(),this.updateMediaContent(d)}}renderEmpty(e){p(en,this.abstract,"no abstract"),p(en,this.mediaContainer,"The media element not exist");const r=v("div",["media-empty","embed-selected-content","embed-hover-content"],this.mediaContainer);r.innerHTML=this.abstract.mediaIcon,this.updateMediaContent(r);const{editor:i}=this.options;i.findBlockById(e.id)&&this.emit("mediaError",i,"empty",e.id),this.setFullScreen()}getResourceUrl(e,r){const{src:i}=e.embedData,{editor:o}=this.options;return o.doc.buildResourceUrl(i,{syncNewResources:async(s,l)=>{var d,h;if(!r)return;await o.doc.addResources([s]);const c=(h=(d=o.doc).getServerMeta)==null?void 0:h.call(d).appId;if(l!==e.embedData.src&&c&&e.embedData.src.includes(c)){const C=Z(r);if(C&&!o.readonly&&o.isBlockWritable(C)){const E=mt.default(e);E.embedData.src=s,o.updateBlockData(C,E)}}}})}setFullScreen(){p(en,this.mediaContainer,"The media element not exist"),z(this.mediaContainer,"full-screen")}removeFullScreen(){p(en,this.mediaContainer,"The media element not exist"),ot(this.mediaContainer,"full-screen")}updateBlockAlign(e,r){const i=Z(r);p(en,i,"The block element not exist");const{align:o}=e;e.embedType==="video"&&(i.hasAttribute("data-style-align")&&i.removeAttribute("data-style-align"),i.setAttribute("data-style-align",o))}render(e,r){const{src:i}=e.embedData;(!this.mediaContainer||!r.contains(this.mediaContainer))&&(this.mediaContainer=v("div",["media"],r)),this.updateBlockAlign(e,r),rZ(i)?i===Of.Empty&&this.renderEmpty(e):this.renderMediaElement(e,r)}setAbstract(e){this.abstract=e}}I("media-embed");const oZ="left";class wS{constructor(){m(this,"handleInsertEmptyEmbed",async(t,e)=>{var C;const{containerId:r,blockIndex:i}=e;let o;(C=e.data)!=null&&C.file&&(o=e.data.file);const s=eZ(t,this.embedType);if(o=o!=null?o:await ga(s,{}),!o)return null;const{mediaType:l}=this.getAbstract();try{nZ(o,t,l)}catch{return null}const c={id:et(),type:"embed",embedType:this.embedType,embedData:{src:Of.Empty}};l==="video"&&(c.align=oZ);const d=t.insertBlock(r,i,c);return await this.getMedia(t,c.id).handleUploadFile(o),d})}getMedia(t,e){const r=t.addCustom(`media-${e}`,()=>new iZ({editor:t,createMediaElement:this.createMediaElement,updateMediaElement:this.updateMediaElement,createProgressElement:this.createProgressElement,updateProgressElement:this.updateProgressElement}));return r.setAbstract({...this.getAbstract()}),r}getOptions(){const{menuItem:t,mediaIcon:e,mediaName:r,order:i,group:o}=this.getAbstract();return{name:r,insertEmbedCommandItems:[{id:`insert-${this.embedType}`,name:t,icon:e,order:i,group:o,subText:kn(`insert-${this.embedType}`)}],handleInsertEmptyEmbed:this.handleInsertEmptyEmbed}}createEmbedContent(t,e,r){const{id:i}=r;this.getMedia(t,i).render(r,e)}handleUpdateBlock(t,e,r){const{id:i}=r,o=this.getMedia(t,i),s=Nt(e);return o.render(r,s),!0}handleDeleteBlock(t,e){const r=e.id,i=this.getMedia(t,r);i.removeAllListeners(),i.destroy()}convertTo(t,e,r,i){const o=e.embedData,s=t.doc.buildResourceUrl(o.src,{withToken:!0});return i==="html"?`<${o.type} src="${s}" />`:i==="markdown"?``:s}}function SS(n,t){const e=v("div",["uploading-progress-mask"],n),r=v("div",["uploading-progress-bar"],e),i=v("div",["uploading-progress-bar-value"],r);i.style.width=`${t}%`}function LS(n,t){const e=n.querySelector(".uploading-progress-bar-value");e&&(e.style.width=`${t}%`)}const sZ=I("media-audio");class lZ extends wS{constructor(){super(...arguments);m(this,"embedType",ni.AUDIO);m(this,"updateProgressElement",LS);m(this,"createMediaElement",(e,r,i,o)=>{const s=v("div",["audio-container","embed-hover-content","embed-selected-content"],r),l=v("audio",[],s);return l.innerHTML="Your browser does not support the <code>audio</code> element.",l.controls=!0,l.src=o,setTimeout(()=>{this.getMedia(e,i.id).setFullScreen()}),l})}getAbstract(){return{mediaIcon:OT,mediaName:D.t(`media.${ni.AUDIO}.menuItem`),menuItem:D.t(`media.${ni.AUDIO}.menuItem`),order:800,mediaType:ni.AUDIO,group:"common"}}getBlockProperties(){return{abstract:`${D.t(`media.${ni.AUDIO}.abstract`)}`}}updateMediaElement(e,r,i,o){const s=r.querySelector(":scope .audio-container > audio");return p(sZ,s,"The media element not exist"),s.src!==o&&(s.src=o),s}createProgressElement(e,r){const i=v("audio",[],e);i.innerHTML="Your browser does not support the <code>audio</code> element.",i.controls=!0,i.src="about:blank",SS(e,r)}}const aZ=new lZ;I("video-resizer");function IS(n){return n&&pe(n)&&$e(n)==="video"}const cZ=50;class Tx{constructor(t){m(this,"currentResizableElement",null);m(this,"resizing",!1);m(this,"handleHoveringBlockChange",(t,e)=>{if(!this.resizing&&!window.isDragging&&(e&&IS(e)&&this.disableBlockResize(e),t&&IS(t)&&this.editor.isBlockWritable(t))){const r=this.getVideoElement(t);if(!r)return;this.enableBlockResize(t,r)}});m(this,"handleResizing",(t,e)=>{if(this.resizing=!0,!this.currentResizableElement)return;const r=t.getBlock();if(!r)return;const i=r.getBoundingClientRect().width,o=Math.min(Math.max(e.width,cZ),i);this.currentResizableElement.style.width=`${o}px`,this.currentResizableElement.style.pointerEvents="none"});m(this,"handleResized",t=>{this.resizing=!1;const e=t.getBlock();if(!this.currentResizableElement||!e)return;const r=this.editor.getBlockData(e),{width:i}=this.currentResizableElement.getBoundingClientRect();this.currentResizableElement.style.pointerEvents="auto",this.editor.updateBlockData(e,{...r,width:i})});this.editor=t,Re.get(t).addListener("change",this.handleHoveringBlockChange)}destroy(){this.currentResizableElement=null,Re.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}getVideoElement(t){return Nt(t).querySelector(":scope .video-container > video")}updateResizer(t){const e=this.editor.findCustom(`${lt(t)}-resizer`);e&&e.updateResizer()}disableBlockResize(t){const e=this.editor.findCustom(`${lt(t)}-resizer`);e&&e.disableResize()}enableBlockResize(t,e){const r=this.editor.addCustom(`${lt(t)}-resizer`,()=>new mf(this.editor,{resize:["top-left","top-right","bottom-left","bottom-right"]}));r.enableResize(t,e),r.removeListener("resizing",this.handleResizing),r.removeListener("resized",this.handleResized),r.addListener("resizing",this.handleResizing),r.addListener("resized",this.handleResized),this.currentResizableElement=e}}const uZ=I("video");class fZ extends wS{constructor(){super(...arguments);m(this,"embedType",ni.VIDEO);m(this,"updateProgressElement",LS);m(this,"createMediaElement",(e,r,i,o)=>{const s=v("div",["video-container","embed-selected-content","drag-preview-element"],r),l=v("video",[],s);return l.innerHTML="Your browser does not support the <code>video</code> element.",l.controls=!0,l.src=o,l.addEventListener("canplay",()=>{e.addCustom("video-resizer",()=>new Tx(e)),this.getMedia(e,i.id).removeListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).addListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).removeFullScreen()}),i.width&&(l.style.width=`${i.width}px`),l});m(this,"createProgressElement",(e,r,i)=>{const o=v("video",["progress-video"],e);o.innerHTML="Your browser does not support the <code>audio</code> element.",o.controls=!0,SS(e,r),ma(i).then(s=>{const l=e.querySelector(".progress-video");l&&r1(e)&&(l.src=s)})})}getAbstract(){return{mediaName:D.t(`media.${ni.VIDEO}.menuItem`),mediaIcon:NT,menuItem:D.t(`media.${ni.VIDEO}.menuItem`),order:700,mediaType:ni.VIDEO,group:"common"}}getBlockProperties(){return{abstract:`${D.t(`media.${ni.VIDEO}.abstract`)}`}}handleMediaError(e,r,i){const o=e.addCustom("video-resizer",()=>new Tx(e)),s=e.getBlockById(i);o.disableBlockResize(s)}updateMediaElement(e,r,i,o){const s=r.querySelector(":scope .video-container > video");p(uZ,s,"The media element not exist"),s.src!==o&&(s.src=o),i.width?s.style.width=`${i.width}px`:s.style.width="";const l=e.getBlockById(i.id);return setTimeout(()=>{e.addCustom("video-resizer",()=>new Tx(e)).updateResizer(l)}),s}}const dZ=new fZ,DS=[aE,pE,CE,kk],yx=[bS,hQ,bJ,LJ,PJ,BK,qJ,dZ,aZ,yz,J4,sX],_S=[Pk,eS,T4,Hk];function hZ(n,t,e){var i,o,s,l;_r.level=(i=e.logLevel)!=null?i:Ho.DEBUG;const r=Su(n,t,{components:{blocks:[...DS,...((o=e==null?void 0:e.components)==null?void 0:o.blocks)||[]],embeds:[...yx,...((s=e.components)==null?void 0:s.embeds)||[]],boxes:[..._S,...((l=e.components)==null?void 0:l.boxes)||[]],textRenders:[new HC],options:{...e.componentsOptions}}});return r.readonly=!0,r.addCustom("heading-collapse",()=>new cx(r)),r.addCustom("editor-tooltip",()=>new sf(r)),r.addListener("clickLink",(c,d,h)=>{var E;if((E=e==null?void 0:e.events)!=null&&E.onClickLink){e.events.onClickLink(c,d,h);return}const C=h.getAttribute("link");C&&(c.readonly||d.ctrlKey||d.metaKey)&&window.open(C,"_blank")}),r}class MS{constructor(t){this.createOptions=t,t.lang&&D.setLang(t.lang)}createHistoryEditor(t,e){return hZ(t,e,this.createOptions)}}function US(n,{root:t,childDoc:e,doc:r}){var h,C;e.uploadResource=r.uploadResource.bind(r),e.buildResourceUrl=r.buildResourceUrl.bind(r);const i=n.getComponentOptions("comment"),o={image:{defaultAlign:"left"},table:{locatingContainer:t,hideCellMenu:!0,hideToolbar:!0},...i==null?void 0:i.componentsOptions},s=[];n.editorBlocks.forEach(E=>{E.blockType==="text"||E.blockType==="embed"||s.push(E)});const l=[];n.editorEmbeds.forEach(E=>{l.push(E)});const c=[];n.editorBoxes.forEach(E=>{E.boxType==="text"||E.boxType==="br"||E.boxType==="image"||E.boxType==="anchor"||c.push(E)});const d=Su(t,e,{shortcuts:[Oh],components:{blocks:s,commandProviders:[new m0],decorators:[new V0],embeds:l,boxes:c,options:o}});if(d.input.addHandler(new H0),d.input.addHandler(new OE(d)),d.input.addHandler(new $E(d)),d.input.addHandler(new pq(d)),d.input.addHandler(new W0),d.addCustom("image-paste-handler",()=>new UE(d)),ie.isMobile||d.addCustom("editor-tooltip",()=>new sf(d)),n.options.enableContextMenu!==!1&&d.addCustom("editor-context-menu",E=>new zE(E)),(h=n.options.componentsOptions)!=null&&h.mention){const E=n.options.componentsOptions.mention;d.addCustom("mention",()=>new tS(d,{...E}))}if((C=n.options.componentsOptions)!=null&&C.comment){const E=n.options.componentsOptions.comment;E.onCommentEditorClick&&d.addListener("click",E.onCommentEditorClick)}return d}function mZ(n,t){const e=Array.from(n.rootContainer.querySelectorAll(`[comment-${t.toLocaleLowerCase()}="${t}"]`)),r=new Set;e.forEach(i=>{const o=Z(i);o&&r.add(o)}),r.forEach(i=>{Cq(n,i,t)})}class gZ{constructor(t){m(this,"listeners",new Set);m(this,"doc");this.editor=t,this.doc=this.editor.doc.externalDoc,this.doc.registerCallback(this)}getComments(){return this.doc.getComments()}getComment(t){return this.doc.getComment(t)}getCommentDoc(t){return this.doc.getCommentDoc(t)}localCreateComment(t,e){this.doc.localCreateComment(t,e)}localDeleteComment(t){const e=this.getComment(t);this.doc.localDeleteComment(t);const r=e.groupId;this.getComments().filter(o=>o.groupId===r).length===0&&mZ(this.editor,r)}localUpdateComment(t,e){this.doc.localUpdateComment(t,e)}onCreateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onCreateComment(t,e))}onDeleteComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onDeleteComment(t,e))}onUpdateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onUpdateComment(t,e))}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}createCommentEditor(t,e){return US(this.editor,{root:t,childDoc:e,doc:this.doc})}allowEdit(t){return t.userId===this.doc.getUser().userId}}class pZ{constructor(t,e){m(this,"listeners",new Set);this.editor=t,this.localDoc=e}get doc(){return this.localDoc.toJSON()}getComments(){return Object.values(this.doc.comments)}getComment(t){return this.doc.comments[t]}getCommentDoc(t){const e=this.doc.comments[t];return Vp(e)}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}localCreateComment(t,e){}localDeleteComment(t){}localUpdateComment(t,e){}createCommentEditor(t,e){return US(this.editor,{root:t,childDoc:e,doc:this.localDoc})}allowEdit(t){return t.userId===this.localDoc.getUser().userId}}const CZ={placeholder:{common:{title:"\u8BF7\u8F93\u5165\u6807\u9898",readonlyTitle:"\u8BF7\u8F93\u5165\u6807\u9898",content:"\u70B9\u51FB + \uFF0C\u6216\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6",contentInTable:"\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6"},local:{readonlyTitle:"\u672A\u547D\u540D"}},copyCutProperty:{copy:"\u590D\u5236",cut:"\u526A\u5207",unsafeEnvTips:"\u7531\u4E8E\u5F53\u524D http \u8BBF\u95EE\u73AF\u5883\u4E0B\u7684\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528\u5FEB\u6377\u952E({shortCut}) {operation}",limitedEnvTips:"\u7531\u4E8E\u6D4F\u89C8\u5668\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528 {shortCut} \u7C98\u8D34"}},EZ={placeholder:{common:{title:"Enter a title",readonlyTitle:"Enter a title",content:'Click "+", or enter "/" to insert components quickly',contentInTable:'Enter "/" to insert components quickly'},local:{readonlyTitle:"Untitled"}},copyCutProperty:{copy:"Copy",cut:"Cut",unsafeEnvTips:"Due to the limitations of the current http access environment, please use the shortcut ({shortCut}) {operation}",limitedEnvTips:"Press {shortCut} to paste due to browser restrictions"}},xZ={placeholder:{common:{title:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",readonlyTitle:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",content:"\u300C+\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u304B\u3001\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059",contentInTable:"\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059"},local:{readonlyTitle:"\u7121\u984C"}},copyCutProperty:{copy:"\u8907\u88FD",cut:"\u5207\u308B",unsafeEnvTips:"HTTP\u74B0\u5883\u306E\u5236\u7D04\u306B\u3088\u308A\u3001{operation}\u3059\u308B\u306B\u306F\u3001\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8({shortCut}) \u3092\u3054\u4F7F\u7528\u304F\u3060\u3055\u3044",limitedEnvTips:"\u30D6\u30E9\u30A6\u30B6\u30FC\u306E\u5236\u9650\u306B\u3088\u308A\u3001\u300C{shortCut}\u300D\u3092\u4F7F\u7528\u3057\u3066\u8CBC\u308A\u4ED8\u3051\u3066\u304F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VhtbC9pdGVtMS54bWxQSwECLQAUAAYACAAAACEAdD85esIAAAAoAQAAHgAAAAAAAAAAAAAAAABVOQAAY3VzdG9tWG1sL19yZWxzL2l0ZW0xLnhtbC5yZWxzUEsBAi0AFAAGAAgAAAAhAOuAYExTAwAAjw4AABIAAAAAAAAAAAAAAAAAWzsAAHdvcmQvZm9udFRhYmxlLnhtbFBLBQYAAAAADwAPANQDAADePgAAAAA=",bZ=()=>Kg(AZ),vZ=I("image-to-docx");async function BZ(n){return new Promise((t,e)=>{const r=new Image;r.onload=()=>{t({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=e,r.src=n})}async function OS(n,t){if(n.width&&n.height)return{width:n.width,height:n.height,buffer:t};try{const e=await ma(new File([t],"",{})),r=await BZ(e);return r.width===void 0||r.height===void 0?{width:345,height:230,buffer:t}:n.width||n.height?{width:n.width||r.width*n.height/r.height,height:n.height||r.height*n.width/r.width,buffer:t}:{width:r.width,height:r.height,buffer:t}}catch(e){vZ.error(e);return}}function TZ(n,t){let e=n.filter(s=>s!=null);const r=t-(e.length-1)*20,i=.87,o=e.reduce((s,l)=>s+l.width,0);return o>r&&(e=e.map(s=>({width:s.width*r/o,height:s.height*r/o,buffer:s.buffer}))),e.map(s=>({width:s.width*i,height:s.height*i,buffer:s.buffer}))}function yZ(n,t,e){if(!e||typeof e!="object")return;const r=e,i=n.filter(s=>s!=null),o=t-(i.length-1)*20;i.forEach((s,l)=>{if(i.length===1&&r.widthPercent){const d=r.widthPercent,h=s.width;s.width=o*(d/100),s.height*=s.width/h;return}const c=`${l}_flex`;if(r[c]){const d=r[c],h=s.width;s.width=o*d,s.height*=s.width/h}})}function NS(n=[0,1,2,3,4,5,6,7],t=1){return n.map(e=>{let r;switch(e%3){case 0:r=Et.LevelFormat.DECIMAL;break;case 1:r=Et.LevelFormat.LOWER_LETTER;break;default:r=Et.LevelFormat.LOWER_ROMAN;break}return{level:e,format:r,text:`%${e+1}. `,alignment:Et.AlignmentType.START,start:t,style:{paragraph:{indent:{left:Et.convertInchesToTwip(.3*(e+1)),hanging:Et.convertInchesToTwip(.2)}}}}})}function kZ(){return[0,1,2,3,4,5,6,7].map(n=>{let t;switch(n%3){case 0:t="\u2022";break;case 1:t="\u25E6";break;default:t="\u25AA";break}return{level:n,format:Et.LevelFormat.BULLET,text:t,alignment:Et.AlignmentType.START,style:{paragraph:{indent:{left:Et.convertInchesToTwip(.3*(n+1)),hanging:Et.convertInchesToTwip(.2)}}}}})}function RZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:Et.LevelFormat.BULLET,text:"\u2611",alignment:Et.AlignmentType.START,style:{paragraph:{indent:{left:Et.convertInchesToTwip(.3*(n+1)),hanging:Et.convertInchesToTwip(.2)}}}}))}function wZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:Et.LevelFormat.BULLET,text:"\u2610",alignment:Et.AlignmentType.START,style:{paragraph:{indent:{left:Et.convertInchesToTwip(.3*(n+1)),hanging:Et.convertInchesToTwip(.2)}}}}))}var Nf=(n=>(n.NUMBERING="number-numbering-reference",n.BULLET="number-bullet-reference",n.CHECKED="checked-bullet-reference",n.UNCHECKED="unchecked-bullet-reference",n))(Nf||{});const SZ=[{levels:NS(),reference:"number-numbering-reference"},{levels:kZ(),reference:"number-bullet-reference"},{levels:RZ(),reference:"checked-bullet-reference"},{levels:wZ(),reference:"unchecked-bullet-reference"}];function LZ(n){switch(n){case"style-color-0":return"d83931";case"style-color-1":return"de7802";case"style-color-2":return"dc9b04";case"style-color-3":return"2ea121";case"style-color-4":return"245bdb";case"style-color-5":return"6425d0";case"style-color-6":return"8f959e";default:return}}function IZ(n){switch(n){case"style-bg-color-1":case"style-bg-color-2":case"style-bg-color-8":case"style-bg-color-9":return"yellow";case"style-bg-color-0":case"style-bg-color-5":return"magenta";case"style-bg-color-3":return"green";case"style-bg-color-4":case"style-bg-color-11":return"blue";case"style-bg-color-6":return"lightGray";case"style-bg-color-7":return"red";case"style-bg-color-10":return"darkGreen";case"style-bg-color-12":return"darkMagenta";case"style-bg-color-13":return"darkGray";default:return}}function DZ(n){switch(n){case"style-bg-color-0":return"fbbab6";case"style-bg-color-1":return"ffdcb0";case"style-bg-color-2":return"fff7a0";case"style-bg-color-3":return"ceefc5";case"style-bg-color-4":return"d1ddfb";case"style-bg-color-5":return"d9cbf8";case"style-bg-color-6":return"eaeaea";case"style-bg-color-7":return"fe837c";case"style-bg-color-8":return"ffbd6a";case"style-bg-color-9":return"ffe662";case"style-bg-color-10":return"a8f393";case"style-bg-color-11":return"98b5ff";case"style-bg-color-12":return"b394f8";case"style-bg-color-13":return"b1b1b1";default:return}}const _Z=/rgb\((\d+),\s*(\d+),\s*(\d+)\)/;function PS(n){if(typeof n=="string"&&n.length>0){if(n[0]==="#")return n.substring(1);const t=n.match(_Z);if(t){const e=s=>{let l=Number(s).toString(16);return l.length<2&&(l=`0${l}`),l},r=e(t[1]),i=e(t[2]),o=e(t[3]);return`${r}${i}${o}`}if(n==="red")return"FF0000";if(n==="green")return"00FF00";if(n==="blue")return"0000FF"}}function fn(n,t){if(n&&n.attributes&&n.attributes[t])return n.attributes[t];if(n&&n.attributes&&n.attributes.box&&n.attributes.inputType&&t==="style-underline")return!0}function FS(n,t,e){for(let r=0;r<=e;++r){const i=`${t}${r}`;if(fn(n,i))return i}}function pm(n,t,e){n.attributes=n.attributes||{},n.attributes[t]=e}function kx(n){return n==="image"||n==="drawio"||n==="plantuml"||n==="mermaid"||n==="flowchart"}function KS(n){return n&&n.startsWith("//")?`https:${n}`:n&&!n.startsWith("http://")&&!n.startsWith("https://")?`https://${n}`:n}function MZ(n){const t=fn(n,"inlineStyle");if(t==null)return;const e=t.split(";");for(const r of e){const i=r.split(":");if(i.length!==2)continue;const o=i[0].trim().toLowerCase(),s=i[1].trim().toLowerCase();o==="font-size"&&pm(n,"inline-style-font-size",s),o==="color"&&pm(n,"inline-style-color",s),o==="background-color"&&pm(n,"inline-style-background-color",s),o==="font-family"&&pm(n,"inline-style-font-family",s)}}function UZ(n,t){if(t==null)return n==null?void 0:n.normal;if(n)return n[`heading${t}`]}function OZ(n){const t=`${fn(n,"inline-style-font-size")}`;if(t&&t.indexOf("px")>0)return+t.replace(/px/g,"")}function NZ(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` ${n.attributes.text} `;if(n.attributes&&n.attributes.box&&n.attributes.inputType)return n.attributes.value?`${n.attributes.value}`:" "}function PZ(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` @${n.attributes.text} `}function FZ(n){return fn(n,"inline-style-font-family")}function KZ(n){const t=fn(n,"inline-style-background-color");return PS(t)}function VZ(n){const t=fn(n,"inline-style-color");return PS(t)}function $Z(n){MZ(n);const t=fn(n,"type")==="mention";return{box:n.attributes&&n.attributes.box?n.attributes:void 0,inlineCode:!!fn(n,"style-code"),link:KS(fn(n,"link")),size:OZ(n),text:t?PZ(n):NZ(n)||n.insert,bold:!!fn(n,"style-bold"),underline:!!fn(n,"style-underline"),italics:!!fn(n,"style-italic"),strike:!!fn(n,"style-strikethrough"),superScript:!!fn(n,"style-super"),subScript:!!fn(n,"style-sub"),math:fn(n,"type")==="math"?fn(n,"src"):void 0,mention:t,fontFamily:FZ(n),background:KZ(n),color:t?"338fe5":LZ(FS(n,"style-color-",6))||VZ(n),highlight:FS(n,"style-bg-color-",13)}}function HZ(){return[new Et.Paragraph({border:{top:{color:"auto",style:Et.BorderStyle.DASHED,size:4,space:1}},spacing:{before:300}}),new Et.Paragraph({spacing:{line:0}})]}function jZ(){return new Et.Paragraph({children:[new Et.TextRun({text:"[\u89C6\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:Et.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function zZ(){return new Et.Paragraph({children:[new Et.TextRun({text:"[\u97F3\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:Et.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function GZ(n,t){return new Et.Paragraph({children:[new Et.ExternalHyperlink({children:[new Et.TextRun({style:"Hyperlink",text:t||n})],link:n})]})}function VS(n){if(n.heading!=null)return`Heading${n.heading}`}function $S(n){if(n.alignment!=null){if(n.alignment==="center")return Et.AlignmentType.CENTER;if(n.alignment==="right")return Et.AlignmentType.RIGHT;if(n.alignment==="left")return Et.AlignmentType.LEFT}}function WZ(n){if(n.indent)return{left:Et.convertInchesToTwip(.3*n.indent-.2)};if(n.padding)return{left:Et.convertInchesToTwip(.3*n.padding)}}function qZ(n){return{type:Et.ShadingType.CLEAR,color:"FFFFFF",fill:n}}function XZ(n){const t=n.split(",");if(t.length!==0)return t[0].trim()}function HS(n,t){let e;e=n.inlineCode?"InlineCode":void 0,e=n.link?"Hyperlink":e;const r=n.size||t,i=r!=null?Math.floor(r*1.5+.5):void 0;return new Et.TextRun({text:n.text,bold:n.bold||void 0,underline:n.underline?{type:Et.UnderlineType.SINGLE}:void 0,italics:n.italics||void 0,strike:n.strike||void 0,superScript:n.superScript||void 0,subScript:n.subScript||void 0,size:i,style:e,font:n.fontFamily?XZ(n.fontFamily):void 0,shading:n.background?qZ(n.background):void 0,color:n.color,highlight:IZ(n.highlight)})}function YZ(n,t){if(n.link)return new Et.ExternalHyperlink({children:[HS(n,t)],link:n.link})}async function jS(n,t,e,r,i){const[o]=await i(n,t,e);if(o==null)return;const s=await OS({width:r||0,height:0,src:e},o);return new Et.ImageRun({data:o,transformation:{width:(s==null?void 0:s.width)||100,height:(s==null?void 0:s.height)||20}})}function QZ(n){if(n.heading||n.heading)return n.heading}function JZ(n){if(n.align&&(n.align==="center"||n.align==="right"||n.align==="left"))return n.align}function ZZ(n){if(n.textOnly===!0&&n.level!=null)return n.level}async function ttt(n,t){var r;const e=[];if(n.text&&Array.isArray(n.text)){for(let i=0;i<n.text.length;i++){const o=n.text[i];if(((r=o.attributes)==null?void 0:r.box)===!0&&t){const s=await t(o);if(s){n.text.splice(i+1,0,...s);continue}}e.push($Z(o))}return e}}function ett(n){if(n.type==="list"&&n.textOnly!==!0)return{checkbox:n.checkbox,groupId:n.groupId,ordered:!!n.ordered,level:n.level||1,start:n.start||0}}function ntt(n,t){if(n.type==="embed"&&n.embedType&&kx(n.embedType)&&n.embedData&&n.embedData.src)return n.embedData.src.split("|").map(r=>{const i=t(r),o=n.embedData[`${i}_width`],s=n.embedData[`${i}_height`];return{src:r,width:o,height:s}})}function rtt(n){if(n.padding)return n.padding}function itt(n){return!!(n.type==="embed"&&n.embedType&&kx(n.embedType)&&n.embedData&&n.embedData.src)}async function Cm(n,t,e){return{quoted:!!n.quoted,heading:QZ(n),alignment:JZ(n),indent:ZZ(n),padding:rtt(n),texts:await ttt(n,e),list:ett(n),images:ntt(n,t),border:itt(n)}}async function ott(n,t,e,r){const i=[];if(!n.children)return[];for(const o of n.children){const s=[];for(const l of t.blocks[o])s.push(await Cm(l,e,r));i.push(s)}return i}const stt=I("to-docx");function ltt(n,t){return Array(n).fill(0).map(()=>Array(t).fill(0).map(()=>({cellId:void 0,color:void 0,from:void 0,rowSpan:1,colSpan:1,width:0,originalWidth:void 0,align:void 0})))}function att(n,t,e,r){const i=!!n.hasColTitle,o=!!n.hasRowTitle,s=!!n.isStripeStyle,l="F5F8FB";for(let c=0;c<t;c++)for(let d=0;d<e;d++)(i&&d===0||o&&c===0||s&&c%2===1)&&(r[c][d].color=l)}function ctt(n){p(stt,n.children,"no table children");const t=n.rows,e=n.cols,r=n.colsWidth;if(r)for(let s=0;s<r.length;s++)r[s]===0&&(r[s]=100);const i=ltt(t,e);let o=0;for(let s=0;s<t;++s)for(let l=0;l<e;++l){if(i[s][l].originalWidth=r?r[l]:void 0,i[s][l].from!==void 0)continue;const c=n.children[o];o+=1,i[s][l].cellId=c,i[s][l].color=DZ(n[`${c}_background`]),i[s][l].width=r?r[l]:100,i[s][l].align=n[`${c}_align`];const d=n[`${c}_rowSpan`]||1,h=n[`${c}_colSpan`]||1;if(i[s][l].rowSpan=d,i[s][l].colSpan=h,d>1||h>1){let C=0;for(let E=0;E<d;E++)for(let x=0;x<h;x++)E===0&&(C+=r?r[l+x]:80),!(E===0&&x===0)&&(i[s+E][l+x].from=[s,l]);i[s][l].width=C}}return att(n,t,e,i),i}async function utt(n,t,e,r,i,o,s,l,c,d){async function h(E){if(l&&E.type!=="_exportVirtualBlock"){const x=await l(i,o,E);if(x){await r.addDoc(n,x,d);return}}if(E.type==="text"||E.textOnly===!0){const x=await Cm(E,s,c);await r.addTextBlock(x);return}if(E.type==="code"){const x=await ott(E,e,s,c);await r.addCodeBlockObject(x);return}if(E.type==="list"&&E.textOnly!==!0){const x=await Cm(E,s,c);await r.addListBlockObject(n,x);return}if(E.type==="embed"&&E.embedType){const x=E,B=x.embedData,k=x.embedType;if(kx(k)){const w=await Cm(E,s,c);await r.addImagesBlockObject(E,w,d)}else E.embedType==="hr"?r.addSeparatorBlock():E.embedType==="video"?r.addVideoPlaceholder():E.embedType==="audio"?r.addAudioPlaceholder():E.embedType==="webpage"?r.addHyperlinkParagraph(KS(B.src),B.title):r.addOtherEmbedBlock(k,E.embedData);return}if(E.type==="table"){let x=[];if(E.colsWidth)x=E.colsWidth;else{const k=E.cols;x=new Array(k);for(let w=0;w<x.length;w++)x[w]=100;E.colsWidth=x}const B=ctt(E);await r.addTableMatrix(x,B,e),r.addEmptyParagraph()}E.type==="_exportVirtualBlock"&&await r.addVirtualBlock(E.id,e,d)}function C(E){var k;const x=((k=E==null?void 0:E.embedData)==null?void 0:k.exportSpec)||(E==null?void 0:E.exportSpec);if(!x)return[E];const B=[];for(const{type:w,data:U}of x){if(w==="text"){const M={id:et(),text:[{insert:U}],type:"text"};B.push(M);continue}if(w==="image"){const M={id:et(),type:"embed",embedType:"image",align:"left",embedData:{src:U}};B.push(M);continue}if(w==="link"){const M={id:et(),type:"embed",embedType:"webpage",embedData:{src:U.url,title:U.title}};B.push(M);continue}if(w==="block")for(const M of U){if(!e.blocks[M])continue;const Y={id:M,type:"_exportVirtualBlock"};B.push(Y)}}return B}for(const E of t)for(const x of C(E))!x||await h(x)}function ftt(){return{listMaxInst:1,listInstMap:{},listRefMap:{},levelConfigs:[]}}const dtt=I("to-docx");class htt{constructor(t,e,r,i,o,s){m(this,"paragraphs");this.appId=t,this.docId=e,this.state=r,this.readImageFunc=i,this.convertBlocksFunc=o,this.defaultFontSize=s,this.paragraphs=[]}async addTextBlock(t){this.paragraphs.push(new Et.Paragraph({heading:VS(t),alignment:$S(t),children:await this.paragraphsFromBlockTexts(t),indent:WZ(t)}))}async addEmptyImagePlaceHolder(){this.paragraphs.push(new Et.Paragraph({text:`[${D.t("docx.imageExportFailed")}]`,shading:{type:Et.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}}))}async paragraphsFromBlockTexts(t){if(t.texts==null)return;const e=UZ(this.defaultFontSize,t.heading),r=[];for(const i of t.texts){if(i.link){const o=YZ(i,e);o&&r.push(o);continue}if(i.box&&i.box.type&&i.box.type==="br"){r.push(new Et.TextRun({text:"",break:1}));continue}if(i.box&&i.box.type&&i.box.type==="image"){const o=await jS(this.appId,this.docId,i.box.src,i.box.width,this.readImageFunc);o&&r.push(o);continue}if(i.math){const o=await jS(this.appId,this.docId,i.math,0,this.readImageFunc);o&&r.push(o);continue}r.push(HS(i,e))}return r}async addCodeBlockObject(t){for(const e of t)for(const r of e){const i={style:Et.BorderStyle.SINGLE,color:"#DEDEDE"};this.paragraphs.push(new Et.Paragraph({style:"Code",border:{left:{...i},right:{...i},top:{...i},bottom:{...i}},children:await this.paragraphsFromBlockTexts(r)}))}}async addListBlockObject(t,e){if(e.list==null)return;let r;const i=e.list.checkbox?`${t}-${e.list.groupId}-${e.list.checkbox}`:`${t}-${e.list.groupId}`;if(this.state.listInstMap[i])r=this.state.listInstMap[i];else if(r=this.state.listMaxInst,this.state.listMaxInst+=1,this.state.listInstMap[i]=r,e.list.start>0&&e.list.ordered){const s=`number-numbering-reference-${r}`,l=NS([e.list.level-1],e.list.start);this.state.levelConfigs.push({levels:l,reference:s,inst:r}),this.state.listRefMap[i]=s}else e.list.ordered?this.state.listRefMap[i]=Nf.NUMBERING:e.list.checkbox&&e.list.checkbox==="checked"?this.state.listRefMap[i]=Nf.CHECKED:e.list.checkbox&&e.list.checkbox==="unchecked"?this.state.listRefMap[i]=Nf.UNCHECKED:this.state.listRefMap[i]=Nf.BULLET;const o=VS(e);e.texts&&this.paragraphs.push(new Et.Paragraph({heading:o,children:await this.paragraphsFromBlockTexts(e),numbering:{reference:this.state.listRefMap[i],level:e.list.level-1,instance:r}}))}imageDimWithBufferToImageRun(t){return new Et.ImageRun({data:t.buffer,transformation:{width:t.width,height:t.height}})}async addImagesBlockObject(t,e,r){if(e.images==null){if(t.type==="embed"&&t.embedType==="image"){const{src:c}=t.embedData;c||this.addEmptyImagePlaceHolder()}return}const i=[],o=await Promise.all(e.images.map(async c=>{const[d,h]=await this.readImageFunc(this.appId,this.docId,c.src);if(d){const C=await OS(c,d);if(C)return C}i.push(h)}));yZ(o,r,t.embedData);const s=TZ(o,r),l={style:Et.BorderStyle.SINGLE,color:"#DEDEDE"};s.length&&this.paragraphs.push(new Et.Paragraph({border:e.border?{left:{...l},right:{...l},top:{...l},bottom:{...l}}:void 0,alignment:$S(e)||Et.AlignmentType.CENTER,children:s.map(c=>this.imageDimWithBufferToImageRun(c)).flatMap((c,d,h)=>c==null?[]:h.length-1!==d?[c,new Et.TextRun({text:" "})]:c)})),i.forEach(c=>{this.addHyperlinkParagraph(c)})}addSeparatorBlock(){HZ().forEach(t=>this.paragraphs.push(t))}addEmptyParagraph(){this.paragraphs.push(new Et.Paragraph(""))}addVideoPlaceholder(){this.paragraphs.push(jZ())}addAudioPlaceholder(){this.paragraphs.push(zZ())}addHyperlinkParagraph(t,e){t!=null&&this.paragraphs.push(GZ(t,e))}async addTableMatrix(t,e,r){const i=t.map(o=>o!==0?o*15:1500);this.paragraphs.push(new Et.Table({rows:await this.generateTableRows(e,r),columnWidths:i}))}async generateRowCells(t,e){const r=[];for(const i of t){const o=i.cellId;if(o===void 0)continue;const s=i.width*.9;r.push(new Et.TableCell({children:await this.convertBlocksFunc(o,e.blocks[o],e,this.appId,this.docId,this.state,s),columnSpan:i.colSpan,rowSpan:i.rowSpan,width:{type:Et.WidthType.DXA,size:i.width*15},shading:i.color?{fill:i.color,type:Et.ShadingType.CLEAR,color:"auto"}:void 0}))}return r}async generateTableRows(t,e){const r=[];for(const i of t)r.push(new Et.TableRow({children:await this.generateRowCells(i,e)}));return r}async addDoc(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks.root,e,this.appId,this.docId,this.state,r);i&&(this.paragraphs=this.paragraphs.concat(i))}async addVirtualBlock(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks[t],e,this.appId,this.docId,this.state,r);this.paragraphs.push(...i)}async addOtherEmbedBlock(){}}class mtt{constructor(t,e,r,i,o,s,l,c){m(this,"convertBlocks",async(t,e,r,i,o,s,l=720)=>{const c=new htt(i,o,s,this.readImage,this.convertBlocks,this.defaultFontSize);return await utt(t,e,r,c,i,o,this.md5HexFunc,this.getDocByBlock,this.getTextsByBox,l||720),c.paragraphs});this.templateData=t,this.docData=e,this.md5HexFunc=r,this.readImage=i,this.defaultFontSize=o,this.getDocByBlock=s,this.getTextsByBox=l,this.backgroundImageOptions=c}async convert(t,e){return this.snapshot2docx(this.docData,t,e)}async snapshot2docx(t,e,r){const i=new Et.ImportDotx,o=this.templateData?await i.extract(this.templateData):void 0,s=t.blocks.root;p(dtt,s,"data must have blocks");const l=ftt(),c=await this.convertBlocks("blocks",s,t,e,r,l),d=this.backgroundImageOptions?{default:new Et.Header({children:[new Et.Paragraph({children:[new Et.ImageRun(this.backgroundImageOptions)]})]})}:{},h=new Et.Document({numbering:{config:[...SZ,...l.levelConfigs]},sections:[{headers:d,children:c,properties:{page:{size:{width:12240,height:15840},margin:{top:1440,bottom:1440,left:1440,right:1440}}}}]},{template:o});return Et.Packer.toBlob(h)}}async function gtt(n,t,e,r){const i=n.doc.buildResourceUrl(r,{withToken:!0});let o=await aS(i);if(!o)return[void 0,i];if(o.type.indexOf("/svg")!==-1){const l=await oS(o);l&&(o=new File([l],o.name))}return[await o.arrayBuffer(),i]}async function ptt(n,t,e){const r=n.editorBlocks.getBlockClass(e.type);if(r.toStandardDoc)return r.toStandardDoc(n,e,t)}async function Ctt(n,t){const e=t.attributes,r=n.editorBoxes.getBoxClass(e.type);if(r.toStandardText)return r.toStandardText(n,e)}async function Ett(n,t){let{template:e,download:r,backgroundImageOptions:i}=t!=null?t:{};e||(e=bZ());const o=n.doc.toJSON(),s=(C,E,x)=>gtt(n,C,E,x),l=async(C,E,x)=>ptt(n,o,x),c=async C=>Ctt(n,C),h=await new mtt(e,o,Md.default,s,void 0,l,c,i).convert("_appId","_docId");if(r){const C=URL.createObjectURL(h),E=document.createElement("a");E.setAttribute("download",`${lS(n)}.docx`),E.setAttribute("href",`${C}`),E.click(),E.remove()}return h}const Rx=I("create-editor");async function xtt(n,t){var s,l,c,d,h,C,E,x,B,k,w,U,M,F,Y,X;p(Rx,n,"app does not exists"),t.lang&&D.setLang(t.lang),_r.level=(s=t.logLevel)!=null?s:Ho.DEBUG;const e=t.onReauth?async()=>{var Ct;const G=t.user.userId,st=t.docId,pt=await((Ct=t.onReauth)==null?void 0:Ct.call(t,G,st,t.permission));return{userId:G,docId:st,permission:t.permission,appId:t.appId,token:pt,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl}}:void 0,r={auth:{appId:t.appId,docId:t.docId,userId:t.user.userId,permission:t.permission,token:t.token,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl},serverUrl:t.serverUrl,reauthFunc:e,disableLogout:t.disableLogout},i=await Hu.load(r),o=Su(n,i,{id:t.id,scrollContainer:t==null?void 0:t.scrollContainer,enableComments:t==null?void 0:t.enableComments,enableContextMenu:t==null?void 0:t.enableContextMenu,components:{blocks:[...DS,...((l=t==null?void 0:t.components)==null?void 0:l.blocks)||[]],embeds:[...yx,...((c=t.components)==null?void 0:c.embeds)||[]],boxes:[..._S,...((d=t.components)==null?void 0:d.boxes)||[]],commandProviders:[new m0,...((h=t.components)==null?void 0:h.commandProviders)||[]],decorators:[new V0,new Hp],insertions:[$1],blockHooks:[new LE,new ZR,...((C=t.components)==null?void 0:C.blockHooks)||[]],textRenders:[new p4,new HC,...((E=t.components)==null?void 0:E.textRenders)||[]],options:{...t.componentsOptions}},shortcuts:[wq,rH,gz,cE,$w,cF,rE,dX,Oh,nF,...t.shortcuts||[]],colors:["#0064FF","#EB3723","#F59300","#00A865","#F25A0A","#70A310","#009CAD","#0990D9","#8851ED","#D62069"]});if(o.editorCommandProviders.registerCommandProvider(new Di(o)),o.input.addHandler(new eY),o.input.addHandler(new H0),o.input.addHandler(new wK),o.input.addHandler(new lz),o.input.addHandler(new EE(o,{hideTitle:t.hideTitle,headingLevel:1,titlePlaceholder:D.t("placeholder.common.title"),contentPlaceholder:D.t("placeholder.common.content"),readonlyTitlePlaceholder:D.t("placeholder.common.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0,applyContentPlaceholder:(x=t.placeholder)==null?void 0:x.applyContentPlaceholder})),o.input.addHandler(new M0(o,(B=t.componentsOptions)==null?void 0:B.quickMenu)),o.input.addHandler(new OE(o)),o.input.addHandler(new $E(o)),o.input.addHandler(new W0),o.doc.registerCallback(new nY(o)),o.addCustom("remote-cursor",()=>new oT(o)),o.addCustom("block-menu",G=>new nw(G)),ie.isMobile||o.addCustom("editor-tooltip",()=>new sf(o)),t!=null&&t.enableComments&&o.addCustom("editor-comments",G=>new g4(G,new gZ(G))),t.enableContextMenu!==!1&&o.addCustom("editor-context-menu",G=>new zE(G)),o.addCustom("create-options",()=>new Sb(o,t)),o.addCustom("drop-target",()=>new Tf(o)),o.addCustom("list-to-mindmap",()=>new R0(o)),o.addCustom("list-to-mention",()=>new BY(o)),o.addCustom("mobile-helper",()=>new zY(o)),o.addCustom("code-caret",()=>new Z$(o)),o.addCustom("image-paste-handler",()=>new UE(o)),(k=t.componentsOptions)!=null&&k.mention){const G=t.componentsOptions.mention;o.addCustom("mention",()=>new tS(o,G))}if(o.addCustom("heading-collapse",()=>new cx(o)),o.addCustom(mm,G=>new px(G)),ec.register(o),Tf.register(o),Ts.register(o),Es.register(o),o.addListener("clickLink",(G,st,pt)=>{var yt;if((yt=t==null?void 0:t.events)!=null&&yt.onClickLink){t.events.onClickLink(G,st,pt);return}const Ct=pt.getAttribute("link");Ct&&(G.readonly||st.ctrlKey||st.metaKey)&&window.open(Ct,"_blank")}),(U=(w=t.componentsOptions)==null?void 0:w.remoteCarets)!=null&&U.onUserChanged){const G=(F=(M=t.componentsOptions)==null?void 0:M.remoteCarets)==null?void 0:F.onUserChanged;o.doc.getRemoteUsers().on("change",st=>{G(o,st)})}return(X=(Y=t.componentsOptions)==null?void 0:Y.templates)!=null&&X.templates.length&&(o.addListener("docChanged",()=>{hm(o)}),o.addListener("resize",()=>{hm(o,{reset:!0})}),setTimeout(()=>{hm(o)},100)),o.doc.registerCallback({onError:async G=>{if(G.code==="ResetDoc"){Rx.error(`reset doc: ${G.message}`);const st=await Hu.load(r);o.doc.reset(st)}}}),o.version="1.1.17-beta.7",_r.level===Ho.DEBUG&&(window.setReauthFail=G=>{window.isReauthError=G},window.reConnect=G=>o.doc.externalDoc.client.connection.reConnect(G)),o}function Att(n){return n.toJSON!==void 0}async function btt(n,t,e){var o,s,l,c,d,h,C,E;p(Rx,n,"app does not exists");const r=Att(t)?t:new bp(t,{serverUrl:e.serverUrl||""});e.lang&&D.setLang(e.lang),_r.level=(o=e.logLevel)!=null?o:Ho.DEBUG;const i=Su(n,r,{id:e.id,scrollContainer:e==null?void 0:e.scrollContainer,components:{blocks:[aE,pE,CE,kk,...(l=(s=e.components)==null?void 0:s.blocks)!=null?l:[]],commandProviders:[new m0],decorators:[new V0,new Hp],embeds:[...yx,...((c=e.components)==null?void 0:c.embeds)||[]],boxes:[Pk,eS,T4,Hk,...((d=e.components)==null?void 0:d.boxes)||[]],insertions:[$1],blockHooks:[new LE,...((h=e.components)==null?void 0:h.blockHooks)||[]],textRenders:[new p4,new HC,...((C=e.components)==null?void 0:C.textRenders)||[]],options:{...e.componentsOptions}},shortcuts:[cE,$w,rE,Oh]});return i.editorCommandProviders.registerCommandProvider(new Di(i)),i.input.addHandler(new H0),i.input.addHandler(new EE(i,{hideTitle:e.hideTitle,headingLevel:1,titlePlaceholder:D.t("placeholder.common.title"),contentPlaceholder:D.t("placeholder.common.content"),readonlyTitlePlaceholder:D.t("placeholder.local.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),i.input.addHandler(new M0(i,(E=e.componentsOptions)==null?void 0:E.quickMenu)),i.input.addHandler(new OE(i)),i.input.addHandler(new $E(i)),i.input.addHandler(new W0),i.addCustom("block-menu",x=>new nw(x)),ie.isMobile||i.addCustom("editor-tooltip",()=>new sf(i)),i.addCustom("image-paste-handler",()=>new UE(i)),e!=null&&e.enableComments&&i.addCustom("editor-comments",x=>new g4(x,new pZ(x,r))),e.enableContextMenu!==!1&&i.addCustom("editor-context-menu",x=>new zE(x)),i.addCustom("heading-collapse",()=>new cx(i)),i.addListener("clickLink",(x,B,k)=>{var U;if((U=e==null?void 0:e.events)!=null&&U.onClickLink){e.events.onClickLink(x,B,k);return}const w=k.getAttribute("link");w&&(x.readonly||B.ctrlKey||B.metaKey)&&window.open(w,"_blank")}),i.addCustom(mm,x=>new px(x)),ec.register(i),i.version="1.1.17-beta.7",i}async function vtt(n,t,e){var h;const r=n.doc.externalDoc.client.auth,i=await Wh.load({auth:r,serverUrl:e});if(!((h=i.getVersionHelper)==null?void 0:h.call(i)))throw new Error("the editor does not support to show versions");const s=n.getCustom("create-options");if(!s)throw new Error("the editor does not support to show versions");const l=s.getData(),c=new MS(l),d=n.addCustom("version-dialog",()=>new K4(i,c));return d.show(t),d}b.tippy=t9,b.AnchorBox=TB,b.AuthError=Vu,b.AuthHeader=cl,b.AutoScroll=Qd,b.BaseURLHeader=Na,b.BasicCommands=YF,b.BlockExclusiveHook=ZR,b.BlockLockerHook=LE,b.BlockLockerPasteHandler=W0,b.BlockResizer=mf,b.BrBox=AB,b.CodeBlock=pE,b.CodeLineBlock=CE,b.CodeTextDecorator=V0,b.DOC_RE_AUTH_KEYS=mm,b.DefaultShortcuts=Oh,b.DocIdError=zU,b.DocReAuthCallbacks=px,b.DragDrop=Wb,b.DrawioEmbed=bS,b.EditorBlocks=r3,b.EditorBoxes=vB,b.EditorCommandProviders=x2,b.EditorComplexBlockPosition=Kr,b.EditorComplexSelectionRange=pi,b.EditorDecorators=wB,b.EditorEmbeds=o3,b.EditorInsertions=RB,b.EditorSimpleBlockPosition=Ye,b.EditorSimpleSelectionRange=rn,b.EmbedBlock=l3,b.EmbedBlockResizer=Df,b.EnforceWithDocumentTitleHandler=EE,b.EventCallbacks=fa,b.FILL_CHAR=g8,b.FileExtError=GU,b.GroupOrder=Lk,b.HeadingBlockScrollListener=pY,b.ImageBox=BB,b.InlineBoxCommandProvider=jk,b.InputtingInsertion=yB,b.LocalDoc=bp,b.LogLevel=Ho,b.Logger=_r,b.MIN_DISTANCE_THRESHOLD=zb,b.ManualCloseDialog=zu,b.ManualMenu=ls,b.ManualToolbar=ju,b.MarkdownInputHandler=H0,b.MaxUserError=Mp,b.Mindmap=k0,b.OnesEditorAutoSuggest=uC,b.OnesEditorCustomDataWrapper=Sb,b.OnesEditorExclusiveBlock=Es,b.OnesEditorHoveringBlock=Re,b.OnesEditorIcons=IO,b.OnesEditorQuickMenu=M0,b.OnesEditorToc=Uf,b.OnesEditorTocProvider=Ts,b.OnesEditorToolbar=ec,b.OnesEditorTooltip=sf,b.OnesEditorVersionsDialog=K4,b.PermissionError=Gh,b.Popup=Va,b.ReAuthToolbar=cS,b.RemoteCarets=oT,b.RemoteCaretsDecorator=Hp,b.RemoteCaretsInsertion=$1,b.RemoteUsers=Lu,b.RequestReloadError=$u,b.RichText=pn,b.ShareDBDoc=Hu,b.ShareDBDocVersionsProvider=MS,b.ShareDBServer=Wh,b.SimpleCache=Nb,b.StandardEmbedBlockCommands=ex,b.TEXT_STYLE_BACKGROUND_COLOR_PREFIX=b1,b.TEXT_STYLE_COLOR_PREFIX=A1,b.TableBlock=aE,b.TableBlockCommandProvider=m0,b.TableShortcuts=cE,b.TextBlock=Nn,b.TextBox=xB,b.TextColorItem=By,b.TextStyleShortcuts=rE,b.TocEmbed=J4,b.ZERO_WIDTH_SPACE_CHAR=Yc,b.abbreviation=Jd,b.addAttribute=lh,b.addClass=z,b.addCommentToBlock=If,b.addDays=cI,b.addMetaToDoc=Ru,b.addMonths=aI,b.animateScrollTo=Gs,b.applyPlaceholderToBlock=df,b.assert=p,b.autoShowHideTemplates=hm,b.bindKeyDownEvent=Hd,b.blockToDoc=gp,b.blockToHtml=z1,b.blockToMarkdown=Bh,b.blockToText=vh,b.blocksToDoc=$5,b.clearAllSelection=Nv,b.clientType=ie,b.cloneBlock=ts,b.cloneChildContainer=ep,b.cloneDoc=np,b.cloneText=uB,b.commentToShareDbComment=$p,b.compareElement=Vd,b.comparePosition=d1,b.complexBlockAdjustSelectionPos=ih,b.complexBlockFindNearestChildBlock=l7,b.complexBlockGetAllChildContainers=an,b.complexBlockGetBottomChildContainers=f3,b.complexBlockGetDeepFirstChild=a3,b.complexBlockGetFirstSimpleChild=m1,b.complexBlockGetLastSimpleChild=xa,b.complexBlockGetSelectedContainers=Ea,b.complexBlockGetTopChildContainers=u3,b.containerToDoc=H5,b.continuousScroll=cv,b.convertBlockFrom=nh,b.convertImageFileToPng=oS,b.convertImageSrcToPng=FY,b.converterIntercept=$0,b.copyBlockAttributes=KB,b.copyResourcesFromDoc=Ap,b.createBlockAnchor=Zi,b.createBlockCaretAnchor=h3,b.createBlockContentElement=Zs,b.createBlockElement=wv,b.createBlockSimpleDocRange=Ch,b.createBlockSimpleRange=ve,b.createBoxContentElement=Iv,b.createBoxElement=Sv,b.createBoxOp=cB,b.createChildContainer=e3,b.createComplexBlockPosition=xe,b.createComplexDocPos=gB,b.createComplexDocRange=E8,b.createContainer=dB,b.createContainerElement=Yg,b.createDeleteOps=oB,b.createEditor=Su,b.createEditorSelectionRange=Qe,b.createElement=v,b.createEmptyContainer=oo,b.createEmptyDoc=io,b.createEmptyTextBlockData=gh,b.createExpandedRange=Fd,b.createIconButton=Hs,b.createImage=Lg,b.createInsertOps=hh,b.createInsertionContentElement=Mv,b.createInsertionElement=Dv,b.createLocalEditor=btt,b.createOnesEditor=xtt,b.createRange=Pb,b.createRichText=ol,b.createRootContainer=t3,b.createSimpleBlockPosition=at,b.createSimpleDocPos=mB,b.createTextBlockData=Ai,b.createTextButton=El,b.createTextOp=Er,b.createTextWithReplaceSoftReturn=_1,b.daysAfter=zg,b.deleteText=U1,b.diffDays=uI,b.disablePageScroll=$g,b.docToHtml=UB,b.docToHtmlFragment=Au,b.docToMarkdown=OB,b.docToText=Zo,b.downloadImageToFile=aS,b.downloadObjectToFile=xx,b.downloadSvgToString=dS,b.editLink=nf,b.editorAddComment=xq,b.editorAddTextAttribute=QB,b.editorAutoInsertBlock=VB,b.editorBreakTextBlock=Sa,b.editorClearCompositionText=X1,b.editorClearSelectedContents=wh,b.editorCopyBlock=Ep,b.editorCopyDoc=Uh,b.editorDeleteBlock=J1,b.editorDeleteBlockText=Y1,b.editorDeleteBlockWithoutChildren=kh,b.editorDeleteChildContainer=p_,b.editorDeleteChildContainers=$B,b.editorFocusToBlock=tp,b.editorFocusToEnd=U_,b.editorGetBlockData=Jo,b.editorGetBlockText=yn,b.editorGetBlockTextEx=xh,b.editorGetBoxData=CB,b.editorHandleKeyboardEvent=e2,b.editorInsertBlock=wa,b.editorInsertBoxToBlock=PB,b.editorInsertDoc=XB,b.editorInsertDocAt=rp,b.editorInsertText=q1,b.editorInsertTextToBlock=NB,b.editorInsertTextToBlockEx=W1,b.editorMergeTextBlock=HB,b.editorMoveDown=u5,b.editorMoveEnd=up,b.editorMoveHome=A5,b.editorMoveLeft=l5,b.editorMoveLineEnd=w5,b.editorMoveLineHome=R5,b.editorMovePageDown=M5,b.editorMovePageUp=_5,b.editorMoveRight=a5,b.editorMoveUp=c5,b.editorMoveWordEnd=C5,b.editorMoveWordLeft=p5,b.editorRangeClearColor=ZB,b.editorRangeGetColor=t5,b.editorRangeSetColor=JB,b.editorRemoveTextAttribute=A_,b.editorReplaceBlockText=Sh,b.editorReplaceContainer=YB,b.editorRunOnce=vp,b.editorSelectAll=dp,b.editorSelectContainer=Dh,b.editorSelectDown=f5,b.editorSelectEnd=fp,b.editorSelectHome=b5,b.editorSelectLeft=d5,b.editorSelectLineEnd=k5,b.editorSelectLineHome=y5,b.editorSelectPageDown=N5,b.editorSelectPageUp=O5,b.editorSelectRight=h5,b.editorSelectUp=m5,b.editorSelectWordEnd=x5,b.editorSelectWordLeft=E5,b.editorSetTextColor=La,b.editorShowFindDialog=fW,b.editorToDocx=Ett,b.editorUpdateBlockData=Lh,b.editorUpdateCompositionText=FB,b.editorUpdateEmbedData=WB,b.enablePageScroll=Hg,b.escapeHtmlText=jd,b.escapeRegExp=Xg,b.escapeSpace=z9,b.exclusiveBlock=RE,b.executeBlockCommand=Gv,b.executeEmbedBlockCommand=zv,b.executeRangeCommand=E2,b.fileToDataUrl=ma,b.findAfterOffsetNotType=F1,b.findAllText=hp,b.findBlockByIndex=Av,b.findEventTargetBlock=Vb,b.findInsertionById=_v,b.findNextOffset=P8,b.findNextVisibleSimpleBlock=B2,b.findPrevOffset=N8,b.findPrevOffsetNotType=P1,b.findPrevSimpleBlockBeforeChildContainer=c3,b.findPrevVisibleSimpleBlock=v2,b.findTarget=ha,b.findWordEnd=V1,b.findWordLeft=K1,b.format=nu,b.formatBytes=uv,b.formatDate=Wg,b.fragmentToHtml=iv,b.fromBase64=Jc,b.fromBase64ToBlob=Kg,b.fromBase64ToUint8Array=nI,b.fromDocRange=Xo,b.fromNowString=qg,b.genId=et,b.getAllChildBlocks=E1,b.getAllQuickMenuItems=nE,b.getAllSelectedBlocks=Ci,b.getAttributesAt=Ba,b.getBlockBackground=Zg,b.getBlockByIndex=zo,b.getBlockCaretRect=Wo,b.getBlockClass=Qt,b.getBlockClassByType=Ys,b.getBlockClientRects=Yi,b.getBlockCommandsWithHook=s1,b.getBlockContent=Nt,b.getBlockHeading=lu,b.getBlockId=lt,b.getBlockIndex=vt,b.getBlockInfo=xf,b.getBlockKind=Nr,b.getBlockMinWidth=Fv,b.getBlockNearestRangeFromPoint=p1,b.getBlockOptions=BI,b.getBlockPath=qo,b.getBlockProperties=$v,b.getBlockRangeFromPoint=oh,b.getBlockStyles=vI,b.getBlockTextLength=dt,b.getBlockTools=oe,b.getBlockType=Dt,b.getBoxContent=e1,b.getBoxId=Lv,b.getBoxTypeFromElement=su,b.getChildBlockCount=Or,b.getChildBlocks=fe,b.getChildOffset=Yo,b.getColorFromAttributes=B1,b.getColorFromContent=Zd,b.getComplexBlockClass=hr,b.getContainerBlockPath=Qv,b.getContainerBlocks=Ov,b.getContainerBlocksElement=iu,b.getContainerById=Ur,b.getContainerId=ct,b.getContainerMinWidth=u1,b.getContainerToolsElement=xI,b.getContainerWidth=n3,b.getDistanceSquare=jo,b.getElementFromPoint=Ae,b.getElementOffset=Xc,b.getElementScale=dr,b.getEmbedType=$e,b.getExistsBlockTools=th,b.getExistsContainerById=ru,b.getFileExt=eu,b.getFirstChildBlock=be,b.getFirstClientRect=Kd,b.getHeadingBlockChildren=Ca,b.getHeadingMenuOptions=YC,b.getHorizontalPadding=Dg,b.getInsertionContent=n1,b.getLastChildBlock=Ue,b.getLastClientRect=js,b.getListAllNextBrothers=Ya,b.getLogger=I,b.getNextBlock=Jt,b.getNextHiddenBlocks=Xv,b.getNextValidOffset=rl,b.getNextVisibleBlock=gr,b.getOffsetFromPoint=Ig,b.getOffsetInfoAfter=Cu,b.getOffsetInfoBefore=Ah,b.getOpAt=F3,b.getOpLength=sh,b.getParentBlock=Z,b.getParentBlockExcludeSelf=Js,b.getParentBox=t1,b.getParentContainer=it,b.getPrevBlock=Oe,b.getPrevValidOffset=Qo,b.getPrevVisibleBlock=mr,b.getRangeCommands=p2,b.getReferenceClientRect=nk,b.getRootBlock=o1,b.getScrollContainer=Xe,b.getSpecialBlockCommands=Hv,b.getStandardEmbedBlockProperties=nx,b.getTextAfterOffset=U8,b.getTextAttributes=G1,b.getTextBeforeOffset=O8,b.getTextBlockChild=uu,b.getTextBlockClass=vv,b.getTextBlockContentChildTextLength=Cr,b.getTextBlockContentChildType=Yv,b.getTextBlockContentChildren=gi,b.getTextLength=gn,b.getTextOpLength=x1,b.getTextWidth=qd,b.getToolbar=A0,b.handleBlockElementUpdated=Kv,b.hasAltOnly=Q9,b.hasClass=wt,b.hasCtrlOrCmd=Zb,b.hasCtrlOrCmdOnly=Y9,b.hashCode=Cv,b.hideBlock=Rv,b.hideTemplates=iS,b.htmlToFragment=Wd,b.i18n=D,b.includeBigTable=lN,b.injectDocToHtmlFragment=ku,b.injectStyle=jb,b.inputActions=eM,b.insertEmptyBlock=kI,b.insertEmptyEmbedBlock=l1,b.insertText=ro,b.intersectionCommands=MM,b.isBackspace=ev,b.isBlock=Qs,b.isBlockLocked=G0,b.isBlockLockedByOthers=SE,b.isBlockLockedBySelf=Af,b.isBlockTools=kv,b.isBox=eh,b.isBoxOp=to,b.isCJK=Qb,b.isChildContainer=Fr,b.isChildNode=re,b.isCodeBlock=Zr,b.isCollapsedHeadingBlock=mi,b.isCollapsedRange=C8,b.isComplexBlockPosition=el,b.isComplexKindBlock=It,b.isContainer=Xi,b.isContainerSelectedAllChildBlocks=P5,b.isControlEvent=qs,b.isDelete=Z9,b.isDraggingFiles=Xd,b.isElementVisible=Ug,b.isEmbedBlock=pe,b.isEmptyContainer=fu,b.isEmptyDoc=O1,b.isEmptyTextBlock=se,b.isEmptyTextBlockWithoutCompositionText=ff,b.isEnterOnly=tv,b.isEscape=Gd,b.isExclusiveBlock=Ef,b.isExpandedHeadingBlock=qv,b.isFirefox=Wc,b.isFirstChildBlockInComplexBlock=s7,b.isHeadingBlock=ln,b.isHighSurrogate=V9,b.isInBlock=r1,b.isInBlockTools=pa,b.isLetter=Yb,b.isLowSurrogate=$9,b.isMatchShortcut=di,b.isMoveForward=q9,b.isNavigationEvent=W9,b.isNavigationKey=Jb,b.isNodeRemoved=qc,b.isNumber=Xb,b.isPrintableKey=Pg,b.isRootBlock=pr,b.isRootContainer=qt,b.isSafari=$s,b.isSameDay=Gg,b.isSelectBoxOnly=Jr,b.isShiftEnter=J9,b.isShiftTab=eI,b.isShortcutEvent=X9,b.isSimpleBlock=bI,b.isSimpleBlockPosition=Vr,b.isSimplePos=hB,b.isSimpleRange=ph,b.isSpace=zd,b.isTab=tI,b.isTextBlockContentBoxChild=Qn,b.isTextBlockContentChild=au,b.isTextBlockContentInsertionChild=Ji,b.isTextBlockContentTextChild=cu,b.isTextKindBlock=rt,b.isTextKindBlockType=ou,b.isTitleBlock=qi,b.isToday=fv,b.isValidOffset=On,b.isVisibleBlock=Go,b.isYesterday=dv,b.loadJs=Kb,b.loadJsPromise=zs,b.lockers=Mr,b.mergeCommands=x0,b.mergeDocs=sl,b.mergeOps=M1,b.mergeText=h8,b.multiSplitText=V3,b.overflowText=hv,b.parseShortcut=nv,b.patchNode=Zc,b.pointInRect=Ws,b.rangeAddAttribute=mu,b.rangeGetTextColor=q3,b.rangeRemoveAttribute=va,b.rangeSetTextColor=z3,b.rangeTransformText=H3,b.registerDragDrop=Og,b.removeAttribute=v1,b.removeClass=ot,b.removeLastBr=c8,b.removePlaceholderFromBlock=yR,b.removeStyle=Hb,b.replaceAll=fI,b.replaceAllCaseInsensitive=dI,b.replaceAllText=K5,b.replaceText=mh,b.requestDownload=Yd,b.resetListStart=Ja,b.scrollIntoView=xu,b.scrollable=av,b.selectFile=ga,b.selectedBlockToDoc=_h,b.selectionToDoc=Ia,b.setAttributes=$d,b.setClipboardData=tu,b.setClipboardDataByEvent=oI,b.setColorToAttributes=G3,b.setDataset=_g,b.setDefaultCursor=Qc,b.setStyles=Mg,b.shareDBCommentToDocObject=Vp,b.shareDBDocCommentToComment=rT,b.shortcutToDisplayText=qe,b.showBlock=Jg,b.showDocVersions=vtt,b.showTemplates=mx,b.splitText=Mn,b.splitToThree=Je,b.stringToDataUrl=Vg,b.stringToObjectUrl=jg,b.subText=$3,b.textNodeOffsetFromPoint=Fb,b.titleFromEditor=lS,b.toBase64URL=hi,b.toMindmap=y0,b.toPlainText=de,b.toPlainTextKeepLength=N1,b.trimChar=Ng,b.unexclusiveBlock=wE,b.unicodeLength=H9,b.unicodeSubstr=j9,b.updateBlockSelection=Pv,b.updateOpAttributes=fB,b.updateTextBlockContent=M8,b.updateUrl=Fg;for(const n in ye)n!=="default"&&!b.hasOwnProperty(n)&&Object.defineProperty(b,n,{enumerable:!0,get:()=>ye[n]});Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
962
|
+
\`\`\`\`\`\``}return""}const PJ={embedType:"plantuml",convertFrom:UJ,handleUpdateBlock:MJ,createEmbedContent:_J,getBlockProperties:OJ,convertTo:NJ},Hat="",FJ="hr",KJ={dividingLine:{type:"\u5206\u5272\u7EBF",abstract:"\u5206\u5272\u7EBF"}},VJ={dividingLine:{type:"Dividing-Line",abstract:"Dividing-Line"}},$J={dividingLine:{type:"\u533A\u5207\u308A\u7DDA",abstract:"\u533A\u5207\u308A\u7DDA"}};D.mergeLang({"zh-CN":KJ,"en-US":VJ,"ja-JP":$J});function HJ(n,t){const e=v("div",["editor-embed-container"],t);v("hr",["editor-embed-hr"],e)}function jJ(n,t,e,r){return r==="html"?"<hr />":r==="markdown"?"---":"------------"}function zJ(){return{name:"hr",insertEmbedCommandItems:[{id:"insert-hr",name:D.t("dividingLine.type"),icon:FT,order:500,group:"common",subText:kn("insert-hr")}],handleInsertEmptyEmbed:async(n,t)=>{const{containerId:e,blockIndex:r}=t;return n.insertEmbed(e,r,FJ,{})}}}function GJ(n,t,e){const{data:r}=e;if(!r||r.embedType!=="dividing-line"||!rt(n,t))return null;const i={};return{blockData:{id:et(),type:"embed",embedType:"hr",embedData:i}}}function WJ(){return{abstract:D.t("dividingLine.abstract")}}const qJ={embedType:"hr",createEmbedContent:HJ,convertTo:jJ,getOptions:zJ,convertFrom:GJ,getBlockProperties:WJ},jat="",zat="",XJ={media:{upload:{failed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>',maxSizeFailed:'<div class="line-1">{name}\u4E0A\u4F20\u5931\u8D25</div><div class="line-2">\u6587\u4EF6\u5927\u5C0F\u8D85\u8FC7\u9650\u5236\uFF0C\u8BF7\u91CD\u65B0\u9009\u62E9\u6587\u4EF6</div>'},load:{failed:'<div class="line-1">{name}\u52A0\u8F7D\u5931\u8D25</div><div class="line-2">\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5 <span class="retry-upload">\u91CD\u8BD5</span></div>'},audio:{menuItem:"\u97F3\u9891",abstract:"\u97F3\u9891"},video:{menuItem:"\u89C6\u9891",abstract:"\u89C6\u9891"}}},YJ={media:{upload:{failed:'<div class="line-1">{name} upload failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>',maxSizeFailed:'<div class="line-1">{name} upload failed</div><div class="line-2">The file size exceeds limit. Please choose another file.</div>'},load:{failed:'<div class="line-1">{name} loading failed</div><div class="line-2">Network error, you can <span class="retry-upload">Retry</span></div>'},audio:{menuItem:"Audio",abstract:"Audio"},video:{menuItem:"Video",abstract:"Video"}}},QJ={media:{upload:{failed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>',maxSizeFailed:'<div class="line-1">{name}\u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F</div><div class="line-2">\u30D5\u30A1\u30A4\u30EB\u306E\u30B5\u30A4\u30BA\u304C\u4E0A\u9650\u3092\u8D85\u3048\u3066\u3044\u308B\u305F\u3081\u3001\u4ED6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044</div>'},load:{failed:'<div class="line-1">{name}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F</div><div class="line-2">\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 <span class="retry-upload">\u518D\u8A66\u884C</span></div>'},audio:{menuItem:"\u97F3\u58F0",abstract:"\u97F3\u58F0"},video:{menuItem:"\u52D5\u753B",abstract:"\u52D5\u753B"}}};D.mergeLang({"zh-CN":XJ,"en-US":YJ,"ja-JP":QJ});var ni=(n=>(n.AUDIO="audio",n.VIDEO="video",n))(ni||{}),Of=(n=>(n.Empty="empty",n.Progress="progress",n.Error="error",n))(Of||{});const kS=10*1024*1024,JJ=["wav","mp3","aac","ogg","webm","flac"],ZJ=["ogg","mp4","webm"],tZ=()=>{};function RS(n){var h,C,E,x,B,k;const t=(h=n.getComponentOptions("media"))!=null?h:{},{allowedMedias:e,maxSize:r,callbacks:i}=t,o=(C=e==null?void 0:e.audio)!=null?C:JJ,s=(E=e==null?void 0:e.video)!=null?E:ZJ,l=(x=r==null?void 0:r.audio)!=null?x:kS,c=(B=r==null?void 0:r.video)!=null?B:kS,d=(k=i==null?void 0:i.onError)!=null?k:tZ;return{allowedMedias:{audio:o,video:s},maxSize:{audio:l,video:c},callbacks:{onError:d}}}function eZ(n,t){const e=o=>o.map(s=>`.${s}`).join(","),{allowedMedias:r}=RS(n),i=r[t];return i?e(i):"*"}function nZ(n,t,e){const{maxSize:r,callbacks:i,allowedMedias:o}=RS(t),{[e]:s}=r,{[e]:l}=o;if(s&&n.size>s){const d=new Error("media is too large");throw d.code=`MaxMediaSize-${e}`,i!=null&&i.onError&&(i==null||i.onError(t,d)),d}const c=eu(n.name);if(l&&!l.includes(c.toLowerCase())){const d=new Error(`media file is not allowed: ${c}`);throw d.code="NotAllowedFile",i!=null&&i.onError&&(i==null||i.onError(t,d)),d}}function rZ(n){return n===Of.Empty||n===Of.Error}const en=I("media");class iZ extends ye.TypedEmitter{constructor(e){super();m(this,"mediaContainer",null);m(this,"media",null);m(this,"abstract",null);m(this,"handleMediaLoadError",(e,r)=>{if(!r.target||!(r.target instanceof Node)||!(r.target instanceof Element?r.target:r.target.parentElement))return;const o=Z(r.target);if(!o||!o.contains(this.mediaContainer))return;const s=this.renderError();this.updateMediaContent(s),this.emit("mediaError",e,"load_error",lt(o))});m(this,"handleUploadFile",async e=>{p(en,this.abstract,"no abstract"),p(en,this.mediaContainer,"The media element not exist");const{editor:r}=this.options,i=Z(this.mediaContainer);p(en,i,"The block element not exist");const o=r.getBlockData(i);try{const{resourceId:s}=await r.doc.uploadResource(e,{onProgress:C=>{this.renderProgress(C,e)}}),{name:l,type:c,size:d}=e,h={...o,embedData:{...o.embedData,src:s,fileName:l,fileSize:d,fileType:c}};r.updateBlockData(i,h)}catch(s){en.error(s),this.emit("mediaError",r,"upload_error",o.id),this.renderRetry(e,s)}ot(i,"media-block-uploading")});m(this,"destroy",()=>{this.mediaContainer=null});this.options=e}bindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.addEventListener(this.media,"error",this.handleMediaLoadError)}unbindMediaEvent(){const{editor:e}=this.options;this.media&&e.domEvents.removeEventListener(this.media,"error",this.handleMediaLoadError)}updateMediaContent(e){p(en,this.mediaContainer,"The media element not exist"),this.mediaContainer.innerHTML="",this.mediaContainer.append(e)}renderError(){p(en,this.abstract,"no abstract");const{editor:e,createMediaElement:r}=this.options,{mediaIcon:i,mediaName:o}=this.abstract;p(en,this.mediaContainer,"The media element not exist");const s=Z(this.mediaContainer);p(en,s,"The block element not exist");const l=e.getBlockData(s),c=v("div",["media-error","embed-selected-content","embed-hover-content"],null),d=v("span",["media-error-icon"],c);d.innerHTML=i;const h=v("div",[],c);h.innerHTML=D.t("media.load.failed",{name:o}),c.appendChild(h);const C=h.querySelector(".retry-upload");return p(en,C,"The element not exist"),e.domEvents.addEventListener(C,"click",(E,x)=>{const B=v("div",["media-element"],null),k=this.getResourceUrl(l),w=r(E,B,l,k);this.unbindMediaEvent(),this.media=w,this.bindMediaEvent(),this.updateMediaContent(B)}),this.setFullScreen(),c}renderRetry(e,r){var E,x;p(en,this.abstract,"no abstract");const{editor:i}=this.options,{mediaIcon:o,mediaName:s}=this.abstract,l=v("div",["media-error","embed-selected-content","embed-hover-content"],null),c=v("span",["media-error-icon"],l);c.innerHTML=o;const d=v("div",[],l);let h=D.t("media.upload.failed",{name:s});(((E=r.response)==null?void 0:E.status)===420||((x=r.response)==null?void 0:x.status)===413)&&(h=D.t("media.upload.maxSizeFailed",{name:s})),d.innerHTML=h,l.appendChild(d);const C=d.querySelector(".retry-upload");C&&i.domEvents.addEventListener(C,"click",()=>{i.readonly||(p(en,this.abstract,"no abstract"),this.handleUploadFile(e))}),this.updateMediaContent(l),this.setFullScreen()}renderProgress(e,r){p(en,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope .media-progress"),o=e===-1||e===100?100:e;if(i){const{updateProgressElement:s}=this.options;s(i,o)}else{const{createProgressElement:s}=this.options,l=Z(this.mediaContainer);p(en,l,"The element not exist"),z(l,"media-block-uploading");const c=v("div",["media-progress"],null);s(c,o,r),this.updateMediaContent(c)}this.setFullScreen()}renderMediaElement(e,r){p(en,this.mediaContainer,"The media element not exist");const i=this.mediaContainer.querySelector(":scope > .media-element"),{createMediaElement:o,updateMediaElement:s,editor:l}=this.options,c=this.getResourceUrl(e,r);if(i){const d=s(l,i,e,c);this.unbindMediaEvent(),this.media=d,this.bindMediaEvent()}else{const d=v("div",["media-element"],null),h=o(l,d,e,c);this.unbindMediaEvent(),this.media=h,this.bindMediaEvent(),this.updateMediaContent(d)}}renderEmpty(e){p(en,this.abstract,"no abstract"),p(en,this.mediaContainer,"The media element not exist");const r=v("div",["media-empty","embed-selected-content","embed-hover-content"],this.mediaContainer);r.innerHTML=this.abstract.mediaIcon,this.updateMediaContent(r);const{editor:i}=this.options;i.findBlockById(e.id)&&this.emit("mediaError",i,"empty",e.id),this.setFullScreen()}getResourceUrl(e,r){const{src:i}=e.embedData,{editor:o}=this.options;return o.doc.buildResourceUrl(i,{syncNewResources:async(s,l)=>{var d,h;if(!r)return;await o.doc.addResources([s]);const c=(h=(d=o.doc).getServerMeta)==null?void 0:h.call(d).appId;if(l!==e.embedData.src&&c&&e.embedData.src.includes(c)){const C=Z(r);if(C&&!o.readonly&&o.isBlockWritable(C)){const E=mt.default(e);E.embedData.src=s,o.updateBlockData(C,E)}}}})}setFullScreen(){p(en,this.mediaContainer,"The media element not exist"),z(this.mediaContainer,"full-screen")}removeFullScreen(){p(en,this.mediaContainer,"The media element not exist"),ot(this.mediaContainer,"full-screen")}updateBlockAlign(e,r){const i=Z(r);p(en,i,"The block element not exist");const{align:o}=e;e.embedType==="video"&&(i.hasAttribute("data-style-align")&&i.removeAttribute("data-style-align"),i.setAttribute("data-style-align",o))}render(e,r){const{src:i}=e.embedData;(!this.mediaContainer||!r.contains(this.mediaContainer))&&(this.mediaContainer=v("div",["media"],r)),this.updateBlockAlign(e,r),rZ(i)?i===Of.Empty&&this.renderEmpty(e):this.renderMediaElement(e,r)}setAbstract(e){this.abstract=e}}I("media-embed");const oZ="left";class wS{constructor(){m(this,"handleInsertEmptyEmbed",async(t,e)=>{var C;const{containerId:r,blockIndex:i}=e;let o;(C=e.data)!=null&&C.file&&(o=e.data.file);const s=eZ(t,this.embedType);if(o=o!=null?o:await ga(s,{}),!o)return null;const{mediaType:l}=this.getAbstract();try{nZ(o,t,l)}catch{return null}const c={id:et(),type:"embed",embedType:this.embedType,embedData:{src:Of.Empty}};l==="video"&&(c.align=oZ);const d=t.insertBlock(r,i,c);return await this.getMedia(t,c.id).handleUploadFile(o),d})}getMedia(t,e){const r=t.addCustom(`media-${e}`,()=>new iZ({editor:t,createMediaElement:this.createMediaElement,updateMediaElement:this.updateMediaElement,createProgressElement:this.createProgressElement,updateProgressElement:this.updateProgressElement}));return r.setAbstract({...this.getAbstract()}),r}getOptions(){const{menuItem:t,mediaIcon:e,mediaName:r,order:i,group:o}=this.getAbstract();return{name:r,insertEmbedCommandItems:[{id:`insert-${this.embedType}`,name:t,icon:e,order:i,group:o,subText:kn(`insert-${this.embedType}`)}],handleInsertEmptyEmbed:this.handleInsertEmptyEmbed}}createEmbedContent(t,e,r){const{id:i}=r;this.getMedia(t,i).render(r,e)}handleUpdateBlock(t,e,r){const{id:i}=r,o=this.getMedia(t,i),s=Nt(e);return o.render(r,s),!0}handleDeleteBlock(t,e){const r=e.id,i=this.getMedia(t,r);i.removeAllListeners(),i.destroy()}convertTo(t,e,r,i){const o=e.embedData,s=t.doc.buildResourceUrl(o.src,{withToken:!0});return i==="html"?`<${o.type} src="${s}" />`:i==="markdown"?``:s}}function SS(n,t){const e=v("div",["uploading-progress-mask"],n),r=v("div",["uploading-progress-bar"],e),i=v("div",["uploading-progress-bar-value"],r);i.style.width=`${t}%`}function LS(n,t){const e=n.querySelector(".uploading-progress-bar-value");e&&(e.style.width=`${t}%`)}const sZ=I("media-audio");class lZ extends wS{constructor(){super(...arguments);m(this,"embedType",ni.AUDIO);m(this,"updateProgressElement",LS);m(this,"createMediaElement",(e,r,i,o)=>{const s=v("div",["audio-container","embed-hover-content","embed-selected-content"],r),l=v("audio",[],s);return l.innerHTML="Your browser does not support the <code>audio</code> element.",l.controls=!0,l.src=o,setTimeout(()=>{this.getMedia(e,i.id).setFullScreen()}),l})}getAbstract(){return{mediaIcon:OT,mediaName:D.t(`media.${ni.AUDIO}.menuItem`),menuItem:D.t(`media.${ni.AUDIO}.menuItem`),order:800,mediaType:ni.AUDIO,group:"common"}}getBlockProperties(){return{abstract:`${D.t(`media.${ni.AUDIO}.abstract`)}`}}updateMediaElement(e,r,i,o){const s=r.querySelector(":scope .audio-container > audio");return p(sZ,s,"The media element not exist"),s.src!==o&&(s.src=o),s}createProgressElement(e,r){const i=v("audio",[],e);i.innerHTML="Your browser does not support the <code>audio</code> element.",i.controls=!0,i.src="about:blank",SS(e,r)}}const aZ=new lZ;I("video-resizer");function IS(n){return n&&pe(n)&&$e(n)==="video"}const cZ=50;class Tx{constructor(t){m(this,"currentResizableElement",null);m(this,"resizing",!1);m(this,"handleHoveringBlockChange",(t,e)=>{if(!this.resizing&&!window.isDragging&&(e&&IS(e)&&this.disableBlockResize(e),t&&IS(t)&&this.editor.isBlockWritable(t))){const r=this.getVideoElement(t);if(!r)return;this.enableBlockResize(t,r)}});m(this,"handleResizing",(t,e)=>{if(this.resizing=!0,!this.currentResizableElement)return;const r=t.getBlock();if(!r)return;const i=r.getBoundingClientRect().width,o=Math.min(Math.max(e.width,cZ),i);this.currentResizableElement.style.width=`${o}px`,this.currentResizableElement.style.pointerEvents="none"});m(this,"handleResized",t=>{this.resizing=!1;const e=t.getBlock();if(!this.currentResizableElement||!e)return;const r=this.editor.getBlockData(e),{width:i}=this.currentResizableElement.getBoundingClientRect();this.currentResizableElement.style.pointerEvents="auto",this.editor.updateBlockData(e,{...r,width:i})});this.editor=t,Re.get(t).addListener("change",this.handleHoveringBlockChange)}destroy(){this.currentResizableElement=null,Re.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}getVideoElement(t){return Nt(t).querySelector(":scope .video-container > video")}updateResizer(t){const e=this.editor.findCustom(`${lt(t)}-resizer`);e&&e.updateResizer()}disableBlockResize(t){const e=this.editor.findCustom(`${lt(t)}-resizer`);e&&e.disableResize()}enableBlockResize(t,e){const r=this.editor.addCustom(`${lt(t)}-resizer`,()=>new mf(this.editor,{resize:["top-left","top-right","bottom-left","bottom-right"]}));r.enableResize(t,e),r.removeListener("resizing",this.handleResizing),r.removeListener("resized",this.handleResized),r.addListener("resizing",this.handleResizing),r.addListener("resized",this.handleResized),this.currentResizableElement=e}}const uZ=I("video");class fZ extends wS{constructor(){super(...arguments);m(this,"embedType",ni.VIDEO);m(this,"updateProgressElement",LS);m(this,"createMediaElement",(e,r,i,o)=>{const s=v("div",["video-container","embed-selected-content","drag-preview-element"],r),l=v("video",[],s);return l.innerHTML="Your browser does not support the <code>video</code> element.",l.controls=!0,l.src=o,l.addEventListener("canplay",()=>{e.addCustom("video-resizer",()=>new Tx(e)),this.getMedia(e,i.id).removeListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).addListener("mediaError",this.handleMediaError),this.getMedia(e,i.id).removeFullScreen()}),i.width&&(l.style.width=`${i.width}px`),l});m(this,"createProgressElement",(e,r,i)=>{const o=v("video",["progress-video"],e);o.innerHTML="Your browser does not support the <code>audio</code> element.",o.controls=!0,SS(e,r),ma(i).then(s=>{const l=e.querySelector(".progress-video");l&&r1(e)&&(l.src=s)})})}getAbstract(){return{mediaName:D.t(`media.${ni.VIDEO}.menuItem`),mediaIcon:NT,menuItem:D.t(`media.${ni.VIDEO}.menuItem`),order:700,mediaType:ni.VIDEO,group:"common"}}getBlockProperties(){return{abstract:`${D.t(`media.${ni.VIDEO}.abstract`)}`}}handleMediaError(e,r,i){const o=e.addCustom("video-resizer",()=>new Tx(e)),s=e.getBlockById(i);o.disableBlockResize(s)}updateMediaElement(e,r,i,o){const s=r.querySelector(":scope .video-container > video");p(uZ,s,"The media element not exist"),s.src!==o&&(s.src=o),i.width?s.style.width=`${i.width}px`:s.style.width="";const l=e.getBlockById(i.id);return setTimeout(()=>{e.addCustom("video-resizer",()=>new Tx(e)).updateResizer(l)}),s}}const dZ=new fZ,DS=[aE,pE,CE,kk],yx=[bS,hQ,bJ,LJ,PJ,BK,qJ,dZ,aZ,yz,J4,sX],_S=[Pk,eS,T4,Hk];function hZ(n,t,e){var i,o,s,l;_r.level=(i=e.logLevel)!=null?i:Ho.DEBUG;const r=Su(n,t,{components:{blocks:[...DS,...((o=e==null?void 0:e.components)==null?void 0:o.blocks)||[]],embeds:[...yx,...((s=e.components)==null?void 0:s.embeds)||[]],boxes:[..._S,...((l=e.components)==null?void 0:l.boxes)||[]],textRenders:[new HC],options:{...e.componentsOptions}}});return r.readonly=!0,r.addCustom("heading-collapse",()=>new cx(r)),r.addCustom("editor-tooltip",()=>new sf(r)),r.addListener("clickLink",(c,d,h)=>{var E;if((E=e==null?void 0:e.events)!=null&&E.onClickLink){e.events.onClickLink(c,d,h);return}const C=h.getAttribute("link");C&&(c.readonly||d.ctrlKey||d.metaKey)&&window.open(C,"_blank")}),r}class MS{constructor(t){this.createOptions=t,t.lang&&D.setLang(t.lang)}createHistoryEditor(t,e){return hZ(t,e,this.createOptions)}}function US(n,{root:t,childDoc:e,doc:r}){var h,C;e.uploadResource=r.uploadResource.bind(r),e.buildResourceUrl=r.buildResourceUrl.bind(r);const i=n.getComponentOptions("comment"),o={image:{defaultAlign:"left"},table:{locatingContainer:t,hideCellMenu:!0,hideToolbar:!0},...i==null?void 0:i.componentsOptions},s=[];n.editorBlocks.forEach(E=>{E.blockType==="text"||E.blockType==="embed"||s.push(E)});const l=[];n.editorEmbeds.forEach(E=>{l.push(E)});const c=[];n.editorBoxes.forEach(E=>{E.boxType==="text"||E.boxType==="br"||E.boxType==="image"||E.boxType==="anchor"||c.push(E)});const d=Su(t,e,{shortcuts:[Oh],components:{blocks:s,commandProviders:[new m0],decorators:[new V0],embeds:l,boxes:c,options:o}});if(d.input.addHandler(new H0),d.input.addHandler(new OE(d)),d.input.addHandler(new $E(d)),d.input.addHandler(new pq(d)),d.input.addHandler(new W0),d.addCustom("image-paste-handler",()=>new UE(d)),ie.isMobile||d.addCustom("editor-tooltip",()=>new sf(d)),n.options.enableContextMenu!==!1&&d.addCustom("editor-context-menu",E=>new zE(E)),(h=n.options.componentsOptions)!=null&&h.mention){const E=n.options.componentsOptions.mention;d.addCustom("mention",()=>new tS(d,{...E}))}if((C=n.options.componentsOptions)!=null&&C.comment){const E=n.options.componentsOptions.comment;E.onCommentEditorClick&&d.addListener("click",E.onCommentEditorClick)}return d}function mZ(n,t){const e=Array.from(n.rootContainer.querySelectorAll(`[comment-${t.toLocaleLowerCase()}="${t}"]`)),r=new Set;e.forEach(i=>{const o=Z(i);o&&r.add(o)}),r.forEach(i=>{Cq(n,i,t)})}class gZ{constructor(t){m(this,"listeners",new Set);m(this,"doc");this.editor=t,this.doc=this.editor.doc.externalDoc,this.doc.registerCallback(this)}getComments(){return this.doc.getComments()}getComment(t){return this.doc.getComment(t)}getCommentDoc(t){return this.doc.getCommentDoc(t)}localCreateComment(t,e){this.doc.localCreateComment(t,e)}localDeleteComment(t){const e=this.getComment(t);this.doc.localDeleteComment(t);const r=e.groupId;this.getComments().filter(o=>o.groupId===r).length===0&&mZ(this.editor,r)}localUpdateComment(t,e){this.doc.localUpdateComment(t,e)}onCreateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onCreateComment(t,e))}onDeleteComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onDeleteComment(t,e))}onUpdateComment(t,e){Array.from(this.listeners.values()).forEach(r=>r.onUpdateComment(t,e))}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}createCommentEditor(t,e){return US(this.editor,{root:t,childDoc:e,doc:this.doc})}allowEdit(t){return t.userId===this.doc.getUser().userId}}class pZ{constructor(t,e){m(this,"listeners",new Set);this.editor=t,this.localDoc=e}get doc(){return this.localDoc.toJSON()}getComments(){return Object.values(this.doc.comments)}getComment(t){return this.doc.comments[t]}getCommentDoc(t){const e=this.doc.comments[t];return Vp(e)}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}localCreateComment(t,e){}localDeleteComment(t){}localUpdateComment(t,e){}createCommentEditor(t,e){return US(this.editor,{root:t,childDoc:e,doc:this.localDoc})}allowEdit(t){return t.userId===this.localDoc.getUser().userId}}const CZ={placeholder:{common:{title:"\u8BF7\u8F93\u5165\u6807\u9898",readonlyTitle:"\u8BF7\u8F93\u5165\u6807\u9898",content:"\u70B9\u51FB + \uFF0C\u6216\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6",contentInTable:"\u8F93\u5165 / \u5FEB\u6377\u63D2\u5165\u7EC4\u4EF6"},local:{readonlyTitle:"\u672A\u547D\u540D"}},copyCutProperty:{copy:"\u590D\u5236",cut:"\u526A\u5207",unsafeEnvTips:"\u7531\u4E8E\u5F53\u524D http \u8BBF\u95EE\u73AF\u5883\u4E0B\u7684\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528\u5FEB\u6377\u952E({shortCut}) {operation}",limitedEnvTips:"\u7531\u4E8E\u6D4F\u89C8\u5668\u9650\u5236\uFF0C\u8BF7\u4F7F\u7528 {shortCut} \u7C98\u8D34"}},EZ={placeholder:{common:{title:"Enter a title",readonlyTitle:"Enter a title",content:'Click "+", or enter "/" to insert components quickly',contentInTable:'Enter "/" to insert components quickly'},local:{readonlyTitle:"Untitled"}},copyCutProperty:{copy:"Copy",cut:"Cut",unsafeEnvTips:"Due to the limitations of the current http access environment, please use the shortcut ({shortCut}) {operation}",limitedEnvTips:"Press {shortCut} to paste due to browser restrictions"}},xZ={placeholder:{common:{title:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",readonlyTitle:"\u30BF\u30A4\u30C8\u30EB\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",content:"\u300C+\u300D\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u304B\u3001\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059",contentInTable:"\u300C/\u300D\u3092\u5165\u529B\u3059\u308B\u3068\u3001\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u7D20\u65E9\u304F\u633F\u5165\u3067\u304D\u307E\u3059"},local:{readonlyTitle:"\u7121\u984C"}},copyCutProperty:{copy:"\u8907\u88FD",cut:"\u5207\u308B",unsafeEnvTips:"HTTP\u74B0\u5883\u306E\u5236\u7D04\u306B\u3088\u308A\u3001{operation}\u3059\u308B\u306B\u306F\u3001\u30B7\u30E7\u30FC\u30C8\u30AB\u30C3\u30C8({shortCut}) \u3092\u3054\u4F7F\u7528\u304F\u3060\u3055\u3044",limitedEnvTips:"\u30D6\u30E9\u30A6\u30B6\u30FC\u306E\u5236\u9650\u306B\u3088\u308A\u3001\u300C{shortCut}\u300D\u3092\u4F7F\u7528\u3057\u3066\u8CBC\u308A\u4ED8\u3051\u3066\u304F\u3060\u3055\u3044"}};D.mergeLang({"zh-CN":CZ,"en-US":EZ,"ja-JP":xZ});const AZ="UEsDBBQABgAIAAAAIQBk9WPugQEAACkGAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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wf/xOQEAACMDAAAUAAAAAAAAAAAAAAAAAMsaAAB3b3JkL3dlYlNldHRpbmdzLnhtbFBLAQItABQABgAIAAAAIQA520VMuQUAACdaAAASAAAAAAAAAAAAAAAAADYcAAB3b3JkL251bWJlcmluZy54bWxQSwECLQAUAAYACAAAACEA+JXI7/wOAADzmQAADwAAAAAAAAAAAAAAAAAfIgAAd29yZC9zdHlsZXMueG1sUEsBAi0AFAAGAAgAAAAhAMySUFR9AQAA8QIAABEAAAAAAAAAAAAAAAAASDEAAGRvY1Byb3BzL2NvcmUueG1sUEsBAi0AFAAGAAgAAAAhACJREfHVAQAA3gMAABAAAAAAAAAAAAAAAAAA/DMAAGRvY1Byb3BzL2FwcC54bWxQSwECLQAUAAYACAAAACEAiD+lv+EAAABVAQAAGAAAAAAAAAAAAAAAAAAHNwAAY3VzdG9tWG1sL2l0ZW1Qcm9wczEueG1sUEsBAi0AFAAGAAgAAAAhAMEnywi2AAAAIQEAABMAAAAAAAAAAAAAAAAARjgAAGN1c3RvbVhtbC9pdGVtMS54bWxQSwECLQAUAAYACAAAACEAdD85esIAAAAoAQAAHgAAAAAAAAAAAAAAAABVOQAAY3VzdG9tWG1sL19yZWxzL2l0ZW0xLnhtbC5yZWxzUEsBAi0AFAAGAAgAAAAhAOuAYExTAwAAjw4AABIAAAAAAAAAAAAAAAAAWzsAAHdvcmQvZm9udFRhYmxlLnhtbFBLBQYAAAAADwAPANQDAADePgAAAAA=",bZ=()=>Kg(AZ),vZ=I("image-to-docx");async function BZ(n){return new Promise((t,e)=>{const r=new Image;r.onload=()=>{t({width:r.naturalWidth,height:r.naturalHeight})},r.onerror=e,r.src=n})}async function OS(n,t){if(n.width&&n.height)return{width:n.width,height:n.height,buffer:t};try{const e=await ma(new File([t],"",{})),r=await BZ(e);return r.width===void 0||r.height===void 0?{width:345,height:230,buffer:t}:n.width||n.height?{width:n.width||r.width*n.height/r.height,height:n.height||r.height*n.width/r.width,buffer:t}:{width:r.width,height:r.height,buffer:t}}catch(e){vZ.error(e);return}}function TZ(n,t){let e=n.filter(s=>s!=null);const r=t-(e.length-1)*20,i=.87,o=e.reduce((s,l)=>s+l.width,0);return o>r&&(e=e.map(s=>({width:s.width*r/o,height:s.height*r/o,buffer:s.buffer}))),e.map(s=>({width:s.width*i,height:s.height*i,buffer:s.buffer}))}function yZ(n,t,e){if(!e||typeof e!="object")return;const r=e,i=n.filter(s=>s!=null),o=t-(i.length-1)*20;i.forEach((s,l)=>{if(i.length===1&&r.widthPercent){const d=r.widthPercent,h=s.width;s.width=o*(d/100),s.height*=s.width/h;return}const c=`${l}_flex`;if(r[c]){const d=r[c],h=s.width;s.width=o*d,s.height*=s.width/h}})}function NS(n=[0,1,2,3,4,5,6,7],t=1){return n.map(e=>{let r;switch(e%3){case 0:r=Et.LevelFormat.DECIMAL;break;case 1:r=Et.LevelFormat.LOWER_LETTER;break;default:r=Et.LevelFormat.LOWER_ROMAN;break}return{level:e,format:r,text:`%${e+1}. `,alignment:Et.AlignmentType.START,start:t,style:{paragraph:{indent:{left:Et.convertInchesToTwip(.3*(e+1)),hanging:Et.convertInchesToTwip(.2)}}}}})}function kZ(){return[0,1,2,3,4,5,6,7].map(n=>{let t;switch(n%3){case 0:t="\u2022";break;case 1:t="\u25E6";break;default:t="\u25AA";break}return{level:n,format:Et.LevelFormat.BULLET,text:t,alignment:Et.AlignmentType.START,style:{paragraph:{indent:{left:Et.convertInchesToTwip(.3*(n+1)),hanging:Et.convertInchesToTwip(.2)}}}}})}function RZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:Et.LevelFormat.BULLET,text:"\u2611",alignment:Et.AlignmentType.START,style:{paragraph:{indent:{left:Et.convertInchesToTwip(.3*(n+1)),hanging:Et.convertInchesToTwip(.2)}}}}))}function wZ(){return[0,1,2,3,4,5,6,7].map(n=>({level:n,format:Et.LevelFormat.BULLET,text:"\u2610",alignment:Et.AlignmentType.START,style:{paragraph:{indent:{left:Et.convertInchesToTwip(.3*(n+1)),hanging:Et.convertInchesToTwip(.2)}}}}))}var Nf=(n=>(n.NUMBERING="number-numbering-reference",n.BULLET="number-bullet-reference",n.CHECKED="checked-bullet-reference",n.UNCHECKED="unchecked-bullet-reference",n))(Nf||{});const SZ=[{levels:NS(),reference:"number-numbering-reference"},{levels:kZ(),reference:"number-bullet-reference"},{levels:RZ(),reference:"checked-bullet-reference"},{levels:wZ(),reference:"unchecked-bullet-reference"}];function LZ(n){switch(n){case"style-color-0":return"d83931";case"style-color-1":return"de7802";case"style-color-2":return"dc9b04";case"style-color-3":return"2ea121";case"style-color-4":return"245bdb";case"style-color-5":return"6425d0";case"style-color-6":return"8f959e";default:return}}function IZ(n){switch(n){case"style-bg-color-1":case"style-bg-color-2":case"style-bg-color-8":case"style-bg-color-9":return"yellow";case"style-bg-color-0":case"style-bg-color-5":return"magenta";case"style-bg-color-3":return"green";case"style-bg-color-4":case"style-bg-color-11":return"blue";case"style-bg-color-6":return"lightGray";case"style-bg-color-7":return"red";case"style-bg-color-10":return"darkGreen";case"style-bg-color-12":return"darkMagenta";case"style-bg-color-13":return"darkGray";default:return}}function DZ(n){switch(n){case"style-bg-color-0":return"fbbab6";case"style-bg-color-1":return"ffdcb0";case"style-bg-color-2":return"fff7a0";case"style-bg-color-3":return"ceefc5";case"style-bg-color-4":return"d1ddfb";case"style-bg-color-5":return"d9cbf8";case"style-bg-color-6":return"eaeaea";case"style-bg-color-7":return"fe837c";case"style-bg-color-8":return"ffbd6a";case"style-bg-color-9":return"ffe662";case"style-bg-color-10":return"a8f393";case"style-bg-color-11":return"98b5ff";case"style-bg-color-12":return"b394f8";case"style-bg-color-13":return"b1b1b1";default:return}}const _Z=/rgb\((\d+),\s*(\d+),\s*(\d+)\)/;function PS(n){if(typeof n=="string"&&n.length>0){if(n[0]==="#")return n.substring(1);const t=n.match(_Z);if(t){const e=s=>{let l=Number(s).toString(16);return l.length<2&&(l=`0${l}`),l},r=e(t[1]),i=e(t[2]),o=e(t[3]);return`${r}${i}${o}`}if(n==="red")return"FF0000";if(n==="green")return"00FF00";if(n==="blue")return"0000FF"}}function fn(n,t){if(n&&n.attributes&&n.attributes[t])return n.attributes[t];if(n&&n.attributes&&n.attributes.box&&n.attributes.inputType&&t==="style-underline")return!0}function FS(n,t,e){for(let r=0;r<=e;++r){const i=`${t}${r}`;if(fn(n,i))return i}}function pm(n,t,e){n.attributes=n.attributes||{},n.attributes[t]=e}function kx(n){return n==="image"||n==="drawio"||n==="plantuml"||n==="mermaid"||n==="flowchart"}function KS(n){return n&&n.startsWith("//")?`https:${n}`:n&&!n.startsWith("http://")&&!n.startsWith("https://")?`https://${n}`:n}function MZ(n){const t=fn(n,"inlineStyle");if(t==null)return;const e=t.split(";");for(const r of e){const i=r.split(":");if(i.length!==2)continue;const o=i[0].trim().toLowerCase(),s=i[1].trim().toLowerCase();o==="font-size"&&pm(n,"inline-style-font-size",s),o==="color"&&pm(n,"inline-style-color",s),o==="background-color"&&pm(n,"inline-style-background-color",s),o==="font-family"&&pm(n,"inline-style-font-family",s)}}function UZ(n,t){if(t==null)return n==null?void 0:n.normal;if(n)return n[`heading${t}`]}function OZ(n){const t=`${fn(n,"inline-style-font-size")}`;if(t&&t.indexOf("px")>0)return+t.replace(/px/g,"")}function NZ(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` ${n.attributes.text} `;if(n.attributes&&n.attributes.box&&n.attributes.inputType)return n.attributes.value?`${n.attributes.value}`:" "}function PZ(n){if(n.attributes&&n.attributes.box&&n.attributes.text)return` @${n.attributes.text} `}function FZ(n){return fn(n,"inline-style-font-family")}function KZ(n){const t=fn(n,"inline-style-background-color");return PS(t)}function VZ(n){const t=fn(n,"inline-style-color");return PS(t)}function $Z(n){MZ(n);const t=fn(n,"type")==="mention";return{box:n.attributes&&n.attributes.box?n.attributes:void 0,inlineCode:!!fn(n,"style-code"),link:KS(fn(n,"link")),size:OZ(n),text:t?PZ(n):NZ(n)||n.insert,bold:!!fn(n,"style-bold"),underline:!!fn(n,"style-underline"),italics:!!fn(n,"style-italic"),strike:!!fn(n,"style-strikethrough"),superScript:!!fn(n,"style-super"),subScript:!!fn(n,"style-sub"),math:fn(n,"type")==="math"?fn(n,"src"):void 0,mention:t,fontFamily:FZ(n),background:KZ(n),color:t?"338fe5":LZ(FS(n,"style-color-",6))||VZ(n),highlight:FS(n,"style-bg-color-",13)}}function HZ(){return[new Et.Paragraph({border:{top:{color:"auto",style:Et.BorderStyle.DASHED,size:4,space:1}},spacing:{before:300}}),new Et.Paragraph({spacing:{line:0}})]}function jZ(){return new Et.Paragraph({children:[new Et.TextRun({text:"[\u89C6\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:Et.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function zZ(){return new Et.Paragraph({children:[new Et.TextRun({text:"[\u97F3\u9891\u6682\u4E0D\u652F\u6301\u5BFC\u51FA]",shading:{type:Et.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}})]})}function GZ(n,t){return new Et.Paragraph({children:[new Et.ExternalHyperlink({children:[new Et.TextRun({style:"Hyperlink",text:t||n})],link:n})]})}function VS(n){if(n.heading!=null)return`Heading${n.heading}`}function $S(n){if(n.alignment!=null){if(n.alignment==="center")return Et.AlignmentType.CENTER;if(n.alignment==="right")return Et.AlignmentType.RIGHT;if(n.alignment==="left")return Et.AlignmentType.LEFT}}function WZ(n){if(n.indent)return{left:Et.convertInchesToTwip(.3*n.indent-.2)};if(n.padding)return{left:Et.convertInchesToTwip(.3*n.padding)}}function qZ(n){return{type:Et.ShadingType.CLEAR,color:"FFFFFF",fill:n}}function XZ(n){const t=n.split(",");if(t.length!==0)return t[0].trim()}function HS(n,t){let e;e=n.inlineCode?"InlineCode":void 0,e=n.link?"Hyperlink":e;const r=n.size||t,i=r!=null?Math.floor(r*1.5+.5):void 0;return new Et.TextRun({text:n.text,bold:n.bold||void 0,underline:n.underline?{type:Et.UnderlineType.SINGLE}:void 0,italics:n.italics||void 0,strike:n.strike||void 0,superScript:n.superScript||void 0,subScript:n.subScript||void 0,size:i,style:e,font:n.fontFamily?XZ(n.fontFamily):void 0,shading:n.background?qZ(n.background):void 0,color:n.color,highlight:IZ(n.highlight)})}function YZ(n,t){if(n.link)return new Et.ExternalHyperlink({children:[HS(n,t)],link:n.link})}async function jS(n,t,e,r,i){const[o]=await i(n,t,e);if(o==null)return;const s=await OS({width:r||0,height:0,src:e},o);return new Et.ImageRun({data:o,transformation:{width:(s==null?void 0:s.width)||100,height:(s==null?void 0:s.height)||20}})}function QZ(n){if(n.heading||n.heading)return n.heading}function JZ(n){if(n.align&&(n.align==="center"||n.align==="right"||n.align==="left"))return n.align}function ZZ(n){if(n.textOnly===!0&&n.level!=null)return n.level}async function ttt(n,t){var r;const e=[];if(n.text&&Array.isArray(n.text)){for(let i=0;i<n.text.length;i++){const o=n.text[i];if(((r=o.attributes)==null?void 0:r.box)===!0&&t){const s=await t(o);if(s){n.text.splice(i+1,0,...s);continue}}e.push($Z(o))}return e}}function ett(n){if(n.type==="list"&&n.textOnly!==!0)return{checkbox:n.checkbox,groupId:n.groupId,ordered:!!n.ordered,level:n.level||1,start:n.start||0}}function ntt(n,t){if(n.type==="embed"&&n.embedType&&kx(n.embedType)&&n.embedData&&n.embedData.src)return n.embedData.src.split("|").map(r=>{const i=t(r),o=n.embedData[`${i}_width`],s=n.embedData[`${i}_height`];return{src:r,width:o,height:s}})}function rtt(n){if(n.padding)return n.padding}function itt(n){return!!(n.type==="embed"&&n.embedType&&kx(n.embedType)&&n.embedData&&n.embedData.src)}async function Cm(n,t,e){return{quoted:!!n.quoted,heading:QZ(n),alignment:JZ(n),indent:ZZ(n),padding:rtt(n),texts:await ttt(n,e),list:ett(n),images:ntt(n,t),border:itt(n)}}async function ott(n,t,e,r){const i=[];if(!n.children)return[];for(const o of n.children){const s=[];for(const l of t.blocks[o])s.push(await Cm(l,e,r));i.push(s)}return i}const stt=I("to-docx");function ltt(n,t){return Array(n).fill(0).map(()=>Array(t).fill(0).map(()=>({cellId:void 0,color:void 0,from:void 0,rowSpan:1,colSpan:1,width:0,originalWidth:void 0,align:void 0})))}function att(n,t,e,r){const i=!!n.hasColTitle,o=!!n.hasRowTitle,s=!!n.isStripeStyle,l="F5F8FB";for(let c=0;c<t;c++)for(let d=0;d<e;d++)(i&&d===0||o&&c===0||s&&c%2===1)&&(r[c][d].color=l)}function ctt(n){p(stt,n.children,"no table children");const t=n.rows,e=n.cols,r=n.colsWidth;if(r)for(let s=0;s<r.length;s++)r[s]===0&&(r[s]=100);const i=ltt(t,e);let o=0;for(let s=0;s<t;++s)for(let l=0;l<e;++l){if(i[s][l].originalWidth=r?r[l]:void 0,i[s][l].from!==void 0)continue;const c=n.children[o];o+=1,i[s][l].cellId=c,i[s][l].color=DZ(n[`${c}_background`]),i[s][l].width=r?r[l]:100,i[s][l].align=n[`${c}_align`];const d=n[`${c}_rowSpan`]||1,h=n[`${c}_colSpan`]||1;if(i[s][l].rowSpan=d,i[s][l].colSpan=h,d>1||h>1){let C=0;for(let E=0;E<d;E++)for(let x=0;x<h;x++)E===0&&(C+=r?r[l+x]:80),!(E===0&&x===0)&&(i[s+E][l+x].from=[s,l]);i[s][l].width=C}}return att(n,t,e,i),i}async function utt(n,t,e,r,i,o,s,l,c,d){async function h(E){if(l&&E.type!=="_exportVirtualBlock"){const x=await l(i,o,E);if(x){await r.addDoc(n,x,d);return}}if(E.type==="text"||E.textOnly===!0){const x=await Cm(E,s,c);await r.addTextBlock(x);return}if(E.type==="code"){const x=await ott(E,e,s,c);await r.addCodeBlockObject(x);return}if(E.type==="list"&&E.textOnly!==!0){const x=await Cm(E,s,c);await r.addListBlockObject(n,x);return}if(E.type==="embed"&&E.embedType){const x=E,B=x.embedData,k=x.embedType;if(kx(k)){const w=await Cm(E,s,c);await r.addImagesBlockObject(E,w,d)}else E.embedType==="hr"?r.addSeparatorBlock():E.embedType==="video"?r.addVideoPlaceholder():E.embedType==="audio"?r.addAudioPlaceholder():E.embedType==="webpage"?r.addHyperlinkParagraph(KS(B.src),B.title):r.addOtherEmbedBlock(k,E.embedData);return}if(E.type==="table"){let x=[];if(E.colsWidth)x=E.colsWidth;else{const k=E.cols;x=new Array(k);for(let w=0;w<x.length;w++)x[w]=100;E.colsWidth=x}const B=ctt(E);await r.addTableMatrix(x,B,e),r.addEmptyParagraph()}E.type==="_exportVirtualBlock"&&await r.addVirtualBlock(E.id,e,d)}function C(E){var k;const x=((k=E==null?void 0:E.embedData)==null?void 0:k.exportSpec)||(E==null?void 0:E.exportSpec);if(!x)return[E];const B=[];for(const{type:w,data:U}of x){if(w==="text"){const M={id:et(),text:[{insert:U}],type:"text"};B.push(M);continue}if(w==="image"){const M={id:et(),type:"embed",embedType:"image",align:"left",embedData:{src:U}};B.push(M);continue}if(w==="link"){const M={id:et(),type:"embed",embedType:"webpage",embedData:{src:U.url,title:U.title}};B.push(M);continue}if(w==="block")for(const M of U){if(!e.blocks[M])continue;const Y={id:M,type:"_exportVirtualBlock"};B.push(Y)}}return B}for(const E of t)for(const x of C(E))!x||await h(x)}function ftt(){return{listMaxInst:1,listInstMap:{},listRefMap:{},levelConfigs:[]}}const dtt=I("to-docx");class htt{constructor(t,e,r,i,o,s){m(this,"paragraphs");this.appId=t,this.docId=e,this.state=r,this.readImageFunc=i,this.convertBlocksFunc=o,this.defaultFontSize=s,this.paragraphs=[]}async addTextBlock(t){this.paragraphs.push(new Et.Paragraph({heading:VS(t),alignment:$S(t),children:await this.paragraphsFromBlockTexts(t),indent:WZ(t)}))}async addEmptyImagePlaceHolder(){this.paragraphs.push(new Et.Paragraph({text:`[${D.t("docx.imageExportFailed")}]`,shading:{type:Et.ShadingType.CLEAR,color:"FFFFFF",fill:"CCCCCC"}}))}async paragraphsFromBlockTexts(t){if(t.texts==null)return;const e=UZ(this.defaultFontSize,t.heading),r=[];for(const i of t.texts){if(i.link){const o=YZ(i,e);o&&r.push(o);continue}if(i.box&&i.box.type&&i.box.type==="br"){r.push(new Et.TextRun({text:"",break:1}));continue}if(i.box&&i.box.type&&i.box.type==="image"){const o=await jS(this.appId,this.docId,i.box.src,i.box.width,this.readImageFunc);o&&r.push(o);continue}if(i.math){const o=await jS(this.appId,this.docId,i.math,0,this.readImageFunc);o&&r.push(o);continue}r.push(HS(i,e))}return r}async addCodeBlockObject(t){for(const e of t)for(const r of e){const i={style:Et.BorderStyle.SINGLE,color:"#DEDEDE"};this.paragraphs.push(new Et.Paragraph({style:"Code",border:{left:{...i},right:{...i},top:{...i},bottom:{...i}},children:await this.paragraphsFromBlockTexts(r)}))}}async addListBlockObject(t,e){if(e.list==null)return;let r;const i=e.list.checkbox?`${t}-${e.list.groupId}-${e.list.checkbox}`:`${t}-${e.list.groupId}`;if(this.state.listInstMap[i])r=this.state.listInstMap[i];else if(r=this.state.listMaxInst,this.state.listMaxInst+=1,this.state.listInstMap[i]=r,e.list.start>0&&e.list.ordered){const s=`number-numbering-reference-${r}`,l=NS([e.list.level-1],e.list.start);this.state.levelConfigs.push({levels:l,reference:s,inst:r}),this.state.listRefMap[i]=s}else e.list.ordered?this.state.listRefMap[i]=Nf.NUMBERING:e.list.checkbox&&e.list.checkbox==="checked"?this.state.listRefMap[i]=Nf.CHECKED:e.list.checkbox&&e.list.checkbox==="unchecked"?this.state.listRefMap[i]=Nf.UNCHECKED:this.state.listRefMap[i]=Nf.BULLET;const o=VS(e);e.texts&&this.paragraphs.push(new Et.Paragraph({heading:o,children:await this.paragraphsFromBlockTexts(e),numbering:{reference:this.state.listRefMap[i],level:e.list.level-1,instance:r}}))}imageDimWithBufferToImageRun(t){return new Et.ImageRun({data:t.buffer,transformation:{width:t.width,height:t.height}})}async addImagesBlockObject(t,e,r){if(e.images==null){if(t.type==="embed"&&t.embedType==="image"){const{src:c}=t.embedData;c||this.addEmptyImagePlaceHolder()}return}const i=[],o=await Promise.all(e.images.map(async c=>{const[d,h]=await this.readImageFunc(this.appId,this.docId,c.src);if(d){const C=await OS(c,d);if(C)return C}i.push(h)}));yZ(o,r,t.embedData);const s=TZ(o,r),l={style:Et.BorderStyle.SINGLE,color:"#DEDEDE"};s.length&&this.paragraphs.push(new Et.Paragraph({border:e.border?{left:{...l},right:{...l},top:{...l},bottom:{...l}}:void 0,alignment:$S(e)||Et.AlignmentType.CENTER,children:s.map(c=>this.imageDimWithBufferToImageRun(c)).flatMap((c,d,h)=>c==null?[]:h.length-1!==d?[c,new Et.TextRun({text:" "})]:c)})),i.forEach(c=>{this.addHyperlinkParagraph(c)})}addSeparatorBlock(){HZ().forEach(t=>this.paragraphs.push(t))}addEmptyParagraph(){this.paragraphs.push(new Et.Paragraph(""))}addVideoPlaceholder(){this.paragraphs.push(jZ())}addAudioPlaceholder(){this.paragraphs.push(zZ())}addHyperlinkParagraph(t,e){t!=null&&this.paragraphs.push(GZ(t,e))}async addTableMatrix(t,e,r){const i=t.map(o=>o!==0?o*15:1500);this.paragraphs.push(new Et.Table({rows:await this.generateTableRows(e,r),columnWidths:i}))}async generateRowCells(t,e){const r=[];for(const i of t){const o=i.cellId;if(o===void 0)continue;const s=i.width*.9;r.push(new Et.TableCell({children:await this.convertBlocksFunc(o,e.blocks[o],e,this.appId,this.docId,this.state,s),columnSpan:i.colSpan,rowSpan:i.rowSpan,width:{type:Et.WidthType.DXA,size:i.width*15},shading:i.color?{fill:i.color,type:Et.ShadingType.CLEAR,color:"auto"}:void 0}))}return r}async generateTableRows(t,e){const r=[];for(const i of t)r.push(new Et.TableRow({children:await this.generateRowCells(i,e)}));return r}async addDoc(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks.root,e,this.appId,this.docId,this.state,r);i&&(this.paragraphs=this.paragraphs.concat(i))}async addVirtualBlock(t,e,r){const i=await this.convertBlocksFunc(t,e.blocks[t],e,this.appId,this.docId,this.state,r);this.paragraphs.push(...i)}async addOtherEmbedBlock(){}}class mtt{constructor(t,e,r,i,o,s,l,c){m(this,"convertBlocks",async(t,e,r,i,o,s,l=720)=>{const c=new htt(i,o,s,this.readImage,this.convertBlocks,this.defaultFontSize);return await utt(t,e,r,c,i,o,this.md5HexFunc,this.getDocByBlock,this.getTextsByBox,l||720),c.paragraphs});this.templateData=t,this.docData=e,this.md5HexFunc=r,this.readImage=i,this.defaultFontSize=o,this.getDocByBlock=s,this.getTextsByBox=l,this.backgroundImageOptions=c}async convert(t,e){return this.snapshot2docx(this.docData,t,e)}async snapshot2docx(t,e,r){const i=new Et.ImportDotx,o=this.templateData?await i.extract(this.templateData):void 0,s=t.blocks.root;p(dtt,s,"data must have blocks");const l=ftt(),c=await this.convertBlocks("blocks",s,t,e,r,l),d=this.backgroundImageOptions?{default:new Et.Header({children:[new Et.Paragraph({children:[new Et.ImageRun(this.backgroundImageOptions)]})]})}:{},h=new Et.Document({numbering:{config:[...SZ,...l.levelConfigs]},sections:[{headers:d,children:c,properties:{page:{size:{width:12240,height:15840},margin:{top:1440,bottom:1440,left:1440,right:1440}}}}]},{template:o});return Et.Packer.toBlob(h)}}async function gtt(n,t,e,r){const i=n.doc.buildResourceUrl(r,{withToken:!0});let o=await aS(i);if(!o)return[void 0,i];if(o.type.indexOf("/svg")!==-1){const l=await oS(o);l&&(o=new File([l],o.name))}return[await o.arrayBuffer(),i]}async function ptt(n,t,e){const r=n.editorBlocks.getBlockClass(e.type);if(r.toStandardDoc)return r.toStandardDoc(n,e,t)}async function Ctt(n,t){const e=t.attributes,r=n.editorBoxes.getBoxClass(e.type);if(r.toStandardText)return r.toStandardText(n,e)}async function Ett(n,t){let{template:e,download:r,backgroundImageOptions:i}=t!=null?t:{};e||(e=bZ());const o=n.doc.toJSON(),s=(C,E,x)=>gtt(n,C,E,x),l=async(C,E,x)=>ptt(n,o,x),c=async C=>Ctt(n,C),h=await new mtt(e,o,Md.default,s,void 0,l,c,i).convert("_appId","_docId");if(r){const C=URL.createObjectURL(h),E=document.createElement("a");E.setAttribute("download",`${lS(n)}.docx`),E.setAttribute("href",`${C}`),E.click(),E.remove()}return h}const Rx=I("create-editor");async function xtt(n,t){var s,l,c,d,h,C,E,x,B,k,w,U,M,F,Y,X;p(Rx,n,"app does not exists"),t.lang&&D.setLang(t.lang),_r.level=(s=t.logLevel)!=null?s:Ho.DEBUG;const e=t.onReauth?async()=>{var Ct;const G=t.user.userId,st=t.docId,pt=await((Ct=t.onReauth)==null?void 0:Ct.call(t,G,st,t.permission));return{userId:G,docId:st,permission:t.permission,appId:t.appId,token:pt,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl}}:void 0,r={auth:{appId:t.appId,docId:t.docId,userId:t.user.userId,permission:t.permission,token:t.token,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl},serverUrl:t.serverUrl,reauthFunc:e,disableLogout:t.disableLogout},i=await Hu.load(r),o=Su(n,i,{id:t.id,scrollContainer:t==null?void 0:t.scrollContainer,enableComments:t==null?void 0:t.enableComments,enableContextMenu:t==null?void 0:t.enableContextMenu,components:{blocks:[...DS,...((l=t==null?void 0:t.components)==null?void 0:l.blocks)||[]],embeds:[...yx,...((c=t.components)==null?void 0:c.embeds)||[]],boxes:[..._S,...((d=t.components)==null?void 0:d.boxes)||[]],commandProviders:[new m0,...((h=t.components)==null?void 0:h.commandProviders)||[]],decorators:[new V0,new Hp],insertions:[$1],blockHooks:[new LE,new ZR,...((C=t.components)==null?void 0:C.blockHooks)||[]],textRenders:[new p4,new HC,...((E=t.components)==null?void 0:E.textRenders)||[]],options:{...t.componentsOptions}},shortcuts:[wq,rH,gz,cE,$w,cF,rE,dX,Oh,nF,...t.shortcuts||[]],colors:["#0064FF","#EB3723","#F59300","#00A865","#F25A0A","#70A310","#009CAD","#0990D9","#8851ED","#D62069"]});if(o.editorCommandProviders.registerCommandProvider(new Di(o)),o.input.addHandler(new eY),o.input.addHandler(new H0),o.input.addHandler(new wK),o.input.addHandler(new lz),o.input.addHandler(new EE(o,{hideTitle:t.hideTitle,headingLevel:1,titlePlaceholder:D.t("placeholder.common.title"),contentPlaceholder:D.t("placeholder.common.content"),readonlyTitlePlaceholder:D.t("placeholder.common.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0,applyContentPlaceholder:(x=t.placeholder)==null?void 0:x.applyContentPlaceholder})),o.input.addHandler(new M0(o,(B=t.componentsOptions)==null?void 0:B.quickMenu)),o.input.addHandler(new OE(o)),o.input.addHandler(new $E(o)),o.input.addHandler(new W0),o.doc.registerCallback(new nY(o)),o.addCustom("remote-cursor",()=>new oT(o)),o.addCustom("block-menu",G=>new nw(G)),ie.isMobile||o.addCustom("editor-tooltip",()=>new sf(o)),t!=null&&t.enableComments&&o.addCustom("editor-comments",G=>new g4(G,new gZ(G))),t.enableContextMenu!==!1&&o.addCustom("editor-context-menu",G=>new zE(G)),o.addCustom("create-options",()=>new Sb(o,t)),o.addCustom("drop-target",()=>new Tf(o)),o.addCustom("list-to-mindmap",()=>new R0(o)),o.addCustom("list-to-mention",()=>new BY(o)),o.addCustom("mobile-helper",()=>new zY(o)),o.addCustom("code-caret",()=>new Z$(o)),o.addCustom("image-paste-handler",()=>new UE(o)),(k=t.componentsOptions)!=null&&k.mention){const G=t.componentsOptions.mention;o.addCustom("mention",()=>new tS(o,G))}if(o.addCustom("heading-collapse",()=>new cx(o)),o.addCustom(mm,G=>new px(G)),ec.register(o),Tf.register(o),Ts.register(o),Es.register(o),o.addListener("clickLink",(G,st,pt)=>{var yt;if((yt=t==null?void 0:t.events)!=null&&yt.onClickLink){t.events.onClickLink(G,st,pt);return}const Ct=pt.getAttribute("link");Ct&&(G.readonly||st.ctrlKey||st.metaKey)&&window.open(Ct,"_blank")}),(U=(w=t.componentsOptions)==null?void 0:w.remoteCarets)!=null&&U.onUserChanged){const G=(F=(M=t.componentsOptions)==null?void 0:M.remoteCarets)==null?void 0:F.onUserChanged;o.doc.getRemoteUsers().on("change",st=>{G(o,st)})}return(X=(Y=t.componentsOptions)==null?void 0:Y.templates)!=null&&X.templates.length&&(o.addListener("docChanged",()=>{hm(o)}),o.addListener("resize",()=>{hm(o,{reset:!0})}),setTimeout(()=>{hm(o)},100)),o.doc.registerCallback({onError:async G=>{if(G.code==="ResetDoc"){Rx.error(`reset doc: ${G.message}`);const st=await Hu.load(r);o.doc.reset(st)}}}),o.version="1.1.17-beta.9",_r.level===Ho.DEBUG&&(window.setReauthFail=G=>{window.isReauthError=G},window.reConnect=G=>o.doc.externalDoc.client.connection.reConnect(G)),o}function Att(n){return n.toJSON!==void 0}async function btt(n,t,e){var o,s,l,c,d,h,C,E;p(Rx,n,"app does not exists");const r=Att(t)?t:new bp(t,{serverUrl:e.serverUrl||""});e.lang&&D.setLang(e.lang),_r.level=(o=e.logLevel)!=null?o:Ho.DEBUG;const i=Su(n,r,{id:e.id,scrollContainer:e==null?void 0:e.scrollContainer,components:{blocks:[aE,pE,CE,kk,...(l=(s=e.components)==null?void 0:s.blocks)!=null?l:[]],commandProviders:[new m0],decorators:[new V0,new Hp],embeds:[...yx,...((c=e.components)==null?void 0:c.embeds)||[]],boxes:[Pk,eS,T4,Hk,...((d=e.components)==null?void 0:d.boxes)||[]],insertions:[$1],blockHooks:[new LE,...((h=e.components)==null?void 0:h.blockHooks)||[]],textRenders:[new p4,new HC,...((C=e.components)==null?void 0:C.textRenders)||[]],options:{...e.componentsOptions}},shortcuts:[cE,$w,rE,Oh]});return i.editorCommandProviders.registerCommandProvider(new Di(i)),i.input.addHandler(new H0),i.input.addHandler(new EE(i,{hideTitle:e.hideTitle,headingLevel:1,titlePlaceholder:D.t("placeholder.common.title"),contentPlaceholder:D.t("placeholder.common.content"),readonlyTitlePlaceholder:D.t("placeholder.local.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),i.input.addHandler(new M0(i,(E=e.componentsOptions)==null?void 0:E.quickMenu)),i.input.addHandler(new OE(i)),i.input.addHandler(new $E(i)),i.input.addHandler(new W0),i.addCustom("block-menu",x=>new nw(x)),ie.isMobile||i.addCustom("editor-tooltip",()=>new sf(i)),i.addCustom("image-paste-handler",()=>new UE(i)),e!=null&&e.enableComments&&i.addCustom("editor-comments",x=>new g4(x,new pZ(x,r))),e.enableContextMenu!==!1&&i.addCustom("editor-context-menu",x=>new zE(x)),i.addCustom("heading-collapse",()=>new cx(i)),i.addListener("clickLink",(x,B,k)=>{var U;if((U=e==null?void 0:e.events)!=null&&U.onClickLink){e.events.onClickLink(x,B,k);return}const w=k.getAttribute("link");w&&(x.readonly||B.ctrlKey||B.metaKey)&&window.open(w,"_blank")}),i.addCustom(mm,x=>new px(x)),ec.register(i),i.version="1.1.17-beta.9",i}async function vtt(n,t,e){var h;const r=n.doc.externalDoc.client.auth,i=await Wh.load({auth:r,serverUrl:e});if(!((h=i.getVersionHelper)==null?void 0:h.call(i)))throw new Error("the editor does not support to show versions");const s=n.getCustom("create-options");if(!s)throw new Error("the editor does not support to show versions");const l=s.getData(),c=new MS(l),d=n.addCustom("version-dialog",()=>new K4(i,c));return d.show(t),d}b.tippy=t9,b.AnchorBox=TB,b.AuthError=Vu,b.AuthHeader=cl,b.AutoScroll=Qd,b.BaseURLHeader=Na,b.BasicCommands=YF,b.BlockExclusiveHook=ZR,b.BlockLockerHook=LE,b.BlockLockerPasteHandler=W0,b.BlockResizer=mf,b.BrBox=AB,b.CodeBlock=pE,b.CodeLineBlock=CE,b.CodeTextDecorator=V0,b.DOC_RE_AUTH_KEYS=mm,b.DefaultShortcuts=Oh,b.DocIdError=zU,b.DocReAuthCallbacks=px,b.DragDrop=Wb,b.DrawioEmbed=bS,b.EditorBlocks=r3,b.EditorBoxes=vB,b.EditorCommandProviders=x2,b.EditorComplexBlockPosition=Kr,b.EditorComplexSelectionRange=pi,b.EditorDecorators=wB,b.EditorEmbeds=o3,b.EditorInsertions=RB,b.EditorSimpleBlockPosition=Ye,b.EditorSimpleSelectionRange=rn,b.EmbedBlock=l3,b.EmbedBlockResizer=Df,b.EnforceWithDocumentTitleHandler=EE,b.EventCallbacks=fa,b.FILL_CHAR=g8,b.FileExtError=GU,b.GroupOrder=Lk,b.HeadingBlockScrollListener=pY,b.ImageBox=BB,b.InlineBoxCommandProvider=jk,b.InputtingInsertion=yB,b.LocalDoc=bp,b.LogLevel=Ho,b.Logger=_r,b.MIN_DISTANCE_THRESHOLD=zb,b.ManualCloseDialog=zu,b.ManualMenu=ls,b.ManualToolbar=ju,b.MarkdownInputHandler=H0,b.MaxUserError=Mp,b.Mindmap=k0,b.OnesEditorAutoSuggest=uC,b.OnesEditorCustomDataWrapper=Sb,b.OnesEditorExclusiveBlock=Es,b.OnesEditorHoveringBlock=Re,b.OnesEditorIcons=IO,b.OnesEditorQuickMenu=M0,b.OnesEditorToc=Uf,b.OnesEditorTocProvider=Ts,b.OnesEditorToolbar=ec,b.OnesEditorTooltip=sf,b.OnesEditorVersionsDialog=K4,b.PermissionError=Gh,b.Popup=Va,b.ReAuthToolbar=cS,b.RemoteCarets=oT,b.RemoteCaretsDecorator=Hp,b.RemoteCaretsInsertion=$1,b.RemoteUsers=Lu,b.RequestReloadError=$u,b.RichText=pn,b.ShareDBDoc=Hu,b.ShareDBDocVersionsProvider=MS,b.ShareDBServer=Wh,b.SimpleCache=Nb,b.StandardEmbedBlockCommands=ex,b.TEXT_STYLE_BACKGROUND_COLOR_PREFIX=b1,b.TEXT_STYLE_COLOR_PREFIX=A1,b.TableBlock=aE,b.TableBlockCommandProvider=m0,b.TableShortcuts=cE,b.TextBlock=Nn,b.TextBox=xB,b.TextColorItem=By,b.TextStyleShortcuts=rE,b.TocEmbed=J4,b.ZERO_WIDTH_SPACE_CHAR=Yc,b.abbreviation=Jd,b.addAttribute=lh,b.addClass=z,b.addCommentToBlock=If,b.addDays=cI,b.addMetaToDoc=Ru,b.addMonths=aI,b.animateScrollTo=Gs,b.applyPlaceholderToBlock=df,b.assert=p,b.autoShowHideTemplates=hm,b.bindKeyDownEvent=Hd,b.blockToDoc=gp,b.blockToHtml=z1,b.blockToMarkdown=Bh,b.blockToText=vh,b.blocksToDoc=$5,b.clearAllSelection=Nv,b.clientType=ie,b.cloneBlock=ts,b.cloneChildContainer=ep,b.cloneDoc=np,b.cloneText=uB,b.commentToShareDbComment=$p,b.compareElement=Vd,b.comparePosition=d1,b.complexBlockAdjustSelectionPos=ih,b.complexBlockFindNearestChildBlock=l7,b.complexBlockGetAllChildContainers=an,b.complexBlockGetBottomChildContainers=f3,b.complexBlockGetDeepFirstChild=a3,b.complexBlockGetFirstSimpleChild=m1,b.complexBlockGetLastSimpleChild=xa,b.complexBlockGetSelectedContainers=Ea,b.complexBlockGetTopChildContainers=u3,b.containerToDoc=H5,b.continuousScroll=cv,b.convertBlockFrom=nh,b.convertImageFileToPng=oS,b.convertImageSrcToPng=FY,b.converterIntercept=$0,b.copyBlockAttributes=KB,b.copyResourcesFromDoc=Ap,b.createBlockAnchor=Zi,b.createBlockCaretAnchor=h3,b.createBlockContentElement=Zs,b.createBlockElement=wv,b.createBlockSimpleDocRange=Ch,b.createBlockSimpleRange=ve,b.createBoxContentElement=Iv,b.createBoxElement=Sv,b.createBoxOp=cB,b.createChildContainer=e3,b.createComplexBlockPosition=xe,b.createComplexDocPos=gB,b.createComplexDocRange=E8,b.createContainer=dB,b.createContainerElement=Yg,b.createDeleteOps=oB,b.createEditor=Su,b.createEditorSelectionRange=Qe,b.createElement=v,b.createEmptyContainer=oo,b.createEmptyDoc=io,b.createEmptyTextBlockData=gh,b.createExpandedRange=Fd,b.createIconButton=Hs,b.createImage=Lg,b.createInsertOps=hh,b.createInsertionContentElement=Mv,b.createInsertionElement=Dv,b.createLocalEditor=btt,b.createOnesEditor=xtt,b.createRange=Pb,b.createRichText=ol,b.createRootContainer=t3,b.createSimpleBlockPosition=at,b.createSimpleDocPos=mB,b.createTextBlockData=Ai,b.createTextButton=El,b.createTextOp=Er,b.createTextWithReplaceSoftReturn=_1,b.daysAfter=zg,b.deleteText=U1,b.diffDays=uI,b.disablePageScroll=$g,b.docToHtml=UB,b.docToHtmlFragment=Au,b.docToMarkdown=OB,b.docToText=Zo,b.downloadImageToFile=aS,b.downloadObjectToFile=xx,b.downloadSvgToString=dS,b.editLink=nf,b.editorAddComment=xq,b.editorAddTextAttribute=QB,b.editorAutoInsertBlock=VB,b.editorBreakTextBlock=Sa,b.editorClearCompositionText=X1,b.editorClearSelectedContents=wh,b.editorCopyBlock=Ep,b.editorCopyDoc=Uh,b.editorDeleteBlock=J1,b.editorDeleteBlockText=Y1,b.editorDeleteBlockWithoutChildren=kh,b.editorDeleteChildContainer=p_,b.editorDeleteChildContainers=$B,b.editorFocusToBlock=tp,b.editorFocusToEnd=U_,b.editorGetBlockData=Jo,b.editorGetBlockText=yn,b.editorGetBlockTextEx=xh,b.editorGetBoxData=CB,b.editorHandleKeyboardEvent=e2,b.editorInsertBlock=wa,b.editorInsertBoxToBlock=PB,b.editorInsertDoc=XB,b.editorInsertDocAt=rp,b.editorInsertText=q1,b.editorInsertTextToBlock=NB,b.editorInsertTextToBlockEx=W1,b.editorMergeTextBlock=HB,b.editorMoveDown=u5,b.editorMoveEnd=up,b.editorMoveHome=A5,b.editorMoveLeft=l5,b.editorMoveLineEnd=w5,b.editorMoveLineHome=R5,b.editorMovePageDown=M5,b.editorMovePageUp=_5,b.editorMoveRight=a5,b.editorMoveUp=c5,b.editorMoveWordEnd=C5,b.editorMoveWordLeft=p5,b.editorRangeClearColor=ZB,b.editorRangeGetColor=t5,b.editorRangeSetColor=JB,b.editorRemoveTextAttribute=A_,b.editorReplaceBlockText=Sh,b.editorReplaceContainer=YB,b.editorRunOnce=vp,b.editorSelectAll=dp,b.editorSelectContainer=Dh,b.editorSelectDown=f5,b.editorSelectEnd=fp,b.editorSelectHome=b5,b.editorSelectLeft=d5,b.editorSelectLineEnd=k5,b.editorSelectLineHome=y5,b.editorSelectPageDown=N5,b.editorSelectPageUp=O5,b.editorSelectRight=h5,b.editorSelectUp=m5,b.editorSelectWordEnd=x5,b.editorSelectWordLeft=E5,b.editorSetTextColor=La,b.editorShowFindDialog=fW,b.editorToDocx=Ett,b.editorUpdateBlockData=Lh,b.editorUpdateCompositionText=FB,b.editorUpdateEmbedData=WB,b.enablePageScroll=Hg,b.escapeHtmlText=jd,b.escapeRegExp=Xg,b.escapeSpace=z9,b.exclusiveBlock=RE,b.executeBlockCommand=Gv,b.executeEmbedBlockCommand=zv,b.executeRangeCommand=E2,b.fileToDataUrl=ma,b.findAfterOffsetNotType=F1,b.findAllText=hp,b.findBlockByIndex=Av,b.findEventTargetBlock=Vb,b.findInsertionById=_v,b.findNextOffset=P8,b.findNextVisibleSimpleBlock=B2,b.findPrevOffset=N8,b.findPrevOffsetNotType=P1,b.findPrevSimpleBlockBeforeChildContainer=c3,b.findPrevVisibleSimpleBlock=v2,b.findTarget=ha,b.findWordEnd=V1,b.findWordLeft=K1,b.format=nu,b.formatBytes=uv,b.formatDate=Wg,b.fragmentToHtml=iv,b.fromBase64=Jc,b.fromBase64ToBlob=Kg,b.fromBase64ToUint8Array=nI,b.fromDocRange=Xo,b.fromNowString=qg,b.genId=et,b.getAllChildBlocks=E1,b.getAllQuickMenuItems=nE,b.getAllSelectedBlocks=Ci,b.getAttributesAt=Ba,b.getBlockBackground=Zg,b.getBlockByIndex=zo,b.getBlockCaretRect=Wo,b.getBlockClass=Qt,b.getBlockClassByType=Ys,b.getBlockClientRects=Yi,b.getBlockCommandsWithHook=s1,b.getBlockContent=Nt,b.getBlockHeading=lu,b.getBlockId=lt,b.getBlockIndex=vt,b.getBlockInfo=xf,b.getBlockKind=Nr,b.getBlockMinWidth=Fv,b.getBlockNearestRangeFromPoint=p1,b.getBlockOptions=BI,b.getBlockPath=qo,b.getBlockProperties=$v,b.getBlockRangeFromPoint=oh,b.getBlockStyles=vI,b.getBlockTextLength=dt,b.getBlockTools=oe,b.getBlockType=Dt,b.getBoxContent=e1,b.getBoxId=Lv,b.getBoxTypeFromElement=su,b.getChildBlockCount=Or,b.getChildBlocks=fe,b.getChildOffset=Yo,b.getColorFromAttributes=B1,b.getColorFromContent=Zd,b.getComplexBlockClass=hr,b.getContainerBlockPath=Qv,b.getContainerBlocks=Ov,b.getContainerBlocksElement=iu,b.getContainerById=Ur,b.getContainerId=ct,b.getContainerMinWidth=u1,b.getContainerToolsElement=xI,b.getContainerWidth=n3,b.getDistanceSquare=jo,b.getElementFromPoint=Ae,b.getElementOffset=Xc,b.getElementScale=dr,b.getEmbedType=$e,b.getExistsBlockTools=th,b.getExistsContainerById=ru,b.getFileExt=eu,b.getFirstChildBlock=be,b.getFirstClientRect=Kd,b.getHeadingBlockChildren=Ca,b.getHeadingMenuOptions=YC,b.getHorizontalPadding=Dg,b.getInsertionContent=n1,b.getLastChildBlock=Ue,b.getLastClientRect=js,b.getListAllNextBrothers=Ya,b.getLogger=I,b.getNextBlock=Jt,b.getNextHiddenBlocks=Xv,b.getNextValidOffset=rl,b.getNextVisibleBlock=gr,b.getOffsetFromPoint=Ig,b.getOffsetInfoAfter=Cu,b.getOffsetInfoBefore=Ah,b.getOpAt=F3,b.getOpLength=sh,b.getParentBlock=Z,b.getParentBlockExcludeSelf=Js,b.getParentBox=t1,b.getParentContainer=it,b.getPrevBlock=Oe,b.getPrevValidOffset=Qo,b.getPrevVisibleBlock=mr,b.getRangeCommands=p2,b.getReferenceClientRect=nk,b.getRootBlock=o1,b.getScrollContainer=Xe,b.getSpecialBlockCommands=Hv,b.getStandardEmbedBlockProperties=nx,b.getTextAfterOffset=U8,b.getTextAttributes=G1,b.getTextBeforeOffset=O8,b.getTextBlockChild=uu,b.getTextBlockClass=vv,b.getTextBlockContentChildTextLength=Cr,b.getTextBlockContentChildType=Yv,b.getTextBlockContentChildren=gi,b.getTextLength=gn,b.getTextOpLength=x1,b.getTextWidth=qd,b.getToolbar=A0,b.handleBlockElementUpdated=Kv,b.hasAltOnly=Q9,b.hasClass=wt,b.hasCtrlOrCmd=Zb,b.hasCtrlOrCmdOnly=Y9,b.hashCode=Cv,b.hideBlock=Rv,b.hideTemplates=iS,b.htmlToFragment=Wd,b.i18n=D,b.includeBigTable=lN,b.injectDocToHtmlFragment=ku,b.injectStyle=jb,b.inputActions=eM,b.insertEmptyBlock=kI,b.insertEmptyEmbedBlock=l1,b.insertText=ro,b.intersectionCommands=MM,b.isBackspace=ev,b.isBlock=Qs,b.isBlockLocked=G0,b.isBlockLockedByOthers=SE,b.isBlockLockedBySelf=Af,b.isBlockTools=kv,b.isBox=eh,b.isBoxOp=to,b.isCJK=Qb,b.isChildContainer=Fr,b.isChildNode=re,b.isCodeBlock=Zr,b.isCollapsedHeadingBlock=mi,b.isCollapsedRange=C8,b.isComplexBlockPosition=el,b.isComplexKindBlock=It,b.isContainer=Xi,b.isContainerSelectedAllChildBlocks=P5,b.isControlEvent=qs,b.isDelete=Z9,b.isDraggingFiles=Xd,b.isElementVisible=Ug,b.isEmbedBlock=pe,b.isEmptyContainer=fu,b.isEmptyDoc=O1,b.isEmptyTextBlock=se,b.isEmptyTextBlockWithoutCompositionText=ff,b.isEnterOnly=tv,b.isEscape=Gd,b.isExclusiveBlock=Ef,b.isExpandedHeadingBlock=qv,b.isFirefox=Wc,b.isFirstChildBlockInComplexBlock=s7,b.isHeadingBlock=ln,b.isHighSurrogate=V9,b.isInBlock=r1,b.isInBlockTools=pa,b.isLetter=Yb,b.isLowSurrogate=$9,b.isMatchShortcut=di,b.isMoveForward=q9,b.isNavigationEvent=W9,b.isNavigationKey=Jb,b.isNodeRemoved=qc,b.isNumber=Xb,b.isPrintableKey=Pg,b.isRootBlock=pr,b.isRootContainer=qt,b.isSafari=$s,b.isSameDay=Gg,b.isSelectBoxOnly=Jr,b.isShiftEnter=J9,b.isShiftTab=eI,b.isShortcutEvent=X9,b.isSimpleBlock=bI,b.isSimpleBlockPosition=Vr,b.isSimplePos=hB,b.isSimpleRange=ph,b.isSpace=zd,b.isTab=tI,b.isTextBlockContentBoxChild=Qn,b.isTextBlockContentChild=au,b.isTextBlockContentInsertionChild=Ji,b.isTextBlockContentTextChild=cu,b.isTextKindBlock=rt,b.isTextKindBlockType=ou,b.isTitleBlock=qi,b.isToday=fv,b.isValidOffset=On,b.isVisibleBlock=Go,b.isYesterday=dv,b.loadJs=Kb,b.loadJsPromise=zs,b.lockers=Mr,b.mergeCommands=x0,b.mergeDocs=sl,b.mergeOps=M1,b.mergeText=h8,b.multiSplitText=V3,b.overflowText=hv,b.parseShortcut=nv,b.patchNode=Zc,b.pointInRect=Ws,b.rangeAddAttribute=mu,b.rangeGetTextColor=q3,b.rangeRemoveAttribute=va,b.rangeSetTextColor=z3,b.rangeTransformText=H3,b.registerDragDrop=Og,b.removeAttribute=v1,b.removeClass=ot,b.removeLastBr=c8,b.removePlaceholderFromBlock=yR,b.removeStyle=Hb,b.replaceAll=fI,b.replaceAllCaseInsensitive=dI,b.replaceAllText=K5,b.replaceText=mh,b.requestDownload=Yd,b.resetListStart=Ja,b.scrollIntoView=xu,b.scrollable=av,b.selectFile=ga,b.selectedBlockToDoc=_h,b.selectionToDoc=Ia,b.setAttributes=$d,b.setClipboardData=tu,b.setClipboardDataByEvent=oI,b.setColorToAttributes=G3,b.setDataset=_g,b.setDefaultCursor=Qc,b.setStyles=Mg,b.shareDBCommentToDocObject=Vp,b.shareDBDocCommentToComment=rT,b.shortcutToDisplayText=qe,b.showBlock=Jg,b.showDocVersions=vtt,b.showTemplates=mx,b.splitText=Mn,b.splitToThree=Je,b.stringToDataUrl=Vg,b.stringToObjectUrl=jg,b.subText=$3,b.textNodeOffsetFromPoint=Fb,b.titleFromEditor=lS,b.toBase64URL=hi,b.toMindmap=y0,b.toPlainText=de,b.toPlainTextKeepLength=N1,b.trimChar=Ng,b.unexclusiveBlock=wE,b.unicodeLength=H9,b.unicodeSubstr=j9,b.updateBlockSelection=Pv,b.updateOpAttributes=fB,b.updateTextBlockContent=M8,b.updateUrl=Fg;for(const n in ye)n!=="default"&&!b.hasOwnProperty(n)&&Object.defineProperty(b,n,{enumerable:!0,get:()=>ye[n]});Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|