@ones-editor/editor 0.0.3-beta.53 → 0.0.3-beta.55
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/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -683,4 +683,4 @@ width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
|
683
683
|
`:`[${i.fileName}]
|
|
684
684
|
`:i.src?`[${i.fileName}](${n.doc.buildResourceUrl(i.src,{withToken:!0})})`:`[${i.fileName}]`}const IN={embedType:"office",createEmbedContent:yN,getBlockProperties:BN,convertTo:EN},Zz="",xN={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 <a href="" class="retry-upload">\u91CD\u8BD5</a></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 <a href="" class="retry-upload">\u91CD\u8BD5</a></div>'},audio:{menuItem:"\u97F3\u9891",abstract:"\u97F3\u9891"},video:{menuItem:"\u89C6\u9891",abstract:"\u89C6\u9891"}}},TN={media:{upload:{failed:'<div class="line-1">{name} upload failed</div><div class="line-2">The network service is abnormal, you can <a href="" class="retry-upload">Try again</a></div>'},load:{failed:'<div class="line-1">{name} loading failed</div><div class="line-2">The network service is abnormal, you can <a href="" class="retry-upload">Try again</a></div>'},audio:{menuItem:"Audio",abstract:"Audio"},video:{menuItem:"Video",abstract:"Video"}}};T.mergeLang({"zh-CN":xN,"en-US":TN});var mn=(n=>(n.AUDIO="audio",n.VIDEO="video",n))(mn||{}),Gs=(n=>(n.Empty="empty",n.Progress="progress",n.Error="error",n))(Gs||{});const G3=10*1024*1024,SN=["wav","mp3","aac","ogg","webm","flac"],DN=["ogg","mp4","webm"],LN=()=>{};function Z3(n){var u,f,m,C,v,B;const t=(u=n.getComponentOptions("media"))!=null?u:{},{allowedMedias:e,maxSize:o,callbacks:r}=t,i=(f=e==null?void 0:e.audio)!=null?f:SN,s=(m=e==null?void 0:e.video)!=null?m:DN,l=(C=o==null?void 0:o.audio)!=null?C:G3,c=(v=o==null?void 0:o.video)!=null?v:G3,a=(B=r==null?void 0:r.onError)!=null?B:LN;return{allowedMedias:{audio:i,video:s},maxSize:{audio:l,video:c},callbacks:{onError:a}}}const MN=w("file-utils");function RN(n){d(MN,n instanceof File,`The file: ${n} isn't instance of File`);const{name:t}=n;if(!t)return"";const e=t.lastIndexOf(".");return e===-1?"":t.slice(e+1)}function Y3(n,t){const e=i=>i.map(s=>`.${s}`).join(","),{allowedMedias:o}=Z3(n),r=o[t];return r?e(r):"*"}function AN(n,t,e){const{maxSize:o,callbacks:r,allowedMedias:i}=Z3(t),{[e]:s}=o,{[e]:l}=i;if(s&&n.size>s){const a=new Error("media is too large");return a.code=`MaxMediaSize-${e}`,r!=null&&r.onError&&(r==null||r.onError(t,a)),a}const c=RN(n);if(l&&!l.includes(c)){const a=new Error(`media file is not allowed: ${c}`);return a.code="NotAllowedFile",r!=null&&r.onError&&(r==null||r.onError(t,a)),a}return!0}function ON(n){return n===Gs.Empty||n===Gs.Error}const pe=w("media");class _N{constructor(t){h(this,"mediaContainer",null);h(this,"media",null);h(this,"abstract",null);h(this,"handleMediaLoadError",(t,e)=>{if(!e.target||!(e.target instanceof Node)||!(e.target instanceof Element?e.target:e.target.parentElement))return;const r=F(e.target);if(!r||!r.contains(this.mediaContainer))return;const i=this.renderError();this.updateMediaContent(i)});h(this,"handleRetry",async t=>{if(t.readonly)return;d(pe,this.abstract,"no abstract");const{mediaType:e}=this.abstract,o=Y3(t,e),r=await No(o);this.handleUploadFile(r)});h(this,"handleUploadFile",async t=>{d(pe,this.abstract,"no abstract"),d(pe,this.mediaContainer,"The media element not exist");const{editor:e}=this.options,{mediaType:o}=this.abstract,r=F(this.mediaContainer);d(pe,r,"The block element not exist");const i=e.getBlockData(r);if(!!AN(t,e,o))try{const{resourceId:s}=await e.doc.uploadResource(t,{onProgress:f=>{this.renderProgress(f,t)}}),{name:l,type:c,size:a}=t,u={...i,embedData:{...i.embedData,src:s,fileName:l,fileSize:a,fileType:c}};e.updateBlockData(r,u)}catch{this.renderRetry()}});h(this,"destroy",()=>{this.mediaContainer=null});this.options=t}bindMediaEvent(){const{editor:t}=this.options;this.media&&t.domEvents.addEventListener(this.media,"error",this.handleMediaLoadError)}unbindMediaEvent(){const{editor:t}=this.options;this.media&&t.domEvents.removeEventListener(this.media,"error",this.handleMediaLoadError)}updateMediaContent(t){d(pe,this.mediaContainer,"The media element not exist"),this.mediaContainer.innerHTML="",this.mediaContainer.append(t)}renderError(){d(pe,this.abstract,"no abstract");const{editor:t,createMediaElement:e}=this.options,{mediaIcon:o,mediaName:r}=this.abstract;d(pe,this.mediaContainer,"The media element not exist");const i=F(this.mediaContainer);d(pe,i,"The block element not exist");const s=t.getBlockData(i),l=s.embedData.src,c=b("div",["media-error","embed-selected-content","embed-hover-content"],null),a=b("span",["media-error-icon"],c);a.innerHTML=o;const u=b("div",[],c);u.innerHTML=T.t("media.load.failed",{name:r}),c.appendChild(u);const f=u.querySelector("a");return d(pe,f,"The element not exist"),t.domEvents.addEventListener(f,"click",(m,C)=>{if(C.preventDefault(),C.target instanceof HTMLElement&&C.target.tagName==="A"){const v=b("div",["media-element"],null),B=this.getResourceUrl(l),y=e(m,v,s,B);this.unbindMediaEvent(),this.media=y,this.bindMediaEvent(),this.updateMediaContent(v)}}),c}renderRetry(){d(pe,this.abstract,"no abstract");const{editor:t}=this.options,{mediaIcon:e,mediaName:o}=this.abstract,r=b("div",["media-error","embed-selected-content","embed-hover-content"],null),i=b("span",["media-error-icon"],r);i.innerHTML=e;const s=b("div",[],r);s.innerHTML=T.t("media.upload.failed",{name:o}),r.appendChild(s);const l=s.querySelector("a");d(pe,l,"The element not exist"),t.domEvents.addEventListener(l,"click",this.handleRetry),this.updateMediaContent(r)}renderProgress(t,e){d(pe,this.mediaContainer,"The media element not exist");const o=this.mediaContainer.querySelector(":scope .media-progress"),r=t===-1||t===100?100:t;if(o){const{updateProgressElement:i}=this.options;i(o,r)}else{const{createProgressElement:i}=this.options,s=b("div",["media-progress"],null);i(s,r,e),this.updateMediaContent(s)}}renderMediaElement(t){d(pe,this.mediaContainer,"The media element not exist");const e=this.mediaContainer.querySelector(":scope > .media-element"),{createMediaElement:o,updateMediaElement:r,editor:i}=this.options,s=this.getResourceUrl(t.embedData.src);if(e){const l=r(i,e,t,s);this.unbindMediaEvent(),this.media=l,this.bindMediaEvent()}else{const l=b("div",["media-element"],null),c=o(i,l,t,s);this.unbindMediaEvent(),this.media=c,this.bindMediaEvent(),this.updateMediaContent(l)}}renderEmpty(){d(pe,this.abstract,"no abstract"),d(pe,this.mediaContainer,"The media element not exist");const t=b("div",["media-empty","embed-selected-content","embed-hover-content"],this.mediaContainer);t.innerHTML=this.abstract.mediaIcon,this.updateMediaContent(t)}getResourceUrl(t){const{editor:e}=this.options;return e.doc.buildResourceUrl(t)}render(t,e){const{src:o}=t.embedData;(!this.mediaContainer||!e.contains(this.mediaContainer))&&(this.mediaContainer=b("div",["media"],e)),ON(o)?o===Gs.Empty&&this.renderEmpty():this.renderMediaElement(t)}setAbstract(t){this.abstract=t}}w("media-embed");class Q3{constructor(){h(this,"handleInsertEmptyEmbed",async(t,e)=>{var u;const{containerId:o,blockIndex:r}=e;let i;(u=e.data)!=null&&u.file&&(i=e.data.file);const s=Y3(t,this.embedType);if(i=i!=null?i:await No(s,{}),!i)return null;const l={id:N(),type:"embed",embedType:this.embedType,embedData:{src:Gs.Empty}},c=t.insertBlock(o,r,l);return await this.getMedia(t,l.id).handleUploadFile(i),c})}getMedia(t,e){const o=t.addCustom(`media-${e}`,()=>new _N({editor:t,createMediaElement:this.createMediaElement,updateMediaElement:this.updateMediaElement,createProgressElement:this.createProgressElement,updateProgressElement:this.updateProgressElement}));return o.setAbstract({...this.abstract}),o}getOptions(){const{menuItem:t,mediaIcon:e,mediaName:o,order:r,group:i}=this.abstract;return{name:o,insertEmbedCommandItems:[{id:`insert-${this.embedType}`,name:t,icon:e,order:r,group:i,subText:fe(`insert-${this.embedType}`)}],handleInsertEmptyEmbed:this.handleInsertEmptyEmbed}}createEmbedContent(t,e,o){const{id:r}=o;this.getMedia(t,r).render(o,e)}handleUpdateBlock(t,e,o){const{id:r}=o,i=this.getMedia(t,r),s=it(e);return i.render(o,s),!0}handleDeleteBlock(t,e){const o=e.id;this.getMedia(t,o).destroy()}convertTo(t,e,o,r){const i=e.embedData,s=t.doc.buildResourceUrl(i.src,{withToken:!0});return r==="html"?`<${i.type} src="${s}" />`:r==="markdown"?``:s}}function K3(n,t){const e=b("div",["uploading-progress-mask"],n),o=b("div",["uploading-progress-bar"],e),r=b("div",["uploading-progress-bar-value"],o);r.style.width=`${t}%`}function J3(n,t){const e=n.querySelector(".uploading-progress-bar-value");e&&(e.style.width=`${t}%`)}const NN=w("media-audio");class $N extends Q3{constructor(){super(...arguments);h(this,"embedType",mn.AUDIO);h(this,"abstract",{mediaIcon:nB,mediaName:T.t(`media.${mn.AUDIO}.menuItem`),menuItem:T.t(`media.${mn.AUDIO}.menuItem`),order:800,mediaType:mn.AUDIO,group:"common"});h(this,"updateProgressElement",J3)}getBlockProperties(){return{abstract:`[${T.t(`media.${mn.AUDIO}.abstract`)}]`}}createMediaElement(e,o,r,i){const s=b("div",["audio-container","embed-hover-content","embed-selected-content"],o),l=b("audio",[],s);return l.innerHTML="Your browser does not support the <code>audio</code> element.",l.controls=!0,l.src=i,l}updateMediaElement(e,o,r,i){const s=o.querySelector(":scope .audio-container > audio");return d(NN,s,"The media element not exist"),s.src!==i&&(s.src=i),s}createProgressElement(e,o){const r=b("audio",[],e);r.innerHTML="Your browser does not support the <code>audio</code> element.",r.controls=!0,r.src="about:blank",K3(e,o)}}const df=new $N;w("video-resizer");function X3(n){return n&&Te(n)&&Oe(n)==="video"}const PN=50;class jN{constructor(t){h(this,"currentResizableElement",null);h(this,"resizing",!1);h(this,"handleHoveringBlockChange",(t,e)=>{if(!this.resizing&&(e&&X3(e)&&this.disableBlockResize(e),t&&X3(t))){const o=this.getVideoElement(t);if(!o)return;this.enableBlockResize(t,o)}});h(this,"handleResizing",(t,e)=>{if(this.resizing=!0,!this.currentResizableElement)return;const o=t.getBlock();if(!o)return;const r=o.getBoundingClientRect().width,i=Math.min(Math.max(e.width,PN),r);this.currentResizableElement.style.width=`${i}px`});h(this,"handleResized",t=>{this.resizing=!1;const e=t.getBlock();if(!this.currentResizableElement||!e)return;const o=this.editor.getBlockData(e),{width:r}=this.currentResizableElement.getBoundingClientRect();this.editor.updateBlockData(e,{...o,width:r})});this.editor=t,Nt.get(t).addListener("change",this.handleHoveringBlockChange)}destroy(){this.currentResizableElement=null,Nt.get(this.editor).removeListener("change",this.handleHoveringBlockChange)}getVideoElement(t){return it(t).querySelector(":scope .video-container > video")}disableBlockResize(t){const e=this.editor.findCustom(`${q(t)}-resizer`);e&&e.disableResize()}enableBlockResize(t,e){const o=this.editor.addCustom(`${q(t)}-resizer`,()=>new Yc(this.editor,{resize:["top-left","top-right","bottom-left","bottom-right"]}));o.enableResize(t,e),o.removeListener("resizing",this.handleResizing),o.removeListener("resized",this.handleResized),o.addListener("resizing",this.handleResizing),o.addListener("resized",this.handleResized),this.currentResizableElement=e}}const HN=w("video");class FN extends Q3{constructor(){super(...arguments);h(this,"embedType",mn.VIDEO);h(this,"abstract",{mediaName:T.t(`media.${mn.VIDEO}.menuItem`),mediaIcon:oB,menuItem:T.t(`media.${mn.VIDEO}.menuItem`),order:700,mediaType:mn.VIDEO,group:"common"});h(this,"updateProgressElement",J3);h(this,"createProgressElement",(e,o,r)=>{const i=b("video",["progress-video"],e);i.innerHTML="Your browser does not support the <code>audio</code> element.",i.controls=!0,K3(e,o),pl(r).then(s=>{const l=e.querySelector(".progress-video");l&&Cd(e)&&(l.src=s)})})}getBlockProperties(){return{abstract:`[${T.t(`media.${mn.VIDEO}.abstract`)}]`}}createMediaElement(e,o,r,i){const s=b("div",["video-container","embed-selected-content","drag-preview-element"],o),l=b("video",[],s);return l.innerHTML="Your browser does not support the <code>video</code> element.",l.controls=!0,l.src=i,e.addCustom("video-resizer",()=>new jN(e)),r.width&&(l.style.width=`${r.width}px`),l}updateMediaElement(e,o,r,i){const s=o.querySelector(":scope .video-container > video");return d(HN,s,"The media element not exist"),s.src!==i&&(s.src=i),s}}const uf=new FN,Yz="",zN={version:{latest:"\u5F53\u524D\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\u8BB0\u5F55 {count}",unknown:"\u672A\u77E5\u7248\u672C",restoreFrom:"\u56DE\u6EDA\u81EA\u7248\u672C {from}",restoreInfo:"\u56DE\u6EDA\u7684\u7248\u672C\u6682\u4E0D\u652F\u6301\u4E0E\u4E0A\u4E00\u7248\u672C\u5BF9\u6BD4"}},UN={version:{latest:"Latest",insert:"Added by {name}",delete:"Deleted by {name}",goBack:"Back",revertVersion:"Revert",play:"Play",versionList:"Versions ({count})",unknown:"Unknown version",restoreFrom:"Reverted from {from}",restoreInfo:"The rolled back version does not currently support comparison with the previous version."}};T.mergeLang({"zh-CN":zN,"en-US":UN});var tC=(n=>(n.NEW="history-new",n.NEW_CHILD="history-new-child",n.DELETED="history-deleted",n.UPDATED="history-updated",n.HISTORY="history",n))(tC||{});const ui="--op-color",hi="--op-selected-color",Qz="";class VN{constructor(t){h(this,"root");this.content=t;const e=b("div",["dialog-root"],null);e.append(t),this.root=e}show(t=document.body){t.append(this.root)}hide(){this.root.remove()}destroy(){}}const{t:fi}=T,eC=w("version-list");class qN{constructor(t){h(this,"activeVersionElement");h(this,"versionsList");h(this,"versionsListHeader");h(this,"handleClickVersionItem",t=>{const o=t.target.closest(".dialog-version-list-item");if(this.isVersionElement(o)){this.toggleActiveVersionElement(o);const r=this.getVersionFromElement(o),{onSelectVersion:i}=this.options;i(r)}});this.options=t;const{versions:e,defaultSelectedIndex:o=0}=t,r=b("div",["version-dialog-list-header"],null,"count");r.innerText=fi("version.versionList",{count:`${e.length}`});const i=b("div",["version-dialog-list"],null),s=this.convertVersionsToFragment(e);i.append(s);const l=i.children[o];A(l,"active"),this.activeVersionElement=l,this.versionsList=i,this.versionsListHeader=r,i.onclick=this.handleClickVersionItem}get isSelectedFirstVersion(){return!!this.activeVersionElement&&this.versionsList.firstChild===this.activeVersionElement}get isSelectedLastVersion(){return!!this.activeVersionElement&&this.versionsList.lastChild===this.activeVersionElement}get beforeVersion(){return d(eC,this.activeVersionElement,"No active version element"),this.activeVersionElement.nextElementSibling?this.activeVersionElement.nextElementSibling.versionData:null}get beforeMajorVersion(){d(eC,this.activeVersionElement,"No active version element");let t=this.activeVersionElement.nextElementSibling;for(;t;){if(t.versionData.type)return t.versionData;t=t.nextElementSibling}return null}convertVersionsToFragment(t){const e=document.createDocumentFragment(),o=i=>{var l;let s;if(i.version!==-1){const c=new Date((l=i.created)!=null?l:i.version);s=`${c.toLocaleDateString()} ${c.toLocaleTimeString()}`}else s=fi("version.latest");return s},r=(i,s,l,c=!1)=>{var C;const a=b("div",["dialog-version-list-item"],e);a.versionData=i,s&&A(a,"child");const u=b("div",["dialog-version-list-item-title"],a);if(b("div",["dialog-version-list-item-date"],u,o(i)),c&&b("div",["dialog-version-list-item-now-ver"],u,fi("version.latest")),typeof i.source=="object"&&((C=i.source)==null?void 0:C.restore)){const v=i.source.restore,B=l.find(R=>R.version==v),y=B?o(B):fi("version.unknown"),S=fi("version.restoreFrom",{from:y}),I=fi("version.restoreInfo"),M=b("div",["dialog-version-item-from-container"],a);b("div",["dialog-version-item-from-main"],M,S),b("div",["dialog-version-item-from-info"],M,I)}const f=b("ul",["dialog-version-list-item-authors"],a),m=v=>{const B=b("li",["dialog-version-list-item-author"],f),y=b("span",["dialog-version-list-item-mark-author"],B);y.style.background=this.options.getMarkColor(v),b("span",["dialog-version-list-item-author-name"],B,v.displayName)};if(this.options.useCreatedBy)if(i.createdBy){const v=i.createdBy;m(v)}else i.authors&&i.authors.length>0&&i.authors.forEach(v=>{m(v)});else if(i.authors&&i.authors.length>0)i.authors.forEach(v=>{m(v)});else if(i.createdBy){const v=i.createdBy;m(v)}};return t.forEach((i,s)=>{r(i,!1,t,s===0),i.minorVersions&&i.minorVersions.length>0&&i.minorVersions.forEach(l=>{r(l,!0,t,!1)})}),e}isVersionElement(t){return t?nt(t,"dialog-version-list-item"):!1}getVersionFromElement(t){return t.versionData}get activeVersion(){return this.getVersionFromElement(this.activeVersionElement)}toggleActiveVersionElement(t){this.activeVersionElement!==t&&(z(this.activeVersionElement,"active"),A(t,"active"),this.activeVersionElement=t)}selectVersionByVersionNum(t){const e=Array.from(this.versionsList.children).find(o=>o.versionData.version===t);return this.isVersionElement(e)?(this.toggleActiveVersionElement(e),this.getVersionFromElement(e)):null}render(t){t.innerHTML="",t.append(this.versionsListHeader,this.versionsList)}destroy(){this.versionsList.onclick=null}}class WN{constructor(t,e){this.doc=t,this.user=e}onDeleteBlock(t,e){this.doc.onDeleteBlock(t,e,this.user)}onInsertBlock(t,e,o){this.doc.onInsertBlock(t,e,o,this.user)}onUpdateBlockText(t,e,o){this.doc.onUpdateBlockText(t,e,o,this.user)}onUpdateBlockData(t,e,o){this.doc.onUpdateBlockData(t,e,o,this.user)}onCreateContainer(t,e){this.doc.onCreateContainer(t,e,this.user)}onCreateComment(){}onDeleteComment(){}onDeleteContainer(){}onUpdateComment(){}}function GN(n){return new Promise(t=>{setTimeout(t,n)})}async function ZN(n,t,e,o){for(const r of e){const i=new WN(n,r.user);t.parseHistoryData(r,i),o.play&&await GN(o.speed||150)}}const YN=`<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
|
|
685
685
|
<path d="M0 0h24v24H0z" fill="none"/><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
|
|
686
|
-
</svg>`,{t:hf}=T;class QN{constructor(t){h(this,"goBackButton");h(this,"playButton");h(this,"revertButton");this.options=t;const e=b("button",["dialog-text-button"],null),o=b("span",["dialog-button-icon"],e);o.innerHTML=YN,b("span",["dialog-button-text"],e,hf("version.goBack"));const r=b("button",["dialog-version-button"],null,hf("version.play")),i=b("button",["dialog-version-button"],null,hf("version.revertVersion"));this.goBackButton=e,this.playButton=r,this.revertButton=i,this.bindEvent()}bindEvent(){const{onBack:t,onPlay:e,onRevert:o}=this.options;this.playButton.onclick=e,this.goBackButton.onclick=t,this.revertButton.onclick=o}disabledButton(){}render(t,e=!1){e||t.append(this.goBackButton,this.playButton,this.revertButton)}destroy(){this.playButton.onclick=null,this.goBackButton.onclick=null,this.revertButton.onclick=null}}const Ce=w("split-text-actions");function nC(n){return n.length>2?!1:n.length===1?n[0].insert!==void 0:(d(Ce,n.length===2,`invalid text actions: ${JSON.stringify(n)}`),n[0].retain===void 0?!1:n[1].insert!==void 0)}function oC(n){return n.length>2?!1:n.length===1?n[0].delete!==void 0:(d(Ce,n.length===2,`invalid text actions: ${JSON.stringify(n)}`),n[0].retain===void 0?!1:n[1].delete!==void 0)}function rC(n){return n.length>2?!1:n.length===1?n[0].insert===void 0&&n[0].delete===void 0&&n[0].attributes!==void 0:(d(Ce,n.length===2,`invalid text actions: ${JSON.stringify(n)}`),n[0].retain===void 0?!1:n[1].attributes!==void 0)}function KN(n){const t=[],e=Y.default(n);if(e.length===0)return[];if(e.length===1)return[n];if(e.length===2&&(oC(n)||nC(n)||rC(n)))return[n];const o=(i,s)=>i>0?[{retain:i},s]:[s];let r=0;for(;e.length>0;){const i=e[0];if(i.retain!==void 0&&i.attributes===void 0){d(Ce,i.retain>0,`invalid text op: ${JSON.stringify(i)}`),d(Ce,e.length>1,`invalid text op: ${JSON.stringify(i)}`);const s=e[1];d(Ce,s.delete||s.insert!==void 0||s.attributes!==void 0,`invalid next text op: ${JSON.stringify(s)}`),r+=i.retain,t.push(o(r,s)),s.delete!==void 0?r-=s.delete:s.insert!==void 0?r+=s.insert.length:(d(Ce,s.attributes!==void 0,`invalid next text op: ${JSON.stringify(s)}`),d(Ce,s.retain!==void 0,`invalid next text op: ${JSON.stringify(s)}`),r+=s.retain),e.splice(0,2)}else d(Ce,i.delete||i.insert!==void 0||i.attributes!==void 0,`invalid next text op: ${JSON.stringify(i)}`),t.push(o(r,i)),e.shift(),i.retain!==void 0&&(d(Ce,i.attributes!==void 0,`invalid next text op: ${JSON.stringify(i)}`),r+=i.retain),i.insert&&(r+=i.insert.length)}return t}function iC(n){if(d(Ce,n.length===1||n.length===2,`not a single action op: ${JSON.stringify(n)}`),n.length===1)return 0;const t=n[0].retain;return d(Ce,typeof t=="number"&&t>0,`invalid retain: ${JSON.stringify(n)}`),t}let sC=0;function JN(n,t,e){const o=sC;sC+=1;const r=vt(n);return{insert:" ",attributes:{box:!0,id:N(),type:"history-deleted-box",user:e,created:Date.now(),text:r,deletedOffset:t,deletedOrder:o}}}function XN(n,t,e){const o=iC(t),r=t.length===1?t[0].delete:t[1].delete;d(Ce,typeof r=="number",`not a delete op: ${JSON.stringify(t)}`);const{left:i,middle:s,right:l}=Gt(n,o,r),c=JN(s,o,e);return[...i,c,...l]}function t$(n,t,e){const o=iC(t),r=t.length===1?t[0].insert:t[1].insert;d(Ce,typeof r=="string",`invalid insert op: ${JSON.stringify(t)}`);const i=t.length===1?t[0].attributes:t[1].attributes,l=Ol([{insert:r,attributes:i}],"insertedBy",e);return Sr(n,o,l,null)}function e$(n,t,e){const o=KN(t).reverse();let r=n;for(const i of o)oC(i)?r=XN(r,i,e):nC(i)?r=t$(r,i,e):(d(Ce,rC(i),`unknown op: ${JSON.stringify(i)}`),r=ie.apply(r,i));return r}const n$=w("history-update-block-text");function lC(n){const t=[],e=[];let o=0;return n.forEach(r=>{var i;if((i=r.attributes)!=null&&i.box){const s=r.attributes;if(s.type==="history-deleted-box"){t.push({boxData:s,offset:o});return}}e.push(r),o+=Fd(r)}),t.sort((r,i)=>i.offset-r.offset),{deletedBoxes:t,newText:e}}function o$(n,t,e){let o=n;return t.forEach(r=>{const i=ie.transformCursor(r.offset,e,!1);o=Sr(o,i,[{insert:" ",attributes:r.boxData}],null)}),o}function r$(n){n.sort((t,e)=>t.boxData.deletedOffset!==e.boxData.deletedOffset?t.boxData.deletedOffset-e.boxData.deletedOffset:t.boxData.deletedOrder-e.boxData.deletedOrder)}function i$(n){if(n.length<=1)return n;const t=n[0].offset;n.forEach(e=>{d(n$,e.offset===t,`invalid boxes group, ${JSON.stringify(n)}`)}),r$(n);for(let e=n.length-1;e>=1;e--){const o=n[e],r=n[e-1];o.boxData.user.userId===r.boxData.user.userId&&(r.boxData.text+=o.boxData.text,n.splice(e,1))}return n}function s$(n){let{newText:t,deletedBoxes:e}=lC(n);const o=new Map;return e.forEach(i=>{let s=o.get(i.offset);s||(s=[],o.set(i.offset,s)),s.push(i),s.sort((l,c)=>l.boxData.deletedOffset-c.boxData.deletedOffset)}),Array.from(o.values()).sort((i,s)=>s[0].offset-i[0].offset).forEach(i=>{const s=i[0].offset;i$(i).reverse().forEach(l=>{t=Sr(t,s,[{insert:" ",attributes:l.boxData}],null)})}),t}function l$(n,t,e){let{newText:o,deletedBoxes:r}=lC(n);return o=e$(o,t,e),o=o$(o,r,t),o=s$(o),o}const Mn=w("history-doc");function Rn(n){d(Mn,!1,"no local actions for history doc")}class c$ extends xi{constructor(e,o){super();h(this,"doc");h(this,"editor");this.doc=Y.default(e),this.editor=o}beginBatchUpdate(){return 0}endBatchUpdate(){return 0}toJSON(){return Y.default(this.doc)}getContainerBlocks(e){return this.doc.blocks[e]}getBlockData(e,o){const r=this.getContainerBlocks(e);d(Mn,r,`no container data: ${e}`);const i=r[o];return d(Mn,i,`no block data: ${o}`),i}localUpdateBlockText(){Rn()}localUpdateBlockData(){Rn()}localInsertBlock(){Rn()}localDeleteBlock(){Rn()}localInsertChildContainer(){Rn()}localDeleteChildContainers(){Rn()}uploadResource(){Rn()}async addResources(e){Rn()}getServerMeta(){var e,o,r;return(r=(o=(e=this.editor.doc.externalDoc).getServerMeta)==null?void 0:o.call(e))!=null?r:{}}buildResourceUrl(e){return this.editor.doc.externalDoc.buildResourceUrl(e)}request(){Rn()}broadcastMessage(){Rn()}getUser(){return{permission:"w",userId:"-",displayName:"-",avatarUrl:"-",rainbowIndex:0}}getRemoteUsers(){return new ic}destroy(){this.clearCallbacks()}transformBlockIndex(e,o,r){const i=this.doc.blocks[e];d(Mn,i,`no container blocks: ${e}`);let s=0;for(let l=0;l<i.length;l++)if(!i[l].deletedBy){if(s===o)return l;s++}return r&&d(Mn,!1,`invalid block index: ${o}, blocks: ${JSON.stringify(i)}`),d(Mn,s===o,`invalid block index: ${o}, blocks: ${JSON.stringify(i)}`),i.length}onDeleteBlock(e,o,r){const i=this.transformBlockIndex(e,o,!0),l=this.doc.blocks[e][i];d(Mn,!l.deleted,`block has already deleted: ${e}/${o}`),l.deletedBy=r,this.callbacks.forEach(c=>{var a;return(a=c.onUpdateBlockData)==null?void 0:a.call(c,e,i,{insert:{},delete:[]},!0)})}onInsertBlock(e,o,r,i){const s=this.transformBlockIndex(e,o,!1),l=this.doc.blocks[e],c=Y.default(r);c.insertedBy=i,l.splice(s,0,c),this.callbacks.forEach(a=>{var u;return(u=a.onInsertBlock)==null?void 0:u.call(a,e,s,c,!0)})}onUpdateBlockText(e,o,r,i){const s=this.transformBlockIndex(e,o,!0),c=this.doc.blocks[e][s];d(Mn,!c.deleted,`block has already deleted: ${e}/${o}`);const a=c.text;d(Mn,a,`no text for block: ${JSON.stringify(c)}`);const u=l$(a,r,i);c.text=u,this.callbacks.forEach(f=>{var m;return(m=f.onUpdateBlockText)==null?void 0:m.call(f,e,o,r,!0)})}onUpdateBlockData(e,o,r,i){const s=this.transformBlockIndex(e,o,!0),l=this.doc.blocks[e],c=l[s];d(Mn,!c.deleted,`block has already deleted: ${e}/${o}`);const a=Y.default(c);a.updatedBy=i,r.delete.forEach(u=>delete a[u]),Object.entries(r.insert).forEach(([u,f])=>{a[u]=f}),l[s]=a,this.callbacks.forEach(u=>{var f;return(f=u.onUpdateBlockData)==null?void 0:f.call(u,e,s,r,!0)})}onCreateContainer(e,o,r){this.doc.blocks[e]=Y.default(o),this.callbacks.forEach(i=>{var s;return(s=i.onInsertChildContainer)==null?void 0:s.call(i,e,o,!0)})}}const{t:cC}=T;function mi(n,t){return t==="insert"?cC("version.insert",{name:n.displayName}):cC("version.delete",{name:n.displayName})}function hr(n,t){const{userId:e}=t;return["flag","selection"].reduce((r,i)=>{const s=n.doc.getRemoteUsers().getFixedUserColor(e,i);return r[i]=s,r},{})}class a${renderText(t,e,o){if(!o.box&&o.insertedBy){const r=o.insertedBy,{flag:i,selection:s}=hr(t,o.insertedBy);return{classes:["history-inserted-text"],attributes:{"history-inserted-by":r.displayName,"data-op-description":mi(r,"insert")},styles:{[ui]:i,[hi]:s}}}return{}}renderBlock(t,e,o){if(o.deletedBy){const r=o.deletedBy,{flag:i,selection:s}=hr(t,r);return{classes:["history-deleted-block"],attributes:{"history-deleted-by":r.displayName,"data-op-description":mi(r,"delete")},styles:{[ui]:i,[hi]:s}}}if(o.insertedBy){const r=o.insertedBy,{flag:i,selection:s}=hr(t,r);return{classes:["history-inserted-block"],attributes:{"history-inserted-by":r.displayName,"data-op-description":mi(r,"insert")},styles:{[ui]:i,[hi]:s}}}return{}}updateBlock(t,e,o,r){if(r.deletedBy){const i=r.deletedBy,{flag:s,selection:l}=hr(t,i);A(o,"history-deleted-block"),Ja(o,{"history-inserted-by":i.displayName,"data-op-description":mi(i,"delete")}),Xa(o,{[ui]:s,[hi]:l});return}if(r.insertedBy){const i=r.insertedBy,{flag:s,selection:l}=hr(t,i);A(o,"history-inserted-block"),Ja(o,{"history-inserted-by":i.displayName,"data-op-description":mi(i,"insert")}),Xa(o,{[ui]:s,[hi]:l})}}}const aC=w("history-deleted-box");function d$(n,t,e,o){const r=o;d(aC,r.text,`no text for text box data: ${JSON.stringify(o)}`),d(aC,typeof r.text=="string",`invalid text type for text box data: ${JSON.stringify(o)}`);const i=b("span",["history-deleted-box"],e,r.text),s=r.user,{flag:l,selection:c}=hr(n,s);i.setAttribute("history-deleted-by",s.displayName),i.setAttribute("data-op-description",mi(s,"delete")),i.style.setProperty(ui,l),i.style.setProperty(hi,c)}function u$(n,t,e,o){return t.text}const h$={boxType:"history-deleted-box",updateBoxContent:d$,convertTo:u$},Ee=w("version-dialog");class f${constructor(t,e){h(this,"editor");h(this,"dialog",null);h(this,"oldViewer",null);h(this,"versionOptions");h(this,"versionList",null);h(this,"actionButtons",null);h(this,"provider");h(this,"components");h(this,"handleClose",()=>{var t;(t=this.dialog)==null||t.hide()});h(this,"handlePlay",()=>{var e;d(Ee,this.versionList,"The versionList did not render");const t=(e=this.versionList)==null?void 0:e.activeVersion;d(Ee,t,`The version: ${t} is invalid`),this.viewVersion(t,{play:!0,speed:150})});h(this,"handleRevert",async()=>{var e,o;d(Ee,this.versionList,"The versionList did not render");const t=(e=this.versionList)==null?void 0:e.activeVersion;d(Ee,t,`The version: ${t} is invalid`),await this.versionHelper.revertVersion(t.version),(o=this.dialog)==null||o.hide()});h(this,"handleSelectVersion",t=>{d(Ee,t,`The version: ${t} is invalid`),this.viewVersion(t)});h(this,"viewVersion",async(t,e={play:!1,speed:1e3})=>{var C,v,B;this.oldViewer&&(this.oldViewer.destroy(),this.oldViewer=null),d(Ee,this.versionList,"The versionList did not render"),d(Ee,this.actionButtons,"The actionButtons did not render");const o=t.type==="minor"?this.versionList.beforeVersion:this.versionList.beforeMajorVersion,r=o?o.version:0,i=this.versionList.isSelectedFirstVersion,s=this.versionList.isSelectedLastVersion;this.actionButtons.revertButton.disabled=i,this.actionButtons.playButton.disabled=i;let l=(C=this.versionOptions)==null?void 0:C.hideOps;if((v=this.versionOptions)!=null&&v.onWillChangeVersion){const y=this.versionOptions.onWillChangeVersion(this.editor,t,i,s);y!=null&&y.hideOps&&(l=!0)}let c,a;if(l)c=await this.versionHelper.getVersion(t.version),a=[];else{const y=await this.versionHelper.getHistoryData(t.version,r);c=y.doc,a=y.historyData}const{editorElement:u}=this.components;u.innerHTML="";const f=new c$(c,this.editor),m=this.provider.createHistoryEditor(u,f);m.editorBlockRenders.registerRender(new a$),m.editorBoxes.registerBoxClass(h$),A(m.rootElement,tC.HISTORY);try{await ZN(f,this.versionHelper,a,e)}finally{this.oldViewer=m}(B=this.versionOptions)!=null&&B.onVersionChanged&&this.versionOptions.onVersionChanged(this.editor,m,t,i,s)});h(this,"setShowOps",t=>{var e;if(this.versionOptions){this.versionOptions.hideOps=!t;const o=(e=this.versionList)==null?void 0:e.activeVersion;d(Ee,o,`The version: ${o} is invalid`),this.viewVersion(o)}});this.editor=t,this.provider=e;const o=b("div",["version-dialog"],null),r=b("div",["version-dialog-note-viewer"],o),i=b("div",["version-dialog-action-container"],r),s=b("div",["version-dialog-editor"],r),l=b("div",["version-dialog-versions-list"],o);this.components={root:o,editorElement:s,actionContainer:i,versionsListContainer:l}}get versionHelper(){d(Ee,this.editor.doc.getVersionHelper,"Can not get getVersionHelper from doc");const t=this.editor.doc.getVersionHelper();return d(Ee,t,"current doc does not support version"),t}renderContent(t){var s,l;const{actionContainer:e,versionsListContainer:o}=this.components;e.innerHTML="";const r=new QN({onBack:this.handleClose,onPlay:this.handlePlay,onRevert:this.handleRevert});r.render(e,(s=this.versionOptions)==null?void 0:s.hideActions),this.actionButtons=r,o.innerHTML="";const i=new qN({versions:t,useCreatedBy:(l=this.versionOptions)==null?void 0:l.useCreatedBy,onSelectVersion:this.handleSelectVersion,getMarkColor:c=>{const{flag:a}=hr(this.editor,c);return a}});i.render(o),this.versionList=i}initViewVersion(){var t;if((t=this.versionOptions)!=null&&t.initSelectedVersion){d(Ee,this.versionList,"The versionList did not render");const{initSelectedVersion:e}=this.versionOptions,o=this.versionList.selectVersionByVersionNum(e);d(Ee,o,`The version: ${o} is invalid`),this.viewVersion(o)}else{d(Ee,this.versionList,"The versionList did not render");const e=this.versionList.activeVersion;d(Ee,e,`The version: ${e} is invalid`),this.viewVersion(e)}}async show(t){this.versionOptions={...this.versionOptions,...t};const e=await this.versionHelper.getVersions();if(this.versionOptions.hideNonVersionedOps&&e.length&&e[0].version===-1&&e.shift(),this.versionOptions.onVersionsLoaded&&this.versionOptions.onVersionsLoaded(this.editor,e),this.renderContent(e),this.initViewVersion(),!this.dialog){const{root:o}=this.components;this.dialog=new VN(o)}this.dialog.show(t.container)}destroy(){var t,e,o;(t=this.dialog)==null||t.destroy(),(e=this.versionList)==null||e.destroy(),(o=this.actionButtons)==null||o.destroy()}}function m$(n,t,e){const o=n.addCustom("version-dialog",()=>new f$(n,t));return o.show(e),{setShowOps:o.setShowOps}}const Kz="",g$=w("heading-collapse");function ff(n){var e;const t=Number.parseInt((e=n.getAttribute("data-style-heading"))!=null?e:"",10);return d(g$,t,"not a heading block"),t}function ze(n){return!!n.getAttribute("data-style-heading")}function p$(n){return!nt(n,"heading-collapsed")}function fr(n){return nt(n,"heading-collapsed")}function dC(n){if(gt(n))return!1;const e=H(n);return pt(e)}const C$=w("heading-collapse");function mf(n){d(C$,ze(n),"not a heading block");const t=[],e=ff(n);let o=dt(n);for(;o&&!(ze(o)&&ff(o)<=e);)t.push(o),o=dt(o);return t}function uC(n,t){if(!Ko(t))return;n.selection.selectBlock(t,0),mf(t).forEach(o=>{jm(o)}),A(t,"heading-collapsed")}function gi(n,t){mf(t).forEach(o=>{Hm(o)}),z(t,"heading-collapsed")}function b$(n,t){p$(t)?uC(n,t):gi(n,t)}const v$=[Xu,th,eh,nh,oh,rh,ih,sh];function k$(n){const t=b("button",["heading-collapse-button"],null);return t.setAttribute(`data-editor-tooltip-${n.clientId}`,"Collapse / Expand"),t.innerHTML=Ju,t}function hC(n){return oa(n).querySelector("button.heading-collapse-button")}function fC(n,t){hC(t)||dC(t)||!Ko(t)||T1(t,k$(n),-1)}function y$(n){var t;(t=hC(n))==null||t.remove()}function mC(n,t){oa(t).querySelector("button.heading-collapse-button")||fC(n,t)}function w$(n){const t=ff(n),e=b("button",["heading-marker"],null);return e.innerHTML=v$[t-1],e}function gC(n){return oa(n).querySelector("button.heading-marker")}function gf(n){gC(n)||dC(n)||!Ko(n)||T1(n,w$(n),1)}function pC(n){const t=gC(n);t==null||t.remove()}function CC(n){pC(n),ze(n)&&gf(n)}class B${handleDrop(t,e,o,r){if(kl(e)||!ze(e)||!fr(e))return;const i=mf(e);i.unshift(e);const s=i.reverse();let l=null;return t.doc.beginBatchUpdate(),s.forEach((c,a,u)=>{const f=t.getBlockData(c),m=ao(t.editorBlocks,t.doc.toJSON(),f),C=t.insertDocAt(o,r,m)[0];a===u.length-1&&(l=C)}),t.doc.endBatchUpdate(),t.doc.beginBatchUpdate(),s.forEach(c=>{t.deleteBlock(c)}),t.doc.endBatchUpdate(),l&&uC(t,l),!0}}const E$=w("heading-collapse");class I${constructor(t){h(this,"handleLoad",()=>{this.showCollapseButtons()});h(this,"handleHoverBlock",(t,e)=>{e&&(z(e,"hovering-heading"),ze(e)&&pt(H(e))&&(gf(e),fr(e)||y$(e))),t&&ze(t)&&pt(H(t))&&(A(t,"hovering-heading"),pC(t),fC(this.editor,t))});h(this,"handleClick",(t,e)=>{const o=Di(e,"button.heading-collapse-button");if(!o)return;const r=F(o);!r||(d(E$,ze(r),"not a heading block"),b$(this.editor,r),mC(this.editor,r))});this.editor=t,t.addListener("load",this.handleLoad),t.addListener("click",this.handleClick),Nt.get(t).addListener("change",this.handleHoverBlock),this.showCollapseButtons(),setTimeout(()=>{Hs.get(t).addHandler(new B$)})}showCollapseButtons(){const t=Mt(this.editor.rootContainer).filter(ze);t.length!==0&&(t[0]===Vt(this.editor.rootContainer)&&t.splice(0,1),t.forEach(gf))}destroy(){this.editor.removeListener("load",this.handleLoad),this.editor.removeListener("click",this.handleClick)}}function va(n){const t=n.selection.range;if(t.isCollapsed()||t.start.blockId===t.end.blockId)return;const e=n.getBlockById(t.start.blockId),o=n.getBlockById(t.end.blockId);fr(e)&&gi(n,e),fr(o)&&gi(n,o)}function x$(n){va(n);const t=n.getFocusedBlock();!ze(t)||fr(t)&&gi(n,t)}function T$(n){va(n);const t=n.getFocusedBlock();if(!ze(t))return;const e=n.selection.range.focus;!e.isSimple()||e.offset===W(n,t)&&fr(t)&&gi(n,t)}function S$(n){va(n);const t=n.getFocusedBlock();if(!ze(t))return;const e=n.selection.range.focus;!e.isSimple()||e.offset===0&&fr(t)&&gi(n,t)}class D${handleBeforeKeyDown(t,e){return rd(e.key)&&va(t),e.key==="Enter"?(x$(t),!1):e.key==="Delete"?(T$(t),!1):(e.key==="Backspace"&&S$(t),!1)}}class L${constructor(t){this.editor=t}onInsertBlock(t,e,o,r){this.updateBlockIfNeeded(o.id)}onUpdateBlockData(t,e,o,r){const i=this.editor.doc.getBlockData(t,e);this.updateBlockIfNeeded(i.id,o)}updateBlockIfNeeded(t,e){setTimeout(()=>{const o=this.editor.findBlockById(t);if(!!o){if(!ze(o)){e&&e.delete.includes("heading")&&CC(o);return}nt(o,"hovering-heading")&&mC(this.editor,o),CC(o)}},100)}}function M$(n){return!!n.heading}function bC(n){var e;const t=n.heading;return(e=Number.parseInt(`${t}`,10))!=null?e:1}function vC(n,t){var e;return{parentNode:t,children:[],text:vt((e=n.text)!=null?e:[]),level:bC(n),block:n}}class Zs{constructor(){h(this,"nodes",[])}appendBlock(t){const e=this.findParent(bC(t),this.nodes);e?e.children.push(vC(t,e)):this.nodes.push(vC(t,null))}findParent(t,e){const o=e[e.length-1];if(!o||t<=1)return null;if(o.level===t-1)return o;const r=this.findParent(t,o.children);return r||(o.level<t?o:null)}static buildToc(t){const e=new Zs,o=t.blocks.root;for(let r=0;r<o.length;r++){const i=o[r];M$(i)&&e.appendBlock(i)}return e}}class mr extends Yt.TypedEmitter{constructor(e){super();h(this,"toc",new Zs);h(this,"updateToc",Xt.default(()=>{this.updateTocNow()},500));this.editor=e,e.doc.registerCallback(this),this.updateToc()}destroy(){this.editor.doc.unregisterCallback(this)}isHeadingBlock(e){return!!e.heading}onInsertBlock(e,o,r,i){e==="root"&&this.isHeadingBlock(r)&&this.updateToc()}onDeleteBlock(e,o,r){e==="root"&&this.updateToc()}onUpdateBlockText(e,o,r,i){if(e!=="root")return;const s=this.editor.doc.getBlockData(e,o);this.isHeadingBlock(s)&&this.updateToc()}onUpdateBlockData(e,o,r,i){if(e!=="root")return;const s=this.editor.doc.getBlockData(e,o);this.isHeadingBlock(s)&&this.updateToc()}static register(e){return e.addCustom("editor-toc",()=>new mr(e))}static get(e){return e.getCustom("editor-toc")}updateTocNow(){this.toc=Zs.buildToc(this.editor.doc.toJSON()),this.emit("change",this.editor,this.toc)}}const Jz="";function R$(n){return n.nodes.length===0?!0:n.nodes.length>1?!1:n.nodes[0].children.length===0}function pf(n,t){t.forEach(e=>{const o=b("div",["toc-node"],n),r=b("div",["toc-title"],o);if(b("span",["toc-text"],r,e.text).setAttribute("data-block-id",e.block.id),e.children.length>0){const s=b("div",["toc-children"],o);pf(s,e.children)}})}function A$(n,t){const e=Di(t,".toc-text");if(!e)return;const o=e.getAttribute("data-block-id");if(!o)return;const r=n.findBlockById(o);!r||(t.preventDefault(),t.stopPropagation(),n.selection.selectBlock(r,0))}function kC(n,t,e){if(z(t,"loading"),t.innerHTML="",R$(e)){b("div",["toc-empty-message"],t,"No toc");return}e.nodes.length===1?pf(t,e.nodes[0].children):pf(t,e.nodes),Au(n,"toc-click-handler",()=>{n.addListener("click",A$)})}class O${constructor(t){h(this,"handleUpdateToc",(t,e)=>{Array.from(t.rootContainer.querySelectorAll('.embed-block[data-type="editor-block"][data-embed-type="toc"]')).forEach(r=>{const i=r.querySelector(".editor-toc-container");i&&kC(t,i,e)})});this.editor=t,mr.register(t).addListener("change",this.handleUpdateToc)}destroy(){mr.register(this.editor).removeListener("change",this.handleUpdateToc)}get toc(){return mr.register(this.editor).toc}}function _$(n,t){const e=b("div",["editor-toc-container","embed-selected-content"],t),r=n.addCustom("init-editor-toc",()=>new O$(n)).toc;r.nodes.length===0?A(e,"loading"):kC(n,e,r)}function N$(n,t,e,o){return o==="markdown"?"[toc]":""}function $$(n,t,e){const{data:o}=e;if(!o||o.embedType!=="toc"||!j(n,t))return null;const r={};return{blockData:{id:N(),type:"embed",embedType:"toc",embedData:r}}}const yC={embedType:"toc",createEmbedContent:_$,convertTo:N$,convertFrom:$$};function P$(n){return!!n.getAttribute("data-style-heading")}function Cf(n,t){return P$(t)&&W(n,t)>0}function j$(n){const t=We(n.rootElement);let e=0,o=0,r=0;if(t===document.documentElement){const i=n.rootContainer.getBoundingClientRect();e=i.left+i.width/2,o=10,r=t.offsetHeight}else{const i=t.getBoundingClientRect();e=i.left+i.width/2,o=i.top+10,r=i.bottom}for(;o<r;){const i=document.elementsFromPoint(e,o);for(let s=0;s<i.length;s++){const l=F(i[s]);if(l&&n.rootContainer.contains(l))return l}o+=10}return null}function bf(n,t){let e=t;for(;e&&!Cf(n,e);)e=dt(e);return e}function wC(n){if(gt(n))return!1;const e=H(n);return pt(e)}function ka(n,t){let e=t;for(;e&&!Cf(n,e);)e=gt(e),e&&wC(e)&&(e=null);return e}const H$=.3;class F$ extends Yt.TypedEmitter{constructor(e){super();h(this,"scrollContainer");h(this,"scrollEventTarget");h(this,"scrollStatus",{curHeadingBlock:null,previousHeadingBlock:null,nextHeadingBlock:null});h(this,"handleScroll",Xt.default(()=>{const e={curHeadingBlock:null,previousHeadingBlock:null,nextHeadingBlock:null};let o=j$(this.editor);if(o&&(o=yd(o)),!o||!this.scrollContainer){this.setStatus(e);return}if(wC(o)&&(o=dt(o)),!o){this.setStatus(e);return}if(Cf(this.editor,o)){e.curHeadingBlock=o,e.previousHeadingBlock=ka(this.editor,o),e.nextHeadingBlock=bf(this.editor,o),this.setStatus(e);return}const r=this.scrollContainer.getBoundingClientRect(),i=bf(this.editor,o);if(i){const l=i.getBoundingClientRect();if(l.top>r.top&&l.top<r.top+r.height*H$){e.curHeadingBlock=i,e.previousHeadingBlock=ka(this.editor,i),e.nextHeadingBlock=bf(this.editor,i),this.setStatus(e);return}e.nextHeadingBlock=i}const s=ka(this.editor,o);s&&(e.curHeadingBlock=s,e.previousHeadingBlock=ka(this.editor,s)),this.setStatus(e)},200));this.editor=e,setTimeout(()=>{this.start()},50)}setStatus(e){this.scrollStatus.previousHeadingBlock===e.previousHeadingBlock&&this.scrollStatus.nextHeadingBlock===e.nextHeadingBlock&&this.scrollStatus.previousHeadingBlock===e.previousHeadingBlock||(this.scrollStatus=e,this.emit("change",this.editor,e))}start(){this.stop(),this.scrollContainer=We(this.editor.rootElement),this.scrollEventTarget=this.scrollContainer===document.documentElement?document:this.scrollContainer,this.scrollEventTarget.addEventListener("scroll",this.handleScroll),this.handleScroll()}stop(){this.scrollEventTarget&&this.scrollEventTarget.removeEventListener("scroll",this.handleScroll)}destroy(){this.stop(),this.scrollEventTarget=void 0}}class z${constructor(t,e){h(this,"suggest");h(this,"onShow",(t,e,o,r)=>{const i=this.editor.getBlockByIndex(e,o);if(!Ko(i)){const s=F(H(i));if(s&&rt(s)==="code")return!1}return!0});h(this,"onClickItem",(t,e,o)=>{const r=e.data,i={id:N(),type:"mention",box:!0,created:Date.now(),iconUrl:r.avatarUrl,text:r.displayName,mentionId:r.userId},s=this.editor.selection.range;if(!s.isCollapsed()||!s.isSimple())return;const l=s.focus,c=this.editor.getBlockById(l.blockId);this.editor.insertBoxToBlock(c,l.offset,i)});h(this,"queryItems",async(t,e)=>(await this.options.queryUsers(this.editor,e)).map(i=>({id:i.userId,name:i.displayName,icon:`<img src="${i.avatarUrl}" class="mention-user-avatar">`,element:i.element,data:i,subText:i.email})));this.editor=t,this.options=e,this.suggest=new mh(t,{id:"editor-mention",trigger:["@"],autoDeleteTrigger:!0,showLoading:!0,onShow:this.onShow,onClickItem:this.onClickItem,queryItems:this.queryItems})}destroy(){}}w("mathjax-box");function U$(n,t,e,o){const r=o,i=b("a",["mention-container"],e);b("span",["mention-name"],i,`@${r.text}`),i.setAttribute("data-mention-id",r.mentionId)}function V$(n,t,e){}function q$(n,t,e,o){return`@${t.text}`}const vf={boxType:"mention",updateBoxContent:U$,handleClickBox:V$,convertTo:q$};function W$(n){return go("list-block-mention",T.t("list.mention.tooltip"),mB,[],n.clientId)}class G${constructor(t){h(this,"mentionButton");h(this,"handleHoveringBlock",t=>{var e;!this.editor.isWritable()||(t&&this.shouldBlockShowMention(t)?Rt(t).appendChild(this.mentionButton):(e=this.mentionButton)==null||e.remove())});h(this,"handleMouseDown",(t,e)=>{e.preventDefault(),e.stopPropagation();const o=F(this.mentionButton);if(!o||!j(t,o))return;const r=t.selection.range.focus;if(!r.isSimple())return;let i;t.selection.focusedBlock!==o?i=W(t,o):i=r.offset,setTimeout(()=>{const s=t.insertTextToBlock(o,i,"@");i+=1;const l=vt(be(s,i).left);this.editor.selection.selectBlock(o,i),this.editor.focus(),t.getCustom("mention").suggest.popup(o,i,l,"@")})});h(this,"destroy",()=>{Nt.get(this.editor).removeListener("change",this.handleHoveringBlock)});this.editor=t,this.mentionButton=W$(t),Nt.get(this.editor).addListener("change",this.handleHoveringBlock),t.domEvents.addEventListener(this.mentionButton,"mousedown",this.handleMouseDown)}shouldBlockShowMention(t){if(!j(this.editor,t)||!ct(t))return!1;const e=Fe(t);return!(e==="ordered"||e==="unordered")}}const Xz="",Z$={templates:{title:"\u9009\u62E9\u6A21\u677F\uFF0C\u5FEB\u901F\u521B\u5EFA",create:"\u65B0\u5EFA\u6A21\u677F",choose:"\u5168\u90E8\u6A21\u677F",customizedMark:"\u81EA\u5B9A\u4E49"}},Y$={templates:{title:"Choose a template",create:"New template",choose:"All templates",customizedMark:"Custom"}};T.mergeLang({"zh-CN":Z$,"en-US":Y$});const tU="",Q$="data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjEyMCIgaGVpZ2h0PSIxMjAiIH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WZzPgo8L3N2Zz4K",BC=w("templates");function kf(n){const t=n.rootElement.querySelector(":scope .editor-templates");if(!t)return null;const e=t.querySelector(":scope .editor-templates-cards");return d(BC,e,"no card container"),{root:t,cardContainer:e}}function J$(n){const t=kf(n);if(t)return t.cardContainer.innerHTML="",t;const e=b("div",["editor-templates"],n.rootElement);b("div",["editor-templates-title"],e,T.t("templates.title"));const o=b("div",["editor-templates-cards"],e);return{root:e,cardContainer:o}}function EC(n,t,e,o,r){var f;const i=(f=n.options.componentsOptions)==null?void 0:f.templates,s=b("div",["editor-template-card",...o],null),l=b("div",["editor-template-thumb-container"],s),c=b("img",["editor-template-thumb"],l);c.src=t,c.style.display="none",c.onerror=()=>{var C;const m=(C=i==null?void 0:i.placeHolderImageSrc)!=null?C:K$;c.src!==m&&(c.src=m)},c.onload=()=>{c.style.display=""};const a=b("div",["editor-template-name"],s),u=b("span",[],a,e);return i!=null&&i.showTemplateTitleAttr&&u.setAttribute("title",e),s.onclick=()=>r(s),s}function X$(n,t){return t.thumbnailUrl?t.thumbnailUrl:n.doc.buildResourceUrl("thumbnail.png")}function tP(n,t){const e=X$(n,t);return EC(n,e,t.name,[],async()=>{var r,i;const o=(r=n.options.componentsOptions)==null?void 0:r.templates;(i=o==null?void 0:o.onApplyTemplate)==null||i.call(o,n,t)})}function eP(n,t){return EC(n,t,T.t("templates.choose"),["more"],()=>{var o,r;const e=(o=n.options.componentsOptions)==null?void 0:o.templates;(r=e==null?void 0:e.onChooseTemplate)==null||r.call(e,n)})}function nP(n,t){var f,m;const e=(f=n.options.componentsOptions)==null?void 0:f.templates;if(!e)return;const r=Qt(n.rootContainer).getBoundingClientRect().width;let i=1;const s=Q$,l=kf(n);if(l){if(t!=null&&t.reset){const C=Array.from(l.cardContainer.children),v=l.cardContainer.firstElementChild;if(d(BC,v,"no first card"),nt(v,"new")||nt(v,"more"))return;const B=window.getComputedStyle(v),y=parseFloat(B.marginLeft),S=parseFloat(B.marginRight),I=v.getBoundingClientRect().width+y+S;i=Math.floor(r/I);const R=Math.max(1,i-1-1),$=C.length-1;C.forEach((Z,ot)=>{ot>R&&ot<$?Z.style.display="none":(ot>=$&&nt(Z,"more"),Z.style.display="")})}return}const c=e.templates,{cardContainer:a}=J$(n);c.forEach((C,v)=>{const B=tP(n,C);if(v>0&&v>=i&&(B.style.display="none"),a.appendChild(B),v===0){const y=window.getComputedStyle(B),S=parseFloat(y.marginLeft),I=parseFloat(y.marginRight),M=B.getBoundingClientRect().width+S+I;i=Math.floor(r/M)-1}});const u=eP(n,s);a.appendChild(u),(m=e==null?void 0:e.onTemplateChooserStatusChanged)==null||m.call(e,n,a,"visible")}const IC=Xt.default(nP,50);function oP(n){var o,r;const t=kf(n);if(!t)return;t.root.remove();const e=(o=n.options.componentsOptions)==null?void 0:o.templates;(r=e==null?void 0:e.onTemplateChooserStatusChanged)==null||r.call(e,n,null,"hide")}function rP(n){const t=n.blocks.root;if(t.length===0)return!0;if(t.length>5)return!1;const e=[...t];e[0].type==="text"&&e[0].heading&&e.splice(0,1);const o=r=>{var i;return r.type!=="text"&&r.type!=="list"?!1:r.text?((i=r.text)==null?void 0:i.length)===0:!0};return e.every(r=>o(r))}function yf(n,t){rP(n.doc.toJSON())?IC(n,t):(IC.cancel(),oP(n))}const iP=800;class sP{constructor(t){h(this,"longPressTimeout",0);h(this,"handleSelectionChange",()=>{});h(this,"handleLongPress",t=>{const e=t.touches[0],o=Tl(this.editor,e.clientX,e.clientY);!o||console.log(o)});h(this,"handleTouchStart",t=>{t.touches.length===1&&(this.longPressTimeout=window.setTimeout(()=>{this.handleLongPress(t)},iP))});h(this,"handleTouchEnd",t=>{this.longPressTimeout&&(window.clearTimeout(this.longPressTimeout),this.longPressTimeout=0)});this.editor=t,this.editor.addListener("selectionChanged",this.handleSelectionChange),document.addEventListener("touchstart",this.handleTouchStart),document.addEventListener("touchend",this.handleTouchEnd)}destroy(){this.editor.removeListener("selectionChanged",this.handleSelectionChange),document.removeEventListener("touchstart",this.handleTouchStart),document.removeEventListener("touchend",this.handleTouchEnd)}}class Ys{constructor(t,e){h(this,"_decrypted",!1);this.editor=t,this.blockData=e}get decrypted(){return this._decrypted||this.blockData.owner===this.editor.doc.getUser().userId}setDecrypted(){this._decrypted=!0}destroy(){}static getState(t,e){return t.addCustom(`encrypted-block-${e.id}`,()=>new Ys(t,e))}}const eU="",Bo=w("encrypted-block");function lP(n,t,e,o,r){const i=r,s=ro(o,"div"),l=Ys.getState(n,i);if(l.decrypted)n.createChildContainer(t,s,i.children[0]),A(o,"decrypted");else{A(o,"encrypted");const c=Rt(o),a=b("div",["password-container"],c),u=b("input",[],a);u.type="text",u.onkeydown=f=>{if(f.key==="Enter"){const m=u.value;if(i.password===Ei.default(`${i.owner}-${m}`)){l.setDecrypted(),n.reloadBlock(o);const C=Ld(n,n.getBlockById(i.id));C&&(n.selection.selectBlock(C,0),n.focus())}}}}return s}function cP(n,t,e,o){const r=document.elementsFromPoint(e,o)[0];if(!r||!t.contains(r)||!n.contains(t)||!bn(r))return null;const i=r;if(n.getBlockData(t).children[0]!==U(i))return null;const l=wt(t,U(i));return new Xe(n,{anchor:l,focus:l})}function aP(n,t,e,o){if(Ys.getState(n,n.getBlockData(t)).decrypted)return null;if(o==="ArrowDown"||o==="ArrowRight"){const s=dt(t);return s?P(s,W(n,s),"end"):P(t,1,"end")}const i=gt(t);return P(i||t,0,"home")}function dP(n,t){return n.getBoundingClientRect()}function uP(n,t,e,o){if(e.isSimple()){d(Bo,o.isSimple(),"from is simple position but to is not simple position"),Bo.debug("full select table"),A(t,"full-selected");return}d(Bo,!o.isSimple(),"from is complex position but end is simple position");const r=e,i=o;d(Bo,r.blockId===i.blockId,"only allow update one table selection"),d(Bo,r.childContainerId===i.childContainerId,"only one container");const s=n.getBlockData(t),l=n.getContainerById(s.children[0]);A(l,"selected")}function hP(n){n.rootContainer.querySelectorAll('[data-type="editor-block"][data-block-type="encrypted"]').forEach(t=>{z(t,"full-selected"),t.querySelectorAll("selected").forEach(e=>{z(e,"selected")})})}function fP(n,t){const e=n.getBlockData(t);return Ys.getState(n,e).decrypted?[n.getContainerById(e.children[0])]:[]}function mP(n,t,e,o,r){return null}function gP(n,t,e,o){d(Bo,e.blockId===o.blockId,"only allow select in single block"),d(Bo,q(t)===e.blockId,"only allow select in single block");const r=n.getBlockData(t);return d(Bo,e.childContainerId===r.children[0],"only one container"),[n.getContainerById(r.children[0])]}function pP(n){return{name:"EncryptedBlock",insertBlockCommandItems:[{id:"insert-encrypted-block",name:"Encrypted Block"}],async handleInsertEmptyBlock(t,e){const o=yn(t.doc),r={id:N(),type:"encrypted",children:[o],owner:t.doc.getUser().userId,ownerDisplayName:t.doc.getUser().displayName,password:Ei.default(`${t.doc.getUser().userId}-1234`)},i=t.doc.getContainerBlocks(o)[0];return t.insertBlock(e.containerId,e.blockIndex,r,At(t,i.id,0))}}}function CP(n,t,e,o){return o==="text"||o==="markdown"?"[Encrypted Block]":"<p>[Encrypted Block]</p>"}const bP={blockType:"encrypted",blockKind:"complex",enableKeyboardSelect:!0,createBlockContent:lP,getBlockTextLength:()=>1,getRangeFromPoint:cP,moveCaret:aP,getCaretRect:dP,updateSelection:uP,clearSelection:hP,getChildContainers:fP,getNextContainer:mP,getSelectedContainers:gP,getOptions:pP,convertTo:CP};function vP(n,t,e){const o=ts(n,t,{components:{blocks:[Ds,Rs,bP],decorators:[new Os],embeds:[ca,C1,H1,F1,z1,n1,U1,uf,df],boxes:[Fc],options:{...e.componentsOptions}}});return o.readonly=!0,o}class kP{constructor(t){this.createOptions=t}createHistoryEditor(t,e){return vP(t,e,this.createOptions)}}w("create-editor");function xC({root:n,childDoc:t,doc:e}){t.uploadResource=e.uploadResource.bind(e),t.buildResourceUrl=e.buildResourceUrl.bind(e);const o=ts(n,t,{shortcuts:[oc],components:{blocks:[Ds,Rs],decorators:[new Os],embeds:[B6,ca,C1,H1,F1,z1,n1,U1,uf,df],boxes:[Fc,vf],options:{}}});return o.input.addHandler(new Qc),o.input.addHandler(new V1(o)),o.input.addHandler(new P_(o)),o}function yP(n,t){const e=Array.from(n.rootContainer.querySelectorAll(`[comment-${t.toLocaleLowerCase()}="${t}"]`)),o=new Set;e.forEach(r=>{const i=F(r);i&&o.add(i)}),o.forEach(r=>{j_(n,r,t)})}class wP{constructor(t){h(this,"listeners",new Set);h(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 o=e.groupId;this.getComments().filter(i=>i.groupId===o).length===0&&yP(this.editor,o)}localUpdateComment(t,e){this.doc.localUpdateComment(t,e)}onCreateComment(t,e){Array.from(this.listeners.values()).forEach(o=>o.onCreateComment(t,e))}onDeleteComment(t,e){Array.from(this.listeners.values()).forEach(o=>o.onDeleteComment(t,e))}onUpdateComment(t,e){Array.from(this.listeners.values()).forEach(o=>o.onUpdateComment(t,e))}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}createCommentEditor(t,e){return xC({root:t,childDoc:e,doc:this.doc})}}class BP{constructor(t,e){h(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 Yu(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 xC({root:t,childDoc:e,doc:this.localDoc})}}const EP={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"},local:{readonlyTitle:"\u672A\u547D\u540D"}}},IP={placeholder:{common:{title:"Enter a title",readonlyTitle:"Enter a title",content:'Click "+", or enter "/" to insert components quickly'},local:{readonlyTitle:"Untitled"}}};T.mergeLang({"zh-CN":EP,"en-US":IP});const wf=w("create-editor"),TC=[ca,C1,H1,F1,z1,n1,U1,uf,df,B6,yC,IN];async function xP(n,t){var s,l,c,a,u,f,m,C,v,B,y,S;d(wf,n,"app does not exists"),t.lang&&T.setLang(t.lang);const e=t.onReauth?async()=>{var $;const I=t.user.userId,M=t.docId,R=await(($=t.onReauth)==null?void 0:$.call(t,I,M,t.permission));return{userId:I,docId:M,permission:t.permission,appId:t.appId,token:R,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl}}:void 0,o={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},r=await fs.load(o),i=ts(n,r,{id:t.id,components:{blocks:[Ds,Rs,E1,u4],commandProviders:[new Bh,...((s=t.components)==null?void 0:s.commandProviders)||[]],decorators:[new Os,new Ku],embeds:[...TC,...((l=t.components)==null?void 0:l.embeds)||[]],boxes:[Fc,vf,U3,...((c=t.components)==null?void 0:c.boxes)||[]],insertions:[Kd],blockHooks:[new g6,...((a=t.components)==null?void 0:a.blockHooks)||[]],textRenders:[new $3,new aI],options:{...t.componentsOptions}},shortcuts:[nL,$M,d1,m3,dI,i1,oc],colors:["#338FE5","#24B47E","#F0A100","#E52727","#9678D3","#2CB2AE","#EB6414","#8AAB3F"]});if(i.editorCommandProviders.registerCommandProvider(new Ln(i)),i.input.addHandler(new D$),i.input.addHandler(new Qc),i.input.addHandler(new oT),i.input.addHandler(new LM),i.input.addHandler(new Ms(i,{headingLevel:1,titlePlaceholder:T.t("placeholder.common.title"),contentPlaceholder:T.t("placeholder.common.content"),readonlyTitlePlaceholder:T.t("placeholder.common.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),i.input.addHandler(new zc(i,(u=t.componentsOptions)==null?void 0:u.quickMenu)),i.input.addHandler(new V1(i)),i.input.addHandler(new i3(i)),i.input.addHandler(new JD),i.doc.registerCallback(new L$(i)),i.addCustom("remote-cursor",()=>new F2(i)),i.addCustom("block-menu",I=>new v6(I)),i.addCustom("editor-tooltip",()=>new r1(i)),t!=null&&t.enableComments&&i.addCustom("editor-comments",I=>new N3(I,new wP(I))),i.addCustom("create-options",()=>new Kf(i,t)),i.addCustom("drop-target",()=>new Hs(i)),i.addCustom("list-to-mindmap",()=>new Hc(i)),i.addCustom("list-to-mention",()=>new G$(i)),i.addCustom("mobile-helper",()=>new sP(i)),i.addCustom("code-caret",()=>new KD(i)),(f=t.componentsOptions)!=null&&f.mention){const I=t.componentsOptions.mention;i.addCustom("mention",()=>new z$(i,I))}if(i.addCustom("heading-collapse",()=>new I$(i)),Xr.register(i),Hs.register(i),mr.register(i),(C=(m=t.componentsOptions)==null?void 0:m.remoteCarets)!=null&&C.onUserChanged){const I=(B=(v=t.componentsOptions)==null?void 0:v.remoteCarets)==null?void 0:B.onUserChanged;i.doc.getRemoteUsers().on("change",M=>{I(i,M)})}return(S=(y=t.componentsOptions)==null?void 0:y.templates)!=null&&S.templates.length&&(i.addListener("docChanged",()=>{yf(i)}),i.addListener("resize",()=>{yf(i,{reset:!0})}),setTimeout(()=>{yf(i)},100)),i.doc.registerCallback({onError:async I=>{if(I.code==="ResetDoc"){wf.error(`reset doc: ${I.message}`);const M=await fs.load(o);i.doc.reset(M)}}}),i}function TP(n){return n.toJSON!==void 0}async function SP(n,t,e){var i,s;d(wf,n,"app does not exists");const o=TP(t)?t:new Ru(t,{serverUrl:e.serverUrl||""});e.lang&&T.setLang(e.lang);const r=ts(n,o,{id:e.id,components:{blocks:[Ds,Rs,E1,u4],commandProviders:[new Bh],decorators:[new Os,new Ku],embeds:[...TC,...((i=e.components)==null?void 0:i.embeds)||[]],boxes:[Fc,vf,U3],insertions:[Kd],blockHooks:[new g6],textRenders:[new $3],options:{...e.componentsOptions}},shortcuts:[d1,m3,i1,oc]});return r.editorCommandProviders.registerCommandProvider(new Ln(r)),r.input.addHandler(new Qc),r.input.addHandler(new Ms(r,{headingLevel:1,titlePlaceholder:T.t("placeholder.common.title"),contentPlaceholder:T.t("placeholder.common.content"),readonlyTitlePlaceholder:T.t("placeholder.local.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),r.input.addHandler(new zc(r,(s=e.componentsOptions)==null?void 0:s.quickMenu)),r.input.addHandler(new V1(r)),r.input.addHandler(new i3(r)),r.addCustom("block-menu",l=>new v6(l)),r.addCustom("editor-tooltip",()=>new r1(r)),e!=null&&e.enableComments&&r.addCustom("editor-comments",l=>new N3(l,new BP(l,o))),Xr.register(r),r}function DP(n,t){var l;const e=n.doc;if(!((l=e.getVersionHelper)==null?void 0:l.call(e)))throw new Error("the editor does not support to show versions");const r=n.getCustom("create-options");if(!r)throw new Error("the editor does not support to show versions");const i=r.getData(),s=new kP(i);return m$(n,s,t)}g.tippy=p7,g.AuthError=fc,g.AuthHeader=hs,g.AutoScroll=Am,g.BaseURLHeader=mc,g.BlockResizer=Yc,g.BrBox=up,g.CodeBlock=Rs,g.CodeLineBlock=E1,g.CodeTextDecorator=Os,g.DefaultShortcuts=oc,g.DocIdError=rw,g.DragDrop=um,g.DrawioEmbed=ca,g.EditorBlocks=Cg,g.EditorBoxes=fp,g.EditorCommandProviders=n2,g.EditorComplexBlockPosition=Je,g.EditorComplexSelectionRange=Xe,g.EditorDecorators=Cp,g.EditorEmbeds=vg,g.EditorInsertions=pp,g.EditorSimpleBlockPosition=qt,g.EditorSimpleSelectionRange=ce,g.EmbedBlock=yg,g.EnforceWithDocumentTitleHandler=Ms,g.EventCallbacks=xi,g.FILL_CHAR=Rb,g.FileExtError=iw,g.HeadingBlockScrollListener=F$,g.InputtingInsertion=mp,g.LocalDoc=Ru,g.Logger=br,g.MIN_DISTANCE_THRESHOLD=am,g.ManualMenu=tr,g.ManualToolbar=ps,g.MarkdownInputHandler=Qc,g.MaxUserError=Vu,g.OnesEditorAutoSuggest=mh,g.OnesEditorCustomDataWrapper=Kf,g.OnesEditorHoveringBlock=Nt,g.OnesEditorQuickMenu=zc,g.OnesEditorToc=Zs,g.OnesEditorTocProvider=mr,g.OnesEditorToolbar=Xr,g.OnesEditorTooltip=r1,g.PermissionError=ow,g.Popup=ms,g.RemoteCarets=F2,g.RemoteCaretsDecorator=Ku,g.RemoteCaretsInsertion=Kd,g.RemoteUsers=ic,g.RequestReloadError=us,g.RichText=ie,g.ShareDBDoc=fs,g.SimpleCache=Xf,g.StandardEmbedBlockCommands=g1,g.TEXT_STYLE_BACKGROUND_COLOR_PREFIX=Ud,g.TEXT_STYLE_COLOR_PREFIX=zd,g.TableBlock=Ds,g.TableBlockCommandProvider=Bh,g.TableShortcuts=d1,g.TextBlock=ve,g.TextBox=dp,g.TextStyleShortcuts=i1,g.TocEmbed=yC,g.ZERO_WIDTH_SPACE_CHAR=Ti,g.addAttribute=Ol,g.addClass=A,g.addCommentToBlock=m1,g.addDays=i8,g.addMonths=r8,g.animateScrollTo=td,g.applyPlaceholderToBlock=Kc,g.assert=d,g.blockToDoc=xu,g.blockToHtml=eu,g.blockToMarkdown=nu,g.blockToText=ql,g.blocksToDoc=qv,g.clearAllSelection=lg,g.clientType=xt,g.cloneBlock=ao,g.cloneChildContainer=hu,g.cloneDoc=fu,g.cloneText=tp,g.commentToShareDbComment=Qu,g.compareElement=fl,g.comparePosition=Sd,g.complexBlockAdjustSelectionPos=xl,g.complexBlockFindNearestChildBlock=Ig,g.complexBlockGeFirstSimpleChild=Ld,g.complexBlockGetAllChildContainers=Se,g.complexBlockGetBottomChildContainers=Eg,g.complexBlockGetLastSimpleChild=Ni,g.complexBlockGetSelectedContainers=xr,g.complexBlockGetTopChildContainers=Bg,g.containerToDoc=R0,g.continuousScroll=Rm,g.convertBlockFrom=Oi,g.copyBlockAttributes=Lp,g.createBlockAnchor=zo,g.createBlockCaretAnchor=Dg,g.createBlockContentElement=ro,g.createBlockElement=zm,g.createBlockSimpleDocRange=Fl,g.createBlockSimpleRange=At,g.createBoxContentElement=qm,g.createBoxElement=Um,g.createBoxOp=qg,g.createChildContainer=rg,g.createComplexBlockPosition=wt,g.createComplexDocPos=sp,g.createComplexDocRange=_b,g.createContainer=op,g.createContainerElement=bd,g.createDeleteOps=Fg,g.createEditor=ts,g.createEditorSelectionRange=Wt,g.createElement=b,g.createEmptyContainer=yn,g.createEmptyDoc=Zo,g.createEmptyTextBlockData=Pl,g.createExpandedRange=ul,g.createIconButton=vr,g.createImage=tm,g.createInsertOps=Al,g.createInsertionContentElement=Zm,g.createInsertionElement=Wm,g.createLocalEditor=SP,g.createOnesEditor=xP,g.createRange=em,g.createRichText=Go,g.createRootContainer=og,g.createSimpleBlockPosition=P,g.createSimpleDocPos=ip,g.createTextBlockData=zn,g.createTextButton=sr,g.createTextOp=$e,g.createTextWithReplaceSoftReturn=Pd,g.daysAfter=ad,g.deleteText=Hd,g.diffDays=s8,g.disablePageScroll=Im,g.docToHtml=Ep,g.docToHtmlFragment=Vi,g.docToMarkdown=qi,g.docToText=Wl,g.downloadObjectToFile=_1,g.downloadSvgToString=I6,g.editLink=Rc,g.editorAddComment=F_,g.editorAddTextAttribute=Fp,g.editorAutoInsertBlock=Mp,g.editorBreakTextBlock=Rr,g.editorClearCompositionText=Dp,g.editorClearSelectedContents=du,g.editorCopyBlock=nc,g.editorDeleteBlock=cu,g.editorDeleteBlockText=iu,g.editorDeleteBlockWithoutChildren=lu,g.editorDeleteChildContainer=Iv,g.editorDeleteChildContainers=Rp,g.editorFocusToBlock=uu,g.editorFocusToEnd=L0,g.editorGetBlockData=co,g.editorGetBlockText=ue,g.editorGetBlockTextEx=Ul,g.editorGetBoxData=cp,g.editorHandleKeyboardEvent=$0,g.editorInsertBlock=Mr,g.editorInsertBoxToBlock=Tp,g.editorInsertDoc=jp,g.editorInsertDocAt=mu,g.editorInsertText=ru,g.editorInsertTextToBlock=xp,g.editorInsertTextToBlockEx=ou,g.editorMergeTextBlock=Ap,g.editorMoveDown=Xp,g.editorMoveEnd=a0,g.editorMoveHome=d0,g.editorMoveLeft=Qp,g.editorMoveLineEnd=b0,g.editorMoveLineHome=C0,g.editorMovePageDown=E0,g.editorMovePageUp=B0,g.editorMoveRight=Kp,g.editorMoveUp=Jp,g.editorMoveWordEnd=s0,g.editorMoveWordLeft=i0,g.editorRangeClearColor=Up,g.editorRangeGetColor=gu,g.editorRangeSetColor=zp,g.editorRemoveTextAttribute=Sv,g.editorReplaceBlockText=Kl,g.editorReplaceContainer=Hp,g.editorRunOnce=Au,g.editorSelectAll=D0,g.editorSelectContainer=Eu,g.editorSelectDown=t0,g.editorSelectEnd=wu,g.editorSelectHome=u0,g.editorSelectLeft=e0,g.editorSelectLineEnd=p0,g.editorSelectLineHome=g0,g.editorSelectPageDown=x0,g.editorSelectPageUp=I0,g.editorSelectRight=n0,g.editorSelectUp=o0,g.editorSelectWordEnd=c0,g.editorSelectWordLeft=l0,g.editorSetTextColor=Ar,g.editorShowFindDialog=ZO,g.editorUpdateBlockData=Jl,g.editorUpdateCompositionText=Sp,g.editorUpdateEmbedData=$p,g.enablePageScroll=xm,g.escapeHtmlText=sm,g.escapeRegExp=hd,g.escapeSpace=F7,g.executeBlockCommand=pg,g.executeEmbedBlockCommand=gg,g.executeRangeCommand=e2,g.fileToDataUrl=pl,g.findAfterOffsetNotType=Zd,g.findAllText=Wd,g.findInsertionById=Gm,g.findNextOffset=Jb,g.findPrevOffset=Kb,g.findPrevOffsetNotType=Gd,g.findPrevSimpleBlockBeforeChildContainer=wg,g.findTarget=Di,g.findWordEnd=Qd,g.findWordLeft=Yd,g.format=cd,g.formatBytes=Om,g.formatDate=$m,g.fragmentToHtml=Tm,g.fromBase64=gl,g.fromBase64ToBlob=wm,g.fromBase64ToUint8Array=X7,g.fromDocRange=io,g.fromNowString=ud,g.genId=N,g.getAllChildBlocks=Rd,g.getAllQuickMenuItems=o1,g.getAllSelectedBlocks=tn,g.getAttributesAt=Nl,g.getBlockBackground=Fm,g.getBlockByIndex=kr,g.getBlockCaretRect=Ke,g.getBlockClass=bt,g.getBlockClassByType=Er,g.getBlockClientRects=Ho,g.getBlockCommandsWithHook=Ed,g.getBlockContent=it,g.getBlockId=q,g.getBlockIndex=J,g.getBlockKind=Qe,g.getBlockMinWidth=ag,g.getBlockNearestRangeFromPoint=Tg,g.getBlockOptions=p8,g.getBlockPath=jo,g.getBlockProperties=hg,g.getBlockRangeFromPoint=Tl,g.getBlockStyles=m8,g.getBlockTextLength=W,g.getBlockTools=Rt,g.getBlockType=rt,g.getBoxContent=gd,g.getBoxId=Vm,g.getBoxTypeFromElement=Ri,g.getChildBlockCount=Ge,g.getChildBlocks=Mt,g.getChildOffset=so,g.getColorFromAttributes=qd,g.getComplexBlockClass=xe,g.getContainerBlockPath=tg,g.getContainerBlocks=Jm,g.getContainerBlocksElement=El,g.getContainerById=Br,g.getContainerId=U,g.getContainerMinWidth=wd,g.getContainerToolsElement=a8,g.getContainerWidth=ug,g.getDistanceSquare=Cn,g.getElementOffset=Si,g.getEmbedType=Oe,g.getExistsBlockTools=Bl,g.getExistsContainerById=Qm,g.getFileExt=Dm,g.getFirstChildBlock=Vt,g.getFirstClientRect=hl,g.getHeadingMenuOptions=Kh,g.getHorizontalPadding=Qa,g.getInsertionContent=pd,g.getLastChildBlock=Qt,g.getLastClientRect=Mo,g.getListAllNextBrothers=Is,g.getLogger=w,g.getNextBlock=dt,g.getNextValidOffset=Vo,g.getNextVisibleBlock=wr,g.getOffsetInfoAfter=Ui,g.getOffsetInfoBefore=Vl,g.getOpAt=Gg,g.getOpLength=Fd,g.getParentBlock=F,g.getParentBox=md,g.getParentContainer=H,g.getPrevBlock=gt,g.getPrevValidOffset=lo,g.getPrevVisibleBlock=yr,g.getRangeCommands=X0,g.getRootBlock=yd,g.getScrollContainer=We,g.getSpecialBlockCommands=fg,g.getStandardEmbedBlockProperties=p1,g.getTextAfterOffset=Yb,g.getTextBeforeOffset=Qb,g.getTextBlockChild=Sl,g.getTextBlockClass=sg,g.getTextBlockContentChildTextLength=Ne,g.getTextBlockContentChildType=Sg,g.getTextBlockContentChildren=Fn,g.getTextLength=de,g.getTextOpLength=Ad,g.getTextWidth=bl,g.getToolbar=Mc,g.handleBlockElementUpdated=dg,g.hasAltOnly=G7,g.hasClass=nt,g.hasCtrlOrCmd=bm,g.hasCtrlOrCmdOnly=W7,g.hideBlock=jm,g.htmlToFragment=Cl,g.i18n=T,g.injectStyle=cm,g.insertEmptyBlock=b8,g.insertEmptyEmbedBlock=Id,g.insertText=Sr,g.intersectionCommands=Kk,g.isBackspace=km,g.isBlock=Po,g.isBox=fd,g.isCJK=gm,g.isChildContainer=Ye,g.isChildNode=It,g.isCollapsedRange=Ob,g.isComplexBlockPosition=Td,g.isComplexKindBlock=at,g.isContainer=bn,g.isContainerSelectedAllChildBlocks=T0,g.isControlEvent=Oo,g.isDelete=Y7,g.isDraggingFiles=kl,g.isEmbedBlock=Te,g.isEmptyContainer=Bd,g.isEmptyDoc=jl,g.isEmptyTextBlock=Tt,g.isEmptyTextBlockWithoutCompositionText=Ls,g.isEnterOnly=vm,g.isEscape=id,g.isFirefox=od,g.isFirstChildBlockInComplexBlock=W8,g.isHighSurrogate=_7,g.isInBlock=Cd,g.isInBlockTools=Ai,g.isLetter=mm,g.isLowSurrogate=Ya,g.isMatchShortcut=Pn,g.isMoveForward=V7,g.isNavigationEvent=U7,g.isNavigationKey=Cm,g.isNodeRemoved=om,g.isNumber=fm,g.isPrintableKey=rd,g.isRootBlock=Ko,g.isRootContainer=pt,g.isSafari=pm,g.isSameDay=dd,g.isShiftEnter=Z7,g.isShiftTab=K7,g.isShortcutEvent=q7,g.isSimpleBlock=g8,g.isSimpleBlockPosition=Ir,g.isSimplePos=rp,g.isSimpleRange=Hl,g.isSpace=ml,g.isTab=Q7,g.isTextBlockContentBoxChild=_e,g.isTextBlockContentChild=$i,g.isTextBlockContentInsertionChild=Hn,g.isTextBlockContentTextChild=Pi,g.isTextKindBlock=j,g.isTextKindBlockType=_i,g.isToday=_m,g.isValidOffset=re,g.isVisibleBlock=wl,g.isYesterday=Nm,g.loadJs=rm,g.loadJsPromise=Ro,g.lockers=qe,g.mergeCommands=Lc,g.mergeDocs=Yo,g.mergeOps=jd,g.mergeText=Sb,g.multiSplitText=Rg,g.parseShortcut=ym,g.patchNode=Mi,g.pointInRect=Ao,g.rangeAddAttribute=_l,g.rangeGetTextColor=Xg,g.rangeRemoveAttribute=Dr,g.rangeSetTextColor=Qg,g.rangeTransformText=Zg,g.registerDragDrop=ed,g.removeAttribute=Vd,g.removeClass=z,g.removeLastBr=Eb,g.removePlaceholderFromBlock=V4,g.removeStyle=lm,g.replaceAll=l8,g.replaceAllCaseInsensitive=c8,g.replaceAllText=np,g.replaceText=$l,g.requestDownload=yl,g.resetListStart=Ts,g.scrollable=Mm,g.selectFile=No,g.selectedBlockToDoc=tc,g.selectionToDoc=Ji,g.setAttributes=Ja,g.setClipboardData=vl,g.setClipboardDataByEvent=o8,g.setColorToAttributes=Kg,g.setDataset=Ka,g.setDefaultCursor=Li,g.setStyles=Xa,g.shareDBCommentToDocObject=Yu,g.shareDBDocCommentToComment=j2,g.shortcutToDisplayText=J7,g.showBlock=Hm,g.showDocVersions=DP,g.splitText=be,g.splitToThree=Gt,g.stringToDataUrl=Bm,g.stringToObjectUrl=ld,g.subText=Ag,g.textNodeOffsetFromPoint=nm,g.toBase64URL=_o,g.toPlainText=vt,g.trimChar=nd,g.unicodeLength=N7,g.unicodeSubstr=$7,g.updateBlockSelection=cg,g.updateOpAttributes=ep,g.updateTextBlockContent=Zb,g.updateUrl=sd,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
686
|
+
</svg>`,{t:hf}=T;class QN{constructor(t){h(this,"goBackButton");h(this,"playButton");h(this,"revertButton");this.options=t;const e=b("button",["dialog-text-button"],null),o=b("span",["dialog-button-icon"],e);o.innerHTML=YN,b("span",["dialog-button-text"],e,hf("version.goBack"));const r=b("button",["dialog-version-button"],null,hf("version.play")),i=b("button",["dialog-version-button"],null,hf("version.revertVersion"));this.goBackButton=e,this.playButton=r,this.revertButton=i,this.bindEvent()}bindEvent(){const{onBack:t,onPlay:e,onRevert:o}=this.options;this.playButton.onclick=e,this.goBackButton.onclick=t,this.revertButton.onclick=o}disabledButton(){}render(t,e=!1){e||t.append(this.goBackButton,this.playButton,this.revertButton)}destroy(){this.playButton.onclick=null,this.goBackButton.onclick=null,this.revertButton.onclick=null}}const Ce=w("split-text-actions");function nC(n){return n.length>2?!1:n.length===1?n[0].insert!==void 0:(d(Ce,n.length===2,`invalid text actions: ${JSON.stringify(n)}`),n[0].retain===void 0?!1:n[1].insert!==void 0)}function oC(n){return n.length>2?!1:n.length===1?n[0].delete!==void 0:(d(Ce,n.length===2,`invalid text actions: ${JSON.stringify(n)}`),n[0].retain===void 0?!1:n[1].delete!==void 0)}function rC(n){return n.length>2?!1:n.length===1?n[0].insert===void 0&&n[0].delete===void 0&&n[0].attributes!==void 0:(d(Ce,n.length===2,`invalid text actions: ${JSON.stringify(n)}`),n[0].retain===void 0?!1:n[1].attributes!==void 0)}function KN(n){const t=[],e=Y.default(n);if(e.length===0)return[];if(e.length===1)return[n];if(e.length===2&&(oC(n)||nC(n)||rC(n)))return[n];const o=(i,s)=>i>0?[{retain:i},s]:[s];let r=0;for(;e.length>0;){const i=e[0];if(i.retain!==void 0&&i.attributes===void 0){d(Ce,i.retain>0,`invalid text op: ${JSON.stringify(i)}`),d(Ce,e.length>1,`invalid text op: ${JSON.stringify(i)}`);const s=e[1];d(Ce,s.delete||s.insert!==void 0||s.attributes!==void 0,`invalid next text op: ${JSON.stringify(s)}`),r+=i.retain,t.push(o(r,s)),s.delete!==void 0?r-=s.delete:s.insert!==void 0?r+=s.insert.length:(d(Ce,s.attributes!==void 0,`invalid next text op: ${JSON.stringify(s)}`),d(Ce,s.retain!==void 0,`invalid next text op: ${JSON.stringify(s)}`),r+=s.retain),e.splice(0,2)}else d(Ce,i.delete||i.insert!==void 0||i.attributes!==void 0,`invalid next text op: ${JSON.stringify(i)}`),t.push(o(r,i)),e.shift(),i.retain!==void 0&&(d(Ce,i.attributes!==void 0,`invalid next text op: ${JSON.stringify(i)}`),r+=i.retain),i.insert&&(r+=i.insert.length)}return t}function iC(n){if(d(Ce,n.length===1||n.length===2,`not a single action op: ${JSON.stringify(n)}`),n.length===1)return 0;const t=n[0].retain;return d(Ce,typeof t=="number"&&t>0,`invalid retain: ${JSON.stringify(n)}`),t}let sC=0;function JN(n,t,e){const o=sC;sC+=1;const r=vt(n);return{insert:" ",attributes:{box:!0,id:N(),type:"history-deleted-box",user:e,created:Date.now(),text:r,deletedOffset:t,deletedOrder:o}}}function XN(n,t,e){const o=iC(t),r=t.length===1?t[0].delete:t[1].delete;d(Ce,typeof r=="number",`not a delete op: ${JSON.stringify(t)}`);const{left:i,middle:s,right:l}=Gt(n,o,r),c=JN(s,o,e);return[...i,c,...l]}function t$(n,t,e){const o=iC(t),r=t.length===1?t[0].insert:t[1].insert;d(Ce,typeof r=="string",`invalid insert op: ${JSON.stringify(t)}`);const i=t.length===1?t[0].attributes:t[1].attributes,l=Ol([{insert:r,attributes:i}],"insertedBy",e);return Sr(n,o,l,null)}function e$(n,t,e){const o=KN(t).reverse();let r=n;for(const i of o)oC(i)?r=XN(r,i,e):nC(i)?r=t$(r,i,e):(d(Ce,rC(i),`unknown op: ${JSON.stringify(i)}`),r=ie.apply(r,i));return r}const n$=w("history-update-block-text");function lC(n){const t=[],e=[];let o=0;return n.forEach(r=>{var i;if((i=r.attributes)!=null&&i.box){const s=r.attributes;if(s.type==="history-deleted-box"){t.push({boxData:s,offset:o});return}}e.push(r),o+=Fd(r)}),t.sort((r,i)=>i.offset-r.offset),{deletedBoxes:t,newText:e}}function o$(n,t,e){let o=n;return t.forEach(r=>{const i=ie.transformCursor(r.offset,e,!1);o=Sr(o,i,[{insert:" ",attributes:r.boxData}],null)}),o}function r$(n){n.sort((t,e)=>t.boxData.deletedOffset!==e.boxData.deletedOffset?t.boxData.deletedOffset-e.boxData.deletedOffset:t.boxData.deletedOrder-e.boxData.deletedOrder)}function i$(n){if(n.length<=1)return n;const t=n[0].offset;n.forEach(e=>{d(n$,e.offset===t,`invalid boxes group, ${JSON.stringify(n)}`)}),r$(n);for(let e=n.length-1;e>=1;e--){const o=n[e],r=n[e-1];o.boxData.user.userId===r.boxData.user.userId&&(r.boxData.text+=o.boxData.text,n.splice(e,1))}return n}function s$(n){let{newText:t,deletedBoxes:e}=lC(n);const o=new Map;return e.forEach(i=>{let s=o.get(i.offset);s||(s=[],o.set(i.offset,s)),s.push(i),s.sort((l,c)=>l.boxData.deletedOffset-c.boxData.deletedOffset)}),Array.from(o.values()).sort((i,s)=>s[0].offset-i[0].offset).forEach(i=>{const s=i[0].offset;i$(i).reverse().forEach(l=>{t=Sr(t,s,[{insert:" ",attributes:l.boxData}],null)})}),t}function l$(n,t,e){let{newText:o,deletedBoxes:r}=lC(n);return o=e$(o,t,e),o=o$(o,r,t),o=s$(o),o}const Mn=w("history-doc");function Rn(n){d(Mn,!1,"no local actions for history doc")}class c$ extends xi{constructor(e,o){super();h(this,"doc");h(this,"editor");this.doc=Y.default(e),this.editor=o}beginBatchUpdate(){return 0}endBatchUpdate(){return 0}toJSON(){return Y.default(this.doc)}getContainerBlocks(e){return this.doc.blocks[e]}getBlockData(e,o){const r=this.getContainerBlocks(e);d(Mn,r,`no container data: ${e}`);const i=r[o];return d(Mn,i,`no block data: ${o}`),i}localUpdateBlockText(){Rn()}localUpdateBlockData(){Rn()}localInsertBlock(){Rn()}localDeleteBlock(){Rn()}localInsertChildContainer(){Rn()}localDeleteChildContainers(){Rn()}uploadResource(){Rn()}async addResources(e){Rn()}getServerMeta(){var e,o,r;return(r=(o=(e=this.editor.doc.externalDoc).getServerMeta)==null?void 0:o.call(e))!=null?r:{}}buildResourceUrl(e){return this.editor.doc.externalDoc.buildResourceUrl(e)}request(){Rn()}broadcastMessage(){Rn()}getUser(){return{permission:"w",userId:"-",displayName:"-",avatarUrl:"-",rainbowIndex:0}}getRemoteUsers(){return new ic}destroy(){this.clearCallbacks()}transformBlockIndex(e,o,r){const i=this.doc.blocks[e];d(Mn,i,`no container blocks: ${e}`);let s=0;for(let l=0;l<i.length;l++)if(!i[l].deletedBy){if(s===o)return l;s++}return r&&d(Mn,!1,`invalid block index: ${o}, blocks: ${JSON.stringify(i)}`),d(Mn,s===o,`invalid block index: ${o}, blocks: ${JSON.stringify(i)}`),i.length}onDeleteBlock(e,o,r){const i=this.transformBlockIndex(e,o,!0),l=this.doc.blocks[e][i];d(Mn,!l.deleted,`block has already deleted: ${e}/${o}`),l.deletedBy=r,this.callbacks.forEach(c=>{var a;return(a=c.onUpdateBlockData)==null?void 0:a.call(c,e,i,{insert:{},delete:[]},!0)})}onInsertBlock(e,o,r,i){const s=this.transformBlockIndex(e,o,!1),l=this.doc.blocks[e],c=Y.default(r);c.insertedBy=i,l.splice(s,0,c),this.callbacks.forEach(a=>{var u;return(u=a.onInsertBlock)==null?void 0:u.call(a,e,s,c,!0)})}onUpdateBlockText(e,o,r,i){const s=this.transformBlockIndex(e,o,!0),c=this.doc.blocks[e][s];d(Mn,!c.deleted,`block has already deleted: ${e}/${o}`);const a=c.text;d(Mn,a,`no text for block: ${JSON.stringify(c)}`);const u=l$(a,r,i);c.text=u,this.callbacks.forEach(f=>{var m;return(m=f.onUpdateBlockText)==null?void 0:m.call(f,e,o,r,!0)})}onUpdateBlockData(e,o,r,i){const s=this.transformBlockIndex(e,o,!0),l=this.doc.blocks[e],c=l[s];d(Mn,!c.deleted,`block has already deleted: ${e}/${o}`);const a=Y.default(c);a.updatedBy=i,r.delete.forEach(u=>delete a[u]),Object.entries(r.insert).forEach(([u,f])=>{a[u]=f}),l[s]=a,this.callbacks.forEach(u=>{var f;return(f=u.onUpdateBlockData)==null?void 0:f.call(u,e,s,r,!0)})}onCreateContainer(e,o,r){this.doc.blocks[e]=Y.default(o),this.callbacks.forEach(i=>{var s;return(s=i.onInsertChildContainer)==null?void 0:s.call(i,e,o,!0)})}}const{t:cC}=T;function mi(n,t){return t==="insert"?cC("version.insert",{name:n.displayName}):cC("version.delete",{name:n.displayName})}function hr(n,t){const{userId:e}=t;return["flag","selection"].reduce((r,i)=>{const s=n.doc.getRemoteUsers().getFixedUserColor(e,i);return r[i]=s,r},{})}class a${renderText(t,e,o){if(!o.box&&o.insertedBy){const r=o.insertedBy,{flag:i,selection:s}=hr(t,o.insertedBy);return{classes:["history-inserted-text"],attributes:{"history-inserted-by":r.displayName,"data-op-description":mi(r,"insert")},styles:{[ui]:i,[hi]:s}}}return{}}renderBlock(t,e,o){if(o.deletedBy){const r=o.deletedBy,{flag:i,selection:s}=hr(t,r);return{classes:["history-deleted-block"],attributes:{"history-deleted-by":r.displayName,"data-op-description":mi(r,"delete")},styles:{[ui]:i,[hi]:s}}}if(o.insertedBy){const r=o.insertedBy,{flag:i,selection:s}=hr(t,r);return{classes:["history-inserted-block"],attributes:{"history-inserted-by":r.displayName,"data-op-description":mi(r,"insert")},styles:{[ui]:i,[hi]:s}}}return{}}updateBlock(t,e,o,r){if(r.deletedBy){const i=r.deletedBy,{flag:s,selection:l}=hr(t,i);A(o,"history-deleted-block"),Ja(o,{"history-inserted-by":i.displayName,"data-op-description":mi(i,"delete")}),Xa(o,{[ui]:s,[hi]:l});return}if(r.insertedBy){const i=r.insertedBy,{flag:s,selection:l}=hr(t,i);A(o,"history-inserted-block"),Ja(o,{"history-inserted-by":i.displayName,"data-op-description":mi(i,"insert")}),Xa(o,{[ui]:s,[hi]:l})}}}const aC=w("history-deleted-box");function d$(n,t,e,o){const r=o;d(aC,r.text,`no text for text box data: ${JSON.stringify(o)}`),d(aC,typeof r.text=="string",`invalid text type for text box data: ${JSON.stringify(o)}`);const i=b("span",["history-deleted-box"],e,r.text),s=r.user,{flag:l,selection:c}=hr(n,s);i.setAttribute("history-deleted-by",s.displayName),i.setAttribute("data-op-description",mi(s,"delete")),i.style.setProperty(ui,l),i.style.setProperty(hi,c)}function u$(n,t,e,o){return t.text}const h$={boxType:"history-deleted-box",updateBoxContent:d$,convertTo:u$},Ee=w("version-dialog");class f${constructor(t,e){h(this,"editor");h(this,"dialog",null);h(this,"oldViewer",null);h(this,"versionOptions");h(this,"versionList",null);h(this,"actionButtons",null);h(this,"provider");h(this,"components");h(this,"handleClose",()=>{var t;(t=this.dialog)==null||t.hide()});h(this,"handlePlay",()=>{var e;d(Ee,this.versionList,"The versionList did not render");const t=(e=this.versionList)==null?void 0:e.activeVersion;d(Ee,t,`The version: ${t} is invalid`),this.viewVersion(t,{play:!0,speed:150})});h(this,"handleRevert",async()=>{var e,o;d(Ee,this.versionList,"The versionList did not render");const t=(e=this.versionList)==null?void 0:e.activeVersion;d(Ee,t,`The version: ${t} is invalid`),await this.versionHelper.revertVersion(t.version),(o=this.dialog)==null||o.hide()});h(this,"handleSelectVersion",t=>{d(Ee,t,`The version: ${t} is invalid`),this.viewVersion(t)});h(this,"viewVersion",async(t,e={play:!1,speed:1e3})=>{var C,v,B;this.oldViewer&&(this.oldViewer.destroy(),this.oldViewer=null),d(Ee,this.versionList,"The versionList did not render"),d(Ee,this.actionButtons,"The actionButtons did not render");const o=t.type==="minor"?this.versionList.beforeVersion:this.versionList.beforeMajorVersion,r=o?o.version:0,i=this.versionList.isSelectedFirstVersion,s=this.versionList.isSelectedLastVersion;this.actionButtons.revertButton.disabled=i,this.actionButtons.playButton.disabled=i;let l=(C=this.versionOptions)==null?void 0:C.hideOps;if((v=this.versionOptions)!=null&&v.onWillChangeVersion){const y=this.versionOptions.onWillChangeVersion(this.editor,t,i,s);y!=null&&y.hideOps&&(l=!0)}let c,a;if(l)c=await this.versionHelper.getVersion(t.version),a=[];else{const y=await this.versionHelper.getHistoryData(t.version,r);c=y.doc,a=y.historyData}const{editorElement:u}=this.components;u.innerHTML="";const f=new c$(c,this.editor),m=this.provider.createHistoryEditor(u,f);m.editorBlockRenders.registerRender(new a$),m.editorBoxes.registerBoxClass(h$),A(m.rootElement,tC.HISTORY);try{await ZN(f,this.versionHelper,a,e)}finally{this.oldViewer=m}(B=this.versionOptions)!=null&&B.onVersionChanged&&this.versionOptions.onVersionChanged(this.editor,m,t,i,s)});h(this,"setShowOps",t=>{var e;if(this.versionOptions){this.versionOptions.hideOps=!t;const o=(e=this.versionList)==null?void 0:e.activeVersion;d(Ee,o,`The version: ${o} is invalid`),this.viewVersion(o)}});this.editor=t,this.provider=e;const o=b("div",["version-dialog"],null),r=b("div",["version-dialog-note-viewer"],o),i=b("div",["version-dialog-action-container"],r),s=b("div",["version-dialog-editor"],r),l=b("div",["version-dialog-versions-list"],o);this.components={root:o,editorElement:s,actionContainer:i,versionsListContainer:l}}get versionHelper(){d(Ee,this.editor.doc.getVersionHelper,"Can not get getVersionHelper from doc");const t=this.editor.doc.getVersionHelper();return d(Ee,t,"current doc does not support version"),t}renderContent(t){var s,l;const{actionContainer:e,versionsListContainer:o}=this.components;e.innerHTML="";const r=new QN({onBack:this.handleClose,onPlay:this.handlePlay,onRevert:this.handleRevert});r.render(e,(s=this.versionOptions)==null?void 0:s.hideActions),this.actionButtons=r,o.innerHTML="";const i=new qN({versions:t,useCreatedBy:(l=this.versionOptions)==null?void 0:l.useCreatedBy,onSelectVersion:this.handleSelectVersion,getMarkColor:c=>{const{flag:a}=hr(this.editor,c);return a}});i.render(o),this.versionList=i}initViewVersion(){var t;if((t=this.versionOptions)!=null&&t.initSelectedVersion){d(Ee,this.versionList,"The versionList did not render");const{initSelectedVersion:e}=this.versionOptions,o=this.versionList.selectVersionByVersionNum(e);d(Ee,o,`The version: ${o} is invalid`),this.viewVersion(o)}else{d(Ee,this.versionList,"The versionList did not render");const e=this.versionList.activeVersion;d(Ee,e,`The version: ${e} is invalid`),this.viewVersion(e)}}async show(t){this.versionOptions={...this.versionOptions,...t};const e=await this.versionHelper.getVersions();if(this.versionOptions.hideNonVersionedOps&&e.length&&e[0].version===-1&&e.shift(),this.versionOptions.onVersionsLoaded&&this.versionOptions.onVersionsLoaded(this.editor,e),this.renderContent(e),this.initViewVersion(),!this.dialog){const{root:o}=this.components;this.dialog=new VN(o)}this.dialog.show(t.container)}destroy(){var t,e,o;(t=this.dialog)==null||t.destroy(),(e=this.versionList)==null||e.destroy(),(o=this.actionButtons)==null||o.destroy()}}function m$(n,t,e){const o=n.addCustom("version-dialog",()=>new f$(n,t));return o.show(e),{setShowOps:o.setShowOps}}const Kz="",g$=w("heading-collapse");function ff(n){var e;const t=Number.parseInt((e=n.getAttribute("data-style-heading"))!=null?e:"",10);return d(g$,t,"not a heading block"),t}function ze(n){return!!n.getAttribute("data-style-heading")}function p$(n){return!nt(n,"heading-collapsed")}function fr(n){return nt(n,"heading-collapsed")}function dC(n){if(gt(n))return!1;const e=H(n);return pt(e)}const C$=w("heading-collapse");function mf(n){d(C$,ze(n),"not a heading block");const t=[],e=ff(n);let o=dt(n);for(;o&&!(ze(o)&&ff(o)<=e);)t.push(o),o=dt(o);return t}function uC(n,t){if(!Ko(t))return;n.selection.selectBlock(t,0),mf(t).forEach(o=>{jm(o)}),A(t,"heading-collapsed")}function gi(n,t){mf(t).forEach(o=>{Hm(o)}),z(t,"heading-collapsed")}function b$(n,t){p$(t)?uC(n,t):gi(n,t)}const v$=[Xu,th,eh,nh,oh,rh,ih,sh];function k$(n){const t=b("button",["heading-collapse-button"],null);return t.setAttribute(`data-editor-tooltip-${n.clientId}`,"Collapse / Expand"),t.innerHTML=Ju,t}function hC(n){return oa(n).querySelector("button.heading-collapse-button")}function fC(n,t){hC(t)||dC(t)||!Ko(t)||T1(t,k$(n),-1)}function y$(n){var t;(t=hC(n))==null||t.remove()}function mC(n,t){oa(t).querySelector("button.heading-collapse-button")||fC(n,t)}function w$(n){const t=ff(n),e=b("button",["heading-marker"],null);return e.innerHTML=v$[t-1],e}function gC(n){return oa(n).querySelector("button.heading-marker")}function gf(n){gC(n)||dC(n)||!Ko(n)||T1(n,w$(n),1)}function pC(n){const t=gC(n);t==null||t.remove()}function CC(n){pC(n),ze(n)&&gf(n)}class B${handleDrop(t,e,o,r){if(kl(e)||!ze(e)||!fr(e))return;const i=mf(e);i.unshift(e);const s=i.reverse();let l=null;return t.doc.beginBatchUpdate(),s.forEach((c,a,u)=>{const f=t.getBlockData(c),m=ao(t.editorBlocks,t.doc.toJSON(),f),C=t.insertDocAt(o,r,m)[0];a===u.length-1&&(l=C)}),t.doc.endBatchUpdate(),t.doc.beginBatchUpdate(),s.forEach(c=>{t.deleteBlock(c)}),t.doc.endBatchUpdate(),l&&uC(t,l),!0}}const E$=w("heading-collapse");class I${constructor(t){h(this,"handleLoad",()=>{this.showCollapseButtons()});h(this,"handleHoverBlock",(t,e)=>{e&&(z(e,"hovering-heading"),ze(e)&&pt(H(e))&&(gf(e),fr(e)||y$(e))),t&&ze(t)&&pt(H(t))&&(A(t,"hovering-heading"),pC(t),fC(this.editor,t))});h(this,"handleClick",(t,e)=>{const o=Di(e,"button.heading-collapse-button");if(!o)return;const r=F(o);!r||(d(E$,ze(r),"not a heading block"),b$(this.editor,r),mC(this.editor,r))});this.editor=t,t.addListener("load",this.handleLoad),t.addListener("click",this.handleClick),Nt.get(t).addListener("change",this.handleHoverBlock),this.showCollapseButtons(),setTimeout(()=>{Hs.get(t).addHandler(new B$)})}showCollapseButtons(){const t=Mt(this.editor.rootContainer).filter(ze);t.length!==0&&(t[0]===Vt(this.editor.rootContainer)&&t.splice(0,1),t.forEach(gf))}destroy(){this.editor.removeListener("load",this.handleLoad),this.editor.removeListener("click",this.handleClick)}}function va(n){const t=n.selection.range;if(t.isCollapsed()||t.start.blockId===t.end.blockId)return;const e=n.getBlockById(t.start.blockId),o=n.getBlockById(t.end.blockId);fr(e)&&gi(n,e),fr(o)&&gi(n,o)}function x$(n){va(n);const t=n.getFocusedBlock();!ze(t)||fr(t)&&gi(n,t)}function T$(n){va(n);const t=n.getFocusedBlock();if(!ze(t))return;const e=n.selection.range.focus;!e.isSimple()||e.offset===W(n,t)&&fr(t)&&gi(n,t)}function S$(n){va(n);const t=n.getFocusedBlock();if(!ze(t))return;const e=n.selection.range.focus;!e.isSimple()||e.offset===0&&fr(t)&&gi(n,t)}class D${handleBeforeKeyDown(t,e){return rd(e.key)&&va(t),e.key==="Enter"?(x$(t),!1):e.key==="Delete"?(T$(t),!1):(e.key==="Backspace"&&S$(t),!1)}}class L${constructor(t){this.editor=t}onInsertBlock(t,e,o,r){this.updateBlockIfNeeded(o.id)}onUpdateBlockData(t,e,o,r){const i=this.editor.doc.getBlockData(t,e);this.updateBlockIfNeeded(i.id,o)}updateBlockIfNeeded(t,e){setTimeout(()=>{const o=this.editor.findBlockById(t);if(!!o){if(!ze(o)){e&&e.delete.includes("heading")&&CC(o);return}nt(o,"hovering-heading")&&mC(this.editor,o),CC(o)}},100)}}function M$(n){return!!n.heading}function bC(n){var e;const t=n.heading;return(e=Number.parseInt(`${t}`,10))!=null?e:1}function vC(n,t){var e;return{parentNode:t,children:[],text:vt((e=n.text)!=null?e:[]),level:bC(n),block:n}}class Zs{constructor(){h(this,"nodes",[])}appendBlock(t){const e=this.findParent(bC(t),this.nodes);e?e.children.push(vC(t,e)):this.nodes.push(vC(t,null))}findParent(t,e){const o=e[e.length-1];if(!o||t<=1)return null;if(o.level===t-1)return o;const r=this.findParent(t,o.children);return r||(o.level<t?o:null)}static buildToc(t){const e=new Zs,o=t.blocks.root;for(let r=0;r<o.length;r++){const i=o[r];M$(i)&&e.appendBlock(i)}return e}}class mr extends Yt.TypedEmitter{constructor(e){super();h(this,"toc",new Zs);h(this,"updateToc",Xt.default(()=>{this.updateTocNow()},500));this.editor=e,e.doc.registerCallback(this),this.updateToc()}destroy(){this.editor.doc.unregisterCallback(this)}isHeadingBlock(e){return!!e.heading}onInsertBlock(e,o,r,i){e==="root"&&this.isHeadingBlock(r)&&this.updateToc()}onDeleteBlock(e,o,r){e==="root"&&this.updateToc()}onUpdateBlockText(e,o,r,i){if(e!=="root")return;const s=this.editor.doc.getBlockData(e,o);this.isHeadingBlock(s)&&this.updateToc()}onUpdateBlockData(e,o,r,i){if(e!=="root")return;const s=this.editor.doc.getBlockData(e,o);this.isHeadingBlock(s)&&this.updateToc()}static register(e){return e.addCustom("editor-toc",()=>new mr(e))}static get(e){return e.getCustom("editor-toc")}updateTocNow(){this.toc=Zs.buildToc(this.editor.doc.toJSON()),this.emit("change",this.editor,this.toc)}}const Jz="";function R$(n){return n.nodes.length===0?!0:n.nodes.length>1?!1:n.nodes[0].children.length===0}function pf(n,t){t.forEach(e=>{const o=b("div",["toc-node"],n),r=b("div",["toc-title"],o);if(b("span",["toc-text"],r,e.text).setAttribute("data-block-id",e.block.id),e.children.length>0){const s=b("div",["toc-children"],o);pf(s,e.children)}})}function A$(n,t){const e=Di(t,".toc-text");if(!e)return;const o=e.getAttribute("data-block-id");if(!o)return;const r=n.findBlockById(o);!r||(t.preventDefault(),t.stopPropagation(),n.selection.selectBlock(r,0))}function kC(n,t,e){if(z(t,"loading"),t.innerHTML="",R$(e)){b("div",["toc-empty-message"],t,"No toc");return}e.nodes.length===1?pf(t,e.nodes[0].children):pf(t,e.nodes),Au(n,"toc-click-handler",()=>{n.addListener("click",A$)})}class O${constructor(t){h(this,"handleUpdateToc",(t,e)=>{Array.from(t.rootContainer.querySelectorAll('.embed-block[data-type="editor-block"][data-embed-type="toc"]')).forEach(r=>{const i=r.querySelector(".editor-toc-container");i&&kC(t,i,e)})});this.editor=t,mr.register(t).addListener("change",this.handleUpdateToc)}destroy(){mr.register(this.editor).removeListener("change",this.handleUpdateToc)}get toc(){return mr.register(this.editor).toc}}function _$(n,t){const e=b("div",["editor-toc-container","embed-selected-content"],t),r=n.addCustom("init-editor-toc",()=>new O$(n)).toc;r.nodes.length===0?A(e,"loading"):kC(n,e,r)}function N$(n,t,e,o){return o==="markdown"?"[toc]":""}function $$(n,t,e){const{data:o}=e;if(!o||o.embedType!=="toc"||!j(n,t))return null;const r={};return{blockData:{id:N(),type:"embed",embedType:"toc",embedData:r}}}const yC={embedType:"toc",createEmbedContent:_$,convertTo:N$,convertFrom:$$};function P$(n){return!!n.getAttribute("data-style-heading")}function Cf(n,t){return P$(t)&&W(n,t)>0}function j$(n){const t=We(n.rootElement);let e=0,o=0,r=0;if(t===document.documentElement){const i=n.rootContainer.getBoundingClientRect();e=i.left+i.width/2,o=10,r=t.offsetHeight}else{const i=t.getBoundingClientRect();e=i.left+i.width/2,o=i.top+10,r=i.bottom}for(;o<r;){const i=document.elementsFromPoint(e,o);for(let s=0;s<i.length;s++){const l=F(i[s]);if(l&&n.rootContainer.contains(l))return l}o+=10}return null}function bf(n,t){let e=t;for(;e&&!Cf(n,e);)e=dt(e);return e}function wC(n){if(gt(n))return!1;const e=H(n);return pt(e)}function ka(n,t){let e=t;for(;e&&!Cf(n,e);)e=gt(e),e&&wC(e)&&(e=null);return e}const H$=.3;class F$ extends Yt.TypedEmitter{constructor(e){super();h(this,"scrollContainer");h(this,"scrollEventTarget");h(this,"scrollStatus",{curHeadingBlock:null,previousHeadingBlock:null,nextHeadingBlock:null});h(this,"handleScroll",Xt.default(()=>{const e={curHeadingBlock:null,previousHeadingBlock:null,nextHeadingBlock:null};let o=j$(this.editor);if(o&&(o=yd(o)),!o||!this.scrollContainer){this.setStatus(e);return}if(wC(o)&&(o=dt(o)),!o){this.setStatus(e);return}if(Cf(this.editor,o)){e.curHeadingBlock=o,e.previousHeadingBlock=ka(this.editor,o),e.nextHeadingBlock=bf(this.editor,o),this.setStatus(e);return}const r=this.scrollContainer.getBoundingClientRect(),i=bf(this.editor,o);if(i){const l=i.getBoundingClientRect();if(l.top>r.top&&l.top<r.top+r.height*H$){e.curHeadingBlock=i,e.previousHeadingBlock=ka(this.editor,i),e.nextHeadingBlock=bf(this.editor,i),this.setStatus(e);return}e.nextHeadingBlock=i}const s=ka(this.editor,o);s&&(e.curHeadingBlock=s,e.previousHeadingBlock=ka(this.editor,s)),this.setStatus(e)},200));this.editor=e,setTimeout(()=>{this.start()},50)}setStatus(e){this.scrollStatus.previousHeadingBlock===e.previousHeadingBlock&&this.scrollStatus.nextHeadingBlock===e.nextHeadingBlock&&this.scrollStatus.previousHeadingBlock===e.previousHeadingBlock||(this.scrollStatus=e,this.emit("change",this.editor,e))}start(){this.stop(),this.scrollContainer=We(this.editor.rootElement),this.scrollEventTarget=this.scrollContainer===document.documentElement?document:this.scrollContainer,this.scrollEventTarget.addEventListener("scroll",this.handleScroll),this.handleScroll()}stop(){this.scrollEventTarget&&this.scrollEventTarget.removeEventListener("scroll",this.handleScroll)}destroy(){this.stop(),this.scrollEventTarget=void 0}}class z${constructor(t,e){h(this,"suggest");h(this,"onShow",(t,e,o,r)=>{const i=this.editor.getBlockByIndex(e,o);if(!Ko(i)){const s=F(H(i));if(s&&rt(s)==="code")return!1}return!0});h(this,"onClickItem",(t,e,o)=>{const r=e.data,i={id:N(),type:"mention",box:!0,created:Date.now(),iconUrl:r.avatarUrl,text:r.displayName,mentionId:r.userId},s=this.editor.selection.range;if(!s.isCollapsed()||!s.isSimple())return;const l=s.focus,c=this.editor.getBlockById(l.blockId);this.editor.insertBoxToBlock(c,l.offset,i)});h(this,"queryItems",async(t,e)=>(await this.options.queryUsers(this.editor,e)).map(i=>({id:i.userId,name:i.displayName,icon:`<img src="${i.avatarUrl}" class="mention-user-avatar">`,element:i.element,data:i,subText:i.email})));this.editor=t,this.options=e,this.suggest=new mh(t,{id:"editor-mention",trigger:["@"],autoDeleteTrigger:!0,showLoading:!0,onShow:this.onShow,onClickItem:this.onClickItem,queryItems:this.queryItems})}destroy(){}}w("mathjax-box");function U$(n,t,e,o){const r=o,i=b("a",["mention-container"],e);b("span",["mention-name"],i,`@${r.text}`),i.setAttribute("data-mention-id",r.mentionId)}function V$(n,t,e){}function q$(n,t,e,o){return`@${t.text}`}const vf={boxType:"mention",updateBoxContent:U$,handleClickBox:V$,convertTo:q$};function W$(n){return go("list-block-mention",T.t("list.mention.tooltip"),mB,[],n.clientId)}class G${constructor(t){h(this,"mentionButton");h(this,"handleHoveringBlock",t=>{var e;!this.editor.isWritable()||(t&&this.shouldBlockShowMention(t)?Rt(t).appendChild(this.mentionButton):(e=this.mentionButton)==null||e.remove())});h(this,"handleMouseDown",(t,e)=>{e.preventDefault(),e.stopPropagation();const o=F(this.mentionButton);if(!o||!j(t,o))return;const r=t.selection.range.focus;if(!r.isSimple())return;let i;t.selection.focusedBlock!==o?i=W(t,o):i=r.offset,setTimeout(()=>{const s=t.insertTextToBlock(o,i,"@");i+=1;const l=vt(be(s,i).left);this.editor.selection.selectBlock(o,i),this.editor.focus(),t.getCustom("mention").suggest.popup(o,i,l,"@")})});h(this,"destroy",()=>{Nt.get(this.editor).removeListener("change",this.handleHoveringBlock)});this.editor=t,this.mentionButton=W$(t),Nt.get(this.editor).addListener("change",this.handleHoveringBlock),t.domEvents.addEventListener(this.mentionButton,"mousedown",this.handleMouseDown)}shouldBlockShowMention(t){if(!j(this.editor,t)||!ct(t))return!1;const e=Fe(t);return!(e==="ordered"||e==="unordered")}}const Xz="",Z$={templates:{title:"\u9009\u62E9\u6A21\u677F\uFF0C\u5FEB\u901F\u521B\u5EFA",create:"\u65B0\u5EFA\u6A21\u677F",choose:"\u5168\u90E8\u6A21\u677F",customizedMark:"\u81EA\u5B9A\u4E49"}},Y$={templates:{title:"Choose a template",create:"New template",choose:"All templates",customizedMark:"Custom"}};T.mergeLang({"zh-CN":Z$,"en-US":Y$});const tU="",Q$="data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjEyMCIgaGVpZ2h0PSIxMjAiIHZpZXdCb3g9IjAgMCAxMjAgMTIwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cmVjdCB3aWR0aD0iMTIwIiBoZWlnaHQ9IjEyMCIgZmlsbD0id2hpdGUiLz4KPHBhdGggZD0iTTQ4IDU5QzQ4IDU0LjU4MTcgNTEuNTgxNyA1MSA1NiA1MUg5M0M5OC41MjI4IDUxIDEwMyA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0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNOTAuMDMxOCAxODkuOTU4Qzg4LjM5MjYgMTg5Ljk1OCA4Ny4wNjM3IDE5MS4yODYgODcuMDYzNyAxOTIuOTI2Qzg3LjA2MzcgMTk0LjU2NSA4OC4zOTI2IDE5NS44OTQgOTAuMDMxOCAxOTUuODk0SDk1Ljk2OEM5Ny42MDcyIDE5NS44OTQgOTguOTM2MSAxOTQuNTY1IDk4LjkzNjEgMTkyLjkyNkM5OC45MzYxIDE5MS4yODYgOTcuNjA3MiAxODkuOTU4IDk1Ljk2OCAxODkuOTU4SDkwLjAzMThaTTkwLjAzMTkgMjEzLjcwMkM4OC4zOTI3IDIxMy43MDIgODcuMDYzOCAyMTUuMDMxIDg3LjA2MzggMjE2LjY3Qzg3LjA2MzggMjE4LjMwOSA4OC4zOTI3IDIxOS42MzggOTAuMDMxOSAyMTkuNjM4SDk1Ljk2ODFDOTcuNjA3MyAyMTkuNjM4IDk4LjkzNjIgMjE4LjMwOSA5OC45MzYyIDIxNi42N0M5OC45MzYyIDIxNS4wMzEgOTcuNjA3MyAyMTMuNzAyIDk1Ljk2ODEgMjEzLjcwMkg5MC4wMzE5WiIgZmlsbD0iIzkxRDlCRSIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzEyNTZfMzcxNjgiPgo8cmVjdCB3aWR0aD0iMzcyIiBoZWlnaHQ9IjI3OSIgZmlsbD0id2hpdGUiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K",BC=w("templates");function kf(n){const t=n.rootElement.querySelector(":scope .editor-templates");if(!t)return null;const e=t.querySelector(":scope .editor-templates-cards");return d(BC,e,"no card container"),{root:t,cardContainer:e}}function J$(n){const t=kf(n);if(t)return t.cardContainer.innerHTML="",t;const e=b("div",["editor-templates"],n.rootElement);b("div",["editor-templates-title"],e,T.t("templates.title"));const o=b("div",["editor-templates-cards"],e);return{root:e,cardContainer:o}}function EC(n,t,e,o,r){var f;const i=(f=n.options.componentsOptions)==null?void 0:f.templates,s=b("div",["editor-template-card",...o],null),l=b("div",["editor-template-thumb-container"],s),c=b("img",["editor-template-thumb"],l);c.src=t,c.style.display="none",c.onerror=()=>{var C;const m=(C=i==null?void 0:i.placeHolderImageSrc)!=null?C:K$;c.src!==m&&(c.src=m)},c.onload=()=>{c.style.display=""};const a=b("div",["editor-template-name"],s),u=b("span",[],a,e);return i!=null&&i.showTemplateTitleAttr&&u.setAttribute("title",e),s.onclick=()=>r(s),s}function X$(n,t){return t.thumbnailUrl?t.thumbnailUrl:n.doc.buildResourceUrl("thumbnail.png")}function tP(n,t){const e=X$(n,t);return EC(n,e,t.name,[],async()=>{var r,i;const o=(r=n.options.componentsOptions)==null?void 0:r.templates;(i=o==null?void 0:o.onApplyTemplate)==null||i.call(o,n,t)})}function eP(n,t){return EC(n,t,T.t("templates.choose"),["more"],()=>{var o,r;const e=(o=n.options.componentsOptions)==null?void 0:o.templates;(r=e==null?void 0:e.onChooseTemplate)==null||r.call(e,n)})}function nP(n,t){var f,m;const e=(f=n.options.componentsOptions)==null?void 0:f.templates;if(!e)return;const r=Qt(n.rootContainer).getBoundingClientRect().width;let i=1;const s=Q$,l=kf(n);if(l){if(t!=null&&t.reset){const C=Array.from(l.cardContainer.children),v=l.cardContainer.firstElementChild;if(d(BC,v,"no first card"),nt(v,"new")||nt(v,"more"))return;const B=window.getComputedStyle(v),y=parseFloat(B.marginLeft),S=parseFloat(B.marginRight),I=v.getBoundingClientRect().width+y+S;i=Math.floor(r/I);const R=Math.max(1,i-1-1),$=C.length-1;C.forEach((Z,ot)=>{ot>R&&ot<$?Z.style.display="none":(ot>=$&&nt(Z,"more"),Z.style.display="")})}return}const c=e.templates,{cardContainer:a}=J$(n);c.forEach((C,v)=>{const B=tP(n,C);if(v>0&&v>=i&&(B.style.display="none"),a.appendChild(B),v===0){const y=window.getComputedStyle(B),S=parseFloat(y.marginLeft),I=parseFloat(y.marginRight),M=B.getBoundingClientRect().width+S+I;i=Math.floor(r/M)-1}});const u=eP(n,s);a.appendChild(u),(m=e==null?void 0:e.onTemplateChooserStatusChanged)==null||m.call(e,n,a,"visible")}const IC=Xt.default(nP,50);function oP(n){var o,r;const t=kf(n);if(!t)return;t.root.remove();const e=(o=n.options.componentsOptions)==null?void 0:o.templates;(r=e==null?void 0:e.onTemplateChooserStatusChanged)==null||r.call(e,n,null,"hide")}function rP(n){const t=n.blocks.root;if(t.length===0)return!0;if(t.length>5)return!1;const e=[...t];e[0].type==="text"&&e[0].heading&&e.splice(0,1);const o=r=>{var i;return r.type!=="text"&&r.type!=="list"?!1:r.text?((i=r.text)==null?void 0:i.length)===0:!0};return e.every(r=>o(r))}function yf(n,t){rP(n.doc.toJSON())?IC(n,t):(IC.cancel(),oP(n))}const iP=800;class sP{constructor(t){h(this,"longPressTimeout",0);h(this,"handleSelectionChange",()=>{});h(this,"handleLongPress",t=>{const e=t.touches[0],o=Tl(this.editor,e.clientX,e.clientY);!o||console.log(o)});h(this,"handleTouchStart",t=>{t.touches.length===1&&(this.longPressTimeout=window.setTimeout(()=>{this.handleLongPress(t)},iP))});h(this,"handleTouchEnd",t=>{this.longPressTimeout&&(window.clearTimeout(this.longPressTimeout),this.longPressTimeout=0)});this.editor=t,this.editor.addListener("selectionChanged",this.handleSelectionChange),document.addEventListener("touchstart",this.handleTouchStart),document.addEventListener("touchend",this.handleTouchEnd)}destroy(){this.editor.removeListener("selectionChanged",this.handleSelectionChange),document.removeEventListener("touchstart",this.handleTouchStart),document.removeEventListener("touchend",this.handleTouchEnd)}}class Ys{constructor(t,e){h(this,"_decrypted",!1);this.editor=t,this.blockData=e}get decrypted(){return this._decrypted||this.blockData.owner===this.editor.doc.getUser().userId}setDecrypted(){this._decrypted=!0}destroy(){}static getState(t,e){return t.addCustom(`encrypted-block-${e.id}`,()=>new Ys(t,e))}}const eU="",Bo=w("encrypted-block");function lP(n,t,e,o,r){const i=r,s=ro(o,"div"),l=Ys.getState(n,i);if(l.decrypted)n.createChildContainer(t,s,i.children[0]),A(o,"decrypted");else{A(o,"encrypted");const c=Rt(o),a=b("div",["password-container"],c),u=b("input",[],a);u.type="text",u.onkeydown=f=>{if(f.key==="Enter"){const m=u.value;if(i.password===Ei.default(`${i.owner}-${m}`)){l.setDecrypted(),n.reloadBlock(o);const C=Ld(n,n.getBlockById(i.id));C&&(n.selection.selectBlock(C,0),n.focus())}}}}return s}function cP(n,t,e,o){const r=document.elementsFromPoint(e,o)[0];if(!r||!t.contains(r)||!n.contains(t)||!bn(r))return null;const i=r;if(n.getBlockData(t).children[0]!==U(i))return null;const l=wt(t,U(i));return new Xe(n,{anchor:l,focus:l})}function aP(n,t,e,o){if(Ys.getState(n,n.getBlockData(t)).decrypted)return null;if(o==="ArrowDown"||o==="ArrowRight"){const s=dt(t);return s?P(s,W(n,s),"end"):P(t,1,"end")}const i=gt(t);return P(i||t,0,"home")}function dP(n,t){return n.getBoundingClientRect()}function uP(n,t,e,o){if(e.isSimple()){d(Bo,o.isSimple(),"from is simple position but to is not simple position"),Bo.debug("full select table"),A(t,"full-selected");return}d(Bo,!o.isSimple(),"from is complex position but end is simple position");const r=e,i=o;d(Bo,r.blockId===i.blockId,"only allow update one table selection"),d(Bo,r.childContainerId===i.childContainerId,"only one container");const s=n.getBlockData(t),l=n.getContainerById(s.children[0]);A(l,"selected")}function hP(n){n.rootContainer.querySelectorAll('[data-type="editor-block"][data-block-type="encrypted"]').forEach(t=>{z(t,"full-selected"),t.querySelectorAll("selected").forEach(e=>{z(e,"selected")})})}function fP(n,t){const e=n.getBlockData(t);return Ys.getState(n,e).decrypted?[n.getContainerById(e.children[0])]:[]}function mP(n,t,e,o,r){return null}function gP(n,t,e,o){d(Bo,e.blockId===o.blockId,"only allow select in single block"),d(Bo,q(t)===e.blockId,"only allow select in single block");const r=n.getBlockData(t);return d(Bo,e.childContainerId===r.children[0],"only one container"),[n.getContainerById(r.children[0])]}function pP(n){return{name:"EncryptedBlock",insertBlockCommandItems:[{id:"insert-encrypted-block",name:"Encrypted Block"}],async handleInsertEmptyBlock(t,e){const o=yn(t.doc),r={id:N(),type:"encrypted",children:[o],owner:t.doc.getUser().userId,ownerDisplayName:t.doc.getUser().displayName,password:Ei.default(`${t.doc.getUser().userId}-1234`)},i=t.doc.getContainerBlocks(o)[0];return t.insertBlock(e.containerId,e.blockIndex,r,At(t,i.id,0))}}}function CP(n,t,e,o){return o==="text"||o==="markdown"?"[Encrypted Block]":"<p>[Encrypted Block]</p>"}const bP={blockType:"encrypted",blockKind:"complex",enableKeyboardSelect:!0,createBlockContent:lP,getBlockTextLength:()=>1,getRangeFromPoint:cP,moveCaret:aP,getCaretRect:dP,updateSelection:uP,clearSelection:hP,getChildContainers:fP,getNextContainer:mP,getSelectedContainers:gP,getOptions:pP,convertTo:CP};function vP(n,t,e){const o=ts(n,t,{components:{blocks:[Ds,Rs,bP],decorators:[new Os],embeds:[ca,C1,H1,F1,z1,n1,U1,uf,df],boxes:[Fc],options:{...e.componentsOptions}}});return o.readonly=!0,o}class kP{constructor(t){this.createOptions=t}createHistoryEditor(t,e){return vP(t,e,this.createOptions)}}w("create-editor");function xC({root:n,childDoc:t,doc:e}){t.uploadResource=e.uploadResource.bind(e),t.buildResourceUrl=e.buildResourceUrl.bind(e);const o=ts(n,t,{shortcuts:[oc],components:{blocks:[Ds,Rs],decorators:[new Os],embeds:[B6,ca,C1,H1,F1,z1,n1,U1,uf,df],boxes:[Fc,vf],options:{}}});return o.input.addHandler(new Qc),o.input.addHandler(new V1(o)),o.input.addHandler(new P_(o)),o}function yP(n,t){const e=Array.from(n.rootContainer.querySelectorAll(`[comment-${t.toLocaleLowerCase()}="${t}"]`)),o=new Set;e.forEach(r=>{const i=F(r);i&&o.add(i)}),o.forEach(r=>{j_(n,r,t)})}class wP{constructor(t){h(this,"listeners",new Set);h(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 o=e.groupId;this.getComments().filter(i=>i.groupId===o).length===0&&yP(this.editor,o)}localUpdateComment(t,e){this.doc.localUpdateComment(t,e)}onCreateComment(t,e){Array.from(this.listeners.values()).forEach(o=>o.onCreateComment(t,e))}onDeleteComment(t,e){Array.from(this.listeners.values()).forEach(o=>o.onDeleteComment(t,e))}onUpdateComment(t,e){Array.from(this.listeners.values()).forEach(o=>o.onUpdateComment(t,e))}addListener(t){this.listeners.add(t)}removeListener(t){this.listeners.delete(t)}createCommentEditor(t,e){return xC({root:t,childDoc:e,doc:this.doc})}}class BP{constructor(t,e){h(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 Yu(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 xC({root:t,childDoc:e,doc:this.localDoc})}}const EP={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"},local:{readonlyTitle:"\u672A\u547D\u540D"}}},IP={placeholder:{common:{title:"Enter a title",readonlyTitle:"Enter a title",content:'Click "+", or enter "/" to insert components quickly'},local:{readonlyTitle:"Untitled"}}};T.mergeLang({"zh-CN":EP,"en-US":IP});const wf=w("create-editor"),TC=[ca,C1,H1,F1,z1,n1,U1,uf,df,B6,yC,IN];async function xP(n,t){var s,l,c,a,u,f,m,C,v,B,y,S;d(wf,n,"app does not exists"),t.lang&&T.setLang(t.lang);const e=t.onReauth?async()=>{var $;const I=t.user.userId,M=t.docId,R=await(($=t.onReauth)==null?void 0:$.call(t,I,M,t.permission));return{userId:I,docId:M,permission:t.permission,appId:t.appId,token:R,displayName:t.user.displayName,avatarUrl:t.user.avatarUrl}}:void 0,o={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},r=await fs.load(o),i=ts(n,r,{id:t.id,components:{blocks:[Ds,Rs,E1,u4],commandProviders:[new Bh,...((s=t.components)==null?void 0:s.commandProviders)||[]],decorators:[new Os,new Ku],embeds:[...TC,...((l=t.components)==null?void 0:l.embeds)||[]],boxes:[Fc,vf,U3,...((c=t.components)==null?void 0:c.boxes)||[]],insertions:[Kd],blockHooks:[new g6,...((a=t.components)==null?void 0:a.blockHooks)||[]],textRenders:[new $3,new aI],options:{...t.componentsOptions}},shortcuts:[nL,$M,d1,m3,dI,i1,oc],colors:["#338FE5","#24B47E","#F0A100","#E52727","#9678D3","#2CB2AE","#EB6414","#8AAB3F"]});if(i.editorCommandProviders.registerCommandProvider(new Ln(i)),i.input.addHandler(new D$),i.input.addHandler(new Qc),i.input.addHandler(new oT),i.input.addHandler(new LM),i.input.addHandler(new Ms(i,{headingLevel:1,titlePlaceholder:T.t("placeholder.common.title"),contentPlaceholder:T.t("placeholder.common.content"),readonlyTitlePlaceholder:T.t("placeholder.common.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),i.input.addHandler(new zc(i,(u=t.componentsOptions)==null?void 0:u.quickMenu)),i.input.addHandler(new V1(i)),i.input.addHandler(new i3(i)),i.input.addHandler(new JD),i.doc.registerCallback(new L$(i)),i.addCustom("remote-cursor",()=>new F2(i)),i.addCustom("block-menu",I=>new v6(I)),i.addCustom("editor-tooltip",()=>new r1(i)),t!=null&&t.enableComments&&i.addCustom("editor-comments",I=>new N3(I,new wP(I))),i.addCustom("create-options",()=>new Kf(i,t)),i.addCustom("drop-target",()=>new Hs(i)),i.addCustom("list-to-mindmap",()=>new Hc(i)),i.addCustom("list-to-mention",()=>new G$(i)),i.addCustom("mobile-helper",()=>new sP(i)),i.addCustom("code-caret",()=>new KD(i)),(f=t.componentsOptions)!=null&&f.mention){const I=t.componentsOptions.mention;i.addCustom("mention",()=>new z$(i,I))}if(i.addCustom("heading-collapse",()=>new I$(i)),Xr.register(i),Hs.register(i),mr.register(i),(C=(m=t.componentsOptions)==null?void 0:m.remoteCarets)!=null&&C.onUserChanged){const I=(B=(v=t.componentsOptions)==null?void 0:v.remoteCarets)==null?void 0:B.onUserChanged;i.doc.getRemoteUsers().on("change",M=>{I(i,M)})}return(S=(y=t.componentsOptions)==null?void 0:y.templates)!=null&&S.templates.length&&(i.addListener("docChanged",()=>{yf(i)}),i.addListener("resize",()=>{yf(i,{reset:!0})}),setTimeout(()=>{yf(i)},100)),i.doc.registerCallback({onError:async I=>{if(I.code==="ResetDoc"){wf.error(`reset doc: ${I.message}`);const M=await fs.load(o);i.doc.reset(M)}}}),i}function TP(n){return n.toJSON!==void 0}async function SP(n,t,e){var i,s,l;d(wf,n,"app does not exists");const o=TP(t)?t:new Ru(t,{serverUrl:e.serverUrl||""});e.lang&&T.setLang(e.lang);const r=ts(n,o,{id:e.id,components:{blocks:[Ds,Rs,E1,u4],commandProviders:[new Bh],decorators:[new Os,new Ku],embeds:[...TC,...((i=e.components)==null?void 0:i.embeds)||[]],boxes:[Fc,vf,U3],insertions:[Kd],blockHooks:[new g6,...((s=e.components)==null?void 0:s.blockHooks)||[]],textRenders:[new $3],options:{...e.componentsOptions}},shortcuts:[d1,m3,i1,oc]});return r.editorCommandProviders.registerCommandProvider(new Ln(r)),r.input.addHandler(new Qc),r.input.addHandler(new Ms(r,{headingLevel:1,titlePlaceholder:T.t("placeholder.common.title"),contentPlaceholder:T.t("placeholder.common.content"),readonlyTitlePlaceholder:T.t("placeholder.local.readonlyTitle"),addPlaceholderToAllCurrentEmptyBlock:!0})),r.input.addHandler(new zc(r,(l=e.componentsOptions)==null?void 0:l.quickMenu)),r.input.addHandler(new V1(r)),r.input.addHandler(new i3(r)),r.addCustom("block-menu",c=>new v6(c)),r.addCustom("editor-tooltip",()=>new r1(r)),e!=null&&e.enableComments&&r.addCustom("editor-comments",c=>new N3(c,new BP(c,o))),Xr.register(r),r}function DP(n,t){var l;const e=n.doc;if(!((l=e.getVersionHelper)==null?void 0:l.call(e)))throw new Error("the editor does not support to show versions");const r=n.getCustom("create-options");if(!r)throw new Error("the editor does not support to show versions");const i=r.getData(),s=new kP(i);return m$(n,s,t)}g.tippy=p7,g.AuthError=fc,g.AuthHeader=hs,g.AutoScroll=Am,g.BaseURLHeader=mc,g.BlockResizer=Yc,g.BrBox=up,g.CodeBlock=Rs,g.CodeLineBlock=E1,g.CodeTextDecorator=Os,g.DefaultShortcuts=oc,g.DocIdError=rw,g.DragDrop=um,g.DrawioEmbed=ca,g.EditorBlocks=Cg,g.EditorBoxes=fp,g.EditorCommandProviders=n2,g.EditorComplexBlockPosition=Je,g.EditorComplexSelectionRange=Xe,g.EditorDecorators=Cp,g.EditorEmbeds=vg,g.EditorInsertions=pp,g.EditorSimpleBlockPosition=qt,g.EditorSimpleSelectionRange=ce,g.EmbedBlock=yg,g.EnforceWithDocumentTitleHandler=Ms,g.EventCallbacks=xi,g.FILL_CHAR=Rb,g.FileExtError=iw,g.HeadingBlockScrollListener=F$,g.InputtingInsertion=mp,g.LocalDoc=Ru,g.Logger=br,g.MIN_DISTANCE_THRESHOLD=am,g.ManualMenu=tr,g.ManualToolbar=ps,g.MarkdownInputHandler=Qc,g.MaxUserError=Vu,g.OnesEditorAutoSuggest=mh,g.OnesEditorCustomDataWrapper=Kf,g.OnesEditorHoveringBlock=Nt,g.OnesEditorQuickMenu=zc,g.OnesEditorToc=Zs,g.OnesEditorTocProvider=mr,g.OnesEditorToolbar=Xr,g.OnesEditorTooltip=r1,g.PermissionError=ow,g.Popup=ms,g.RemoteCarets=F2,g.RemoteCaretsDecorator=Ku,g.RemoteCaretsInsertion=Kd,g.RemoteUsers=ic,g.RequestReloadError=us,g.RichText=ie,g.ShareDBDoc=fs,g.SimpleCache=Xf,g.StandardEmbedBlockCommands=g1,g.TEXT_STYLE_BACKGROUND_COLOR_PREFIX=Ud,g.TEXT_STYLE_COLOR_PREFIX=zd,g.TableBlock=Ds,g.TableBlockCommandProvider=Bh,g.TableShortcuts=d1,g.TextBlock=ve,g.TextBox=dp,g.TextStyleShortcuts=i1,g.TocEmbed=yC,g.ZERO_WIDTH_SPACE_CHAR=Ti,g.addAttribute=Ol,g.addClass=A,g.addCommentToBlock=m1,g.addDays=i8,g.addMonths=r8,g.animateScrollTo=td,g.applyPlaceholderToBlock=Kc,g.assert=d,g.blockToDoc=xu,g.blockToHtml=eu,g.blockToMarkdown=nu,g.blockToText=ql,g.blocksToDoc=qv,g.clearAllSelection=lg,g.clientType=xt,g.cloneBlock=ao,g.cloneChildContainer=hu,g.cloneDoc=fu,g.cloneText=tp,g.commentToShareDbComment=Qu,g.compareElement=fl,g.comparePosition=Sd,g.complexBlockAdjustSelectionPos=xl,g.complexBlockFindNearestChildBlock=Ig,g.complexBlockGeFirstSimpleChild=Ld,g.complexBlockGetAllChildContainers=Se,g.complexBlockGetBottomChildContainers=Eg,g.complexBlockGetLastSimpleChild=Ni,g.complexBlockGetSelectedContainers=xr,g.complexBlockGetTopChildContainers=Bg,g.containerToDoc=R0,g.continuousScroll=Rm,g.convertBlockFrom=Oi,g.copyBlockAttributes=Lp,g.createBlockAnchor=zo,g.createBlockCaretAnchor=Dg,g.createBlockContentElement=ro,g.createBlockElement=zm,g.createBlockSimpleDocRange=Fl,g.createBlockSimpleRange=At,g.createBoxContentElement=qm,g.createBoxElement=Um,g.createBoxOp=qg,g.createChildContainer=rg,g.createComplexBlockPosition=wt,g.createComplexDocPos=sp,g.createComplexDocRange=_b,g.createContainer=op,g.createContainerElement=bd,g.createDeleteOps=Fg,g.createEditor=ts,g.createEditorSelectionRange=Wt,g.createElement=b,g.createEmptyContainer=yn,g.createEmptyDoc=Zo,g.createEmptyTextBlockData=Pl,g.createExpandedRange=ul,g.createIconButton=vr,g.createImage=tm,g.createInsertOps=Al,g.createInsertionContentElement=Zm,g.createInsertionElement=Wm,g.createLocalEditor=SP,g.createOnesEditor=xP,g.createRange=em,g.createRichText=Go,g.createRootContainer=og,g.createSimpleBlockPosition=P,g.createSimpleDocPos=ip,g.createTextBlockData=zn,g.createTextButton=sr,g.createTextOp=$e,g.createTextWithReplaceSoftReturn=Pd,g.daysAfter=ad,g.deleteText=Hd,g.diffDays=s8,g.disablePageScroll=Im,g.docToHtml=Ep,g.docToHtmlFragment=Vi,g.docToMarkdown=qi,g.docToText=Wl,g.downloadObjectToFile=_1,g.downloadSvgToString=I6,g.editLink=Rc,g.editorAddComment=F_,g.editorAddTextAttribute=Fp,g.editorAutoInsertBlock=Mp,g.editorBreakTextBlock=Rr,g.editorClearCompositionText=Dp,g.editorClearSelectedContents=du,g.editorCopyBlock=nc,g.editorDeleteBlock=cu,g.editorDeleteBlockText=iu,g.editorDeleteBlockWithoutChildren=lu,g.editorDeleteChildContainer=Iv,g.editorDeleteChildContainers=Rp,g.editorFocusToBlock=uu,g.editorFocusToEnd=L0,g.editorGetBlockData=co,g.editorGetBlockText=ue,g.editorGetBlockTextEx=Ul,g.editorGetBoxData=cp,g.editorHandleKeyboardEvent=$0,g.editorInsertBlock=Mr,g.editorInsertBoxToBlock=Tp,g.editorInsertDoc=jp,g.editorInsertDocAt=mu,g.editorInsertText=ru,g.editorInsertTextToBlock=xp,g.editorInsertTextToBlockEx=ou,g.editorMergeTextBlock=Ap,g.editorMoveDown=Xp,g.editorMoveEnd=a0,g.editorMoveHome=d0,g.editorMoveLeft=Qp,g.editorMoveLineEnd=b0,g.editorMoveLineHome=C0,g.editorMovePageDown=E0,g.editorMovePageUp=B0,g.editorMoveRight=Kp,g.editorMoveUp=Jp,g.editorMoveWordEnd=s0,g.editorMoveWordLeft=i0,g.editorRangeClearColor=Up,g.editorRangeGetColor=gu,g.editorRangeSetColor=zp,g.editorRemoveTextAttribute=Sv,g.editorReplaceBlockText=Kl,g.editorReplaceContainer=Hp,g.editorRunOnce=Au,g.editorSelectAll=D0,g.editorSelectContainer=Eu,g.editorSelectDown=t0,g.editorSelectEnd=wu,g.editorSelectHome=u0,g.editorSelectLeft=e0,g.editorSelectLineEnd=p0,g.editorSelectLineHome=g0,g.editorSelectPageDown=x0,g.editorSelectPageUp=I0,g.editorSelectRight=n0,g.editorSelectUp=o0,g.editorSelectWordEnd=c0,g.editorSelectWordLeft=l0,g.editorSetTextColor=Ar,g.editorShowFindDialog=ZO,g.editorUpdateBlockData=Jl,g.editorUpdateCompositionText=Sp,g.editorUpdateEmbedData=$p,g.enablePageScroll=xm,g.escapeHtmlText=sm,g.escapeRegExp=hd,g.escapeSpace=F7,g.executeBlockCommand=pg,g.executeEmbedBlockCommand=gg,g.executeRangeCommand=e2,g.fileToDataUrl=pl,g.findAfterOffsetNotType=Zd,g.findAllText=Wd,g.findInsertionById=Gm,g.findNextOffset=Jb,g.findPrevOffset=Kb,g.findPrevOffsetNotType=Gd,g.findPrevSimpleBlockBeforeChildContainer=wg,g.findTarget=Di,g.findWordEnd=Qd,g.findWordLeft=Yd,g.format=cd,g.formatBytes=Om,g.formatDate=$m,g.fragmentToHtml=Tm,g.fromBase64=gl,g.fromBase64ToBlob=wm,g.fromBase64ToUint8Array=X7,g.fromDocRange=io,g.fromNowString=ud,g.genId=N,g.getAllChildBlocks=Rd,g.getAllQuickMenuItems=o1,g.getAllSelectedBlocks=tn,g.getAttributesAt=Nl,g.getBlockBackground=Fm,g.getBlockByIndex=kr,g.getBlockCaretRect=Ke,g.getBlockClass=bt,g.getBlockClassByType=Er,g.getBlockClientRects=Ho,g.getBlockCommandsWithHook=Ed,g.getBlockContent=it,g.getBlockId=q,g.getBlockIndex=J,g.getBlockKind=Qe,g.getBlockMinWidth=ag,g.getBlockNearestRangeFromPoint=Tg,g.getBlockOptions=p8,g.getBlockPath=jo,g.getBlockProperties=hg,g.getBlockRangeFromPoint=Tl,g.getBlockStyles=m8,g.getBlockTextLength=W,g.getBlockTools=Rt,g.getBlockType=rt,g.getBoxContent=gd,g.getBoxId=Vm,g.getBoxTypeFromElement=Ri,g.getChildBlockCount=Ge,g.getChildBlocks=Mt,g.getChildOffset=so,g.getColorFromAttributes=qd,g.getComplexBlockClass=xe,g.getContainerBlockPath=tg,g.getContainerBlocks=Jm,g.getContainerBlocksElement=El,g.getContainerById=Br,g.getContainerId=U,g.getContainerMinWidth=wd,g.getContainerToolsElement=a8,g.getContainerWidth=ug,g.getDistanceSquare=Cn,g.getElementOffset=Si,g.getEmbedType=Oe,g.getExistsBlockTools=Bl,g.getExistsContainerById=Qm,g.getFileExt=Dm,g.getFirstChildBlock=Vt,g.getFirstClientRect=hl,g.getHeadingMenuOptions=Kh,g.getHorizontalPadding=Qa,g.getInsertionContent=pd,g.getLastChildBlock=Qt,g.getLastClientRect=Mo,g.getListAllNextBrothers=Is,g.getLogger=w,g.getNextBlock=dt,g.getNextValidOffset=Vo,g.getNextVisibleBlock=wr,g.getOffsetInfoAfter=Ui,g.getOffsetInfoBefore=Vl,g.getOpAt=Gg,g.getOpLength=Fd,g.getParentBlock=F,g.getParentBox=md,g.getParentContainer=H,g.getPrevBlock=gt,g.getPrevValidOffset=lo,g.getPrevVisibleBlock=yr,g.getRangeCommands=X0,g.getRootBlock=yd,g.getScrollContainer=We,g.getSpecialBlockCommands=fg,g.getStandardEmbedBlockProperties=p1,g.getTextAfterOffset=Yb,g.getTextBeforeOffset=Qb,g.getTextBlockChild=Sl,g.getTextBlockClass=sg,g.getTextBlockContentChildTextLength=Ne,g.getTextBlockContentChildType=Sg,g.getTextBlockContentChildren=Fn,g.getTextLength=de,g.getTextOpLength=Ad,g.getTextWidth=bl,g.getToolbar=Mc,g.handleBlockElementUpdated=dg,g.hasAltOnly=G7,g.hasClass=nt,g.hasCtrlOrCmd=bm,g.hasCtrlOrCmdOnly=W7,g.hideBlock=jm,g.htmlToFragment=Cl,g.i18n=T,g.injectStyle=cm,g.insertEmptyBlock=b8,g.insertEmptyEmbedBlock=Id,g.insertText=Sr,g.intersectionCommands=Kk,g.isBackspace=km,g.isBlock=Po,g.isBox=fd,g.isCJK=gm,g.isChildContainer=Ye,g.isChildNode=It,g.isCollapsedRange=Ob,g.isComplexBlockPosition=Td,g.isComplexKindBlock=at,g.isContainer=bn,g.isContainerSelectedAllChildBlocks=T0,g.isControlEvent=Oo,g.isDelete=Y7,g.isDraggingFiles=kl,g.isEmbedBlock=Te,g.isEmptyContainer=Bd,g.isEmptyDoc=jl,g.isEmptyTextBlock=Tt,g.isEmptyTextBlockWithoutCompositionText=Ls,g.isEnterOnly=vm,g.isEscape=id,g.isFirefox=od,g.isFirstChildBlockInComplexBlock=W8,g.isHighSurrogate=_7,g.isInBlock=Cd,g.isInBlockTools=Ai,g.isLetter=mm,g.isLowSurrogate=Ya,g.isMatchShortcut=Pn,g.isMoveForward=V7,g.isNavigationEvent=U7,g.isNavigationKey=Cm,g.isNodeRemoved=om,g.isNumber=fm,g.isPrintableKey=rd,g.isRootBlock=Ko,g.isRootContainer=pt,g.isSafari=pm,g.isSameDay=dd,g.isShiftEnter=Z7,g.isShiftTab=K7,g.isShortcutEvent=q7,g.isSimpleBlock=g8,g.isSimpleBlockPosition=Ir,g.isSimplePos=rp,g.isSimpleRange=Hl,g.isSpace=ml,g.isTab=Q7,g.isTextBlockContentBoxChild=_e,g.isTextBlockContentChild=$i,g.isTextBlockContentInsertionChild=Hn,g.isTextBlockContentTextChild=Pi,g.isTextKindBlock=j,g.isTextKindBlockType=_i,g.isToday=_m,g.isValidOffset=re,g.isVisibleBlock=wl,g.isYesterday=Nm,g.loadJs=rm,g.loadJsPromise=Ro,g.lockers=qe,g.mergeCommands=Lc,g.mergeDocs=Yo,g.mergeOps=jd,g.mergeText=Sb,g.multiSplitText=Rg,g.parseShortcut=ym,g.patchNode=Mi,g.pointInRect=Ao,g.rangeAddAttribute=_l,g.rangeGetTextColor=Xg,g.rangeRemoveAttribute=Dr,g.rangeSetTextColor=Qg,g.rangeTransformText=Zg,g.registerDragDrop=ed,g.removeAttribute=Vd,g.removeClass=z,g.removeLastBr=Eb,g.removePlaceholderFromBlock=V4,g.removeStyle=lm,g.replaceAll=l8,g.replaceAllCaseInsensitive=c8,g.replaceAllText=np,g.replaceText=$l,g.requestDownload=yl,g.resetListStart=Ts,g.scrollable=Mm,g.selectFile=No,g.selectedBlockToDoc=tc,g.selectionToDoc=Ji,g.setAttributes=Ja,g.setClipboardData=vl,g.setClipboardDataByEvent=o8,g.setColorToAttributes=Kg,g.setDataset=Ka,g.setDefaultCursor=Li,g.setStyles=Xa,g.shareDBCommentToDocObject=Yu,g.shareDBDocCommentToComment=j2,g.shortcutToDisplayText=J7,g.showBlock=Hm,g.showDocVersions=DP,g.splitText=be,g.splitToThree=Gt,g.stringToDataUrl=Bm,g.stringToObjectUrl=ld,g.subText=Ag,g.textNodeOffsetFromPoint=nm,g.toBase64URL=_o,g.toPlainText=vt,g.trimChar=nd,g.unicodeLength=N7,g.unicodeSubstr=$7,g.updateBlockSelection=cg,g.updateOpAttributes=ep,g.updateTextBlockContent=Zb,g.updateUrl=sd,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/types.d.ts
CHANGED