12 lines
60 KiB
JavaScript
12 lines
60 KiB
JavaScript
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3445],{17118:(e,t,n)=>{n.d(t,{AB:()=>tj,BQ:()=>eq,CU:()=>tu,Ce:()=>t$,Dd:()=>t_,FF:()=>eB,JJ:()=>tC,J_:()=>eH,KV:()=>eC,Nx:()=>eb,OX:()=>tT,Op:()=>eW,Pg:()=>x,QN:()=>eU,T7:()=>ev,YY:()=>th,Zc:()=>tU,bP:()=>tF,fl:()=>e_,gk:()=>eS,gu:()=>ez,hO:()=>eD,iI:()=>ew,kj:()=>tL,rU:()=>en,tG:()=>tA,zU:()=>eA});var r=n(17163),o=n(89520),i=n(31132),a=n(84036),s=n(3898);n(58499);var l=n(71421),d=Object.defineProperty,c=(e,t)=>{for(var n in t)d(e,n,{get:t[n],enumerable:!0})};function u(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var p=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:o}=this,{view:i}=r,a=[],s=!!e,l=e||o.tr,d=()=>(s||!t||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),a.every(e=>!0===e)),c={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(l,t),o=n(...e)(r);return a.push(o),c}])),run:d};return c}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,o=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...o,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:o}=this,{view:i}=r,a={tr:e,editor:r,view:i,state:u({state:o,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(a)]))}};return a}},f={};c(f,{blur:()=>m,clearContent:()=>h,clearNodes:()=>g,command:()=>y,createParagraphNear:()=>k,cut:()=>v,deleteCurrentNode:()=>b,deleteNode:()=>w,deleteRange:()=>M,deleteSelection:()=>E,enter:()=>S,exitCode:()=>O,extendMarkRange:()=>R,first:()=>N,focus:()=>_,forEach:()=>L,insertContent:()=>F,insertContentAt:()=>K,joinBackward:()=>J,joinDown:()=>q,joinForward:()=>Z,joinItemBackward:()=>Q,joinItemForward:()=>G,joinTextblockBackward:()=>Y,joinTextblockForward:()=>X,joinUp:()=>W,keyboardShortcut:()=>et,lift:()=>er,liftEmptyBlock:()=>eo,liftListItem:()=>ei,newlineInCode:()=>ea,resetAttributes:()=>ed,scrollIntoView:()=>ec,selectAll:()=>eu,selectNodeBackward:()=>ep,selectNodeForward:()=>ef,selectParentNode:()=>em,selectTextblockEnd:()=>eh,selectTextblockStart:()=>eg,setContent:()=>ey,setMark:()=>eJ,setMeta:()=>eZ,setNode:()=>eQ,setNodeSelection:()=>eG,setTextDirection:()=>eY,setTextSelection:()=>eX,sinkListItem:()=>e0,splitBlock:()=>e2,splitListItem:()=>e3,toggleList:()=>e9,toggleMark:()=>e5,toggleNode:()=>e7,toggleWrap:()=>e6,undoInputRule:()=>te,unsetAllMarks:()=>tt,unsetMark:()=>tn,unsetTextDirection:()=>tr,updateAttributes:()=>to,wrapIn:()=>ti,wrapInList:()=>ta});var m=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),h=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),g=()=>({state:e,tr:t,dispatch:n})=>{let{selection:o}=t,{ranges:i}=o;return!n||(i.forEach(({$from:n,$to:o})=>{e.doc.nodesBetween(n.pos,o.pos,(e,n)=>{if(e.type.isText)return;let{doc:o,mapping:i}=t,a=o.resolve(i.map(n)),s=o.resolve(i.map(n+e.nodeSize)),l=a.blockRange(s);if(!l)return;let d=(0,r.jP)(l);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(l.start,e)}(d||0===d)&&t.lift(l,d)})}),!0)},y=e=>t=>e(t),k=()=>({state:e,dispatch:t})=>(0,o.Z1)(e,t),v=(e,t)=>({editor:n,tr:r})=>{let{state:o}=n,a=o.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let s=r.mapping.map(t);return r.insert(s,a.content),r.setSelection(new i.U3(r.doc.resolve(Math.max(s-1,0)))),!0},b=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let o=e.selection.$anchor;for(let n=o.depth;n>0;n-=1)if(o.node(n).type===r.type){if(t){let t=o.before(n),r=o.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function x(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var w=e=>({tr:t,state:n,dispatch:r})=>{let o=x(e,n.schema),i=t.selection.$anchor;for(let e=i.depth;e>0;e-=1)if(i.node(e).type===o){if(r){let n=i.before(e),r=i.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},M=e=>({tr:t,dispatch:n})=>{let{from:r,to:o}=e;return n&&t.delete(r,o),!0},E=()=>({state:e,dispatch:t})=>(0,o.ic)(e,t),S=()=>({commands:e})=>e.keyboardShortcut("Enter"),O=()=>({state:e,dispatch:t})=>(0,o.I$)(e,t);function T(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function $(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:T(t[r])?t[r].test(e[r]):t[r]===e[r])}function C(e,t,n={}){return e.find(e=>e.type===t&&$(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function A(e,t,n={}){return!!C(e,t,n)}function j(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!C([...r.node.marks],t,n))return;let o=r.index,i=e.start()+r.offset,a=o+1,s=i+r.node.nodeSize;for(;o>0&&A([...e.parent.child(o-1).marks],t,n);)o-=1,i-=e.parent.child(o).nodeSize;for(;a<e.parent.childCount&&A([...e.parent.child(a).marks],t,n);)s+=e.parent.child(a).nodeSize,a+=1;return{from:i,to:s}}function I(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var R=(e,t)=>({tr:n,state:r,dispatch:o})=>{let a=I(e,r.schema),{doc:s,selection:l}=n,{$from:d,from:c,to:u}=l;if(o){let e=j(d,a,t);if(e&&e.from<=c&&e.to>=u){let t=i.U3.create(s,e.from,e.to);n.setSelection(t)}}return!0},N=e=>t=>{let n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function P(e){return e instanceof i.U3}function z(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function B(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function D(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var _=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:a})=>{t={scrollIntoView:!0,...t};let s=()=>{(D()||B())&&r.dom.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!D()&&!B()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(a&&null===e&&!P(n.state.selection))return s(),!0;let l=function(e,t=null){if(!t)return null;let n=i.LN.atStart(e),r=i.LN.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;let o=n.from,a=r.to;return"all"===t?i.U3.create(e,z(0,o,a),z(e.content.size,o,a)):i.U3.create(e,z(t,o,a),z(t,o,a))}(o.doc,e)||n.state.selection,d=n.state.selection.eq(l);return a&&(d||o.setSelection(l),d&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},L=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),F=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),U=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){let r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&U(r)}return e};function H(e){if("u"<typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`;return U(new window.DOMParser().parseFromString(t,"text/html").body)}function V(e,t,n){if(e instanceof a.bP||e instanceof a.FK)return e;n={slice:!0,parseOptions:{},...n};let r="object"==typeof e&&null!==e,o="string"==typeof e;if(r)try{if(Array.isArray(e)&&e.length>0)return a.FK.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),V("",t,n)}if(o){if(n.errorOnInvalidContent){let r=!1,o="",i=new a.Sj({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,o="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?a.S4.fromSchema(i).parseSlice(H(e),n.parseOptions):a.S4.fromSchema(i).parse(H(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${o}`)})}let r=a.S4.fromSchema(t);return n.slice?r.parseSlice(H(e),n.parseOptions).content:r.parse(H(e),n.parseOptions)}return V("",t,n)}var K=(e,t,n)=>({tr:o,dispatch:s,editor:l})=>{var d;if(s){let s,c;n={parseOptions:l.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let u=e=>{l.emit("contentError",{editor:l,error:e,disableCollaboration:()=>{"collaboration"in l.storage&&"object"==typeof l.storage.collaboration&&l.storage.collaboration&&(l.storage.collaboration.isDisabled=!0)}})},p={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!l.options.enableContentCheck&&l.options.emitContentError)try{V(t,l.schema,{parseOptions:p,errorOnInvalidContent:!0})}catch(e){u(e)}try{s=V(t,l.schema,{parseOptions:p,errorOnInvalidContent:null!=(d=n.errorOnInvalidContent)?d:l.options.enableContentCheck})}catch(e){return u(e),!1}let{from:f,to:m}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},h=!0,g=!0;if((!("type"in s)?s:[s]).forEach(e=>{e.check(),h=!!h&&e.isText&&0===e.marks.length,g=!!g&&e.isBlock}),f===m&&g){let{parent:e}=o.doc.resolve(f);!e.isTextblock||e.type.spec.code||e.childCount||(f-=1,m+=1)}if(h){if(Array.isArray(t))c=t.map(e=>e.text||"").join("");else if(t instanceof a.FK){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),c=e}else c="object"==typeof t&&t&&t.text?t.text:t;o.insertText(c,f,m)}else{c=s;let e=o.doc.resolve(f),t=e.node(),n=0===e.parentOffset,r=t.isText||t.isTextblock,i=t.content.size>0;n&&r&&i&&g&&(f=Math.max(0,f-1)),o.replaceWith(f,m,c)}n.updateSelection&&function(e,t){let n=e.steps.length-1;if(n<t)return;let o=e.steps[n];if(!(o instanceof r.Ln||o instanceof r.Wg))return;let a=e.mapping.maps[n],s=0;a.forEach((e,t,n,r)=>{0===s&&(s=r)}),e.setSelection(i.LN.near(e.doc.resolve(s),-1))}(o,o.steps.length-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:f,text:c}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:f,text:c})}return!0},W=()=>({state:e,dispatch:t})=>(0,o.G2)(e,t),q=()=>({state:e,dispatch:t})=>(0,o.bh)(e,t),J=()=>({state:e,dispatch:t})=>(0,o.Qv)(e,t),Z=()=>({state:e,dispatch:t})=>(0,o.eT)(e,t),Q=()=>({state:e,dispatch:t,tr:n})=>{try{let o=(0,r.N0)(e.doc,e.selection.$from.pos,-1);if(null==o)return!1;return n.join(o,2),t&&t(n),!0}catch{return!1}},G=()=>({state:e,dispatch:t,tr:n})=>{try{let o=(0,r.N0)(e.doc,e.selection.$from.pos,1);if(null==o)return!1;return n.join(o,2),t&&t(n),!0}catch{return!1}},Y=()=>({state:e,dispatch:t})=>(0,o.eB)(e,t),X=()=>({state:e,dispatch:t})=>(0,o._G)(e,t);function ee(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}var et=e=>({editor:t,view:n,tr:r,dispatch:o})=>{let i=(function(e){let t,n,r,o,i=e.split(/-(?!$)/),a=i[i.length-1];"Space"===a&&(a=" ");for(let e=0;e<i.length-1;e+=1){let a=i[e];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))t=!0;else if(/^(c|ctrl|control)$/i.test(a))n=!0;else if(/^s(hift)?$/i.test(a))r=!0;else if(/^mod$/i.test(a))D()||ee()?o=!0:n=!0;else throw Error(`Unrecognized modifier name: ${a}`)}return t&&(a=`Alt-${a}`),n&&(a=`Ctrl-${a}`),o&&(a=`Meta-${a}`),r&&(a=`Shift-${a}`),a})(e).split(/-(?!$)/),a=i.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),s=new KeyboardEvent("keydown",{key:"Space"===a?" ":a,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,s))});return null==l||l.steps.forEach(e=>{let t=e.map(r.mapping);t&&o&&r.maybeStep(t)}),!0};function en(e,t,n={}){let{from:r,to:o,empty:i}=e.selection,a=t?x(t,e.schema):null,s=[];e.doc.nodesBetween(r,o,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);s.push({node:e,from:n,to:i})});let l=o-r,d=s.filter(e=>!a||a.name===e.node.type.name).filter(e=>$(e.node.attrs,n,{strict:!1}));return i?!!d.length:d.reduce((e,t)=>e+t.to-t.from,0)>=l}var er=(e,t={})=>({state:n,dispatch:r})=>{let i=x(e,n.schema);return!!en(n,i,t)&&(0,o.yY)(n,r)},eo=()=>({state:e,dispatch:t})=>(0,o.iz)(e,t),ei=e=>({state:t,dispatch:n})=>{let r=x(e,t.schema);return(0,s.T2)(r)(t,n)},ea=()=>({state:e,dispatch:t})=>(0,o.pC)(e,t);function es(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function el(e,t){let n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var ed=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,a=null,s=es("string"==typeof e?e:e.name,r.schema);if(!s)return!1;"node"===s&&(i=x(e,r.schema)),"mark"===s&&(a=I(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,el(e.attrs,t))),a&&e.marks.length&&e.marks.forEach(i=>{a===i.type&&(l=!0,o&&n.addMark(r,r+e.nodeSize,a.create(el(i.attrs,t))))})})}),l},ec=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),eu=()=>({tr:e,dispatch:t})=>{if(t){let t=new i.i5(e.doc);e.setSelection(t)}return!0},ep=()=>({state:e,dispatch:t})=>(0,o._e)(e,t),ef=()=>({state:e,dispatch:t})=>(0,o.Sd)(e,t),em=()=>({state:e,dispatch:t})=>(0,o.hy)(e,t),eh=()=>({state:e,dispatch:t})=>(0,o.ec)(e,t),eg=()=>({state:e,dispatch:t})=>(0,o.$f)(e,t),ey=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:a,commands:s})=>{let{doc:l}=i;if("full"!==r.preserveWhitespace){let s=function(e,t,n={},r={}){return V(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}(e,o.schema,r,{errorOnInvalidContent:null!=t?t:o.options.enableContentCheck});return a&&i.replaceWith(0,l.content.size,s).setMeta("preventUpdate",!n),!0}return a&&i.setMeta("preventUpdate",!n),s.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:o.options.enableContentCheck})};function ek(e,t){let n=I(t,e.schema),{from:r,to:o,empty:i}=e.selection,a=[];i?(e.storedMarks&&a.push(...e.storedMarks),a.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,e=>{a.push(...e.marks)});let s=a.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function ev(e,t){let n=new r.dL(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function eb(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function ex(e){return t=>(function(e,t){for(let n=e.depth;n>0;n-=1){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}})(t.$from,e)}function ew(e,t,n){return void 0===e.config[t]&&e.parent?ew(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?ew(e.parent,t,n):null}):e.config[t]}function eM(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},n=ew(e,"addExtensions",t);return n?[e,...eM(n())]:e}).flat(10)}function eE(e,t){let n=a.ZF.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function eS(e,t,...n){return"function"==typeof e?t?e.bind(t)(...n):e(...n):e}function eO(e){let t=e.filter(e=>"extension"===e.type);return{baseExtensions:t,nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function eT(e){let t=[],{nodeExtensions:n,markExtensions:r}=eO(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},a=n.filter(e=>"text"!==e.name).map(e=>e.name),s=r.map(e=>e.name),l=[...a,...s];return e.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage,extensions:o},r=ew(e,"addGlobalAttributes",n);r&&r().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?a:"marks"===e.types?s:[]).forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...i,...r}})})})})}),o.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=ew(e,"addAttributes",n);r&&Object.entries(r()).forEach(([n,r])=>{let o={...i,...r};"function"==typeof(null==o?void 0:o.default)&&(o.default=o.default()),(null==o?void 0:o.isRequired)&&(null==o?void 0:o.default)===void 0&&delete o.default,t.push({type:e.name,name:n,attribute:o})})}),t}function e$(e){let t=[],n=function(e){let t=[],n="",r=!1,o=!1,i=0,a=e.length;for(let s=0;s<a;s+=1){let a=e[s];if("'"===a&&!o){r=!r,n+=a;continue}if('"'===a&&!r){o=!o,n+=a;continue}if(!r&&!o){if("("===a){i+=1,n+=a;continue}if(")"===a&&i>0){i-=1,n+=a;continue}if(";"===a&&0===i){t.push(n),n="";continue}}n+=a}return n&&t.push(n),t}(e||""),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],o=r.indexOf(":");if(-1===o)continue;let i=r.slice(0,o).trim(),a=r.slice(o+1).trim();i&&a&&t.push([i,a])}return t}function eC(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if("class"===e){let r=t?String(t).split(" "):[],o=n[e]?n[e].split(" "):[],i=r.filter(e=>!o.includes(e));n[e]=[...o,...i].join(" ")}else if("style"===e){let r=new Map([...e$(n[e]),...e$(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function eA(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>eC(e,t),{})}function ej(e,t){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;let o=t.reduce((e,t)=>{var r;let o=t.attribute.parseHTML?t.attribute.parseHTML(n):"string"!=typeof(r=n.getAttribute(t.name))?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):"true"===r||"false"!==r&&r;return null==o?e:{...e,[t.name]:o}},{});return{...r,...o}}}}function eI(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>!("attrs"===e&&function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function eR(e){var t,n;let r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function eN(e){return e.sort((e,t)=>{let n=ew(e,"priority")||100,r=ew(t,"priority")||100;return n>r?-1:+(n<r)})}function eP(e){var t;let n=eN(eM(e)),r=Array.from(new Set((t=n.map(e=>e.name)).filter((e,n)=>t.indexOf(e)!==n)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),n}function ez(e,t){let n=es("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){let n=x(t,e.schema),{from:r,to:o}=e.selection,i=[];e.doc.nodesBetween(r,o,e=>{i.push(e)});let a=i.reverse().find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}(e,t):"mark"===n?ek(e,t):{}}function eB(e){let t,{mapping:n,steps:r}=e,o=[];return n.maps.forEach((e,t)=>{let i=[];if(e.ranges.length)e.forEach((e,t)=>{i.push({from:e,to:t})});else{let{from:e,to:n}=r[t];if(void 0===e||void 0===n)return;i.push({from:e,to:n})}i.forEach(({from:e,to:r})=>{let i=n.slice(t).map(e,-1),a=n.slice(t).map(r),s=n.invert().map(i,-1),l=n.invert().map(a);o.push({oldRange:{from:s,to:l},newRange:{from:i,to:a}})})}),1===(t=function(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(o)).length?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function eD(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let o=j(n.resolve(e),t.type);o&&r.push({mark:t,...o})}):n.nodesBetween(e,t,(e,t)=>{e&&(null==e?void 0:e.nodeSize)!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var e_=(e,t,n,r=20)=>{let o=e.doc.resolve(n),i=r,a=null;for(;i>0&&null===a;){let e=o.node(i);(null==e?void 0:e.type.name)===t?a=e:i-=1}return[a,i]};function eL(e,t){return t.nodes[e]||t.marks[e]||null}function eF(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}var eU=(e,t)=>{let{$from:n,$to:r,$anchor:o}=e.selection;if(t){let n=ex(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return o.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2)&&n.pos===r.pos},eH=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0)&&t.pos===n.pos};function eV(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function eK(e,t){let{nodeExtensions:n}=eO(t),r=n.find(t=>t.name===e);if(!r)return!1;let o={name:r.name,options:r.options,storage:r.storage},i=eS(ew(r,"group",o));return"string"==typeof i&&i.split(" ").includes("list")}function eW(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return!/\S/.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(eW(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function eq(e){return e instanceof i.nh}var eJ=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let{selection:i}=n,{empty:a,ranges:s}=i,l=I(e,r.schema);if(o)if(a){let e=ek(r,l);n.addStoredMark(l.create({...e,...t}))}else s.forEach(e=>{let o=e.$from.pos,i=e.$to.pos;r.doc.nodesBetween(o,i,(e,r)=>{let a=Math.max(r,o),s=Math.min(r+e.nodeSize,i);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(a,s,l.create({...e.attrs,...t}))}):n.addMark(a,s,l.create(t))})});return function(e,t,n){var r;let{selection:o}=t,i=null;if(P(o)&&(i=o.$cursor),i){let t=null!=(r=e.storedMarks)?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=o;return a.some(({$from:t,$to:r})=>{let o=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(o)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),i=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));o=t&&i}return!o}),o})}(r,n,l)},eZ=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),eQ=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a,s=x(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(a=n.selection.$anchor.parent.attrs),s.isTextblock)?i().command(({commands:e})=>!!(0,o.y_)(s,{...a,...t})(n)||e.clearNodes()).command(({state:e})=>(0,o.y_)(s,{...a,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},eG=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=z(e,0,n.content.size),o=i.nh.create(n,r);t.setSelection(o)}return!0},eY=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i,a,{selection:s}=r;return"number"==typeof t?(i=t,a=t):t&&"from"in t&&"to"in t?(i=t.from,a=t.to):(i=s.from,a=s.to),o&&n.doc.nodesBetween(i,a,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},eX=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:o}="number"==typeof e?{from:e,to:e}:e,a=i.U3.atStart(n).from,s=i.U3.atEnd(n).to,l=z(r,a,s),d=z(o,a,s),c=i.U3.create(n,l,d);t.setSelection(c)}return!0},e0=e=>({state:t,dispatch:n})=>{let r=x(e,t.schema);return(0,s.$B)(r)(t,n)};function e1(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var e2=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:o,editor:a})=>{let{selection:s,doc:l}=t,{$from:d,$to:c}=s,u=eF(a.extensionManager.attributes,d.node().type.name,d.node().attrs);if(s instanceof i.nh&&s.node.isBlock)return!!d.parentOffset&&!!(0,r.zy)(l,d.pos)&&(o&&(e&&e1(n,a.extensionManager.splittableMarks),t.split(d.pos).scrollIntoView()),!0);if(!d.parent.isBlock)return!1;let p=c.parentOffset===c.parent.content.size,f=0===d.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(d.node(-1).contentMatchAt(d.indexAfter(-1))),m=p&&f?[{type:f,attrs:u}]:void 0,h=(0,r.zy)(t.doc,t.mapping.map(d.pos),1,m);if(!m&&!h&&(0,r.zy)(t.doc,t.mapping.map(d.pos),1,f?[{type:f}]:void 0)&&(h=!0,m=f?[{type:f,attrs:u}]:void 0),o){if(h&&(s instanceof i.U3&&t.deleteSelection(),t.split(t.mapping.map(d.pos),1,m),f&&!p&&!d.parentOffset&&d.parent.type!==f)){let e=t.mapping.map(d.before()),n=t.doc.resolve(e);d.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(d.before()),f)}e&&e1(n,a.extensionManager.splittableMarks),t.scrollIntoView()}return h},e3=(e,t={})=>({tr:n,state:o,dispatch:s,editor:l})=>{var d;let c=x(e,o.schema),{$from:u,$to:p}=o.selection,f=o.selection.node;if(f&&f.isBlock||u.depth<2||!u.sameParent(p))return!1;let m=u.node(-1);if(m.type!==c)return!1;let h=l.extensionManager.attributes;if(0===u.parent.content.size&&u.node(-1).childCount===u.indexAfter(-1)){if(2===u.depth||u.node(-3).type!==c||u.index(-2)!==u.node(-2).childCount-1)return!1;if(s){let e=a.FK.empty,r=u.index(-1)?1:u.index(-2)?2:3;for(let t=u.depth-r;t>=u.depth-3;t-=1)e=a.FK.from(u.node(t).copy(e));let o=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,s={...eF(h,u.node().type.name,u.node().attrs),...t},l=(null==(d=c.contentMatch.defaultType)?void 0:d.createAndFill(s))||void 0;e=e.append(a.FK.from(c.createAndFill(null,l)||void 0));let p=u.before(u.depth-(r-1));n.replace(p,u.after(-o),new a.Ji(e,4-r,0));let f=-1;n.doc.nodesBetween(p,n.doc.content.size,(e,t)=>{if(f>-1)return!1;e.isTextblock&&0===e.content.size&&(f=t+1)}),f>-1&&n.setSelection(i.U3.near(n.doc.resolve(f))),n.scrollIntoView()}return!0}let g=p.pos===u.end()?m.contentMatchAt(0).defaultType:null,y={...eF(h,m.type.name,m.attrs),...t},k={...eF(h,u.node().type.name,u.node().attrs),...t};n.delete(u.pos,p.pos);let v=g?[{type:c,attrs:y},{type:g,attrs:k}]:[{type:c,attrs:y}];if(!(0,r.zy)(n.doc,u.pos,2))return!1;if(s){let{selection:e,storedMarks:t}=o,{splittableMarks:r}=l.extensionManager,i=t||e.$to.parentOffset&&e.$from.marks();if(n.split(u.pos,2,v).scrollIntoView(),!i||!s)return!0;let a=i.filter(e=>r.includes(e.type.name));n.ensureMarks(a)}return!0},e4=(e,t)=>{let n=ex(e=>e.type===t)(e.selection);if(!n)return!0;let o=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===o)return!0;let i=e.doc.nodeAt(o);return!(n.node.type===(null==i?void 0:i.type)&&(0,r.n9)(e.doc,n.pos))||(e.join(n.pos),!0)},e8=(e,t)=>{let n=ex(e=>e.type===t)(e.selection);if(!n)return!0;let o=e.doc.resolve(n.start).after(n.depth);if(void 0===o)return!0;let i=e.doc.nodeAt(o);return!(n.node.type===(null==i?void 0:i.type)&&(0,r.n9)(e.doc,o))||(e.join(o),!0)},e9=(e,t,n,r={})=>({editor:o,tr:a,state:s,dispatch:l,chain:d,commands:c,can:u})=>{let{extensions:p,splittableMarks:f}=o.extensionManager,m=x(e,s.schema),h=x(t,s.schema),{selection:g,storedMarks:y}=s,{$from:k,$to:v}=g,b=k.blockRange(v),w=y||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;let M=ex(e=>eK(e.type.name,p))(g),E=0===g.from&&g.to===s.doc.content.size,S=s.doc.content.content,O=1===S.length?S[0]:null,T=E&&O&&eK(O.type.name,p)?{node:O,pos:0,depth:0}:null,$=null!=M?M:T,C=!!M&&b.depth>=1&&b.depth-M.depth<=1,A=!!T;if((C||A)&&$){if($.node.type===m)return E&&A?d().command(({tr:e,dispatch:t})=>{let n=function(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),o=t.resolve(n.nodeSize-1);return i.U3.between(r,o)}(e);return!!n&&(e.setSelection(n),t&&t(e),!0)}).liftListItem(h).run():c.liftListItem(h);if(eK($.node.type.name,p)&&m.validContent($.node.content))return d().command(()=>(a.setNodeMarkup($.pos,m),!0)).command(()=>e4(a,m)).command(()=>e8(a,m)).run()}return n&&w&&l?d().command(()=>{let e=u().wrapInList(m,r),t=w.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(m,r).command(()=>e4(a,m)).command(()=>e8(a,m)).run():d().command(()=>!!u().wrapInList(m,r)||c.clearNodes()).wrapInList(m,r).command(()=>e4(a,m)).command(()=>e8(a,m)).run()},e5=(e,t={},n={})=>({state:r,commands:o})=>{let{extendEmptyMarkRange:i=!1}=n,a=I(e,r.schema);return!function(e,t,n={}){let{empty:r,ranges:o}=e.selection,i=t?I(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>$(e.attrs,n,{strict:!1}));let a=0,s=[];if(o.forEach(({$from:t,$to:n})=>{let r=t.pos,o=n.pos;e.doc.nodesBetween(r,o,(e,t)=>{if(i&&e.inlineContent&&!e.type.allowsMarkType(i))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),l=Math.min(o,t+e.nodeSize);a+=l-n,s.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===a)return!1;let l=s.filter(e=>!i||i.name===e.mark.type.name).filter(e=>$(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),d=s.filter(e=>!i||e.mark.type!==i&&e.mark.type.excludes(i)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+d:l)>=a}(r,a,t)?o.setMark(a,t):o.unsetMark(a,{extendEmptyMarkRange:i})},e7=(e,t,n={})=>({state:r,commands:o})=>{let i,a=x(e,r.schema),s=x(t,r.schema),l=en(r,a,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(i=r.selection.$anchor.parent.attrs),l)?o.setNode(s,i):o.setNode(a,{...i,...n})},e6=(e,t={})=>({state:n,commands:r})=>{let o=x(e,n.schema);return en(n,o,t)?r.lift(o):r.wrapIn(o,t)},te=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let o,i=n[r];if(i.spec.isInputRules&&(o=i.getState(e))){if(t){let t=e.tr,n=o.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(o.text){let n=t.doc.resolve(o.from).marks();t.replaceWith(o.from,o.to,e.schema.text(o.text,n))}else t.delete(o.from,o.to)}return!0}}return!1},tt=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:o}=n;return!!r||(t&&o.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0)},tn=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;let{extendEmptyMarkRange:a=!1}=t,{selection:s}=n,l=I(e,r.schema),{$from:d,empty:c,ranges:u}=s;if(!o)return!0;if(c&&a){let{from:e,to:t}=s,r=null==(i=d.marks().find(e=>e.type===l))?void 0:i.attrs,o=j(d,l,r);o&&(e=o.from,t=o.to),n.removeMark(e,t,l)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},tr=e=>({tr:t,state:n,dispatch:r})=>{let o,i,{selection:a}=n;return"number"==typeof e?(o=e,i=e):e&&"from"in e&&"to"in e?(o=e.from,i=e.to):(o=a.from,i=a.to),r&&t.doc.nodesBetween(o,i,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},to=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,a=null,s=es("string"==typeof e?e:e.name,r.schema);if(!s)return!1;"node"===s&&(i=x(e,r.schema)),"mark"===s&&(a=I(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{let s,d,c,u,p=e.$from.pos,f=e.$to.pos;n.selection.empty?r.doc.nodesBetween(p,f,(e,t)=>{i&&i===e.type&&(l=!0,c=Math.max(t,p),u=Math.min(t+e.nodeSize,f),s=t,d=e)}):r.doc.nodesBetween(p,f,(e,r)=>{r<p&&i&&i===e.type&&(l=!0,c=Math.max(r,p),u=Math.min(r+e.nodeSize,f),s=r,d=e),r>=p&&r<=f&&(i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),a&&e.marks.length&&e.marks.forEach(i=>{if(a===i.type&&(l=!0,o)){let o=Math.max(r,p),s=Math.min(r+e.nodeSize,f);n.addMark(o,s,a.create({...i.attrs,...t}))}}))}),d&&(void 0!==s&&o&&n.setNodeMarkup(s,void 0,{...d.attrs,...t}),a&&d.marks.length&&d.marks.forEach(e=>{a===e.type&&o&&n.addMark(c,u,a.create({...e.attrs,...t}))}))}),l},ti=(e,t={})=>({state:n,dispatch:r})=>{let i=x(e,n.schema);return(0,o.Im)(i,t)(n,r)},ta=(e,t={})=>({state:n,dispatch:r})=>{let o=x(e,n.schema);return(0,s.Sd)(o,t)(n,r)},ts=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function tl(e){var t;let{editor:n,from:r,to:o,text:i,rules:a,plugin:s}=e,{view:l}=n;if(l.composing)return!1;let d=l.state.doc.resolve(r);if(d.parent.type.spec.code||(null==(t=d.nodeBefore||d.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let c=!1,f=((e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,o,i)=>{var a,s;let l=(null==(s=(a=e.type.spec).toText)?void 0:s.call(a,{node:e,pos:t,parent:o,index:i}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(d)+i;return a.forEach(e=>{if(c)return;let t=((e,t)=>{if(T(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(f,e.find);if(!t)return;let a=l.state.tr,d=u({state:l.state,transaction:a}),m={from:r-(t[0].length-i.length),to:o},{commands:h,chain:g,can:y}=new p({editor:n,state:d});null!==e.handler({state:d,range:m,match:t,commands:h,chain:g,can:y})&&a.steps.length&&(e.undoable&&a.setMeta(s,{transform:a,from:r,to:o,text:i}),l.dispatch(a),c=!0)}),c}function td(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}var tc=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...eS(ew(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...eS(ew(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>(function e(t,n){let r={...t};return td(t)&&td(n)&&Object.keys(n).forEach(o=>{td(n[o])&&td(t[o])?r[o]=e(t[o],n[o]):r[o]=n[o]}),r})(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},tu=class e extends tc{constructor(){super(...arguments),this.type="mark"}static create(t={}){return new e("function"==typeof t?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let o=r.marks();if(!o.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;let i=o.find(e=>(null==e?void 0:e.type.name)===t.name);return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},tp=class{constructor(e){this.find=e.find,this.handler=e.handler}},tf=null,tm=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=eP(e),this.schema=function(e,t){var n;let r=eT(e),{nodeExtensions:o,markExtensions:i}=eO(e),s=null==(n=o.find(e=>ew(e,"topNode")))?void 0:n.name,l=Object.fromEntries(o.map(n=>{let o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},a=eI({...e.reduce((e,t)=>{let r=ew(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}},{}),content:eS(ew(n,"content",i)),marks:eS(ew(n,"marks",i)),group:eS(ew(n,"group",i)),inline:eS(ew(n,"inline",i)),atom:eS(ew(n,"atom",i)),selectable:eS(ew(n,"selectable",i)),draggable:eS(ew(n,"draggable",i)),code:eS(ew(n,"code",i)),whitespace:eS(ew(n,"whitespace",i)),linebreakReplacement:eS(ew(n,"linebreakReplacement",i)),defining:eS(ew(n,"defining",i)),isolating:eS(ew(n,"isolating",i)),attrs:Object.fromEntries(o.map(eR))}),s=eS(ew(n,"parseHTML",i));s&&(a.parseDOM=s.map(e=>ej(e,o)));let l=ew(n,"renderHTML",i);l&&(a.toDOM=e=>l({node:e,HTMLAttributes:eA(e,o)}));let d=ew(n,"renderText",i);return d&&(a.toText=d),[n.name,a]})),d=Object.fromEntries(i.map(n=>{let o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},a=eI({...e.reduce((e,t)=>{let r=ew(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}},{}),inclusive:eS(ew(n,"inclusive",i)),excludes:eS(ew(n,"excludes",i)),group:eS(ew(n,"group",i)),spanning:eS(ew(n,"spanning",i)),code:eS(ew(n,"code",i)),attrs:Object.fromEntries(o.map(eR))}),s=eS(ew(n,"parseHTML",i));s&&(a.parseDOM=s.map(e=>ej(e,o)));let l=ew(n,"renderHTML",i);return l&&(a.toDOM=e=>l({mark:e,HTMLAttributes:eA(e,o)})),[n.name,a]}));return new a.Sj({topNode:s,nodes:l,marks:d})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:eL(t.name,this.schema)},r=ew(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this;return eN([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:eL(t.name,this.schema)},r=[],o=ew(t,"addKeyboardShortcuts",n),s={};if("mark"===t.type&&ew(t,"exitable",n)&&(s.ArrowRight=()=>tu.handleExit({editor:e,mark:t})),o){let t=Object.fromEntries(Object.entries(o()).map(([t,n])=>[t,()=>n({editor:e})]));s={...s,...t}}let d=(0,l.w)(s);r.push(d);let c=ew(t,"addInputRules",n);if(eV(t,e.options.enableInputRules)&&c){let t=c();if(t&&t.length){let n=function(e){let{editor:t,rules:n}=e,r=new i.k_({state:{init:()=>null,apply(e,o,i){let s=e.getMeta(r);if(s)return s;let l=e.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:e}=l;"string"==typeof e||(e=eE(a.FK.from(e),i.schema));let{from:o}=l,s=o+e.length;tl({editor:t,from:o,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,o,i,a)=>tl({editor:t,from:o,to:i,text:a,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:o}=e.state.selection;o&&tl({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,o){if("Enter"!==o.key)return!1;let{$cursor:i}=e.state.selection;return!!i&&tl({editor:t,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),o=Array.isArray(n)?n:[n];r.push(...o)}}let f=ew(t,"addPasteRules",n);if(eV(t,e.options.enablePasteRules)&&f){let t=f();if(t&&t.length){let n=function(e){let t,{editor:n,rules:r}=e,o=null,s=!1,l=!1,d="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let c=({state:e,from:r,to:o,rule:i,pasteEvt:a})=>{let s=e.tr;if(function(e){let{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:a,dropEvent:s}=e,{commands:l,chain:d,can:c}=new p({editor:t,state:n}),u=[];return n.doc.nodesBetween(r,o,(e,t)=>{var p,f,m,h,g;if((null==(f=null==(p=e.type)?void 0:p.spec)?void 0:f.code)||!(e.isText||e.isTextblock||e.isInline))return;let y=null!=(g=null!=(h=null==(m=e.content)?void 0:m.size)?h:e.nodeSize)?g:0,k=Math.max(r,t),v=Math.min(o,t+y);k>=v||((e,t,n)=>{if(T(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(k-t,v-t,void 0,""),i.find,a).forEach(e=>{if(void 0===e.index)return;let t=k+e.index+1,r=t+e[0].length,o={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},p=i.handler({state:n,range:o,match:e,commands:l,chain:d,can:c,pasteEvent:a,dropEvent:s});u.push(p)})}),u.every(e=>null!==e)}({editor:n,state:u({state:e,transaction:s}),from:Math.max(r-1,0),to:o.b-1,rule:i,pasteEvent:a,dropEvent:t})&&s.steps.length){try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return d="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,s}};return r.map(e=>new i.k_({view(e){let t=t=>{var r;(o=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(tf=n)},r=()=>{tf&&(tf=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,n)=>{if(l=o===e.dom.parentElement,t=n,!l){let e=tf;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;let r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return d=t,s=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let o=t[0],i="paste"===o.getMeta("uiEvent")&&!s,u="drop"===o.getMeta("uiEvent")&&!l,p=o.getMeta("applyPasteRules"),f=!!p;if(!i&&!u&&!f)return;if(f){var m,h;let t,{text:n}=p;"string"==typeof n||(n=eE(a.FK.from(n),r.schema));let{from:o}=p,i=o+n.length;return c({rule:e,state:r,from:o,to:{b:i},pasteEvt:(m=n,null==(h=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||h.setData("text/html",m),t)})}let g=n.doc.content.findDiffStart(r.doc.content),y=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof g&&y&&g!==y.b)return c({rule:e,state:r,from:g,to:y,pasteEvt:d})}}))}({editor:e,rules:t});r.push(...n)}}let m=ew(t,"addProseMirrorPlugins",n);if(m){let e=m();r.push(...e)}return r})}get attributes(){return eT(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=eO(this.extensions);return Object.fromEntries(t.filter(e=>!!ew(e,"addNodeView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:x(t.name,this.schema)},o=ew(t,"addNodeView",r);if(!o)return[];let i=o();return i?[t.name,(r,o,a,s,l)=>{let d=eA(r,n);return i({node:r,view:o,getPos:a,decorations:s,innerDecorations:l,editor:e,extension:t,HTMLAttributes:d})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return eN([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:eL(n.name,this.schema)},o=ew(n,"dispatchTransaction",r);return o?t=>{o.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return eN([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:eL(n.name,this.schema)},o=ew(n,"transformPastedHTML",r);return o?(t,n)=>{let i=e(t,n);return o.call(r,i)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=eO(this.extensions);return Object.fromEntries(t.filter(e=>!!ew(e,"addMarkView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:I(t.name,this.schema)},o=ew(t,"addMarkView",r);return o?[t.name,(r,i,a)=>{let s=eA(r,n);return o()({mark:r,view:i,inline:a,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{!function(e,t,n={}){let{state:r}=t,{doc:o,tr:i}=r;o.descendants((t,r)=>{let o=i.mapping.map(r),a=i.mapping.map(r)+t.nodeSize,s=null;if(t.marks.forEach(t=>{if(t!==e)return!1;s=t}),!s)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==s.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});i.removeMark(o,a,e.type),i.addMark(o,a,t)}}),i.docChanged&&t.view.dispatch(i)}(r,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t;let n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:eL(e.name,this.schema)};"mark"===e.type&&(null==(t=eS(ew(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);let r=ew(e,"onBeforeCreate",n),o=ew(e,"onCreate",n),i=ew(e,"onUpdate",n),a=ew(e,"onSelectionUpdate",n),s=ew(e,"onTransaction",n),l=ew(e,"onFocus",n),d=ew(e,"onBlur",n),c=ew(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),o&&this.editor.on("create",o),i&&this.editor.on("update",i),a&&this.editor.on("selectionUpdate",a),s&&this.editor.on("transaction",s),l&&this.editor.on("focus",l),d&&this.editor.on("blur",d),c&&this.editor.on("destroy",c)})}};tm.resolve=eP,tm.sort=eN,tm.flatten=eM,c({},{ClipboardTextSerializer:()=>tg,Commands:()=>ty,Delete:()=>tk,Drop:()=>tv,Editable:()=>tb,FocusEvents:()=>tw,Keymap:()=>tM,Paste:()=>tE,Tabindex:()=>tS,TextDirection:()=>tO,focusEventsPluginKey:()=>tx});var th=class e extends tc{constructor(){super(...arguments),this.type="extension"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},tg=th.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new i.k_({key:new i.hs("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:i}=o,a=Math.min(...i.map(e=>e.$from.pos)),s=Math.max(...i.map(e=>e.$to.pos)),l=Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]));return function(e,t,n){let{from:r,to:o}=t,{blockSeparator:i="\n\n",textSerializers:a={}}=n||{},s="";return e.nodesBetween(r,o,(e,n,l,d)=>{var c;e.isBlock&&n>r&&(s+=i);let u=null==a?void 0:a[e.type.name];if(u)return l&&(s+=u({node:e,pos:n,parent:l,index:d,range:t})),!1;e.isText&&(s+=null==(c=null==e?void 0:e.text)?void 0:c.slice(Math.max(r,n)-n,o-n))}),s}(r,{from:a,to:s},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),ty=th.create({name:"commands",addCommands:()=>({...f})}),tk=th.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,o,i;let a=()=>{var n,o,i,a;if(null!=(a=null==(i=null==(o=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:o.filterTransaction)?void 0:i.call(o,e))?a:e.getMeta("y-sync$"))return;let s=ev(e.before,[e,...t]);eB(s).forEach(t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let o=r+n.nodeSize-2,i=t.oldRange.from<=r&&o<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:o,newFrom:s.mapping.map(r),newTo:s.mapping.map(o),deletedRange:t.oldRange,newRange:t.newRange,partial:!i,editor:this.editor,transaction:e,combinedTransform:s})})});let l=s.mapping;s.steps.forEach((t,n)=>{var o,i;if(t instanceof r.Ys){let r=l.slice(n).map(t.from,-1),a=l.slice(n).map(t.to),d=l.invert().map(r,-1),c=l.invert().map(a),u=r>0&&(null==(o=s.doc.nodeAt(r-1))?void 0:o.marks.some(e=>e.eq(t.mark))),p=null==(i=s.doc.nodeAt(a))?void 0:i.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:d,to:c},newRange:{from:r,to:a},partial:!!(p||u),editor:this.editor,transaction:e,combinedTransform:s})}})};null==(i=null==(o=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:o.async)||i?setTimeout(a,0):a()}}),tv=th.create({name:"drop",addProseMirrorPlugins(){return[new i.k_({key:new i.hs("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),tb=th.create({name:"editable",addProseMirrorPlugins(){return[new i.k_({key:new i.hs("editable"),props:{editable:()=>this.editor.options.editable}})]}}),tx=new i.hs("focusEvents"),tw=th.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new i.k_({key:tx,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),tM=th.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:o,$anchor:a}=n,{pos:s,parent:l}=a,d=a.parent.isTextblock&&s>0?t.doc.resolve(s-1):a,c=d.parent.type.spec.isolating,u=a.pos-a.parentOffset,p=c&&1===d.parent.childCount?u===a.pos:i.LN.atStart(r).from===s;return!!o&&!!l.type.isTextblock&&!l.textContent.length&&!!p&&(!p||"paragraph"!==a.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},o={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return D()||ee()?o:r},addProseMirrorPlugins(){return[new i.k_({key:new i.hs("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),o=e.some(e=>e.getMeta("preventClearDocument"));if(!r||o)return;let{empty:a,from:s,to:l}=t.selection,d=i.LN.atStart(t.doc).from,c=i.LN.atEnd(t.doc).to;if(a||s!==d||l!==c||!eW(n.doc))return;let f=n.tr,m=u({state:n,transaction:f}),{commands:h}=new p({editor:this.editor,state:m});if(h.clearNodes(),f.steps.length)return f}})]}}),tE=th.create({name:"paste",addProseMirrorPlugins(){return[new i.k_({key:new i.hs("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),tS=th.create({name:"tabindex",addOptions:()=>({value:void 0}),addProseMirrorPlugins(){return[new i.k_({key:new i.hs("tabindex"),props:{attributes:()=>{var e;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!=(e=this.options.value)?e:"0"}:{}}}})]}}),tO=th.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=eO(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&("ltr"===t||"rtl"===t||"auto"===t)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new i.k_({key:new i.hs("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}});function tT(e){return new ts({find:e.find,handler:({state:t,range:n,match:r})=>{let o=eS(e.getAttributes,void 0,r);if(!1===o||null===o)return null;let{tr:i}=t,a=r[r.length-1],s=r[0];if(a){let r=s.search(/\S/),l=n.from+s.indexOf(a),d=l+a.length;if(eD(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>l).length)return null;d<n.to&&i.delete(d,n.to),l>n.from&&i.delete(n.from+r,l);let c=n.from+r+a.length;i.addMark(n.from+r,c,e.type.create(o||{})),i.removeStoredMark(e.type)}},undoable:e.undoable})}function t$(e){return new ts({find:e.find,handler:({state:t,range:n,match:r})=>{let o=eS(e.getAttributes,void 0,r)||{},{tr:i}=t,a=n.from,s=n.to,l=e.type.create(o);if(r[1]){let e=a+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];i.insertText(t,a+r[0].length-1),i.replaceWith(e,s,l)}else if(r[0]){let t=e.type.isInline?a:a-1;i.insert(t,e.type.create(o)).delete(i.mapping.map(a),i.mapping.map(s))}i.scrollIntoView()},undoable:e.undoable})}function tC(e){return new ts({find:e.find,handler:({state:t,range:n,match:r})=>{let o=t.doc.resolve(n.from),i=eS(e.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)},undoable:e.undoable})}function tA(e){return new ts({find:e.find,handler:({state:t,range:n,match:o,chain:i})=>{let a=eS(e.getAttributes,void 0,o)||{},s=t.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),d=l&&(0,r.oM)(l,e.type,a);if(!d)return null;if(s.wrap(l,d),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:o}=e.editor.extensionManager,i=r||n.$to.parentOffset&&n.$from.marks();if(i){let e=i.filter(e=>o.includes(e.type.name));s.ensureMarks(e)}}if(e.keepAttributes){let t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";i().updateAttributes(t,a).run()}let c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&(0,r.n9)(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(o,c))&&s.join(n.from-1)},undoable:e.undoable})}function tj(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof i.nh){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let o=r.depth;for(;o>=0;){let e=r.index(o);if(r.node(o).contentMatchAt(e).matchType(t))return!0;o-=1}return!1}function tI(e){if(!(null==e?void 0:e.trim()))return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);o&&(t.class=o.map(e=>e.trim().slice(1)).join(" "));let i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(t.id=i[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var o;let i=n[parseInt((null==(o=r.match(/__QUOTED_(\d+)__/))?void 0:o[1])||"0",10)];i&&(t[e]=i.slice(1,-1))});let a=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function tR(e){if(!e||0===Object.keys(e).length)return"";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function tN(e){let{nodeName:t,name:n,parseAttributes:r=tI,serializeAttributes:o=tR,defaultAttributes:i={},requiredAttributes:a=[],allowedAttributes:s}=e,l=n||t;return{parseMarkdown:(e,n)=>{let r={...i,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${l}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,o){let i=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(i);if(!s)return;let d=r(s[1]||"");if(!a.find(e=>!(e in d)))return{type:t,raw:s[0],attributes:d}}},renderMarkdown:e=>{let t=o((e=>{if(!s)return e;let t={};return s.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),n=t?` {${t}}`:"";return`:::${l}${n} :::`}}}function tP(e){let{nodeName:t,name:n,getContent:r,parseAttributes:o=tI,serializeAttributes:i=tR,defaultAttributes:a={},content:s="block",allowedAttributes:l}=e,d=n||t;return{parseMarkdown:(e,n)=>{let o;if(r){let t=r(e);o="string"==typeof t?[{type:"text",text:t}]:t}else o="block"===s?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let i={...a,...e.attributes};return n.createNode(t,i,o)},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${d}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var i;let a=RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),l=e.match(a);if(!l)return;let[c,u=""]=l,p=o(u),f=1,m=c.length,h="",g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(m);for(g.lastIndex=0;;){let n=g.exec(y);if(null===n)break;let o=n.index,a=n[1];if(null==(i=n[2])||!i.endsWith(":::")){if(a)f+=1;else if(0==(f-=1)){let i=y.slice(0,o);h=i.trim();let a=e.slice(0,m+o+n[0].length),l=[];if(h)if("block"===s)for((l=r.blockTokens(i)).forEach(e=>{e.text&&(!e.tokens||0===e.tokens.length)&&(e.tokens=r.inlineTokens(e.text))});l.length>0;){let e=l[l.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;l.pop()}else l=r.inlineTokens(h);return{type:t,raw:a,attributes:p,content:h,tokens:l}}}}}},renderMarkdown:(e,t)=>{let n=i((e=>{if(!l)return e;let t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),r=n?` {${n}}`:"",o=t.renderChildren(e.content||[],"\n\n");return`:::${d}${r}
|
||
|
||
${o}
|
||
|
||
:::`}}}function tz(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;null!==r;){let[,o,i,a]=r;t[o]=i||a,r=n.exec(e)}return t}function tB(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function tD(e){let{nodeName:t,name:n,getContent:r,parseAttributes:o=tz,serializeAttributes:i=tB,defaultAttributes:a={},selfClosing:s=!1,allowedAttributes:l}=e,d=n||t,c=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{let o={...a,...e.attributes};if(s)return n.createNode(t,o);let i=r?r(e):e.content||"";return i?n.createNode(t,o,[n.createTextNode(i)]):n.createNode(t,o,[])},markdownTokenizer:{name:t,level:"inline",start(e){let t=s?RegExp(`\\[${c}\\s*[^\\]]*\\]`):RegExp(`\\[${c}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${c}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){let i=s?RegExp(`^\\[${c}\\s*([^\\]]*)\\]`):RegExp(`^\\[${c}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${c}\\]`),a=e.match(i);if(!a)return;let l="",d="";if(s){let[,e]=a;d=e}else{let[,e,t]=a;d=e,l=t||""}let u=o(d.trim());return{type:t,raw:a[0],content:l.trim(),attributes:u}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));let n=i((e=>{if(!l)return e;let t={};return l.forEach(n=>{let r="string"==typeof n?n:n.name,o="string"==typeof n?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(void 0!==o&&n===o)return;t[r]=n}}),t})(e.attrs||{})),o=n?` ${n}`:"";return s?`[${d}${o}]`:`[${d}${o}]${t}[/${d}]`}}}function t_(e,t,n){var r,o,i,a;let s=e.split("\n"),l=[],d="",c=0,u=t.baseIndentSize||2;for(;c<s.length;){let e,p=s[c],f=p.match(t.itemPattern);if(!f)if(l.length>0)break;else{if(""!==p.trim())return;c+=1,d=`${d}${p}
|
||
`;continue}let m=t.extractItemData(f),{indentLevel:h,mainContent:g}=m;d=`${d}${p}
|
||
`;let y=[g];for(c+=1;c<s.length;){let e=s[c];if(""===e.trim()){let t=s.slice(c+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(o=null==(r=s[c+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:o.length)||0)>h){y.push(e),d=`${d}${e}
|
||
`,c+=1;continue}break}if(((null==(a=null==(i=e.match(/^(\s*)/))?void 0:i[1])?void 0:a.length)||0)>h)y.push(e),d=`${d}${e}
|
||
`,c+=1;else break}let k=y.slice(1);if(k.length>0){let r=k.map(e=>e.slice(h+u)).join("\n");r.trim()&&(e=t.customNestedParser?t.customNestedParser(r):n.blockTokens(r))}let v=t.createToken(m,e);l.push(v)}if(0!==l.length)return{items:l,raw:d}}function tL(e,t,n,r){if(!e||!Array.isArray(e.content))return"";let o="function"==typeof n?n(r):n,[i,...a]=e.content,s=t.renderChildren([i]),l=`${o}${s}`;return a&&a.length>0&&a.forEach((e,n)=>{var r,o;let i=null!=(o=null==(r=t.renderChild)?void 0:r.call(t,e,n+1))?o:t.renderChildren([e]);if(null!=i){let n=i.split("\n").map(e=>e?t.indent(e):t.indent("")).join("\n");l+="paragraph"===e.type?`
|
||
|
||
${n}`:`
|
||
${n}`}}),l}c({},{createAtomBlockMarkdownSpec:()=>tN,createBlockMarkdownSpec:()=>tP,createInlineMarkdownSpec:()=>tD,parseAttributes:()=>tI,parseIndentedBlocks:()=>t_,renderNestedMarkdownContent:()=>tL,serializeAttributes:()=>tR});var tF=class e extends tc{constructor(){super(...arguments),this.type="node"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}};function tU(e){return new tp({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{let i=eS(e.getAttributes,void 0,r,o);if(!1===i||null===i)return null;let{tr:a}=t,s=r[r.length-1],l=r[0],d=n.to;if(s){let o=l.search(/\S/),c=n.from+l.indexOf(s),u=c+s.length;if(eD(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;u<n.to&&a.delete(u,n.to),c>n.from&&a.delete(n.from+o,c),d=n.from+o+s.length,a.addMark(n.from+o,d,e.type.create(i||{})),void 0!==r.index&&void 0!==r.input&&r.index+r[0].length>=r.input.length||a.removeStoredMark(e.type)}}})}}}]); |