0||D.length>0||C.length>0)&&s.emit("change",[{added:m,updated:D,removed:C},o]),(m.length>0||c.length>0||C.length>0)&&s.emit("update",[{added:m,updated:c,removed:C},o])},p1=s=>{const i=M0.getState(s).undoManager;if(i!=null)return i.undo(),!0},g1=s=>{const i=M0.getState(s).undoManager;if(i!=null)return i.redo(),!0},A1=new Set(["paragraph"]),M1=(s,i)=>!(s instanceof D6)||!(s.content instanceof E6)||!(s.content.type instanceof p6||s.content.type instanceof g6&&i.has(s.content.type.nodeName))||s.content.type._length===0,C1=({protectedNodes:s=A1,trackedOrigins:i=[],undoManager:o=null}={})=>new Qr({key:M0,state:{init:(a,h)=>{const m=pt.getState(h),c=o||new h6(m.type,{trackedOrigins:new Set([pt].concat(i)),deleteFilter:D=>M1(D,s),captureTransaction:D=>D.meta.get("addToHistory")!==!1});return{undoManager:c,prevSel:null,hasUndoOps:c.undoStack.length>0,hasRedoOps:c.redoStack.length>0}},apply:(a,h,m,c)=>{const D=pt.getState(c).binding,C=h.undoManager,p=C.undoStack.length>0,M=C.redoStack.length>0;return D?{undoManager:C,prevSel:c6(D,m),hasUndoOps:p,hasRedoOps:M}:p!==h.hasUndoOps||M!==h.hasRedoOps?Object.assign({},h,{hasUndoOps:C.undoStack.length>0,hasRedoOps:C.redoStack.length>0}):h}},view:a=>{const h=pt.getState(a.state),m=M0.getState(a.state).undoManager;return m.on("stack-item-added",({stackItem:c})=>{const D=h.binding;D&&c.meta.set(D,M0.getState(a.state).prevSel)}),m.on("stack-item-popped",({stackItem:c})=>{const D=h.binding;D&&(D.beforeTransactionSelection=c.meta.get(D)||D.beforeTransactionSelection)}),{destroy:()=>{m.destroy()}}}}),L1=Xr.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(s=>s.name==="history")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-history".')},addCommands(){return{undo:()=>({tr:s,state:i,dispatch:o})=>(s.setMeta("preventDispatch",!0),M0.getState(i).undoManager.undoStack.length===0?!1:o?p1(i):!0),redo:()=>({tr:s,state:i,dispatch:o})=>(s.setMeta("preventDispatch",!0),M0.getState(i).undoManager.redoStack.length===0?!1:o?g1(i):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){var s;const i=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),o=C1(this.options.yUndoOptions),a=o.spec.view;o.spec.view=c=>{const{undoManager:D}=M0.getState(c.state);D.restore&&(D.restore(),D.restore=()=>{});const C=a?a(c):void 0;return{destroy:()=>{const p=D.trackedOrigins.has(D),M=D._observers;D.restore=()=>{p&&D.trackedOrigins.add(D),D.doc.on("afterTransaction",D.afterTransactionHandler),D._observers=M},C!=null&&C.destroy&&C.destroy()}}};const h={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},m=A6(i,h);return this.editor.options.enableContentCheck&&((s=i.doc)===null||s===void 0||s.on("beforeTransaction",()=>{try{const c=M6(i);if(c.content.length===0)return;this.editor.schema.nodeFromJSON(c).check()}catch(c){return this.editor.emit("contentError",{error:c,editor:this.editor,disableCollaboration:()=>{var D;(D=i.doc)===null||D===void 0||D.destroy(),this.storage.isDisabled=!0}}),!1}})),[m,o,this.editor.options.enableContentCheck&&new Qr({key:new C6("filterInvalidContent"),filterTransaction:()=>{var c;return this.storage.isDisabled&&((c=i.doc)===null||c===void 0||c.destroy()),!0}})].filter(Boolean)}}),y1=Xr.create({addOptions(){return{fileId:null}},addStorage(){return{started:!1}},onCreate(){if(this.options.fileId===null)throw new Error("fileId needs to be provided");this.storage.started=!0},onSelectionUpdate({editor:s}){if(!this.storage.started)return;const i=s.state.selection.$anchor.pos;sessionStorage.setItem("text-lastPos-"+this.options.fileId,i)},addCommands(){return{autofocus:()=>({commands:s,editor:i})=>{const o=sessionStorage.getItem("text-lastPos-"+this.options.fileId);return o?s.focus(o):s.focus("start")}}}});function Ia(s){const i=new Uint8Array(s);return uo(i)}function Da(s){return eo(s)}const mo=0,xt=1,Ra=2,Ea=(s,i)=>{X(s,mo);const o=to(i);C0(s,o)},ho=(s,i,o)=>{X(s,xt),C0(s,It(i,o))},f1=(s,i,o)=>ho(i,o,ja(s)),co=(s,i,o)=>{try{so(i,ja(s),o)}catch(a){console.error("Caught error while handling a Yjs update",a)}},Do=(s,i)=>{X(s,Ra),C0(s,i)},B1=co,Ui=(s,i,o,a)=>{const h=Ae(s);switch(h){case mo:f1(s,i,o);break;case xt:co(s,o,a);break;case Ra:B1(s,o,a);break;default:throw new Error("Unknown message type")}return h},Eo=new Map;class Y1{constructor(i){this.room=i,this.onmessage=null,this._onChange=o=>o.key===i&&this.onmessage!==null&&this.onmessage({data:eo(o.newValue||"")}),f6(this._onChange)}postMessage(i){B6.setItem(this.room,uo(Y6(i)))}close(){F6(this._onChange)}}const F1=typeof BroadcastChannel>"u"?Y1:BroadcastChannel,Va=s=>L6(Eo,s,()=>{const i=y6(),o=new F1(s);return o.onmessage=a=>i.forEach(h=>h(a.data,"broadcastchannel")),{bc:o,subs:i}}),v1=(s,i)=>(Va(s).subs.add(i),i),k1=(s,i)=>{const o=Va(s),a=o.subs.delete(i);return a&&o.subs.size===0&&(o.bc.close(),Eo.delete(s)),a},me=(s,i,o=null)=>{const a=Va(s);a.bc.postMessage(i),a.subs.forEach(h=>h(i,o))},T1=0,b1=(s,i,o)=>{switch(Ae(s)){case T1:o(i,Kr(s))}},x1=s=>v6(s,(i,o)=>"".concat(encodeURIComponent(o),"=").concat(encodeURIComponent(i))).join("&"),A0=0,po=3,Me=1,w1=2,Ie=[];Ie[A0]=(s,i,o,a,h)=>{X(s,A0);const m=k6(i),c=Ui(i,s,o.doc,o);a&&((c===xt||c===Ra)&&Ui(m,du(),o.remote,o),c===xt&&!o.synced&&(o.synced=!0))},Ie[po]=(s,i,o,a,h)=>{X(s,Me),C0(s,Re(o.awareness,[o.doc.clientID]))},Ie[Me]=(s,i,o,a,h)=>{E1(o.awareness,ja(i),o)},Ie[w1]=(s,i,o,a,h)=>{b1(i,o.doc,(m,c)=>j1(o,c))};const Ji=3e4,j1=(s,i)=>console.warn("Permission denied to access ".concat(s.url,".\n").concat(i)),go=(s,i,o)=>{const a=Zr(i),h=du(),m=Ae(a),c=s.messageHandlers[m];return c?c(h,a,s,o,m):console.error("Unable to compute message"),h},Ao=s=>{if(s.shouldConnect&&s.ws===null){const i=new s._WS(s.url,s.protocols);i.binaryType="arraybuffer",s.ws=i,s.wsconnecting=!0,s.wsconnected=!1,s.synced=!1,i.onmessage=o=>{s.wsLastMessageReceived=O0();const a=go(s,new Uint8Array(o.data),!0);ao(a)>1&&i.send(ou(a))},i.onerror=o=>{s.emit("connection-error",[o,s])},i.onclose=o=>{s.emit("connection-close",[o,s]),s.ws=null,s.wsconnecting=!1,s.wsconnected?(s.wsconnected=!1,s.synced=!1,Pa(s.awareness,Array.from(s.awareness.getStates().keys()).filter(a=>a!==s.doc.clientID),s),s.emit("status",[{status:"disconnected"}])):s.wsUnsuccessfulReconnects++,setTimeout(Ao,T6(b6(2,s.wsUnsuccessfulReconnects)*100,s.maxBackoffTime),s)},i.onopen=()=>{s.wsLastMessageReceived=O0(),s.wsconnecting=!1,s.wsconnected=!0,s.wsUnsuccessfulReconnects=0,s.emit("status",[{status:"connected"}]);const o=du();if(X(o,A0),Ea(o,s.doc),i.send(ou(o)),s.awareness.getLocalState()!==null){const a=du();X(a,Me),C0(a,Re(s.awareness,[s.doc.clientID])),i.send(ou(a))}},s.emit("status",[{status:"connecting"}])}},Ns=(s,i)=>{const o=s.ws;s.wsconnected&&o&&o.readyState===o.OPEN&&o.send(i),s.bcconnected&&me(s.bcChannel,i,s)};class S1 extends Gr{constructor(i,o,a,{connect:h=!0,awareness:m=new D1(a),params:c={},protocols:D=[],WebSocketPolyfill:C=WebSocket,resyncInterval:p=-1,maxBackoffTime:M=2500,disableBc:F=!1}={}){for(super();i[i.length-1]==="/";)i=i.slice(0,i.length-1);this.serverUrl=i,this.bcChannel=i+"/"+o,this.maxBackoffTime=M,this.params=c,this.protocols=D,this.roomname=o,this.doc=a,this._WS=C,this.awareness=m,this.wsconnected=!1,this.wsconnecting=!1,this.bcconnected=!1,this.disableBc=F,this.wsUnsuccessfulReconnects=0,this.messageHandlers=Ie.slice(),this.remote=new Sa,this._synced=!1,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=h,this._resyncInterval=0,p>0&&(this._resyncInterval=setInterval(()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){const v=du();X(v,A0),Ea(v,a),this.ws.send(ou(v))}},p)),this._bcSubscriber=(v,B)=>{if(B!==this){const k=go(this,new Uint8Array(v),!1);ao(k)>1&&me(this.bcChannel,ou(k),this)}},this._updateHandler=(v,B,k)=>{if(B!==this){const G=to(this.remote),f=It(k,G),q=du();X(q,A0),Do(q,f),Ns(this,ou(q))}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:v,updated:B,removed:k},G)=>{const f=du();X(f,Me),C0(f,Re(m,[this.doc.clientID])),Ns(this,ou(f))},this._exitHandler=()=>{Pa(this.awareness,[a.clientID],"app closed")},Ni&&typeof Ee<"u"&&Ee.on("exit",this._exitHandler),m.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&Ji \n\t\t\t\t{{ syncError.data.data.error }}\n\t\t\t\t\n\t\t\t\t{{ t('text', 'Reload') }}\n\t\t\t \n\t\t\t\t{{ t('text', 'Document has been changed outside of the editor. The changes cannot be applied') }}\n\t\t\t \n\t\t\t\t{{ t('text', 'Document could not be loaded. Please check your internet connection.') }}\n\t\t\t\t{{ t('text', 'Reconnect') }}\n\t\t\t \n\t\t\t\t{{ t('text', 'Document idle for {timeout} minutes, click to continue editing', { timeout: IDLE_TIMEOUT }) }}\n\t\t\t\t{{ t('text', 'Reconnect') }}\n\t\t\t \n\t\t\t\t{{ t('text', 'This file is opened read-only as it is currently locked by {user}.', { user: lock.displayName }) }}\n\t\t\t \n\t\t\t\t{{ t('text', 'Last saved') }}: {{ lastSavedString }}\n\t\t\t 0||D.length>0||C.length>0)&&s.emit("change",[{added:m,updated:D,removed:C},o]),(m.length>0||c.length>0||C.length>0)&&s.emit("update",[{added:m,updated:c,removed:C},o])},y1=s=>{const i=M0.getState(s).undoManager;if(i!=null)return i.undo(),!0},f1=s=>{const i=M0.getState(s).undoManager;if(i!=null)return i.redo(),!0},B1=new Set(["paragraph"]),Y1=(s,i)=>!(s instanceof M6)||!(s.content instanceof C6)||!(s.content.type instanceof L6||s.content.type instanceof y6&&i.has(s.content.type.nodeName))||s.content.type._length===0,F1=({protectedNodes:s=B1,trackedOrigins:i=[],undoManager:o=null}={})=>new Qr({key:M0,state:{init:(a,h)=>{const m=pt.getState(h),c=o||new g6(m.type,{trackedOrigins:new Set([pt].concat(i)),deleteFilter:D=>Y1(D,s),captureTransaction:D=>D.meta.get("addToHistory")!==!1});return{undoManager:c,prevSel:null,hasUndoOps:c.undoStack.length>0,hasRedoOps:c.redoStack.length>0}},apply:(a,h,m,c)=>{const D=pt.getState(c).binding,C=h.undoManager,p=C.undoStack.length>0,M=C.redoStack.length>0;return D?{undoManager:C,prevSel:A6(D,m),hasUndoOps:p,hasRedoOps:M}:p!==h.hasUndoOps||M!==h.hasRedoOps?Object.assign({},h,{hasUndoOps:C.undoStack.length>0,hasRedoOps:C.redoStack.length>0}):h}},view:a=>{const h=pt.getState(a.state),m=M0.getState(a.state).undoManager;return m.on("stack-item-added",({stackItem:c})=>{const D=h.binding;D&&c.meta.set(D,M0.getState(a.state).prevSel)}),m.on("stack-item-popped",({stackItem:c})=>{const D=h.binding;D&&(D.beforeTransactionSelection=c.meta.get(D)||D.beforeTransactionSelection)}),{destroy:()=>{m.destroy()}}}}),v1=Xr.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(s=>s.name==="history")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-history".')},addCommands(){return{undo:()=>({tr:s,state:i,dispatch:o})=>(s.setMeta("preventDispatch",!0),M0.getState(i).undoManager.undoStack.length===0?!1:o?y1(i):!0),redo:()=>({tr:s,state:i,dispatch:o})=>(s.setMeta("preventDispatch",!0),M0.getState(i).undoManager.redoStack.length===0?!1:o?f1(i):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){var s;const i=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),o=F1(this.options.yUndoOptions),a=o.spec.view;o.spec.view=c=>{const{undoManager:D}=M0.getState(c.state);D.restore&&(D.restore(),D.restore=()=>{});const C=a?a(c):void 0;return{destroy:()=>{const p=D.trackedOrigins.has(D),M=D._observers;D.restore=()=>{p&&D.trackedOrigins.add(D),D.doc.on("afterTransaction",D.afterTransactionHandler),D._observers=M},C!=null&&C.destroy&&C.destroy()}}};const h={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},m=f6(i,h);return this.editor.options.enableContentCheck&&((s=i.doc)===null||s===void 0||s.on("beforeTransaction",()=>{try{const c=B6(i);if(c.content.length===0)return;this.editor.schema.nodeFromJSON(c).check()}catch(c){return this.editor.emit("contentError",{error:c,editor:this.editor,disableCollaboration:()=>{var D;(D=i.doc)===null||D===void 0||D.destroy(),this.storage.isDisabled=!0}}),!1}})),[m,o,this.editor.options.enableContentCheck&&new Qr({key:new Y6("filterInvalidContent"),filterTransaction:()=>{var c;return this.storage.isDisabled&&((c=i.doc)===null||c===void 0||c.destroy()),!0}})].filter(Boolean)}}),k1=Xr.create({addOptions(){return{fileId:null}},addStorage(){return{started:!1}},onCreate(){if(this.options.fileId===null)throw new Error("fileId needs to be provided");this.storage.started=!0},onSelectionUpdate({editor:s}){if(!this.storage.started)return;const i=s.state.selection.$anchor.pos;sessionStorage.setItem("text-lastPos-"+this.options.fileId,i)},addCommands(){return{autofocus:()=>({commands:s,editor:i})=>{const o=sessionStorage.getItem("text-lastPos-"+this.options.fileId);return o?s.focus(o):s.focus("start")}}}});function Ia(s){const i=new Uint8Array(s);return uo(i)}function Da(s){return eo(s)}const mo=0,xt=1,Ra=2,Ea=(s,i)=>{X(s,mo);const o=to(i);C0(s,o)},ho=(s,i,o)=>{X(s,xt),C0(s,It(i,o))},T1=(s,i,o)=>ho(i,o,ja(s)),co=(s,i,o)=>{try{so(i,ja(s),o)}catch(a){console.error("Caught error while handling a Yjs update",a)}},Do=(s,i)=>{X(s,Ra),C0(s,i)},b1=co,Ui=(s,i,o,a)=>{const h=Ae(s);switch(h){case mo:T1(s,i,o);break;case xt:co(s,o,a);break;case Ra:b1(s,o,a);break;default:throw new Error("Unknown message type")}return h},Eo=new Map;class x1{constructor(i){this.room=i,this.onmessage=null,this._onChange=o=>o.key===i&&this.onmessage!==null&&this.onmessage({data:eo(o.newValue||"")}),k6(this._onChange)}postMessage(i){T6.setItem(this.room,uo(b6(i)))}close(){x6(this._onChange)}}const w1=typeof BroadcastChannel>"u"?x1:BroadcastChannel,Va=s=>F6(Eo,s,()=>{const i=v6(),o=new w1(s);return o.onmessage=a=>i.forEach(h=>h(a.data,"broadcastchannel")),{bc:o,subs:i}}),j1=(s,i)=>(Va(s).subs.add(i),i),S1=(s,i)=>{const o=Va(s),a=o.subs.delete(i);return a&&o.subs.size===0&&(o.bc.close(),Eo.delete(s)),a},me=(s,i,o=null)=>{const a=Va(s);a.bc.postMessage(i),a.subs.forEach(h=>h(i,o))},H1=0,O1=(s,i,o)=>{switch(Ae(s)){case H1:o(i,Kr(s))}},P1=s=>w6(s,(i,o)=>"".concat(encodeURIComponent(o),"=").concat(encodeURIComponent(i))).join("&"),A0=0,po=3,Me=1,I1=2,Ie=[];Ie[A0]=(s,i,o,a,h)=>{X(s,A0);const m=j6(i),c=Ui(i,s,o.doc,o);a&&((c===xt||c===Ra)&&Ui(m,du(),o.remote,o),c===xt&&!o.synced&&(o.synced=!0))},Ie[po]=(s,i,o,a,h)=>{X(s,Me),C0(s,Re(o.awareness,[o.doc.clientID]))},Ie[Me]=(s,i,o,a,h)=>{L1(o.awareness,ja(i),o)},Ie[I1]=(s,i,o,a,h)=>{O1(i,o.doc,(m,c)=>R1(o,c))};const Ji=3e4,R1=(s,i)=>console.warn("Permission denied to access ".concat(s.url,".\n").concat(i)),go=(s,i,o)=>{const a=Zr(i),h=du(),m=Ae(a),c=s.messageHandlers[m];return c?c(h,a,s,o,m):console.error("Unable to compute message"),h},Ao=s=>{if(s.shouldConnect&&s.ws===null){const i=new s._WS(s.url,s.protocols);i.binaryType="arraybuffer",s.ws=i,s.wsconnecting=!0,s.wsconnected=!1,s.synced=!1,i.onmessage=o=>{s.wsLastMessageReceived=O0();const a=go(s,new Uint8Array(o.data),!0);ao(a)>1&&i.send(ou(a))},i.onerror=o=>{s.emit("connection-error",[o,s])},i.onclose=o=>{s.emit("connection-close",[o,s]),s.ws=null,s.wsconnecting=!1,s.wsconnected?(s.wsconnected=!1,s.synced=!1,Pa(s.awareness,Array.from(s.awareness.getStates().keys()).filter(a=>a!==s.doc.clientID),s),s.emit("status",[{status:"disconnected"}])):s.wsUnsuccessfulReconnects++,setTimeout(Ao,S6(H6(2,s.wsUnsuccessfulReconnects)*100,s.maxBackoffTime),s)},i.onopen=()=>{s.wsLastMessageReceived=O0(),s.wsconnecting=!1,s.wsconnected=!0,s.wsUnsuccessfulReconnects=0,s.emit("status",[{status:"connected"}]);const o=du();if(X(o,A0),Ea(o,s.doc),i.send(ou(o)),s.awareness.getLocalState()!==null){const a=du();X(a,Me),C0(a,Re(s.awareness,[s.doc.clientID])),i.send(ou(a))}},s.emit("status",[{status:"connecting"}])}},Ns=(s,i)=>{const o=s.ws;s.wsconnected&&o&&o.readyState===o.OPEN&&o.send(i),s.bcconnected&&me(s.bcChannel,i,s)};class V1 extends Gr{constructor(i,o,a,{connect:h=!0,awareness:m=new C1(a),params:c={},protocols:D=[],WebSocketPolyfill:C=WebSocket,resyncInterval:p=-1,maxBackoffTime:M=2500,disableBc:F=!1}={}){for(super();i[i.length-1]==="/";)i=i.slice(0,i.length-1);this.serverUrl=i,this.bcChannel=i+"/"+o,this.maxBackoffTime=M,this.params=c,this.protocols=D,this.roomname=o,this.doc=a,this._WS=C,this.awareness=m,this.wsconnected=!1,this.wsconnecting=!1,this.bcconnected=!1,this.disableBc=F,this.wsUnsuccessfulReconnects=0,this.messageHandlers=Ie.slice(),this.remote=new Sa,this._synced=!1,this.ws=null,this.wsLastMessageReceived=0,this.shouldConnect=h,this._resyncInterval=0,p>0&&(this._resyncInterval=setInterval(()=>{if(this.ws&&this.ws.readyState===WebSocket.OPEN){const v=du();X(v,A0),Ea(v,a),this.ws.send(ou(v))}},p)),this._bcSubscriber=(v,B)=>{if(B!==this){const k=go(this,new Uint8Array(v),!1);ao(k)>1&&me(this.bcChannel,ou(k),this)}},this._updateHandler=(v,B,k)=>{if(B!==this){const G=to(this.remote),f=It(k,G),q=du();X(q,A0),Do(q,f),Ns(this,ou(q))}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:v,updated:B,removed:k},G)=>{const f=du();X(f,Me),C0(f,Re(m,[this.doc.clientID])),Ns(this,ou(f))},this._exitHandler=()=>{Pa(this.awareness,[a.clientID],"app closed")},Ni&&typeof Ee<"u"&&Ee.on("exit",this._exitHandler),m.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&Ji \n\t\t\t\t{{ syncError.data.data.error }}\n\t\t\t\t\n\t\t\t\t{{ t('text', 'Reload') }}\n\t\t\t \n\t\t\t\t{{ t('text', 'Document has been changed outside of the editor. The changes cannot be applied') }}\n\t\t\t \n\t\t\t\t{{ t('text', 'Document could not be loaded. Please check your internet connection.') }}\n\t\t\t\t{{ t('text', 'Reconnect') }}\n\t\t\t \n\t\t\t\t{{ t('text', 'Document idle for {timeout} minutes, click to continue editing', { timeout: IDLE_TIMEOUT }) }}\n\t\t\t\t{{ t('text', 'Reconnect') }}\n\t\t\t \n\t\t\t\t{{ t('text', 'This file is opened read-only as it is currently locked by {user}.', { user: lock.displayName }) }}\n\t\t\t \n\t\t\t\t{{ t('text', 'Last saved') }}: {{ lastSavedString }}\n\t\t\t".concat(zi(s),"
");this.$editor.chain().setContent(a,o).command(({tr:h})=>(h.setMeta("addToHistory",o),!0)).run()},setInitialYjsState(s,{isRichEditor:i}){const o=i?bt.render(s)+"":"".concat(zi(s),"
"),a=i?bo():xo(),h=V6(o,a.options.extensions),m=W6.fromJSON(a.schema,h),c=It((D=>{const C=new Sa;C.clientID=0;const p=C.get("default",N6);return p.doc&&z6(D,p),C})(m));so(this.$ydoc,c)}}},yc={name:"CollisionResolveDialog",components:{NcButton:wa},mixins:[io,eh,wo,ro],props:{syncError:{type:Object,default:null}},data(){return{clicked:!1}},methods:{resolveThisVersion(){this.clicked=!0,this.$syncService.forceSave().then(()=>this.$syncService.syncUp()),this.$editor.setEditable(!this.readOnly)},resolveServerVersion(){const{outsideChange:s}=this.syncError.data;this.clicked=!0,this.$editor.setEditable(!this.readOnly),this.setContent(s,{isRichEditor:this.$isRichEditor}),this.$syncService.forceSave().then(()=>this.$syncService.syncUp())}}};var fc=function(){var s=this,i=s._self._c;return i("div",{staticClass:"collision-resolve-dialog",class:{"icon-loading":s.clicked},attrs:{id:"resolve-conflicts"}},[i("NcButton",{attrs:{disabled:s.clicked,"data-cy":"resolveThisVersion"},on:{click:s.resolveThisVersion}},[s._v(" "+s._s(s.t("text","Use current version"))+" ")]),i("NcButton",{attrs:{disabled:s.clicked,"data-cy":"resolveServerVersion"},on:{click:s.resolveServerVersion}},[s._v(" "+s._s(s.t("text","Use the saved version"))+" ")])],1)},Bc=[],Yc=tu(yc,fc,Bc,!1,null,"8ab72257");const Fc=Yc.exports,vc={name:"DocumentStatus",components:{CollisionResolveDialog:Fc,Lock:c1,NcNoteCard:Xh},props:{idle:{type:Boolean,require:!0},lock:{type:Object,default:null},syncError:{type:Object,default:null},hasConnectionIssue:{type:Boolean,require:!0},isResolvingConflict:{type:Boolean,require:!0}},data(){return{IDLE_TIMEOUT:Na}},computed:{hasSyncCollission(){return this.syncError&&this.syncError.type===$.SAVE_COLLISSION},isLoadingError(){return this.syncError&&this.syncError.type===$.LOAD_ERROR},hasWarning(){return this.syncError||this.hasConnectionIssue}},methods:{reconnect(){this.$emit("reconnect")},reload(){window.location.reload()}}};var kc=function(){var s=this,i=s._self._c;return i("div",{staticClass:"document-status"},[s.hasWarning?i("NcNoteCard",{attrs:{type:"warning"}},[s.isLoadingError?i("p",[s._v(" "+s._s(s.syncError.data.data.error)+" "),s.syncError.data.status===412?i("a",{staticClass:"button primary",on:{click:s.reload}},[s._v(s._s(s.t("text","Reload")))]):s._e()]):s.hasSyncCollission?i("p",[s._v(" "+s._s(s.t("text","Document has been changed outside of the editor. The changes cannot be applied"))+" ")]):s.hasConnectionIssue?i("p",[s._v(" "+s._s(s.t("text","Document could not be loaded. Please check your internet connection."))+" "),i("a",{staticClass:"button primary",on:{click:s.reconnect}},[s._v(s._s(s.t("text","Reconnect")))])]):s._e()]):s.idle?i("NcNoteCard",{attrs:{type:"info"}},[i("p",[s._v(" "+s._s(s.t("text","Document idle for {timeout} minutes, click to continue editing",{timeout:s.IDLE_TIMEOUT}))+" "),i("a",{staticClass:"button primary",on:{click:s.reconnect}},[s._v(s._s(s.t("text","Reconnect")))])])]):s._e(),s.lock?i("NcNoteCard",{attrs:{type:"info"},scopedSlots:s._u([{key:"icon",fn:function(){return[i("Lock",{attrs:{size:20}})]},proxy:!0}],null,!1,326953187)},[i("p",[s._v(" "+s._s(s.t("text","This file is opened read-only as it is currently locked by {user}.",{user:s.lock.displayName}))+" ")])]):s._e(),s.isResolvingConflict?i("CollisionResolveDialog",{attrs:{"sync-error":s.syncError}}):s._e()],1)},Tc=[],bc=tu(vc,kc,Tc,!1,null,"64a8995a");const xc=bc.exports,wc=()=>document.documentElement.clientWidth,Ki=()=>wc()<768,jc={data(){return{isMobile:Ki()}},beforeMount(){this.$onResize=lo(()=>{this.isMobile=Ki()},100),window.addEventListener("resize",this.$onResize)},beforeDestroy(){window.removeEventListener("resize",this.$onResize)}};function Sc(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jo={exports:{}};(function(s,i){(function(o,a){s.exports=a()})(g0,function(){var o;function a(){return o.apply(null,arguments)}function h(u){o=u}function m(u){return u instanceof Array||Object.prototype.toString.call(u)==="[object Array]"}function c(u){return u!=null&&Object.prototype.toString.call(u)==="[object Object]"}function D(u,e){return Object.prototype.hasOwnProperty.call(u,e)}function C(u){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(u).length===0;var e;for(e in u)if(D(u,e))return!1;return!0}function p(u){return u===void 0}function M(u){return typeof u=="number"||Object.prototype.toString.call(u)==="[object Number]"}function F(u){return u instanceof Date||Object.prototype.toString.call(u)==="[object Date]"}function v(u,e){var n=[],r,d=u.length;for(r=0;r${escapeHtml(content)}
`\n\t\t\tthis.$editor.chain()\n\t\t\t\t.setContent(html, addToHistory)\n\t\t\t\t.command(({ tr }) => {\n\t\t\t\t\ttr.setMeta('addToHistory', addToHistory)\n\t\t\t\t\treturn true\n\t\t\t\t})\n\t\t\t\t.run()\n\t\t},\n\n\t\tsetInitialYjsState(content, { isRichEditor }) {\n\t\t\tconst html = isRichEditor\n\t\t\t\t? markdownit.render(content) + ''\n\t\t\t\t: `${escapeHtml(content)}
`\n\n\t\t\tconst editor = isRichEditor\n\t\t\t\t? createRichEditor()\n\t\t\t\t: createPlainEditor()\n\n\t\t\tconst json = generateJSON(html, editor.options.extensions)\n\n\t\t\tconst doc = Node.fromJSON(editor.schema, json)\n\t\t\tconst getBaseDoc = (doc) => {\n\t\t\t\tconst ydoc = new Doc()\n\t\t\t\t// In order to make the initial document state idempotent, we need to reset the clientID\n\t\t\t\t// While this is not recommended, we cannot avoid it here as we lack another mechanism\n\t\t\t\t// to generate the initial state on the server side\n\t\t\t\t// The only other option to avoid this could be to generate the initial state once and push\n\t\t\t\t// it to the server immediately, however this would require read only sessions to be able\n\t\t\t\t// to still push a state\n\t\t\t\tydoc.clientID = 0\n\t\t\t\tconst type = /** @type {XmlFragment} */ (ydoc.get('default', XmlFragment))\n\t\t\t\tif (!type.doc) {\n\t\t\t\t\t// This should not happen but is aligned with the upstream implementation\n\t\t\t\t\t// https://github.com/yjs/y-prosemirror/blob/8db24263770c2baaccb08e08ea9ef92dbcf8a9da/src/lib.js#L209\n\t\t\t\t\treturn ydoc\n\t\t\t\t}\n\n\t\t\t\tprosemirrorToYXmlFragment(doc, type)\n\t\t\t\treturn ydoc\n\t\t\t}\n\n\t\t\tconst baseUpdate = encodeStateAsUpdate(getBaseDoc(doc))\n\t\t\tapplyUpdate(this.$ydoc, baseUpdate)\n\t\t},\n\t},\n}\n","\n\n\n\t\n\t\t\t\t
\n\t\t\n\t 0\">\n\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t 0\">\n\t\t\t\t\t
\n\t\t\t{{ t('text', 'Translate') }}
\n\t\t\t{{ t('text', 'To translate individual parts of the text, select it before using the translate function.') }}\n\t\t\t".concat(zi(s),"
");this.$editor.chain().setContent(a,o).command(({tr:h})=>(h.setMeta("addToHistory",o),!0)).run()},setInitialYjsState(s,{isRichEditor:i}){const o=i?bt.render(s)+"":"".concat(zi(s),"
"),a=i?bo():xo(),h=U6(o,a.options.extensions),m=J6.fromJSON(a.schema,h),c=It((D=>{const C=new Sa;C.clientID=0;const p=C.get("default",G6);return p.doc&&q6(D,p),C})(m));so(this.$ydoc,c)}}},kc={name:"CollisionResolveDialog",components:{NcButton:wa},mixins:[io,ih,wo,ro],props:{syncError:{type:Object,default:null}},data(){return{clicked:!1}},methods:{resolveThisVersion(){this.clicked=!0,this.$syncService.forceSave().then(()=>this.$syncService.syncUp()),this.$editor.setEditable(!this.readOnly)},resolveServerVersion(){const{outsideChange:s}=this.syncError.data;this.clicked=!0,this.$editor.setEditable(!this.readOnly),this.setContent(s,{isRichEditor:this.$isRichEditor}),this.$syncService.forceSave().then(()=>this.$syncService.syncUp())}}};var Tc=function(){var s=this,i=s._self._c;return i("div",{staticClass:"collision-resolve-dialog",class:{"icon-loading":s.clicked},attrs:{id:"resolve-conflicts"}},[i("NcButton",{attrs:{disabled:s.clicked,"data-cy":"resolveThisVersion"},on:{click:s.resolveThisVersion}},[s._v(" "+s._s(s.t("text","Use current version"))+" ")]),i("NcButton",{attrs:{disabled:s.clicked,"data-cy":"resolveServerVersion"},on:{click:s.resolveServerVersion}},[s._v(" "+s._s(s.t("text","Use the saved version"))+" ")])],1)},bc=[],xc=tu(kc,Tc,bc,!1,null,"8ab72257");const wc=xc.exports,jc={name:"DocumentStatus",components:{CollisionResolveDialog:wc,Lock:M1,NcNoteCard:n1},props:{idle:{type:Boolean,require:!0},lock:{type:Object,default:null},syncError:{type:Object,default:null},hasConnectionIssue:{type:Boolean,require:!0},isResolvingConflict:{type:Boolean,require:!0}},data(){return{IDLE_TIMEOUT:Na}},computed:{hasSyncCollission(){return this.syncError&&this.syncError.type===$.SAVE_COLLISSION},isLoadingError(){return this.syncError&&this.syncError.type===$.LOAD_ERROR},hasWarning(){return this.syncError||this.hasConnectionIssue}},methods:{reconnect(){this.$emit("reconnect")},reload(){window.location.reload()}}};var Sc=function(){var s=this,i=s._self._c;return i("div",{staticClass:"document-status"},[s.hasWarning?i("NcNoteCard",{attrs:{type:"warning"}},[s.isLoadingError?i("p",[s._v(" "+s._s(s.syncError.data.data.error)+" "),s.syncError.data.status===412?i("a",{staticClass:"button primary",on:{click:s.reload}},[s._v(s._s(s.t("text","Reload")))]):s._e()]):s.hasSyncCollission?i("p",[s._v(" "+s._s(s.t("text","Document has been changed outside of the editor. The changes cannot be applied"))+" ")]):s.hasConnectionIssue?i("p",[s._v(" "+s._s(s.t("text","Document could not be loaded. Please check your internet connection."))+" "),i("a",{staticClass:"button primary",on:{click:s.reconnect}},[s._v(s._s(s.t("text","Reconnect")))])]):s._e()]):s.idle?i("NcNoteCard",{attrs:{type:"info"}},[i("p",[s._v(" "+s._s(s.t("text","Document idle for {timeout} minutes, click to continue editing",{timeout:s.IDLE_TIMEOUT}))+" "),i("a",{staticClass:"button primary",on:{click:s.reconnect}},[s._v(s._s(s.t("text","Reconnect")))])])]):s._e(),s.lock?i("NcNoteCard",{attrs:{type:"info"},scopedSlots:s._u([{key:"icon",fn:function(){return[i("Lock",{attrs:{size:20}})]},proxy:!0}],null,!1,326953187)},[i("p",[s._v(" "+s._s(s.t("text","This file is opened read-only as it is currently locked by {user}.",{user:s.lock.displayName}))+" ")])]):s._e(),s.isResolvingConflict?i("CollisionResolveDialog",{attrs:{"sync-error":s.syncError}}):s._e()],1)},Hc=[],Oc=tu(jc,Sc,Hc,!1,null,"64a8995a");const Pc=Oc.exports,Ic=()=>document.documentElement.clientWidth,Ki=()=>Ic()<768,Rc={data(){return{isMobile:Ki()}},beforeMount(){this.$onResize=lo(()=>{this.isMobile=Ki()},100),window.addEventListener("resize",this.$onResize)},beforeDestroy(){window.removeEventListener("resize",this.$onResize)}};function Vc(s){throw new Error('Could not dynamically require "'+s+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var jo={exports:{}};(function(s,i){(function(o,a){s.exports=a()})(g0,function(){var o;function a(){return o.apply(null,arguments)}function h(u){o=u}function m(u){return u instanceof Array||Object.prototype.toString.call(u)==="[object Array]"}function c(u){return u!=null&&Object.prototype.toString.call(u)==="[object Object]"}function D(u,e){return Object.prototype.hasOwnProperty.call(u,e)}function C(u){if(Object.getOwnPropertyNames)return Object.getOwnPropertyNames(u).length===0;var e;for(e in u)if(D(u,e))return!1;return!0}function p(u){return u===void 0}function M(u){return typeof u=="number"||Object.prototype.toString.call(u)==="[object Number]"}function F(u){return u instanceof Date||Object.prototype.toString.call(u)==="[object Date]"}function v(u,e){var n=[],r,d=u.length;for(r=0;r${escapeHtml(content)}
`\n\t\t\tthis.$editor.chain()\n\t\t\t\t.setContent(html, addToHistory)\n\t\t\t\t.command(({ tr }) => {\n\t\t\t\t\ttr.setMeta('addToHistory', addToHistory)\n\t\t\t\t\treturn true\n\t\t\t\t})\n\t\t\t\t.run()\n\t\t},\n\n\t\tsetInitialYjsState(content, { isRichEditor }) {\n\t\t\tconst html = isRichEditor\n\t\t\t\t? markdownit.render(content) + ''\n\t\t\t\t: `${escapeHtml(content)}
`\n\n\t\t\tconst editor = isRichEditor\n\t\t\t\t? createRichEditor()\n\t\t\t\t: createPlainEditor()\n\n\t\t\tconst json = generateJSON(html, editor.options.extensions)\n\n\t\t\tconst doc = Node.fromJSON(editor.schema, json)\n\t\t\tconst getBaseDoc = (doc) => {\n\t\t\t\tconst ydoc = new Doc()\n\t\t\t\t// In order to make the initial document state idempotent, we need to reset the clientID\n\t\t\t\t// While this is not recommended, we cannot avoid it here as we lack another mechanism\n\t\t\t\t// to generate the initial state on the server side\n\t\t\t\t// The only other option to avoid this could be to generate the initial state once and push\n\t\t\t\t// it to the server immediately, however this would require read only sessions to be able\n\t\t\t\t// to still push a state\n\t\t\t\tydoc.clientID = 0\n\t\t\t\tconst type = /** @type {XmlFragment} */ (ydoc.get('default', XmlFragment))\n\t\t\t\tif (!type.doc) {\n\t\t\t\t\t// This should not happen but is aligned with the upstream implementation\n\t\t\t\t\t// https://github.com/yjs/y-prosemirror/blob/8db24263770c2baaccb08e08ea9ef92dbcf8a9da/src/lib.js#L209\n\t\t\t\t\treturn ydoc\n\t\t\t\t}\n\n\t\t\t\tprosemirrorToYXmlFragment(doc, type)\n\t\t\t\treturn ydoc\n\t\t\t}\n\n\t\t\tconst baseUpdate = encodeStateAsUpdate(getBaseDoc(doc))\n\t\t\tapplyUpdate(this.$ydoc, baseUpdate)\n\t\t},\n\t},\n}\n","\n\n\n\t\n\t\t\t\t
\n\t\t\n\t 0\">\n\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t 0\">\n\t\t\t\t\t
\n\t\t\t{{ t('text', 'Translate') }}
\n\t\t\t{{ t('text', 'To translate individual parts of the text, select it before using the translate function.') }}\n\t\t\t