1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[277],{82159:(e,t,n)=>{n.d(t,{BQ:()=>eh,CU:()=>j,FF:()=>ea,KE:()=>eP,KV:()=>y,MG:()=>em,Nx:()=>eo,OX:()=>eT,T7:()=>er,YY:()=>B,Zc:()=>e$,bP:()=>ej,eE:()=>U,gu:()=>ei,hO:()=>el,tG:()=>eA});var r=n(76865),o=n(63197),s=n(12894),i=n(27050),a=n(8242),l=n(97144),d=n(42080);function c(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:o}=n,{storedMarks:s}=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 s},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,s=n.storedMarks,n}}}class p{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,s=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(s);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:s}=r,i=[],a=!!e,l=e||o.tr,d=()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||s.dispatch(l),i.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 i.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:s}=r,i={tr:e,editor:r,view:s,state:c({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)(i)]))}};return i}}class u{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}}function h(e,t,n){return void 0===e.config[t]&&e.parent?h(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?h(e.parent,t,n):null}):e.config[t]}function m(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 f(e){let t=[],{nodeExtensions:n,markExtensions:r}=m(e),o=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage,extensions:o},r=h(e,"addGlobalAttributes",n);r&&r().forEach(e=>{e.types.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...s,...r}})})})})}),o.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=h(e,"addAttributes",n);r&&Object.entries(r()).forEach(([n,r])=>{let o={...s,...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 g(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}function y(...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(" "):[],s=r.filter(e=>!o.includes(e));n[e]=[...o,...s].join(" ")}else if("style"===e){let r=t?t.split(";").map(e=>
1e.trim()).filter(Boolean):[],o=n[e]?n[e].split(";").map(e=>e.trim()).filter(Boolean):[],s=new Map;o.forEach(e=>{let[t,n]=e.split(":").map(e=>e.trim());s.set(t,n)}),r.forEach(e=>{let[t,n]=e.split(":").map(e=>e.trim());s.set(t,n)}),n[e]=Array.from(s.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function b(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)=>y(e,t),{})}function v(e){return"function"==typeof e}function k(e,t,...n){return v(e)?t?e.bind(t)(...n):e(...n):e}function w(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 x(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 M(e,t){return t.nodes[e]||t.marks[e]||null}function O(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function E(e,t){let n=i.ZF.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function S(e){return"[object RegExp]"===Object.prototype.toString.call(e)}class C{constructor(e){this.find=e.find,this.handler=e.handler}}function P(e){var t;let{editor:n,from:r,to:o,text:s,rules:i,plugin:a}=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 u=!1,h=((e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,o,s)=>{var i,a;let l=(null==(a=(i=e.type.spec).toText)?void 0:a.call(i,{node:e,pos:t,parent:o,index:s}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(d)+s;return i.forEach(e=>{if(u)return;let t=((e,t)=>{if(S(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})(h,e.find);if(!t)return;let i=l.state.tr,d=c({state:l.state,transaction:i}),m={from:r-(t[0].length-s.length),to:o},{commands:f,chain:g,can:y}=new p({editor:n,state:d});null!==e.handler({state:d,range:m,match:t,commands:f,chain:g,can:y})&&i.steps.length&&(i.setMeta(a,{transform:i,from:r,to:o,text:s}),l.dispatch(i),u=!0)}),u}function T(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function A(e,t){let n={...e};return T(e)&&T(t)&&Object.keys(t).forEach(r=>{T(t[r])&&T(e[r])?n[r]=A(e[r],t[r]):n[r]=t[r]}),n}class j{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=k(h(this,"addOptions",{name:this.name}))),this.storage=k(h(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new j(e)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>A(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new j(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=k(h(t,"addOptions",{name:t.name})),t.storage=k(h(t,"addStorage",{name:t.name,options:t.options})),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=>
1(null==e?void 0:e.type.name)===t.name))return!1;let s=o.find(e=>(null==e?void 0:e.type.name)===t.name);return s&&n.removeStoredMark(s),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}}class ${constructor(e){this.find=e.find,this.handler=e.handler}}let N=null;class I{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=I.resolve(e),this.schema=function(e,t){var n;let r=f(e),{nodeExtensions:o,markExtensions:s}=m(e),a=null==(n=o.find(e=>h(e,"topNode")))?void 0:n.name,l=Object.fromEntries(o.map(n=>{let o=r.filter(e=>e.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:t},i=x({...e.reduce((e,t)=>{let r=h(t,"extendNodeSchema",s);return{...e,...r?r(n):{}}},{}),content:k(h(n,"content",s)),marks:k(h(n,"marks",s)),group:k(h(n,"group",s)),inline:k(h(n,"inline",s)),atom:k(h(n,"atom",s)),selectable:k(h(n,"selectable",s)),draggable:k(h(n,"draggable",s)),code:k(h(n,"code",s)),whitespace:k(h(n,"whitespace",s)),linebreakReplacement:k(h(n,"linebreakReplacement",s)),defining:k(h(n,"defining",s)),isolating:k(h(n,"isolating",s)),attrs:Object.fromEntries(o.map(e=>{var t;return[e.name,{default:null==(t=null==e?void 0:e.attribute)?void 0:t.default}]}))}),a=k(h(n,"parseHTML",s));a&&(i.parseDOM=a.map(e=>w(e,o)));let l=h(n,"renderHTML",s);l&&(i.toDOM=e=>l({node:e,HTMLAttributes:b(e,o)}));let d=h(n,"renderText",s);return d&&(i.toText=d),[n.name,i]})),d=Object.fromEntries(s.map(n=>{let o=r.filter(e=>e.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:t},i=x({...e.reduce((e,t)=>{let r=h(t,"extendMarkSchema",s);return{...e,...r?r(n):{}}},{}),inclusive:k(h(n,"inclusive",s)),excludes:k(h(n,"excludes",s)),group:k(h(n,"group",s)),spanning:k(h(n,"spanning",s)),code:k(h(n,"code",s)),attrs:Object.fromEntries(o.map(e=>{var t;return[e.name,{default:null==(t=null==e?void 0:e.attribute)?void 0:t.default}]}))}),a=k(h(n,"parseHTML",s));a&&(i.parseDOM=a.map(e=>w(e,o)));let l=h(n,"renderHTML",s);return l&&(i.toDOM=e=>l({mark:e,HTMLAttributes:b(e,o)})),[n.name,i]}));return new i.Sj({topNode:a,nodes:l,marks:d})}(this.extensions,t),this.setupExtensions()}static resolve(e){var t;let n=I.sort(I.flatten(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}static flatten(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},n=h(e,"addExtensions",t);return n?[e,...this.flatten(n())]:e}).flat(10)}static sort(e){return e.sort((e,t)=>{let n=h(e,"priority")||100,r=h(t,"priority")||100;return n>r?-1:+(n<r)})}get commands(){return this.extensions.reduce((e,t)=>{let n={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:M(t.name,this.schema)},r=h(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this,t=I.sort([...this.extensions].reverse()),n=[],o=[],a=t.map(t=>{let r={name:t.name,options:t.options,storage:t.storage,editor:e,type:M(t.name,this.schema)},i=[],a=h(t,"addKeyboardShortcuts",r),l={};if("mark"===t.type&&h(t,"exitable",r)&&(l.ArrowRight=()=>j.handleExit({editor:e,mark:t})),a){let t=Object.fromEntries(Object.entries(a()).map(([t,n])=>[t,()=>n({editor:e})]));l={...l,...t}}let d=(0,s.w)(l);i.push(d);let c=h(t,"addInputRules",r);O(t,e.options.enableInputRules)&&c&&n.push(...c());let p=h(t,"addPasteRules",r);O(t,e.options.enablePasteRules)&&p&&o.push(...p());let u=h(t,"addProseMirrorPlugins",r);if(u){let e=u();i.push(...e)}return i}).flat();return[function(e){let{editor:t,rules:n}=e,o=new r.k_({state:{init:()=>null,apply(e,r,s){let a=e.getMeta(o);if(a)return a;let l=e.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:e}=l;"string"==typeof e||(e=E(i.FK.from(e),s.schema));let{from:r}=l,a=r+e.length;P({editor:t,from:r,to:a,text:e,rules:n,plugin:o})}),e.selectionSet||e.docChanged?null:r}},props:{handleTextInput:(e,r,s,i)=>P({editor:t,from:r,to:s,text:i,rules:n,plugin:o}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:r}=e.state.selection;r&&P({editor:t,from:r.pos,to:r.pos,text:"",rules:n,plugin:o})}),!1)},handleKeyDown(e,r){if("Enter"!==r.key)return!1;let{$cursor:s}=e.state.selection;return!!s&&P({editor:t,from:s.pos,to:s.pos,text:"\n",rules:n,plugin:o})}},isInputRules:!0});return o}({editor:e,rules:n}),...function(e){let t,{editor:n,rules:o}=e,s=null,a=!1,l=!1,d="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let u=({state:e,from:r,to:o,rule:s,pasteEvt:i})=>{let a=e.tr;if(function(e){let{editor:t,state:n,from:r,to:o,rule:s,pasteEvent:i,dropEvent:a}=e,{commands:l,chain:d,can:c}=new p({editor:t,state:n}),u=[];return n.doc.nodesBetween(r,o,(e,t)=>{if(!e.isTextblock||e.type.spec.code)return;let p=Math.max(r,t),h=Math.min(o,t+e.content.size);
1((e,t,n)=>{if(S(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.textBetween(p-t,h-t,void 0,""),s.find,i).forEach(e=>{if(void 0===e.index)return;let t=p+e.index+1,r=t+e[0].length,o={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},h=s.handler({state:n,range:o,match:e,commands:l,chain:d,can:c,pasteEvent:i,dropEvent:a});u.push(h)})}),u.every(e=>null!==e)}({editor:n,state:c({state:e,transaction:a}),from:Math.max(r-1,0),to:o.b-1,rule:s,pasteEvent:i,dropEvent:t})&&a.steps.length){try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return d="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return o.map(e=>new r.k_({view(e){let t=t=>{var r;(s=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(N=n)},r=()=>{N&&(N=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=s===e.dom.parentElement,t=n,!l){let e=N;e&&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,a=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let o=t[0],s="paste"===o.getMeta("uiEvent")&&!a,c="drop"===o.getMeta("uiEvent")&&!l,p=o.getMeta("applyPasteRules"),h=!!p;if(!s&&!c&&!h)return;if(h){var m,f;let t,{text:n}=p;"string"==typeof n||(n=E(i.FK.from(n),r.schema));let{from:o}=p,s=o+n.length;return u({rule:e,state:r,from:o,to:{b:s},pasteEvt:(m=n,null==(f=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||f.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 u({rule:e,state:r,from:g,to:y,pasteEvt:d})}}))}({editor:e,rules:o}),...a]}get attributes(){return f(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=m(this.extensions);return Object.fromEntries(t.filter(e=>!!h(e,"addNodeView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:t.storage,editor:e,type:g(t.name,this.schema)},o=h(t,"addNodeView",r);return o?[t.name,(r,s,i,a,l)=>{let d=b(r,n);return o()({node:r,view:s,getPos:i,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:d})}]:[]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;let n={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:M(e.name,this.schema)};"mark"===e.type&&(null==(t=k(h(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);let r=h(e,"onBeforeCreate",n),o=h(e,"onCreate",n),s=h(e,"onUpdate",n),i=h(e,"onSelectionUpdate",n),a=h(e,"onTransaction",n),l=h(e,"onFocus",n),d=h(e,"onBlur",n),c=h(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),o&&this.editor.on("create",o),s&&this.editor.on("update",s),i&&this.editor.on("selectionUpdate",i),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),d&&this.editor.on("blur",d),c&&this.editor.on("destroy",c)})}}class B{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=k(h(this,"addOptions",{name:this.name}))),this.storage=k(h(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new B(e)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>A(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new B({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=k(h(t,"addOptions",{name:t.name})),t.storage=k(h(t,"addStorage",{name:t.name,options:t.options})),t}}function R(e,t,n){let{from:r,to:o}
1=t,{blockSeparator:s="\n\n",textSerializers:i={}}=n||{},a="";return e.nodesBetween(r,o,(e,n,l,d)=>{var c;e.isBlock&&n>r&&(a+=s);let p=null==i?void 0:i[e.type.name];if(p)return l&&(a+=p({node:e,pos:n,parent:l,index:d,range:t})),!1;e.isText&&(a+=null==(c=null==e?void 0:e.text)?void 0:c.slice(Math.max(r,n)-n,o-n))}),a}function D(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}let L=B.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new r.k_({key:new r.hs("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:s}=o,i=Math.min(...s.map(e=>e.$from.pos)),a=Math.max(...s.map(e=>e.$to.pos)),l=D(n);return R(r,{from:i,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}});function z(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:S(t[r])?t[r].test(e[r]):t[r]===e[r])}function F(e,t,n={}){return e.find(e=>e.type===t&&z(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function _(e,t,n={}){return!!F(e,t,n)}function H(e,t,n){var r;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if(o.node&&o.node.marks.some(e=>e.type===t)||(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some(e=>e.type===t)||(n=n||(null==(r=o.node.marks[0])?void 0:r.attrs),!F([...o.node.marks],t,n)))return;let s=o.index,i=e.start()+o.offset,a=s+1,l=i+o.node.nodeSize;for(;s>0&&_([...e.parent.child(s-1).marks],t,n);)s-=1,i-=e.parent.child(s).nodeSize;for(;a<e.parent.childCount&&_([...e.parent.child(a).marks],t,n);)l+=e.parent.child(a).nodeSize,a+=1;return{from:i,to:l}}function K(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}function U(e){return e instanceof r.U3}function V(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function G(e,t=null){if(!t)return null;let n=r.LN.atStart(e),o=r.LN.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return o;let s=n.from,i=o.to;return"all"===t?r.U3.create(e,V(0,s,i),V(e.content.size,s,i)):r.U3.create(e,V(t,s,i),V(t,s,i))}function W(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}let q=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&&q(r)}return e};function J(e){let t=`<body>${e}</body>`;return q(new window.DOMParser().parseFromString(t,"text/html").body)}function Y(e,t,n){if(e instanceof i.bP||e instanceof i.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 i.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),Y("",t,n)}if(o){if(n.errorOnInvalidContent){let r=!1,o="",s=new i.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?i.S4.fromSchema(s).parseSlice(J(e),n.parseOptions):i.S4.fromSchema(s).parse(J(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${o}`)})}let r=i.S4.fromSchema(t);return n.slice?r.parseSlice(J(e),n.parseOptions).content:r.parse(J(e),n.parseOptions)}return Y("",t,n)}function Z(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}function Q(e,t,n={}){let{from:r,to:o,empty:s}=e.selection,i=t?g(t,e.schema):null,a=[];e.doc.nodesBetween(r,o,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),s=Math.min(o,t+e.nodeSize);a.push({node:e,from:n,to:s})});let l=o-r,d=a.filter(e=>
1!i||i.name===e.node.type.name).filter(e=>z(e.node.attrs,n,{strict:!1}));return s?!!d.length:d.reduce((e,t)=>e+t.to-t.from,0)>=l}function X(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function ee(e,t){let n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}function et(e,t,n={},r={}){return Y(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}function en(e,t){let n=K(t,e.schema),{from:r,to:o,empty:s}=e.selection,i=[];s?(e.storedMarks&&i.push(...e.storedMarks),i.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,e=>{i.push(...e.marks)});let a=i.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function er(e,t){let n=new a.dL(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function eo(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function es(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 ei(e,t){let n=X("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){let n=g(t,e.schema),{from:r,to:o}=e.selection,s=[];e.doc.nodesBetween(r,o,e=>{s.push(e)});let i=s.reverse().find(e=>e.type.name===n.name);return i?{...i.attrs}:{}}(e,t):"mark"===n?en(e,t):{}}function ea(e){let t,{mapping:n,steps:r}=e,o=[];return n.maps.forEach((e,t)=>{let s=[];if(e.ranges.length)e.forEach((e,t)=>{s.push({from:e,to:t})});else{let{from:e,to:n}=r[t];if(void 0===e||void 0===n)return;s.push({from:e,to:n})}s.forEach(({from:e,to:r})=>{let s=n.slice(t).map(e,-1),i=n.slice(t).map(r),a=n.invert().map(s,-1),l=n.invert().map(i);o.push({oldRange:{from:a,to:l},newRange:{from:s,to:i}})})}),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 el(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let o=H(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}function ed(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}))}function ec(e,t,n={}){let{empty:r,ranges:o}=e.selection,s=t?K(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!s||s.name===e.type.name).find(e=>z(e.attrs,n,{strict:!1}));let i=0,a=[];if(o.forEach(({$from:t,$to:n})=>{let r=t.pos,o=n.pos;e.doc.nodesBetween(r,o,(e,t)=>{if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),s=Math.min(o,t+e.nodeSize);i+=s-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:s})))})}),0===i)return!1;let l=a.filter(e=>!s||s.name===e.mark.type.name).filter(e=>z(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),d=a.filter(e=>!s||e.mark.type!==s&&e.mark.type.excludes(s)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+d:l)>=i}function ep(e,t){let{nodeExtensions:n}=m(t),r=n.find(t=>t.name===e);if(!r)return!1;let o={name:r.name,options:r.options,storage:r.storage},s=k(h(r,"group",o));return"string"==typeof s&&s.split(" ").includes("list")}function eu(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.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&&(eu(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function eh(e){return e instanceof r.nh}function em(e,t,n){let r=e.state.doc.content.size,o=V(t,0,r),s=V(n,0,r),i=e.coordsAtPos(o),a=e.coordsAtPos(s,-1),l=Math.min(i.top,a.top),d=Math.max(i.bottom,a.bottom),c=Math.min(i.left,a.left),p=Math.max(i.right,a.right),u={top:l,bottom:d,left:c,right:p,width:p-c,height:d-l,x:c,y:l};return{...u,toJSON:()=>u}}function ef(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>
1null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}let eg=(e,t)=>{let n=es(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;let o=e.doc.nodeAt(r);return!(n.node.type===(null==o?void 0:o.type)&&(0,a.n9)(e.doc,n.pos))||(e.join(n.pos),!0)},ey=(e,t)=>{let n=es(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;let o=e.doc.nodeAt(r);return!(n.node.type===(null==o?void 0:o.type)&&(0,a.n9)(e.doc,r))||(e.join(r),!0)};var eb=Object.freeze({__proto__:null,blur:()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),clearContent:(e=!1)=>({commands:t})=>t.setContent("",e),clearNodes:()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:o}=r;return!n||(o.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:o}=t,s=r.resolve(o.map(n)),i=r.resolve(o.map(n+e.nodeSize)),l=s.blockRange(i);if(!l)return;let d=(0,a.jP)(l);if(e.type.isTextblock){let{defaultType:e}=s.parent.contentMatchAt(s.index());t.setNodeMarkup(l.start,e)}(d||0===d)&&t.lift(l,d)})}),!0)},command:e=>t=>e(t),createParagraphNear:()=>({state:e,dispatch:t})=>(0,l.Z1)(e,t),cut:(e,t)=>({editor:n,tr:o})=>{let{state:s}=n,i=s.doc.slice(e.from,e.to);o.deleteRange(e.from,e.to);let a=o.mapping.map(t);return o.insert(a,i.content),o.setSelection(new r.U3(o.doc.resolve(a-1))),!0},deleteCurrentNode:()=>({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},deleteNode:e=>({tr:t,state:n,dispatch:r})=>{let o=g(e,n.schema),s=t.selection.$anchor;for(let e=s.depth;e>0;e-=1)if(s.node(e).type===o){if(r){let n=s.before(e),r=s.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},deleteRange:e=>({tr:t,dispatch:n})=>{let{from:r,to:o}=e;return n&&t.delete(r,o),!0},deleteSelection:()=>({state:e,dispatch:t})=>(0,l.ic)(e,t),enter:()=>({commands:e})=>e.keyboardShortcut("Enter"),exitCode:()=>({state:e,dispatch:t})=>(0,l.I$)(e,t),extendMarkRange:(e,t={})=>({tr:n,state:o,dispatch:s})=>{let i=K(e,o.schema),{doc:a,selection:l}=n,{$from:d,from:c,to:p}=l;if(s){let e=H(d,i,t);if(e&&e.from<=c&&e.to>=p){let t=r.U3.create(a,e.from,e.to);n.setSelection(t)}}return!0},first: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},focus:(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:s})=>{t={scrollIntoView:!0,...t};let i=()=>{(W()||"Android"===navigator.platform||/android/i.test(navigator.userAgent))&&r.dom.focus(),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};if(r.hasFocus()&&null===e||!1===e)return!0;if(s&&null===e&&!U(n.state.selection))return i(),!0;let a=G(o.doc,e)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),i()),!0},forEach:(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),insertContent:(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),insertContentAt:(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};try{s=Y(t,l.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:null!=(d=n.errorOnInvalidContent)?d:l.options.enableContentCheck})}catch(e){return l.emit("contentError",{editor:l,error:e,disableCollaboration:()=>{l.storage.collaboration&&(l.storage.collaboration.isDisabled=!0)}}),!1}let{from:p,to:u}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},h=!0,m=!0;if((!("type"in s)?s:[s]).forEach(e=>{e.check(),h=!!h&&e.isText&&0===e.marks.length,m=!!m&&e.isBlock}),p===u&&m){let{parent:e}=o.doc.resolve(p);!e.isTextblock||e.type.spec.code||e.childCount||(p-=1,u+=1)}
1if(h){if(Array.isArray(t))c=t.map(e=>e.text||"").join("");else if(t instanceof i.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,p,u)}else c=s,o.replaceWith(p,u,c);n.updateSelection&&function(e,t){let n=e.steps.length-1;if(n<t)return;let o=e.steps[n];if(!(o instanceof a.Ln||o instanceof a.Wg))return;let s=e.mapping.maps[n],i=0;s.forEach((e,t,n,r)=>{0===i&&(i=r)}),e.setSelection(r.LN.near(e.doc.resolve(i),-1))}(o,o.steps.length-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:p,text:c}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:p,text:c})}return!0},joinBackward:()=>({state:e,dispatch:t})=>(0,l.Qv)(e,t),joinDown:()=>({state:e,dispatch:t})=>(0,l.bh)(e,t),joinForward:()=>({state:e,dispatch:t})=>(0,l.eT)(e,t),joinItemBackward:()=>({state:e,dispatch:t,tr:n})=>{try{let r=(0,a.N0)(e.doc,e.selection.$from.pos,-1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},joinItemForward:()=>({state:e,dispatch:t,tr:n})=>{try{let r=(0,a.N0)(e.doc,e.selection.$from.pos,1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},joinTextblockBackward:()=>({state:e,dispatch:t})=>(0,l.eB)(e,t),joinTextblockForward:()=>({state:e,dispatch:t})=>(0,l._G)(e,t),joinUp:()=>({state:e,dispatch:t})=>(0,l.G2)(e,t),keyboardShortcut:e=>({editor:t,view:n,tr:r,dispatch:o})=>{let s=(function(e){let t,n,r,o,s=e.split(/-(?!$)/),i=s[s.length-1];"Space"===i&&(i=" ");for(let e=0;e<s.length-1;e+=1){let i=s[e];if(/^(cmd|meta|m)$/i.test(i))o=!0;else if(/^a(lt)?$/i.test(i))t=!0;else if(/^(c|ctrl|control)$/i.test(i))n=!0;else if(/^s(hift)?$/i.test(i))r=!0;else if(/^mod$/i.test(i))W()||Z()?o=!0:n=!0;else throw Error(`Unrecognized modifier name: ${i}`)}return t&&(i=`Alt-${i}`),n&&(i=`Ctrl-${i}`),o&&(i=`Meta-${i}`),r&&(i=`Shift-${i}`),i})(e).split(/-(?!$)/),i=s.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"===i?" ":i,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,a))});return null==l||l.steps.forEach(e=>{let t=e.map(r.mapping);t&&o&&r.maybeStep(t)}),!0},lift:(e,t={})=>({state:n,dispatch:r})=>{let o=g(e,n.schema);return!!Q(n,o,t)&&(0,l.yY)(n,r)},liftEmptyBlock:()=>({state:e,dispatch:t})=>(0,l.iz)(e,t),liftListItem:e=>({state:t,dispatch:n})=>{let r=g(e,t.schema);return(0,d.T2)(r)(t,n)},newlineInCode:()=>({state:e,dispatch:t})=>(0,l.pC)(e,t),resetAttributes:(e,t)=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null,a=X("string"==typeof e?e:e.name,r.schema);return!!a&&("node"===a&&(s=g(e,r.schema)),"mark"===a&&(i=K(e,r.schema)),o&&n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{s&&s===e.type&&n.setNodeMarkup(r,void 0,ee(e.attrs,t)),i&&e.marks.length&&e.marks.forEach(o=>{i===o.type&&n.addMark(r,r+e.nodeSize,i.create(ee(o.attrs,t)))})})}),!0)},scrollIntoView:()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),selectAll:()=>({tr:e,dispatch:t})=>{if(t){let t=new r.i5(e.doc);e.setSelection(t)}return!0},selectNodeBackward:()=>({state:e,dispatch:t})=>(0,l._e)(e,t),selectNodeForward:()=>({state:e,dispatch:t})=>(0,l.Sd)(e,t),selectParentNode:()=>({state:e,dispatch:t})=>(0,l.hy)(e,t),selectTextblockEnd:()=>({state:e,dispatch:t})=>(0,l.ec)(e,t),selectTextblockStart:()=>({state:e,dispatch:t})=>(0,l.$f)(e,t),setContent:(e,t=!1,n={},r={})=>({editor:o,tr:s,dispatch:i,commands:a})=>{var l,d;let{doc:c}=s;if("full"!==n.preserveWhitespace){let a=et(e,o.schema,n,{errorOnInvalidContent:null!=(l=r.errorOnInvalidContent)?l:o.options.enableContentCheck});return i&&s.replaceWith(0,c.content.size,a).setMeta("preventUpdate",!t),!0}return i&&s.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:c.content.size},e,{parseOptions:n,errorOnInvalidContent:null!=(d=r.errorOnInvalidContent)?d:o.options.enableContentCheck})},setMark:(e,t={})=>({tr:n,state:r,dispatch:o})=>{let{selection:s}=n,{empty:i,ranges:a}=s,l=K(e,r.schema);if(o)if(i){let e=en(r,l);n.addStoredMark(l.create({...e,...t}))}
1else a.forEach(e=>{let o=e.$from.pos,s=e.$to.pos;r.doc.nodesBetween(o,s,(e,r)=>{let i=Math.max(r,o),a=Math.min(r+e.nodeSize,s);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(i,a,l.create({...e.attrs,...t}))}):n.addMark(i,a,l.create(t))})});return function(e,t,n){var r;let{selection:o}=t,s=null;if(U(o)&&(s=o.$cursor),s){let t=null!=(r=e.storedMarks)?r:s.marks();return!!n.isInSet(t)||!t.some(e=>e.type.excludes(n))}let{ranges:i}=o;return i.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),s=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));o=t&&s}return!o}),o})}(r,n,l)},setMeta:(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),setNode:(e,t={})=>({state:n,dispatch:r,chain:o})=>{let s,i=g(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock)?o().command(({commands:e})=>!!(0,l.y_)(i,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>(0,l.y_)(i,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,o=V(e,0,n.content.size),s=r.nh.create(n,o);t.setSelection(s)}return!0},setTextSelection:e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:o,to:s}="number"==typeof e?{from:e,to:e}:e,i=r.U3.atStart(n).from,a=r.U3.atEnd(n).to,l=V(o,i,a),d=V(s,i,a),c=r.U3.create(n,l,d);t.setSelection(c)}return!0},sinkListItem:e=>({state:t,dispatch:n})=>{let r=g(e,t.schema);return(0,d.$B)(r)(t,n)},splitBlock:({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:o,editor:s})=>{let{selection:i,doc:l}=t,{$from:d,$to:c}=i,p=ed(s.extensionManager.attributes,d.node().type.name,d.node().attrs);if(i instanceof r.nh&&i.node.isBlock)return!!d.parentOffset&&!!(0,a.zy)(l,d.pos)&&(o&&(e&&ef(n,s.extensionManager.splittableMarks),t.split(d.pos).scrollIntoView()),!0);if(!d.parent.isBlock)return!1;let u=c.parentOffset===c.parent.content.size,h=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=u&&h?[{type:h,attrs:p}]:void 0,f=(0,a.zy)(t.doc,t.mapping.map(d.pos),1,m);if(!m&&!f&&(0,a.zy)(t.doc,t.mapping.map(d.pos),1,h?[{type:h}]:void 0)&&(f=!0,m=h?[{type:h,attrs:p}]:void 0),o){if(f&&(i instanceof r.U3&&t.deleteSelection(),t.split(t.mapping.map(d.pos),1,m),h&&!u&&!d.parentOffset&&d.parent.type!==h)){let e=t.mapping.map(d.before()),n=t.doc.resolve(e);d.node(-1).canReplaceWith(n.index(),n.index()+1,h)&&t.setNodeMarkup(t.mapping.map(d.before()),h)}e&&ef(n,s.extensionManager.splittableMarks),t.scrollIntoView()}return f},splitListItem:(e,t={})=>({tr:n,state:o,dispatch:s,editor:l})=>{var d;let c=g(e,o.schema),{$from:p,$to:u}=o.selection,h=o.selection.node;if(h&&h.isBlock||p.depth<2||!p.sameParent(u))return!1;let m=p.node(-1);if(m.type!==c)return!1;let f=l.extensionManager.attributes;if(0===p.parent.content.size&&p.node(-1).childCount===p.indexAfter(-1)){if(2===p.depth||p.node(-3).type!==c||p.index(-2)!==p.node(-2).childCount-1)return!1;if(s){let e=i.FK.empty,o=p.index(-1)?1:p.index(-2)?2:3;for(let t=p.depth-o;t>=p.depth-3;t-=1)e=i.FK.from(p.node(t).copy(e));let s=p.indexAfter(-1)<p.node(-2).childCount?1:p.indexAfter(-2)<p.node(-3).childCount?2:3,a={...ed(f,p.node().type.name,p.node().attrs),...t},l=(null==(d=c.contentMatch.defaultType)?void 0:d.createAndFill(a))||void 0;e=e.append(i.FK.from(c.createAndFill(null,l)||void 0));let u=p.before(p.depth-(o-1));n.replace(u,p.after(-s),new i.Ji(e,4-o,0));let h=-1;n.doc.nodesBetween(u,n.doc.content.size,(e,t)=>{if(h>-1)return!1;e.isTextblock&&0===e.content.size&&(h=t+1)}),h>-1&&n.setSelection(r.U3.near(n.doc.resolve(h))),n.scrollIntoView()}return!0}let y=u.pos===p.end()?m.contentMatchAt(0).defaultType:null,b={...ed(f,m.type.name,m.attrs),...t},v={...ed(f,p.node().type.name,p.node().attrs),...t};n.delete(p.pos,u.pos);let k=y?[{type:c,attrs:b},{type:y,attrs:v}]:[{type:c,attrs:b}];if(!(0,a.zy)(n.doc,p.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(p.pos,2,k).scrollIntoView(),!i||!s)return!0;let a=i.filter(e=>
1r.includes(e.type.name));n.ensureMarks(a)}return!0},toggleList:(e,t,n,r={})=>({editor:o,tr:s,state:i,dispatch:a,chain:l,commands:d,can:c})=>{let{extensions:p,splittableMarks:u}=o.extensionManager,h=g(e,i.schema),m=g(t,i.schema),{selection:f,storedMarks:y}=i,{$from:b,$to:v}=f,k=b.blockRange(v),w=y||f.$to.parentOffset&&f.$from.marks();if(!k)return!1;let x=es(e=>ep(e.type.name,p))(f);if(k.depth>=1&&x&&k.depth-x.depth<=1){if(x.node.type===h)return d.liftListItem(m);if(ep(x.node.type.name,p)&&h.validContent(x.node.content)&&a)return l().command(()=>(s.setNodeMarkup(x.pos,h),!0)).command(()=>eg(s,h)).command(()=>ey(s,h)).run()}return n&&w&&a?l().command(()=>{let e=c().wrapInList(h,r),t=w.filter(e=>u.includes(e.type.name));return s.ensureMarks(t),!!e||d.clearNodes()}).wrapInList(h,r).command(()=>eg(s,h)).command(()=>ey(s,h)).run():l().command(()=>!!c().wrapInList(h,r)||d.clearNodes()).wrapInList(h,r).command(()=>eg(s,h)).command(()=>ey(s,h)).run()},toggleMark:(e,t={},n={})=>({state:r,commands:o})=>{let{extendEmptyMarkRange:s=!1}=n,i=K(e,r.schema);return ec(r,i,t)?o.unsetMark(i,{extendEmptyMarkRange:s}):o.setMark(i,t)},toggleNode:(e,t,n={})=>({state:r,commands:o})=>{let s,i=g(e,r.schema),a=g(t,r.schema),l=Q(r,i,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(s=r.selection.$anchor.parent.attrs),l)?o.setNode(a,s):o.setNode(i,{...s,...n})},toggleWrap:(e,t={})=>({state:n,commands:r})=>{let o=g(e,n.schema);return Q(n,o,t)?r.lift(o):r.wrapIn(o,t)},undoInputRule:()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let o,s=n[r];if(s.spec.isInputRules&&(o=s.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},unsetAllMarks:()=>({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)},unsetMark:(e,t={})=>({tr:n,state:r,dispatch:o})=>{var s;let{extendEmptyMarkRange:i=!1}=t,{selection:a}=n,l=K(e,r.schema),{$from:d,empty:c,ranges:p}=a;if(!o)return!0;if(c&&i){let{from:e,to:t}=a,r=null==(s=d.marks().find(e=>e.type===l))?void 0:s.attrs,o=H(d,l,r);o&&(e=o.from,t=o.to),n.removeMark(e,t,l)}else p.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},updateAttributes:(e,t={})=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null,a=X("string"==typeof e?e:e.name,r.schema);return!!a&&("node"===a&&(s=g(e,r.schema)),"mark"===a&&(i=K(e,r.schema)),o&&n.selection.ranges.forEach(e=>{let o,a,l,d,c=e.$from.pos,p=e.$to.pos;n.selection.empty?r.doc.nodesBetween(c,p,(e,t)=>{s&&s===e.type&&(l=Math.max(t,c),d=Math.min(t+e.nodeSize,p),o=t,a=e)}):r.doc.nodesBetween(c,p,(e,r)=>{r<c&&s&&s===e.type&&(l=Math.max(r,c),d=Math.min(r+e.nodeSize,p),o=r,a=e),r>=c&&r<=p&&(s&&s===e.type&&n.setNodeMarkup(r,void 0,{...e.attrs,...t}),i&&e.marks.length&&e.marks.forEach(o=>{if(i===o.type){let s=Math.max(r,c),a=Math.min(r+e.nodeSize,p);n.addMark(s,a,i.create({...o.attrs,...t}))}}))}),a&&(void 0!==o&&n.setNodeMarkup(o,void 0,{...a.attrs,...t}),i&&a.marks.length&&a.marks.forEach(e=>{i===e.type&&n.addMark(l,d,i.create({...e.attrs,...t}))}))}),!0)},wrapIn:(e,t={})=>({state:n,dispatch:r})=>{let o=g(e,n.schema);return(0,l.Im)(o,t)(n,r)},wrapInList:(e,t={})=>({state:n,dispatch:r})=>{let o=g(e,n.schema);return(0,d.Sd)(o,t)(n,r)}});let ev=B.create({name:"commands",addCommands:()=>({...eb})}),ek=B.create({name:"drop",addProseMirrorPlugins(){return[new r.k_({key:new r.hs("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),ew=B.create({name:"editable",addProseMirrorPlugins(){return[new r.k_({key:new r.hs("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ex=B.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new r.k_({key:new r.hs("focusEvents"),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}}}})]}}),eM=B.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:o}=t,{empty:s,$anchor:i}=n,{pos:a,parent:l}=i,d=i.parent.isTextblock&&a>0?t.doc.resolve(a-1):i,c=d.parent.type.spec.isolating,p=i.pos-i.parentOffset,u=c&&1===d.parent.childCount?p===i.pos:r.LN.atStart(o).from===a;return!!s&&!!l.type.isTextblock&&!l.textContent.length&&!!u&&(!u||"paragraph"!==i.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()},o={...n},s={...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 W()||Z()?s:o},addProseMirrorPlugins(){return[new r.k_({key:new r.hs("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;let o=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),s=e.some(e=>e.getMeta("preventClearDocument"));if(!o||s)return;let{empty:i,from:a,to:l}=t.selection,d=r.LN.atStart(t.doc).from,u=r.LN.atEnd(t.doc).to;
1if(i||a!==d||l!==u||!eu(n.doc))return;let h=n.tr,m=c({state:n,transaction:h}),{commands:f}=new p({editor:this.editor,state:m});if(f.clearNodes(),h.steps.length)return h}})]}}),eO=B.create({name:"paste",addProseMirrorPlugins(){return[new r.k_({key:new r.hs("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),eE=B.create({name:"tabindex",addProseMirrorPlugins(){return[new r.k_({key:new r.hs("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class eS{get name(){return this.node.type.name}constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You canât set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(0===this.depth)return null;let e=this.resolvedPos.start(this.resolvedPos.depth-1);return new eS(this.resolvedPos.doc.resolve(e),this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new eS(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new eS(e,this.editor)}get children(){let e=[];return this.node.content.forEach((t,n)=>{let r=t.isBlock&&!t.isTextblock,o=t.isAtom&&!t.isText,s=this.pos+n+ +!o,i=this.resolvedPos.doc.resolve(s);if(!r&&i.depth<=this.depth)return;let a=new eS(i,this.editor,r,r?t:null);r&&(a.actualDepth=this.depth+1),e.push(new eS(i,this.editor,r,r?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let o=n[r];if(e[o]!==t[o])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;let o=Object.keys(t);return this.children.forEach(s=>{n&&r.length>0||(s.node.type.name===e&&o.every(e=>t[e]===s.node.attrs[e])&&r.push(s),n&&r.length>0||(r=r.concat(s.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}}let eC=`.ProseMirror { 2 position: relative; 3} 4 5.ProseMirror { 6 word-wrap: break-word; 7 white-space: pre-wrap; 8 white-space: break-spaces; 9 -webkit-font-variant-ligatures: none; 10 font-variant-ligatures: none; 11 font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ 12} 13 14.ProseMirror [contenteditable="false"] { 15 white-space: normal; 16} 17 18.ProseMirror [contenteditable="false"] [contenteditable="true"] { 19 white-space: pre-wrap; 20} 21 22.ProseMirror pre { 23 white-space: pre-wrap; 24} 25 26img.ProseMirror-separator { 27 display: inline !important; 28 border: none !important; 29 margin: 0 !important; 30 width: 0 !important; 31 height: 0 !important; 32} 33 34.ProseMirror-gapcursor { 35 display: none; 36 pointer-events: none; 37 position: absolute; 38 margin: 0; 39} 40 41.ProseMirror-gapcursor:after {
42 content: ""; 43 display: block; 44 position: absolute; 45 top: -2px; 46 width: 20px; 47 border-top: 1px solid black; 48 animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; 49} 50 51@keyframes ProseMirror-cursor-blink { 52 to { 53 visibility: hidden; 54 } 55} 56 57.ProseMirror-hideselection *::selection { 58 background: transparent; 59} 60 61.ProseMirror-hideselection *::-moz-selection { 62 background: transparent; 63} 64 65.ProseMirror-hideselection * { 66 caret-color: transparent; 67} 68 69.ProseMirror-focused .ProseMirror-gapcursor { 70 display: block; 71} 72 73.tippy-box[data-animation=fade][data-state=hidden] { 74 opacity: 0 75}`;class eP extends u{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=function(e,t){let n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;let r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}(eC,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,t){let n=v(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let r="string"==typeof e?`${e}$`:e.key;n=t.filter(e=>!e.key.startsWith(r))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[ew,L.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),ev,ex,eM,eE,ek,eO].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new I(n,this)}createCommandManager(){this.commandManager=new p({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=et(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;
75this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),t=et(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let n=G(t,this.options.autofocus);this.view=new o.Lz(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...null==(e=this.options.editorProps)?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:r.$t.create({doc:t,selection:n||void 0})});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.createNodeViews(),this.prependClass(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)});return}let t=this.state.apply(e),n=!this.state.selection.eq(t.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),n&&this.emit("selectionUpdate",{editor:this,transaction:e});let r=e.getMeta("focus"),o=e.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event,transaction:e}),o&&this.emit("blur",{editor:this,event:o.event,transaction:e}),!e.docChanged||e.getMeta("preventUpdate")||this.emit("update",{editor:this,transaction:e})}getAttributes(e){return ei(this.state,e)}isActive(e,t){let n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return Q(e,null,n)||ec(e,null,n);let r=X(t,e.schema);return"node"===r?Q(e,t,n):"mark"===r&&ec(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return E(this.state.doc.content,this.schema)}getText(e){var t,n;let r,{blockSeparator:o="\n\n",textSerializers:s={}}=e||{};return t=this.state.doc,n={blockSeparator:o,textSerializers:{...D(this.schema),...s}},r={from:0,to:t.content.size},R(t,r,n)}get isEmpty(){return eu(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){let e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(null==(e=this.view)?void 0:e.docView)}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){return new eS(this.state.doc.resolve(e),this)}get $doc(){return this.$pos(0)}}function eT(e){return new C({find:e.find,handler:({state:t,range:n,match:r})=>{let o=k(e.getAttributes,void 0,r);if(!1===o||null===o)return null;let{tr:s}=t,i=r[r.length-1],a=r[0];if(i){let r=a.search(/\S/),l=n.from+a.indexOf(i),d=l+i.length;if(el(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&&s.delete(d,n.to),l>n.from&&s.delete(n.from+r,l);let c=n.from+r+i.length;s.addMark(n.from+r,c,e.type.create(o||{})),s.removeStoredMark(e.type)}}})}function eA(e){return new C({find:e.find,handler:({state:t,range:n,match:r,chain:o})=>{let s=k(e.getAttributes,void 0,r)||{},i=t.tr.delete(n.from,n.to),l=i.doc.resolve(n.from).blockRange(),d=l&&(0,a.oM)(l,e.type,s);if(!d)return null;if(i.wrap(l,d),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:o}=e.editor.extensionManager,s=r||n.$to.parentOffset&&n.$from.marks();if(s){let e=s.filter(e=>
75o.includes(e.type.name));i.ensureMarks(e)}}if(e.keepAttributes){let t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";o().updateAttributes(t,s).run()}let c=i.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&(0,a.n9)(i.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&i.join(n.from-1)}})}class ej{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=k(h(this,"addOptions",{name:this.name}))),this.storage=k(h(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new ej(e)}configure(e={}){let t=this.extend({...this.config,addOptions:()=>A(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new ej(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=k(h(t,"addOptions",{name:t.name})),t.storage=k(h(t,"addStorage",{name:t.name,options:t.options})),t}}function e$(e){return new $({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{let s=k(e.getAttributes,void 0,r,o);if(!1===s||null===s)return null;let{tr:i}=t,a=r[r.length-1],l=r[0],d=n.to;if(a){let r=l.search(/\S/),o=n.from+l.indexOf(a),c=o+a.length;if(el(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>o).length)return null;c<n.to&&i.delete(c,n.to),o>n.from&&i.delete(n.from+r,o),d=n.from+r+a.length,i.addMark(n.from+r,d,e.type.create(s||{})),i.removeStoredMark(e.type)}}})}}}]);
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.