@@ -102,19 +102,19 @@ img.ProseMirror-separator {
display: block;
}`,Vp=class extends of{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document< `u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:_d,createMappablePosition:vd},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc();if(!this.editorState){let e=Cl(t,this.options.autofocus);this.editorState=zn.create({doc:t,schema:this.schema,selection:e||void 0})}Rp(this.schema),this.options.element& & this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state; let e=this.editorView.dom;e?.editor& & delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css& & !document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode& & this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():Xc.createFakeChain()}can(){return this.commandManager?this.commandManager.can():Xc.createFallbackCan()}injectCSS(){this.options.injectCSS& & typeof document< `u`& & (this.css=Of(Bp,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView& & this.state& & !this.isDestroyed& & (this.options.editorProps& & this.view.setProps({...this.options.editorProps,attributes:this.getEditorViewAttributes()}),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t& & this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable& & this.view& & this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return sf& & !this.hasWarnedStaleDecorationRead& & af(this)& & (this.hasWarnedStaleDecorationRead=!0,console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")),this.editorView& & (this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=Mu(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.recoLine truncated
`,textSerializers:n={}}=e||{};return qu(this.state.doc,{blockSeparator:t,textSerializers:{...Ju(this.schema),...n}})}get isEmpty(){return fd(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null; return new zp(t,this,!1,n)}get $doc(){return this.$pos(0)}};function Hp(e){return new lp({find:e.find,handler:({state:t,range:n,match:r})=>{let i=Nu(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(ed(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type& & n!==t.mark.type)).filter(e=>e.to>c).length)return null;l< n.to & & a . delete ( l , n . to ) , c > n.from&&a.delete(n.from+r,c); let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function Up(e){return new lp({find:e.find,handler:({state:t,range:n,match:r})=>{let i=Nu(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function Wp(e){return new lp({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=Nu(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function Gp(e){return new lp({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=Nu(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&Ft(s,e.type,a); if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks(); if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l& & l.type===e.type& & qt(o.doc,n.from-1)& & (!e.joinPredicate||e.joinPredicate(r,l))& & o.join(n.from-1)},undoable:e.undoable})}var Kp=e=>`touches`in e,qp=class{constructor(e){var t;this.directions=[`bottom-left`,`bottom-right`,`top-left`,`top-right`],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:``,wrapper:``,handle:``,resizing:``},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState=`false`,this.classNames.resizing& & this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp)},this.handleKeyDown=e=>{e.key===`Shift`& & (this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{e.key===`Shift`& & (this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.element.draggable=!1,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,e.options?.min& & (this.minSize={...this.minSize,...e.options.min}),e.options?.max& & (this.maxSize=e.options.max),e!=null& & (t=e.options)!=null& & t.directions& & (this.directions=e.options.directions),e.options?.preserveAspectRatio& & (this.preserveAspectRatio=e.options.preserveAspectRatio),e.options?.className& & (this.classNames={container:e.options.className.container||``,wrapper:e.options.className.wrapper||``,handle:e.options.className.handle||``,resizing:e.options.className.resLine truncated
`)}},Ag=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[Lh]?Rh(e,t):cm(e)?am(e,e=>om(t,t=>Ag(e,t))):zh(e)?Gh(e,(e,n)=>Ag(e,t[n])):!1,jg=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes& & ([n,t]=[t,n]),Ag(t,n)}equals(e){return this.constructor===e.constructor& & Qh(this.shape,e.shape)}[Og](){return!0}[Lh](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){ah()}get nullable(){return u_(this,T_)}get optional(){return new Hg(this)}cast(e){return k_(e,this),e}expect(e){return k_(e,this),e}},Mg=class extends jg{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){let n=e?.constructor===this.shape&&(this._c==null||this._c(e)); return!n& & t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor===this.shape?`Check failed`:`Constructor match failed`),n}},Ng=(e,t=null)=>new Mg(e,t);Ng(Mg);var Pg=class extends jg{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape(e);return!n& & t?.extend(null,`custom prop`,e?.constructor.name,`failed to check custom prop`),n}},Fg=e=>new Pg(e);Ng(Pg);var Ig=class extends jg{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape.some(t=>t===e);return!n& & t?.extend(null,this.shape.join(` | `),e.toString()),n}},Lg=(...e)=>new Ig(e),Rg=Ng(Ig),zg=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,e=>`\\`+e)),Bg=e=>{if(b_.check(e))return[zg(e)]; if(Rg.check(e))return e.shape.map(e=>e+``);if(y_.check(e))return[`[+-]?\\d+.?\\d*`];if(x_.check(e))return[`.*`];if(d_.check(e))return e.shape.map(Bg).flat(1);oh()};Ng(class extends jg{constructor(e){super(),this.shape=e,this._r=RegExp(`^`+e.map(Bg).map(e=>`(${e.join(`|`)})`).join(``)+`$`)}check(e,t){let n=this._r.exec(e)!=null;return!n& & t?.extend(null,this._r.toString(),e.toString(),`String doesn't match string template.`),n}});var Vg=Symbol(`optional`),Hg=class extends jg{constructor(e){super(),this.shape=e}check(e,t){let n=e===void 0||this.shape.check(e);return!n& & t?.extend(null,`undefined (optional)`,`()`),n}get[Vg](){return!0}},Ug=Ng(Hg),Wg=class extends jg{check(e,t){return t?.extend(null,`never`,typeof e),!1}};new Wg,Ng(Wg);var Gg=class e extends jg{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new e(this.shape,!0)}check(e,t){return e==null?(t?.extend(null,`object`,`null`),!1):Gh(this.shape,(n,r)=>{let i=this._isPartial&&!Kh(e,r)||n.check(e[r],t); return!i& & t?.extend(r.toString(),n.toString(),typeof e[r],`Object property does not match`),i})}},Kg=e=>new Gg(e),qg=Ng(Gg),Jg=Fg(e=>e!=null& & (e.constructor===Object||e.constructor==null)),Yg=class extends jg{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null& & Gh(e,(n,r)=>{let i=this.shape.keys.check(r,t);return!i& & t?.extend(r+``,`Record`,typeof e,i?`Key doesn't match schema`:`Value doesn't match value`),i& & this.shape.values.check(n,t)})}},Xg=(e,t)=>new Yg(e,t),Zg=Ng(Yg),Qg=class extends jg{constructor(e){super(),this.shape=e}check(e,t){return e!=null& & Gh(this.shape,(n,r)=>{let i=n.check(e[r],t);return!i& & t?.extend(r.toString(),`Tuple`,typeof n),i})}},$g=(...e)=>new Qg(e);Ng(Qg);var e_=class extends jg{constructor(e){super(),this.shape=e.length===1?e[0]:new l_(e)}check(e,t){let n=cm(e)&&am(e,e=>this.shape.check(e)); return!n& & t?.extend(null,`Array`,``),n}},t_=(...e)=>new e_(e),n_=Ng(e_),r_=Fg(e=>cm(e)),i_=class extends jg{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let n=e instanceof this.shape&&(this._c==null||this._c(e)); return!n& & t?.extend(null,this.shape.name,e?.constructor.name),n}},a_=(e,t=null)=>new i_(e,t);Ng(i_);var o_=a_(jg),s_=Ng(class extends jg{constructor(e){super(),this.len=e.length-1,this.args=$g(...e.slice(-1)),this.res=e[this.len]}check(e,t){let n=e.constructor===Function&&e.length<=this.len; return!n& & t?.extend(null,`function`,typeof e),n}}),c_=Fg(e=>typeof e==`function`);Ng(class extends jg{constructor(e){super(),this.shape=e}check(e,t){let n=am(this.shape,n=>n.check(e,t));return!n& & t?.extend(null,`Intersectinon`,typeof e),n}},e=>e.shape.length>0);var l_=class extends jg{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){let n=om(this.shape,n=>n.check(e,t));return t?.extend(null,`Union`,typeof e),n}},u_=(...e)=>e.findIndex(e=>d_.check(e))>=0?u_(...e.map(e=>O_(e)).map(e=>d_.check(e)?e.shape:[e]).flat(1)):e.length===1?e[0]:new l_(e),d_=Ng(l_),f_=()=>!0,p_=Fg(f_),m_=Ng(Pg,e=>e.shape===f_),h_=Fg(e=>typeof e==`bigint`),g_=Fg(e=>e===h_),__=Fg(e=>typeof e==`symbol`);Fg(e=>e===__);var v_=Fg(e=>typeof e==`number`),y_=Fg(e=>e===v_),b_=Fg(e=>typeof e==`string`),x_=Fg(e=>e===b_),S_=Fg(e=>typeof e==`boolean`),C_=Fg(e=>e===S_),w_=Lg(void 0);Ng(Ig,e=>e.shape.length===1& & e.shape[0]===void 0),Lg(void 0);var T_=Lg(null),E_=Ng(Ig,e=>e.shape.length===1&&e.shape[0]===null); Ng(Uint8Array),Ng(Mg,e=>e.shape===Uint8Array);var D_=u_(v_,b_,T_,w_,h_,S_,__);(()=>{let e=t_(p_),t=Xg(b_,p_),n=u_(v_,b_,T_,S_,e,t);return e.shape=n,t.shape.values=n,n})();var O_=e=>{if(o_.check(e))return e;ifLine truncated
`;n.right=new Y x(N(o,x y(a.store,o)),n.left,n.left& & n.left.lastId,n.right,n.right& & n.right.id,t,null,new M x(i)),n.right.integrate(e,0),n.forward()}U b(e,t,n,s)},Y b=(e,t,n,r,i)=>{let a=t,o=X p();for(;a&&(!a.countable||a.deleted); ){if(!a.deleted& & a.content.constructor===T x){let e=a.content;o.set(e.key,e)}a=a.right}let s=0,c=!1;for(;t!==a;){if(n===t& & (c=!0),!t.deleted){let n=t.content;switch(n.constructor){case T x:{let{key:a,value:l}=n,u=r.get(a)??null;(o.get(a)!==n||u===l)&&(t.delete(e),s++,!c&&(i.get(a)??null)===l&&u!==l&&(u===null?i.delete(a):i.set(a,u))),!c&&!t.deleted&&W b(i,n); break}}}t=t.right}return s},X b=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable); )t=t.right;let n=new Set;for(;t&&(t.deleted||!t.countable); ){if(!t.deleted& & t.content.constructor===T x){let r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},Zb =e=>{let t=0;return L y(e.doc,n=>{let r=e._start,i=e._start,a=X p(),o=Zp (a);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case T x:W b(o,i.content);break;default:t+=Y b(n,r,i,a,o),a=Zp (o),r=i}i=i.right}}),t},Qb =e=>{let t=new Set,n=e.doc;for(let[r,i]of e.afterState.entries()){let a=e.beforeState.get(r)||0;i!==a& & k y(e,n.store.clients.get(r),a,i,e=>{!e.deleted& & e.content.constructor===T x& & e.constructor!==h x& & t.add(e.parent)})}L y(n,n=>{c v(e,e.deleteSet,e=>{if(e instanceof h x||!e.parent._hasFormatting||t.has(e.parent))return;let r=e.parent;e.content.constructor===T x?t.add(r):X b(n,e)});for(let e of t)Zb (e)})},$b =(e,t,n)=>{let r=n,i=Zp (t.currentAttributes),a=t.right;for(;n>0&&t.right!==null; ){if(t.right.deleted===!1)switch(t.right.content.constructor){case H x:case C x:case M x:n< t.right.length & & Ey ( e , N ( t . right . id . client , t . right . id . clock + n ) ) , n- = t.right.length,t.right.delete(e)}t.forward()}a&&Y b(e,a,t.right,i,t.currentAttributes);let o = (t.left||t.right).parent;return o . _searchMarker & & db ( o . _searchMarker , t . index , -r + n ) , t } , ex = class extends tb { constructor ( e , t , n ) { super ( e , t ) , this . childListChanged = !1,this.keysChanged=new Set , n . forEach ( e = > {e===null?this.childListChanged=!0:this.keysChanged.add(e)})}get changes ( ) { if ( this . _changes = ==null){let e = {keys:this.keys,delta:this.delta,added:new Set , deleted:new Set } ; this . _changes = e}return this . _changes } get delta ( ) { if ( this . _delta = ==null){let e = this.target.doc,t=[];L y(e,e= > {let n=new Map,r=new Map,i=this.target._start,a=null,o={},s=``,c=0,l=0,u=()=>{if(a!==null){let e=null;switch(a){case`delete`:l>0&&(e={delete:l}),l=0; break;case`insert`:(typeof s==`object`||s.length>0)&&(e={insert:s},n.size>0&&(e.attributes={},n.forEach((t,n)=>{t!==null&&(e.attributes[n]=t)}))),s=``; break;case`retain`:c>0&&(e={retain:c},W h(o)||(e.attributes=B h({},o))),c=0}e&&t.push(e),a=null}}; for(;i!==null;){switch(i.content.constructor){case H x:case C x:this.adds(i)?this.deletes(i)||(u(),a=`insert`,s=i.content.getContent()[0],u()):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=1):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=1); break;case M x:this.adds(i)?this.deletes(i)||(a!==`insert`&&(u(),a=`insert`),s+=i.content.str):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=i.length):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=i.length); break;case T x:{let{key:t,value:s}=i.content;if(this.adds(i))this.deletes(i)||(z b(n.get(t)??null,s)?s!==null& & i.delete(e):(a===`retain`& & u(),z b(s,r.get(t)??null)?delete o[t]:o[t]=s));else if(this.deletes(i)){r.set(t,s);let e=n.get(t)??null;z b(e,s)||(a===`retain`& & u(),o[t]=e)}else if(!i.deleted){r.set(t,s);let n=o[t];n!==void 0& & (z b(n,s)?n!==null& & i.delete(e):(a===`retain`& & u(),s===null?delete o[t]:o[t]=s))}i.deleted||(a===`insert`&&u(),W b(n,i.content)); break}}i=i.right}for(u();t.length>0;){let e=t[t.length-1];if(e.retain!==void 0& & e.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},t x=class e extends p b{constructor(e){super(),this._pending=e===void 0?[]:[()=>this.insert(0,e)],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??r b(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(e=>e())}catch(e){console.error(e)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(e,t){super._callObserver(e,t);let n=new e x(this,e,t);f b(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??r b(); let e=``,t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===M x&&(e+=t.content.str),t=t.right; return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc===null?this._pending.push(()=>this.applyDelta(e)):L y(this.doc,n=>{let r=new B b(null,this._start,0,new Map);for(let i=0;i< e.length ; i + + ) { let a = e[i];if(a.insert!==void 0 ) { let o = !t&&typeof a . insert = =`string`&&i===e.length-1&&r.right===null&&a.insert.slice(-1)===`
`?a.insert.slice(0,-1):a.insert;(typeof o!=`string`||o.length>0)& & qb(n,this,r,o,a.attributes||{})}else a.retain===void 0?a.delete!==void 0&&$b(n,r,a.delete):Jb(n,this,r,a.retain,a.attributes||{})}})}toDelta(e,t,n){this.doc??rb(); let r=[],i=new Map,a=this.doc,o=``,s=this._start;function c(){if(o.length>0){let e={},t=!1;i.forEach((n,r)=>{t=!0,e[r]=n});let n={insert:o};t& & (n.attributes=e),r.push(n),o=``}}let l=()=>{for(;s!==null;){if(_y(s,e)||t!==void 0& & _y(s,t))switch(s.content.constructor){case Mx:{let r=i.get(`ychange`);e!==void 0& & !_y(s,e)?(r===void 0||r.user!==s.id.client||r.type!==`removed`)& & (c(),i.set(`ychange`,n?n(`removed`,s.id):{type:`removed`})):t!==void 0& & !_y(s,t)?(r===void 0||r.user!==s.id.client||r.type!==`added`)& & (c(),i.set(`ychange`,n?n(`added`,s.id):{type:`added`})):r!==void 0&&(c(),i.delete(`ychange`)),o+=s.content.str; break}case Hx:case Cx:{c();let e={insert:s.content.getContent()[0]};if(i.size>0){let t={};e.attributes=t,i.forEach((e,n)=>{t[n]=e})}r.push(e);break}case Tx:_y(s,e)&&(c(),Wb(i,s.content))}s=s.right}c()}; return e||t?Ly(a,n=>{e&&vy(n,e),t&&vy(n,t),l()},`cleanup`):l(),r}insert(e,t,n){if(t.length<=0)return; let r=this.doc;r===null?this._pending.push(()=>this.insert(e,t,n)):Ly(r,r=>{let i=Hb(r,this,e,!n);n||(n={},i.currentAttributes.forEach((e,t)=>{n[t]=e})),qb(r,this,i,t,n)})}insertEmbed(e,t,n){let r=this.doc;r===null?this._pending.push(()=>this.insertEmbed(e,t,n||{})):Ly(r,r=>{let i=Hb(r,this,e,!n);qb(r,this,i,t,n||{})})}delete(e,t){if(t===0)return;let n=this.doc;n===null?this._pending.push(()=>this.delete(e,t)):Ly(n,n=>{$b(n,Hb(n,this,e,!0),t)})}format(e,t,n){if(t===0)return;let r=this.doc;r===null?this._pending.push(()=>this.format(e,t,n)):Ly(r,r=>{let i=Hb(r,this,e,!1);i.right!==null& & Jb(r,this,i,t,n)})}removeAttribute(e){this.doc===null?this._pending.push(()=>this.removeAttribute(e)):Ly(this.doc,t=>{Eb(t,this,e)})}setAttribute(e,t){this.doc===null?this._pending.push(()=>this.setAttribute(e,t)):Ly(this.doc,n=>{Db(n,this,e,t)})}getAttribute(e){return Ob(this,e)}getAttributes(){return kb(this)}_write(e){e.writeTypeRef(Lx)}},nx=e=>new tx,rx=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??rb()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type; if(e!==null& & (!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===ox||t.constructor===ix)&&t._start!==null)e=t._start; else for(;e!==null;){let t=e.next;if(t!==null){e=t;break}e=e.parent===this._root?null:e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type))); return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},ix=class e extends pb{constructor(){super(),this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof pb?e.clone():e)),t}get length(){return this.doc??rb(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new rx(this,e)}querySelector(e){e=e.toUpperCase();let t=new rx(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e).next(); return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),im(new rx(this,t=>t.nodeName& & t.nodeName.toUpperCase()===e))}_callObserver(e,t){fb(this,e,new cx(this,t,e))}toString(){return vb(this,e=>e.toString()).join(``)}toJSON(){return this.toString()}toDOM(e=document,t={},n){let r=e.createDocumentFragment();return n!==void 0& & n._createAssociation(r,this),_b(this,i=>{r.insertBefore(i.toDOM(e,t,n),null)}),r}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):Ly(this.doc,n=>{Cb(n,this,e,t)})}insertAfter(e,t){if(this.doc!==null)Ly(this.doc,n=>{let r=e& & e instanceof pb?e._item:e;xb(n,this,r,t)});else{let n=this._prelimContent,r=e===null?0:n.findIndex(t=>t===e)+1;if(r===0& & e!==null)throw ih(`Reference item not found`);n.splice(r,0,...t)}}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):Ly(this.doc,n=>{Tb(n,this,e,t)})}toArray(){return hb(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return bb(this,e)}slice(e=0,t=this.length){return mb(this,e,t)}forEach(e){_b(this,e)}_write(e){e.writeTypeRef(zx)}},ax=e=>new ix,ox=class e extends ix{constructor(e=`UNDEFINED`){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((e,t)=>{this.setAttribute(t,e)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName);return Hh(this.getAttributes(),(e,n)=>{t.setAttribute(n,e)}),t.insert(0,this.toArray().map(e=>eLine truncated
`,textSerializers:n={}}=e||{};return qu(this.state.doc,{blockSeparator:t,textSerializers:{...Ju(this.schema),...n}})}get isEmpty(){return fd(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null; return new zp(t,this,!1,n)}get $doc(){return this.$pos(0)}};function Hp(e){return new lp({find:e.find,handler:({state:t,range:n,match:r})=>{let i=Nu(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(ed(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type& & n!==t.mark.type)).filter(e=>e.to>c).length)return null;l< n.to & & a . delete ( l , n . to ) , c > n.from&&a.delete(n.from+r,c); let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function Up(e){return new lp({find:e.find,handler:({state:t,range:n,match:r})=>{let i=Nu(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function Wp(e){return new lp({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=Nu(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function Gp(e){return new lp({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=Nu(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&Ft(s,e.type,a); if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks(); if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l& & l.type===e.type& & qt(o.doc,n.from-1)& & (!e.joinPredicate||e.joinPredicate(r,l))& & o.join(n.from-1)},undoable:e.undoable})}var Kp=e=>`touches`in e,qp=class{constructor(e){var t;this.directions=[`bottom-left`,`bottom-right`,`top-left`,`top-right`],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:``,wrapper:``,handle:``,resizing:``},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState=`false`,this.classNames.resizing& & this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp)},this.handleKeyDown=e=>{e.key===`Shift`& & (this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{e.key===`Shift`& & (this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.element.draggable=!1,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,e.options?.min& & (this.minSize={...this.minSize,...e.options.min}),e.options?.max& & (this.maxSize=e.options.max),e!=null& & (t=e.options)!=null& & t.directions& & (this.directions=e.options.directions),e.options?.preserveAspectRatio& & (this.preserveAspectRatio=e.options.preserveAspectRatio),e.options?.className& & (this.classNames={container:e.options.className.container||``,wrapper:e.options.className.wrapper||``,handle:e.options.className.handle||``,resizing:e.options.className.resLine truncated
`)}},Ng=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[Bh]?Vh(e,t):dm(e)?cm(e,e=>lm(t,t=>Ng(e,t))):Hh(e)?Jh(e,(e,n)=>Ng(e,t[n])):!1,Pg=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes& & ([n,t]=[t,n]),Ng(t,n)}equals(e){return this.constructor===e.constructor& & tg(this.shape,e.shape)}[jg](){return!0}[Bh](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){ch()}get nullable(){return p_(this,O_)}get optional(){return new Gg(this)}cast(e){return M_(e,this),e}expect(e){return M_(e,this),e}},Fg=class extends Pg{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){let n=e?.constructor===this.shape&&(this._c==null||this._c(e)); return!n& & t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor===this.shape?`Check failed`:`Constructor match failed`),n}},Ig=(e,t=null)=>new Fg(e,t);Ig(Fg);var Lg=class extends Pg{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape(e);return!n& & t?.extend(null,`custom prop`,e?.constructor.name,`failed to check custom prop`),n}},Rg=e=>new Lg(e);Ig(Lg);var zg=class extends Pg{constructor(e){super(),this.shape=e}check(e,t){let n=this.shape.some(t=>t===e);return!n& & t?.extend(null,this.shape.join(` | `),e.toString()),n}},Bg=(...e)=>new zg(e),Vg=Ig(zg),Hg=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,e=>`\\`+e)),Ug=e=>{if(C_.check(e))return[Hg(e)]; if(Vg.check(e))return e.shape.map(e=>e+``);if(S_.check(e))return[`[+-]?\\d+.?\\d*`];if(w_.check(e))return[`.*`];if(m_.check(e))return e.shape.map(Ug).flat(1);lh()};Ig(class extends Pg{constructor(e){super(),this.shape=e,this._r=RegExp(`^`+e.map(Ug).map(e=>`(${e.join(`|`)})`).join(``)+`$`)}check(e,t){let n=this._r.exec(e)!=null;return!n& & t?.extend(null,this._r.toString(),e.toString(),`String doesn't match string template.`),n}});var Wg=Symbol(`optional`),Gg=class extends Pg{constructor(e){super(),this.shape=e}check(e,t){let n=e===void 0||this.shape.check(e);return!n& & t?.extend(null,`undefined (optional)`,`()`),n}get[Wg](){return!0}},Kg=Ig(Gg),qg=class extends Pg{check(e,t){return t?.extend(null,`never`,typeof e),!1}};new qg,Ig(qg);var Jg=class e extends Pg{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new e(this.shape,!0)}check(e,t){return e==null?(t?.extend(null,`object`,`null`),!1):Jh(this.shape,(n,r)=>{let i=this._isPartial&&!Yh(e,r)||n.check(e[r],t); return!i& & t?.extend(r.toString(),n.toString(),typeof e[r],`Object property does not match`),i})}},Yg=e=>new Jg(e),Xg=Ig(Jg),Zg=Rg(e=>e!=null& & (e.constructor===Object||e.constructor==null)),Qg=class extends Pg{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null& & Jh(e,(n,r)=>{let i=this.shape.keys.check(r,t);return!i& & t?.extend(r+``,`Record`,typeof e,i?`Key doesn't match schema`:`Value doesn't match value`),i& & this.shape.values.check(n,t)})}},$g=(e,t)=>new Qg(e,t),e_=Ig(Qg),t_=class extends Pg{constructor(e){super(),this.shape=e}check(e,t){return e!=null& & Jh(this.shape,(n,r)=>{let i=n.check(e[r],t);return!i& & t?.extend(r.toString(),`Tuple`,typeof n),i})}},n_=(...e)=>new t_(e);Ig(t_);var r_=class extends Pg{constructor(e){super(),this.shape=e.length===1?e[0]:new f_(e)}check(e,t){let n=dm(e)&&cm(e,e=>this.shape.check(e)); return!n& & t?.extend(null,`Array`,``),n}},i_=(...e)=>new r_(e),a_=Ig(r_),o_=Rg(e=>dm(e)),s_=class extends Pg{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let n=e instanceof this.shape&&(this._c==null||this._c(e)); return!n& & t?.extend(null,this.shape.name,e?.constructor.name),n}},c_=(e,t=null)=>new s_(e,t);Ig(s_);var l_=c_(Pg),u_=Ig(class extends Pg{constructor(e){super(),this.len=e.length-1,this.args=n_(...e.slice(-1)),this.res=e[this.len]}check(e,t){let n=e.constructor===Function&&e.length<=this.len; return!n& & t?.extend(null,`function`,typeof e),n}}),d_=Rg(e=>typeof e==`function`);Ig(class extends Pg{constructor(e){super(),this.shape=e}check(e,t){let n=cm(this.shape,n=>n.check(e,t));return!n& & t?.extend(null,`Intersectinon`,typeof e),n}},e=>e.shape.length>0);var f_=class extends Pg{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){let n=lm(this.shape,n=>n.check(e,t));return t?.extend(null,`Union`,typeof e),n}},p_=(...e)=>e.findIndex(e=>m_.check(e))>=0?p_(...e.map(e=>j_(e)).map(e=>m_.check(e)?e.shape:[e]).flat(1)):e.length===1?e[0]:new f_(e),m_=Ig(f_),h_=()=>!0,g_=Rg(h_),__=Ig(Lg,e=>e.shape===h_),v_=Rg(e=>typeof e==`bigint`),y_=Rg(e=>e===v_),b_=Rg(e=>typeof e==`symbol`);Rg(e=>e===b_);var x_=Rg(e=>typeof e==`number`),S_=Rg(e=>e===x_),C_=Rg(e=>typeof e==`string`),w_=Rg(e=>e===C_),T_=Rg(e=>typeof e==`boolean`),E_=Rg(e=>e===T_),D_=Bg(void 0);Ig(zg,e=>e.shape.length===1& & e.shape[0]===void 0),Bg(void 0);var O_=Bg(null),k_=Ig(zg,e=>e.shape.length===1&&e.shape[0]===null); Ig(Uint8Array),Ig(Fg,e=>e.shape===Uint8Array);var A_=p_(x_,C_,O_,D_,v_,T_,b_);(()=>{let e=i_(g_),t=$g(C_,g_),n=p_(x_,C_,O_,T_,e,t);return e.shape=n,t.shape.values=n,n})();var j_=e=>{if(l_.check(e))return e;ifLine truncated
`;n.right=new Q x(N(o,w y(a.store,o)),n.left,n.left& & n.left.lastId,n.right,n.right& & n.right.id,t,null,new F x(i)),n.right.integrate(e,0),n.forward()}K b(e,t,n,s)},Q b=(e,t,n,r,i)=>{let a=t,o=$ p();for(;a&&(!a.countable||a.deleted); ){if(!a.deleted& & a.content.constructor===O x){let e=a.content;o.set(e.key,e)}a=a.right}let s=0,c=!1;for(;t!==a;){if(n===t& & (c=!0),!t.deleted){let n=t.content;switch(n.constructor){case O x:{let{key:a,value:l}=n,u=r.get(a)??null;(o.get(a)!==n||u===l)&&(t.delete(e),s++,!c&&(i.get(a)??null)===l&&u!==l&&(u===null?i.delete(a):i.set(a,u))),!c&&!t.deleted&&q b(i,n); break}}}t=t.right}return s},$ b=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable); )t=t.right;let n=new Set;for(;t&&(t.deleted||!t.countable); ){if(!t.deleted& & t.content.constructor===O x){let r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},ex =e=>{let t=0;return B y(e.doc,n=>{let r=e._start,i=e._start,a=$ p(),o=em (a);for(;i;){if(i.deleted===!1)switch(i.content.constructor){case O x:q b(o,i.content);break;default:t+=Q b(n,r,i,a,o),a=em (o),r=i}i=i.right}}),t},tx =e=>{let t=new Set,n=e.doc;for(let[r,i]of e.afterState.entries()){let a=e.beforeState.get(r)||0;i!==a& & M y(e,n.store.clients.get(r),a,i,e=>{!e.deleted& & e.content.constructor===O x& & e.constructor!==v x& & t.add(e.parent)})}B y(n,n=>{d v(e,e.deleteSet,e=>{if(e instanceof v x||!e.parent._hasFormatting||t.has(e.parent))return;let r=e.parent;e.content.constructor===O x?t.add(r):$ b(n,e)});for(let e of t)ex (e)})},nx =(e,t,n)=>{let r=n,i=em (t.currentAttributes),a=t.right;for(;n>0&&t.right!==null; ){if(t.right.deleted===!1)switch(t.right.content.constructor){case G x:case E x:case F x:n< t.right.length & & ky ( e , N ( t . right . id . client , t . right . id . clock + n ) ) , n- = t.right.length,t.right.delete(e)}t.forward()}a&&Q b(e,a,t.right,i,t.currentAttributes);let o = (t.left||t.right).parent;return o . _searchMarker & & mb ( o . _searchMarker , t . index , -r + n ) , t } , rx = class extends ib { constructor ( e , t , n ) { super ( e , t ) , this . childListChanged = !1,this.keysChanged=new Set , n . forEach ( e = > {e===null?this.childListChanged=!0:this.keysChanged.add(e)})}get changes ( ) { if ( this . _changes = ==null){let e = {keys:this.keys,delta:this.delta,added:new Set , deleted:new Set } ; this . _changes = e}return this . _changes } get delta ( ) { if ( this . _delta = ==null){let e = this.target.doc,t=[];B y(e,e= > {let n=new Map,r=new Map,i=this.target._start,a=null,o={},s=``,c=0,l=0,u=()=>{if(a!==null){let e=null;switch(a){case`delete`:l>0&&(e={delete:l}),l=0; break;case`insert`:(typeof s==`object`||s.length>0)&&(e={insert:s},n.size>0&&(e.attributes={},n.forEach((t,n)=>{t!==null&&(e.attributes[n]=t)}))),s=``; break;case`retain`:c>0&&(e={retain:c},q h(o)||(e.attributes=U h({},o))),c=0}e&&t.push(e),a=null}}; for(;i!==null;){switch(i.content.constructor){case G x:case E x:this.adds(i)?this.deletes(i)||(u(),a=`insert`,s=i.content.getContent()[0],u()):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=1):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=1); break;case F x:this.adds(i)?this.deletes(i)||(a!==`insert`&&(u(),a=`insert`),s+=i.content.str):this.deletes(i)?(a!==`delete`&&(u(),a=`delete`),l+=i.length):i.deleted||(a!==`retain`&&(u(),a=`retain`),c+=i.length); break;case O x:{let{key:t,value:s}=i.content;if(this.adds(i))this.deletes(i)||(H b(n.get(t)??null,s)?s!==null& & i.delete(e):(a===`retain`& & u(),H b(s,r.get(t)??null)?delete o[t]:o[t]=s));else if(this.deletes(i)){r.set(t,s);let e=n.get(t)??null;H b(e,s)||(a===`retain`& & u(),o[t]=e)}else if(!i.deleted){r.set(t,s);let n=o[t];n!==void 0& & (H b(n,s)?n!==null& & i.delete(e):(a===`retain`& & u(),s===null?delete o[t]:o[t]=s))}i.deleted||(a===`insert`&&u(),q b(n,i.content)); break}}i=i.right}for(u();t.length>0;){let e=t[t.length-1];if(e.retain!==void 0& & e.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},i x=class e extends g b{constructor(e){super(),this._pending=e===void 0?[]:[()=>this.insert(0,e)],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??o b(),this._length}_integrate(e,t){super._integrate(e,t);try{this._pending.forEach(e=>e())}catch(e){console.error(e)}this._pending=null}_copy(){return new e}clone(){let t=new e;return t.applyDelta(this.toDelta()),t}_callObserver(e,t){super._callObserver(e,t);let n=new r x(this,e,t);h b(this,e,n),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??o b(); let e=``,t=this._start;for(;t!==null;)!t.deleted&&t.countable&&t.content.constructor===F x&&(e+=t.content.str),t=t.right; return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:t=!0}={}){this.doc===null?this._pending.push(()=>this.applyDelta(e)):B y(this.doc,n=>{let r=new U b(null,this._start,0,new Map);for(let i=0;i< e.length ; i + + ) { let a = e[i];if(a.insert!==void 0 ) { let o = !t&&typeof a . insert = =`string`&&i===e.length-1&&r.right===null&&a.insert.slice(-1)===`
`?a.insert.slice(0,-1):a.insert;(typeof o!=`string`||o.length>0)& & Xb(n,this,r,o,a.attributes||{})}else a.retain===void 0?a.delete!==void 0&&nx(n,r,a.delete):Zb(n,this,r,a.retain,a.attributes||{})}})}toDelta(e,t,n){this.doc??ob(); let r=[],i=new Map,a=this.doc,o=``,s=this._start;function c(){if(o.length>0){let e={},t=!1;i.forEach((n,r)=>{t=!0,e[r]=n});let n={insert:o};t& & (n.attributes=e),r.push(n),o=``}}let l=()=>{for(;s!==null;){if(by(s,e)||t!==void 0& & by(s,t))switch(s.content.constructor){case Fx:{let r=i.get(`ychange`);e!==void 0& & !by(s,e)?(r===void 0||r.user!==s.id.client||r.type!==`removed`)& & (c(),i.set(`ychange`,n?n(`removed`,s.id):{type:`removed`})):t!==void 0& & !by(s,t)?(r===void 0||r.user!==s.id.client||r.type!==`added`)& & (c(),i.set(`ychange`,n?n(`added`,s.id):{type:`added`})):r!==void 0&&(c(),i.delete(`ychange`)),o+=s.content.str; break}case Gx:case Ex:{c();let e={insert:s.content.getContent()[0]};if(i.size>0){let t={};e.attributes=t,i.forEach((e,n)=>{t[n]=e})}r.push(e);break}case Ox:by(s,e)&&(c(),qb(i,s.content))}s=s.right}c()}; return e||t?By(a,n=>{e&&xy(n,e),t&&xy(n,t),l()},`cleanup`):l(),r}insert(e,t,n){if(t.length<=0)return; let r=this.doc;r===null?this._pending.push(()=>this.insert(e,t,n)):By(r,r=>{let i=Gb(r,this,e,!n);n||(n={},i.currentAttributes.forEach((e,t)=>{n[t]=e})),Xb(r,this,i,t,n)})}insertEmbed(e,t,n){let r=this.doc;r===null?this._pending.push(()=>this.insertEmbed(e,t,n||{})):By(r,r=>{let i=Gb(r,this,e,!n);Xb(r,this,i,t,n||{})})}delete(e,t){if(t===0)return;let n=this.doc;n===null?this._pending.push(()=>this.delete(e,t)):By(n,n=>{nx(n,Gb(n,this,e,!0),t)})}format(e,t,n){if(t===0)return;let r=this.doc;r===null?this._pending.push(()=>this.format(e,t,n)):By(r,r=>{let i=Gb(r,this,e,!1);i.right!==null& & Zb(r,this,i,t,n)})}removeAttribute(e){this.doc===null?this._pending.push(()=>this.removeAttribute(e)):By(this.doc,t=>{kb(t,this,e)})}setAttribute(e,t){this.doc===null?this._pending.push(()=>this.setAttribute(e,t)):By(this.doc,n=>{Ab(n,this,e,t)})}getAttribute(e){return jb(this,e)}getAttributes(){return Mb(this)}_write(e){e.writeTypeRef(Bx)}},ax=e=>new ix,ox=class{constructor(e,t=()=>!0){this._filter=t,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??ob()}[Symbol.iterator](){return this}next(){let e=this._currentNode,t=e&&e.content&&e.content.type; if(e!==null& & (!this._firstCall||e.deleted||!this._filter(t)))do if(t=e.content.type,!e.deleted&&(t.constructor===lx||t.constructor===sx)&&t._start!==null)e=t._start; else for(;e!==null;){let t=e.next;if(t!==null){e=t;break}e=e.parent===this._root?null:e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type))); return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}},sx=class e extends gb{constructor(){super(),this._prelimContent=[]}get firstChild(){let e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,t){super._integrate(e,t),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new e}clone(){let t=new e;return t.insert(0,this.toArray().map(e=>e instanceof gb?e.clone():e)),t}get length(){return this.doc??ob(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new ox(this,e)}querySelector(e){e=e.toUpperCase();let t=new ox(this,t=>t.nodeName&&t.nodeName.toUpperCase()===e).next(); return t.done?null:t.value}querySelectorAll(e){return e=e.toUpperCase(),sm(new ox(this,t=>t.nodeName& & t.nodeName.toUpperCase()===e))}_callObserver(e,t){hb(this,e,new dx(this,t,e))}toString(){return xb(this,e=>e.toString()).join(``)}toJSON(){return this.toString()}toDOM(e=document,t={},n){let r=e.createDocumentFragment();return n!==void 0& & n._createAssociation(r,this),bb(this,i=>{r.insertBefore(i.toDOM(e,t,n),null)}),r}insert(e,t){this.doc===null?this._prelimContent.splice(e,0,...t):By(this.doc,n=>{Eb(n,this,e,t)})}insertAfter(e,t){if(this.doc!==null)By(this.doc,n=>{let r=e& & e instanceof gb?e._item:e;wb(n,this,r,t)});else{let n=this._prelimContent,r=e===null?0:n.findIndex(t=>t===e)+1;if(r===0& & e!==null)throw sh(`Reference item not found`);n.splice(r,0,...t)}}delete(e,t=1){this.doc===null?this._prelimContent.splice(e,t):By(this.doc,n=>{Ob(n,this,e,t)})}toArray(){return vb(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return Cb(this,e)}slice(e=0,t=this.length){return _b(this,e,t)}forEach(e){bb(this,e)}_write(e){e.writeTypeRef(Hx)}},cx=e=>new sx,lx=class e extends sx{constructor(e=`UNDEFINED`){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,t){super._integrate(e,t),this._prelimAttrs.forEach((e,t)=>{this.setAttribute(t,e)}),this._prelimAttrs=null}_copy(){return new e(this.nodeName)}clone(){let t=new e(this.nodeName);return Gh(this.getAttributes(),(e,n)=>{t.setAttribute(n,e)}),t.insert(0,this.toArray().map(e=>eLine truncated
`).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
`))}),n.join(`
>
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>D T(this.editor,this.type)}},addInputRules(){return[Gp({find:O T,type:this.type})]}}),A T=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,j T=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,M T=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,N T=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,P T=_p.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`& & null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)& & null}]},renderHTML({HTMLAttributes:e}){return E T(`strong`,{...A(this.options.HTMLAttributes,e),children:E T(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`< strong > `,close:`< / strong > `}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Hp({find:A T,type:this.type}),Hp({find:M T,type:this.type})]},addPasteRules(){return[Yp({find:j T,type:this.type}),Yp({find:N T,type:this.type})]}}),F T=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0& & e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},I T=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]}); return n};function L T(e){let t=new Set((e.match(/`+/g)||[]).map(e=>e.length)),n=1;for(;t.has(n);)n+=1;return n}var R T=_p.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,A(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t,n)=>{var r;if(!e.content)return``;let i=typeof(n==null||(r=n.meta)==null?void 0:r.markText)==`string`?n.meta.markText:``,a="`".repeat(L T(i)),o=i.startsWith("`")||i.endsWith("`")?` `:``;return`${a}${o}${t.renderChildren(e.content)}${o}${a}`},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Hp({find:F T,type:this.type})]},addPasteRules(){return[Yp({find:I T,type:this.type})]}}),z T=4,B T=/^```([a-z]+)?[\s\n]$/,V T=/^~~~([a-z]+)?[\s\n]$/,H T=Jp.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:z T,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t& & [...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,A(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1& & e.raw?.startsWith(`~~~`)===!1& & e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
`):`\`\`\`${r}\n\n\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??z T,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>A T(this.editor,this.type)}},addInputRules(){return[Gp({find:j T,type:this.type})]}}),N T=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,P T=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,F T=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,I T=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,L T=_p.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`& & null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)& & null}]},renderHTML({HTMLAttributes:e}){return k T(`strong`,{...A(this.options.HTMLAttributes,e),children:k T(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`< strong > `,close:`< / strong > `}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Hp({find:N T,type:this.type}),Hp({find:F T,type:this.type})]},addPasteRules(){return[Yp({find:P T,type:this.type}),Yp({find:I T,type:this.type})]}}),R T=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0& & e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},z T=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]}); return n};function B T(e){let t=new Set((e.match(/`+/g)||[]).map(e=>e.length)),n=1;for(;t.has(n);)n+=1;return n}var V T=_p.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,A(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t,n)=>{var r;if(!e.content)return``;let i=typeof(n==null||(r=n.meta)==null?void 0:r.markText)==`string`?n.meta.markText:``,a="`".repeat(B T(i)),o=i.startsWith("`")||i.endsWith("`")?` `:``;return`${a}${o}${t.renderChildren(e.content)}${o}${a}`},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Hp({find:R T,type:this.type})]},addPasteRules(){return[Yp({find:z T,type:this.type})]}}),H T=4,U T=/^```([a-z]+)?[\s\n]$/,W T=/^~~~([a-z]+)?[\s\n]$/,G T=Jp.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:H T,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t& & [...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,A(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1& & e.raw?.startsWith(`~~~`)===!1& & e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
`):`\`\`\`${r}\n\n\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??H T,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
`,`
`).split(`
`).map(e=>o+e).join(`
`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??z T,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??H T,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
`,`
`).split(`
`),c=0,l=0,u=r-a;for(let e=0;e< s.length ; e + = 1 ) { if ( l + s [ e ] . length > =u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e< c ; e + = 1 ) p + = s [ e ] . length + 1 ; return e . delete ( p , p + f ) , r-p < = f & & e . setSelection ( T . create ( e . doc , p ) ) , ! 0 } ) :e . commands . command ( ( { tr:e } ) = > {let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
@@ -123,51 +123,51 @@ img.ProseMirror-separator {
`).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
`);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;let a=r.before();return a>0?!1:e.commands.insertDefaultBlock({pos:a})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(w.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[Wp({find:B T,type:this.type,getAttributes:e=>({language:e[1]})}),Wp({find:V T,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new D({key:new Un(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type& & a.setSelection(T.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),U T=H T,W T=Jp.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;let a=r.before();return a>0?!1:e.commands.insertDefaultBlock({pos:a})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(w.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[Wp({find:U T,type:this.type,getAttributes:e=>({language:e[1]})}),Wp({find:W T,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new D({key:new Un(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type& & a.setSelection(T.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),K T=G T,q T=Jp.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
`):``}),G T=Jp.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,A(this.options.HTMLAttributes,e)]},renderText(){return`
`):``}),J T=Jp.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,A(this.options.HTMLAttributes,e)]},renderText(){return`
`},renderMarkdown:()=>`
`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks(); return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t& & s& & a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),KT=Jp.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,A(this.options.HTMLAttributes,t),0]},parseMarkdown(e,t){let n=e.depth||1;return this.options.levels.includes(n)?t.createNode(`heading`,{level:n},t.parseInline(e.tokens||[])):t.createNode(`paragraph`,void 0,t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Wp({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),qT=Jp.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,A(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!Df(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return pd(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(T.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(E.create(t.doc,n.pos)):t.setSelection(T.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i& & (t.insert(r,i),t.setSelection(T.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Up({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),JT=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,YT=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,XT=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,ZT=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,QT=_p.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`& & null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,A(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`< em > `,close:`< / em > `}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Hp({find:JT,type:this.type}),Hp({find:XT,type:this.type})]},addPasteRules(){return[Yp({find:YT,type:this.type}),Yp({find:ZT,type:this.type})]}}),$T=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zLine truncated
`,DD=`️ `,OD=` `,kD=` `,AD=null,jD=null;function MD(e=[]){let t={};mE.groups=t;let n=new mE;AD??=ID($T),jD??=ID(eE),P(n,`'`,qE),P(n,`{`,AE),P(n,`}`,jE),P(n,`[`,ME),P(n,`]`,NE),P(n,`(`,PE),P(n,`)`,FE),P(n,`< `,IE),P(n,`>`,LE),P(n,`( `,RE),P(n,`) `,zE),P(n,`「`,BE),P(n,`」`,VE),P(n,`『`,HE),P(n,`』`,UE),P(n,`< `,WE),P(n,`> `,GE),P(n,`&`,KE),P(n,`*`,JE),P(n,`@`,YE),P(n,"`",ZE),P(n,`^`,QE),P(n,`:`,$E),P(n,`,`,eD),P(n,`$`,tD),P(n,`.`,nD),P(n,`=`,rD),P(n,`!`,iD),P(n,`-`,aD),P(n,`%`,oD),P(n,`|`,sD),P(n,`+`,cD),P(n,`#`,lD),P(n,`?`,uD),P(n,`"`,dD),P(n,`/`,mD),P(n,`; `,pD),P(n,`~`,hD),P(n,`_`,gD),P(n,`\\`,XE),P(n,`・`,fD);let r=gE(n,CD,DE,{[tE]:!0});gE(r,CD,r);let i=gE(r,bD,bE,{[iE]:!0}),a=gE(r,xD,xE,{[aE]:!0}),o=gE(n,bD,vE,{[nE]:!0});gE(o,CD,i),gE(o,bD,o),gE(i,CD,i),gE(i,bD,i);let s=gE(n,xD,yE,{[rE]:!0});gE(s,bD),gE(s,CD,a),gE(s,xD,s),gE(a,CD,a),gE(a,bD),gE(a,xD,a);let c=P(n,ED,kE,{[uE]:!0}),l=P(n,TD,OE,{[uE]:!0}),u=gE(n,wD,OE,{[uE]:!0});P(n,kD,u),P(l,ED,c),P(l,kD,u),gE(l,wD,u),P(u,TD),P(u,ED),gE(u,wD,u),P(u,kD,u);let d=gE(n,SD,_D,{[sE]:!0});P(d,`#`),gE(d,SD,d),P(d,DD,d);let f=P(d,OD);P(f,`#`),gE(f,SD,d);let p=[[bD,o],[CD,i]],m=[[bD,null],[xD,s],[CD,a]];for(let e=0;e< AD.length ; e + + ) FD ( n , AD [ e ] , CE , vE , p ) ; for ( let e = 0;e<jD.length;e++)FD(n,jD[e],wE,yE,m);fE(CE,{tld:!0,ascii:!0},t),fE(wE,{utld:!0,alpha:!0},t),FD(n,`file`,TE,vE,p),FD(n,`mailto`,TE,vE,p),FD(n,`http`,EE,vE,p),FD(n,`https`,EE,vE,p),FD(n,`ftp`,EE,vE,p),FD(n,`ftps`,EE,vE,p),fE(TE,{scheme:!0,ascii:!0},t),fE(EE,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)= > e[0]>t[0]?1:-1);for(let t=0;t< e.length ; t + + ) { let r = e[t][0],i=e[t][1]?{[cE]:!0}:{[lE]:!0};r.indexOf(`-`) > =0?i[oE]=!0:bD.test(r)?CD.test(r)?i[iE]=!0:i[nE]=!0:i[tE]=!0,_E(n,r,r,i)}return _E(n,`localhost`,SE,{ascii:!0}),n.jd=new mE(vD),{start:n,tokens:Object.assign({groups:t},yD)}}function ND(e,t){let n=PD(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o< r ; ) { let s = e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d > =0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++; a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function PD(e){let t=[],n=e.length,r=0;for(;r< n ; ) { let i = e.charCodeAt(r),a,o=i<55296||i > 56319||r+1===n||(a=e.charCodeAt(r+1))< 56320 | | a > 57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function FD(e,t,n,r,i){let a,o=t.length;for(let n=0;n< o-1 ; n + + ) { let o = t[n];e.j[o]?a=e.j[o]:(a=new mE ( r ) , a . jr = i.slice(),e.j[o]=a),e=a}return a = new mE ( n ) , a . jr = i.slice(),e.j[t[o-1]]=a,a}function ID ( e ) { let t = [],n=[],r=0;for(;r<e.length;){let i = 0;for(;`0123456789`.indexOf(e[r+i]) > =0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var LD={defaultProtocol:`http`,events:null,format:zD,formatHref:zD,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],ignoreClasses:[],render:null};function RD(e,t=null){let n=Object.assign({},LD);e& & (n=Object.assign(n,e instanceof RD?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e< r.length ; e + + ) i . push ( r [ e ] . toUpperCase ( ) ) ; this . o = n,t&&(this.defaultRender=t),this.ignoreTags=i,this.ignoreClasses=n.ignoreClasses.slice()}RD.prototype={o:LD,ignoreTags:[],ignoreClasses:[],isIgnoredClass(e){if(typeof e ! = ` string ` | | this . ignoreClasses . length = ==0)return!1;let t = e.split(/\s+/);for(let e = 0;e<t.length;e++)if(this.ignoreClasses.indexOf(t[e]) > =0)return!0;return!1},defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i& & (typeof i==`object`?(i=n.t in i?i[n.t]:LD[e],typeof i==`function`& & r& & (i=i(t,n))):typeof i==`function`& & r& & (i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`& & t!=null& & (r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function zD(e){return e}function BD(e,t){this.t=`token`,this.v=e,this.tk=t}BD.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n& & r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=LD.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);reLine truncated
`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks(); return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t& & s& & a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),YT=Jp.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,A(this.options.HTMLAttributes,t),0]},parseMarkdown(e,t){let n=e.depth||1;return this.options.levels.includes(n)?t.createNode(`heading`,{level:n},t.parseInline(e.tokens||[])):t.createNode(`paragraph`,void 0,t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Wp({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),XT=Jp.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,A(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!Df(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return pd(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(T.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(E.create(t.doc,n.pos)):t.setSelection(T.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i& & (t.insert(r,i),t.setSelection(T.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Up({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),ZT=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,QT=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,$T=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,eE=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,tE=_p.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`& & null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,A(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`< em > `,close:`< / em > `}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Hp({find:ZT,type:this.type}),Hp({find:$T,type:this.type})]},addPasteRules(){return[Yp({find:QT,type:this.type}),Yp({find:eE,type:this.type})]}}),nE=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zLine truncated
`,AD=`️ `,jD=` `,MD=` `,ND=null,PD=null;function FD(e=[]){let t={};_E.groups=t;let n=new _E;ND??=zD(nE),PD??=zD(rE),P(n,`'`,XE),P(n,`{`,NE),P(n,`}`,PE),P(n,`[`,FE),P(n,`]`,IE),P(n,`(`,LE),P(n,`)`,RE),P(n,`< `,zE),P(n,`>`,BE),P(n,`( `,VE),P(n,`) `,HE),P(n,`「`,UE),P(n,`」`,WE),P(n,`『`,GE),P(n,`』`,KE),P(n,`< `,qE),P(n,`> `,JE),P(n,`&`,YE),P(n,`*`,ZE),P(n,`@`,QE),P(n,"`",eD),P(n,`^`,tD),P(n,`:`,nD),P(n,`,`,rD),P(n,`$`,iD),P(n,`.`,aD),P(n,`=`,oD),P(n,`!`,sD),P(n,`-`,cD),P(n,`%`,lD),P(n,`|`,uD),P(n,`+`,dD),P(n,`#`,fD),P(n,`?`,pD),P(n,`"`,mD),P(n,`/`,_D),P(n,`; `,gD),P(n,`~`,vD),P(n,`_`,yD),P(n,`\\`,$E),P(n,`・`,hD);let r=yE(n,ED,AE,{[iE]:!0});yE(r,ED,r);let i=yE(r,CD,CE,{[sE]:!0}),a=yE(r,wD,wE,{[cE]:!0}),o=yE(n,CD,xE,{[aE]:!0});yE(o,ED,i),yE(o,CD,o),yE(i,ED,i),yE(i,CD,i);let s=yE(n,wD,SE,{[oE]:!0});yE(s,CD),yE(s,ED,a),yE(s,wD,s),yE(a,ED,a),yE(a,CD),yE(a,wD,a);let c=P(n,kD,ME,{[pE]:!0}),l=P(n,OD,jE,{[pE]:!0}),u=yE(n,DD,jE,{[pE]:!0});P(n,MD,u),P(l,kD,c),P(l,MD,u),yE(l,DD,u),P(u,OD),P(u,kD),yE(u,DD,u),P(u,MD,u);let d=yE(n,TD,bD,{[uE]:!0});P(d,`#`),yE(d,TD,d),P(d,AD,d);let f=P(d,jD);P(f,`#`),yE(f,TD,d);let p=[[CD,o],[ED,i]],m=[[CD,null],[wD,s],[ED,a]];for(let e=0;e< ND.length ; e + + ) RD ( n , ND [ e ] , EE , xE , p ) ; for ( let e = 0;e<PD.length;e++)RD(n,PD[e],DE,SE,m);hE(EE,{tld:!0,ascii:!0},t),hE(DE,{utld:!0,alpha:!0},t),RD(n,`file`,OE,xE,p),RD(n,`mailto`,OE,xE,p),RD(n,`http`,kE,xE,p),RD(n,`https`,kE,xE,p),RD(n,`ftp`,kE,xE,p),RD(n,`ftps`,kE,xE,p),hE(OE,{scheme:!0,ascii:!0},t),hE(kE,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)= > e[0]>t[0]?1:-1);for(let t=0;t< e.length ; t + + ) { let r = e[t][0],i=e[t][1]?{[dE]:!0}:{[fE]:!0};r.indexOf(`-`) > =0?i[lE]=!0:CD.test(r)?ED.test(r)?i[sE]=!0:i[aE]=!0:i[iE]=!0,bE(n,r,r,i)}return bE(n,`localhost`,TE,{ascii:!0}),n.jd=new _E(xD),{start:n,tokens:Object.assign({groups:t},SD)}}function ID(e,t){let n=LD(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o< r ; ) { let s = e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d > =0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++; a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function LD(e){let t=[],n=e.length,r=0;for(;r< n ; ) { let i = e.charCodeAt(r),a,o=i<55296||i > 56319||r+1===n||(a=e.charCodeAt(r+1))< 56320 | | a > 57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function RD(e,t,n,r,i){let a,o=t.length;for(let n=0;n< o-1 ; n + + ) { let o = t[n];e.j[o]?a=e.j[o]:(a=new _E ( r ) , a . jr = i.slice(),e.j[o]=a),e=a}return a = new _E ( n ) , a . jr = i.slice(),e.j[t[o-1]]=a,a}function zD ( e ) { let t = [],n=[],r=0;for(;r<e.length;){let i = 0;for(;`0123456789`.indexOf(e[r+i]) > =0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var BD={defaultProtocol:`http`,events:null,format:HD,formatHref:HD,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],ignoreClasses:[],render:null};function VD(e,t=null){let n=Object.assign({},BD);e& & (n=Object.assign(n,e instanceof VD?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e< r.length ; e + + ) i . push ( r [ e ] . toUpperCase ( ) ) ; this . o = n,t&&(this.defaultRender=t),this.ignoreTags=i,this.ignoreClasses=n.ignoreClasses.slice()}VD.prototype={o:BD,ignoreTags:[],ignoreClasses:[],isIgnoredClass(e){if(typeof e ! = ` string ` | | this . ignoreClasses . length = ==0)return!1;let t = e.split(/\s+/);for(let e = 0;e<t.length;e++)if(this.ignoreClasses.indexOf(t[e]) > =0)return!0;return!1},defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i& & (typeof i==`object`?(i=n.t in i?i[n.t]:BD[e],typeof i==`function`& & r& & (i=i(t,n))):typeof i==`function`& & r& & (i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`& & t!=null& & (r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function HD(e){return e}function UD(e,t){this.t=`token`,this.v=e,this.tk=t}UD.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n& & r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=BD.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);reLine truncated
1. Must only contain digits, lowercase ASCII letters or "-"
2. Cannot start or end with "-"
3. "-" cannot repeat`);QD.customSchemes.push([e,t])}function tO(){QD.scanner=MD(QD.customSchemes);for(let e=0;e< QD.tokenQueue.length ; e + + ) QD . tokenQueue [ e ] [ 1 ] ( { scanner:QD . scanner } ) ; QD . parser = qD(QD.scanner.tokens);for(let e = 0;e<QD.pluginQueue.length;e++)QD.pluginQueue[e][1]({scanner:QD.scanner,parser:QD.parser});return QD . initialized = !0,QD}function nO ( e ) { return QD . initialized | | tO ( ) , JD ( QD . parser . start , e , ND ( QD . scanner . start , e ) ) } nO . scan = ND;function rO ( e , t = null,n=null){if(t&&typeof t = =`object`){if(n)throw Error ( ` linkifyjs: Invalid link type $ { t } ; must be a string ` ) ; n = t,t=null}let r = new RD ( n ) , i = nO(e),a=[];for(let e = 0;e<i.length;e++){let n = i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a } var iO = `[\0- \ xA0 - \ u2029 ] ` , aO = new RegExp ( iO ) , oO = RegExp(`${iO}$`),sO=RegExp(`${iO}+$`),cO=new RegExp ( iO , ` g ` ) ; function lO ( e , t , n ) { let r = e.doc.resolve(t.to);if(!r.nodeBefore?.isText)return;let i = e.doc.textBetween(t.from,t.to,` `,` `).match(sO)?.[0];if(!i)return;let a = t.to-i.length,o=ed(a,t.to,e.doc).filter(e= > e.mark.type===n);if(!o.length)return;let{nodeAfter:s}=r;if(s&&o.some(e=>e.mark.isInSet(s.marks)))return; let c=e.storedMarks;e.removeMark(a,t.to,n),e.setStoredMarks(c),e.selection.empty& & e.selection.from===t.to& & e.removeStoredMark(n)}function uO(e){return e.length===1?e[0].isLink:e.length===3& & e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function dO(e){return new D({key:new Un(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`)); if(!i||a)return;let{tr:o}=r,s=hu(n.doc,[...t]);if(!t.some(Jc)){let t=[];s.steps.forEach((e,n)=>{if(!(e instanceof Et)||!e.slice.size)return;let r=s.mapping.slice(n+1),i=r.map(e.from,1),a=r.map(e.from+e.slice.size,-1);i< a & & t . push ( { from:i , to:a } ) } ) , t . sort ( ( e , t ) = > t.to-e.to),t.forEach(t=>lO(o,t,e.type))}if($u(s).forEach(({newRange:t})=>{let n=_u(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!oO.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i& & a){let t=a.split(aO).filter(Boolean);if(t.length< =0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=nO(n).map(t=>t.toObject(e.defaultProtocol));if(!uO(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{ed(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function fO(e){return new D({key:new Un(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1; let a=!1;if(e.enableClickSelection& & (a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=Xu(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r& & (window.open(r,o),a=!0)}return a}}})}var pO=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘ (.*?)’ ))?\)$/,mO=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘ (.*?)’ ))?\)/g;function hO(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`; --r)n+=1;return n%2==1}function gO(e,t){let n=0,r=0;for(;r< t ; ) { if ( e [ r ] ! = = " ` " | | n = ==0&&hO(e,r)){r+=1;continue}let i = 0;for(;r<t&&e[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n > 0}function _O(e,t,n){let[,r,i]=t;return(t.index?e[t.index-1]:void 0)===`!`||hO(e,t.index??0)||gO(e,t.index??0)?!1:!!r.trim()& & n(i)}function vO(e){let[t,n,r,,i,a,o]=e,s=i??a??o;return{index:e.index??0,text:t,replaceWith:n,data:{href:r,title:s||null,markdown:!0}}}function yO(e,t){return e.index< t.index + t . text . length & & t . index < e . index + e . text . length } function bO ( e ) { return { href:e . data ? . href , title:e . data ? . title ? ? null } } function xO ( e ) { let t = Hp({find:t= > {let n=pO.exec(t);return!n||!_O(t,n,e.isAllowedHref)?null:vO(n)},type:e.type,getAttributes:bO});return new lp({find:t.find,handler:e=>{let n=t.handler(e);return n!==null& & e.state.tr.steps.length& & e.state.tr.setMeta(`preventAutolink`,!0),n}})}function SO(e){let t=Yp({find:t=>{let n=[];for(let r of t.matchAll(mO))_O(t,r,e.isAllowedHref)&&n.push(vO(r)); let r=(e.findPlainUrls?.call(e,t)??[]).filter(e=>!n.some(t=>yO(t,e)));return[...n,...r]},type:e.type,getAttributes:bO});return new vp({find:t.find,handler:e=>{let n=t.handler(e);return n!==null& & e.state.tr.steps.length& & e.match.data?.markdown& & e.state.tr.setMeta(`preventAutolink`,!0),n}})}function CO(e){return new D({key:new Un(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=rOLine truncated
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(EO,this.editor.getAttributes(DO)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Gp({find:OO,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Gp({find:OO,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(DO),editor:this.editor})),[e]}}),AO=(e,t,n)=>{let{selection:r}=e; if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a< 0 ) return null ; let o = i.node(a),s=i.index(a);if(s+1 > =o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l& & e.childCount>1& & (u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},jO=(e,t,n,r)=>{let i=AO(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:c,insertPos:l,items:u}=i,d=e.tr;d.delete(c,c+o.nodeSize);let f=d.mapping.map(l);return d.insert(f,s.from(u)),d.setSelection(a.map(d.doc,d.mapping)),t& & t(d),!0},MO=(e,t,n)=>jO(e.state,e.view.dispatch,t,n),NO=(e,t)=>Tp.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>MO(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}}),PO=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],FO=`abcdefghijklmnopqrstuvwxyz`,IO=String.raw`\d+|[ivxlcdmIVXLCDM]+|${`[a-zA-Z]{1,2}`}`;function LO(e){let t=e,n=``;for(let[e,r]of PO)for(;t>=e;)n+=r,t-=e;return n}function RO(e){return LO(e).toUpperCase()}function zO(e){let t=e.toLowerCase(),n=0,r=0;for(;n< t.length ; ) { let e = !1;for(let[i,a]of PO ) if ( t . startsWith ( a , n ) ) { r + = i , n + = a . length , e = !0;break}if(!e)return 0 } return r } function BO ( e ) { if ( ! / ^ [ ivxlcdmIVXLCDM ] + $ / . test ( e ) ) return ! 1 ; let t = zO(e);return t < = 0 ? ! 1: ( e = ==e.toLowerCase()?LO(t):RO(t))===e}function VO ( e ) { let t = e.toLowerCase();if(t.length===1)return t . charCodeAt ( 0 ) -97 + 1 ; if ( t . length = ==2){let e = t.charCodeAt(0)-97,n=t.charCodeAt(1)-97;return(e+1)*26+n+1}return 0 } function HO ( e ) { if ( e < = 26 ) return FO [ e-1 ] ; let t = Math.floor((e-1)/26)-1,n=(e-1)%26;return t < 0 ? FO [ n ] :FO [ t ] + FO [ n ] } function UO ( e ) { if ( e & & ! / ^ \ d + $ / . test ( e ) ) { if ( BO ( e ) ) return e = ==e.toLowerCase()?`i`:`I`;if(/^[a-z]{1,2}$/.test(e))return`a`;if(/^[A-Z]{1,2}$/.test(e))return`A`}}function WO ( e ) { if ( / ^ \ d + $ / . test ( e ) ) return parseInt ( e , 10 ) ; let t = UO(e);if(t===`i`||t===`I`)return zO ( e ) ; if ( t = ==`a`||t===`A`){let t = VO(e);return t > 0?t:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}function GO(e,t){if(e===`numeric`)return String(t);switch(e){case`a`:return HO(t);case`A`:return HO(t).toUpperCase();case`i`:return LO(t);case`I`:return RO(t);default:return String(t)}}function KO(e){if(e.length===0)return!1;let t=UO(e[0])??`numeric`,n=WO(e[0]);if(n< 1 ) return ! 1 ; for ( let r = 0;r<e.length;r++){let i = GO(t,n+r);if(e[r]!==i)return!1}return!0}function qO ( e ) { return { type:UO ( e ) , start:WO ( e ) } } function JO ( e ) { let { type:t , start:n } = qO ( e ) , r = {};return t & & ( r . type = t),n!==1&&(r.start=n),r}function YO ( e , t , n = `. ` ) { let r = t+1;if(!e||e===`1`)return`${r}${n}`;switch(e){case`a`:return`${HO(r)}${n}`;case`A`:return`${HO(r).toUpperCase()}${n}`;case`i`:return`${LO(r)}${n}`;case`I`:return`${RO(r)}${n}`;default:return`${r}${n}`}}function XO ( e ) { return ! e [ 0 ] | | e [ 0 ] . type = ==`paragraph`?e:[{type:`paragraph`,content:[]},...e]}function ZO ( e ) { let t = e.content?.[0];return t ? . type = ==`paragraph`&&!t.content?.length}var QO = ` `,$O=1,ek=e= > (e?.level??$O)>$O;function tk(e){let t=e.tokens?.[0];return!!(e.text& & e.tokens?.length===1& & t?.type===`list`& & t.ordered& & t.raw===e.text)}function nk(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var rk=Jp.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,A(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(tk(e))return{type:`listItem`,content:[{type:`paragraph`,content:nk(e.text||``,t)}]}; let[i,...a]=e.tokens;if(i.type===`heading`)return{type:`listItem`,content:[{type:`paragraph`,content:t.parseInline(i.tokens??[])},...a.length>0?n(a):[]]}Line truncated
3. "-" cannot repeat`);tO.customSchemes.push([e,t])}function iO(){tO.scanner=FD(tO.customSchemes);for(let e=0;e< tO.tokenQueue.length ; e + + ) tO . tokenQueue [ e ] [ 1 ] ( { scanner:tO . scanner } ) ; tO . parser = XD(tO.scanner.tokens);for(let e = 0;e<tO.pluginQueue.length;e++)tO.pluginQueue[e][1]({scanner:tO.scanner,parser:tO.parser});return tO . initialized = !0,tO}function aO ( e ) { return tO . initialized | | iO ( ) , ZD ( tO . parser . start , e , ID ( tO . scanner . start , e ) ) } aO . scan = ID;function oO ( e , t = null,n=null){if(t&&typeof t = =`object`){if(n)throw Error ( ` linkifyjs: Invalid link type $ { t } ; must be a string ` ) ; n = t,t=null}let r = new VD ( n ) , i = aO(e),a=[];for(let e = 0;e<i.length;e++){let n = i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a } var sO = `[\0- \ xA0 - \ u2029 ] ` , cO = new RegExp ( sO ) , lO = RegExp(`${sO}$`),uO=RegExp(`${sO}+$`),dO=new RegExp ( sO , ` g ` ) ; function fO ( e , t , n ) { let r = e.doc.resolve(t.to);if(!r.nodeBefore?.isText)return;let i = e.doc.textBetween(t.from,t.to,` `,` `).match(uO)?.[0];if(!i)return;let a = t.to-i.length,o=ed(a,t.to,e.doc).filter(e= > e.mark.type===n);if(!o.length)return;let{nodeAfter:s}=r;if(s&&o.some(e=>e.mark.isInSet(s.marks)))return; let c=e.storedMarks;e.removeMark(a,t.to,n),e.setStoredMarks(c),e.selection.empty& & e.selection.from===t.to& & e.removeStoredMark(n)}function pO(e){return e.length===1?e[0].isLink:e.length===3& & e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function mO(e){return new D({key:new Un(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`)); if(!i||a)return;let{tr:o}=r,s=hu(n.doc,[...t]);if(!t.some(Jc)){let t=[];s.steps.forEach((e,n)=>{if(!(e instanceof Et)||!e.slice.size)return;let r=s.mapping.slice(n+1),i=r.map(e.from,1),a=r.map(e.from+e.slice.size,-1);i< a & & t . push ( { from:i , to:a } ) } ) , t . sort ( ( e , t ) = > t.to-e.to),t.forEach(t=>fO(o,t,e.type))}if($u(s).forEach(({newRange:t})=>{let n=_u(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!lO.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i& & a){let t=a.split(cO).filter(Boolean);if(t.length< =0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=aO(n).map(t=>t.toObject(e.defaultProtocol));if(!pO(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{ed(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function hO(e){return new D({key:new Un(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1; let a=!1;if(e.enableClickSelection& & (a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=Xu(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r& & (window.open(r,o),a=!0)}return a}}})}var gO=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘ (.*?)’ ))?\)$/,_O=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘ (.*?)’ ))?\)/g;function vO(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`; --r)n+=1;return n%2==1}function yO(e,t){let n=0,r=0;for(;r< t ; ) { if ( e [ r ] ! = = " ` " | | n = ==0&&vO(e,r)){r+=1;continue}let i = 0;for(;r<t&&e[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n > 0}function bO(e,t,n){let[,r,i]=t;return(t.index?e[t.index-1]:void 0)===`!`||vO(e,t.index??0)||yO(e,t.index??0)?!1:!!r.trim()& & n(i)}function xO(e){let[t,n,r,,i,a,o]=e,s=i??a??o;return{index:e.index??0,text:t,replaceWith:n,data:{href:r,title:s||null,markdown:!0}}}function SO(e,t){return e.index< t.index + t . text . length & & t . index < e . index + e . text . length } function CO ( e ) { return { href:e . data ? . href , title:e . data ? . title ? ? null } } function wO ( e ) { let t = Hp({find:t= > {let n=gO.exec(t);return!n||!bO(t,n,e.isAllowedHref)?null:xO(n)},type:e.type,getAttributes:CO});return new lp({find:t.find,handler:e=>{let n=t.handler(e);return n!==null& & e.state.tr.steps.length& & e.state.tr.setMeta(`preventAutolink`,!0),n}})}function TO(e){let t=Yp({find:t=>{let n=[];for(let r of t.matchAll(_O))bO(t,r,e.isAllowedHref)&&n.push(xO(r)); let r=(e.findPlainUrls?.call(e,t)??[]).filter(e=>!n.some(t=>SO(t,e)));return[...n,...r]},type:e.type,getAttributes:CO});return new vp({find:t.find,handler:e=>{let n=t.handler(e);return n!==null& & e.state.tr.steps.length& & e.match.data?.markdown& & e.state.tr.setMeta(`preventAutolink`,!0),n}})}function EO(e){return new D({key:new Un(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=oOLine truncated
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(kO,this.editor.getAttributes(AO)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Gp({find:jO,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Gp({find:jO,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(AO),editor:this.editor})),[e]}}),NO=(e,t,n)=>{let{selection:r}=e; if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a< 0 ) return null ; let o = i.node(a),s=i.index(a);if(s+1 > =o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l& & e.childCount>1& & (u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},PO=(e,t,n,r)=>{let i=NO(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:c,insertPos:l,items:u}=i,d=e.tr;d.delete(c,c+o.nodeSize);let f=d.mapping.map(l);return d.insert(f,s.from(u)),d.setSelection(a.map(d.doc,d.mapping)),t& & t(d),!0},FO=(e,t,n)=>PO(e.state,e.view.dispatch,t,n),IO=(e,t)=>Tp.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>FO(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}}),LO=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],RO=`abcdefghijklmnopqrstuvwxyz`,zO=String.raw`\d+|[ivxlcdmIVXLCDM]+|${`[a-zA-Z]{1,2}`}`;function BO(e){let t=e,n=``;for(let[e,r]of LO)for(;t>=e;)n+=r,t-=e;return n}function VO(e){return BO(e).toUpperCase()}function HO(e){let t=e.toLowerCase(),n=0,r=0;for(;n< t.length ; ) { let e = !1;for(let[i,a]of LO ) if ( t . startsWith ( a , n ) ) { r + = i , n + = a . length , e = !0;break}if(!e)return 0 } return r } function UO ( e ) { if ( ! / ^ [ ivxlcdmIVXLCDM ] + $ / . test ( e ) ) return ! 1 ; let t = HO(e);return t < = 0 ? ! 1: ( e = ==e.toLowerCase()?BO(t):VO(t))===e}function WO ( e ) { let t = e.toLowerCase();if(t.length===1)return t . charCodeAt ( 0 ) -97 + 1 ; if ( t . length = ==2){let e = t.charCodeAt(0)-97,n=t.charCodeAt(1)-97;return(e+1)*26+n+1}return 0 } function GO ( e ) { if ( e < = 26 ) return RO [ e-1 ] ; let t = Math.floor((e-1)/26)-1,n=(e-1)%26;return t < 0 ? RO [ n ] :RO [ t ] + RO [ n ] } function KO ( e ) { if ( e & & ! / ^ \ d + $ / . test ( e ) ) { if ( UO ( e ) ) return e = ==e.toLowerCase()?`i`:`I`;if(/^[a-z]{1,2}$/.test(e))return`a`;if(/^[A-Z]{1,2}$/.test(e))return`A`}}function qO ( e ) { if ( / ^ \ d + $ / . test ( e ) ) return parseInt ( e , 10 ) ; let t = KO(e);if(t===`i`||t===`I`)return HO ( e ) ; if ( t = ==`a`||t===`A`){let t = WO(e);return t > 0?t:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}function JO(e,t){if(e===`numeric`)return String(t);switch(e){case`a`:return GO(t);case`A`:return GO(t).toUpperCase();case`i`:return BO(t);case`I`:return VO(t);default:return String(t)}}function YO(e){if(e.length===0)return!1;let t=KO(e[0])??`numeric`,n=qO(e[0]);if(n< 1 ) return ! 1 ; for ( let r = 0;r<e.length;r++){let i = JO(t,n+r);if(e[r]!==i)return!1}return!0}function XO ( e ) { return { type:KO ( e ) , start:qO ( e ) } } function ZO ( e ) { let { type:t , start:n } = XO ( e ) , r = {};return t & & ( r . type = t),n!==1&&(r.start=n),r}function QO ( e , t , n = `. ` ) { let r = t+1;if(!e||e===`1`)return`${r}${n}`;switch(e){case`a`:return`${GO(r)}${n}`;case`A`:return`${GO(r).toUpperCase()}${n}`;case`i`:return`${BO(r)}${n}`;case`I`:return`${VO(r)}${n}`;default:return`${r}${n}`}}function $ O ( e ) { return ! e [ 0 ] | | e [ 0 ] . type = ==`paragraph`?e:[{type:`paragraph`,content:[]},...e]}function ek ( e ) { let t = e.content?.[0];return t ? . type = ==`paragraph`&&!t.content?.length}var tk = ` `,nk=1,rk=e= > (e?.level??nk)>nk;function ik(e){let t=e.tokens?.[0];return!!(e.text& & e.tokens?.length===1& & t?.type===`list`& & t.ordered& & t.raw===e.text)}function ak(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var ok=Jp.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,A(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(ik(e))return{type:`listItem`,content:[{type:`paragraph`,content:ak(e.text||``,t)}]}; let[i,...a]=e.tokens;if(i.type===`heading`)return{type:`listItem`,content:[{type:`paragraph`,content:t.parseInline(i.tokens??[])},...a.length>0?n(a):[]]}Line truncated
`).trim(),contentLines:m,raw:g.join(`
`)}),r=h,n=h}return[t,r]}var x k=RegExp(`^(${I O})([.)])\\s+(.+)$`);function S k(e){let t=e.split(`
`).filter(e=>e.trim().length>0);if(t.length===0)return null;let n=[];for(let e of t){let t=e.trim().match(x k);if(!t)return null;n.push({marker:t[1],content:t[3]})}return K O(n.map(e=>e.marker))?{type:`orderedList`,attrs:J O(n[0].marker),content:n.map(e=>({type:`listItem`,content:[{type:`paragraph`,content:[{type:`text`,text:e.content}]}]}))}:null}function C k(e,t,n){let r=[],i=0;for(;i< e.length ; ) { let a = e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=y k(a.contentLines),c=o.join(`
`)}),r=h,n=h}return[t,r]}var w k=RegExp(`^(${z O})([.)])\\s+(.+)$`);function T k(e){let t=e.split(`
`).filter(e=>e.trim().length>0);if(t.length===0)return null;let n=[];for(let e of t){let t=e.trim().match(w k);if(!t)return null;n.push({marker:t[1],content:t[3]})}return Y O(n.map(e=>e.marker))?{type:`orderedList`,attrs:Z O(n[0].marker),content:n.map(e=>({type:`listItem`,content:[{type:`paragraph`,content:[{type:`text`,text:e.content}]}]}))}:null}function E k(e,t,n){let r=[],i=0;for(;i< e.length ; ) { let a = e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=S k(a.contentLines),c=o.join(`
`).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)}); let u=s.join(`
`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d< e.length & & e [ d ] . indent > t;)f.push(e[d]),d+=1;if(f.length>0){let e=C k(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,typeMarker:f[0].type,items:e,raw:f.map(e=>e.raw).join(`
`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function w k(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e])); else if(e.type===`text`& & e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0& & n.push(...r)}}),{type:`listItem`,content:n}})}var T k=64;function E k(e,t){let n=[],r=0;for(;n.length< t ; ) { let t = e.indexOf(`
`,r);if(t===-1)return n.push(e.slice(r)),n;n.push(e.slice(r,t)),r=t+1}return n}function D k(e){let t=e.indexOf(`
`),n=t===-1?e:e.slice(0,t);if(!p k.test(n))return[[],0,[]];let r=T k,i=E k(e,r),a=b k(i);for(;a[1]===i.length&&i.length===r; )r*=2,i=E k(e,r),a=b k(i);return[a[0],a[1],i]}var O k=`listItem`,k k=`textStyle`,A k=/^(\d+)\.\s$/;function j k(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case`upper-roman`:return`I`;case`lower-roman`:return`i`;case`upper-alpha`:case`upper-latin`:return`A`;case`lower-alpha`:case`lower-latin`:return`a`;default:return null}}var M k=Jp.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute(`type`);if(t)return t;let n=e.getAttribute(`style`);if(n){let e=j k(n);if(e)return e}let r=e.querySelector(`li`);if(r){let e=r.getAttribute(`style`);if(e){let t=j k(e);if(t)return t}}return null}}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=A(this.options.HTMLAttributes,r);return t!==1&&(i.start=t),n&&n!==`1`&&(i.type=n),[`ol`,i,0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[]; let n=e.start||1,r=e.typeMarker,i=e.items?w k(e.items,t):[],a={};return n!==1& & (a.start=n),r& & (a.type=r),Object.keys(a).length>0?{type:`orderedList`,attrs:a,content:i}:{type:`orderedList`,content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:()=>-1,tokenize:(e,t,n)=>{let[r,i,a]=D k(e);if(r.length===0)return;let o=C k(r,r[0].indent,n);if(o.length!==0)return{type:`list`,ordered:!0,start:r[0]?.number||1,typeMarker:r[0]?.type,items:o,raw:a.slice(0,i).join(`
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Ok,this.editor.getAttributes(kk)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new D({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=Sk(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=Gp({find:Ak,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e}); return(this.options.keepMarks||this.options.keepAttributes)& & (t=Gp({find:Ak,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(kk)}),joinPredicate:e,editor:this.editor})),[t]}}),Nk=/^\s*(\[([( |x])?\])\s$/,Pk=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,Fk=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},Ik=Jp.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>e.querySelector(`div`)??e}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,A(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens& & e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens& & e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>op(e,t,`- [${e.attrs?.checked?`x`:` `}] `,void 0,{indentMainContent:!0}),addExtensions(){return this.options.nested?[NO(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`);o.style.cssText=Pk;let l=e=>{let t=Fk(e,e.attrs.checked,this.options.a11y);s.setAttribute(`aria-label`,t),o.textContent=t};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked; return}let{checked:i}=t.target;r.isEditable& & typeof n==`function`& & r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)}); let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=Lu(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[Gp({find:Nk,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Lk=Jp.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`uLine truncated
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=rp(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=rp(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Tp.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(kO.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(rk.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(fk.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Mk.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(Ik.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Lk.configure(this.options.taskList)),e}}); var Rk=` `,zk=`\xA0`,Bk=Jp.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,A(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1& & n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1& & n[0].type===`text`& & (n[0].raw===Rk||n[0].text===Rk||n[0].raw===zk||n[0].text===zk)& & r.length===1& & r[0].type===`text`& & (r[0].text===Rk||r[0].text===zk)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`& & e.length===0?Rk:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Vk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Hk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Uk=_p.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,A(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Hp({find:Vk,type:this.type})]},addPasteRules(){return[Yp({find:Hk,type:this.type})]}}),Wk=Jp.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),Gk=_p.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,A(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`< u > ${t.renderChildren(e)}< / u > `},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.toLowerCase().indexOf(`< u > `)},tokenize(e,t,n){if(!/^< u > /i.test(e))return;let r=/\\[\s\S]|`+|< \/u>/gi;r.lastIndex=3;let i=r.exec(e);for(;i;){if(i[0].startsWith("`")){let t=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/.exec(e.slice(i.index));t& & (r.lastIndex=i.index+t[0].length)}else if(!i[0].startsWith(`\\`)){let t=e.slice(3,i.index);return t?{type:`underline`,raw:e.slice(0,r.lastIndex),text:t,tokens:n.inlineTokens(t)}:void 0}i=r.exec(e)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleLine truncated
`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d< e.length & & e [ d ] . indent > t;)f.push(e[d]),d+=1;if(f.length>0){let e=E k(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,typeMarker:f[0].type,items:e,raw:f.map(e=>e.raw).join(`
`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function D k(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e])); else if(e.type===`text`& & e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0& & n.push(...r)}}),{type:`listItem`,content:n}})}var O k=64;function k k(e,t){let n=[],r=0;for(;n.length< t ; ) { let t = e.indexOf(`
`,r);if(t===-1)return n.push(e.slice(r)),n;n.push(e.slice(r,t)),r=t+1}return n}function A k(e){let t=e.indexOf(`
`),n=t===-1?e:e.slice(0,t);if(!g k.test(n))return[[],0,[]];let r=O k,i=k k(e,r),a=C k(i);for(;a[1]===i.length&&i.length===r; )r*=2,i=k k(e,r),a=C k(i);return[a[0],a[1],i]}var j k=`listItem`,M k=`textStyle`,N k=/^(\d+)\.\s$/;function P k(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case`upper-roman`:return`I`;case`lower-roman`:return`i`;case`upper-alpha`:case`upper-latin`:return`A`;case`lower-alpha`:case`lower-latin`:return`a`;default:return null}}var F k=Jp.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute(`type`);if(t)return t;let n=e.getAttribute(`style`);if(n){let e=P k(n);if(e)return e}let r=e.querySelector(`li`);if(r){let e=r.getAttribute(`style`);if(e){let t=P k(e);if(t)return t}}return null}}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=A(this.options.HTMLAttributes,r);return t!==1&&(i.start=t),n&&n!==`1`&&(i.type=n),[`ol`,i,0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[]; let n=e.start||1,r=e.typeMarker,i=e.items?D k(e.items,t):[],a={};return n!==1& & (a.start=n),r& & (a.type=r),Object.keys(a).length>0?{type:`orderedList`,attrs:a,content:i}:{type:`orderedList`,content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:()=>-1,tokenize:(e,t,n)=>{let[r,i,a]=A k(e);if(r.length===0)return;let o=E k(r,r[0].indent,n);if(o.length!==0)return{type:`list`,ordered:!0,start:r[0]?.number||1,typeMarker:r[0]?.type,items:o,raw:a.slice(0,i).join(`
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(jk,this.editor.getAttributes(Mk)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new D({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=Tk(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=Gp({find:Nk,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e}); return(this.options.keepMarks||this.options.keepAttributes)& & (t=Gp({find:Nk,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Mk)}),joinPredicate:e,editor:this.editor})),[t]}}),Ik=/^\s*(\[([( |x])?\])\s$/,Lk=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,Rk=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},zk=Jp.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>e.querySelector(`div`)??e}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,A(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens& & e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens& & e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>op(e,t,`- [${e.attrs?.checked?`x`:` `}] `,void 0,{indentMainContent:!0}),addExtensions(){return this.options.nested?[IO(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`);o.style.cssText=Lk;let l=e=>{let t=Rk(e,e.attrs.checked,this.options.a11y);s.setAttribute(`aria-label`,t),o.textContent=t};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked; return}let{checked:i}=t.target;r.isEditable& & typeof n==`function`& & r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)}); let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=Lu(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[Gp({find:Ik,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),Bk=Jp.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`uLine truncated
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=rp(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=rp(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Tp.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(MO.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(ok.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(hk.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(Fk.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(zk.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(Bk.configure(this.options.taskList)),e}}); var Vk=` `,Hk=`\xA0`,Uk=Jp.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,A(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1& & n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1& & n[0].type===`text`& & (n[0].raw===Vk||n[0].text===Vk||n[0].raw===Hk||n[0].text===Hk)& & r.length===1& & r[0].type===`text`& & (r[0].text===Vk||r[0].text===Hk)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`& & e.length===0?Vk:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Wk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Gk=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Kk=_p.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,A(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Hp({find:Wk,type:this.type})]},addPasteRules(){return[Yp({find:Gk,type:this.type})]}}),qk=Jp.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),Jk=_p.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,A(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`< u > ${t.renderChildren(e)}< / u > `},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.toLowerCase().indexOf(`< u > `)},tokenize(e,t,n){if(!/^< u > /i.test(e))return;let r=/\\[\s\S]|`+|< \/u>/gi;r.lastIndex=3;let i=r.exec(e);for(;i;){if(i[0].startsWith("`")){let t=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/.exec(e.slice(i.index));t& & (r.lastIndex=i.index+t[0].length)}else if(!i[0].startsWith(`\\`)){let t=e.slice(3,i.index);return t?{type:`underline`,raw:e.slice(0,r.lastIndex),text:t,tokens:n.inlineTokens(t)}:void 0}i=r.exec(e)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleLine truncated
`).length:0;c!==o& & (o=c,i.textContent=Array.from({length:c},(e,t)=>t+1).join(`
`))};return s(n),{dom:r,contentDOM:a,update:e=>e.type===n.type& & (s(e),!0),ignoreMutation:e=>i.contains(e.target)}}}}),Fj=(e,t)=>e===`application/pdf`||typeof t==`string`&&/\.pdf$/i.test(t); function Ij(e,t,n,r){let i=!1,a=null,o=null,s=document.createElement(`div`);return s.className=`dw-pdf__status`,s.textContent=r.blocks.pdfLoading,e.replaceChildren(s),(async()=>{try{let c=await n();if(i)return;o=c.getDocument({url:t});let l=await o.promise;if(i)return;s.remove();let u=Math.max(e.clientWidth-2,200),d=window.devicePixelRatio||1;a=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=t.target;a?.unobserve(e),p(e,Number(e.dataset.page))}},{root:e,rootMargin:`400px 0px`});let f=(await l.getPage(1)).getViewport({scale:1});for(let t=1;t< =l.numPages;t++){let n=document.createElement(`div`);n.className=`dw-pdf__page`,n.dataset.page=String(t),n.style.aspectRatio=`${f.width} / ${f.height}`,n.setAttribute(`aria-label`,r.blocks.pdfPage.replace(`{n}`,String(t))),e.append(n),a.observe(n)}async function p(e,t){let n=await l.getPage(t);if(i)return;let r=u/n.getViewport({scale:1}).width,a=n.getViewport({scale:r*d}),o=document.createElement(`canvas`);o.width=Math.floor(a.width),o.height=Math.floor(a.height),e.style.aspectRatio=`${a.width} / ${a.height}`,e.append(o),await n.render({canvas:o,viewport:a}).promise}}catch{i||(s.textContent=r.blocks.loadFailed)}})(),()=>{i=!0,a?.disconnect(),o?.destroy()}}var Lj={page:[`M6 3h8l4 4v14H6z`,`M14 3v4h4`,`M9 12h6`,`M9 16h6`],"chevron-right":[`M10 6l6 6-6 6`],"chevron-left":[`M14 6l-6 6 6 6`],"chevron-down":[`M6 10l6 6 6-6`],"chevron-up":[`M6 14l6-6 6 6`],plus:[`M12 5v14`,`M5 12h14`],search:[`M11 4a7 7 0 1 0 0 14a7 7 0 1 0 0-14z`,`M16.5 16.5L20 20`],more:[`M6 12h.01`,`M12 12h.01`,`M18 12h.01`],drop:[`M12 4h7v7a7 7 0 1 1-7-7z`],info:[`M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z`,`M12 11v5`,`M12 8h.01`],check:[`M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z`,`M8 12.5l2.5 2.5L16 9.5`],alert:[`M12 4l9 16H3z`,`M12 10v4`,`M12 17h.01`],error:[`M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z`,`M9 9l6 6`,`M15 9l-6 6`],text:[`M5 6h14`,`M12 6v13`],heading:[`M6 5v14`,`M18 5v14`,`M6 12h12`],list:[`M9 6h11`,`M9 12h11`,`M9 18h11`,`M4.5 6h.01`,`M4.5 12h.01`,`M4.5 18h.01`],todo:[`M4 4h7v7H4z`,`M5.5 7.5l1.5 1.5 2.5-2.5`,`M14 7h6`,`M4 14h7v7H4z`,`M14 17h6`],code:[`M9 7l-5 5 5 5`,`M15 7l5 5-5 5`],quote:[`M6 6v12`,`M10 8h9`,`M10 12h9`,`M10 16h6`],image:[`M4 5h16v14H4z`,`M4 16l5-5 4 4 2-2 5 5`,`M15.5 8.5h.01`],table:[`M4 5h16v14H4z`,`M4 10h16`,`M4 15h16`,`M10 5v14`],lock:[`M6 11h12v9H6z`,`M8.5 11V8a3.5 3.5 0 0 1 7 0v3`],trash:[`M4 7h16`,`M10 4h4`,`M6 7l1 13h10l1-13`,`M10 11v6`,`M14 11v6`],settings:[`M4 7h9`,`M17 7h3`,`M15 5v4`,`M4 17h3`,`M11 17h9`,`M9 15v4`],menu:[`M4 7h16`,`M4 12h16`,`M4 17h16`],close:[`M6 6l12 12`,`M18 6L6 18`],open:[`M8 16L16 8`,`M9 8h7v7`],restore:[`M4.5 13a7.5 7.5 0 1 0 2.2-6.3`,`M5 4v4h4`],"sign-out":[`M14 4h5v16h-5`,`M10 8l-4 4 4 4`,`M6 12h9`],sidebar:[`M4 5h16v14H4z`,`M9.5 5v14`],home:[`M4 11l8-7 8 7`,`M6 9.5V20h12V9.5`,`M10 20v-5h4v5`],sun:[`M12 8a4 4 0 1 0 0 8a4 4 0 1 0 0-8z`,`M12 3v1.5`,`M12 19.5V21`,`M3 12h1.5`,`M19.5 12H21`,`M5.6 5.6l1.1 1.1`,`M17.3 17.3l1.1 1.1`,`M5.6 18.4l1.1-1.1`,`M17.3 6.7l1.1-1.1`],moon:[`M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z`],monitor:[`M4 5h16v11H4z`,`M9 20h6`,`M12 16v4`],selector:[`M8 9l4-4 4 4`,`M8 15l4 4 4-4`],star:[`M12 4l2.5 5.2 5.5.8-4 3.9.9 5.6L12 16.9l-4.9 2.6.9-5.6-4-3.9 5.5-.8z`],clock:[`M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z`,`M12 7v5l3 2`],calendar:[`M5 5h14a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z`,`M4 10h16`,`M8 3v4`,`M16 3v4`],share:[`M12 4v11`,`M8 8l4-4 4 4`,`M6 13v7h12v-7`],link:[`M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1`,`M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1`],upload:[`M12 16V4`,`M7 9l5-5 5 5`,`M4 20h16`],download:[`M12 4v12`,`M7 11l5 5 5-5`,`M4 20h16`],file:[`M6 3h8l4 4v14H6z`,`M14 3v4h4`],paperclip:[`M18 11.5l-6.4 6.4a4.2 4.2 0 0 1-6-6l7-7a2.8 2.8 0 0 1 4 4l-7 7a1.4 1.4 0 0 1-2-2l6.4-6.4`],comment:[`M5 5h14v10H9l-4 4z`],at:[`M12 8a4 4 0 1 0 0 8a4 4 0 1 0 0-8z`,`M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-3.5 7.1`],bold:[`M7 5h6a3.5 3.5 0 0 1 0 7H7z`,`M7 12h7a3.5 3.5 0 0 1 0 7H7z`],italic:[`M10 5h8`,`M6 19h8`,`M14 5l-4 14`],strike:[`M5 12h14`,`M16 7.5A3.5 3 0 0 0 12.5 5h-1A3.5 3 0 0 0 8 8c0 4 8 3 8 7.5a3.5 3.5 0 0 1-3.5 3.5h-1A3.5 3 0 0 1 8 16.5`],underline:[`M7 4v7a5 5 0 0 0 10 0V4`,`M5 20h14`],"list-ordered":[`M10 6h10`,`M10 12h10`,`M10 18h10`,`M4 5l1.5-1v5`,`M4 15.5a1.5 1.5 0 0 1 3 .5L4 19h3`],divider:[`M4 12h16`],globe:[`M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z`,`M3 12h18`,`M12 3c2.5 2.5 3.5 5.5 3.5 9s-1 6.5-3.5 9`,`M12 3C9.5 5.5 8.5 8.5 8.5 12s1 6.5 3.5 9`],bell:[`M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z`,`M10 20a2 2 0 0 0 4 0`],"bell-off":[`M6 16V11a6 6 0 0 1 9.5-4.9`,`M18 11v5l1.5 2H8`,`M10 20a2 2 0 0 0 4 0`,`M4 4l16 16`],smile:[`M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z`,`M8.5 14a4 4 0 0 0 7 0`,`M9 9.5h.01`,`M15 9.5h.01`],reply:[`M9 7L4 12l5 5`,`M4 12h10a6 6 0 0 1 6 6v1`],pencil:[`M15 5l4 4L8Line truncated
`).map(e=>!e.includes(`|`)||!e.includes("`")?e:p P(e)).join(`
`)}function h P(e){return(e||``).replaceAll(` `,` `).replace(/\s+/g,` `).trim()}function g P(e,t){return t?e.split(t).join(`
`):e}function _ P(e){return e.replace(/\\.|\|/g,e=>e===`|`?`\\|`:e)}function v P(e,t,n={}){if(!e||!e.content||e.content.length===0)return``;let r=[];e.content.forEach(e=>{let i=[];e.content& & e.content.forEach(e=>{let r=``;r=e.content& & Array.isArray(e.content)& & e.content.length>1?e.content.map(e=>g P(t.renderChildren(e),n.cellLineSeparator)).join(`
`):g P(e.content?t.renderChildren(e.content):``,n.cellLineSeparator);let a=_ P(h P(r.replace(/[ \t]*\r?\n[ \t]*/g,`< br > `))),o=e.type===`tableHeader`,s=K N(e.attrs);i.push({text:a,isHeader:o,align:s})}),r.push(i)});let i=r.reduce((e,t)=>Math.max(e,t.length),0);if(i===0)return``;let a=Array.from({length:i}).fill(0);r.forEach(e=>{for(let t=0;t< i ; t + = 1 ) { let n = (e[t]?.text||``).length;n > a[t]&&(a[t]=n),a[t]<3&&(a[t]=3)}}); let o=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),s=r[0],c=s.some(e=>e.isHeader),l=Array.from({length:i}).fill(null);r.forEach(e=>{for(let t=0;t< i ; t + = 1 ) ! l [ t ] & & e [ t ] ? . align & & ( l [ t ] = e [ t ] . align ) } ) ; let u = `
`,d=Array.from({length:i}).map((e,t)=>c&&s[t]&&s[t].text||``); return u+=`| ${d.map((e,t)=>o(e,a[t])).join(` | `)} |\n`,u+=`| ${a.map((e,t)=>{let n=Math.max(3,e),r=l[t];return r===`left`?`:${`-`.repeat(n)}`:r===`right`?`${`-`.repeat(n)}:`:r===`center`?`:${`-`.repeat(n)}:`:`-`.repeat(n)}).join(` | `)} |\n`,(c?r.slice(1):r).forEach(e=>{u+=`| ${Array.from({length:i}).fill(0).map((t,n)=>o(e[n]& & e[n].text||``,a[n])).join(` | `)} |\n`}),u}var y P=new Un(`preserveCellSelectionOnContextMenu`);function b P(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(n)return n.pos;if(!(t.target instanceof Node))return null;try{return e.posAtDOM(t.target,0)}catch{return null}}function x P(e,t){let n=!1;return e.forEachCell((e,r)=>{t>=r& & t< r + e . nodeSize & & ( n = !0)}),n}function SP ( ) { return new D ( { key:y P , props: { handleDOMEvents: { mousedown ( e , t ) { if ( t . button ! = = 2 ) return ! 1 ; let { selection:n } = e . state ; if ( ! uP ( n ) | | n . ranges . length < 2 ) return ! 1 ; let r = b P(e,t);return r = =null||!x P(n,r)?!1:(t.preventDefault(),!0)}}}})}var CP = Jp.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:a P,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=o P(e,this.options.cellMinWidth),a=t.style;function o ( ) { return a | | ( r ? ` width: $ { r } ` : ` min-width: $ { i } ` ) } let s = [`table`,A(this.options.HTMLAttributes,t,{style:o()}),n,[`tbody`,0]];return this . options . renderWrapper ? [ ` div ` , { class: ` tableWrapper ` } , s ] :s } , parseMarkdown: ( e , t ) = > {let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{let a=W N(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableHeader`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}return e.rows& & e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{let a=W N(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableCell`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}),t.createNode(`table`,void 0,n)},renderMarkdown:(e,t)=>v P(e,t),markdownTokenizer:{name:`table`,level:`block`,start:e=>{let t=e.split(`
`))};return s(n),{dom:r,contentDOM:a,update:e=>e.type===n.type& & (s(e),!0),ignoreMutation:e=>i.contains(e.target)}}}}),Rj=(e,t)=>e===`application/pdf`||typeof t==`string`&&/\.pdf$/i.test(t); function zj(e,t,n,r){let i=!1,a=null,o=null,s=document.createElement(`div`);return s.className=`dw-pdf__status`,s.textContent=r.blocks.pdfLoading,e.replaceChildren(s),(async()=>{try{let c=await n();if(i)return;o=c.getDocument({url:t});let l=await o.promise;if(i)return;s.remove();let u=Math.max(e.clientWidth-2,200),d=window.devicePixelRatio||1;a=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=t.target;a?.unobserve(e),p(e,Number(e.dataset.page))}},{root:e,rootMargin:`400px 0px`});let f=(await l.getPage(1)).getViewport({scale:1});for(let t=1;t< =l.numPages;t++){let n=document.createElement(`div`);n.className=`dw-pdf__page`,n.dataset.page=String(t),n.style.aspectRatio=`${f.width} / ${f.height}`,n.setAttribute(`aria-label`,r.blocks.pdfPage.replace(`{n}`,String(t))),e.append(n),a.observe(n)}async function p(e,t){let n=await l.getPage(t);if(i)return;let r=u/n.getViewport({scale:1}).width,a=n.getViewport({scale:r*d}),o=document.createElement(`canvas`);o.width=Math.floor(a.width),o.height=Math.floor(a.height),e.style.aspectRatio=`${a.width} / ${a.height}`,e.append(o),await n.render({canvas:o,viewport:a}).promise}}catch{i||(s.textContent=r.blocks.loadFailed)}})(),()=>{i=!0,a?.disconnect(),o?.destroy()}}var Bj={page:[`M6 3h8l4 4v14H6z`,`M14 3v4h4`,`M9 12h6`,`M9 16h6`],"chevron-right":[`M10 6l6 6-6 6`],"chevron-left":[`M14 6l-6 6 6 6`],"chevron-down":[`M6 10l6 6 6-6`],"chevron-up":[`M6 14l6-6 6 6`],plus:[`M12 5v14`,`M5 12h14`],search:[`M11 4a7 7 0 1 0 0 14a7 7 0 1 0 0-14z`,`M16.5 16.5L20 20`],more:[`M6 12h.01`,`M12 12h.01`,`M18 12h.01`],drop:[`M12 4h7v7a7 7 0 1 1-7-7z`],info:[`M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z`,`M12 11v5`,`M12 8h.01`],check:[`M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z`,`M8 12.5l2.5 2.5L16 9.5`],alert:[`M12 4l9 16H3z`,`M12 10v4`,`M12 17h.01`],error:[`M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z`,`M9 9l6 6`,`M15 9l-6 6`],text:[`M5 6h14`,`M12 6v13`],heading:[`M6 5v14`,`M18 5v14`,`M6 12h12`],list:[`M9 6h11`,`M9 12h11`,`M9 18h11`,`M4.5 6h.01`,`M4.5 12h.01`,`M4.5 18h.01`],todo:[`M4 4h7v7H4z`,`M5.5 7.5l1.5 1.5 2.5-2.5`,`M14 7h6`,`M4 14h7v7H4z`,`M14 17h6`],code:[`M9 7l-5 5 5 5`,`M15 7l5 5-5 5`],quote:[`M6 6v12`,`M10 8h9`,`M10 12h9`,`M10 16h6`],image:[`M4 5h16v14H4z`,`M4 16l5-5 4 4 2-2 5 5`,`M15.5 8.5h.01`],table:[`M4 5h16v14H4z`,`M4 10h16`,`M4 15h16`,`M10 5v14`],lock:[`M6 11h12v9H6z`,`M8.5 11V8a3.5 3.5 0 0 1 7 0v3`],trash:[`M4 7h16`,`M10 4h4`,`M6 7l1 13h10l1-13`,`M10 11v6`,`M14 11v6`],settings:[`M4 7h9`,`M17 7h3`,`M15 5v4`,`M4 17h3`,`M11 17h9`,`M9 15v4`],menu:[`M4 7h16`,`M4 12h16`,`M4 17h16`],close:[`M6 6l12 12`,`M18 6L6 18`],open:[`M8 16L16 8`,`M9 8h7v7`],restore:[`M4.5 13a7.5 7.5 0 1 0 2.2-6.3`,`M5 4v4h4`],"sign-out":[`M14 4h5v16h-5`,`M10 8l-4 4 4 4`,`M6 12h9`],sidebar:[`M4 5h16v14H4z`,`M9.5 5v14`],home:[`M4 11l8-7 8 7`,`M6 9.5V20h12V9.5`,`M10 20v-5h4v5`],sun:[`M12 8a4 4 0 1 0 0 8a4 4 0 1 0 0-8z`,`M12 3v1.5`,`M12 19.5V21`,`M3 12h1.5`,`M19.5 12H21`,`M5.6 5.6l1.1 1.1`,`M17.3 17.3l1.1 1.1`,`M5.6 18.4l1.1-1.1`,`M17.3 6.7l1.1-1.1`],moon:[`M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z`],monitor:[`M4 5h16v11H4z`,`M9 20h6`,`M12 16v4`],selector:[`M8 9l4-4 4 4`,`M8 15l4 4 4-4`],star:[`M12 4l2.5 5.2 5.5.8-4 3.9.9 5.6L12 16.9l-4.9 2.6.9-5.6-4-3.9 5.5-.8z`],clock:[`M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z`,`M12 7v5l3 2`],calendar:[`M5 5h14a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z`,`M4 10h16`,`M8 3v4`,`M16 3v4`],share:[`M12 4v11`,`M8 8l4-4 4 4`,`M6 13v7h12v-7`],link:[`M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1`,`M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1`],upload:[`M12 16V4`,`M7 9l5-5 5 5`,`M4 20h16`],download:[`M12 4v12`,`M7 11l5 5 5-5`,`M4 20h16`],file:[`M6 3h8l4 4v14H6z`,`M14 3v4h4`],paperclip:[`M18 11.5l-6.4 6.4a4.2 4.2 0 0 1-6-6l7-7a2.8 2.8 0 0 1 4 4l-7 7a1.4 1.4 0 0 1-2-2l6.4-6.4`],comment:[`M5 5h14v10H9l-4 4z`],at:[`M12 8a4 4 0 1 0 0 8a4 4 0 1 0 0-8z`,`M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-3.5 7.1`],bold:[`M7 5h6a3.5 3.5 0 0 1 0 7H7z`,`M7 12h7a3.5 3.5 0 0 1 0 7H7z`],italic:[`M10 5h8`,`M6 19h8`,`M14 5l-4 14`],strike:[`M5 12h14`,`M16 7.5A3.5 3 0 0 0 12.5 5h-1A3.5 3 0 0 0 8 8c0 4 8 3 8 7.5a3.5 3.5 0 0 1-3.5 3.5h-1A3.5 3 0 0 1 8 16.5`],underline:[`M7 4v7a5 5 0 0 0 10 0V4`,`M5 20h14`],"list-ordered":[`M10 6h10`,`M10 12h10`,`M10 18h10`,`M4 5l1.5-1v5`,`M4 15.5a1.5 1.5 0 0 1 3 .5L4 19h3`],divider:[`M4 12h16`],globe:[`M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z`,`M3 12h18`,`M12 3c2.5 2.5 3.5 5.5 3.5 9s-1 6.5-3.5 9`,`M12 3C9.5 5.5 8.5 8.5 8.5 12s1 6.5 3.5 9`],bell:[`M6 16V11a6 6 0 0 1 12 0v5l1.5 2h-15z`,`M10 20a2 2 0 0 0 4 0`],"bell-off":[`M6 16V11a6 6 0 0 1 9.5-4.9`,`M18 11v5l1.5 2H8`,`M10 20a2 2 0 0 0 4 0`,`M4 4l16 16`],smile:[`M12 3a9 9 0 1 0 0 18a9 9 0 1 0 0-18z`,`M8.5 14a4 4 0 0 0 7 0`,`M9 9.5h.01`,`M15 9.5h.01`],reply:[`M9 7L4 12l5 5`,`M4 12h10a6 6 0 0 1 6 6v1`],pencil:[`M15 5l4 4L8Line truncated
`).map(e=>!e.includes(`|`)||!e.includes("`")?e:g P(e)).join(`
`)}function v P(e){return(e||``).replaceAll(` `,` `).replace(/\s+/g,` `).trim()}function y P(e,t){return t?e.split(t).join(`
`):e}function b P(e){return e.replace(/\\.|\|/g,e=>e===`|`?`\\|`:e)}function x P(e,t,n={}){if(!e||!e.content||e.content.length===0)return``;let r=[];e.content.forEach(e=>{let i=[];e.content& & e.content.forEach(e=>{let r=``;r=e.content& & Array.isArray(e.content)& & e.content.length>1?e.content.map(e=>y P(t.renderChildren(e),n.cellLineSeparator)).join(`
`):y P(e.content?t.renderChildren(e.content):``,n.cellLineSeparator);let a=b P(v P(r.replace(/[ \t]*\r?\n[ \t]*/g,`< br > `))),o=e.type===`tableHeader`,s=Y N(e.attrs);i.push({text:a,isHeader:o,align:s})}),r.push(i)});let i=r.reduce((e,t)=>Math.max(e,t.length),0);if(i===0)return``;let a=Array.from({length:i}).fill(0);r.forEach(e=>{for(let t=0;t< i ; t + = 1 ) { let n = (e[t]?.text||``).length;n > a[t]&&(a[t]=n),a[t]<3&&(a[t]=3)}}); let o=(e,t)=>e+` `.repeat(Math.max(0,t-e.length)),s=r[0],c=s.some(e=>e.isHeader),l=Array.from({length:i}).fill(null);r.forEach(e=>{for(let t=0;t< i ; t + = 1 ) ! l [ t ] & & e [ t ] ? . align & & ( l [ t ] = e [ t ] . align ) } ) ; let u = `
`,d=Array.from({length:i}).map((e,t)=>c&&s[t]&&s[t].text||``); return u+=`| ${d.map((e,t)=>o(e,a[t])).join(` | `)} |\n`,u+=`| ${a.map((e,t)=>{let n=Math.max(3,e),r=l[t];return r===`left`?`:${`-`.repeat(n)}`:r===`right`?`${`-`.repeat(n)}:`:r===`center`?`:${`-`.repeat(n)}:`:`-`.repeat(n)}).join(` | `)} |\n`,(c?r.slice(1):r).forEach(e=>{u+=`| ${Array.from({length:i}).fill(0).map((t,n)=>o(e[n]& & e[n].text||``,a[n])).join(` | `)} |\n`}),u}var S P=new Un(`preserveCellSelectionOnContextMenu`);function C P(e,t){let n=e.posAtCoords({left:t.clientX,top:t.clientY});if(n)return n.pos;if(!(t.target instanceof Node))return null;try{return e.posAtDOM(t.target,0)}catch{return null}}function w P(e,t){let n=!1;return e.forEachCell((e,r)=>{t>=r& & t< r + e . nodeSize & & ( n = !0)}),n}function TP ( ) { return new D ( { key:S P , props: { handleDOMEvents: { mousedown ( e , t ) { if ( t . button ! = = 2 ) return ! 1 ; let { selection:n } = e . state ; if ( ! pP ( n ) | | n . ranges . length < 2 ) return ! 1 ; let r = C P(e,t);return r = =null||!w P(n,r)?!1:(t.preventDefault(),!0)}}}})}var EP = Jp.create({name:`table`,addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:c P,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:`tableRow+`,tableRole:`table`,isolating:!0,group:`block`,parseHTML(){return[{tag:`table`}]},renderHTML({node:e,HTMLAttributes:t}){let{colgroup:n,tableWidth:r,tableMinWidth:i}=l P(e,this.options.cellMinWidth),a=t.style;function o ( ) { return a | | ( r ? ` width: $ { r } ` : ` min-width: $ { i } ` ) } let s = [`table`,A(this.options.HTMLAttributes,t,{style:o()}),n,[`tbody`,0]];return this . options . renderWrapper ? [ ` div ` , { class: ` tableWrapper ` } , s ] :s } , parseMarkdown: ( e , t ) = > {let n=[],r=Array.isArray(e.align)?e.align:[];if(e.header){let i=[];e.header.forEach((e,n)=>{let a=q N(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableHeader`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}return e.rows& & e.rows.forEach(e=>{let i=[];e.forEach((e,n)=>{let a=q N(r[n]??e.align),o=a?{align:a}:{};i.push(t.createNode(`tableCell`,o,[{type:`paragraph`,content:t.parseInline(e.tokens)}]))}),n.push(t.createNode(`tableRow`,{},i))}),t.createNode(`table`,void 0,n)},renderMarkdown:(e,t)=>x P(e,t),markdownTokenizer:{name:`table`,level:`block`,start:e=>{let t=e.split(`
`);if(t.length< 2 ) return-1 ; let n = t[1];return!/^[ \ t | : ] * - [ \ t | :- ] * $ / . test ( n ) | | ! n . includes ( ` | ` ) ? -1:t [ 0 ] . includes ( ` | ` ) ? 0:-1 } , tokenize ( e , t , n ) { let r = e.indexOf(`
`),i=r>=0?e.slice(0,r):e,a=i.split(`
`);if(a.length< 2 ) return ; let o = a[1];if(!/^[ \ t | : ] * - [ \ t | :- ] * $ / . test ( o ) | | ! o . includes ( ` | ` ) ) return ; let s = m P(i);if(s===i)return;let c = n.blockTokens(s)[0];if(c?.type!==`table`||!c.raw)return;let l = c.raw.split(`
`);if(a.length< 2 ) return ; let o = a[1];if(!/^[ \ t | : ] * - [ \ t | :- ] * $ / . test ( o ) | | ! o . includes ( ` | ` ) ) return ; let s = _ P(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=lP(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(T.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>RM(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>zM(e,t),deleteColumn:()=>({state:e,dispatch:t})=>{let n=vu(e.selection.$from,e=>e.type.name===`table`);return VM(e,t& & (e=>{n& & fP(e,n.pos),t(e)}))},addRowBefore:()=>({state:e,dispatch:t})=>WM(e,t),addRowAfter:()=>({state:e,dispatch:t})=>GM(e,t),deleteRow:()=>({state:e,dispatch:t})=>{let n=vu(e.selection.$from,e=>e.type.name===`table`);return qM(e,t& & (e=>{n& & fP(e,n.pos),t(e)}))},deleteTable:()=>({state:e,dispatch:t})=>oN(e,t),mergeCells:()=>({state:e,dispatch:t})=>XM(e,t),splitCell:()=>({state:e,dispatch:t})=>ZM(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>nN(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>nN(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>rN(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>XM(e,t)?!0:ZM(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>$M(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>aN(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>aN(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t& & PM(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=EM.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:dP,"Mod-Backspace":dP,Delete:dP,"Mod-Delete":dP}},addProseMirrorPlugins(){return[...this.options.resizable& & this.editor.isEditable?[kN({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:null,lastColumnResizable:this.options.lastColumnResizable})]:[],UN({allowTableNodeSelection:this.options.allowTableNodeSelection}),SP()]},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}))}}}),wP=Tp.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1& & e.push(CP.configure(this.options.table)),this.options.tableCell!==!1& & e.push(eP.configure(this.options.tableCell)),this.options.tableHeader!==!1& & e.push(tP.configure(this.options.tableHeader)),this.options.tableRow!==!1& & e.push(nP.configure(this.options.tableRow)),e}}),TP=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 EP(){return[Lk.configure({HTMLAttributes:{class:`dw-tasks`}}),Ik.configure({nested:!0})]}function DP(){return[wP.configure({table:{resizable:!0,cellMinWidth:60,HTMLAttributes:{class:`dw-table`}}})]}var OP=TP.configure({types:[`heading`,`paragraph`],alignments:[`left`,`center`,`right`]}),kP=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}}),AP=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,jP=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,MP=_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
`)){if(!o){a.push(``);continue}let e=``;for(let s of o.split(/(\s+)/)){let o=e+s;if(!e||XF(o,t,r,i)< =n)e=o;else for(a.push(e.trimEnd()),e=s.trimStart();e&&XF(e,t,r,i)>n; ){let o=e.length-1;for(;o>1&&XF(e.slice(0,o),t,r,i)>n; )o--;a.push(e.slice(0,o)),e=e.slice(o)}}a.push(e)}return a}function QF(e,t){let n=t===0?18:15,r=t===0?600:400,i=ZF(e||` `,n,260,KF,r),a=Math.max(...i.map(e=>XF(e,n,KF,r)),t===0?60:40);return{w:Math.ceil(a)+(t===0?32:24),h:i.length*Math.round(n*1.4)+(t===0?20:14)}}var $F=56,eI=14;function tI(e){let t=Object.entries(e).filter(([,t])=>!t.parent||!e[t.parent]);return t.sort((e,t)=>e[1].pos-t[1].pos||(e[0]< t [ 0 ] ? -1:1 ) ) , t [ 0 ] ? . [ 0 ] ? ? null } function nI ( e , t ) { return Object . entries ( e ) . filter ( ( [ e , n ] ) = > n.parent===t& & e!==t).sort((e,t)=>e[1].pos-t[1].pos||(e[0]< t [ 0 ] ? -1:1 ) ) . map ( ( [ e ] ) = > e)}function rI(e,t,n){let r=tI(e),i=new Map,a=[];if(!r)return{root:``,boxes:i,edges:a,bounds:{x:0,y:0,w:0,h:0}};let o=new Map,s=new Set,c=(t,r)=>{if(!(s.has(t)||r>50)){s.add(t),o.set(t,n(e[t].text,r));for(let n of nI(e,t))c(n,r+1)}};c(r,0);let l=t=>nI(e,t).filter(e=>o.has(e)),u=new Map,d=e=>{let t=u.get(e);if(t!==void 0)return t;let n=l(e),r=n.reduce((e,t)=>e+d(t),0)+eI*Math.max(0,n.length-1),i=Math.max(o.get(e).h,r);return u.set(e,i),i},f=(e,t,n,r,a,s)=>{let c=o.get(e),u=a===1?t:t-c.w;i.set(e,{id:e,x:u,y:n-c.h/2,w:c.w,h:c.h,depth:r,dir:a,parent:s}),p(e,l(e),a===1?u+c.w+$F:u-$F,n,r+1,a)},p=(e,t,n,r,i,a)=>{let o=r-(t.reduce((e,t)=>e+d(t),0)+eI*Math.max(0,t.length-1))/2;for(let r of t){let t=d(r);f(r,n,o+t/2,i,a,e),o+=t+eI}},m=o.get(r);i.set(r,{id:r,x:0,y:0,w:m.w,h:m.h,depth:0,dir:1,parent:``});let h=m.h/2,g=l(r);if(t===`right`)p(r,g,m.w+$F,h,1,1);else if(t===`left`)p(r,g,-56,h,1,-1);else{let e=Math.ceil(g.length/2);p(r,g.slice(0,e),m.w+$F,h,1,1),p(r,g.slice(e),-56,h,1,-1)}for(let e of i.values()){if(!e.parent)continue;let t=i.get(e.parent),n=e.dir===1?[t.x+t.w,t.y+t.h/2]:[t.x,t.y+t.h/2],r=e.dir===1?[e.x,e.y+e.h/2]:[e.x+e.w,e.y+e.h/2];a.push({from:n,to:r,child:e.id})}let _=1/0,v=1/0,y=-1/0,b=-1/0;for(let e of i.values())_=Math.min(_,e.x),v=Math.min(v,e.y),y=Math.max(y,e.x+e.w),b=Math.max(b,e.y+e.h);return{root:r,boxes:i,edges:a,bounds:{x:_,y:v,w:y-_,h:b-v}}}function iI(e,t,n,r){let i=e.boxes.get(n);if(!i)return null;if(r===`ArrowUp`||r===`ArrowDown`){let a=i.parent?nI(t,i.parent).filter(t=>e.boxes.get(t)?.dir===i.dir):[];return a[a.indexOf(n)+(r===`ArrowUp`?-1:1)]??null}let a=r===`ArrowRight`?1:-1;return i.parent?a===i.dir?nI(t,n)[0]??null:i.parent:nI(t,n).find(t=>e.boxes.get(t)?.dir===a)??null}function aI(e,t){let n=(e[0]+t[0])/2;return`M${e[0]} ${e[1]} C${n} ${e[1]} ${n} ${t[1]} ${t[0]} ${t[1]}`}function oI(e,t,n,r=e=>e){return e*r(.5-t*(.5-n))}function sI(e){return[-e[0],-e[1]]}function cI(e,t){return[e[0]+t[0],e[1]+t[1]]}function lI(e,t){return[e[0]-t[0],e[1]-t[1]]}function uI(e,t){return[e[0]*t,e[1]*t]}function dI(e,t){return[e[0]/t,e[1]/t]}function fI(e){return[e[1],-e[0]]}function pI(e,t){return e[0]*t[0]+e[1]*t[1]}function mI(e,t){return e[0]===t[0]& & e[1]===t[1]}function hI(e){return Math.hypot(e[0],e[1])}function gI(e){return e[0]*e[0]+e[1]*e[1]}function _I(e,t){return gI(lI(e,t))}function vI(e){return dI(e,hI(e))}function yI(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function bI(e,t,n){let r=Math.sin(n),i=Math.cos(n),a=e[0]-t[0],o=e[1]-t[1],s=a*i-o*r,c=a*r+o*i;return[s+t[0],c+t[1]]}function xI(e,t,n){return cI(e,uI(lI(t,e),n))}function SI(e,t,n){return cI(e,uI(t,n))}var{min:CI,PI:wI}=Math,TI=.275,EI=wI+1e-4;function DI(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:a=!0,easing:o=e=>e,start:s={},end:c={},last:l=!1}=t,{cap:u=!0,easing:d=e=>e*(2-e)}=s,{cap:f=!0,easing:p=e=>--e*e*e+1}=c;if(e.length===0||n< =0)return[];let m=e[e.length-1].runningLength,h=s.taper===!1?0:s.taper===!0?Math.max(n,m):s.taper,g=c.taper===!1?0:c.taper===!0?Math.max(n,m):c.taper,_=(n*r)**2,v=[],y=[],b=e.slice(0,10).reduce((e,t)=>{let r=t.pressure;if(a){let i=CI(1,t.distance/n);r=CI(1,e+(CI(1,1-i)-e)*(i*TI))}return(e+r)/2},e[0].pressure),x=oI(n,i,e[e.length-1].pressure,o),S,C=e[0].vector,ee=e[0].point,te=ee,ne=ee,re=te,ie=!1;for(let t=0;t< e.length ; t + + ) { let { pressure:r } = e [ t ] , { point:s , vector:c , distance:l , runningLength:u } = e [ t ] ; if ( t < e . length-1 & & m-u < 3 ) continue ; if ( i ) { if ( a ) { let e = CI(1,l/n),t=CI(1,1-e);r=CI(1,b+(t-b)*(e*TI))}x=oI(n,i,r,o)}else x = n/2;S===void 0 & & ( S = x);let f = u<h?d(u/h):1,ae=m-u<g?p((m-u)/g):1;x=Math.max(.01,x*Math.min(f,ae));let oe = (t<e.length-1?e[t+1]:e[t]).vector,se=t<e.length-1?pI(c,oe):1,ce=pI(c,C)<0&&!ie,le=se!==null&&se<0;if(ce||le){let e = uI(fI(C),x);for(let t = 0;t<=1;t+=.07692307692307693)ne=bI(lI(s,e),s,EI*t),v.push(ne),re=bI(cI(s,e),s,EI*-t),y.push(re);ee=ne,te=re,le&&(ie=!0);continue}if(ie=!1,t===e.length-1){let e = uI(fI(c),x);v.push(lI(s,e)),y.push(cI(s,e));continue}let ue = uI(fI(xI(oe,c,se)),x);ne=lI(s,ue),(t<=1||_I(ee,ne) > _)& & (v.push(ne),ee=ne),re=cI(s,ue),(t< =1||_I(te,re)>_)& & (y.push(re),te=re),b=r,C=c}let ae=e[0].point.slice(0,2),oe=e.length>1?e[e.length-1].point.slice(0,2):cI(e[0].point,[1,1]),se=[],ce=[];if(eLine truncated
`:n(e)).join(``),r=(e,i)=>{for(let a of e)if(a.type===`heading`){let e=Number(a.attrs?.level)||1;t.push({text:n(a),size:[0,26,21,18,16,16,16][e]??16,weight:650})}else if(a.type===`paragraph`)t.push({text:i+n(a),size:15,weight:400});else if(a.type===`listItem`||a.type===`taskItem`){let e=a.type===`taskItem`?a.attrs?.checked?`☑ `:`☐ `:`• `,[i,...o]=a.content??[];i& & t.push({text:e+n(i),size:15,weight:400}),r(o,` `)}else a.type===`codeBlock`?t.push({text:n(a),size:13,weight:400}):a.content?.length&&r(a.content,i)}; return r(e,``),t}function d R(e,t,n,r,i,a,o=400,s=`start`){let c=Math.round(r*1.35);return n.map((n,l)=>`< text x = "${e}" y = "${t+r+l*c}" font-size = "${r}" font-family = "${P L(a)}" font-weight = "${o}" fill = "${i}" text-anchor = "${s}" xml:space = "preserve" > ${P L(n)}< / text > `).join(``)}async function f R(e){if(e.startsWith(`data:`))return e;try{let t=await fetch(e,{credentials:`include`});if(!t.ok)return null;let n=await t.blob();return await new Promise(e=>{let t=new FileReader;t.onload=()=>e(typeof t.result==`string`?t.result:null),t.onerror=()=>e(null),t.readAsDataURL(n)})}catch{return null}}async function p R(e){let t=l R(e.root),n=e.elements.filter(e=>e.type!==`group`),r=H P(V P(n.map(t=>e.boxOf(t)))??{x:0,y:0,w:400,h:300},32),i=t(`ink`,`line`),a=[];for(let r of n){let n=e.boxOf(r),o=r.rotate?` rotate(${r.rotate} ${n.w/2} ${n.h/2})`:``,s=e=>`< g transform = "translate(${n.x} ${n.y})${o}" > ${e}< / g > `;switch(r.type){case`shape`:{let e=ZF (r.text,r.fontSize,Math.max(20,n.w-16)),i=Math.round(r.fontSize*1.35),o=n.h/2-e.length*i/2-r.fontSize*.25;a.push(s(H L(r,t)+(r.text?d R(n.w/2,o,e,r.fontSize,t(r.textColor,`line`),K F,400,`middle`):``)));break}case`text`:{let e=Y F(r.font),i=r.w?ZF (r.text,r.fontSize,r.w,e):r.text.split(`
`),o=r.align===`center`?n.w/2:r.align===`right`?n.w:0,c=r.align===`center`?`middle`:r.align===`right`?`end`:`start`;a.push(s(dR(o,0,i,r.fontSize,t(r.color,`line`),e,r.bold?650:400,c)));break}case`connector`:{let n=e.routeOf(r);if(a.push(WL(r,n,t)),r.label){let e=Math.min(240,r.label.length*8+16);a.push(`< rect x = "${n.mid[0]-e/2}" y = "${n.mid[1]-12}" width = "${e}" height = "24" rx = "4" fill = "${t(`paper`,`line`)}" / > `+dR(n.mid[0],n.mid[1]-12+3,[r.label],13,i,KF,400,`middle`))}break}case`brush`:a.push(s(KL(r,t)));break;case`frame`:a.push(s(`< rect width = "${n.w}" height = "${n.h}" rx = "8" fill = "${t(r.background,`fill`)===`none`?`none`:t(r.background,`fill`)}" stroke = "${t(`gray`,`line`)}" stroke-width = "1.5" / > `+dR(4,-24,[r.title],13,t(`gray`,`line`),KF,600)));break;case`note`:{let o=e.noteBody(r),c=o?uR(qL(o)):[],l=18,u=`< rect width = "${n.w}" height = "${n.h}" rx = "8" fill = "${t(r.background,`fill`)}" stroke = "${t(`gray`,`fill`)}" / > `;if(r.page& & e.pageTitle){let t=ZF(e.pageTitle,26,n.w-48,KF,650);u+=dR(24,l-4,t,26,i,KF,650),l+=t.length*35+8}for(let e of c){let t=ZF(e.text,e.size,n.w-48,KF,e.weight);if(u+=dR(24,l,t,e.size,i,KF,e.weight),l+=t.length*Math.round(e.size*1.35)+8,l>n.h-12)break}a.push(s(u));break}case`image`:{let i=await fR(e.resolve(r.src));a.push(s(i?`< image href = "${PL(i)}" width = "${n.w}" height = "${n.h}" preserveAspectRatio = "xMidYMid meet" / > `:`< rect width = "${n.w}" height = "${n.h}" fill = "${t(`ink`,`fill`)}" / > `));break}case`embed`:a.push(s(`< rect width = "${n.w}" height = "${n.h}" rx = "8" fill = "${t(`paper`,`fill`)}" stroke = "${t(`gray`,`fill`)}" / > `+dR(16,16,ZF(r.url,13,n.w-32),13,t(`blue`,`line`),KF)));break;case`mindmap`:{let n=e.layoutOf(r),o=t(r.color,`line`),s=t(r.color,`fill`),c=n.edges.map(e=>`< path d = "${aI(e.from,e.to)}" fill = "none" stroke = "${o}" stroke-width = "2" / > `).join(``);for(let e of n.boxes.values()){let n=e.depth===0?18:15,a=e.depth===0?600:400,l=e.depth===0?o:e.depth===1?s:t(`paper`,`line`),u=e.depth===0?t(`paper`,`line`):i;c+=`< rect x = "${e.x}" y = "${e.y}" width = "${e.w}" height = "${e.h}" rx = "${e.depth===0?10:8}" fill = "${l}" stroke = "${o}" stroke-width = "${e.depth===0?0:1.5}" / > `;let d=ZF(r.nodes[e.id]?.text||` `,n,260,KF,a);c+=dR(e.x+e.w/2,e.y+(e.h-d.length*Math.round(n*1.4))/2-2,d,n,u,KF,a,`middle`)}a.push(`< g transform = "translate(${r.x} ${r.y})" > ${c}< / g > `);break}}}return{svg:`< svg xmlns = "http://www.w3.org/2000/svg" width = "${Math.ceil(r.w)}" height = "${Math.ceil(r.h)}" viewBox = "${r.x} ${r.y} ${r.w} ${r.h}" > < rect x = "${r.x}" y = "${r.y}" width = "${r.w}" height = "${r.h}" fill = "${t(`paper`,`line`)}" / > ${a.join(``)}< / svg > `,box:r}}async function mR(e,t){let{svg:n,box:r}=await pR(t),i=new Blob([n],{type:`image/svg+xml`});if(e===`svg`)return i;let a=Math.min(2,8192/Math.max(r.w,r.h,1)),o=URL.createObjectURL(i);try{let e=await new Promise((e,t)=>{let n=new Image;n.onload=()=>e(n),n.onerror=()=>t(Error(`could not draw the canvas`)),n.src=o}),t=document.createElement(`canvas`);t.width=Math.ceil(r.w*a),t.height=Math.ceil(r.h*a);let n=t.getContext(`2d`);if(!n)throw Error(`could not draw the canvas`);return n.drawImage(e,0,0,t.width,t.height),await new Promise((e,n)=>t.toBlob(t=>t?e(t):n(Error(`could not draw the canvas`)),`image/png`))}finally{URL.revokeObjectURL(o)}}var hR=.1,gR=4,_R=`http://www.w3.org/2000/svg`,vR=e=>e instanceof HTMLElement&&(e.isContentEditable||e.tagName===`INPUT`||e.tagName===`TEXTAREA`),yR=class{opts; store;labels;root;styles;editable;tool=`select`;shapeKind;selected=new Set;activeNode=null;editing=null;entered=null;world;overlay;ui;view={x:0,y:0,zoom:1};rendered=new Map;measured=new Map;layouts=new Map;routes=new Map;previews=new Map;drag=null;guides=[];marquee=null;hover=null;raf=0;spaceDown=!1;pointers=new Map;pinch=null;presenting=null;comments=[];activeComment=``;resize=typeof ResizeObserver>`u`?null:new ResizeObserver(e=>this.onResize(e));unsub;cleanups=[];saveTimer;constructor(e,t){this.opts=t,this.labels=t.labels??dF,this.editable=t.editable,this.styles=PF(t.styles),this.shapeKind=this.styles.shape.shape,this.store=new tR(t.doc,{undo:t.undo!==!1}),this.root=document.createElement(`div`),this.root.className=`dw-cv`,this.root.tabIndex=0,this.root.setAttribute(`role`,`application`),this.root.dataset.testid=`edgeless-canvas`,this.world=document.createElement(`div`),this.world.className=`dw-cv-world`,this.overlay=document.createElementNS(_R,`svg`),this.overlay.classList.add(`dw-cv-overlay`),this.root.append(this.world,this.overlay),e.append(this.root),this.ui=new cR(this),this.root.classList.toggle(`dw-cv-readonly`,!this.editable),this.unsub=this.store.onChange(()=>this.schedule()),this.listen(),this.render(),this.restoreView()||this.fit(void 0,!1),this.applyView()}destroy(){cancelAnimationFrame(this.raf),clearTimeout(this.saveTimer),this.saveView(),this.unsub(),this.resize?.disconnect();for(let e of this.cleanups)e();for(let e of this.rendered.values())e.note?.destroy();this.rendered.clear(),this.ui.destroy(),this.store.destroy(),this.root.remove()}setEditable(e){if(e!==this.editable){this.editable=e,this.roLine 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=fP(a.schema,e,t,n);if(i){let e=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(T.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>VM(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>HM(e,t),deleteColumn:()=>({state:e,dispatch:t})=>{let n=vu(e.selection.$from,e=>e.type.name===`table`);return WM(e,t& & (e=>{n& & hP(e,n.pos),t(e)}))},addRowBefore:()=>({state:e,dispatch:t})=>qM(e,t),addRowAfter:()=>({state:e,dispatch:t})=>JM(e,t),deleteRow:()=>({state:e,dispatch:t})=>{let n=vu(e.selection.$from,e=>e.type.name===`table`);return XM(e,t& & (e=>{n& & hP(e,n.pos),t(e)}))},deleteTable:()=>({state:e,dispatch:t})=>lN(e,t),mergeCells:()=>({state:e,dispatch:t})=>$M(e,t),splitCell:()=>({state:e,dispatch:t})=>eN(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>aN(`column`)(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>aN(`row`)(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>oN(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>$M(e,t)?!0:eN(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>nN(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>cN(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>cN(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t& & LM(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){let n=kM.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:mP,"Mod-Backspace":mP,Delete:mP,"Mod-Delete":mP}},addProseMirrorPlugins(){return[...this.options.resizable& & this.editor.isEditable?[MN({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:null,lastColumnResizable:this.options.lastColumnResizable})]:[],KN({allowTableNodeSelection:this.options.allowTableNodeSelection}),TP()]},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}))}}}),DP=Tp.create({name:`tableKit`,addExtensions(){let e=[];return this.options.table!==!1& & e.push(EP.configure(this.options.table)),this.options.tableCell!==!1& & e.push(rP.configure(this.options.tableCell)),this.options.tableHeader!==!1& & e.push(iP.configure(this.options.tableHeader)),this.options.tableRow!==!1& & e.push(aP.configure(this.options.tableRow)),e}}),OP=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 kP(){return[Bk.configure({HTMLAttributes:{class:`dw-tasks`}}),zk.configure({nested:!0})]}function AP(){return[DP.configure({table:{resizable:!0,cellMinWidth:60,HTMLAttributes:{class:`dw-table`}}})]}var jP=OP.configure({types:[`heading`,`paragraph`],alignments:[`left`,`center`,`right`]}),MP=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}}),NP=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,PP=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,FP=_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
`)){if(!o){a.push(``);continue}let e=``;for(let s of o.split(/(\s+)/)){let o=e+s;if(!e||$F(o,t,r,i)< =n)e=o;else for(a.push(e.trimEnd()),e=s.trimStart();e&&$F(e,t,r,i)>n; ){let o=e.length-1;for(;o>1&&$F(e.slice(0,o),t,r,i)>n; )o--;a.push(e.slice(0,o)),e=e.slice(o)}}a.push(e)}return a}function tI(e,t){let n=t===0?18:15,r=t===0?600:400,i=eI(e||` `,n,260,YF,r),a=Math.max(...i.map(e=>$F(e,n,YF,r)),t===0?60:40);return{w:Math.ceil(a)+(t===0?32:24),h:i.length*Math.round(n*1.4)+(t===0?20:14)}}var nI=56,rI=14;function iI(e){let t=Object.entries(e).filter(([,t])=>!t.parent||!e[t.parent]);return t.sort((e,t)=>e[1].pos-t[1].pos||(e[0]< t [ 0 ] ? -1:1 ) ) , t [ 0 ] ? . [ 0 ] ? ? null } function aI ( e , t ) { return Object . entries ( e ) . filter ( ( [ e , n ] ) = > n.parent===t& & e!==t).sort((e,t)=>e[1].pos-t[1].pos||(e[0]< t [ 0 ] ? -1:1 ) ) . map ( ( [ e ] ) = > e)}function oI(e,t,n){let r=iI(e),i=new Map,a=[];if(!r)return{root:``,boxes:i,edges:a,bounds:{x:0,y:0,w:0,h:0}};let o=new Map,s=new Set,c=(t,r)=>{if(!(s.has(t)||r>50)){s.add(t),o.set(t,n(e[t].text,r));for(let n of aI(e,t))c(n,r+1)}};c(r,0);let l=t=>aI(e,t).filter(e=>o.has(e)),u=new Map,d=e=>{let t=u.get(e);if(t!==void 0)return t;let n=l(e),r=n.reduce((e,t)=>e+d(t),0)+rI*Math.max(0,n.length-1),i=Math.max(o.get(e).h,r);return u.set(e,i),i},f=(e,t,n,r,a,s)=>{let c=o.get(e),u=a===1?t:t-c.w;i.set(e,{id:e,x:u,y:n-c.h/2,w:c.w,h:c.h,depth:r,dir:a,parent:s}),p(e,l(e),a===1?u+c.w+nI:u-nI,n,r+1,a)},p=(e,t,n,r,i,a)=>{let o=r-(t.reduce((e,t)=>e+d(t),0)+rI*Math.max(0,t.length-1))/2;for(let r of t){let t=d(r);f(r,n,o+t/2,i,a,e),o+=t+rI}},m=o.get(r);i.set(r,{id:r,x:0,y:0,w:m.w,h:m.h,depth:0,dir:1,parent:``});let h=m.h/2,g=l(r);if(t===`right`)p(r,g,m.w+nI,h,1,1);else if(t===`left`)p(r,g,-56,h,1,-1);else{let e=Math.ceil(g.length/2);p(r,g.slice(0,e),m.w+nI,h,1,1),p(r,g.slice(e),-56,h,1,-1)}for(let e of i.values()){if(!e.parent)continue;let t=i.get(e.parent),n=e.dir===1?[t.x+t.w,t.y+t.h/2]:[t.x,t.y+t.h/2],r=e.dir===1?[e.x,e.y+e.h/2]:[e.x+e.w,e.y+e.h/2];a.push({from:n,to:r,child:e.id})}let _=1/0,v=1/0,y=-1/0,b=-1/0;for(let e of i.values())_=Math.min(_,e.x),v=Math.min(v,e.y),y=Math.max(y,e.x+e.w),b=Math.max(b,e.y+e.h);return{root:r,boxes:i,edges:a,bounds:{x:_,y:v,w:y-_,h:b-v}}}function sI(e,t,n,r){let i=e.boxes.get(n);if(!i)return null;if(r===`ArrowUp`||r===`ArrowDown`){let a=i.parent?aI(t,i.parent).filter(t=>e.boxes.get(t)?.dir===i.dir):[];return a[a.indexOf(n)+(r===`ArrowUp`?-1:1)]??null}let a=r===`ArrowRight`?1:-1;return i.parent?a===i.dir?aI(t,n)[0]??null:i.parent:aI(t,n).find(t=>e.boxes.get(t)?.dir===a)??null}function cI(e,t){let n=(e[0]+t[0])/2;return`M${e[0]} ${e[1]} C${n} ${e[1]} ${n} ${t[1]} ${t[0]} ${t[1]}`}function lI(e,t,n,r=e=>e){return e*r(.5-t*(.5-n))}function uI(e){return[-e[0],-e[1]]}function dI(e,t){return[e[0]+t[0],e[1]+t[1]]}function fI(e,t){return[e[0]-t[0],e[1]-t[1]]}function pI(e,t){return[e[0]*t,e[1]*t]}function mI(e,t){return[e[0]/t,e[1]/t]}function hI(e){return[e[1],-e[0]]}function gI(e,t){return e[0]*t[0]+e[1]*t[1]}function _I(e,t){return e[0]===t[0]& & e[1]===t[1]}function vI(e){return Math.hypot(e[0],e[1])}function yI(e){return e[0]*e[0]+e[1]*e[1]}function bI(e,t){return yI(fI(e,t))}function xI(e){return mI(e,vI(e))}function SI(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function CI(e,t,n){let r=Math.sin(n),i=Math.cos(n),a=e[0]-t[0],o=e[1]-t[1],s=a*i-o*r,c=a*r+o*i;return[s+t[0],c+t[1]]}function wI(e,t,n){return dI(e,pI(fI(t,e),n))}function TI(e,t,n){return dI(e,pI(t,n))}var{min:EI,PI:DI}=Math,OI=.275,kI=DI+1e-4;function AI(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:a=!0,easing:o=e=>e,start:s={},end:c={},last:l=!1}=t,{cap:u=!0,easing:d=e=>e*(2-e)}=s,{cap:f=!0,easing:p=e=>--e*e*e+1}=c;if(e.length===0||n< =0)return[];let m=e[e.length-1].runningLength,h=s.taper===!1?0:s.taper===!0?Math.max(n,m):s.taper,g=c.taper===!1?0:c.taper===!0?Math.max(n,m):c.taper,_=(n*r)**2,v=[],y=[],b=e.slice(0,10).reduce((e,t)=>{let r=t.pressure;if(a){let i=EI(1,t.distance/n);r=EI(1,e+(EI(1,1-i)-e)*(i*OI))}return(e+r)/2},e[0].pressure),x=lI(n,i,e[e.length-1].pressure,o),S,C=e[0].vector,ee=e[0].point,te=ee,ne=ee,re=te,ie=!1;for(let t=0;t< e.length ; t + + ) { let { pressure:r } = e [ t ] , { point:s , vector:c , distance:l , runningLength:u } = e [ t ] ; if ( t < e . length-1 & & m-u < 3 ) continue ; if ( i ) { if ( a ) { let e = EI(1,l/n),t=EI(1,1-e);r=EI(1,b+(t-b)*(e*OI))}x=lI(n,i,r,o)}else x = n/2;S===void 0 & & ( S = x);let f = u<h?d(u/h):1,ae=m-u<g?p((m-u)/g):1;x=Math.max(.01,x*Math.min(f,ae));let oe = (t<e.length-1?e[t+1]:e[t]).vector,se=t<e.length-1?gI(c,oe):1,ce=gI(c,C)<0&&!ie,le=se!==null&&se<0;if(ce||le){let e = pI(hI(C),x);for(let t = 0;t<=1;t+=.07692307692307693)ne=CI(fI(s,e),s,kI*t),v.push(ne),re=CI(dI(s,e),s,kI*-t),y.push(re);ee=ne,te=re,le&&(ie=!0);continue}if(ie=!1,t===e.length-1){let e = pI(hI(c),x);v.push(fI(s,e)),y.push(dI(s,e));continue}let ue = pI(hI(wI(oe,c,se)),x);ne=fI(s,ue),(t<=1||bI(ee,ne) > _)& & (v.push(ne),ee=ne),re=dI(s,ue),(t< =1||bI(te,re)>_)& & (y.push(re),te=re),b=r,C=c}let ae=e[0].point.slice(0,2),oe=e.length>1?e[e.length-1].point.slice(0,2):dI(e[0].point,[1,1]),se=[],ce=[];if(eLine truncated
`:n(e)).join(``),r=(e,i)=>{for(let a of e)if(a.type===`heading`){let e=Number(a.attrs?.level)||1;t.push({text:n(a),size:[0,26,21,18,16,16,16][e]??16,weight:650})}else if(a.type===`paragraph`)t.push({text:i+n(a),size:15,weight:400});else if(a.type===`listItem`||a.type===`taskItem`){let e=a.type===`taskItem`?a.attrs?.checked?`☑ `:`☐ `:`• `,[i,...o]=a.content??[];i& & t.push({text:e+n(i),size:15,weight:400}),r(o,` `)}else a.type===`codeBlock`?t.push({text:n(a),size:13,weight:400}):a.content?.length&&r(a.content,i)}; return r(e,``),t}function m R(e,t,n,r,i,a,o=400,s=`start`){let c=Math.round(r*1.35);return n.map((n,l)=>`< text x = "${e}" y = "${t+r+l*c}" font-size = "${r}" font-family = "${L L(a)}" font-weight = "${o}" fill = "${i}" text-anchor = "${s}" xml:space = "preserve" > ${L L(n)}< / text > `).join(``)}async function h R(e){if(e.startsWith(`data:`))return e;try{let t=await fetch(e,{credentials:`include`});if(!t.ok)return null;let n=await t.blob();return await new Promise(e=>{let t=new FileReader;t.onload=()=>e(typeof t.result==`string`?t.result:null),t.onerror=()=>e(null),t.readAsDataURL(n)})}catch{return null}}async function g R(e){let t=f R(e.root),n=e.elements.filter(e=>e.type!==`group`),r=G P(W P(n.map(t=>e.boxOf(t)))??{x:0,y:0,w:400,h:300},32),i=t(`ink`,`line`),a=[];for(let r of n){let n=e.boxOf(r),o=r.rotate?` rotate(${r.rotate} ${n.w/2} ${n.h/2})`:``,s=e=>`< g transform = "translate(${n.x} ${n.y})${o}" > ${e}< / g > `;switch(r.type){case`shape`:{let e=eI (r.text,r.fontSize,Math.max(20,n.w-16)),i=Math.round(r.fontSize*1.35),o=n.h/2-e.length*i/2-r.fontSize*.25;a.push(s(G L(r,t)+(r.text?m R(n.w/2,o,e,r.fontSize,t(r.textColor,`line`),Y F,400,`middle`):``)));break}case`text`:{let e=Q F(r.font),i=r.w?eI (r.text,r.fontSize,r.w,e):r.text.split(`
`),o=r.align===`center`?n.w/2:r.align===`right`?n.w:0,c=r.align===`center`?`middle`:r.align===`right`?`end`:`start`;a.push(s(mR(o,0,i,r.fontSize,t(r.color,`line`),e,r.bold?650:400,c)));break}case`connector`:{let n=e.routeOf(r);if(a.push(qL(r,n,t)),r.label){let e=Math.min(240,r.label.length*8+16);a.push(`< rect x = "${n.mid[0]-e/2}" y = "${n.mid[1]-12}" width = "${e}" height = "24" rx = "4" fill = "${t(`paper`,`line`)}" / > `+mR(n.mid[0],n.mid[1]-12+3,[r.label],13,i,YF,400,`middle`))}break}case`brush`:a.push(s(YL(r,t)));break;case`frame`:a.push(s(`< rect width = "${n.w}" height = "${n.h}" rx = "8" fill = "${t(r.background,`fill`)===`none`?`none`:t(r.background,`fill`)}" stroke = "${t(`gray`,`line`)}" stroke-width = "1.5" / > `+mR(4,-24,[r.title],13,t(`gray`,`line`),YF,600)));break;case`note`:{let o=e.noteBody(r),c=o?pR(XL(o)):[],l=18,u=`< rect width = "${n.w}" height = "${n.h}" rx = "8" fill = "${t(r.background,`fill`)}" stroke = "${t(`gray`,`fill`)}" / > `;if(r.page& & e.pageTitle){let t=eI(e.pageTitle,26,n.w-48,YF,650);u+=mR(24,l-4,t,26,i,YF,650),l+=t.length*35+8}for(let e of c){let t=eI(e.text,e.size,n.w-48,YF,e.weight);if(u+=mR(24,l,t,e.size,i,YF,e.weight),l+=t.length*Math.round(e.size*1.35)+8,l>n.h-12)break}a.push(s(u));break}case`image`:{let i=await hR(e.resolve(r.src));a.push(s(i?`< image href = "${LL(i)}" width = "${n.w}" height = "${n.h}" preserveAspectRatio = "xMidYMid meet" / > `:`< rect width = "${n.w}" height = "${n.h}" fill = "${t(`ink`,`fill`)}" / > `));break}case`embed`:a.push(s(`< rect width = "${n.w}" height = "${n.h}" rx = "8" fill = "${t(`paper`,`fill`)}" stroke = "${t(`gray`,`fill`)}" / > `+mR(16,16,eI(r.url,13,n.w-32),13,t(`blue`,`line`),YF)));break;case`mindmap`:{let n=e.layoutOf(r),o=t(r.color,`line`),s=t(r.color,`fill`),c=n.edges.map(e=>`< path d = "${cI(e.from,e.to)}" fill = "none" stroke = "${o}" stroke-width = "2" / > `).join(``);for(let e of n.boxes.values()){let n=e.depth===0?18:15,a=e.depth===0?600:400,l=e.depth===0?o:e.depth===1?s:t(`paper`,`line`),u=e.depth===0?t(`paper`,`line`):i;c+=`< rect x = "${e.x}" y = "${e.y}" width = "${e.w}" height = "${e.h}" rx = "${e.depth===0?10:8}" fill = "${l}" stroke = "${o}" stroke-width = "${e.depth===0?0:1.5}" / > `;let d=eI(r.nodes[e.id]?.text||` `,n,260,YF,a);c+=mR(e.x+e.w/2,e.y+(e.h-d.length*Math.round(n*1.4))/2-2,d,n,u,YF,a,`middle`)}a.push(`< g transform = "translate(${r.x} ${r.y})" > ${c}< / g > `);break}}}return{svg:`< svg xmlns = "http://www.w3.org/2000/svg" width = "${Math.ceil(r.w)}" height = "${Math.ceil(r.h)}" viewBox = "${r.x} ${r.y} ${r.w} ${r.h}" > < rect x = "${r.x}" y = "${r.y}" width = "${r.w}" height = "${r.h}" fill = "${t(`paper`,`line`)}" / > ${a.join(``)}< / svg > `,box:r}}async function _R(e,t){let{svg:n,box:r}=await gR(t),i=new Blob([n],{type:`image/svg+xml`});if(e===`svg`)return i;let a=Math.min(2,8192/Math.max(r.w,r.h,1)),o=URL.createObjectURL(i);try{let e=await new Promise((e,t)=>{let n=new Image;n.onload=()=>e(n),n.onerror=()=>t(Error(`could not draw the canvas`)),n.src=o}),t=document.createElement(`canvas`);t.width=Math.ceil(r.w*a),t.height=Math.ceil(r.h*a);let n=t.getContext(`2d`);if(!n)throw Error(`could not draw the canvas`);return n.drawImage(e,0,0,t.width,t.height),await new Promise((e,n)=>t.toBlob(t=>t?e(t):n(Error(`could not draw the canvas`)),`image/png`))}finally{URL.revokeObjectURL(o)}}var vR=.1,yR=4,bR=`http://www.w3.org/2000/svg`,xR=e=>e instanceof HTMLElement&&(e.isContentEditable||e.tagName===`INPUT`||e.tagName===`TEXTAREA`),SR=class{opts; store;labels;root;styles;editable;tool=`select`;shapeKind;selected=new Set;activeNode=null;editing=null;entered=null;world;overlay;ui;view={x:0,y:0,zoom:1};rendered=new Map;measured=new Map;layouts=new Map;routes=new Map;previews=new Map;drag=null;guides=[];marquee=null;hover=null;raf=0;spaceDown=!1;pointers=new Map;pinch=null;presenting=null;comments=[];activeComment=``;resize=typeof ResizeObserver>`u`?null:new ResizeObserver(e=>this.onResize(e));unsub;cleanups=[];saveTimer;constructor(e,t){this.opts=t,this.labels=t.labels??mF,this.editable=t.editable,this.styles=LF(t.styles),this.shapeKind=this.styles.shape.shape,this.store=new iR(t.doc,{undo:t.undo!==!1}),this.root=document.createElement(`div`),this.root.className=`dw-cv`,this.root.tabIndex=0,this.root.setAttribute(`role`,`application`),this.root.dataset.testid=`edgeless-canvas`,this.world=document.createElement(`div`),this.world.className=`dw-cv-world`,this.overlay=document.createElementNS(bR,`svg`),this.overlay.classList.add(`dw-cv-overlay`),this.root.append(this.world,this.overlay),e.append(this.root),this.ui=new dR(this),this.root.classList.toggle(`dw-cv-readonly`,!this.editable),this.unsub=this.store.onChange(()=>this.schedule()),this.listen(),this.render(),this.restoreView()||this.fit(void 0,!1),this.applyView()}destroy(){cancelAnimationFrame(this.raf),clearTimeout(this.saveTimer),this.saveView(),this.unsub(),this.resize?.disconnect();for(let e of this.cleanups)e();for(let e of this.rendered.values())e.note?.destroy();this.rendered.clear(),this.ui.destroy(),this.store.destroy(),this.root.remove()}setEditable(e){if(e!==this.editable){this.editable=e,this.roLine truncated
`||e===`\r`?(r.push(i),n.push(r),r=[],i=``,e===`\r`& & s[o+1]===`
`& & o++):i+=e,o++}return(i!==``||r.length)& & (r.push(i),n.push(r)),n}function c B(e,t){return e.includes(t)||/["\r\n]/.test(e)||/^\s|\s$/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function l B(e,t=`,`){return e.map(e=>e.map(e=>c B(e,t)).join(t)).join(`\r
`)}function uB(e,t,n){return lB([t.map(e=>e.name),...n.map(e=>t.map(t=>JR(e,t)))])}function dB(e){let t=e.map(e=>e.trim()).filter(Boolean);if(!t.length)return`text`;if(t.every(e=>KR(e)!==null))return`number`;if(t.every(e=>/^\d{4}-\d{2}-\d{2}/.test(e)))return`date`;if(t.every(e=>/^(true|false|yes|no)$/i.test(e)))return`checkbox`;if(t.every(e=>/^https?:\/\/\S+$/.test(e)))return`link`;let n=new Set(t.map(e=>e.toLowerCase()));return t.length>=4& & n.size< =Math.max(2,t.length/3)& & t.every(e=>e.length< =40)?`select`:`text`}function fB(e,t,n){let r=e.trim();if(!r)return null;let i=e=>{let t=n.find(t=>t.name.toLowerCase()===e.toLowerCase());return t||(t={id:PR(),name:e,color:az(n)},n.push(t)),t.id};switch(t.type){case`number`:return KR(r);case`progress`:{let e=KR(r.replace(`%`,``));return e===null?null:Math.max(0,Math.min(100,Math.round(e)))}case`checkbox`:return/^(true|yes|1|x|✓|done)$/i.test(r);case`date`:return WR(r)||null;case`select`:return i(r);case`multiSelect`:return[...new Set(r.split(/[,;]/).map(e=>e.trim()).filter(Boolean).map(i))];case`member`:case`attachment`:case`createdBy`:case`createdTime`:return null;default:return r}}function pB(e,t=`,`){let n=sB(e,t).filter(e=>e.some(e=>e.trim())),r=n[0]??[],i=n.slice(1),a=r.map((e,t)=>({id:PR(),name:e.trim()||`${t+1}`,type:t===0?`title`:dB(i.map(e=>e[t]??``))}));for(let e of a)e.type===`select`&&(e.options=[]); return{columns:a,rows:i.map(e=>{let t={};return a.forEach((n,r)=>{let i=fB(e[r]??``,n,n.options??[]);i!==null& & (!Array.isArray(i)||i.length)& & (t[n.id]=i)}),t})}}function mB(e,t){let n=[];return{index:e.map(e=>{let r=t.find(t=>t.name.trim().toLowerCase()===e.trim().toLowerCase());return!r& & e.trim()& & n.push(e.trim()),r??null}),missing:n}}function hB(e,t,n,r){let i=I(`select`,{class:`dw-db-select`,"aria-label":n});for(let n of t){let t=I(`option`,{value:n.value},n.label);n.value===e& & (t.selected=!0),i.append(t)}return i.addEventListener(`change`,()=>r(i.value)),i.addEventListener(`keydown`,e=>e.stopPropagation()),i}var gB=e=>e.map(e=>({value:e.id,label:e.name||`…`}));function _B(e,t,n,r){let i=e.labels;if(!XR(n.op))return null;if(t.type===`select`||t.type===`multiSelect`)return hB(typeof n.value==`string`?n.value:``,[{value:``,label:`—`},...(t.options??[]).map(e=>({value:e.id,label:e.name}))],i.value,r);let a=t.type===`date`||t.type===`createdTime`?`date`:t.type===`number`||t.type===`progress`?`number`:`text`,o=I(`input`,{class:`dw-db-input dw-db-input--small`,type:a,"aria-label":i.value,placeholder:i.value});return o.value=n.value===void 0||n.value===null?``:String(n.value),o.addEventListener(`keydown`,e=>e.stopPropagation()),o.addEventListener(`change`,()=>r(a===`number`?o.value===``?null:Number(o.value):o.value)),o}function vB(e,t,n){let r=e.store,i=e.labels,a=e.db.columns,o=structuredClone(n.filters),s=()=>r?.updateView(n.id,{filters:o}),c=()=>{t.replaceChildren(),o.length>1& & t.append(hB(n.filterMode,[{value:`and`,label:i.matchAll},{value:`or`,label:i.matchAny}],i.filter,e=>{n.filterMode=e,r?.updateView(n.id,{filterMode:n.filterMode})})),o.length||t.append(I(`p`,{class:`dw-db-pop__empty`},i.noFilters)),o.forEach((n,r)=>{let l=a.find(e=>e.id===n.column);if(!l)return;let u=YR(l.type),d=I(`div`,{class:`dw-db-pop__line`},hB(n.column,gB(a),i.filter,e=>{let t=a.find(t=>t.id===e);o[r]={column:e,op:YR(t.type)[0]},s(),c()}),hB(n.op,u.map(e=>({value:e,label:TR(i,e)})),i.filter,e=>{o[r]={...n,op:e},XR(e)||delete o[r].value,s(),c()}),_B(e,l,n,e=>{o[r]={...o[r],value:e},s()}),CB(i.remove,()=>{o.splice(r,1),s(),c()}));t.append(d)}),r& & t.append(wB(i.addFilter,()=>{let e=a.find(e=>e.type!==`title`)??a[0];o.push({column:e.id,op:YR(e.type)[0]}),s(),c()}))};c()}function yB(e,t,n){let r=e.store,i=e.labels,a=e.db.columns,o=structuredClone(n.sorts),s=()=>r?.updateView(n.id,{sorts:o}),c=()=>{t.replaceChildren(),o.length||t.append(I(`p`,{class:`dw-db-pop__empty`},i.noSorts)),o.forEach((e,n)=>{t.append(I(`div`,{class:`dw-db-pop__line`},hB(e.column,gB(a),i.sort,t=>{o[n]={...e,column:t},s()}),hB(e.desc?`desc`:`asc`,[{value:`asc`,label:i.ascending},{value:`desc`,label:i.descending}],i.sort,t=>{o[n]={...e,desc:t===`desc`},s()}),CB(i.remove,()=>{o.splice(n,1),s(),c()})))}),r& & t.append(wB(i.addSort,()=>{let e=new Set(o.map(e=>e.column)),t=a.find(t=>!e.has(t.id))??a[0];o.push({column:t.id,desc:!1}),s(),c()}))};c()}function bB(e,t,n){let r=e.store,i=e.labels,a=e.db.columns.filter(e=>IR.includes(e.type)),o=a.map(e=>({value:e.id,label:e.name||CR(i,e.type)}));n.type!==`kanban`& & o.unshift({value:``,label:i.noGrouping}),t.append(I(`label`,{class:`dw-db-pop__label`},i.groupBy),a.length||n.type!==`kanban`?hB(n.groupBy??``,o,i.groupBy,e=>r?.updateView(n.id,{groupBy:e||null})):I(`p`,{class:`dw-db-pop__empty`},i.noGroupColumn))}function xB(e,t,n){let r=e.store,i=e.labels,a=e.db.columns.filter(e=>e.type===`date`||e.type===`createdTime`);t.append(I(`label`,{class:`dw-db-pop__label`},i.dateColumn),a.length?hB(n.dateColumn??``,[{value:``,label:`—`},...a.map(e=>({value:e.id,label:e.name||CR(i,e.tyLine truncated
`)},onCreate(){let{doc:e,readOnlyDoc:t,undoScope:n}=this.options;e& & !t& & n& & (NS.getState(this.editor.state)?.undoManager)?.addToScope(Gz(e))},addCommands(){let e=e=>{let t=PR(),{doc:n,readOnlyDoc:r}=this.options;return!n||r?{id:t,data:e}:(oB(n,t,e,(e,t)=>GB(this.editor,e,t)),{id:t,data:null})};return{insertDatabase:t=>({commands:n})=>n.insertContent([{type:this.name,attrs:e(t??tB(BB(this.options.labels)))},{type:`paragraph`}]),groupAsDatabase:()=>({state:t,dispatch:n,commands:r})=>{let i=JB(t.selection.$from,t.selection.$to);if(!i)return!1;if(!n)return!0;let a=zB(this.options.labels),o={id:PR(),name:a.typeTitle,type:`title`},s=[o],c=i.checks?{id:PR(),name:a.done,type:`checkbox`}:null;c&&s.push(c); let l=Date.now(),u={title:``,columns:s,rows:i.items.map((e,t)=>({id:PR(),cells:{[o.id]:e.text,...c& & e.checked?{[c.id]:!0}:{}},createdAt:l+t,createdBy:this.options.me?.()??null,body:e.rest.length?e.rest:void 0})),views:[FR(`table`,a.viewTable,s)]},d=this.type.create(e(u));return r.command(({tr:e})=>(e.replaceWith(i.from,i.to,d),e.setSelection(E.create(e.doc,i.from)),!0))}}},addKeyboardShortcuts(){return{"Mod-g":()=>this.editor.commands.groupAsDatabase()}},addProseMirrorPlugins(){let{doc:e,readOnlyDoc:t}=this.options,n=e&&!t?e:null,r=this.editor; return[new D({key:new Un(`databaseClipboard`),props:{transformCopied:t=>!e||!UB(t.content)?t:new p(HB(t.content,t=>{let n=Gz(e).get(String(t.attrs.id));return n instanceof Lb?t.type.create({...t.attrs,data:aB(n,VB)}):t}),t.openStart,t.openEnd),transformPasted:e=>UB(e.content)?new p(HB(e.content,e=>{let t=PR();if(!n)return e.type.create({...e.attrs,id:t});let i=e.attrs.data?LR(e.attrs.data):null,a=Gz(n).get(String(e.attrs.id)),o=i??(a instanceof Lb?aB(a,VB):tB(BB(this.options.labels)));return oB(n,t,qB(o),(e,t)=>GB(r,e,t)),e.type.create({id:t,data:null})}),e.openStart,e.openEnd):e},appendTransaction:(e,t,i)=>{if(!n||!e.some(e=>e.docChanged& & !e.getMeta(MS))||!e.some(e=>e.steps.some(e=>UB(e.slice?.content??s.empty))))return null;let a=new Set,o=[];if(i.doc.descendants((e,t)=>{if(e.type.name!==`database`)return;let n=String(e.attrs.id);return n& & a.has(n)& & o.push({pos:t,node:e}),a.add(n),!1}),!o.length)return null;let c=i.tr;for(let{pos:e,node:t}of o){let i=Gz(n).get(String(t.attrs.id)),a=PR();i instanceof Lb& & oB(n,a,qB(aB(i,VB)),(e,t)=>GB(r,e,t)),c.setNodeMarkup(e,void 0,{...t.attrs,id:a,data:null})}return c}})]},addNodeView(){let e=this.options;return({node:t,editor:n,getPos:r})=>{let i=t,a=e.labels??AR,o=e.doc,s=()=>n.isEditable& & !!o& & !e.readOnlyDoc,c=null,l=null,u=null,d=null,f=I(`div`,{class:`dw-db-node`}),p=()=>String(i.attrs.id),m=()=>{let e=o?Gz(o).get(p()):void 0;return e instanceof Lb?e:null},h=()=>{let t=m();return t?eB(t):i.attrs.data?LR(i.attrs.data):tB(BB(e.labels))},g=e=>{let t=o?Gz(o).get(e):void 0;if(t instanceof Lb)return eB(t);let r=null;return n.state.doc.descendants(t=>!r& & (t.type.name===`database`& & t.attrs.id===e& & t.attrs.data& & (r=LR(t.attrs.data)),!0)),r},_=new Map,v=t=>{let n=e.linkedPages;if(!n)return null;let r=_.get(t);if(!r){let e=n.open(t),i=e.onChange(ne);e.doc.on(`update`,ne),r={provider:e,stop:()=>{i(),e.doc.off(`update`,ne),e.destroy()}},_.set(t,r)}return r.provider},y=t=>!t||t===e.linkedPages?.self,b=new Set,x=e=>{if(y(e.page))return b.add(e.database),e.database===p()?h():g(e.database);let t=v(e.page);if(!t?.synced)return null;let n=Gz(t.doc).get(e.database);return n instanceof Lb?eB(n):null},S=(e,t,n)=>{let r=[],i=e=>{for(let a of e.toArray())if(a instanceof ox){if(a.nodeName===`database`){let e=String(a.getAttribute(`id`)??``);e& & r.push({page:t,database:e,title:n(e)?.title??``})}else i(a)}};return i(e),r},C={local:()=>{let e=[];return n.state.doc.descendants(t=>(t.type.name===`database`& & t.attrs.id& & t.attrs.id!==p()& & e.push({page:``,database:String(t.attrs.id),title:g(String(t.attrs.id))?.title??``}),!0)),e},searchPages:e.pages?t=>e.pages.search(t).then(e=>e.filter(e=>!y(e.id)).map(e=>({id:e.id,title:e.title}))):void 0,databasesOn:e.linkedPages?e=>new Promise(t=>{let n=v(e),r=()=>{t(S(n.doc.getXmlFragment(`default`),e,e=>{let t=Gz(n.doc).get(e);return t instanceof Lb?eB(t):null}))};if(n.synced)return r();let i=setTimeout(()=>{a(),t([])},8e3),a=n.onChange(()=>{n.synced& & (clearTimeout(i),a(),r())})}):void 0,read:x,openRecord:(t,r)=>{y(t.page)?LB(n,t.database,r):e.onNavigate?.(`/p/${encodeURIComponent(t.page)}${PB(t.database,r)}`)}},ee=e=>{for(let t of e)if((t.path.length?[String(t.path[0])]:[...t.keysChanged??[]]).some(e=>e!==p()& & b.has(e)))return ne()};o&&Gz(o).observeDeep(ee); let te;function ne(){clearTimeout(te),te=setTimeout(()=>de(),60)}let re=()=>gz(h(),x,a.database),ie=()=>({labels:a.database,colorNames:a.colors,locale:a.locale,files:e.files,people:e.people,store:c,linked:C}),ae=(t,n)=>{let r=e.rowExtensions;if(!r)return null;let i=m(),o=null;if(i& & (o=c?c.rowBody(n.id):KB(i,n.id),!o))return t.append(I(`p`,{class:`dw-db-peek__note`},a.database.bodyReadOnly)),null;let s=new Vp({element:t,editable:!!c,extensions:r(o),content:o?void 0:{type:`doLine truncated
`);return/\s/.test(n)}):!1}function hV(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 gV(e,t,n,r){return n?()=>{let n=r.getState(e.state)?.decorationId;return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect()||null}:hV(e)}function _V({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& & !mV(r)}function vV({view:e,pluginKeyRef:t}){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}function yV({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 bV({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 xV({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 SV({placement:e,offset:t,flip:n,floatingUi:r}){var i;let a=[kj({mainAxis:t.mainAxis??4,crossAxis:t.crossAxis??0})];return n& & a.push(jj()),r!=null& & (i=r.middleware)!=null& & i.length& & a.push(...r.middleware),{placement:e,strategy:r?.strategy??`absolute`,middleware:a}}function CV(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 wV({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&&CV(r).appendChild(o),s.onPosition||(o.style.visibility=`hidden`,o.style.width=`max-content`); let d=Oj(c,o,()=>{Mj(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 TV({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,_=xV({editor:e,items:n}),v=SV({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=Oj(e.anchor,t,()=>{Mj(e.anchor,t,{placement:`bottom-start`,middleware:[kj(6),jj(),Aj({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(),JV===d& & (JV=null),n||e.onCancel?.())}let d=()=>u();return JV=d,n.focus(),e.multiline||n.select(),d}var XV=[{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 ZV(e){let t;try{t=new URL(e.trim())}catch{return null}for(let e of XV){let n=e.pattern.exec(t.href);if(n)return{src:e.src(n,t),ratio:e.ratio??`video`}}return null}function QV(e){try{let t=new URL(e.trim());return t.protocol===`https:`||t.protocol===`http:`?t.href:``}catch{return``}}var $V=e=>{try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}};function eH(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;YV({anchor:i,value:`https://`,label:n,labels:{done:r.done,cancel:r.cancel,remove:r.remove},onSave:t=>e(QV(t)),onCancel:()=>e(``)})})}async function tH(e,t,n,r){let i=await eH(e,t,t.blocks.embedUrl);i& & (ZV(i)?e.chain().focus().insertEmbed(i).run():await rH(e,i,n,r))}async function nH(e,t,n,r){let i=await eH(e,t,t.blocks.linkUrl);i& & await rH(e,i,n,r)}async function rH(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 iH=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=QV(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=QV(e),i=ZV(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}: ${$V(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
`& & o++):i+=e,o++}return(i!==``||r.length)& & (r.push(i),n.push(r)),n}function d B(e,t){return e.includes(t)||/["\r\n]/.test(e)||/^\s|\s$/.test(e)?`"${e.replace(/"/g,`""`)}"`:e}function f B(e,t=`,`){return e.map(e=>e.map(e=>d B(e,t)).join(t)).join(`\r
`)}function pB(e,t,n){return fB([t.map(e=>e.name),...n.map(e=>t.map(t=>ZR(e,t)))])}function mB(e){let t=e.map(e=>e.trim()).filter(Boolean);if(!t.length)return`text`;if(t.every(e=>YR(e)!==null))return`number`;if(t.every(e=>/^\d{4}-\d{2}-\d{2}/.test(e)))return`date`;if(t.every(e=>/^(true|false|yes|no)$/i.test(e)))return`checkbox`;if(t.every(e=>/^https?:\/\/\S+$/.test(e)))return`link`;let n=new Set(t.map(e=>e.toLowerCase()));return t.length>=4& & n.size< =Math.max(2,t.length/3)& & t.every(e=>e.length< =40)?`select`:`text`}function hB(e,t,n){let r=e.trim();if(!r)return null;let i=e=>{let t=n.find(t=>t.name.toLowerCase()===e.toLowerCase());return t||(t={id:LR(),name:e,color:cz(n)},n.push(t)),t.id};switch(t.type){case`number`:return YR(r);case`progress`:{let e=YR(r.replace(`%`,``));return e===null?null:Math.max(0,Math.min(100,Math.round(e)))}case`checkbox`:return/^(true|yes|1|x|✓|done)$/i.test(r);case`date`:return qR(r)||null;case`select`:return i(r);case`multiSelect`:return[...new Set(r.split(/[,;]/).map(e=>e.trim()).filter(Boolean).map(i))];case`member`:case`attachment`:case`createdBy`:case`createdTime`:return null;default:return r}}function gB(e,t=`,`){let n=uB(e,t).filter(e=>e.some(e=>e.trim())),r=n[0]??[],i=n.slice(1),a=r.map((e,t)=>({id:LR(),name:e.trim()||`${t+1}`,type:t===0?`title`:mB(i.map(e=>e[t]??``))}));for(let e of a)e.type===`select`&&(e.options=[]); return{columns:a,rows:i.map(e=>{let t={};return a.forEach((n,r)=>{let i=hB(e[r]??``,n,n.options??[]);i!==null& & (!Array.isArray(i)||i.length)& & (t[n.id]=i)}),t})}}function _B(e,t){let n=[];return{index:e.map(e=>{let r=t.find(t=>t.name.trim().toLowerCase()===e.trim().toLowerCase());return!r& & e.trim()& & n.push(e.trim()),r??null}),missing:n}}function vB(e,t,n,r){let i=I(`select`,{class:`dw-db-select`,"aria-label":n});for(let n of t){let t=I(`option`,{value:n.value},n.label);n.value===e& & (t.selected=!0),i.append(t)}return i.addEventListener(`change`,()=>r(i.value)),i.addEventListener(`keydown`,e=>e.stopPropagation()),i}var yB=e=>e.map(e=>({value:e.id,label:e.name||`…`}));function bB(e,t,n,r){let i=e.labels;if(!$R(n.op))return null;if(t.type===`select`||t.type===`multiSelect`)return vB(typeof n.value==`string`?n.value:``,[{value:``,label:`—`},...(t.options??[]).map(e=>({value:e.id,label:e.name}))],i.value,r);let a=t.type===`date`||t.type===`createdTime`?`date`:t.type===`number`||t.type===`progress`?`number`:`text`,o=I(`input`,{class:`dw-db-input dw-db-input--small`,type:a,"aria-label":i.value,placeholder:i.value});return o.value=n.value===void 0||n.value===null?``:String(n.value),o.addEventListener(`keydown`,e=>e.stopPropagation()),o.addEventListener(`change`,()=>r(a===`number`?o.value===``?null:Number(o.value):o.value)),o}function xB(e,t,n){let r=e.store,i=e.labels,a=e.db.columns,o=structuredClone(n.filters),s=()=>r?.updateView(n.id,{filters:o}),c=()=>{t.replaceChildren(),o.length>1& & t.append(vB(n.filterMode,[{value:`and`,label:i.matchAll},{value:`or`,label:i.matchAny}],i.filter,e=>{n.filterMode=e,r?.updateView(n.id,{filterMode:n.filterMode})})),o.length||t.append(I(`p`,{class:`dw-db-pop__empty`},i.noFilters)),o.forEach((n,r)=>{let l=a.find(e=>e.id===n.column);if(!l)return;let u=QR(l.type),d=I(`div`,{class:`dw-db-pop__line`},vB(n.column,yB(a),i.filter,e=>{let t=a.find(t=>t.id===e);o[r]={column:e,op:QR(t.type)[0]},s(),c()}),vB(n.op,u.map(e=>({value:e,label:OR(i,e)})),i.filter,e=>{o[r]={...n,op:e},$R(e)||delete o[r].value,s(),c()}),bB(e,l,n,e=>{o[r]={...o[r],value:e},s()}),EB(i.remove,()=>{o.splice(r,1),s(),c()}));t.append(d)}),r& & t.append(DB(i.addFilter,()=>{let e=a.find(e=>e.type!==`title`)??a[0];o.push({column:e.id,op:QR(e.type)[0]}),s(),c()}))};c()}function SB(e,t,n){let r=e.store,i=e.labels,a=e.db.columns,o=structuredClone(n.sorts),s=()=>r?.updateView(n.id,{sorts:o}),c=()=>{t.replaceChildren(),o.length||t.append(I(`p`,{class:`dw-db-pop__empty`},i.noSorts)),o.forEach((e,n)=>{t.append(I(`div`,{class:`dw-db-pop__line`},vB(e.column,yB(a),i.sort,t=>{o[n]={...e,column:t},s()}),vB(e.desc?`desc`:`asc`,[{value:`asc`,label:i.ascending},{value:`desc`,label:i.descending}],i.sort,t=>{o[n]={...e,desc:t===`desc`},s()}),EB(i.remove,()=>{o.splice(n,1),s(),c()})))}),r& & t.append(DB(i.addSort,()=>{let e=new Set(o.map(e=>e.column)),t=a.find(t=>!e.has(t.id))??a[0];o.push({column:t.id,desc:!1}),s(),c()}))};c()}function CB(e,t,n){let r=e.store,i=e.labels,a=e.db.columns.filter(e=>zR.includes(e.type)),o=a.map(e=>({value:e.id,label:e.name||ER(i,e.type)}));n.type!==`kanban`& & o.unshift({value:``,label:i.noGrouping}),t.append(I(`label`,{class:`dw-db-pop__label`},i.groupBy),a.length||n.type!==`kanban`?vB(n.groupBy??``,o,i.groupBy,e=>r?.updateView(n.id,{groupBy:e||null})):I(`p`,{class:`dw-db-pop__empty`},i.noGroupColumn))}function wB(e,t,n){let r=e.store,i=e.labels,a=e.db.columns.filter(e=>e.type===`date`||e.type===`createdTime`);t.append(I(`label`,{class:`dw-db-pop__label`},i.dateColumn),a.length?vB(n.dateColumn??``,[{value:``,label:`—`},...a.map(e=>({value:e.id,label:e.name||ER(i,e.tyLine truncated
`)},onCreate(){let{doc:e,readOnlyDoc:t,undoScope:n}=this.options;e& & !t& & n& & (IS.getState(this.editor.state)?.undoManager)?.addToScope(Jz(e))},addCommands(){let e=e=>{let t=LR(),{doc:n,readOnlyDoc:r}=this.options;return!n||r?{id:t,data:e}:(lB(n,t,e,(e,t)=>JB(this.editor,e,t)),{id:t,data:null})};return{insertDatabase:t=>({commands:n})=>n.insertContent([{type:this.name,attrs:e(t??iB(UB(this.options.labels)))},{type:`paragraph`}]),groupAsDatabase:()=>({state:t,dispatch:n,commands:r})=>{let i=ZB(t.selection.$from,t.selection.$to);if(!i)return!1;if(!n)return!0;let a=HB(this.options.labels),o={id:LR(),name:a.typeTitle,type:`title`},s=[o],c=i.checks?{id:LR(),name:a.done,type:`checkbox`}:null;c&&s.push(c); let l=Date.now(),u={title:``,columns:s,rows:i.items.map((e,t)=>({id:LR(),cells:{[o.id]:e.text,...c& & e.checked?{[c.id]:!0}:{}},createdAt:l+t,createdBy:this.options.me?.()??null,body:e.rest.length?e.rest:void 0})),views:[RR(`table`,a.viewTable,s)]},d=this.type.create(e(u));return r.command(({tr:e})=>(e.replaceWith(i.from,i.to,d),e.setSelection(E.create(e.doc,i.from)),!0))}}},addKeyboardShortcuts(){return{"Mod-g":()=>this.editor.commands.groupAsDatabase()}},addProseMirrorPlugins(){let{doc:e,readOnlyDoc:t}=this.options,n=e&&!t?e:null,r=this.editor; return[new D({key:new Un(`databaseClipboard`),props:{transformCopied:t=>!e||!KB(t.content)?t:new p(GB(t.content,t=>{let n=Jz(e).get(String(t.attrs.id));return n instanceof Bb?t.type.create({...t.attrs,data:cB(n,WB)}):t}),t.openStart,t.openEnd),transformPasted:e=>KB(e.content)?new p(GB(e.content,e=>{let t=LR();if(!n)return e.type.create({...e.attrs,id:t});let i=e.attrs.data?BR(e.attrs.data):null,a=Jz(n).get(String(e.attrs.id)),o=i??(a instanceof Bb?cB(a,WB):iB(UB(this.options.labels)));return lB(n,t,XB(o),(e,t)=>JB(r,e,t)),e.type.create({id:t,data:null})}),e.openStart,e.openEnd):e},appendTransaction:(e,t,i)=>{if(!n||!e.some(e=>e.docChanged& & !e.getMeta(FS))||!e.some(e=>e.steps.some(e=>KB(e.slice?.content??s.empty))))return null;let a=new Set,o=[];if(i.doc.descendants((e,t)=>{if(e.type.name!==`database`)return;let n=String(e.attrs.id);return n& & a.has(n)& & o.push({pos:t,node:e}),a.add(n),!1}),!o.length)return null;let c=i.tr;for(let{pos:e,node:t}of o){let i=Jz(n).get(String(t.attrs.id)),a=LR();i instanceof Bb& & lB(n,a,XB(cB(i,WB)),(e,t)=>JB(r,e,t)),c.setNodeMarkup(e,void 0,{...t.attrs,id:a,data:null})}return c}})]},addNodeView(){let e=this.options;return({node:t,editor:n,getPos:r})=>{let i=t,a=e.labels??NR,o=e.doc,s=()=>n.isEditable& & !!o& & !e.readOnlyDoc,c=null,l=null,u=null,d=null,f=I(`div`,{class:`dw-db-node`}),p=()=>String(i.attrs.id),m=()=>{let e=o?Jz(o).get(p()):void 0;return e instanceof Bb?e:null},h=()=>{let t=m();return t?rB(t):i.attrs.data?BR(i.attrs.data):iB(UB(e.labels))},g=e=>{let t=o?Jz(o).get(e):void 0;if(t instanceof Bb)return rB(t);let r=null;return n.state.doc.descendants(t=>!r& & (t.type.name===`database`& & t.attrs.id===e& & t.attrs.data& & (r=BR(t.attrs.data)),!0)),r},_=new Map,v=t=>{let n=e.linkedPages;if(!n)return null;let r=_.get(t);if(!r){let e=n.open(t),i=e.onChange(ne);e.doc.on(`update`,ne),r={provider:e,stop:()=>{i(),e.doc.off(`update`,ne),e.destroy()}},_.set(t,r)}return r.provider},y=t=>!t||t===e.linkedPages?.self,b=new Set,x=e=>{if(y(e.page))return b.add(e.database),e.database===p()?h():g(e.database);let t=v(e.page);if(!t?.synced)return null;let n=Jz(t.doc).get(e.database);return n instanceof Bb?rB(n):null},S=(e,t,n)=>{let r=[],i=e=>{for(let a of e.toArray())if(a instanceof lx){if(a.nodeName===`database`){let e=String(a.getAttribute(`id`)??``);e& & r.push({page:t,database:e,title:n(e)?.title??``})}else i(a)}};return i(e),r},C={local:()=>{let e=[];return n.state.doc.descendants(t=>(t.type.name===`database`& & t.attrs.id& & t.attrs.id!==p()& & e.push({page:``,database:String(t.attrs.id),title:g(String(t.attrs.id))?.title??``}),!0)),e},searchPages:e.pages?t=>e.pages.search(t).then(e=>e.filter(e=>!y(e.id)).map(e=>({id:e.id,title:e.title}))):void 0,databasesOn:e.linkedPages?e=>new Promise(t=>{let n=v(e),r=()=>{t(S(n.doc.getXmlFragment(`default`),e,e=>{let t=Jz(n.doc).get(e);return t instanceof Bb?rB(t):null}))};if(n.synced)return r();let i=setTimeout(()=>{a(),t([])},8e3),a=n.onChange(()=>{n.synced& & (clearTimeout(i),a(),r())})}):void 0,read:x,openRecord:(t,r)=>{y(t.page)?BB(n,t.database,r):e.onNavigate?.(`/p/${encodeURIComponent(t.page)}${LB(t.database,r)}`)}},ee=e=>{for(let t of e)if((t.path.length?[String(t.path[0])]:[...t.keysChanged??[]]).some(e=>e!==p()& & b.has(e)))return ne()};o&&Jz(o).observeDeep(ee); let te;function ne(){clearTimeout(te),te=setTimeout(()=>de(),60)}let re=()=>yz(h(),x,a.database),ie=()=>({labels:a.database,colorNames:a.colors,locale:a.locale,files:e.files,people:e.people,store:c,linked:C}),ae=(t,n)=>{let r=e.rowExtensions;if(!r)return null;let i=m(),o=null;if(i& & (o=c?c.rowBody(n.id):YB(i,n.id),!o))return t.append(I(`p`,{class:`dw-db-peek__note`},a.database.bodyReadOnly)),null;let s=new Vp({element:t,editable:!!c,extensions:r(o),content:o?void 0:{type:`doLine truncated
`);return/\s/.test(n)}):!1}function vV(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 yV(e,t,n,r){return n?()=>{let n=r.getState(e.state)?.decorationId;return t.dom.querySelector(`[data-decoration-id="${n}"]`)?.getBoundingClientRect()||null}:vV(e)}function bV({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& & !_V(r)}function xV({view:e,pluginKeyRef:t}){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)}function SV({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 CV({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 wV({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 TV({placement:e,offset:t,flip:n,floatingUi:r}){var i;let a=[Mj({mainAxis:t.mainAxis??4,crossAxis:t.crossAxis??0})];return n& & a.push(Pj()),r!=null& & (i=r.middleware)!=null& & i.length& & a.push(...r.middleware),{placement:e,strategy:r?.strategy??`absolute`,middleware:a}}function EV(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 DV({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&&EV(r).appendChild(o),s.onPosition||(o.style.visibility=`hidden`,o.style.width=`max-content`); let d=jj(c,o,()=>{Fj(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 OV({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,_=wV({editor:e,items:n}),v=TV({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=jj(e.anchor,t,()=>{Fj(e.anchor,t,{placement:`bottom-start`,middleware:[Mj(6),Pj(),Nj({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(),ZV===d& & (ZV=null),n||e.onCancel?.())}let d=()=>u();return ZV=d,n.focus(),e.multiline||n.select(),d}var $V=[{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 eH(e){let t;try{t=new URL(e.trim())}catch{return null}for(let e of $V){let n=e.pattern.exec(t.href);if(n)return{src:e.src(n,t),ratio:e.ratio??`video`}}return null}function tH(e){try{let t=new URL(e.trim());return t.protocol===`https:`||t.protocol===`http:`?t.href:``}catch{return``}}var nH=e=>{try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}};function rH(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;QV({anchor:i,value:`https://`,label:n,labels:{done:r.done,cancel:r.cancel,remove:r.remove},onSave:t=>e(tH(t)),onCancel:()=>e(``)})})}async function iH(e,t,n,r){let i=await rH(e,t,t.blocks.embedUrl);i& & (eH(i)?e.chain().focus().insertEmbed(i).run():await oH(e,i,n,r))}async function aH(e,t,n,r){let i=await rH(e,t,t.blocks.linkUrl);i& & await oH(e,i,n,r)}async function oH(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 sH=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=tH(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=tH(e),i=eH(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}: ${nH(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
@@ -178,7 +178,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`},r U=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`},s U=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+`
@@ -188,7 +188,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`},i U=function(e,t){return`M983 `+(10+e+t)+`
M`+(1001+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},c U=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
@@ -197,7 +197,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`},a U=function(e,t){return`M424,`+(2398+e+t)+`
M`+(1001+e)+` `+t+`h400000v`+(40+e)+`h-400000z`},l U=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
@@ -207,18 +207,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`},o U=function(e,t){return`M473,`+(2713+e+t)+`
h400000v`+(40+e)+`h-400000z`},u U=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`},s U=function(e){var t=e/2;return`M400000 `+e+` H0 L`+t+` 0 l65 45 L145 `+(e-80)+` H400000z`},c U=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`},d U=function(e){var t=e/2;return`M400000 `+e+` H0 L`+t+` 0 l65 45 L145 `+(e-80)+` H400000z`},f U=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`},l U=function(e,t,n){t=1e3*t;var r=``;switch(e){case`sqrtMain`:r=n U(t,t U);break;case`sqrtSize1`:r=r U(t,t U);break;case`sqrtSize2`:r=i U(t,t U);break;case`sqrtSize3`:r=a U(t,t U);break;case`sqrtSize4`:r=o U(t,t U);break;case`sqrtTall`:r=c U(t,t U,n)}return r},u U=function(e,t){switch(e){case`⎜`:return e U(`M291 0 H417 V`+t+` H291z`);case`∣ `:return e U(`M145 0 H188 V`+t+` H145z`);case`∥`:return e U(`M145 0 H188 V`+t+` H145z`)+e U(`M367 0 H410 V`+t+` H367z`);case`⎟`:return e U(`M457 0 H583 V`+t+` H457z`);case`⎢`:return e U(`M319 0 H403 V`+t+` H319z`);case`⎥`:return e U(`M263 0 H347 V`+t+` H263z`);case`⎪`:return e U(`M384 0 H504 V`+t+` H384z`);case`⏐`:return e U(`M312 0 H355 V`+t+` H312z`);case`‖`:return e U(`M257 0 H300 V`+t+` H257z`)+e U(`M478 0 H521 V`+t+` H478z`);default:return``}},d U={doubleleftarrow:`M262 157
219 661 l218 661zM702 `+t+`H400000v`+(40+e)+`H742z`},p U=function(e,t,n){t=1e3*t;var r=``;switch(e){case`sqrtMain`:r=o U(t,a U);break;case`sqrtSize1`:r=s U(t,a U);break;case`sqrtSize2`:r=c U(t,a U);break;case`sqrtSize3`:r=l U(t,a U);break;case`sqrtSize4`:r=u U(t,a U);break;case`sqrtTall`:r=f U(t,a U,n)}return r},m U=function(e,t){switch(e){case`⎜`:return i U(`M291 0 H417 V`+t+` H291z`);case`∣ `:return i U(`M145 0 H188 V`+t+` H145z`);case`∥`:return i U(`M145 0 H188 V`+t+` H145z`)+i U(`M367 0 H410 V`+t+` H367z`);case`⎟`:return i U(`M457 0 H583 V`+t+` H457z`);case`⎢`:return i U(`M319 0 H403 V`+t+` H319z`);case`⎥`:return i U(`M263 0 H347 V`+t+` H263z`);case`⎪`:return i U(`M384 0 H504 V`+t+` H384z`);case`⏐`:return i U(`M312 0 H355 V`+t+` H312z`);case`‖`:return i U(`M257 0 H300 V`+t+` H257z`)+i U(`M478 0 H521 V`+t+` H478z`);default:return``}},h U={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
@@ -264,10 +264,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:e U(`M40 281 V428 H0 V94 H40 V241 H400000 v40z`),leftbracketunder:e U(`M0 0 h120 V290 H399995 v120 H0z`),leftbracketover:e U(`M0 440 h120 V150 H399995 v-120 H0z`),leftmapsto:e U(`M40 281 V448H0V74H40V241H400000v40z`),leftToFrom:`M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23
71.5 23h399859zM103 281v-40h399897v40z`,leftlinesegment:i U(`M40 281 V428 H0 V94 H40 V241 H400000 v40z`),leftbracketunder:i U(`M0 0 h120 V290 H399995 v120 H0z`),leftbracketover:i U(`M0 440 h120 V150 H399995 v-120 H0z`),leftmapsto:i U(`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:e U(`M0 50 h400000 v40H0z m0 194h40000v40H0z`),midbrace:`M200428 334
68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`,longequal:i U(`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
@@ -316,7 +316,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:e U(`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`),rightbracketunder:e U(`M399995 0 h-120 V290 H0 v120 H400000z`),rightbracketover:e U(`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:i U(`M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`),rightbracketunder:i U(`M399995 0 h-120 V290 H0 v120 H400000z`),rightbracketover:i U(`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
@@ -389,7 +389,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`},f U=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`},g U=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
@@ -417,17 +417,80 @@ 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 pU(e){return`toText`in e}var mU=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(pU(e))return e . toText ( ) ; throw Error ( ` Expected MathDomNode with toText , got ` + e . constructor . name ) } ) . join ( ` ` ) } } , hU = {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},gU={ex:!0,em:!0,mu:!0},_U=function(e){return typeof e ! = ` string ` & & ( e = e.unit),e in hU | | e in gU | | e = ==`ex`},vU=function(e,t){var n ; if ( e . unit in hU ) n = hU[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 L ( ` Invalid unit: ' ` + e . unit + ` ' ` ) ; r ! = = t & & ( n * = r . sizeMultiplier / t . sizeMultiplier ) } return Math . min ( e . number * n , t . maxSize ) } , z = function(e){return+e.toFixed(4)+`em`},yU=function(e){return e . filter ( e = > e).join(` ` ) } , bU = function(e){var t = ``;for(var n of Object . keys ( e ) ) { var r = e[n];r!==void 0 & & ( t + = xH ( n ) + ` : ` + r + ` ; ` ) } return t } , xU = 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)}},SU=function(e){var t = document.createElement(e);t.className=yU(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 } , CU = /[\s"' > /=\x00-\x1f]/,wU=function(e){var t=`< `+e;this.classes.length& & (t+=` class="`+wH(yU(this.classes))+`"`);var n=bU(this.style);n& & (t+=` style="`+wH(n)+`"`);for(var r of Object.keys(this.attributes)){if(CU.test(r))throw new L(`Invalid attribute name '`+r+`'`);t+=` `+r+`="`+wH(this.attributes[r])+`"`}t+=`>`;for(var i=0;i< this.children.length ; i + + ) t + = this . children [ i ] . toMarkup ( ) ; return t + = ` < / ` + e + ` > `,t},TU=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,xU.call(this,e,n,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return SU.call(this,`span`)}toMarkup(){return wU.call(this,`span`)}},EU=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,xU.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 SU.call(this,`a`)}toMarkup(){return wU.call(this,`a`)}},DU=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 = "`+wH(this.src)+`" ` + ( ` alt = "`+wH(this.alt)+`" ` ) , t = bU(this.style);return t & & ( e + = ` style = "`+wH(t)+`" ` ) , e + = ` ' / > `,e}},OU={î:`ı̂`,ï:`ı̈`,í:`ı́`,ì:`ı̀`},kU=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=ZH(this.text.charCodeAt(0));c& & this.classes.push(c+`_fallback`),/[îïíì]/.test(this.text)& & (this.text=OU[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=z(this.italic)),this.classes.length>0& & (t||=document.createElement(`span`),t.className=yU(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+=wH(yU(this.classes) Line truncated
`+h+` children.`);for(var v=0;v< h ; v + + ) { var y = new AU ( [ new jU ( d [ v ] ) ] , { width: ` 400em ` , height:z ( m ) , viewBox: ` 0 0 ` + n + ` ` + p , preserveAspectRatio:_ [ v ] + ` slice ` } ) , b = LW([g[v]],[y],t);if(h===1)return{span:b,minWidth:f,height:m};b.style.height=z(m),l.push(b)}return{span:X([`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=z(o),a > 0& & (i.style.minWidth=z(a)),i},KG=function(e,t,n,r,i){var a,o=e.height+e.depth+n+r;if(/fbox|color|angl/.test(t)){if(a=X([`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 MU({x1:`0`,y1:`0`,x2:`100%`,y2:`100%`,"stroke-width":`0.046em`})),/^x?cancel$/.test(t)& & c.push(new MU({x1:`0`,y1:`100%`,x2:`100%`,y2:`0`,"stroke-width":`0.046em`})),a=LW([],[new AU(c,{width:`100%`,height:z(o)})],i)}return a.height=o,a.style.height=z(o),a},qG=[`bin`,`close`,`inner`,`open`,`punct`,`rel`],JG=[`accent-token`,`mathord`,`op-token`,`spacing`,`textord`],YG=new Set(qG),XG=new Set(JG);function ZG(e){return YG.has(e)}function QG(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 $G(e){var t=eK(e);if(!t)throw Error(`Expected node of symbol group type, but got `+(e?`node of type `+e.type:String(e)));return t}function eK(e){return e.type===`atom`||XG.has(e.type)?e:null}function tK(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 L(t,e);return r}var nK=e=>{if(e instanceof kU)return e;if(FU(e)& & e.children.length===1)return nK(e.children[0])},rK=(e,t)=>{var n,r,i;e&&e.type===`supsub`?(r=QG(e.base,`accent`),n=r.base,e.base=n,i=PU(gG(e,t)),e.base=r):(r=QG(e,`accent`),n=r.base); var a=gG(n,t.havingCrampedStyle()),o=r.isShifty&&DH(n),s=0; o&&(s=nK(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=GG(r,t),u=UW({positionType:`firstBaseline`,children:[{type:`elem`,elem:a},{type:`elem`,elem:u,wrapperClasses:[`svg-align`],wrapperStyle:s>0?{width:`calc(100% - `+z(2*s)+`)`,marginLeft:z(2*s)}:void 0}]});else{var d,f;r.label===`\\vec`?(d=JW(`vec`,t),f=qW.vec[1]):(d=NW({type:`textord`,mode:r.mode,text:r.label},t),d=NU(d),d.italic=0,f=d.width,c&&(l+=d.depth)),u=X([`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=z(m),r.label===`\\textcircled`& & (u.style.top=`.2em`),u=UW({positionType:`firstBaseline`,children:[{type:`elem`,elem:a},{type:`kern`,size:-l},{type:`elem`,elem:u}]})}var h=X([`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},iK=(e,t)=>{var n=e.isStretchy?HG(e.label):new Q(`mo`,[wG(e.label,e.mode)]),r=new Q(`mover`,[jG(e.base,t),n]);return r.setAttribute(`accent`,`true`),r},aK=new RegExp([`\\acute`,`\\grave`,`\\ddot`,`\\tilde`,`\\bar`,`\\breve`,`\\check`,`\\hat`,`\\vec`,`\\dot`,`\\mathring`].map(e=>`\\`+e).join(`|`));Z({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=iG(t[0]),r=!aK.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:rK,mathmlBuilder:iK}),Z({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}}}),Z({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=gG(e.base,t),r=GG(e,t),i=e.label===`\\utilde`?.12:0;return X([`mord`,`accentunder`],[UW({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=HG(e.label),r=new Q(`munder`,[jG(e.base,t),n]);return r.setAttribute(`accentunder`,`true`),r}});var oK=e=>{var t=new Q(`mpadded`,e?[e]:[]);return t.setAttribute(`width`,`+0.6em`),t.setAttribute(`lspace`,`0.3em`),t};Z({type:`xArrow`,names:[`\\xleftarrow`,`\\xrightarrow`,`\\xLeftarrow`,`\\xRightarrow`,`\\xleftrighLine truncated
]`,Zq =`\\\\[a-zA-Z@]+`,Qq =`\\\\[^\ud800-\udfff]`,$q =`(`+Zq +`)`+Xq +`*`,e J=`\\\\(
-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 _U(e){return`toText`in e}var vU=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(_U(e))return e . toText ( ) ; throw Error ( ` Expected MathDomNode with toText , got ` + e . constructor . name ) } ) . join ( ` ` ) } } , yU = {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},bU={ex:!0,em:!0,mu:!0},xU=function(e){return typeof e ! = ` string ` & & ( e = e.unit),e in yU | | e in bU | | e = ==`ex`},SU=function(e,t){var n ; if ( e . unit in yU ) n = yU[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 L ( ` Invalid unit: ' ` + e . unit + ` ' ` ) ; r ! = = t & & ( n * = r . sizeMultiplier / t . sizeMultiplier ) } return Math . min ( e . number * n , t . maxSize ) } , z = function(e){return+e.toFixed(4)+`em`},CU=function(e){return e . filter ( e = > e).join(` ` ) } , wU = function(e){var t = ``;for(var n of Object . keys ( e ) ) { var r = e[n];r!==void 0 & & ( t + = TH ( n ) + ` : ` + r + ` ; ` ) } return t } , TU = 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)}},EU=function(e){var t = document.createElement(e);t.className=CU(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 } , DU = /[\s"' > /=\x00-\x1f]/,OU=function(e){var t=`< `+e;this.classes.length& & (t+=` class="`+OH(CU(this.classes))+`"`);var n=wU(this.style);n& & (t+=` style="`+OH(n)+`"`);for(var r of Object.keys(this.attributes)){if(DU.test(r))throw new L(`Invalid attribute name '`+r+`'`);t+=` `+r+`="`+OH(this.attributes[r])+`"`}t+=`>`;for(var i=0;i< this.children.length ; i + + ) t + = this . children [ i ] . toMarkup ( ) ; return t + = ` < / ` + e + ` > `,t},kU=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,TU.call(this,e,n,r),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}hasClass(e){return this.classes.includes(e)}toNode(){return EU.call(this,`span`)}toMarkup(){return OU.call(this,`span`)}},AU=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,TU.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 EU.call(this,`a`)}toMarkup(){return OU.call(this,`a`)}},jU=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 = "`+OH(this.src)+`" ` + ( ` alt = "`+OH(this.alt)+`" ` ) , t = wU(this.style);return t & & ( e + = ` style = "`+OH(t)+`" ` ) , e + = ` ' / > `,e}},MU={î:`ı̂`,ï:`ı̈`,í:`ı́`,ì:`ı̀`},NU=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=tU(this.text.charCodeAt(0));c& & this.classes.push(c+`_fallback`),/[îïíì]/.test(this.text)& & (this.text=MU[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=z(this.italic)),this.classes.length>0& & (t||=document.createElement(`span`),t.className=CU(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+=OH(CU(this.classes) Line truncated
`+h+` children.`);for(var v=0;v< h ; v + + ) { var y = new PU ( [ new FU ( d [ v ] ) ] , { width: ` 400em ` , height:z ( m ) , viewBox: ` 0 0 ` + n + ` ` + p , preserveAspectRatio:_ [ v ] + ` slice ` } ) , b = VW([g[v]],[y],t);if(h===1)return{span:b,minWidth:f,height:m};b.style.height=z(m),l.push(b)}return{span:X([`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=z(o),a > 0& & (i.style.minWidth=z(a)),i},XG=function(e,t,n,r,i){var a,o=e.height+e.depth+n+r;if(/fbox|color|angl/.test(t)){if(a=X([`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 IU({x1:`0`,y1:`0`,x2:`100%`,y2:`100%`,"stroke-width":`0.046em`})),/^x?cancel$/.test(t)& & c.push(new IU({x1:`0`,y1:`100%`,x2:`100%`,y2:`0`,"stroke-width":`0.046em`})),a=VW([],[new PU(c,{width:`100%`,height:z(o)})],i)}return a.height=o,a.style.height=z(o),a},ZG=[`bin`,`close`,`inner`,`open`,`punct`,`rel`],QG=[`accent-token`,`mathord`,`op-token`,`spacing`,`textord`],$G=new Set(ZG),eK=new Set(QG);function tK(e){return $G.has(e)}function nK(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 rK(e){var t=iK(e);if(!t)throw Error(`Expected node of symbol group type, but got `+(e?`node of type `+e.type:String(e)));return t}function iK(e){return e.type===`atom`||eK.has(e.type)?e:null}function aK(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 L(t,e);return r}var oK=e=>{if(e instanceof NU)return e;if(zU(e)& & e.children.length===1)return oK(e.children[0])},sK=(e,t)=>{var n,r,i;e&&e.type===`supsub`?(r=nK(e.base,`accent`),n=r.base,e.base=n,i=RU(bG(e,t)),e.base=r):(r=nK(e,`accent`),n=r.base); var a=bG(n,t.havingCrampedStyle()),o=r.isShifty&&jH(n),s=0; o&&(s=oK(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=YG(r,t),u=qW({positionType:`firstBaseline`,children:[{type:`elem`,elem:a},{type:`elem`,elem:u,wrapperClasses:[`svg-align`],wrapperStyle:s>0?{width:`calc(100% - `+z(2*s)+`)`,marginLeft:z(2*s)}:void 0}]});else{var d,f;r.label===`\\vec`?(d=QW(`vec`,t),f=ZW.vec[1]):(d=LW({type:`textord`,mode:r.mode,text:r.label},t),d=LU(d),d.italic=0,f=d.width,c&&(l+=d.depth)),u=X([`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=z(m),r.label===`\\textcircled`& & (u.style.top=`.2em`),u=qW({positionType:`firstBaseline`,children:[{type:`elem`,elem:a},{type:`kern`,size:-l},{type:`elem`,elem:u}]})}var h=X([`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},cK=(e,t)=>{var n=e.isStretchy?KG(e.label):new Q(`mo`,[OG(e.label,e.mode)]),r=new Q(`mover`,[FG(e.base,t),n]);return r.setAttribute(`accent`,`true`),r},lK=new RegExp([`\\acute`,`\\grave`,`\\ddot`,`\\tilde`,`\\bar`,`\\breve`,`\\check`,`\\hat`,`\\vec`,`\\dot`,`\\mathring`].map(e=>`\\`+e).join(`|`));Z({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=cG(t[0]),r=!lK.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:sK,mathmlBuilder:cK}),Z({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}}}),Z({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=bG(e.base,t),r=YG(e,t),i=e.label===`\\utilde`?.12:0;return X([`mord`,`accentunder`],[qW({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=KG(e.label),r=new Q(`munder`,[FG(e.base,t),n]);return r.setAttribute(`accentunder`,`true`),r}});var uK=e=>{var t=new Q(`mpadded`,e?[e]:[]);return t.setAttribute(`width`,`+0.6em`),t.setAttribute(`lspace`,`0.3em`),t};Z({type:`xArrow`,names:[`\\xleftarrow`,`\\xrightarrow`,`\\xLeftarrow`,`\\xRightarrow`,`\\xleftrighLine truncated
]`,tJ =`\\\\[a-zA-Z@]+`,nJ =`\\\\[^\ud800-\udfff]`,rJ =`(`+tJ +`)`+eJ +`*`,i J=`\\\\(
|[ \r ]+
?)[ \r ]*`,t J=`[̀-ͯ]`,n J=RegExp(t J+`+$`),r J=`(`+Xq +`+)|`+(e J+`|`)+`([!-\\[\\]-‧-豈-]`+(t J+`*`)+`|[\ud800-\udbff][\udc00-\udfff]`+(t J+`*`)+`|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5`+(`|`+$q )+(`|`+Qq +`)`),i J=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(r J,`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 i q(`EOF`,new r q(this,t,t));var n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new L(`Unexpected character: '`+e[t]+`'`,new i q(e[t],new r q(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 iq(r,new rq(this,t,this.tokenRegex.lastIndex))}},aJ=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 L(`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}},oJ=nq;$(`\\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 sJ={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 L("\\char` missing argument");else r=t.text.charCodeAt(0)}else n=10;if(n){if(r=sJ[t.text],r==null||r>=n)throw new L(`Invalid base-`+n+` digit `+t.text);for(var i;(i=sJ[e.future().text])!=null&&i<n; )r*=n,r+=i,e.popToken()}return`\\@char{`+r+`}`});var cJ=(e,t,n,r)=>{var i=e.consumeArg().tokens;if(i.length!==1)throw new L(`\\newcommand's first argument must be a macro name`);var a=i[0].text,o=e.isDefined(a);if(o& & !t)throw new L(`\\newcommand{`+a+`} attempting to redefine `+(a+`; use \\renewcommand`));if(!o& & !n)throw new L(`\\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 L(`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=>cJ(e,!1,!0,!1)),$(`\\renewcommand`,e=>cJ(e,!0,!1,!1)),$(`\\providecommand`,e=>cJ(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),Yq[n],UU.math[n],UU.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(y J,t[0])& & !U U[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=y J[t[0]]+t.slice(1));var i=n J.exec(t);i&&(t=t.substring(0,i.index),t===`i`?t=`ı `:t===`j`&&(t=`ȷ`)); var a;if(U U[this.mode][t]){this.settings.strict& & this.mode===`math`& & d W.includes(t)& & this.settings.reportNonstrict(`unicodeTextInMathMode`,`Latin-1/Unicode text character "`+t[0]+`" used in math mode`,e);var o=U U[this.mode][t].group,s=r q.range(e);a=ZG (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& & ($H (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:r q.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(!v J[l])throw new L ( ` Unknown accent ' ` + l + ` ' ` , e ) ; var u = v J[l][this.mode]||v J[l].text;if(!u)throw new L ( ` Accent ` + l + ` unsupported in ` + this . mode + ` mode ` , e ) ; a = {type:`accent`,mode:this.mode,loc:r q.range(e),label:u,isStretchy:!1,isShifty:!0,base:a}}return a } } ; bJ . endOfExpression = new Set ( [ ` } ` , ` \ \ endgroup ` , ` \ \ end ` , ` \ \ right ` , ` & ` ] ) ; var xJ = function(e,t){if(!(typeof e = =`string`||e instanceof String ) ) throw TypeError ( ` KaTeX can only parse string typed expression ` ) ; var n = new bJ ( 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 L ( ` \ \ tag works only in display equations ` ) ; r = [{type:`tag`,mode:`text`,body:r,tag:n.subparse([new iq ( ` \ \ df @ tag ` ) ] ) } ] } return r } , SJ = function(e,t,n){t.textContent=``;var r = E J(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 . ` ) , SJ = function(){throw new L ( ` KaTeX doesn ' t work in quirks mode . ` ) } ) ; var CJ = function(e,t){return EJ ( e , t ) . toMarkup ( ) } , wJ = function(e,t){return xJ ( e , new NH ( t ) ) } , TJ = function(e,t,n){if(n.throwOnError||!(e instanceof L ) ) throw e ; var r = X([`katex-error`],[new kU ( t ) ] ) ; return r . setAttribute ( ` title ` , e . toString ( ) ) , r . setAttribute ( ` style ` , ` color: ` + n . errorColor ) , r } , EJ = function(e,t){var n = new NH ( t ) ; try { return zG ( xJ ( e , n ) , e , n ) } catch ( t ) { return TJ ( t , e , n ) } } , DJ = {version:`0.18.10`,render:S J,renderToString:C J,ParseError:L,SETTINGS_SCHEMA:k H,__parse:w J,__renderToDomTree:E J,__renderToHTMLTree:function(e,t){var n = new NH ( t ) ; try { return BG ( xJ ( e , n ) , e , n ) } catch ( t ) { return TJ ( t , e , n ) } } , __setFontMetrics:z U , __defineSymbol:B , __defineFunction:Z , __defineMacro: $ , __domTree: { Span:T U , Anchor:E U , SymbolNode:k U , SvgNode:A U , PathNode:j U , LineNode:M U } } , OJ = 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{DJ.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)}}}}}),kJ=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},AJ=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:kJ,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{DJ.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)}}}}}),jJ=Tp.create({name:`Mathematics`,addOptions(){return{inlineOptions:void 0,blockOptions:void 0,katexOptions:void 0}},addExtensions(){return[OJ.configure({...this.options.blockOptions,katexOptions:this.options.katexOptions}),AJ.configure({...this.options.inlineOptions,katexOptions:this.options.katexOptions})]}});function MJ(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;YV({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 jJ.configure({katexOptions:{throwOnError:!1,strict:!1,trust:!1},inlineOptions:{onClick:n(`inline`)},blockOptions:{onClick:n(`block`)}})}function NJ({editor:e,overrideSuggestionOptions:t,extensionName:n,char:r=`@`}){return{editor:e,char:r,pluginKey:new Un,command:({editor:e,range:t,props:i})=>{var a,o;let sLine truncated
Idea --> Draft --> Review --> Published`,zJ=null;function BJ(e){return zJ??=e().then(e=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:document.documentElement.classList.contains(`dark`)?`dark`:`neutral`,fontFamily:`inherit`}),e)),zJ}var VJ=0;async function HJ(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 BJ(r)).render(`dw-mermaid-${++VJ}`,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 UJ=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=RJ)=>({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 HJ(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;YV({anchor:a,value:s,label:c.mermaid,multiline:!0,monospace:!0,labels:{done:c.done,cancel:c.cancel,remove:c.remove},onInput:e=>void HJ(o,e,r,i),onSave:n=>{t.chain().setNodeSelection(e).updateAttributes(`mermaid`,{code:n}).run(),HJ(o,n,r,i)},onRemove:()=>t.chain().setNodeSelection(e).deleteSelection().focus().run(),onCancel:()=>void HJ(o,s,r,i)})}),{dom:a,update:e=>e.type.name===`mermaid`&&(e.attrs.code!==s&&(s=String(e.attrs.code),HJ(o,s,r,i)),!0),ignoreMutation:()=>!0,stopEvent:()=>!1}}}}); function WJ(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 GJ(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(`database`,`database`,[`kanban`,`board`,`calendar`,`records`,`tracker`,`notion`],(e,t)=>e.chain().focus().deleteRange(t).insertDatabase().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().Line truncated
?)[ \r ]*`,a J=`[̀-ͯ]`,o J=RegExp(a J+`+$`),s J=`(`+eJ +`+)|`+(i J+`|`)+`([!-\\[\\]-‧-豈-]`+(a J+`*`)+`|[\ud800-\udbff][\udc00-\udfff]`+(a J+`*`)+`|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5`+(`|`+rJ )+(`|`+nJ +`)`),c J=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(s J,`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 c q(`EOF`,new s q(this,t,t));var n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new L(`Unexpected character: '`+e[t]+`'`,new c q(e[t],new s q(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 cq(r,new sq(this,t,this.tokenRegex.lastIndex))}},lJ=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 L(`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}},uJ=oq;$(`\\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 dJ={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 L("\\char` missing argument");else r=t.text.charCodeAt(0)}else n=10;if(n){if(r=dJ[t.text],r==null||r>=n)throw new L(`Invalid base-`+n+` digit `+t.text);for(var i;(i=dJ[e.future().text])!=null&&i<n; )r*=n,r+=i,e.popToken()}return`\\@char{`+r+`}`});var fJ=(e,t,n,r)=>{var i=e.consumeArg().tokens;if(i.length!==1)throw new L(`\\newcommand's first argument must be a macro name`);var a=i[0].text,o=e.isDefined(a);if(o& & !t)throw new L(`\\newcommand{`+a+`} attempting to redefine `+(a+`; use \\renewcommand`));if(!o& & !n)throw new L(`\\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 L(`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=>fJ(e,!1,!0,!1)),$(`\\renewcommand`,e=>fJ(e,!0,!1,!1)),$(`\\providecommand`,e=>fJ(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),$q[n],qU.math[n],qU.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(C J,t[0])& & !q U[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=C J[t[0]]+t.slice(1));var i=o J.exec(t);i&&(t=t.substring(0,i.index),t===`i`?t=`ı `:t===`j`&&(t=`ȷ`)); var a;if(q U[this.mode][t]){this.settings.strict& & this.mode===`math`& & h W.includes(t)& & this.settings.reportNonstrict(`unicodeTextInMathMode`,`Latin-1/Unicode text character "`+t[0]+`" used in math mode`,e);var o=q U[this.mode][t].group,s=s q.range(e);a=tK (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& & (rU (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:s q.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(!S J[l])throw new L ( ` Unknown accent ' ` + l + ` ' ` , e ) ; var u = S J[l][this.mode]||S J[l].text;if(!u)throw new L ( ` Accent ` + l + ` unsupported in ` + this . mode + ` mode ` , e ) ; a = {type:`accent`,mode:this.mode,loc:s q.range(e),label:u,isStretchy:!1,isShifty:!0,base:a}}return a } } ; wJ . endOfExpression = new Set ( [ ` } ` , ` \ \ endgroup ` , ` \ \ end ` , ` \ \ right ` , ` & ` ] ) ; var TJ = function(e,t){if(!(typeof e = =`string`||e instanceof String ) ) throw TypeError ( ` KaTeX can only parse string typed expression ` ) ; var n = new wJ ( 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 L ( ` \ \ tag works only in display equations ` ) ; r = [{type:`tag`,mode:`text`,body:r,tag:n.subparse([new cq ( ` \ \ df @ tag ` ) ] ) } ] } return r } , EJ = function(e,t,n){t.textContent=``;var r = A J(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 . ` ) , EJ = function(){throw new L ( ` KaTeX doesn ' t work in quirks mode . ` ) } ) ; var DJ = function(e,t){return AJ ( e , t ) . toMarkup ( ) } , OJ = function(e,t){return TJ ( e , new LH ( t ) ) } , kJ = function(e,t,n){if(n.throwOnError||!(e instanceof L ) ) throw e ; var r = X([`katex-error`],[new NU ( t ) ] ) ; return r . setAttribute ( ` title ` , e . toString ( ) ) , r . setAttribute ( ` style ` , ` color: ` + n . errorColor ) , r } , AJ = function(e,t){var n = new LH ( t ) ; try { return UG ( TJ ( e , n ) , e , n ) } catch ( t ) { return kJ ( t , e , n ) } } , jJ = {version:`0.18.10`,render:E J,renderToString:D J,ParseError:L,SETTINGS_SCHEMA:N H,__parse:O J,__renderToDomTree:A J,__renderToHTMLTree:function(e,t){var n = new LH ( t ) ; try { return WG ( TJ ( e , n ) , e , n ) } catch ( t ) { return kJ ( t , e , n ) } } , __setFontMetrics:U U , __defineSymbol:B , __defineFunction:Z , __defineMacro: $ , __domTree: { Span:k U , Anchor:A U , SymbolNode:N U , SvgNode:P U , PathNode:F U , LineNode:I U } } , MJ = 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{jJ.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)}}}}}),NJ=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},PJ=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:NJ,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{jJ.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)}}}}}),FJ=Tp.create({name:`Mathematics`,addOptions(){return{inlineOptions:void 0,blockOptions:void 0,katexOptions:void 0}},addExtensions(){return[MJ.configure({...this.options.blockOptions,katexOptions:this.options.katexOptions}),PJ.configure({...this.options.inlineOptions,katexOptions:this.options.katexOptions})]}});function IJ(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;QV({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 FJ.configure({katexOptions:{throwOnError:!1,strict:!1,trust:!1},inlineOptions:{onClick:n(`inline`)},blockOptions:{onClick:n(`block`)}})}function LJ({editor:e,overrideSuggestionOptions:t,extensionName:n,char:r=`@`}){return{editor:e,char:r,pluginKey:new Un,command:({editor:e,range:t,props:i})=>{var a,o;let sLine truncated
Idea --> Draft --> Review --> Published`,UJ=null;function WJ(e){return UJ??=e().then(e=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:document.documentElement.classList.contains(`dark`)?`dark`:`neutral`,fontFamily:`inherit`}),e)),UJ}var GJ=0;async function KJ(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 WJ(r)).render(`dw-mermaid-${++GJ}`,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 qJ=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=HJ)=>({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 KJ(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;QV({anchor:a,value:s,label:c.mermaid,multiline:!0,monospace:!0,labels:{done:c.done,cancel:c.cancel,remove:c.remove},onInput:e=>void KJ(o,e,r,i),onSave:n=>{t.chain().setNodeSelection(e).updateAttributes(`mermaid`,{code:n}).run(),KJ(o,n,r,i)},onRemove:()=>t.chain().setNodeSelection(e).deleteSelection().focus().run(),onCancel:()=>void KJ(o,s,r,i)})}),{dom:a,update:e=>e.type.name===`mermaid`&&(e.attrs.code!==s&&(s=String(e.attrs.code),KJ(o,s,r,i)),!0),ignoreMutation:()=>!0,stopEvent:()=>!1}}}}); function JJ(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 YJ(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(`database`,`database`,[`kanban`,`board`,`calendar`,`records`,`tracker`,`notion`],(e,t)=>e.chain().focus().deleteRange(t).insertDatabase().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().Line truncated
]`).replace(`lheading`,jY).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},KY=/^\\([!"#$%&'()*+,\-./:; < =>?@\[\]\\^_`{|}~])/,qY=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,JY=/^( {2,}|\\)\n(?!\s*$)/,YY=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,XY=/[\p{P}\p{S}]/u,ZY=/[\s\p{P}\p{S}]/u,QY=/[^\s\p{P}\p{S}]/u,$Y=xY(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,ZY).getRegex(),eX=/(?!~)[\p{P}\p{S}]/u,tX=/(?!~)[\s\p{P}\p{S}]/u,nX=/(?:[^\s\p{P}\p{S}]|~)/u,rX=xY(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a> `+)[^`]+\k< a > (?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,SY?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b> `+)[^`]+\k< b > (?!`)/).replace(`html`,/< (?! )[^< >]*?>/).getRegex(),iX=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,aX=xY(iX,`u`).replace(/punct/g,XY).getRegex(),oX=xY(iX,`u`).replace(/punct/g,eX).getRegex(),sX=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,cX=xY(sX,`gu`).replace(/notPunctSpace/g,QY).replace(/punctSpace/g,ZY).replace(/punct/g,XY).getRegex(),lX=xY(sX,`gu`).replace(/notPunctSpace/g,nX).replace(/punctSpace/g,tX).replace(/punct/g,eX).getRegex(),uX=xY(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,QY).replace(/punctSpace/g,ZY).replace(/punct/g,XY).getRegex(),dX=xY(/\\(punct)/,`gu`).replace(/punct/g,XY).getRegex(),fX=xY(/^< (scheme:[^\s\x00-\x1f< >]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%& '*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),pX=xY(zY).replace(`(?:-->|$)`,`-->`).getRegex(),mX=xY(`^comment|^< /[a-zA-Z][\\w:-]*\\s*>|^< [a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^< \\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?> |^<!\\[CDATA\\[[\\s\\S]*?\\]\\]> `).replace(`comment`,pX).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=< >`]+)?/).getRegex(),hX=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,gX=xY(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,hX).replace(`href`,/< (?:\\.|[^\n< >\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_X=xY(/^!?\[(label)\]\[(ref)\]/).replace(`label`,hX).replace(`ref`,FY).getRegex(),vX=xY(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,FY).getRegex(),yX=xY(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,_X).replace(`nolink`,vX).getRegex(),bX=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,xX={_backpedal:bY,anyPunctuation:dX,autolink:fX,blockSkip:rX,br:JY,code:qY,del:bY,emStrongLDelim:aX,emStrongRDelimAst:cX,emStrongRDelimUnd:uX,escape:KY,link:gX,nolink:vX,punctuation:$Y,reflink:_X,reflinkSearch:yX,tag:mX,text:YY,url:bY},SX={...xX,link:xY(/^!?\[(label)\]\((.*?)\)/).replace(`label`,hX).getRegex(),reflink:xY(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,hX).getRegex()},CX={...xX,emStrongRDelimAst:lX,emStrongLDelim:oX,url:xY(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s< ]*|^email/).replace(`protocol`,bX).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+; $)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:xY(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%& '*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,bX).getRegex()},wX={...CX,br:xY(JY).replace(`{2,}`,`*`).getRegex(),text:xY(CX.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},TX={normal:HY,gfm:WY,pedantic:GY},EX={normal:xX,gfm:CX,breaks:wX,pedantic:SX},DX={"&":`&`,"<":`<`,"> ":`> `,'"':`" `,"'":`' `},OX=e=>DX[e];function kX(e,t){if(t){if(CY.escapeTest.test(e))return e.replace(CY.escapeReplace,OX)}else if(CY.escapeTestNoEncode.test(e))return e.replace(CY.escapeReplaceNoEncode,OX);return e}function AX(e){try{e=encodeURI(e).replace(CY.percentDecode,`%`)}catch{return null}return e}function jX(e,t){let n=e.replace(CY.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`; )r=!r;return r?`|`:` |`}).split(CY.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t); else for(;n.length< t ; ) n . push ( ` ` ) } for ( ; r < n . length ; r + + ) n [ r ] = n [ r ] . trim ( ) . replace ( CY . sl Line truncated
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
`)}var IX=class{options;rules;lexer;constructor(e){this.options=e||vY}space(e){let t=this.rules.block.newline.exec(e);if(t& & t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:MX(e,`
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=FX(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=MX(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))& & (e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:MX(t[0],`
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=MX(t[0],`
`).split(`
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o< e.length ; o + + ) if ( this . rules . other . blockquoteStart . test ( e [ o ] ) ) a . push ( e [ o ] ) , t = !0;else if ( ! t ) a . push ( e [ o ] ) ; else break ; e = e.slice(o);let s = a.join(`
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
${s}`:s,r=r?`${r}
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
`+e.join(`
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
`+e.join(`
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
`)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`); let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
`,1)[0].replace(this.rules.other.listReplaceTabs,e=>` `.repeat(3*e.length)),l=e.split(`
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u& & this.rules.other.blankLine.test(l)& & (r+=l+`
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let f=e.split(`
`,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
`+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
`+l}!u& & !l.trim()& & (u=!0),r+=f+`
`,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)); let f=null,p;this.options.gfm& & (f=this.rules.other.listIsTask.exec(s),f& & (p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e< i.items.length ; e + + ) if ( this . lexer . state . top = !1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t = i.items[e].tokens.filter(e= > e.type===`space`);i.loose=t.length>0& & t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e< i.items.length ; e + + ) i . items [ e ] . loose = !0;return i } } html ( e ) { let t = this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t = this.rules.block.def.exec(e);if(t){let e = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` ` ) , n = t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t = this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n = jX(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e< n.length ; e + + ) a . header . push ( { text:n [ e ] , tokens:this . lexer . inline ( n [ e ] ) , header: ! 0 , align:a . align [ e ] } ) ; for ( let e of i ) a . rows . push ( jX ( e , a . header . length ) . map ( ( e , t ) = > ({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink& & this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink& & this.rules.other.endATag.test(t[0])& & (this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock& & this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock& & this.rules.other.endPreScriptTag.test(t[0])& & (this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return; let t=MX(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=NX(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e& & (n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)& & (n=this.options.pedantic& & !this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),PX(t,{href:n& & n.replace(this.rules.inline.anyPunctuation,`$1`),title:r& & r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return PX(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]& & n.match(this.rules.other.unicodeAlphaNumeric))& & (!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a; continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e); return n& & r& & (e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},LX=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||vY,this.options.tokenizer=this.options.tokenizer||new IX,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:CY,block:TX.normal,inline:EX.normal};this.options.pedantic?(t.block=TX.pedantic,t.inline=EX.pedantic):this.options.gfm& & (t.block=TX.gfm,t.inline=this.options.breaks?EX.breaks:EX.gfm),this.tokenizer.rules=t}static get rules(){return{block:TX,inline:EX}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(CY.carriageReturn,`
`),this.blockTokens(e,this.tokens);for(let e=0;e< this.inlineQueue.length ; e + + ) { let t = this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this . inlineQueue = [],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(CY.tabCharGlobal,` ` ) . replace ( CY . spaceLine , ` ` ) ) ; e ; ) { let r ; if ( this . options . extensions ? . block ? . some ( n = > (r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n = t.at(-1);r.raw.length===1&&n!==void 0 ? n . raw + = `
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
`)?``:`
`)+r.raw,n.text+=`
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if((r=this.tokenizer.fences(e))||(r=this.tokenizer.heading(e))||(r=this.tokenizer.hr(e))||(r=this.tokenizer.blockquote(e))||(r=this.tokenizer.list(e))||(r=this.tokenizer.html(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
`)?``:`
`)+r.raw,n.text+=`
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if((r=this.tokenizer.table(e))||(r=this.tokenizer.lheading(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`& & r>=0& & (t=Math.min(t,r))}),t< 1 / 0 & & t > =0& & (i=e.substring(0,t+1))}if(this.state.top& & (r=this.tokenizer.paragraph(i))){let a=t.at(-1);n& & a?.type===`paragraph`?(a.raw+=(a.raw.endsWith(`
`)?``:`
`)+r.raw,a.text+=`
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length)}else if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
`)?``:`
`)+r.raw,n.text+=`
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r)}else if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(; (r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``;for(;e;){a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if((r=this.tokenizer.escape(e))||(r=this.tokenizer.tag(e))||(r=this.tokenizer.link(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r); continue}if((r=this.tokenizer.emStrong(e,n,o))||(r=this.tokenizer.codespan(e))||(r=this.tokenizer.br(e))||(r=this.tokenizer.del(e))||(r=this.tokenizer.autolink(e))||!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r); continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0; let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r)}else if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}},RX=class{options;parser;constructor(e){this.options=e||vY}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(CY.notSpaceStart)?.[0],i=e.replace(CY.endingNewline,``)+`
`;return r?`< pre > < code class = "language-`+kX(r)+`" > `+(n?i:kX(i,!0))+`< / code > < / pre >
`:`< pre > < code > `+(n?i:kX(i,!0))+`< / code > < / pre >
`}blockquote({tokens:e}){return`< blockquote >
${this.parser.parse(e)}< / blockquote >
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`< h $ { t } > ${this.parser.parseInline(e)}< /h${t}>
`}hr(e){return`< hr >
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t< e.items.length ; t + + ) { let n = e.items[t];r+=this.listitem(n)}let i = t?`ol`:`ul`,a=t&&n!==1?` start = "`+n+`" ` : ` ` ; return ` < ` + i + a + ` >
`+r+`< /`+i+`>
`}listitem(e){let t=``;if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type===`paragraph`?(e.tokens[0].text=n+` `+e.tokens[0].text,e.tokens[0].tokens& & e.tokens[0].tokens.length>0& & e.tokens[0].tokens[0].type===`text`& & (e.tokens[0].tokens[0].text=n+` `+kX(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:`text`,raw:n+` `,text:n+` `,escaped:!0}):t+=n+` `}return t+=this.parser.parse(e.tokens,!!e.loose),`< li > ${t}< / li >
`}checkbox({checked:e}){return`< input ` + ( e ? ` checked = "" ` : ` ` ) + ` disabled = "" type = "checkbox" > `}paragraph({tokens:e}){return`< p > ${this.parser.parseInline(e)}< / p >
`}table(e){let t=``,n=``;for(let t=0;t< e.header.length ; t + + ) n + = this . tablecell ( e . header [ t ] ) ; t + = this . tablerow ( { text:n } ) ; let r = ``;for(let t = 0;t<e.rows.length;t++){let i = e.rows[t];n=``;for(let e = 0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r & & = ` < tbody > ${r}< / tbody > `,`< table >
< thead >
`+t+`< / thead >
`+r+`< / table >
`}tablerow({text:e}){return`< tr >
${e}< / tr >
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`< ${n} align="${e.align}">`:`< ${n}>`)+t+`< /${n}>
`}strong({tokens:e}){return`< strong > ${this.parser.parseInline(e)}< / strong > `}em({tokens:e}){return`< em > ${this.parser.parseInline(e)}< / em > `}codespan({text:e}){return`< code > ${kX(e,!0)}< / code > `}br(e){return`< br > `}del({tokens:e}){return`< del > ${this.parser.parseInline(e)}< / del > `}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=AX(e);if(i===null)return r;e=i;let a=`< a href = "`+e+`" ` ; return t & & ( a + = ` title = "`+kX(t)+`" ` ) , a + = ` > `+r+`< / a > `,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer)); let i=AX(e);if(i===null)return kX(n);e=i;let a=`< img src = "${e}" alt = "${n}" ` ; return t & & ( a + = ` title = "${kX(t)}" ` ) , a + = ` > `,a}text(e){return`tokens`in e& & e.tokens?this.parser.parseInline(e.tokens):`escaped`in e& & e.escaped?e.text:kX(e.text)}},zX=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},BX=class e{options;renderer;textRenderer;constructor(e){this.options=e||vY,this.options.renderer=this.options.renderer||new RX,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new zX}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r< e.length ; r + + ) { let i = e[r];if(this.options.extensions?.renderers?.[i.type]){let e = i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a = i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`def`:n+=this.renderer.def(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i = a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
`+this.renderer.text(i);n+=t?this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r< e.length ; r + + ) { let i = e[r];if(this.options.extensions?.renderers?.[i.type]){let e = this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a = i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e = `Token with " ` + a . type + ` " type was not found . ` ; if ( this . options . silent ) return console . error ( e ) , ` ` ; throw Error ( e ) } } } return n } } , VX = class{options;block;constructor(e){this.options=e||vY}static passThroughHooks = new Set ( [ ` preprocess ` , ` postprocess ` , ` processAllTokens ` , ` emStrongMask ` ] ) ; static passThroughHooksRespectAsync = new Set ( [ ` preprocess ` , ` postprocess ` , ` processAllTokens ` ] ) ; preprocess ( e ) { return e } postprocess ( e ) { return e } processAllTokens ( e ) { return e } emStrongMask ( e ) { return e } provideLexer ( ) { return this . block ? LX . lex:LX . lexInline } provideParser ( ) { return this . block ? BX . parse:BX . parseInline } } , HX = new class { defaults = _Y();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=BX;Renderer=RX;TextRenderer=zX;Lexer=LX;Tokenizer=IX;Hooks=VX;constructor(...e){this.use(...e)}walkTokens(e,t){let n = [];for(let r of e ) switch ( n = n.concat(t.call(this,r)),r.type){case`table`:{let e = r;for(let r of e . header ) n = n.concat(this.walkTokens(r.tokens,t));for(let r of e . rows ) for ( let e of r ) n = n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e = r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e = r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r= > {let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens& & (n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions& & (e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1& & (r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`& & e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start& & (e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`& & (t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e& & e.childTokens& & (t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new RX(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1& & (n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new IX(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1& & (n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new VX;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=VX.passThroughHooks.has(n)?e=>{if(this.defaults.async& & VX.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1& & (n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1& & (n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t& & (n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return LX.lex(e,t??this.defaults)}parser(e,t){return BX.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0& & r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async:Line truncated
Please report this to https://github.com/markedjs/marked.`,e){let e=`< p > An error occurred:< / p > < pre > `+kX(n.message+``,!0)+`< / pre > `;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function UX(e,t){return HX.parse(e,t)}UX.options=UX.setOptions=function(e){return HX.setOptions(e),UX.defaults=HX.defaults,yY(UX.defaults),UX},UX.getDefaults=_Y,UX.defaults=vY,UX.use=function(...e){return HX.use(...e),UX.defaults=HX.defaults,yY(UX.defaults),UX},UX.walkTokens=function(e,t){return HX.walkTokens(e,t)},UX.parseInline=HX.parseInline,UX.Parser=BX,UX.parser=BX.parse,UX.Renderer=RX,UX.TextRenderer=zX,UX.Lexer=LX,UX.lexer=LX.lex,UX.Tokenizer=IX,UX.Hooks=VX,UX.parse=UX,UX.options,UX.setOptions,UX.use,UX.walkTokens,UX.parseInline,BX.parse,LX.lex;function WX(e){let t=e??NR;return{...mF,...t.edgeless,colors:{...mF.colors,...t.colors}}}function GX(e){let t=e?.surface;return Array.isArray(t?.elements)?t.elements:[]}function KX(e,t,n){let r={...n,placeholder:n.placeholder??``},i=new Vp({element:e,editable:t.kind!==`json`& & t.editable,content:t.kind===`json`?t.content:void 0,extensions:t.kind===`page`?hY({...r,collab:{provider:t.provider,user:t.user}}):t.kind===`body`?hY({...r,rowBody:{doc:t.doc,fragment:t.fragment}}):hY(r),editorProps:{attributes:{class:`dw-prose`}}});return{destroy:()=>i.destroy(),focus:()=>i.commands.focus(`end`),setEditable:e=>i.setEditable(e& & t.kind!==`json`)}}function qX(e,t){let n=!!t.provider,r,i=null;if(t.provider)r=t.provider.doc;else{i=new Cv,r=i;let e=t.content;i.transact(()=>ZL(i.getXmlFragment(`default`),e?.content??[]));let n=GX(e);if(n.length){let e=new iR(i,{undo:!1});e.load(n),e.destroy()}}let a={...t};delete a.provider,delete a.content;let o=new SR(e,{doc:r,editable:n& & t.editable,notes:{mount:(e,r)=>{let i=n?r.page?{kind:`page`,provider:t.provider,user:t.user??{name:`?`,color:`#888`},editable:r.editable}:{kind:`body`,doc:r.doc,fragment:r.fragment,editable:r.editable}:{kind:`json`,content:r.page&&t.content?t.content:{type:`doc`,content:XL(r.fragment)}}; return t.mountNote?t.mountNote(e,i):KX(e,i,a)}},labels:WX(t.labels),files:t.files,links:t.links,embedSource:eH,styles:t.styles,onStyles:t.onStyles,viewKey:t.viewKey,pageTitle:t.pageTitle,undo:n,onError:t.onError,onComment:t.onComment,onCommentSelect:t.onCommentSelect});return{view:o,setEditable:e=>o.setEditable(n& & e),destroy:()=>{o.destroy(),i?.destroy()}}}function JX(e,t,n){let r=Zj(t),i=RB(t);if(!r&&!i)return()=>{}; let a=()=>i?BB(e,i.database,i.row):rM(e,r),o=!1,s,c=()=>{clearTimeout(s),s=setTimeout(()=>{o||e.isDestroyed||!a()||(o=!0,l(),n?.())},50)},l=()=>{e.off(`transaction`,c),clearTimeout(u)},u=setTimeout(l,5e3);return e.on(`transaction`,c),c(),()=>{l(),clearTimeout(s)}}var YX=3e4,XX=class extends pm{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let e=Fh();this.getLocalState()!==null&&15e3<=e-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState()); let t=[];this.meta.forEach((n,r)=>{r!==this.clientID& & 3e4< =e-n.lastUpdated& & this.states.has(r)& & t.push(r)}),t.length>0& & ZX(this,t,`timeout`)},mm(YX/10)),e.on(`destroy`,()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit(`destroy`,[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){let t=this.clientID,n=this.meta.get(t),r=n===void 0?0:n.clock+1,i=this.states.get(t);e===null?this.states.delete(t):this.states.set(t,e),this.meta.set(t,{clock:r,lastUpdated:Fh()});let a=[],o=[],s=[],c=[];e===null?c.push(t):i==null?e!=null& & a.push(t):(o.push(t),tg(i,e)||s.push(t)),(a.length>0||s.length>0||c.length>0)& & this.emit(`change`,[{added:a,updated:s,removed:c},`local`]),this.emit(`update`,[{added:a,updated:o,removed:c},`local`])}setLocalStateField(e,t){let n=this.getLocalState();n!==null& & this.setLocalState({...n,[e]:t})}getStates(){return this.states}},ZX=(e,t,n)=>{let r=[];for(let n=0;n< t.length ; n + + ) { let i = t[n];if(e.states.has(i)){if(e.states.delete(i),i===e.clientID){let t = e.meta.get(i);e.meta.set(i,{clock:t.clock+1,lastUpdated:Fh()})}r.push(i)}}r.length > 0& & (e.emit(`change`,[{added:[],updated:[],removed:r},n]),e.emit(`update`,[{added:[],updated:[],removed:r},n]))},QX=(e,t,n=e.states)=>{let r=t.length,i=Fm();j(i,r);for(let a=0;a< r ; a + + ) { let r = t[a],o=n.get(r)||null,s=e.meta.get(r).clock;j(i,r),j(i,s),Gm(i,JSON.stringify(o))}return Rm ( i ) } , $ X = (e,t,n)= > {let r=hh(t),i=Fh(),a=[],o=[],s=[],c=[],l=M(r);for(let t=0;t< l ; t + + ) { let t = M(r),n=M(r),l=JSON.parse(xh(r)),u=e.meta.get(t),d=e.states.get(t),f=u===void 0 ? 0:u . clock ; ( f < n | | f = ==n&&l===null&&e.states.has(t))&&(l===null?t===e.clientID&&e.getLocalState()!=null?n++:e.states.delete(t):e.states.set(t,l),e.meta.set(t,{clock:n,lastUpdated:i}),u===void 0 & & l ! = = null ? a . push ( t ) :u ! = = void 0 & & l = ==null?c.push(t):l!==null&&(tg(l,d)||s.push(t),o.push(t)))}(a.length > 0||s.length>0||c.length>0)& & e.emit(`change`,[{added:a,updated:s,removed:c},nLine truncated
`),before:e.state.doc.textBetween(Math.max(0,t-4e3),t,`
`)});return}case`insertMarkdown`:this.insertMarkdown(e.markdown,e.mode);return;case`transcribed`:{let t=this.pendingTranscripts.get(e.id);if(!t)return;this.pendingTranscripts.delete(e.id),e.result&&this.words?t.resolve(Qp(e.result,this.words,_Z)):t.reject(Error(e.error||this.labels.blocks.transcribeFailed)); return}default:throw Error(`unknown message ${e.type}`)}}requestTranscript(e,t){let n=this.nextTranscript++;return new Promise((r,i)=>{this.pendingTranscripts.set(n,{resolve:r,reject:i}),this.send({type:`transcribe`,id:n,src:e,name:t})})}insertMarkdown(e,t){let n=this.picked,r=n&&!n.editor.isDestroyed?n.editor:this.target,i=_Z(e); if(!i.trim())return;let a=r.state.doc.content.size,o=Math.min(n?.from??r.state.selection.from,a),s=Math.min(n?.to??r.state.selection.to,a);if(t===`replace`)r.chain().focus().insertContentAt({from:o,to:s},i).run();else{let e=r.state.doc.resolve(s);r.chain().focus().insertContentAt(e.depth>=1?e.after(1):s,i).run()}this.picked=null}connect(e){this.provider?.destroy();let t=new fZ({url:e.url,page:e.page,token:()=>e.token});t.onChange(()=>this.send({type:`collab`,status:t.status})),this.provider=t,this.editor.destroy(),this.editor=this.create({collab:{provider:t,user:e.user}}),this.mode===`edgeless`&&this.openCanvas()}openCanvas(){this.closeCanvas(); let e=document.createElement(`div`);e.className=`dw-bridge-canvas`,document.body.append(e),this.canvasEl=e,this.el.hidden=!0,this.canvas=qX(e,{provider:this.provider??void 0,content:this.provider?void 0:this.lastContent??this.editor.getJSON(),editable:this.editable& & !!this.provider,pageTitle:()=>this.title,onNavigate:e=>this.send({type:`navigate`,path:e}),onError:e=>this.send({type:`error`,message:e instanceof Error?e.message:String(e)})})}closeCanvas(){this.canvas?.destroy(),this.canvas=null,this.canvasEl?.remove(),this.canvasEl=null,this.el.hidden=!1}create(e){return this.el.replaceChildren(),new Vp({element:this.el,editable:this.editable,extensions:hY({...e,files:this.files,labels:this.labels,onNavigate:e=>this.send({type:`navigate`,path:e})}),editorProps:{attributes:{class:`dw-prose`}},onUpdate:({editor:e})=>this.send({type:`change`,content:e.getJSON()}),onSelectionUpdate:()=>this.reportState(),onTransaction:()=>this.reportState(),onFocus:()=>this.reportState(),onBlur:()=>this.reportState()})}get target(){return this.inner& & !this.inner.isDestroyed?this.inner:this.editor}track(e){let t=(e instanceof Element?e.closest(`.ProseMirror`):null)?.editor;t&&(this.setInner(t===this.editor?null:t),this.reportState())}innerChanged=()=>this.reportState(); innerGone=()=>{this.setInner(null),this.reportState()};setInner(e){if(e!==this.inner){if(this.inner){for(let e of[`selectionUpdate`,`transaction`,`focus`,`blur`])this.inner.off(e,this.innerChanged);this.inner.off(`destroy`,this.innerGone)}if(this.inner=e,e){for(let t of[`selectionUpdate`,`transaction`,`focus`,`blur`])e.on(t,this.innerChanged);e.on(`destroy`,this.innerGone)}}}reportOverlay(){let e=document.querySelector(pZ)!==null;e!==this.overlay& & (this.overlay=e,this.send({type:`overlay`,open:e}))}reportState(){let e=this.target;if(e.isDestroyed)return;let t={active:hZ.filter(([,t])=>t(e)).map(([e])=>e),canUndo:e.can().undo(),canRedo:e.can().redo(),focused:e.isFocused},n=JSON.stringify(t);n!==this.lastState&&(this.lastState=n,this.send({type:`state`,state:t}))}}; function _Z(e){return UX.parse(e.trim(),{async:!1,gfm:!0})}function vZ(e){if(e.isDestroyed)return;let t=e.view.props.nodeViews??{},n=Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)]));e.view.setProps({nodeViews:n})}function yZ(e){let t=JSON.stringify(e);window.DocwellNative?window.DocwellNative.postMessage(t):(window.parent.postMessage(t,`*`),console.debug(`[docwell bridge]`,e))}var bZ=new gZ(document.getElementById(`editor`),yZ);window.docwell={receive:e=>bZ.receive(e)};< / script >
< style rel = "stylesheet" crossorigin > / * ! t a i l w i n d c s s v 4 . 3 . 3 | M I T L i c e n s e | h t t p s : / / t a i l w i n d c s s . c o m * /
@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);--shadow-dialog:var(--dw-shadow-dialog);--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-varLine 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);--shadow-dialog:var(--dw-shadow-dialog);--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-varLine truncated
/*$vite$:1*/< / style >
< / head >
< body >