1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[171],{9016:function(e,t,n){n.d(t,{Cf:function(){return markInputRule},Jo:function(){return getMarkAttributes},K9:function(){return markPasteRule},ML:function(){return Editor},NB:function(){return Node},Nl:function(){return getExtensionField},P1:function(){return mergeAttributes},S0:function(){return wrappingInputRule},eE:function(){return isMacOS},hj:function(){return Extension},nU:function(){return callOrReturn},vc:function(){return Mark},x2:function(){return nodeInputRule},zK:function(){return textblockTypeInputRule}});var r=n(565),i=n(8236),o=n(398),s=n(2012),a=n(5599),l=n(3744),d=n(4017);function createChainableState(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:o}=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 o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}let CommandManager=class CommandManager{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:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(o);return i.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s=[],a=!!e,l=e||i.tr,d={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(l,t),i=n(...e)(r);return s.push(i),d}])),run:()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(l),s.every(e=>!0===e))};return d}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1),o=Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})]));return{...o,chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s={tr:e,editor:r,view:o,state:createChainableState({state:i,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)(s)]))}};return s}};let EventEmitter=class EventEmitter{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}removeAllListeners(){this.callbacks={}}};function getExtensionField(e,t,n){if(void 0===e.config[t]&&e.parent)return getExtensionField(e.parent,t,n);if("function"==typeof e.config[t]){let r=e.config[t].bind({...n,parent:e.parent?getExtensionField(e.parent,t,n):null});return r}return e.config[t]}function splitExtensions(e){let t=e.filter(e=>"extension"===e.type),n=e.filter(e=>"node"===e.type),r=e.filter(e=>"mark"===e.type);return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function getAttributesFromExtensions(e){let t=[],{nodeExtensions:n,markExtensions:r}=splitExtensions(e),i=[...n,...r],o={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},r=getExtensionField(e,"addGlobalAttributes",n);if(!r)return;let i=r();i.forEach(e=>{e.types.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...o,...r}})})})})}
1),i.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=getExtensionField(e,"addAttributes",n);if(!r)return;let i=r();Object.entries(i).forEach(([n,r])=>{let i={...o,...r};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&(null==i?void 0:i.default)===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function getNodeType(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 mergeAttributes(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{let r=n[e];if(!r){n[e]=t;return}if("class"===e){let r=t?t.split(" "):[],i=n[e]?n[e].split(" "):[],o=r.filter(e=>!i.includes(e));n[e]=[...i,...o].join(" ")}else"style"===e?n[e]=[n[e],t].join("; "):n[e]=t}),n},{})}function getRenderedAttributes(e,t){return t.filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>mergeAttributes(e,t),{})}function isFunction(e){return"function"==typeof e}function callOrReturn(e,t,...n){return isFunction(e)?t?e.bind(t)(...n):e(...n):e}function injectExtensionAttributesToParseRule(e,t){return e.style?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;let i=t.reduce((e,t)=>{var r;let i=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==i?e:{...e,[t.name]:i}},{});return{...r,...i}}}}function cleanUpSchemaItem(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 getSchemaTypeByName(e,t){return t.nodes[e]||t.marks[e]||null}function isExtensionRulesEnabled(e,t){return Array.isArray(t)?t.some(t=>{let n="string"==typeof t?t:t.name;return n===e.name}):t}let getTextContentFromNodes=(e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,o)=>{var s,a;let l=(null===(a=(s=e.type.spec).toText)||void 0===a?void 0:a.call(s,{node:e,pos:t,parent:i,index:o}))||e.textContent||"%leaf%";n+=l.slice(0,Math.max(0,r-t))}),n};function isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}let InputRule=class InputRule{constructor(e){this.find=e.find,this.handler=e.handler}};let inputRuleMatcherHandler=(e,t)=>{if(isRegExp(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};function run$1(e){var t;let{editor:n,from:r,to:i,text:o,rules:s,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?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let c=!1,u=getTextContentFromNodes(d)+o;return s.forEach(e=>{if(c)return;let t=inputRuleMatcherHandler(u,e.find);if(!t)return;let s=l.state.tr,d=createChainableState({state:l.state,transaction:s}),p={from:r-(t[0].length-o.length),to:i}
1,{commands:h,chain:m,can:f}=new CommandManager({editor:n,state:d}),g=e.handler({state:d,range:p,match:t,commands:h,chain:m,can:f});null!==g&&s.steps.length&&(s.setMeta(a,{transform:s,from:r,to:i,text:o}),l.dispatch(s),c=!0)}),c}let PasteRule=class PasteRule{constructor(e){this.find=e.find,this.handler=e.handler}};let pasteRuleMatcherHandler=(e,t,n)=>{if(isRegExp(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}):[]},createClipboardPasteEvent=e=>{var t;let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null===(t=n.clipboardData)||void 0===t||t.setData("text/html",e),n};let ExtensionManager=class ExtensionManager{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=ExtensionManager.resolve(e),this.schema=function(e,t){var n;let r=getAttributesFromExtensions(e),{nodeExtensions:i,markExtensions:o}=splitExtensions(e),a=null===(n=i.find(e=>getExtensionField(e,"topNode")))||void 0===n?void 0:n.name,l=Object.fromEntries(i.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=e.reduce((e,t)=>{let r=getExtensionField(t,"extendNodeSchema",o);return{...e,...r?r(n):{}}},{}),a=cleanUpSchemaItem({...s,content:callOrReturn(getExtensionField(n,"content",o)),marks:callOrReturn(getExtensionField(n,"marks",o)),group:callOrReturn(getExtensionField(n,"group",o)),inline:callOrReturn(getExtensionField(n,"inline",o)),atom:callOrReturn(getExtensionField(n,"atom",o)),selectable:callOrReturn(getExtensionField(n,"selectable",o)),draggable:callOrReturn(getExtensionField(n,"draggable",o)),code:callOrReturn(getExtensionField(n,"code",o)),defining:callOrReturn(getExtensionField(n,"defining",o)),isolating:callOrReturn(getExtensionField(n,"isolating",o)),attrs:Object.fromEntries(i.map(e=>{var t;return[e.name,{default:null===(t=null==e?void 0:e.attribute)||void 0===t?void 0:t.default}]}))}),l=callOrReturn(getExtensionField(n,"parseHTML",o));l&&(a.parseDOM=l.map(e=>injectExtensionAttributesToParseRule(e,i)));let d=getExtensionField(n,"renderHTML",o);d&&(a.toDOM=e=>d({node:e,HTMLAttributes:getRenderedAttributes(e,i)}));let c=getExtensionField(n,"renderText",o);return c&&(a.toText=c),[n.name,a]})),d=Object.fromEntries(o.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=e.reduce((e,t)=>{let r=getExtensionField(t,"extendMarkSchema",o);return{...e,...r?r(n):{}}},{}),a=cleanUpSchemaItem({...s,inclusive:callOrReturn(getExtensionField(n,"inclusive",o)),excludes:callOrReturn(getExtensionField(n,"excludes",o)),group:callOrReturn(getExtensionField(n,"group",o)),spanning:callOrReturn(getExtensionField(n,"spanning",o)),code:callOrReturn(getExtensionField(n,"code",o)),attrs:Object.fromEntries(i.map(e=>{var t;return[e.name,{default:null===(t=null==e?void 0:e.attribute)||void 0===t?void 0:t.default}]}))}),l=callOrReturn(getExtensionField(n,"parseHTML",o));l&&(a.parseDOM=l.map(e=>injectExtensionAttributesToParseRule(e,i)));let d=getExtensionField(n,"renderHTML",o);return d&&(a.toDOM=e=>d({mark:e,HTMLAttributes:getRenderedAttributes(e,i)})),[n.name,a]}));return new s.V_({topNode:a,nodes:l,marks:d})}(this.extensions,t),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:getSchemaTypeByName(e.name,this.schema)};if("mark"===e.type){let r=null===(t=callOrReturn(getExtensionField(e,"keepOnSplit",n)))||void 0===t||t;r&&this.splittableMarks.push(e.name)}let r=getExtensionField(e,"onBeforeCreate",n);r&&this.editor.on("beforeCreate",r);let i=getExtensionField(e,"onCreate",n);i&&this.editor.on("create",i);let o=getExtensionField(e,"onUpdate",n);o&&this.editor.on("update",o);let s=getExtensionField(e,"onSelectionUpdate",n);s&&this.editor.on("selectionUpdate",s);let a=getExtensionField(e,"onTransaction",n);a&&this.editor.on("transaction",a);let l=getExtensionField(e,"onFocus",n);l&&this.editor.on("focus",l);let d=getExtensionField(e,"onBlur",n);d&&this.editor.on("blur",d);let c=getExtensionField(e,"onDestroy",n);c&&this.editor.on("destroy",c)})}static resolve(e){let t=ExtensionManager.sort(ExtensionManager.flatten(e)),n=function(e){let t=e.filter((t,
1n)=>e.indexOf(t)!==n);return[...new Set(t)]}(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},n=getExtensionField(e,"addExtensions",t);return n?[e,...this.flatten(n())]:e}).flat(10)}static sort(e){return e.sort((e,t)=>{let n=getExtensionField(e,"priority")||100,r=getExtensionField(t,"priority")||100;return n>r?-1:n<r?1:0})}get commands(){return this.extensions.reduce((e,t)=>{let n={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:getSchemaTypeByName(t.name,this.schema)},r=getExtensionField(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this,t=ExtensionManager.sort([...this.extensions].reverse()),n=[],i=[],s=t.map(t=>{let r={name:t.name,options:t.options,storage:t.storage,editor:e,type:getSchemaTypeByName(t.name,this.schema)},s=[],a=getExtensionField(t,"addKeyboardShortcuts",r),l={};if("mark"===t.type&&t.config.exitable&&(l.ArrowRight=()=>Mark.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,o.h)(l);s.push(d);let c=getExtensionField(t,"addInputRules",r);isExtensionRulesEnabled(t,e.options.enableInputRules)&&c&&n.push(...c());let u=getExtensionField(t,"addPasteRules",r);isExtensionRulesEnabled(t,e.options.enablePasteRules)&&u&&i.push(...u());let p=getExtensionField(t,"addProseMirrorPlugins",r);if(p){let e=p();s.push(...e)}return s}).flat();return[function(e){let{editor:t,rules:n}=e,i=new r.Sy({state:{init:()=>null,apply(e,r){let o=e.getMeta(i);if(o)return o;let s=e.getMeta("applyInputRules");return s&&setTimeout(()=>{let{from:e,text:r}=s,o=e+r.length;run$1({editor:t,from:e,to:o,text:r,rules:n,plugin:i})}),e.selectionSet||e.docChanged?null:r}},props:{handleTextInput:(e,r,o,s)=>run$1({editor:t,from:r,to:o,text:s,rules:n,plugin:i}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:r}=e.state.selection;r&&run$1({editor:t,from:r.pos,to:r.pos,text:"",rules:n,plugin:i})}),!1)},handleKeyDown(e,r){if("Enter"!==r.key)return!1;let{$cursor:o}=e.state.selection;return!!o&&run$1({editor:t,from:o.pos,to:o.pos,text:"\n",rules:n,plugin:i})}},isInputRules:!0});return i}({editor:e,rules:n}),...function(e){let{editor:t,rules:n}=e,i=null,o=!1,s=!1,a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l="undefined"!=typeof DragEvent?new DragEvent("drop"):null,processEvent=({state:e,from:n,to:r,rule:i,pasteEvt:o})=>{let s=e.tr,d=createChainableState({state:e,transaction:s}),c=function(e){let{editor:t,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:d,can:c}=new CommandManager({editor:t,state:n}),u=[];n.doc.nodesBetween(r,i,(e,t)=>{if(!e.isTextblock||e.type.spec.code)return;let p=Math.max(r,t),h=Math.min(i,t+e.content.size),m=e.textBetween(p-t,h-t,void 0,""),f=pasteRuleMatcherHandler(m,o.find,s);f.forEach(e=>{if(void 0===e.index)return;let t=p+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},h=o.handler({state:n,range:i,match:e,commands:l,chain:d,can:c,pasteEvent:s,dropEvent:a});u.push(h)})});let p=u.every(e=>null!==e);return p}({editor:t,state:d,from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:o,dropEvent:l});if(c&&s.steps.length)return l="undefined"!=typeof DragEvent?new DragEvent("drop"):null,a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,s},d=n.map(e=>new r.Sy({view(e){let handleDragstart=t=>{var n;i=(null===(n=e.dom.parentElement)||void 0===n?void 0:n.contains(t.target))?e.dom.parentElement:null};return window.addEventListener("dragstart",handleDragstart),{destroy(){window.removeEventListener("dragstart",handleDragstart)}}},props:{handleDOMEvents:{drop:(e,t)=>(s=i===e.dom.parentElement,l=t,!1),paste:(e,t)=>{var n;let r=null===(n=t.clipboardData)||void 0===n?void 0:n.getData("text/html");return a=t,o=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let i=t[0],l="paste"===i.getMeta("uiEvent")&&!o,d="drop"===i.getMeta("uiEvent")&&!s,c=i.getMeta("applyPasteRules"),u=!!c;if(!l&&!d&&!u)return;if(u){let{from:t,text:n}=c,i=t+n.length,o=createClipboardPasteEvent(n);return processEvent({rule:e,state:r,from:t,to:{b:i},pasteEvt:o})}
1let p=n.doc.content.findDiffStart(r.doc.content),h=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof p&&h&&p!==h.b)return processEvent({rule:e,state:r,from:p,to:h,pasteEvt:a})}}));return d}({editor:e,rules:i}),...s]}get attributes(){return getAttributesFromExtensions(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=splitExtensions(this.extensions);return Object.fromEntries(t.filter(e=>!!getExtensionField(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:getNodeType(t.name,this.schema)},i=getExtensionField(t,"addNodeView",r);return i?[t.name,(r,o,s,a)=>{let l=getRenderedAttributes(r,n);return i()({editor:e,node:r,getPos:s,decorations:a,HTMLAttributes:l,extension:t})}]:[]}))}};function isPlainObject(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function mergeDeep(e,t){let n={...e};return isPlainObject(e)&&isPlainObject(t)&&Object.keys(t).forEach(r=>{isPlainObject(t[r])&&r in e?n[r]=mergeDeep(e[r],t[r]):Object.assign(n,{[r]:t[r]})}),n}let Extension=class Extension{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=callOrReturn(getExtensionField(this,"addOptions",{name:this.name}))),this.storage=callOrReturn(getExtensionField(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Extension(e)}configure(e={}){let t=this.extend();return t.options=mergeDeep(this.options,e),t.storage=callOrReturn(getExtensionField(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){let t=new Extension({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=callOrReturn(getExtensionField(t,"addOptions",{name:t.name})),t.storage=callOrReturn(getExtensionField(t,"addStorage",{name:t.name,options:t.options})),t}};function getTextBetween(e,t,n){let{from:r,to:i}=t,{blockSeparator:o="\n\n",textSerializers:s={}}=n||{},a="",l=!0;return e.nodesBetween(r,i,(e,n,d,c)=>{var u;let p=null==s?void 0:s[e.type.name];if(p)return e.isBlock&&!l&&(a+=o,l=!0),d&&(a+=p({node:e,pos:n,parent:d,index:c,range:t})),!1;e.isText?(a+=null===(u=null==e?void 0:e.text)||void 0===u?void 0:u.slice(Math.max(r,n)-n,i-n),l=!1):e.isBlock&&!l&&(a+=o,l=!0)}),a}function getTextSerializersFromSchema(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}let c=Extension.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new r.Sy({key:new r.H$("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,{ranges:o}=i,s=Math.min(...o.map(e=>e.$from.pos)),a=Math.max(...o.map(e=>e.$to.pos)),l=getTextSerializersFromSchema(n);return getTextBetween(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}});function objectIncludes(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:isRegExp(t[r])?t[r].test(e[r]):t[r]===e[r])}function findMarkInSet(e,t,n={}){return e.find(e=>e.type===t&&objectIncludes(e.attrs,n))}function getMarkRange(e,t,n={}){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(e.parentOffset===r.offset&&0!==r.offset&&(r=e.parent.childBefore(e.parentOffset)),!r.node)return;let i=findMarkInSet([...r.node.marks],t,n);if(!i)return;let o=r.index,s=e.start()+r.offset,a=o+1,l=s+r.node.nodeSize;
1for(findMarkInSet([...r.node.marks],t,n);o>0&&i.isInSet(e.parent.child(o-1).marks);)o-=1,s-=e.parent.child(o).nodeSize;for(;a<e.parent.childCount&&function(e,t,n={}){return!!findMarkInSet(e,t,n)}([...e.parent.child(a).marks],t,n);)l+=e.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function getMarkType(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 isTextSelection(e){return e instanceof r.Bs}function minMax(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function resolveFocusPosition(e,t=null){if(!t)return null;let n=r.Y1.atStart(e),i=r.Y1.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return i;let o=n.from,s=i.to;return"all"===t?r.Bs.create(e,minMax(0,o,s),minMax(e.content.size,o,s)):r.Bs.create(e,minMax(t,o,s),minMax(t,o,s))}function isiOS(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}let removeWhitespaces=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&&removeWhitespaces(r)}return e};function elementFromString(e){let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,"text/html").body;return removeWhitespaces(n)}function createNodeFromContent(e,t,n){if(n={slice:!0,parseOptions:{},...n},"object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return s.HY.fromArray(e.map(e=>t.nodeFromJSON(e)));return t.nodeFromJSON(e)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),createNodeFromContent("",t,n)}if("string"==typeof e){let r=s.aw.fromSchema(t);return n.slice?r.parseSlice(elementFromString(e),n.parseOptions).content:r.parse(elementFromString(e),n.parseOptions)}return createNodeFromContent("",t,n)}let isFragment=e=>e.toString().startsWith("<");function isMacOS(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function isNodeActive(e,t,n={}){let{from:r,to:i,empty:o}=e.selection,s=t?getNodeType(t,e.schema):null,a=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);a.push({node:e,from:n,to:o})});let l=i-r,d=a.filter(e=>!s||s.name===e.node.type.name).filter(e=>objectIncludes(e.node.attrs,n,{strict:!1}));if(o)return!!d.length;let c=d.reduce((e,t)=>e+t.to-t.from,0);return c>=l}function getSchemaTypeNameByName(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function deleteProps(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 createDocument(e,t,n={}){return createNodeFromContent(e,t,{slice:!1,parseOptions:n})}function getMarkAttributes(e,t){let n=getMarkType(t,e.schema),{from:r,to:i,empty:o}=e.selection,s=[];o?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{s.push(...e.marks)});let a=s.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function findParentNode(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 getMarksBetween(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=n.resolve(e-1),o=getMarkRange(i,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 getSplittedAttributes(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 isMarkActive(e,t,n={}){let{empty:r,ranges:i}=e.selection,o=t?getMarkType(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!o||o.name===e.type.name).find(e=>objectIncludes(e.attrs,n,{strict:!1}));let s=0,a=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);s+=o-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:o})))})}),0===s)return!1;let l=a.filter(e=>!o||o.name===e.mark.type.name).filter(e=>objectIncludes(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>
1e+t.to-t.from,0),d=a.filter(e=>!o||e.mark.type!==o&&e.mark.type.excludes(o)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+d:l)>=s}function isList(e,t){let{nodeExtensions:n}=splitExtensions(t),r=n.find(t=>t.name===e);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=callOrReturn(getExtensionField(r,"group",i));return"string"==typeof o&&o.split(" ").includes("list")}function ensureMarks(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)}}let joinListBackwards=(e,t)=>{let n=findParentNode(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 i=e.doc.nodeAt(r),o=n.node.type===(null==i?void 0:i.type)&&(0,a.Mn)(e.doc,n.pos);return!o||(e.join(n.pos),!0)},joinListForwards=(e,t)=>{let n=findParentNode(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 i=e.doc.nodeAt(r),o=n.node.type===(null==i?void 0:i.type)&&(0,a.Mn)(e.doc,r);return!o||(e.join(r),!0)};var u=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())||void 0===n||n.removeAllRanges())}),!0),clearContent:(e=!1)=>({commands:t})=>t.setContent("",e),clearNodes:()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return!n||(i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,o=r.resolve(i.map(n)),s=r.resolve(i.map(n+e.nodeSize)),l=o.blockRange(s);if(!l)return;let d=(0,a.k9)(l);if(e.type.isTextblock){let{defaultType:e}=o.parent.contentMatchAt(o.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.mD)(e,t),cut:(e,t)=>({editor:n,tr:i})=>{let{state:o}=n,s=o.doc.slice(e.from,e.to);i.deleteRange(e.from,e.to);let a=i.mapping.map(t);return i.insert(a,s.content),i.setSelection(new r.Bs(i.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 i=e.selection.$anchor;for(let n=i.depth;n>0;n-=1){let o=i.node(n);if(o.type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}}return!1},deleteNode:e=>({tr:t,state:n,dispatch:r})=>{let i=getNodeType(e,n.schema),o=t.selection.$anchor;for(let e=o.depth;e>0;e-=1){let n=o.node(e);if(n.type===i){if(r){let n=o.before(e),r=o.after(e);t.delete(n,r).scrollIntoView()}return!0}}return!1},deleteRange:e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},deleteSelection:()=>({state:e,dispatch:t})=>(0,l.NE)(e,t),enter:()=>({commands:e})=>e.keyboardShortcut("Enter"),exitCode:()=>({state:e,dispatch:t})=>(0,l.uo)(e,t),extendMarkRange:(e,t={})=>({tr:n,state:i,dispatch:o})=>{let s=getMarkType(e,i.schema),{doc:a,selection:l}=n,{$from:d,from:c,to:u}=l;if(o){let e=getMarkRange(d,s,t);if(e&&e.from<=c&&e.to>=u){let t=r.Bs.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:i,dispatch:o})=>{t={scrollIntoView:!0,...t};let delayedFocus=()=>{isiOS()&&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(o&&null===e&&!isTextSelection(n.state.selection))return delayedFocus(),!0;let s=resolveFocusPosition(i.doc,e)||n.state.selection,a=n.state.selection.eq(s);return o&&(a||i.setSelection(s),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),delayedFocus()),!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:i,dispatch:o,editor:s})=>{if(o){let o;n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l=createNodeFromContent(t,s.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if("<>"===l.toString())return!0;let{from:d,to:c}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},u=!0,p=!0,h=isFragment(l)?l:[l];
1if(h.forEach(e=>{e.check(),u=!!u&&e.isText&&0===e.marks.length,p=!!p&&e.isBlock}),d===c&&p){let{parent:e}=i.doc.resolve(d),t=e.isTextblock&&!e.type.spec.code&&!e.childCount;t&&(d-=1,c+=1)}u?(o=Array.isArray(t)?t.map(e=>e.text||"").join(""):"object"==typeof t&&t&&t.text?t.text:t,i.insertText(o,d,c)):(o=l,i.replaceWith(d,c,o)),n.updateSelection&&function(e,t,n){let i=e.steps.length-1;if(i<t)return;let o=e.steps[i];if(!(o instanceof a.Pu||o instanceof a.FC))return;let s=e.mapping.maps[i],l=0;s.forEach((e,t,n,r)=>{0===l&&(l=r)}),e.setSelection(r.Y1.near(e.doc.resolve(l),-1))}(i,i.steps.length-1,0),n.applyInputRules&&i.setMeta("applyInputRules",{from:d,text:o}),n.applyPasteRules&&i.setMeta("applyPasteRules",{from:d,text:o})}return!0},joinUp:()=>({state:e,dispatch:t})=>(0,l.MI)(e,t),joinDown:()=>({state:e,dispatch:t})=>(0,l.Ig)(e,t),joinBackward:()=>({state:e,dispatch:t})=>(0,l.al)(e,t),joinForward:()=>({state:e,dispatch:t})=>(0,l.Y_)(e,t),joinItemBackward:()=>({tr:e,state:t,dispatch:n})=>{try{let r=(0,a.GJ)(t.doc,t.selection.$from.pos,-1);if(null==r)return!1;return e.join(r,2),n&&n(e),!0}catch{return!1}},joinItemForward:()=>({state:e,dispatch:t,tr:n})=>{try{let r=(0,a.GJ)(e.doc,e.selection.$from.pos,1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch(e){return!1}},joinTextblockBackward:()=>({state:e,dispatch:t})=>(0,l.rr)(e,t),joinTextblockForward:()=>({state:e,dispatch:t})=>(0,l.cR)(e,t),keyboardShortcut:e=>({editor:t,view:n,tr:r,dispatch:i})=>{let o=(function(e){let t,n,r,i;let o=e.split(/-(?!$)/),s=o[o.length-1];"Space"===s&&(s=" ");for(let e=0;e<o.length-1;e+=1){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))isiOS()||isMacOS()?i=!0:n=!0;else throw Error(`Unrecognized modifier name: ${s}`)}return t&&(s=`Alt-${s}`),n&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),r&&(s=`Shift-${s}`),s})(e).split(/-(?!$)/),s=o.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.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&&i&&r.maybeStep(t)}),!0},lift:(e,t={})=>({state:n,dispatch:r})=>{let i=getNodeType(e,n.schema),o=isNodeActive(n,i,t);return!!o&&(0,l.xb)(n,r)},liftEmptyBlock:()=>({state:e,dispatch:t})=>(0,l.X0)(e,t),liftListItem:e=>({state:t,dispatch:n})=>{let r=getNodeType(e,t.schema);return(0,d.IB)(r)(t,n)},newlineInCode:()=>({state:e,dispatch:t})=>(0,l.QK)(e,t),resetAttributes:(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=getSchemaTypeNameByName("string"==typeof e?e:e.name,r.schema);return!!a&&("node"===a&&(o=getNodeType(e,r.schema)),"mark"===a&&(s=getMarkType(e,r.schema)),i&&n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{o&&o===e.type&&n.setNodeMarkup(r,void 0,deleteProps(e.attrs,t)),s&&e.marks.length&&e.marks.forEach(i=>{s===i.type&&n.addMark(r,r+e.nodeSize,s.create(deleteProps(i.attrs,t)))})})}),!0)},scrollIntoView:()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),selectAll:()=>({tr:e,commands:t})=>t.setTextSelection({from:0,to:e.doc.content.size}),selectNodeBackward:()=>({state:e,dispatch:t})=>(0,l._M)(e,t),selectNodeForward:()=>({state:e,dispatch:t})=>(0,l.o)(e,t),selectParentNode:()=>({state:e,dispatch:t})=>(0,l.N0)(e,t),selectTextblockEnd:()=>({state:e,dispatch:t})=>(0,l.nw)(e,t),selectTextblockStart:()=>({state:e,dispatch:t})=>(0,l.U9)(e,t),setContent:(e,t=!1,n={})=>({tr:r,editor:i,dispatch:o})=>{let{doc:s}=r,a=createDocument(e,i.schema,n);return o&&r.replaceWith(0,s.content.size,a).setMeta("preventUpdate",!t),!0},setMark:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:a}=o,l=getMarkType(e,r.schema);if(i){if(s){let e=getMarkAttributes(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{let i=e.$from.pos,o=e.$to.pos;r.doc.nodesBetween(i,o,(e,r)=>
1{let s=Math.max(r,i),a=Math.min(r+e.nodeSize,o),d=e.marks.find(e=>e.type===l);d?e.marks.forEach(e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))}):n.addMark(s,a,l.create(t))})})}return function(e,t,n){var r;let{selection:i}=t,o=null;if(isTextSelection(i)&&(o=i.$cursor),o){let t=null!==(r=e.storedMarks)&&void 0!==r?r:o.marks();return!!n.isInSet(t)||!t.some(e=>e.type.excludes(n))}let{ranges:s}=i;return s.some(({$from:t,$to:r})=>{let i=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),o=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&o}return!i}),i})}(r,n,l)},setMeta:(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),setNode:(e,t={})=>({state:n,dispatch:r,chain:i})=>{let o=getNodeType(e,n.schema);return o.isTextblock?i().command(({commands:e})=>{let r=(0,l.uJ)(o,t)(n);return!!r||e.clearNodes()}).command(({state:e})=>(0,l.uJ)(o,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,i=minMax(e,0,n.content.size),o=r.qv.create(n,i);t.setSelection(o)}return!0},setTextSelection:e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:i,to:o}="number"==typeof e?{from:e,to:e}:e,s=r.Bs.atStart(n).from,a=r.Bs.atEnd(n).to,l=minMax(i,s,a),d=minMax(o,s,a),c=r.Bs.create(n,l,d);t.setSelection(c)}return!0},sinkListItem:e=>({state:t,dispatch:n})=>{let r=getNodeType(e,t.schema);return(0,d.bw)(r)(t,n)},splitBlock:({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:i,editor:o})=>{let{selection:s,doc:l}=t,{$from:d,$to:c}=s,u=o.extensionManager.attributes,p=getSplittedAttributes(u,d.node().type.name,d.node().attrs);if(s instanceof r.qv&&s.node.isBlock)return!!(d.parentOffset&&(0,a.Ax)(l,d.pos))&&(i&&(e&&ensureMarks(n,o.extensionManager.splittableMarks),t.split(d.pos).scrollIntoView()),!0);if(!d.parent.isBlock)return!1;if(i){let i=c.parentOffset===c.parent.content.size;s instanceof r.Bs&&t.deleteSelection();let l=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))),u=i&&l?[{type:l,attrs:p}]:void 0,h=(0,a.Ax)(t.doc,t.mapping.map(d.pos),1,u);if(!u&&!h&&(0,a.Ax)(t.doc,t.mapping.map(d.pos),1,l?[{type:l}]:void 0)&&(h=!0,u=l?[{type:l,attrs:p}]:void 0),h&&(t.split(t.mapping.map(d.pos),1,u),l&&!i&&!d.parentOffset&&d.parent.type!==l)){let e=t.mapping.map(d.before()),n=t.doc.resolve(e);d.node(-1).canReplaceWith(n.index(),n.index()+1,l)&&t.setNodeMarkup(t.mapping.map(d.before()),l)}e&&ensureMarks(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return!0},splitListItem:e=>({tr:t,state:n,dispatch:i,editor:o})=>{var l;let d=getNodeType(e,n.schema),{$from:c,$to:u}=n.selection,p=n.selection.node;if(p&&p.isBlock||c.depth<2||!c.sameParent(u))return!1;let h=c.node(-1);if(h.type!==d)return!1;let m=o.extensionManager.attributes;if(0===c.parent.content.size&&c.node(-1).childCount===c.indexAfter(-1)){if(2===c.depth||c.node(-3).type!==d||c.index(-2)!==c.node(-2).childCount-1)return!1;if(i){let e=s.HY.empty,n=c.index(-1)?1:c.index(-2)?2:3;for(let t=c.depth-n;t>=c.depth-3;t-=1)e=s.HY.from(c.node(t).copy(e));let i=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,o=getSplittedAttributes(m,c.node().type.name,c.node().attrs),a=(null===(l=d.contentMatch.defaultType)||void 0===l?void 0:l.createAndFill(o))||void 0;e=e.append(s.HY.from(d.createAndFill(null,a)||void 0));let u=c.before(c.depth-(n-1));t.replace(u,c.after(-i),new s.p2(e,4-n,0));let p=-1;t.doc.nodesBetween(u,t.doc.content.size,(e,t)=>{if(p>-1)return!1;e.isTextblock&&0===e.content.size&&(p=t+1)}),p>-1&&t.setSelection(r.Bs.near(t.doc.resolve(p))),t.scrollIntoView()}return!0}let f=u.pos===c.end()?h.contentMatchAt(0).defaultType:null,g=getSplittedAttributes(m,h.type.name,h.attrs),y=getSplittedAttributes(m,c.node().type.name,c.node().attrs);if(t.delete(c.pos,u.pos),!(0,a.Ax)(t.doc,c.pos,2))return!1;if(i){let{selection:e,storedMarks:r}=n,{splittableMarks:s}=o.extensionManager,a=r||e.$to.parentOffset&&e.$from.marks();if(t.split(c.pos,2,f?[{type:d,attrs:g},{type:f,attrs:y}]:[{type:d,attrs:g}]).scrollIntoView(),!a||!i)return!0;let l=a.filter(e=>
1s.includes(e.type.name));t.ensureMarks(l)}return!0},toggleList:(e,t,n,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:d,can:c})=>{let{extensions:u,splittableMarks:p}=i.extensionManager,h=getNodeType(e,s.schema),m=getNodeType(t,s.schema),{selection:f,storedMarks:g}=s,{$from:y,$to:x}=f,b=y.blockRange(x),k=g||f.$to.parentOffset&&f.$from.marks();if(!b)return!1;let v=findParentNode(e=>isList(e.type.name,u))(f);if(b.depth>=1&&v&&b.depth-v.depth<=1){if(v.node.type===h)return d.liftListItem(m);if(isList(v.node.type.name,u)&&h.validContent(v.node.content)&&a)return l().command(()=>(o.setNodeMarkup(v.pos,h),!0)).command(()=>joinListBackwards(o,h)).command(()=>joinListForwards(o,h)).run()}return n&&k&&a?l().command(()=>{let e=c().wrapInList(h,r),t=k.filter(e=>p.includes(e.type.name));return o.ensureMarks(t),!!e||d.clearNodes()}).wrapInList(h,r).command(()=>joinListBackwards(o,h)).command(()=>joinListForwards(o,h)).run():l().command(()=>{let e=c().wrapInList(h,r);return!!e||d.clearNodes()}).wrapInList(h,r).command(()=>joinListBackwards(o,h)).command(()=>joinListForwards(o,h)).run()},toggleMark:(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}
1=n,s=getMarkType(e,r.schema),a=isMarkActive(r,s,t);return a?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,t)},toggleNode:(e,t,n={})=>({state:r,commands:i})=>{let o=getNodeType(e,r.schema),s=getNodeType(t,r.schema),a=isNodeActive(r,o,n);return a?i.setNode(s):i.setNode(o,n)},toggleWrap:(e,t={})=>({state:n,commands:r})=>{let i=getNodeType(e,n.schema),o=isNodeActive(n,i,t);return o?r.lift(i):r.wrapIn(i,t)},undoInputRule:()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i;let o=n[r];if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){let n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},unsetAllMarks:()=>({tr:e,dispatch:t})=>{let{selection:n}=e,{empty:r,ranges:i}=n;return!!r||(t&&i.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0)},unsetMark:(e,t={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=getMarkType(e,r.schema),{$from:d,empty:c,ranges:u}=a;if(!i)return!0;if(c&&s){let{from:e,to:t}=a,r=null===(o=d.marks().find(e=>e.type===l))||void 0===o?void 0:o.attrs,i=getMarkRange(d,l,r);i&&(e=i.from,t=i.to),n.removeMark(e,t,l)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},updateAttributes:(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,a=getSchemaTypeNameByName("string"==typeof e?e:e.name,r.schema);return!!a&&("node"===a&&(o=getNodeType(e,r.schema)),"mark"===a&&(s=getMarkType(e,r.schema)),i&&n.selection.ranges.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{o&&o===e.type&&n.setNodeMarkup(r,void 0,{...e.attrs,...t}),s&&e.marks.length&&e.marks.forEach(o=>{if(s===o.type){let l=Math.max(r,i),d=Math.min(r+e.nodeSize,a);n.addMark(l,d,s.create({...o.attrs,...t}))}})})}),!0)},wrapIn:(e,t={})=>({state:n,dispatch:r})=>{let i=getNodeType(e,n.schema);return(0,l.ym)(i,t)(n,r)},wrapInList:(e,t={})=>({state:n,dispatch:r})=>{let i=getNodeType(e,n.schema);return(0,d.KI)(i,t)(n,r)}});let p=Extension.create({name:"commands",addCommands:()=>({...u})}),h=Extension.create({name:"editable",addProseMirrorPlugins(){return[new r.Sy({key:new r.H$("editable"),props:{editable:()=>this.editor.options.editable}})]}}),m=Extension.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new r.Sy({key:new r.H$("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}}}})]}}),f=Extension.create({name:"keymap",addKeyboardShortcuts(){let handleBackspace=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:i}=t,{empty:o,$anchor:s}=n,{pos:a,parent:l}=s,d=s.parent.isTextblock&&a>0?t.doc.resolve(a-1):s,c=d.parent.type.spec.isolating,u=s.pos-s.parentOffset,p=c&&1===d.parent.childCount?u===s.pos:r.Y1.atStart(i).from===a;return!!o&&!!p&&!!l.type.isTextblock&&!l.textContent.length&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),handleDelete=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),e={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:handleBackspace,"Mod-Backspace":handleBackspace,"Shift-Backspace":handleBackspace,Delete:handleDelete,"Mod-Delete":handleDelete,"Mod-a":()=>this.editor.commands.selectAll()},t={...e},n={...e,"Ctrl-h":handleBackspace,"Alt-Backspace":handleBackspace,"Ctrl-d":handleDelete,"Ctrl-Alt-Backspace":handleDelete,"Alt-Delete":handleDelete,"Alt-d":handleDelete,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return isiOS()||isMacOS()?n:t},addProseMirrorPlugins(){return[new r.Sy({key:new r.H$("clearDocument"),appendTransaction:(e,t,n)=>{let i=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc);if(!i)return;let{empty:o,from:s,to:a}=t.selection,l=r.Y1.atStart(t.doc).from,d=r.Y1.atEnd(t.doc).to;
1if(o||!(s===l&&a===d))return;let c=0===n.doc.textBetween(0,n.doc.content.size," "," ").length;if(!c)return;let u=n.tr,p=createChainableState({state:n,transaction:u}),{commands:h}=new CommandManager({editor:this.editor,state:p});if(h.clearNodes(),u.steps.length)return u}})]}}),g=Extension.create({name:"tabindex",addProseMirrorPlugins(){return[new r.Sy({key:new r.H$("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}});let NodePos=class NodePos{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 name(){return this.node.type.name}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)&&void 0!==e?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){console.error(`You canât set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}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?0:1)}get parent(){if(0===this.depth)return null;let e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new NodePos(t,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 NodePos(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 NodePos(e,this.editor)}get children(){let e=[];return this.node.content.forEach((t,n)=>{let r=t.isBlock&&!t.isTextblock,i=this.pos+n+1,o=this.resolvedPos.doc.resolve(i);if(!r&&o.depth<=this.depth)return;let s=new NodePos(o,this.editor,r,r?t:null);r&&(s.actualDepth=this.depth+1),e.push(new NodePos(o,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 i=n[r];if(e[i]!==t[i])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=[];return this.children&&0!==this.children.length&&this.children.forEach(i=>{if(i.node.type.name===e){if(Object.keys(t).length>0){let e=i.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])return}}if(r.push(i),n)return}r=r.concat(i.querySelectorAll(e))}),r}setAttribute(e){let t=this.editor.state.selection;this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name,e).setTextSelection(t.from).run()}};let y=`.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: 1px !important; 31 height: 1px !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}`;let Editor=class Editor extends EventEmitter{constructor(e={}){super(),this.isFocused=!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,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>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.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),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},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,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(null!==r)return r;let i=document.createElement("style");return t&&i.setAttribute("nonce",t),i.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),i.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(i),i}(y,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=isFunction(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});this.view.updateState(r)}unregisterPlugin(e){if(this.isDestroyed)return;let t="string"==typeof e?`${e}$`:e.key,n=this.state.reconfigure({plugins:this.state.plugins.filter(e=>!e.key.startsWith(t))});this.view.updateState(n)}createExtensionManager(){var e,t;let n=this.options.enableCoreExtensions?[h,c.configure({blockSeparator:null===(t=null===(e=this.options.coreExtensionOptions)||void 0===e?void 0:e.clipboardTextSerializer)||void 0===t?void 0:t.blockSeparator}),p,m,f,g]:[],r=[...n,...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new ExtensionManager(r,this)}createCommandManager(){this.commandManager=new CommandManager({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let e=createDocument(this.options.content,this.schema,this.options.parseOptions),t=resolveFocusPosition(e,this.options.autofocus);this.view=new i.tk(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:r.yy.create({doc:e,selection:t||void 0})});let n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass();let o=this.view.dom;o.editor=this}createNodeViews(){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}
75e.steps.forEach(e=>{var t;return null===(t=this.capturedTransaction)||void 0===t?void 0:t.step(e)});return}let t=this.state.apply(e),n=!this.state.selection.eq(t.selection);this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),n&&this.emit("selectionUpdate",{editor:this,transaction:e});let r=e.getMeta("focus"),i=e.getMeta("blur");r&&this.emit("focus",{editor:this,event:r.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),!e.docChanged||e.getMeta("preventUpdate")||this.emit("update",{editor:this,transaction:e})}getAttributes(e){return function(e,t){let n=getSchemaTypeNameByName("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){let n=getNodeType(t,e.schema),{from:r,to:i}=e.selection,o=[];e.doc.nodesBetween(r,i,e=>{o.push(e)});let s=o.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?getMarkAttributes(e,t):{}}(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 isNodeActive(e,null,n)||isMarkActive(e,null,n);let r=getSchemaTypeNameByName(t,e.schema);return"node"===r?isNodeActive(e,t,n):"mark"===r&&isMarkActive(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return function(e,t){let n=s.PW.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument(),i=r.createElement("div");return i.appendChild(n),i.innerHTML}(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return function(e,t){let n={from:0,to:e.content.size};return getTextBetween(e,n,t)}(this.state.doc,{blockSeparator:t,textSerializers:{...getTextSerializersFromSchema(this.schema),...n}})}get isEmpty(){return function(e){var t;let n=null===(t=e.type.createAndFill())||void 0===t?void 0:t.toJSON(),r=e.toJSON();return JSON.stringify(n)===JSON.stringify(r)}(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(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(null===(e=this.view)||void 0===e?void 0:e.docView)}$node(e,t){var n;return(null===(n=this.$doc)||void 0===n?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null===(n=this.$doc)||void 0===n?void 0:n.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e);return new NodePos(t,this)}get $doc(){return this.$pos(0)}};function markInputRule(e){return new InputRule({find:e.find,handler:({state:t,range:n,match:r})=>{let i=callOrReturn(e.getAttributes,void 0,r);if(!1===i||null===i)return null;let{tr:o}=t,s=r[r.length-1],a=r[0];if(s){let r=a.search(/\S/),l=n.from+a.indexOf(s),d=l+s.length,c=getMarksBetween(n.from,n.to,t.doc).filter(t=>{let n=t.mark.type.excluded;return n.find(n=>n===e.type&&n!==t.mark.type)}).filter(e=>e.to>l);if(c.length)return null;
75d<n.to&&o.delete(d,n.to),l>n.from&&o.delete(n.from+r,l);let u=n.from+r+s.length;o.addMark(n.from+r,u,e.type.create(i||{})),o.removeStoredMark(e.type)}}})}function nodeInputRule(e){return new InputRule({find:e.find,handler:({state:t,range:n,match:r})=>{let i=callOrReturn(e.getAttributes,void 0,r)||{},{tr:o}=t,s=n.from,a=n.to,l=e.type.create(i);if(r[1]){let e=r[0].lastIndexOf(r[1]),t=s+e;t>a?t=a:a=t+r[1].length;let n=r[0][r[0].length-1];o.insertText(n,s+r[0].length-1),o.replaceWith(t,a,l)}else r[0]&&o.insert(s-1,e.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a));o.scrollIntoView()}})}function textblockTypeInputRule(e){return new InputRule({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),o=callOrReturn(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)}})}function wrappingInputRule(e){return new InputRule({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let o=callOrReturn(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),l=s.doc.resolve(n.from),d=l.blockRange(),c=d&&(0,a.nd)(d,e.type,o);if(!c)return null;if(s.wrap(d,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,o=r||n.$to.parentOffset&&n.$from.marks();if(o){let e=o.filter(e=>i.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,o).run()}let u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===e.type&&(0,a.Mn)(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,u))&&s.join(n.from-1)}})}let Mark=class Mark{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=callOrReturn(getExtensionField(this,"addOptions",{name:this.name}))),this.storage=callOrReturn(getExtensionField(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Mark(e)}configure(e={}){let t=this.extend();return t.options=mergeDeep(this.options,e),t.storage=callOrReturn(getExtensionField(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}){let t=new Mark({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=callOrReturn(getExtensionField(t,"addOptions",{name:t.name})),t.storage=callOrReturn(getExtensionField(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,i=r.pos===r.end();if(i){let i=r.marks(),o=!!i.find(e=>(null==e?void 0:e.type.name)===t.name);if(!o)return!1;let s=i.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}};let Node=class Node{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=callOrReturn(getExtensionField(this,"addOptions",{name:this.name}))),this.storage=callOrReturn(getExtensionField(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Node(e)}configure(e={}){let t=this.extend();return t.options=mergeDeep(this.options,e),t.storage=callOrReturn(getExtensionField(t,"addStorage",{name:t.name,options:t.options})),t}extend(e={}
75){let t=new Node({...this.config,...e});return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=callOrReturn(getExtensionField(t,"addOptions",{name:t.name})),t.storage=callOrReturn(getExtensionField(t,"addStorage",{name:t.name,options:t.options})),t}};function markPasteRule(e){return new PasteRule({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let o=callOrReturn(e.getAttributes,void 0,r,i);if(!1===o||null===o)return null;let{tr:s}=t,a=r[r.length-1],l=r[0],d=n.to;if(a){let r=l.search(/\S/),i=n.from+l.indexOf(a),c=i+a.length,u=getMarksBetween(n.from,n.to,t.doc).filter(t=>{let n=t.mark.type.excluded;return n.find(n=>n===e.type&&n!==t.mark.type)}).filter(e=>e.to>i);if(u.length)return null;c<n.to&&s.delete(c,n.to),i>n.from&&s.delete(n.from+r,i),d=n.from+r+a.length,s.addMark(n.from+r,d,e.type.create(o||{})),s.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.