1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5654],{11401:function(e,t,i){let n,o;i.d(t,{BM:function(){return ey},Di:function(){return eT},G6:function(){return ec},HC:function(){return eb},HF:function(){return eq},Kx:function(){return eQ},P9:function(){return tg},Ro:function(){return e_},Rp:function(){return ef},SJ:function(){return tc},Sh:function(){return eZ},Vj:function(){return e0},Xc:function(){return eg},Xy:function(){return ip},am:function(){return tb},an:function(){return eY},aw:function(){return eK},cE:function(){return tp},e8:function(){return G},eD:function(){return el},kQ:function(){return ev},kg:function(){return eL},kl:function(){return ez},lt:function(){return tf},lw:function(){return iv},lz:function(){return ew},px:function(){return e$},rP:function(){return eS},rn:function(){return em},tA:function(){return eA},tp:function(){return iy},vz:function(){return ik},w2:function(){return tk},xQ:function(){return ed},xg:function(){return tv},yD:function(){return iw}});var r=i(12806),s=i(87556),a=i(13888),l=i(70575),d=i(5865),c=i(2376),h=i(5410),p=i(73722),u=i(67937),m=i(57355),f=i(73816),g=i(4281),b=i(48510),v=i(658),k=i(43626),y=i(33991),w=i(78649),C=i(70789),E=i(69313),S=i(18356),M=i(47126),x=i(92999),L=i(79769),T=i(84348),A=i(34005),H=i(62115),B=i(73397),_=i(94903),N=i(35525),I=i(91842),P=i(99404),U=i(52701),V=Object.defineProperty,O=(e,t,i)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,D=(e,t,i)=>(O(e,"symbol"!=typeof t?t+"":t,i),i);let R={slash_menu:{heading:{title:"Heading 1",subtext:"Used for a top-level heading",aliases:["h","heading1","h1"],group:"Headings"},heading_2:{title:"Heading 2",subtext:"Used for key sections",aliases:["h2","heading2","subheading"],group:"Headings"},heading_3:{title:"Heading 3",subtext:"Used for subsections and group headings",aliases:["h3","heading3","subheading"],group:"Headings"},numbered_list:{title:"Numbered List",subtext:"Used to display a numbered list",aliases:["ol","li","list","numberedlist","numbered list"],group:"Basic blocks"},bullet_list:{title:"Bullet List",subtext:"Used to display an unordered list",aliases:["ul","li","list","bulletlist","bullet list"],group:"Basic blocks"},check_list:{title:"Check List",subtext:"Used to display a list with checkboxes",aliases:["ul","li","list","checklist","check list","checked list","checkbox"],group:"Basic blocks"},paragraph:{title:"Paragraph",subtext:"Used for the body of your document",aliases:["p","paragraph"],group:"Basic blocks"},table:{title:"Table",subtext:"Used for tables",aliases:["table"],group:"Advanced"},image:{title:"Image",subtext:"Insert an image",aliases:["image","imageUpload","upload","img","picture","media","url"],group:"Media"},video:{title:"Video",subtext:"Insert a video",aliases:["video","videoUpload","upload","mp4","film","media","url"],group:"Media"},audio:{title:"Audio",subtext:"Insert audio",aliases:["audio","audioUpload","upload","mp3","sound","media","url"],group:"Media"},file:{title:"File",subtext:"Insert a file",aliases:["file","upload","embed","media","url"],group:"Media"}},placeholders:{default:"Enter text or type '/' for commands",heading:"Heading",bulletListItem:"List",numberedListItem:"List",checkListItem:"List"},file_blocks:{image:{add_button_text:"Add image"},video:{add_button_text:"Add video"},audio:{add_button_text:"Add audio"},file:{add_button_text:"Add file"}},side_menu:{add_block_label:"Add block",drag_handle_label:"Open block menu"},drag_handle:{delete_menuitem:"Delete",colors_menuitem:"Colors"},table_handle:{delete_column_menuitem:"Delete column",delete_row_menuitem:"Delete row",add_left_menuitem:"Add column left",add_right_menuitem:"Add column right",add_above_menuitem:"Add row above",add_below_menuitem:"Add row below"},suggestion_menu:{no_items_title:"No items found",loading:"Loadingâ¦"},color_picker:{text_title:"Text",background_title:"Background",colors:{default:"Default",gray:"Gray",brown:"Brown",red:"Red",orange:"Orange",yellow:"Yellow",green:"Green",blue:"Blue",purple:"Purple",pink:"Pink"}},formatting_toolbar:{bold:{tooltip:"Bold",secondary_tooltip:"Mod+B"},italic:{tooltip:"Italic",secondary_tooltip:"Mod+I"},underline:{tooltip:"Underline",secondary_tooltip:"Mod+U"},strike:{tooltip:"Strike",secondary_tooltip:"Mod+Shift+X"}
1,code:{tooltip:"Code",secondary_tooltip:""},colors:{tooltip:"Colors"},link:{tooltip:"Create link",secondary_tooltip:"Mod+K"},file_caption:{tooltip:"Edit caption",input_placeholder:"Edit caption"},file_replace:{tooltip:{image:"Replace image",video:"Replace video",audio:"Replace audio",file:"Replace file"}},file_rename:{tooltip:{image:"Rename image",video:"Rename video",audio:"Rename audio",file:"Rename file"},input_placeholder:{image:"Rename image",video:"Rename video",audio:"Rename audio",file:"Rename file"}},file_download:{tooltip:{image:"Download image",video:"Download video",audio:"Download audio",file:"Download file"}},file_delete:{tooltip:{image:"Delete image",video:"Delete video",audio:"Delete audio",file:"Delete file"}},file_preview_toggle:{tooltip:"Toggle preview"},nest:{tooltip:"Nest block",secondary_tooltip:"Tab"},unnest:{tooltip:"Unnest block",secondary_tooltip:"Shift+Tab"},align_left:{tooltip:"Align text left"},align_center:{tooltip:"Align text center"},align_right:{tooltip:"Align text right"},align_justify:{tooltip:"Justify text"}},file_panel:{upload:{title:"Upload",file_placeholder:{image:"Upload image",video:"Upload video",audio:"Upload audio",file:"Upload file"},upload_error:"Error: Upload failed"},embed:{title:"Embed",embed_button:{image:"Embed image",video:"Embed video",audio:"Embed audio",file:"Embed file"},url_placeholder:"Enter URL"}},link_toolbar:{delete:{tooltip:"Remove link"},edit:{text:"Edit link",tooltip:"Edit"},open:{tooltip:"Open in new tab"},form:{title_placeholder:"Edit title",url_placeholder:"Edit URL"}},generic:{ctrl_shortcut:"Ctrl"}},z=d.hj.create({name:"uniqueID",priority:1e4,addOptions:()=>({attributeName:"id",types:[],generateID:()=>
1{if("u">typeof window&&window.__TEST_OPTIONS){let e=window.__TEST_OPTIONS;return void 0===e.mockID?e.mockID=0:e.mockID++,e.mockID.toString()}return(0,h.Z)()},filterTransaction:null}),addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:e=>e.getAttribute(`data-${this.options.attributeName}`),renderHTML:e=>({[`data-${this.options.attributeName}`]:e[this.options.attributeName]})}}}]},addProseMirrorPlugins(){let e=null,t=!1;return[new c.Sy({key:new c.H$("uniqueID"),appendTransaction:(e,t,i)=>{let n=e.some(e=>e.docChanged)&&!t.doc.eq(i.doc),o=this.options.filterTransaction&&e.some(e=>{let t,i;return!(!(null===(i=(t=this.options).filterTransaction)||void 0===i)&&i.call(t,e))});if(!n||o)return;let{tr:r}=i,{types:s,attributeName:a,generateID:l}=this.options,c=(0,d.XP)(t.doc,e),{mapping:h}=c;if((0,d.QC)(c).forEach(({newRange:e})=>{var n;let o=(0,d.b5)(i.doc,e,e=>s.includes(e.type.name)),c=function(e,t=JSON.stringify){let i={};return e.filter(e=>{let n=t(e);return!Object.prototype.hasOwnProperty.call(i,n)&&(i[n]=!0)})}((n=o.map(({node:e})=>e.attrs[a]).filter(e=>null!==e)).filter((e,t)=>n.indexOf(e)!==t));o.forEach(({node:e,pos:n})=>{let o;let s=null===(o=r.doc.nodeAt(n))||void 0===o?void 0:o.attrs[a];if(null===s){let o=t.doc.type.createAndFill().content;if(null===t.doc.content.findDiffStart(o)){let t=JSON.parse(JSON.stringify(i.doc.toJSON()));if(t.content[0].content[0].attrs.id="initialBlockId",JSON.stringify(t.content)===JSON.stringify(o.toJSON())){r.setNodeMarkup(n,void 0,{...e.attrs,[a]:"initialBlockId"});return}}r.setNodeMarkup(n,void 0,{...e.attrs,[a]:l()});return}let{deleted:d}=h.invert().mapResult(n);d&&c.includes(s)&&r.setNodeMarkup(n,void 0,{...e.attrs,[a]:l()})})}),r.steps.length)return r},view(t){let i=i=>{let n;e=!(null===(n=t.dom.parentElement)||void 0===n)&&n.contains(i.target)?t.dom.parentElement:null};return window.addEventListener("dragstart",i),{destroy(){window.removeEventListener("dragstart",i)}}},props:{handleDOMEvents:{drop:(i,n)=>{let o;return(e!==i.dom.parentElement||(null===(o=n.dataTransfer)||void 0===o?void 0:o.effectAllowed)==="copy")&&(e=null,t=!0),!1},paste:()=>(t=!0,!1)},transformPasted:e=>{if(!t)return e;let{types:i,attributeName:n}=this.options,o=e=>{let t=[];return e.forEach(e=>{if(e.isText){t.push(e);return}if(!i.includes(e.type.name)){t.push(e.copy(o(e.content)));return}let r=e.type.create({...e.attrs,[n]:null},o(e.content),e.marks);t.push(r)}),r.HY.from(t)};return t=!1,new r.p2(o(e.content),e.openStart,e.openEnd)}}})]}});function $(e){let t=e.attrs.id,i=e.firstChild,n=i.type,o=2===e.childCount?e.lastChild.childCount:0;return{id:t,node:e,contentNode:i,contentType:n,numChildBlocks:o}}function F(e,t){let i=e.nodeSize-2;if(t<=1)for(t=2;"blockContainer"!==e.resolve(t).parent.type.name&&t<i;)t++;else if(t>=i)for(t=i-1;"blockContainer"!==e.resolve(t).parent.type.name&&t>1;)t--;"blockGroup"===e.resolve(t).parent.type.name&&t++;let n=e.resolve(t),o=n.depth,r=n.node(o),s=o;for(;;){if(s<0)throw Error("Could not find blockContainer node. This can only happen if the underlying BlockNote schema has been edited.");if("blockContainer"===r.type.name)break;s-=1,r=n.node(s)}let{id:a,contentNode:l,contentType:d,numChildBlocks:c}=$(r);return{id:a,node:r,contentNode:l,contentType:d,numChildBlocks:c,startPos:n.start(s),endPos:n.end(s),depth:s}}function j(e){return"link"===e.type}function q(e){return"string"!=typeof e&&"text"===e.type}
1class Z extends Error{constructor(e){super(`Unreachable case: ${e}`)}}function G(e,t=!0){let{"data-test":i,...n}=e;if(Object.keys(n).length>0&&t)throw Error("Object must be empty "+JSON.stringify(e))}function W(e,t,i){let n=[];for(let[o,r]of Object.entries(e.styles)){let e=i[o];if(!e)throw Error(`style ${o} not found in styleSchema`);if("boolean"===e.propSchema)n.push(t.mark(o));else if("string"===e.propSchema)n.push(t.mark(o,{stringValue:r}));else throw new Z(e.propSchema)}return e.text.split(/(\n)/g).filter(e=>e.length>0).map(e=>e===` 2`?t.nodes.hardBreak.create():t.text(e,n))}function K(e,t,i){let n=[];if("string"==typeof e)return n.push(...W({type:"text",text:e,styles:{}},t,i)),n;for(let o of e)n.push(...W(o,t,i));return n}function Y(e,t,i){let n=[];for(let o of e)"string"==typeof o?n.push(...K(o,t,i)):"string"!=typeof o&&"link"===o.type?n.push(...function(e,t,i){let n=t.marks.link.create({href:e.href});return K(e.content,t,i).map(e=>{if("text"===e.type.name)return e.mark([...e.marks,n]);if("hardBreak"===e.type.name)return e;throw Error("unexpected node type")})}(o,t,i)):q(o)?n.push(...K([o],t,i)):n.push(X(o,t,i));return n}function J(e,t,i){let n=[];for(let o of e.rows){let e=[];for(let n of o.cells){let o;if(n){if("string"==typeof n)o=t.nodes.tableParagraph.create({},t.text(n));else{let e=Y(n,t,i);o=t.nodes.tableParagraph.create({},e)}}else o=t.nodes.tableParagraph.create({});let r=t.nodes.tableCell.create({},o);e.push(r)}let r=t.nodes.tableRow.create({},e);n.push(r)}return n}function X(e,t,i){let n,o=e.type;if(void 0===o&&(o="paragraph"),!t.nodes[o])throw Error(`node type ${o} not found in schema`);if(e.content){if("string"==typeof e.content){let r=Y([e.content],t,i);n=t.nodes[o].create(e.props,r)}else if(Array.isArray(e.content)){let r=Y(e.content,t,i);n=t.nodes[o].create(e.props,r)}else if("tableContent"===e.content.type){let r=J(e.content,t,i);n=t.nodes[o].create(e.props,r)}else throw new Z(e.content.type)}else n=t.nodes[o].create(e.props);return n}function Q(e,t,i){let n=e.id;void 0===n&&(n=z.options.generateID());let o=X(e,t,i),r=[];if(e.children)for(let n of e.children)r.push(Q(n,t,i));let s=t.nodes.blockGroup.create({},r);return t.nodes.blockContainer.create({id:n,...e.props},r.length>0?[o,s]:o)}function ee(e,t,i){let n;let o=[];return e.content.forEach(e=>{let r;if("hardBreak"===e.type.name){if(n){if(q(n))n.text+=` 3`;else if(j(n))n.content[n.content.length-1].text+=` 4`;else throw Error("unexpected")}else n={type:"text",text:` 5`,styles:{}};return}if("link"!==e.type.name&&"text"!==e.type.name&&t[e.type.name]){n&&(o.push(n),n=void 0),o.push(function(e,t,i){let n;if("text"===e.type.name||"link"===e.type.name)throw Error("unexpected");let o={},r=t[e.type.name];for(let[t,i]of Object.entries(e.attrs)){if(!r)throw Error("ic node is of an unrecognized type: "+e.type.name);t in r.propSchema&&(o[t]=i)}return n="styled"===r.content?ee(e,t,i):void 0,{type:e.type.name,props:o,content:n}}(e,t,i));return}let s={};for(let t of e.marks)if("link"===t.type.name)r=t;else{let e=i[t.type.name];if(!e)throw Error(`style ${t.type.name} not found in styleSchema`);if("boolean"===e.propSchema)s[e.type]=!0;else if("string"===e.propSchema)s[e.type]=t.attrs.stringValue;else throw new Z(e.propSchema)}n?q(n)?r?(o.push(n),n={type:"link",href:r.attrs.href,content:[{type:"text",text:e.textContent,styles:s}]}):JSON.stringify(n.styles)===JSON.stringify(s)?n.text+=e.textContent:(o.push(n),n={type:"text",text:e.textContent,styles:s}):j(n)&&(r?n.href===r.attrs.href?JSON.stringify(n.content[n.content.length-1].styles)===JSON.stringify(s)?n.content[n.content.length-1].text+=e.textContent:n.content.push({type:"text",text:e.textContent,styles:s}):(o.push(n),n={type:"link",href:r.attrs.href,content:[{type:"text",text:e.textContent,styles:s}]}):(o.push(n),n={type:"text",text:e.textContent,styles:s})):n=r?{type:"link",href:r.attrs.href,content:[{type:"text",text:e.textContent,styles:s}]}:{type:"text",text:e.textContent,styles:s}}),n&&o.push(n),o}function et(e,t,i,n,o){let r;if("blockContainer"!==e.type.name)throw Error("Node must be of type blockContainer, but is of type"+e.type.n
5ame+".");let s=null==o?void 0:o.get(e);if(s)return s;let a=$(e),l=a.id;null===l&&(l=z.options.generateID());let d={};for(let[i,n]of Object.entries({...e.attrs,...a.contentNode.attrs})){let e=t[a.contentType.name];if(!e)throw Error("Block is of an unrecognized type: "+a.contentType.name);i in e.propSchema&&(d[i]=n)}let c=t[a.contentType.name],h=[];for(let r=0;r<a.numChildBlocks;r++)h.push(et(e.lastChild.child(r),t,i,n,o));if("inline"===c.content)r=ee(a.contentNode,i,n);else if("table"===c.content)r=function(e,t,i){let n={type:"tableContent",rows:[]};return e.content.forEach(e=>{let o={cells:[]};e.content.forEach(e=>{o.cells.push(ee(e.firstChild,t,i))}),n.rows.push(o)}),n}(a.contentNode,i,n);else if("none"===c.content)r=void 0;else throw new Z(c.content);let p={id:l,type:c.type,props:d,content:r,children:h};return null==o||o.set(e,p),p}let ei=(e,t,i,n,o)=>{if(!i.nodes[e.type.name])throw Error("Serializer is missing a node type: "+e.type.name);let{dom:s,contentDOM:a}=r.PW.renderSpec(t.document||window.document,i.nodes[e.type.name](e));if(a){if(e.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");if("blockContainer"===e.type.name){let s=e.childCount>0&&"blockContent"===e.firstChild.type.spec.group?e.firstChild:void 0,l=e.childCount>0&&"blockGroup"===e.lastChild.type.spec.group?e.lastChild:void 0;if(void 0!==s){let r=n.blockImplementations[s.type.name].implementation,l=(o?r.toExternalHTML:r.toInternalHTML)(et(e,n.schema.blockSchema,n.schema.inlineContentSchema,n.schema.styleSchema,n.blockCache),n);if(void 0!==l.contentDOM){if(e.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");l.contentDOM.appendChild(i.serializeFragment(s.content,t))}a.appendChild(l.dom)}void 0!==l&&i.serializeFragment(r.HY.from(l),t,a)}else i.serializeFragment(e.content,t,a)}return s},en=(e,t)=>{let i=t.serializeFragment(e),n=document.createElement("div");return n.appendChild(i),n.innerHTML};function eo(e){let t=new Set([...e.orderedListItemBlockTypes,...e.unorderedListItemBlockTypes]),i=n=>{var o;if(1===n.children.length&&(null==(o=n.children[0].properties)?void 0:o.dataNodeType)==="blockGroup"){let e=n.children[0];n.children.pop(),n.children.push(...e.children)}let r=n.children.length,s;for(let o=0;o<r;o++){let a=n.children[o].children[0],l=a.children[0],d=2===a.children.length?a.children[1]:null,c=t.has(l.properties.dataContentType),h=c?e.orderedListItemBlockTypes.has(l.properties.dataContentType)?"ol":"ul":null;if(null!==d&&i(d),s&&s.tagName!==h){n.children.splice(o-s.children.length,s.children.length,s);let e=s.children.length-1;o-=e,r-=e,s=void 0}if(c){s||(s=(0,p.Y)(document.createElement(h)));let e=(0,p.Y)(document.createElement("li"));e.children.push(...l.children),null!==d&&e.children.push(...d.children),s.children.push(e)}else if(null!==d){n.children.splice(o+1,0,...d.children),n.children[o]=l.children[0];let e=d.children.length;o+=e,r+=e}else n.children[o]=l.children[0]}s&&n.children.splice(r-s.children.length,s.children.length,s)};return i}let er=(e,t)=>{let i=r.PW.fromSchema(e);return i.serializeNodeInner=(e,n)=>ei(e,n,i,t,!0),i.exportProseMirrorFragment=e=>(0,l.l)().use(s.Z,{fragment:!0}).use(eo,{orderedListItemBlockTypes:new Set(["numberedListItem"]),unorderedListItemBlockTypes:new Set(["bulletListItem","checkListItem"])}).use(a.Z).processSync(en(e,i)).value,i.exportBlocks=n=>{let o=n.map(i=>Q(i,e,t.schema.styleSchema)),s=e.nodes.blockGroup.create(null,o);return i.exportProseMirrorFragment(r.HY.from(s))},i},es=(e,t)=>{let i=r.PW.fromSchema(e);return i.serializeNodeInner=(e,n)=>ei(e,n,i,t,!1),i.serializeProseMirrorFragment=e=>en(e,i),i.serializeBlocks=n=>{let o=n.map(i=>Q(i,e,t.schema.styleSchema)),s=e.nodes.blockGroup.create(null,o);return i.serializeProseMirrorFragment(r.HY.from(s))},i},ea=()=>"u">typeof navigator&&(/Mac/.test(navigator.platform)||/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent));function el(e,t="Ctrl"){return ea()?e.replace("Mod","â"):e.replace("Mod",t)}function ed(...e){return e.filter(e=>e).join(" ")}let ec=()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent);function eh(e,t,i,n){let o=document.createElement("div");for(let[t,n]of(o.className=ed("bn-block-content",i.class),o.setAttribute("data-content-type",e),Object.entries(i)))"class"!==t&&o.setAttribute(t,n);let r=document.createElement(t);
5for(let[e,t]of(r.className=ed("bn-inline-content",n.class),Object.entries(n)))"class"!==e&&r.setAttribute(e,t);return o.appendChild(r),{dom:o,contentDOM:r}}let ep=(e,t)=>{let i=Q(e,t._tiptapEditor.schema,t.schema.styleSchema).firstChild,n=t._tiptapEditor.schema.nodes[i.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(i);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},eu={backgroundColor:{default:"default"},textColor:{default:"default"},textAlignment:{default:"left",values:["left","center","right","justify"]}},em=["backgroundColor","textColor"];function ef(e){return"data-"+e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function eg(e){let t=e.split("/");return t.length&&""!==t[t.length-1]?t[t.length-1]:e}function eb(e){let t={};return Object.entries(e).filter(([e,t])=>!em.includes(e)).forEach(([e,i])=>{t[e]={default:i.default,keepOnSplit:!0,parseHTML:t=>{let n=t.getAttribute(ef(e));if(null===n)return null;if("boolean"==typeof i.default)return"true"===n||"false"!==n&&null;if("number"==typeof i.default){let e=parseFloat(n);return!Number.isNaN(e)&&Number.isFinite(e)?e:null}return n},renderHTML:t=>t[e]!==i.default?{[ef(e)]:t[e]}:{}}}),t}function ev(e,t,i,n){if("boolean"==typeof e)throw Error("Cannot find node position as getPos is a boolean, not a function.");let o=e(),r=i.state.doc.resolve(o).node().attrs.id;if(!r)throw Error("Block doesn't have id");let s=t.getBlock(r);if(s.type!==n)throw Error("Block type does not match");return s}function ek(e,t,i,n,o=!1,r){let s=document.createElement("div");if(void 0!==r)for(let[e,t]of Object.entries(r))"class"!==e&&s.setAttribute(e,t);for(let[e,o]of(s.className=ed("bn-block-content",(null==r?void 0:r.class)||""),s.setAttribute("data-content-type",t),Object.entries(i)))em.includes(e)||o===n[e].default||s.setAttribute(ef(e),o);return o&&s.setAttribute("data-file-block",""),s.appendChild(e.dom),void 0!==e.contentDOM&&(e.contentDOM.className=ed("bn-inline-content",e.contentDOM.className),e.contentDOM.setAttribute("data-editable","")),{...e,dom:s}}function ey(e){return d.NB.create(e)}function ew(e,t){return{config:e,implementation:t}}function eC(e,t,i){return ew({type:e.name,content:"inline*"===e.config.content?"inline":"tableRow+"===e.config.content?"table":"none",propSchema:t},{node:e,requiredExtensions:i,toInternalHTML:ep,toExternalHTML:ep})}function eE(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.config]))}function eS(e,t){let i=[{tag:"[data-content-type="+e.type+"]",contentElement:"[data-editable]"}];return t&&i.push({tag:"*",getAttrs(e){if("string"==typeof e)return!1;let i=null==t?void 0:t(e);return void 0!==i&&i}}),i}function eM(e,t){let i=ey({name:e.type,content:"inline"===e.content?"inline*":"",group:"blockContent",selectable:!0,addAttributes:()=>eb(e.propSchema),parseHTML:()=>eS(e,t.parse),renderHTML(){let e=document.createElement("div");return e.setAttribute("data-tmp-placeholder","true"),{dom:e}},addNodeView(){return({getPos:i})=>{var n;let o=this.options.editor,r=ev(i,o,this.editor,e.type),s=(null==(n=this.options.domAttributes)?void 0:n.blockContent)||{};return ek(t.render(r,o),r.type,r.props,e.propSchema,s)}}});if(i.name!==e.type)throw Error("Node name does not match block type. This is a bug in BlockNote.");return ew(e,{node:i,toInternalHTML:(n,o)=>{var r;let s=(null==(r=i.options.domAttributes)?void 0:r.blockContent)||{};return ek(t.render(n,o),n.type,n.props,e.propSchema,e.isFileBlock,s)},toExternalHTML:(n,o)=>{var r,s;let a=(null==(r=i.options.domAttributes)?void 0:r.blockContent)||{},l=null==(s=t.toExternalHTML)?void 0:s.call(t,n,o);return void 0===l&&(l=t.render(n,o)),ek(l,n.type,n.props,e.propSchema,a)}})}function ex(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.config]))}function eL(e){return"boolean"===e?{}:{stringValue:{default:void 0,keepOnSplit:!0,parseHTML:e=>e.getAttribute("data-value"),renderHTML:e=>void 0!==e.stringValue?{"data-value":e.stringValue}:{}}}}function eT(e,t,i,n){return e.dom.setAttribute("data-style-type",t),"string"===n&&e.dom.setAttribute("data-value",i),void 0!==e.contentDOM&&e.contentDOM.setAttribute("data-editable",""),e}function eA(e,t){return{config:e,implementation:t}}function eH(e,t){return eA({type:e.name,propSchema:t},{mark:e})}function eB(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.config]))}function e_(e){return[{tag:`[data-style-type="${e.type}"]`,contentElement:e=>e.matches("[data-editable]")?e:e.querySelector("[data-editable]")||e}]}let eN=e=>{let t=document.createElement("div");t.className="bn-file-default-preview";let i=document.createElement("div");i.className="bn-file-default-preview-icon",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>';let n=document.createElement("p");return n.className="bn-file-default-preview-name",n.textContent=e.props.name||"",t.appendChild(i),t.appendChild(n),{dom:t}},eI=(e,t)=>{let i=document.createElement("div");i.className="bn-file-and-caption-wrapper";let n=document.createElement("p");return n.className="bn-file-caption",n.textContent=e.props.caption,i.appendChild(t),i.appendChild(n),{dom:i}},eP=(e,t,i,n)=>{let o=document.createElement("div");o.className="bn-add-file-button";let r=document.createElement("div");r.className="bn-add-file-button-icon",n?r.appendChild(n):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>';let s=document.createElement("p");s.className="bn-add-file-button-text",s.innerHTML=i||t.dictionary.file_blocks.file.add_button_text;let a=e=>{e.preventDefault()},l=()=>{t._tiptapEditor.view.dispatch(t._tiptapEditor.state.tr.setMeta(t.filePanel.plugin,{block:e}))};return o.appendChild(r),o.appendChild(s),o.addEventListener("mousedown",a,!0),o.addEventListener("click",l,!0),{dom:o,destroy:()=>{o.removeEventListener("mousedown",a,!0),o.removeEventListener("click",l,!0)}}},eU=e=>({url:e.src||void 0}),eV=(e,t)=>{let i=e.querySelector(t);if(!i)return;let n=e.querySelector("figcaption");
5return{targetElement:i,caption:(null==n?void 0:n.textContent)??void 0}},eO=(e,t)=>{let i=document.createElement("div"),n=document.createElement("p");return n.textContent=t,i.appendChild(e),i.appendChild(n),{dom:i}},eD=(e,t)=>{let i=document.createElement("figure"),n=document.createElement("figcaption");return n.textContent=t,i.appendChild(e),i.appendChild(n),{dom:i}},eR=(e,t,i,n,o)=>{let r;if(!e.props.previewWidth)throw Error("Block must have a `previewWidth` prop.");let s=document.createElement("div");s.className="bn-visual-media-wrapper";let a=document.createElement("div");a.className="bn-visual-media-resize-handle",a.style.left="4px";let l=document.createElement("div");l.className="bn-visual-media-resize-handle",l.style.right="4px";let d=i=>{let n;if(!r){!t.isEditable&&s.contains(a)&&s.contains(l)&&(s.removeChild(a),s.removeChild(l));return}(n="center"===e.props.textAlignment?"left"===r.handleUsed?r.initialWidth+(r.initialClientX-i.clientX)*2:r.initialWidth+(i.clientX-r.initialClientX)*2:"left"===r.handleUsed?r.initialWidth+r.initialClientX-i.clientX:r.initialWidth+i.clientX-r.initialClientX)<64?o(64):n>t.domElement.firstElementChild.clientWidth?o(t.domElement.firstElementChild.clientWidth):o(n)},c=i=>{(!i.target||!s.contains(i.target)||!t.isEditable)&&s.contains(a)&&s.contains(l)&&(s.removeChild(a),s.removeChild(l)),r&&(r=void 0,t.updateBlock(e,{props:{previewWidth:n()}}))},h=()=>{t.isEditable&&(s.appendChild(a),s.appendChild(l))},p=e=>{e.relatedTarget===a||e.relatedTarget===l||r||t.isEditable&&s.contains(a)&&s.contains(l)&&(s.removeChild(a),s.removeChild(l))},u=t=>{t.preventDefault(),s.appendChild(a),s.appendChild(l),r={handleUsed:"left",initialWidth:e.props.previewWidth,initialClientX:t.clientX}},m=t=>{t.preventDefault(),s.appendChild(a),s.appendChild(l),r={handleUsed:"right",initialWidth:e.props.previewWidth,initialClientX:t.clientX}};return s.appendChild(i),window.addEventListener("mousemove",d),window.addEventListener("mouseup",c),i.addEventListener("mouseenter",h),i.addEventListener("mouseleave",p),a.addEventListener("mousedown",u),l.addEventListener("mousedown",m),{dom:s,destroy:()=>{window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",c),i.removeEventListener("mouseenter",h),i.removeEventListener("mouseleave",p),a.removeEventListener("mousedown",u),l.removeEventListener("mousedown",m)}}},ez={type:"file",propSchema:{backgroundColor:eu.backgroundColor,name:{default:""},url:{default:""},caption:{default:""}},content:"none",isFileBlock:!0},e$=e=>{if("EMBED"===e.tagName)return eU(e);if("FIGURE"===e.tagName){let t=eV(e,"embed");if(!t)return;let{targetElement:i,caption:n}=t;return{...eU(i),caption:n}}},eF=eM(ez,{render:(e,t)=>{let i=document.createElement("div");if(i.className="bn-file-block-content-wrapper",""===e.props.url){let n=eP(e,t);return i.appendChild(n.dom),{dom:i,destroy:n.destroy}}{let t=eN(e).dom,n=eI(e,t);return i.appendChild(n.dom),{dom:i}}},parse:e$,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?eO(t,e.props.caption):{dom:t}}}),ej=e=>({url:e.src||void 0,previewWidth:e.width||void 0}),eq={type:"image",propSchema:{textAlignment:eu.textAlignment,backgroundColor:eu.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:512}},content:"none",isFileBlock:!0,fileBlockAcceptMimeTypes:["image/*"]},eZ=e=>{if("IMG"===e.tagName)return ej(e);if("FIGURE"===e.tagName){let t=eV(e,"img");if(!t)return;let{targetElement:i,caption:n}=t;return{...ej(i),caption:n}}},eG=eM(eq,{render:(e,t)=>{let i=document.createElement("div");if(i.className="bn-file-block-content-wrapper",""===e.props.url){let n=document.createElement("div");n.innerHTML='<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=eP(e,t,t.dictionary.file_blocks.image.add_button_text,n.firstElementChild);return i.appendChild(o.dom),{dom:i,destroy:()=>{var e;null==(e=null==o?void 0:o.destroy)||e.call(o)}}}if(e.props.showPreview){let n=document.createElement("img");n.className="bn-visual-media",t.resolveFileUrl(e.props.url).then(e=>{n.src=e}),n.alt=e.props.name||e.props.caption||"BlockNote image",n.contentEditable="false",n.draggable=!1,n.width=Math.min(e.props.previewWidth,t.domElement.firstElementChild.clientWidth);let o=eR(e,t,n,()=>n.width,e=>n.width=e),r=eI(e,o.dom);return i.appendChild(r.dom),{dom:i,destroy:o.destroy}}{let t=eN(e).dom;return{dom:eI(e,t).dom}}},parse:eZ,toExternalHTML:e=>{let t;if(!e.props.url){let e=document.createElement("p");return e.textContent="Add image",{dom:e}}return e.props.showPreview?((t=document.createElement("img")).src=e.props.url,t.alt=e.props.name||e.props.caption||"BlockNote image",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?eD(t,e.props.caption):eO(t,e.props.caption):{dom:t}}}),eW=e=>({url:e.src||void 0,previewWidth:e.width||void 0}),eK={type:"video",propSchema:{textAlignment:eu.textAlignment,backgroundColor:eu.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0},previewWidth:{default:512}},content:"none",isFileBlock:!0,fileBlockAcceptMimeTypes:["video/*"]},eY=e=>{if("VIDEO"===e.tagName)return eW(e);if("FIGURE"===e.tagName){let t=eV(e,"video");if(!t)return;
5let{targetElement:i,caption:n}=t;return{...eW(i),caption:n}}},eJ=eM(eK,{render:(e,t)=>{let i=document.createElement("div");if(i.className="bn-file-block-content-wrapper",""===e.props.url){let n=document.createElement("div");n.innerHTML='<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=eP(e,t,t.dictionary.file_blocks.video.add_button_text,n.firstElementChild);return i.appendChild(o.dom),{dom:i,destroy:()=>{var e;null==(e=null==o?void 0:o.destroy)||e.call(o)}}}if(e.props.showPreview){let n=document.createElement("video");n.className="bn-visual-media",n.src=e.props.url,n.controls=!0,n.contentEditable="false",n.draggable=!1,n.width=Math.min(e.props.previewWidth,t.domElement.firstElementChild.clientWidth);let o=eR(e,t,n,()=>n.width,e=>n.width=e),r=eI(e,o.dom);return i.appendChild(r.dom),{dom:i,destroy:o.destroy}}{let t=eN(e).dom;return{dom:eI(e,t).dom}}},parse:eY,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,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?eD(t,e.props.caption):eO(t,e.props.caption):{dom:t}}}),eX=e=>({url:e.src||void 0}),eQ={type:"audio",propSchema:{backgroundColor:eu.backgroundColor,name:{default:""},url:{default:""},caption:{default:""},showPreview:{default:!0}},content:"none",isFileBlock:!0,fileBlockAcceptMimeTypes:["audio/*"]},e0=e=>{if("AUDIO"===e.tagName)return eX(e);if("FIGURE"===e.tagName){let t=eV(e,"audio");if(!t)return;let{targetElement:i,caption:n}=t;return{...eX(i),caption:n}}},e1=eM(eQ,{render:(e,t)=>{let i=document.createElement("div");if(i.className="bn-file-block-content-wrapper",""===e.props.url){let n=document.createElement("div");n.innerHTML='<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=eP(e,t,t.dictionary.file_blocks.audio.add_button_text,n.firstElementChild);return i.appendChild(o.dom),{dom:i,destroy:()=>{var e;null==(e=null==o?void 0:o.destroy)||e.call(o)}}}if(e.props.showPreview){let n=document.createElement("audio");n.className="bn-audio",t.resolveFileUrl(e.props.url).then(e=>{n.src=e}),n.controls=!0,n.contentEditable="false",n.draggable=!1;let o=eI(e,n);return i.appendChild(o.dom),{dom:i}}{let t=eN(e).dom;return{dom:eI(e,t).dom}}},parse:e0,toExternalHTML:e=>{let t;if(!e.props.url){let e=document.createElement("p");return e.textContent="Add audio",{dom:e}}return e.props.showPreview?(t=document.createElement("audio")).src=e.props.url:((t=document.createElement("a")).href=e.props.url,t.textContent=e.props.name||e.props.url),e.props.caption?e.props.showPreview?eD(t,e.props.caption):eO(t,e.props.caption):{dom:t}}}),e2=eH(d.vc.create({name:"backgroundColor",addAttributes:()=>({stringValue:{default:void 0,parseHTML:e=>e.getAttribute("data-background-color"),renderHTML:e=>({"data-background-color":e.stringValue})}}),parseHTML:()=>[{tag:"span",getAttrs:e=>"string"!=typeof e&&!!e.hasAttribute("data-background-color")&&{stringValue:e.getAttribute("data-background-color")}}],renderHTML:({HTMLAttributes:e})=>["span",e,0]}),"string"),e4=eH(d.vc.create({name:"textColor",addAttributes:()=>({stringValue:{default:void 0,parseHTML:e=>e.getAttribute("data-text-color"),renderHTML:e=>({"data-text-color":e.stringValue})}}),parseHTML:()=>[{tag:"span",getAttrs:e=>"string"!=typeof e&&!!e.hasAttribute("data-text-color")&&{stringValue:e.getAttribute("data-text-color")}}],renderHTML:({HTMLAttributes:e})=>["span",e,0]}),"string"),e3=e=>{let{contentType:t}=F(e.state.doc,e.state.selection.from);return t.spec.content},e5={...eu,level:{default:1,values:[1,2,3]}},e9=eC(ey({name:"heading",content:"inline*",group:"blockContent",addAttributes:()=>({level:{default:1,parseHTML:e=>{let t=parseInt(e.getAttribute("data-level"));if(isFinite(t))return t},renderHTML:e=>({"data-level":e.level.toString()})}}),addInputRules(){return[...[1,2,3].map(e=>new d.VK({find:RegExp(`^(#{${e}})\\s$`),handler:({state:t,chain:i,range:n})=>{"inline*"===e3(this.editor)&&i().BNUpdateBlock(t.selection.from,{type:"heading",props:{level:e}}).deleteRange({from:n.from,to:n.to})}}))]},addKeyboardShortcuts(){return{"Mod-Alt-1":()=>"inline*"!==e3(this.editor)||this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"heading",props:{level:1}}),"Mod-Alt-2":()=>"inline*"!==e3(this.editor)||this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"heading",props:{level:2}}),"Mod-Alt-3":()=>"inline*"!==e3(this.editor)||this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"heading",props:{level:3}})}},parseHTML(){return[{tag:"div[data-content-type="+this.name+"]",getAttrs:e=>"string"!=typeof e&&{level:e.getAttribute("data-level")}},{tag:"h1",attrs:{level:1},node:"heading"},{tag:"h2",attrs:{level:2},node:"heading"},{tag:"h3",attrs:{level:3},node:"heading"}]},renderHTML({node:e,HTMLAttributes:t}){var i,n;return eh(this.name,`h${e.attrs.level}`,{...(null==(i=this.options.domAttributes)?void 0:i.blockContent)||{},...t},(null==(n=this.options.domAttributes)?void 0:n.inlineContent)||{})}}
5),e5),e7=e=>{let{contentNode:t,contentType:i}=F(e.state.doc,e.state.selection.from),n=e.state.selection.anchor===e.state.selection.head;return("bulletListItem"===i.name||"numberedListItem"===i.name||"checkListItem"===i.name)&&!!n&&e.commands.first(({state:e,chain:i,commands:n})=>[()=>n.command(()=>0===t.childCount&&n.BNUpdateBlock(e.selection.from,{type:"paragraph",props:{}})),()=>n.command(()=>t.childCount>0&&(i().deleteSelection().BNSplitBlock(e.selection.from,!0).run(),!0))])},e8={...eu},e6=eC(ey({name:"bulletListItem",content:"inline*",group:"blockContent",priority:90,addInputRules(){return[new d.VK({find:RegExp("^[-+*]\\s$"),handler:({state:e,chain:t,range:i})=>{"inline*"===e3(this.editor)&&t().BNUpdateBlock(e.selection.from,{type:"bulletListItem",props:{}}).deleteRange({from:i.from,to:i.to})}})]},addKeyboardShortcuts(){return{Enter:()=>e7(this.editor),"Mod-Shift-8":()=>"inline*"!==e3(this.editor)||this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"bulletListItem",props:{}})}},parseHTML(){return[{tag:"div[data-content-type="+this.name+"]"},{tag:"li",getAttrs:e=>{if("string"==typeof e)return!1;let t=e.parentElement;return null!==t&&("UL"===t.tagName||"DIV"===t.tagName&&"UL"===t.parentElement.tagName)&&{}},node:"bulletListItem"},{tag:"p",getAttrs:e=>{if("string"==typeof e)return!1;let t=e.parentElement;return null!==t&&"bulletListItem"===t.getAttribute("data-content-type")&&{}},priority:300,node:"bulletListItem"}]},renderHTML({HTMLAttributes:e}){var t,i;return eh(this.name,"p",{...(null==(t=this.options.domAttributes)?void 0:t.blockContent)||{},...e},(null==(i=this.options.domAttributes)?void 0:i.inlineContent)||{})}}),e8),te=new c.H$("numbered-list-indexing"),tt=()=>new c.Sy({key:te,appendTransaction:(e,t,i)=>{let n=i.tr;n.setMeta("numberedListIndexing",!0);let o=!1;return i.doc.descendants((e,t)=>{if("blockContainer"===e.type.name&&"numberedListItem"===e.firstChild.type.name){let e="1",i=F(n.doc,t+1);if(void 0!==i){if(1!==t){let o=F(n.doc,t-2);if(void 0===o)return;if(!(i.depth!==o.depth)){let t=o.contentNode;"numberedListItem"===o.contentType.name&&(e=(parseInt(t.attrs.index)+1).toString())}}i.contentNode.attrs.index!==e&&(o=!0,n.setNodeMarkup(t+1,void 0,{index:e}))}}}),o?n:null}}),ti={...eu},tn=eC(ey({name:"numberedListItem",content:"inline*",group:"blockContent",priority:90,addAttributes:()=>({index:{default:null,parseHTML:e=>e.getAttribute("data-index"),renderHTML:e=>({"data-index":e.index})}}),addInputRules(){return[new d.VK({find:RegExp("^1\\.\\s$"),handler:({state:e,chain:t,range:i})=>{"inline*"===e3(this.editor)&&t().BNUpdateBlock(e.selection.from,{type:"numberedListItem",props:{}}).deleteRange({from:i.from,to:i.to})}})]},addKeyboardShortcuts(){return{Enter:()=>e7(this.editor),"Mod-Shift-7":()=>"inline*"!==e3(this.editor)||this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"numberedListItem",props:{}})}},addProseMirrorPlugins:()=>[tt()],parseHTML(){return[{tag:"div[data-content-type="+this.name+"]"},{tag:"li",getAttrs:e=>{if("string"==typeof e)return!1;let t=e.parentElement;return null!==t&&("OL"===t.tagName||"DIV"===t.tagName&&"OL"===t.parentElement.tagName)&&{}},node:"numberedListItem"},{tag:"p",getAttrs:e=>{if("string"==typeof e)return!1;let t=e.parentElement;return null!==t&&"numberedListItem"===t.getAttribute("data-content-type")&&{}},priority:300,node:"numberedListItem"}]},renderHTML({HTMLAttributes:e}){var t,i;return eh(this.name,"p",{...(null==(t=this.options.domAttributes)?void 0:t.blockContent)||{},...e},(null==(i=this.options.domAttributes)?void 0:i.inlineContent)||{})}}),ti),to={...eu,checked:{default:!1}},tr=eC(ey({name:"checkListItem",content:"inline*",group:"blockContent",addAttributes:()=>({checked:{default:!1,parseHTML:e=>"true"===e.getAttribute("data-checked")||void 0,renderHTML:e=>e.checked?{"data-checked":e.checked.toString()}:{}}}),addInputRules(){return[new d.VK({find:RegExp("\\[\\s*\\]\\s$"),handler:({state:e,chain:t,range:i})=>{"inline*"===e3(this.editor)&&t().BNUpdateBlock(e.selection.from,{type:"checkListItem",props:{checked:!1}}).deleteRange({from:i.from,to:i.to})}}),new d.VK({find:RegExp("\\[[Xx]\\]\\s$"),handler:({state:e,chain:t,range:i})=>{"inline*"===e3(this.editor)&&t().BNUpdateBlock(e.selection.from,{type:"checkListItem",props:{checked:!0}}).deleteRange({from:i.from,to:i.to})}})]},addKeyboardShortcuts(){return{Enter:()=>
5e7(this.editor),"Mod-Shift-9":()=>"inline*"!==e3(this.editor)||this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"checkListItem",props:{}})}},parseHTML(){return[{tag:"div[data-content-type="+this.name+"]"},{tag:"input",getAttrs:e=>"string"!=typeof e&&"checkbox"===e.type&&{checked:e.checked},node:"checkListItem"},{tag:"li",getAttrs:e=>{if("string"==typeof e)return!1;let t=e.parentElement;if(null===t)return!1;if("UL"===t.tagName||"DIV"===t.tagName&&"UL"===t.parentElement.tagName){let t=e.querySelector("input[type=checkbox]")||null;return null!==t&&{checked:t.checked}}return!1},node:"checkListItem"}]},renderHTML({node:e,HTMLAttributes:t}){var i,n;let o=document.createElement("input");o.type="checkbox",o.checked=e.attrs.checked,e.attrs.checked&&o.setAttribute("checked","");let{dom:r,contentDOM:s}=eh(this.name,"p",{...(null==(i=this.options.domAttributes)?void 0:i.blockContent)||{},...t},(null==(n=this.options.domAttributes)?void 0:n.inlineContent)||{});return r.insertBefore(o,s),{dom:r,contentDOM:s}},addNodeView(){return({node:e,getPos:t,editor:i,HTMLAttributes:n})=>{var o,r;let s=document.createElement("div"),a=document.createElement("div");a.contentEditable="false";let l=document.createElement("input");l.type="checkbox",l.checked=e.attrs.checked,e.attrs.checked&&l.setAttribute("checked","");let d=()=>{if(!i.isEditable){l.checked=!l.checked;return}"boolean"!=typeof t&&this.editor.commands.BNUpdateBlock(t(),{type:"checkListItem",props:{checked:l.checked}})};l.addEventListener("change",d);let{dom:c,contentDOM:h}=eh(this.name,"p",{...(null==(o=this.options.domAttributes)?void 0:o.blockContent)||{},...n},(null==(r=this.options.domAttributes)?void 0:r.inlineContent)||{});if("boolean"!=typeof t){let e="label-"+this.editor.state.doc.resolve(t()).node().attrs.id;l.setAttribute("aria-labelledby",e),h.id=e}return c.removeChild(h),c.appendChild(s),s.appendChild(a),s.appendChild(h),a.appendChild(l),{dom:c,contentDOM:h,destroy:()=>{l.removeEventListener("change",d)}}}}}),to),ts={...eu},ta=eC(ey({name:"paragraph",content:"inline*",group:"blockContent",addKeyboardShortcuts(){return{"Mod-Alt-0":()=>"inline*"!==e3(this.editor)||this.editor.commands.BNUpdateBlock(this.editor.state.selection.anchor,{type:"paragraph",props:{}})}},parseHTML(){return[{tag:"div[data-content-type="+this.name+"]"},{tag:"p",priority:200,getAttrs:e=>{var t;return!!("string"!=typeof e&&null!=(t=e.textContent)&&t.trim())&&{}},node:"paragraph"}]},renderHTML({HTMLAttributes:e}){var t,i;return eh(this.name,"p",{...(null==(t=this.options.domAttributes)?void 0:t.blockContent)||{},...e},(null==(i=this.options.domAttributes)?void 0:i.inlineContent)||{})}}),ts),tl=d.hj.create({name:"BlockNoteTableExtension",addProseMirrorPlugins:()=>[(0,w.VH)({cellMinWidth:100}),(0,w.G3)()],addKeyboardShortcuts(){return{Enter:()=>!!this.editor.state.selection.empty&&"tableParagraph"===this.editor.state.selection.$head.parent.type.name&&(this.editor.commands.setHardBreak(),!0),Backspace:()=>{let e=this.editor.state.selection,t=e.empty,i=0===e.$head.parentOffset,n="tableParagraph"===e.$head.node().type.name;return t&&i&&n}}},extendNodeSchema(e){let t={name:e.name,options:e.options,storage:e.storage};return{tableRole:(0,d.nU)((0,d.Nl)(e,"tableRole",t))}}}),td={...eu},tc={paragraph:ta,heading:e9,bulletListItem:e6,numberedListItem:tn,checkListItem:tr,table:eC(ey({name:"table",content:"tableRow+",group:"blockContent",tableRole:"table",isolating:!0,parseHTML:()=>[{tag:"table"}],renderHTML({HTMLAttributes:e}){var t,i;return eh(this.name,"table",{...(null==(t=this.options.domAttributes)?void 0:t.blockContent)||{},...e},(null==(i=this.options.domAttributes)?void 0:i.inlineContent)||{})}}),td,[tl,d.NB.create({name:"tableParagraph",group:"tableContent",content:"inline*",parseHTML:()=>[{tag:"td"},{tag:"p",getAttrs:e=>{if("string"==typeof e||!e.textContent)return!1;let t=e.parentElement;return null!==t&&"TD"===t.tagName&&{}}}],renderHTML({HTMLAttributes:e}){return["p",(0,d.P1)(this.options.HTMLAttributes,e),0]}}),k.x.extend({content:"tableContent"}),v.p.extend({content:"tableContent"}),y.S]),file:eF,image:eG,video:eJ,audio:e1},th=eE(tc),tp={bold:eH(u.ZP,"boolean"),italic:eH(f.ZP,"boolean"),underline:eH(b.Z,"boolean"),strike:eH(g.ZP,"boolean"),code:eH(m.ZP,"boolean"),textColor:e4,backgroundColor:e2},tu=(eB(tp),{text:{config:"text",implementation:{}},link:{config:"link",implementation:{}}});function tm(e,t){return e in t.schema.blockSchema&&t.schema.blockSchema[e]===th[e]}function tf(e,t){return e.type in t.schema.blockSchema&&t.schema.blockSchema[e.type].isFileBlock||!1}function tg(e,t){return e.type in t.schema.blockSchema&&t.schema.blockSchema[e.type].isFileBlock&&"showPreview"in t.schema.blockSchema[e.type].propSchema||!1}function tb(e,t){return t.schema.blockSchema[e.type].isFileBlock&&!e.props.url}function tv(e,t,i){return t in i.schema.blockSchema&&e in i.schema.blockSchema[t].propSchema&&i.schema.blockSchema[t].propSchema[e]===eu[e]}function tk(e,t,i){return tv(e,t.type,i)}function ty(e,t){let i,n;if(t.firstChild.descendants((t,o)=>!i&&("blockContainer"!==t.type.name||t.attrs.id!==e||(i=t,n=o+1,!1))),void 0===i||void 0===n)throw Error("Could not find block
5in the editor with matching ID.");return{node:i,posBeforeNode:n}}function tw(e,t,i){let n=t._tiptapEditor,o=n.state.tr,r=new Set(e.map(e=>"string"==typeof e?e:e.id)),s=[],a=0;if(n.state.doc.descendants((e,n)=>{if(0===r.size)return!1;if("blockContainer"!==e.type.name||!r.has(e.attrs.id))return!0;s.push(et(e,t.schema.blockSchema,t.schema.inlineContentSchema,t.schema.styleSchema,t.blockCache)),r.delete(e.attrs.id),a=(null==i?void 0:i(e,n,o,a))||a;let l=o.doc.nodeSize;o.delete(n-a-1,n-a+e.nodeSize+1);let d=o.doc.nodeSize;return a+=l-d,!1}),r.size>0)throw Error("Blocks with the following IDs could not be found in the editor: "+[...r].join(` 6`));return n.view.dispatch(o),s}function tC(){let e=t=>{let i=t.children.length;for(let n=0;n<i;n++){let o=t.children[n];if("element"===o.type&&(e(o),"u"===o.tagName)){if(o.children.length>0){t.children.splice(n,1,...o.children);let e=o.children.length-1;i+=e,n+=e}else t.children.splice(n,1),i--,n--}}};return e}function tE(){let e=t=>{var i;if(t.children&&"length"in t.children&&t.children.length)for(let n=t.children.length-1;n>=0;n--){let o=t.children[n],r=n+1<t.children.length?t.children[n+1]:void 0;"element"===o.type&&"input"===o.tagName&&(null==(i=o.properties)?void 0:i.type)==="checkbox"&&(null==r?void 0:r.type)==="element"&&"p"===r.tagName?(r.tagName="span",r.children.splice(0,0,(0,p.Y)(document.createTextNode(" ")))):e(o)}};return e}function tS(e){return(0,l.l)().use(s.Z,{fragment:!0}).use(tC).use(tE).use(C.Z).use(E.Z).use(S.Z).processSync(e).value}ex(tu);let tM=null;function tx(e){if("string"==typeof e){let t=(tM||(tM=document.implementation.createHTMLDocument("title"))).createElement("div");t.innerHTML=e,e=t}return function(e){e.querySelectorAll("li > ul, li > ol").forEach(e=>{let t=Array.prototype.indexOf.call(e.parentElement.childNodes,e),i=e.parentElement,n=Array.from(i.childNodes).slice(t+1);e.remove(),n.forEach(e=>{e.remove()}),i.insertAdjacentElement("afterend",e),n.reverse().forEach(t=>{if(3===t.nodeType&&!/\S/.test(t.nodeValue||""))return;let i=document.createElement("li");i.append(t),e.insertAdjacentElement("afterend",i)}),0===i.childNodes.length&&i.remove()})}(e),function(e){e.querySelectorAll("li + ul, li + ol").forEach(e=>{var t,i;let n=e.previousElementSibling,o=document.createElement("div");n.insertAdjacentElement("afterend",o),o.append(n);let r=document.createElement("div");for(r.setAttribute("data-node-type","blockGroup"),o.append(r);(null==(t=o.nextElementSibling)?void 0:t.nodeName)==="UL"||(null==(i=o.nextElementSibling)?void 0:i.nodeName)==="OL";)r.append(o.nextElementSibling)})}(e),e}async function tL(e,t,i,n,o){let s=tx(e),a=r.aw.fromSchema(o).parse(s,{topNode:o.nodes.blockGroup.create()}),l=[];for(let e=0;e<a.childCount;e++)l.push(et(a.child(e),t,i,n));return l}function tT(e,t){let i=t.value?t.value+` 7`:"",n={};t.lang&&(n["data-language"]=t.lang);let o={type:"element",tagName:"code",properties:n,children:[{type:"text",value:i}]};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}class tA{constructor(){D(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 i=this.callbacks[e];i&&i.forEach(e=>e.apply(this,t))}off(e,t){let i=this.callbacks[e];i&&(t?this.callbacks[e]=i.filter(e=>e!==t):delete this.callbacks[e])}removeAllListeners(){this.callbacks={}}}class tH{constructor(e,t,i,n){D(this,"state"),D(this,"emitUpdate"),D(this,"mouseDownHandler",()=>{var e;null!=(e=this.state)&&e.show&&(this.state.show=!1,this.emitUpdate())}),D(this,"dragstartHandler",()=>{var e;null!=(e=this.state)&&e.show&&(this.state.show=!1,this.emitUpdate())}),D(this,"scrollHandler",()=>{var e;if(null!=(e=this.state)&&e.show){let e=document.querySelector(`[data-node-type="blockContainer"][data-id="${this.state.block.id}"]`);this.state.referencePos=e.getBoundingClientRect(),this.emitUpdate()}}),D(this,"closeMenu",()=>{var e;null!=(e=this.state)&&e.show&&(this.state.show=!1,this.emitUpdate())}),this.editor=e,this.pluginKey=t,this.pmView=i,this.emitUpdate=()=>{if(!this.state)throw Error("Attempting to update uninitialized file panel");n(this.state)},i.dom.addEventListener("mousedown",this.mouseDownHandler),i.dom.addEventListener("dragstart",this.dragstartHandler),document.addEventListener("scroll",this.scrollHandler,!0)}update(e,t){var i,n;let o=this.pluginKey.getState(e.state);if(!(null!=(i=this.state)&&i.show)&&o.block&&this.editor.isEditable){let e=document.querySelector(`[data-node-type="blockContainer"][data-id="${o.block.id}"]`);this.state={show:!0,referencePos:e.getBoundingClientRect(),block:o.block},this.emitUpdate();return}e.state.selection.eq(t.selection)&&e.state.doc.eq(t.doc)&&this.editor.isEditable||null==(n=this.state)||!n.show||(this.state.show=!1,this.emitUpdate())}destroy(){this.pmView.dom.removeEventListener("mousedown",this.mouseDownHandler),this.pmView.dom.removeEventListener("dragstart",this.dragstartHandler),document.removeEventListener("scroll",this.scrollHandler,!0)}}let tB=new c.H$("FilePanelPlugin");class t_ extends tA{constructor(e){super(),D(this,"view"),D(this,"plugin"),D(this,"closeMenu",()=>this.view.closeMenu()),this.plugin=new c.Sy({key:tB,view:t=>(this.view=new tH(e,tB,t,e=>
7{this.emit("update",e)}),this.view),props:{handleKeyDown:(e,t)=>"Escape"===t.key&&!!this.shown&&(this.view.closeMenu(),!0)},state:{init:()=>({block:void 0}),apply:e=>{var t;return{block:null==(t=e.getMeta(tB))?void 0:t.block}}}})}get shown(){var e,t;return(null==(t=null==(e=this.view)?void 0:e.state)?void 0:t.show)||!1}onUpdate(e){return this.on("update",e)}}class tN{constructor(e,t,i){D(this,"state"),D(this,"emitUpdate"),D(this,"preventHide",!1),D(this,"preventShow",!1),D(this,"shouldShow",({state:e,from:t,to:i,view:n})=>{let{doc:o,selection:r}=e,{empty:s}=r,a=!o.textBetween(t,i).length&&(0,d.xh)(e.selection);return!(!n.hasFocus()||s||a)}),D(this,"viewMousedownHandler",()=>{this.preventShow=!0}),D(this,"viewMouseupHandler",()=>{this.preventShow=!1,setTimeout(()=>this.update(this.pmView))}),D(this,"dragHandler",()=>{var e;null!=(e=this.state)&&e.show&&(this.state.show=!1,this.emitUpdate())}),D(this,"scrollHandler",()=>{var e;null!=(e=this.state)&&e.show&&(this.state.referencePos=this.getSelectionBoundingBox(),this.emitUpdate())}),D(this,"closeMenu",()=>{var e;null!=(e=this.state)&&e.show&&(this.state.show=!1,this.emitUpdate())}),this.editor=e,this.pmView=t,this.emitUpdate=()=>{if(!this.state)throw Error("Attempting to update uninitialized formatting toolbar");i(this.state)},t.dom.addEventListener("mousedown",this.viewMousedownHandler),t.dom.addEventListener("mouseup",this.viewMouseupHandler),t.dom.addEventListener("dragstart",this.dragHandler),t.dom.addEventListener("dragover",this.dragHandler),document.addEventListener("scroll",this.scrollHandler,!0)}update(e,t){var i,n;let{state:o,composing:r}=e,{doc:s,selection:a}=o,l=t&&t.doc.eq(s)&&t.selection.eq(a);if(r||l)return;let{ranges:d}=a,c=Math.min(...d.map(e=>e.$from.pos)),h=Math.max(...d.map(e=>e.$to.pos)),p=null==(i=this.shouldShow)?void 0:i.call(this,{view:e,state:o,from:c,to:h});if(!this.preventShow&&(p||this.preventHide)){this.state={show:!0,referencePos:this.getSelectionBoundingBox()},this.emitUpdate();return}if(null!=(n=this.state)&&n.show&&!this.preventHide&&(!p||this.preventShow||!this.editor.isEditable)){this.state.show=!1,this.emitUpdate();return}}destroy(){this.pmView.dom.removeEventListener("mousedown",this.viewMousedownHandler),this.pmView.dom.removeEventListener("mouseup",this.viewMouseupHandler),this.pmView.dom.removeEventListener("dragstart",this.dragHandler),this.pmView.dom.removeEventListener("dragover",this.dragHandler),document.removeEventListener("scroll",this.scrollHandler,!0)}getSelectionBoundingBox(){let{state:e}=this.pmView,{selection:t}=e,{ranges:i}=t,n=Math.min(...i.map(e=>e.$from.pos)),o=Math.max(...i.map(e=>e.$to.pos));if((0,d.EG)(t)){let e=this.pmView.nodeDOM(n);if(e)return e.getBoundingClientRect()}return(0,d.pr)(this.pmView,n,o)}}let tI=new c.H$("FormattingToolbarPlugin");class tP extends tA{constructor(e){super(),D(this,"view"),D(this,"plugin"),D(this,"closeMenu",()=>this.view.closeMenu()),this.plugin=new c.Sy({key:tI,view:t=>(this.view=new tN(e,t,e=>{this.emit("update",e)}),this.view),props:{handleKeyDown:(e,t)=>"Escape"===t.key&&!!this.shown&&(this.view.closeMenu(),!0)}})}get shown(){var e,t;return(null==(t=null==(e=this.view)?void 0:e.state)?void 0:t.show)||!1}onUpdate(e){return this.on("update",e)}}class tU{constructor(e,t,i){D(this,"state"),D(this,"emitUpdate"),D(this,"menuUpdateTimer"),D(this,"startMenuUpdateTimer"),D(this,"stopMenuUpdateTimer"),D(this,"mouseHoveredLinkMark"),D(this,"mouseHoveredLinkMarkRange"),D(this,"keyboardHoveredLinkMark"),D(this,"keyboardHoveredLinkMarkRange"),D(this,"linkMark"),D(this,"linkMarkRange"),D(this,"mouseOverHandler",e=>{if(this.mouseHoveredLinkMark=void 0,this.mouseHoveredLinkMarkRange=void 0,this.stopMenuUpdateTimer(),e.target instanceof HTMLAnchorElement&&"A"===e.target.nodeName){let t=e.target,i=this.pmView.posAtDOM(t,0)+1,n=this.pmView.state.doc.resolve(i);for(let e of n.marks())if(e.type.name===this.pmView.state.schema.mark("link").type.name){this.mouseHoveredLinkMark=e,this.mouseHoveredLinkMarkRange=(0,d.IH)(n,e.type,e.attrs)||void 0;break}}return this.startMenuUpdateTimer(),!1}),D(this,"clickHandler",e=>{var t;let i=this.pmView.dom.parentElement;this.linkMark&&e&&e.target&&!(i===e.target||i.contains(e.target))&&null!=(t=this.state)&&t.show&&(this.state.show=!1,this.emitUpdate())}),D(this,"scrollHandler",()=>{var e;void 0!==this.linkMark&&null!=(e=this.state)&&e.show&&(this.state.referencePos=(0,d.pr)(this.pmView,this.linkMarkRange.from,this.linkMarkRange.to),this.emitUpdate())}),D(this,"closeMenu",()=>{var e;null!=(e=this.state)&&e.show&&(this.state.show=!1,this.emitUpdate())}),this.editor=e,this.pmView=t,this.emitUpdate=()=>{if(!this.state)throw Error("Attempting to update uninitialized link toolbar");i(this.state)},this.startMenuUpdateTimer=()=>{this.menuUpdateTimer=setTimeout(()=>{this.update()},250)}
7,this.stopMenuUpdateTimer=()=>(this.menuUpdateTimer&&(clearTimeout(this.menuUpdateTimer),this.menuUpdateTimer=void 0),!1),this.pmView.dom.addEventListener("mouseover",this.mouseOverHandler),document.addEventListener("click",this.clickHandler,!0),document.addEventListener("scroll",this.scrollHandler,!0)}editLink(e,t){var i;let n=this.pmView.state.tr.insertText(t,this.linkMarkRange.from,this.linkMarkRange.to);n.addMark(this.linkMarkRange.from,this.linkMarkRange.from+t.length,this.pmView.state.schema.mark("link",{href:e})),this.pmView.dispatch(n),this.pmView.focus(),null!=(i=this.state)&&i.show&&(this.state.show=!1,this.emitUpdate())}deleteLink(){var e;this.pmView.dispatch(this.pmView.state.tr.removeMark(this.linkMarkRange.from,this.linkMarkRange.to,this.linkMark.type).setMeta("preventAutolink",!0)),this.pmView.focus(),null!=(e=this.state)&&e.show&&(this.state.show=!1,this.emitUpdate())}update(){var e;if(!this.pmView.hasFocus())return;let t=this.linkMark;if(this.linkMark=void 0,this.linkMarkRange=void 0,this.keyboardHoveredLinkMark=void 0,this.keyboardHoveredLinkMarkRange=void 0,this.pmView.state.selection.empty){for(let e of this.pmView.state.selection.$from.marks())if(e.type.name===this.pmView.state.schema.mark("link").type.name){this.keyboardHoveredLinkMark=e,this.keyboardHoveredLinkMarkRange=(0,d.IH)(this.pmView.state.selection.$from,e.type,e.attrs)||void 0;break}}if(this.mouseHoveredLinkMark&&(this.linkMark=this.mouseHoveredLinkMark,this.linkMarkRange=this.mouseHoveredLinkMarkRange),this.keyboardHoveredLinkMark&&(this.linkMark=this.keyboardHoveredLinkMark,this.linkMarkRange=this.keyboardHoveredLinkMarkRange),this.linkMark&&this.editor.isEditable){this.state={show:!0,referencePos:(0,d.pr)(this.pmView,this.linkMarkRange.from,this.linkMarkRange.to),url:this.linkMark.attrs.href,text:this.pmView.state.doc.textBetween(this.linkMarkRange.from,this.linkMarkRange.to)},this.emitUpdate();return}if(null!=(e=this.state)&&e.show&&t&&(!this.linkMark||!this.editor.isEditable)){this.state.show=!1,this.emitUpdate();return}}destroy(){this.pmView.dom.removeEventListener("mouseover",this.mouseOverHandler),document.removeEventListener("scroll",this.scrollHandler,!0),document.removeEventListener("click",this.clickHandler,!0)}}let tV=new c.H$("LinkToolbarPlugin");class tO extends tA{constructor(e){super(),D(this,"view"),D(this,"plugin"),D(this,"editLink",(e,t)=>{this.view.editLink(e,t)}),D(this,"deleteLink",()=>{this.view.deleteLink()}),D(this,"startHideTimer",()=>{this.view.startMenuUpdateTimer()}),D(this,"stopHideTimer",()=>{this.view.stopMenuUpdateTimer()}),D(this,"closeMenu",()=>this.view.closeMenu()),this.plugin=new c.Sy({key:tV,view:t=>(this.view=new tU(e,t,e=>{this.emit("update",e)}),this.view),props:{handleKeyDown:(e,t)=>"Escape"===t.key&&!!this.shown&&(this.view.closeMenu(),!0)}})}onUpdate(e){return this.on("update",e)}get shown(){var e,t;return(null==(t=null==(e=this.view)?void 0:e.state)?void 0:t.show)||!1}}let tD=(0,d.Kk)(e=>"blockContainer"===e.type.name);class tR{constructor(e,t){D(this,"state"),D(this,"emitUpdate"),D(this,"pluginState"),D(this,"handleScroll",()=>{var e;if(null!=(e=this.state)&&e.show){let e=document.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);this.state.referencePos=e.getBoundingClientRect(),this.emitUpdate(this.pluginState.triggerCharacter)}}),D(this,"closeMenu",()=>{this.editor._tiptapEditor.view.dispatch(this.editor._tiptapEditor.view.state.tr.setMeta(tz,null))}),D(this,"clearQuery",()=>{void 0!==this.pluginState&&this.editor._tiptapEditor.chain().focus().deleteRange({from:this.pluginState.queryStartPos-(this.pluginState.fromUserInput?this.pluginState.triggerCharacter.length:0),to:this.editor._tiptapEditor.state.selection.from}).run()}),this.editor=e,this.pluginState=void 0,this.emitUpdate=e=>{if(!this.state)throw Error("Attempting to update uninitialized suggestions menu");t(e,this.state)},document.addEventListener("scroll",this.handleScroll,!0)}update(e,t){let i=tz.getState(t),n=tz.getState(e.state),o=void 0!==i&&void 0===n;if(!(void 0===i&&void 0!==n)&&!(void 0!==i&&void 0!==n)&&!o)return;if(this.pluginState=o?i:n,o||!this.editor.isEditable){this.state.show=!1,this.emitUpdate(this.pluginState.triggerCharacter);return}let r=document.querySelector(`[data-decoration-id="${this.pluginState.decorationId}"]`);this.editor.isEditable&&(this.state={show:!0,referencePos:r.getBoundingClientRect(),query:this.pluginState.query},this.emitUpdate(this.pluginState.triggerCharacter))}destroy(){document.removeEventListener("scroll",this.handleScroll,!0)}}let tz=new c.H$("SuggestionMenuPlugin");class t$ extends tA{constructor(e){super(),D(this,"view"),D(this,"plugin"),D(this,"triggerCharacters",[]),D(this,"addTriggerCharacter",e=>{this.triggerCharacters.push(e)}),D(this,"removeTriggerCharacter",e=>{this.triggerCharacters=this.triggerCharacters.filter(t=>t!==e)}),D(this,"closeMenu",()=>this.view.closeMenu()),D(this,"clearQuery",()=>this.view.clearQuery());let t=this.triggerCharacters;this.plugin=new c.Sy({key:tz,view:()=>(this.view=new tR(e,(e,t)=>
7{this.emit(`update ${e}`,t)}),this.view),state:{init(){},apply(e,t,i,n){if(void 0!==e.getMeta("orderedListIndexing"))return t;let o=e.getMeta(tz);if("object"==typeof o&&null!==o&&void 0===t)return{triggerCharacter:o.triggerCharacter,fromUserInput:!1!==o.fromUserInput,queryStartPos:n.selection.from,query:"",decorationId:`id_${Math.floor(4294967295*Math.random())}`};if(void 0===t)return t;if(n.selection.from!==n.selection.to||null===o||e.getMeta("focus")||e.getMeta("blur")||e.getMeta("pointer")||void 0!==t.triggerCharacter&&n.selection.from<t.queryStartPos)return;let r={...t};return r.query=n.doc.textBetween(t.queryStartPos,n.selection.from),r}},props:{handleTextInput(e,i,n,o){let r=this.getState(e.state);return!!t.includes(o)&&void 0===r&&(e.dispatch(e.state.tr.insertText(o).scrollIntoView().setMeta(tz,{triggerCharacter:o})),!0)},decorations(e){let t=this.getState(e);if(void 0===t)return null;if(!t.fromUserInput){let i=tD(e.selection);if(i)return T.EH.create(e.doc,[T.p.node(i.pos,i.pos+i.node.nodeSize,{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":t.decorationId})])}return T.EH.create(e.doc,[T.p.inline(t.queryStartPos-t.triggerCharacter.length,t.queryStartPos,{nodeName:"span",class:"bn-suggestion-decorator","data-decoration-id":t.decorationId})])}}})}onUpdate(e,t){return this.triggerCharacters.includes(e)||this.addTriggerCharacter(e),this.on(`update ${e}`,t)}get shown(){var e,t;return(null==(t=null==(e=this.view)?void 0:e.state)?void 0:t.show)||!1}}class tF extends c.Y1{constructor(e,t){super(e,t),D(this,"nodes");let i=e.node();this.nodes=[],e.doc.nodesBetween(e.pos,t.pos,(e,t,n)=>{if(null!==n&&n.eq(i))return this.nodes.push(e),!1})}static create(e,t,i=t){return new tF(e.resolve(t),e.resolve(i))}content(){return new r.p2(r.HY.from(this.nodes),0,0)}eq(e){if(!(e instanceof tF)||this.nodes.length!==e.nodes.length||this.from!==e.from||this.to!==e.to)return!1;for(let t=0;t<this.nodes.length;t++)if(!this.nodes[t].eq(e.nodes[t]))return!1;return!0}map(e,t){let i=t.mapResult(this.from),n=t.mapResult(this.to);return n.deleted?c.Y1.near(e.resolve(i.pos)):i.deleted?c.Y1.near(e.resolve(n.pos)):new tF(e.resolve(i.pos),e.resolve(n.pos))}toJSON(){return{type:"node",anchor:this.anchor,head:this.head}}}function tj(e,t){for(var i;e&&e.parentElement&&e.parentElement!==t.dom&&!(null!=(i=e.hasAttribute)&&i.call(e,"data-id"));)e=e.parentElement;if(e.hasAttribute("data-id"))return{node:e,id:e.getAttribute("data-id")}}function tq(e,t,i=t){t===i&&(i+=e.state.doc.resolve(t+1).node().nodeSize);let o=e.domAtPos(t).node.cloneNode(!0),r=e.domAtPos(t).node,s=(e,t)=>Array.prototype.indexOf.call(e.children,t),a=s(r,e.domAtPos(t+1).node.parentElement),l=s(r,e.domAtPos(i-1).node.parentElement);for(let e=r.childElementCount-1;e>=0;e--)(e>l||e<a)&&o.removeChild(o.children[e]);tZ(),n=o;let d=e.dom.className.split(" ").filter(e=>"ProseMirror"!==e&&"bn-root"!==e&&"bn-editor"!==e).join(" ");n.className=n.className+" bn-drag-preview "+d,document.body.appendChild(n)}function tZ(){void 0!==n&&(document.body.removeChild(n),n=void 0)}class tG{constructor(e,t,i){D(this,"state"),D(this,"emitUpdate"),D(this,"needUpdate",!1),D(this,"mousePos"),D(this,"horizontalPosAnchoredAtRoot"),D(this,"horizontalPosAnchor"),D(this,"hoveredBlock"),D(this,"isDragging",!1),D(this,"menuFrozen",!1),D(this,"updateState",()=>{var e,t,i,n;let o;if(this.menuFrozen||!this.mousePos)return;let r=this.pmView.dom.firstChild.getBoundingClientRect();this.horizontalPosAnchor=r.x;let s={left:r.left+r.width/2,top:this.mousePos.y};for(let e of document.elementsFromPoint(s.left,s.top))if(this.pmView.dom.contains(e)){o=tj(e,this.pmView);break}if(!o||!this.editor.isEditable){null!=(e=this.state)&&e.show&&(this.state.show=!1,this.needUpdate=!0);return}if(null!=(t=this.state)&&t.show&&null!=(i=this.hoveredBlock)&&i.hasAttribute("data-id")&&(null==(n=this.hoveredBlock)?void 0:n.getAttribute("data-id"))===o.id)return;this.hoveredBlock=o.node;let a=o.node.firstChild;if(a&&this.editor.isEditable){let e=a.getBoundingClientRect();this.state={show:!0,referencePos:new DOMRect(this.horizontalPosAnchoredAtRoot?this.horizontalPosAnchor:e.x,e.y,e.width,e.height),block:this.editor.getBlock(this.hoveredBlock.getAttribute("data-id"))},this.needUpdate=!0}}),D(this,"onDragStart",()=>{this.isDragging=!0}),D(this,"onDrop",e=>{if(this.editor._tiptapEditor.commands.blur(),e.synthetic||!this.isDragging)return;let t=this.pmView.posAtCoords({left:e.clientX,top:e.clientY});if(this.isDragging=!1,!t||-1===t.inside){let t=new Event("drop",e),i=this.pmView.dom.firstChild.getBoundingClientRect();t.clientX=i.left+i.width/2,t.clientY=e.clientY,t.dataTransfer=e.dataTransfer,t.preventDefault=()=>e.preventDefault(),t.synthetic=!0,this.pmView.dom.dispatchEvent(t)}}),D(this,"onDragOver",e=>{if(e.synthetic||!this.isDragging)return;let t=this.pmView.posAtCoords({left:e.clientX,top:e.clientY});if(!t||-1===t.inside){let t=new Event("dragover",e),i=this.pmView.dom.firstChild.getBoundingClientRect();t.clientX=i.left+i.width/2,t.clientY=e.clientY,t.dataTransfer=e.dataTransfer,t.preventDefault=()=>e.preventDefault(),t.synthetic=!0,this.pmView.dom.dispatchEvent(t)}}),D(this,"onKeyDown",e=>{var t;null!=(t=this.state)&&t.show&&this.editor.isFocused()&&(this.state.show=!1,this.emitUpdate(this.state),this.menuFrozen=!1)}),D(this,"onMouseDown",()=>{this.state&&this.state.show&&this.menuFrozen&&(this.menuFrozen=!1,this.state.show=!1,this.emitUpdate(this.state))}),D(this,"onMouseMove",e=>{var t;this.mousePos={x:e.clientX,y:e.clientY};let i=this.pmView.dom.getBoundingClientRect(),n=this.mousePos.x>i.left&&this.mousePos.x<i.right&&this.mousePos.y>i.top&&this.mousePos.y<i.bottom,o=this.pmView.dom.parentElement;if(n&&e&&e.target&&!(o===e.target||o.contains(e.target))){null!=(t=this.state)&&t.show&&(this.state.show=!1,this.emitUpdate(this.state));return}this.updateState(),this.needUpdate&&(this.emitUpdate(this.state),this.needUpdate=!1)}),D(this,"onScroll",()=>{var e;if(null!=(e=this.state)&&e.show){let e=this.hoveredBlock.firstChild.getBoundingClientRect();this.state.referencePos=new DOMRect(this.horizontalPosAnchoredAtRoot?this.horizontalPosAnchor:e.x,e.y,e.width,e.height),this.emitUpdate(this.state)}}),this.editor=e,this.pmView=t,this.emitUpdate=()=>{if(!this.state)throw Error("Attempting to update uninitialized side menu");i(this.state)},this.horizontalPosAnchoredAtRoot=!0,this.horizontalPosAnchor=this.pmView.dom.firstChild.getBoundingClientRect().x,document.body.addEventListener("drop",this.onDrop,!0),document.body.addEventListener("dragover",this.onDragOver),this.pmView.dom.addEventListener("dragstart",this.onDragStart),document.body.addEventListener("mousemove",this.onMouseMove,!0),this.pmView.dom.addEventListener("mousedown",this.onMouseDown),document.body.addEventListener("keydown",this.onKeyDown,!0),document.addEventListener("scroll",this.onScroll,!0)}update(){var e;let t=null==(e=this.state)?void 0:e.block.id;this.updateState(),this.needUpdate&&this.state&&t!==this.state.block.id&&(this.emitUpdate(this.state),this.needUpdate=!1)}destroy(){var e;null!=(e=this.state)&&e.show&&(this.state.show=!1,this.emitUpdate(this.state)),document.body.removeEventListener("mousemove",this.onMouseMove,!0),document.body.removeEventListener("dragover",this.onDragOver),this.pmView.dom.removeEventListener("dragstart",this.onDragStart),document.body.removeEventListener("drop",this.onDrop,!0),document.removeEventListener("scroll",this.onScroll,!0),this.pmView.dom.removeEventListener("mousedown",this.onMouseDown),document.body.removeEventListener("keydown",this.onKeyDown,!0)}addBlock(){var e;null!=(e=this.state)&&e.show&&(this.state.show=!1,this.emitUpdate(this.state));let t=this.hoveredBlock.firstChild.getBoundingClientRect(),i=this.pmView.posAtCoords({left:t.left+t.width/2,top:t.top+t.height/2});if(!i)return;let n=F(this.editor._tiptapEditor.state.doc,i.pos);if(void 0===n)return;let{contentNode:o,startPos:r,endPos:s}=n;if("inline*"!==o.type.spec.content||0!==o.textContent.length){let e=s+1;this.editor._tiptapEditor.chain().BNCreateBlock(e).setTextSelection(e+2).run()}else this.editor._tiptapEditor.commands.setTextSelection(r+1);this.pmView.focus(),this.pmView.dispatch(this.pmView.state.tr.scrollIntoView().setMeta(tz,{triggerCharacter:"/",fromUserInput:!1}))}}let tW=new c.H$("SideMenuPlugin");class tK extends tA{constructor(e){super(),D(this,"view"),D(this,"plugin"),D(this,"addBlock",()=>this.view.addBlock()),D(this,"blockDragStart",e=>{this.view.isDragging=!0,function(e,t){let i;if(!e.dataTransfer)return;let o=t.prosemirrorView,r=o.dom.getBoundingClientRect(),s={left:r.left+r.
7width/2,top:e.clientY};for(let e of document.elementsFromPoint(s.left,s.top))if(o.dom.contains(e)){i=tj(e,o);break}if(!i)return;let a=function(e,t){let i=tj(e,t);if(i&&1===i.node.nodeType){let e=t.docView,n=e.nearestDesc(i.node,!0);return n&&n!==e?n.posBefore:null}return null}(i.node,o);if(null!=a){let i=o.state.selection,r=o.state.doc,{from:s,to:l}=function(e,t){let i,n;let o="blockContent"===t.resolve(e.from).node().type.spec.group,r="blockContent"===t.resolve(e.to).node().type.spec.group,s=Math.min(e.$anchor.depth,e.$head.depth);if(o&&r){let o=e.$from.start(s-1),r=e.$to.end(s-1);i=t.resolve(o-1).pos,n=t.resolve(r+1).pos}else i=e.from,n=e.to;return{from:i,to:n}}(i,r),d=s<=a&&a<l,h=i.$anchor.node()!==i.$head.node()||i instanceof tF;d&&h?(o.dispatch(o.state.tr.setSelection(tF.create(r,s,l))),tq(o,s,l)):(o.dispatch(o.state.tr.setSelection(c.qv.create(o.state.doc,a))),tq(o,a));let p=o.state.selection.content(),u=t._tiptapEditor.schema,m=es(u,t).serializeProseMirrorFragment(p.content),f=er(u,t).exportProseMirrorFragment(p.content),g=tS(f);e.dataTransfer.clearData(),e.dataTransfer.setData("blocknote/html",m),e.dataTransfer.setData("text/html",f),e.dataTransfer.setData("text/plain",g),e.dataTransfer.effectAllowed="move",e.dataTransfer.setDragImage(n,0,0),o.dragging={slice:p,move:!0}}}(e,this.editor)}),D(this,"blockDragEnd",()=>tZ()),D(this,"freezeMenu",()=>this.view.menuFrozen=!0),D(this,"unfreezeMenu",()=>{this.view.menuFrozen=!1,this.view.state.show=!1,this.view.emitUpdate(this.view.state)}),this.editor=e,this.plugin=new c.Sy({key:tW,view:t=>(this.view=new tG(e,t,e=>{this.emit("update",e)}),this.view)})}onUpdate(e){return this.on("update",e)}}function tY(){o||((o=document.createElement("div")).innerHTML="_",o.style.opacity="0",o.style.height="1px",o.style.width="1px",document.body.appendChild(o))}function tJ(e){return Array.prototype.indexOf.call(e.parentElement.childNodes,e)}class tX{constructor(e,t,i){D(this,"state"),D(this,"emitUpdate"),D(this,"tableId"),D(this,"tablePos"),D(this,"menuFrozen",!1),D(this,"prevWasEditable",null),D(this,"mouseMoveHandler",e=>{var t;let i;if(this.menuFrozen)return;let n=function(e){for(;e&&"TD"!==e.nodeName&&"TH"!==e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(e.target);if(!n||!this.editor.isEditable){null!=(t=this.state)&&t.show&&(this.state.show=!1,this.emitUpdate());return}let o=tJ(n),r=tJ(n.parentElement),s=n.getBoundingClientRect(),a=n.parentElement.parentElement.getBoundingClientRect(),l=tj(n,this.pmView);if(l&&(this.editor._tiptapEditor.state.doc.descendants((e,t)=>{var n;if("u">typeof i)return!1;if("blockContainer"!==e.type.name||e.attrs.id!==l.id)return!0;let o=et(e,this.editor.schema.blockSchema,this.editor.schema.inlineContentSchema,this.editor.schema.styleSchema,this.editor.blockCache);return n=this.editor,"table"===o.type&&o.type in n.schema.blockSchema&&tm(o.type,n)&&(this.tablePos=t+1,i=o),!1}),i&&(this.tableId=l.id,!(void 0!==this.state&&this.state.show&&this.tableId===l.id&&this.state.rowIndex===r&&this.state.colIndex===o))))return this.state={show:!0,referencePosCell:s,referencePosTable:a,block:i,colIndex:o,rowIndex:r,draggingState:void 0},this.emitUpdate(),!1}),D(this,"dragOverHandler",e=>{var t;if((null==(t=this.state)?void 0:t.draggingState)===void 0)return;e.preventDefault(),e.dataTransfer.dropEffect="move",function(e){e.forEach(e=>{let t=document.getElementsByClassName(e);for(let e=0;e<t.length;e++)t[e].style.visibility="hidden"})}(["column-resize-handle","prosemirror-dropcursor-block","prosemirror-dropcursor-inline"]);let i={left:Math.min(Math.max(e.clientX,this.state.referencePosTable.left+1),this.state.referencePosTable.right-1),top:Math.min(Math.max(e.clientY,this.state.referencePosTable.top+1),this.state.referencePosTable.bottom-1)},n=document.elementsFromPoint(i.left,i.top).filter(e=>"TD"===e.tagName||"TH"===e.tagName);if(0===n.length)throw Error("Could not find table cell element that the mouse cursor is hovering over.");let o=n[0],r=!1,s=tJ(o.parentElement),a=tJ(o),l="row"===this.state.draggingState.draggedCellOrientation?this.state.rowIndex:this.state.colIndex,d=("row"===this.state.draggingState.draggedCellOrientation?s:a)!==l;(this.state.rowIndex!==s||this.state.colIndex!==a)&&(this.state.rowIndex=s,this.state.colIndex=a,this.state.referencePosCell=o.getBoundingClientRect(),r=!0);let c="row"===this.state.draggingState.draggedCellOrientation?i.top:i.left;this.state.draggingState.mousePos!==c&&(this.state.draggingState.mousePos=c,r=!0),r&&this.emitUpdate(),d&&this.pmView.dispatch(this.pmView.state.tr.setMeta(tQ,!0))}),D(this,"dropHandler",e=>{if(void 0===this.state||void 0===this.state.draggingState)return;e.preventDefault();let t=this.state.block.content.rows;if("row"===this.state.draggingState.draggedCellOrientation){let e=t[this.state.draggingState.originalIndex];t.splice(this.state.draggingState.originalIndex,1),t.splice(this.state.rowIndex,0,e)}else{let e=t.map(e=>e.cells[this.state.draggingState.originalIndex]);t.forEach((t,i)=>{t.cells.splice(this.state.draggingState.originalIndex,1),t.cells.splice(this.state.colIndex,0,e[i])})}this.editor.updateBlock(this.state.block,{type:"table",content:{type:"tableContent",rows:t}})}),D(this,"scrollHandler",()=>{var e;if(null!=(e=this.state)&&e.show){let e=document.querySelector(`[data-node-type="blockContainer"][data-id="${this.tableId}"] table`),t=e.querySelector(`tr:nth-child(${this.state.rowIndex+1}) > td:nth-child(${this.state.colIndex+1})`);this.state.referencePosTable=e.getBoundingClientRect(),this.state.referencePosCell=t.getBoundingClientRect(),this.emitUpdate()}}),this.editor=e,this.pmView=t,this.emitUpdate=()=>{if(!this.state)throw Error("Attempting to update uninitialized image toolbar");i(this.state)},t.dom.addEventListener("mousemove",this.mouseMoveHandler),document.addEventListener("dragover",this.dragOverHandler),document.addEventListener("drop",this.dropHandler),document.addEventListener("scroll",this.scrollHandler,!0)}destroy(){this.pmView.dom.removeEventListener("mousemove",this.mouseMoveHandler),document.removeEventListener("dragover",this.dragOverHandler),document.removeEventListener("drop",this.dropHandler),document.removeEventListener("scroll",this.scrollHandler,!0)}}let tQ=new c.H$("TableHandlesPlugin");class t0 extends tA{constructor(e){super(),D(this,"view"),D(this,"plugin"),D(this,"colDragStart",e=>{if(void 0===this.view.state)throw Error("Attempted to drag table column, but no table block was hovered prior.");this.view.state.draggingState={draggedCellOrientation:"col",originalIndex:this.view.state.colIndex,mousePos:e.clientX},this.view.emitUpdate(),this.editor._tiptapEditor.view.dispatch(this.editor._tiptapEditor.state.tr.setMeta(tQ,{draggedCellOrientation:this.view.state.draggingState.draggedCellOrientation,originalIndex:this.view.state.colIndex,newIndex:this.view.state.colIndex,tablePos:this.view.tablePos})),tY(),e.dataTransfer.setDragImage(o,0,0),e.dataTransfer.effectAllowed="move"}),D(this,"rowDragStart",e=>{if(void 0===this.view.state)throw Error("Attempted to drag table row, but no table block was hovered prior.");this.view.state.draggingState={draggedCellOrientation:"row",originalIndex:this.view.state.rowIndex,mousePos:e.clientY},this.view.emitUpdate(),this.editor._tiptapEditor.view.dispatch(this.editor._tiptapEditor.state.tr.setMeta(tQ,{draggedCellOrientation:this.view.state.draggingState.draggedCellOrientation,originalIndex:this.view.state.rowIndex,newIndex:this.view.state.rowIndex,tablePos:this.view.tablePos})),tY(),e.dataTransfer.setDragImage(o,0,0),e.dataTransfer.effectAllowed="copyMove"}),D(this,"dragEnd",()=>{if(void 0===this.view.state)throw Error("Attempted to drag table row, but no table block was hovered prior.");this.view.state.draggingState=void 0,this.view.emitUpdate(),this.editor._tiptapEditor.view.dispatch(this.editor._tiptapEditor.state.tr.setMeta(tQ,null)),o&&(
7document.body.removeChild(o),o=void 0)}),D(this,"freezeHandles",()=>{this.view.menuFrozen=!0}),D(this,"unfreezeHandles",()=>{this.view.menuFrozen=!1}),this.editor=e,this.plugin=new c.Sy({key:tQ,view:t=>(this.view=new tX(e,t,e=>{this.emit("update",e)}),this.view),props:{decorations:e=>{if(void 0===this.view||void 0===this.view.state||void 0===this.view.state.draggingState||void 0===this.view.tablePos)return;let t="row"===this.view.state.draggingState.draggedCellOrientation?this.view.state.rowIndex:this.view.state.colIndex,i=[];if(t===this.view.state.draggingState.originalIndex)return T.EH.create(e.doc,i);let n=e.doc.resolve(this.view.tablePos+1),o=n.node();if("row"===this.view.state.draggingState.draggedCellOrientation){let o=e.doc.resolve(n.posAtIndex(t)+1),r=o.node();for(let n=0;n<r.childCount;n++){let r=e.doc.resolve(o.posAtIndex(n)+1),s=r.node(),a=r.pos+(t>this.view.state.draggingState.originalIndex?s.nodeSize-2:0);i.push(T.p.widget(a,()=>{let e=document.createElement("div");return e.className="bn-table-drop-cursor",e.style.left="0",e.style.right="0",t>this.view.state.draggingState.originalIndex?e.style.bottom="-2px":e.style.top="-3px",e.style.height="4px",e}))}}else for(let r=0;r<o.childCount;r++){let o=e.doc.resolve(n.posAtIndex(r)+1),s=e.doc.resolve(o.posAtIndex(t)+1),a=s.node(),l=s.pos+(t>this.view.state.draggingState.originalIndex?a.nodeSize-2:0);i.push(T.p.widget(l,()=>{let e=document.createElement("div");return e.className="bn-table-drop-cursor",e.style.top="0",e.style.bottom="0",t>this.view.state.draggingState.originalIndex?e.style.right="-2px":e.style.left="-3px",e.style.width="4px",e}))}return T.EH.create(e.doc,i)}}})}onUpdate(e){return this.on("update",e)}}function t1(e,t){let i=e.state.selection.content().content,n=es(e.state.schema,t).serializeProseMirrorFragment(i),o=er(e.state.schema,t).exportProseMirrorFragment(i),r=tS(o);return{internalHTML:n,externalHTML:o,plainText:r}}let t2=e=>d.hj.create({name:"copyToClipboard",addProseMirrorPlugins:()=>[new c.Sy({props:{handleDOMEvents:{copy(t,i){i.preventDefault(),i.clipboardData.clearData(),"node"in t.state.selection&&"blockContent"===t.state.selection.node.type.spec.group&&t.dispatch(t.state.tr.setSelection(new c.qv(t.state.doc.resolve(t.state.selection.from-1))));let{internalHTML:n,externalHTML:o,plainText:r}=t1(t,e);return i.clipboardData.setData("blocknote/html",n),i.clipboardData.setData("text/html",o),i.clipboardData.setData("text/plain",r),!0},dragstart(t,i){if(!("node"in t.state.selection)||"blockContent"!==t.state.selection.node.type.spec.group)return;t.dispatch(t.state.tr.setSelection(new c.qv(t.state.doc.resolve(t.state.selection.from-1)))),i.preventDefault(),i.dataTransfer.clearData();let{internalHTML:n,externalHTML:o,plainText:r}=t1(t,e);return i.dataTransfer.setData("blocknote/html",n),i.dataTransfer.setData("text/html",o),i.dataTransfer.setData("text/plain",r),!0}}}})]}),t4=["blocknote/html","text/html","text/plain"],t3=e=>d.hj.create({name:"pasteFromClipboard",addProseMirrorPlugins:()=>[new c.Sy({props:{handleDOMEvents:{paste(t,i){if(i.preventDefault(),!e.isEditable)return;let n=null;for(let e of t4)if(i.clipboardData.types.includes(e)){n=e;break}if(null!==n){let t=i.clipboardData.getData(n);"text/html"===n&&(t=tx(t.trim()).innerHTML),e._tiptapEditor.view.pasteHTML(t)}return!0}}}})]}),t5=d.hj.create({name:"blockBackgroundColor",addGlobalAttributes:()=>[{types:["blockContainer"],attributes:{backgroundColor:{default:eu.backgroundColor.default,parseHTML:e=>e.hasAttribute("data-background-color")?e.getAttribute("data-background-color"):eu.backgroundColor.default,renderHTML:e=>e.backgroundColor!==eu.backgroundColor.default&&{"data-background-color":e.backgroundColor}}}}]}),t9=d.hj.create({name:"textAlignment",addGlobalAttributes:()=>[{types:["paragraph","heading","bulletListItem","numberedListItem","checkListItem"],attributes:{textAlignment:{default:"left",parseHTML:e=>e.getAttribute("data-text-alignment"),renderHTML:e=>"left"!==e.textAlignment&&{"data-text-alignment":e.textAlignment}}}}]}),t7=d.hj.create({name:"blockTextColor",addGlobalAttributes:()=>[{types:["blockContainer"],attributes:{textColor:{default:eu.textColor.default,parseHTML:e=>e.hasAttribute("data-text-color")?e.getAttribute("data-text-color"):eu.textColor.default,renderHTML:e=>e.textColor!==eu.textColor.default&&{"data-text-color":e.textColor}}}}]}),t8=d.hj.create({name:"trailingNode",addProseMirrorPlugins(){let e=new c.H$(this.name);return[new c.Sy({key:e,appendTransaction:(t,i,n)=>{let{doc:o,tr:r,schema:s}=n,a=e.getState(n),l=o.content.size-2,d=s.nodes.blockContainer,c=s.nodes.paragraph;if(a)return r.insert(l,d.create(void 0,c.create()))},state:{init:(e,t)=>
7{},apply:(e,t)=>{if(!e.docChanged)return t;let i=e.doc.lastChild;if(!i||"blockGroup"!==i.type.name)throw Error("Expected blockGroup");if(!(i=i.lastChild)||"blockContainer"!==i.type.name)throw Error("Expected blockContainer");let n=i.firstChild;if(!n)throw Error("Expected blockContent");return i.nodeSize>4||"inline*"!==n.type.spec.content}}})]}}),t6=new c.H$("non-editable-block"),ie=()=>new c.Sy({key:t6,props:{handleKeyDown:(e,t)=>{if("node"in e.state.selection){if(t.ctrlKey||t.metaKey)return!1;if(1===t.key.length)return t.preventDefault(),!0;if("Enter"===t.key){let t=e.state.tr;return e.dispatch(t.insert(e.state.tr.selection.$to.after(),e.state.schema.nodes.paragraph.create()).setSelection(new c.Bs(t.doc.resolve(e.state.tr.selection.$to.after()+1)))),!0}}return!1}}}),it=new c.H$("previous-blocks"),ii={index:"index",level:"level",type:"type",depth:"depth","depth-change":"depth-change"},io=()=>{let e;return new c.Sy({key:it,view(t){return{update:async(t,i)=>{var n;(null==(n=this.key)?void 0:n.getState(t.state).updatedBlocks.size)>0&&(e=setTimeout(()=>{t.dispatch(t.state.tr.setMeta(it,{clearUpdate:!0}))},0))},destroy:()=>{e&&clearTimeout(e)}}},state:{init:()=>({prevTransactionOldBlockAttrs:{},currentTransactionOldBlockAttrs:{},updatedBlocks:new Set}),apply(e,t,i,n){if(t.currentTransactionOldBlockAttrs={},t.updatedBlocks.clear(),!e.docChanged||i.doc.eq(n.doc))return t;let o={},r=(0,d.N2)(i.doc,e=>e.attrs.id),s=new Map(r.map(e=>[e.node.attrs.id,e]));for(let r of(0,d.N2)(n.doc,e=>e.attrs.id)){let a=s.get(r.node.attrs.id),l=null==a?void 0:a.node.firstChild,d=r.node.firstChild;if(a&&l&&d){let s={index:d.attrs.index,level:d.attrs.level,type:d.type.name,depth:n.doc.resolve(r.pos).depth},c={index:l.attrs.index,level:l.attrs.level,type:l.type.name,depth:i.doc.resolve(a.pos).depth};o[r.node.attrs.id]=c,e.getMeta("numberedListIndexing")&&(r.node.attrs.id in t.prevTransactionOldBlockAttrs&&(c=t.prevTransactionOldBlockAttrs[r.node.attrs.id]),"numberedListItem"===s.type&&(c.index=s.index)),t.currentTransactionOldBlockAttrs[r.node.attrs.id]=c,JSON.stringify(c)!==JSON.stringify(s)&&(c["depth-change"]=c.depth-s.depth,t.updatedBlocks.add(r.node.attrs.id))}}return t.prevTransactionOldBlockAttrs=o,t}},props:{decorations(e){let t=this.getState(e);if(0===t.updatedBlocks.size)return;let i=[];return e.doc.descendants((e,n)=>{if(!e.attrs.id||!t.updatedBlocks.has(e.attrs.id))return;let o=t.currentTransactionOldBlockAttrs[e.attrs.id],r={};for(let[e,t]of Object.entries(o))r["data-prev-"+ii[e]]=t||"none";let s=T.p.node(n,n+e.nodeSize,{...r});i.push(s)}),T.EH.create(e.doc,i)}}})},ir={blockColor:"data-block-color",blockStyle:"data-block-style",id:"data-id",depth:"data-depth",depthChange:"data-depth-change"},is=d.NB.create({name:"blockContainer",group:"blockContainer",content:"blockContent blockGroup?",priority:50,defining:!0,parseHTML:()=>[{tag:"div",getAttrs:e=>{if("string"==typeof e)return!1;let t={};for(let[i,n]of Object.entries(ir))e.getAttribute(n)&&(t[i]=e.getAttribute(n));return"blockContainer"===e.getAttribute("data-node-type")&&t}}],renderHTML({HTMLAttributes:e}){var t;let i=document.createElement("div");for(let[t,n]of(i.className="bn-block-outer",i.setAttribute("data-node-type","blockOuter"),Object.entries(e)))"class"!==t&&i.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=ed("bn-block",n.class),o.setAttribute("data-node-type",this.name),Object.entries(n)))"class"!==e&&o.setAttribute(e,t);return i.appendChild(o),{dom:i,contentDOM:o}},addCommands(){return{BNCreateBlock:e=>({state:t,dispatch:i})=>{let n=t.schema.nodes.blockContainer.createAndFill();return i&&t.tr.insert(e,n).scrollIntoView(),!0},BNDeleteBlock:e=>({state:t,dispatch:i})=>{let n=F(t.doc,e);if(void 0===n)return!1;let{startPos:o,endPos:r}=n;return i&&t.tr.deleteRange(o,r),!0},BNUpdateBlock:(e,t)=>({state:i,dispatch:n})=>{let o=F(i.doc,e);if(void 0===o)return!1;let{startPos:s,endPos:a,node:l,contentNode:d}=o;if(n){if(void 0!==t.children){let e=[];for(let n of t.children)e.push(Q(n,i.schema,this.options.editor.schema.styleSchema));2===l.childCount?i.tr.replace(s+d.nodeSize+1,a-1,new r.p2(r.HY.from(e),0,0)):i.tr.insert(s+d.nodeSize,i.schema.nodes.blockGroup.create({},e))}let e=d.type.name,n=t.type||e,o="keep";if(t.content){if("string"==typeof t.content)o=Y([t.content],i.schema,this.options.editor.schema.styleSchema);else if(Array.isArray(t.content))o=Y(t.content,i.schema,this.options.editor.schema.styleSchema);else if("tableContent"===t.content.type)o=J(t.content,i.schema,this.options.editor.schema.styleSchema);else throw new Z(t.content.type)}else{let t=i.schema.nodes[e].spec.content,r=i.schema.nodes[n].spec.content;""===t||r!==t&&(o=[])}
7"keep"===o?i.tr.setNodeMarkup(s,void 0===t.type?void 0:i.schema.nodes[t.type],{...d.attrs,...t.props}):i.tr.replaceWith(s,a,i.schema.nodes[n].create({...d.attrs,...t.props},o)).setSelection(""===i.schema.nodes[n].spec.content?new c.qv(i.tr.doc.resolve(s)):new c.Bs("inline*"===i.schema.nodes[n].spec.content?i.tr.doc.resolve(s):i.tr.doc.resolve(s+4))),i.tr.setNodeMarkup(s-1,void 0,{...l.attrs,...t.props})}return!0},BNMergeBlocks:e=>({state:t,dispatch:i})=>{let n="blockContainer"===t.doc.resolve(e+1).node().type.name,o="blockContainer"===t.doc.resolve(e-1).node().type.name;if(!n||!o)return!1;let{node:s,contentNode:a,startPos:l,endPos:d,depth:h}=F(t.doc,e+1);if(2===s.childCount){let e=t.doc.resolve(l+a.nodeSize+1),n=t.doc.resolve(d-1),o=e.blockRange(n);i&&t.tr.lift(o,h-1)}let p=e-1,u=F(t.doc,p);for(;u.numChildBlocks>0;)if(p--,void 0===(u=F(t.doc,p)))return!1;return i&&(i(t.tr.deleteRange(l,l+a.nodeSize).replace(p-1,l,new r.p2(a.content,0,0)).scrollIntoView()),t.tr.setSelection(new c.Bs(t.doc.resolve(p-1)))),!0},BNSplitBlock:(e,t,i)=>({state:n,dispatch:o})=>{let s=F(n.doc,e);if(void 0===s)return!1;let{contentNode:a,contentType:l,startPos:d,endPos:h,depth:p}=s,u=n.doc.cut(d+1,e),m=n.doc.cut(e,h-1),f=n.schema.nodes.blockContainer.createAndFill(),g=h+1,b=g+2;return o&&(n.tr.insert(g,f),n.tr.replace(b,b+1,m.content.size>0?new r.p2(r.HY.from(m),p+2,p+2):void 0),t&&n.tr.setBlockType(b,b,n.schema.node(l).type,i?a.attrs:void 0),n.tr.setSelection(new c.Bs(n.doc.resolve(b))),n.tr.replace(d+1,h-1,u.content.size>0?new r.p2(r.HY.from(u),p+2,p+2):void 0),n.tr.scrollIntoView()),!0}}},addProseMirrorPlugins:()=>[io(),ie()],addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.undoInputRule(),()=>e.command(({state:t})=>{let{contentType:i,startPos:n}=F(t.doc,t.selection.from),o=t.selection.from===n+1,r="paragraph"===i.name;return!!o&&!r&&e.BNUpdateBlock(t.selection.from,{type:"paragraph",props:{}})}),()=>e.command(({state:t})=>{let{startPos:i}=F(t.doc,t.selection.from);return t.selection.from===i+1&&e.liftListItem("blockContainer")}),()=>e.command(({state:t})=>{let{depth:i,startPos:n}=F(t.doc,t.selection.from),o=t.selection.from===n+1,r=t.selection.empty;return 2!==n&&!!o&&!!r&&2===i&&e.BNMergeBlocks(n-1)})]),Delete:()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.command(({state:t})=>{let{node:i,depth:n,endPos:o}=F(t.doc,t.selection.from),r=o===t.doc.nodeSize-4,s=t.selection.from===o-1,a=t.selection.empty,l=2===i.childCount;if(!r&&s&&a&&!l){let i=n,r=o+2,s=t.doc.resolve(r).depth;for(;s<i;)i=s,r+=2,s=t.doc.resolve(r).depth;return e.BNMergeBlocks(r-1)}return!1})]),Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.command(({state:t})=>{let{contentNode:i,depth:n}=F(t.doc,t.selection.from),o=0===t.selection.$anchor.parentOffset,r=t.selection.anchor===t.selection.head,s=0===i.childCount;return!!o&&!!r&&!!s&&n>2&&e.liftListItem("blockContainer")}),()=>e.command(({state:e,chain:t})=>{let{contentNode:i,endPos:n}=F(e.doc,e.selection.from),o=0===e.selection.$anchor.parentOffset,r=e.selection.anchor===e.selection.head,s=0===i.childCount;if(o&&r&&s){let e=n+1;return t().BNCreateBlock(e).setTextSelection(e+2).run(),!0}return!1}),()=>e.command(({state:e,chain:t})=>{let{contentNode:i}=F(e.doc,e.selection.from),n=0===e.selection.$anchor.parentOffset;return 0!==i.childCount&&(t().deleteSelection().BNSplitBlock(e.selection.from,n,n).run(),!0)})]),Tab:()=>{var e,t,i;return(null==(e=this.options.editor.formattingToolbar)||!e.shown)&&(null==(t=this.options.editor.linkToolbar)||!t.shown)&&(null==(i=this.options.editor.filePanel)||!i.shown)&&(this.editor.commands.sinkListItem("blockContainer"),!0)},"Shift-Tab":()=>{var e,t,i;return(null==(e=this.options.editor.formattingToolbar)||!e.shown)&&(null==(t=this.options.editor.linkToolbar)||!t.shown)&&(null==(i=this.options.editor.filePanel)||!i.shown)&&(this.editor.commands.liftListItem("blockContainer"),!0)}}}}),ia=d.NB.create({name:"blockGroup",group:"blockGroup",content:"blockContainer+",parseHTML:()=>[{tag:"div",getAttrs:e=>"string"!=typeof e&&"blockGroup"===e.getAttribute("data-node-type")&&null}],renderHTML({HTMLAttributes:e}){var t;let i={...(null==(t=this.options.domAttributes)?void 0:t.blockGroup)||{},...e},n=document.createElement("div");for(let[e,t]of(n.className=ed("bn-block-group",i.class),n.setAttribute("data-node-type","blockGroup"),Object.entries(i)))"class"!==e&&n.setAttribute(e,t);return{dom:n,contentDOM:n}}}),il=d.NB.create({name:"doc",topNode:!0,content:"blockGroup"}),id=e=>{var t;
7let i=[d.Rw.ClipboardTextSerializer,d.Rw.Commands,d.Rw.Editable,d.Rw.FocusEvents,d.Rw.Tabindex,_.f,z.configure({types:["blockContainer"]}),N.U.extend({priority:10}),U.x,P.rU.extend({addKeyboardShortcuts(){return{"Mod-k":()=>(this.editor.commands.toggleLink({href:""}),!0)}}}),...Object.values(e.styleSpecs).map(e=>e.implementation.mark),t7,t5,t9,d.hj.create({name:"OverrideEscape",addKeyboardShortcuts(){return{Escape:()=>!e.editor.suggestionMenus.shown&&this.editor.commands.blur()}}}),il,is.configure({editor:e.editor,domAttributes:e.domAttributes}),ia.configure({domAttributes:e.domAttributes}),...Object.values(e.inlineContentSpecs).filter(e=>"link"!==e.config&&"text"!==e.config).map(t=>t.implementation.node.configure({editor:e.editor})),...Object.values(e.blockSpecs).flatMap(t=>[...(t.implementation.requiredExtensions||[]).map(t=>t.configure({editor:e.editor,domAttributes:e.domAttributes})),t.implementation.node.configure({editor:e.editor,domAttributes:e.domAttributes})]),t2(e.editor),t3(e.editor),B.m.configure({width:5,color:"#ddeeff"}),...void 0===e.trailingBlock||e.trailingBlock?[t8]:[]];return e.collaboration?(i.push(A.ZP.configure({fragment:e.collaboration.fragment})),null!=(t=e.collaboration.provider)&&t.awareness&&i.push(H.Z.configure({user:e.collaboration.user,render:e.collaboration.renderCursor||(e=>{let t=document.createElement("span");t.classList.add("collaboration-cursor__caret"),t.setAttribute("style",`border-color: ${e.color}`);let i=document.createElement("span");i.classList.add("collaboration-cursor__label"),i.setAttribute("style",`background-color: ${e.color}`),i.insertBefore(document.createTextNode(e.name),null);let n=document.createTextNode("â "),o=document.createTextNode("â ");return t.insertBefore(n,null),t.insertBefore(i,null),t.insertBefore(o,null),t}),provider:e.collaboration.provider}))):i.push(I.A),i};function ic(e,t){let i=r.HY.from(e.content);for(let e=0;e<i.childCount;e++)if("blockContent"===i.child(e).type.spec.group){let n=[i.child(e)];if(e+1<i.childCount&&"blockGroup"===i.child(e+1).type.spec.group){let t=i.child(e+1).child(0).child(0);("bulletListItem"===t.type.name||"numberedListItem"===t.type.name||"checkListItem"===t.type.name)&&(n.push(i.child(e+1)),i=function(e,t){let i=[];return e.forEach((e,n,o)=>{o!==t&&i.push(e)}),r.HY.from(i)}(i,e+1))}let o=t.state.schema.nodes.blockContainer.create(void 0,n);i=i.replaceChild(e,o)}return new r.p2(i,e.openStart,e.openEnd)}function ih(e){return e&&Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}class ip{constructor(e){D(this,"blockSpecs"),D(this,"inlineContentSpecs"),D(this,"styleSpecs"),D(this,"blockSchema"),D(this,"inlineContentSchema"),D(this,"styleSchema"),D(this,"BlockNoteEditor","only for types"),D(this,"Block","only for types"),D(this,"PartialBlock","only for types"),this.blockSpecs=ih(null==e?void 0:e.blockSpecs)||tc,this.inlineContentSpecs=ih(null==e?void 0:e.inlineContentSpecs)||tu,this.styleSpecs=ih(null==e?void 0:e.styleSpecs)||tp,this.blockSchema=eE(this.blockSpecs),this.inlineContentSchema=ex(this.inlineContentSpecs),this.styleSchema=eB(this.styleSpecs)}static create(e){return new ip(e)}}class iu extends d.ML{constructor(e,t){let i,n;super({...e,content:void 0}),D(this,"_state"),D(this,"mount",e=>{e?(this.options.element=e,this.createViewAlternative()):this.destroy()});let o=this.schema,s=o.nodes.doc.createAndFill;o.nodes.doc.createAndFill=(...e)=>{if(i)return i;let t=JSON.parse(JSON.stringify(s.apply(o.nodes.doc,e).toJSON()));return t.content[0].content[0].attrs.id="initialBlockId",i=r.NB.fromJSON(o,t)};try{let i=null==e?void 0:e.content.map(e=>Q(e,this.schema,t).toJSON());n=(0,d.OE)({type:"doc",content:[{type:"blockGroup",content:i}]},this.schema,this.options.parseOptions)}catch(t){throw console.error("Error creating document from blocks passed as `initialContent`. Caused by exception: ",t),Error("Error creating document from blocks passed as `initialContent`:\n"+ +JSON.stringify(e.content))}this._state=c.yy.create({doc:n,schema:this.schema})}get state(){return this.view&&(this._state=this.view.state),this._state}createView(){}createViewAlternative(){queueMicrotask(()=>{this.view=new T.tk({mount:this.options.element},{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:this.state});let e=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(e),this.createNodeViews()})}}let im=new c.H$("blocknote-placeholder"),ig=(e,t)=>
7new c.Sy({key:im,view:()=>{let i=document.createElement("style"),n=e._tiptapEditor.options.injectNonce;n&&i.setAttribute("nonce",n),document.head.appendChild(i);let o=i.sheet,r=(e="")=>`.bn-block-content${e} .bn-inline-content:has(> .ProseMirror-trailingBreak:only-child):before`,s=(e,t=!0)=>{let i=t?"[data-is-empty-and-focused]":"";return"default"===e?r(i):r(i+`[data-content-type="${e}"]`)};for(let[e,i]of Object.entries(t)){let t="default"===e;o.insertRule(`${s(e,t)}{ content: ${JSON.stringify(i)}; }`),t||o.insertRule(`${s(e,!0)}{ content: ${JSON.stringify(i)}; }`)}return{destroy:()=>{document.head.removeChild(i)}}},props:{decorations:t=>{let{doc:i,selection:n}=t;if(!e.isEditable||!n.empty)return;let o=n.$anchor,r=o.parent;if(r.content.size>0)return null;let s=o.before(),a=T.p.node(s,s+r.nodeSize,{"data-is-empty-and-focused":"true"});return T.EH.create(i,[a])}}}),ib={enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!1};class iv{constructor(e){var t,i,n,o,r,s,a,l;if(D(this,"_tiptapEditor"),D(this,"blockCache",new WeakMap),D(this,"dictionary"),D(this,"schema"),D(this,"blockImplementations"),D(this,"inlineContentImplementations"),D(this,"styleImplementations"),D(this,"formattingToolbar"),D(this,"linkToolbar"),D(this,"sideMenu"),D(this,"suggestionMenus"),D(this,"filePanel"),D(this,"tableHandles"),D(this,"uploadFile"),D(this,"resolveFileUrl"),this.options=e,e.onEditorContentChange)throw Error("onEditorContentChange initialization option is deprecated, use <BlockNoteView onChange={...} />, the useEditorChange(...) hook, or editor.onChange(...)");if(e.onTextCursorPositionChange)throw Error("onTextCursorPositionChange initialization option is deprecated, use <BlockNoteView onSelectionChange={...} />, the useEditorSelectionChange(...) hook, or editor.onSelectionChange(...)");if(e.onEditorReady)throw Error("onEditorReady is deprecated. Editor is immediately ready for use after creation.");if(e.editable)throw Error("editable initialization option is deprecated, use <BlockNoteView editable={true/false} />, or alternatively editor.isEditable = true/false");this.dictionary=e.dictionary||R;let c={defaultStyles:!0,schema:e.schema||ip.create(),...e,placeholders:{...this.dictionary.placeholders,...e.placeholders}};this.schema=c.schema,this.blockImplementations=c.schema.blockSpecs,this.inlineContentImplementations=c.schema.inlineContentSpecs,this.styleImplementations=c.schema.styleSpecs,this.formattingToolbar=new tP(this),this.linkToolbar=new tO(this),this.sideMenu=new tK(this),this.suggestionMenus=new t$(this),this.filePanel=new t_(this),tm("table",this)&&(this.tableHandles=new t0(this));let h=id({editor:this,domAttributes:c.domAttributes||{},blockSchema:this.schema.blockSchema,blockSpecs:this.schema.blockSpecs,styleSpecs:this.schema.styleSpecs,inlineContentSpecs:this.schema.inlineContentSpecs,collaboration:c.collaboration,trailingBlock:c.trailingBlock}),p=d.hj.create({name:"BlockNoteUIExtension",addProseMirrorPlugins:()=>[this.formattingToolbar.plugin,this.linkToolbar.plugin,this.sideMenu.plugin,this.suggestionMenus.plugin,...this.filePanel?[this.filePanel.plugin]:[],...this.tableHandles?[this.tableHandles.plugin]:[],ig(this,c.placeholders)]});h.push(p),this.uploadFile=c.uploadFile,this.resolveFileUrl=c.resolveFileUrl||(async e=>e),c.collaboration&&c.initialContent&&console.warn("When using Collaboration, initialContent might cause conflicts, because changes should come from the collaboration provider");let u=c.initialContent||(e.collaboration?[{type:"paragraph",id:"initialBlockId"}]:[{type:"paragraph",id:z.options.generateID()}]);if(!Array.isArray(u)||0===u.length)throw Error("initialContent must be a non-empty array of blocks, received: "+u);let m={...ib,...c._tiptapOptions,content:u,extensions:!1===c.enableBlockNoteExtensions?(null==(t=c._tiptapOptions)?void 0:t.extensions)||[]:[...(null==(i=c._tiptapOptions)?void 0:i.extensions)||[],...h],editorProps:{...null==(n=c._tiptapOptions)?void 0:n.editorProps,attributes:{...null==(r=null==(o=c._tiptapOptions)?void 0:o.editorProps)?void 0:r.attributes,...null==(s=c.domAttributes)?void 0:s.editor,class:ed("bn-editor",c.defaultStyles?"bn-default-styles":"",(null==(l=null==(a=c.domAttributes)?void 0:a.editor)?void 0:l.class)||"")},transformPasted:ic}};this._tiptapEditor=new iu(m,this.schema.styleSchema)}static create(e={}){return new iv(e)}mount(e){this._tiptapEditor.mount(e)}get prosemirrorView(){return this._tiptapEditor.view}get domElement(){return this._tiptapEditor.view.dom}isFocused(){return this._tiptapEditor.view.hasFocus()}focus(){this._tiptapEditor.view.focus()}get topLevelBlocks(){return this.topLevelBlocks}get document(){let e=[];return this._tiptapEditor.state.doc.firstChild.descendants(t=>(e.push(et(t,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache)),!1)),e}getBlock(e){let t;let i="string"==typeof e?e:e.id;return this._tiptapEditor.state.doc.firstChild.descendants(e=>!("u">
7typeof t)&&("blockContainer"!==e.type.name||e.attrs.id!==i||(t=et(e,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache),!1))),t}forEachBlock(e,t=!1){let i=this.document.slice();t&&i.reverse(),function i(n){for(let o of n)if(!e(o)||!i(t?o.children.slice().reverse():o.children))return!1;return!0}(i)}onEditorContentChange(e){this._tiptapEditor.on("update",e)}onEditorSelectionChange(e){this._tiptapEditor.on("selectionUpdate",e)}getTextCursorPosition(){let e,t;let{node:i,depth:n,startPos:o,endPos:r}=F(this._tiptapEditor.state.doc,this._tiptapEditor.state.selection.from),s=this._tiptapEditor.state.doc.resolve(r).index(n-1),a=this._tiptapEditor.state.doc.resolve(r+1).node().childCount;return s>0&&(e=this._tiptapEditor.state.doc.resolve(o-2).node()),s<a-1&&(t=this._tiptapEditor.state.doc.resolve(r+2).node()),{block:et(i,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache),prevBlock:void 0===e?void 0:et(e,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache),nextBlock:void 0===t?void 0:et(t,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache)}}setTextCursorPosition(e,t="start"){let{posBeforeNode:i}=ty("string"==typeof e?e:e.id,this._tiptapEditor.state.doc),{startPos:n,contentNode:o}=F(this._tiptapEditor.state.doc,i+2),r=this.schema.blockSchema[o.type.name].content;if("none"===r){this._tiptapEditor.commands.setNodeSelection(n);return}if("inline"===r)"start"===t?this._tiptapEditor.commands.setTextSelection(n+1):this._tiptapEditor.commands.setTextSelection(n+o.nodeSize-1);else if("table"===r)"start"===t?this._tiptapEditor.commands.setTextSelection(n+4):this._tiptapEditor.commands.setTextSelection(n+o.nodeSize-4);else throw new Z(r)}getSelection(){if(this._tiptapEditor.state.selection.from===this._tiptapEditor.state.selection.to||"node"in this._tiptapEditor.state.selection)return;let e=[];return this._tiptapEditor.state.doc.descendants((t,i)=>"blockContent"!==t.type.spec.group||i+t.nodeSize<this._tiptapEditor.state.selection.from||i>this._tiptapEditor.state.selection.to||(e.push(et(this._tiptapEditor.state.doc.resolve(i).node(),this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this.blockCache)),!1)),{blocks:e}}get isEditable(){return this._tiptapEditor.isEditable}set isEditable(e){this._tiptapEditor.options.editable!==e&&this._tiptapEditor.setEditable(e)}insertBlocks(e,t,i="before"){return function(e,t,i="before",n){let o=n._tiptapEditor,r="string"==typeof t?t:t.id,s=[];for(let t of e)s.push(Q(t,o.schema,n.schema.styleSchema));let{node:a,posBeforeNode:l}=ty(r,o.state.doc);if("before"===i&&o.view.dispatch(o.state.tr.insert(l,s)),"after"===i&&o.view.dispatch(o.state.tr.insert(l+a.nodeSize,s)),"nested"===i&&a.childCount<2){let e=o.state.schema.nodes.blockGroup.create({},s);o.view.dispatch(o.state.tr.insert(l+a.firstChild.nodeSize+1,e))}let d=[];for(let e of s)d.push(et(e,n.schema.blockSchema,n.schema.inlineContentSchema,n.schema.styleSchema,n.blockCache));return d}(e,t,i,this)}updateBlock(e,t){return function(e,t,i){let n=i._tiptapEditor,{posBeforeNode:o}=ty("string"==typeof e?e:e.id,n.state.doc);return n.commands.BNUpdateBlock(o+1,t),et(n.state.doc.resolve(o+1).node(),i.schema.blockSchema,i.schema.inlineContentSchema,i.schema.styleSchema,i.blockCache)}(e,t,this)}removeBlocks(e){return tw(e,this)}replaceBlocks(e,t){return function(e,t,i){let n=i._tiptapEditor,o=[];for(let e of t)o.push(Q(e,n.schema,i.schema.styleSchema));let r="string"==typeof e[0]?e[0]:e[0].id,s=tw(e,i,(e,t,i,n)=>{if(e.attrs.id===r){let e=i.doc.nodeSize;return i.insert(t,o),n+e-i.doc.nodeSize}return n}),a=[];for(let e of o)a.push(et(e,i.schema.blockSchema,i.schema.inlineContentSchema,i.schema.styleSchema,i.blockCache));return{insertedBlocks:a,removedBlocks:s}}(e,t,this)}insertInlineContent(e){let t=Y(e,this._tiptapEditor.schema,this.schema.styleSchema);!function(e,t,i,n={updateSelection:!0}
7){let o=i._tiptapEditor,r=o.state.tr,{from:s,to:a}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},l=!0,c=!0,h="";if(t.forEach(e=>{e.check(),l&&e.isText&&0===e.marks.length?h+=e.text:l=!1,c=!!c&&e.isBlock}),s===a&&c){let{parent:e}=r.doc.resolve(s);!e.isTextblock||e.type.spec.code||e.childCount||(s-=1,a+=1)}l?r.insertText(h,s,a):r.replaceWith(s,a,t),n.updateSelection&&(0,d.nj)(r,r.steps.length-1,-1),o.view.dispatch(r)}({from:this._tiptapEditor.state.selection.from,to:this._tiptapEditor.state.selection.to},t,this)}getActiveStyles(){let e={};for(let t of this._tiptapEditor.state.selection.$to.marks()){let i=this.schema.styleSchema[t.type.name];if(!i){"link"!==t.type.name&&console.warn("mark not found in styleschema",t.type.name);continue}"boolean"===i.propSchema?e[i.type]=!0:e[i.type]=t.attrs.stringValue}return e}addStyles(e){for(let[t,i]of Object.entries(e)){let e=this.schema.styleSchema[t];if(!e)throw Error(`style ${t} not found in styleSchema`);if("boolean"===e.propSchema)this._tiptapEditor.commands.setMark(t);else if("string"===e.propSchema)this._tiptapEditor.commands.setMark(t,{stringValue:i});else throw new Z(e.propSchema)}}removeStyles(e){for(let t of Object.keys(e))this._tiptapEditor.commands.unsetMark(t)}toggleStyles(e){for(let[t,i]of Object.entries(e)){let e=this.schema.styleSchema[t];if(!e)throw Error(`style ${t} not found in styleSchema`);if("boolean"===e.propSchema)this._tiptapEditor.commands.toggleMark(t);else if("string"===e.propSchema)this._tiptapEditor.commands.toggleMark(t,{stringValue:i});else throw new Z(e.propSchema)}}getSelectedText(){return this._tiptapEditor.state.doc.textBetween(this._tiptapEditor.state.selection.from,this._tiptapEditor.state.selection.to)}getSelectedLinkUrl(){return this._tiptapEditor.getAttributes("link").href}createLink(e,t){if(""===e)return;let{from:i,to:n}=this._tiptapEditor.state.selection;t||(t=this._tiptapEditor.state.doc.textBetween(i,n));let o=this._tiptapEditor.schema.mark("link",{href:e});this._tiptapEditor.view.dispatch(this._tiptapEditor.view.state.tr.insertText(t,i,n).addMark(i,i+t.length,o))}canNestBlock(){let{startPos:e,depth:t}=F(this._tiptapEditor.state.doc,this._tiptapEditor.state.selection.from);return this._tiptapEditor.state.doc.resolve(e).index(t-1)>0}nestBlock(){this._tiptapEditor.commands.sinkListItem("blockContainer")}canUnnestBlock(){let{depth:e}=F(this._tiptapEditor.state.doc,this._tiptapEditor.state.selection.from);return e>2}unnestBlock(){this._tiptapEditor.commands.liftListItem("blockContainer")}async blocksToHTMLLossy(e=this.document){return er(this._tiptapEditor.schema,this).exportBlocks(e)}async tryParseHTMLToBlocks(e){return tL(e,this.schema.blockSchema,this.schema.inlineContentSchema,this.schema.styleSchema,this._tiptapEditor.schema)}async blocksToMarkdownLossy(e=this.document){return tS(er(this._tiptapEditor.schema,this).exportBlocks(e))}async tryParseMarkdownToBlocks(e){var t,i,n,o;return t=this.schema.blockSchema,i=this.schema.inlineContentSchema,n=this.schema.styleSchema,o=this._tiptapEditor.schema,tL((0,l.l)().use(M.Z).use(E.Z).use(x.Z,{handlers:{...L.q,code:tT}}).use(a.Z).processSync(e).value,t,i,n,o)}updateCollaborationUserInfo(e){if(!this.options.collaboration)throw Error("Cannot update collaboration user info when collaboration is disabled.");this._tiptapEditor.commands.updateUser(e)}onChange(e){let t=()=>{e(this)};return this._tiptapEditor.on("update",t),()=>{this._tiptapEditor.off("update",t)}}onSelectionChange(e){let t=()=>{e(this)};return this._tiptapEditor.on("selectionUpdate",t),()=>{this._tiptapEditor.off("selectionUpdate",t)}}}function ik(e,t){let i=e.getTextCursorPosition().block;if(void 0===i.content)throw Error("Slash Menu open in a block that doesn't contain content.");Array.isArray(i.content)&&(1===i.content.length&&q(i.content[0])&&"text"===i.content[0].type&&"/"===i.content[0].text||0===i.content.length)?e.updateBlock(i,t):(e.insertBlocks([t],i,"after"),e.setTextCursorPosition(e.getTextCursorPosition().nextBlock,"end"));let n=e.getTextCursorPosition().block;
7return function(e){let t=e.getTextCursorPosition().block,i=e.schema.blockSchema[t.type].content;for(;"none"===i;)t=e.getTextCursorPosition().nextBlock,i=e.schema.blockSchema[t.type].content,e.setTextCursorPosition(t,"end")}(e),n}function iy(e){let t=[];return tm("heading",e)&&t.push({onItemClick:()=>{ik(e,{type:"heading",props:{level:1}})},badge:el("Mod-Alt-1"),key:"heading",...e.dictionary.slash_menu.heading},{onItemClick:()=>{ik(e,{type:"heading",props:{level:2}})},badge:el("Mod-Alt-2"),key:"heading_2",...e.dictionary.slash_menu.heading_2},{onItemClick:()=>{ik(e,{type:"heading",props:{level:3}})},badge:el("Mod-Alt-3"),key:"heading_3",...e.dictionary.slash_menu.heading_3}),tm("numberedListItem",e)&&t.push({onItemClick:()=>{ik(e,{type:"numberedListItem"})},badge:el("Mod-Shift-7"),key:"numbered_list",...e.dictionary.slash_menu.numbered_list}),tm("bulletListItem",e)&&t.push({onItemClick:()=>{ik(e,{type:"bulletListItem"})},badge:el("Mod-Shift-8"),key:"bullet_list",...e.dictionary.slash_menu.bullet_list}),tm("checkListItem",e)&&t.push({onItemClick:()=>{ik(e,{type:"checkListItem"})},badge:el("Mod-Shift-9"),key:"check_list",...e.dictionary.slash_menu.check_list}),tm("paragraph",e)&&t.push({onItemClick:()=>{ik(e,{type:"paragraph"})},badge:el("Mod-Alt-0"),key:"paragraph",...e.dictionary.slash_menu.paragraph}),tm("table",e)&&t.push({onItemClick:()=>{ik(e,{type:"table",content:{type:"tableContent",rows:[{cells:["","",""]},{cells:["","",""]}]}})},badge:void 0,key:"table",...e.dictionary.slash_menu.table}),tm("image",e)&&t.push({onItemClick:()=>{let t=ik(e,{type:"image"});e.prosemirrorView.dispatch(e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin,{block:t}))},key:"image",...e.dictionary.slash_menu.image}),tm("video",e)&&t.push({onItemClick:()=>{let t=ik(e,{type:"video"});e.prosemirrorView.dispatch(e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin,{block:t}))},key:"video",...e.dictionary.slash_menu.video}),tm("audio",e)&&t.push({onItemClick:()=>{let t=ik(e,{type:"audio"});e.prosemirrorView.dispatch(e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin,{block:t}))},key:"audio",...e.dictionary.slash_menu.audio}),tm("file",e)&&t.push({onItemClick:()=>{let t=ik(e,{type:"file"});e.prosemirrorView.dispatch(e._tiptapEditor.state.tr.setMeta(e.filePanel.plugin,{block:t}))},key:"image",...e.dictionary.slash_menu.file}),t}function iw(e,t){return e.filter(({title:e,aliases:i})=>e.toLowerCase().includes(t.toLowerCase())||i&&0!==i.filter(e=>e.toLowerCase().includes(t.toLowerCase())).length)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.