${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{{ 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\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\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\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\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\n\t\t\t\t{{ t('text', 'Last saved') }}: {{ lastSavedString }}\n\t\t\t
\n\t\t\t0||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])},w1=s=>{const n=C0.getState(s).undoManager;if(n!=null)return n.undo(),!0},j1=s=>{const n=C0.getState(s).undoManager;if(n!=null)return n.redo(),!0},S1=new Set(["paragraph"]),O1=(s,n)=>!(s instanceof Mh)||!(s.content instanceof Ch)||!(s.content.type instanceof yh||s.content.type instanceof Lh&&n.has(s.content.type.nodeName))||s.content.type._length===0,H1=({protectedNodes:s=S1,trackedOrigins:n=[],undoManager:o=null}={})=>new Qr({key:C0,state:{init:(a,h)=>{const m=pt.getState(h),c=o||new gh(m.type,{trackedOrigins:new Set([pt].concat(n)),deleteFilter:D=>O1(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:Ah(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=C0.getState(a.state).undoManager;return m.on("stack-item-added",({stackItem:c})=>{const D=h.binding;D&&c.meta.set(D,C0.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()}}}}),P1=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:n,dispatch:o})=>(s.setMeta("preventDispatch",!0),C0.getState(n).undoManager.undoStack.length===0?!1:o?w1(n):!0),redo:()=>({tr:s,state:n,dispatch:o})=>(s.setMeta("preventDispatch",!0),C0.getState(n).undoManager.redoStack.length===0?!1:o?j1(n):!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 n=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),o=H1(this.options.yUndoOptions),a=o.spec.view;o.spec.view=c=>{const{undoManager:D}=C0.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=fh(n,h);return this.editor.options.enableContentCheck&&((s=n.doc)===null||s===void 0||s.on("beforeTransaction",()=>{try{const c=Bh(n);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=n.doc)===null||D===void 0||D.destroy(),this.storage.isDisabled=!0}}),!1}})),[m,o,this.editor.options.enableContentCheck&&new Qr({key:new Yh("filterInvalidContent"),filterTransaction:()=>{var c;return this.storage.isDisabled&&((c=n.doc)===null||c===void 0||c.destroy()),!0}})].filter(Boolean)}}),I1=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 n=s.state.selection.$anchor.pos;sessionStorage.setItem("text-lastPos-"+this.options.fileId,n)},addCommands(){return{autofocus:()=>({commands:s,editor:n})=>{const o=sessionStorage.getItem("text-lastPos-"+this.options.fileId);return o?s.focus(o):s.focus("start")}}}});function Ia(s){const n=new Uint8Array(s);return uo(n)}function Da(s){return eo(s)}const mo=0,wt=1,Ra=2,Ea=(s,n)=>{X(s,mo);const o=to(n);y0(s,o)},ho=(s,n,o)=>{X(s,wt),y0(s,Rt(n,o))},R1=(s,n,o)=>ho(n,o,ja(s)),co=(s,n,o)=>{try{so(n,ja(s),o)}catch(a){console.error("Caught error while handling a Yjs update",a)}},Do=(s,n)=>{X(s,Ra),y0(s,n)},V1=co,Ui=(s,n,o,a)=>{const h=ge(s);switch(h){case mo:R1(s,n,o);break;case wt:co(s,o,a);break;case Ra:V1(s,o,a);break;default:throw new Error("Unknown message type")}return h},Eo=new Map;class W1{constructor(n){this.room=n,this.onmessage=null,this._onChange=o=>o.key===n&&this.onmessage!==null&&this.onmessage({data:eo(o.newValue||"")}),kh(this._onChange)}postMessage(n){Th.setItem(this.room,uo(bh(n)))}close(){xh(this._onChange)}}const N1=typeof BroadcastChannel>"u"?W1:BroadcastChannel,Va=s=>Fh(Eo,s,()=>{const n=vh(),o=new N1(s);return o.onmessage=a=>n.forEach(h=>h(a.data,"broadcastchannel")),{bc:o,subs:n}}),z1=(s,n)=>(Va(s).subs.add(n),n),$1=(s,n)=>{const o=Va(s),a=o.subs.delete(n);return a&&o.subs.size===0&&(o.bc.close(),Eo.delete(s)),a},le=(s,n,o=null)=>{const a=Va(s);a.bc.postMessage(n),a.subs.forEach(h=>h(n,o))},U1=0,J1=(s,n,o)=>{switch(ge(s)){case U1:o(n,Kr(s))}},G1=s=>wh(s,(n,o)=>"".concat(encodeURIComponent(o),"=").concat(encodeURIComponent(n))).join("&"),M0=0,po=3,Ae=1,q1=2,Pe=[];Pe[M0]=(s,n,o,a,h)=>{X(s,M0);const m=jh(n),c=Ui(n,s,o.doc,o);a&&((c===wt||c===Ra)&&Ui(m,du(),o.remote,o),c===wt&&!o.synced&&(o.synced=!0))},Pe[po]=(s,n,o,a,h)=>{X(s,Ae),y0(s,Ie(o.awareness,[o.doc.clientID]))},Pe[Ae]=(s,n,o,a,h)=>{x1(o.awareness,ja(n),o)},Pe[q1]=(s,n,o,a,h)=>{J1(n,o.doc,(m,c)=>K1(o,c))};const Ji=3e4,K1=(s,n)=>console.warn("Permission denied to access ".concat(s.url,".\n").concat(n)),go=(s,n,o)=>{const a=Zr(n),h=du(),m=ge(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 n=new s._WS(s.url,s.protocols);n.binaryType="arraybuffer",s.ws=n,s.wsconnecting=!0,s.wsconnected=!1,s.synced=!1,n.onmessage=o=>{s.wsLastMessageReceived=P0();const a=go(s,new Uint8Array(o.data),!0);ao(a)>1&&n.send(ou(a))},n.onerror=o=>{s.emit("connection-error",[o,s])},n.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,Sh(Oh(2,s.wsUnsuccessfulReconnects)*100,s.maxBackoffTime),s)},n.onopen=()=>{s.wsLastMessageReceived=P0(),s.wsconnecting=!1,s.wsconnected=!0,s.wsUnsuccessfulReconnects=0,s.emit("status",[{status:"connected"}]);const o=du();if(X(o,M0),Ea(o,s.doc),n.send(ou(o)),s.awareness.getLocalState()!==null){const a=du();X(a,Ae),y0(a,Ie(s.awareness,[s.doc.clientID])),n.send(ou(a))}},s.emit("status",[{status:"connecting"}])}},zs=(s,n)=>{const o=s.ws;s.wsconnected&&o&&o.readyState===o.OPEN&&o.send(n),s.bcconnected&&le(s.bcChannel,n,s)};class Z1 extends Gr{constructor(n,o,a,{connect:h=!0,awareness:m=new b1(a),params:c={},protocols:D=[],WebSocketPolyfill:C=WebSocket,resyncInterval:p=-1,maxBackoffTime:M=2500,disableBc:F=!1}={}){for(super();n[n.length-1]==="/";)n=n.slice(0,n.length-1);this.serverUrl=n,this.bcChannel=n+"/"+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=Pe.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,M0),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&&le(this.bcChannel,ou(k),this)}},this._updateHandler=(v,B,k)=>{if(B!==this){const G=to(this.remote),f=Rt(k,G),q=du();X(q,M0),Do(q,f),zs(this,ou(q))}},this.doc.on("update",this._updateHandler),this._awarenessUpdateHandler=({added:v,updated:B,removed:k},G)=>{const f=du();X(f,Ae),y0(f,Ie(m,[this.doc.clientID])),zs(this,ou(f))},this._exitHandler=()=>{Pa(this.awareness,[a.clientID],"app closed")},Ni&&typeof De<"u"&&De.on("exit",this._exitHandler),m.on("update",this._awarenessUpdateHandler),this._checkInterval=setInterval(()=>{this.wsconnected&&Ji 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])},j1=s=>{const n=C0.getState(s).undoManager;if(n!=null)return n.undo(),!0},S1=s=>{const n=C0.getState(s).undoManager;if(n!=null)return n.redo(),!0},O1=new Set(["paragraph"]),H1=(s,n)=>!(s instanceof Ch)||!(s.content instanceof yh)||!(s.content.type instanceof Lh||s.content.type instanceof fh&&n.has(s.content.type.nodeName))||s.content.type._length===0,P1=({protectedNodes:s=O1,trackedOrigins:n=[],undoManager:o=null}={})=>new Xr({key:C0,state:{init:(a,h)=>{const m=pt.getState(h),c=o||new Ah(m.type,{trackedOrigins:new Set([pt].concat(n)),deleteFilter:D=>H1(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:Mh(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=C0.getState(a.state).undoManager;return m.on("stack-item-added",({stackItem:c})=>{const D=h.binding;D&&c.meta.set(D,C0.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()}}}}),I1=uo.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:n,dispatch:o})=>(s.setMeta("preventDispatch",!0),C0.getState(n).undoManager.undoStack.length===0?!1:o?j1(n):!0),redo:()=>({tr:s,state:n,dispatch:o})=>(s.setMeta("preventDispatch",!0),C0.getState(n).undoManager.redoStack.length===0?!1:o?S1(n):!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 n=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),o=P1(this.options.yUndoOptions),a=o.spec.view;o.spec.view=c=>{const{undoManager:D}=C0.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=Bh(n,h);return this.editor.options.enableContentCheck&&((s=n.doc)===null||s===void 0||s.on("beforeTransaction",()=>{try{const c=Yh(n);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=n.doc)===null||D===void 0||D.destroy(),this.storage.isDisabled=!0}}),!1}})),[m,o,this.editor.options.enableContentCheck&&new Xr({key:new Fh("filterInvalidContent"),filterTransaction:()=>{var c;return this.storage.isDisabled&&((c=n.doc)===null||c===void 0||c.destroy()),!0}})].filter(Boolean)}}),R1=uo.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 n=s.state.selection.$anchor.pos;sessionStorage.setItem("text-lastPos-"+this.options.fileId,n)},addCommands(){return{autofocus:()=>({commands:s,editor:n})=>{const o=sessionStorage.getItem("text-lastPos-"+this.options.fileId);return o?s.focus(o):s.focus("start")}}}});function Ia(s){const n=new Uint8Array(s);return eo(n)}function Da(s){return to(s)}const ho=0,xt=1,Ra=2,Ea=(s,n)=>{X(s,ho);const o=so(n);y0(s,o)},co=(s,n,o)=>{X(s,xt),y0(s,It(n,o))},V1=(s,n,o)=>co(n,o,ja(s)),Do=(s,n,o)=>{try{ao(n,ja(s),o)}catch(a){console.error("Caught error while handling a Yjs update",a)}},Eo=(s,n)=>{X(s,Ra),y0(s,n)},W1=Do,Ui=(s,n,o,a)=>{const h=Ae(s);switch(h){case ho:V1(s,n,o);break;case xt:Do(s,o,a);break;case Ra:W1(s,o,a);break;default:throw new Error("Unknown message type")}return h},po=new Map;class N1{constructor(n){this.room=n,this.onmessage=null,this._onChange=o=>o.key===n&&this.onmessage!==null&&this.onmessage({data:to(o.newValue||"")}),Th(this._onChange)}postMessage(n){bh.setItem(this.room,eo(xh(n)))}close(){wh(this._onChange)}}const z1=typeof BroadcastChannel>"u"?N1:BroadcastChannel,Va=s=>vh(po,s,()=>{const n=kh(),o=new z1(s);return o.onmessage=a=>n.forEach(h=>h(a.data,"broadcastchannel")),{bc:o,subs:n}}),$1=(s,n)=>(Va(s).subs.add(n),n),U1=(s,n)=>{const o=Va(s),a=o.subs.delete(n);return a&&o.subs.size===0&&(o.bc.close(),po.delete(s)),a},me=(s,n,o=null)=>{const a=Va(s);a.bc.postMessage(n),a.subs.forEach(h=>h(n,o))},J1=0,G1=(s,n,o)=>{switch(Ae(s)){case J1:o(n,Zr(s))}},q1=s=>jh(s,(n,o)=>"".concat(encodeURIComponent(o),"=").concat(encodeURIComponent(n))).join("&"),M0=0,go=3,Me=1,K1=2,Ie=[];Ie[M0]=(s,n,o,a,h)=>{X(s,M0);const m=Sh(n),c=Ui(n,s,o.doc,o);a&&((c===xt||c===Ra)&&Ui(m,du(),o.remote,o),c===xt&&!o.synced&&(o.synced=!0))},Ie[go]=(s,n,o,a,h)=>{X(s,Me),y0(s,Re(o.awareness,[o.doc.clientID]))},Ie[Me]=(s,n,o,a,h)=>{w1(o.awareness,ja(n),o)},Ie[K1]=(s,n,o,a,h)=>{G1(n,o.doc,(m,c)=>Z1(o,c))};const Ji=3e4,Z1=(s,n)=>console.warn("Permission denied to access ".concat(s.url,".\n").concat(n)),Ao=(s,n,o)=>{const a=Qr(n),h=du(),m=Ae(a),c=s.messageHandlers[m];return c?c(h,a,s,o,m):console.error("Unable to compute message"),h},Mo=s=>{if(s.shouldConnect&&s.ws===null){const n=new s._WS(s.url,s.protocols);n.binaryType="arraybuffer",s.ws=n,s.wsconnecting=!0,s.wsconnected=!1,s.synced=!1,n.onmessage=o=>{s.wsLastMessageReceived=P0();const a=Ao(s,new Uint8Array(o.data),!0);no(a)>1&&n.send(ou(a))},n.onerror=o=>{s.emit("connection-error",[o,s])},n.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(Mo,Oh(Hh(2,s.wsUnsuccessfulReconnects)*100,s.maxBackoffTime),s)},n.onopen=()=>{s.wsLastMessageReceived=P0(),s.wsconnecting=!1,s.wsconnected=!0,s.wsUnsuccessfulReconnects=0,s.emit("status",[{status:"connected"}]);const o=du();if(X(o,M0),Ea(o,s.doc),n.send(ou(o)),s.awareness.getLocalState()!==null){const a=du();X(a,Me),y0(a,Re(s.awareness,[s.doc.clientID])),n.send(ou(a))}},s.emit("status",[{status:"connecting"}])}},Ns=(s,n)=>{const o=s.ws;s.wsconnected&&o&&o.readyState===o.OPEN&&o.send(n),s.bcconnected&&me(s.bcChannel,n,s)};class Q1 extends qr{constructor(n,o,a,{connect:h=!0,awareness:m=new x1(a),params:c={},protocols:D=[],WebSocketPolyfill:C=WebSocket,resyncInterval:p=-1,maxBackoffTime:M=2500,disableBc:F=!1}={}){for(super();n[n.length-1]==="/";)n=n.slice(0,n.length-1);this.serverUrl=n,this.bcChannel=n+"/"+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,M0),Ea(v,a),this.ws.send(ou(v))}},p)),this._bcSubscriber=(v,B)=>{if(B!==this){const k=Ao(this,new Uint8Array(v),!1);no(k)>1&&me(this.bcChannel,ou(k),this)}},this._updateHandler=(v,B,k)=>{if(B!==this){const G=so(this.remote),f=It(k,G),q=du();X(q,M0),Eo(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),y0(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 {{ t('text', 'Speed up your writing with simple shortcuts.') }} \n\t\t\t{{ t('text', 'Just type the Markdown syntax or use keyboard shortcuts from below.') }}\n\t\t \n\t\t\t{{ t('text', 'Just type the Markdown syntax from below.') }}\n\t\t {{ t('text', 'Speed up your writing with simple shortcuts.') }} \n\t\t\t{{ t('text', 'Just type the Markdown syntax or use keyboard shortcuts from below.') }}\n\t\t \n\t\t\t{{ t('text', 'Just type the Markdown syntax from below.') }}\n\t\t".concat(zi(s),"
");this.$editor.chain().setContent(a,o).command(({tr:h})=>(h.setMeta("addToHistory",o),!0)).run()},setInitialYjsState(s,{isRichEditor:n}){const o=n?bt.render(s)+"":"".concat(zi(s),"
"),a=n?bo():xo(),h=Uh(o,a.options.extensions),m=Jh.fromJSON(a.schema,h),c=Rt((D=>{const C=new Sa;C.clientID=0;const p=C.get("default",Gh);return p.doc&&qh(D,p),C})(m));so(this.$ydoc,c)}}},Ic={name:"CollisionResolveDialog",components:{NcButton:wa},mixins:[io,i6,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 Rc=function(){var s=this,n=s._self._c;return n("div",{staticClass:"collision-resolve-dialog",class:{"icon-loading":s.clicked},attrs:{id:"resolve-conflicts"}},[n("NcButton",{attrs:{disabled:s.clicked,"data-cy":"resolveThisVersion"},on:{click:s.resolveThisVersion}},[s._v(" "+s._s(s.t("text","Use current version"))+" ")]),n("NcButton",{attrs:{disabled:s.clicked,"data-cy":"resolveServerVersion"},on:{click:s.resolveServerVersion}},[s._v(" "+s._s(s.t("text","Use the saved version"))+" ")])],1)},Vc=[],Wc=tu(Ic,Rc,Vc,!1,null,"8ab72257");const Nc=Wc.exports,zc={name:"DocumentStatus",components:{CollisionResolveDialog:Nc,Lock:T1,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 $c=function(){var s=this,n=s._self._c;return n("div",{staticClass:"document-status"},[s.hasWarning?n("NcNoteCard",{attrs:{type:"warning"}},[s.isLoadingError?n("p",[s._v(" "+s._s(s.syncError.data.data.error)+" "),s.syncError.data.status===412?n("a",{staticClass:"button primary",on:{click:s.reload}},[s._v(s._s(s.t("text","Reload")))]):s._e()]):s.hasSyncCollission?n("p",[s._v(" "+s._s(s.t("text","Document has been changed outside of the editor. The changes cannot be applied"))+" ")]):s.hasConnectionIssue?n("p",[s._v(" "+s._s(s.t("text","Document could not be loaded. Please check your internet connection."))+" "),n("a",{staticClass:"button primary",on:{click:s.reconnect}},[s._v(s._s(s.t("text","Reconnect")))])]):s._e()]):s.idle?n("NcNoteCard",{attrs:{type:"info"}},[n("p",[s._v(" "+s._s(s.t("text","Document idle for {timeout} minutes, click to continue editing",{timeout:s.IDLE_TIMEOUT}))+" "),n("a",{staticClass:"button primary",on:{click:s.reconnect}},[s._v(s._s(s.t("text","Reconnect")))])])]):s._e(),s.lock?n("NcNoteCard",{attrs:{type:"info"},scopedSlots:s._u([{key:"icon",fn:function(){return[n("Lock",{attrs:{size:20}})]},proxy:!0}],null,!1,326953187)},[n("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?n("CollisionResolveDialog",{attrs:{"sync-error":s.syncError}}):s._e()],1)},Uc=[],Jc=tu(zc,$c,Uc,!1,null,"64a8995a");const Gc=Jc.exports,qc=()=>document.documentElement.clientWidth,Ki=()=>qc()<768,Kc={data(){return{isMobile:Ki()}},beforeMount(){this.$onResize=lo(()=>{this.isMobile=Ki()},100),window.addEventListener("resize",this.$onResize)},beforeDestroy(){window.removeEventListener("resize",this.$onResize)}};function Zc(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,n){(function(o,a){s.exports=a()})(A0,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 i=[],r,d=u.length;for(r=0;r".concat(zi(s),"
");this.$editor.chain().setContent(a,o).command(({tr:h})=>(h.setMeta("addToHistory",o),!0)).run()},setInitialYjsState(s,{isRichEditor:n}){const o=n?bt.render(s)+"":"".concat(zi(s),"
"),a=n?xo():wo(),h=Jh(o,a.options.extensions),m=Gh.fromJSON(a.schema,h),c=It((D=>{const C=new Sa;C.clientID=0;const p=C.get("default",qh);return p.doc&&Kh(D,p),C})(m));ao(this.$ydoc,c)}}},Rc={name:"CollisionResolveDialog",components:{NcButton:wa},mixins:[ro,r6,jo,oo],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 Vc=function(){var s=this,n=s._self._c;return n("div",{staticClass:"collision-resolve-dialog",class:{"icon-loading":s.clicked},attrs:{id:"resolve-conflicts"}},[n("NcButton",{attrs:{disabled:s.clicked,"data-cy":"resolveThisVersion"},on:{click:s.resolveThisVersion}},[s._v(" "+s._s(s.t("text","Use current version"))+" ")]),n("NcButton",{attrs:{disabled:s.clicked,"data-cy":"resolveServerVersion"},on:{click:s.resolveServerVersion}},[s._v(" "+s._s(s.t("text","Use the saved version"))+" ")])],1)},Wc=[],Nc=tu(Rc,Vc,Wc,!1,null,"8ab72257");const zc=Nc.exports,$c={name:"DocumentStatus",components:{CollisionResolveDialog:zc,Lock:b1,NcNoteCard:i1},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 Uc=function(){var s=this,n=s._self._c;return n("div",{staticClass:"document-status"},[s.hasWarning?n("NcNoteCard",{attrs:{type:"warning"}},[s.isLoadingError?n("p",[s._v(" "+s._s(s.syncError.data.data.error)+" "),s.syncError.data.status===412?n("a",{staticClass:"button primary",on:{click:s.reload}},[s._v(s._s(s.t("text","Reload")))]):s._e()]):s.hasSyncCollission?n("p",[s._v(" "+s._s(s.t("text","Document has been changed outside of the editor. The changes cannot be applied"))+" ")]):s.hasConnectionIssue?n("p",[s._v(" "+s._s(s.t("text","Document could not be loaded. Please check your internet connection."))+" "),n("a",{staticClass:"button primary",on:{click:s.reconnect}},[s._v(s._s(s.t("text","Reconnect")))])]):s._e()]):s.idle?n("NcNoteCard",{attrs:{type:"info"}},[n("p",[s._v(" "+s._s(s.t("text","Document idle for {timeout} minutes, click to continue editing",{timeout:s.IDLE_TIMEOUT}))+" "),n("a",{staticClass:"button primary",on:{click:s.reconnect}},[s._v(s._s(s.t("text","Reconnect")))])])]):s._e(),s.lock?n("NcNoteCard",{attrs:{type:"info"},scopedSlots:s._u([{key:"icon",fn:function(){return[n("Lock",{attrs:{size:20}})]},proxy:!0}],null,!1,326953187)},[n("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?n("CollisionResolveDialog",{attrs:{"sync-error":s.syncError}}):s._e()],1)},Jc=[],Gc=tu($c,Uc,Jc,!1,null,"64a8995a");const qc=Gc.exports,Kc=()=>document.documentElement.clientWidth,Ki=()=>Kc()<768,Zc={data(){return{isMobile:Ki()}},beforeMount(){this.$onResize=mo(()=>{this.isMobile=Ki()},100),window.addEventListener("resize",this.$onResize)},beforeDestroy(){window.removeEventListener("resize",this.$onResize)}};function Qc(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 So={exports:{}};(function(s,n){(function(o,a){s.exports=a()})(A0,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 i=[],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=i?this.right.slice(n-i,r-i):this.left.slice(n,i).append(this.right.slice(0,r-i))},t.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new t(this.left,r)},t.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new t(r,this.right)},t.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new t(this.left,new t(this.right,n)):new t(this,n)},t}(u),k=u;const tt=500;class m{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=t.tr,a,h,d=[],c=[];return this.items.forEach((l,p)=>{if(!l.step){i||(i=this.remapping(r,p+1),o=i.maps.length),o--,c.push(l);return}if(i){c.push(new g(l.map));let f=l.step.map(i.slice(o)),y;f&&s.maybeStep(f).doc&&(y=s.mapping.maps[s.mapping.maps.length-1],d.push(new g(y,void 0,void 0,d.length+c.length))),o--,y&&i.appendMap(y,o)}else s.maybeStep(l.step);if(l.selection)return a=i?l.selection.map(i.slice(o)):l.selection,h=new m(this.items.slice(0,r).append(c.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:h,transform:s,selection:a}}addTransform(t,n,r,i){let o=[],s=this.eventCount,a=this.items,h=!i&&a.length?a.get(a.length-1):null;for(let c=0;ctt&&(l=l.compress(this.items.length-r.length)),l}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=t)i.push(s),s.selection&&o++;else if(s.step){let h=s.step.map(n.slice(r)),d=h&&h.getMap();if(r--,d&&n.appendMap(d,r),h){let c=s.selection&&s.selection.map(n.slice(r));c&&o++;let l=new g(d.invert(),h,c),p,f=i.length-1;(p=i.length&&i[f].merge(l))?i[f]=p:i.push(l)}}else s.map&&r--},this.items.length,0),new m(k.from(i.reverse()),o)}}m.empty=new m(k.empty,0);function et(e,t){let n;return e.forEach((r,i)=>{if(r.selection&&t--==0)return n=i,!1}),e.slice(n)}class g{constructor(t,n,r,i){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new g(n.getMap().invert(),n,this.selection)}}}class v{constructor(t,n,r,i,o){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const nt=20;function rt(e,t,n,r){let i=n.getMeta(w),o;if(i)return i.historyState;n.getMeta(st)&&(e=new v(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(s&&s.getMeta(w))return s.getMeta(w).redo?new v(e.done.addTransform(n,void 0,r,M(t)),e.undone,T(n.mapping.maps),e.prevTime,e.prevComposition):new v(e.done,e.undone.addTransform(n,void 0,r,M(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),h=e.prevTime==0||!s&&e.prevComposition!=a&&(e.prevTime<(n.time||0)-r.newGroupDelay||!it(n,e.prevRanges)),d=s?I(e.prevRanges,n.mapping):T(n.mapping.maps);return new v(e.done.addTransform(n,h?t.selection.getBookmark():void 0,r,M(t)),m.empty,d,n.time,a!=null?a:e.prevComposition)}else return(o=n.getMeta("rebased"))?new v(e.done.rebased(n,o),e.undone.rebased(n,o),I(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new v(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),I(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function it(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,i)=>{for(let o=0;o=i?this.right.slice(n-i,r-i):this.left.slice(n,i).append(this.right.slice(0,r-i))},t.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new t(this.left,r)},t.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new t(r,this.right)},t.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new t(this.left,new t(this.right,n)):new t(this,n)},t}(u),k=u;const tt=500;class m{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=t.tr,a,h,d=[],c=[];return this.items.forEach((l,p)=>{if(!l.step){i||(i=this.remapping(r,p+1),o=i.maps.length),o--,c.push(l);return}if(i){c.push(new g(l.map));let f=l.step.map(i.slice(o)),y;f&&s.maybeStep(f).doc&&(y=s.mapping.maps[s.mapping.maps.length-1],d.push(new g(y,void 0,void 0,d.length+c.length))),o--,y&&i.appendMap(y,o)}else s.maybeStep(l.step);if(l.selection)return a=i?l.selection.map(i.slice(o)):l.selection,h=new m(this.items.slice(0,r).append(c.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:h,transform:s,selection:a}}addTransform(t,n,r,i){let o=[],s=this.eventCount,a=this.items,h=!i&&a.length?a.get(a.length-1):null;for(let c=0;ctt&&(l=l.compress(this.items.length-r.length)),l}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=t)i.push(s),s.selection&&o++;else if(s.step){let h=s.step.map(n.slice(r)),d=h&&h.getMap();if(r--,d&&n.appendMap(d,r),h){let c=s.selection&&s.selection.map(n.slice(r));c&&o++;let l=new g(d.invert(),h,c),p,f=i.length-1;(p=i.length&&i[f].merge(l))?i[f]=p:i.push(l)}}else s.map&&r--},this.items.length,0),new m(k.from(i.reverse()),o)}}m.empty=new m(k.empty,0);function et(e,t){let n;return e.forEach((r,i)=>{if(r.selection&&t--==0)return n=i,!1}),e.slice(n)}class g{constructor(t,n,r,i){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new g(n.getMap().invert(),n,this.selection)}}}class v{constructor(t,n,r,i,o){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const nt=20;function rt(e,t,n,r){let i=n.getMeta(w),o;if(i)return i.historyState;n.getMeta(st)&&(e=new v(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(s&&s.getMeta(w))return s.getMeta(w).redo?new v(e.done.addTransform(n,void 0,r,M(t)),e.undone,T(n.mapping.maps),e.prevTime,e.prevComposition):new v(e.done,e.undone.addTransform(n,void 0,r,M(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),h=e.prevTime==0||!s&&e.prevComposition!=a&&(e.prevTime<(n.time||0)-r.newGroupDelay||!it(n,e.prevRanges)),d=s?I(e.prevRanges,n.mapping):T(n.mapping.maps);return new v(e.done.addTransform(n,h?t.selection.getBookmark():void 0,r,M(t)),m.empty,d,n.time,a!=null?a:e.prevComposition)}else return(o=n.getMeta("rebased"))?new v(e.done.rebased(n,o),e.undone.rebased(n,o),I(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new v(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),I(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function it(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,i)=>{for(let o=0;o{{ t('text', 'Formatting and shortcuts') }}
\n\t\t\n\t\t\t\n\t\t\t\t
\n\n\t\t\n\t\t\t\t\t \n\t\t\t\n\t\t\t\n\t\t\t\t{{ t('text', 'Style') }} \n\t\t\t\t\t{{ t('text', 'Syntax') }} \n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Keyboard shortcuts') }}\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'New paragraph') }} \n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Enter') }}\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Hard line break') }} \n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Enter') }}\n\t\t\t\t\t\t{{ t('text', 'followed by') }}\n\t\t\t\t\t\t{{ t('text', 'Backspace') }}\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Shift') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t{{ t('text', 'Enter') }}\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Bold') }} \n\t\t\t\t\t \n\t\t\t\t\t**{{ t('text', 'Bold text') }}**
\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\tB\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Italic') }} \n\t\t\t\t\t \n\t\t\t\t\t*{{ t('text', 'Italicized text') }}*
\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\tI\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Strikethrough') }} \n\t\t\t\t\t \n\t\t\t\t\t~~{{ t('text', 'Mistaken text') }}~~
\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t{{ t('text', 'Shift') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\tS\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Underline') }} \n\t\t\t\t\t \n\t\t\t\t\t__{{ t('text', 'Underlined text') }}__
\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\tU\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Heading 1') }}\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t# {{ t('text', 'Heading level 1') }}
\n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t{{ t('text', 'Shift') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t1\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t\t…\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t\t…\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t\t…\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Heading 6') }}\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t###### {{ t('text', 'Heading level 6') }}
\n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t{{ t('text', 'Shift') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t6\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Unordered list') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t* {{ t('text', 'An item') }}
\n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t{{ t('text', 'Shift') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t8\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Ordered list') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t1. {{ t('text', 'First item') }}
\n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t{{ t('text', 'Shift') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t7\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Checklist') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t* [] {{ t('text', 'To-Do item') }}
\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Blockquote') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t> {{ t('text', 'Quoted text') }}
\n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t>\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Code block') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t``` {{ t('text', 'Some code') }}
\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Link') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t[Title](https://example.org)
\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Insert emoji') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t:{{ t('text', 'emoji') }}
\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Mention someone') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t@{{ t('text', 'name') }}
\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t\t \n\t\t\t\n\t\t{{ t('text', 'Smart picker') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t/{{ t('text', 'something') }}
\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\n\t\t\t\t
\n\t\n\t\t\t\t\t \n\t\t\t\n\t\t\t\n\t\t\t\t{{ t('text', 'Action') }} \n\t\t\t\t\t{{ t('text', 'Keyboard shortcuts') }} \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Undo') }} \n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\tZ\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Redo') }} \n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\tY\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\n\t\t{{ t('text', 'Toggle outline') }} \n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t{{ t('text', 'Alt') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\tH\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Formatting and shortcuts') }}
\n\t\t\n\t\t\t\n\t\t\t\t
\n\n\t\t\n\t\t\t\t\t \n\t\t\t\n\t\t\t\n\t\t\t\t{{ t('text', 'Style') }} \n\t\t\t\t\t{{ t('text', 'Syntax') }} \n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Keyboard shortcuts') }}\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'New paragraph') }} \n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Enter') }}\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Hard line break') }} \n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Enter') }}\n\t\t\t\t\t\t{{ t('text', 'followed by') }}\n\t\t\t\t\t\t{{ t('text', 'Backspace') }}\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Shift') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t{{ t('text', 'Enter') }}\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Bold') }} \n\t\t\t\t\t \n\t\t\t\t\t**{{ t('text', 'Bold text') }}**
\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\tB\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Italic') }} \n\t\t\t\t\t \n\t\t\t\t\t*{{ t('text', 'Italicized text') }}*
\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\tI\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Strikethrough') }} \n\t\t\t\t\t \n\t\t\t\t\t~~{{ t('text', 'Mistaken text') }}~~
\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t{{ t('text', 'Shift') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\tS\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Underline') }} \n\t\t\t\t\t \n\t\t\t\t\t__{{ t('text', 'Underlined text') }}__
\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\tU\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Heading 1') }}\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t# {{ t('text', 'Heading level 1') }}
\n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t{{ t('text', 'Shift') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t1\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t\t…\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t\t…\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t\t…\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Heading 6') }}\n\t\t\t\t\t \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t###### {{ t('text', 'Heading level 6') }}
\n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t{{ t('text', 'Shift') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t6\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Unordered list') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t* {{ t('text', 'An item') }}
\n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t{{ t('text', 'Shift') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t8\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Ordered list') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t1. {{ t('text', 'First item') }}
\n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t{{ t('text', 'Shift') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t7\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Checklist') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t* [] {{ t('text', 'To-Do item') }}
\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Blockquote') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t> {{ t('text', 'Quoted text') }}
\n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t>\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Code block') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t``` {{ t('text', 'Some code') }}
\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Link') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t[Title](https://example.org)
\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Insert emoji') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t:{{ t('text', 'emoji') }}
\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Mention someone') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t@{{ t('text', 'name') }}
\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\t\t \n\t\t\t\n\t\t{{ t('text', 'Smart picker') }} \n\t\t\t\t\t\n\t\t\t\t\t\t \n\t\t\t\t\t/{{ t('text', 'something') }}
\n\t\t\t\t\t\n\t\t\t\t \n\t\t\t\n\t\t\t\t
\n\t\n\t\t\t\t\t \n\t\t\t\n\t\t\t\n\t\t\t\t{{ t('text', 'Action') }} \n\t\t\t\t\t{{ t('text', 'Keyboard shortcuts') }} \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Undo') }} \n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\tZ\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t{{ t('text', 'Redo') }} \n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\tY\n\t\t\t\t\t \n\t\t\t\t\n\t\t\t\t\t \n\t\t\t\n\t\t{{ t('text', 'Toggle outline') }} \n\t\t\t\t\t\n\t\t\t\t\t\t{{ t('text', 'Ctrl') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\t{{ t('text', 'Alt') }}\n\t\t\t\t\t\t+\n\t\t\t\t\t\tH\n\t\t\t\t\t \n\t\t\t\t