clawpad 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/app-path-routes-manifest.json +7 -7
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/react-loadable-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +2 -2
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/api/ai/write/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/changes/[id]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/changes/record/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/changes/revert/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/changes/route.js +1 -1
- package/.next/standalone/.next/server/app/api/changes/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/changes/run/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/chat/abort/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/chat/route.js +7 -7
- package/.next/standalone/.next/server/app/api/chat/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/files/pages/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/files/recent/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/files/search/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/files/spaces/[space]/pages/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/files/spaces/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/files/watch/route.js +1 -1
- package/.next/standalone/.next/server/app/api/files/watch/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/gateway/detect/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/gateway/events/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/gateway/features/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/gateway/history/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/gateway/resolve/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/gateway/sessions/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/gateway/status/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/openclaw/commands/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/settings/search-status/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/setup/bootstrap/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/setup/bootstrap-workspace/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/setup/status/route.js +1 -1
- package/.next/standalone/.next/server/app/api/setup/status/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/api/setup/trigger-onboarding/route_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/connection/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings/connection.html +1 -1
- package/.next/standalone/.next/server/app/settings/connection.rsc +2 -2
- package/.next/standalone/.next/server/app/settings/connection.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/settings/connection.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings/connection.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/settings/connection.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/settings/connection.segments/settings/connection/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings/connection.segments/settings/connection.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings/connection.segments/settings.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/settings.html +1 -1
- package/.next/standalone/.next/server/app/settings.rsc +2 -2
- package/.next/standalone/.next/server/app/settings.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/settings.segments/settings.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/setup/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/setup.html +1 -1
- package/.next/standalone/.next/server/app/setup.rsc +2 -2
- package/.next/standalone/.next/server/app/setup.segments/_full.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/setup.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/setup.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/setup.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/setup.segments/setup/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/setup.segments/setup.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspace/[...path]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspace/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspace/search/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/workspace/search.html +2 -2
- package/.next/standalone/.next/server/app/workspace/search.rsc +3 -3
- package/.next/standalone/.next/server/app/workspace/search.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/workspace/search.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspace/search.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/workspace/search.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/workspace/search.segments/workspace/search/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspace/search.segments/workspace/search.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspace/search.segments/workspace.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/workspace.html +2 -2
- package/.next/standalone/.next/server/app/workspace.rsc +3 -3
- package/.next/standalone/.next/server/app/workspace.segments/_full.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/workspace.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspace.segments/_index.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/workspace.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/workspace.segments/workspace/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/workspace.segments/workspace.segment.rsc +2 -2
- package/.next/standalone/.next/server/app-paths-manifest.json +7 -7
- package/.next/standalone/.next/server/chunks/3251.js +1 -1
- package/.next/standalone/.next/server/chunks/534.js +1 -1
- package/.next/standalone/.next/server/chunks/7035.js +8 -8
- package/.next/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/.next/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +2 -2
- package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
- package/.next/standalone/package.json +1 -1
- package/.next/static/chunks/{20-4cfa0dd1c497eee3.js → 20-3538f9e141103136.js} +4 -4
- package/.next/static/chunks/{6361.298d554a6bf5dde1.js → 6361.95d268081af200a1.js} +2 -2
- package/.next/static/chunks/app/workspace/{layout-9717963f2fdd1346.js → layout-8f93dc32bce5ac46.js} +1 -1
- package/.next/static/chunks/ba12c10f-c1e7cb71acafac81.js +1 -0
- package/.next/static/chunks/{webpack-2f676db6328b0d7d.js → webpack-0c9808987c6b957c.js} +1 -1
- package/.next/static/css/58342f9a044e019d.css +1 -0
- package/bin/clawpad.js +121 -1
- package/package.json +1 -1
- package/public/install.sh +19 -0
- package/.next/static/chunks/ba12c10f-d2d630b861c021fb.js +0 -1
- package/.next/static/css/a44c237eaaac8354.css +0 -1
- /package/.next/static/{WjQpy-wj7aRX-ddVHKjXc → LvUY6ibmmD6EHrRtm1qSH}/_buildManifest.js +0 -0
- /package/.next/static/{WjQpy-wj7aRX-ddVHKjXc → LvUY6ibmmD6EHrRtm1qSH}/_ssgManifest.js +0 -0
|
@@ -14,8 +14,8 @@ ${c}`}function nZ({theme:e,color:t,colorScheme:r,name:n=t,withColorValues:o=!0})
|
|
|
14
14
|
`));return l.forEach(t=>re(e,t)),{insertedBlocks:o.map(e=>(0,s.a)(e,n)),removedBlocks:a}}let rr=(e,t,r,n)=>{var i;let a=e.pmSchema.nodes.blockGroup,l=a.spec.toDOM(a.create({})),c=function e(t,r,n,i){let a=((null==i?void 0:i.document)??document).createDocumentFragment();for(let l of r){let r=function(t,r,n,i){var a,l,c,d,h;let p=t.pmSchema.nodes.blockContainer,u=r.props||{};for(let[e,n]of Object.entries(t.schema.blockSchema[r.type].propSchema))e in u||void 0===n.default||(u[e]=n.default);let f=r.children||[],m=t.blockImplementations[r.type].implementation.render.call({renderType:"dom",props:void 0},{...r,props:u,children:f},t);if(m.contentDOM&&r.content){let e=function(e,t,r,n,i){let a;if(t)if("string"==typeof t)a=(0,s.i)([t],e.pmSchema,n);else if(Array.isArray(t))a=(0,s.i)(t,e.pmSchema,n);else if("tableContent"===t.type)a=(0,s.t)(t,e.pmSchema);else throw new s.U(t.type);else throw Error("blockContent is required");let l=((null==i?void 0:i.document)??document).createDocumentFragment();for(let t of a)if("text"!==t.type.name&&e.schema.inlineContentSchema[t.type.name]){let n=e.schema.inlineContentSpecs[t.type.name].implementation;if(n){let o=(0,s.n)(t,e.schema.inlineContentSchema,e.schema.styleSchema),a=n.render.call({renderType:"dom",props:void 0},o,()=>{},e);if(a){if(l.appendChild(a.dom),a.contentDOM){let e=r.serializeFragment(t.content,i);a.contentDOM.dataset.editable="",a.contentDOM.appendChild(e)}continue}}}else if("text"===t.type.name){let r=document.createTextNode(t.textContent);for(let n of t.marks.toReversed())if(n.type.name in e.schema.styleSpecs){let t=e.schema.styleSpecs[n.type.name].implementation.render(n.attrs.stringValue,e);t.contentDOM.appendChild(r),r=t.dom}else{let e=n.type.spec.toDOM(n,!0),t=o.ZF.renderSpec(document,e);t.contentDOM.appendChild(r),r=t.dom}l.appendChild(r)}else{let e=r.serializeFragment(o.FK.from([t]),i);l.appendChild(e)}return l}(t,r.content,n,r.type,i);m.contentDOM.appendChild(e)}if(t.pmSchema.nodes[r.type].isInGroup("bnBlock")){if(r.children&&r.children.length>0){let o=e(t,r.children,n,i);null==(a=m.contentDOM)||a.append(o)}return m.dom}let g=null==(c=null==(l=p.spec)?void 0:l.toDOM)?void 0:c.call(l,p.create({id:r.id,...u}));return null==(d=g.contentDOM)||d.appendChild(m.dom),r.children&&r.children.length>0&&(null==(h=g.contentDOM)||h.appendChild(rr(t,r.children,n,i))),g.dom}(t,l,n,i);a.appendChild(r)}return a}(e,t,r,n);return null==(i=l.contentDOM)||i.appendChild(c),l.dom},rn=e=>(e.querySelectorAll('[data-content-type="numberedListItem"]').forEach(e=>{var t,r;let n=null==(r=null==(t=e.closest(".bn-block-outer"))?void 0:t.previousElementSibling)?void 0:r.querySelector('[data-content-type="numberedListItem"]');if(n){let t=n.getAttribute("data-index");e.setAttribute("data-index",(parseInt(t||"0")+1).toString())}else e.setAttribute("data-index",e.getAttribute("data-start")||"1")}),e),ro=e=>(e.querySelectorAll('[data-content-type="checkListItem"] input').forEach(e=>{e.disabled=!0}),e),ri=e=>(e.querySelectorAll('.bn-toggle-wrapper[data-show-children="false"]').forEach(e=>{e.setAttribute("data-show-children","true")}),e),rs=e=>(e.querySelectorAll('[data-content-type="table"] table').forEach(e=>{e.setAttribute("style",`--default-cell-min-width: ${a.a}px;`),e.setAttribute("data-show-children","true")}),e),ra=e=>(e.querySelectorAll('[data-content-type="table"] table').forEach(e=>{var t;let r=document.createElement("div");r.className="tableWrapper";let n=document.createElement("div");n.className="tableWrapper-inner",r.appendChild(n),null==(t=e.parentElement)||t.appendChild(r),r.appendChild(e)}),e),rl=e=>(e.querySelectorAll(".bn-inline-content:empty").forEach(e=>{let t=document.createElement("span");t.className="ProseMirror-trailingBreak",t.setAttribute("style","display: inline-block;"),e.appendChild(t)}),e);function rc(e,t,r){e.transact(n=>{var o;let i=(null==(o=e.getSelection())?void 0:o.blocks)||[e.getTextCursorPosition().block],l=e.transact(e=>{let t=(0,s.q)(e.doc,e.selection.anchor);if(e.selection instanceof ta.rn)return{type:"cell",anchorBlockId:t.node.attrs.id,anchorCellOffset:e.selection.$anchorCell.pos-t.posBeforeNode,headCellOffset:e.selection.$headCell.pos-t.posBeforeNode};if(e.selection instanceof f.nh)return{type:"node",anchorBlockId:t.node.attrs.id};{let r=(0,s.q)(e.doc,e.selection.head);return{type:"text",anchorBlockId:t.node.attrs.id,headBlockId:r.node.attrs.id,anchorOffset:e.selection.anchor-t.posBeforeNode,headOffset:e.selection.head-r.posBeforeNode}}});e.removeBlocks(i),e.insertBlocks(function e(t){return t.map(t=>"columnList"===t.type?t.children.map(t=>e(t.children)).flat():{...t,children:e(t.children)}).flat()}(i),t,r),function(e,t){var r,n;let o,i=null==(r=(0,a.aj)(t.anchorBlockId,e.doc))?void 0:r.posBeforeNode;if(void 0===i)throw Error(`Could not find block with ID ${t.anchorBlockId} to update selection`);if("cell"===t.type)o=ta.rn.create(e.doc,i+t.anchorCellOffset,i+t.headCellOffset);else if("node"===t.type)o=f.nh.create(e.doc,i+1);else{let r=null==(n=(0,a.aj)(t.headBlockId,e.doc))?void 0:n.posBeforeNode;if(void 0===r)throw Error(`Could not find block with ID ${t.headBlockId} to update selection`);o=f.U3.create(e.doc,i+t.anchorOffset,r+t.headOffset)}e.setSelection(o)}(n,l)})}function rd(e){return!e||"columnList"!==e.type}function rh(e){return e.transact(t=>(function(e,t,r){let{$from:n,$to:s}=e.selection,a=n.blockRange(s,e=>e.childCount>0&&("blockGroup"===e.type.name||"column"===e.type.name));if(!a)return!1;let l=a.startIndex;if(0===l)return!1;let c=a.parent.child(l-1);if(c.type!==t)return!1;let d=c.lastChild&&c.lastChild.type===r,h=o.FK.from(d?t.create():null),p=new o.Ji(o.FK.from(t.create(null,o.FK.from(r.create(null,h)))),d?3:1,0),u=a.start,f=a.end;return e.step(new i.Wg(u-(d?3:1),f,u,f,p,1,!0)).scrollIntoView(),!0})(t,e.pmSchema.nodes.blockContainer,e.pmSchema.nodes.blockGroup))}class rp{constructor(e){this.editor=e}get document(){return this.editor.transact(e=>(0,s.d)(e.doc,this.editor.pmSchema))}getBlock(e){return this.editor.transact(t=>(function(e,t){let r="string"==typeof t?t:t.id,n=(0,s.g)(e),o=(0,a.aj)(r,e);if(o)return(0,s.a)(o.node,n)})(t.doc,e))}getPrevBlock(e){return this.editor.transact(t=>(function(e,t){let r="string"==typeof t?t:t.id,n=(0,a.aj)(r,e),o=(0,s.g)(e);if(!n)return;let i=e.resolve(n.posBeforeNode).nodeBefore;if(i)return(0,s.a)(i,o)})(t.doc,e))}getNextBlock(e){return this.editor.transact(t=>(function(e,t){let r="string"==typeof t?t:t.id,n=(0,a.aj)(r,e),o=(0,s.g)(e);if(!n)return;let i=e.resolve(n.posBeforeNode+n.node.nodeSize).nodeAfter;if(i)return(0,s.a)(i,o)})(t.doc,e))}getParentBlock(e){return this.editor.transact(t=>(function(e,t){let r="string"==typeof t?t:t.id,n=(0,s.g)(e),o=(0,a.aj)(r,e);if(!o)return;let i=e.resolve(o.posBeforeNode),l=i.node(),c=i.node(-1),d="doc"!==c.type.name?"blockGroup"===l.type.name?c:l:void 0;if(d)return(0,s.a)(d,n)})(t.doc,e))}forEachBlock(e,t=!1){let r=this.document.slice();t&&r.reverse(),!function r(n){for(let o of n)if(!1===e(o)||!r(t?o.children.slice().reverse():o.children))return!1;return!0}(r)}insertBlocks(e,t,r="before"){return this.editor.transact(n=>(function(e,t,r,n="before"){let l="string"==typeof r?r:r.id,c=(0,s.g)(e),d=t.map(e=>(0,s.b)(e,c)),h=(0,a.aj)(l,e.doc);if(!h)throw Error(`Block with ID ${l} not found`);let p=h.posBeforeNode;return"after"===n&&(p+=h.node.nodeSize),e.step(new i.Ln(p,p,new o.Ji(o.FK.from(d),0,0))),d.map(e=>(0,s.a)(e,c))})(n,e,t,r))}updateBlock(e,t){return this.editor.transact(r=>(0,a.ao)(r,e,t))}removeBlocks(e){return this.editor.transact(t=>rt(t,e,[]).removedBlocks)}replaceBlocks(e,t){return this.editor.transact(r=>rt(r,e,t))}canNestBlock(){return this.editor.transact(e=>{let{bnBlock:t}=(0,s.r)(e);return null!==e.doc.resolve(t.beforePos).nodeBefore})}nestBlock(){rh(this.editor)}canUnnestBlock(){return this.editor.transact(e=>{let{bnBlock:t}=(0,s.r)(e);return e.doc.resolve(t.beforePos).depth>1})}unnestBlock(){this.editor._tiptapEditor.commands.liftListItem("blockContainer")}moveBlocksUp(){var e;(e=this.editor).transact(()=>{let t=e.getSelection(),r=(null==t?void 0:t.blocks[0])||e.getTextCursorPosition().block,n=function e(t,r,n){let o,i;if(r?r.children.length>0?(o=r.children[r.children.length-1],i="after"):(o=r,i="before"):n&&(o=n,i="before"),!o||!i)return;let s=t.getParentBlock(o);return rd(s)?{referenceBlock:o,placement:i}:e(t,"after"===i?o:t.getPrevBlock(o),s)}(e,e.getPrevBlock(r),e.getParentBlock(r));n&&rc(e,n.referenceBlock,n.placement)})}moveBlocksDown(){var e;(e=this.editor).transact(()=>{let t=e.getSelection(),r=(null==t?void 0:t.blocks[(null==t?void 0:t.blocks.length)-1])||e.getTextCursorPosition().block,n=function e(t,r,n){let o,i;if(r?r.children.length>0?(o=r.children[0],i="before"):(o=r,i="after"):n&&(o=n,i="after"),!o||!i)return;let s=t.getParentBlock(o);return rd(s)?{referenceBlock:o,placement:i}:e(t,"before"===i?o:t.getNextBlock(o),s)}(e,e.getNextBlock(r),e.getParentBlock(r));n&&rc(e,n.referenceBlock,n.placement)})}}class ru extends h.E{constructor(e){super(),this.editor=e,e.on("create",()=>{e._tiptapEditor.on("update",({transaction:t,appendedTransactions:r})=>{this.emit("onChange",{editor:e,transaction:t,appendedTransactions:r})}),e._tiptapEditor.on("selectionUpdate",({transaction:t})=>{this.emit("onSelectionChange",{editor:e,transaction:t})}),e._tiptapEditor.on("mount",()=>{this.emit("onMount",{editor:e})}),e._tiptapEditor.on("unmount",()=>{this.emit("onUnmount",{editor:e})})})}onChange(e,t=!0){let r=({transaction:r,appendedTransactions:n})=>{!t&&rf(r)||e(this.editor,{getChanges:()=>(0,l.j)(r,n)})};return this.on("onChange",r),()=>{this.off("onChange",r)}}onSelectionChange(e,t=!1){let r=r=>{!t&&rf(r.transaction)||e(this.editor)};return this.on("onSelectionChange",r),()=>{this.off("onSelectionChange",r)}}onMount(e){return this.on("onMount",e),()=>{this.off("onMount",e)}}onUnmount(e){return this.on("onUnmount",e),()=>{this.off("onUnmount",e)}}}function rf(e){return!!e.getMeta("y-sync$")}let rm=null;function rg(e,t){let r=function(e){if("string"==typeof e){let t=(rm||(rm=document.implementation.createHTMLDocument("title"))).createElement("div");t.innerHTML=e,e=t}return e.querySelectorAll("li > ul, li > ol").forEach(e=>{let t=Array.prototype.indexOf.call(e.parentElement.childNodes,e),r=e.parentElement,n=Array.from(r.childNodes).slice(t+1);e.remove(),n.forEach(e=>{e.remove()}),r.insertAdjacentElement("afterend",e),n.reverse().forEach(t=>{if(3===t.nodeType&&!/\S/.test(t.nodeValue||""))return;let r=document.createElement("li");r.append(t),e.insertAdjacentElement("afterend",r)}),0===r.childNodes.length&&r.remove()}),e.querySelectorAll("li + ul, li + ol").forEach(e=>{var t,r;let n=e.previousElementSibling,o=document.createElement("div");n.insertAdjacentElement("afterend",o),o.append(n);let i=document.createElement("div");for(i.setAttribute("data-node-type","blockGroup"),o.append(i);(null==(t=o.nextElementSibling)?void 0:t.nodeName)==="UL"||(null==(r=o.nextElementSibling)?void 0:r.nodeName)==="OL";)i.append(o.nextElementSibling)}),e}(e),n=o.S4.fromSchema(t).parse(r,{topNode:t.nodes.blockGroup.create()}),i=[];for(let e=0;e<n.childCount;e++)i.push((0,s.a)(n.child(e),t));return i}function rE(e,t){let r=t.value?t.value:"",n={};t.lang&&(n["data-language"]=t.lang);let o={type:"element",tagName:"code",properties:n,children:[{type:"text",value:r}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o={type:"element",tagName:"pre",properties:{},children:[o=e.applyData(t,o)]},e.patch(t,o),o}function rb(e){return(0,t6.l)().use(td.A).use(tc.A).use(th.A,{handlers:{...tp.Y,image:(e,t)=>{var r;let n,o,i=String((null==t?void 0:t.url)||"");return(0,a.ap)(i)?(o={type:"element",tagName:"video",properties:{src:n=String((null==t?void 0:t.url)||""),"data-name":null!=t&&t.title?String(t.title):void 0,"data-url":n,controls:!0},children:[]},null==(r=e.patch)||r.call(e,t,o),o=e.applyData?e.applyData(t,o):o):tp.Y.image(e,t)},code:rE,blockquote:(e,t)=>{let r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!1)};return e.patch(t,r),e.applyData(t,r)}}}).use(t4).processSync(e).value}class ry{constructor(e){this.editor=e}blocksToHTMLLossy(e=this.editor.document){return(0,l.k)(this.editor.pmSchema,this.editor).exportBlocks(e,{})}blocksToFullHTML(e=this.editor.document){var t,r;let n,i;return(t=this.editor.pmSchema,r=this.editor,n=o.ZF.fromSchema(t),i=[rn,ro,ri,rs,ra,rl],{serializeBlocks:(e,t)=>{let o=rr(r,e,n,t);for(let e of i)o=e(o);return o.outerHTML}}).serializeBlocks(e,{})}tryParseHTMLToBlocks(e){return rg(e,this.editor.pmSchema)}blocksToMarkdownLossy(e=this.editor.document){return(0,l.l)(e,this.editor.pmSchema,this.editor,{})}tryParseMarkdownToBlocks(e){var t;return t=this.editor.pmSchema,rg(rb(e),t)}pasteHTML(e,t=!1){var r;let n=e;if(!t){let t=this.tryParseHTMLToBlocks(e);n=this.blocksToFullHTML(t)}n&&(null==(r=this.editor.prosemirrorView)||r.pasteHTML(n))}pasteText(e){var t;return null==(t=this.editor.prosemirrorView)?void 0:t.pasteText(e)}pasteMarkdown(e){let t=rb(e);return this.pasteHTML(t)}}let rT=["vscode-editor-data","blocknote/html","text/markdown","text/html","text/plain","Files"];function rv(e,t,r,n="after"){return Array.isArray(t.content)&&0===t.content.length?e.updateBlock(t,r).id:e.insertBlocks([r],t,n)[0].id}async function rk(e,t){var r;if(!t.uploadFile)return void console.warn("Attempted ot insert file, but uploadFile is not set in the BlockNote editor options");let n="dataTransfer"in e?e.dataTransfer:e.clipboardData;if(null===n)return;let o=null;for(let e of rT)if(n.types.includes(e)){o=e;break}if("Files"!==o)return;let i=n.items;if(i){e.preventDefault();for(let n=0;n<i.length;n++){let o="file";for(let e of Object.values(t.schema.blockSpecs))for(let t of(null==(r=e.implementation.meta)?void 0:r.fileBlockAccept)||[]){let r=t.startsWith("."),s=i[n].getAsFile();if(s&&(!r&&s.type&&function(e,t){let r=e.split("/"),n=t.split("/");if(2!==r.length)throw Error(`The string ${e} is not a valid MIME type.`);if(2!==n.length)throw Error(`The string ${t} is not a valid MIME type.`);return"*"===r[1]||"*"===n[1]?r[0]===n[0]:("*"===r[0]||"*"===n[0]||r[0]===n[0])&&r[1]===n[1]}(i[n].type,t)||r&&function(e,t){if(!e.startsWith(".")||!t.startsWith("."))throw Error("The strings provided are not valid file extensions.");return e===t}("."+s.name.split(".").pop(),t))){o=e.config.type;break}}let a=i[n].getAsFile();if(a){let r,n={type:o,props:{name:a.name}};if("paste"===e.type){let e=t.getTextCursorPosition().block;r=rv(t,e,n)}else{if("drop"!==e.type)return;let o={left:e.clientX,top:e.clientY},i=t.prosemirrorView.posAtCoords(o);if(!i)return;r=t.transact(e=>{var r;let a=(0,s.q)(e.doc,i.pos),l=null==(r=t.domElement)?void 0:r.querySelector(`[data-id="${a.node.attrs.id}"]`),c=null==l?void 0:l.getBoundingClientRect();return rv(t,t.getBlock(a.node.attrs.id),n,c&&(c.top+c.bottom)/2>o.top?"before":"after")})}let i=await t.uploadFile(a,r),l="string"==typeof i?{props:{url:i}}:{...i};t.updateBlock(r,l)}}}}let rA=/(^|\n) {0,3}#{1,6} {1,8}[^\n]{1,64}\r?\n\r?\n\s{0,32}\S/,rC=/(_|__|\*|\*\*|~~|==|\+\+)(?!\s)(?:[^\s](?:.{0,62}[^\s])?|\S)(?=\1)/,rS=/\[[^\]]{1,128}\]\(https?:\/\/\S{1,999}\)/,rw=/(?:\s|^)`(?!\s)(?:[^\s`](?:[^`]{0,46}[^\s`])?|[^\s`])`([^\w]|$)/,r_=/(?:^|\n)\s{0,5}-\s{1}[^\n]+\n\s{0,15}-\s/,rN=/(?:^|\n)\s{0,5}\d+\.\s{1}[^\n]+\n\s{0,15}\d+\.\s/,rI=/\n{2} {0,3}-{2,48}\n{2}/,rx=/(?:\n|^)(```|~~~|\$\$)(?!`|~)[^\s]{0,64} {0,64}[^\n]{0,64}\n[\s\S]{0,9999}?\s*\1 {0,64}(?:\n+|$)/,rM=/(?:\n|^)(?!\s)\w[^\n]{0,64}\r?\n(-|=)\1{0,64}\n\n\s{0,64}(\w|$)/,rO=/(?:^|(\r?\n\r?\n))( {0,3}>[^\n]{1,333}\n){1,999}($|(\r?\n))/,rD=/^\s*\|(.+\|)+\s*$/m,rR=/^\s*\|(\s*[-:]+[-:]\s*\|)+\s*$/m,rL=/^\s*\|(.+\|)+\s*$/m;async function rP(e,t){let{schema:r}=t.state;if(!e.clipboardData)return!1;let n=e.clipboardData.getData("text/plain");if(!n)return!1;if(!r.nodes.codeBlock)return t.pasteText(n),!0;let o=e.clipboardData.getData("vscode-editor-data"),i=o?JSON.parse(o):void 0,s=null==i?void 0:i.mode;return!!s&&(t.pasteHTML(`<pre><code class="language-${s}">${n.replace(/\r\n?/g,`
|
|
15
15
|
`)}</code></pre>`),!0)}function rB(e,t){"node"in e.state.selection&&"blockContent"===e.state.selection.node.type.spec.group&&t.transact(t=>t.setSelection(new f.nh(t.doc.resolve(e.state.selection.from-1))));let r=e.serializeForClipboard(e.state.selection.content()).dom.innerHTML,n=e.state.selection.content().content,o=function(e,t,r){var n;let o,i=!1,a=e.state.selection instanceof ta.rn;if(!a){let r=e.state.doc.slice(e.state.selection.from,e.state.selection.to,!1).content,n=[];for(let e=0;e<r.childCount;e++)n.push(r.child(e));(i=void 0===n.find(e=>e.type.isInGroup("bnBlock")||"blockGroup"===e.type.name||"blockContent"===e.type.spec.group))&&(t=r)}let c=(0,l.k)(e.state.schema,r);if(a){(null==(n=t.firstChild)?void 0:n.type.name)==="table"&&(t=t.firstChild.content);let e=(0,s.s)(t,r.schema.inlineContentSchema,r.schema.styleSchema);o=`<table>${c.exportInlineContent(e,{})}</table>`}else if(i){let e=(0,s.u)(t,r.schema.inlineContentSchema,r.schema.styleSchema);o=c.exportInlineContent(e,{})}else{let e=(0,l.n)(t);o=c.exportBlocks(e,{})}return o}(e,n,t),i=(0,l.m)(o);return{clipboardHTML:r,externalHTML:o,markdown:i}}let rF=()=>{let e=window.getSelection();if(!e||e.isCollapsed)return!0;let t=e.focusNode;for(;t;){if(t instanceof HTMLElement&&"false"===t.getAttribute("contenteditable"))return!0;t=t.parentElement}return!1},rU=(e,t,r)=>{r.preventDefault(),r.clipboardData.clearData();let{clipboardHTML:n,externalHTML:o,markdown:i}=rB(t,e);r.clipboardData.setData("blocknote/html",n),r.clipboardData.setData("text/html",o),r.clipboardData.setData("text/plain",i)},rH=d.YY.create({name:"blockBackgroundColor",addGlobalAttributes:()=>[{types:["tableCell","tableHeader"],attributes:{backgroundColor:(0,a.a5)()}}]}),rj=d.bP.create({name:"hardBreak",inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,priority:10,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",(0,d.KV)(this.options.HTMLAttributes,e)]},renderText:()=>`
|
|
16
16
|
`}),r$=(e,t)=>{let r=e.resolve(t),n=r.index();if(0===n)return;let o=r.posAtIndex(n-1);return(0,s.v)(e.resolve(o))},rG=(e,t)=>{for(;t.childContainer;){let r=t.childContainer.node,n=e.resolve(t.childContainer.beforePos+1).posAtIndex(r.childCount-1);t=(0,s.v)(e.resolve(n))}return t},rz=e=>({state:t,dispatch:r})=>{let n=t.doc.resolve(e),o=(0,s.v)(n),i=r$(t.doc,o.bnBlock.beforePos);if(!i)return!1;let a=rG(t.doc,i);return!!a.isBlockContainer&&"inline*"===a.blockContent.node.type.spec.content&&a.blockContent.node.childCount>0&&!!o.isBlockContainer&&"inline*"===o.blockContent.node.type.spec.content&&((e,t,r,n)=>{if(!n.isBlockContainer)throw Error(`Attempted to merge block at position ${n.bnBlock.beforePos} into previous block at position ${r.bnBlock.beforePos}, but next block is not a block container`);if(n.childContainer){let r=e.doc.resolve(n.childContainer.beforePos+1),o=e.doc.resolve(n.childContainer.afterPos-1),i=r.blockRange(o);if(t){let t=e.doc.resolve(n.bnBlock.beforePos);e.tr.lift(i,t.depth)}}if(t){if(!r.isBlockContainer)throw Error(`Attempted to merge block at position ${n.bnBlock.beforePos} into previous block at position ${r.bnBlock.beforePos}, but previous block is not a block container`);t(e.tr.delete(r.blockContent.afterPos-1,n.blockContent.beforePos+1))}return!0})(t,r,a,o)},rV=d.YY.create({priority:50,addKeyboardShortcuts(){let e=(e=!1)=>this.editor.commands.first(({commands:t,tr:r})=>[()=>t.command(({state:e})=>{let r=(0,s.w)(e);if(!r.isBlockContainer)return!1;let{bnBlock:n,blockContent:o}=r,{depth:i}=e.doc.resolve(n.beforePos),a=0===e.selection.$anchor.parentOffset,l=e.selection.anchor===e.selection.head,c=0===o.node.childCount;return!!a&&!!l&&!!c&&i>1&&t.liftListItem("blockContainer")}),()=>t.command(({state:t})=>{var n;let o=(0,s.w)(t),i=(null==(n=this.options.editor.schema.blockSchema[o.blockNoteType].meta)?void 0:n.hardBreakShortcut)??"shift+enter";if("none"===i)return!1;if("shift+enter"===i&&e||"enter"===i){let e=r.storedMarks||r.selection.$head.marks().filter(e=>this.editor.extensionManager.splittableMarks.includes(e.type.name));return r.insert(r.selection.head,r.doc.type.schema.nodes.hardBreak.create()).ensureMarks(e),!0}return!1}),()=>t.command(({state:e,dispatch:t})=>{let r=(0,s.w)(e);if(!r.isBlockContainer)return!1;let{bnBlock:n,blockContent:o}=r,i=0===e.selection.$anchor.parentOffset,a=e.selection.anchor===e.selection.head,l=0===o.node.childCount;if(i&&a&&l){let r=n.afterPos;if(t){let t=e.schema.nodes.blockContainer.createAndFill();e.tr.insert(r,t).scrollIntoView(),e.tr.setSelection(new f.U3(e.doc.resolve(r+2)))}return!0}return!1}),()=>t.command(({state:e,chain:t})=>{let r=(0,s.w)(e);if(!r.isBlockContainer)return!1;let{blockContent:n}=r,o=0===e.selection.$anchor.parentOffset;return 0!==n.node.childCount&&(t().deleteSelection().command((0,a.aq)(e.selection.from,o,o)).run(),!0)})]);return{Backspace:()=>this.editor.commands.first(({chain:e,commands:t})=>[()=>t.deleteSelection(),()=>t.undoInputRule(),()=>t.command(({state:e})=>{let r=(0,s.w)(e);if(!r.isBlockContainer)return!1;let n=e.selection.from===r.blockContent.beforePos+1,o="paragraph"===r.blockContent.node.type.name;return!!n&&!o&&t.command((0,a.ar)(r.bnBlock.beforePos,{type:"paragraph",props:{}}))}),()=>t.command(({state:e})=>{let r=(0,s.w)(e);if(!r.isBlockContainer)return!1;let{blockContent:n}=r;return e.selection.from===n.beforePos+1&&t.liftListItem("blockContainer")}),()=>t.command(({state:t})=>{let r=(0,s.w)(t);if(!r.isBlockContainer)return!1;let{bnBlock:n,blockContent:o}=r,i=t.selection.from===o.beforePos+1,a=t.selection.empty,l=n.beforePos;return!!i&&!!a&&e().command(rz(l)).scrollIntoView().run()}),()=>t.command(({state:e,tr:t,dispatch:r})=>{let n=(0,s.w)(e);if(!n.isBlockContainer||t.selection.from!==n.blockContent.beforePos+1)return!1;let o=t.doc.resolve(n.bnBlock.beforePos);if(o.nodeBefore||"column"!==o.node().type.name)return!1;let i=t.doc.resolve(n.bnBlock.beforePos),a=t.doc.resolve(i.before()),l=a.before();if(r){let e=t.doc.slice(n.bnBlock.beforePos,n.bnBlock.afterPos).content;t.delete(n.bnBlock.beforePos,n.bnBlock.afterPos),0===a.index()?(re(t,l),t.insert(l,e),t.setSelection(f.U3.near(t.doc.resolve(l)))):(t.insert(a.pos-1,e),t.setSelection(f.U3.near(t.doc.resolve(a.pos-1))),re(t,l))}return!0}),()=>t.command(({state:t})=>{let r=(0,s.w)(t);if(!r.isBlockContainer)return!1;if(0===r.blockContent.node.childCount&&"inline*"===r.blockContent.node.type.spec.content){let n=r$(t.doc,r.bnBlock.beforePos);if(!n||!n.isBlockContainer)return!1;let o=e();if("tableRow+"===n.blockContent.node.type.spec.content){let e=r.bnBlock.beforePos-1-1-1-1-1;o=o.setTextSelection(e)}else if(""===n.blockContent.node.type.spec.content){let e=n.blockContent.afterPos-n.blockContent.node.nodeSize;o=o.setNodeSelection(e)}else{let e=n.blockContent.afterPos-n.blockContent.node.nodeSize;o=o.setTextSelection(e)}return o.deleteRange({from:r.bnBlock.beforePos,to:r.bnBlock.afterPos}).scrollIntoView().run()}return!1}),()=>t.command(({state:t})=>{let r=(0,s.w)(t);if(!r.isBlockContainer)throw Error("todo");let n=t.selection.from===r.blockContent.beforePos+1,o=t.selection.empty,i=r$(t.doc,r.bnBlock.beforePos);if(i&&n&&o){let n=rG(t.doc,i);if(!n.isBlockContainer)throw Error("todo");if(""===n.blockContent.node.type.spec.content||"inline*"===n.blockContent.node.type.spec.content&&0===n.blockContent.node.childCount)return e().cut({from:r.bnBlock.beforePos,to:r.bnBlock.afterPos},n.bnBlock.afterPos).deleteRange({from:n.bnBlock.beforePos,to:n.bnBlock.afterPos}).run()}return!1})]),Delete:()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.command(({state:t})=>{let r=(0,s.w)(t);if(!r.isBlockContainer)return!1;let{bnBlock:n,blockContent:o,childContainer:i}=r,{depth:a}=t.doc.resolve(n.beforePos),l=n.afterPos===t.doc.nodeSize-3,c=t.selection.from===o.afterPos-1,d=t.selection.empty;if(!l&&c&&d&&void 0===i){let r=a,o=n.afterPos+1,i=t.doc.resolve(o).depth;for(;i<r;)r=i,o+=2,i=t.doc.resolve(o).depth;return e.command(rz(o-1))}return!1})]),Enter:()=>e(),"Shift-Enter":()=>e(!0),Tab:()=>{var e,t;return("prefer-indent"===this.options.tabBehavior||(null==(e=this.options.editor.getExtension(l.c))||!e.store.state)&&(null==(t=this.options.editor.getExtension(a.a8))?void 0:t.store.state)===void 0)&&rh(this.options.editor)},"Shift-Tab":()=>{var e,t;return("prefer-indent"===this.options.tabBehavior||(null==(e=this.options.editor.getExtension(l.c))||!e.store.state)&&(null==(t=this.options.editor.getExtension(a.a8))?void 0:t.store.state)===void 0)&&this.editor.commands.liftListItem("blockContainer")},"Shift-Mod-ArrowUp":()=>(this.options.editor.moveBlocksUp(),!0),"Shift-Mod-ArrowDown":()=>(this.options.editor.moveBlocksDown(),!0),"Mod-z":()=>this.options.editor.undo(),"Mod-y":()=>this.options.editor.redo(),"Shift-Mod-z":()=>this.options.editor.redo()}}}),rW=d.CU.create({name:"insertion",inclusive:!1,excludes:"deletion modification insertion",addAttributes:()=>({id:{default:null,validate:"number"}}),extendMarkSchema:e=>"insertion"!==e.name?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM:(e,t)=>["ins",{"data-id":String(e.attrs.id),"data-inline":String(t),...!t&&{style:"display: contents"}},0],parseDOM:[{tag:"ins",getAttrs:e=>!!e.dataset.id&&{id:parseInt(e.dataset.id,10)}}]}}),rY=d.CU.create({name:"deletion",inclusive:!1,excludes:"insertion modification deletion",addAttributes:()=>({id:{default:null,validate:"number"}}),extendMarkSchema:e=>"deletion"!==e.name?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM:(e,t)=>["del",{"data-id":String(e.attrs.id),"data-inline":String(t),...!t&&{style:"display: contents"}},0],parseDOM:[{tag:"del",getAttrs:e=>!!e.dataset.id&&{id:parseInt(e.dataset.id,10)}}]}}),rq=d.CU.create({name:"modification",inclusive:!1,excludes:"deletion insertion",addAttributes:()=>({id:{default:null,validate:"number"},type:{validate:"string"},attrName:{default:null,validate:"string|null"},previousValue:{default:null},newValue:{default:null}}),extendMarkSchema:e=>"modification"!==e.name?{}:{blocknoteIgnore:!0,inclusive:!1,toDOM:(e,t)=>[t?"span":"div",{"data-type":"modification","data-id":String(e.attrs.id),"data-mod-type":e.attrs.type,"data-mod-prev-val":JSON.stringify(e.attrs.previousValue),"data-mod-new-val":JSON.stringify(e.attrs.newValue)},0],parseDOM:[{tag:"span[data-type='modification']",getAttrs:e=>!!e.dataset.id&&{id:parseInt(e.dataset.id,10),type:e.dataset.modType,previousValue:e.dataset.modPrevVal,newValue:e.dataset.modNewVal}},{tag:"div[data-type='modification']",getAttrs:e=>!!e.dataset.id&&{id:parseInt(e.dataset.id,10),type:e.dataset.modType,previousValue:e.dataset.modPrevVal}}]}}),rK=d.YY.create({name:"textAlignment",addGlobalAttributes:()=>[{types:["tableCell","tableHeader"],attributes:{textAlignment:{default:"left",parseHTML:e=>e.getAttribute("data-text-alignment"),renderHTML:e=>"left"===e.textAlignment?{}:{"data-text-alignment":e.textAlignment}}}}]}),rJ=d.YY.create({name:"blockTextColor",addGlobalAttributes:()=>[{types:["table","tableCell","tableHeader"],attributes:{textColor:(0,a.a6)()}}]}),rQ={blockColor:"data-block-color",blockStyle:"data-block-style",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},rX=d.bP.create({name:"blockContainer",group:"blockGroupChild bnBlock",content:"blockContent blockGroup?",priority:50,defining:!0,marks:"insertion modification deletion",parseHTML(){return[{tag:"div[data-node-type="+this.name+"]",getAttrs:e=>{if("string"==typeof e)return!1;let t={};for(let[r,n]of Object.entries(rQ))e.getAttribute(n)&&(t[r]=e.getAttribute(n));return t}},{tag:'div[data-node-type="blockOuter"]',skip:!0}]},renderHTML({HTMLAttributes:e}){var t;let r=document.createElement("div");for(let[t,n]of(r.className="bn-block-outer",r.setAttribute("data-node-type","blockOuter"),Object.entries(e)))"class"!==t&&r.setAttribute(t,n);let n={...(null==(t=this.options.domAttributes)?void 0:t.block)||{},...e},o=document.createElement("div");for(let[e,t]of(o.className=(0,a.as)("bn-block",n.class),o.setAttribute("data-node-type",this.name),Object.entries(n)))"class"!==e&&o.setAttribute(e,t);return r.appendChild(o),{dom:r,contentDOM:o}}}),rZ=d.bP.create({name:"blockGroup",group:"childContainer",content:"blockGroupChild+",marks:"deletion insertion modification",parseHTML:()=>[{tag:"div",getAttrs:e=>"string"!=typeof e&&"blockGroup"===e.getAttribute("data-node-type")&&null}],renderHTML({HTMLAttributes:e}){var t;let r={...(null==(t=this.options.domAttributes)?void 0:t.blockGroup)||{},...e},n=document.createElement("div");for(let[e,t]of(n.className=(0,a.as)("bn-block-group",r.class),n.setAttribute("data-node-type","blockGroup"),Object.entries(r)))"class"!==e&&n.setAttribute(e,t);return{dom:n,contentDOM:n}}}),r0=d.bP.create({name:"doc",topNode:!0,content:"blockGroup",marks:"insertion modification deletion"}),r1=(0,b.c)(({options:e})=>({key:"collaboration",blockNoteExtensions:[(0,l.F)(e),(0,l.Y)(e),(0,l.a)(e),(0,l.b)(),(0,l.S)(e)]})),r2=!1;class r3{constructor(e,t){for(const r of(t9(this,"disabledExtensions",new Set),t9(this,"extensions",[]),t9(this,"abortMap",new Map),t9(this,"extensionFactories",new Map),t9(this,"extensionPlugins",new Map),this.editor=e,this.options=t,e.onMount(()=>{for(let t of this.extensions)if(t.mount){let r=new window.AbortController,n=t.mount({dom:e.prosemirrorView.dom,root:e.prosemirrorView.root,signal:r.signal});n&&r.signal.addEventListener("abort",()=>{n()}),this.abortMap.set(t,r)}}),e.onUnmount(()=>{for(let[e,t]of this.abortMap.entries())this.abortMap.delete(e),t.abort()}),this.disabledExtensions=new Set(t.disableExtensions||[]),function(e,t){let r=[(0,l.B)(),(0,l.D)(t),(0,a.a8)(t),(0,l.c)(t),(0,l.L)(t),(0,l.N)(),(0,l.P)(t),(0,tl.S)(t),(0,l.g)(t),(0,a.a9)(t),...!1!==t.trailingBlock?[(0,l.i)()]:[]];return t.collaboration?r.push(r1(t.collaboration)):r.push((0,l.H)()),"table"in e.schema.blockSpecs&&r.push((0,l.h)(t)),!1!==t.animations&&r.push((0,l.e)()),r}(this.editor,this.options)))this.addExtension(r);for(const e of this.options.extensions??[])this.addExtension(e);for(const e of Object.values(this.editor.schema.blockSpecs))for(const t of e.extensions??[])this.addExtension(t)}registerExtension(e){var t;let r=[].concat(e).filter(Boolean);if(!r.length)return void console.warn("No extensions found to register",e);let n=r.map(e=>this.addExtension(e)).filter(Boolean),o=new Set;for(let e of n)null!=e&&e.tiptapExtensions&&console.warn(`Extension ${e.key} has tiptap extensions, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,e),null!=(t=null==e?void 0:e.inputRules)&&t.length&&console.warn(`Extension ${e.key} has input rules, but these cannot be changed after initializing the editor. Please separate the extension into multiple extensions if you want to add them, or re-initialize the editor.`,e),this.getProsemirrorPluginsFromExtension(e).plugins.forEach(e=>{o.add(e)});this.updatePlugins(e=>[...e,...o])}addExtension(e){let t;if(!(!(t="function"==typeof e?e({editor:this.editor}):e)||this.disabledExtensions.has(t.key))){if("function"==typeof e){let e=t[b.o];"function"==typeof e&&this.extensionFactories.set(e,t)}if(this.extensions.push(t),t.blockNoteExtensions)for(let e of t.blockNoteExtensions)this.addExtension(e);return t}}resolveExtensions(e){let t=[];if("function"==typeof e){let r=this.extensionFactories.get(e);r&&t.push(r)}else if(Array.isArray(e))for(let r of e)t.push(...this.resolveExtensions(r));else if("object"==typeof e&&"key"in e)t.push(e);else if("string"==typeof e){let r=this.extensions.find(t=>t.key===e);r&&t.push(r)}return t}unregisterExtension(e){var t;let r=this.resolveExtensions(e);if(!r.length)return void console.warn("No extensions found to unregister",e);let n=!1,o=new Set;for(let i of r){this.extensions=this.extensions.filter(e=>e!==i),this.extensionFactories.forEach((e,t)=>{e===i&&this.extensionFactories.delete(t)}),null==(t=this.abortMap.get(i))||t.abort(),this.abortMap.delete(i);let r=this.extensionPlugins.get(i);null==r||r.forEach(e=>{o.add(e)}),this.extensionPlugins.delete(i),i.tiptapExtensions&&!n&&(n=!0,console.warn(`Extension ${i.key} has tiptap extensions, but they will not be removed. Please separate the extension into multiple extensions if you want to remove them, or re-initialize the editor.`,e))}this.updatePlugins(e=>e.filter(e=>!o.has(e)))}updatePlugins(e){let t=this.editor.prosemirrorState,r=t.reconfigure({plugins:e(t.plugins.slice())});this.editor.prosemirrorView.updateState(r)}getTiptapExtensions(){var e,t,r;let n,o,i=(t=this.editor,r=this.options,o=[d.XO.ClipboardTextSerializer,d.XO.Commands,d.XO.Editable,d.XO.FocusEvents,d.XO.Tabindex,N,s.x.configure({types:["blockContainer","columnList","column"],setIdAttribute:r.setIdAttribute}),rj,ts,rW,rY,rq,ti.extend({inclusive:!1}).configure({defaultProtocol:l.d,protocols:r2?[]:l.V}),...Object.values(t.schema.styleSpecs).map(e=>e.implementation.mark.configure({editor:t})),rJ,rH,rK,d.YY.create({name:"OverrideEscape",addKeyboardShortcuts:()=>({Escape:()=>{var e;return!(null!=(e=t.getExtension(a.a9))&&e.shown())&&(t.blur(),!0)}})}),r0,rX.configure({editor:t,domAttributes:r.domAttributes}),rV.configure({editor:t,tabBehavior:r.tabBehavior}),rZ.configure({domAttributes:r.domAttributes}),...Object.values(t.schema.inlineContentSpecs).filter(e=>"link"!==e.config&&"text"!==e.config).map(e=>e.implementation.node.configure({editor:t})),...Object.values(t.schema.blockSpecs).flatMap(e=>[..."node"in e.implementation?[e.implementation.node.configure({editor:t,domAttributes:r.domAttributes})]:[]]),d.YY.create({name:"copyToClipboard",addProseMirrorPlugins:()=>[new f.k_({props:{handleDOMEvents:{copy:(e,r)=>(rF()||rU(t,e,r),!0),cut:(e,r)=>(rF()||(rU(t,e,r),e.editable&&e.dispatch(e.state.tr.deleteSelection())),!0),dragstart(e,r){if(!("node"in e.state.selection)||"blockContent"!==e.state.selection.node.type.spec.group)return;t.transact(t=>t.setSelection(new f.nh(t.doc.resolve(e.state.selection.from-1)))),r.preventDefault(),r.dataTransfer.clearData();let{clipboardHTML:n,externalHTML:o,markdown:i}=rB(e,t);return r.dataTransfer.setData("blocknote/html",n),r.dataTransfer.setData("text/html",o),r.dataTransfer.setData("text/plain",i),!0}}}})]}),(n=r.pasteHandler||(e=>e.defaultPasteHandler()),d.YY.create({name:"pasteFromClipboard",addProseMirrorPlugins:()=>[new f.k_({props:{handleDOMEvents:{paste(e,r){if(r.preventDefault(),t.isEditable)return n({event:r,editor:t,defaultPasteHandler:({prioritizeMarkdownOverHTML:e=!0,plainTextAsMarkdown:n=!0}={})=>(function({event:e,editor:t,prioritizeMarkdownOverHTML:r,plainTextAsMarkdown:n}){var o;let i;if(t.transact(e=>e.selection.$from.parent.type.spec.code&&e.selection.$to.parent.type.spec.code)){let r=null==(o=e.clipboardData)?void 0:o.getData("text/plain");if(r)return t.pasteText(r),!0}for(let t of rT)if(e.clipboardData.types.includes(t)){i=t;break}if(!i)return!0;if("vscode-editor-data"===i)return rP(e,t.prosemirrorView),!0;if("Files"===i)return rk(e,t),!0;let s=e.clipboardData.getData(i);if("blocknote/html"===i)return t.pasteHTML(s,!0),!0;if("text/markdown"===i)return t.pasteMarkdown(s),!0;if(r){let r=e.clipboardData.getData("text/plain");if(rA.test(r)||rC.test(r)||rS.test(r)||rw.test(r)||r_.test(r)||rN.test(r)||rI.test(r)||rx.test(r)||rM.test(r)||rO.test(r)||rD.test(r)||rR.test(r)||rL.test(r))return t.pasteMarkdown(r),!0}return"text/html"===i?t.pasteHTML(s):n?t.pasteMarkdown(s):t.pasteText(s),!0})({event:r,editor:t,prioritizeMarkdownOverHTML:e,plainTextAsMarkdown:n})})}}}})]})),d.YY.create({name:"dropFile",addProseMirrorPlugins:()=>[new f.k_({props:{handleDOMEvents:{drop(e,r){if(!t.isEditable)return;let n=null;for(let e of rT)if(r.dataTransfer.types.includes(e)){n=e;break}return null===n||"Files"===n&&(rk(r,t),!0)}}}})]})],r2=!0,o).filter(e=>!this.disabledExtensions.has(e.name)),h=(0,c.s)(this.extensions),p=new Map;for(let e of this.extensions){e.tiptapExtensions&&i.push(...e.tiptapExtensions);let t=h(e.key),{plugins:r,inputRules:n}=this.getProsemirrorPluginsFromExtension(e);r.length&&i.push(d.YY.create({name:e.key,priority:t,addProseMirrorPlugins:()=>r})),n.length&&(p.has(t)||p.set(t,[]),p.get(t).push(...n))}for(let t of(i.push(d.YY.create({name:"blocknote-input-rules",addProseMirrorPlugins(){let e=[];return Array.from(p.keys()).sort().reverse().forEach(t=>{e.push(...p.get(t))}),[function({rules:e}){let t=new f.k_({state:{init:()=>null,apply(e,t){let r=e.getMeta(this);return r||(e.selectionSet||e.docChanged?null:t)}},props:{handleTextInput:(r,n,o,i)=>g(r,n,o,i,e,t),handleDOMEvents:{compositionend:r=>{setTimeout(()=>{let{$cursor:n}=r.state.selection;n&&g(r,n.pos,n.pos,"",e,t)})}}},isInputRules:!0});return t}({rules:e})]}})),(null==(e=this.options._tiptapOptions)?void 0:e.extensions)??[]))i.push(t);return i}getProsemirrorPluginsFromExtension(e){var t,r,n;let o=[...e.prosemirrorPlugins??[]],i=[];return(null!=(t=e.prosemirrorPlugins)&&t.length||Object.keys(e.keyboardShortcuts||{}).length||null!=(r=e.inputRules)&&r.length)&&(this.extensionPlugins.set(e,o),null!=(n=e.inputRules)&&n.length&&i.push(...e.inputRules.map(e=>new m(e.find,(t,r,n,o)=>{let i=e.replace({match:r,range:{from:n,to:o},editor:this.editor});if(i){let e=this.editor.getTextCursorPosition();if("inline"!==this.editor.schema.blockSchema[e.block.type].content)return null;let r=(0,s.r)(t.tr),l=t.tr.deleteRange(n,o);return(0,a.at)(l,r.bnBlock.beforePos,i),l}return null}))),Object.keys(e.keyboardShortcuts||{}).length&&o.push((0,E.w)(Object.fromEntries(Object.entries(e.keyboardShortcuts).map(([e,t])=>[e,()=>t({editor:this.editor})]))))),{plugins:o,inputRules:i}}getExtensions(){return new Map(this.extensions.map(e=>[e.key,e]))}getExtension(e){if("string"==typeof e)return this.extensions.find(t=>t.key===e)||void 0;if("function"==typeof e)return this.extensionFactories.get(e)||void 0;throw Error(`Invalid extension type: ${typeof e}`)}hasExtension(e){return"string"==typeof e?this.extensions.some(t=>t.key===e):"object"==typeof e&&"key"in e?this.extensions.some(t=>t.key===e.key):"function"==typeof e&&this.extensionFactories.has(e)}}class r5{constructor(e){this.editor=e}getSelection(){return this.editor.transact(e=>(function(e){let t=(0,s.g)(e);if(e.selection.empty||"node"in e.selection)return;let r=e.doc.resolve((0,s.q)(e.doc,e.selection.from).posBeforeNode),n=e.doc.resolve((0,s.q)(e.doc,e.selection.to).posBeforeNode),o=(n,o)=>{let i=r.posAtIndex(n,o),a=e.doc.resolve(i).nodeAfter;if(!a)throw Error(`Error getting selection - node not found at position ${i}`);return(0,s.a)(a,t)},i=[],a=r.sharedDepth(n.pos),l=r.index(a),c=n.index(a);if(r.depth>a){i.push((0,s.a)(r.nodeAfter,t));for(let e=r.depth;e>a;e--)if(r.node(e).type.isInGroup("childContainer")){let t=r.index(e)+1,n=r.node(e).childCount;for(let r=t;r<n;r++)i.push(o(r,e))}}else i.push(o(l,a));for(let e=l+1;e<=c;e++)i.push(o(e,a));if(0===i.length)throw Error(`Error getting selection - selection doesn't span any blocks (${e.selection})`);return{blocks:i}})(e))}getSelectionCutBlocks(e=!1){return this.editor.transact(t=>(function(e,t=!1){let r=(0,s.g)(e),n=t?function(e,t){let{$from:r,$to:n}=t;if(r.pos>r.start()&&r.pos<e.content.size){let t=e.textBetween(r.pos,r.pos+1);if(/^[\w\p{P}]$/u.test(t)){let t=e.textBetween(r.start(),r.pos).match(/[\w\p{P}]+$/u);t&&(r=e.resolve(r.pos-t[0].length))}}if(n.pos<n.end()&&n.pos>0){let t=e.textBetween(n.pos-1,n.pos);if(/^[\w\p{P}]$/u.test(t)){let t=e.textBetween(n.pos,n.end()).match(/^[\w\p{P}]+/u);t&&(n=e.resolve(n.pos+t[0].length))}}return{$from:r,$to:n,from:r.pos,to:n.pos}}(e.doc,e.selection):e.selection,o=n.$from,i=n.$to;for(;i.parentOffset>=i.parent.nodeSize-2&&i.depth>0;)i=e.doc.resolve(i.pos+1);for(;0===i.parentOffset&&i.depth>0;)i=e.doc.resolve(i.pos-1);for(;0===o.parentOffset&&o.depth>0;)o=e.doc.resolve(o.pos-1);for(;o.parentOffset>=o.parent.nodeSize-2&&o.depth>0;)o=e.doc.resolve(o.pos+1);let a=(0,s.y)(e.doc.slice(o.pos,i.pos,!0),r);return{_meta:{startPos:o.pos,endPos:i.pos},...a}})(t,e))}setSelection(e,t){return this.editor.transact(r=>(function(e,t,r){let n,o,i="string"==typeof t?t:t.id,l="string"==typeof r?r:r.id,c=(0,s.g)(e),d=(0,s.z)(c);if(i===l)throw Error(`Attempting to set selection with the same anchor and head blocks (id ${i})`);let h=(0,a.aj)(i,e.doc);if(!h)throw Error(`Block with ID ${i} not found`);let p=(0,a.aj)(l,e.doc);if(!p)throw Error(`Block with ID ${l} not found`);let u=(0,s.A)(h),m=(0,s.A)(p),g=d.blockSchema[u.blockNoteType],E=d.blockSchema[m.blockNoteType];if(!u.isBlockContainer||"none"===g.content)throw Error(`Attempting to set selection anchor in block without content (id ${i})`);if(!m.isBlockContainer||"none"===E.content)throw Error(`Attempting to set selection anchor in block without content (id ${l})`);if("table"===g.content){let e=ta.J3.get(u.blockContent.node);n=u.blockContent.beforePos+e.positionAt(0,0,u.blockContent.node)+1+2}else n=u.blockContent.beforePos+1;if("table"===E.content){let t=ta.J3.get(m.blockContent.node),r=m.blockContent.beforePos+t.positionAt(t.height-1,t.width-1,m.blockContent.node)+1,n=e.doc.resolve(r).nodeAfter.nodeSize;o=r+n-2}else o=m.blockContent.afterPos-1;e.setSelection(f.U3.create(e.doc,n,o))})(r,e,t))}getTextCursorPosition(){return this.editor.transact(e=>(function(e){let t,{bnBlock:r}=(0,s.r)(e),n=(0,s.g)(e.doc),o=e.doc.resolve(r.beforePos),i=o.nodeBefore,a=e.doc.resolve(r.afterPos).nodeAfter;return o.depth>1&&((t=o.node()).type.isInGroup("bnBlock")||(t=o.node(o.depth-1))),{block:(0,s.a)(r.node,n),prevBlock:null===i?void 0:(0,s.a)(i,n),nextBlock:null===a?void 0:(0,s.a)(a,n),parentBlock:void 0===t?void 0:(0,s.a)(t,n)}})(e))}setTextCursorPosition(e,t="start"){return this.editor.transact(r=>(function e(t,r,n="start"){let o="string"==typeof r?r:r.id,i=(0,s.g)(t.doc),l=(0,s.z)(i),c=(0,a.aj)(o,t.doc);if(!c)throw Error(`Block with ID ${o} not found`);let d=(0,s.A)(c),h=l.blockSchema[d.blockNoteType].content;if(d.isBlockContainer){let e=d.blockContent;if("none"===h)return void t.setSelection(f.nh.create(t.doc,e.beforePos));if("inline"===h)"start"===n?t.setSelection(f.U3.create(t.doc,e.beforePos+1)):t.setSelection(f.U3.create(t.doc,e.afterPos-1));else if("table"===h)"start"===n?t.setSelection(f.U3.create(t.doc,e.beforePos+4)):t.setSelection(f.U3.create(t.doc,e.afterPos-4));else throw new s.U(h)}else e(t,("start"===n?d.childContainer.node.firstChild:d.childContainer.node.lastChild).attrs.id,n)})(r,e,t))}getSelectionBoundingBox(){if(!this.editor.prosemirrorView)return;let{selection:e}=this.editor.prosemirrorState,{ranges:t}=e,r=Math.min(...t.map(e=>e.$from.pos)),n=Math.max(...t.map(e=>e.$to.pos));if((0,d.BQ)(e)){let e=this.editor.prosemirrorView.nodeDOM(r);if(e)return e.getBoundingClientRect()}return(0,d.MG)(this.editor.prosemirrorView,r,n).toJSON()}}class r4{constructor(e){t9(this,"activeTransaction",null),t9(this,"isInCan",!1),this.editor=e}can(e){try{return this.isInCan=!0,e()}finally{this.isInCan=!1}}exec(e){if(this.activeTransaction)throw Error("`exec` should not be called within a `transact` call, move the `exec` call outside of the `transact` call");return this.isInCan?this.canExec(e):e(this.prosemirrorState,e=>this.prosemirrorView.dispatch(e),this.prosemirrorView)}canExec(e){if(this.activeTransaction)throw Error("`canExec` should not be called within a `transact` call, move the `canExec` call outside of the `transact` call");return e(this.prosemirrorState,void 0,this.prosemirrorView)}transact(e){if(this.activeTransaction)return e(this.activeTransaction);try{this.activeTransaction=this.editor._tiptapEditor.state.tr;let t=e(this.activeTransaction),r=this.activeTransaction;return this.activeTransaction=null,r&&(r.docChanged||r.selectionSet||r.scrolledIntoView||r.storedMarksSet||!r.isGeneric)&&this.prosemirrorView.dispatch(r),t}finally{this.activeTransaction=null}}get prosemirrorState(){if(this.activeTransaction)throw Error("`prosemirrorState` should not be called within a `transact` call, move the `prosemirrorState` call outside of the `transact` call or use `editor.transact` to read the current editor state");return this.editor._tiptapEditor.state}get prosemirrorView(){return this.editor._tiptapEditor.view}isFocused(){var e;return(null==(e=this.prosemirrorView)?void 0:e.hasFocus())||!1}focus(){var e;null==(e=this.prosemirrorView)||e.focus()}get isEditable(){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw Error("no editor, but also not headless?");return!1}return void 0===this.editor._tiptapEditor.isEditable||this.editor._tiptapEditor.isEditable}set isEditable(e){if(!this.editor._tiptapEditor){if(!this.editor.headless)throw Error("no editor, but also not headless?");return}this.editor._tiptapEditor.options.editable!==e&&this.editor._tiptapEditor.setEditable(e)}undo(){let e=this.editor.getExtension("yUndo");if(e)return this.exec(e.undoCommand);let t=this.editor.getExtension("history");if(t)return this.exec(t.undoCommand);throw Error("No undo plugin found")}redo(){let e=this.editor.getExtension("yUndo");if(e)return this.exec(e.redoCommand);let t=this.editor.getExtension("history");if(t)return this.exec(t.redoCommand);throw Error("No redo plugin found")}}class r6{constructor(e){this.editor=e}insertInlineContent(e,{updateSelection:t=!1}={}){let r=(0,s.i)(e,this.editor.pmSchema);this.editor.transact(e=>{!function(e,t,r,n={updateSelection:!0}){let{from:o,to:i}="number"==typeof t?{from:t,to:t}:{from:t.from,to:t.to},s=!0,a=!0,l="";if(r.forEach(e=>{e.check(),s&&e.isText&&0===e.marks.length?l+=e.text:s=!1,a=!!a&&e.isBlock}),o===i&&a){let{parent:t}=e.doc.resolve(o);!t.isTextblock||t.type.spec.code||t.childCount||(o-=1,i+=1)}s?e.insertText(l,o,i):e.replaceWith(o,i,r),n.updateSelection&&(0,d.Ms)(e,e.steps.length-1,-1)}(e,{from:e.selection.from,to:e.selection.to},r,{updateSelection:t})})}getActiveStyles(){return this.editor.transact(e=>{let t={};for(let r of e.selection.$to.marks()){let e=this.editor.schema.styleSchema[r.type.name];if(!e){"link"===r.type.name||r.type.spec.blocknoteIgnore||console.warn("mark not found in styleschema",r.type.name);continue}"boolean"===e.propSchema?t[e.type]=!0:t[e.type]=r.attrs.stringValue}return t})}addStyles(e){for(let[t,r]of Object.entries(e)){let e=this.editor.schema.styleSchema[t];if(!e)throw Error(`style ${t} not found in styleSchema`);if("boolean"===e.propSchema)this.editor._tiptapEditor.commands.setMark(t);else if("string"===e.propSchema)this.editor._tiptapEditor.commands.setMark(t,{stringValue:r});else throw new s.U(e.propSchema)}}removeStyles(e){for(let t of Object.keys(e))this.editor._tiptapEditor.commands.unsetMark(t)}toggleStyles(e){for(let[t,r]of Object.entries(e)){let e=this.editor.schema.styleSchema[t];if(!e)throw Error(`style ${t} not found in styleSchema`);if("boolean"===e.propSchema)this.editor._tiptapEditor.commands.toggleMark(t);else if("string"===e.propSchema)this.editor._tiptapEditor.commands.toggleMark(t,{stringValue:r});else throw new s.U(e.propSchema)}}getSelectedText(){return this.editor.transact(e=>e.doc.textBetween(e.selection.from,e.selection.to))}getSelectedLinkUrl(){return this.editor._tiptapEditor.getAttributes("link").href}createLink(e,t){if(""===e)return;let r=this.editor.pmSchema.mark("link",{href:e});this.editor.transact(e=>{let{from:n,to:o}=e.selection;t?e.insertText(t,n,o).addMark(n,n+t.length,r):e.setSelection(f.U3.create(e.doc,o)).addMark(n,o,r)})}}function r8(e,t){let r=o.FK.from(e.content);if(!function(e,t){var r,n;let o=1===e.childCount,i=(null==(r=e.firstChild)?void 0:r.type.spec.content)==="inline*",a=(null==(n=e.firstChild)?void 0:n.type.spec.content)==="tableRow+";if(o){if(i)return!1;if(a){let e=(0,s.w)(t.state);if(e.isBlockContainer)return"tableRow+"!==e.blockContent.node.type.spec.content}}return!0}(r=function(e,t){let r=[];for(let n=0;n<e.childCount;n++)if("tableRow"===e.child(n).type.name)if(r.length>0&&"table"===r[r.length-1].type.name){let t=r[r.length-1],o=t.copy(t.content.addToEnd(e.child(n)));r[r.length-1]=o}else{let o=t.nodes.table.createChecked(void 0,e.child(n));r.push(o)}else r.push(e.child(n));return o.FK.from(r)}(r,t.state.schema),t))return new o.Ji(r,e.openStart,e.openEnd);for(let e=0;e<r.childCount;e++)if("blockContent"===r.child(e).type.spec.group){let n=[r.child(e)];if(e+1<r.childCount&&"blockGroup"===r.child(e+1).type.name){let t=r.child(e+1).child(0).child(0);("bulletListItem"===t.type.name||"numberedListItem"===t.type.name||"checkListItem"===t.type.name)&&(n.push(r.child(e+1)),r=function(e,t){let r=[];return e.forEach((e,n,o)=>{o!==t&&r.push(e)}),o.FK.from(r)}(r,e+1))}let i=t.state.schema.nodes.blockContainer.createChecked(void 0,n);r=r.replaceChild(e,i)}return new o.Ji(r,e.openStart,e.openEnd)}let r9={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1};class r7 extends h.E{constructor(e){var t,r,n,i,l,h,u,f,m,g;let E;super(),t9(this,"pmSchema"),t9(this,"_tiptapEditor"),t9(this,"elementRenderer",null),t9(this,"blockCache",new WeakMap),t9(this,"dictionary"),t9(this,"schema"),t9(this,"blockImplementations"),t9(this,"inlineContentImplementations"),t9(this,"styleImplementations"),t9(this,"uploadFile"),t9(this,"onUploadStartCallbacks",[]),t9(this,"onUploadEndCallbacks",[]),t9(this,"resolveFileUrl"),t9(this,"settings"),t9(this,"_blockManager"),t9(this,"_eventManager"),t9(this,"_exportManager"),t9(this,"_extensionManager"),t9(this,"_selectionManager"),t9(this,"_stateManager"),t9(this,"_styleManager"),t9(this,"unregisterExtension",(...e)=>this._extensionManager.unregisterExtension(...e)),t9(this,"registerExtension",(...e)=>this._extensionManager.registerExtension(...e)),t9(this,"getExtension",(...e)=>this._extensionManager.getExtension(...e)),t9(this,"mount",e=>{this._tiptapEditor.mount({mount:e})}),t9(this,"unmount",()=>{this._tiptapEditor.unmount()}),this.options=e,this.dictionary=e.dictionary||p,this.settings={tables:{splitCells:(null==(t=null==e?void 0:e.tables)?void 0:t.splitCells)??!1,cellBackgroundColor:(null==(r=null==e?void 0:e.tables)?void 0:r.cellBackgroundColor)??!1,cellTextColor:(null==(n=null==e?void 0:e.tables)?void 0:n.cellTextColor)??!1,headers:(null==(i=null==e?void 0:e.tables)?void 0:i.headers)??!1}};const b={defaultStyles:!0,schema:e.schema||c.B.create(),...e,placeholders:{...this.dictionary.placeholders,...e.placeholders}};if(this.schema=b.schema,this.blockImplementations=b.schema.blockSpecs,this.inlineContentImplementations=b.schema.inlineContentSpecs,this.styleImplementations=b.schema.styleSpecs,b.uploadFile){const e=b.uploadFile;this.uploadFile=async(t,r)=>{this.onUploadStartCallbacks.forEach(e=>e.apply(this,[r]));try{return await e(t,r)}finally{this.onUploadEndCallbacks.forEach(e=>e.apply(this,[r]))}}}this.resolveFileUrl=b.resolveFileUrl,this._eventManager=new ru(this),this._extensionManager=new r3(this,b);const y=this._extensionManager.getTiptapExtensions(),T=this._extensionManager.hasExtension("ySync")||this._extensionManager.hasExtension("liveblocksExtension");T&&b.initialContent&&console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");const v={...r9,...b._tiptapOptions,element:null,autofocus:b.autofocus??!1,extensions:y,editorProps:{...null==(l=b._tiptapOptions)?void 0:l.editorProps,attributes:{tabIndex:"0",...null==(u=null==(h=b._tiptapOptions)?void 0:h.editorProps)?void 0:u.attributes,...null==(f=b.domAttributes)?void 0:f.editor,class:(0,a.as)("bn-editor",b.defaultStyles?"bn-default-styles":"",(null==(g=null==(m=b.domAttributes)?void 0:m.editor)?void 0:g.class)||"")},transformPasted:r8}};try{const e=b.initialContent||(T?[{type:"paragraph",id:"initialBlockId"}]:[{type:"paragraph",id:s.x.options.generateID()}]);if(!Array.isArray(e)||0===e.length)throw Error("initialContent must be a non-empty array of blocks, received: "+e);const t=(0,d._w)(v.extensions),r=e.map(e=>(0,s.b)(e,t,this.schema.styleSchema).toJSON()),n=(0,d.ui)({type:"doc",content:[{type:"blockGroup",content:r}]},t,v.parseOptions);this._tiptapEditor=new d.KE({...v,content:n.toJSON()}),this.pmSchema=this._tiptapEditor.schema}catch(e){throw Error("Error creating document from blocks passed as `initialContent`",{cause:e})}const k=this.pmSchema.nodes.doc.createAndFill;this.pmSchema.nodes.doc.createAndFill=(...e)=>{if(E)return E;let t=JSON.parse(JSON.stringify(k.apply(this.pmSchema.nodes.doc,e).toJSON()));return t.content[0].content[0].attrs.id="initialBlockId",E=o.bP.fromJSON(this.pmSchema,t)},this.pmSchema.cached.blockNoteEditor=this,this._blockManager=new rp(this),this._exportManager=new ry(this),this._selectionManager=new r5(this),this._stateManager=new r4(this),this._styleManager=new r6(this),this.emit("create")}static create(e){return new r7(e??{})}get extensions(){return this._extensionManager.getExtensions()}exec(e){return this._stateManager.exec(e)}canExec(e){return this._stateManager.canExec(e)}transact(e){return this._stateManager.transact(e)}get prosemirrorState(){return this._stateManager.prosemirrorState}get prosemirrorView(){return this._stateManager.prosemirrorView}get domElement(){var e;if(!this.headless)return null==(e=this.prosemirrorView)?void 0:e.dom}isFocused(){var e;return!this.headless&&((null==(e=this.prosemirrorView)?void 0:e.hasFocus())||!1)}get headless(){return!this._tiptapEditor.isInitialized}focus(){this.headless||this.prosemirrorView.focus()}blur(){var e;this.headless||null==(e=this.domElement)||e.blur()}onUploadStart(e){return this.onUploadStartCallbacks.push(e),()=>{let t=this.onUploadStartCallbacks.indexOf(e);t>-1&&this.onUploadStartCallbacks.splice(t,1)}}onUploadEnd(e){return this.onUploadEndCallbacks.push(e),()=>{let t=this.onUploadEndCallbacks.indexOf(e);t>-1&&this.onUploadEndCallbacks.splice(t,1)}}get topLevelBlocks(){return this.document}get document(){return this._blockManager.document}getBlock(e){return this._blockManager.getBlock(e)}getPrevBlock(e){return this._blockManager.getPrevBlock(e)}getNextBlock(e){return this._blockManager.getNextBlock(e)}getParentBlock(e){return this._blockManager.getParentBlock(e)}forEachBlock(e,t=!1){this._blockManager.forEachBlock(e,t)}onEditorContentChange(e){this._tiptapEditor.on("update",e)}onEditorSelectionChange(e){this._tiptapEditor.on("selectionUpdate",e)}onBeforeChange(e){return this._extensionManager.getExtension(l.B).subscribe(e)}getTextCursorPosition(){return this._selectionManager.getTextCursorPosition()}setTextCursorPosition(e,t="start"){return this._selectionManager.setTextCursorPosition(e,t)}getSelection(){return this._selectionManager.getSelection()}getSelectionCutBlocks(e=!1){return this._selectionManager.getSelectionCutBlocks(e)}setSelection(e,t){return this._selectionManager.setSelection(e,t)}get isEditable(){return this._stateManager.isEditable}set isEditable(e){this._stateManager.isEditable=e}insertBlocks(e,t,r="before"){return this._blockManager.insertBlocks(e,t,r)}updateBlock(e,t){return this._blockManager.updateBlock(e,t)}removeBlocks(e){return this._blockManager.removeBlocks(e)}replaceBlocks(e,t){return this._blockManager.replaceBlocks(e,t)}undo(){return this._stateManager.undo()}redo(){return this._stateManager.redo()}insertInlineContent(e,{updateSelection:t=!1}={}){this._styleManager.insertInlineContent(e,{updateSelection:t})}getActiveStyles(){return this._styleManager.getActiveStyles()}addStyles(e){this._styleManager.addStyles(e)}removeStyles(e){this._styleManager.removeStyles(e)}toggleStyles(e){this._styleManager.toggleStyles(e)}getSelectedText(){return this._styleManager.getSelectedText()}getSelectedLinkUrl(){return this._styleManager.getSelectedLinkUrl()}createLink(e,t){this._styleManager.createLink(e,t)}canNestBlock(){return this._blockManager.canNestBlock()}nestBlock(){this._blockManager.nestBlock()}canUnnestBlock(){return this._blockManager.canUnnestBlock()}unnestBlock(){this._blockManager.unnestBlock()}moveBlocksUp(){return this._blockManager.moveBlocksUp()}moveBlocksDown(){return this._blockManager.moveBlocksDown()}blocksToHTMLLossy(e=this.document){return this._exportManager.blocksToHTMLLossy(e)}blocksToFullHTML(e=this.document){return this._exportManager.blocksToFullHTML(e)}tryParseHTMLToBlocks(e){return this._exportManager.tryParseHTMLToBlocks(e)}blocksToMarkdownLossy(e=this.document){return this._exportManager.blocksToMarkdownLossy(e)}tryParseMarkdownToBlocks(e){return this._exportManager.tryParseMarkdownToBlocks(e)}onChange(e,t){return this._eventManager.onChange(e,t)}onSelectionChange(e,t){return this._eventManager.onSelectionChange(e,t)}onMount(e){this._eventManager.onMount(e)}onUnmount(e){this._eventManager.onUnmount(e)}getSelectionBoundingBox(){return this._selectionManager.getSelectionBoundingBox()}get isEmpty(){let e=this.document;return 0===e.length||1===e.length&&"paragraph"===e[0].type&&0===e[0].content.length}pasteHTML(e,t=!1){this._exportManager.pasteHTML(e,t)}pasteText(e){return this._exportManager.pasteText(e)}pasteMarkdown(e){return this._exportManager.pasteMarkdown(e)}}},25775:(e,t,r)=>{"use strict";r.d(t,{wR:()=>i});let n=e=>class{constructor(e){this._=e}destroy(){e(this._)}},o=n(clearTimeout),i=(e,t)=>new o(setTimeout(t,e));n(clearInterval),n(e=>"u">typeof requestAnimationFrame&&cancelAnimationFrame(e)),n(e=>"u">typeof cancelIdleCallback&&cancelIdleCallback(e))},27050:(e,t,r)=>{"use strict";function n(e){this.content=e}r.d(t,{S4:()=>H,ZF:()=>K,FK:()=>o,CU:()=>l,sX:()=>B,bP:()=>A,u$:()=>v,vI:()=>c,Sj:()=>F,Ji:()=>d}),n.prototype={constructor:n,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return -1},get:function(e){var t=this.find(e);return -1==t?void 0:this.content[t+1]},update:function(e,t,r){var o=r&&r!=e?this.remove(r):this,i=o.find(e),s=o.content.slice();return -1==i?s.push(r||e,t):(s[i+1]=t,r&&(s[i]=r)),new n(s)},remove:function(e){var t=this.find(e);if(-1==t)return this;var r=this.content.slice();return r.splice(t,2),new n(r)},addToStart:function(e,t){return new n([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var r=this.remove(e).content.slice();return r.push(e,t),new n(r)},addBefore:function(e,t,r){var o=this.remove(t),i=o.content.slice(),s=o.find(e);return i.splice(-1==s?i.length:s,0,t,r),new n(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=n.from(e)).size?new n(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=n.from(e)).size?new n(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=n.from(e);for(var r=0;r<e.content.length;r+=2)t=t.remove(e.content[r]);return t},toObject:function(){var e={};return this.forEach(function(t,r){e[t]=r}),e},get size(){return this.content.length>>1}},n.from=function(e){if(e instanceof n)return e;var t=[];if(e)for(var r in e)t.push(r,e[r]);return new n(t)};class o{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,r,n=0,o){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==r(a,n+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,e-o),Math.min(a.content.size,t-o),r,n+o)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,n){let o="",i=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?n?"function"==typeof n?n(s):n:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&r&&(i?i=!1:o+=r),o+=l},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,n=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(n[n.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)n.push(e.content[i]);return new o(n,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let r=[],n=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],a=i+s.nodeSize;a>e&&((i<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),r.push(s),n+=s.nodeSize),i=a}return new o(r,n)}cutByIndex(e,t){return e==t?o.empty:0==e&&t==this.content.length?this:new o(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let n=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return n[e]=t,new o(n,i)}addToStart(e){return new o([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new o(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let n=this.content[t];e(n,r,t),r+=n.nodeSize}}findDiffStart(e,t=0){return function e(t,r,n){for(let o=0;;o++){if(o==t.childCount||o==r.childCount)return t.childCount==r.childCount?null:n;let i=t.child(o),s=r.child(o);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let e=0;i.text[e]==s.text[e];e++)n++;return n}if(i.content.size||s.content.size){let t=e(i.content,s.content,n+1);if(null!=t)return t}n+=i.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return function e(t,r,n,o){for(let i=t.childCount,s=r.childCount;;){if(0==i||0==s)return i==s?null:{a:n,b:o};let a=t.child(--i),l=r.child(--s),c=a.nodeSize;if(a==l){n-=c,o-=c;continue}if(!a.sameMarkup(l))return{a:n,b:o};if(a.isText&&a.text!=l.text){let e=0,t=Math.min(a.text.length,l.text.length);for(;e<t&&a.text[a.text.length-e-1]==l.text[l.text.length-e-1];)e++,n--,o--;return{a:n,b:o}}if(a.content.size||l.content.size){let t=e(a.content,l.content,n-1,o-1);if(t)return t}n-=c,o-=c}}(this,e,t,r)}findIndex(e){if(0==e)return s(0,e);if(e==this.size)return s(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let n=r+this.child(t).nodeSize;if(n>=e){if(n==e)return s(t+1,n);return s(t,r)}r=n}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return o.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return new o(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return o.empty;let t,r=0;for(let n=0;n<e.length;n++){let o=e[n];r+=o.nodeSize,n&&o.isText&&e[n-1].sameMarkup(o)?(t||(t=e.slice(0,n)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new o(t||e,r)}static from(e){if(!e)return o.empty;if(e instanceof o)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new o([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}o.empty=new o([],0);let i={index:0,offset:0};function s(e,t){return i.index=e,i.offset=t,i}function a(e,t){if(e===t)return!0;if(!(e&&"object"==typeof e)||!(t&&"object"==typeof t))return!1;let r=Array.isArray(e);if(Array.isArray(t)!=r)return!1;if(r){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!a(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!a(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}class l{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let n=0;n<e.length;n++){let o=e[n];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,n));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,n)),t.push(this),r=!0),t&&t.push(o)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&a(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw RangeError(`There is no mark type ${t.type} in this schema`);let n=r.create(t.attrs);return r.checkAttrs(n.attrs),n}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return l.none;if(e instanceof l)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}l.none=[];class c extends Error{}class d{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=function e(t,r,n,o){let{index:i,offset:s}=t.findIndex(r),a=t.maybeChild(i);if(s==r||a.isText)return o&&!o.canReplace(i,i,n)?null:t.cut(0,r).append(n).append(t.cut(r));let l=e(a.content,r-s-1,n,a);return l&&t.replaceChild(i,a.copy(l))}(this.content,e+this.openStart,t);return r&&new d(r,this.openStart,this.openEnd)}removeBetween(e,t){return new d(function e(t,r,n){let{index:o,offset:i}=t.findIndex(r),s=t.maybeChild(o),{index:a,offset:l}=t.findIndex(n);if(i==r||s.isText){if(l!=n&&!t.child(a).isText)throw RangeError("Removing non-flat range");return t.cut(0,r).append(t.cut(n))}if(o!=a)throw RangeError("Removing non-flat range");return t.replaceChild(o,s.copy(e(s.content,r-i-1,n-i-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return d.empty;let r=t.openStart||0,n=t.openEnd||0;if("number"!=typeof r||"number"!=typeof n)throw RangeError("Invalid input for Slice.fromJSON");return new d(o.fromJSON(e,t.content),r,n)}static maxOpen(e,t=!0){let r=0,n=0;for(let n=e.firstChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.firstChild)r++;for(let r=e.lastChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.lastChild)n++;return new d(e,r,n)}}function h(e,t){if(!t.type.compatibleContent(e.type))throw new c("Cannot join "+t.type.name+" onto "+e.type.name)}function p(e,t,r){let n=e.node(r);return h(n,t.node(r)),n}function u(e,t){let r=t.length-1;r>=0&&e.isText&&e.sameMarkup(t[r])?t[r]=e.withText(t[r].text+e.text):t.push(e)}function f(e,t,r,n){let o=(t||e).node(r),i=0,s=t?t.index(r):o.childCount;e&&(i=e.index(r),e.depth>r?i++:e.textOffset&&(u(e.nodeAfter,n),i++));for(let e=i;e<s;e++)u(o.child(e),n);t&&t.depth==r&&t.textOffset&&u(t.nodeBefore,n)}function m(e,t){return e.type.checkContent(t),e.copy(t)}function g(e,t,r){let n=[];return f(null,e,r,n),e.depth>r&&u(m(p(e,t,r+1),g(e,t,r+1)),n),f(t,null,r,n),new o(n)}d.empty=new d(o.empty,0,0);class E{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],n=e.child(t);return r?e.child(t).cut(r):n}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[3*t],n=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)n+=r.child(t).nodeSize;return n}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return l.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),n=e.maybeChild(t);if(!r){let e=r;r=n,n=e}let o=r.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||n&&o[i].isInSet(n.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,n=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)!1!==r[o].type.spec.inclusive||n&&r[o].isInSet(n.marks)||(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new v(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw RangeError("Position "+t+" out of range");let r=[],n=0,o=t;for(let t=e;;){let{index:e,offset:i}=t.content.findIndex(o),s=o-i;if(r.push(t,e,n+i),!s||(t=t.child(e)).isText)break;o=s-1,n+=i+1}return new E(t,r,o)}static resolveCached(e,t){let r=T.get(e);if(r)for(let e=0;e<r.elts.length;e++){let n=r.elts[e];if(n.pos==t)return n}else T.set(e,r=new b);let n=r.elts[r.i]=E.resolve(e,t);return r.i=(r.i+1)%y,n}}class b{constructor(){this.elts=[],this.i=0}}let y=12,T=new WeakMap;class v{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}let k=Object.create(null);class A{constructor(e,t,r,n=l.none){this.type=e,this.attrs=t,this.marks=n,this.content=r||o.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,n=0){this.content.nodesBetween(e,t,r,n,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,n){return this.content.textBetween(e,t,r,n)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&a(this.attrs,t||e.defaultAttrs||k)&&l.sameSet(this.marks,r||l.none)}copy(e=null){return e==this.content?this:new A(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new A(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return d.empty;let n=this.resolve(e),o=this.resolve(t),i=r?0:n.sharedDepth(t),s=n.start(i);return new d(n.node(i).content.cut(n.pos-s,o.pos-s),n.depth-i,o.depth-i)}replace(e,t,r){var n=this.resolve(e),i=this.resolve(t);if(r.openStart>n.depth)throw new c("Inserted content deeper than insertion position");if(n.depth-r.openStart!=i.depth-r.openEnd)throw new c("Inconsistent open depths");return function e(t,r,n,i){let s=t.index(i),a=t.node(i);if(s==r.index(i)&&i<t.depth-n.openStart){let o=e(t,r,n,i+1);return a.copy(a.content.replaceChild(s,o))}if(!n.content.size)return m(a,g(t,r,i));if(n.openStart||n.openEnd||t.depth!=i||r.depth!=i){let{start:e,end:s}=function(e,t){let r=t.depth-e.openStart,n=t.node(r).copy(e.content);for(let e=r-1;e>=0;e--)n=t.node(e).copy(o.from(n));return{start:n.resolveNoCache(e.openStart+r),end:n.resolveNoCache(n.content.size-e.openEnd-r)}}(n,t);return m(a,function e(t,r,n,i,s){let a=t.depth>s&&p(t,r,s+1),l=i.depth>s&&p(n,i,s+1),c=[];return f(null,t,s,c),a&&l&&r.index(s)==n.index(s)?(h(a,l),u(m(a,e(t,r,n,i,s+1)),c)):(a&&u(m(a,g(t,r,s+1)),c),f(r,n,s,c),l&&u(m(l,g(n,i,s+1)),c)),f(i,null,s,c),new o(c)}(t,e,s,r,i))}{let e=t.parent,o=e.content;return m(e,o.cut(0,t.parentOffset).append(n.content).append(o.cut(r.parentOffset)))}}(n,i,r,0)}nodeAt(e){for(let t=this;;){let{index:r,offset:n}=t.content.findIndex(e);if(!(t=t.maybeChild(r)))return null;if(n==e||t.isText)return t;e-=n+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let n=this.content.child(t-1);return{node:n,index:t-1,offset:r-n.nodeSize}}resolve(e){return E.resolveCached(this,e)}resolveNoCache(e){return E.resolve(this,e)}rangeHasMark(e,t,r){let n=!1;return t>e&&this.nodesBetween(e,t,e=>(r.isInSet(e.marks)&&(n=!0),!n)),n}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),S(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=o.empty,n=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,n,i),a=s&&s.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let e=n;e<i;e++)if(!this.type.allowsMarks(r.child(e).marks))return!1;return!0}canReplaceWith(e,t,r,n){if(n&&!this.type.allowsMarks(n))return!1;let o=this.contentMatchAt(e).matchType(r),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=l.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!l.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){let r;if(!t)throw RangeError("Invalid input for Node.fromJSON");if(t.marks){if(!Array.isArray(t.marks))throw RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw RangeError("Invalid text node in JSON");return e.text(t.text,r)}let n=o.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,n,r);return i.type.checkAttrs(i.attrs),i}}A.prototype.text=void 0;class C extends A{constructor(e,t,r,n){if(super(e,t,null,n),!r)throw RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):S(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new C(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new C(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function S(e,t){for(let r=e.length-1;r>=0;r--)t=e[r].type.name+"("+t+")";return t}class w{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var r;let n,o=new _(e,t);if(null==o.next)return w.empty;let i=function e(t){let r=[];do r.push(function(t){let r=[];do r.push(function(t){let r=function(t){if(t.eat("(")){let r=e(t);return t.eat(")")||t.err("Missing closing paren"),r}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(e,t){let r=e.nodeTypes,n=r[t];if(n)return[n];let o=[];for(let e in r){let n=r[e];n.isInGroup(t)&&o.push(n)}return 0==o.length&&e.err("No node type or group '"+t+"' found"),o})(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}}(t);for(;;)if(t.eat("+"))r={type:"plus",expr:r};else if(t.eat("*"))r={type:"star",expr:r};else if(t.eat("?"))r={type:"opt",expr:r};else if(t.eat("{"))r=function(e,t){let r=N(e),n=r;return e.eat(",")&&(n="}"!=e.next?N(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:t}}(t,r);else break;return r}(t));while(t.next&&")"!=t.next&&"|"!=t.next);return 1==r.length?r[0]:{type:"seq",exprs:r}}(t));while(t.eat("|"));return 1==r.length?r[0]:{type:"choice",exprs:r}}(o);o.next&&o.err("Unexpected trailing text");let s=(r=function(e){let t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce((t,r)=>t.concat(e(r,i)),[]);if("seq"==t.type)for(let n=0;;n++){let s=e(t.exprs[n],i);if(n==t.exprs.length-1)return s;o(s,i=r())}else if("star"==t.type){let s=r();return n(i,s),o(e(t.expr,s),s),[n(s)]}else if("plus"==t.type){let s=r();return o(e(t.expr,i),s),o(e(t.expr,s),s),[n(s)]}else if("opt"==t.type)return[n(i)].concat(e(t.expr,i));else if("range"==t.type){let s=i;for(let n=0;n<t.min;n++){let n=r();o(e(t.expr,s),n),s=n}if(-1==t.max)o(e(t.expr,s),s);else for(let i=t.min;i<t.max;i++){let i=r();n(s,i),o(e(t.expr,s),i),s=i}return[n(s)]}else if("name"==t.type)return[n(i,void 0,t.value)];else throw Error("Unknown expr type")}(e,0),r()),t;function r(){return t.push([])-1}function n(e,r,n){let o={term:n,to:r};return t[e].push(o),o}function o(e,t){e.forEach(e=>e.to=t)}}(i),n=Object.create(null),function e(t){let o=[];t.forEach(e=>{r[e].forEach(({term:e,to:t})=>{let n;if(e){for(let t=0;t<o.length;t++)o[t][0]==e&&(n=o[t][1]);x(r,t).forEach(t=>{n||o.push([e,n=[]]),-1==n.indexOf(t)&&n.push(t)})}})});let i=n[t.join(",")]=new w(t.indexOf(r.length-1)>-1);for(let t=0;t<o.length;t++){let r=o[t][1].sort(I);i.next.push({type:o[t][0],next:n[r.join(",")]||e(r)})}return i}(x(r,0)));return function(e,t){for(let r=0,n=[e];r<n.length;r++){let e=n[r],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:r,next:s}=e.next[t];i.push(r.name),o&&!(r.isText||r.hasRequiredAttrs())&&(o=!1),-1==n.indexOf(s)&&n.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(s,o),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let n=this;for(let o=t;n&&o<r;o++)n=n.matchType(e.child(o).type);return n}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let n=[this];return function i(s,a){let l=s.matchFragment(e,r);if(l&&(!t||l.validEnd))return o.from(a.map(e=>e.createAndFill()));for(let e=0;e<s.next.length;e++){let{type:t,next:r}=s.next[e];if(!(t.isText||t.hasRequiredAttrs())&&-1==n.indexOf(r)){n.push(r);let e=i(r,a.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let n=r.shift(),o=n.match;if(o.matchType(e)){let e=[];for(let t=n;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||n.type&&!s.validEnd||(r.push({match:i.contentMatch,type:i,via:n}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return!function t(r){e.push(r);for(let n=0;n<r.next.length;n++)-1==e.indexOf(r.next[n].next)&&t(r.next[n].next)}(this),e.map((t,r)=>{let n=r+(t.validEnd?"*":" ")+" ";for(let r=0;r<t.next.length;r++)n+=(r?", ":"")+t.next[r].type.name+"->"+e.indexOf(t.next[r].next);return n}).join("\n")}}w.empty=new w(!0);class _{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+" (in content expression '"+this.string+"')")}}function N(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function I(e,t){return t-e}function x(e,t){let r=[];return function t(n){let o=e[n];if(1==o.length&&!o[0].term)return t(o[0].to);r.push(n);for(let e=0;e<o.length;e++){let{term:n,to:i}=o[e];n||-1!=r.indexOf(i)||t(i)}}(t),r.sort(I)}function M(e){let t=Object.create(null);for(let r in e){let n=e[r];if(!n.hasDefault)return null;t[r]=n.default}return t}function O(e,t){let r=Object.create(null);for(let n in e){let o=t&&t[n];if(void 0===o){let t=e[n];if(t.hasDefault)o=t.default;else throw RangeError("No value supplied for attribute "+n)}r[n]=o}return r}function D(e,t,r,n){for(let n in t)if(!(n in e))throw RangeError(`Unsupported attribute ${n} for ${r} of type ${n}`);for(let r in e){let n=e[r];n.validate&&n.validate(t[r])}}function R(e,t){let r=Object.create(null);if(t)for(let n in t)r[n]=new P(e,n,t[n]);return r}class L{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=R(e,r.attrs),this.defaultAttrs=M(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==w.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:O(this.attrs,e)}create(e=null,t,r){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new A(this,this.computeAttrs(e),o.from(t),l.setFrom(r))}createChecked(e=null,t,r){return t=o.from(t),this.checkContent(t),new A(this,this.computeAttrs(e),t,l.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),(t=o.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let n=this.contentMatch.matchFragment(t),i=n&&n.fillBefore(o.empty,!0);return i?new A(this,e,t.append(i),l.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){D(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){let t;if(null==this.markSet)return e;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:l.none:e}static compile(e,t){let r=Object.create(null);e.forEach((e,n)=>r[e]=new L(e,t,n));let n=t.spec.topNode||"doc";if(!r[n])throw RangeError("Schema is missing its top node type ('"+n+"')");if(!r.text)throw RangeError("Every schema needs a 'text' type");for(let e in r.text.attrs)throw RangeError("The text node type should not have attributes");return r}}class P{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate="string"==typeof r.validate?function(e,t,r){let n=r.split("|");return r=>{let o=null===r?"null":typeof r;if(0>n.indexOf(o))throw RangeError(`Expected value of type ${n} for attribute ${t} on type ${e}, got ${o}`)}}(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class B{constructor(e,t,r,n){this.name=e,this.rank=t,this.schema=r,this.spec=n,this.attrs=R(e,n.attrs),this.excluded=null;let o=M(this.attrs);this.instance=o?new l(this,o):null}create(e=null){return!e&&this.instance?this.instance:new l(this,O(this.attrs,e))}static compile(e,t){let r=Object.create(null),n=0;return e.forEach((e,o)=>r[e]=new B(e,n++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){D(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class F{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=n.from(e.nodes),t.marks=n.from(e.marks||{}),this.nodes=L.compile(this.spec.nodes,this),this.marks=B.compile(this.spec.marks,this);let r=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],n=t.spec.content||"",o=t.spec.marks;if(t.contentMatch=r[n]||(r[n]=w.parse(n,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==o?null:o?U(this,o.split(" ")):""!=o&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],r=t.spec.excludes;t.excluded=null==r?[t]:""==r?[]:U(this,r.split(" "))}this.nodeFromJSON=e=>A.fromJSON(this,e),this.markFromJSON=e=>l.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,n){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof L){if(e.schema!=this)throw RangeError("Node type from different schema used ("+e.name+")")}else throw RangeError("Invalid node type: "+e);return e.createChecked(t,r,n)}text(e,t){let r=this.nodes.text;return new C(r,r.defaultAttrs,e,l.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError("Unknown node type: "+e);return t}}function U(e,t){let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e.marks[o],s=i;if(i)r.push(i);else for(let t in e.marks){let n=e.marks[t];("_"==o||n.spec.group&&n.spec.group.split(" ").indexOf(o)>-1)&&r.push(s=n)}if(!s)throw SyntaxError("Unknown mark type: '"+t[n]+"'")}return r}class H{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let t=/[^=]*/.exec(e.style)[0];0>r.indexOf(t)&&r.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let r=e.nodes[t.node];return r.contentMatch.matchType(r)})}parse(e,t={}){let r=new W(this,t,!1);return r.addAll(e,l.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new W(this,t,!0);return r.addAll(e,l.none,t.from,t.to),d.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){var n,o;let r=this.tags[i];if(n=e,o=r.tag,(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,o)&&(void 0===r.namespace||e.namespaceURI==r.namespace)&&(!r.context||t.matchesContext(r.context))){if(r.getAttrs){let t=r.getAttrs(e);if(!1===t)continue;r.attrs=t||void 0}return r}}}matchStyle(e,t,r,n){for(let o=n?this.styles.indexOf(n)+1:0;o<this.styles.length;o++){let n=this.styles[o],i=n.style;if(0==i.indexOf(e)&&(!n.context||r.matchesContext(n.context))&&(!(i.length>e.length)||61==i.charCodeAt(e.length)&&i.slice(e.length+1)==t)){if(n.getAttrs){let e=n.getAttrs(t);if(!1===e)continue;n.attrs=e||void 0}return n}}}static schemaRules(e){let t=[];function r(e){let r=null==e.priority?50:e.priority,n=0;for(;n<t.length;n++){let e=t[n];if((null==e.priority?50:e.priority)<r)break}t.splice(n,0,e)}for(let t in e.marks){let n=e.marks[t].spec.parseDOM;n&&n.forEach(e=>{r(e=Y(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let n=e.nodes[t].spec.parseDOM;n&&n.forEach(e=>{r(e=Y(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new H(e,H.schemaRules(e)))}}let j={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},$={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},G={ol:!0,ul:!0};function z(e,t,r){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&r}class V{constructor(e,t,r,n,o,i){this.type=e,this.attrs=t,this.marks=r,this.solid=n,this.options=i,this.content=[],this.activeMarks=l.none,this.match=o||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(o.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,r;return(r=t.findWrapping(e.type))?(this.match=t,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e=this.content[this.content.length-1],t;e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-t[0].length)))}let t=o.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(o.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!j.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class W{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let n=t.topNode,o,i=z(null,t.preserveWhitespace,0)|4*!!r;o=n?new V(n.type,n.attrs,l.none,!0,t.topMatch||n.type.contentMatch,i):r?new V(null,null,l.none,!0,null,i):new V(e.schema.topNodeType,null,l.none,!0,null,i),this.nodes=[o],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,n=this.top,o=2&n.options?"full":this.localPreserveWS||(1&n.options)>0,{schema:i}=this.parser;if("full"===o||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if("full"===o)r=r.replace(/\r\n?/g,"\n");else if(i.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(i.linebreakReplacement.create())){let e=r.split(/\r?\n|\r/);for(let r=0;r<e.length;r++)r&&this.insertNode(i.linebreakReplacement.create(),t,!0),e[r]&&this.insertNode(i.text(e[r]),t,!/\S/.test(e[r]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let t=n.content[n.content.length-1],o=e.previousSibling;(!t||o&&"BR"==o.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(r=r.slice(1))}r&&this.insertNode(i.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let n=this.localPreserveWS,o=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i=e.nodeName.toLowerCase(),s;G.hasOwnProperty(i)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,r=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&G.hasOwnProperty(e)&&r?(r.appendChild(t),t=r):"li"==e?r=t:e&&(r=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,r));r:if(a?a.ignore:$.hasOwnProperty(i))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let r,n=this.needsBlock;if(j.hasOwnProperty(i))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),r=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break r}let s=a&&a.skip?t:this.readStyles(e,t);s&&this.addAll(e,s),r&&this.sync(o),this.needsBlock=n}else{let r=this.readStyles(e,t);r&&this.addElementByRule(e,a,r,!1===a.consuming?s:void 0)}this.localPreserveWS=n}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let n=this.parser.matchedStyles[e],o=r.getPropertyValue(n);if(o)for(let e;;){let r=this.parser.matchStyle(n,o,this,e);if(!r)break;if(r.ignore)return null;if(t=r.clearMark?t.filter(e=>!r.clearMark(e)):t.concat(this.parser.schema.marks[r.mark].create(r.attrs)),!1===r.consuming)e=r;else break}}return t}addElementByRule(e,t,r,n){let o,i;if(t.node)if((i=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(i.create(t.attrs),r,"BR"==e.nodeName)||this.leafFallback(e,r);else{let e=this.enter(i,t.attrs||null,r,t.preserveWhitespace);e&&(o=!0,r=e)}else{let e=this.parser.schema.marks[t.mark];r=r.concat(e.create(t.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(n)this.addElement(e,r,n);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,r,!1));else{let n=e;"string"==typeof t.contentElement?n=e.querySelector(t.contentElement):"function"==typeof t.contentElement?n=t.contentElement(e):t.contentElement&&(n=t.contentElement),this.findAround(e,n,!0),this.addAll(n,r),this.findAround(e,n,!1)}o&&this.sync(s)&&this.open--}addAll(e,t,r,n){let o=r||0;for(let i=r?e.childNodes[r]:e.firstChild,s=null==n?null:e.childNodes[n];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,r){let n,o;for(let t=this.open,i=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!n||n.length>a.length+i)&&(n=a,o=s,!a.length))break;if(s.solid){if(r)break;i+=2}}if(!n)return null;this.sync(o);for(let e=0;e<n.length;e++)t=this.enterInner(n[e],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let n=this.findPlace(e,t,r);if(n){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let r=l.none;for(let o of n.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):q(o.type,e.type))&&(r=o.addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r,n){let o=this.findPlace(e.create(t),r,!1);return o&&(o=this.enterInner(e,t,r,!0,n)),o}enterInner(e,t,r,n=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let s=z(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let a=l.none;return r=r.filter(t=>(i.type?!i.type.allowsMarkType(t.type):!q(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new V(e,t,a,n,null,s)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=1);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let t=r.length-1;t>=0;t--)e+=r[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let n=0;n<this.find.length;n++)null==this.find[n].pos&&1==e.nodeType&&e.contains(this.find[n].node)&&t.compareDocumentPosition(this.find[n].node)&(r?2:4)&&(this.find[n].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,n=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+ +!n,i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&n?this.nodes[s].type:r&&s>=o?r.node(s-o).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function Y(e){let t={};for(let r in e)t[r]=e[r];return t}function q(e,t){let r=t.schema.nodes;for(let n in r){let o=r[n];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let r=0;r<e.edgeCount;r++){let{type:n,next:o}=e.edge(r);if(n==t||0>i.indexOf(o)&&s(o))return!0}};if(s(o.contentMatch))return!0}}class K{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Q(t).createDocumentFragment());let n=r,o=[];return e.forEach(e=>{if(o.length||e.marks.length){let r=0,i=0;for(;r<o.length&&i<e.marks.length;){let t=e.marks[i];if(!this.marks[t.type.name]){i++;continue}if(!t.eq(o[r][0])||!1===t.type.spec.spanning)break;r++,i++}for(;r<o.length;)n=o.pop()[1];for(;i<e.marks.length;){let r=e.marks[i++],s=this.serializeMark(r,e.isInline,t);s&&(o.push([r,n]),n.appendChild(s.dom),n=s.contentDOM||s.dom)}}n.appendChild(this.serializeNodeInner(e,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:n}=Z(Q(t),this.nodes[e.type.name](e),null,e.attrs);if(n){if(e.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,n)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let n=e.marks.length-1;n>=0;n--){let o=this.serializeMark(e.marks[n],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,t,r={}){let n=this.marks[e.type.name];return n&&Z(Q(r),n(e,t),null,e.attrs)}static renderSpec(e,t,r=null,n){return Z(e,t,r,n)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new K(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=J(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return J(e.marks)}}function J(e){let t={};for(let r in e){let n=e[r].spec.toDOM;n&&(t[r]=n)}return t}function Q(e){return e.document||window.document}let X=new WeakMap;function Z(e,t,r,n){let o,i,s;if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let a=t[0],l;if("string"!=typeof a)throw RangeError("Invalid array passed to renderSpec");if(n&&(void 0===(i=X.get(n))&&X.set(n,(s=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])s||(s=[]),s.push(t);else for(let r=0;r<t.length;r++)e(t[r]);else for(let r in t)e(t[r])}(n),i=s)),l=i)&&l.indexOf(t)>-1)throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let c=a.indexOf(" ");c>0&&(r=a.slice(0,c),a=a.slice(c+1));let d=r?e.createElementNS(r,a):e.createElement(a),h=t[1],p=1;if(h&&"object"==typeof h&&null==h.nodeType&&!Array.isArray(h)){for(let e in p=2,h)if(null!=h[e]){let t=e.indexOf(" ");t>0?d.setAttributeNS(e.slice(0,t),e.slice(t+1),h[e]):"style"==e&&d.style?d.style.cssText=h[e]:d.setAttribute(e,h[e])}}for(let i=p;i<t.length;i++){let s=t[i];if(0===s){if(i<t.length-1||i>p)throw RangeError("Content hole must be the only child of its parent node");return{dom:d,contentDOM:d}}{let{dom:t,contentDOM:i}=Z(e,s,r,n);if(d.appendChild(t),i){if(o)throw RangeError("Multiple content holes");o=i}}}return{dom:d,contentDOM:o}}},27413:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(90425).A)("languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]])},27629:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});let n={}.hasOwnProperty;function o(e,t){let r=t||{};function o(t,...r){let i=o.invalid,s=o.handlers;if(t&&n.call(t,e)){let r=String(t[e]);i=n.call(s,r)?s[r]:o.unknown}if(i)return i.call(this,t,...r)}return o.handlers=r.handlers||{},o.invalid=r.invalid,o.unknown=r.unknown,o}},28215:(e,t,r)=>{"use strict";r.d(t,{a:()=>u,c:()=>p,o:()=>h});class n{constructor(e){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{let e=this.options.deps.length,t=Array(e),r=Array(e);for(let n=0;n<e;n++){let e=this.options.deps[n];t[n]=e.prevState,r[n]=e.state}return this.lastSeenDepValues=r,{prevDepVals:t,currDepVals:r,prevVal:this.prevState??void 0}},this.recompute=()=>{var e,t;this.prevState=this.state;let r=this.getDepVals();this.state=this.options.fn(r),null==(t=(e=this.options).onUpdate)||t.call(e)},this.checkIfRecalculationNeededDeeply=()=>{for(let e of this.options.deps)e instanceof n&&e.checkIfRecalculationNeededDeeply();let e=!1,t=this.lastSeenDepValues,{currDepVals:r}=this.getDepVals();for(let n=0;n<r.length;n++)if(r[n]!==t[n]){e=!0;break}e&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{for(let e of(this.unregisterFromGraph(),this._subscriptions))e()}),this.subscribe=e=>{var t,r;this.listeners.add(e);let n=null==(r=(t=this.options).onSubscribe)?void 0:r.call(t,e,this);return()=>{this.listeners.delete(e),null==n||n()}},this.options=e,this.state=e.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(e=this.options.deps){for(let t of e)if(t instanceof n)t.registerOnGraph(),this.registerOnGraph(t.options.deps);else if(t instanceof d){let e=o.get(t);e||(e=new Set,o.set(t,e)),e.add(this);let r=i.get(this);r||(r=new Set,i.set(this,r)),r.add(t)}}unregisterFromGraph(e=this.options.deps){for(let t of e)if(t instanceof n)this.unregisterFromGraph(t.options.deps);else if(t instanceof d){let e=o.get(t);e&&e.delete(this);let r=i.get(this);r&&r.delete(t)}}}let o=new WeakMap,i=new WeakMap,s={current:[]},a=!1,l=new Set,c=new Map;class d{constructor(e,t){this.listeners=new Set,this.subscribe=e=>{var t,r;this.listeners.add(e);let n=null==(r=null==(t=this.options)?void 0:t.onSubscribe)?void 0:r.call(t,e,this);return()=>{this.listeners.delete(e),null==n||n()}},this.prevState=e,this.state=e,this.options=t}setState(e){var t,r,d;(this.prevState=this.state,null==(t=this.options)?void 0:t.updateFn)?this.state=this.options.updateFn(this.prevState)(e):"function"==typeof e?this.state=e(this.prevState):this.state=e,null==(d=null==(r=this.options)?void 0:r.onUpdate)||d.call(r),function(e){if(l.add(e),!a)try{for(a=!0;l.size>0;){let e=Array.from(l);for(let t of(l.clear(),e)){let e=c.get(t)??t.prevState;t.prevState=e,function(e){let t={prevVal:e.prevState,currentVal:e.state};for(let r of e.listeners)r(t)}(t)}for(let t of e){let e=o.get(t);e&&(s.current.push(t),function e(t){for(let r of Array.from(t).sort((e,t)=>e instanceof n&&e.options.deps.includes(t)?1:t instanceof n&&t.options.deps.includes(e)?-1:0)){if(s.current.includes(r))continue;s.current.push(r),r.recompute();let t=i.get(r);if(t)for(let r of t){let t=o.get(r);t&&e(t)}}}(e))}for(let t of e){let e=o.get(t);if(e)for(let t of e)!function(e){let t={prevVal:e.prevState,currentVal:e.state};for(let r of e.listeners)r(t)}(t)}}}finally{a=!1,s.current=[],c.clear()}}(this)}}let h=Symbol("originalFactory");function p(e){if("object"==typeof e&&"key"in e)return function t(){return e[h]=t,e};if("function"!=typeof e)throw Error("factory must be a function");return function t(r){return n=>{let o=e({editor:n.editor,options:r});return o[h]=t,o}}}function u(e,t){return new d(e,t)}},29804:(e,t,r)=>{"use strict";r.d(t,{E:()=>o});var n=Object.defineProperty;class o{constructor(){((e,t,r)=>{let o;return(o="symbol"!=typeof t?t+"":t)in e?n(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r})(this,"callbacks",{})}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),()=>this.off(e,t)}emit(e,...t){let r=this.callbacks[e];r&&r.forEach(e=>e.apply(this,t))}off(e,t){let r=this.callbacks[e];r&&(t?this.callbacks[e]=r.filter(e=>e!==t):delete this.callbacks[e])}removeAllListeners(){this.callbacks={}}}},30200:(e,t,r)=>{"use strict";r.d(t,{yL:()=>a,S8:()=>s,gZ:()=>l});var n=r(62261);crypto.subtle;let o=crypto.getRandomValues.bind(crypto),i=Math.random,s=()=>o(new Uint32Array(1))[0],a=e=>e[n.RI(i()*e.length)],l=()=>"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(e^s()&15>>e/4).toString(16))},31885:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(90425).A)("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]])},33867:(e,t,r)=>{"use strict";r.d(t,{EK:()=>c,OK:()=>s,id:()=>a,vo:()=>l});var n=r(6648),o=r(90756),i=r(37766);let s=(e,t,r=0)=>{try{for(;r<e.length;r++)e[r](...t)}finally{r<e.length&&s(e,t,r+1)}},a=e=>e,l=(e,t)=>{if(e===t)return!0;if(null==e||null==t||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(null!=e[i.B])return e[i.B](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;break;case Set:if(e.size!==t.size)return!1;for(let r of e)if(!t.has(r))return!1;break;case Map:if(e.size!==t.size)return!1;for(let r of e.keys())if(!t.has(r)||!l(e.get(r),t.get(r)))return!1;break;case void 0:case Object:if(o.Ej(e)!==o.Ej(t))return!1;for(let r in e)if(!o.i5(e,r)||!l(e[r],t[r]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!l(e[r],t[r]))return!1;break;default:return!1}return!0},c=(e,t)=>t.includes(e);n.cy},36158:(e,t,r)=>{"use strict";r.d(t,{Mj:()=>i,S6:()=>s,pJ:()=>o});var n=r(76865);let o=new n.hs("y-sync"),i=new n.hs("y-undo"),s=new n.hs("yjs-cursor")},37766:(e,t,r)=>{"use strict";r.d(t,{B:()=>n,a:()=>o});let n=Symbol("Equality"),o=(e,t)=>e===t||!!e?.[n]?.(t)},41585:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(90425).A)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},42080:(e,t,r)=>{"use strict";r.d(t,{$B:()=>a,Sd:()=>i,T2:()=>s});var n=r(8242),o=r(27050);function i(e,t=null){return function(r,i){let{$from:s,$to:a}=r.selection,l=s.blockRange(a);if(!l)return!1;let c=i?r.tr:null;return!!function(e,t,r,i=null){let s=!1,a=t,l=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(r)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=l.resolve(t.start-2);a=new o.u$(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new o.u$(t.$from,l.resolve(t.$to.end(t.depth)),t.depth)),s=!0}let c=(0,n.oM)(a,r,i,t);return!!c&&(e&&function(e,t,r,i,s){let a=o.FK.empty;for(let e=r.length-1;e>=0;e--)a=o.FK.from(r[e].type.create(r[e].attrs,a));e.step(new n.Wg(t.start-2*!!i,t.end,t.start,t.end,new o.Ji(a,0,0),r.length,!0));let l=0;for(let e=0;e<r.length;e++)r[e].type==s&&(l=e+1);let c=r.length-l,d=t.start+r.length-2*!!i,h=t.parent;for(let r=t.startIndex,o=t.endIndex,i=!0;r<o;r++,i=!1)!i&&(0,n.zy)(e.doc,d,c)&&(e.split(d,c),d+=2*c),d+=h.child(r).nodeSize}(e,t,c,s,r),!0)}(c,l,e,t)&&(i&&i(c.scrollIntoView()),!0)}}function s(e){return function(t,r){let{$from:i,$to:s}=t.selection,a=i.blockRange(s,t=>t.childCount>0&&t.firstChild.type==e);return!!a&&(!r||(i.node(a.depth-1).type==e?function(e,t,r,i){let s=e.tr,a=i.end,l=i.$to.end(i.depth);a<l&&(s.step(new n.Wg(a-1,l,a,l,new o.Ji(o.FK.from(r.create(null,i.parent.copy())),1,0),1,!0)),i=new o.u$(s.doc.resolve(i.$from.pos),s.doc.resolve(l),i.depth));let c=(0,n.jP)(i);if(null==c)return!1;s.lift(i,c);let d=s.doc.resolve(s.mapping.map(a,-1)-1);return(0,n.n9)(s.doc,d.pos)&&d.nodeBefore.type==d.nodeAfter.type&&s.join(d.pos),t(s.scrollIntoView()),!0}(t,r,e,a):function(e,t,r){let i=e.tr,s=r.parent;for(let e=r.end,t=r.endIndex-1,n=r.startIndex;t>n;t--)e-=s.child(t).nodeSize,i.delete(e-1,e+1);let a=i.doc.resolve(r.start),l=a.nodeAfter;if(i.mapping.map(r.end)!=r.start+a.nodeAfter.nodeSize)return!1;let c=0==r.startIndex,d=r.endIndex==s.childCount,h=a.node(-1),p=a.index(-1);if(!h.canReplace(p+ +!c,p+1,l.content.append(d?o.FK.empty:o.FK.from(s))))return!1;let u=a.pos,f=u+l.nodeSize;return i.step(new n.Wg(u-!!c,f+ +!!d,u+1,f-1,new o.Ji((c?o.FK.empty:o.FK.from(s.copy(o.FK.empty))).append(d?o.FK.empty:o.FK.from(s.copy(o.FK.empty))),+!c,+!d),+!c)),t(i.scrollIntoView()),!0}(t,r,a)))}}function a(e){return function(t,r){let{$from:i,$to:s}=t.selection,a=i.blockRange(s,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let l=a.startIndex;if(0==l)return!1;let c=a.parent,d=c.child(l-1);if(d.type!=e)return!1;if(r){let i=d.lastChild&&d.lastChild.type==c.type,s=o.FK.from(i?e.create():null),l=new o.Ji(o.FK.from(e.create(null,o.FK.from(c.type.create(null,s)))),i?3:1,0),h=a.start,p=a.end;r(t.tr.step(new n.Wg(h-(i?3:1),p,h,p,l,1,!0)).scrollIntoView())}return!0}}},48273:(e,t,r)=>{"use strict";let n;r.d(t,{dn:()=>g,Bd:()=>u,IA:()=>b,WI:()=>y});var o=r(87443),i=r(8750);let s=e=>void 0===e?null:e;class a{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let l=new a;try{"u">typeof localStorage&&localStorage&&(l=localStorage)}catch(e){}let c=l;var d=r(33867),h=r(41463);let p=void 0!==h&&h.release&&/node|io\.js/.test(h.release.name)&&"[object process]"===Object.prototype.toString.call(void 0!==h?h:0),u="u">typeof window&&"u">typeof document&&!p;"u">typeof navigator&&/Mac/.test(navigator.platform);let f=[],m=e=>(()=>{if(void 0===n)if(p){n=o.vt();let e=h.argv,t=null;for(let r=0;r<e.length;r++){let o=e[r];"-"===o[0]?(null!==t&&n.set(t,""),t=o):null!==t?(n.set(t,o),t=null):f.push(o)}null!==t&&n.set(t,"")}else"object"==typeof location?(n=o.vt(),(location.search||"?").slice(1).split("&").forEach(e=>{if(0!==e.length){let[t,r]=e.split("=");n.set(`--${i.jN(t,"-")}`,r),n.set(`-${i.jN(t,"-")}`,r)}})):n=o.vt();return n})().has(e),g=e=>p?s(h.env[e.toUpperCase().replaceAll("-","_")]):s(c.getItem(e)),E=e=>m("--"+e)||null!==g(e),b=E("production"),y=p&&d.EK(h.env.FORCE_COLOR,["true","1","2"])||!m("--no-colors")&&!E("no-color")&&(!p||h.stdout.isTTY)&&(!p||m("--color")||null!==g("COLORTERM")||(g("TERM")||"").includes("color"))},50208:(e,t,r)=>{"use strict";let n;r.d(t,{eg:()=>s});var o=r(91492);async function i(){return n||(n=(async()=>{let[e,t]=await Promise.all([r.e(4758).then(r.bind(r,69850)),r.e(234).then(r.t.bind(r,21263,17))]),n="default"in e?e.default:e,o="default"in t?t.default:t;return await n.init({data:o}),{emojiMart:n,emojiData:o}})())}async function s(e,t){if(!("text"in e.schema.inlineContentSchema)||e.schema.inlineContentSchema.text!==o._.text)return[];let{emojiData:r,emojiMart:n}=await i();return(""===t.trim()?Object.values(r.emojis):await n.SearchIndex.search(t)).map(t=>({id:t.skins[0].native,onItemClick:()=>e.insertInlineContent(t.skins[0].native+" ")}))}},50947:(e,t,r)=>{"use strict";r.d(t,{yy:()=>p,R8:()=>u});var n=r(48273),o=r(19441);class i{constructor(e,t){this.left=e,this.right=t}}let s=(e,t)=>new i(e,t);var a=r(84206),l=r(87443),c=r(63758);let d={[c.Y]:s("font-weight","bold"),[c.Ny]:s("font-weight","normal"),[c.ft]:s("color","blue"),[c.AV]:s("color","green"),[c.Qu]:s("color","grey"),[c.UH]:s("color","red"),[c.hr]:s("color","purple"),[c.hN]:s("color","orange"),[c.Tx]:s("color","black")},h=n.WI?e=>{1===e.length&&e[0]?.constructor===Function&&(e=e[0]());let t=[],r=[],n=l.vt(),o=[],i=0;for(;i<e.length;i++){let o=e[i],s=d[o];if(void 0!==s)n.set(s.left,s.right);else{if(void 0===o)break;if(o.constructor===String||o.constructor===Number){let e=a.OW(n);i>0||e.length>0?(t.push("%c"+o),r.push(e)):t.push(o)}else break}}for(i>0&&(o=r).unshift(t.join(""));i<e.length;i++){let t=e[i];t instanceof Symbol||o.push(t)}return o}:c.ET,p=(...e)=>{console.log(...h(e)),f.forEach(t=>t.print(e))},u=(...e)=>{console.warn(...h(e)),e.unshift(c.hN),f.forEach(t=>t.print(e))},f=o.vt()},59710:(e,t,r)=>{"use strict";r.d(t,{xq:()=>E,b6:()=>T,ZS:()=>A,tN:()=>k});var n=function(){};n.prototype.append=function(e){return e.length?(e=n.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},n.prototype.prepend=function(e){return e.length?n.from(e).append(this):this},n.prototype.appendInner=function(e){return new i(this,e)},n.prototype.slice=function(e,t){return(void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t)?n.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},n.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},n.prototype.forEach=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},n.prototype.map=function(e,t,r){void 0===t&&(t=0),void 0===r&&(r=this.length);var n=[];return this.forEach(function(t,r){return n.push(e(t,r))},t,r),n},n.from=function(e){return e instanceof n?e:e&&e.length?new o(e):n.empty};var o=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,r){return 0==e&&r==this.length?this:new t(this.values.slice(e,r))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,r,n){for(var o=t;o<r;o++)if(!1===e(this.values[o],n+o))return!1},t.prototype.forEachInvertedInner=function(e,t,r,n){for(var o=t-1;o>=r;o--)if(!1===e(this.values[o],n+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(t.prototype,r),t}(n);n.empty=new o([]);var i=function(e){function t(t,r){e.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,r,n){var o=this.left.length;if(t<o&&!1===this.left.forEachInner(e,t,Math.min(r,o),n)||r>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,r)-o,n+o))return!1},t.prototype.forEachInvertedInner=function(e,t,r,n){var o=this.left.length;if(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(r,o)-o,n+o)||r<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),r,n))return!1},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var r=this.left.length;return t<=r?this.left.slice(e,t):e>=r?this.right.slice(e-r,t-r):this.left.slice(e,r).append(this.right.slice(0,t-r))},t.prototype.leafAppend=function(e){var r=this.right.leafAppend(e);if(r)return new t(this.left,r)},t.prototype.leafPrepend=function(e){var r=this.left.leafPrepend(e);if(r)return new t(r,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(n),s=r(8242),a=r(76865);class l{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){let r,n,o,i;if(0==this.eventCount)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}t&&(n=(r=this.remapping(s,this.items.length)).maps.length);let a=e.tr,d=[],h=[];return this.items.forEach((e,t)=>{if(!e.step){r||(n=(r=this.remapping(s,t+1)).maps.length),n--,h.push(e);return}if(r){h.push(new c(e.map));let t=e.step.map(r.slice(n)),o;t&&a.maybeStep(t).doc&&(o=a.mapping.maps[a.mapping.maps.length-1],d.push(new c(o,void 0,void 0,d.length+h.length))),n--,o&&r.appendMap(o,n)}else a.maybeStep(e.step);if(e.selection)return o=r?e.selection.map(r.slice(n)):e.selection,i=new l(this.items.slice(0,s).append(h.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:i,transform:a,selection:o}}addTransform(e,t,r,n){var o,i;let s,a=[],d=this.eventCount,p=this.items,u=!n&&p.length?p.get(p.length-1):null;for(let r=0;r<e.steps.length;r++){let o=e.steps[r].invert(e.docs[r]),i=new c(e.mapping.maps[r],o,t),s;(s=u&&u.merge(i))&&(i=s,r?a.pop():p=p.slice(0,p.length-1)),a.push(i),t&&(d++,t=void 0),n||(u=i)}let f=d-r.depth;return f>h&&(o=p,i=f,o.forEach((e,t)=>{if(e.selection&&0==i--)return s=t,!1}),p=o.slice(s),d-=f),new l(p.append(a),d)}remapping(e,t){let r=new s.X9;return this.items.forEach((t,n)=>{let o=null!=t.mirrorOffset&&n-t.mirrorOffset>=e?r.maps.length-t.mirrorOffset:void 0;r.appendMap(t.map,o)},e,t),r}addMaps(e){return 0==this.eventCount?this:new l(this.items.append(e.map(e=>new c(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],n=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},n);let a=t;this.items.forEach(t=>{let n=o.getMirror(--a);if(null==n)return;i=Math.min(i,n);let l=o.maps[n];if(t.step){let i=e.steps[n].invert(e.docs[n]),d=t.selection&&t.selection.map(o.slice(a+1,n));d&&s++,r.push(new c(l,i,d))}else r.push(new c(l))},n);let d=[];for(let e=t;e<i;e++)d.push(new c(o.maps[e]));let h=new l(this.items.slice(0,n).append(d).append(r),s);return h.emptyItemCount()>500&&(h=h.compress(this.items.length-r.length)),h}emptyItemCount(){let e=0;return this.items.forEach(t=>{!t.step&&e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,o=[],i=0;return this.items.forEach((n,s)=>{if(s>=e)o.push(n),n.selection&&i++;else if(n.step){let e=n.step.map(t.slice(r)),s=e&&e.getMap();if(r--,s&&t.appendMap(s,r),e){let a=n.selection&&n.selection.map(t.slice(r));a&&i++;let l=new c(s.invert(),e,a),d,h=o.length-1;(d=o.length&&o[h].merge(l))?o[h]=d:o.push(l)}}else n.map&&r--},this.items.length,0),new l(n.from(o.reverse()),i)}}l.empty=new l(n.empty,0);class c{constructor(e,t,r,n){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=n}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new c(t.getMap().invert(),t,this.selection)}}}class d{constructor(e,t,r,n,o){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=n,this.prevComposition=o}}let h=20;function p(e){let t=[];for(let r=e.length-1;r>=0&&0==t.length;r--)e[r].forEach((e,r,n,o)=>t.push(n,o));return t}function u(e,t){if(!e)return null;let r=[];for(let n=0;n<e.length;n+=2){let o=t.map(e[n],1),i=t.map(e[n+1],-1);o<=i&&r.push(o,i)}return r}let f=!1,m=null;function g(e){let t=e.plugins;if(m!=t){f=!1,m=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){f=!0;break}}return f}function E(e){return e.setMeta(y,!0)}let b=new a.hs("history"),y=new a.hs("closeHistory");function T(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new a.k_({key:b,state:{init:()=>new d(l.empty,l.empty,null,0,-1),apply:(t,r,n)=>(function(e,t,r,n){let o=r.getMeta(b),i;if(o)return o.historyState;r.getMeta(y)&&(e=new d(e.done,e.undone,null,0,-1));let s=r.getMeta("appendedTransaction");if(0==r.steps.length)return e;if(s&&s.getMeta(b))if(s.getMeta(b).redo)return new d(e.done.addTransform(r,void 0,n,g(t)),e.undone,p(r.mapping.maps),e.prevTime,e.prevComposition);else return new d(e.done,e.undone.addTransform(r,void 0,n,g(t)),null,e.prevTime,e.prevComposition);if(!1===r.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))if(i=r.getMeta("rebased"))return new d(e.done.rebased(r,i),e.undone.rebased(r,i),u(e.prevRanges,r.mapping),e.prevTime,e.prevComposition);else return new d(e.done.addMaps(r.mapping.maps),e.undone.addMaps(r.mapping.maps),u(e.prevRanges,r.mapping),e.prevTime,e.prevComposition);{let o=r.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(r.time||0)-n.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let r=!1;return e.mapping.maps[0].forEach((e,n)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&n>=t[o]&&(r=!0)}),r}(r,e.prevRanges)),a=s?u(e.prevRanges,r.mapping):p(r.mapping.maps);return new d(e.done.addTransform(r,i?t.selection.getBookmark():void 0,n,g(t)),l.empty,a,r.time,null==o?e.prevComposition:o)}})(r,n,t,e)},config:e,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,n="historyUndo"==r?k:"historyRedo"==r?A:null;return!!n&&!!e.editable&&(t.preventDefault(),n(e.state,e.dispatch))}}}})}function v(e,t){return(r,n)=>{let o=b.getState(r);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(n){let i=function(e,t,r){let n=g(t),o=b.get(t).spec.config,i=(r?e.undone:e.done).popEvent(t,n);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(r?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,n),l=new d(r?a:i.remaining,r?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(b,{redo:r,historyState:l})}(o,r,e);i&&n(t?i.scrollIntoView():i)}return!0}}let k=v(!1,!0),A=v(!0,!0);v(!1,!1),v(!0,!1)},62261:(e,t,r)=>{"use strict";r.d(t,{RI:()=>n,T9:()=>s,jk:()=>i,sj:()=>a,tn:()=>o});let n=Math.floor,o=Math.abs,i=(e,t)=>e<t?e:t,s=(e,t)=>e>t?e:t,a=e=>0!==e?e<0:1/e<0},62921:(e,t,r)=>{"use strict";let n,o;r.d(t,{AL:()=>eo,D8:()=>U,GU:()=>N,J3:()=>d,JD:()=>M,L0:()=>P,LF:()=>ed,Qg:()=>et,RC:()=>_,aR:()=>D,gC:()=>O,gR:()=>I,rn:()=>v,w7:()=>L});var i=r(76865),s=r(27050),a=r(63197),l=r(12894),c=r(8242);if("u">typeof WeakMap){let e=new WeakMap;n=t=>e.get(t),o=(t,r)=>(e.set(t,r),r)}else{let e=[],t=0;n=t=>{for(let r=0;r<e.length;r+=2)if(e[r]==t)return e[r+1]},o=(r,n)=>(10==t&&(t=0),e[t++]=r,e[t++]=n)}var d=class{constructor(e,t,r,n){this.width=e,this.height=t,this.map=r,this.problems=n}findCell(e){for(let t=0;t<this.map.length;t++){let r=this.map[t];if(r!=e)continue;let n=t%this.width,o=t/this.width|0,i=n+1,s=o+1;for(let e=1;i<this.width&&this.map[t+e]==r;e++)i++;for(let e=1;s<this.height&&this.map[t+this.width*e]==r;e++)s++;return{left:n,top:o,right:i,bottom:s}}throw RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw RangeError(`No cell with offset ${e} found`)}nextCell(e,t,r){let{left:n,right:o,top:i,bottom:s}=this.findCell(e);return"horiz"==t?(r<0?0==n:o==this.width)?null:this.map[i*this.width+(r<0?n-1:o)]:(r<0?0==i:s==this.height)?null:this.map[n+this.width*(r<0?i-1:s)]}rectBetween(e,t){let{left:r,right:n,top:o,bottom:i}=this.findCell(e),{left:s,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(r,s),top:Math.min(o,l),right:Math.max(n,a),bottom:Math.max(i,c)}}cellsInRect(e){let t=[],r={};for(let n=e.top;n<e.bottom;n++)for(let o=e.left;o<e.right;o++){let i=n*this.width+o,s=this.map[i];!r[s]&&(r[s]=!0,o==e.left&&o&&this.map[i-1]==s||n==e.top&&n&&this.map[i-this.width]==s||t.push(s))}return t}positionAt(e,t,r){for(let n=0,o=0;;n++){let i=o+r.child(n).nodeSize;if(n==e){let r=t+e*this.width,n=(e+1)*this.width;for(;r<n&&this.map[r]<o;)r++;return r==n?i-1:this.map[r]}o=i}}static get(e){return n(e)||o(e,function(e){if("table"!=e.type.spec.tableRole)throw RangeError("Not a table node: "+e.type.name);let t=function(e){let t=-1,r=!1;for(let n=0;n<e.childCount;n++){let o=e.child(n),i=0;if(r)for(let t=0;t<n;t++){let r=e.child(t);for(let e=0;e<r.childCount;e++){let o=r.child(e);t+o.attrs.rowspan>n&&(i+=o.attrs.colspan)}}for(let e=0;e<o.childCount;e++){let t=o.child(e);i+=t.attrs.colspan,t.attrs.rowspan>1&&(r=!0)}-1==t?t=i:t!=i&&(t=Math.max(t,i))}return t}(e),r=e.childCount,n=[],o=0,i=null,s=[];for(let e=0,o=t*r;e<o;e++)n[e]=0;for(let a=0,l=0;a<r;a++){let c=e.child(a);l++;for(let e=0;;e++){for(;o<n.length&&0!=n[o];)o++;if(e==c.childCount)break;let d=c.child(e),{colspan:h,rowspan:p,colwidth:u}=d.attrs;for(let e=0;e<p;e++){if(e+a>=r){(i||(i=[])).push({type:"overlong_rowspan",pos:l,n:p-e});break}let c=o+e*t;for(let e=0;e<h;e++){0==n[c+e]?n[c+e]=l:(i||(i=[])).push({type:"collision",row:a,pos:l,n:h-e});let r=u&&u[e];if(r){let n=(c+e)%t*2,o=s[n];null==o||o!=r&&1==s[n+1]?(s[n]=r,s[n+1]=1):o==r&&s[n+1]++}}}o+=h,l+=d.nodeSize}let d=(a+1)*t,h=0;for(;o<d;)0==n[o++]&&h++;h&&(i||(i=[])).push({type:"missing",row:a,n:h}),l++}(0===t||0===r)&&(i||(i=[])).push({type:"zero_sized"});let a=new d(t,r,n,i),l=!1;for(let e=0;!l&&e<s.length;e+=2)null!=s[e]&&s[e+1]<r&&(l=!0);return l&&function(e,t,r){e.problems||(e.problems=[]);let n={};for(let o=0;o<e.map.length;o++){let i=e.map[o];if(n[i])continue;n[i]=!0;let s=r.nodeAt(i);if(!s)throw RangeError(`No cell with offset ${i} found`);let a=null,l=s.attrs;for(let r=0;r<l.colspan;r++){let n=t[(o+r)%e.width*2];null==n||l.colwidth&&l.colwidth[r]==n||((a||(a=function(e){if(e.colwidth)return e.colwidth.slice();let t=[];for(let r=0;r<e.colspan;r++)t.push(0);return t}(l)))[r]=n)}a&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}(a,s,e),a}(e))}};function h(e){let t=e.cached.tableNodeTypes;if(!t)for(let r in t=e.cached.tableNodeTypes={},e.nodes){let n=e.nodes[r],o=n.spec.tableRole;o&&(t[o]=n)}return t}let p=new i.hs("selectingCells");function u(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function f(e){let t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function m(e){let t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;let r=u(t.$head)||function(e){for(let t=e.nodeAfter,r=e.pos;t;t=t.firstChild,r++){let n=t.type.spec.tableRole;if("cell"==n||"header_cell"==n)return e.doc.resolve(r)}for(let t=e.nodeBefore,r=e.pos;t;t=t.lastChild,r--){let n=t.type.spec.tableRole;if("cell"==n||"header_cell"==n)return e.doc.resolve(r-t.nodeSize)}}(t.$head);if(r)return r;throw RangeError(`No cell found around position ${t.head}`)}function g(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function E(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function b(e,t,r){let n=e.node(-1),o=d.get(n),i=e.start(-1),s=o.nextCell(e.pos-i,t,r);return null==s?null:e.node(0).resolve(i+s)}function y(e,t,r=1){let n={...e,colspan:e.colspan-r};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(t,r),n.colwidth.some(e=>e>0)||(n.colwidth=null)),n}function T(e,t,r=1){let n={...e,colspan:e.colspan+r};if(n.colwidth){n.colwidth=n.colwidth.slice();for(let e=0;e<r;e++)n.colwidth.splice(t,0,0)}return n}var v=class e extends i.LN{constructor(e,t=e){const r=e.node(-1),n=d.get(r),o=e.start(-1),s=n.rectBetween(e.pos-o,t.pos-o),a=e.node(0),l=n.cellsInRect(s).filter(e=>e!=t.pos-o);l.unshift(t.pos-o);const c=l.map(e=>{let t=r.nodeAt(e);if(!t)throw RangeError(`No cell with offset ${e} found`);let n=o+e+1;return new i.yn(a.resolve(n),a.resolve(n+t.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(t,r){let n=t.resolve(r.map(this.$anchorCell.pos)),o=t.resolve(r.map(this.$headCell.pos));if(g(n)&&g(o)&&E(n,o)){let t=this.$anchorCell.node(-1)!=n.node(-1);return t&&this.isRowSelection()?e.rowSelection(n,o):t&&this.isColSelection()?e.colSelection(n,o):new e(n,o)}return i.U3.between(n,o)}content(){let e=this.$anchorCell.node(-1),t=d.get(e),r=this.$anchorCell.start(-1),n=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),o={},i=[];for(let r=n.top;r<n.bottom;r++){let a=[];for(let i=r*t.width+n.left,s=n.left;s<n.right;s++,i++){let r=t.map[i];if(o[r])continue;o[r]=!0;let s=t.findCell(r),l=e.nodeAt(r);if(!l)throw RangeError(`No cell with offset ${r} found`);let c=n.left-s.left,d=s.right-n.right;if(c>0||d>0){let e=l.attrs;if(c>0&&(e=y(e,0,c)),d>0&&(e=y(e,e.colspan-d,d)),s.left<n.left){if(!(l=l.type.createAndFill(e)))throw RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else l=l.type.create(e,l.content)}if(s.top<n.top||s.bottom>n.bottom){let e={...l.attrs,rowspan:Math.min(s.bottom,n.bottom)-Math.max(s.top,n.top)};l=s.top<n.top?l.type.createAndFill(e):l.type.create(e,l.content)}a.push(l)}i.push(e.child(r).copy(s.FK.from(a)))}let a=this.isColSelection()&&this.isRowSelection()?e:i;return new s.Ji(s.FK.from(a),1,1)}replace(e,t=s.Ji.empty){let r=e.steps.length,n=this.ranges;for(let o=0;o<n.length;o++){let{$from:i,$to:a}=n[o],l=e.mapping.slice(r);e.replace(l.map(i.pos),l.map(a.pos),o?s.Ji.empty:t)}let o=i.LN.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new s.Ji(s.FK.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),r=d.get(t),n=this.$anchorCell.start(-1),o=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n));for(let r=0;r<o.length;r++)e(t.nodeAt(o[r]),n+o[r])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);return!(Math.min(e,t)>0)&&Math.max(e+this.$anchorCell.nodeAfter.attrs.rowspan,t+this.$headCell.nodeAfter.attrs.rowspan)==this.$headCell.node(-1).childCount}static colSelection(t,r=t){let n=t.node(-1),o=d.get(n),i=t.start(-1),s=o.findCell(t.pos-i),a=o.findCell(r.pos-i),l=t.node(0);return s.top<=a.top?(s.top>0&&(t=l.resolve(i+o.map[s.left])),a.bottom<o.height&&(r=l.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))):(a.top>0&&(r=l.resolve(i+o.map[a.left])),s.bottom<o.height&&(t=l.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new e(t,r)}isRowSelection(){let e=this.$anchorCell.node(-1),t=d.get(e),r=this.$anchorCell.start(-1),n=t.colCount(this.$anchorCell.pos-r),o=t.colCount(this.$headCell.pos-r);return!(Math.min(n,o)>0)&&Math.max(n+this.$anchorCell.nodeAfter.attrs.colspan,o+this.$headCell.nodeAfter.attrs.colspan)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,r=t){let n=t.node(-1),o=d.get(n),i=t.start(-1),s=o.findCell(t.pos-i),a=o.findCell(r.pos-i),l=t.node(0);return s.left<=a.left?(s.left>0&&(t=l.resolve(i+o.map[s.top*o.width])),a.right<o.width&&(r=l.resolve(i+o.map[o.width*(a.top+1)-1]))):(a.left>0&&(r=l.resolve(i+o.map[a.top*o.width])),s.right<o.width&&(t=l.resolve(i+o.map[o.width*(s.top+1)-1]))),new e(t,r)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,r){return new e(t.resolve(r.anchor),t.resolve(r.head))}static create(t,r,n=r){return new e(t.resolve(r),t.resolve(n))}getBookmark(){return new k(this.$anchorCell.pos,this.$headCell.pos)}};v.prototype.visible=!1,i.LN.jsonID("cell",v);var k=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){let t=e.resolve(this.anchor),r=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==r.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&E(t,r)?new v(t,r):i.LN.near(r,1)}};function A(e){if(!(e.selection instanceof v))return null;let t=[];return e.selection.forEachCell((e,r)=>{t.push(a.NZ.node(r,r+e.nodeSize,{class:"selectedCell"}))}),a.zF.create(e.doc,t)}let C=new i.hs("fix-tables");function S(e){let t=e.selection,r=m(e),n=r.node(-1),o=r.start(-1),i=d.get(n);return{...t instanceof v?i.rectBetween(t.$anchorCell.pos-o,t.$headCell.pos-o):i.findCell(r.pos-o),tableStart:o,map:i,table:n}}function w(e,{map:t,tableStart:r,table:n},o){let i=o>0?-1:0;(function(e,t,r){let n=h(t.type.schema).header_cell;for(let o=0;o<e.height;o++)if(t.nodeAt(e.map[r+o*e.width]).type!=n)return!1;return!0})(t,n,o+i)&&(i=0==o||o==t.width?null:0);for(let s=0;s<t.height;s++){let a=s*t.width+o;if(o>0&&o<t.width&&t.map[a-1]==t.map[a]){let i=t.map[a],l=n.nodeAt(i);e.setNodeMarkup(e.mapping.map(r+i),null,T(l.attrs,o-t.colCount(i))),s+=l.attrs.rowspan-1}else{let l=null==i?h(n.type.schema).cell:n.nodeAt(t.map[a+i]).type,c=t.positionAt(s,o,n);e.insert(e.mapping.map(r+c),l.createAndFill())}}return e}function _(e,t){if(!f(e))return!1;if(t){let r=S(e);t(w(e.tr,r,r.left))}return!0}function N(e,t){if(!f(e))return!1;if(t){let r=S(e);t(w(e.tr,r,r.right))}return!0}function I(e,t){if(!f(e))return!1;if(t){let r=S(e),n=e.tr;if(0==r.left&&r.right==r.map.width)return!1;for(let e=r.right-1;!function(e,{map:t,table:r,tableStart:n},o){let i=e.mapping.maps.length;for(let s=0;s<t.height;){let a=s*t.width+o,l=t.map[a],c=r.nodeAt(l),d=c.attrs;if(o>0&&t.map[a-1]==l||o<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(i).map(n+l),null,y(d,o-t.colCount(l)));else{let t=e.mapping.slice(i).map(n+l);e.delete(t,t+c.nodeSize)}s+=d.rowspan}}(n,r,e),e!=r.left;e--){let e=r.tableStart?n.doc.nodeAt(r.tableStart-1):n.doc;if(!e)throw RangeError("No table found");r.table=e,r.map=d.get(e)}t(n)}return!0}function x(e,{map:t,tableStart:r,table:n},o){let i=r;for(let e=0;e<o;e++)i+=n.child(e).nodeSize;let s=[],a=o>0?-1:0;(function(e,t,r){var n;let o=h(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if((null==(n=t.nodeAt(e.map[i+r*e.width]))?void 0:n.type)!=o)return!1;return!0})(t,n,o+a)&&(a=0==o||o==t.height?null:0);for(let i=0,c=t.width*o;i<t.width;i++,c++)if(o>0&&o<t.height&&t.map[c]==t.map[c-t.width]){let o=t.map[c],s=n.nodeAt(o).attrs;e.setNodeMarkup(r+o,null,{...s,rowspan:s.rowspan+1}),i+=s.colspan-1}else{var l;let e=null==a?h(n.type.schema).cell:null==(l=n.nodeAt(t.map[c+a*t.width]))?void 0:l.type,r=null==e?void 0:e.createAndFill();r&&s.push(r)}return e.insert(i,h(n.type.schema).row.create(null,s)),e}function M(e,t){if(!f(e))return!1;if(t){let r=S(e);t(x(e.tr,r,r.top))}return!0}function O(e,t){if(!f(e))return!1;if(t){let r=S(e);t(x(e.tr,r,r.bottom))}return!0}function D(e,t){if(!f(e))return!1;if(t){let r=S(e),n=e.tr;if(0==r.top&&r.bottom==r.map.height)return!1;for(let e=r.bottom-1;!function(e,{map:t,table:r,tableStart:n},o){let i=0;for(let e=0;e<o;e++)i+=r.child(e).nodeSize;let s=i+r.child(o).nodeSize,a=e.mapping.maps.length;e.delete(i+n,s+n);let l=new Set;for(let i=0,s=o*t.width;i<t.width;i++,s++){let c=t.map[s];if(!l.has(c)){if(l.add(c),o>0&&c==t.map[s-t.width]){let t=r.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(a).map(c+n),null,{...t,rowspan:t.rowspan-1}),i+=t.colspan-1}else if(o<t.height&&c==t.map[s+t.width]){let s=r.nodeAt(c),l=s.attrs,d=s.type.create({...l,rowspan:s.attrs.rowspan-1},s.content),h=t.positionAt(o+1,i,r);e.insert(e.mapping.slice(a).map(n+h),d),i+=l.colspan-1}}}}(n,r,e),e!=r.top;e--){let e=r.tableStart?n.doc.nodeAt(r.tableStart-1):n.doc;if(!e)throw RangeError("No table found");r.table=e,r.map=d.get(r.table)}t(n)}return!0}function R(e){let t=e.content;return 1==t.childCount&&t.child(0).isTextblock&&0==t.child(0).childCount}function L(e,t){let r=e.selection;if(!(r instanceof v)||r.$anchorCell.pos==r.$headCell.pos)return!1;let n=S(e),{map:o}=n;if(function({width:e,height:t,map:r},n){let o=n.top*e+n.left,i=o,s=(n.bottom-1)*e+n.left,a=o+(n.right-n.left-1);for(let t=n.top;t<n.bottom;t++){if(n.left>0&&r[i]==r[i-1]||n.right<e&&r[a]==r[a+1])return!0;i+=e,a+=e}for(let i=n.left;i<n.right;i++){if(n.top>0&&r[o]==r[o-e]||n.bottom<t&&r[s]==r[s+e])return!0;o++,s++}return!1}(o,n))return!1;if(t){let r,i,a=e.tr,l={},c=s.FK.empty;for(let e=n.top;e<n.bottom;e++)for(let t=n.left;t<n.right;t++){let s=o.map[e*o.width+t],d=n.table.nodeAt(s);if(!l[s]&&d)if(l[s]=!0,null==r)r=s,i=d;else{R(d)||(c=c.append(d.content));let e=a.mapping.map(s+n.tableStart);a.delete(e,e+d.nodeSize)}}if(null==r||null==i)return!0;if(a.setNodeMarkup(r+n.tableStart,null,{...T(i.attrs,i.attrs.colspan,n.right-n.left-i.attrs.colspan),rowspan:n.bottom-n.top}),c.size>0){let e=r+1+i.content.size,t=R(i)?r+1:e;a.replaceWith(t+n.tableStart,e+n.tableStart,c)}a.setSelection(new v(a.doc.resolve(r+n.tableStart))),t(a)}return!0}function P(e,t){var r;let n=h(e.schema);return(r=({node:e})=>n[e.type.spec.tableRole],(e,t)=>{let n,o,i=e.selection;if(i instanceof v){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;n=i.$anchorCell.nodeAfter,o=i.$anchorCell.pos}else{var s;if(!(n=function(e){for(let t=e.depth;t>0;t--){let r=e.node(t).type.spec.tableRole;if("cell"===r||"header_cell"===r)return e.node(t)}return null}(i.$from)))return!1;o=null==(s=u(i.$from))?void 0:s.pos}if(null==n||null==o||1==n.attrs.colspan&&1==n.attrs.rowspan)return!1;if(t){let s,a=n.attrs,l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});let d=S(e),h=e.tr;for(let e=0;e<d.right-d.left;e++)l.push(c?{...a,colwidth:c&&c[e]?[c[e]]:null}:a);for(let e=d.top;e<d.bottom;e++){let t=d.map.positionAt(e,d.left,d.table);e==d.top&&(t+=n.nodeSize);for(let o=d.left,i=0;o<d.right;o++,i++)(o!=d.left||e!=d.top)&&h.insert(s=h.mapping.map(t+d.tableStart,1),r({node:n,row:e,col:o}).createAndFill(l[i]))}h.setNodeMarkup(o,r({node:n,row:d.top,col:d.left}),l[0]),i instanceof v&&h.setSelection(new v(h.doc.resolve(i.$anchorCell.pos),s?h.doc.resolve(s):void 0)),t(h)}return!0})(e,t)}function B(e,t,r){let n=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<n.length;e++){let o=t.table.nodeAt(n[e]);if(o&&o.type!==r.header_cell)return!1}return!0}function F(e,t){if((t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic)return function(t,r){if(!f(t))return!1;if(r){let n=h(t.schema),o=S(t),i=t.tr,s=o.map.cellsInRect("column"==e?{left:o.left,top:0,right:o.right,bottom:o.map.height}:"row"==e?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=s.map(e=>o.table.nodeAt(e));for(let e=0;e<s.length;e++)a[e].type==n.header_cell&&i.setNodeMarkup(o.tableStart+s[e],n.cell,a[e].attrs);if(0===i.steps.length)for(let e=0;e<s.length;e++)i.setNodeMarkup(o.tableStart+s[e],n.header_cell,a[e].attrs);r(i)}return!0};return function(t,r){if(!f(t))return!1;if(r){let n=h(t.schema),o=S(t),i=t.tr,s=B("row",o,n),a=B("column",o,n),l=+("column"===e?!!s:"row"===e&&!!a),c="column"==e?{left:0,top:l,right:1,bottom:o.map.height}:"row"==e?{left:l,top:0,right:o.map.width,bottom:1}:o,d="column"==e?a?n.cell:n.header_cell:"row"==e?s?n.cell:n.header_cell:n.cell;o.map.cellsInRect(c).forEach(e=>{let t=e+o.tableStart,r=i.doc.nodeAt(t);r&&i.setNodeMarkup(t,d,r.attrs)}),r(i)}return!0}}function U(e){return function(t,r){if(!f(t))return!1;let n=function(e,t){if(t<0){let t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,r=e.before();t>=0;t--){let n=e.node(-1).child(t),o=n.lastChild;if(o)return r-1-o.nodeSize;r-=n.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;let t=e.node(-1);for(let r=e.indexAfter(-1),n=e.after();r<t.childCount;r++){let e=t.child(r);if(e.childCount)return n+1;n+=e.nodeSize}}return null}(m(t),e);if(null==n)return!1;if(r){let e=t.doc.resolve(n);r(t.tr.setSelection(i.U3.between(e,e.node(0).resolve(e.pos+e.nodeAfter.nodeSize))).scrollIntoView())}return!0}}function H(e,t){let r=e.selection;if(!(r instanceof v))return!1;if(t){let n=e.tr,o=h(e.schema).cell.createAndFill().content;r.forEachCell((e,t)=>{e.content.eq(o)||n.replace(n.mapping.map(t+1),n.mapping.map(t+e.nodeSize-1),new s.Ji(o,0,0))}),n.docChanged&&t(n)}return!0}function j(e,t){let r=e.createAndFill();return new c.dL(r).replace(0,r.content.size,t).doc}function $(e,t,r,n,o,i,s,a){if(0==s||s==t.height)return!1;let l=!1;for(let c=o;c<i;c++){let o=s*t.width+c,i=t.map[o];if(t.map[o-t.width]==i){l=!0;let o=r.nodeAt(i),{top:d,left:h}=t.findCell(i);e.setNodeMarkup(e.mapping.slice(a).map(i+n),null,{...o.attrs,rowspan:s-d}),e.insert(e.mapping.slice(a).map(t.positionAt(s,h,r)),o.type.createAndFill({...o.attrs,rowspan:d+o.attrs.rowspan-s})),c+=o.attrs.colspan-1}}return l}function G(e,t,r,n,o,i,s,a){if(0==s||s==t.width)return!1;let l=!1;for(let c=o;c<i;c++){let o=c*t.width+s,i=t.map[o];if(t.map[o-1]==i){l=!0;let o=r.nodeAt(i),d=t.colCount(i),h=e.mapping.slice(a).map(i+n);e.setNodeMarkup(h,null,y(o.attrs,s-d,o.attrs.colspan-(s-d))),e.insert(h+o.nodeSize,o.type.createAndFill(y(o.attrs,0,s-d))),c+=o.attrs.rowspan-1}}return l}function z(e,t,r,n,o){let i=r?e.doc.nodeAt(r-1):e.doc;if(!i)throw Error("No table found");let a=d.get(i),{top:l,left:c}=n,p=c+o.width,u=l+o.height,f=e.tr,m=0;function g(){if(!(i=r?f.doc.nodeAt(r-1):f.doc))throw Error("No table found");a=d.get(i),m=f.mapping.maps.length}(function(e,t,r,n,o,i,a){let l,c,d=h(e.doc.type.schema);if(o>t.width)for(let i=0,s=0;i<t.height;i++){let a,h=r.child(i);s+=h.nodeSize;let p=[];a=null==h.lastChild||h.lastChild.type==d.cell?l||(l=d.cell.createAndFill()):c||(c=d.header_cell.createAndFill());for(let e=t.width;e<o;e++)p.push(a);e.insert(e.mapping.slice(0).map(s-1+n),p)}if(i>t.height){let a=[];for(let e=0,n=(t.height-1)*t.width;e<Math.max(t.width,o);e++){let o=!(e>=t.width)&&r.nodeAt(t.map[n+e]).type==d.header_cell;a.push(o?c||(c=d.header_cell.createAndFill()):l||(l=d.cell.createAndFill()))}let h=d.row.create(null,s.FK.from(a)),p=[];for(let e=t.height;e<i;e++)p.push(h);e.insert(e.mapping.slice(0).map(n+r.nodeSize-2),p)}return!!(l||c)})(f,a,i,r,p,u,0)&&g(),$(f,a,i,r,c,p,l,m)&&g(),$(f,a,i,r,c,p,u,m)&&g(),G(f,a,i,r,l,u,c,m)&&g(),G(f,a,i,r,l,u,p,m)&&g();for(let e=l;e<u;e++){let t=a.positionAt(e,c,i),n=a.positionAt(e,p,i);f.replace(f.mapping.slice(m).map(t+r),f.mapping.slice(m).map(n+r),new s.Ji(o.rows[e-l],0,0))}g(),f.setSelection(new v(f.doc.resolve(r+a.positionAt(l,c,i)),f.doc.resolve(r+a.positionAt(u-1,p-1,i)))),t(f)}F("row",{useDeprecatedLogic:!0}),F("column",{useDeprecatedLogic:!0}),F("cell",{useDeprecatedLogic:!0});let V=(0,l.K)({ArrowLeft:Y("horiz",-1),ArrowRight:Y("horiz",1),ArrowUp:Y("vert",-1),ArrowDown:Y("vert",1),"Shift-ArrowLeft":q("horiz",-1),"Shift-ArrowRight":q("horiz",1),"Shift-ArrowUp":q("vert",-1),"Shift-ArrowDown":q("vert",1),Backspace:H,"Mod-Backspace":H,Delete:H,"Mod-Delete":H});function W(e,t,r){return!r.eq(e.selection)&&(t&&t(e.tr.setSelection(r).scrollIntoView()),!0)}function Y(e,t){return(r,n,o)=>{if(!o)return!1;let s=r.selection;if(s instanceof v)return W(r,n,i.LN.near(s.$headCell,t));if("horiz"!=e&&!s.empty)return!1;let a=X(o,e,t);if(null==a)return!1;if("horiz"==e)return W(r,n,i.LN.near(r.doc.resolve(s.head+t),t));{let o,s=r.doc.resolve(a),l=b(s,e,t);return o=l?i.LN.near(l,1):t<0?i.LN.near(r.doc.resolve(s.before(-1)),-1):i.LN.near(r.doc.resolve(s.after(-1)),1),W(r,n,o)}}}function q(e,t){return(r,n,o)=>{let i;if(!o)return!1;let s=r.selection;if(s instanceof v)i=s;else{let n=X(o,e,t);if(null==n)return!1;i=new v(r.doc.resolve(n))}let a=b(i.$headCell,e,t);return!!a&&W(r,n,new v(i.$anchorCell,a))}}function K(e,t){let r=u(e.state.doc.resolve(t));return!!r&&(e.dispatch(e.state.tr.setSelection(new v(r))),!0)}function J(e,t,r){if(!f(e.state))return!1;let n=function(e){if(0===e.size)return null;let{content:t,openStart:r,openEnd:n}=e;for(;1==t.childCount&&(r>0&&n>0||"table"==t.child(0).type.spec.tableRole);)r--,n--,t=t.child(0).content;let o=t.child(0),i=o.type.spec.tableRole,a=o.type.schema,l=[];if("row"==i)for(let e=0;e<t.childCount;e++){let o=t.child(e).content,i=e?0:Math.max(0,r-1),c=e<t.childCount-1?0:Math.max(0,n-1);(i||c)&&(o=j(h(a).row,new s.Ji(o,i,c)).content),l.push(o)}else{if("cell"!=i&&"header_cell"!=i)return null;l.push(r||n?j(h(a).row,new s.Ji(t,r,n)).content:t)}return function(e,t){let r=[];for(let e=0;e<t.length;e++){let n=t[e];for(let t=n.childCount-1;t>=0;t--){let{rowspan:o,colspan:i}=n.child(t).attrs;for(let t=e;t<e+o;t++)r[t]=(r[t]||0)+i}}let n=0;for(let e=0;e<r.length;e++)n=Math.max(n,r[e]);for(let o=0;o<r.length;o++)if(o>=t.length&&t.push(s.FK.empty),r[o]<n){let i=h(e).cell.createAndFill(),a=[];for(let e=r[o];e<n;e++)a.push(i);t[o]=t[o].append(s.FK.from(a))}return{height:t.length,width:n,rows:t}}(a,l)}(r),o=e.state.selection;if(o instanceof v){n||(n={width:1,height:1,rows:[s.FK.from(j(h(e.state.schema).cell,r))]});let t=o.$anchorCell.node(-1),i=o.$anchorCell.start(-1),a=d.get(t).rectBetween(o.$anchorCell.pos-i,o.$headCell.pos-i);return n=function({width:e,height:t,rows:r},n,o){if(e!=n){let t=[],o=[];for(let e=0;e<r.length;e++){let i=r[e],a=[];for(let r=t[e]||0,o=0;r<n;o++){let s=i.child(o%i.childCount);r+s.attrs.colspan>n&&(s=s.type.createChecked(y(s.attrs,s.attrs.colspan,r+s.attrs.colspan-n),s.content)),a.push(s),r+=s.attrs.colspan;for(let r=1;r<s.attrs.rowspan;r++)t[e+r]=(t[e+r]||0)+s.attrs.colspan}o.push(s.FK.from(a))}r=o,e=n}if(t!=o){let e=[];for(let n=0,i=0;n<o;n++,i++){let a=[],l=r[i%t];for(let e=0;e<l.childCount;e++){let t=l.child(e);n+t.attrs.rowspan>o&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,o-t.attrs.rowspan)},t.content)),a.push(t)}e.push(s.FK.from(a))}r=e,t=o}return{width:e,height:t,rows:r}}(n,a.right-a.left,a.bottom-a.top),z(e.state,e.dispatch,i,a,n),!0}if(!n)return!1;{let t=m(e.state),r=t.start(-1);return z(e.state,e.dispatch,r,d.get(t.node(-1)).findCell(t.pos-r),n),!0}}function Q(e,t){var r;let n;if(0!=t.button||t.ctrlKey||t.metaKey)return;let o=Z(e,t.target);if(t.shiftKey&&e.state.selection instanceof v)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&o&&null!=(n=u(e.state.selection.$anchor))&&(null==(r=ee(e,t))?void 0:r.pos)!=n.pos)i(n,t),t.preventDefault();else if(!o)return;function i(t,r){let n=ee(e,r),o=null==p.getState(e.state);if(!n||!E(t,n))if(!o)return;else n=t;let i=new v(t,n);if(o||!e.state.selection.eq(i)){let r=e.state.tr.setSelection(i);o&&r.setMeta(p,t.pos),e.dispatch(r)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),null!=p.getState(e.state)&&e.dispatch(e.state.tr.setMeta(p,-1))}function a(r){let n,a=p.getState(e.state);if(null!=a)n=e.state.doc.resolve(a);else if(Z(e,r.target)!=o&&!(n=ee(e,t)))return s();n&&i(n,r)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function X(e,t,r){if(!(e.state.selection instanceof i.U3))return null;let{$head:n}=e.state.selection;for(let o=n.depth-1;o>=0;o--){let i=n.node(o);if((r<0?n.index(o):n.indexAfter(o))!=(r<0?0:i.childCount))break;if("cell"==i.type.spec.tableRole||"header_cell"==i.type.spec.tableRole){let i=n.before(o),s="vert"==t?r>0?"down":"up":r>0?"right":"left";return e.endOfTextblock(s)?i:null}}return null}function Z(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function ee(e,t){let r=e.posAtCoords({left:t.clientX,top:t.clientY});if(!r)return null;let{inside:n,pos:o}=r;return n>=0&&u(e.state.doc.resolve(n))||u(e.state.doc.resolve(o))}var et=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),er(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,er(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function er(e,t,r,n,o,i){let s=0,a=!0,l=t.firstChild,c=e.firstChild;if(c){for(let e=0,r=0;e<c.childCount;e++){let{colspan:d,colwidth:h}=c.child(e).attrs;for(let e=0;e<d;e++,r++){let c=o==r?i:h&&h[e],d=c?c+"px":"";if(s+=c||n,c||(a=!1),l)l.style.width!=d&&(l.style.width=d),l=l.nextSibling;else{let e=document.createElement("col");e.style.width=d,t.appendChild(e)}}}for(;l;){var d;let e=l.nextSibling;null==(d=l.parentNode)||d.removeChild(l),l=e}a?(r.style.width=s+"px",r.style.minWidth=""):(r.style.width="",r.style.minWidth=s+"px")}}let en=new i.hs("tableColumnResizing");function eo({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:r=100,View:n=et,lastColumnResizable:o=!0}={}){let s=new i.k_({key:en,state:{init(e,t){var o;let i=null==(o=s.spec)||null==(o=o.props)?void 0:o.nodeViews,a=h(t.schema).table.name;return n&&i&&(i[a]=(e,t)=>new n(e,r,t)),new ei(-1,!1)},apply:(e,t)=>t.apply(e)},props:{attributes:e=>{let t=en.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,r)=>{!function(e,t,r,n){if(!e.editable)return;let o=en.getState(e.state);if(o&&!o.dragging){let i=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target),s=-1;if(i){let{left:n,right:o}=i.getBoundingClientRect();t.clientX-n<=r?s=es(e,t,"left",r):o-t.clientX<=r&&(s=es(e,t,"right",r))}if(s!=o.activeHandle){if(!n&&-1!==s){let t=e.state.doc.resolve(s),r=t.node(-1),n=d.get(r),o=t.start(-1);if(n.colCount(t.pos-o)+t.nodeAfter.attrs.colspan-1==n.width-1)return}el(e,s)}}}(t,r,e,o)},mouseleave:e=>{!function(e){if(!e.editable)return;let t=en.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&el(e,-1)}(e)},mousedown:(e,n)=>{!function(e,t,r,n){var o;if(!e.editable)return;let i=null!=(o=e.dom.ownerDocument.defaultView)?o:window,s=en.getState(e.state);if(!s||-1==s.activeHandle||s.dragging)return;let a=e.state.doc.nodeAt(s.activeHandle),l=function(e,t,{colspan:r,colwidth:n}){let o=n&&n[n.length-1];if(o)return o;let i=e.domAtPos(t),s=i.node.childNodes[i.offset].offsetWidth,a=r;if(n)for(let e=0;e<r;e++)n[e]&&(s-=n[e],a--);return s/a}(e,s.activeHandle,a.attrs);function c(t){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",h);let n=en.getState(e.state);(null==n?void 0:n.dragging)&&(function(e,t,r){let n=e.state.doc.resolve(t),o=n.node(-1),i=d.get(o),s=n.start(-1),a=i.colCount(n.pos-s)+n.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let e=0;e<i.height;e++){let t=e*i.width+a;if(e&&i.map[t]==i.map[t-i.width])continue;let n=i.map[t],c=o.nodeAt(n).attrs,d=1==c.colspan?0:a-i.colCount(n);if(c.colwidth&&c.colwidth[d]==r)continue;let h=c.colwidth?c.colwidth.slice():Array(c.colspan).fill(0);h[d]=r,l.setNodeMarkup(s+n,null,{...c,colwidth:h})}l.docChanged&&e.dispatch(l)}(e,n.activeHandle,ea(n.dragging,t,r)),e.dispatch(e.state.tr.setMeta(en,{setDragging:null})))}function h(t){if(!t.which)return c(t);let o=en.getState(e.state);if(o&&o.dragging){let i=ea(o.dragging,t,r);ec(e,o.activeHandle,i,n)}}e.dispatch(e.state.tr.setMeta(en,{setDragging:{startX:t.clientX,startWidth:l}})),ec(e,s.activeHandle,l,n),i.addEventListener("mouseup",c),i.addEventListener("mousemove",h),t.preventDefault()}(e,n,t,r)}},decorations:e=>{let t=en.getState(e);if(t&&t.activeHandle>-1)return function(e,t){let r=[],n=e.doc.resolve(t),o=n.node(-1);if(!o)return a.zF.empty;let i=d.get(o),s=n.start(-1),l=i.colCount(n.pos-s)+n.nodeAfter.attrs.colspan-1;for(let t=0;t<i.height;t++){let n=l+t*i.width;if((l==i.width-1||i.map[n]!=i.map[n+1])&&(0==t||i.map[n]!=i.map[n-i.width])){var c;let t=i.map[n],l=s+t+o.nodeAt(t).nodeSize-1,d=document.createElement("div");d.className="column-resize-handle",(null==(c=en.getState(e))?void 0:c.dragging)&&r.push(a.NZ.node(s+t,s+t+o.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),r.push(a.NZ.widget(l,d))}}return a.zF.create(e.doc,r)}(e,t.activeHandle)},nodeViews:{}}});return s}var ei=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){let r=t.getMeta(en);if(r&&null!=r.setHandle)return new e(r.setHandle,!1);if(r&&void 0!==r.setDragging)return new e(this.activeHandle,r.setDragging);if(this.activeHandle>-1&&t.docChanged){let r=t.mapping.map(this.activeHandle,-1);return g(t.doc.resolve(r))||(r=-1),new e(r,this.dragging)}return this}};function es(e,t,r,n){let o=e.posAtCoords({left:t.clientX+("right"==r?-n:n),top:t.clientY});if(!o)return -1;let{pos:i}=o,s=u(e.state.doc.resolve(i));if(!s)return -1;if("right"==r)return s.pos;let a=d.get(s.node(-1)),l=s.start(-1),c=a.map.indexOf(s.pos-l);return c%a.width==0?-1:l+a.map[c-1]}function ea(e,t,r){let n=t.clientX-e.startX;return Math.max(r,e.startWidth+n)}function el(e,t){e.dispatch(e.state.tr.setMeta(en,{setHandle:t}))}function ec(e,t,r,n){let o=e.state.doc.resolve(t),i=o.node(-1),s=o.start(-1),a=d.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,l=e.domAtPos(o.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&er(i,l.firstChild,l,n,a,r)}function ed({allowTableNodeSelection:e=!1}={}){return new i.k_({key:p,state:{init:()=>null,apply(e,t){let r=e.getMeta(p);if(null!=r)return -1==r?null:r;if(null==t||!e.docChanged)return t;let{deleted:n,pos:o}=e.mapping.mapResult(t);return n?null:o}},props:{decorations:A,handleDOMEvents:{mousedown:Q},createSelectionBetween:e=>null!=p.getState(e.state)?e.state.selection:null,handleTripleClick:K,handleKeyDown:V,handlePaste:J},appendTransaction:(t,r,n)=>{let o,s;return function(e,t,r){let n,o,s=(t||e).selection,a=(t||e).doc;if(s instanceof i.nh&&(o=s.node.type.spec.tableRole)){if("cell"==o||"header_cell"==o)n=v.create(a,s.from);else if("row"==o){let e=a.resolve(s.from+1);n=v.rowSelection(e,e)}else if(!r){let e=d.get(s.node),t=s.from+1,r=t+e.map[e.width*e.height-1];n=v.create(a,t+1,r)}}else s instanceof i.U3&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let r=e.pos,n=t.pos,o=e.depth;for(;o>=0&&!(e.after(o+1)<e.end(o));o--,r++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,n--);return r==n&&/row|table/.test(e.node(o).type.spec.tableRole)}(s)?n=i.U3.create(a,s.from):s instanceof i.U3&&function({$from:e,$to:t}){let r,n;for(let t=e.depth;t>0;t--){let n=e.node(t);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}for(let e=t.depth;e>0;e--){let r=t.node(e);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}return r!==n&&0===t.parentOffset}(s)&&(n=i.U3.create(a,s.$from.start(),s.$from.end()));return n&&(t||(t=e.tr)).setSelection(n),t}(n,(s=(e,t)=>{"table"==e.type.spec.tableRole&&(o=function(e,t,r,n){let o,i,s=d.get(t);if(!s.problems)return n;n||(n=e.tr);let a=[];for(let e=0;e<s.height;e++)a.push(0);for(let e=0;e<s.problems.length;e++){let o=s.problems[e];if("collision"==o.type){let e=t.nodeAt(o.pos);if(!e)continue;let i=e.attrs;for(let e=0;e<i.rowspan;e++)a[o.row+e]+=o.n;n.setNodeMarkup(n.mapping.map(r+1+o.pos),null,y(i,i.colspan-o.n,o.n))}else if("missing"==o.type)a[o.row]+=o.n;else if("overlong_rowspan"==o.type){let e=t.nodeAt(o.pos);if(!e)continue;n.setNodeMarkup(n.mapping.map(r+1+o.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-o.n})}else if("colwidth mismatch"==o.type){let e=t.nodeAt(o.pos);if(!e)continue;n.setNodeMarkup(n.mapping.map(r+1+o.pos),null,{...e.attrs,colwidth:o.colwidth})}else if("zero_sized"==o.type){let e=n.mapping.map(r);n.delete(e,e+t.nodeSize)}}for(let e=0;e<a.length;e++)a[e]&&(null==o&&(o=e),i=e);for(let l=0,c=r+1;l<s.height;l++){let r=t.child(l),s=c+r.nodeSize,d=a[l];if(d>0){let t="cell";r.firstChild&&(t=r.firstChild.type.spec.tableRole);let a=[];for(let r=0;r<d;r++){let r=h(e.schema)[t].createAndFill();r&&a.push(r)}let p=(0==l||o==l-1)&&i==l?c+1:s-1;n.insert(n.mapping.map(p),a)}c=s}return n.setMeta(C,{fixTables:!0})}(n,e,t,o))},r?r.doc!=n.doc&&function e(t,r,n,o){let i=t.childCount,s=r.childCount;n:for(let a=0,l=0;a<s;a++){let s=r.child(a);for(let e=l,r=Math.min(i,a+3);e<r;e++)if(t.child(e)==s){l=e+1,n+=s.nodeSize;continue n}o(s,n),l<i&&t.child(l).sameMarkup(s)?e(t.child(l),s,n+1,o):s.nodesBetween(0,s.content.size,o,n+1),n+=s.nodeSize}}(r.doc,n.doc,0,s):n.doc.descendants(s),o),e)}})}},63056:(e,t,r)=>{"use strict";r.d(t,{$u:()=>m,CM:()=>function e(t,r,n){return void 0===n&&(n=!0),t.filter(e=>{var t;return e.parentId===r&&(!n||(null==(t=e.context)?void 0:t.open))}).flatMap(r=>[r,...e(t,r.id,n)])},EW:()=>h,F2:()=>p,Go:()=>y,Jt:()=>A,OS:()=>T,O_:()=>b,RS:()=>c,SE:()=>v,YE:()=>f,cX:()=>a,em:()=>g,gR:()=>d,nd:()=>E,nr:()=>s,tZ:()=>u});var n,o=r(6791),i=r(12115);function s(){return/apple/i.test(navigator.vendor)}function a(){let e;return(null!=(e=navigator.userAgentData)&&e.platform?e.platform:navigator.platform).toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}let l="data-floating-ui-focusable";function c(e){let t=e.activeElement;for(;(null==(r=t)||null==(r=r.shadowRoot)?void 0:r.activeElement)!=null;){var r;t=t.shadowRoot.activeElement}return t}function d(e,t){if(!e||!t)return!1;let r=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(r&&(0,o.Ng)(r)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function h(e){return"composedPath"in e?e.composedPath()[0]:e.target}function p(e,t){return null!=t&&("composedPath"in e?e.composedPath().includes(t):null!=e.target&&t.contains(e.target))}function u(e){return e.matches("html,body")}function f(e){return(null==e?void 0:e.ownerDocument)||document}function m(e){return(0,o.sb)(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function g(e){let t;if(!e||((t=navigator.userAgentData)&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:t,version:r}=e;return t+"/"+r}).join(" "):navigator.userAgent).includes("jsdom/"))return!0;try{return e.matches(":focus-visible")}catch(e){return!0}}function E(e){return e?e.hasAttribute(l)?e:e.querySelector("["+l+"]")||e:null}function b(e){return"nativeEvent"in e}function y(e,t){let r=["mouse","pen"];return t||r.push("",void 0),r.includes(e)}var T="u">typeof document?i.useLayoutEffect:function(){};function v(e){let t=i.useRef(e);return T(()=>{t.current=e}),t}let k={...n||(n=r.t(i,2))}.useInsertionEffect||(e=>e());function A(e){let t=i.useRef(()=>{});return k(()=>{t.current=e}),i.useCallback(function(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];return null==t.current?void 0:t.current(...r)},[])}},63758:(e,t,r)=>{"use strict";r.d(t,{ft:()=>a,Y:()=>i,AV:()=>c,Qu:()=>l,hN:()=>p,hr:()=>h,UH:()=>d,Ny:()=>s,Tx:()=>u,ET:()=>f});let n=Symbol;var o=r(76290);let i=n(),s=n(),a=n(),l=n(),c=n(),d=n(),h=n(),p=n(),u=n(),f=e=>{1===e.length&&e[0]?.constructor===Function&&(e=e[0]());let t=[],r=[],n=0;for(;n<e.length;n++){let r=e[n];if(void 0===r)break;if(r.constructor===String||r.constructor===Number)t.push(r);else if(r.constructor===Object)break}for(n>0&&r.push(t.join(""));n<e.length;n++){let t=e[n];t instanceof Symbol||r.push(t)}return r};o._g()},65512:()=>{},65538:(e,t,r)=>{"use strict";var n=r(12115),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=n.useState,s=n.useEffect,a=n.useLayoutEffect,l=n.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!o(e,r)}catch(e){return!0}}var d="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),n=i({inst:{value:r,getSnapshot:t}}),o=n[0].inst,d=n[1];return a(function(){o.value=r,o.getSnapshot=t,c(o)&&d({inst:o})},[e,r,t]),s(function(){return c(o)&&d({inst:o}),e(function(){c(o)&&d({inst:o})})},[e]),l(r),r};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:d},66965:(e,t,r)=>{"use strict";r.d(t,{S:()=>a});var n=r(76865),o=r(63197),i=r(28215);let s=new n.hs("blocknote-show-selection"),a=(0,i.c)(({editor:e})=>{let t=(0,i.a)({enabledSet:new Set},{onUpdate(){e.transact(e=>e.setMeta(s,{}))}});return{key:"showSelection",store:t,prosemirrorPlugins:[new n.k_({key:s,props:{decorations:e=>{let{doc:r,selection:n}=e;if(0===t.state.enabledSet.size)return o.zF.empty;let i=o.NZ.inline(n.from,n.to,{"data-show-selection":"true"});return o.zF.create(r,[i])}}})],showSelection(e,r){t.setState({enabledSet:new Set(e?[...t.state.enabledSet,r]:[...t.state.enabledSet].filter(e=>e!==r))})}}})},68054:e=>{"use strict";e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!=o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;0!=o--;){var n,o,i,s=i[o];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}},68822:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(90425).A)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},70489:(e,t,r)=>{"use strict";r.d(t,{HR:()=>l,T0:()=>c,nk:()=>a});var n=r(8750),o=r(48273),i=r(14214),s=r(92619).Buffer;let a=o.Bd?e=>{let t="";for(let r=0;r<e.byteLength;r++)t+=n.QV(e[r]);return btoa(t)}:e=>s.from(e.buffer,e.byteOffset,e.byteLength).toString("base64");o.Bd;let l=e=>{let t=new Uint8Array(e.byteLength);return t.set(e),t},c=e=>i.lF(t=>i.IO(t,e))},71319:(e,t,r)=>{"use strict";r.d(t,{VR:()=>m,cm:()=>f,gu:()=>T});var n=r(12115),o=r(47650),i=r(8039),s=r(95155);r(94577);var a=r(82159),l=({contentComponent:e})=>{let t=(0,i.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,s.jsx)(s.Fragment,{children:Object.values(t)})},c=class extends n.Component{constructor(e){var t;super(e),this.editorContentRef=n.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(null==(t=e.editor)?void 0:t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;let t=this.props.editor;if(t&&!t.isDestroyed&&(null==(e=t.view.dom)?void 0:e.parentNode)){let e,r;if(t.contentComponent)return;let n=this.editorContentRef.current;n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n}),e=new Set,r={},t.contentComponent={subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>r,getServerSnapshot:()=>r,setRenderer(t,n){r={...r,[t]:o.createPortal(n.reactElement,n.element,t)},e.forEach(e=>e())},removeRenderer(t){let n={...r};delete n[t],r=n,e.forEach(e=>e())}},this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(e=>e.hasContentComponentInitialized?e:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;let t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!(null==(e=t.view.dom)?void 0:e.parentNode))return;let r=document.createElement("div");r.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:r})}catch{}}}render(){let{editor:e,innerRef:t,...r}=this.props;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{ref:((...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})})(t,this.editorContentRef),...r}),(null==e?void 0:e.contentComponent)&&(0,s.jsx)(l,{contentComponent:e.contentComponent})]})}},d=(0,n.forwardRef)((e,t)=>{let r=n.useMemo(()=>Math.floor(0xffffffff*Math.random()).toString(),[e.editor]);return n.createElement(c,{key:r,innerRef:t,...e})}),h=n.memo(d);"u">typeof window?n.useLayoutEffect:n.useEffect,"u"<typeof window||"u">typeof window&&window.next;var p=(0,n.createContext)({editor:null});p.Consumer;var u=(0,n.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),f=()=>(0,n.useContext)(u),m=n.forwardRef((e,t)=>{let{onDragStart:r}=f(),n=e.as||"div";return(0,s.jsx)(n,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...e.style}})});function g(e){return!!("function"==typeof e&&e.prototype&&e.prototype.isReactComponent)}function E(e){return!!("object"==typeof e&&e.$$typeof&&("Symbol(react.forward_ref)"===e.$$typeof.toString()||"react.forward_ref"===e.$$typeof.description))}var b=class{constructor(e,{editor:t,props:r={},as:n="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(0xffffffff*Math.random()).toString(),this.component=e,this.editor=t,this.props=r,this.element=document.createElement(n),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?(0,o.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,r=this.props,o=this.editor,i=function(){try{if(n.version)return parseInt(n.version.split(".")[0],10)>=19}catch{}return!1}(),a=function(e){if(g(e)||E(e))return!0;if("object"==typeof e&&e.$$typeof&&("Symbol(react.memo)"===e.$$typeof.toString()||"react.memo"===e.$$typeof.description)){let t=e.type;if(t)return g(t)||E(t)}return!1}(t),l={...r};l.ref&&!(i||a)&&delete l.ref,!l.ref&&(i||a)&&(l.ref=e=>{this.ref=e}),this.reactElement=(0,s.jsx)(t,{...l}),null==(e=null==o?void 0:o.contentComponent)||e.setRenderer(this.id,this)}updateProps(e={}){this.destroyed||(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;let t=this.editor;null==(e=null==t?void 0:t.contentComponent)||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};n.createContext({markViewContentRef:()=>{}}),a.Db;var y=class extends a.Yv{constructor(e,t,r){if(super(e,t,r),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const e=this.dom.querySelector("[data-node-view-content]");if(!e)return;e.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(r,n,o){var i;return"storage"===n?null!=(i=e.storage[t.name])?i:{}:Reflect.get(r,n,o)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,n.createRef)()};if(!this.component.displayName){let e;this.component.displayName=(e=this.extension.name).charAt(0).toUpperCase()+e.substring(1)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement&&(e.hasAttribute("data-node-view-wrapper")&&e.removeAttribute("data-node-view-wrapper"),e.appendChild(this.contentDOMElement))}},r=this.component,o=(0,n.memo)(e=>(0,s.jsx)(u.Provider,{value:t,children:(0,n.createElement)(r,e)}));o.displayName="ReactNodeView";let i=this.node.isInline?"span":"div";this.options.as&&(i=this.options.as);let{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new b(o,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!(null==(e=this.renderer.element.firstElementChild)?void 0:e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;let{from:e,to:t}=this.editor.state.selection,r=this.getPos();if("number"==typeof r)if(e<=r&&t>=r+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(e,t,r){let n=e=>{this.renderer.updateProps(e),"function"==typeof this.options.attrs&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if("function"==typeof this.options.update){let o=this.node,i=this.decorations,s=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=r,this.options.update({oldNode:o,oldDecorations:i,newNode:e,newDecorations:t,oldInnerDecorations:s,innerDecorations:r,updateProps:()=>n({node:e,decorations:t,innerDecorations:r,extension:this.extensionWithSyncedStorage})})}return e===this.node&&this.decorations===t&&this.innerDecorations===r||(this.node=e,this.decorations=t,this.innerDecorations=r,n({node:e,decorations:t,innerDecorations:r,extension:this.extensionWithSyncedStorage}),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let e={};if("function"==typeof this.options.attrs){let t=this.editor.extensionManager.attributes,r=(0,a.zU)(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:r})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function T(e,t){return r=>r.editor.contentComponent?new y(e,r,t):{}}var v=(0,n.createContext)({get editor(){throw Error("useTiptap must be used within a <Tiptap> provider")}});function k({editor:e,instance:t,children:r}){let o=null!=e?e:t;if(!o)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,n.useMemo)(()=>({editor:o}),[o]),a=(0,n.useMemo)(()=>({editor:o}),[o]);return(0,s.jsx)(p.Provider,{value:a,children:(0,s.jsx)(v.Provider,{value:i,children:r})})}function A({...e}){let{editor:t}=(0,n.useContext)(v);return(0,s.jsx)(h,{editor:t,...e})}v.displayName="TiptapContext",k.displayName="Tiptap",A.displayName="Tiptap.Content",Object.assign(k,{Content:A})},72140:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(90425).A)("calendar-days",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]])},74102:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(90425).A)("message-square-quote",[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]])},74825:(e,t,r)=>{"use strict";r.d(t,{B:()=>p,s:()=>l});var n=r(91492),o=Object.defineProperty,i=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?o(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r};function s(e){let t=new Set,r=new Set;for(let[n,o]of e.entries())0===o?t.add(n):r.add(n);return{roots:t,nonRoots:r}}function a(e,t,r){return e.has(t)||e.set(t,new Set),e.get(t).add(r),e}function l(e){let t=new Map;for(let r of e)Array.isArray(r.runsBefore)&&r.runsBefore.length>0?r.runsBefore.forEach(e=>{a(t,r.key,e)}):a(t,"default",r.key);let r=function(e){let t=function(e){let t=new Map;for(let[r,n]of e.entries())for(let e of(t.has(r)||t.set(r,0),n)){let r=t.get(e)??0;t.set(e,r+1)}return t}(e),{roots:r,nonRoots:n}=s(t),o=[];for(;r.size;){o.push(r);let n=new Set;for(let o of r){let r=e.get(o);if(r)for(let e of r){let r=t.get(e);if(void 0===r)continue;let o=r-1;t.set(e,o),0===o&&n.add(e)}}r=n}if((n=s(t).nonRoots).size)throw Error(`Cycle(s) detected; toposort only works on acyclic graphs. Cyclic nodes: ${Array.from(n).join(", ")}`);return o}(function(e){let t=new Map;for(let[r,n]of e.entries())for(let e of(t.has(r)||t.set(r,new Set),n))t.has(e)||t.set(e,new Set),t.get(e).add(r);return t}(t)),n=r.findIndex(e=>e.has("default"));return e=>91+(r.findIndex(t=>t.has(e))+n)*10}function c(e){return e&&Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}class d{constructor(e){i(this,"BlockNoteEditor","only for types"),i(this,"Block","only for types"),i(this,"PartialBlock","only for types"),i(this,"inlineContentSpecs"),i(this,"styleSpecs"),i(this,"blockSpecs"),i(this,"blockSchema"),i(this,"inlineContentSchema"),i(this,"styleSchema"),this.opts=e;const{blockSpecs:t,inlineContentSpecs:r,styleSpecs:n,blockSchema:o,inlineContentSchema:s,styleSchema:a}=this.init();this.blockSpecs=t,this.styleSpecs=n,this.styleSchema=a,this.inlineContentSpecs=r,this.blockSchema=o,this.inlineContentSchema=s}init(){let e=l(Object.entries({...this.opts.blockSpecs,...this.opts.inlineContentSpecs,...this.opts.styleSpecs}).map(([e,t])=>{var r;return{key:e,runsBefore:(null==(r=t.implementation)?void 0:r.runsBefore)??[]}})),t=Object.fromEntries(Object.entries(this.opts.blockSpecs).map(([t,r])=>[t,(0,n.ad)(r.config,r.implementation,r.extensions,e(t))])),r=Object.fromEntries(Object.entries(this.opts.inlineContentSpecs).map(([t,r])=>{var n;return"object"!=typeof r.config?[t,r]:[t,{...r,implementation:{...r.implementation,node:null==(n=r.implementation)?void 0:n.node.extend({priority:e(t)})}}]})),o=Object.fromEntries(Object.entries(this.opts.styleSpecs).map(([t,r])=>{var n;return[t,{...r,implementation:{...r.implementation,mark:null==(n=r.implementation)?void 0:n.mark.extend({priority:e(t)})}}]}));return{blockSpecs:t,blockSchema:Object.fromEntries(Object.entries(t).map(([e,t])=>[e,t.config])),inlineContentSpecs:c(r),styleSpecs:c(o),inlineContentSchema:(0,n.af)(r),styleSchema:(0,n.ae)(o)}}extend(e){Object.assign(this.opts.blockSpecs,e.blockSpecs),Object.assign(this.opts.inlineContentSpecs,e.inlineContentSpecs),Object.assign(this.opts.styleSpecs,e.styleSpecs);let{blockSpecs:t,inlineContentSpecs:r,styleSpecs:n,blockSchema:o,inlineContentSchema:i,styleSchema:s}=this.init();return this.blockSpecs=t,this.styleSpecs=n,this.styleSchema=s,this.inlineContentSpecs=r,this.blockSchema=o,this.inlineContentSchema=i,this}}let h=(0,n.ag)(()=>({type:"pageBreak",propSchema:{},content:"none"}));(0,n.ah)(h,{parse(e){if("DIV"===e.tagName&&e.hasAttribute("data-page-break"))return{}},render(){let e=document.createElement("div");return e.setAttribute("data-page-break",""),{dom:e}},toExternalHTML(){let e=document.createElement("div");return e.setAttribute("data-page-break",""),{dom:e}}});class p extends d{static create(e){return new p({blockSpecs:(null==e?void 0:e.blockSpecs)??n.W,inlineContentSpecs:(null==e?void 0:e.inlineContentSpecs)??n.Z,styleSpecs:(null==e?void 0:e.styleSpecs)??n.X})}}},76290:(e,t,r)=>{"use strict";r.d(t,{_g:()=>n});let n=Date.now},76865:(e,t,r)=>{"use strict";r.d(t,{$t:()=>A,LN:()=>s,U3:()=>d,hs:()=>_,i5:()=>f,k_:()=>C,nh:()=>p,yn:()=>a});var n=r(27050),o=r(8242);let i=Object.create(null);class s{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new a(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=n.Ji.empty){let r=t.content.lastChild,o=null;for(let e=0;e<t.openEnd;e++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],d=e.mapping.slice(i);e.replaceRange(d.map(l.pos),d.map(c.pos),a?n.Ji.empty:t),0==a&&E(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,n=this.ranges;for(let o=0;o<n.length;o++){let{$from:i,$to:s}=n[o],a=e.mapping.slice(r),l=a.map(i.pos),c=a.map(s.pos);o?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),E(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let n=e.parent.inlineContent?new d(e):g(e.node(0),e.parent,e.pos,e.index(),t,r);if(n)return n;for(let n=e.depth-1;n>=0;n--){let o=t<0?g(e.node(0),e.node(n),e.before(n+1),e.index(n),t,r):g(e.node(0),e.node(n),e.after(n+1),e.index(n)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new f(e.node(0))}static atStart(e){return g(e,e,0,0,1)||new f(e)}static atEnd(e){return g(e,e,e.content.size,e.childCount,-1)||new f(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let r=i[t.type];if(!r)throw RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in i)throw RangeError("Duplicate use of selection JSON ID "+e);return i[e]=t,t.prototype.jsonID=e,t}getBookmark(){return d.between(this.$anchor,this.$head).getBookmark()}}s.prototype.visible=!0;class a{constructor(e,t){this.$from=e,this.$to=t}}let l=!1;function c(e){l||e.parent.inlineContent||(l=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class d extends s{constructor(e,t=e){c(e),c(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return s.near(r);let n=e.resolve(t.map(this.anchor));return new d(n.parent.inlineContent?n:r,r)}replace(e,t=n.Ji.empty){if(super.replace(e,t),t==n.Ji.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof d&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new h(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new d(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let n=e.resolve(t);return new this(n,r==t?n:e.resolve(r))}static between(e,t,r){let n=e.pos-t.pos;if((!r||n)&&(r=n>=0?1:-1),!t.parent.inlineContent){let e=s.findFrom(t,r,!0)||s.findFrom(t,-r,!0);if(!e)return s.near(t,r);t=e.$head}return e.parent.inlineContent||(0==n?e=t:(e=(s.findFrom(e,-r,!0)||s.findFrom(e,r,!0)).$anchor).pos<t.pos!=n<0&&(e=t)),new d(e,t)}}s.jsonID("text",d);class h{constructor(e,t){this.anchor=e,this.head=t}map(e){return new h(e.map(this.anchor),e.map(this.head))}resolve(e){return d.between(e.resolve(this.anchor),e.resolve(this.head))}}class p extends s{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:n}=t.mapResult(this.anchor),o=e.resolve(n);return r?s.near(o):new p(o)}content(){return new n.Ji(n.FK.from(this.node),0,0)}eq(e){return e instanceof p&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new u(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new p(e.resolve(t.anchor))}static create(e,t){return new p(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}p.prototype.visible=!1,s.jsonID("node",p);class u{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new h(r,r):new u(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&p.isSelectable(r)?new p(t):s.near(t)}}class f extends s{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=n.Ji.empty){if(t==n.Ji.empty){e.delete(0,e.doc.content.size);let t=s.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new f(e)}map(e){return new f(e)}eq(e){return e instanceof f}getBookmark(){return m}}s.jsonID("all",f);let m={map(){return this},resolve:e=>new f(e)};function g(e,t,r,n,o,i=!1){if(t.inlineContent)return d.create(e,r);for(let s=n-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let n=t.child(s);if(n.isAtom){if(!i&&p.isSelectable(n))return p.create(e,r-(o<0?n.nodeSize:0))}else{let t=g(e,n,r+o,o<0?n.childCount:0,o,i);if(t)return t}r+=n.nodeSize*o}return null}function E(e,t,r){let n,i=e.steps.length-1;if(i<t)return;let a=e.steps[i];(a instanceof o.Ln||a instanceof o.Wg)&&(e.mapping.maps[i].forEach((e,t,r,o)=>{null==n&&(n=o)}),e.setSelection(s.near(e.doc.resolve(n),r)))}class b extends o.dL{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return n.CU.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||n.CU.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let n=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(n.text(e),!0):this.deleteSelection();{if(null==r&&(r=t),!e)return this.deleteRange(t,r);let o=this.storedMarks;if(!o){let e=this.doc.resolve(t);o=r==t?e.marks():e.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,n.text(e,o)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(s.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function y(e,t){return t&&e?e.bind(t):e}class T{constructor(e,t,r){this.name=e,this.init=y(t.init,r),this.apply=y(t.apply,r)}}let v=[new T("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new T("selection",{init:(e,t)=>e.selection||s.atStart(t.doc),apply:e=>e.selection}),new T("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,r,n)=>n.selection.$cursor?e.storedMarks:null}),new T("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class k{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=v.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new T(e.key,e.spec.state,e))})}}class A{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let t=this.config.plugins[r];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),n=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=n?n[i].n:0,l=n?n[i].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,r);if(c&&r.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!n){n=[];for(let e=0;e<this.config.plugins.length;e++)n.push(e<i?{state:r,n:t.length}:{state:this,n:0})}t.push(c),r=r.applyInner(c),o=!0}n&&(n[i]={state:r,n:t.length})}}if(!o)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let t=new A(this.config),r=this.config.fields;for(let n=0;n<r.length;n++){let o=r[n];t[o.name]=o.apply(e,this[o.name],this,t)}return t}get tr(){return new b(this)}static create(e){let t=new k(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new A(t);for(let n=0;n<t.fields.length;n++)r[t.fields[n].name]=t.fields[n].init(e,r);return r}reconfigure(e){let t=new k(this.schema,e.plugins),r=t.fields,n=new A(t);for(let t=0;t<r.length;t++){let o=r[t].name;n[o]=this.hasOwnProperty(o)?this[o]:r[t].init(e,n)}return n}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let r in e){if("doc"==r||"selection"==r)throw RangeError("The JSON fields `doc` and `selection` are reserved");let n=e[r],o=n.spec.state;o&&o.toJSON&&(t[r]=o.toJSON.call(n,this[n.key]))}return t}static fromJSON(e,t,r){if(!t)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let o=new k(e.schema,e.plugins),i=new A(o);return o.fields.forEach(o=>{if("doc"==o.name)i.doc=n.bP.fromJSON(e.schema,t.doc);else if("selection"==o.name)i.selection=s.fromJSON(i.doc,t.selection);else if("storedMarks"==o.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let n in r){let s=r[n],a=s.spec.state;if(s.key==o.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(t,n)){i[o.name]=a.fromJSON.call(s,e,t[n],i);return}}i[o.name]=o.init(e,i)}}),i}}class C{constructor(e){this.spec=e,this.props={},e.props&&function e(t,r,n){for(let o in t){let i=t[o];i instanceof Function?i=i.bind(r):"handleDOMEvents"==o&&(i=e(i,r,{})),n[o]=i}return n}(e.props,this,this.props),this.key=e.key?e.key.key:w("plugin")}getState(e){return e[this.key]}}let S=Object.create(null);function w(e){return e in S?e+"$"+ ++S[e]:(S[e]=0,e+"$")}class _{constructor(e="key"){this.key=w(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}},79274:(e,t,r)=>{"use strict";r.d(t,{CW:()=>m,D1:()=>i,D7:()=>l,Dk:()=>n,KD:()=>o,KJ:()=>a,P1:()=>p,V7:()=>d,WD:()=>u,WY:()=>h,vZ:()=>f,wn:()=>s,wt:()=>c});let n=1,o=2,i=4,s=8,a=32,l=64,c=128,d=0x20000000,h=31,p=63,u=127,f=0x7fffffff,m=0xffffffff},80702:(e,t,r)=>{"use strict";r.d(t,{W:()=>s,c:()=>a});var n=r(87443),o=r(19441),i=r(6648);class s{constructor(){this._observers=n.vt()}on(e,t){return n._4(this._observers,e,o.vt).add(t),t}once(e,t){let r=(...n)=>{this.off(e,r),t(...n)};this.on(e,r)}off(e,t){let r=this._observers.get(e);void 0!==r&&(r.delete(t),0===r.size&&this._observers.delete(e))}emit(e,t){return i.HT((this._observers.get(e)||n.vt()).values()).forEach(e=>e(...t))}destroy(){this._observers=n.vt()}}class a{constructor(){this._observers=n.vt()}on(e,t){n._4(this._observers,e,o.vt).add(t)}once(e,t){let r=(...n)=>{this.off(e,r),t(...n)};this.on(e,r)}off(e,t){let r=this._observers.get(e);void 0!==r&&(r.delete(t),0===r.size&&this._observers.delete(e))}emit(e,t){return i.HT((this._observers.get(e)||n.vt()).values()).forEach(e=>e(...t))}destroy(){this._observers=n.vt()}}},82482:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(90425).A)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]])},84206:(e,t,r)=>{"use strict";let n,o,i;r.d(t,{H9:()=>ew,OW:()=>e_});var s=r(87443),a=r(90756),l=r(6648),c=r(1651),d=r(48273),h=r(37766),p=r(33867),u=r(8750),f=r(62261);let m=e=>e.next()>=.5,g=(e,t,r)=>f.RI(e.next()*(r+1-t)+t),E=(e,t,r)=>f.RI(e.next()*(r+1-t)+t),b=e=>(0,u.QV)(E(e,97,122)),y=(e,t)=>t[E(e,0,t.length-1)];var T=r(438);let v=Symbol("0schema");class k{constructor(){this._rerrs=[]}extend(e,t,r,n=null){this._rerrs.push({path:e,expected:t,has:r,message:n})}toString(){let e=[];for(let t=this._rerrs.length-1;t>0;t--){let r=this._rerrs[t];e.push(u.ux(" ",(this._rerrs.length-t)*2)+`${null!=r.path?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join("\n")}}let A=(e,t)=>e===t||null!=e&&null!=t&&e.constructor===t.constructor&&(e[h.B]?h.a(e,t):l.cy(e)?l.Si(e,e=>l.zN(t,t=>A(e,t))):!!a.Gv(e)&&a.Si(e,(e,r)=>A(e,t[r])));class C{static _dilutes=!1;extends(e){let[t,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,t]=[t,r]),A(t,r)}equals(e){return this.constructor===e.constructor&&p.vo(this.shape,e.shape)}[v](){return!0}[h.B](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){c.bD()}get nullable(){return en(this,eb)}get optional(){return new P(this)}cast(e){return ek(e,this),e}expect(e){return ek(e,this),e}}class S extends C{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let r=e?.constructor===this.shape&&(null==this._c||this._c(e));return r||t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),r}}let w=(e,t=null)=>new S(e,t);w(S);class _ extends C{constructor(e){super(),this.shape=e}check(e,t){let r=this.shape(e);return r||t?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),r}}let N=e=>new _(e);w(_);class I extends C{constructor(e){super(),this.shape=e}check(e,t){let r=this.shape.some(t=>t===e);return r||t?.extend(null,this.shape.join(" | "),e.toString()),r}}let x=(...e)=>new I(e),M=w(I),O=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),D=e=>eu.check(e)?[O(e)]:M.check(e)?e.shape.map(e=>e+""):ep.check(e)?["[+-]?\\d+.?\\d*"]:ef.check(e)?[".*"]:eo.check(e)?e.shape.map(D).flat(1):void c.Mq();class R extends C{constructor(e){super(),this.shape=e,this._r=RegExp("^"+e.map(D).map(e=>`(${e.join("|")})`).join("")+"$")}check(e,t){let r=null!=this._r.exec(e);return r||t?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),r}}w(R);let L=Symbol("optional");class P extends C{constructor(e){super(),this.shape=e}check(e,t){let r=void 0===e||this.shape.check(e);return r||t?.extend(null,"undefined (optional)","()"),r}get[L](){return!0}}let B=w(P);class F extends C{check(e,t){return t?.extend(null,"never",typeof e),!1}}new F,w(F);class U extends C{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}static _dilutes=!0;get partial(){return new U(this.shape,!0)}check(e,t){return null==e?(t?.extend(null,"object","null"),!1):a.Si(this.shape,(r,n)=>{let o=this._isPartial&&!a.i5(e,n)||r.check(e[n],t);return o||t?.extend(n.toString(),r.toString(),typeof e[n],"Object property does not match"),o})}}let H=w(U),j=N(e=>null!=e&&(e.constructor===Object||null==e.constructor));class $ extends C{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return null!=e&&a.Si(e,(r,n)=>{let o=this.shape.keys.check(n,t);return o||t?.extend(n+"","Record",typeof e,o?"Key doesn't match schema":"Value doesn't match value"),o&&this.shape.values.check(r,t)})}}let G=(e,t)=>new $(e,t),z=w($);class V extends C{constructor(e){super(),this.shape=e}check(e,t){return null!=e&&a.Si(this.shape,(r,n)=>{let o=r.check(e[n],t);return o||t?.extend(n.toString(),"Tuple",typeof r),o})}}w(V);class W extends C{constructor(e){super(),this.shape=1===e.length?e[0]:new er(e)}check(e,t){let r=l.cy(e)&&l.Si(e,e=>this.shape.check(e));return r||t?.extend(null,"Array",""),r}}let Y=(...e)=>new W(e),q=w(W),K=N(e=>l.cy(e));class J extends C{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){let r=e instanceof this.shape&&(null==this._c||this._c(e));return r||t?.extend(null,this.shape.name,e?.constructor.name),r}}w(J);let Q=((e,t=null)=>new J(e,t))(C);class X extends C{constructor(e){super(),this.len=e.length-1,this.args=((...e)=>new V(e))(...e.slice(-1)),this.res=e[this.len]}check(e,t){let r=e.constructor===Function&&e.length<=this.len;return r||t?.extend(null,"function",typeof e),r}}let Z=w(X),ee=N(e=>"function"==typeof e);class et extends C{constructor(e){super(),this.shape=e}check(e,t){let r=l.Si(this.shape,r=>r.check(e,t));return r||t?.extend(null,"Intersectinon",typeof e),r}}w(et,e=>e.shape.length>0);class er extends C{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){let r=l.zN(this.shape,r=>r.check(e,t));return t?.extend(null,"Union",typeof e),r}}let en=(...e)=>e.findIndex(e=>eo.check(e))>=0?en(...e.map(e=>ev(e)).map(e=>eo.check(e)?e.shape:[e]).flat(1)):1===e.length?e[0]:new er(e),eo=w(er),ei=()=>!0,es=N(ei),ea=w(_,e=>e.shape===ei),el=N(e=>"bigint"==typeof e),ec=N(e=>e===el),ed=N(e=>"symbol"==typeof e);N(e=>e===ed);let eh=N(e=>"number"==typeof e),ep=N(e=>e===eh),eu=N(e=>"string"==typeof e),ef=N(e=>e===eu),em=N(e=>"boolean"==typeof e),eg=N(e=>e===em),eE=x(void 0);w(I,e=>1===e.shape.length&&void 0===e.shape[0]),x(void 0);let eb=x(null),ey=w(I,e=>1===e.shape.length&&null===e.shape[0]);w(Uint8Array),w(S,e=>e.shape===Uint8Array);let eT=en(eh,eu,eb,eE,el,em,ed);n=Y(es),o=G(eu,es),i=en(eh,eu,eb,em,n,o),n.shape=i,o.shape.values=i;let ev=e=>{if(Q.check(e))return e;if(j.check(e)){let t={};for(let r in e)t[r]=ev(e[r]);return new U(t)}if(K.check(e))return en(...e.map(ev));if(eT.check(e))return x(e);if(ee.check(e))return w(e);c.Mq()},ek=d.IA?()=>{}:(e,t)=>{let r=new k;if(!t.check(e,r))throw c.vt(`Expected value to be of type ${t.constructor.name}.
|
|
17
|
-
${r.toString()}`)};class eA{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:ev(e),h:t}),this}else(e){return this.if(es,e)}done(){return(e,t)=>{for(let r=0;r<this.patterns.length;r++){let n=this.patterns[r];if(n.if.check(e))return n.h(e,t)}throw c.vt("Unhandled pattern")}}}let eC=new eA(es).if(ep,(e,t)=>g(t,T.YH,T.Is)).if(ef,(e,t)=>((e,t=0,r=20)=>{let n=E(e,t,r),o="";for(let t=0;t<n;t++)o+=b(e);return o})(t)).if(eg,(e,t)=>m(t)).if(ec,(e,t)=>BigInt(g(t,T.YH,T.Is))).if(eo,(e,t)=>eS(t,y(t,e.shape))).if(H,(e,t)=>{let r={};for(let n in e.shape){let o=e.shape[n];if(B.check(o)){if(m(t))continue;o=o.shape}r[n]=eC(o,t)}return r}).if(q,(e,t)=>{let r=[],n=E(t,0,42);for(let o=0;o<n;o++)r.push(eS(t,e.shape));return r}).if(M,(e,t)=>y(t,e.shape)).if(ey,(e,t)=>null).if(Z,(e,t)=>{let r=eS(t,e.res);return()=>r}).if(ea,(e,t)=>eS(t,y(t,[eh,eu,eb,eE,el,em,Y(eh),G(en("a","b","c"),eh)]))).if(z,(e,t)=>{let r={},n=g(t,0,3);for(let o=0;o<n;o++){let n=eS(t,e.shape.keys),o=eS(t,e.shape.values);r[n]=o}return r}).done(),eS=(e,t)=>eC(ev(t),e),ew="u">typeof document?document:{};N(e=>e.nodeType===eM),"u">typeof DOMParser&&new DOMParser,N(e=>e.nodeType===eN),N(e=>e.nodeType===eI);let e_=e=>s.Tj(e,(e,t)=>`${t}:${e};`).join(""),eN=ew.ELEMENT_NODE,eI=ew.TEXT_NODE;ew.CDATA_SECTION_NODE,ew.COMMENT_NODE;let ex=ew.DOCUMENT_NODE;ew.DOCUMENT_TYPE_NODE;let eM=ew.DOCUMENT_FRAGMENT_NODE;N(e=>e.nodeType===ex)},87443:(e,t,r)=>{"use strict";r.d(t,{C:()=>o,Tj:()=>s,_4:()=>i,bz:()=>a,vt:()=>n});let n=()=>new Map,o=e=>{let t=n();return e.forEach((e,r)=>{t.set(r,e)}),t},i=(e,t,r)=>{let n=e.get(t);return void 0===n&&e.set(t,n=r()),n},s=(e,t)=>{let r=[];for(let[n,o]of e)r.push(t(o,n));return r},a=(e,t)=>{for(let[r,n]of e)if(t(n,r))return!0;return!1}},90756:(e,t,r)=>{"use strict";r.d(t,{Ej:()=>l,Gv:()=>o,HP:()=>s,Im:()=>c,SQ:()=>p,Si:()=>d,i5:()=>h,jJ:()=>a,kp:()=>i,ol:()=>f});var n=r(37766);let o=e=>"object"==typeof e,i=Object.assign,s=Object.keys,a=(e,t)=>{for(let r in e)t(e[r],r)},l=e=>s(e).length,c=e=>{for(let t in e)return!1;return!0},d=(e,t)=>{for(let r in e)if(!t(e[r],r))return!1;return!0},h=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p=(e,t)=>e===t||l(e)===l(t)&&d(e,(e,r)=>(void 0!==e||h(t,r))&&n.a(t[r],e)),u=Object.freeze,f=e=>{for(let t in e){let r=e[t];("object"==typeof r||"function"==typeof r)&&f(e[t])}return u(e)}},91492:(e,t,r)=>{"use strict";r.d(t,{$:()=>tr,E:()=>eZ,I:()=>eJ,O:()=>e7,P:()=>te,W:()=>tu,X:()=>tg,Z:()=>tE,_:()=>tb,a:()=>eX,a0:()=>tn,a1:()=>to,a2:()=>ec,a5:()=>ep,a6:()=>eu,a8:()=>em,a9:()=>tc,aK:()=>B,aL:()=>U,aM:()=>j,aN:()=>$,ab:()=>th,ac:()=>tp,ad:()=>W,ae:()=>Z,af:()=>K,ag:()=>Y,ah:()=>q,ai:()=>er,aj:()=>et,ao:()=>es,ap:()=>G,aq:()=>ej,ar:()=>en,as:()=>F,at:()=>eo,av:()=>ea,aw:()=>el,az:()=>z,b:()=>ev,c:()=>eT,l:()=>eI,m:()=>ex,s:()=>eF,t:()=>eU});var n,o,i=r(62921),s=r(82159),a=r(76865),l=r(63197),c=r(8242),d=r(36158),h=r(8682),p=r(28215),u=r(16121),f=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);let{children:r,...n}=null!=t?t:{};if("svg"===e)throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,n,r]},m=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,g=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,E=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,b=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,y=s.CU.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&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 f("strong",{...(0,s.KV)(this.options.HTMLAttributes,e),children:f("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),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[(0,s.OX)({find:m,type:this.type}),(0,s.OX)({find:E,type:this.type})]},addPasteRules(){return[(0,s.Zc)({find:g,type:this.type}),(0,s.Zc)({find:b,type:this.type})]}}),T=/(^|[^`])`([^`]+)`(?!`)$/,v=/(^|[^`])`([^`]+)`(?!`)/g,k=s.CU.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",(0,s.KV)(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",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[(0,s.OX)({find:T,type:this.type})]},addPasteRules(){return[(0,s.Zc)({find:v,type:this.type})]}}),A=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,C=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,S=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,w=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,_=s.CU.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",(0,s.KV)(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||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[(0,s.OX)({find:A,type:this.type}),(0,s.OX)({find:S,type:this.type})]},addPasteRules(){return[(0,s.Zc)({find:C,type:this.type}),(0,s.Zc)({find:w,type:this.type})]}}),N=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,I=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,x=s.CU.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",(0,s.KV)(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[(0,s.OX)({find:N,type:this.type})]},addPasteRules(){return[(0,s.Zc)({find:I,type:this.type})]}}),M=s.CU.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",(0,s.KV)(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,r){let n=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!n)return;let o=n[2].trim();return{type:"underline",raw:n[0],text:o,tokens:r.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),O=r(27050),D=class e{constructor(e){this.cache=new Map(e)}get(e){return this.cache.get(e)}set(e,t,r){e<0||this.cache.set(e,[t,r])}replace(e,t,r,n){this.remove(e),this.set(t,r,n)}remove(e){this.cache.delete(e)}invalidate(t){let r=new e(this.cache),n=t.mapping;return this.cache.forEach(([e,o],i)=>{if(i<0)return;let s=n.mapResult(i),a=t.doc.nodeAt(s.pos);if(!s.deleted&&(null==a?void 0:a.eq(e))){if(i!==s.pos){let e=o.map(e=>e.map(n,0,0)).filter(e=>null!=e);r.replace(i,s.pos,a,e)}}else r.remove(i)}),r}};function R(e,t,r,n,o){let i=[],s=[];return e.descendants((e,a)=>{if(!e.type.isTextblock)return!0;if(r.includes(e.type.name)){let r=n(e),l=o.get(a);if(l){let[e,t]=l;i.push(...t)}else{let n=t({content:e.textContent,language:r||void 0,pos:a,size:e.nodeSize});n&&Array.isArray(n)?(o.set(a,e,n),i.push(...n)):n instanceof Promise&&(o.remove(a),s.push(n))}}return!1}),[l.zF.create(e,i),s]}var L=Object.defineProperty,P=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?L(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r};function B(e,t="Ctrl"){return"u">typeof navigator&&(/Mac/.test(navigator.platform)||/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent))?e.replace("Mod","⌘"):e.replace("Mod",t)}function F(...e){return[...new Set(e.filter(e=>e).join(" ").split(" "))].join(" ")}let U=()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent),H=(e,t)=>{let r=(0,u.b)(e,t.pmSchema);"blockContainer"===r.type.name&&(r=r.firstChild);let n=t.pmSchema.nodes[r.type.name].spec.toDOM;if(void 0===n)throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");let o=n(r);if("object"!=typeof o||!("dom"in o))throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");return o};function j(e){return"data-"+e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function $(e){let t=e.split("/");return t.length&&""!==t[t.length-1]?t[t.length-1]:e}function G(e){var t;try{let r=(null==(t=new URL(e).pathname.split(".").pop())?void 0:t.toLowerCase())||"";return["mp4","webm","ogg","mov","mkv","flv","avi","wmv","m4v"].includes(r)}catch{return!1}}function z(e,t,r,n){let o=e();if(void 0===o)throw Error("Cannot find node position");let i=r.state.doc.resolve(o).node().attrs.id;if(!i)throw Error("Block doesn't have id");let s=t.getBlock(i);if(s.type!==n)throw Error("Block type does not match");return s}function V(e,t,r,n,o=!1,i){let s=document.createElement("div");if(void 0!==i)for(let[e,t]of Object.entries(i))"class"!==e&&s.setAttribute(e,t);for(let[e,o]of(s.className=F("bn-block-content",(null==i?void 0:i.class)||""),s.setAttribute("data-content-type",t),Object.entries(r)))o!==n[e].default&&s.setAttribute(j(e),o);return o&&s.setAttribute("data-file-block",""),s.appendChild(e.dom),e.contentDOM&&(e.contentDOM.className=F("bn-inline-content",e.contentDOM.className)),{...e,dom:s}}function W(e,t,r,n){var o,i,a,l;let c=t.node||s.bP.create({name:e.type,content:"inline"===e.content?"inline*":"none"===e.content?"":e.content,group:"blockContent",selectable:(null==(o=t.meta)?void 0:o.selectable)??!0,isolating:(null==(i=t.meta)?void 0:i.isolating)??!0,code:(null==(a=t.meta)?void 0:a.code)??!1,defining:(null==(l=t.meta)?void 0:l.defining)??!0,priority:n,addAttributes:()=>{var t;let r;return t=e.propSchema,r={},Object.entries(t).forEach(([e,t])=>{r[e]={default:t.default,keepOnSplit:!0,parseHTML:r=>{let n=r.getAttribute(j(e));if(null===n)return null;if(void 0===t.default&&"boolean"===t.type||void 0!==t.default&&"boolean"==typeof t.default)return"true"===n||"false"!==n&&null;if(void 0===t.default&&"number"===t.type||void 0!==t.default&&"number"==typeof t.default){let e=parseFloat(n);return!Number.isNaN(e)&&Number.isFinite(e)?e:null}return n},renderHTML:r=>r[e]!==t.default?{[j(e)]:r[e]}:{}}}),r},parseHTML:()=>{let r;return r=[{tag:"[data-content-type="+e.type+"]",contentElement:".bn-inline-content"}],t.parse&&r.push({tag:"*",getAttrs(e){var r;if("string"==typeof e)return!1;let n=null==(r=t.parse)?void 0:r.call(t,e);return void 0!==n&&n},preserveWhitespace:!0,getContent:"inline"===e.content||"none"===e.content?(r,n)=>{var o;if(t.parseContent)return t.parseContent({el:r,schema:n});if("inline"===e.content){let e=r.cloneNode(!0);return function(e,t="<br>"){let r=e.querySelectorAll("p");if(r.length>1){let e=r[0];for(let n=1;n<r.length;n++){let o=r[n];e.innerHTML+=t+o.innerHTML,o.remove()}}}(e,null!=(o=t.meta)&&o.code?`
|
|
18
|
-
`:"<br>"),O.S4.fromSchema(n).parse(e,{topNode:n.nodes.paragraph.create(),preserveWhitespace:!0}).content}return O.FK.empty}:void 0}),r},renderHTML({HTMLAttributes:r}){var n;let o=document.createElement("div");return V({dom:o,contentDOM:"inline"===e.content?o:void 0},e.type,{},e.propSchema,(null==(n=t.meta)?void 0:n.fileBlockAccept)!==void 0,r)},addNodeView(){return r=>{var n,o,i;let s=this.options.editor,a=z(r.getPos,s,this.editor,e.type),l=(null==(n=this.options.domAttributes)?void 0:n.blockContent)||{},c=t.render.call({blockContentDOMAttributes:l,props:r,renderType:"nodeView"},a,s);return(null==(o=t.meta)?void 0:o.selectable)===!1&&(i=this.editor,c.stopEvent=e=>("mousedown"===e.type&&setTimeout(()=>{i.view.dom.blur()},10),!0)),c}}});if(c.name!==e.type)throw Error("Node name does not match block type. This is a bug in BlockNote.");return{config:e,implementation:{...t,node:c,render(e,r){var n;let o=(null==(n=c.options.domAttributes)?void 0:n.blockContent)||{};return t.render.call({blockContentDOMAttributes:o,props:void 0,renderType:"dom"},e,r)},toExternalHTML:(e,r,n)=>{var o,i;let s=(null==(o=c.options.domAttributes)?void 0:o.blockContent)||{};return(null==(i=t.toExternalHTML)?void 0:i.call({blockContentDOMAttributes:s},e,r,n))??t.render.call({blockContentDOMAttributes:s,renderType:"dom",props:void 0},e,r)}},extensions:r}}function Y(e){return e}function q(e,t,r){return (n={})=>{let o="function"==typeof e?e(n):e,i="function"==typeof t?t(n):t,s=r?"function"==typeof r?r(n):r:void 0;return{config:o,implementation:{...i,toExternalHTML(e,t,r){var n,s;let a=null==(n=i.toExternalHTML)?void 0:n.call({blockContentDOMAttributes:this.blockContentDOMAttributes},e,t,r);if(void 0!==a)return V(a,e.type,e.props,o.propSchema,(null==(s=i.meta)?void 0:s.fileBlockAccept)!==void 0)},render(e,t){var r;return V(i.render.call({blockContentDOMAttributes:this.blockContentDOMAttributes,renderType:this.renderType,props:this.props},e,t),e.type,e.props,o.propSchema,(null==(r=i.meta)?void 0:r.fileBlockAccept)!==void 0,this.blockContentDOMAttributes)}},extensions:s}}}function K(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.config]))}function J(e,t,r,n){return e.dom.setAttribute("data-style-type",t),"string"===n&&e.dom.setAttribute("data-value",r),e.contentDOM&&e.contentDOM.setAttribute("data-editable",""),e}function Q(e,t){return{config:e,implementation:t}}function X(e,t){return Q({type:e.name,propSchema:t},{mark:e,render(t,r){let n=r.pmSchema.marks[e.name].spec.toDOM;if(void 0===n)throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");let o=r.pmSchema.mark(e.name,{stringValue:t}),i=O.ZF.renderSpec(document,n(o,!0));if("object"!=typeof i||!("dom"in i))throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");return i},toExternalHTML(t,r){let n=r.pmSchema.marks[e.name].spec.toDOM;if(void 0===n)throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");let o=r.pmSchema.mark(e.name,{stringValue:t}),i=O.ZF.renderSpec(document,n(o,!0));if("object"!=typeof i||!("dom"in i))throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");return i}})}function Z(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.config]))}function ee(e,t){let r=s.CU.create({name:e.type,addAttributes:()=>"boolean"===e.propSchema?{}:{stringValue:{default:void 0,keepOnSplit:!0,parseHTML:e=>e.getAttribute("data-value"),renderHTML:e=>void 0!==e.stringValue?{"data-value":e.stringValue}:{}}},parseHTML:()=>{var r;let n;return r=t.parse,n=[{tag:`[data-style-type="${e.type}"]`,contentElement:e=>e.matches("[data-editable]")?e:e.querySelector("[data-editable]")||e}],r&&n.push({tag:"*",consuming:!1,getAttrs(e){if("string"==typeof e)return!1;let t=null==r?void 0:r(e);return void 0!==t&&{stringValue:t}}}),n},renderHTML:({mark:r})=>J((t.toExternalHTML||t.render)(r.attrs.stringValue),e.type,r.attrs.stringValue,e.propSchema),addMarkView:()=>({mark:r})=>J(t.render(r.attrs.stringValue),e.type,r.attrs.stringValue,e.propSchema)});return Q(e,{...t,mark:r,render:r=>J(t.render(r),e.type,r,e.propSchema),toExternalHTML:r=>J((t.toExternalHTML||t.render)(r),e.type,r,e.propSchema)})}function et(e,t){let r,n;if(t.firstChild.descendants((t,o)=>!r&&(!er(t)||t.attrs.id!==e||(r=t,n=o+1,!1))),void 0!==r&&void 0!==n)return{node:r,posBeforeNode:n}}function er(e){return e.type.isInGroup("bnBlock")}let en=(e,t)=>({tr:r,dispatch:n})=>(n&&eo(r,e,t),!0);function eo(e,t,r,n,o){let s=(0,u.v)(e.doc.resolve(t)),l=null;"table"===s.blockNoteType&&(l=function(e){let t="selection"in e?e.selection:null;if(!(t instanceof a.U3))return null;let r=e.doc.resolve(t.head),n=-1,o=-1;for(let e=r.depth;e>=0;e--){let t=r.node(e).type.name;if(n<0&&("tableCell"===t||"tableHeader"===t)&&(n=e),"table"===t){o=e;break}}if(n<0||o<0)return null;let s=r.before(n),l=r.before(o),c=e.doc.nodeAt(l);if(!c||"table"!==c.type.name)return null;let d=i.J3.get(c),h=s-(l+1),p=d.map.indexOf(h);return p<0?null:{row:Math.floor(p/d.width),col:p%d.width,offset:Math.max(0,t.head-(s+1+1))}}(e));let c=(0,u.g)(e);if(void 0!==n&&void 0!==o&&n>o)throw Error("Invalid replaceFromPos or replaceToPos");let d=c.nodes[s.blockNoteType],h=c.nodes[r.type||s.blockNoteType],p=h.isInGroup("bnBlock")?h:c.nodes.blockContainer;if(s.isBlockContainer&&h.isInGroup("blockContent")){let t=void 0!==n&&n>s.blockContent.beforePos&&n<s.blockContent.afterPos?n-s.blockContent.beforePos-1:void 0,i=void 0!==o&&o>s.blockContent.beforePos&&o<s.blockContent.afterPos?o-s.blockContent.beforePos-1:void 0;ei(r,e,s),function(e,t,r,n,o,i,s){let a=(0,u.g)(t),l="keep";if(e.content)if("string"==typeof e.content)l=(0,u.i)([e.content],a,n.name);else if(Array.isArray(e.content))l=(0,u.i)(e.content,a,n.name);else if("tableContent"===e.content.type)l=(0,u.t)(e.content,a);else throw new u.U(e.content.type);else""===r.spec.content||n.spec.content!==r.spec.content&&(l=[]);if("keep"===l)t.setNodeMarkup(o.blockContent.beforePos,n,{...o.blockContent.node.attrs,...e.props});else if(void 0!==i||void 0!==s){t.setNodeMarkup(o.blockContent.beforePos,n,{...o.blockContent.node.attrs,...e.props});let r=o.blockContent.beforePos+1+(i??0),a=o.blockContent.beforePos+1+(s??o.blockContent.node.content.size),c=t.doc.resolve(o.blockContent.beforePos).depth,d=t.doc.resolve(r).depth,h=t.doc.resolve(a).depth;t.replace(r,a,new O.Ji(O.FK.from(l),d-c-1,h-c-1))}else t.replaceWith(o.blockContent.beforePos,o.blockContent.afterPos,n.createChecked({...o.blockContent.node.attrs,...e.props},l))}(r,e,d,h,s,t,i)}else if(!s.isBlockContainer&&h.isInGroup("bnBlock"))ei(r,e,s);else{let t=(0,u.a)(s.bnBlock.node,c);e.replaceWith(s.bnBlock.beforePos,s.bnBlock.afterPos,(0,u.b)({children:t.children,...r},c));return}e.setNodeMarkup(s.bnBlock.beforePos,p,{...s.bnBlock.node.attrs,...r.props}),l&&function(e,t,r){var n;if("table"!==t.blockNoteType)return;let o=-1;if(t.isBlockContainer)o=e.mapping.map(t.blockContent.beforePos);else{let r=e.mapping.map(t.bnBlock.beforePos),i=r+((null==(n=e.doc.nodeAt(r))?void 0:n.nodeSize)||0);e.doc.nodesBetween(r,i,(e,t)=>"table"!==e.type.name||(o=t,!1))}let s=o>=0?e.doc.nodeAt(o):null;if(!s||"table"!==s.type.name)return;let l=i.J3.get(s),c=Math.max(0,Math.min(r.row,l.height-1)),d=Math.max(0,Math.min(r.col,l.width-1)),h=c*l.width+d,p=l.map[h];if(null==p)return;let u=o+1+p+1,f=e.doc.nodeAt(u),m=u+1,g=f?f.content.size:0,E=m+Math.max(0,Math.min(r.offset,g));"selection"in e&&e.setSelection(a.U3.create(e.doc,E))}(e,s,l)}function ei(e,t,r){let n=(0,u.g)(t);if(void 0!==e.children&&e.children.length>0){let o=e.children.map(e=>(0,u.b)(e,n));if(r.childContainer)t.step(new c.Ln(r.childContainer.beforePos+1,r.childContainer.afterPos-1,new O.Ji(O.FK.from(o),0,0)));else{if(!r.isBlockContainer)throw Error("impossible");t.insert(r.blockContent.afterPos,n.nodes.blockGroup.createChecked({},o))}}}function es(e,t,r,n,o){let i="string"==typeof t?t:t.id,s=et(i,e.doc);if(!s)throw Error(`Block with ID ${i} not found`);eo(e,s.posBeforeNode,r,n,o);let a=e.doc.resolve(s.posBeforeNode+1).node(),l=(0,u.g)(e);return(0,u.a)(a,l)}let ea={gray:{text:"#9b9a97",background:"#ebeced"},brown:{text:"#64473a",background:"#e9e5e3"},red:{text:"#e03e3e",background:"#fbe4e4"},orange:{text:"#d9730d",background:"#f6e9d9"},yellow:{text:"#dfab01",background:"#fbf3db"},green:{text:"#4d6461",background:"#ddedea"},blue:{text:"#0b6e99",background:"#ddebf1"},purple:{text:"#6940a5",background:"#eae4f2"},pink:{text:"#ad1a72",background:"#f4dfeb"}},el={gray:{text:"#bebdb8",background:"#9b9a97"},brown:{text:"#8e6552",background:"#64473a"},red:{text:"#ec4040",background:"#be3434"},orange:{text:"#e3790d",background:"#b7600a"},yellow:{text:"#dfab01",background:"#b58b00"},green:{text:"#6b8b87",background:"#4d6461"},blue:{text:"#0e87bc",background:"#0b6e99"},purple:{text:"#8552d7",background:"#6940a5"},pink:{text:"#da208f",background:"#ad1a72"}},ec={backgroundColor:{default:"default"},textColor:{default:"default"},textAlignment:{default:"left",values:["left","center","right","justify"]}},ed=e=>{let t={};return e.hasAttribute("data-background-color")?t.backgroundColor=e.getAttribute("data-background-color"):e.style.backgroundColor&&(t.backgroundColor=e.style.backgroundColor),e.hasAttribute("data-text-color")?t.textColor=e.getAttribute("data-text-color"):e.style.color&&(t.textColor=e.style.color),t.textAlignment=ec.textAlignment.values.includes(e.style.textAlign)?e.style.textAlign:void 0,t},eh=(e,t)=>{e.backgroundColor&&e.backgroundColor!==ec.backgroundColor.default&&(t.style.backgroundColor=e.backgroundColor in ea?ea[e.backgroundColor].background:e.backgroundColor),e.textColor&&e.textColor!==ec.textColor.default&&(t.style.color=e.textColor in ea?ea[e.textColor].text:e.textColor),e.textAlignment&&e.textAlignment!==ec.textAlignment.default&&(t.style.textAlign=e.textAlignment)},ep=(e="backgroundColor")=>({default:ec.backgroundColor.default,parseHTML:e=>e.hasAttribute("data-background-color")?e.getAttribute("data-background-color"):e.style.backgroundColor?e.style.backgroundColor:ec.backgroundColor.default,renderHTML:t=>t[e]===ec.backgroundColor.default?{}:{"data-background-color":t[e]}}),eu=(e="textColor")=>({default:ec.textColor.default,parseHTML:e=>e.hasAttribute("data-text-color")?e.getAttribute("data-text-color"):e.style.color?e.style.color:ec.textColor.default,renderHTML:t=>t[e]===ec.textColor.default?{}:{"data-text-color":t[e]}}),ef=(e,t)=>{let r=e.querySelector(t);if(!r)return;let n=e.querySelector("figcaption");return{targetElement:r,caption:(null==n?void 0:n.textContent)??void 0}},em=(0,p.c)(({editor:e})=>{let t=(0,p.a)(void 0);function r(){t.setState(void 0)}return{key:"filePanel",store:t,mount({signal:t}){let n=e.onChange(r,!1),o=e.onSelectionChange(r,!1);t.addEventListener("abort",()=>{n(),o()})},closeMenu:r,showMenu(e){t.setState(e)}}}),eg=(e,t,r,n)=>{let o=document.createElement("div");if(o.className="bn-file-block-content-wrapper",""===e.props.url){let r,i,s,a,l,c=((r=document.createElement("div")).className="bn-add-file-button",(i=document.createElement("div")).className="bn-add-file-button-icon",n?i.appendChild(n):i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>',r.appendChild(i),(s=document.createElement("p")).className="bn-add-file-button-text",s.innerHTML=e.type in t.dictionary.file_blocks.add_button_text?t.dictionary.file_blocks.add_button_text[e.type]:t.dictionary.file_blocks.add_button_text.file,r.appendChild(s),a=e=>{e.preventDefault(),e.stopPropagation()},l=()=>{var r;t.isEditable&&(null==(r=t.getExtension(em))||r.showMenu(e.id))},r.addEventListener("mousedown",a,!0),r.addEventListener("click",l,!0),{dom:r,destroy:()=>{r.removeEventListener("mousedown",a,!0),r.removeEventListener("click",l,!0)}});o.appendChild(c.dom);let d=t.onUploadStart(t=>{if(t===e.id){o.removeChild(c.dom);let e=document.createElement("div");e.className="bn-file-loading-preview",e.textContent="Loading...",o.appendChild(e)}});return{dom:o,destroy:()=>{d(),c.destroy()}}}let i={dom:o};if(!1!==e.props.showPreview&&r)o.appendChild(r.dom);else{let t,r,n,s=((t=document.createElement("div")).className="bn-file-name-with-icon",(r=document.createElement("div")).className="bn-file-icon",r.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>',t.appendChild(r),(n=document.createElement("p")).className="bn-file-name",n.textContent=e.props.name,t.appendChild(n),{dom:t});o.appendChild(s.dom),i.destroy=()=>{var e;null==(e=s.destroy)||e.call(s)}}if(e.props.caption){let t=document.createElement("p");t.className="bn-file-caption",t.textContent=e.props.caption,o.appendChild(t)}return i},eE=(e,t)=>{let r=document.createElement("figure"),n=document.createElement("figcaption");return n.textContent=t,r.appendChild(e),r.appendChild(n),{dom:r}},eb=(e,t)=>{let r=document.createElement("div"),n=document.createElement("p");return n.textContent=t,r.appendChild(e),r.appendChild(n),{dom:r}},ey=e=>({url:e.src||void 0}),eT=e=>({type:"audio",propSchema:{backgroundColor:ec.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0}},content:"none"}),ev=(e={})=>e=>{if("AUDIO"===e.tagName){if(e.closest("figure"))return;let{backgroundColor:t}=ed(e);return{...ey(e),backgroundColor:t}}if("FIGURE"===e.tagName){let t=ef(e,"audio");if(!t)return;let{targetElement:r,caption:n}=t,{backgroundColor:o}=ed(e);return{...ey(r),backgroundColor:o,caption:n}}},ek=q(eT,e=>({meta:{fileBlockAccept:["audio/*"]},parse:ev(e),render:((e={})=>(t,r)=>{let n=document.createElement("div");n.innerHTML=e.icon??'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>';let o=document.createElement("audio");return o.className="bn-audio",r.resolveFileUrl?r.resolveFileUrl(t.props.url).then(e=>{o.src=e}):o.src=t.props.url,o.controls=!0,o.contentEditable="false",o.draggable=!1,eg(t,r,{dom:o},n.firstElementChild)})(e),toExternalHTML:((e={})=>(e,t)=>{let r;if(!e.props.url){let e=document.createElement("p");return e.textContent="Add audio",{dom:e}}return e.props.showPreview?(r=document.createElement("audio")).src=e.props.url:((r=document.createElement("a")).href=e.props.url,r.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?eE(r,e.props.caption):eb(r,e.props.caption):{dom:r}})(e),runsBefore:["file"]})),eA=Symbol.for("blocknote.shikiParser"),eC=Symbol.for("blocknote.shikiHighlighterPromise"),eS=q(({defaultLanguage:e="text"})=>({type:"codeBlock",propSchema:{language:{default:e}},content:"inline"}),e=>({meta:{code:!0,defining:!0,isolating:!1},parse:e=>{var t,r;if("PRE"!==e.tagName||1!==e.childElementCount||(null==(t=e.firstElementChild)?void 0:t.tagName)!=="CODE")return;let n=e.firstElementChild;return{language:n.getAttribute("data-language")||(null==(r=n.className.split(" ").find(e=>e.includes("language-")))?void 0:r.replace("language-",""))}},parseContent:({el:e,schema:t})=>{let r=O.S4.fromSchema(t),n=e.firstElementChild;return r.parse(n,{preserveWhitespace:"full",topNode:t.nodes.codeBlock.create()}).content},render(t,r){let n,o=document.createDocumentFragment(),i=document.createElement("pre"),s=document.createElement("code");if(i.appendChild(s),e.supportedLanguages){let i=document.createElement("select");if(Object.entries(e.supportedLanguages??{}).forEach(([e,{name:t}])=>{let r=document.createElement("option");r.value=e,r.text=t,i.appendChild(r)}),i.value=t.props.language||e.defaultLanguage||"text",r.isEditable){let e=e=>{let n=e.target.value;r.updateBlock(t.id,{props:{language:n}})};i.addEventListener("change",e),n=()=>i.removeEventListener("change",e)}else i.disabled=!0;let s=document.createElement("div");s.contentEditable="false",s.appendChild(i),o.appendChild(s)}return o.appendChild(i),{dom:o,contentDOM:s,destroy:()=>{null==n||n()}}},toExternalHTML(e){let t=document.createElement("pre"),r=document.createElement("code");return r.className=`language-${e.props.language}`,r.dataset.language=e.props.language,t.appendChild(r),{dom:t,contentDOM:r}}}),e=>{let t,r,n;return[(0,p.c)({key:"code-block-highlighter",prosemirrorPlugins:[(n=globalThis,function({parser:e,nodeTypes:t=["code_block","codeBlock"],languageExtractor:r=e=>e.attrs.language}){let n=new a.hs("prosemirror-highlight");return new a.k_({key:n,state:{init(n,o){let i=new D,[s,a]=R(o.doc,e,t,r,i);return{cache:i,decorations:s,promises:a}},apply:(n,o)=>{let i=o.cache.invalidate(n),s=!!n.getMeta("prosemirror-highlight-refresh");if(!n.docChanged&&!s)return{cache:i,decorations:o.decorations.map(n.mapping,n.doc),promises:o.promises};let[a,l]=R(n.doc,e,t,r,i);return{cache:i,decorations:a,promises:l}}},view:e=>{let t=new Set,r=()=>{if(t.size>0)return;let r=e.state.tr.setMeta("prosemirror-highlight-refresh",!0);e.dispatch(r)},o=()=>{var o;let i=n.getState(e.state);for(let e of null!=(o=null==i?void 0:i.promises)?o:[])t.add(e),e.then(()=>{t.delete(e),r()}).catch(()=>{t.delete(e)})};return o(),{update:()=>{o()}}},props:{decorations(e){var t;return null==(t=this.getState(e))?void 0:t.decorations}}})}({parser:o=>{var i;if(!e.createHighlighter)return[];if(!t)return n[eC]=n[eC]||e.createHighlighter(),n[eC].then(e=>{t=e});let s=ew(e,o.language);return s&&"text"!==s&&"none"!==s&&"plaintext"!==s&&"txt"!==s?t.getLoadedLanguages().includes(s)?(r||(r=n[eA]||(i=t,function({content:e,language:t,pos:r,size:n}){var o,s;let a=[],{tokens:c,fg:d,bg:h,rootStyle:p}=i.codeToTokens(e,{lang:t,...{theme:i.getLoadedThemes()[0]}}),u=p||(d&&h?`--prosemirror-highlight:${d};--prosemirror-highlight-bg:${h}`:"");if(u){let e=l.NZ.node(r,r+n,{style:u});a.push(e)}let f=r+1;for(let e of c){for(let t of e){let e=f+t.content.length,r=l.NZ.inline(f,e,{style:"string"==typeof(s=null!=(o=t.htmlStyle)?o:`color: ${t.color}`)?s:Object.entries(s).map(([e,t])=>`${e}:${t}`).join(";"),class:"shiki"});a.push(r),f=e}f+=1}return a}),n[eA]=r),r(o)):t.loadLanguage(s):[]},languageExtractor:e=>e.attrs.language,nodeTypes:["codeBlock"]}))]}),(0,p.c)({key:"code-block-keyboard-shortcuts",keyboardShortcuts:{Delete:({editor:e})=>e.transact(t=>{let{block:r}=e.getTextCursorPosition();if("codeBlock"!==r.type)return!1;let{$from:n}=t.selection;return!n.parent.textContent&&(e.removeBlocks([r]),!0)}),Tab:({editor:t})=>!1!==e.indentLineWithTab&&t.transact(e=>{let{block:r}=t.getTextCursorPosition();return"codeBlock"===r.type&&(e.insertText(" "),!0)}),Enter:({editor:e})=>e.transact(t=>{let{block:r,nextBlock:n}=e.getTextCursorPosition();if("codeBlock"!==r.type)return!1;let{$from:o}=t.selection,i=o.parentOffset===o.parent.nodeSize-2,s=o.parent.textContent.endsWith(`
|
|
17
|
+
${r.toString()}`)};class eA{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:ev(e),h:t}),this}else(e){return this.if(es,e)}done(){return(e,t)=>{for(let r=0;r<this.patterns.length;r++){let n=this.patterns[r];if(n.if.check(e))return n.h(e,t)}throw c.vt("Unhandled pattern")}}}let eC=new eA(es).if(ep,(e,t)=>g(t,T.YH,T.Is)).if(ef,(e,t)=>((e,t=0,r=20)=>{let n=E(e,t,r),o="";for(let t=0;t<n;t++)o+=b(e);return o})(t)).if(eg,(e,t)=>m(t)).if(ec,(e,t)=>BigInt(g(t,T.YH,T.Is))).if(eo,(e,t)=>eS(t,y(t,e.shape))).if(H,(e,t)=>{let r={};for(let n in e.shape){let o=e.shape[n];if(B.check(o)){if(m(t))continue;o=o.shape}r[n]=eC(o,t)}return r}).if(q,(e,t)=>{let r=[],n=E(t,0,42);for(let o=0;o<n;o++)r.push(eS(t,e.shape));return r}).if(M,(e,t)=>y(t,e.shape)).if(ey,(e,t)=>null).if(Z,(e,t)=>{let r=eS(t,e.res);return()=>r}).if(ea,(e,t)=>eS(t,y(t,[eh,eu,eb,eE,el,em,Y(eh),G(en("a","b","c"),eh)]))).if(z,(e,t)=>{let r={},n=g(t,0,3);for(let o=0;o<n;o++){let n=eS(t,e.shape.keys),o=eS(t,e.shape.values);r[n]=o}return r}).done(),eS=(e,t)=>eC(ev(t),e),ew="u">typeof document?document:{};N(e=>e.nodeType===eM),"u">typeof DOMParser&&new DOMParser,N(e=>e.nodeType===eN),N(e=>e.nodeType===eI);let e_=e=>s.Tj(e,(e,t)=>`${t}:${e};`).join(""),eN=ew.ELEMENT_NODE,eI=ew.TEXT_NODE;ew.CDATA_SECTION_NODE,ew.COMMENT_NODE;let ex=ew.DOCUMENT_NODE;ew.DOCUMENT_TYPE_NODE;let eM=ew.DOCUMENT_FRAGMENT_NODE;N(e=>e.nodeType===ex)},87443:(e,t,r)=>{"use strict";r.d(t,{C:()=>o,Tj:()=>s,_4:()=>i,bz:()=>a,vt:()=>n});let n=()=>new Map,o=e=>{let t=n();return e.forEach((e,r)=>{t.set(r,e)}),t},i=(e,t,r)=>{let n=e.get(t);return void 0===n&&e.set(t,n=r()),n},s=(e,t)=>{let r=[];for(let[n,o]of e)r.push(t(o,n));return r},a=(e,t)=>{for(let[r,n]of e)if(t(n,r))return!0;return!1}},90756:(e,t,r)=>{"use strict";r.d(t,{Ej:()=>l,Gv:()=>o,HP:()=>s,Im:()=>c,SQ:()=>p,Si:()=>d,i5:()=>h,jJ:()=>a,kp:()=>i,ol:()=>f});var n=r(37766);let o=e=>"object"==typeof e,i=Object.assign,s=Object.keys,a=(e,t)=>{for(let r in e)t(e[r],r)},l=e=>s(e).length,c=e=>{for(let t in e)return!1;return!0},d=(e,t)=>{for(let r in e)if(!t(e[r],r))return!1;return!0},h=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p=(e,t)=>e===t||l(e)===l(t)&&d(e,(e,r)=>(void 0!==e||h(t,r))&&n.a(t[r],e)),u=Object.freeze,f=e=>{for(let t in e){let r=e[t];("object"==typeof r||"function"==typeof r)&&f(e[t])}return u(e)}},91492:(e,t,r)=>{"use strict";r.d(t,{$:()=>tr,E:()=>eZ,I:()=>eJ,O:()=>e7,P:()=>te,W:()=>tu,X:()=>tg,Z:()=>tE,_:()=>tb,a:()=>eX,a0:()=>tn,a1:()=>to,a2:()=>ec,a5:()=>ep,a6:()=>eu,a8:()=>em,a9:()=>tc,aK:()=>B,aL:()=>U,aM:()=>j,aN:()=>$,ab:()=>th,ac:()=>tp,ad:()=>W,ae:()=>Z,af:()=>K,ag:()=>Y,ah:()=>q,ai:()=>er,aj:()=>et,ao:()=>es,ap:()=>G,aq:()=>ej,ar:()=>en,as:()=>F,at:()=>eo,av:()=>ea,aw:()=>el,az:()=>z,b:()=>ev,c:()=>eT,l:()=>eI,m:()=>ex,s:()=>eF,t:()=>eU});var n,o,i=r(62921),s=r(82159),a=r(76865),l=r(63197),c=r(8242),d=r(36158),h=r(8682),p=r(28215),u=r(16121),f=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);let{children:r,...n}=null!=t?t:{};if("svg"===e)throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,n,r]},m=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,g=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,E=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,b=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,y=s.CU.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&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 f("strong",{...(0,s.KV)(this.options.HTMLAttributes,e),children:f("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),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[(0,s.OX)({find:m,type:this.type}),(0,s.OX)({find:E,type:this.type})]},addPasteRules(){return[(0,s.Zc)({find:g,type:this.type}),(0,s.Zc)({find:b,type:this.type})]}}),T=/(^|[^`])`([^`]+)`(?!`)$/,v=/(^|[^`])`([^`]+)`(?!`)/g,k=s.CU.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",(0,s.KV)(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",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[(0,s.OX)({find:T,type:this.type})]},addPasteRules(){return[(0,s.Zc)({find:v,type:this.type})]}}),A=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,C=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,S=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,w=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,_=s.CU.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",(0,s.KV)(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||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[(0,s.OX)({find:A,type:this.type}),(0,s.OX)({find:S,type:this.type})]},addPasteRules(){return[(0,s.Zc)({find:C,type:this.type}),(0,s.Zc)({find:w,type:this.type})]}}),N=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,I=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,x=s.CU.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",(0,s.KV)(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[(0,s.OX)({find:N,type:this.type})]},addPasteRules(){return[(0,s.Zc)({find:I,type:this.type})]}}),M=s.CU.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",(0,s.KV)(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown:(e,t)=>`++${t.renderChildren(e)}++`,markdownTokenizer:{name:"underline",level:"inline",start:e=>e.indexOf("++"),tokenize(e,t,r){let n=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!n)return;let o=n[2].trim();return{type:"underline",raw:n[0],text:o,tokens:r.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),O=r(27050),D=class e{constructor(e){this.cache=new Map(e)}get(e){return this.cache.get(e)}set(e,t,r){e<0||this.cache.set(e,[t,r])}replace(e,t,r,n){this.remove(e),this.set(t,r,n)}remove(e){this.cache.delete(e)}invalidate(t){let r=new e(this.cache),n=t.mapping;return this.cache.forEach(([e,o],i)=>{if(i<0)return;let s=n.mapResult(i),a=t.doc.nodeAt(s.pos);if(s.deleted||!a?.eq(e))r.remove(i);else if(i!==s.pos){let e=o.map(e=>e.map(n,0,0)).filter(e=>null!=e);r.replace(i,s.pos,a,e)}}),r}};function R(e,t,r,n,o){let i=[],s=[];return e.descendants((e,a)=>{if(!e.type.isTextblock)return!0;if(r.includes(e.type.name)){let r=n(e),l=o.get(a);if(l){let[e,t]=l;i.push(...t)}else{let n=t({content:e.textContent,language:r||void 0,pos:a,size:e.nodeSize});n&&Array.isArray(n)?(o.set(a,e,n),i.push(...n)):n instanceof Promise&&(o.remove(a),s.push(n))}}return!1}),[l.zF.create(e,i),s]}var L=Object.defineProperty,P=(e,t,r)=>{let n;return(n="symbol"!=typeof t?t+"":t)in e?L(e,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[n]=r};function B(e,t="Ctrl"){return"u">typeof navigator&&(/Mac/.test(navigator.platform)||/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent))?e.replace("Mod","⌘"):e.replace("Mod",t)}function F(...e){return[...new Set(e.filter(e=>e).join(" ").split(" "))].join(" ")}let U=()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent),H=(e,t)=>{let r=(0,u.b)(e,t.pmSchema);"blockContainer"===r.type.name&&(r=r.firstChild);let n=t.pmSchema.nodes[r.type.name].spec.toDOM;if(void 0===n)throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");let o=n(r);if("object"!=typeof o||!("dom"in o))throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap node's `renderHTML` function does not return an object with the `dom` property.");return o};function j(e){return"data-"+e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function $(e){let t=e.split("/");return t.length&&""!==t[t.length-1]?t[t.length-1]:e}function G(e){var t;try{let r=(null==(t=new URL(e).pathname.split(".").pop())?void 0:t.toLowerCase())||"";return["mp4","webm","ogg","mov","mkv","flv","avi","wmv","m4v"].includes(r)}catch{return!1}}function z(e,t,r,n){let o=e();if(void 0===o)throw Error("Cannot find node position");let i=r.state.doc.resolve(o).node().attrs.id;if(!i)throw Error("Block doesn't have id");let s=t.getBlock(i);if(s.type!==n)throw Error("Block type does not match");return s}function V(e,t,r,n,o=!1,i){let s=document.createElement("div");if(void 0!==i)for(let[e,t]of Object.entries(i))"class"!==e&&s.setAttribute(e,t);for(let[e,o]of(s.className=F("bn-block-content",(null==i?void 0:i.class)||""),s.setAttribute("data-content-type",t),Object.entries(r)))o!==n[e].default&&s.setAttribute(j(e),o);return o&&s.setAttribute("data-file-block",""),s.appendChild(e.dom),e.contentDOM&&(e.contentDOM.className=F("bn-inline-content",e.contentDOM.className)),{...e,dom:s}}function W(e,t,r,n){var o,i,a,l;let c=t.node||s.bP.create({name:e.type,content:"inline"===e.content?"inline*":"none"===e.content?"":e.content,group:"blockContent",selectable:(null==(o=t.meta)?void 0:o.selectable)??!0,isolating:(null==(i=t.meta)?void 0:i.isolating)??!0,code:(null==(a=t.meta)?void 0:a.code)??!1,defining:(null==(l=t.meta)?void 0:l.defining)??!0,priority:n,addAttributes:()=>{var t;let r;return t=e.propSchema,r={},Object.entries(t).forEach(([e,t])=>{r[e]={default:t.default,keepOnSplit:!0,parseHTML:r=>{let n=r.getAttribute(j(e));if(null===n)return null;if(void 0===t.default&&"boolean"===t.type||void 0!==t.default&&"boolean"==typeof t.default)return"true"===n||"false"!==n&&null;if(void 0===t.default&&"number"===t.type||void 0!==t.default&&"number"==typeof t.default){let e=parseFloat(n);return!Number.isNaN(e)&&Number.isFinite(e)?e:null}return n},renderHTML:r=>r[e]!==t.default?{[j(e)]:r[e]}:{}}}),r},parseHTML:()=>{let r;return r=[{tag:"[data-content-type="+e.type+"]",contentElement:".bn-inline-content"}],t.parse&&r.push({tag:"*",getAttrs(e){var r;if("string"==typeof e)return!1;let n=null==(r=t.parse)?void 0:r.call(t,e);return void 0!==n&&n},preserveWhitespace:!0,getContent:"inline"===e.content||"none"===e.content?(r,n)=>{var o;if(t.parseContent)return t.parseContent({el:r,schema:n});if("inline"===e.content){let e=r.cloneNode(!0);return function(e,t="<br>"){let r=e.querySelectorAll("p");if(r.length>1){let e=r[0];for(let n=1;n<r.length;n++){let o=r[n];e.innerHTML+=t+o.innerHTML,o.remove()}}}(e,null!=(o=t.meta)&&o.code?`
|
|
18
|
+
`:"<br>"),O.S4.fromSchema(n).parse(e,{topNode:n.nodes.paragraph.create(),preserveWhitespace:!0}).content}return O.FK.empty}:void 0}),r},renderHTML({HTMLAttributes:r}){var n;let o=document.createElement("div");return V({dom:o,contentDOM:"inline"===e.content?o:void 0},e.type,{},e.propSchema,(null==(n=t.meta)?void 0:n.fileBlockAccept)!==void 0,r)},addNodeView(){return r=>{var n,o,i;let s=this.options.editor,a=z(r.getPos,s,this.editor,e.type),l=(null==(n=this.options.domAttributes)?void 0:n.blockContent)||{},c=t.render.call({blockContentDOMAttributes:l,props:r,renderType:"nodeView"},a,s);return(null==(o=t.meta)?void 0:o.selectable)===!1&&(i=this.editor,c.stopEvent=e=>("mousedown"===e.type&&setTimeout(()=>{i.view.dom.blur()},10),!0)),c}}});if(c.name!==e.type)throw Error("Node name does not match block type. This is a bug in BlockNote.");return{config:e,implementation:{...t,node:c,render(e,r){var n;let o=(null==(n=c.options.domAttributes)?void 0:n.blockContent)||{};return t.render.call({blockContentDOMAttributes:o,props:void 0,renderType:"dom"},e,r)},toExternalHTML:(e,r,n)=>{var o,i;let s=(null==(o=c.options.domAttributes)?void 0:o.blockContent)||{};return(null==(i=t.toExternalHTML)?void 0:i.call({blockContentDOMAttributes:s},e,r,n))??t.render.call({blockContentDOMAttributes:s,renderType:"dom",props:void 0},e,r)}},extensions:r}}function Y(e){return e}function q(e,t,r){return (n={})=>{let o="function"==typeof e?e(n):e,i="function"==typeof t?t(n):t,s=r?"function"==typeof r?r(n):r:void 0;return{config:o,implementation:{...i,toExternalHTML(e,t,r){var n,s;let a=null==(n=i.toExternalHTML)?void 0:n.call({blockContentDOMAttributes:this.blockContentDOMAttributes},e,t,r);if(void 0!==a)return V(a,e.type,e.props,o.propSchema,(null==(s=i.meta)?void 0:s.fileBlockAccept)!==void 0)},render(e,t){var r;return V(i.render.call({blockContentDOMAttributes:this.blockContentDOMAttributes,renderType:this.renderType,props:this.props},e,t),e.type,e.props,o.propSchema,(null==(r=i.meta)?void 0:r.fileBlockAccept)!==void 0,this.blockContentDOMAttributes)}},extensions:s}}}function K(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.config]))}function J(e,t,r,n){return e.dom.setAttribute("data-style-type",t),"string"===n&&e.dom.setAttribute("data-value",r),e.contentDOM&&e.contentDOM.setAttribute("data-editable",""),e}function Q(e,t){return{config:e,implementation:t}}function X(e,t){return Q({type:e.name,propSchema:t},{mark:e,render(t,r){let n=r.pmSchema.marks[e.name].spec.toDOM;if(void 0===n)throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");let o=r.pmSchema.mark(e.name,{stringValue:t}),i=O.ZF.renderSpec(document,n(o,!0));if("object"!=typeof i||!("dom"in i))throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");return i},toExternalHTML(t,r){let n=r.pmSchema.marks[e.name].spec.toDOM;if(void 0===n)throw Error("This block has no default HTML serialization as its corresponding TipTap node doesn't implement `renderHTML`.");let o=r.pmSchema.mark(e.name,{stringValue:t}),i=O.ZF.renderSpec(document,n(o,!0));if("object"!=typeof i||!("dom"in i))throw Error("Cannot use this block's default HTML serialization as its corresponding TipTap mark's `renderHTML` function does not return an object with the `dom` property.");return i}})}function Z(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.config]))}function ee(e,t){let r=s.CU.create({name:e.type,addAttributes:()=>"boolean"===e.propSchema?{}:{stringValue:{default:void 0,keepOnSplit:!0,parseHTML:e=>e.getAttribute("data-value"),renderHTML:e=>void 0!==e.stringValue?{"data-value":e.stringValue}:{}}},parseHTML:()=>{var r;let n;return r=t.parse,n=[{tag:`[data-style-type="${e.type}"]`,contentElement:e=>e.matches("[data-editable]")?e:e.querySelector("[data-editable]")||e}],r&&n.push({tag:"*",consuming:!1,getAttrs(e){if("string"==typeof e)return!1;let t=null==r?void 0:r(e);return void 0!==t&&{stringValue:t}}}),n},renderHTML:({mark:r})=>J((t.toExternalHTML||t.render)(r.attrs.stringValue),e.type,r.attrs.stringValue,e.propSchema),addMarkView:()=>({mark:r})=>J(t.render(r.attrs.stringValue),e.type,r.attrs.stringValue,e.propSchema)});return Q(e,{...t,mark:r,render:r=>J(t.render(r),e.type,r,e.propSchema),toExternalHTML:r=>J((t.toExternalHTML||t.render)(r),e.type,r,e.propSchema)})}function et(e,t){let r,n;if(t.firstChild.descendants((t,o)=>!r&&(!er(t)||t.attrs.id!==e||(r=t,n=o+1,!1))),void 0!==r&&void 0!==n)return{node:r,posBeforeNode:n}}function er(e){return e.type.isInGroup("bnBlock")}let en=(e,t)=>({tr:r,dispatch:n})=>(n&&eo(r,e,t),!0);function eo(e,t,r,n,o){let s=(0,u.v)(e.doc.resolve(t)),l=null;"table"===s.blockNoteType&&(l=function(e){let t="selection"in e?e.selection:null;if(!(t instanceof a.U3))return null;let r=e.doc.resolve(t.head),n=-1,o=-1;for(let e=r.depth;e>=0;e--){let t=r.node(e).type.name;if(n<0&&("tableCell"===t||"tableHeader"===t)&&(n=e),"table"===t){o=e;break}}if(n<0||o<0)return null;let s=r.before(n),l=r.before(o),c=e.doc.nodeAt(l);if(!c||"table"!==c.type.name)return null;let d=i.J3.get(c),h=s-(l+1),p=d.map.indexOf(h);return p<0?null:{row:Math.floor(p/d.width),col:p%d.width,offset:Math.max(0,t.head-(s+1+1))}}(e));let c=(0,u.g)(e);if(void 0!==n&&void 0!==o&&n>o)throw Error("Invalid replaceFromPos or replaceToPos");let d=c.nodes[s.blockNoteType],h=c.nodes[r.type||s.blockNoteType],p=h.isInGroup("bnBlock")?h:c.nodes.blockContainer;if(s.isBlockContainer&&h.isInGroup("blockContent")){let t=void 0!==n&&n>s.blockContent.beforePos&&n<s.blockContent.afterPos?n-s.blockContent.beforePos-1:void 0,i=void 0!==o&&o>s.blockContent.beforePos&&o<s.blockContent.afterPos?o-s.blockContent.beforePos-1:void 0;ei(r,e,s),function(e,t,r,n,o,i,s){let a=(0,u.g)(t),l="keep";if(e.content)if("string"==typeof e.content)l=(0,u.i)([e.content],a,n.name);else if(Array.isArray(e.content))l=(0,u.i)(e.content,a,n.name);else if("tableContent"===e.content.type)l=(0,u.t)(e.content,a);else throw new u.U(e.content.type);else""===r.spec.content||n.spec.content!==r.spec.content&&(l=[]);if("keep"===l)t.setNodeMarkup(o.blockContent.beforePos,n,{...o.blockContent.node.attrs,...e.props});else if(void 0!==i||void 0!==s){t.setNodeMarkup(o.blockContent.beforePos,n,{...o.blockContent.node.attrs,...e.props});let r=o.blockContent.beforePos+1+(i??0),a=o.blockContent.beforePos+1+(s??o.blockContent.node.content.size),c=t.doc.resolve(o.blockContent.beforePos).depth,d=t.doc.resolve(r).depth,h=t.doc.resolve(a).depth;t.replace(r,a,new O.Ji(O.FK.from(l),d-c-1,h-c-1))}else t.replaceWith(o.blockContent.beforePos,o.blockContent.afterPos,n.createChecked({...o.blockContent.node.attrs,...e.props},l))}(r,e,d,h,s,t,i)}else if(!s.isBlockContainer&&h.isInGroup("bnBlock"))ei(r,e,s);else{let t=(0,u.a)(s.bnBlock.node,c);e.replaceWith(s.bnBlock.beforePos,s.bnBlock.afterPos,(0,u.b)({children:t.children,...r},c));return}e.setNodeMarkup(s.bnBlock.beforePos,p,{...s.bnBlock.node.attrs,...r.props}),l&&function(e,t,r){var n;if("table"!==t.blockNoteType)return;let o=-1;if(t.isBlockContainer)o=e.mapping.map(t.blockContent.beforePos);else{let r=e.mapping.map(t.bnBlock.beforePos),i=r+((null==(n=e.doc.nodeAt(r))?void 0:n.nodeSize)||0);e.doc.nodesBetween(r,i,(e,t)=>"table"!==e.type.name||(o=t,!1))}let s=o>=0?e.doc.nodeAt(o):null;if(!s||"table"!==s.type.name)return;let l=i.J3.get(s),c=Math.max(0,Math.min(r.row,l.height-1)),d=Math.max(0,Math.min(r.col,l.width-1)),h=c*l.width+d,p=l.map[h];if(null==p)return;let u=o+1+p+1,f=e.doc.nodeAt(u),m=u+1,g=f?f.content.size:0,E=m+Math.max(0,Math.min(r.offset,g));"selection"in e&&e.setSelection(a.U3.create(e.doc,E))}(e,s,l)}function ei(e,t,r){let n=(0,u.g)(t);if(void 0!==e.children&&e.children.length>0){let o=e.children.map(e=>(0,u.b)(e,n));if(r.childContainer)t.step(new c.Ln(r.childContainer.beforePos+1,r.childContainer.afterPos-1,new O.Ji(O.FK.from(o),0,0)));else{if(!r.isBlockContainer)throw Error("impossible");t.insert(r.blockContent.afterPos,n.nodes.blockGroup.createChecked({},o))}}}function es(e,t,r,n,o){let i="string"==typeof t?t:t.id,s=et(i,e.doc);if(!s)throw Error(`Block with ID ${i} not found`);eo(e,s.posBeforeNode,r,n,o);let a=e.doc.resolve(s.posBeforeNode+1).node(),l=(0,u.g)(e);return(0,u.a)(a,l)}let ea={gray:{text:"#9b9a97",background:"#ebeced"},brown:{text:"#64473a",background:"#e9e5e3"},red:{text:"#e03e3e",background:"#fbe4e4"},orange:{text:"#d9730d",background:"#f6e9d9"},yellow:{text:"#dfab01",background:"#fbf3db"},green:{text:"#4d6461",background:"#ddedea"},blue:{text:"#0b6e99",background:"#ddebf1"},purple:{text:"#6940a5",background:"#eae4f2"},pink:{text:"#ad1a72",background:"#f4dfeb"}},el={gray:{text:"#bebdb8",background:"#9b9a97"},brown:{text:"#8e6552",background:"#64473a"},red:{text:"#ec4040",background:"#be3434"},orange:{text:"#e3790d",background:"#b7600a"},yellow:{text:"#dfab01",background:"#b58b00"},green:{text:"#6b8b87",background:"#4d6461"},blue:{text:"#0e87bc",background:"#0b6e99"},purple:{text:"#8552d7",background:"#6940a5"},pink:{text:"#da208f",background:"#ad1a72"}},ec={backgroundColor:{default:"default"},textColor:{default:"default"},textAlignment:{default:"left",values:["left","center","right","justify"]}},ed=e=>{let t={};return e.hasAttribute("data-background-color")?t.backgroundColor=e.getAttribute("data-background-color"):e.style.backgroundColor&&(t.backgroundColor=e.style.backgroundColor),e.hasAttribute("data-text-color")?t.textColor=e.getAttribute("data-text-color"):e.style.color&&(t.textColor=e.style.color),t.textAlignment=ec.textAlignment.values.includes(e.style.textAlign)?e.style.textAlign:void 0,t},eh=(e,t)=>{e.backgroundColor&&e.backgroundColor!==ec.backgroundColor.default&&(t.style.backgroundColor=e.backgroundColor in ea?ea[e.backgroundColor].background:e.backgroundColor),e.textColor&&e.textColor!==ec.textColor.default&&(t.style.color=e.textColor in ea?ea[e.textColor].text:e.textColor),e.textAlignment&&e.textAlignment!==ec.textAlignment.default&&(t.style.textAlign=e.textAlignment)},ep=(e="backgroundColor")=>({default:ec.backgroundColor.default,parseHTML:e=>e.hasAttribute("data-background-color")?e.getAttribute("data-background-color"):e.style.backgroundColor?e.style.backgroundColor:ec.backgroundColor.default,renderHTML:t=>t[e]===ec.backgroundColor.default?{}:{"data-background-color":t[e]}}),eu=(e="textColor")=>({default:ec.textColor.default,parseHTML:e=>e.hasAttribute("data-text-color")?e.getAttribute("data-text-color"):e.style.color?e.style.color:ec.textColor.default,renderHTML:t=>t[e]===ec.textColor.default?{}:{"data-text-color":t[e]}}),ef=(e,t)=>{let r=e.querySelector(t);if(!r)return;let n=e.querySelector("figcaption");return{targetElement:r,caption:(null==n?void 0:n.textContent)??void 0}},em=(0,p.c)(({editor:e})=>{let t=(0,p.a)(void 0);function r(){t.setState(void 0)}return{key:"filePanel",store:t,mount({signal:t}){let n=e.onChange(r,!1),o=e.onSelectionChange(r,!1);t.addEventListener("abort",()=>{n(),o()})},closeMenu:r,showMenu(e){t.setState(e)}}}),eg=(e,t,r,n)=>{let o=document.createElement("div");if(o.className="bn-file-block-content-wrapper",""===e.props.url){let r,i,s,a,l,c=((r=document.createElement("div")).className="bn-add-file-button",(i=document.createElement("div")).className="bn-add-file-button-icon",n?i.appendChild(n):i.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>',r.appendChild(i),(s=document.createElement("p")).className="bn-add-file-button-text",s.innerHTML=e.type in t.dictionary.file_blocks.add_button_text?t.dictionary.file_blocks.add_button_text[e.type]:t.dictionary.file_blocks.add_button_text.file,r.appendChild(s),a=e=>{e.preventDefault(),e.stopPropagation()},l=()=>{var r;t.isEditable&&(null==(r=t.getExtension(em))||r.showMenu(e.id))},r.addEventListener("mousedown",a,!0),r.addEventListener("click",l,!0),{dom:r,destroy:()=>{r.removeEventListener("mousedown",a,!0),r.removeEventListener("click",l,!0)}});o.appendChild(c.dom);let d=t.onUploadStart(t=>{if(t===e.id){o.removeChild(c.dom);let e=document.createElement("div");e.className="bn-file-loading-preview",e.textContent="Loading...",o.appendChild(e)}});return{dom:o,destroy:()=>{d(),c.destroy()}}}let i={dom:o};if(!1!==e.props.showPreview&&r)o.appendChild(r.dom);else{let t,r,n,s=((t=document.createElement("div")).className="bn-file-name-with-icon",(r=document.createElement("div")).className="bn-file-icon",r.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>',t.appendChild(r),(n=document.createElement("p")).className="bn-file-name",n.textContent=e.props.name,t.appendChild(n),{dom:t});o.appendChild(s.dom),i.destroy=()=>{var e;null==(e=s.destroy)||e.call(s)}}if(e.props.caption){let t=document.createElement("p");t.className="bn-file-caption",t.textContent=e.props.caption,o.appendChild(t)}return i},eE=(e,t)=>{let r=document.createElement("figure"),n=document.createElement("figcaption");return n.textContent=t,r.appendChild(e),r.appendChild(n),{dom:r}},eb=(e,t)=>{let r=document.createElement("div"),n=document.createElement("p");return n.textContent=t,r.appendChild(e),r.appendChild(n),{dom:r}},ey=e=>({url:e.src||void 0}),eT=e=>({type:"audio",propSchema:{backgroundColor:ec.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0}},content:"none"}),ev=(e={})=>e=>{if("AUDIO"===e.tagName){if(e.closest("figure"))return;let{backgroundColor:t}=ed(e);return{...ey(e),backgroundColor:t}}if("FIGURE"===e.tagName){let t=ef(e,"audio");if(!t)return;let{targetElement:r,caption:n}=t,{backgroundColor:o}=ed(e);return{...ey(r),backgroundColor:o,caption:n}}},ek=q(eT,e=>({meta:{fileBlockAccept:["audio/*"]},parse:ev(e),render:((e={})=>(t,r)=>{let n=document.createElement("div");n.innerHTML=e.icon??'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"></path></svg>';let o=document.createElement("audio");return o.className="bn-audio",r.resolveFileUrl?r.resolveFileUrl(t.props.url).then(e=>{o.src=e}):o.src=t.props.url,o.controls=!0,o.contentEditable="false",o.draggable=!1,eg(t,r,{dom:o},n.firstElementChild)})(e),toExternalHTML:((e={})=>(e,t)=>{let r;if(!e.props.url){let e=document.createElement("p");return e.textContent="Add audio",{dom:e}}return e.props.showPreview?(r=document.createElement("audio")).src=e.props.url:((r=document.createElement("a")).href=e.props.url,r.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?eE(r,e.props.caption):eb(r,e.props.caption):{dom:r}})(e),runsBefore:["file"]})),eA=Symbol.for("blocknote.shikiParser"),eC=Symbol.for("blocknote.shikiHighlighterPromise"),eS=q(({defaultLanguage:e="text"})=>({type:"codeBlock",propSchema:{language:{default:e}},content:"inline"}),e=>({meta:{code:!0,defining:!0,isolating:!1},parse:e=>{var t,r;if("PRE"!==e.tagName||1!==e.childElementCount||(null==(t=e.firstElementChild)?void 0:t.tagName)!=="CODE")return;let n=e.firstElementChild;return{language:n.getAttribute("data-language")||(null==(r=n.className.split(" ").find(e=>e.includes("language-")))?void 0:r.replace("language-",""))}},parseContent:({el:e,schema:t})=>{let r=O.S4.fromSchema(t),n=e.firstElementChild;return r.parse(n,{preserveWhitespace:"full",topNode:t.nodes.codeBlock.create()}).content},render(t,r){let n,o=document.createDocumentFragment(),i=document.createElement("pre"),s=document.createElement("code");if(i.appendChild(s),e.supportedLanguages){let i=document.createElement("select");if(Object.entries(e.supportedLanguages??{}).forEach(([e,{name:t}])=>{let r=document.createElement("option");r.value=e,r.text=t,i.appendChild(r)}),i.value=t.props.language||e.defaultLanguage||"text",r.isEditable){let e=e=>{let n=e.target.value;r.updateBlock(t.id,{props:{language:n}})};i.addEventListener("change",e),n=()=>i.removeEventListener("change",e)}else i.disabled=!0;let s=document.createElement("div");s.contentEditable="false",s.appendChild(i),o.appendChild(s)}return o.appendChild(i),{dom:o,contentDOM:s,destroy:()=>{null==n||n()}}},toExternalHTML(e){let t=document.createElement("pre"),r=document.createElement("code");return r.className=`language-${e.props.language}`,r.dataset.language=e.props.language,t.appendChild(r),{dom:t,contentDOM:r}}}),e=>{let t,r,n;return[(0,p.c)({key:"code-block-highlighter",prosemirrorPlugins:[(n=globalThis,function({parser:e,nodeTypes:t=["code_block","codeBlock"],languageExtractor:r=e=>e.attrs.language}){let n=new a.hs("prosemirror-highlight");return new a.k_({key:n,state:{init(n,o){let i=new D,[s,a]=R(o.doc,e,t,r,i);return{cache:i,decorations:s,promises:a}},apply:(n,o)=>{let i=o.cache.invalidate(n),s=!!n.getMeta("prosemirror-highlight-refresh");if(!n.docChanged&&!s)return{cache:i,decorations:o.decorations.map(n.mapping,n.doc),promises:o.promises};let[a,l]=R(n.doc,e,t,r,i);return{cache:i,decorations:a,promises:l}}},view:e=>{let t=new Set,r=()=>{if(t.size>0)return;let r=e.state.tr.setMeta("prosemirror-highlight-refresh",!0);e.dispatch(r)},o=()=>{let o=n.getState(e.state);for(let e of o?.promises??[])t.add(e),e.then(()=>{t.delete(e),r()}).catch(()=>{t.delete(e)})};return o(),{update:()=>{o()}}},props:{decorations(e){return this.getState(e)?.decorations}}})}({parser:o=>{var i;if(!e.createHighlighter)return[];if(!t)return n[eC]=n[eC]||e.createHighlighter(),n[eC].then(e=>{t=e});let s=ew(e,o.language);return s&&"text"!==s&&"none"!==s&&"plaintext"!==s&&"txt"!==s?t.getLoadedLanguages().includes(s)?(r||(r=n[eA]||(i=t,function({content:e,language:t,pos:r,size:n}){let o=[],{tokens:s,fg:a,bg:c,rootStyle:d}=i.codeToTokens(e,{lang:t,...(void 0)??{theme:i.getLoadedThemes()[0]}}),h=d||(a&&c?`--prosemirror-highlight:${a};--prosemirror-highlight-bg:${c}`:"");if(h){let e=l.NZ.node(r,r+n,{style:h});o.push(e)}let p=r+1;for(let e of s){for(let t of e){var u;let e=p+t.content.length,r=l.NZ.inline(p,e,{style:"string"==typeof(u=t.htmlStyle??`color: ${t.color}`)?u:Object.entries(u).map(([e,t])=>`${e}:${t}`).join(";"),class:"shiki"});o.push(r),p=e}p+=1}return o}),n[eA]=r),r(o)):t.loadLanguage(s):[]},languageExtractor:e=>e.attrs.language,nodeTypes:["codeBlock"]}))]}),(0,p.c)({key:"code-block-keyboard-shortcuts",keyboardShortcuts:{Delete:({editor:e})=>e.transact(t=>{let{block:r}=e.getTextCursorPosition();if("codeBlock"!==r.type)return!1;let{$from:n}=t.selection;return!n.parent.textContent&&(e.removeBlocks([r]),!0)}),Tab:({editor:t})=>!1!==e.indentLineWithTab&&t.transact(e=>{let{block:r}=t.getTextCursorPosition();return"codeBlock"===r.type&&(e.insertText(" "),!0)}),Enter:({editor:e})=>e.transact(t=>{let{block:r,nextBlock:n}=e.getTextCursorPosition();if("codeBlock"!==r.type)return!1;let{$from:o}=t.selection,i=o.parentOffset===o.parent.nodeSize-2,s=o.parent.textContent.endsWith(`
|
|
19
19
|
|
|
20
20
|
`);if(i&&s){if(t.delete(o.pos-2,o.pos),n)return e.setTextCursorPosition(n,"start"),!0;let[i]=e.insertBlocks([{type:"paragraph"}],r,"after");return e.setTextCursorPosition(i,"start"),!0}return t.insertText(`
|
|
21
21
|
`),!0}),"Shift-Enter":({editor:e})=>e.transact(()=>{let{block:t}=e.getTextCursorPosition();if("codeBlock"!==t.type)return!1;let[r]=e.insertBlocks([{type:"paragraph"}],t,"after");return e.setTextCursorPosition(r,"start"),!0})},inputRules:[{find:/^```(.*?)\s$/,replace:({match:t})=>{let r=t[1].trim();return{type:"codeBlock",props:{language:({language:ew(e,r)??r}).language},content:[]}}}]})]});function ew(e,t){var r;return null==(r=Object.entries(e.supportedLanguages??{}).find(([e,{aliases:r}])=>(null==r?void 0:r.includes(t))||e===t))?void 0:r[0]}let e_=q(()=>({type:"divider",propSchema:{},content:"none"}),{meta:{isolating:!1},parse(e){if("HR"===e.tagName)return{}},render:()=>({dom:document.createElement("hr")})},[(0,p.c)({key:"divider-block-shortcuts",inputRules:[{find:RegExp("^---$"),replace:()=>({type:"divider",props:{},content:[]})}]})]),eN=e=>({url:e.src||void 0}),eI=()=>({type:"file",propSchema:{backgroundColor:ec.backgroundColor,name:{default:""},url:{default:""},caption:{default:""}},content:"none"}),ex=()=>e=>{if("EMBED"===e.tagName){if(e.closest("figure"))return;let{backgroundColor:t}=ed(e);return{...eN(e),backgroundColor:t}}if("FIGURE"===e.tagName){let t=ef(e,"embed");if(!t)return;let{targetElement:r,caption:n}=t,{backgroundColor:o}=ed(e);return{...eN(r),backgroundColor:o,caption:n}}},eM=q(eI,{meta:{fileBlockAccept:["*/*"]},parse:ex(),render:(e,t)=>eg(e,t),toExternalHTML(e){if(!e.props.url){let e=document.createElement("p");return e.textContent="Add file",{dom:e}}let t=document.createElement("a");return t.href=e.props.url,t.textContent=e.props.name||e.props.url,e.props.caption?eb(t,e.props.caption):{dom:t}}}),eO={set:(e,t)=>window.localStorage.setItem(`toggle-${e.id}`,t?"true":"false"),get:e=>"true"===window.localStorage.getItem(`toggle-${e.id}`)},eD=(e,t,r,n=eO)=>{if("isToggleable"in e.props&&!e.props.isToggleable)return{dom:r};let o=document.createElement("div"),i=document.createElement("div");i.className="bn-toggle-wrapper";let s=document.createElement("button");s.className="bn-toggle-button",s.type="button",s.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="CURRENTCOLOR"><path d="M320-200v-560l440 280-440 280Z"/></svg>';let a=e=>e.preventDefault();s.addEventListener("mousedown",a);let l=()=>{var r;"true"===i.getAttribute("data-show-children")?(i.setAttribute("data-show-children","false"),n.set(t.getBlock(e),!1),o.contains(c)&&o.removeChild(c)):(i.setAttribute("data-show-children","true"),n.set(t.getBlock(e),!0),t.isEditable&&(null==(r=t.getBlock(e))?void 0:r.children.length)===0&&!o.contains(c)&&o.appendChild(c))};s.addEventListener("click",l),i.appendChild(s),i.appendChild(r);let c=document.createElement("button");c.className="bn-toggle-add-block-button",c.type="button",c.textContent=t.dictionary.toggle_blocks.add_block_button;let d=e=>e.preventDefault();c.addEventListener("mousedown",d);let h=()=>{t.transact(()=>{let r=t.updateBlock(e,{children:[{}]});t.setTextCursorPosition(r.children[0].id,"end"),t.focus()})};c.addEventListener("click",h),o.appendChild(i);let p=e.children.length,u=t.onChange(()=>{var r;let s=(null==(r=t.getBlock(e))?void 0:r.children.length)??0;s>p?("false"===i.getAttribute("data-show-children")&&(i.setAttribute("data-show-children","true"),n.set(t.getBlock(e),!0)),o.contains(c)&&o.removeChild(c)):0===s&&s<p&&("true"===i.getAttribute("data-show-children")&&(i.setAttribute("data-show-children","false"),n.set(t.getBlock(e),!1)),o.contains(c)&&o.removeChild(c)),p=s});return n.get(e)?(i.setAttribute("data-show-children","true"),t.isEditable&&0===e.children.length&&o.appendChild(c)):i.setAttribute("data-show-children","false"),{dom:o,ignoreMutation:e=>e instanceof MutationRecord&&("attributes"===e.type&&e.target===i&&"data-show-children"===e.attributeName||"childList"===e.type&&(e.addedNodes[0]===c||e.removedNodes[0]===c)),destroy:()=>{s.removeEventListener("mousedown",a),s.removeEventListener("click",l),c.removeEventListener("mousedown",d),c.removeEventListener("click",h),null==u||u()}}},eR=[1,2,3,4,5,6],eL=q(({defaultLevel:e=1,levels:t=eR,allowToggleHeadings:r=!0}={})=>({type:"heading",propSchema:{...ec,level:{default:e,values:t},...r?{isToggleable:{default:!1,optional:!0}}:{}},content:"inline"}),({allowToggleHeadings:e=!0}={})=>({meta:{isolating:!1},parse(e){let t;switch(e.tagName){case"H1":t=1;break;case"H2":t=2;break;case"H3":t=3;break;case"H4":t=4;break;case"H5":t=5;break;case"H6":t=6;break;default:return}return{...ed(e),level:t}},render(t,r){let n=document.createElement(`h${t.props.level}`);return e?{...eD(t,r,n),contentDOM:n}:{dom:n,contentDOM:n}},toExternalHTML(e){let t=document.createElement(`h${e.props.level}`);return eh(e.props,t),{dom:t,contentDOM:t}}}),({levels:e=eR}={})=>[(0,p.c)({key:"heading-shortcuts",keyboardShortcuts:Object.fromEntries(e.map(e=>[`Mod-Alt-${e}`,({editor:t})=>{let r=t.getTextCursorPosition();return"inline"===t.schema.blockSchema[r.block.type].content&&(t.updateBlock(r.block,{type:"heading",props:{level:e}}),!0)}])??[]),inputRules:e.map(e=>({find:RegExp(`^(#{${e}})\\s$`),replace:({match:e})=>({type:"heading",props:{level:e[1].length}})}))})]),eP=(e,t,r,n,o)=>{let{dom:i,destroy:s}=eg(e,t,r,o);i.style.position="relative",e.props.url&&e.props.showPreview&&(e.props.previewWidth?i.style.width=`${e.props.previewWidth}px`:i.style.width="fit-content");let a=document.createElement("div");a.className="bn-resize-handle",a.style.left="4px";let l=document.createElement("div");l.className="bn-resize-handle",l.style.right="4px";let c=document.createElement("div");c.style.position="absolute",c.style.height="100%",c.style.width="100%";let d,h=e.props.previewWidth,p=r=>{var o,s;if(!d){!t.isEditable&&n.contains(a)&&n.contains(l)&&(n.removeChild(a),n.removeChild(l));return}let c="touches"in r?r.touches[0].clientX:r.clientX;h=Math.min(Math.max("center"===e.props.textAlignment?"left"===d.handleUsed?d.initialWidth+(d.initialClientX-c)*2:d.initialWidth+(c-d.initialClientX)*2:"left"===d.handleUsed?d.initialWidth+d.initialClientX-c:d.initialWidth+c-d.initialClientX,64),(null==(s=null==(o=t.domElement)?void 0:o.firstElementChild)?void 0:s.clientWidth)||Number.MAX_VALUE),i.style.width=`${h}px`},u=r=>{(!r.target||!i.contains(r.target)||!t.isEditable)&&n.contains(a)&&n.contains(l)&&(n.removeChild(a),n.removeChild(l)),d&&(d=void 0,i.contains(c)&&i.removeChild(c),t.updateBlock(e,{props:{previewWidth:h}}))},f=()=>{t.isEditable&&(n.appendChild(a),n.appendChild(l))},m=e=>{e.relatedTarget===a||e.relatedTarget===l||d||t.isEditable&&n.contains(a)&&n.contains(l)&&(n.removeChild(a),n.removeChild(l))},g=e=>{e.preventDefault(),i.contains(c)||i.appendChild(c);let t="touches"in e?e.touches[0].clientX:e.clientX;d={handleUsed:"left",initialWidth:i.clientWidth,initialClientX:t}},E=e=>{e.preventDefault(),i.contains(c)||i.appendChild(c);let t="touches"in e?e.touches[0].clientX:e.clientX;d={handleUsed:"right",initialWidth:i.clientWidth,initialClientX:t}};return window.addEventListener("mousemove",p),window.addEventListener("touchmove",p),window.addEventListener("mouseup",u),window.addEventListener("touchend",u),i.addEventListener("mouseenter",f),i.addEventListener("mouseleave",m),a.addEventListener("mousedown",g),a.addEventListener("touchstart",g),l.addEventListener("mousedown",E),l.addEventListener("touchstart",E),{dom:i,destroy:()=>{null==s||s(),window.removeEventListener("mousemove",p),window.removeEventListener("touchmove",p),window.removeEventListener("mouseup",u),window.removeEventListener("touchend",u),i.removeEventListener("mouseenter",f),i.removeEventListener("mouseleave",m),a.removeEventListener("mousedown",g),a.removeEventListener("touchstart",g),l.removeEventListener("mousedown",E),l.removeEventListener("touchstart",E)}}},eB=e=>({url:e.src||void 0,previewWidth:e.width||void 0,name:e.alt||void 0}),eF=(e={})=>({type:"image",propSchema:{textAlignment:ec.textAlignment,backgroundColor:ec.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),eU=(e={})=>e=>{if("IMG"===e.tagName){if(e.closest("figure"))return;let{backgroundColor:t}=ed(e);return{...eB(e),backgroundColor:t}}if("FIGURE"===e.tagName){let t=ef(e,"img");if(!t)return;let{targetElement:r,caption:n}=t,{backgroundColor:o}=ed(e);return{...eB(r),backgroundColor:o,caption:n}}},eH=q(eF,e=>({meta:{fileBlockAccept:["image/*"]},parse:eU(e),render:((e={})=>(t,r)=>{let n=document.createElement("div");n.innerHTML=e.icon??'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"></path></svg>';let o=document.createElement("div");o.className="bn-visual-media-wrapper";let i=document.createElement("img");return i.className="bn-visual-media",r.resolveFileUrl?r.resolveFileUrl(t.props.url).then(e=>{i.src=e}):i.src=t.props.url,i.alt=t.props.name||t.props.caption||"BlockNote image",i.contentEditable="false",i.draggable=!1,o.appendChild(i),eP(t,r,{dom:o},o,n.firstElementChild)})(e),toExternalHTML:((e={})=>(e,t)=>{let r;if(!e.props.url){let e=document.createElement("p");return e.textContent="Add image",{dom:e}}return e.props.showPreview?((r=document.createElement("img")).src=e.props.url,r.alt=e.props.name||e.props.caption||"BlockNote image",e.props.previewWidth&&(r.width=e.props.previewWidth)):((r=document.createElement("a")).href=e.props.url,r.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?eE(r,e.props.caption):eb(r,e.props.caption):{dom:r}})(e),runsBefore:["file"]})),ej=(e,t,r)=>({state:n,dispatch:o})=>!o||e$(n.tr,e,t,r),e$=(e,t,r,n)=>{let o=(0,u.q)(e.doc,t),i=(0,u.A)(o);if(!i.isBlockContainer)return!1;let s=(0,u.g)(e),a=[{type:i.bnBlock.node.type,attrs:n?{...i.bnBlock.node.attrs,id:void 0}:{}},{type:r?i.blockContent.node.type:s.nodes.paragraph,attrs:n?{...i.blockContent.node.attrs}:{}}];return e.split(t,2,a),!0},eG=(e,t)=>{let{blockInfo:r,selectionEmpty:n}=e.transact(e=>({blockInfo:(0,u.r)(e),selectionEmpty:e.selection.anchor===e.selection.head}));if(!r.isBlockContainer)return!1;let{bnBlock:o,blockContent:i}=r;return i.node.type.name===t&&!!n&&(0===i.node.childCount?(e.transact(e=>{eo(e,o.beforePos,{type:"paragraph",props:{}})}),!0):i.node.childCount>0&&e.transact(e=>(e.deleteSelection(),e$(e,e.selection.from,!0))))};function ez(e,t,r){var n,o,i;let s=O.S4.fromSchema(t),a=document.createElement("div");for(let t of(a.setAttribute("data-node-type","blockGroup"),Array.from(e.childNodes)))a.appendChild(t.cloneNode(!0));let l=s.parse(a,{topNode:t.nodes.blockGroup.create()});(null==(o=null==(n=l.firstChild)?void 0:n.firstChild)?void 0:o.type.name)==="checkListItem"&&(l=l.copy(l.content.cut(l.firstChild.firstChild.nodeSize+2)));let c=null==(i=l.firstChild)?void 0:i.firstChild;if(!(null!=c&&c.isTextblock))return O.FK.from(l);let d=t.nodes[r].create({},c.content),h=l.content.cut(c.nodeSize+2);if(h.size>0){let e=l.copy(h);return d.content.addToEnd(e)}return d.content}let eV=q(()=>({type:"bulletListItem",propSchema:{...ec},content:"inline"}),{meta:{isolating:!1},parse(e){var t;if("LI"!==e.tagName)return;let r=e.parentElement;if(null!==r&&("UL"===r.tagName||"DIV"===r.tagName&&(null==(t=r.parentElement)?void 0:t.tagName)==="UL"))return ed(e)},parseContent:({el:e,schema:t})=>ez(e,t,"bulletListItem"),render(){let e=document.createElement("p");return{dom:e,contentDOM:e}},toExternalHTML(e){let t=document.createElement("li"),r=document.createElement("p");return eh(e.props,t),t.appendChild(r),{dom:t,contentDOM:r}}},[(0,p.c)({key:"bullet-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:e})=>eG(e,"bulletListItem"),"Mod-Shift-8":({editor:e})=>{let t=e.getTextCursorPosition();return"inline"===e.schema.blockSchema[t.block.type].content&&(e.updateBlock(t.block,{type:"bulletListItem",props:{}}),!0)}},inputRules:[{find:/^\s?[-+*]\s$/,replace({editor:e}){if("heading"!==(0,u.w)(e.prosemirrorState).blockNoteType)return{type:"bulletListItem",props:{}}}}]})]),eW=q(()=>({type:"checkListItem",propSchema:{...ec,checked:{default:!1,type:"boolean"}},content:"inline"}),{meta:{isolating:!1},parse(e){var t;if("input"===e.tagName)return e.closest("[data-content-type]")||e.closest("li")?void 0:"checkbox"===e.type?{checked:e.checked}:void 0;if("LI"!==e.tagName)return;let r=e.parentElement;if(null!==r&&("UL"===r.tagName||"DIV"===r.tagName&&(null==(t=r.parentElement)?void 0:t.tagName)==="UL")){let t=e.querySelector("input[type=checkbox]")||null;return null===t?void 0:{...ed(e),checked:t.checked}}},parseContent:({el:e,schema:t})=>ez(e,t,"checkListItem"),render(e,t){let r=document.createDocumentFragment(),n=document.createElement("input");n.type="checkbox",n.checked=e.props.checked,e.props.checked&&n.setAttribute("checked",""),n.addEventListener("change",()=>{t.updateBlock(e,{props:{checked:!e.props.checked}})});let o=document.createElement("p"),i=document.createElement("div");return i.contentEditable="false",i.appendChild(n),r.appendChild(i),r.appendChild(o),{dom:r,contentDOM:o}},toExternalHTML(e){let t=document.createElement("li"),r=document.createElement("input");r.type="checkbox",r.checked=e.props.checked,e.props.checked&&r.setAttribute("checked","");let n=document.createElement("p");return eh(e.props,t),t.appendChild(r),t.appendChild(n),{dom:t,contentDOM:n}},runsBefore:["bulletListItem"]},[(0,p.c)({key:"check-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:e})=>eG(e,"checkListItem"),"Mod-Shift-9":({editor:e})=>{let t=e.getTextCursorPosition();return"inline"===e.schema.blockSchema[t.block.type].content&&(e.updateBlock(t.block,{type:"checkListItem",props:{}}),!0)}},inputRules:[{find:/^\s?\[\s*\]\s$/,replace:()=>({type:"checkListItem",props:{checked:!1}})},{find:/^\s?\[[Xx]\]\s$/,replace:()=>({type:"checkListItem",props:{checked:!0}})}]})]);function eY(e,t){let r=new Map,n=t.decorations.map(e.mapping,e.doc),o=[];e.doc.nodesBetween(0,e.doc.nodeSize-2,(t,i)=>{if("blockContainer"===t.type.name&&"numberedListItem"===t.firstChild.type.name){let{index:s,isFirst:a,hasStart:c}=function e(t,r,n,o){let i=t.firstChild.attrs.start||1,s=!0,a=!!t.firstChild.attrs.start,l=(0,u.A)({posBeforeNode:r,node:t});if(!l.isBlockContainer)throw Error("impossible");let c=n.doc.resolve(l.bnBlock.beforePos).nodeBefore,d=c?o.get(c):void 0;return void 0!==d?(i=d+1,s=!1):c&&"numberedListItem"===(0,u.A)({posBeforeNode:l.bnBlock.beforePos-c.nodeSize,node:c}).blockNoteType&&(i=e(c,l.bnBlock.beforePos-c.nodeSize,n,o).index+1,s=!1),o.set(t,i),{index:i,isFirst:s,hasStart:a}}(t,i,e,r);if(0===n.find(i,i+t.nodeSize,e=>e.index===s&&e.isFirst===a&&e.hasStart===c).length){let t=e.doc.nodeAt(i+1);o.push(l.NZ.node(i+1,i+1+t.nodeSize,{"data-index":s.toString()}))}}});let i=o.flatMap(e=>n.find(e.from,e.to));return{decorations:n.remove(i).add(e.doc,o)}}let eq=q(()=>({type:"numberedListItem",propSchema:{...ec,start:{default:void 0,type:"number"}},content:"inline"}),{meta:{isolating:!1},parse(e){var t;if("LI"!==e.tagName)return;let r=e.parentElement;if(null!==r&&("OL"===r.tagName||"DIV"===r.tagName&&(null==(t=r.parentElement)?void 0:t.tagName)==="OL")){let t=parseInt(r.getAttribute("start")||"1"),n=ed(e);return e.previousElementSibling||1===t?n:{...n,start:t}}},parseContent:({el:e,schema:t})=>ez(e,t,"numberedListItem"),render(){let e=document.createElement("p");return{dom:e,contentDOM:e}},toExternalHTML(e){let t=document.createElement("li"),r=document.createElement("p");return eh(e.props,t),t.appendChild(r),{dom:t,contentDOM:r}}},[(0,p.c)({key:"numbered-list-item-shortcuts",inputRules:[{find:/^\s?(\d+)\.\s$/,replace({match:e,editor:t}){if("heading"===(0,u.w)(t.prosemirrorState).blockNoteType)return;let r=parseInt(e[1]);return{type:"numberedListItem",props:{start:1!==r?r:void 0}}}}],keyboardShortcuts:{Enter:({editor:e})=>eG(e,"numberedListItem"),"Mod-Shift-7":({editor:e})=>{let t=e.getTextCursorPosition();return"inline"===e.schema.blockSchema[t.block.type].content&&(e.updateBlock(t.block,{type:"numberedListItem",props:{}}),!0)}},prosemirrorPlugins:[new a.k_({key:new a.hs("numbered-list-indexing-decorations"),state:{init:(e,t)=>eY(t.tr,{decorations:l.zF.empty}),apply:(e,t)=>e.docChanged||e.selectionSet||!t.decorations?eY(e,t):t},props:{decorations(e){var t;return(null==(t=this.getState(e))?void 0:t.decorations)??l.zF.empty}}})]})]),eK=q(()=>({type:"toggleListItem",propSchema:{...ec},content:"inline"}),{meta:{isolating:!1},render(e,t){let r=document.createElement("p");return{...eD(e,t,r),contentDOM:r}},toExternalHTML(e){let t=document.createElement("li"),r=document.createElement("p");return eh(e.props,t),t.appendChild(r),{dom:t,contentDOM:r}}},[(0,p.c)({key:"toggle-list-item-shortcuts",keyboardShortcuts:{Enter:({editor:e})=>eG(e,"toggleListItem"),"Mod-Shift-6":({editor:e})=>{let t=e.getTextCursorPosition();return"inline"===e.schema.blockSchema[t.block.type].content&&(e.updateBlock(t.block,{type:"toggleListItem",props:{}}),!0)}}})]),eJ=q(()=>({type:"paragraph",propSchema:ec,content:"inline"}),{meta:{isolating:!1},parse:e=>{var t;if("P"===e.tagName&&null!=(t=e.textContent)&&t.trim())return ed(e)},render:()=>{let e=document.createElement("p");return{dom:e,contentDOM:e}},toExternalHTML:e=>{let t=document.createElement("p");return eh(e.props,t),{dom:t,contentDOM:t}},runsBefore:["default"]},[(0,p.c)({key:"paragraph-shortcuts",keyboardShortcuts:{"Mod-Alt-0":({editor:e})=>{let t=e.getTextCursorPosition();return"inline"===e.schema.blockSchema[t.block.type].content&&(e.updateBlock(t.block,{type:"paragraph",props:{}}),!0)}}})]),eQ=q(()=>({type:"quote",propSchema:{backgroundColor:ec.backgroundColor,textColor:ec.textColor},content:"inline"}),{meta:{isolating:!1},parse(e){if("BLOCKQUOTE"===e.tagName){let{backgroundColor:t,textColor:r}=ed(e);return{backgroundColor:t,textColor:r}}},render(){let e=document.createElement("blockquote");return{dom:e,contentDOM:e}},toExternalHTML(e){let t=document.createElement("blockquote");return eh(e.props,t),{dom:t,contentDOM:t}}},[(0,p.c)({key:"quote-block-shortcuts",keyboardShortcuts:{"Mod-Alt-q":({editor:e})=>{let t=e.getTextCursorPosition();return"inline"===e.schema.blockSchema[t.block.type].content&&(e.updateBlock(t.block,{type:"quote",props:{}}),!0)}},inputRules:[{find:RegExp("^>\\s$"),replace:()=>({type:"quote",props:{}})}]})]),eX=120,eZ=31,e0=s.YY.create({name:"BlockNoteTableExtension",addProseMirrorPlugins:()=>[(0,i.AL)({cellMinWidth:35,defaultCellMinWidth:eX,View:null}),(0,i.LF)()],addKeyboardShortcuts(){return{Enter:()=>!!this.editor.state.selection.empty&&"tableParagraph"===this.editor.state.selection.$head.parent.type.name&&(this.editor.commands.insertContent({type:"hardBreak"}),!0),Backspace:()=>{let e=this.editor.state.selection,t=e.empty,r=0===e.$head.parentOffset,n="tableParagraph"===e.$head.node().type.name;return t&&r&&n},Tab:()=>this.editor.commands.command(({state:e,dispatch:t,view:r})=>(0,i.D8)(1)(e,t,r)),"Shift-Tab":()=>this.editor.commands.command(({state:e,dispatch:t,view:r})=>(0,i.D8)(-1)(e,t,r))}},extendNodeSchema(e){let t={name:e.name,options:e.options,storage:e.storage};return{tableRole:(0,s.gk)((0,s.iI)(e,"tableRole",t))}}}),e1={textColor:ec.textColor},e2=s.bP.create({name:"tableHeader",addOptions:()=>({HTMLAttributes:{}}),content:"tableContent+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute("colwidth");return t?t.split(",").map(e=>parseInt(e,10)):null}}}),tableRole:"header_cell",isolating:!0,parseHTML:()=>[{tag:"th",getContent:(e,t)=>e8(e,t)}],renderHTML({HTMLAttributes:e}){return["th",(0,s.KV)(this.options.HTMLAttributes,e),0]}}),e3=s.bP.create({name:"tableCell",addOptions:()=>({HTMLAttributes:{}}),content:"tableContent+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{let t=e.getAttribute("colwidth");return t?t.split(",").map(e=>parseInt(e,10)):null}}}),tableRole:"cell",isolating:!0,parseHTML:()=>[{tag:"td",getContent:(e,t)=>e8(e,t)}],renderHTML({HTMLAttributes:e}){return["td",(0,s.KV)(this.options.HTMLAttributes,e),0]}}),e5=s.bP.create({name:"table",content:"tableRow+",group:"blockContent",tableRole:"table",marks:"deletion insertion modification",isolating:!0,parseHTML:()=>[{tag:"table"}],renderHTML({node:e,HTMLAttributes:t}){var r,n,o;let i=function(e,t,r,n){let o=document.createElement("div");for(let[t,n]of(o.className=F("bn-block-content",r.class),o.setAttribute("data-content-type",e),Object.entries(r)))"class"!==t&&o.setAttribute(t,n);let i=document.createElement(t);for(let[e,t]of(i.className=F("bn-inline-content",n.class),Object.entries(n)))"class"!==e&&i.setAttribute(e,t);return o.appendChild(i),{dom:o,contentDOM:i}}(this.name,"table",{...(null==(r=this.options.domAttributes)?void 0:r.blockContent)||{},...t},(null==(n=this.options.domAttributes)?void 0:n.inlineContent)||{}),s=document.createElement("colgroup");for(let t of e.children[0].children)if(t.attrs.colwidth)for(let e of t.attrs.colwidth){let t=document.createElement("col");e&&(t.style=`width: ${e}px`),s.appendChild(t)}else s.appendChild(document.createElement("col"));return null==(o=i.dom.firstChild)||o.appendChild(s),i},addNodeView(){return({node:e,HTMLAttributes:t})=>{var r;class n extends i.Qg{constructor(e,t,r){super(e,t),this.node=e,this.cellMinWidth=t,this.blockContentHTMLAttributes=r;const n=document.createElement("div");for(const[e,t]of(n.className=F("bn-block-content",r.class),n.setAttribute("data-content-type","table"),Object.entries(r)))"class"!==e&&n.setAttribute(e,t);const o=this.dom,i=document.createElement("div");i.className="tableWrapper-inner",i.appendChild(o.firstChild),o.appendChild(i),n.appendChild(o);const s=document.createElement("div");s.className="table-widgets-container",s.style.position="relative",o.appendChild(s),this.dom=n}ignoreMutation(e){return!e.target.closest(".tableWrapper-inner")||super.ignoreMutation(e)}}return new n(e,eX,{...(null==(r=this.options.domAttributes)?void 0:r.blockContent)||{},...t})}}}),e4=s.bP.create({name:"tableParagraph",group:"tableContent",content:"inline*",parseHTML:()=>[{tag:"p",getAttrs:e=>{if("string"==typeof e||!e.textContent||!e.closest("[data-content-type]"))return!1;let t=e.parentElement;return null!==t&&("TD"===t.tagName||"TH"===t.tagName)&&{}},node:"tableParagraph"}],renderHTML:({HTMLAttributes:e})=>["p",e,0]}),e6=s.bP.create({name:"tableRow",addOptions:()=>({HTMLAttributes:{}}),content:"(tableCell | tableHeader)+",tableRole:"row",marks:"deletion insertion modification",parseHTML:()=>[{tag:"tr"}],renderHTML({HTMLAttributes:e}){return["tr",(0,s.KV)(this.options.HTMLAttributes,e),0]}});function e8(e,t){let r=O.S4.fromSchema(t).parse(e,{topNode:t.nodes.blockGroup.create()}),n=[];return r.content.descendants(e=>{if(e.isInline)return n.push(e),!1}),O.FK.fromArray(n)}let e9=e=>({url:e.src||void 0,previewWidth:e.width||void 0}),e7=e=>({type:"video",propSchema:{textAlignment:ec.textAlignment,backgroundColor:ec.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:void 0,type:"number"}},content:"none"}),te=e=>e=>{if("VIDEO"===e.tagName){if(e.closest("figure"))return;let{backgroundColor:t}=ed(e);return{...e9(e),backgroundColor:t}}if("FIGURE"===e.tagName){let t=ef(e,"video");if(!t)return;let{targetElement:r,caption:n}=t,{backgroundColor:o}=ed(e);return{...e9(r),backgroundColor:o,caption:n}}},tt=q(e7,e=>({meta:{fileBlockAccept:["video/*"]},parse:te(),render(t,r){let n=document.createElement("div");n.innerHTML=e.icon??'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"></path></svg>';let o=document.createElement("div");o.className="bn-visual-media-wrapper";let i=document.createElement("video");return i.className="bn-visual-media",r.resolveFileUrl?r.resolveFileUrl(t.props.url).then(e=>{i.src=e}):i.src=t.props.url,i.controls=!0,i.contentEditable="false",i.draggable=!1,i.width=t.props.previewWidth,o.appendChild(i),eP(t,r,{dom:o},o,n.firstElementChild)},toExternalHTML(e){let t;if(!e.props.url){let e=document.createElement("p");return e.textContent="Add video",{dom:e}}return e.props.showPreview?((t=document.createElement("video")).src=e.props.url,e.props.previewWidth&&(t.width=e.props.previewWidth)):((t=document.createElement("a")).href=e.props.url,t.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?eE(t,e.props.caption):eb(t,e.props.caption):{dom:t}},runsBefore:["file"]}));function tr(e,t,r){if(!(t in e.schema.blockSpecs))return!1;if(!r)return!0;for(let[n,o]of Object.entries(r)){if(!(n in e.schema.blockSpecs[t].config.propSchema))return!1;if("string"==typeof o){if(void 0!==e.schema.blockSpecs[t].config.propSchema[n].default&&typeof e.schema.blockSpecs[t].config.propSchema[n].default!==o||void 0!==e.schema.blockSpecs[t].config.propSchema[n].type&&e.schema.blockSpecs[t].config.propSchema[n].type!==o)return!1}else{if(e.schema.blockSpecs[t].config.propSchema[n].default!==o.default||void 0===e.schema.blockSpecs[t].config.propSchema[n].default&&void 0===o.default&&e.schema.blockSpecs[t].config.propSchema[n].type!==o.type||typeof e.schema.blockSpecs[t].config.propSchema[n].values!=typeof o.values)return!1;if("object"==typeof e.schema.blockSpecs[t].config.propSchema[n].values&&"object"==typeof o.values){for(let r of o.values)if(!e.schema.blockSpecs[t].config.propSchema[n].values.includes(r))return!1}}}return!0}function tn(e,t,r,n){return tr(t,r,n)&&e.type===r}function to(e){return e instanceof i.rn}let ti=new Map,ts=(0,s.KP)(e=>"blockContainer"===e.type.name);class ta{constructor(e,t,r){var n;P(this,"state"),P(this,"emitUpdate"),P(this,"rootEl"),P(this,"pluginState"),P(this,"handleScroll",()=>{var e,t;if(null!=(e=this.state)&&e.show){let e=null==(t=this.rootEl)?void 0:t.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);if(!e)return;this.state.referencePos=e.getBoundingClientRect().toJSON(),this.emitUpdate(this.pluginState.triggerCharacter)}}),P(this,"closeMenu",()=>{this.editor.transact(e=>e.setMeta(tl,null))}),P(this,"clearQuery",()=>{void 0!==this.pluginState&&this.editor._tiptapEditor.chain().focus().deleteRange({from:this.pluginState.queryStartPos()-(this.pluginState.deleteTriggerCharacter?this.pluginState.triggerCharacter.length:0),to:this.editor.transact(e=>e.selection.from)}).run()}),this.editor=e,this.pluginState=void 0,this.emitUpdate=e=>{var r;if(!this.state)throw Error("Attempting to update uninitialized suggestions menu");t(e,{...this.state,ignoreQueryLength:null==(r=this.pluginState)?void 0:r.ignoreQueryLength})},this.rootEl=r.root,null==(n=this.rootEl)||n.addEventListener("scroll",this.handleScroll,!0)}update(e,t){var r;let n=tl.getState(t),o=tl.getState(e.state),i=void 0!==n&&void 0===o;if((void 0!==n||void 0===o)&&(void 0===n||void 0===o)&&!i)return;if(this.pluginState=i?n:o,i||!this.editor.isEditable){this.state&&(this.state.show=!1),this.emitUpdate(this.pluginState.triggerCharacter);return}let s=null==(r=this.rootEl)?void 0:r.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);this.editor.isEditable&&s&&(this.state={show:!0,referencePos:s.getBoundingClientRect().toJSON(),query:this.pluginState.query},this.emitUpdate(this.pluginState.triggerCharacter))}destroy(){var e;null==(e=this.rootEl)||e.removeEventListener("scroll",this.handleScroll,!0)}}let tl=new a.hs("SuggestionMenuPlugin"),tc=(0,p.c)(({editor:e})=>{let t,r=[],n=(0,p.a)(void 0);return{key:"suggestionMenu",store:n,addTriggerCharacter:e=>{r.push(e)},removeTriggerCharacter:e=>{r.splice(r.indexOf(e),1)},closeMenu:()=>{null==t||t.closeMenu()},clearQuery:()=>{null==t||t.clearQuery()},shown:()=>{var e;return(null==(e=null==t?void 0:t.state)?void 0:e.show)||!1},openSuggestionMenu:(t,r)=>{e.headless||(e.focus(),e.transact(e=>{null!=r&&r.deleteTriggerCharacter&&e.insertText(t),e.scrollIntoView().setMeta(tl,{triggerCharacter:t,deleteTriggerCharacter:(null==r?void 0:r.deleteTriggerCharacter)||!1,ignoreQueryLength:(null==r?void 0:r.ignoreQueryLength)||!1})}))},prosemirrorPlugins:[new a.k_({key:tl,view:r=>t=new ta(e,(e,t)=>{n.setState({...t,triggerCharacter:e})},r),state:{init(){},apply:(r,n,o,i)=>{if(r.selection.$from.parent.type.spec.code)return n;let s=r.getMeta(tl);if("object"==typeof s&&null!==s){n&&(null==t||t.closeMenu());let r=function(e,t,r="left"){let n=d.pJ.getState(e.prosemirrorState);if(!n){let n=function(e){if(ti.has(e))return ti.get(e);let t=new c.X9;return e._tiptapEditor.on("transaction",({transaction:e})=>{t.appendMapping(e.mapping)}),e._tiptapEditor.on("destroy",()=>{ti.delete(e)}),ti.set(e,t),t}(e),o=n.maps.length;return()=>n.slice(o).map(t,"left"===r?-1:1)}let o=(0,h.Bw)(t+("right"===r?1:-1),n.binding.type,n.binding.mapping);return()=>{let t=d.pJ.getState(e.prosemirrorState),n=(0,h.bL)(t.doc,t.binding.type,o,t.binding.mapping);if(null===n)throw Error("Position not found, cannot track positions");return n+("right"===r?-1:1)}}(e,i.selection.from-s.triggerCharacter.length);return{triggerCharacter:s.triggerCharacter,deleteTriggerCharacter:!1!==s.deleteTriggerCharacter,queryStartPos:()=>r()+s.triggerCharacter.length,query:"",decorationId:`id_${Math.floor(0xffffffff*Math.random())}`,ignoreQueryLength:null==s?void 0:s.ignoreQueryLength}}if(void 0===n)return n;if(i.selection.from!==i.selection.to||null===s||r.getMeta("focus")||r.getMeta("blur")||r.getMeta("pointer")||void 0!==n.triggerCharacter&&i.selection.from<n.queryStartPos()||!i.selection.$from.sameParent(i.doc.resolve(n.queryStartPos())))return;let a={...n};return a.query=i.doc.textBetween(n.queryStartPos(),i.selection.from),a}},props:{handleTextInput(e,t,n,o){if(t===n){let n=e.state.doc;for(let i of r){let r=i.length>1?n.textBetween(t-i.length,t)+o:o;if(i===r)return e.dispatch(e.state.tr.insertText(o)),e.dispatch(e.state.tr.setMeta(tl,{triggerCharacter:r}).scrollIntoView()),!0}}return!1},decorations(e){let t=this.getState(e);if(void 0===t)return null;if(!t.deleteTriggerCharacter){let r=ts(e.selection);if(r)return l.zF.create(e.doc,[l.NZ.node(r.pos,r.pos+r.node.nodeSize,{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":t.decorationId})])}return l.zF.create(e.doc,[l.NZ.inline(t.queryStartPos()-t.triggerCharacter.length,t.queryStartPos(),{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":t.decorationId})])}}})]}});function td(e,t){let r,n=e.getTextCursorPosition().block;if(void 0===n.content)throw Error("Slash Menu open in a block that doesn't contain content.");return Array.isArray(n.content)&&(1===n.content.length&&(0,u.J)(n.content[0])&&"text"===n.content[0].type&&"/"===n.content[0].text||0===n.content.length)?(r=e.updateBlock(n,t),e.setTextCursorPosition(r)):(r=e.insertBlocks([t],n,"after")[0],e.setTextCursorPosition(e.getTextCursorPosition().nextBlock)),function(e){let t=e.getTextCursorPosition().block,r=e.schema.blockSchema[t.type].content;for(;"none"===r;){if(void 0===(t=e.getTextCursorPosition().nextBlock))return;r=e.schema.blockSchema[t.type].content,e.setTextCursorPosition(t,"end")}}(e),r}function th(e){let t=[];return tr(e,"heading",{level:"number"})&&(e.schema.blockSchema.heading.propSchema.level.values||[]).filter(e=>e<=3).forEach(r=>{t.push({onItemClick:()=>{td(e,{type:"heading",props:{level:r}})},badge:B(`Mod-Alt-${r}`),key:1===r?"heading":`heading_${r}`,...e.dictionary.slash_menu[1===r?"heading":`heading_${r}`]})}),tr(e,"quote")&&t.push({onItemClick:()=>{td(e,{type:"quote"})},key:"quote",...e.dictionary.slash_menu.quote}),tr(e,"toggleListItem")&&t.push({onItemClick:()=>{td(e,{type:"toggleListItem"})},badge:B("Mod-Shift-6"),key:"toggle_list",...e.dictionary.slash_menu.toggle_list}),tr(e,"numberedListItem")&&t.push({onItemClick:()=>{td(e,{type:"numberedListItem"})},badge:B("Mod-Shift-7"),key:"numbered_list",...e.dictionary.slash_menu.numbered_list}),tr(e,"bulletListItem")&&t.push({onItemClick:()=>{td(e,{type:"bulletListItem"})},badge:B("Mod-Shift-8"),key:"bullet_list",...e.dictionary.slash_menu.bullet_list}),tr(e,"checkListItem")&&t.push({onItemClick:()=>{td(e,{type:"checkListItem"})},badge:B("Mod-Shift-9"),key:"check_list",...e.dictionary.slash_menu.check_list}),tr(e,"paragraph")&&t.push({onItemClick:()=>{td(e,{type:"paragraph"})},badge:B("Mod-Alt-0"),key:"paragraph",...e.dictionary.slash_menu.paragraph}),tr(e,"codeBlock")&&t.push({onItemClick:()=>{td(e,{type:"codeBlock"})},badge:B("Mod-Alt-c"),key:"code_block",...e.dictionary.slash_menu.code_block}),tr(e,"divider")&&t.push({onItemClick:()=>{td(e,{type:"divider"})},key:"divider",...e.dictionary.slash_menu.divider}),tr(e,"table")&&t.push({onItemClick:()=>{td(e,{type:"table",content:{type:"tableContent",rows:[{cells:["","",""]},{cells:["","",""]}]}})},badge:void 0,key:"table",...e.dictionary.slash_menu.table}),tr(e,"image",{url:"string"})&&t.push({onItemClick:()=>{var t;let r=td(e,{type:"image"});null==(t=e.getExtension(em))||t.showMenu(r.id)},key:"image",...e.dictionary.slash_menu.image}),tr(e,"video",{url:"string"})&&t.push({onItemClick:()=>{var t;let r=td(e,{type:"video"});null==(t=e.getExtension(em))||t.showMenu(r.id)},key:"video",...e.dictionary.slash_menu.video}),tr(e,"audio",{url:"string"})&&t.push({onItemClick:()=>{var t;let r=td(e,{type:"audio"});null==(t=e.getExtension(em))||t.showMenu(r.id)},key:"audio",...e.dictionary.slash_menu.audio}),tr(e,"file",{url:"string"})&&t.push({onItemClick:()=>{var t;let r=td(e,{type:"file"});null==(t=e.getExtension(em))||t.showMenu(r.id)},key:"file",...e.dictionary.slash_menu.file}),tr(e,"heading",{level:"number",isToggleable:"boolean"})&&(e.schema.blockSchema.heading.propSchema.level.values||[]).filter(e=>e<=3).forEach(r=>{t.push({onItemClick:()=>{td(e,{type:"heading",props:{level:r,isToggleable:!0}})},key:1===r?"toggle_heading":`toggle_heading_${r}`,...e.dictionary.slash_menu[1===r?"toggle_heading":`toggle_heading_${r}`]})}),tr(e,"heading",{level:"number"})&&(e.schema.blockSchema.heading.propSchema.level.values||[]).filter(e=>e>3).forEach(r=>{t.push({onItemClick:()=>{td(e,{type:"heading",props:{level:r}})},badge:B(`Mod-Alt-${r}`),key:`heading_${r}`,...e.dictionary.slash_menu[`heading_${r}`]})}),t.push({onItemClick:()=>{var t;null==(t=e.getExtension(tc))||t.openSuggestionMenu(":",{deleteTriggerCharacter:!0,ignoreQueryLength:!0})},key:"emoji",...e.dictionary.slash_menu.emoji}),t}function tp(e,t){return e.filter(({title:e,aliases:r})=>e.toLowerCase().includes(t.toLowerCase())||r&&0!==r.filter(e=>e.toLowerCase().includes(t.toLowerCase())).length)}let tu={audio:ek(),bulletListItem:eV(),checkListItem:eW(),codeBlock:eS(),divider:e_(),file:eM(),heading:eL(),image:eH(),numberedListItem:eq(),paragraph:eJ(),quote:eQ(),table:(n={node:e5,type:"table",content:"table"},o=[(0,p.c)({key:"table-extensions",tiptapExtensions:[e0,e4,e2,e3,e6]}),(0,p.c)({key:"table-keyboard-delete",keyboardShortcuts:{Backspace:({editor:e})=>{if(!(e.prosemirrorState.selection instanceof i.rn))return!1;let t=e.getTextCursorPosition().block,r=t.content,n=0;for(let e of r.rows)for(let t of e.cells){if("type"in t&&t.content.length>0||!("type"in t)&&t.length>0)return!1;n++}let o=0;return e.prosemirrorState.selection.forEachCell(()=>{o++}),!(o<n)&&(e.transact(()=>{(e.getPrevBlock(t)||e.getNextBlock(t))&&e.setTextCursorPosition(t),e.removeBlocks([t])}),!0)}}})],{config:{type:n.type,content:n.content,propSchema:e1},implementation:{node:n.node,render:H,toExternalHTML:H},extensions:o}),toggleListItem:eK(),video:tt()},tf=ee({type:"textColor",propSchema:"string"},{render:()=>{let e=document.createElement("span");return{dom:e,contentDOM:e}},toExternalHTML:e=>{let t=document.createElement("span");return e!==ec.textColor.default&&(t.style.color=e in ea?ea[e].text:e),{dom:t,contentDOM:t}},parse:e=>{if("SPAN"===e.tagName&&e.style.color)return e.style.color}}),tm=ee({type:"backgroundColor",propSchema:"string"},{render:()=>{let e=document.createElement("span");return{dom:e,contentDOM:e}},toExternalHTML:e=>{let t=document.createElement("span");return e!==ec.backgroundColor.default&&(t.style.backgroundColor=e in ea?ea[e].background:e),{dom:t,contentDOM:t}},parse:e=>{if("SPAN"===e.tagName&&e.style.backgroundColor)return e.style.backgroundColor}}),tg={bold:X(y,"boolean"),italic:X(_,"boolean"),underline:X(M,"boolean"),strike:X(x,"boolean"),code:X(k,"boolean"),textColor:tf,backgroundColor:tm},tE=(Z(tg),{text:{config:"text",implementation:{}},link:{config:"link",implementation:{}}}),tb=K(tE)},92619:e=>{var t={675:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,i=l(e),s=i[0],a=i[1],c=new o((s+a)*3/4-a),d=0,h=a>0?s-4:s;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[d++]=t>>16&255,c[d++]=t>>8&255,c[d++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[d++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[d++]=t>>8&255,c[d++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],s=0,a=n-o;s<a;s+=16383)i.push(function(e,t,n){for(var o,i=[],s=t;s<n;s+=3)o=(e[s]<<16&0xff0000)+(e[s+1]<<8&65280)+(255&e[s+2]),i.push(r[o>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return i.join("")}(e,s,s+16383>a?a:s+16383));return 1===o?i.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===o&&i.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),i.join("")};for(var r=[],n=[],o="u">typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=i.length;s<a;++s)r[s]=i[s],n[i.charCodeAt(s)]=s;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},72:function(e,t,r){"use strict";var n=r(675),o=r(783),i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,o=t;if(("string"!=typeof o||""===o)&&(o="utf8"),!a.isEncoding(o))throw TypeError("Unknown encoding: "+o);var i=0|u(n,o),l=s(i),c=l.write(n,o);return c!==i&&(l=l.slice(0,c)),l}if(ArrayBuffer.isView(e))return h(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(I(e,ArrayBuffer)||e&&I(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(I(e,SharedArrayBuffer)||e&&I(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),a.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var d=e.valueOf&&e.valueOf();if(null!=d&&d!==e)return a.from(d,t,r);var f=function(e){if(a.isBuffer(e)){var t=0|p(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?s(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(f)return f;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return c(e),s(e<0?0:0|p(e))}function h(e){for(var t=e.length<0?0:0|p(e.length),r=s(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=a,t.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!a.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(c(e),e<=0)?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)},a.allocUnsafe=function(e){return d(e)},a.allocUnsafeSlow=function(e){return d(e)};function p(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function u(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||I(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return S(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return _(e).length;default:if(o)return n?-1:S(e).length;t=(""+t).toLowerCase(),o=!0}}function f(e,t,r){var o,i,s,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=x[e[i]];return o}(this,t,r);case"utf8":case"utf-8":return b(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}(this,t,r);case"base64":return o=this,i=t,s=r,0===i&&s===o.length?n.fromByteArray(o):n.fromByteArray(o.slice(i,s));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}(this,t,r);default:if(a)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function m(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,o){var i;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(i=r*=1)!=i&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(o)return -1;else r=e.length-1;else if(r<0)if(!o)return -1;else r=0;if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:E(e,t,r,n,o);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(o)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return E(e,[t],r,n,o)}throw TypeError("val must be string, number or Buffer")}function E(e,t,r,n,o){var i,s=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;s=2,a/=2,l/=2,r/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var d=-1;for(i=r;i<a;i++)if(c(e,i)===c(t,-1===d?0:i-d)){if(-1===d&&(d=i),i-d+1===l)return d*s}else -1!==d&&(i-=i-d),d=-1}else for(r+l>a&&(r=a-l),i=r;i>=0;i--){for(var h=!0,p=0;p<l;p++)if(c(e,i+p)!==c(t,p)){h=!1;break}if(h)return i}return -1}a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(I(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),I(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:+(n<r)},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=a.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var i=e[r];if(I(i,Uint8Array)&&(i=a.from(i)),!a.isBuffer(i))throw TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},a.byteLength=u,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?b(this,0,e):f.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,o){if(I(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,o>>>=0,this===e)return 0;for(var i=o-n,s=r-t,l=Math.min(i,s),c=this.slice(n,o),d=e.slice(t,r),h=0;h<l;++h)if(c[h]!==d[h]){i=c[h],s=d[h];break}return i<s?-1:+(s<i)},a.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)};function b(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,s,a,l,c=e[o],d=null,h=c>239?4:c>223?3:c>191?2:1;if(o+h<=r)switch(h){case 1:c<128&&(d=c);break;case 2:(192&(i=e[o+1]))==128&&(l=(31&c)<<6|63&i)>127&&(d=l);break;case 3:i=e[o+1],s=e[o+2],(192&i)==128&&(192&s)==128&&(l=(15&c)<<12|(63&i)<<6|63&s)>2047&&(l<55296||l>57343)&&(d=l);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],(192&i)==128&&(192&s)==128&&(192&a)==128&&(l=(15&c)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(d=l)}null===d?(d=65533,h=1):d>65535&&(d-=65536,n.push(d>>>10&1023|55296),d=56320|1023&d),n.push(d),o+=h}var p=n,u=p.length;if(u<=4096)return String.fromCharCode.apply(String,p);for(var f="",m=0;m<u;)f+=String.fromCharCode.apply(String,p.slice(m,m+=4096));return f}function y(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function T(e,t,r,n,o,i){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function v(e,t,r,n,o,i){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function k(e,t,r,n,i){return t*=1,r>>>=0,i||v(e,t,r,4,34028234663852886e22,-34028234663852886e22),o.write(e,t,r,n,23,4),r+4}function A(e,t,r,n,i){return t*=1,r>>>=0,i||v(e,t,r,8,17976931348623157e292,-17976931348623157e292),o.write(e,t,r,n,52,8),r+8}a.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o,i,s,a,l,c,d,h,p=this.length-t;if((void 0===r||r>p)&&(r=p),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var u=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var a,l=parseInt(t.substr(2*s,2),16);if((a=l)!=a)break;e[r+s]=l}return s}(this,e,t,r);case"utf8":case"utf-8":return o=t,i=r,N(S(e,this.length-o),this,o,i);case"ascii":return s=t,a=r,N(w(e),this,s,a);case"latin1":case"binary":return function(e,t,r,n){return N(w(t),e,r,n)}(this,e,t,r);case"base64":return l=t,c=r,N(_(e),this,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d=t,h=r,N(function(e,t){for(var r,n,o=[],i=0;i<e.length&&!((t-=2)<0);++i)n=(r=e.charCodeAt(i))>>8,o.push(r%256),o.push(n);return o}(e,this.length-d),this,d,h);default:if(u)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),u=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,a.prototype),n},a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},a.prototype.readUInt8=function(e,t){return e>>>=0,t||y(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||y(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||y(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},a.prototype.readInt8=function(e,t){return(e>>>=0,t||y(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||y(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||y(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||y(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||y(e,4,this.length),o.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||y(e,8,this.length),o.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;T(this,e,t,r,o,0)}var i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},a.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var o=Math.pow(2,8*r)-1;T(this,e,t,r,o,0)}var i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||T(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||T(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||T(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var o=Math.pow(2,8*r-1);T(this,e,t,r,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var o=Math.pow(2,8*r-1);T(this,e,t,r,o-1,-o)}var i=r-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s|0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||T(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||T(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||T(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return k(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return k(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return A(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return A(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var i=o-1;i>=0;--i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return o},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var o,i=e.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(e=i)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=a.isBuffer(e)?e:a.from(e,n),l=s.length;if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=s[o%l]}return this};var C=/[^+/0-9A-Za-z-_]/g;function S(e,t){t=t||1/0;for(var r,n=e.length,o=null,i=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319||s+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return i}function w(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function _(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(C,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function N(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length)&&!(o>=e.length);++o)t[o+r]=e[o];return o}function I(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var x=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,o=0;o<16;++o)t[n+o]=e[r]+e[o];return t}()},783:function(e,t){t.read=function(e,t,r,n,o){var i,s,a=8*o-n-1,l=(1<<a)-1,c=l>>1,d=-7,h=r?o-1:0,p=r?-1:1,u=e[t+h];for(h+=p,i=u&(1<<-d)-1,u>>=-d,d+=a;d>0;i=256*i+e[t+h],h+=p,d-=8);for(s=i&(1<<-d)-1,i>>=-d,d+=n;d>0;s=256*s+e[t+h],h+=p,d-=8);if(0===i)i=1-c;else{if(i===l)return s?NaN:1/0*(u?-1:1);s+=Math.pow(2,n),i-=c}return(u?-1:1)*s*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var s,a,l,c=8*i-o-1,d=(1<<c)-1,h=d>>1,p=5960464477539062e-23*(23===o),u=n?0:i-1,f=n?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(a=+!!isNaN(t),s=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+h>=1?t+=p/l:t+=p*Math.pow(2,1-h),t*l>=2&&(s++,l/=2),s+h>=d?(a=0,s=d):s+h>=1?(a=(t*l-1)*Math.pow(2,o),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;e[r+u]=255&a,u+=f,a/=256,o-=8);for(s=s<<o|a,c+=o;c>0;e[r+u]=255&s,u+=f,s/=256,c-=8);e[r+u-f]|=128*m}}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var i=r[e]={exports:{}},s=!0;try{t[e](i,i.exports,n),s=!1}finally{s&&delete r[e]}return i.exports}n.ab="//",e.exports=n(72)},94577:(e,t,r)=>{"use strict";e.exports=r(99617)},97144:(e,t,r)=>{"use strict";r.d(t,{$f:()=>x,G2:()=>y,I$:()=>C,Im:()=>O,Qv:()=>l,Sd:()=>E,Z1:()=>S,_G:()=>d,_e:()=>u,bh:()=>T,eB:()=>c,eT:()=>g,ec:()=>M,hy:()=>_,ic:()=>s,iz:()=>w,pC:()=>k,yY:()=>v,y_:()=>D});var n=r(8242),o=r(27050),i=r(76865);let s=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function a(e,t){let{$cursor:r}=e.selection;return r&&(t?t.endOfTextblock("backward",e):!(r.parentOffset>0))?r:null}let l=(e,t,r)=>{let s=a(e,r);if(!s)return!1;let l=f(s);if(!l){let r=s.blockRange(),o=r&&(0,n.jP)(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)}let c=l.nodeBefore;if(N(e,l,t,-1))return!0;if(0==s.parent.content.size&&(p(c,"end")||i.nh.isSelectable(c)))for(let r=s.depth;;r--){let a=(0,n.$L)(e.doc,s.before(r),s.after(r),o.Ji.empty);if(a&&a.slice.size<a.to-a.from){if(t){let r=e.tr.step(a);r.setSelection(p(c,"end")?i.LN.findFrom(r.doc.resolve(r.mapping.map(l.pos,-1)),-1):i.nh.create(r.doc,l.pos-c.nodeSize)),t(r.scrollIntoView())}return!0}if(1==r||s.node(r-1).childCount>1)break}return!!c.isAtom&&l.depth==s.depth-1&&(t&&t(e.tr.delete(l.pos-c.nodeSize,l.pos).scrollIntoView()),!0)},c=(e,t,r)=>{let n=a(e,r);if(!n)return!1;let o=f(n);return!!o&&h(e,o,t)},d=(e,t,r)=>{let n=m(e,r);if(!n)return!1;let o=b(n);return!!o&&h(e,o,t)};function h(e,t,r){let s=t.nodeBefore,a=t.pos-1;for(;!s.isTextblock;a--){if(s.type.spec.isolating)return!1;let e=s.lastChild;if(!e)return!1;s=e}let l=t.nodeAfter,c=t.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let e=l.firstChild;if(!e)return!1;l=e}let d=(0,n.$L)(e.doc,a,c,o.Ji.empty);if(!d||d.from!=a||d instanceof n.Ln&&d.slice.size>=c-a)return!1;if(r){let t=e.tr.step(d);t.setSelection(i.U3.create(t.doc,a)),r(t.scrollIntoView())}return!0}function p(e,t,r=!1){for(let n=e;n;n="start"==t?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(r&&1!=n.childCount)break}return!1}let u=(e,t,r)=>{let{$head:n,empty:o}=e.selection,s=n;if(!o)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("backward",e):n.parentOffset>0)return!1;s=f(n)}let a=s&&s.nodeBefore;return!!a&&!!i.nh.isSelectable(a)&&(t&&t(e.tr.setSelection(i.nh.create(e.doc,s.pos-a.nodeSize)).scrollIntoView()),!0)};function f(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function m(e,t){let{$cursor:r}=e.selection;return r&&(t?t.endOfTextblock("forward",e):!(r.parentOffset<r.parent.content.size))?r:null}let g=(e,t,r)=>{let s=m(e,r);if(!s)return!1;let a=b(s);if(!a)return!1;let l=a.nodeAfter;if(N(e,a,t,1))return!0;if(0==s.parent.content.size&&(p(l,"start")||i.nh.isSelectable(l))){let r=(0,n.$L)(e.doc,s.before(),s.after(),o.Ji.empty);if(r&&r.slice.size<r.to-r.from){if(t){let n=e.tr.step(r);n.setSelection(p(l,"start")?i.LN.findFrom(n.doc.resolve(n.mapping.map(a.pos)),1):i.nh.create(n.doc,n.mapping.map(a.pos))),t(n.scrollIntoView())}return!0}}return!!l.isAtom&&a.depth==s.depth-1&&(t&&t(e.tr.delete(a.pos,a.pos+l.nodeSize).scrollIntoView()),!0)},E=(e,t,r)=>{let{$head:n,empty:o}=e.selection,s=n;if(!o)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)return!1;s=b(n)}let a=s&&s.nodeAfter;return!!a&&!!i.nh.isSelectable(a)&&(t&&t(e.tr.setSelection(i.nh.create(e.doc,s.pos)).scrollIntoView()),!0)};function b(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let r=e.node(t);if(e.index(t)+1<r.childCount)return e.doc.resolve(e.after(t+1));if(r.type.spec.isolating)break}return null}let y=(e,t)=>{let r=e.selection,o=r instanceof i.nh,s;if(o){if(r.node.isTextblock||!(0,n.n9)(e.doc,r.from))return!1;s=r.from}else if(null==(s=(0,n.N0)(e.doc,r.from,-1)))return!1;if(t){let r=e.tr.join(s);o&&r.setSelection(i.nh.create(r.doc,s-e.doc.resolve(s).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0},T=(e,t)=>{let r=e.selection,o;if(r instanceof i.nh){if(r.node.isTextblock||!(0,n.n9)(e.doc,r.to))return!1;o=r.to}else if(null==(o=(0,n.N0)(e.doc,r.to,1)))return!1;return t&&t(e.tr.join(o).scrollIntoView()),!0},v=(e,t)=>{let{$from:r,$to:o}=e.selection,i=r.blockRange(o),s=i&&(0,n.jP)(i);return null!=s&&(t&&t(e.tr.lift(i,s).scrollIntoView()),!0)},k=(e,t)=>{let{$head:r,$anchor:n}=e.selection;return!!r.parent.type.spec.code&&!!r.sameParent(n)&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function A(e){for(let t=0;t<e.edgeCount;t++){let{type:r}=e.edge(t);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}let C=(e,t)=>{let{$head:r,$anchor:n}=e.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return!1;let o=r.node(-1),s=r.indexAfter(-1),a=A(o.contentMatchAt(s));if(!a||!o.canReplaceWith(s,s,a))return!1;if(t){let n=r.after(),o=e.tr.replaceWith(n,n,a.createAndFill());o.setSelection(i.LN.near(o.doc.resolve(n),1)),t(o.scrollIntoView())}return!0},S=(e,t)=>{let r=e.selection,{$from:n,$to:o}=r;if(r instanceof i.i5||n.parent.inlineContent||o.parent.inlineContent)return!1;let s=A(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){let r=(!n.parentOffset&&o.index()<o.parent.childCount?n:o).pos,a=e.tr.insert(r,s.createAndFill());a.setSelection(i.U3.create(a.doc,r+1)),t(a.scrollIntoView())}return!0},w=(e,t)=>{let{$cursor:r}=e.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let o=r.before();if((0,n.zy)(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let o=r.blockRange(),i=o&&(0,n.jP)(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)},_=(e,t)=>{let{$from:r,to:n}=e.selection,o,s=r.sharedDepth(n);return 0!=s&&(o=r.before(s),t&&t(e.tr.setSelection(i.nh.create(e.doc,o))),!0)};function N(e,t,r,s){let a,l,c,d=t.nodeBefore,h=t.nodeAfter,u,f,m=d.type.spec.isolating||h.type.spec.isolating;if(!m&&(a=t.nodeBefore,l=t.nodeAfter,c=t.index(),a&&l&&a.type.compatibleContent(l.type)&&(!a.content.size&&t.parent.canReplace(c-1,c)?(r&&r(e.tr.delete(t.pos-a.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(c,c+1)&&!!(l.isTextblock||(0,n.n9)(e.doc,t.pos))&&(r&&r(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let g=!m&&t.parent.canReplace(t.index(),t.index()+1);if(g&&(u=(f=d.contentMatchAt(d.childCount)).findWrapping(h.type))&&f.matchType(u[0]||h.type).validEnd){if(r){let i=t.pos+h.nodeSize,s=o.FK.empty;for(let e=u.length-1;e>=0;e--)s=o.FK.from(u[e].create(null,s));s=o.FK.from(d.copy(s));let a=e.tr.step(new n.Wg(t.pos-1,i,t.pos,i,new o.Ji(s,1,0),u.length,!0)),l=a.doc.resolve(i+2*u.length);l.nodeAfter&&l.nodeAfter.type==d.type&&(0,n.n9)(a.doc,l.pos)&&a.join(l.pos),r(a.scrollIntoView())}return!0}let E=h.type.spec.isolating||s>0&&m?null:i.LN.findFrom(t,1),b=E&&E.$from.blockRange(E.$to),y=b&&(0,n.jP)(b);if(null!=y&&y>=t.depth)return r&&r(e.tr.lift(b,y).scrollIntoView()),!0;if(g&&p(h,"start",!0)&&p(d,"end")){let i=d,s=[];for(;s.push(i),!i.isTextblock;)i=i.lastChild;let a=h,l=1;for(;!a.isTextblock;a=a.firstChild)l++;if(i.canReplace(i.childCount,i.childCount,a.content)){if(r){let i=o.FK.empty;for(let e=s.length-1;e>=0;e--)i=o.FK.from(s[e].copy(i));r(e.tr.step(new n.Wg(t.pos-s.length,t.pos+h.nodeSize,t.pos+l,t.pos+h.nodeSize-l,new o.Ji(i,s.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function I(e){return function(t,r){let n=t.selection,o=e<0?n.$from:n.$to,s=o.depth;for(;o.node(s).isInline;){if(!s)return!1;s--}return!!o.node(s).isTextblock&&(r&&r(t.tr.setSelection(i.U3.create(t.doc,e<0?o.start(s):o.end(s)))),!0)}}let x=I(-1),M=I(1);function O(e,t=null){return function(r,o){let{$from:i,$to:s}=r.selection,a=i.blockRange(s),l=a&&(0,n.oM)(a,e,t);return!!l&&(o&&o(r.tr.wrap(a,l).scrollIntoView()),!0)}}function D(e,t=null){return function(r,n){let o=!1;for(let n=0;n<r.selection.ranges.length&&!o;n++){let{$from:{pos:i},$to:{pos:s}}=r.selection.ranges[n];r.doc.nodesBetween(i,s,(n,i)=>{if(o)return!1;if(!(!n.isTextblock||n.hasMarkup(e,t)))if(n.type==e)o=!0;else{let t=r.doc.resolve(i),n=t.index();o=t.parent.canReplaceWith(n,n+1,e)}})}if(!o)return!1;if(n){let o=r.tr;for(let n=0;n<r.selection.ranges.length;n++){let{$from:{pos:i},$to:{pos:s}}=r.selection.ranges[n];o.setBlockType(i,s,e,t)}n(o.scrollIntoView())}return!0}}function R(...e){return function(t,r,n){for(let o=0;o<e.length;o++)if(e[o](t,r,n))return!0;return!1}}let L=R(s,l,u),P=R(s,g,E),B={Enter:R(k,S,w,(e,t)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof i.nh&&e.selection.node.isBlock)return!!r.parentOffset&&!!(0,n.zy)(e.doc,r.pos)&&(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],a,l,c=!1,d=!1;for(let e=r.depth;;e--){if(r.node(e).isBlock){let t;c=r.end(e)==r.pos+(r.depth-e),d=r.start(e)==r.pos-(r.depth-e),l=A(r.node(e-1).contentMatchAt(r.indexAfter(e-1)));s.unshift(t||(c&&l?{type:l}:null)),a=e;break}if(1==e)return!1;s.unshift(null)}let h=e.tr;(e.selection instanceof i.U3||e.selection instanceof i.i5)&&h.deleteSelection();let p=h.mapping.map(r.pos),u=(0,n.zy)(h.doc,p,s.length,s);if(u||(s[0]=l?{type:l}:null,u=(0,n.zy)(h.doc,p,s.length,s)),!u)return!1;if(h.split(p,s.length,s),!c&&d&&r.node(a).type!=l){let e=h.mapping.map(r.before(a)),t=h.doc.resolve(e);l&&r.node(a-1).canReplaceWith(t.index(),t.index()+1,l)&&h.setNodeMarkup(h.mapping.map(r.before(a)),l)}return t&&t(h.scrollIntoView()),!0}),"Mod-Enter":C,Backspace:L,"Mod-Backspace":L,"Shift-Backspace":L,Delete:P,"Mod-Delete":P,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new i.i5(e.doc))),!0)},F={"Ctrl-h":B.Backspace,"Alt-Backspace":B["Mod-Backspace"],"Ctrl-d":B.Delete,"Ctrl-Alt-Backspace":B["Mod-Delete"],"Alt-Delete":B["Mod-Delete"],"Alt-d":B["Mod-Delete"],"Ctrl-a":x,"Ctrl-e":M};for(let e in B)F[e]=B[e];"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform()},97810:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(90425).A)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])},98307:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});let n=(0,r(90425).A)("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]])},99617:(e,t,r)=>{"use strict";var n=r(12115),o=r(8039),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=o.useSyncExternalStore,a=n.useRef,l=n.useEffect,c=n.useMemo,d=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,n,o){var h=a(null);if(null===h.current){var p={hasValue:!1,value:null};h.current=p}else p=h.current;var u=s(e,(h=c(function(){function e(e){if(!l){if(l=!0,s=e,e=n(e),void 0!==o&&p.hasValue){var t=p.value;if(o(t,e))return a=t}return a=e}if(t=a,i(s,e))return t;var r=n(e);return void 0!==o&&o(t,r)?(s=e,t):(s=e,a=r)}var s,a,l=!1,c=void 0===r?null:r;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,r,n,o]))[0],h[1]);return l(function(){p.hasValue=!0,p.value=u},[u]),d(u),u}}}]);
|