Add synced pages, editor settings and split view

Phase B items 7-9 of docs/AFFINE.md.

Synced pages: "![[" or /Synced page shows another page inside this one,
read-only and live. The copy follows the page over a read-only collab
connection (CollabProvider readOnly: no edits, no presence) in a nested
read-only editor; it folds to its title and opens the page. The node
keeps the page's title, so exports (Markdown, HTML, PDF, Word) and
readers without a host show it as a link to the page.

Settings: Account -> Editor sets, per device, the text size, full width
or a date title for new pages, showing properties and backlinks, and
code line numbers. The inbox settings choose which notification types
the email digest includes (users.notify_email_off, new migration).

Split view: Alt+click a page link, or Open beside in the page menu,
shows that page in a side pane on wide screens; it survives navigation
and reloads of the tab. The page menu opens pages in a new tab on the
web, and Ctrl+[ / Ctrl+] go back and forward.

Strings are translated into all five languages, the user guide covers
the new features, and the mobile editor bundle is rebuilt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tajniak81andClaude Opus 5.5 committed 2026-11-14 19:23:30 +01:00
1 parent ec11abd8b8
commit 53dd43cc2e
36 files changed
+1160 -102

No files matched your search

@@ -0,0 +1,20 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
/// <reference path="../pb_data/types.d.ts" />
// users.notify_email_off: the notification types (comment, reply, mention,
// share, resolved, reminder) a person does not want in their email digest.
// They still land in the inbox.
migrate(
(app) => {
const users = app.findCollectionByNameOrId("users");
users.fields.add(new JSONField({ name: "notify_email_off", maxSize: 2000 }));
app.save(users);
},
(app) => {
const users = app.findCollectionByNameOrId("users");
users.fields.removeByName("notify_email_off");
app.save(users);
},
);
+10
View File
@@ -22,6 +22,9 @@ Pages save as you type, and everyone with the page open sees changes and cursors
| Copy a link to a block | Ctrl+Shift+C in the desktop app, or the link button in the margin or the toolbar |
| Headings by keyboard | Ctrl+Shift+1 to 6, and Ctrl+Shift+0 for plain text |
| Mention someone | Type `@` and their name |
| Show another page inside this one | Type `![[` and pick it, or use `/Synced page`; it stays up to date as that page changes, and **Fold** shrinks it to its title |
| Open a page beside this one | Alt+click (Option+click on a Mac) any link to it, or choose **Open beside** in the ⋯ menu |
| Go back or forward | Ctrl+[ and Ctrl+] (⌘[ and ⌘] on a Mac) |
| Add an image or file | Paste or drop it, or use `/image`, `/file` or the paperclip in the header |
| Undo | Ctrl+Z (your own changes only) |
| Fold the sidebar | Ctrl+/ |
@@ -29,12 +32,19 @@ Pages save as you type, and everyone with the page open sees changes and cursors
**History** in the page header lists saved versions; you can view any of them and restore it. Restoring keeps the
current text as a version too.
A synced page is read-only where it is shown: open it to edit it. People who cannot open that page see only its
title. **Account → Editor** sets, for this device, the text size, whether new pages start full width or titled with
today's date, whether properties and the pages that link here show, and line numbers in code blocks.
## Comments
Select text and choose **Comment** to start a discussion; the text stays highlighted and the comment appears in
the **Comments** panel. People with the *commenter* role can comment without being able to edit. Authors and space
admins can delete comments.
The **Inbox** lists your notifications. Under its settings you choose whether they also come by email, and which
kinds (mentions, comments, replies, resolved threads, shared pages, reminders).
## Finding things
Press **Ctrl+K** (⌘K on a Mac) or click **Search** in the sidebar. With nothing typed it shows the pages you
+2
View File
@@ -3155,6 +3155,8 @@ export interface components {
* @enum {string}
*/
email: "digest" | "off";
/** @description The notification types the email digest includes (the others only reach the inbox). Always sent back; leave it out when saving to keep it as it is. */
emailTypes?: components["schemas"]["NotificationType"][];
};
AdminStats: {
/** @enum {string} */
+22 -22
View File
@@ -158,8 +158,9 @@ img.ProseMirror-separator {
`);if(a.length<2)return;let o=a[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(o)||!o.includes(`|`))return;let s=sP(i);if(s===i)return;let c=n.blockTokens(s)[0];if(c?.type!==`table`||!c.raw)return;let l=c.raw.split(`
`).length,u=e.split(`
`).slice(0,l).join(`
`);return{...c,raw:u}}},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=nP(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(w.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>jM(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>MM(e,t),deleteColumn:()=>({state:e,dispatch:t})=>{let n=vu(e.selection.$from,e=>e.type.name===`table`);return PM(e,t&&(e=>{n&&aP(e,n.pos),t(e)}))},addRowBefore:()=>({state:e,dispatch:t})=>LM(e,t),addRowAfter:()=>({state:e,dispatch:t})=>RM(e,t),deleteRow:()=>({state:e,dispatch:t})=>{let n=vu(e.selection.$from,e=>e.type.name===`table`);return BM(e,t&&(e=>{n&&aP(e,n.pos),t(e)}))},deleteTable:()=>({state:e,dispatch:t})=>$M(e,t),mergeCells:()=>({state:e,dispatch:t})=>UM(e,t),splitCell:()=>({state:e,dispatch:t})=>WM(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>YM(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>YM(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>XM(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>UM(e,t)?!0:WM(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>KM(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>QM(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>QM(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&DM(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=yM.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:iP,"Mod-Backspace":iP,Delete:iP,"Mod-Delete":iP}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[SN({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:null,lastColumnResizable:this.options.lastColumnResizable})]:[],IN({allowTableNodeSelection:this.options.allowTableNodeSelection}),hP()]},addNodeView(){let e=this.options.View;return e?({node:t,view:n,HTMLAttributes:r})=>{let i=A(this.options.HTMLAttributes,r);return new e(t,this.options.cellMinWidth,n,i)}:null},extendNodeSchema(e){return{tableRole:Nu(k(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}}),_P=Tp.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(gP.configure(this.options.table)),this.options.tableCell!==!1&&e.push(qN.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(JN.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(YN.configure(this.options.tableRow)),e}}),vP=Tp.create({name:`textAlign`,addOptions(){return{types:[],alignments:[`left`,`center`,`right`,`justify`],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>!Pf(e.textAlign)||!this.options.alignments.includes(e.textAlign)?{}:{style:`text-align: ${e.textAlign}`}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,`textAlign`)).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign(`left`),"Mod-Shift-e":()=>this.editor.commands.setTextAlign(`center`),"Mod-Shift-r":()=>this.editor.commands.setTextAlign(`right`),"Mod-Shift-j":()=>this.editor.commands.setTextAlign(`justify`)}}});function yP(){return[Nk.configure({HTMLAttributes:{class:`dw-tasks`}}),Mk.configure({nested:!0})]}function bP(){return[_P.configure({table:{resizable:!0,cellMinWidth:60,HTMLAttributes:{class:`dw-table`}}})]}var xP=vP.configure({types:[`heading`,`paragraph`],alignments:[`left`,`center`,`right`]}),SP=Tp.create({name:`headingShortcuts`,addKeyboardShortcuts(){let e={"Mod-Shift-0":()=>this.editor.commands.setParagraph()};for(let t of[1,2,3,4,5,6])e[`Mod-Shift-${t}`]=()=>this.editor.commands.toggleHeading({level:t});return e}}),CP=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,wP=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,TP=_p.create({name:`highlight`,addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute(`data-color`)||Af(e,`background-color`)||e.style.backgroundColor,renderHTML:e=>Pf(e.color)?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:`mark`}]},renderHTML({HTMLAttributes:e}){retuLine truncated
`).length+1)));let r=document.createElement(`div`);r.className=`dw-source__actions`;let i=(e,t,n)=>{let r=document.createElement(`button`);return r.type=`button`,r.className=`dw-source__btn ${t}`,r.textContent=e,r.addEventListener(`mousedown`,e=>e.preventDefault()),r.addEventListener(`click`,n),r};e.onRemove&&r.append(i(e.labels.remove,`dw-source__btn--danger`,()=>{u(!0),e.onRemove()}));let a=document.createElement(`span`);a.style.flex=`1`,r.append(a,i(e.labels.cancel,``,()=>u()),i(e.labels.done,`dw-source__btn--primary`,()=>o())),t.append(n,r),document.body.append(t);let o=()=>{let t=n.value;u(!0),e.onSave(t)};n.addEventListener(`input`,()=>e.onInput?.(n.value)),n.addEventListener(`keydown`,t=>{let n=t;n.key===`Escape`?(n.preventDefault(),u()):n.key===`Enter`&&(n.ctrlKey||n.metaKey||!e.multiline)&&(n.preventDefault(),o()),n.stopPropagation()});let s=n=>{!t.contains(n.target)&&!e.anchor.contains(n.target)&&u()};setTimeout(()=>document.addEventListener(`mousedown`,s),0);let c=wj(e.anchor,t,()=>{Oj(e.anchor,t,{placement:`bottom-start`,middleware:[Tj(6),Dj(),Ej({padding:8})]}).then(({x:e,y:n})=>Object.assign(t.style,{left:`${e}px`,top:`${n}px`}))}),l=!1;function u(n=!1){l||(l=!0,c(),document.removeEventListener(`mousedown`,s),t.remove(),cF===d&&(cF=null),n||e.onCancel?.())}let d=()=>u();return cF=d,n.focus(),e.multiline||n.select(),d}var uF=[{pattern:/^https:\/\/(?:www\.|m\.)?youtube\.com\/(?:watch\?(?:.*&)?v=|shorts\/|embed\/|live\/)([\w-]{11})/,src:e=>`https://www.youtube-nocookie.com/embed/${e[1]}`},{pattern:/^https:\/\/youtu\.be\/([\w-]{11})/,src:e=>`https://www.youtube-nocookie.com/embed/${e[1]}`},{pattern:/^https:\/\/(?:www\.)?vimeo\.com\/(?:video\/)?(\d+)/,src:e=>`https://player.vimeo.com/video/${e[1]}`},{pattern:/^https:\/\/(?:www\.)?loom\.com\/(?:share|embed)\/([\da-f]{32})/,src:e=>`https://www.loom.com/embed/${e[1]}`},{pattern:/^https:\/\/(?:www\.)?figma\.com\/(?:file|design|proto|board|slides)\/[\w-]+/,src:(e,t)=>`https://www.figma.com/embed?embed_host=docwell&url=${encodeURIComponent(t.href)}`},{pattern:/^https:\/\/codepen\.io\/([\w-]+)\/(?:pen|embed)\/([\w-]+)/,src:e=>`https://codepen.io/${e[1]}/embed/${e[2]}?default-tab=result`},{pattern:/^https:\/\/open\.spotify\.com\/(?:embed\/)?(track|album|playlist|episode|show)\/(\w+)/,src:e=>`https://open.spotify.com/embed/${e[1]}/${e[2]}`,ratio:`audio`},{pattern:/^https:\/\/docs\.google\.com\/(document|spreadsheets|presentation)\/d\/([\w-]+)/,src:e=>`https://docs.google.com/${e[1]}/d/${e[2]}/preview`,ratio:`tall`},{pattern:/^https:\/\/(?:www\.)?google\.com\/maps\/embed\?/,src:(e,t)=>t.href}];function dF(e){let t;try{t=new URL(e.trim())}catch{return null}for(let e of uF){let n=e.pattern.exec(t.href);if(n)return{src:e.src(n,t),ratio:e.ratio??`video`}}return null}function fF(e){try{let t=new URL(e.trim());return t.protocol===`https:`||t.protocol===`http:`?t.href:``}catch{return``}}var pF=e=>{try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}};function mF(e,t,n){let{node:r}=e.view.domAtPos(e.state.selection.from),i=r instanceof HTMLElement?r:r.parentElement??e.view.dom;return new Promise(e=>{let r=t.blocks;lF({anchor:i,value:`https://`,label:n,labels:{done:r.done,cancel:r.cancel,remove:r.remove},onSave:t=>e(fF(t)),onCancel:()=>e(``)})})}async function hF(e,t,n,r){let i=await mF(e,t,t.blocks.embedUrl);i&&(dF(i)?e.chain().focus().insertEmbed(i).run():await _F(e,i,n,r))}async function gF(e,t,n,r){let i=await mF(e,t,t.blocks.linkUrl);i&&await _F(e,i,n,r)}async function _F(e,t,n,r){let i={url:t};if(n)try{i={...await n.preview(t),url:t}}catch(e){r?.(e)}e.chain().focus().insertLinkCard(i).run()}var vF=Jp.create({name:`embed`,group:`block`,atom:!0,draggable:!0,addOptions(){return{labels:null}},addAttributes(){return{url:{default:``,parseHTML:e=>e.getAttribute(`data-url`)??``,renderHTML:e=>({"data-url":e.url})}}},parseHTML(){return[{tag:`div[data-type='embed']`}]},renderHTML({node:e,HTMLAttributes:t}){let n=fF(String(e.attrs.url));return[`div`,A(t,{"data-type":`embed`}),[`a`,{href:n},n]]},addCommands(){return{insertEmbed:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{url:e}})}},addNodeView(){return({node:e})=>{let t=this.options.labels.blocks,n=document.createElement(`figure`);n.className=`dw-embed`,n.setAttribute(`data-type`,`embed`),n.contentEditable=`false`;let r=e=>{let r=fF(e),i=dF(r);if(n.replaceChildren(),!i){let e=document.createElement(`a`);e.href=r,e.target=`_blank`,e.rel=`noopener noreferrer`,e.textContent=r||t.embedInvalid,n.append(e);return}n.dataset.ratio=i.ratio;let a=document.createElement(`iframe`);a.className=`dw-embed__frame`,a.src=i.src,a.title=`${t.embed}: ${pF(r)}`,a.loading=`lazy`,a.allow=`fullscreen; picture-in-picture; encrypted-media; clipboard-write`,a.referrerPolicy=`strict-origin-when-cross-origin`,a.setAttribute(`sandbox`,`allow-scripts allow-same-origin allow-popups allow-presentation`);let o=document.createElement(`figcaption`);o.className=`dw-embed__caption`;let s=document.createElement(`a`);s.href=r,s.targeLine truncated
`);return{...c,raw:u}}},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:a})=>{let o=nP(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(w.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>jM(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>MM(e,t),deleteColumn:()=>({state:e,dispatch:t})=>{let n=vu(e.selection.$from,e=>e.type.name===`table`);return PM(e,t&&(e=>{n&&aP(e,n.pos),t(e)}))},addRowBefore:()=>({state:e,dispatch:t})=>LM(e,t),addRowAfter:()=>({state:e,dispatch:t})=>RM(e,t),deleteRow:()=>({state:e,dispatch:t})=>{let n=vu(e.selection.$from,e=>e.type.name===`table`);return BM(e,t&&(e=>{n&&aP(e,n.pos),t(e)}))},deleteTable:()=>({state:e,dispatch:t})=>$M(e,t),mergeCells:()=>({state:e,dispatch:t})=>UM(e,t),splitCell:()=>({state:e,dispatch:t})=>WM(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>YM(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>YM(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>XM(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>UM(e,t)?!0:WM(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>KM(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>QM(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>QM(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&DM(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=yM.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:iP,"Mod-Backspace":iP,Delete:iP,"Mod-Delete":iP}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[SN({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:null,lastColumnResizable:this.options.lastColumnResizable})]:[],IN({allowTableNodeSelection:this.options.allowTableNodeSelection}),hP()]},addNodeView(){let e=this.options.View;return e?({node:t,view:n,HTMLAttributes:r})=>{let i=A(this.options.HTMLAttributes,r);return new e(t,this.options.cellMinWidth,n,i)}:null},extendNodeSchema(e){return{tableRole:Nu(k(e,`tableRole`,{name:e.name,options:e.options,storage:e.storage}))}}}),_P=Tp.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1&&e.push(gP.configure(this.options.table)),this.options.tableCell!==!1&&e.push(qN.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(JN.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(YN.configure(this.options.tableRow)),e}}),vP=Tp.create({name:`textAlign`,addOptions(){return{types:[],alignments:[`left`,`center`,`right`,`justify`],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{let t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>!Pf(e.textAlign)||!this.options.alignments.includes(e.textAlign)?{}:{style:`text-align: ${e.textAlign}`}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,`textAlign`)).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign(`left`),"Mod-Shift-e":()=>this.editor.commands.setTextAlign(`center`),"Mod-Shift-r":()=>this.editor.commands.setTextAlign(`right`),"Mod-Shift-j":()=>this.editor.commands.setTextAlign(`justify`)}}});function yP(){return[Nk.configure({HTMLAttributes:{class:`dw-tasks`}}),Mk.configure({nested:!0})]}function bP(){return[_P.configure({table:{resizable:!0,cellMinWidth:60,HTMLAttributes:{class:`dw-table`}}})]}var xP=vP.configure({types:[`heading`,`paragraph`],alignments:[`left`,`center`,`right`]}),SP=Tp.create({name:`headingShortcuts`,addKeyboardShortcuts(){let e={"Mod-Shift-0":()=>this.editor.commands.setParagraph()};for(let t of[1,2,3,4,5,6])e[`Mod-Shift-${t}`]=()=>this.editor.commands.toggleHeading({level:t});return e}}),CP=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,wP=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,TP=_p.create({name:`highlight`,addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute(`data-color`)||Af(e,`background-color`)||e.style.backgroundColor,renderHTML:e=>Pf(e.color)?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:`mark`}]},renderHTML({HTMLAttributes:e}){retuLine truncated
`);return/\s/.test(n)}):!1}function $P(e){return()=>{let t=e.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=e.view.coordsAtPos(t);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}}}function eF(e,t,n,r){return n?()=>{let n=r.getState(e.state)?.decorationId;return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect()||null}:$P(e)}function tF({match:e,dismissedRange:t,state:n,transaction:r,editor:i,shouldResetDismissed:a,effectiveAllowSpaces:o}){return a?.({editor:i,state:n,range:t,match:e,transaction:r,allowSpaces:o})?!1:o?e.range.from===t.from:e.range.from===t.from&&!QP(r)}function nF({view:e,pluginKeyRef:t}){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}function rF({pluginKey:e,decorationTag:t,decorationClass:n,decorationContent:r,decorationEmptyClass:i,renderer:a,dispatchExit:o}){return{handleKeyDown(t,n){var r;let i=e.getState(t.state);if(!i.active)return!1;if(n.key===`Escape`||n.key===`Esc`){var s;return a==null||(s=a.onKeyDown)==null||s.call(a,{view:t,event:n,range:i.range}),o(t),!0}return(a==null||(r=a.onKeyDown)==null?void 0:r.call(a,{view:t,event:n,range:i.range}))||!1},decorations(a){let{active:o,range:s,decorationId:c,query:l}=e.getState(a);if(!o)return null;let u=!l?.length,d=[n];return u&&d.push(i),xs.create(a.doc,[vs.inline(s.from,s.to,{nodeName:t,class:d.join(` `),"data-decoration-id":c||void 0,"data-decoration-content":r})])}}}function iF({editor:e,char:t,effectiveAllowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,findSuggestionMatch:o,allow:s,shouldShow:c,shouldKeepDismissed:l,pluginKey:u}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(d,f,p,m){let{isEditable:h}=e,{composing:g}=e.view,{selection:_}=d,{empty:v,from:y}=_,b={...f},x=d.getMeta(u);if(x&&x.exit)return b.active=!1,b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null,b.dismissedRange=f.active?{...f.range}:f.dismissedRange,b;if(b.composing=g,d.docChanged&&b.dismissedRange!==null&&(b.dismissedRange={from:d.mapping.map(b.dismissedRange.from),to:d.mapping.map(b.dismissedRange.to)}),h&&(v||e.view.composing)){(y<f.range.from||y>f.range.to)&&!g&&!f.composing&&(b.active=!1);let u=o({char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:_.$from}),p=`id_${Math.floor(Math.random()*4294967295)}`;u&&s({editor:e,state:m,range:u.range,isActive:f.active})&&(!c||c({editor:e,range:u.range,query:u.query,text:u.text,transaction:d}))?(b.dismissedRange!==null&&!l({match:u,dismissedRange:b.dismissedRange,state:m,transaction:d})&&(b.dismissedRange=null),b.dismissedRange===null?(b.active=!0,b.decorationId=f.decorationId||p,b.range=u.range,b.query=u.query,b.text=u.text):b.active=!1):(u||(b.dismissedRange=null),b.active=!1)}else b.active=!1;return b.active||(b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null),b}}}function aF({editor:e,items:t}){let n=null,r=null,i=null,a=()=>{r!==null&&(clearTimeout(r),r=null),i?.(),i=null},o=e=>new Promise(t=>{i=t,r=setTimeout(()=>{r=null;let e=i;i=null,e?.()},e)}),s=()=>{n?.abort(),a(),n=null};return{abort:s,fetch:async(r,i)=>{s(),n=new AbortController;let a=n;if(i>0&&await o(i),n!==a||a.signal.aborted)return{status:`aborted`};try{let i=await t({editor:e,query:r,signal:a.signal});return n!==a||a.signal.aborted?{status:`aborted`}:{status:`resolved`,items:i}}catch{return n!==a||a.signal.aborted?{status:`aborted`}:{status:`error`}}}}}function oF({placement:e,offset:t,flip:n,floatingUi:r}){var i;let a=[Tj({mainAxis:t.mainAxis??4,crossAxis:t.crossAxis??0})];return n&&a.push(Dj()),r!=null&&(i=r.middleware)!=null&&i.length&&a.push(...r.middleware),{placement:e,strategy:r?.strategy??`absolute`,middleware:a}}function sF(e){if(e instanceof HTMLElement)return e;if(typeof e==`string`)try{let t=document.querySelector(e);if(t)return t}catch{return document.body}return document.body}function cF({getReferenceRect:e,contextElement:t,config:n,container:r,dismissOnOutsideClick:i,dismiss:a}){return(o,s={})=>{let c={getBoundingClientRect:()=>e()??new DOMRect,contextElement:t},l=!1,u=!o.isConnected;u&&sF(r).appendChild(o),s.onPosition||(o.style.visibility=`hidden`,o.style.width=`max-content`);let d=wj(c,o,()=>{Oj(c,o,{placement:n.placement,strategy:n.strategy,middleware:n.middleware}).then(({x:e,y:t,placement:n,strategy:r})=>{s.onPosition?s.onPosition({x:e,y:t,placement:n,strategy:r}):(Object.assign(o.style,{position:r,left:`${e}px`,top:`${t}px`}),l||(l=!0,o.style.visibility=``))})},s.autoUpdate),f;return i&&(f=e=>{let n=e.target;!(n instanceof Node)||o.contains(n)||t.contains(n)||a()},document.addEventListener(`pointerdown`,f,!0)),()=>{d(),f&&document.removeEventListener(`pointerdown`,f,!0),u&&o.remove()}}}function lF({editor:e,pluginKey:t,items:n,renderer:r,minQueryLength:i,debounce:a,initialItems:o,placement:s,offset:c,container:l,flip:u,floatingUi:d,dismissOnOutsideClick:f,command:p,clientRectFor:m,dispatchExit:h}){let g,_=aF({editor:e,items:n}),v=oF({placLine truncated
`).length+1)));let r=document.createElement(`div`);r.className=`dw-source__actions`;let i=(e,t,n)=>{let r=document.createElement(`button`);return r.type=`button`,r.className=`dw-source__btn ${t}`,r.textContent=e,r.addEventListener(`mousedown`,e=>e.preventDefault()),r.addEventListener(`click`,n),r};e.onRemove&&r.append(i(e.labels.remove,`dw-source__btn--danger`,()=>{u(!0),e.onRemove()}));let a=document.createElement(`span`);a.style.flex=`1`,r.append(a,i(e.labels.cancel,``,()=>u()),i(e.labels.done,`dw-source__btn--primary`,()=>o())),t.append(n,r),document.body.append(t);let o=()=>{let t=n.value;u(!0),e.onSave(t)};n.addEventListener(`input`,()=>e.onInput?.(n.value)),n.addEventListener(`keydown`,t=>{let n=t;n.key===`Escape`?(n.preventDefault(),u()):n.key===`Enter`&&(n.ctrlKey||n.metaKey||!e.multiline)&&(n.preventDefault(),o()),n.stopPropagation()});let s=n=>{!t.contains(n.target)&&!e.anchor.contains(n.target)&&u()};setTimeout(()=>document.addEventListener(`mousedown`,s),0);let c=wj(e.anchor,t,()=>{Oj(e.anchor,t,{placement:`bottom-start`,middleware:[Tj(6),Dj(),Ej({padding:8})]}).then(({x:e,y:n})=>Object.assign(t.style,{left:`${e}px`,top:`${n}px`}))}),l=!1;function u(n=!1){l||(l=!0,c(),document.removeEventListener(`mousedown`,s),t.remove(),MF===d&&(MF=null),n||e.onCancel?.())}let d=()=>u();return MF=d,n.focus(),e.multiline||n.select(),d}var PF=[{pattern:/^https:\/\/(?:www\.|m\.)?youtube\.com\/(?:watch\?(?:.*&)?v=|shorts\/|embed\/|live\/)([\w-]{11})/,src:e=>`https://www.youtube-nocookie.com/embed/${e[1]}`},{pattern:/^https:\/\/youtu\.be\/([\w-]{11})/,src:e=>`https://www.youtube-nocookie.com/embed/${e[1]}`},{pattern:/^https:\/\/(?:www\.)?vimeo\.com\/(?:video\/)?(\d+)/,src:e=>`https://player.vimeo.com/video/${e[1]}`},{pattern:/^https:\/\/(?:www\.)?loom\.com\/(?:share|embed)\/([\da-f]{32})/,src:e=>`https://www.loom.com/embed/${e[1]}`},{pattern:/^https:\/\/(?:www\.)?figma\.com\/(?:file|design|proto|board|slides)\/[\w-]+/,src:(e,t)=>`https://www.figma.com/embed?embed_host=docwell&url=${encodeURIComponent(t.href)}`},{pattern:/^https:\/\/codepen\.io\/([\w-]+)\/(?:pen|embed)\/([\w-]+)/,src:e=>`https://codepen.io/${e[1]}/embed/${e[2]}?default-tab=result`},{pattern:/^https:\/\/open\.spotify\.com\/(?:embed\/)?(track|album|playlist|episode|show)\/(\w+)/,src:e=>`https://open.spotify.com/embed/${e[1]}/${e[2]}`,ratio:`audio`},{pattern:/^https:\/\/docs\.google\.com\/(document|spreadsheets|presentation)\/d\/([\w-]+)/,src:e=>`https://docs.google.com/${e[1]}/d/${e[2]}/preview`,ratio:`tall`},{pattern:/^https:\/\/(?:www\.)?google\.com\/maps\/embed\?/,src:(e,t)=>t.href}];function FF(e){let t;try{t=new URL(e.trim())}catch{return null}for(let e of PF){let n=e.pattern.exec(t.href);if(n)return{src:e.src(n,t),ratio:e.ratio??`video`}}return null}function IF(e){try{let t=new URL(e.trim());return t.protocol===`https:`||t.protocol===`http:`?t.href:``}catch{return``}}var LF=e=>{try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}};function RF(e,t,n){let{node:r}=e.view.domAtPos(e.state.selection.from),i=r instanceof HTMLElement?r:r.parentElement??e.view.dom;return new Promise(e=>{let r=t.blocks;NF({anchor:i,value:`https://`,label:n,labels:{done:r.done,cancel:r.cancel,remove:r.remove},onSave:t=>e(IF(t)),onCancel:()=>e(``)})})}async function zF(e,t,n,r){let i=await RF(e,t,t.blocks.embedUrl);i&&(FF(i)?e.chain().focus().insertEmbed(i).run():await VF(e,i,n,r))}async function BF(e,t,n,r){let i=await RF(e,t,t.blocks.linkUrl);i&&await VF(e,i,n,r)}async function VF(e,t,n,r){let i={url:t};if(n)try{i={...await n.preview(t),url:t}}catch(e){r?.(e)}e.chain().focus().insertLinkCard(i).run()}var HF=Jp.create({name:`embed`,group:`block`,atom:!0,draggable:!0,addOptions(){return{labels:null}},addAttributes(){return{url:{default:``,parseHTML:e=>e.getAttribute(`data-url`)??``,renderHTML:e=>({"data-url":e.url})}}},parseHTML(){return[{tag:`div[data-type='embed']`}]},renderHTML({node:e,HTMLAttributes:t}){let n=IF(String(e.attrs.url));return[`div`,A(t,{"data-type":`embed`}),[`a`,{href:n},n]]},addCommands(){return{insertEmbed:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{url:e}})}},addNodeView(){return({node:e})=>{let t=this.options.labels.blocks,n=document.createElement(`figure`);n.className=`dw-embed`,n.setAttribute(`data-type`,`embed`),n.contentEditable=`false`;let r=e=>{let r=IF(e),i=FF(r);if(n.replaceChildren(),!i){let e=document.createElement(`a`);e.href=r,e.target=`_blank`,e.rel=`noopener noreferrer`,e.textContent=r||t.embedInvalid,n.append(e);return}n.dataset.ratio=i.ratio;let a=document.createElement(`iframe`);a.className=`dw-embed__frame`,a.src=i.src,a.title=`${t.embed}: ${LF(r)}`,a.loading=`lazy`,a.allow=`fullscreen; picture-in-picture; encrypted-media; clipboard-write`,a.referrerPolicy=`strict-origin-when-cross-origin`,a.setAttribute(`sandbox`,`allow-scripts allow-same-origin allow-popups allow-presentation`);let o=document.createElement(`figcaption`);o.className=`dw-embed__caption`;let s=document.createElement(`a`);s.href=r,s.targeLine truncated
c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
@@ -170,7 +171,7 @@ c5.3,-9.3,12,-14,20,-14
H400000v`+(40+e)+`H845.2724
s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7
c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z
M`+(834+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},vI=function(e,t){return`M263,`+(601+e+t)+`c0.7,0,18,39.7,52,119
M`+(834+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},HI=function(e,t){return`M263,`+(601+e+t)+`c0.7,0,18,39.7,52,119
c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120
c340,-704.7,510.7,-1060.3,512,-1067
l`+e/2.084+` -`+e+`
@@ -180,7 +181,7 @@ s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,
c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1
s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26
c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z
M`+(1001+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},yI=function(e,t){return`M983 `+(10+e+t)+`
M`+(1001+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},UI=function(e,t){return`M983 `+(10+e+t)+`
l`+e/3.13+` -`+e+`
c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+`
H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7
@@ -189,7 +190,7 @@ c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30
c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722
c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5
c53.7,-170.3,84.5,-266.8,92.5,-289.5z
M`+(1001+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},bI=function(e,t){return`M424,`+(2398+e+t)+`
M`+(1001+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},WI=function(e,t){return`M424,`+(2398+e+t)+`
c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514
c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20
s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121
@@ -199,18 +200,18 @@ v`+(40+e)+`H1014.6
s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185
c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+` `+t+`
h400000v`+(40+e)+`h-400000z`},xI=function(e,t){return`M473,`+(2713+e+t)+`
h400000v`+(40+e)+`h-400000z`},GI=function(e,t){return`M473,`+(2713+e+t)+`
c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+` -`+e+`
c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7
s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9
c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200
c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26
s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104,
606zM`+(1001+e)+` `+t+`h400000v`+(40+e)+`H1017.7z`},SI=function(e){var t=e/2;return`M400000 `+e+` H0 L`+t+` 0 l65 45 L145 `+(e-80)+` H400000z`},CI=function(e,t,n){var r=n-54-t-e;return`M702 `+(e+t)+`H400000`+(40+e)+`
606zM`+(1001+e)+` `+t+`h400000v`+(40+e)+`H1017.7z`},KI=function(e){var t=e/2;return`M400000 `+e+` H0 L`+t+` 0 l65 45 L145 `+(e-80)+` H400000z`},qI=function(e,t,n){var r=n-54-t-e;return`M702 `+(e+t)+`H400000`+(40+e)+`
H742v`+r+`l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1
h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170
c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667
219 661 l218 661zM702 `+t+`H400000v`+(40+e)+`H742z`},wI=function(e,t,n){t=1e3*t;var r=``;switch(e){case`sqrtMain`:r=_I(t,gI);break;case`sqrtSize1`:r=vI(t,gI);break;case`sqrtSize2`:r=yI(t,gI);break;case`sqrtSize3`:r=bI(t,gI);break;case`sqrtSize4`:r=xI(t,gI);break;case`sqrtTall`:r=CI(t,gI,n)}return r},TI=function(e,t){switch(e){case`⎜`:return hI(`M291 0 H417 V`+t+` H291z`);case`∣`:return hI(`M145 0 H188 V`+t+` H145z`);case`∥`:return hI(`M145 0 H188 V`+t+` H145z`)+hI(`M367 0 H410 V`+t+` H367z`);case`⎟`:return hI(`M457 0 H583 V`+t+` H457z`);case`⎢`:return hI(`M319 0 H403 V`+t+` H319z`);case`⎥`:return hI(`M263 0 H347 V`+t+` H263z`);case`⎪`:return hI(`M384 0 H504 V`+t+` H384z`);case`⏐`:return hI(`M312 0 H355 V`+t+` H312z`);case`‖`:return hI(`M257 0 H300 V`+t+` H257z`)+hI(`M478 0 H521 V`+t+` H478z`);default:return``}},EI={doubleleftarrow:`M262 157
219 661 l218 661zM702 `+t+`H400000v`+(40+e)+`H742z`},JI=function(e,t,n){t=1e3*t;var r=``;switch(e){case`sqrtMain`:r=VI(t,BI);break;case`sqrtSize1`:r=HI(t,BI);break;case`sqrtSize2`:r=UI(t,BI);break;case`sqrtSize3`:r=WI(t,BI);break;case`sqrtSize4`:r=GI(t,BI);break;case`sqrtTall`:r=qI(t,BI,n)}return r},YI=function(e,t){switch(e){case`⎜`:return zI(`M291 0 H417 V`+t+` H291z`);case`∣`:return zI(`M145 0 H188 V`+t+` H145z`);case`∥`:return zI(`M145 0 H188 V`+t+` H145z`)+zI(`M367 0 H410 V`+t+` H367z`);case`⎟`:return zI(`M457 0 H583 V`+t+` H457z`);case`⎢`:return zI(`M319 0 H403 V`+t+` H319z`);case`⎥`:return zI(`M263 0 H347 V`+t+` H263z`);case`⎪`:return zI(`M384 0 H504 V`+t+` H384z`);case`⏐`:return zI(`M312 0 H355 V`+t+` H312z`);case`‖`:return zI(`M257 0 H300 V`+t+` H257z`)+zI(`M478 0 H521 V`+t+` H478z`);default:return``}},XI={doubleleftarrow:`M262 157
l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3
0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28
14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5
@@ -256,10 +257,10 @@ m0 0v40h400000v-40z`,leftharpoondown:`M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9
v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`,lefthook:`M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5
-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3
-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21
71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:hI(`M40 281 V428 H0 V94 H40 V241 H400000 v40z`),leftbracketunder:hI(`M0 0 h120 V290 H399995 v120 H0z`),leftbracketover:hI(`M0 440 h120 V150 H399995 v-120 H0z`),leftmapsto:hI(`M40 281 V448H0V74H40V241H400000v40z`),leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:zI(`M40 281 V428 H0 V94 H40 V241 H400000 v40z`),leftbracketunder:zI(`M0 0 h120 V290 H399995 v120 H0z`),leftbracketover:zI(`M0 440 h120 V150 H399995 v-120 H0z`),leftmapsto:zI(`M40 281 V448H0V74H40V241H400000v40z`),leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8
c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3
68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:hI(`M0 50 h400000 v40H0z m0 194h40000v40H0z`),midbrace:`M200428 334
68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:zI(`M0 50 h400000 v40H0z m0 194h40000v40H0z`),midbrace:`M200428 334
c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14
-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7
311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11
@@ -308,7 +309,7 @@ m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`,rightharpoondown
m0-194v40h400000v-40zm0 0v40h400000v-40z`,righthook:`M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3
15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0
-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21
66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:hI(`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`),rightbracketunder:hI(`M399995 0 h-120 V290 H0 v120 H400000z`),rightbracketover:hI(`M399995 440 h-120 V150 H0 v-120 H399995z`),rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`,rightlinesegment:zI(`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`),rightbracketunder:zI(`M399995 0 h-120 V290 H0 v120 H400000z`),rightbracketover:zI(`M399995 440 h-120 V150 H0 v-120 H399995z`),rightToFrom:`M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23
1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32
-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142
-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`,twoheadleftarrow:`M0 167c68 40
@@ -381,7 +382,7 @@ M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`
c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199,
-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6
c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},DI=function(e,t){switch(e){case`lbrack`:return`M403 1759 V84 H666 V0 H319 V1759 v`+t+` v1759 v84 h347 v-84
M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},ZI=function(e,t){switch(e){case`lbrack`:return`M403 1759 V84 H666 V0 H319 V1759 v`+t+` v1759 v84 h347 v-84
H403z M403 1759 V0 H319 V1759 v`+t+` v1759 v84 h84z`;case`rbrack`:return`M347 1759 V0 H0 V84 H263 V1759 v`+t+` v1759 H0 v84 H347z
M347 1759 V0 H263 V1759 v`+t+` v1759 h84z`;case`vert`:return`M145 15 v585 v`+t+` v585 c2.667,10,9.667,15,21,15
c10,0,16.667,-5,20,-15 v-585 v`+-t+` v-585 c-2.667,-10,-9.667,-15,-21,-15
@@ -409,18 +410,17 @@ c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6
c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17
c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558
l0,-`+(t+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw Error(`Unknown stretchy delimiter.`)}};function OI(e){return`toText`in e}var kI=class{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e=``,t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){return this.children.map(e=>{if(OI(e))return e.toText();throw Error(`Expected MathDomNode with toText, got `+e.constructor.name)}).join(``)}},AI={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},jI={ex:!0,em:!0,mu:!0},MI=function(e){return typeof e!=`string`&&(e=e.unit),e in AI||e in jI||e===`ex`},NI=function(e,t){var n;if(e.unit in AI)n=AI[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(e.unit===`mu`)n=t.fontMetrics().cssEmPerMu;else{var r=t.style.isTight()?t.havingStyle(t.style.text()):t;if(e.unit===`ex`)n=r.fontMetrics().xHeight;else if(e.unit===`em`)n=r.fontMetrics().quad;else throw new I(`Invalid unit: '`+e.unit+`'`);r!==t&&(n*=r.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},R=function(e){return+e.toFixed(4)+`em`},PI=function(e){return e.filter(e=>e).join(` `)},FI=function(e){var t=``;for(var n of Object.keys(e)){var r=e[n];r!==void 0&&(t+=IF(n)+`:`+r+`;`)}return t},II=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push(`mtight`);var r=t.getColor();r&&(this.style.color=r)}},LI=function(e){var t=document.createElement(e);t.className=PI(this.classes),Object.assign(t.style,this.style);for(var n of Object.keys(this.attributes))t.setAttribute(n,this.attributes[n]);for(var r=0;r<this.children.length;r++)t.appendChild(this.children[r].toNode());return t},RI=/[\s"'>/=\x00-\x1f]/,zI=function(e){var t=`<`+e;this.classes.length&&(t+=` class="`+zF(PI(this.classes))+`"`);var n=FI(this.style);n&&(t+=` style="`+zF(n)+`"`);for(var r of Object.keys(this.attributes)){if(RI.test(r))throw new I(`Invalid attribute name '`+r+`'`);t+=` `+r+`="`+zF(this.attributes[r])+`"`}t+=`>`;for(var i=0;i<this.children.length;i++)t+=this.children[i].toMarkup();return t+=`</`+e+`>`,t},BI=class{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,II.call(this,e,n,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return LI.call(this,`span`)}toMarkup(){return zI.call(this,`span`)}},VI=class{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,II.call(this,t,r),this.children=n||[],this.setAttribute(`href`,e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return LI.call(this,`a`)}toMarkup(){return zI.call(this,`a`)}},HI=class{constructor(e,t,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=[`mord`],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement(`img`);return e.src=this.src,e.alt=this.alt,e.className=`mord`,Object.assign(e.style,this.style),e}toMarkup(){var e=`<img src="`+zF(this.src)+`"`+(` alt="`+zF(this.alt)+`"`),t=FI(this.style);return t&&(e+=` style="`+zF(t)+`"`),e+=`'/>`,e}},UI={î:`ı̂`,ï:`ı̈`,í:`ı́`,ì:`ı̀`},WI=class{constructor(e,t,n,r,i,a,o,s){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=n||0,this.italic=r||0,this.skew=i||0,this.width=a||0,this.classes=o||[],this.style=s||{},this.maxFontSize=0;var c=fI(this.text.charCodeAt(0));c&&this.classes.push(c+`_fallback`),/[îïíì]/.test(this.text)&&(this.text=UI[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;return this.italic>0&&(t=document.createElement(`span`),t.style.marginRight=R(this.italic)),this.classes.length>0&&(t||=document.createElement(`span`),t.className=PI(this.classes)),Object.keys(this.style).length>0&&(t||=document.createElement(`span`),Object.assign(t.style,this.style)),t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t=`<span`;this.classes.length&&(e=!0,t+=` class="`,t+=zF(PI(this.classes)Line truncated
`+h+` children.`);for(var v=0;v<h;v++){var y=new GI([new KI(d[v])],{width:`400em`,height:R(m),viewBox:`0 0 `+n+` `+p,preserveAspectRatio:_[v]+` slice`}),b=QL([g[v]],[y],t);if(h===1)return{span:b,minWidth:f,height:m};b.style.height=R(m),l.push(b)}return{span:Y([`katex-stretchy`],l,t),minWidth:f,height:m}}var r=n(),i=r.span,a=r.minWidth,o=r.height;return i.height=o,i.style.height=R(o),a>0&&(i.style.minWidth=R(a)),i},sz=function(e,t,n,r,i){var a,o=e.height+e.depth+n+r;if(/fbox|color|angl/.test(t)){if(a=Y([`katex-stretchy`,t],[],i),t===`fbox`){var s=i.color&&i.getColor();s&&(a.style.borderColor=s)}}else{var c=[];/^[bx]cancel$/.test(t)&&c.push(new qI({x1:`0`,y1:`0`,x2:`100%`,y2:`100%`,"stroke-width":`0.046em`})),/^x?cancel$/.test(t)&&c.push(new qI({x1:`0`,y1:`100%`,x2:`100%`,y2:`0`,"stroke-width":`0.046em`})),a=QL([],[new GI(c,{width:`100%`,height:R(o)})],i)}return a.height=o,a.style.height=R(o),a},cz=[`bin`,`close`,`inner`,`open`,`punct`,`rel`],lz=[`accent-token`,`mathord`,`op-token`,`spacing`,`textord`],uz=new Set(cz),dz=new Set(lz);function fz(e){return uz.has(e)}function Q(e,t){if(!e||e.type!==t)throw Error(`Expected node of type `+t+`, but got `+(e?`node of type `+e.type:String(e)));return e}function pz(e){var t=mz(e);if(!t)throw Error(`Expected node of symbol group type, but got `+(e?`node of type `+e.type:String(e)));return t}function mz(e){return e.type===`atom`||dz.has(e.type)?e:null}function hz(e,t,n){var r=``;for(var i of e.body)if(i.type===`textord`)r+=i.text;else if(n&&i.type===`spacing`&&i.text===` `)r+=` `;else throw new I(t,e);return r}var gz=e=>{if(e instanceof WI)return e;if(XI(e)&&e.children.length===1)return gz(e.children[0])},_z=(e,t)=>{var n,r,i;e&&e.type===`supsub`?(r=Q(e.base,`accent`),n=r.base,e.base=n,i=YI(jR(e,t)),e.base=r):(r=Q(e,`accent`),n=r.base);var a=jR(n,t.havingCrampedStyle()),o=r.isShifty&&HF(n),s=0;o&&(s=gz(a)?.skew??0);var c=r.label===`\\c`,l=c?a.height+a.depth:Math.min(a.height,t.fontMetrics().xHeight),u;if(r.isStretchy)u=oz(r,t),u=iR({positionType:`firstBaseline`,children:[{type:`elem`,elem:a},{type:`elem`,elem:u,wrapperClasses:[`svg-align`],wrapperStyle:s>0?{width:`calc(100% - `+R(2*s)+`)`,marginLeft:R(2*s)}:void 0}]});else{var d,f;r.label===`\\vec`?(d=lR(`vec`,t),f=cR.vec[1]):(d=JL({type:`textord`,mode:r.mode,text:r.label},t),d=JI(d),d.italic=0,f=d.width,c&&(l+=d.depth)),u=Y([`accent-body`],[d]);var p=r.label===`\\textcircled`;p&&(u.classes.push(`accent-full`),l=a.height);var m=s;p||(m-=f/2),u.style.left=R(m),r.label===`\\textcircled`&&(u.style.top=`.2em`),u=iR({positionType:`firstBaseline`,children:[{type:`elem`,elem:a},{type:`kern`,size:-l},{type:`elem`,elem:u}]})}var h=Y([`mord`,`katex-accent`],[u],t);return i?(i.children[0]=h,i.height=Math.max(h.height,i.height),i.classes[0]=`mord`,i):h},vz=(e,t)=>{var n=e.isStretchy?rz(e.label):new Z(`mo`,[zR(e.label,e.mode)]),r=new Z(`mover`,[KR(e.base,t),n]);return r.setAttribute(`accent`,`true`),r},yz=new RegExp([`\\acute`,`\\grave`,`\\ddot`,`\\tilde`,`\\bar`,`\\breve`,`\\check`,`\\hat`,`\\vec`,`\\dot`,`\\mathring`].map(e=>`\\`+e).join(`|`));X({type:`accent`,names:[`\\acute`,`\\grave`,`\\ddot`,`\\tilde`,`\\bar`,`\\breve`,`\\check`,`\\hat`,`\\vec`,`\\dot`,`\\mathring`,`\\widecheck`,`\\widehat`,`\\widetilde`,`\\overrightarrow`,`\\overleftarrow`,`\\Overrightarrow`,`\\overleftrightarrow`,`\\overgroup`,`\\overlinesegment`,`\\overleftharpoon`,`\\overrightharpoon`],numArgs:1,handler:(e,t)=>{var n=yR(t[0]),r=!yz.test(e.funcName),i=!r||e.funcName===`\\widehat`||e.funcName===`\\widetilde`||e.funcName===`\\widecheck`;return{type:`accent`,mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:i,base:n}},htmlBuilder:_z,mathmlBuilder:vz}),X({type:`accent`,names:[`\\'`,"\\`",`\\^`,`\\~`,`\\=`,`\\u`,`\\.`,`\\"`,`\\c`,`\\r`,`\\H`,`\\v`,`\\textcircled`],numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:[`primitive`],handler:(e,t)=>{var n=t[0],r=e.parser.mode;return r===`math`&&(e.parser.settings.reportNonstrict(`mathVsTextAccents`,`LaTeX's accent `+e.funcName+` works only in text mode`),r=`text`),{type:`accent`,mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}}}),X({type:`accentUnder`,names:[`\\underleftarrow`,`\\underrightarrow`,`\\underleftrightarrow`,`\\undergroup`,`\\underlinesegment`,`\\utilde`],numArgs:1,handler:(e,t)=>{var n=e.parser,r=e.funcName,i=t[0];return{type:`accentUnder`,mode:n.mode,label:r,base:i}},htmlBuilder:(e,t)=>{var n=jR(e.base,t),r=oz(e,t),i=e.label===`\\utilde`?.12:0;return Y([`mord`,`accentunder`],[iR({positionType:`top`,positionData:n.height,children:[{type:`elem`,elem:r,wrapperClasses:[`svg-align`]},{type:`kern`,size:i},{type:`elem`,elem:n}]})],t)},mathmlBuilder:(e,t)=>{var n=rz(e.label),r=new Z(`munder`,[KR(e.base,t),n]);return r.setAttribute(`accentunder`,`true`),r}});var bz=e=>{var t=new Z(`mpadded`,e?[e]:[]);return t.setAttribute(`width`,`+0.6em`),t.setAttribute(`lspace`,`0.3em`),t};X({type:`xArrow`,names:[`\\xleftarrow`,`\\xrightarrow`,`\\xLeftarrow`,`\\xRightarrow`,`\\xleftrightarLine truncated
]`,dV=`\\\\[a-zA-Z@]+`,fV=`\\\\[^\ud800-\udfff]`,pV=`(`+dV+`)`+uV+`*`,mV=`\\\\(
-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`;default:throw Error(`Unknown stretchy delimiter.`)}};function QI(e){return`toText`in e}var $I=class{constructor(e){this.children=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.children=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){for(var e=``,t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){return this.children.map(e=>{if(QI(e))return e.toText();throw Error(`Expected MathDomNode with toText, got `+e.constructor.name)}).join(``)}},eL={pt:1,mm:7227/2540,cm:7227/254,in:72.27,bp:803/800,pc:12,dd:1238/1157,cc:14856/1157,nd:685/642,nc:1370/107,sp:1/65536,px:803/800},tL={ex:!0,em:!0,mu:!0},nL=function(e){return typeof e!=`string`&&(e=e.unit),e in eL||e in tL||e===`ex`},rL=function(e,t){var n;if(e.unit in eL)n=eL[e.unit]/t.fontMetrics().ptPerEm/t.sizeMultiplier;else if(e.unit===`mu`)n=t.fontMetrics().cssEmPerMu;else{var r=t.style.isTight()?t.havingStyle(t.style.text()):t;if(e.unit===`ex`)n=r.fontMetrics().xHeight;else if(e.unit===`em`)n=r.fontMetrics().quad;else throw new I(`Invalid unit: '`+e.unit+`'`);r!==t&&(n*=r.sizeMultiplier/t.sizeMultiplier)}return Math.min(e.number*n,t.maxSize)},R=function(e){return+e.toFixed(4)+`em`},iL=function(e){return e.filter(e=>e).join(` `)},aL=function(e){var t=``;for(var n of Object.keys(e)){var r=e[n];r!==void 0&&(t+=oI(n)+`:`+r+`;`)}return t},oL=function(e,t,n){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=n||{},t){t.style.isTight()&&this.classes.push(`mtight`);var r=t.getColor();r&&(this.style.color=r)}},sL=function(e){var t=document.createElement(e);t.className=iL(this.classes),Object.assign(t.style,this.style);for(var n of Object.keys(this.attributes))t.setAttribute(n,this.attributes[n]);for(var r=0;r<this.children.length;r++)t.appendChild(this.children[r].toNode());return t},cL=/[\s"'>/=\x00-\x1f]/,lL=function(e){var t=`<`+e;this.classes.length&&(t+=` class="`+lI(iL(this.classes))+`"`);var n=aL(this.style);n&&(t+=` style="`+lI(n)+`"`);for(var r of Object.keys(this.attributes)){if(cL.test(r))throw new I(`Invalid attribute name '`+r+`'`);t+=` `+r+`="`+lI(this.attributes[r])+`"`}t+=`>`;for(var i=0;i<this.children.length;i++)t+=this.children[i].toMarkup();return t+=`</`+e+`>`,t},uL=class{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.width=void 0,this.maxFontSize=void 0,this.style=void 0,this.italic=void 0,oL.call(this,e,n,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return sL.call(this,`span`)}toMarkup(){return lL.call(this,`span`)}},dL=class{constructor(e,t,n,r){this.children=void 0,this.attributes=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,oL.call(this,t,r),this.children=n||[],this.setAttribute(`href`,e)}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return sL.call(this,`a`)}toMarkup(){return lL.call(this,`a`)}},fL=class{constructor(e,t,n){this.src=void 0,this.alt=void 0,this.classes=void 0,this.height=void 0,this.depth=void 0,this.maxFontSize=void 0,this.style=void 0,this.alt=t,this.src=e,this.classes=[`mord`],this.height=0,this.depth=0,this.maxFontSize=0,this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement(`img`);return e.src=this.src,e.alt=this.alt,e.className=`mord`,Object.assign(e.style,this.style),e}toMarkup(){var e=`<img src="`+lI(this.src)+`"`+(` alt="`+lI(this.alt)+`"`),t=aL(this.style);return t&&(e+=` style="`+lI(t)+`"`),e+=`'/>`,e}},pL={î:`ı̂`,ï:`ı̈`,í:`ı́`,ì:`ı̀`},mL=class{constructor(e,t,n,r,i,a,o,s){this.text=void 0,this.height=void 0,this.depth=void 0,this.italic=void 0,this.skew=void 0,this.width=void 0,this.maxFontSize=void 0,this.classes=void 0,this.style=void 0,this.text=e,this.height=t||0,this.depth=n||0,this.italic=r||0,this.skew=i||0,this.width=a||0,this.classes=o||[],this.style=s||{},this.maxFontSize=0;var c=II(this.text.charCodeAt(0));c&&this.classes.push(c+`_fallback`),/[îïíì]/.test(this.text)&&(this.text=pL[this.text])}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createTextNode(this.text),t=null;return this.italic>0&&(t=document.createElement(`span`),t.style.marginRight=R(this.italic)),this.classes.length>0&&(t||=document.createElement(`span`),t.className=iL(this.classes)),Object.keys(this.style).length>0&&(t||=document.createElement(`span`),Object.assign(t.style,this.style)),t?(t.appendChild(e),t):e}toMarkup(){var e=!1,t=`<span`;this.classes.length&&(e=!0,t+=` class="`,t+=lI(iL(this.classes)Line truncated
`+h+` children.`);for(var v=0;v<h;v++){var y=new hL([new gL(d[v])],{width:`400em`,height:R(m),viewBox:`0 0 `+n+` `+p,preserveAspectRatio:_[v]+` slice`}),b=SR([g[v]],[y],t);if(h===1)return{span:b,minWidth:f,height:m};b.style.height=R(m),l.push(b)}return{span:Y([`katex-stretchy`],l,t),minWidth:f,height:m}}var r=n(),i=r.span,a=r.minWidth,o=r.height;return i.height=o,i.style.height=R(o),a>0&&(i.style.minWidth=R(a)),i},jz=function(e,t,n,r,i){var a,o=e.height+e.depth+n+r;if(/fbox|color|angl/.test(t)){if(a=Y([`katex-stretchy`,t],[],i),t===`fbox`){var s=i.color&&i.getColor();s&&(a.style.borderColor=s)}}else{var c=[];/^[bx]cancel$/.test(t)&&c.push(new _L({x1:`0`,y1:`0`,x2:`100%`,y2:`100%`,"stroke-width":`0.046em`})),/^x?cancel$/.test(t)&&c.push(new _L({x1:`0`,y1:`100%`,x2:`100%`,y2:`0`,"stroke-width":`0.046em`})),a=SR([],[new hL(c,{width:`100%`,height:R(o)})],i)}return a.height=o,a.style.height=R(o),a},Mz=[`bin`,`close`,`inner`,`open`,`punct`,`rel`],Nz=[`accent-token`,`mathord`,`op-token`,`spacing`,`textord`],Pz=new Set(Mz),Fz=new Set(Nz);function Iz(e){return Pz.has(e)}function Q(e,t){if(!e||e.type!==t)throw Error(`Expected node of type `+t+`, but got `+(e?`node of type `+e.type:String(e)));return e}function Lz(e){var t=Rz(e);if(!t)throw Error(`Expected node of symbol group type, but got `+(e?`node of type `+e.type:String(e)));return t}function Rz(e){return e.type===`atom`||Fz.has(e.type)?e:null}function zz(e,t,n){var r=``;for(var i of e.body)if(i.type===`textord`)r+=i.text;else if(n&&i.type===`spacing`&&i.text===` `)r+=` `;else throw new I(t,e);return r}var Bz=e=>{if(e instanceof mL)return e;if(bL(e)&&e.children.length===1)return Bz(e.children[0])},Vz=(e,t)=>{var n,r,i;e&&e.type===`supsub`?(r=Q(e.base,`accent`),n=r.base,e.base=n,i=yL(tz(e,t)),e.base=r):(r=Q(e,`accent`),n=r.base);var a=tz(n,t.havingCrampedStyle()),o=r.isShifty&&fI(n),s=0;o&&(s=Bz(a)?.skew??0);var c=r.label===`\\c`,l=c?a.height+a.depth:Math.min(a.height,t.fontMetrics().xHeight),u;if(r.isStretchy)u=Az(r,t),u=OR({positionType:`firstBaseline`,children:[{type:`elem`,elem:a},{type:`elem`,elem:u,wrapperClasses:[`svg-align`],wrapperStyle:s>0?{width:`calc(100% - `+R(2*s)+`)`,marginLeft:R(2*s)}:void 0}]});else{var d,f;r.label===`\\vec`?(d=NR(`vec`,t),f=MR.vec[1]):(d=vR({type:`textord`,mode:r.mode,text:r.label},t),d=vL(d),d.italic=0,f=d.width,c&&(l+=d.depth)),u=Y([`accent-body`],[d]);var p=r.label===`\\textcircled`;p&&(u.classes.push(`accent-full`),l=a.height);var m=s;p||(m-=f/2),u.style.left=R(m),r.label===`\\textcircled`&&(u.style.top=`.2em`),u=OR({positionType:`firstBaseline`,children:[{type:`elem`,elem:a},{type:`kern`,size:-l},{type:`elem`,elem:u}]})}var h=Y([`mord`,`katex-accent`],[u],t);return i?(i.children[0]=h,i.height=Math.max(h.height,i.height),i.classes[0]=`mord`,i):h},Hz=(e,t)=>{var n=e.isStretchy?Dz(e.label):new Z(`mo`,[lz(e.label,e.mode)]),r=new Z(`mover`,[gz(e.base,t),n]);return r.setAttribute(`accent`,`true`),r},Uz=new RegExp([`\\acute`,`\\grave`,`\\ddot`,`\\tilde`,`\\bar`,`\\breve`,`\\check`,`\\hat`,`\\vec`,`\\dot`,`\\mathring`].map(e=>`\\`+e).join(`|`));X({type:`accent`,names:[`\\acute`,`\\grave`,`\\ddot`,`\\tilde`,`\\bar`,`\\breve`,`\\check`,`\\hat`,`\\vec`,`\\dot`,`\\mathring`,`\\widecheck`,`\\widehat`,`\\widetilde`,`\\overrightarrow`,`\\overleftarrow`,`\\Overrightarrow`,`\\overleftrightarrow`,`\\overgroup`,`\\overlinesegment`,`\\overleftharpoon`,`\\overrightharpoon`],numArgs:1,handler:(e,t)=>{var n=UR(t[0]),r=!Uz.test(e.funcName),i=!r||e.funcName===`\\widehat`||e.funcName===`\\widetilde`||e.funcName===`\\widecheck`;return{type:`accent`,mode:e.parser.mode,label:e.funcName,isStretchy:r,isShifty:i,base:n}},htmlBuilder:Vz,mathmlBuilder:Hz}),X({type:`accent`,names:[`\\'`,"\\`",`\\^`,`\\~`,`\\=`,`\\u`,`\\.`,`\\"`,`\\c`,`\\r`,`\\H`,`\\v`,`\\textcircled`],numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:[`primitive`],handler:(e,t)=>{var n=t[0],r=e.parser.mode;return r===`math`&&(e.parser.settings.reportNonstrict(`mathVsTextAccents`,`LaTeX's accent `+e.funcName+` works only in text mode`),r=`text`),{type:`accent`,mode:r,label:e.funcName,isStretchy:!1,isShifty:!0,base:n}}}),X({type:`accentUnder`,names:[`\\underleftarrow`,`\\underrightarrow`,`\\underleftrightarrow`,`\\undergroup`,`\\underlinesegment`,`\\utilde`],numArgs:1,handler:(e,t)=>{var n=e.parser,r=e.funcName,i=t[0];return{type:`accentUnder`,mode:n.mode,label:r,base:i}},htmlBuilder:(e,t)=>{var n=tz(e.base,t),r=Az(e,t),i=e.label===`\\utilde`?.12:0;return Y([`mord`,`accentunder`],[OR({positionType:`top`,positionData:n.height,children:[{type:`elem`,elem:r,wrapperClasses:[`svg-align`]},{type:`kern`,size:i},{type:`elem`,elem:n}]})],t)},mathmlBuilder:(e,t)=>{var n=Dz(e.label),r=new Z(`munder`,[gz(e.base,t),n]);return r.setAttribute(`accentunder`,`true`),r}});var Wz=e=>{var t=new Z(`mpadded`,e?[e]:[]);return t.setAttribute(`width`,`+0.6em`),t.setAttribute(`lspace`,`0.3em`),t};X({type:`xArrow`,names:[`\\xleftarrow`,`\\xrightarrow`,`\\xLeftarrow`,`\\xRightarrow`,`\\xleftrightarLine truncated
]`,FV=`\\\\[a-zA-Z@]+`,IV=`\\\\[^\ud800-\udfff]`,LV=`(`+FV+`)`+PV+`*`,RV=`\\\\(
|[ \r ]+
?)[ \r ]*`,hV=`[̀-ͯ]`,gV=RegExp(hV+`+$`),_V=`(`+uV+`+)|`+(mV+`|`)+`([!-\\[\\]-‧‪-퟿豈-￿]`+(hV+`*`)+`|[\ud800-\udbff][\udc00-\udfff]`+(hV+`*`)+`|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5`+(`|`+pV)+(`|`+fV+`)`),vV=class{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(_V,`g`),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new vB(`EOF`,new _B(this,t,t));var n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new I(`Unexpected character: '`+e[t]+`'`,new vB(e[t],new _B(this,t,t+1)));var r=n[6]||n[3]||(n[2]?`\\ `:` `);if(this.catcodes[r]===14){var i=e.indexOf(`
`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict(`commentAtEnd`,`% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)`)):this.tokenRegex.lastIndex=i+1,this.lex()}return new vB(r,new _B(this,t,this.tokenRegex.lastIndex))}},yV=class{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new I(`Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug`);var e=this.undefStack.pop();for(var t of Object.keys(e))e[t]===void 0?delete this.current[t]:this.current[t]=e[t]}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return Object.prototype.hasOwnProperty.call(this.current,e)||Object.prototype.hasOwnProperty.call(this.builtins,e)}get(e){if(Object.prototype.hasOwnProperty.call(this.current,e))return this.current[e];if(Object.prototype.hasOwnProperty.call(this.builtins,e))return this.builtins[e]}set(e,t,n){if(n===void 0&&(n=!1),n){for(var r=0;r<this.undefStack.length;r++)delete this.undefStack[r][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var i=this.undefStack[this.undefStack.length-1];i&&!Object.prototype.hasOwnProperty.call(i,e)&&(i[e]=Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:void 0)}t==null?delete this.current[e]:this.current[e]=t}},bV=gB;$(`\\noexpand`,function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),$(`\\expandafter`,function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),$(`\\@firstoftwo`,function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),$(`\\@secondoftwo`,function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),$(`\\@ifnextchar`,function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),$(`\\@ifstar`,`\\@ifnextchar *{\\@firstoftwo{#1}}`),$(`\\TextOrMath`,function(e){var t=e.consumeArgs(2);return e.mode===`text`?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var xV={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};$(`\\char`,function(e){var t=e.popToken(),n,r=0;if(t.text===`'`)n=8,t=e.popToken();else if(t.text===`"`)n=16,t=e.popToken();else if(t.text==="`"){if(t=e.popToken(),t.text[0]===`\\`)r=t.text.charCodeAt(1);else if(t.text===`EOF`)throw new I("\\char` missing argument");else r=t.text.charCodeAt(0)}else n=10;if(n){if(r=xV[t.text],r==null||r>=n)throw new I(`Invalid base-`+n+` digit `+t.text);for(var i;(i=xV[e.future().text])!=null&&i<n;)r*=n,r+=i,e.popToken()}return`\\@char{`+r+`}`});var SV=(e,t,n,r)=>{var i=e.consumeArg().tokens;if(i.length!==1)throw new I(`\\newcommand's first argument must be a macro name`);var a=i[0].text,o=e.isDefined(a);if(o&&!t)throw new I(`\\newcommand{`+a+`} attempting to redefine `+(a+`; use \\renewcommand`));if(!o&&!n)throw new I(`\\renewcommand{`+a+`} when command `+a+` does not yet exist; use \\newcommand`);var s=0;if(i=e.consumeArg().tokens,i.length===1&&i[0].text===`[`){for(var c=``,l=e.expandNextToken();l.text!==`]`&&l.text!==`EOF`;)c+=l.text,l=e.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new I(`Invalid number of arguments: `+c);s=parseInt(c),i=e.consumeArg().tokens}return o&&r||e.macros.set(a,{tokens:i,numArgs:s}),``};$(`\\newcommand`,e=>SV(e,!1,!0,!1)),$(`\\renewcommand`,e=>SV(e,!0,!1,!1)),$(`\\providecommand`,e=>SV(e,!0,!0,!0)),$(`\\message`,e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(e=>e.text).join(``)),``}),$(`\\errmessage`,e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(e=>e.text).join(``)),``}),$(`\\show`,e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),lV[n],iL.math[n],iL.text[n]),``}),$(`\\bgroup`,`{`),$(`\\egroup`,`}`),$(`~`,`\\nobreakspace`),$(`\\lq`,"`"),$(`\\rq`,`'`),$(`\\aa`,`\\r a`),$(`\\AA`,`\\r A`),$(`\\textcopyright`,"\\html@mathml{\\textcircled{c}}{\\char`©}"),$(`\\copyright`,`\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}`),$(`\\textregistered`,"\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),$(`ℬ`,`\\mathscr{B}`),$(`ℰ`,`\\mathscr{E}`),$(`ℱ`,`\\mathscr{F}`),$(`ℋ`,`\\mathscr{H}`),$(`ℐ`,`\\mathscr{I}`),$(`ℒ`,`\\mathscr{L}`),$(`ℳ`,`\\mathscr{M}`),$(`ℛ`,`\\mathscr{R}`),$(`ℭ`,`\\mathfrak{C}`),$(`ℌ`,`\\mathfrak{H}`),$(`ℨ`,`\\mathfrak{Z}`),$(`\\Bbbk`,`\\Bbb{k}`),$(`\\llap`,`\\mathllap{\\textrm{#1}}`),$(`\\rlap`,`\\mathrlap{\\textrm{#1}}`),$(`\\clap`,`\\mathclap{\\textrm{#1}}`),$(`\\mathstrut`,`\\vphantom{(}`),$(`\\underbar`,`\\underline{\\text{#1}}`),$(`\\not`,`\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}`),$(`\\neq`,"\\html@mathml{\\mathreLine truncated
please report what input caused this bug`);return n=n.slice(1,-1),{type:`verb`,mode:`text`,body:n,star:r}}Object.prototype.hasOwnProperty.call(NV,t[0])&&!iL[this.mode][t[0]]&&(this.settings.strict&&this.mode===`math`&&this.settings.reportNonstrict(`unicodeTextInMathMode`,`Accented Unicode text character "`+t[0]+`" used in math mode`,e),t=NV[t[0]]+t.slice(1));var i=gV.exec(t);i&&(t=t.substring(0,i.index),t===`i`?t=`ı`:t===`j`&&(t=`ȷ`));var a;if(iL[this.mode][t]){this.settings.strict&&this.mode===`math`&&EL.includes(t)&&this.settings.reportNonstrict(`unicodeTextInMathMode`,`Latin-1/Unicode text character "`+t[0]+`" used in math mode`,e);var o=iL[this.mode][t].group,s=_B.range(e);a=fz(o)?{type:`atom`,mode:this.mode,family:o,loc:s,text:t}:{type:o,mode:this.mode,loc:s,text:t}}else if(t.charCodeAt(0)>=128)this.settings.strict&&(mI(t.charCodeAt(0))?this.mode===`math`&&this.settings.reportNonstrict(`unicodeTextInMathMode`,`Unicode text character "`+t[0]+`" used in math mode`,e):this.settings.reportNonstrict(`unknownSymbol`,`Unrecognized Unicode character "`+t[0]+`"`+(` (`+t.charCodeAt(0)+`)`),e)),a={type:`textord`,mode:`text`,loc:_B.range(e),text:t};else return null;if(this.consume(),i)for(var c=0;c<i[0].length;c++){var l=i[0][c];if(!MV[l])throw new I(`Unknown accent ' `+l+`'`,e);var u=MV[l][this.mode]||MV[l].text;if(!u)throw new I(`Accent `+l+` unsupported in `+this.mode+` mode`,e);a={type:`accent`,mode:this.mode,loc:_B.range(e),label:u,isStretchy:!1,isShifty:!0,base:a}}return a}};PV.endOfExpression=new Set([`}`,`\\endgroup`,`\\end`,`\\right`,`&`]);var FV=function(e,t){if(!(typeof e==`string`||e instanceof String))throw TypeError(`KaTeX can only parse string typed expression`);var n=new PV(e,t);delete n.gullet.macros.current[`\\df@tag`];var r=n.parse();if(delete n.gullet.macros.current[`\\current@color`],delete n.gullet.macros.current[`\\color`],n.gullet.macros.get(`\\df@tag`)){if(!t.displayMode)throw new I(`\\tag works only in display equations`);r=[{type:`tag`,mode:`text`,body:r,tag:n.subparse([new vB(`\\df@tag`)])}]}return r},IV=function(e,t,n){t.textContent=``;var r=BV(e,n).toNode();t.appendChild(r)};typeof document<`u`&&document.compatMode!==`CSS1Compat`&&(typeof console<`u`&&console.warn(`Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype.`),IV=function(){throw new I(`KaTeX doesn't work in quirks mode.`)});var LV=function(e,t){return BV(e,t).toMarkup()},RV=function(e,t){return FV(e,new JF(t))},zV=function(e,t,n){if(n.throwOnError||!(e instanceof I))throw e;var r=Y([`katex-error`],[new WI(t)]);return r.setAttribute(`title`,e.toString()),r.setAttribute(`style`,`color:`+n.errorColor),r},BV=function(e,t){var n=new JF(t);try{return ez(FV(e,n),e,n)}catch(t){return zV(t,e,n)}},VV={version:`0.18.10`,render:IV,renderToString:LV,ParseError:I,SETTINGS_SCHEMA:WF,__parse:RV,__renderToDomTree:BV,__renderToHTMLTree:function(e,t){var n=new JF(t);try{return tz(FV(e,n),e,n)}catch(t){return zV(t,e,n)}},__setFontMetrics:eL,__defineSymbol:z,__defineFunction:X,__defineMacro:$,__domTree:{Span:BI,Anchor:VI,SymbolNode:WI,SvgNode:GI,PathNode:KI,LineNode:qI}},HV=Jp.create({name:`blockMath`,group:`block`,atom:!0,addOptions(){return{onClick:void 0,katexOptions:void 0}},addAttributes(){return{latex:{default:``,parseHTML:e=>e.getAttribute(`data-latex`),renderHTML:e=>({"data-latex":e.latex})}}},addCommands(){return{insertBlockMath:e=>({commands:t,editor:n})=>{let{latex:r,pos:i}=e;return r?t.insertContentAt(i??n.state.selection.from,{type:this.name,attrs:{latex:r}}):!1},deleteBlockMath:e=>({editor:t,tr:n})=>{let r=e?.pos??t.state.selection.$from.pos,i=t.state.doc.nodeAt(r);return!i||i.type.name!==this.name?!1:(n.delete(r,r+i.nodeSize),!0)},updateBlockMath:e=>({editor:t,tr:n})=>{let r=e?.latex,i=e?.pos;i===void 0&&(i=t.state.selection.$from.pos);let a=t.state.doc.nodeAt(i);return!a||a.type.name!==this.name?!1:(n.setNodeMarkup(i,this.type,{...a.attrs,latex:r??a.attrs.latex}),!0)}}},parseHTML(){return[{tag:`div[data-type="block-math"]`}]},renderHTML({HTMLAttributes:e}){return[`div`,A(e,{"data-type":`block-math`})]},parseMarkdown:e=>({type:`blockMath`,attrs:{latex:e.latex}}),renderMarkdown:e=>[`$$`,e.attrs?.latex||``,`$$`].join(`
`),markdownTokenizer:{name:`blockMath`,level:`block`,start:e=>e.indexOf(`$$`),tokenize:e=>{let t=e.match(/^\$\$([^$]+)\$\$/);if(!t)return;let[n,r]=t;return{type:`blockMath`,raw:n,latex:r.trim()}}},addInputRules(){return[new lp({find:/^\$\$\$([^$]+)\$\$\$$/,handler:({state:e,range:t,match:n})=>{let[,r]=n,{tr:i}=e,a=e.doc.resolve(t.from),o=this.type.create({latex:r}),s=a.depth>0&&a.parent.isTextblock&&t.from===a.start()&&t.to===a.end()&&a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),this.type)?{from:a.before(),to:a.after()}:t;i.replaceWith(s.from,s.to,o)}})]},addNodeView(){let{katexOptions:e}=this.options;return({node:t,getPos:n})=>{let r=document.createElement(`div`),i=document.createElement(`div`);r.className=`tiptap-mathematics-render`,this.editor.isEditable&&r.classList.add(`tiptap-mathematics-render--editable`),i.className=`block-math-inner`,r.dataset.type=`block-math`,r.setAttribute(`data-latex`,t.attrs.latex),r.appendChild(i);function a(){try{VV.render(t.attrs.latex,i,e),r.classList.remove(`block-math-error`)}catch{r.textContent=t.attrs.latex,r.classList.add(`block-math-error`)}}let o=e=>{e.preventDefault(),e.stopPropagation();let r=n();r!=null&&this.options.onClick&&this.options.onClick(t,r)};return this.options.onClick&&r.addEventListener(`click`,o),a(),{dom:r,destroy(){r.removeEventListener(`click`,o)}}}}}),UV=e=>{let t=/\$\$([^$\n]+?)\$\$(?!\$)/g,n=t.exec(e);for(;n!==null;){if(n.index===0||e[n.index-1]!==`$`)return{index:n.index,text:n[0],data:{latex:n[1]}};t.lastIndex=n.index+1,n=t.exec(e)}return null},WV=Jp.create({name:`inlineMath`,group:`inline`,inline:!0,atom:!0,addOptions(){return{onClick:void 0,katexOptions:void 0}},addAttributes(){return{latex:{default:``,parseHTML:e=>e.getAttribute(`data-latex`),renderHTML:e=>({"data-latex":e.latex})}}},addCommands(){return{insertInlineMath:e=>({editor:t,tr:n})=>{let r=e.latex,i=e?.pos??t.state.selection.from;return r?(n.replaceWith(i,i,this.type.create({latex:r})),!0):!1},deleteInlineMath:e=>({editor:t,tr:n})=>{let r=e?.pos??t.state.selection.$from.pos,i=t.state.doc.nodeAt(r);return!i||i.type.name!==this.name?!1:(n.delete(r,r+i.nodeSize),!0)},updateInlineMath:e=>({editor:t,tr:n})=>{let r=e?.latex,i=e?.pos;i===void 0&&(i=t.state.selection.$from.pos);let a=t.state.doc.nodeAt(i);return!a||a.type.name!==this.name?!1:(n.setNodeMarkup(i,this.type,{...a.attrs,latex:r}),!0)}}},parseHTML(){return[{tag:`span[data-type="inline-math"]`}]},renderHTML({HTMLAttributes:e}){return[`span`,A(e,{"data-type":`inline-math`})]},parseMarkdown:e=>({type:`inlineMath`,attrs:{latex:e.latex}}),renderMarkdown:e=>`$${e.attrs?.latex||``}$`,markdownTokenizer:{name:`inlineMath`,level:`inline`,start:e=>e.indexOf(`$`),tokenize:e=>{let t=e.match(/^\$([^$]+)\$(?!\$)/);if(!t)return;let[n,r]=t;return{type:`inlineMath`,raw:n,latex:r.trim()}}},addInputRules(){return[new lp({find:UV,handler:({state:e,range:t,match:n})=>{let r=n.data?.latex;if(typeof r!=`string`)return null;let{tr:i}=e,a=t.from,o=t.to;i.replaceWith(a,o,this.type.create({latex:r}))}})]},addNodeView(){let{katexOptions:e}=this.options;return({node:t,getPos:n})=>{let r=document.createElement(`span`);r.className=`tiptap-mathematics-render`,this.editor.isEditable&&r.classList.add(`tiptap-mathematics-render--editable`),r.dataset.type=`inline-math`,r.setAttribute(`data-latex`,t.attrs.latex);function i(){try{VV.render(t.attrs.latex,r,e),r.classList.remove(`inline-math-error`)}catch{r.textContent=t.attrs.latex,r.classList.add(`inline-math-error`)}}let a=e=>{e.preventDefault(),e.stopPropagation();let r=n();r!=null&&this.options.onClick&&this.options.onClick(t,r)};return this.options.onClick&&r.addEventListener(`click`,a),i(),{dom:r,destroy(){r.removeEventListener(`click`,a)}}}}}),GV=Tp.create({name:`Mathematics`,addOptions(){return{inlineOptions:void 0,blockOptions:void 0,katexOptions:void 0}},addExtensions(){return[HV.configure({...this.options.blockOptions,katexOptions:this.options.katexOptions}),WV.configure({...this.options.inlineOptions,katexOptions:this.options.katexOptions})]}});function KV(e,t){let n=n=>(r,i)=>{let a=t();if(!a?.isEditable)return;let o=a.view.nodeDOM(i);if(!(o instanceof HTMLElement))return;let s=e.blocks;lF({anchor:o,value:String(r.attrs.latex??``),label:s.latex,multiline:n===`block`,monospace:!0,labels:{done:s.done,cancel:s.cancel,remove:s.remove},onSave:e=>{let t=a.chain().setNodeSelection(i);e.trim()?(n===`inline`?t.updateInlineMath({latex:e,pos:i}):t.updateBlockMath({latex:e,pos:i})).focus().run():(n===`inline`?t.deleteInlineMath({pos:i}):t.deleteBlockMath({pos:i})).focus().run()},onRemove:()=>{let e=a.chain();(n===`inline`?e.deleteInlineMath({pos:i}):e.deleteBlockMath({pos:i})).focus().run()}})};return GV.configure({katexOptions:{throwOnError:!1,strict:!1,trust:!1},inlineOptions:{onClick:n(`inline`)},blockOptions:{onClick:n(`block`)}})}function qV(e){let{char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:o}=e,s=n&&!r,c=kf(t),l=RegExp(`\\s${c}$`),u=a?`^`:``,d=r?``:c,f=RegELine truncated
`);return/\s/.test(n)}):!1}function YV(e){return()=>{let t=e.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:a}=e.view.coordsAtPos(t);try{return new DOMRect(a,n,r-a,i-n)}catch{return null}}}function XV(e,t,n,r){return n?()=>{let n=r.getState(e.state)?.decorationId;return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect()||null}:YV(e)}function ZV({match:e,dismissedRange:t,state:n,transaction:r,editor:i,shouldResetDismissed:a,effectiveAllowSpaces:o}){return a?.({editor:i,state:n,range:t,match:e,transaction:r,allowSpaces:o})?!1:o?e.range.from===t.from:e.range.from===t.from&&!JV(r)}function QV({view:e,pluginKeyRef:t}){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}function $V({pluginKey:e,decorationTag:t,decorationClass:n,decorationContent:r,decorationEmptyClass:i,renderer:a,dispatchExit:o}){return{handleKeyDown(t,n){var r;let i=e.getState(t.state);if(!i.active)return!1;if(n.key===`Escape`||n.key===`Esc`){var s;return a==null||(s=a.onKeyDown)==null||s.call(a,{view:t,event:n,range:i.range}),o(t),!0}return(a==null||(r=a.onKeyDown)==null?void 0:r.call(a,{view:t,event:n,range:i.range}))||!1},decorations(a){let{active:o,range:s,decorationId:c,query:l}=e.getState(a);if(!o)return null;let u=!l?.length,d=[n];return u&&d.push(i),xs.create(a.doc,[vs.inline(s.from,s.to,{nodeName:t,class:d.join(` `),"data-decoration-id":c||void 0,"data-decoration-content":r})])}}}function eH({editor:e,char:t,effectiveAllowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,findSuggestionMatch:o,allow:s,shouldShow:c,shouldKeepDismissed:l,pluginKey:u}){return{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(d,f,p,m){let{isEditable:h}=e,{composing:g}=e.view,{selection:_}=d,{empty:v,from:y}=_,b={...f},x=d.getMeta(u);if(x&&x.exit)return b.active=!1,b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null,b.dismissedRange=f.active?{...f.range}:f.dismissedRange,b;if(b.composing=g,d.docChanged&&b.dismissedRange!==null&&(b.dismissedRange={from:d.mapping.map(b.dismissedRange.from),to:d.mapping.map(b.dismissedRange.to)}),h&&(v||e.view.composing)){(y<f.range.from||y>f.range.to)&&!g&&!f.composing&&(b.active=!1);let u=o({char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:a,$position:_.$from}),p=`id_${Math.floor(Math.random()*4294967295)}`;u&&s({editor:e,state:m,range:u.range,isActive:f.active})&&(!c||c({editor:e,range:u.range,query:u.query,text:u.text,transaction:d}))?(b.dismissedRange!==null&&!l({match:u,dismissedRange:b.dismissedRange,state:m,transaction:d})&&(b.dismissedRange=null),b.dismissedRange===null?(b.active=!0,b.decorationId=f.decorationId||p,b.range=u.range,b.query=u.query,b.text=u.text):b.active=!1):(u||(b.dismissedRange=null),b.active=!1)}else b.active=!1;return b.active||(b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null),b}}}function tH({editor:e,items:t}){let n=null,r=null,i=null,a=()=>{r!==null&&(clearTimeout(r),r=null),i?.(),i=null},o=e=>new Promise(t=>{i=t,r=setTimeout(()=>{r=null;let e=i;i=null,e?.()},e)}),s=()=>{n?.abort(),a(),n=null};return{abort:s,fetch:async(r,i)=>{s(),n=new AbortController;let a=n;if(i>0&&await o(i),n!==a||a.signal.aborted)return{status:`aborted`};try{let i=await t({editor:e,query:r,signal:a.signal});return n!==a||a.signal.aborted?{status:`aborted`}:{status:`resolved`,items:i}}catch{return n!==a||a.signal.aborted?{status:`aborted`}:{status:`error`}}}}}function nH({placement:e,offset:t,flip:n,floatingUi:r}){var i;let a=[Tj({mainAxis:t.mainAxis??4,crossAxis:t.crossAxis??0})];return n&&a.push(Dj()),r!=null&&(i=r.middleware)!=null&&i.length&&a.push(...r.middleware),{placement:e,strategy:r?.strategy??`absolute`,middleware:a}}function rH(e){if(e instanceof HTMLElement)return e;if(typeof e==`string`)try{let t=document.querySelector(e);if(t)return t}catch{return document.body}return document.body}function iH({getReferenceRect:e,contextElement:t,config:n,container:r,dismissOnOutsideClick:i,dismiss:a}){return(o,s={})=>{let c={getBoundingClientRect:()=>e()??new DOMRect,contextElement:t},l=!1,u=!o.isConnected;u&&rH(r).appendChild(o),s.onPosition||(o.style.visibility=`hidden`,o.style.width=`max-content`);let d=wj(c,o,()=>{Oj(c,o,{placement:n.placement,strategy:n.strategy,middleware:n.middleware}).then(({x:e,y:t,placement:n,strategy:r})=>{s.onPosition?s.onPosition({x:e,y:t,placement:n,strategy:r}):(Object.assign(o.style,{position:r,left:`${e}px`,top:`${t}px`}),l||(l=!0,o.style.visibility=``))})},s.autoUpdate),f;return i&&(f=e=>{let n=e.target;!(n instanceof Node)||o.contains(n)||t.contains(n)||a()},document.addEventListener(`pointerdown`,f,!0)),()=>{d(),f&&document.removeEventListener(`pointerdown`,f,!0),u&&o.remove()}}}function aH({editor:e,pluginKey:t,items:n,renderer:r,minQueryLength:i,debounce:a,initialItems:o,placement:s,offset:c,container:l,flip:u,floatingUi:d,dismissOnOutsideClick:f,command:p,clientRectFor:m,dispatchExit:h}){let g,_=tH({editor:e,items:n}),v=nH({placLine truncated
Idea --> Draft --> Review --> Published`,hH=null;function gH(e){return hH??=e().then(e=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:document.documentElement.classList.contains(`dark`)?`dark`:`neutral`,fontFamily:`inherit`}),e)),hH}var _H=0;async function vH(e,t,n,r){if(e.classList.remove(`dw-mermaid__body--error`),!t.trim())e.textContent=``;else if(r)try{let{svg:n}=await(await gH(r)).render(`dw-mermaid-${++_H}`,t);e.innerHTML=n}catch(t){e.classList.add(`dw-mermaid__body--error`),e.textContent=`${n.blocks.mermaidError} ${t instanceof Error?t.message:String(t)}`}else{let n=document.createElement(`pre`);n.className=`dw-mermaid__source`,n.textContent=t,e.replaceChildren(n)}}var yH=Jp.create({name:`mermaid`,group:`block`,atom:!0,draggable:!0,addOptions(){return{labels:null,load:void 0}},addAttributes(){return{code:{default:``,parseHTML:e=>e.getAttribute(`data-code`)??e.textContent??``,renderHTML:e=>({"data-code":e.code})}}},parseHTML(){return[{tag:`div[data-type='mermaid']`},{tag:`pre.mermaid`}]},renderHTML({node:e,HTMLAttributes:t}){return[`div`,A(t,{"data-type":`mermaid`}),[`pre`,{},String(e.attrs.code)]]},addCommands(){return{insertMermaid:(e=mH)=>({commands:t})=>t.insertContent({type:this.name,attrs:{code:e}})}},addNodeView(){return({node:e,editor:t,getPos:n})=>{let r=this.options.labels,i=this.options.load,a=document.createElement(`div`);a.className=`dw-mermaid`,a.setAttribute(`data-type`,`mermaid`);let o=document.createElement(`div`);o.className=`dw-mermaid__body`,a.append(o);let s=String(e.attrs.code);return vH(o,s,r,i),a.addEventListener(`click`,()=>{if(!t.isEditable)return;let e=typeof n==`function`?n():void 0;if(e===void 0)return;let c=r.blocks;lF({anchor:a,value:s,label:c.mermaid,multiline:!0,monospace:!0,labels:{done:c.done,cancel:c.cancel,remove:c.remove},onInput:e=>void vH(o,e,r,i),onSave:n=>{t.chain().setNodeSelection(e).updateAttributes(`mermaid`,{code:n}).run(),vH(o,n,r,i)},onRemove:()=>t.chain().setNodeSelection(e).deleteSelection().focus().run(),onCancel:()=>void vH(o,s,r,i)})}),{dom:a,update:e=>e.type.name===`mermaid`&&(e.attrs.code!==s&&(s=String(e.attrs.code),vH(o,s,r,i)),!0),ignoreMutation:()=>!0,stopEvent:()=>!1}}}}),bH=e=>`/p/${encodeURIComponent(e)}`,xH=/^\/p\/([A-Za-z0-9_-]+)\/?(?:[?#].*)?$/;function SH(e){return xH.exec(e)?.[1]??``}function CH(e,t,n,r=`Untitled`){let i=`${n.icon?`${n.icon} `:``}${n.title||r}`;e.chain().focus().deleteRange(t).insertContent([{type:`text`,text:i,marks:[{type:`link`,attrs:{href:bH(n.id)}}]},{type:`text`,text:` `}]).run()}async function wH(e,t,n){if(!t.create)return;let{from:r,to:i,empty:a}=e.state.selection,o=a?``:e.state.doc.textBetween(r,i,` `).trim().slice(0,200),s=await t.create(o);a||!o?CH(e,{from:r,to:r},s,n):e.chain().focus().setTextSelection({from:r,to:i}).setLink({href:bH(s.id)}).run()}var TH=Tp.create({name:`pageLinks`,addOptions(){return{host:void 0,labels:null,onNavigate:void 0}},addProseMirrorPlugins(){let{host:e,onNavigate:t}=this.options,n=this.options.labels,r=[];return e&&r.push(cH({editor:this.editor,pluginKey:new D(`pageLinks`),char:`[[`,allowSpaces:!0,allow:({state:e,range:t})=>!e.doc.resolve(t.from).parent.type.spec.code,items:async({query:t})=>(await e.search(t).catch(()=>[])).slice(0,8),render:Ij({label:n.pageLinks,empty:n.noPages,toItem:e=>({label:`${e.icon?`${e.icon} `:``}${e.title||`…`}`,description:e.hint,icon:`page`}),pick:(e,t)=>CH(e.editor,e.range,t)})})),t&&r.push(new E({key:new D(`pageLinkClicks`),props:{handleClick:(e,n,r)=>{let i=(r.target?.closest?.(`a[href]`))?.getAttribute(`href`)??``;return!SH(i)||e.editable&&!(r.ctrlKey||r.metaKey)?!1:(r.preventDefault(),t(i),!0)}}})),r}});function EH(e){return new Promise(t=>{let n=document.createElement(`input`);n.type=`file`,n.accept=e,n.multiple=!0,n.onchange=()=>t([...n.files??[]]),n.click()})}function DH(e,t,n,r,i=!1,a){let o=(t,n,r,i)=>({id:t,icon:n,keywords:r,label:e.slash[t]?.label??t,description:e.slash[t]?.description??``,run:i}),s=[o(`text`,`text`,[`paragraph`,`p`],(e,t)=>e.chain().focus().deleteRange(t).setParagraph().run()),o(`h1`,`heading`,[`heading`,`title`,`#`],(e,t)=>e.chain().focus().deleteRange(t).setHeading({level:1}).run()),o(`h2`,`heading`,[`heading`,`subtitle`,`##`],(e,t)=>e.chain().focus().deleteRange(t).setHeading({level:2}).run()),o(`h3`,`heading`,[`heading`,`###`],(e,t)=>e.chain().focus().deleteRange(t).setHeading({level:3}).run()),{...o(`otherHeadings`,`heading`,[`other`,`more headings`,`smaller`],()=>{}),children:[4,5,6].map(e=>o(`h${e}`,`heading`,[`heading`,`#`.repeat(e)],(t,n)=>t.chain().focus().deleteRange(n).setHeading({level:e}).run()))},o(`bullet`,`list`,[`list`,`ul`,`-`],(e,t)=>e.chain().focus().deleteRange(t).toggleBulletList().run()),o(`ordered`,`list-ordered`,[`list`,`ol`,`1.`],(e,t)=>e.chain().focus().deleteRange(t).toggleOrderedList().run()),o(`todo`,`todo`,[`task`,`checkbox`,`checklist`,`[]`],(e,t)=>e.chain().focus().deleteRange(t).toggleTaskList().run()),o(`callout`,`callout`,[`note`,`info`,`tip`,`warning`,`aside`,`box`]Line truncated
?)[ \r ]*`,zV=`[̀-ͯ]`,BV=RegExp(zV+`+$`),VV=`(`+PV+`+)|`+(RV+`|`)+`([!-\\[\\]-‧‪-퟿豈-￿]`+(zV+`*`)+`|[\ud800-\udbff][\udc00-\udfff]`+(zV+`*`)+`|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5`+(`|`+LV)+(`|`+IV+`)`),HV=class{constructor(e,t){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=t,this.tokenRegex=new RegExp(VV,`g`),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){var e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new HB(`EOF`,new VB(this,t,t));var n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new I(`Unexpected character: '`+e[t]+`'`,new HB(e[t],new VB(this,t,t+1)));var r=n[6]||n[3]||(n[2]?`\\ `:` `);if(this.catcodes[r]===14){var i=e.indexOf(`
`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.length,this.settings.reportNonstrict(`commentAtEnd`,`% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)`)):this.tokenRegex.lastIndex=i+1,this.lex()}return new HB(r,new VB(this,t,this.tokenRegex.lastIndex))}},UV=class{constructor(e,t){e===void 0&&(e={}),t===void 0&&(t={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new I(`Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug`);var e=this.undefStack.pop();for(var t of Object.keys(e))e[t]===void 0?delete this.current[t]:this.current[t]=e[t]}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return Object.prototype.hasOwnProperty.call(this.current,e)||Object.prototype.hasOwnProperty.call(this.builtins,e)}get(e){if(Object.prototype.hasOwnProperty.call(this.current,e))return this.current[e];if(Object.prototype.hasOwnProperty.call(this.builtins,e))return this.builtins[e]}set(e,t,n){if(n===void 0&&(n=!1),n){for(var r=0;r<this.undefStack.length;r++)delete this.undefStack[r][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{var i=this.undefStack[this.undefStack.length-1];i&&!Object.prototype.hasOwnProperty.call(i,e)&&(i[e]=Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:void 0)}t==null?delete this.current[e]:this.current[e]=t}},WV=BB;$(`\\noexpand`,function(e){var t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),$(`\\expandafter`,function(e){var t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),$(`\\@firstoftwo`,function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),$(`\\@secondoftwo`,function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),$(`\\@ifnextchar`,function(e){var t=e.consumeArgs(3);e.consumeSpaces();var n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),$(`\\@ifstar`,`\\@ifnextchar *{\\@firstoftwo{#1}}`),$(`\\TextOrMath`,function(e){var t=e.consumeArgs(2);return e.mode===`text`?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var GV={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};$(`\\char`,function(e){var t=e.popToken(),n,r=0;if(t.text===`'`)n=8,t=e.popToken();else if(t.text===`"`)n=16,t=e.popToken();else if(t.text==="`"){if(t=e.popToken(),t.text[0]===`\\`)r=t.text.charCodeAt(1);else if(t.text===`EOF`)throw new I("\\char` missing argument");else r=t.text.charCodeAt(0)}else n=10;if(n){if(r=GV[t.text],r==null||r>=n)throw new I(`Invalid base-`+n+` digit `+t.text);for(var i;(i=GV[e.future().text])!=null&&i<n;)r*=n,r+=i,e.popToken()}return`\\@char{`+r+`}`});var KV=(e,t,n,r)=>{var i=e.consumeArg().tokens;if(i.length!==1)throw new I(`\\newcommand's first argument must be a macro name`);var a=i[0].text,o=e.isDefined(a);if(o&&!t)throw new I(`\\newcommand{`+a+`} attempting to redefine `+(a+`; use \\renewcommand`));if(!o&&!n)throw new I(`\\renewcommand{`+a+`} when command `+a+` does not yet exist; use \\newcommand`);var s=0;if(i=e.consumeArg().tokens,i.length===1&&i[0].text===`[`){for(var c=``,l=e.expandNextToken();l.text!==`]`&&l.text!==`EOF`;)c+=l.text,l=e.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new I(`Invalid number of arguments: `+c);s=parseInt(c),i=e.consumeArg().tokens}return o&&r||e.macros.set(a,{tokens:i,numArgs:s}),``};$(`\\newcommand`,e=>KV(e,!1,!0,!1)),$(`\\renewcommand`,e=>KV(e,!0,!1,!1)),$(`\\providecommand`,e=>KV(e,!0,!0,!0)),$(`\\message`,e=>{var t=e.consumeArgs(1)[0];return console.log(t.reverse().map(e=>e.text).join(``)),``}),$(`\\errmessage`,e=>{var t=e.consumeArgs(1)[0];return console.error(t.reverse().map(e=>e.text).join(``)),``}),$(`\\show`,e=>{var t=e.popToken(),n=t.text;return console.log(t,e.macros.get(n),NV[n],OL.math[n],OL.text[n]),``}),$(`\\bgroup`,`{`),$(`\\egroup`,`}`),$(`~`,`\\nobreakspace`),$(`\\lq`,"`"),$(`\\rq`,`'`),$(`\\aa`,`\\r a`),$(`\\AA`,`\\r A`),$(`\\textcopyright`,"\\html@mathml{\\textcircled{c}}{\\char`©}"),$(`\\copyright`,`\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}`),$(`\\textregistered`,"\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"),$(`ℬ`,`\\mathscr{B}`),$(`ℰ`,`\\mathscr{E}`),$(`ℱ`,`\\mathscr{F}`),$(`ℋ`,`\\mathscr{H}`),$(`ℐ`,`\\mathscr{I}`),$(`ℒ`,`\\mathscr{L}`),$(`ℳ`,`\\mathscr{M}`),$(`ℛ`,`\\mathscr{R}`),$(`ℭ`,`\\mathfrak{C}`),$(`ℌ`,`\\mathfrak{H}`),$(`ℨ`,`\\mathfrak{Z}`),$(`\\Bbbk`,`\\Bbb{k}`),$(`\\llap`,`\\mathllap{\\textrm{#1}}`),$(`\\rlap`,`\\mathrlap{\\textrm{#1}}`),$(`\\clap`,`\\mathclap{\\textrm{#1}}`),$(`\\mathstrut`,`\\vphantom{(}`),$(`\\underbar`,`\\underline{\\text{#1}}`),$(`\\not`,`\\html@mathml{\\mathrel{\\mathrlap\\@not}\\nobreak}{\\char"338}`),$(`\\neq`,"\\html@mathml{\\mathreLine truncated
please report what input caused this bug`);return n=n.slice(1,-1),{type:`verb`,mode:`text`,body:n,star:r}}Object.prototype.hasOwnProperty.call(rH,t[0])&&!OL[this.mode][t[0]]&&(this.settings.strict&&this.mode===`math`&&this.settings.reportNonstrict(`unicodeTextInMathMode`,`Accented Unicode text character "`+t[0]+`" used in math mode`,e),t=rH[t[0]]+t.slice(1));var i=BV.exec(t);i&&(t=t.substring(0,i.index),t===`i`?t=`ı`:t===`j`&&(t=`ȷ`));var a;if(OL[this.mode][t]){this.settings.strict&&this.mode===`math`&&XL.includes(t)&&this.settings.reportNonstrict(`unicodeTextInMathMode`,`Latin-1/Unicode text character "`+t[0]+`" used in math mode`,e);var o=OL[this.mode][t].group,s=VB.range(e);a=Iz(o)?{type:`atom`,mode:this.mode,family:o,loc:s,text:t}:{type:o,mode:this.mode,loc:s,text:t}}else if(t.charCodeAt(0)>=128)this.settings.strict&&(RI(t.charCodeAt(0))?this.mode===`math`&&this.settings.reportNonstrict(`unicodeTextInMathMode`,`Unicode text character "`+t[0]+`" used in math mode`,e):this.settings.reportNonstrict(`unknownSymbol`,`Unrecognized Unicode character "`+t[0]+`"`+(` (`+t.charCodeAt(0)+`)`),e)),a={type:`textord`,mode:`text`,loc:VB.range(e),text:t};else return null;if(this.consume(),i)for(var c=0;c<i[0].length;c++){var l=i[0][c];if(!nH[l])throw new I(`Unknown accent ' `+l+`'`,e);var u=nH[l][this.mode]||nH[l].text;if(!u)throw new I(`Accent `+l+` unsupported in `+this.mode+` mode`,e);a={type:`accent`,mode:this.mode,loc:VB.range(e),label:u,isStretchy:!1,isShifty:!0,base:a}}return a}};iH.endOfExpression=new Set([`}`,`\\endgroup`,`\\end`,`\\right`,`&`]);var aH=function(e,t){if(!(typeof e==`string`||e instanceof String))throw TypeError(`KaTeX can only parse string typed expression`);var n=new iH(e,t);delete n.gullet.macros.current[`\\df@tag`];var r=n.parse();if(delete n.gullet.macros.current[`\\current@color`],delete n.gullet.macros.current[`\\color`],n.gullet.macros.get(`\\df@tag`)){if(!t.displayMode)throw new I(`\\tag works only in display equations`);r=[{type:`tag`,mode:`text`,body:r,tag:n.subparse([new HB(`\\df@tag`)])}]}return r},oH=function(e,t,n){t.textContent=``;var r=uH(e,n).toNode();t.appendChild(r)};typeof document<`u`&&document.compatMode!==`CSS1Compat`&&(typeof console<`u`&&console.warn(`Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype.`),oH=function(){throw new I(`KaTeX doesn't work in quirks mode.`)});var sH=function(e,t){return uH(e,t).toMarkup()},cH=function(e,t){return aH(e,new vI(t))},lH=function(e,t,n){if(n.throwOnError||!(e instanceof I))throw e;var r=Y([`katex-error`],[new mL(t)]);return r.setAttribute(`title`,e.toString()),r.setAttribute(`style`,`color:`+n.errorColor),r},uH=function(e,t){var n=new vI(t);try{return wz(aH(e,n),e,n)}catch(t){return lH(t,e,n)}},dH={version:`0.18.10`,render:oH,renderToString:sH,ParseError:I,SETTINGS_SCHEMA:mI,__parse:cH,__renderToDomTree:uH,__renderToHTMLTree:function(e,t){var n=new vI(t);try{return Tz(aH(e,n),e,n)}catch(t){return lH(t,e,n)}},__setFontMetrics:wL,__defineSymbol:z,__defineFunction:X,__defineMacro:$,__domTree:{Span:uL,Anchor:dL,SymbolNode:mL,SvgNode:hL,PathNode:gL,LineNode:_L}},fH=Jp.create({name:`blockMath`,group:`block`,atom:!0,addOptions(){return{onClick:void 0,katexOptions:void 0}},addAttributes(){return{latex:{default:``,parseHTML:e=>e.getAttribute(`data-latex`),renderHTML:e=>({"data-latex":e.latex})}}},addCommands(){return{insertBlockMath:e=>({commands:t,editor:n})=>{let{latex:r,pos:i}=e;return r?t.insertContentAt(i??n.state.selection.from,{type:this.name,attrs:{latex:r}}):!1},deleteBlockMath:e=>({editor:t,tr:n})=>{let r=e?.pos??t.state.selection.$from.pos,i=t.state.doc.nodeAt(r);return!i||i.type.name!==this.name?!1:(n.delete(r,r+i.nodeSize),!0)},updateBlockMath:e=>({editor:t,tr:n})=>{let r=e?.latex,i=e?.pos;i===void 0&&(i=t.state.selection.$from.pos);let a=t.state.doc.nodeAt(i);return!a||a.type.name!==this.name?!1:(n.setNodeMarkup(i,this.type,{...a.attrs,latex:r??a.attrs.latex}),!0)}}},parseHTML(){return[{tag:`div[data-type="block-math"]`}]},renderHTML({HTMLAttributes:e}){return[`div`,A(e,{"data-type":`block-math`})]},parseMarkdown:e=>({type:`blockMath`,attrs:{latex:e.latex}}),renderMarkdown:e=>[`$$`,e.attrs?.latex||``,`$$`].join(`
`),markdownTokenizer:{name:`blockMath`,level:`block`,start:e=>e.indexOf(`$$`),tokenize:e=>{let t=e.match(/^\$\$([^$]+)\$\$/);if(!t)return;let[n,r]=t;return{type:`blockMath`,raw:n,latex:r.trim()}}},addInputRules(){return[new lp({find:/^\$\$\$([^$]+)\$\$\$$/,handler:({state:e,range:t,match:n})=>{let[,r]=n,{tr:i}=e,a=e.doc.resolve(t.from),o=this.type.create({latex:r}),s=a.depth>0&&a.parent.isTextblock&&t.from===a.start()&&t.to===a.end()&&a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),this.type)?{from:a.before(),to:a.after()}:t;i.replaceWith(s.from,s.to,o)}})]},addNodeView(){let{katexOptions:e}=this.options;return({node:t,getPos:n})=>{let r=document.createElement(`div`),i=document.createElement(`div`);r.className=`tiptap-mathematics-render`,this.editor.isEditable&&r.classList.add(`tiptap-mathematics-render--editable`),i.className=`block-math-inner`,r.dataset.type=`block-math`,r.setAttribute(`data-latex`,t.attrs.latex),r.appendChild(i);function a(){try{dH.render(t.attrs.latex,i,e),r.classList.remove(`block-math-error`)}catch{r.textContent=t.attrs.latex,r.classList.add(`block-math-error`)}}let o=e=>{e.preventDefault(),e.stopPropagation();let r=n();r!=null&&this.options.onClick&&this.options.onClick(t,r)};return this.options.onClick&&r.addEventListener(`click`,o),a(),{dom:r,destroy(){r.removeEventListener(`click`,o)}}}}}),pH=e=>{let t=/\$\$([^$\n]+?)\$\$(?!\$)/g,n=t.exec(e);for(;n!==null;){if(n.index===0||e[n.index-1]!==`$`)return{index:n.index,text:n[0],data:{latex:n[1]}};t.lastIndex=n.index+1,n=t.exec(e)}return null},mH=Jp.create({name:`inlineMath`,group:`inline`,inline:!0,atom:!0,addOptions(){return{onClick:void 0,katexOptions:void 0}},addAttributes(){return{latex:{default:``,parseHTML:e=>e.getAttribute(`data-latex`),renderHTML:e=>({"data-latex":e.latex})}}},addCommands(){return{insertInlineMath:e=>({editor:t,tr:n})=>{let r=e.latex,i=e?.pos??t.state.selection.from;return r?(n.replaceWith(i,i,this.type.create({latex:r})),!0):!1},deleteInlineMath:e=>({editor:t,tr:n})=>{let r=e?.pos??t.state.selection.$from.pos,i=t.state.doc.nodeAt(r);return!i||i.type.name!==this.name?!1:(n.delete(r,r+i.nodeSize),!0)},updateInlineMath:e=>({editor:t,tr:n})=>{let r=e?.latex,i=e?.pos;i===void 0&&(i=t.state.selection.$from.pos);let a=t.state.doc.nodeAt(i);return!a||a.type.name!==this.name?!1:(n.setNodeMarkup(i,this.type,{...a.attrs,latex:r}),!0)}}},parseHTML(){return[{tag:`span[data-type="inline-math"]`}]},renderHTML({HTMLAttributes:e}){return[`span`,A(e,{"data-type":`inline-math`})]},parseMarkdown:e=>({type:`inlineMath`,attrs:{latex:e.latex}}),renderMarkdown:e=>`$${e.attrs?.latex||``}$`,markdownTokenizer:{name:`inlineMath`,level:`inline`,start:e=>e.indexOf(`$`),tokenize:e=>{let t=e.match(/^\$([^$]+)\$(?!\$)/);if(!t)return;let[n,r]=t;return{type:`inlineMath`,raw:n,latex:r.trim()}}},addInputRules(){return[new lp({find:pH,handler:({state:e,range:t,match:n})=>{let r=n.data?.latex;if(typeof r!=`string`)return null;let{tr:i}=e,a=t.from,o=t.to;i.replaceWith(a,o,this.type.create({latex:r}))}})]},addNodeView(){let{katexOptions:e}=this.options;return({node:t,getPos:n})=>{let r=document.createElement(`span`);r.className=`tiptap-mathematics-render`,this.editor.isEditable&&r.classList.add(`tiptap-mathematics-render--editable`),r.dataset.type=`inline-math`,r.setAttribute(`data-latex`,t.attrs.latex);function i(){try{dH.render(t.attrs.latex,r,e),r.classList.remove(`inline-math-error`)}catch{r.textContent=t.attrs.latex,r.classList.add(`inline-math-error`)}}let a=e=>{e.preventDefault(),e.stopPropagation();let r=n();r!=null&&this.options.onClick&&this.options.onClick(t,r)};return this.options.onClick&&r.addEventListener(`click`,a),i(),{dom:r,destroy(){r.removeEventListener(`click`,a)}}}}}),hH=Tp.create({name:`Mathematics`,addOptions(){return{inlineOptions:void 0,blockOptions:void 0,katexOptions:void 0}},addExtensions(){return[fH.configure({...this.options.blockOptions,katexOptions:this.options.katexOptions}),mH.configure({...this.options.inlineOptions,katexOptions:this.options.katexOptions})]}});function gH(e,t){let n=n=>(r,i)=>{let a=t();if(!a?.isEditable)return;let o=a.view.nodeDOM(i);if(!(o instanceof HTMLElement))return;let s=e.blocks;NF({anchor:o,value:String(r.attrs.latex??``),label:s.latex,multiline:n===`block`,monospace:!0,labels:{done:s.done,cancel:s.cancel,remove:s.remove},onSave:e=>{let t=a.chain().setNodeSelection(i);e.trim()?(n===`inline`?t.updateInlineMath({latex:e,pos:i}):t.updateBlockMath({latex:e,pos:i})).focus().run():(n===`inline`?t.deleteInlineMath({pos:i}):t.deleteBlockMath({pos:i})).focus().run()},onRemove:()=>{let e=a.chain();(n===`inline`?e.deleteInlineMath({pos:i}):e.deleteBlockMath({pos:i})).focus().run()}})};return hH.configure({katexOptions:{throwOnError:!1,strict:!1,trust:!1},inlineOptions:{onClick:n(`inline`)},blockOptions:{onClick:n(`block`)}})}function _H({editor:e,overrideSuggestionOptions:t,extensionName:n,char:r=`@`}){return{editor:e,char:r,pluginKey:new D,command:({editor:e,range:t,props:i})=>{var a,o;let s=Line truncated
Idea --> Draft --> Review --> Published`,CH=null;function wH(e){return CH??=e().then(e=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:document.documentElement.classList.contains(`dark`)?`dark`:`neutral`,fontFamily:`inherit`}),e)),CH}var TH=0;async function EH(e,t,n,r){if(e.classList.remove(`dw-mermaid__body--error`),!t.trim())e.textContent=``;else if(r)try{let{svg:n}=await(await wH(r)).render(`dw-mermaid-${++TH}`,t);e.innerHTML=n}catch(t){e.classList.add(`dw-mermaid__body--error`),e.textContent=`${n.blocks.mermaidError} ${t instanceof Error?t.message:String(t)}`}else{let n=document.createElement(`pre`);n.className=`dw-mermaid__source`,n.textContent=t,e.replaceChildren(n)}}var DH=Jp.create({name:`mermaid`,group:`block`,atom:!0,draggable:!0,addOptions(){return{labels:null,load:void 0}},addAttributes(){return{code:{default:``,parseHTML:e=>e.getAttribute(`data-code`)??e.textContent??``,renderHTML:e=>({"data-code":e.code})}}},parseHTML(){return[{tag:`div[data-type='mermaid']`},{tag:`pre.mermaid`}]},renderHTML({node:e,HTMLAttributes:t}){return[`div`,A(t,{"data-type":`mermaid`}),[`pre`,{},String(e.attrs.code)]]},addCommands(){return{insertMermaid:(e=SH)=>({commands:t})=>t.insertContent({type:this.name,attrs:{code:e}})}},addNodeView(){return({node:e,editor:t,getPos:n})=>{let r=this.options.labels,i=this.options.load,a=document.createElement(`div`);a.className=`dw-mermaid`,a.setAttribute(`data-type`,`mermaid`);let o=document.createElement(`div`);o.className=`dw-mermaid__body`,a.append(o);let s=String(e.attrs.code);return EH(o,s,r,i),a.addEventListener(`click`,()=>{if(!t.isEditable)return;let e=typeof n==`function`?n():void 0;if(e===void 0)return;let c=r.blocks;NF({anchor:a,value:s,label:c.mermaid,multiline:!0,monospace:!0,labels:{done:c.done,cancel:c.cancel,remove:c.remove},onInput:e=>void EH(o,e,r,i),onSave:n=>{t.chain().setNodeSelection(e).updateAttributes(`mermaid`,{code:n}).run(),EH(o,n,r,i)},onRemove:()=>t.chain().setNodeSelection(e).deleteSelection().focus().run(),onCancel:()=>void EH(o,s,r,i)})}),{dom:a,update:e=>e.type.name===`mermaid`&&(e.attrs.code!==s&&(s=String(e.attrs.code),EH(o,s,r,i)),!0),ignoreMutation:()=>!0,stopEvent:()=>!1}}}});function OH(e){return new Promise(t=>{let n=document.createElement(`input`);n.type=`file`,n.accept=e,n.multiple=!0,n.onchange=()=>t([...n.files??[]]),n.click()})}function kH(e,t,n,r,i=!1,a){let o=(t,n,r,i)=>({id:t,icon:n,keywords:r,label:e.slash[t]?.label??t,description:e.slash[t]?.description??``,run:i}),s=[o(`text`,`text`,[`paragraph`,`p`],(e,t)=>e.chain().focus().deleteRange(t).setParagraph().run()),o(`h1`,`heading`,[`heading`,`title`,`#`],(e,t)=>e.chain().focus().deleteRange(t).setHeading({level:1}).run()),o(`h2`,`heading`,[`heading`,`subtitle`,`##`],(e,t)=>e.chain().focus().deleteRange(t).setHeading({level:2}).run()),o(`h3`,`heading`,[`heading`,`###`],(e,t)=>e.chain().focus().deleteRange(t).setHeading({level:3}).run()),{...o(`otherHeadings`,`heading`,[`other`,`more headings`,`smaller`],()=>{}),children:[4,5,6].map(e=>o(`h${e}`,`heading`,[`heading`,`#`.repeat(e)],(t,n)=>t.chain().focus().deleteRange(n).setHeading({level:e}).run()))},o(`bullet`,`list`,[`list`,`ul`,`-`],(e,t)=>e.chain().focus().deleteRange(t).toggleBulletList().run()),o(`ordered`,`list-ordered`,[`list`,`ol`,`1.`],(e,t)=>e.chain().focus().deleteRange(t).toggleOrderedList().run()),o(`todo`,`todo`,[`task`,`checkbox`,`checklist`,`[]`],(e,t)=>e.chain().focus().deleteRange(t).toggleTaskList().run()),o(`callout`,`callout`,[`note`,`info`,`tip`,`warning`,`aside`,`box`],(e,t)=>e.chain().focus().deleteRange(t).setCallout().run()),o(`table`,`table`,[`grid`,`rows`,`columns`,`spreadsheet`],(e,t)=>e.chain().focus().deleteRange(t).insertTable({rows:3,cols:3,withHeaderRow:!0}).run()),o(`quote`,`quote`,[`blockquote`,`>`],(e,t)=>e.chain().focus().deleteRange(t).toggleBlockquote().run()),o(`code`,`code`,[`codeblock`,"```",`snippet`],(e,t)=>e.chain().focus().deleteRange(t).toggleCodeBlock().run()),o(`toggle`,`chevron-right`,[`details`,`collapse`,`expand`,`fold`,`>`],(e,t)=>e.chain().focus().deleteRange(t).setDetails().run()),o(`divider`,`divider`,[`hr`,`rule`,`line`,`---`],(e,t)=>e.chain().focus().deleteRange(t).setHorizontalRule().run()),o(`toc`,`list`,[`contents`,`outline`,`headings`,`index`],(e,t)=>e.chain().focus().deleteRange(t).insertTableOfContents().run()),o(`math`,`sigma`,[`latex`,`formula`,`equation`,`katex`,`$$`],(e,t)=>e.chain().focus().deleteRange(t).insertBlockMath({latex:`E = mc^2`}).run()),o(`mathInline`,`sigma`,[`latex`,`formula`,`equation`,`$`],(e,t)=>e.chain().focus().deleteRange(t).insertInlineMath({latex:`x^2`}).run()),o(`mermaid`,`diagram`,[`diagram`,`flowchart`,`chart`,`sequence`,`graph`],(e,t)=>e.chain().focus().deleteRange(t).insertMermaid().run()),o(`embed`,`video`,[`video`,`youtube`,`vimeo`,`figma`,`loom`,`iframe`,`map`],(t,r)=>{t.chain().focus().deleteRange(r).run(),zF(t,e,a,n)}),o(`linkCard`,`link`,[`bookmark`,`preview`,`card`,`url`,`web`],(t,r)=>{t.chain().focus().deleteRange(r).rLine truncated
<style rel="stylesheet" crossorigin>/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:"Inter Variable", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;--font-serif:"Source Serif 4 Variable", "Source Serif 4", "Iowan Old Style", Georgia, serif;--font-mono:"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--spacing:.25rem;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--radius-xs:4px;--radius-sm:6px;--radius-md:10px;--ease-in:cubic-bezier(.4, 0, 1, 1);--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-surface:var(--dw-surface);--color-surface-sunken:var(--dw-surface-sunken);--color-surface-raised:var(--dw-surface-raised);--color-surface-hover:var(--dw-surface-hover);--color-line:var(--dw-line);--color-line-strong:var(--dw-line-strong);--color-ink:var(--dw-ink);--color-ink-muted:var(--dw-ink-muted);--color-ink-faint:var(--dw-ink-faint);--color-primary:var(--dw-primary);--color-primary-hover:var(--dw-primary-hover);--color-on-primary:var(--dw-on-primary);--color-accent:var(--dw-accent);--color-accent-soft:var(--dw-accent-soft);--color-selection:var(--dw-selection);--color-focus-ring:var(--dw-focus-ring);--color-success:var(--dw-success);--color-success-soft:var(--dw-success-soft);--color-warning:var(--dw-warning);--color-warning-soft:var(--dw-warning-soft);--color-danger:var(--dw-danger);--color-danger-soft:var(--dw-danger-soft);--color-on-danger:var(--dw-on-danger);--color-info:var(--dw-info);--color-info-soft:var(--dw-info-soft);--color-code-bg:var(--dw-code-bg);--text-ui-xs:12px;--text-ui-xs--line-height:16px;--text-ui-xs--letter-spacing:.01em;--text-ui-xs--font-weight:500;--text-ui-sm:13px;--text-ui-sm--line-height:18px;--text-ui-md:14px;--text-ui-md--line-height:20px;--text-doc-h1:30px;--text-doc-h1--line-height:38px;--text-doc-h2:24px;--text-doc-h2--line-height:32px;--text-doc-h3:18px;--text-doc-h3--line-height:28px;--text-doc-body:16px;--text-doc-body--line-height:27px;--text-code:14px;--text-code--line-height:22px;--shadow-menu:var(--dw-shadow-menu);--container-doc:720px;--container-doc-wide:1040px;--spacing-control-sm:28px;--spacing-control-md:34px}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-Line truncated
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:"Inter Variable", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;--font-serif:"Source Serif 4 Variable", "Source Serif 4", "Iowan Old Style", Georgia, serif;--font-mono:"JetBrains Mono Variable", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--spacing:.25rem;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--radius-xs:4px;--radius-sm:6px;--radius-md:10px;--ease-in:cubic-bezier(.4, 0, 1, 1);--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-surface:var(--dw-surface);--color-surface-sunken:var(--dw-surface-sunken);--color-surface-raised:var(--dw-surface-raised);--color-surface-hover:var(--dw-surface-hover);--color-line:var(--dw-line);--color-line-strong:var(--dw-line-strong);--color-ink:var(--dw-ink);--color-ink-muted:var(--dw-ink-muted);--color-ink-faint:var(--dw-ink-faint);--color-primary:var(--dw-primary);--color-primary-hover:var(--dw-primary-hover);--color-on-primary:var(--dw-on-primary);--color-accent:var(--dw-accent);--color-accent-soft:var(--dw-accent-soft);--color-selection:var(--dw-selection);--color-focus-ring:var(--dw-focus-ring);--color-success:var(--dw-success);--color-success-soft:var(--dw-success-soft);--color-warning:var(--dw-warning);--color-warning-soft:var(--dw-warning-soft);--color-danger:var(--dw-danger);--color-danger-soft:var(--dw-danger-soft);--color-on-danger:var(--dw-on-danger);--color-info:var(--dw-info);--color-info-soft:var(--dw-info-soft);--color-code-bg:var(--dw-code-bg);--text-ui-xs:12px;--text-ui-xs--line-height:16px;--text-ui-xs--letter-spacing:.01em;--text-ui-xs--font-weight:500;--text-ui-sm:13px;--text-ui-sm--line-height:18px;--text-ui-md:14px;--text-ui-md--line-height:20px;--text-doc-h1:30px;--text-doc-h1--line-height:38px;--text-doc-h2:24px;--text-doc-h2--line-height:32px;--text-doc-h3:18px;--text-doc-h3--line-height:28px;--text-doc-body:16px;--text-doc-body--line-height:27px;--text-code:14px;--text-code--line-height:22px;--shadow-menu:var(--dw-shadow-menu);--container-doc:720px;--container-doc-wide:1040px;--spacing-control-sm:28px;--spacing-control-md:34px}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-Line truncated
/*$vite$:1*/</style>
</head>
<body>
+4
View File
@@ -16,6 +16,7 @@ import { englishLabels, type EditorLabels } from "./labels";
import type { MentionHost } from "./mention";
import { createLinkedPage, type PageHost } from "./pagelinks";
import type { CollabProvider } from "./provider";
import type { SyncedPageHost } from "./syncedpage";
const props = withDefaults(
defineProps<{
@@ -42,6 +43,8 @@ const props = withDefaults(
codeLineNumbers?: boolean;
/** Dates in the text open that day's journal (navigate to /journal/<date>). */
journals?: boolean;
/** Draws synced pages live; without it they show as links. */
syncedPages?: SyncedPageHost;
}>(),
{ editable: true },
);
@@ -80,6 +83,7 @@ const editor = useEditor({
loadPdf: () => import("./pdfjs").then((m) => m.pdf),
codeLineNumbers: props.codeLineNumbers,
onNavigate: (path) => emit("navigate", path),
syncedPages: props.syncedPages,
onOpenDate: props.journals ? (date) => emit("navigate", `/journal/${date}`) : undefined,
labels: props.labels,
onCommentSelect: (id) => emit("comment-select", id),
+81
View File
@@ -1159,3 +1159,84 @@
display: none;
}
}
/* ---- Synced pages (syncedpage.ts) ---- */
.dw-prose .dw-synced {
margin: 0.75em 0;
border: 1px solid var(--color-line);
border-left: 3px solid var(--color-accent);
border-radius: var(--radius-sm);
background: var(--color-surface);
}
.dw-prose .dw-synced__head {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 10px;
border-bottom: 1px solid var(--color-line);
font-family: var(--font-sans);
font-size: 13px;
color: var(--color-ink-muted);
}
.dw-prose .dw-synced.is-folded .dw-synced__head {
border-bottom: 0;
}
.dw-prose .dw-synced__badge {
flex: none;
color: var(--color-accent);
}
.dw-prose .dw-synced__title {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-weight: 600;
color: var(--color-ink);
text-decoration: none;
}
.dw-prose .dw-synced__title:hover {
text-decoration: underline;
}
.dw-prose .dw-synced__btn {
flex: none;
border: 0;
border-radius: var(--radius-xs);
background: none;
padding: 2px 6px;
font: inherit;
color: inherit;
cursor: pointer;
}
.dw-prose .dw-synced__btn:hover {
background: var(--color-surface-hover);
color: var(--color-ink);
}
.dw-prose .dw-synced__body {
padding: 4px 14px;
}
.dw-prose .dw-synced__body:empty {
display: none;
}
.dw-prose .dw-synced__body .dw-prose > :first-child {
margin-top: 0.5em;
}
.dw-prose .dw-synced__note {
margin: 0.5em 0;
font-family: var(--font-sans);
font-size: 13px;
color: var(--color-ink-muted);
}
/* The reader's text size (account settings, kept per device). */
.dw-size-sm {
--text-doc-body: 14px;
--text-doc-body--line-height: 24px;
}
.dw-size-lg {
--text-doc-body: 18px;
--text-doc-body--line-height: 30px;
}
.dw-prose .dw-synced__body .dw-prose {
min-height: 0;
}
+33 -2
View File
@@ -12,6 +12,8 @@ import { DocwellCodeBlock } from "./codeblock";
import { DocwellHighlight, TextColor } from "./colors";
import { CommentHighlights } from "./comments";
import { DateMention } from "./dates";
import { SyncedPage, type SyncedPageHost } from "./syncedpage";
import type * as Y from "yjs";
import { DrawioBlock, ExcalidrawBlock, type ExcalidrawLoader } from "./diagrams";
import { Embed, LinkCard, type LinkHost } from "./embeds";
import { DocwellImage, FileAttachment, FileDrop, type FileHost } from "./files";
@@ -56,6 +58,13 @@ export interface ExtensionOptions {
onNavigate?: (path: string) => void;
/** Opens a date's journal page (clicking a date mention); hosts without journals leave it out. */
onOpenDate?: (date: string) => void;
/** Draws synced pages live; without it they show as links to the page. */
syncedPages?: SyncedPageHost;
/**
* Shows this document read-only (a synced page's copy): bound to it
* without carets, undo or synced pages of its own.
*/
syncedDoc?: Y.Doc;
/** The Draw.io embed address (default https://embed.diagrams.net). */
drawioUrl?: string;
/** Loads Mermaid; without it diagrams show as their text. */
@@ -100,7 +109,7 @@ export function docwellExtensions(opts: ExtensionOptions = {}): AnyExtension[] {
codeBlock: false,
link: { openOnClick: false, autolink: true },
// Collaboration brings its own undo history, scoped to the local user.
undoRedo: opts.collab ? false : undefined,
undoRedo: opts.collab || opts.syncedDoc ? false : undefined,
}),
Placeholder.configure({ placeholder: opts.placeholder ?? "Type '/' for commands…" }),
DocwellImage.configure({ host: opts.files }),
@@ -128,13 +137,35 @@ export function docwellExtensions(opts: ExtensionOptions = {}): AnyExtension[] {
DrawioBlock.configure(diagrams),
ExcalidrawBlock.configure(diagrams),
PageLinks.configure({ host: opts.pages, labels, onNavigate: opts.onNavigate }),
SyncedPage.configure({
host: opts.syncedPages,
pages: opts.pages,
labels,
onNavigate: opts.onNavigate,
// One level deep: a synced page's own synced pages show as links.
nested: (doc) =>
docwellExtensions({
syncedDoc: doc,
files: opts.files,
links: opts.links,
onNavigate: opts.onNavigate,
drawioUrl: opts.drawioUrl,
loadMermaid: opts.loadMermaid,
loadPdf: opts.loadPdf,
codeLineNumbers: opts.codeLineNumbers,
labels: opts.labels,
placeholder: "",
}),
}),
...docwellToggles(labels),
Embed.configure({ labels }),
LinkCard.configure({ labels }),
BlockLinks.configure({ labels, link: opts.blockLink, onCopied: opts.onBlockLinkCopied }),
FindReplace,
];
if (opts.collab) {
if (opts.syncedDoc) {
list.push(Collaboration.configure({ document: opts.syncedDoc }));
} else if (opts.collab) {
list.push(
Collaboration.configure({ document: opts.collab.provider.doc }),
CollaborationCaret.configure({ provider: opts.collab.provider, user: opts.collab.user, render: renderCaret }),
+1
View File
@@ -8,6 +8,7 @@ export { englishLabels, type EditorLabels } from "./labels";
export type { MentionHost, Person } from "./mention";
export { filterCommands, slashCommands, type SlashCommand } from "./slash";
export { insertFiles, type FileHost, type UploadedFile } from "./files";
export { insertSyncedPage, SyncedPage, type SyncedPageHost } from "./syncedpage";
export { CollabProvider, type CollabProviderOptions, type CollabStatus } from "./provider";
export { linkedPage, pagePath, type PageHost, type PageRef as LinkablePage } from "./pagelinks";
export { headingsOf, type Heading } from "./toc";
+15
View File
@@ -105,6 +105,13 @@ export interface EditorLabels {
pdfLoading: string;
/** One page of a PDF shown inline; {n} is its number. */
pdfPage: string;
syncedPage: string;
syncedOpen: string;
syncedFold: string;
syncedUnfold: string;
syncedLoading: string;
syncedDenied: string;
syncedSelf: string;
};
/** The find and replace bar. count has {current} and {total} in it. */
find: {
@@ -168,6 +175,7 @@ export const englishLabels: EditorLabels = {
toggle: { label: "Toggle", description: "A heading that hides the blocks under it" },
embed: { label: "Embed", description: "A video, design or document from YouTube, Figma and more" },
linkCard: { label: "Link card", description: "A link with its page's title and picture" },
syncedPage: { label: "Synced page", description: "Show another page here, always up to date" },
newPage: { label: "New page", description: "Make a page and link it here" },
today: { label: "Today", description: "Insert today's date" },
tomorrow: { label: "Tomorrow", description: "Insert tomorrow's date" },
@@ -261,6 +269,13 @@ export const englishLabels: EditorLabels = {
embed: "Embedded content",
embedUrl: "Address of the video, design or document",
embedInvalid: "This address can't be embedded.",
syncedPage: "Synced page",
syncedOpen: "Open",
syncedFold: "Fold",
syncedUnfold: "Unfold",
syncedLoading: "Loading the page…",
syncedDenied: "You can't open this page.",
syncedSelf: "A page can't show itself.",
linkUrl: "Address of the page to link",
copyBlockLink: "Copy link to this block",
calloutEmoji: "Change emoji",
+10 -3
View File
@@ -28,6 +28,12 @@ export interface CollabProviderOptions {
page: string;
/** Read on every (re)connect, so a refreshed session token is picked up. */
token: () => string | null;
/**
* Only follow the page: never send changes or presence. For pages shown
* inside another page (synced pages), so nothing done to the copy can
* reach the real one.
*/
readOnly?: boolean;
}
/**
@@ -52,6 +58,7 @@ export class CollabProvider {
constructor(private readonly opts: CollabProviderOptions) {
this.doc.on("update", this.onDocUpdate);
this.awareness.on("update", this.onAwarenessUpdate);
if (opts.readOnly) this.awareness.setLocalState(null);
window.addEventListener("beforeunload", this.onUnload);
this.connect();
}
@@ -129,7 +136,7 @@ export class CollabProvider {
const enc = encoding.createEncoder();
encoding.writeVarUint(enc, MSG_SYNC);
const step = sync.readSyncMessage(dec, enc, this.doc, this);
if (encoding.length(enc) > 1) this.ws?.send(encoding.toUint8Array(enc));
if (encoding.length(enc) > 1 && !this.opts.readOnly) this.ws?.send(encoding.toUint8Array(enc));
if (step === sync.messageYjsSyncStep2) {
this.retries = 0;
this.set("connected", true);
@@ -140,7 +147,7 @@ export class CollabProvider {
}
private onDocUpdate = (update: Uint8Array, origin: unknown) => {
if (origin === this || this.ws?.readyState !== WebSocket.OPEN) return;
if (origin === this || this.opts.readOnly || this.ws?.readyState !== WebSocket.OPEN) return;
const enc = encoding.createEncoder();
encoding.writeVarUint(enc, MSG_SYNC);
sync.writeUpdate(enc, update);
@@ -152,7 +159,7 @@ export class CollabProvider {
{ added, updated, removed }: { added: number[]; updated: number[]; removed: number[] },
origin: unknown,
) => {
if (origin === this) return;
if (origin === this || this.opts.readOnly) return;
this.sendAwareness([...added, ...updated, ...removed]);
};
+5
View File
@@ -141,6 +141,11 @@ export function slashCommands(
e.chain().focus().deleteRange(r).insertContent("[[").run(),
),
);
list.push(
block("syncedPage", "copy", ["embed", "transclude", "include", "mirror", "![["], (e, r) =>
e.chain().focus().deleteRange(r).insertContent("![[").run(),
),
);
if (pages.create) {
list.push(
block("newPage", "page-plus", ["page", "doc", "subpage", "create"], (e, r) => {
+280
View File
@@ -0,0 +1,280 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import { Editor, mergeAttributes, Node, type AnyExtension, type Range } from "@tiptap/core";
import { PluginKey } from "@tiptap/pm/state";
import Suggestion from "@tiptap/suggestion";
import type * as Y from "yjs";
import type { EditorLabels } from "./labels";
import { pagePath, type PageHost, type PageRef } from "./pagelinks";
import type { CollabProvider } from "./provider";
import { floatingList, svgIcon } from "./suggestion";
/**
* Shows other pages inside a page. Without one, synced pages show as a
* titled link to the page (the mobile reader, exports).
*/
export interface SyncedPageHost {
/** A read-only connection to the page's live document (see CollabProvider's readOnly). */
open(page: string): CollabProvider;
/** The page's current title and icon; null when the reader cannot open it. */
meta(page: string): Promise<{ title: string; icon: string } | null>;
/** The page being edited, which cannot show itself. */
self?: string;
}
export interface SyncedPageOptions {
host?: SyncedPageHost;
/** Finds pages for "![[", which inserts a synced page. */
pages?: PageHost;
labels: EditorLabels | null;
onNavigate?: (path: string) => void;
/** The extensions of the read-only editor that draws a synced page's document. */
nested?: (doc: Y.Doc) => AnyExtension[];
}
declare module "@tiptap/core" {
interface Commands<ReturnType> {
syncedPage: {
insertSyncedPage: (page: PageRef) => ReturnType;
};
}
}
/** Replaces range with a synced page. */
export function insertSyncedPage(editor: Editor, range: Range, page: PageRef) {
editor.chain().focus().deleteRange(range).insertSyncedPage(page).run();
}
/**
* A synced page: another page drawn inside this one, read-only, and kept up
* to date as it is edited. The node stores the page id and, for exports and
* readers without a host, its title and icon. It can be folded to its title.
*/
export const SyncedPage = Node.create<SyncedPageOptions>({
name: "syncedPage",
group: "block",
atom: true,
draggable: true,
addOptions() {
return { host: undefined, pages: undefined, labels: null, onNavigate: undefined, nested: undefined };
},
addAttributes() {
return {
page: {
default: "",
parseHTML: (el) => el.getAttribute("data-page") ?? "",
renderHTML: (a) => ({ "data-page": a.page }),
},
title: {
default: "",
parseHTML: (el) => el.getAttribute("data-title") ?? "",
renderHTML: (a) => (a.title ? { "data-title": a.title } : {}),
},
icon: {
default: "",
parseHTML: (el) => el.getAttribute("data-icon") ?? "",
renderHTML: (a) => (a.icon ? { "data-icon": a.icon } : {}),
},
folded: {
default: false,
parseHTML: (el) => el.hasAttribute("data-folded"),
renderHTML: (a) => (a.folded ? { "data-folded": "" } : {}),
},
};
},
parseHTML() {
return [{ tag: "div[data-type='syncedPage']" }];
},
renderHTML({ node, HTMLAttributes }) {
const title = `${node.attrs.icon ? `${node.attrs.icon} ` : ""}${node.attrs.title || "…"}`;
return [
"div",
mergeAttributes(HTMLAttributes, { "data-type": "syncedPage" }),
["a", { href: pagePath(String(node.attrs.page)) }, title],
];
},
addCommands() {
return {
insertSyncedPage:
(page) =>
({ commands }) =>
commands.insertContent([
{ type: this.name, attrs: { page: page.id, title: page.title, icon: page.icon ?? "" } },
{ type: "paragraph" },
]),
};
},
addProseMirrorPlugins() {
const { pages } = this.options;
const labels = this.options.labels!;
if (!pages) return [];
return [
Suggestion<PageRef>({
editor: this.editor,
pluginKey: new PluginKey("syncedPages"),
char: "![[",
allowSpaces: true,
allow: ({ state, range }) => !state.doc.resolve(range.from).parent.type.spec.code,
items: async ({ query }) => (await pages.search(query).catch(() => [])).slice(0, 8),
render: floatingList<PageRef>({
label: labels.blocks.syncedPage,
empty: labels.noPages,
toItem: (p) => ({
label: `${p.icon ? `${p.icon} ` : ""}${p.title || "…"}`,
description: p.hint,
icon: "page",
}),
pick: (props, p) => insertSyncedPage(props.editor, props.range, p),
}),
}),
];
},
addNodeView() {
const { host, onNavigate, nested } = this.options;
const labels = this.options.labels!.blocks;
return ({ node: initial, editor, getPos }) => {
let node = initial;
const page = String(node.attrs.page);
const dom = document.createElement("div");
dom.className = "dw-synced";
dom.dataset.type = "syncedPage";
dom.contentEditable = "false";
const head = document.createElement("div");
head.className = "dw-synced__head";
const title = document.createElement("a");
title.className = "dw-synced__title";
title.href = pagePath(page);
const badge = svgIcon("copy", 14);
badge.classList.add("dw-synced__badge");
const fold = document.createElement("button");
fold.type = "button";
fold.className = "dw-synced__btn";
const open = document.createElement("button");
open.type = "button";
open.className = "dw-synced__btn";
open.textContent = labels.syncedOpen;
head.append(badge, title, fold, open);
const body = document.createElement("div");
body.className = "dw-synced__body";
dom.append(head, body);
const go = (e: Event) => {
e.preventDefault();
if (onNavigate) onNavigate(pagePath(page));
else window.location.assign(pagePath(page));
};
title.addEventListener("click", go);
open.addEventListener("click", go);
const set = (patch: Record<string, unknown>) => {
const pos = typeof getPos === "function" ? getPos() : undefined;
if (pos === undefined) return;
editor.view.dispatch(editor.state.tr.setNodeMarkup(pos, undefined, { ...node.attrs, ...patch }));
};
// Readers fold for themselves; editors fold for everyone.
let localFold: boolean | null = null;
const folded = () => localFold ?? !!node.attrs.folded;
fold.addEventListener("click", () => {
if (editor.isEditable) set({ folded: !node.attrs.folded });
else {
localFold = !folded();
draw();
}
});
let provider: CollabProvider | null = null;
let view: Editor | null = null;
let stopWatch: (() => void) | null = null;
const note = (text: string) => {
const p = document.createElement("p");
p.className = "dw-synced__note";
p.textContent = text;
body.replaceChildren(p);
};
const close = () => {
stopWatch?.();
view?.destroy();
provider?.destroy();
stopWatch = null;
view = null;
provider = null;
};
const show = () => {
if (view || !host || !nested) return;
if (page === host.self) return note(labels.syncedSelf);
provider = host.open(page);
note(labels.syncedLoading);
const p = provider;
const refresh = () => {
if (p.status === "denied") {
close();
note(labels.syncedDenied);
} else if (p.synced && !view) {
body.replaceChildren();
view = new Editor({
element: body,
editable: false,
extensions: nested(p.doc),
editorProps: { attributes: { class: "dw-prose" } },
});
}
};
stopWatch = p.onChange(refresh);
refresh();
};
function draw() {
const t = node.attrs.title as string;
title.textContent = `${node.attrs.icon ? `${node.attrs.icon} ` : ""}${t || labels.syncedPage}`;
const isFolded = folded();
dom.classList.toggle("is-folded", isFolded);
fold.textContent = isFolded ? labels.syncedUnfold : labels.syncedFold;
fold.setAttribute("aria-expanded", String(!isFolded));
if (isFolded) {
close();
body.replaceChildren();
} else if (!host) {
body.replaceChildren();
} else {
show();
}
}
draw();
// Keep the stored title in step, so exports and other readers have it.
void host?.meta(page).then((m) => {
if (!m) {
if (!folded()) note(labels.syncedDenied);
return;
}
if (editor.isEditable && (m.title !== node.attrs.title || m.icon !== node.attrs.icon)) {
set({ title: m.title, icon: m.icon });
} else {
title.textContent = `${m.icon ? `${m.icon} ` : ""}${m.title || labels.syncedPage}`;
}
});
return {
dom,
update(next) {
if (next.type !== node.type || String(next.attrs.page) !== page) return false;
node = next;
draw();
return true;
},
ignoreMutation: () => true,
stopEvent: (e) => e.target instanceof globalThis.Node && (head.contains(e.target) || body.contains(e.target)),
destroy: close,
};
};
},
});
+13 -2
View File
@@ -3200,17 +3200,28 @@ enum NotificationSettingsEmail {
}
class NotificationSettings {
const NotificationSettings({required this.email});
const NotificationSettings({required this.email, this.emailTypes});
factory NotificationSettings.fromJson(Map<String, dynamic> json) =>
NotificationSettings(
email: NotificationSettingsEmail.fromJson(json['email'] as String),
emailTypes: json['emailTypes'] == null
? null
: (json['emailTypes'] as List)
.map((e) => NotificationType.fromJson(e as String))
.toList(),
);
/// Unread notifications by email every few minutes
final NotificationSettingsEmail email;
Map<String, dynamic> toJson() => {'email': email.toJson()};
/// The notification types the email digest includes (the others only reach the inbox). Always sent back; leave it out when saving to keep it as it is.
final List<NotificationType>? emailTypes;
Map<String, dynamic> toJson() => {
'email': email.toJson(),
'emailTypes': ?emailTypes?.map((e) => e.toJson()).toList(),
};
}
enum AdminStatsScope {
+3
View File
@@ -1233,6 +1233,9 @@ type NotificationList struct {
type NotificationSettings struct {
// Email Unread notifications by email every few minutes
Email NotificationSettingsEmail `json:"email"`
// EmailTypes The notification types the email digest includes (the others only reach the inbox). Always sent back; leave it out when saving to keep it as it is.
EmailTypes *[]NotificationType `json:"emailTypes,omitempty"`
}
// NotificationSettingsEmail Unread notifications by email every few minutes
+3 -6
View File
@@ -385,13 +385,10 @@ func (w *docxWriter) block(n Node, ctx blockCtx) {
w.para(paraProps{}, func() { w.text(label, runProps{italic: true, href: w.link(n.attr("src"))}) })
case "fileAttachment":
w.para(paraProps{}, func() { w.text(n.attr("name"), runProps{href: w.link(n.attr("url"))}) })
case "embed", "linkCard":
title := n.attr("title")
if title == "" {
title = n.attr("url")
}
case "embed", "linkCard", "syncedPage":
href, title := n.card()
w.para(paraProps{}, func() {
w.text(title, runProps{href: w.link(n.attr("url"))})
w.text(title, runProps{href: w.link(href)})
if d := n.attr("description"); d != "" {
w.b.WriteString("<w:r><w:br/></w:r>")
w.text(d, runProps{color: "787878"})
+6 -12
View File
@@ -180,15 +180,12 @@ func writeHTML(b *strings.Builder, n Node, o Options) {
}
}
b.WriteString("</details>\n")
case "embed", "linkCard":
href := n.attr("url")
case "embed", "linkCard", "syncedPage":
href, title := n.card()
href = o.file(href)
if !safeURL.MatchString(href) {
return
}
title := n.attr("title")
if title == "" {
title = href
}
fmt.Fprintf(b, "<p><a href=\"%s\">%s</a>", html.EscapeString(href), html.EscapeString(title))
if d := n.attr("description"); d != "" {
fmt.Fprintf(b, "<br>%s", html.EscapeString(d))
@@ -407,15 +404,12 @@ func (w *mdWriter) block(n Node, first, rest string) {
}
w.b.WriteString(strings.TrimRight(rest, " ") + "\n")
w.lines("</details>", rest, rest)
case "embed", "linkCard":
href := n.attr("url")
case "embed", "linkCard", "syncedPage":
href, title := n.card()
href = w.o.file(href)
if !safeURL.MatchString(href) {
return
}
title := n.attr("title")
if title == "" {
title = href
}
line := "[" + escapeMD(title) + "](" + mdURL(href) + ")"
if d := n.attr("description"); d != "" {
line += " — " + escapeMD(d)
+25
View File
@@ -81,3 +81,28 @@ func TestTogglesEmbedsAndPageLinks(t *testing.T) {
t.Fatalf("details did not round-trip: %+v", d)
}
}
func TestSyncedPageExportsAsPageLink(t *testing.T) {
doc, err := Parse([]byte(`{"type":"doc","content":[
{"type":"syncedPage","attrs":{"page":"abc123","title":"Plan","icon":"📋"}},
{"type":"syncedPage","attrs":{"page":"def456"}}]}`))
if err != nil {
t.Fatal(err)
}
o := Options{PageURL: func(id, frag string) string { return "../" + id + ".md" + frag }}
md := Markdown(doc, o)
for _, want := range []string{"[📋 Plan](../abc123.md)", "[Synced page](../def456.md)"} {
if !strings.Contains(md, want) {
t.Errorf("markdown lacks %q:\n%s", want, md)
}
}
if h := HTML(doc, Options{}); !strings.Contains(h, `<a href="/p/abc123">📋 Plan</a>`) {
t.Errorf("html lacks the page link:\n%s", h)
}
if _, err := PDF("T", doc, PDFOptions{}); err != nil {
t.Errorf("pdf: %v", err)
}
if _, err := DOCX("T", doc, DOCXOptions{}); err != nil {
t.Errorf("docx: %v", err)
}
}
+21
View File
@@ -42,6 +42,27 @@ func (n Node) attr(key string) string {
return ""
}
// card is the address and title of a block that links somewhere: an embed,
// a link card, or a synced page (shown as a link to the page it shows).
func (n Node) card() (href, title string) {
if n.Type == "syncedPage" {
href = "/p/" + n.attr("page")
title = n.attr("title")
if icon := n.attr("icon"); icon != "" && title != "" {
title = icon + " " + title
}
if title == "" {
title = "Synced page"
}
return href, title
}
href, title = n.attr("url"), n.attr("title")
if title == "" {
title = href
}
return href, title
}
func (n Node) intAttr(key string, def int) int {
if v, ok := n.Attrs[key].(float64); ok {
return int(v)
+3 -6
View File
@@ -325,12 +325,9 @@ func (w *pdfWriter) block(n Node, indent, gap float64) {
w.inline(n.Content, "B", pdfBody)
w.f.Ln(pdfLine)
w.f.Ln(pdfTightGap)
case "embed", "linkCard":
title := n.attr("title")
if title == "" {
title = n.attr("url")
}
w.note(title, n.attr("url"), indent)
case "embed", "linkCard", "syncedPage":
href, title := n.card()
w.note(title, href, indent)
if d := n.attr("description"); d != "" {
w.at(indent)
w.f.SetFont("go", "", 10)
+51 -10
View File
@@ -8,6 +8,7 @@ import (
"fmt"
"log/slog"
"net/url"
"slices"
"sort"
"strings"
"time"
@@ -502,29 +503,64 @@ func (s *Service) MarkNotificationsRead(ctx context.Context, c access.Caller, id
type NotificationSettings struct {
// Email is "digest" (unread notifications by email every few minutes) or "off".
Email string `json:"email"`
// EmailTypes are the notification types the digest includes; the others
// only reach the inbox. Nil when setting means "leave as it is".
EmailTypes []string `json:"emailTypes"`
}
// notificationTypes are every type a notification can have, in menu order.
var notificationTypes = []string{"mention", "comment", "reply", "resolved", "share", "reminder"}
// emailTypes is every notification type except the ones turned off.
func emailTypes(off []string) []string {
out := []string{}
for _, t := range notificationTypes {
if !slices.Contains(off, t) {
out = append(out, t)
}
}
return out
}
type notifyPrefs struct {
NotifyEmail string `json:"notify_email"`
NotifyEmailOff []string `json:"notify_email_off"`
}
func (s *Service) GetNotificationSettings(ctx context.Context, c access.Caller) (NotificationSettings, error) {
r, err := pocketbase.Get[struct {
NotifyEmail string `json:"notify_email"`
}](ctx, s.pb, "users", c.ID)
r, err := pocketbase.Get[notifyPrefs](ctx, s.pb, "users", c.ID)
if err != nil {
return NotificationSettings{}, mapPB(err, "user not found")
}
if r.NotifyEmail != "off" {
r.NotifyEmail = "digest"
}
return NotificationSettings{Email: r.NotifyEmail}, nil
return NotificationSettings{Email: r.NotifyEmail, EmailTypes: emailTypes(r.NotifyEmailOff)}, nil
}
func (s *Service) SetNotificationSettings(ctx context.Context, c access.Caller, in NotificationSettings) (NotificationSettings, error) {
if in.Email != "digest" && in.Email != "off" {
return NotificationSettings{}, apperr.InvalidFields(map[string]string{"email": "Choose digest or off."})
}
if _, err := pocketbase.Update[struct{}](ctx, s.pb, "users", c.ID, map[string]any{"notify_email": in.Email}); err != nil {
patch := map[string]any{"notify_email": in.Email}
if in.EmailTypes != nil {
off := []string{}
for _, t := range in.EmailTypes {
if !slices.Contains(notificationTypes, t) {
return NotificationSettings{}, apperr.InvalidFields(map[string]string{"emailTypes": "Unknown notification type " + t + "."})
}
}
for _, t := range notificationTypes {
if !slices.Contains(in.EmailTypes, t) {
off = append(off, t)
}
}
patch["notify_email_off"] = off
}
if _, err := pocketbase.Update[struct{}](ctx, s.pb, "users", c.ID, patch); err != nil {
return NotificationSettings{}, mapPB(err, "user not found")
}
return in, nil
return s.GetNotificationSettings(ctx, c)
}
// ---- Email digest ----------------------------------------------------------
@@ -601,14 +637,19 @@ func (s *Service) SendDigests(ctx context.Context) error {
var firstErr error
for userID, list := range byUser {
u, err := pocketbase.Get[struct {
Email string `json:"email"`
Name string `json:"name"`
Status string `json:"status"`
NotifyEmail string `json:"notify_email"`
Email string `json:"email"`
Name string `json:"name"`
Status string `json:"status"`
NotifyEmail string `json:"notify_email"`
NotifyEmailOff []string `json:"notify_email_off"`
}](ctx, s.pb, "users", userID)
if err == nil && u.NotifyEmail != "off" && u.Status != "disabled" {
var items []digestItem
for _, n := range list {
// Types turned off stay in the inbox only (and are marked below).
if slices.Contains(u.NotifyEmailOff, n.Type) {
continue
}
if it, ok := s.digestLine(ctx, n, who); ok {
items = append(items, it)
}
+11
View File
@@ -67,3 +67,14 @@ func TestLinkIDs(t *testing.T) {
t.Fatalf("empty document should give an empty list, got %v", ids)
}
}
func TestEmailTypesLeaveOutTheOnesTurnedOff(t *testing.T) {
got := emailTypes([]string{"comment", "share"})
want := []string{"mention", "reply", "resolved", "reminder"}
if strings.Join(got, ",") != strings.Join(want, ",") {
t.Errorf("emailTypes = %v, want %v", got, want)
}
if len(emailTypes(nil)) != len(notificationTypes) {
t.Error("nothing turned off should email every type")
}
}
+11
View File
@@ -307,6 +307,17 @@
"required": false,
"system": false,
"type": "json"
},
{
"help": "",
"hidden": false,
"id": "json3607448351",
"maxSize": 2000,
"name": "notify_email_off",
"presentable": false,
"required": false,
"system": false,
"type": "json"
}
],
"fileToken": {
+13
View File
@@ -1,11 +1,24 @@
<!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
<script setup lang="ts">
import { useTheme } from "@docwell/ui";
import { onBeforeUnmount, onMounted } from "vue";
import { useRouter } from "vue-router";
import { useBrandingStore } from "./stores/branding";
useTheme();
// The instance's accent colour and name apply everywhere, signed in or not.
void useBrandingStore().load();
// Ctrl+[ and Ctrl+] (Cmd on macOS) go back and forward, on every screen.
const router = useRouter();
function onKey(e: KeyboardEvent) {
if (!(e.ctrlKey || e.metaKey) || e.shiftKey || e.altKey || (e.key !== "[" && e.key !== "]")) return;
e.preventDefault();
if (e.key === "[") router.back();
else router.forward();
}
onMounted(() => document.addEventListener("keydown", onKey));
onBeforeUnmount(() => document.removeEventListener("keydown", onKey));
</script>
<template>
+70 -3
View File
@@ -7,6 +7,8 @@ import { useRoute, useRouter } from "vue-router";
import { clearFileToken } from "../composables/useFiles";
import { useFormErrors } from "../composables/useFormErrors";
import { onCommand } from "../lib/commands";
import { pageOfHref, useSplit } from "../composables/useSplit";
import PageView from "../views/page/PageView.vue";
import { SIDEBAR_DEFAULT, clampWidth, useSidebar } from "../composables/useSidebar";
import { useAuthStore } from "../stores/auth";
import { useFavoritesStore } from "../stores/favorites";
@@ -61,7 +63,8 @@ watch(
() => (sidebar.mobileOpen.value = false),
);
// Ctrl+/ (Cmd+/ on macOS) folds the sidebar, as in other editors; Ctrl+K searches.
// Ctrl+/ (Cmd+/ on macOS) folds the sidebar, as in other editors; Ctrl+K
// searches. (Back and forward are in App.vue.)
function onKey(e: KeyboardEvent) {
if ((e.ctrlKey || e.metaKey) && e.key === "/") {
e.preventDefault();
@@ -74,6 +77,37 @@ function onKey(e: KeyboardEvent) {
onMounted(() => document.addEventListener("keydown", onKey));
onBeforeUnmount(() => document.removeEventListener("keydown", onKey));
// Split view: Alt+click (Option on macOS) on any link to a page opens it
// beside the main view, on screens wide enough for two pages.
const split = useSplit();
const wide = ref(true);
let wideQuery: MediaQueryList | null = null;
const onWide = () => (wide.value = !!wideQuery?.matches);
function onLinkClick(e: MouseEvent) {
if (!e.altKey || e.button !== 0 || !wide.value) return;
const a = (e.target as Element | null)?.closest?.("a[href]");
const id = a ? pageOfHref(a.getAttribute("href") ?? "") : "";
if (!id) return;
e.preventDefault();
e.stopPropagation();
split.open(id);
}
onMounted(() => {
wideQuery = window.matchMedia("(min-width: 1024px)");
onWide();
wideQuery.addEventListener("change", onWide);
document.addEventListener("click", onLinkClick, true);
});
onBeforeUnmount(() => {
wideQuery?.removeEventListener("change", onWide);
document.removeEventListener("click", onLinkClick, true);
});
function openSplitHere() {
const id = split.page.value;
split.close();
router.push({ name: "page", params: { id } });
}
// The desktop app's menu bar sends the same actions.
const stopCommands = onCommand((c) => {
if (c === "search") searchOpen.value = true;
@@ -487,8 +521,41 @@ function signOut() {
/>
<div id="app-header" class="flex min-w-0 flex-1 items-center gap-2" />
</header>
<div class="flex-1 overflow-y-auto">
<RouterView @error="showError" />
<div class="flex min-h-0 flex-1">
<div class="min-w-0 flex-1 overflow-y-auto">
<RouterView @error="showError" />
</div>
<!-- Split view: a second page beside the main one (wide screens). -->
<section
v-if="split.page.value && wide"
class="flex w-1/2 min-w-0 flex-col border-l border-line"
:aria-label="$t('split.label')"
data-testid="split-pane"
>
<header class="flex h-10 shrink-0 items-center gap-2 border-b border-line px-3">
<div id="split-header" class="flex min-w-0 flex-1 items-center gap-1" />
<DwButton
variant="ghost"
size="sm"
icon="open"
:aria-label="$t('split.openHere')"
:title="$t('split.openHere')"
@click="openSplitHere"
/>
<DwButton
variant="ghost"
size="sm"
icon="close"
:aria-label="$t('split.close')"
:title="$t('split.close')"
data-testid="split-close"
@click="split.close()"
/>
</header>
<div class="min-h-0 flex-1 overflow-y-auto">
<PageView :id="split.page.value" :key="split.page.value" pane="split" @error="showError" />
</div>
</section>
</div>
</main>
</div>
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import { ref } from "vue";
const key = "docwell.split";
function remembered(): string {
try {
return sessionStorage.getItem(key) ?? "";
} catch {
return "";
}
}
// One split pane for the whole app, kept while navigating the main view
// and across reloads of the tab.
const page = ref(remembered());
/** The page shown beside the main view (split view), if any. */
export function useSplit() {
function set(id: string) {
page.value = id;
try {
if (id) sessionStorage.setItem(key, id);
else sessionStorage.removeItem(key);
} catch {
// per-tab convenience only
}
}
return { page, open: (id: string) => set(id), close: () => set("") };
}
/** The page id of an app link like "/p/<id>" (with an optional #block), or "". */
export function pageOfHref(href: string): string {
return /^\/p\/([A-Za-z0-9_-]+)\/?(?:[?#].*)?$/.exec(href)?.[1] ?? "";
}
+45 -3
View File
@@ -301,7 +301,9 @@
"unarchive": "Aus dem Archiv holen",
"archived": "Diese Seite ist archiviert. Sie ist schreibgeschützt, bis jemand sie aus dem Archiv holt.",
"parentArchived": "Eine übergeordnete Seite ist archiviert, daher ist diese Seite schreibgeschützt.",
"linkCopied": "Link kopiert"
"linkCopied": "Link kopiert",
"openNewTab": "In neuem Tab öffnen",
"openBeside": "Daneben öffnen"
},
"trash": {
"hint": "Unterseiten einer gelöschten Seite kommen mit zurück, wenn du sie wiederherstellst.",
@@ -549,6 +551,10 @@
"now": {
"label": "Jetzt",
"description": "Datum und Uhrzeit einfügen"
},
"syncedPage": {
"label": "Synchronisierte Seite",
"description": "Eine andere Seite hier zeigen, immer aktuell"
}
},
"format": {
@@ -598,7 +604,14 @@
"calloutEmoji": "Emoji ändern",
"calloutColor": "Farbe ändern",
"pdfLoading": "PDF wird geladen…",
"pdfPage": "Seite {n}"
"pdfPage": "Seite {n}",
"syncedPage": "Synchronisierte Seite",
"syncedOpen": "Öffnen",
"syncedFold": "Einklappen",
"syncedUnfold": "Ausklappen",
"syncedLoading": "Seite wird geladen…",
"syncedDenied": "Du kannst diese Seite nicht öffnen.",
"syncedSelf": "Eine Seite kann sich nicht selbst zeigen."
},
"colors": {
"gray": "Grau",
@@ -682,7 +695,16 @@
"emailDigestHint": "Alle paar Minuten eine Zusammenfassung, nur zu dem, was du in der App noch nicht gesehen hast.",
"watchHint": "Du beobachtest Seiten, die du erstellst oder kommentierst. Über das Seitenmenü beobachtest oder stummschaltest du eine Seite.",
"watch": "Seite beobachten",
"unwatch": "Nicht mehr beobachten"
"unwatch": "Nicht mehr beobachten",
"emailTypesHint": "Per E-Mail benachrichtigen bei",
"emailTypes": {
"mention": "Erwähnungen",
"comment": "Kommentaren auf beobachteten Seiten",
"reply": "Antworten",
"resolved": "Erledigten Threads",
"share": "Mit mir geteilten Seiten",
"reminder": "Erinnerungen"
}
},
"templates": {
"mark": "Als Vorlage verwenden",
@@ -733,6 +755,21 @@
"expiresOn": "läuft am {date} ab",
"revoke": "Widerrufen",
"none": "Noch keine Tokens."
},
"editor": {
"title": "Editor",
"hint": "Wie Seiten auf diesem Gerät aussehen und beginnen.",
"textSize": "Textgröße",
"sizes": {
"sm": "Klein",
"md": "Standard",
"lg": "Groß"
},
"newPageFullWidth": "Neue Seiten nutzen die volle Breite",
"dateTitles": "Neue Seiten mit dem heutigen Datum betiteln",
"showProperties": "Eigenschaften unter dem Titel zeigen",
"showBacklinks": "Seiten zeigen, die hierher verlinken",
"codeLineNumbers": "Zeilennummern in Codeblöcken"
}
},
"webhooks": {
@@ -962,5 +999,10 @@
"noTemplate": "Einer leeren Seite",
"opening": "Journal wird geöffnet…",
"failed": "Das Journal konnte nicht geöffnet werden."
},
"split": {
"label": "Seite daneben",
"openHere": "Als Hauptseite öffnen",
"close": "Seite daneben schließen"
}
}
+45 -3
View File
@@ -301,7 +301,9 @@
"unarchive": "Unarchive",
"archived": "This page is archived. It is read-only until someone unarchives it.",
"parentArchived": "A page above this one is archived, so this page is read-only.",
"linkCopied": "Link copied"
"linkCopied": "Link copied",
"openNewTab": "Open in new tab",
"openBeside": "Open beside"
},
"trash": {
"hint": "Pages inside a trashed page come back when you restore it.",
@@ -549,6 +551,10 @@
"now": {
"label": "Now",
"description": "Insert the date and time"
},
"syncedPage": {
"label": "Synced page",
"description": "Show another page here, always up to date"
}
},
"format": {
@@ -598,7 +604,14 @@
"calloutEmoji": "Change emoji",
"calloutColor": "Change colour",
"pdfLoading": "Loading PDF…",
"pdfPage": "Page {n}"
"pdfPage": "Page {n}",
"syncedPage": "Synced page",
"syncedOpen": "Open",
"syncedFold": "Fold",
"syncedUnfold": "Unfold",
"syncedLoading": "Loading the page…",
"syncedDenied": "You can't open this page.",
"syncedSelf": "A page can't show itself."
},
"colors": {
"gray": "Grey",
@@ -682,7 +695,16 @@
"emailDigestHint": "A summary every few minutes, only for what you have not seen in the app.",
"watchHint": "You watch pages you create or comment on. Use the page menu to watch or mute a page.",
"watch": "Watch page",
"unwatch": "Stop watching"
"unwatch": "Stop watching",
"emailTypesHint": "Email me about",
"emailTypes": {
"mention": "Mentions",
"comment": "Comments on pages I watch",
"reply": "Replies",
"resolved": "Resolved threads",
"share": "Pages shared with me",
"reminder": "Reminders"
}
},
"templates": {
"mark": "Use as template",
@@ -733,6 +755,21 @@
"expiresOn": "expires {date}",
"revoke": "Revoke",
"none": "No tokens yet."
},
"editor": {
"title": "Editor",
"hint": "How pages read and start out on this device.",
"textSize": "Text size",
"sizes": {
"sm": "Small",
"md": "Default",
"lg": "Large"
},
"newPageFullWidth": "New pages use the full width",
"dateTitles": "Title new pages with today's date",
"showProperties": "Show properties under the title",
"showBacklinks": "Show the pages that link here",
"codeLineNumbers": "Line numbers in code blocks"
}
},
"webhooks": {
@@ -962,5 +999,10 @@
"noTemplate": "An empty page",
"opening": "Opening the journal…",
"failed": "The journal could not be opened."
},
"split": {
"label": "Page beside",
"openHere": "Open as the main page",
"close": "Close the side page"
}
}
+45 -3
View File
@@ -301,7 +301,9 @@
"unarchive": "Desarchivar",
"archived": "Esta página está archivada. Es de solo lectura hasta que alguien la desarchive.",
"parentArchived": "Una página superior está archivada, así que esta página es de solo lectura.",
"linkCopied": "Enlace copiado"
"linkCopied": "Enlace copiado",
"openNewTab": "Abrir en una pestaña nueva",
"openBeside": "Abrir al lado"
},
"trash": {
"hint": "Las subpáginas de una página eliminada vuelven cuando la restauras.",
@@ -549,6 +551,10 @@
"now": {
"label": "Ahora",
"description": "Insertar la fecha y la hora"
},
"syncedPage": {
"label": "Página sincronizada",
"description": "Muestra otra página aquí, siempre al día"
}
},
"format": {
@@ -598,7 +604,14 @@
"calloutEmoji": "Cambiar emoji",
"calloutColor": "Cambiar color",
"pdfLoading": "Cargando PDF…",
"pdfPage": "Página {n}"
"pdfPage": "Página {n}",
"syncedPage": "Página sincronizada",
"syncedOpen": "Abrir",
"syncedFold": "Plegar",
"syncedUnfold": "Desplegar",
"syncedLoading": "Cargando la página…",
"syncedDenied": "No puedes abrir esta página.",
"syncedSelf": "Una página no puede mostrarse a sí misma."
},
"colors": {
"gray": "Gris",
@@ -682,7 +695,16 @@
"emailDigestHint": "Un resumen cada pocos minutos, solo de lo que no has visto en la app.",
"watchHint": "Sigues las páginas que creas o comentas. Usa el menú de la página para seguirla o silenciarla.",
"watch": "Seguir página",
"unwatch": "Dejar de seguir"
"unwatch": "Dejar de seguir",
"emailTypesHint": "Avisarme por correo de",
"emailTypes": {
"mention": "Menciones",
"comment": "Comentarios en páginas que sigo",
"reply": "Respuestas",
"resolved": "Hilos resueltos",
"share": "Páginas compartidas conmigo",
"reminder": "Recordatorios"
}
},
"templates": {
"mark": "Usar como plantilla",
@@ -733,6 +755,21 @@
"expiresOn": "caduca el {date}",
"revoke": "Revocar",
"none": "Aún no hay tokens."
},
"editor": {
"title": "Editor",
"hint": "Cómo se leen y empiezan las páginas en este dispositivo.",
"textSize": "Tamaño del texto",
"sizes": {
"sm": "Pequeño",
"md": "Normal",
"lg": "Grande"
},
"newPageFullWidth": "Las páginas nuevas usan todo el ancho",
"dateTitles": "Titular las páginas nuevas con la fecha de hoy",
"showProperties": "Mostrar las propiedades bajo el título",
"showBacklinks": "Mostrar las páginas que enlazan aquí",
"codeLineNumbers": "Números de línea en los bloques de código"
}
},
"webhooks": {
@@ -962,5 +999,10 @@
"noTemplate": "Una página vacía",
"opening": "Abriendo el diario…",
"failed": "No se pudo abrir el diario."
},
"split": {
"label": "Página al lado",
"openHere": "Abrir como página principal",
"close": "Cerrar la página de al lado"
}
}
+45 -3
View File
@@ -301,7 +301,9 @@
"unarchive": "Désarchiver",
"archived": "Cette page est archivée. Elle est en lecture seule jusqu’à ce que quelqu’un la désarchive.",
"parentArchived": "Une page parente est archivée, cette page est donc en lecture seule.",
"linkCopied": "Lien copié"
"linkCopied": "Lien copié",
"openNewTab": "Ouvrir dans un nouvel onglet",
"openBeside": "Ouvrir à côté"
},
"trash": {
"hint": "Les sous-pages d’une page supprimée reviennent quand vous la restaurez.",
@@ -549,6 +551,10 @@
"now": {
"label": "Maintenant",
"description": "Insérer la date et l'heure"
},
"syncedPage": {
"label": "Page synchronisée",
"description": "Afficher une autre page ici, toujours à jour"
}
},
"format": {
@@ -598,7 +604,14 @@
"calloutEmoji": "Changer l'emoji",
"calloutColor": "Changer la couleur",
"pdfLoading": "Chargement du PDF…",
"pdfPage": "Page {n}"
"pdfPage": "Page {n}",
"syncedPage": "Page synchronisée",
"syncedOpen": "Ouvrir",
"syncedFold": "Replier",
"syncedUnfold": "Déplier",
"syncedLoading": "Chargement de la page…",
"syncedDenied": "Vous ne pouvez pas ouvrir cette page.",
"syncedSelf": "Une page ne peut pas s’afficher elle-même."
},
"colors": {
"gray": "Gris",
@@ -682,7 +695,16 @@
"emailDigestHint": "Un résumé toutes les quelques minutes, seulement pour ce que vous n’avez pas vu dans l’app.",
"watchHint": "Vous suivez les pages que vous créez ou commentez. Utilisez le menu de la page pour suivre une page ou la mettre en sourdine.",
"watch": "Suivre la page",
"unwatch": "Ne plus suivre"
"unwatch": "Ne plus suivre",
"emailTypesHint": "M’écrire pour",
"emailTypes": {
"mention": "Les mentions",
"comment": "Les commentaires sur les pages suivies",
"reply": "Les réponses",
"resolved": "Les fils résolus",
"share": "Les pages partagées avec moi",
"reminder": "Les rappels"
}
},
"templates": {
"mark": "Utiliser comme modèle",
@@ -733,6 +755,21 @@
"expiresOn": "expire le {date}",
"revoke": "Révoquer",
"none": "Aucun jeton pour l’instant."
},
"editor": {
"title": "Éditeur",
"hint": "L’aspect et le départ des pages sur cet appareil.",
"textSize": "Taille du texte",
"sizes": {
"sm": "Petite",
"md": "Normale",
"lg": "Grande"
},
"newPageFullWidth": "Les nouvelles pages prennent toute la largeur",
"dateTitles": "Titrer les nouvelles pages avec la date du jour",
"showProperties": "Afficher les propriétés sous le titre",
"showBacklinks": "Afficher les pages qui pointent ici",
"codeLineNumbers": "Numéros de ligne dans les blocs de code"
}
},
"webhooks": {
@@ -962,5 +999,10 @@
"noTemplate": "Une page vide",
"opening": "Ouverture du journal…",
"failed": "Le journal n’a pas pu être ouvert."
},
"split": {
"label": "Page à côté",
"openHere": "Ouvrir comme page principale",
"close": "Fermer la page à côté"
}
}
+45 -3
View File
@@ -301,7 +301,9 @@
"unarchive": "Przywróć z archiwum",
"archived": "Ta strona jest zarchiwizowana. Jest tylko do odczytu, dopóki ktoś jej nie przywróci.",
"parentArchived": "Strona nadrzędna jest zarchiwizowana, więc ta strona jest tylko do odczytu.",
"linkCopied": "Skopiowano link"
"linkCopied": "Skopiowano link",
"openNewTab": "Otwórz w nowej karcie",
"openBeside": "Otwórz obok"
},
"trash": {
"hint": "Strony wewnątrz przywróconej strony wracają razem z nią.",
@@ -549,6 +551,10 @@
"now": {
"label": "Teraz",
"description": "Wstaw datę i godzinę"
},
"syncedPage": {
"label": "Strona synchronizowana",
"description": "Pokaż tu inną stronę, zawsze aktualną"
}
},
"format": {
@@ -598,7 +604,14 @@
"calloutEmoji": "Zmień emoji",
"calloutColor": "Zmień kolor",
"pdfLoading": "Wczytywanie PDF…",
"pdfPage": "Strona {n}"
"pdfPage": "Strona {n}",
"syncedPage": "Strona synchronizowana",
"syncedOpen": "Otwórz",
"syncedFold": "Zwiń",
"syncedUnfold": "Rozwiń",
"syncedLoading": "Wczytywanie strony…",
"syncedDenied": "Nie możesz otworzyć tej strony.",
"syncedSelf": "Strona nie może pokazać samej siebie."
},
"colors": {
"gray": "Szary",
@@ -682,7 +695,16 @@
"emailDigestHint": "Podsumowanie co kilka minut, tylko o tym, czego nie widzisz w aplikacji.",
"watchHint": "Obserwujesz strony, które tworzysz lub komentujesz. Menu strony pozwala obserwować lub wyciszyć stronę.",
"watch": "Obserwuj stronę",
"unwatch": "Przestań obserwować"
"unwatch": "Przestań obserwować",
"emailTypesHint": "Wysyłaj e-mail o",
"emailTypes": {
"mention": "Wzmiankach",
"comment": "Komentarzach na obserwowanych stronach",
"reply": "Odpowiedziach",
"resolved": "Rozwiązanych wątkach",
"share": "Stronach mi udostępnionych",
"reminder": "Przypomnieniach"
}
},
"templates": {
"mark": "Użyj jako szablonu",
@@ -733,6 +755,21 @@
"expiresOn": "wygasa {date}",
"revoke": "Unieważnij",
"none": "Brak tokenów."
},
"editor": {
"title": "Edytor",
"hint": "Jak strony wyglądają i zaczynają się na tym urządzeniu.",
"textSize": "Rozmiar tekstu",
"sizes": {
"sm": "Mały",
"md": "Domyślny",
"lg": "Duży"
},
"newPageFullWidth": "Nowe strony mają pełną szerokość",
"dateTitles": "Tytułuj nowe strony dzisiejszą datą",
"showProperties": "Pokazuj właściwości pod tytułem",
"showBacklinks": "Pokazuj strony, które tu linkują",
"codeLineNumbers": "Numery wierszy w blokach kodu"
}
},
"webhooks": {
@@ -962,5 +999,10 @@
"noTemplate": "Pustej strony",
"opening": "Otwieranie dziennika…",
"failed": "Nie udało się otworzyć dziennika."
},
"split": {
"label": "Strona obok",
"openHere": "Otwórz jako główną",
"close": "Zamknij stronę obok"
}
}
@@ -0,0 +1,62 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import { effectScope, reactive, watch } from "vue";
/** How pages read and start out on this device (account settings → Editor). */
export interface EditorPrefs {
/** The body text size: small, default or large. */
textSize: "sm" | "md" | "lg";
/** New pages start full width instead of in the reading column. */
newPageFullWidth: boolean;
/** New pages are titled with today's date. */
dateTitles: boolean;
/** The properties list under each page title. */
showProperties: boolean;
/** The list of pages that link to the page, under its text. */
showBacklinks: boolean;
/** Code blocks show line numbers unless one was switched on or off itself. */
codeLineNumbers: boolean;
}
const key = "docwell.editorPrefs";
export const defaultEditorPrefs: EditorPrefs = {
textSize: "md",
newPageFullWidth: false,
dateTitles: false,
showProperties: true,
showBacklinks: true,
codeLineNumbers: false,
};
function read(): EditorPrefs {
try {
return { ...defaultEditorPrefs, ...(JSON.parse(localStorage.getItem(key) ?? "{}") as Partial<EditorPrefs>) };
} catch {
return { ...defaultEditorPrefs };
}
}
let prefs: EditorPrefs | null = null;
/** The editor preferences, shared by every view and saved as they change. */
export function useEditorPrefs(): EditorPrefs {
if (!prefs) {
const p = reactive(read());
prefs = p;
// Detached from the component that asked first, so saving outlives it.
effectScope(true).run(() =>
watch(
p,
(v) => {
try {
localStorage.setItem(key, JSON.stringify(v));
} catch {
// per-device convenience only
}
},
{ deep: true },
),
);
}
return prefs;
}
+9 -1
View File
@@ -5,6 +5,7 @@ import { defineStore } from "pinia";
import { computed, ref } from "vue";
import { useApi } from "../api";
import { applyMove, childrenByParent } from "../lib/tree";
import { useEditorPrefs } from "./preferences";
const rank: Record<SpaceRole, number> = { viewer: 1, commenter: 2, editor: 3, admin: 4 };
@@ -100,8 +101,15 @@ export const useSpacesStore = defineStore("spaces", () => {
for (let p = parentOf.get(pageId); p; p = parentOf.get(p)) setExpanded(p, true);
}
/** Makes a page; the editor preferences can title it with today's date and make it full width. */
async function createPage(spaceId: string, parent = "", title?: string) {
const page = await api.spaces.createPage(spaceId, title ? { parent, title } : { parent });
const prefs = useEditorPrefs();
if (!title && prefs.dateTitles) {
const lang = document.documentElement.lang || undefined;
title = new Intl.DateTimeFormat(lang, { dateStyle: "long" }).format(new Date());
}
let page = await api.spaces.createPage(spaceId, title ? { parent, title } : { parent });
if (prefs.newPageFullWidth) page = await api.pages.update(page.id, { fullWidth: true });
if (parent) setExpanded(parent, true);
await loadTree(spaceId);
return page;
@@ -1,6 +1,6 @@
<!-- SPDX-License-Identifier: AGPL-3.0-or-later -->
<script setup lang="ts">
import type { Notification, NotificationSettings } from "@docwell/api-client";
import type { Notification, NotificationSettings, NotificationType } from "@docwell/api-client";
import { DwBreadcrumbs, DwButton, DwCallout, DwIcon, type IconName } from "@docwell/ui";
import { onMounted, ref } from "vue";
import { useI18n } from "vue-i18n";
@@ -60,6 +60,14 @@ const setEmail = (on: boolean) =>
run(async () => {
settings.value = await api.notifications.setSettings({ email: on ? "digest" : "off" });
});
// Which kinds of notification the digest includes; the rest stay in the inbox.
const emailKinds: NotificationType[] = ["mention", "comment", "reply", "resolved", "share", "reminder"];
const setEmailType = (type: NotificationType, on: boolean) =>
run(async () => {
const cur = settings.value?.emailTypes ?? emailKinds;
const emailTypes = on ? [...new Set([...cur, type])] : cur.filter((x) => x !== type);
settings.value = await api.notifications.setSettings({ email: settings.value!.email, emailTypes });
});
const when = (s: string) =>
new Date(s.replace(" ", "T")).toLocaleString(locale.value, { dateStyle: "medium", timeStyle: "short" });
@@ -146,6 +154,19 @@ const when = (s: string) =>
<span class="block text-ui-sm text-ink-muted">{{ $t("notifications.emailDigestHint") }}</span>
</span>
</label>
<fieldset v-if="settings.email === 'digest'" class="mt-3 ml-7" data-testid="email-types">
<legend class="text-ui-sm text-ink-muted">{{ $t("notifications.emailTypesHint") }}</legend>
<label v-for="k in emailKinds" :key="k" class="mt-1 flex items-center gap-2 text-ui-md">
<input
type="checkbox"
class="accent-primary"
:checked="(settings.emailTypes ?? emailKinds).includes(k)"
:disabled="busy"
@change="setEmailType(k, ($event.target as HTMLInputElement).checked)"
/>
{{ $t(`notifications.emailTypes.${k}`) }}
</label>
</fieldset>
<p class="mt-3 text-ui-sm text-ink-muted">{{ $t("notifications.watchHint") }}</p>
</section>
</article>
+65 -19
View File
@@ -12,6 +12,7 @@ import {
setCommentMarks,
userColor,
type CommentAnchor,
type SyncedPageHost,
} from "@docwell/editor";
import { DwBreadcrumbs, DwButton, DwCallout, DwIcon, DwMenu, type MenuItem } from "@docwell/ui";
import { computed, onBeforeUnmount, ref, shallowRef, watch } from "vue";
@@ -26,20 +27,30 @@ import PageProperties from "../../components/PageProperties.vue";
import ShareDialog from "../../components/ShareDialog.vue";
import { useEditorLabels, useMentions, usePageLinks } from "../../composables/useEditorHosts";
import { useFileHost } from "../../composables/useFiles";
import { useSplit } from "../../composables/useSplit";
import { saveBlob } from "../../lib/download";
import { usePlatform, useRuntimeConfig } from "../../platform";
import { useAuthStore } from "../../stores/auth";
import { useFavoritesStore } from "../../stores/favorites";
import { useOrganizeStore } from "../../stores/organize";
import { useEditorPrefs } from "../../stores/preferences";
import { spaceAtLeast, useSpacesStore } from "../../stores/spaces";
import { atLeast, useWorkspacesStore } from "../../stores/workspaces";
const props = defineProps<{ id: string }>();
// pane "split" is the page shown beside the main view: it has its own
// header and leaves the sidebar, the address and the hash to the main view.
const props = withDefaults(defineProps<{ id: string; pane?: "main" | "split" }>(), { pane: "main" });
const main = computed(() => props.pane === "main");
const headerTarget = computed(() => (main.value ? "#app-header" : "#split-header"));
// Header buttons show their words on wide main views; the side pane is narrow.
const buttonLabel = computed(() => (main.value ? "sr-only sm:not-sr-only" : "sr-only"));
const emit = defineEmits<{ error: [err: unknown] }>();
const api = useApi();
const spaces = useSpacesStore();
const favorites = useFavoritesStore();
const org = useOrganizeStore();
const prefs = useEditorPrefs();
const split = useSplit();
const workspaces = useWorkspacesStore();
const router = useRouter();
const route = useRoute();
@@ -77,7 +88,7 @@ function blockLinkCopied() {
let scrolledTo = "";
function scrollToHash() {
const editor = editorRef.value?.editor;
const id = linkedBlock(route.hash);
const id = main.value ? linkedBlock(route.hash) : "";
const key = `${props.id}${id}`;
if (!editor || !id || scrolledTo === key) return;
// The shared document fills the editor just after it is created, and node
@@ -148,7 +159,7 @@ async function loadComments() {
const list = await api.pages.comments(id).catch(() => null);
if (list && page.value?.id === id) comments.value = list;
// A notification links to ?comment=<id>: open the panel on its thread.
const wanted = typeof route.query.comment === "string" ? route.query.comment : "";
const wanted = main.value && typeof route.query.comment === "string" ? route.query.comment : "";
const hit = wanted && list?.find((c) => c.id === wanted);
if (hit) {
activeComment.value = hit.parent || hit.id;
@@ -280,6 +291,18 @@ function collabUrl() {
return `${location.protocol === "https:" ? "wss" : "ws"}://${location.host}/collab`;
}
// Synced pages: other pages drawn inside this one, followed read-only.
const syncedPages: SyncedPageHost = {
get self() {
return page.value?.id ?? props.id;
},
open: (id) => new CollabProvider({ url: collabUrl(), page: id, token, readOnly: true }),
meta: async (id) => {
const p = await api.pages.get(id).catch(() => null);
return p ? { title: p.title, icon: p.icon } : null;
},
};
function openDoc(id: string) {
closeDoc();
const p = new CollabProvider({ url: collabUrl(), page: id, token });
@@ -335,6 +358,14 @@ async function accessChanged() {
void spaces.loadTree(p.space);
}
// The main view marks its page in the sidebar and follows it to its workspace.
function setActive(p: Page) {
spaces.active = { space: p.space, page: p.id };
// A link from another workspace switches the sidebar to it.
if (workspaces.current && p.workspace !== workspaces.current.id) workspaces.select(p.workspace);
spaces.reveal(p.space, p.id);
}
async function load(id: string) {
notFound.value = false;
try {
@@ -342,10 +373,7 @@ async function load(id: string) {
page.value = p;
if (!provider.value) openDoc(id);
title.value = p.title;
spaces.active = { space: p.space, page: p.id };
// A link from another workspace switches the sidebar to it.
if (workspaces.current && p.workspace !== workspaces.current.id) workspaces.select(p.workspace);
spaces.reveal(p.space, p.id);
if (main.value) setActive(p);
// Best effort: the recent list is a convenience.
api.pages.visit(p.id).catch(() => {});
void loadComments();
@@ -429,6 +457,18 @@ const exportAs = (format: "markdown" | "html" | "pdf" | "docx") =>
const menu = computed<MenuItem[]>(() => [
{ label: t("page.find"), icon: "search", onSelect: () => editorRef.value?.openFind() },
...(platform.kind === "web"
? [
{
label: t("page.openNewTab"),
icon: "open" as const,
onSelect: () => window.open(platform.pageUrl(pagePath(props.id)), "_blank", "noopener"),
},
]
: []),
...(main.value
? [{ label: t("page.openBeside"), icon: "sidebar" as const, onSelect: () => split.open(props.id) }]
: []),
{
label: t(watching.value ? "notifications.unwatch" : "notifications.watch"),
icon: watching.value ? "bell-off" : "bell",
@@ -520,13 +560,13 @@ const purge = () =>
</script>
<template>
<Teleport v-if="page" defer to="#app-header">
<Teleport v-if="page" defer :to="headerTarget">
<DwBreadcrumbs :items="crumbs" :label="$t('page.breadcrumbs')" class="min-w-16 flex-1" />
<p
role="status"
class="hidden truncate text-ui-sm text-ink-muted sm:block"
class="hidden truncate text-ui-sm text-ink-muted"
:class="{ 'sm:block': main, 'text-danger': collabStatus === 'denied' }"
data-testid="collab-status"
:class="{ 'text-danger': collabStatus === 'denied' }"
>
<template v-if="collabStatus === 'denied'">{{ $t("page.collab.denied") }}</template>
<template v-else-if="collabStatus === 'offline'">{{ $t("page.collab.offline") }}</template>
@@ -550,7 +590,7 @@ const purge = () =>
>
<DwIcon name="star" :size="16" :filled="page.favorite" />
</button>
<template v-if="editable">
<template v-if="editable && main">
<input ref="filePicker" type="file" multiple class="hidden" data-testid="attach-input" @change="attachPicked" />
<DwButton
variant="ghost"
@@ -572,7 +612,7 @@ const purge = () =>
@click="historyOpen = !historyOpen"
>
<!-- Phones get icon-only header buttons; the label stays for screen readers. -->
<span class="sr-only sm:not-sr-only">{{ $t("page.history.title") }}</span>
<span :class="buttonLabel">{{ $t("page.history.title") }}</span>
</DwButton>
<DwButton
variant="ghost"
@@ -583,7 +623,7 @@ const purge = () =>
data-testid="info-toggle"
@click="infoOpen = !infoOpen"
>
<span class="sr-only sm:not-sr-only">{{ $t("properties.info") }}</span>
<span :class="buttonLabel">{{ $t("properties.info") }}</span>
</DwButton>
<DwButton
variant="ghost"
@@ -594,11 +634,11 @@ const purge = () =>
data-testid="comments-toggle"
@click="commentsOpen = !commentsOpen"
>
<span class="sr-only sm:not-sr-only">{{ $t("comments.title") }}</span>
<span :class="buttonLabel">{{ $t("comments.title") }}</span>
<span v-if="openThreads.length" class="tabular-nums">{{ openThreads.length }}</span>
</DwButton>
<DwButton variant="ghost" size="sm" icon="share" data-testid="share-open" @click="shareOpen = true">
<span class="sr-only sm:not-sr-only">{{ $t("share.button") }}</span>
<DwButton v-if="main" variant="ghost" size="sm" icon="share" data-testid="share-open" @click="shareOpen = true">
<span :class="buttonLabel">{{ $t("share.button") }}</span>
</DwButton>
<DwMenu :items="menu" :label="$t('page.more')" data-testid="page-menu" />
</Teleport>
@@ -607,7 +647,11 @@ const purge = () =>
<div class="flex min-h-full items-start">
<article
class="mx-auto min-w-0 flex-1 px-4 pt-6 pb-16 sm:px-16 sm:pt-10"
:class="[page?.fullWidth ? 'max-w-doc-wide' : 'max-w-doc', page?.font ? `dw-font-${page.font}` : '']"
:class="[
page?.fullWidth ? 'max-w-doc-wide' : 'max-w-doc',
page?.font ? `dw-font-${page.font}` : '',
prefs.textSize !== 'md' ? `dw-size-${prefs.textSize}` : '',
]"
data-testid="page-article"
>
<DwCallout v-if="notFound" tone="info" size="ui">{{ $t("page.notFound") }}</DwCallout>
@@ -668,7 +712,7 @@ const purge = () =>
{{ $t("page.readOnly") }}
</p>
<div v-if="!page.inTrash" class="mt-3">
<div v-if="!page.inTrash && prefs.showProperties" class="mt-3">
<button
type="button"
class="flex h-6 cursor-pointer items-center gap-1 rounded-xs px-1 text-ui-sm text-ink-muted hover:bg-surface-hover hover:text-ink"
@@ -711,6 +755,8 @@ const purge = () =>
:labels="labels"
:can-comment="canComment"
:journals="canOrganize"
:synced-pages="syncedPages"
:code-line-numbers="prefs.codeLineNumbers"
:user="me"
:editable="editable"
:placeholder="editable ? $t('page.placeholder') : ''"
@@ -755,7 +801,7 @@ const purge = () =>
<PageList v-if="children.length" :items="children" class="mt-2" />
<p v-else class="mt-2 text-ui-md text-ink-muted">{{ $t("page.noSubpages") }}</p>
</section>
<section v-if="backlinks.length" class="mt-8" data-testid="backlinks">
<section v-if="backlinks.length && prefs.showBacklinks" class="mt-8" data-testid="backlinks">
<h2 class="dw-label">{{ $t("page.backlinks", { n: backlinks.length }, backlinks.length) }}</h2>
<PageList :items="backlinks" class="mt-2">
<template #meta="{ item }">{{ item.spaceName }}</template>
@@ -5,6 +5,7 @@ import { DwButton, DwCallout } from "@docwell/ui";
import { onMounted, ref } from "vue";
import { useI18n } from "vue-i18n";
import { useApi } from "../../api";
import { useEditorPrefs } from "../../stores/preferences";
import { localeNames, storedLocale, storeLocale, supportedLocales, type Locale } from "../../i18n";
import FormField from "../../components/FormField.vue";
import PageShell from "../../components/PageShell.vue";
@@ -24,6 +25,8 @@ const busy = ref(false);
const copied = ref("");
const language = ref<Locale | "">(storedLocale());
const prefs = useEditorPrefs();
const prefSwitches = ["newPageFullWidth", "dateTitles", "showProperties", "showBacklinks", "codeLineNumbers"] as const;
function pickLanguage() {
locale.value = storeLocale(language.value);
}
@@ -136,6 +139,26 @@ const when = (s: string) =>
</section>
<!-- Two-step sign-in -->
<!-- How pages read and start out, kept per device like the language. -->
<section class="space-y-3 dw-card" data-testid="editor-section">
<div>
<h2 class="text-ui-lg">{{ $t("account.editor.title") }}</h2>
<p class="mt-1 text-ui-md text-ink-muted">{{ $t("account.editor.hint") }}</p>
</div>
<label class="flex flex-wrap items-center gap-3 text-ui-md">
<span class="min-w-0 flex-1">{{ $t("account.editor.textSize") }}</span>
<select v-model="prefs.textSize" class="dw-input" data-testid="text-size">
<option value="sm">{{ $t("account.editor.sizes.sm") }}</option>
<option value="md">{{ $t("account.editor.sizes.md") }}</option>
<option value="lg">{{ $t("account.editor.sizes.lg") }}</option>
</select>
</label>
<label v-for="k in prefSwitches" :key="k" class="flex items-center gap-3 text-ui-md">
<input v-model="prefs[k]" type="checkbox" class="accent-primary" :data-testid="`pref-${k}`" />
{{ $t(`account.editor.${k}`) }}
</label>
</section>
<section v-if="totp" class="space-y-4 dw-card" data-testid="totp-section">
<div>
<h2 class="text-ui-lg">{{ $t("account.totp.title") }}</h2>
+6
View File
@@ -3797,6 +3797,12 @@ components:
required: [email]
properties:
email: { type: string, enum: [digest, "off"], description: Unread notifications by email every few minutes, or no emails }
emailTypes:
type: array
items: { $ref: "#/components/schemas/NotificationType" }
description: >-
The notification types the email digest includes (the others only reach the inbox).
Always sent back; leave it out when saving to keep it as it is.
AdminStats:
type: object
required: [scope, users, organizations, workspaces, spaces, pages, attachments, storageBytes, rooms, editors, indexed]