const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('text', '', 'js/MarkdownContentEditor-BwTzyQSN.chunk.mjs'),window.OC.filePath('text', '', 'js/Wrapper-obocs1sV.chunk.mjs'),window.OC.filePath('text', '', 'js/NcLoadingIcon-Bdu4Z_fo.chunk.mjs'),window.OC.filePath('text', '', 'js/vue.runtime.esm-CbNPNm8f.chunk.mjs'),window.OC.filePath('text', '', 'js/emoji-picker-hi3Hwbeu.chunk.mjs'),window.OC.filePath('text', '', 'js/index-xQwnxqUU.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DxwFe63_.chunk.mjs'),window.OC.filePath('text', '', 'css/NcLoadingIcon-KhuNWNbx.chunk.css'),window.OC.filePath('text', '', 'js/logger-DrmDPXkr.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DtbbSwig.chunk.mjs'),window.OC.filePath('text', '', 'js/index-D3wiQe9-.chunk.mjs'),window.OC.filePath('text', '', 'js/preload-helper-BorfeO-5.chunk.mjs'),window.OC.filePath('text', '', 'js/NcCheckboxRadioSwitch-D4IV4zWy-Bb19W4wJ.chunk.mjs'),window.OC.filePath('text', '', 'css/NcCheckboxRadioSwitch-D4IV4zWy-CFjpafPM.chunk.css'),window.OC.filePath('text', '', 'js/NcNoteCard-CwNXZ4vV-CPnkYq5v.chunk.mjs'),window.OC.filePath('text', '', 'css/NcNoteCard-CwNXZ4vV-Cyx11ynf.chunk.css'),window.OC.filePath('text', '', 'js/MediaHandler.provider-BUbYNN83.chunk.mjs'),window.OC.filePath('text', '', 'css/Wrapper-CNQWYaBa.chunk.css'),window.OC.filePath('text', '', 'js/MenuBar-BBhgnV0-.chunk.mjs'),window.OC.filePath('text', '', 'css/MenuBar-B9oARRUR.chunk.css'),window.OC.filePath('text', '', 'css/RichTextReader-Dh2MlJRZ.chunk.css'),window.OC.filePath('text', '', 'js/Editor-Cr_YdjKk.chunk.mjs'),window.OC.filePath('text', '', 'js/dav-BTwUt5Rb.chunk.mjs'),window.OC.filePath('text', '', 'css/Editor-CNbK6O9y.chunk.css'),window.OC.filePath('text', '', 'js/PlainTableContentEditor-DupQNxsY.chunk.mjs')])))=>i.map(i=>d[i]);
import{_ as C}from"./preload-helper-BorfeO-5.chunk.mjs";import{s as y,e as M}from"./index-xQwnxqUU.chunk.mjs";import{d as f,V as g}from"./vue.runtime.esm-CbNPNm8f.chunk.mjs";import{o as j,H as B,A as H,O as R,a as V,b as D,E as F,c as Y}from"./MediaHandler.provider-BUbYNN83.chunk.mjs";import"./emoji-picker-hi3Hwbeu.chunk.mjs";import"./index-D3wiQe9-.chunk.mjs";import"./index-DxwFe63_.chunk.mjs";import"./logger-DrmDPXkr.chunk.mjs";import"./index-DtbbSwig.chunk.mjs";function O(p){return encodeURIComponent(p).replace(/[!'()*]/g,t=>"%"+t.charCodeAt(0).toString(16).toUpperCase())}const N="1.4";window.OCA.Text={...window.OCA.Text};class b{#t;#o;constructor(t,e){return this.#t=t,this.#o=e,this.#n(),this}#e(){return this.#t.$children[0]}onCreate(t=()=>{}){return this.#t.$on("create:content",e=>{t(e)}),this}onLoaded(t=()=>{}){return this.#t.$on("ready",()=>{t()}),this}onUpdate(t=()=>{}){return this.#t.$on("update:content",e=>{t(e)}),this}onSearch(t=()=>{}){return y("text:editor:search-results",t),this}onTocToggle(t=()=>{}){return y("text:toc:toggled",t),this}onTocPin(t=()=>{}){return y("text:toc:pin",t),this}onAttachmentsUpdated(t=()=>{}){return y("text:editor:attachments:updated",t),this}render(t){t.innerHTML="";const e=document.createElement("div");return t.appendChild(e),this.#t.$mount(e),this}destroy(){this.#t.$destroy(),this.#t.$el.innerHTML=""}setContent(t){return this.#t.$set(this.#o,"content",t),this.#e()?.setContent?.(t),this}getHTML(){return this.#e()?.editor?.getHTML()}setSearchQuery(t,e){this.#e()?.editor?.commands.setSearchQuery(t,e)}searchNext(){this.#e()?.editor?.commands.nextMatch()}searchPrevious(){this.#e()?.editor?.commands.previousMatch()}async save(){return this.#e().save?.()}setShowOutline(t){return M("text:toc:toggle",{visible:t}),this}setReadOnly(t){return this.#t.$set(this.#o,"readOnly",t),this}updateReadonlyBarProps(t){return this.#t.$set(this.#o,"readonlyBarProps",t),this}insertAtCursor(t){this.#e().editor?.chain().insertContent(t).focus().run()}replaceAttachmentFilename(t,e,r){const s=".attachments."+t+"/"+O(e),i=".attachments."+t+"/"+O(r),{view:d,state:a}=this.#e().editor,{doc:o,schema:c,tr:n}=a;let h=!1;o.descendants((m,v)=>{!m.type===c.nodes.image||m.attrs.src!==s||(n.setNodeMarkup(v,void 0,{...m.attrs,src:i,alt:m.attrs.alt.replace(e,r)}),h=!0)}),h&&(d.dispatch(n),this.save())}removeAttachmentReferences(t,e){const r=".attachments."+t+"/"+O(e),{view:s,state:i}=this.#e().editor,{doc:d,schema:a,tr:o}=i;let c=!1;d.descendants((n,h)=>{!n.type===a.nodes.image||n.attrs.src!==r||(o.delete(h,h+n.nodeSize),c=!0)}),c&&(s.dispatch(o),this.save())}focus(){this.#e().editor?.commands.focus()}debugYjs(){const t=this.#e().debugYjsData();console.warn(JSON.stringify(t,null," ")),console.warn(`%c%s
%c%s
%s`,"font-weight: bold;",'Editor Yjs debug data. Copy the object below that starts with "clientId".',"font-weight: normal; font-style: italic;",'- In Chrome, select "Copy" at the end of the line.','- In Firefox, right-click on the object and select "Copy object".')}#n(){window?._oc_debug&&(this.vm=this.#t,window.OCA.Text._debug=[...window.OCA.Text._debug??[],this])}}window.OCA.Text.apiVersion=N,window.OCA.Text.createEditor=async function({el:p,fileId:t=void 0,useSession:e=!0,filePath:r=void 0,shareToken:s=null,content:i="",readOnly:d=!1,autofocus:a=!0,readonlyBar:o={component:null,props:null},menubarLinkCustomAction:c=void 0,onCreate:n=({markdown:l})=>{},onLoaded:h=()=>{},onUpdate:m=({markdown:l})=>{},onTocToggle:v=l=>{},onOutlineToggle:x=l=>{},onTocPin:L=(l,_)=>{},onFileInsert:P=void 0,onMentionSearch:k=void 0,onMentionInsert:S=void 0,openLinkHandler:I=void 0,onSearch:E=void 0,onAttachmentsUpdated:U=({attachmentSrcs:l})=>{}}){const l=f(()=>C(()=>import("./MarkdownContentEditor-BwTzyQSN.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]),import.meta.url)),_=f(()=>C(()=>import("./Editor-Cr_YdjKk.chunk.mjs").then(u=>u.a),__vite__mapDeps([21,11,5,4,22,6,10,3,9,2,7,1,8,12,13,14,15,16,17,18,19,23]),import.meta.url)),w=g.observable({readonlyBarProps:o.props,readOnly:d,content:i}),A=t&&e,$=new g({provide(){return{[Y]:P,[F]:!!A,[D]:k,[V]:S,[R]:{openLink:I||j},[H]:{resolve(u,T){return[{type:"image",url:u}]}},[B]:c}},data(){return w},render:u=>{const T=o?.component?{readonlyBar:()=>u(o.component,{props:w.readonlyBarProps})}:{};return A?u(_,{props:{fileId:t,relativePath:r,shareToken:s,mime:"text/markdown",active:!0,autofocus:a},scopedSlots:T}):u(l,{props:{fileId:t,content:w.content,relativePath:r,shareToken:s,readOnly:w.readOnly},scopedSlots:T})}});return new b($,w).onCreate(n).onLoaded(h).onUpdate(m).onSearch(E).onTocToggle(x).onTocToggle(v).onTocPin(L).onAttachmentsUpdated(U).render(p)},window.OCA.Text.createTable=async function({el:p,content:t="",readOnly:e=!1,autofocus:r=!0,onCreate:s=({markdown:a})=>{},onLoaded:i=()=>{},onUpdate:d=({markdown:a})=>{}}){const a=f(()=>C(()=>import("./PlainTableContentEditor-DupQNxsY.chunk.mjs"),__vite__mapDeps([24,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,20]),import.meta.url)),o=g.observable({readOnly:e,content:t}),c=new g({data(){return o},render:n=>n(a,{props:{content:o.content,readOnly:o.readOnly}})});return new b(c,o).onCreate(s).onLoaded(i).onUpdate(d).render(p)};
//# sourceMappingURL=text-editor.mjs.map
