1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7764],{74460:(e,t,n)=>{n.d(t,{CU:()=>tM,KV:()=>e$,OX:()=>tI,Zc:()=>tD});var r=n(63959),o=n(52870),i=n(38676),a=n(15701),s=n(80869),l=n(86020),d=n(47833),c=n(58152),u=n(77011);function p(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var f=class e{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:o}=this,{view:i}=r,a=[],s=!!e,l=e||o.tr,d=()=>(s||!t||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),a.every(e=>!0===e)),c={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(l,t),o=n(...e)(r);return a.push(o),c}])),run:d};return c}static createFakeChain(){let e=new Proxy({},{get:(t,n)=>{if("then"!==n)return"run"===n?()=>!1:()=>e}});return e}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)}}static createFallbackCan(){let t=e.createFakeChain();return new Proxy({chain:()=>t},{get:(e,t)=>{if("then"!==t)return"chain"===t?e.chain:()=>!1}})}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:o}=this,{view:i}=r,a={tr:e,editor:r,view:i,state:p({state:o,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(a)]))}};return a}};let m=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),null==(n=window)||null==(n=n.getSelection())||n.removeAllRanges()}}),!0),h=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),g=()=>({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,a=r.resolve(i.map(n)),s=r.resolve(i.map(n+e.nodeSize)),l=a.blockRange(s);if(!l)return;let d=(0,o.jP)(l);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(l.start,e)}(d||0===d)&&t.lift(l,d)})}),!0)},y=e=>t=>e(t),v=()=>({state:e,dispatch:t})=>(0,i.Z1)(e,t),b=(e,t)=>({editor:n,tr:r})=>{let{state:o}=n,i=o.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let s=r.mapping.map(t);return r.insert(s,i.content),r.setSelection(new a.U3(r.doc.resolve(Math.max(s-1,0)))),!0},k=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let o=e.selection.$anchor;for(let n=o.depth;n>0;n-=1)if(o.node(n).type===r.type){if(t){let t=o.before(n),r=o.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function w(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}let x=e=>({tr:t,state:n,dispatch:r})=>{let o=w(e,n.schema),i=t.selection.$anchor;for(let e=i.depth;e>0;e-=1)if(i.node(e).type===o){if(r){let n=i.before(e),r=i.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},M=e=>({tr:t,dispatch:n})=>{let{from:r,to:o}=e;return n&&t.delete(r,o),!0},E=(e,t,n)=>!e.parent.isInline||"left"===n&&e.pos>e.start()||"right"===n&&e.pos<e.end()||!(e=>!!e.content&&/^text(\*|\+)/.test(e.content))(t.nodes[e.parent.type.name].spec)?e.pos:"left"===n?e.start()-1:e.end()+1,S=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,o=n.steps.length;r.forEach(t=>{let r=n.mapping.slice(o),{from:i,to:a}=((e,t,n)=>({from:E(e,n,"left"),to:E(t,n,"right")}))(n.doc.resolve(r.map(t.$from.pos)),n.doc.resolve(r.map(t.$to.pos)),e.schema);n.deleteRange(i,a)}),n.selection.empty||n.setSelection(a.U3.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},O=()=>({commands:e})=>e.keyboardShortcut("Enter"),C=()=>({state:e,dispatch:t})=>(0,i.I$)(e,t);function T(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function R(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:T(t[r])?t[r].test(e[r]):t[r]===e[r])}function j(e,t,n={}){return e.find(e=>e.type===t&&R(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function A(e,t,n={}){return!!j(e,t,n)}function $(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!j([...r.node.marks],t,n))return;let o=r.index,i=e.start()+r.offset,a=o+1,s=i+r.node.nodeSize;
1for(;o>0&&A([...e.parent.child(o-1).marks],t,n);)o-=1,i-=e.parent.child(o).nodeSize;for(;a<e.parent.childCount&&A([...e.parent.child(a).marks],t,n);)s+=e.parent.child(a).nodeSize,a+=1;return{from:i,to:s}}function I(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}let D=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=I(e,r.schema),{doc:s,selection:l}=n,{$from:d,from:c,to:u}=l;if(o){let e=$(d,i,t);if(e&&e.from<=c&&e.to>=u){let t=a.U3.create(s,e.from,e.to);n.setSelection(t)}}return!0},P=e=>t=>{let n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function N(e){return e instanceof a.U3}function B(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function z(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function L(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}let F=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};let s=()=>{(L()||z())&&r.dom.focus(),"undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!L()&&!z()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(i&&null===e&&!N(n.state.selection))return s(),!0;let l=function(e,t=null){if(!t)return null;let n=a.LN.atStart(e),r=a.LN.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;let o=n.from,i=r.to;return"all"===t?a.U3.create(e,B(0,o,i),B(e.content.size,o,i)):a.U3.create(e,B(t,o,i),B(t,o,i))}(o.doc,e)||n.state.selection,d=n.state.selection.eq(l);return i&&(d||o.setSelection(l),d&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},_=(e,t)=>
1n=>e.every((e,r)=>t(e,{...n,index:r})),K=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),W=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&&W(r)}return e};function U(e){if("undefined"==typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`;return W(new window.DOMParser().parseFromString(t,"text/html").body)}function V(e){return"function"==typeof(null==e?void 0:e.nodesBetween)}function H(e,t,n){if(V(e))return e;let r="object"==typeof e&&null!==e;n={slice:!0,parseOptions:{},...n};let o="string"==typeof e;if(r)try{if(Array.isArray(e)&&e.length>0)return s.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),H("",t,n)}if(o){if(n.errorOnInvalidContent){let r=!1,o="",i=new s.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?s.S4.fromSchema(i).parseSlice(U(e),n.parseOptions):s.S4.fromSchema(i).parse(U(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${o}`)})}let r=s.S4.fromSchema(t);return n.slice?r.parseSlice(U(e),n.parseOptions).content:r.parse(U(e),n.parseOptions)}return H("",t,n)}function q(e){return!("type"in e)}function J(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof o.Ln||i instanceof o.Wg))return;let s=e.mapping.maps[r],l=0;s.forEach((e,t,n,r)=>{0===l&&(l=r)}),e.setSelection(a.LN.near(e.doc.resolve(l),n))}let Z=(e,t,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){let o,l;n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let d=e=>{i.emit("contentError",{editor:i,error:e,disableCollaboration:()=>{"collaboration"in i.storage&&"object"==typeof i.storage.collaboration&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{H(t,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(e){d(e)}try{var a;o=H(t,i.schema,{parseOptions:c,errorOnInvalidContent:null!=(a=n.errorOnInvalidContent)?a:i.options.enableContentCheck})}catch(e){return d(e),!1}let{from:u,to:p}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},f=!0,m=!0,h=q(o)?o.content:[o];if(h.forEach(e=>{e.check(),f=!!f&&e.isText&&0===e.marks.length,m=!!m&&e.isBlock}),u===p&&m){let{parent:e}=r.doc.resolve(u);!e.isTextblock||e.type.spec.code||e.childCount||(u-=1,p+=1)}if(f)l=Array.isArray(t)?t.map(e=>e.text||"").join(""):V(t)?h.map(e=>{var t;return null!=(t=e.text)?t:""}).join(""):"object"==typeof t&&t&&t.text?t.text:t,r.insertText(l,u,p);else{l=s.FK.from(h);let e=r.doc.resolve(u),t=e.node(),n=0===e.parentOffset,o=t.isText||t.isTextblock,i=t.content.size>0;n&&o&&i&&m&&(u=Math.max(0,u-1)),r.replaceWith(u,p,h)}n.updateSelection&&J(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:l}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:l})}return!0};function G(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}let Y=(e={})=>({tr:t,dispatch:n,editor:r})=>{let o,i,{pos:a,attrs:s,content:l,updateSelection:d=!0}=e,c=G((o="number"==typeof a?t.doc.resolve(a):a||t.selection.$from).parent.contentMatchAt(o.index()));if(!c)return!1;let u=Object.keys(c.spec.attrs||{}),p=s?Object.fromEntries(Object.entries(s).filter(([e])=>u.includes(e))):{};if(l){let e=H(l,r.schema);i=c.createAndFill(p,e)}else i=c.createAndFill(p);return!!i&&(n&&(t.insert(o.pos,i),d&&J(t,t.steps.length-1,-1)),!0)},Q=()=>({state:e,dispatch:t})=>(0,i.G2)(e,t),X=()=>({state:e,dispatch:t})=>(0,i.bh)(e,t),ee=()=>({state:e,dispatch:t})=>(0,i.Qv)(e,t),et=()=>({state:e,dispatch:t})=>(0,i.eT)(e,t),en=()=>({state:e,dispatch:t,tr:n})=>{try{let r=(0,o.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}},er=()=>({state:e,dispatch:t,tr:n})=>{try{let r=(0,o.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}},eo=()=>({state:e,dispatch:t})=>(0,i.eB)(e,t),ei=()=>({state:e,dispatch:t})=>(0,i._G)(e,t);function ea(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}let es=e=>({editor:t,view:n,tr:r,dispatch:o})=>{let i=(function(e){let t,n,r,o,i=e.split(/-(?!$)/),a=i[i.length-1];"Space"===a&&(a=" ");for(let e=0;e<i.length-1;e+=1){let a=i[e];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))t=!0;else if(/^(c|ctrl|control)$/i.test(a))n=!0;else if(/^s(hift)?$/i.test(a))r=!0;else if(/^mod$/i.test(a))L()||ea()?o=!0:n=!0;else throw Error(`Unrecognized modifier name: ${a}`)}return t&&(a=`Alt-${a}`),n&&(a=`Ctrl-${a}`),o&&(a=`Meta-${a}`),r&&(a=`Shift-${a}`),a})(e).split(/-(?!$)/),a=i.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),s=new KeyboardEvent("keydown",{key:"Space"
1===a?" ":a,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,s))});return null==l||l.steps.forEach(e=>{let t=e.map(r.mapping);t&&o&&r.maybeStep(t)}),!0};function el(e,t,n={}){let{from:r,to:o,empty:i}=e.selection,a=t?w(t,e.schema):null,s=[];e.doc.nodesBetween(r,o,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);s.push({node:e,from:n,to:i})});let l=o-r,d=s.filter(e=>!a||a.name===e.node.type.name).filter(e=>R(e.node.attrs,n,{strict:!1}));return i?!!d.length:d.reduce((e,t)=>e+t.to-t.from,0)>=l}let ed=(e,t={})=>({state:n,dispatch:r})=>!!el(n,w(e,n.schema),t)&&(0,i.yY)(n,r),ec=()=>({state:e,dispatch:t})=>(0,i.iz)(e,t),eu=e=>({state:t,dispatch:n})=>{let r=w(e,t.schema);return(0,l.T2)(r)(t,n)},ep=()=>({state:e,dispatch:t})=>(0,i.pC)(e,t);function ef(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function em(e,t){let n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}let eh=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,a=null,s=ef("string"==typeof e?e:e.name,r.schema);if(!s)return!1;"node"===s&&(i=w(e,r.schema)),"mark"===s&&(a=I(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,em(e.attrs,t))),a&&e.marks.length&&e.marks.forEach(i=>{a===i.type&&(l=!0,o&&n.addMark(r,r+e.nodeSize,a.create(em(i.attrs,t))))})})}),l},eg=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),ey=()=>({tr:e,dispatch:t})=>{if(t){let t=new a.i5(e.doc);e.setSelection(t)}return!0},ev=()=>({state:e,dispatch:t})=>(0,i._e)(e,t),eb=()=>({state:e,dispatch:t})=>(0,i.Sd)(e,t),ek=()=>({state:e,dispatch:t})=>(0,i.hy)(e,t),ew=()=>({state:e,dispatch:t})=>(0,i.ec)(e,t),ex=()=>({state:e,dispatch:t})=>(0,i.$f)(e,t),eM=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:a,commands:s})=>{let{doc:l}=i;if("full"!==r.preserveWhitespace){let s=function(e,t,n={},r={}){return H(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}(e,o.schema,r,{errorOnInvalidContent:null!=t?t:o.options.enableContentCheck});if(a){let e=q(s)?s.content:[s];i.replaceWith(0,l.content.size,e).setMeta("preventUpdate",!n)}return!0}return a&&i.setMeta("preventUpdate",!n),s.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:o.options.enableContentCheck})};function eE(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 eS(e,t,n){return void 0===e.config[t]&&e.parent?eS(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?eS(e.parent,t,n):null}):e.config[t]}function eO(e){return e.map(e=>{let t=eS(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...eO(t())]:e}).flat(10)}function eC(e,t){let n=s.ZF.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function eT(e,t,...n){return"function"==typeof e?t?e.bind(t)(...n):e(...n):e}function eR(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function ej(e){let t=[],{nodeExtensions:n,markExtensions:r}=eR(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},a=n.filter(e=>"text"!==e.name).map(e=>e.name),s=r.map(e=>e.name),l=[...a,...s];return e.forEach(e=>{let n=eS(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:o});n&&n().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?a:"marks"===e.types?s:[]).forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...i,...r}})})})})}),o.forEach(e=>{let n=eS(e,"addAttributes",{name:e.name,options:e.options,storage:e.storage});
1n&&Object.entries(n()).forEach(([n,r])=>{let o={...i,...r};"function"==typeof(null==o?void 0:o.default)&&(o.default=o.default()),(null==o?void 0:o.isRequired)&&(null==o?void 0:o.default)===void 0&&delete o.default,t.push({type:e.name,name:n,attribute:o})})}),t}function eA(e){let t=[],n=function(e){let t=[],n="",r=!1,o=!1,i=0,a=e.length;for(let s=0;s<a;s+=1){let a=e[s];if("'"===a&&!o){r=!r,n+=a;continue}if('"'===a&&!r){o=!o,n+=a;continue}if(!r&&!o){if("("===a){i+=1,n+=a;continue}if(")"===a&&i>0){i-=1,n+=a;continue}if(";"===a&&0===i){t.push(n),n="";continue}}n+=a}return n&&t.push(n),t}(e||""),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],o=r.indexOf(":");if(-1===o)continue;let i=r.slice(0,o).trim(),a=r.slice(o+1).trim();i&&a&&t.push([i,a])}return t}function e$(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if("__proto__"===e)return void Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0});if(!n[e]){n[e]=t;return}if("class"===e){let r=t?String(t).split(" "):[],o=n[e]?n[e].split(" "):[],i=r.filter(e=>!o.includes(e));n[e]=[...o,...i].join(" ")}else if("style"===e){let r=new Map([...eA(n[e]),...eA(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function eI(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)=>e$(e,t),{})}function eD(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 eP(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 eN(e){var t,n;let r={};return!(null==e||null==(t=e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(null==e||null==(n=e.attribute)?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function eB(e){return e.sort((e,t)=>{let n=eS(e,"priority")||100,r=eS(t,"priority")||100;return n>r?-1:+(n<r)})}function ez(e){var t;let n=eB(eO(e)),r=Array.from(new Set((t=n.map(e=>e.name)).filter((e,n)=>t.indexOf(e)!==n)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),n}function eL(e){let{mapping:t,steps:n}=e,r=[];t.maps.forEach((e,o)=>{let i=[];if(e.ranges.length)e.forEach((e,t)=>{i.push({from:e,to:t})});else{let{from:e,to:t}=n[o];if(void 0===e||void 0===t)return;i.push({from:e,to:t})}i.forEach(({from:e,to:n})=>{let i=t.slice(o).map(e,-1),a=t.slice(o).map(n),s=t.invert().map(i,-1),l=t.invert().map(a);r.push({oldRange:{from:s,to:l},newRange:{from:i,to:a}})})});let o=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)})}(r);return 1===o.length?o:o.filter((e,t)=>!o.filter((e,n)=>n!==t).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 eF(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let o=$(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 e_(e,t){return t.nodes[e]||t.marks[e]||null}function eK(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 eW(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function eU(e,t){let{nodeExtensions:n}=eR(t),r=n.find(t=>t.name===e);if(!r)return!1;let o=eT(eS(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}let eV=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let{selection:i}=n,{empty:a,ranges:s}=i,l=I(e,r.schema);if(o)if(a){let e=function(e,t){let n=I(t,e.schema),{from:r,to:o,empty:i}=e.selection,a=[];i?(e.storedMarks&&a.push(...e.storedMarks),a.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,e=>{a.push(...e.marks)});let s=a.find(e=>
1e.type.name===n.name);return s?{...s.attrs}:{}}(r,l);n.addStoredMark(l.create({...e,...t}))}else s.forEach(e=>{let o=e.$from.pos,i=e.$to.pos;r.doc.nodesBetween(o,i,(e,r)=>{let a=Math.max(r,o),s=Math.min(r+e.nodeSize,i);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(a,s,l.create({...e.attrs,...t}))}):n.addMark(a,s,l.create(t))})});return function(e,t,n){let{selection:r}=t,o=null;if(N(r)&&(o=r.$cursor),o){var i;let t=null!=(i=e.storedMarks)?i:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let o=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(o)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),i=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));o=t&&i}return!o}),o})}(r,n,l)},eH=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),eq=(e,t={})=>({state:n,dispatch:r,chain:o})=>{let a,s=w(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(a=n.selection.$anchor.parent.attrs),s.isTextblock)?o().command(({commands:e})=>!!(0,i.y_)(s,{...a,...t})(n)||e.clearNodes()).command(({state:e})=>(0,i.y_)(s,{...a,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},eJ=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=B(e,0,n.content.size),o=a.nh.create(n,r);t.setSelection(o)}return!0},eZ=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i,a,{selection:s}=r;return"number"==typeof t?(i=t,a=t):t&&"from"in t&&"to"in t?(i=t.from,a=t.to):(i=s.from,a=s.to),o&&n.doc.nodesBetween(i,a,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},eG=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:o}="number"==typeof e?{from:e,to:e}:e,i=a.U3.atStart(n).from,s=a.U3.atEnd(n).to,l=B(r,i,s),d=B(o,i,s),c=a.U3.create(n,l,d);t.setSelection(c)}return!0},eY=e=>({state:t,dispatch:n})=>{let r=w(e,t.schema);return(0,l.$B)(r)(t,n)};function eQ(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 eX=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:s,doc:l}=t,{$from:d,$to:c}=s,u=eK(i.extensionManager.attributes,d.node().type.name,d.node().attrs);if(s instanceof a.nh&&s.node.isBlock)return!!d.parentOffset&&!!(0,o.zy)(l,d.pos)&&(r&&(e&&eQ(n,i.extensionManager.splittableMarks),t.split(d.pos).scrollIntoView()),!0);if(!d.parent.isBlock)return!1;let p=c.parentOffset===c.parent.content.size,f=0===d.depth?void 0:G(d.node(-1).contentMatchAt(d.indexAfter(-1))),m=p&&f?[{type:f,attrs:u}]:void 0,h=(0,o.zy)(t.doc,t.mapping.map(d.pos),1,m);if(!m&&!h&&(0,o.zy)(t.doc,t.mapping.map(d.pos),1,f?[{type:f}]:void 0)&&(h=!0,m=f?[{type:f,attrs:u}]:void 0),r){if(h&&(s instanceof a.U3&&t.deleteSelection(),t.split(t.mapping.map(d.pos),1,m),f&&!p&&!d.parentOffset&&d.parent.type!==f)){let e=t.mapping.map(d.before()),n=t.doc.resolve(e);d.node(-1).canReplaceWith(n.index(),n.index()+1,f)&&t.setNodeMarkup(t.mapping.map(d.before()),f)}e&&eQ(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return h},e0=(e,t={})=>({tr:n,state:r,dispatch:i,editor:l})=>{let d=w(e,r.schema),{$from:c,$to:u}=r.selection,p=r.selection.node;if(p&&p.isBlock||c.depth<2||!c.sameParent(u))return!1;let f=c.node(-1);if(f.type!==d)return!1;let m=l.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){var h;let e=s.FK.empty,r=c.index(-1)?1:c.index(-2)?2:3;for(let t=c.depth-r;t>=c.depth-3;t-=1)e=s.FK.from(c.node(t).copy(e));let o=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,i={...eK(m,c.node().type.name,c.node().attrs),...t},l=(null==(h=d.contentMatch.defaultType)?void 0:h.createAndFill(i))||void 0;e=e.append(s.FK.from(d.createAndFill(null,l)||void 0));let u=c.before(c.depth-(r-1));n.replace(u,c.after(-o),new s.Ji(e,4-r,0));let p=-1;n.doc.nodesBetween(u,n.doc.content.size,(e,t)=>{if(p>-1)return!1;e.isTextblock&&0===e.content.size&&(p=t+1)}),p>-1&&n.setSelection(a.U3.near(n.doc.resolve(p))),n.scrollIntoView()}return!0}let g=u.pos===c.end()?f.contentMatchAt(0).defaultType:null,y={...eK(m,f.type.n
1ame,f.attrs),...t},v={...eK(m,c.node().type.name,c.node().attrs),...t};n.delete(c.pos,u.pos);let b=g?[{type:d,attrs:y},{type:g,attrs:v}]:[{type:d,attrs:y}];if(!(0,o.zy)(n.doc,c.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=l.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(c.pos,2,b).scrollIntoView(),!a||!i)return!0;let s=a.filter(e=>o.includes(e.type.name));n.ensureMarks(s)}return!0};function e1(e){return e&&"1"!==e?e:null}let e3=(e,t)=>{var n,r;let i=eE(e=>e.type===t)(e.selection);if(!i)return!0;let a=e.doc.resolve(Math.max(0,i.pos-1)).before(i.depth);if(void 0===a)return!0;let s=e.doc.nodeAt(a);return!(i.node.type===(null==s?void 0:s.type)&&(0,o.n9)(e.doc,i.pos))||(n=i.node.attrs.type,r=null==s?void 0:s.attrs.type,e1(n)!==e1(r)||(e.join(i.pos),!0))},e2=(e,t)=>{var n,r;let i=eE(e=>e.type===t)(e.selection);if(!i)return!0;let a=e.doc.resolve(i.start).after(i.depth);if(void 0===a)return!0;let s=e.doc.nodeAt(a);return!(i.node.type===(null==s?void 0:s.type)&&(0,o.n9)(e.doc,a))||(n=i.node.attrs.type,r=null==s?void 0:s.attrs.type,e1(n)!==e1(r)||(e.join(a),!0))},e7=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:d,commands:c,can:u})=>{let{extensions:p,splittableMarks:f}=o.extensionManager,m=w(e,s.schema),h=w(t,s.schema),{selection:g,storedMarks:y}=s,{$from:v,$to:b}=g,k=v.blockRange(b),x=y||g.$to.parentOffset&&g.$from.marks();if(!k)return!1;let M=eE(e=>eU(e.type.name,p))(g),E=0===g.from&&g.to===s.doc.content.size,S=s.doc.content.content,O=1===S.length?S[0]:null,C=E&&O&&eU(O.type.name,p)?{node:O,pos:0,depth:0}:null,T=null!=M?M:C,R=!!M&&k.depth>=1&&k.depth-M.depth<=1,j=!!C;if((R||j)&&T){if(T.node.type===m)return E&&j?d().command(({tr:e,dispatch:t})=>{let n=function(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),o=t.resolve(n.nodeSize-1);return a.U3.between(r,o)}(e);return!!n&&(e.setSelection(n),t&&t(e),!0)}).liftListItem(h).run():c.liftListItem(h);if(eU(T.node.type.name,p)&&m.validContent(T.node.content))return d().command(()=>(i.setNodeMarkup(T.pos,m),!0)).command(()=>e3(i,m)).command(()=>e2(i,m)).run()}return n&&x&&l?d().command(()=>{let e=u().wrapInList(m,r),t=x.filter(e=>f.includes(e.type.name));return i.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(m,r).command(()=>e3(i,m)).command(()=>e2(i,m)).run():d().command(()=>!!u().wrapInList(m,r)||c.clearNodes()).wrapInList(m,r).command(()=>e3(i,m)).command(()=>e2(i,m)).run()},e4=(e,t={},n={})=>({state:r,commands:o})=>{let{extendEmptyMarkRange:i=!1}=n,a=I(e,r.schema);return!function(e,t,n={}){let{empty:r,ranges:o}=e.selection,i=t?I(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>R(e.attrs,n,{strict:!1}));let a=0,s=[];if(o.forEach(({$from:t,$to:n})=>{let r=t.pos,o=n.pos;e.doc.nodesBetween(r,o,(e,t)=>{if(i&&e.inlineContent&&!e.type.allowsMarkType(i))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),l=Math.min(o,t+e.nodeSize);a+=l-n,s.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===a)return!1;let l=s.filter(e=>!i||i.name===e.mark.type.name).filter(e=>R(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),d=s.filter(e=>!i||e.mark.type!==i&&e.mark.type.excludes(i)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+d:l)>=a}(r,a,t)?o.setMark(a,t):o.unsetMark(a,{extendEmptyMarkRange:i})},e8=(e,t,n={})=>({state:r,commands:o})=>{let i,a=w(e,r.schema),s=w(t,r.schema),l=el(r,a,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(i=r.selection.$anchor.parent.attrs),l)?o.setNode(s,i):o.setNode(a,{...i,...n})},e5=(e,t={})=>({state:n,commands:r})=>{let o=w(e,n.schema);return el(n,o,t)?r.lift(o):r.wrapIn(o,t)},e6=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let o,i=n[r];if(i.spec.isInputRules&&(o=i.getState(e))){if(t){let t=e.tr,n=o.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(o.text){let n=t.doc.resolve(o.from).marks();t.replaceWith(o.from,o.to,e.schema.text(o.text,n))}else t.delete(o.from,o.to)}return!0}}return!1},e9=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:o=!1}=e,{selection:i}=t,{empty:a,ranges:s}=i;
1if(a)return!0;let{nonClearableMarks:l}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>o||!l.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},te=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let{extendEmptyMarkRange:i=!1}=t,{selection:a}=n,s=I(e,r.schema),{$from:l,empty:d,ranges:c}=a;if(!o)return!0;if(d&&i){var u;let{from:e,to:t}=a,r=$(l,s,null==(u=l.marks().find(e=>e.type===s))?void 0:u.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else c.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},tt=e=>({tr:t,state:n,dispatch:r})=>{let o,i,{selection:a}=n;return"number"==typeof e?(o=e,i=e):e&&"from"in e&&"to"in e?(o=e.from,i=e.to):(o=a.from,i=a.to),r&&t.doc.nodesBetween(o,i,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},tn=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,a=null,s=ef("string"==typeof e?e:e.name,r.schema);if(!s)return!1;"node"===s&&(i=w(e,r.schema)),"mark"===s&&(a=I(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{let s,d,c,u,p=e.$from.pos,f=e.$to.pos;n.selection.empty?r.doc.nodesBetween(p,f,(e,t)=>{i&&i===e.type&&(l=!0,c=Math.max(t,p),u=Math.min(t+e.nodeSize,f),s=t,d=e)}):r.doc.nodesBetween(p,f,(e,r)=>{r<p&&i&&i===e.type&&(l=!0,c=Math.max(r,p),u=Math.min(r+e.nodeSize,f),s=r,d=e),r>=p&&r<=f&&(i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),a&&e.marks.length&&e.marks.forEach(i=>{if(a===i.type&&(l=!0,o)){let o=Math.max(r,p),s=Math.min(r+e.nodeSize,f);n.addMark(o,s,a.create({...i.attrs,...t}))}}))}),d&&(void 0!==s&&o&&n.setNodeMarkup(s,void 0,{...d.attrs,...t}),a&&d.marks.length&&d.marks.forEach(e=>{a===e.type&&o&&n.addMark(c,u,a.create({...e.attrs,...t}))}))}),l},tr=new a.hs("__tiptap_decorations__"),to=e=>({tr:t,dispatch:n})=>(n&&t.setMeta(tr,{type:"force",name:e}),!0),ti=(e,t={})=>({state:n,dispatch:r})=>{let o=w(e,n.schema);return(0,i.Im)(o,t)(n,r)},ta=(e,t={})=>({state:n,dispatch:r})=>{let o=w(e,n.schema);return(0,l.Sd)(o,t)(n,r)};var ts=(0,r.t)({blur:()=>m,clearContent:()=>h,clearNodes:()=>g,command:()=>y,createParagraphNear:()=>v,cut:()=>b,deleteCurrentNode:()=>k,deleteNode:()=>x,deleteRange:()=>M,deleteSelection:()=>S,enter:()=>O,exitCode:()=>C,extendMarkRange:()=>D,first:()=>P,focus:()=>F,forEach:()=>_,insertContent:()=>K,insertContentAt:()=>Z,insertDefaultBlock:()=>Y,joinBackward:()=>ee,joinDown:()=>X,joinForward:()=>et,joinItemBackward:()=>en,joinItemForward:()=>er,joinTextblockBackward:()=>eo,joinTextblockForward:()=>ei,joinUp:()=>Q,keyboardShortcut:()=>es,lift:()=>ed,liftEmptyBlock:()=>ec,liftListItem:()=>eu,newlineInCode:()=>ep,resetAttributes:()=>eh,scrollIntoView:()=>eg,selectAll:()=>ey,selectNodeBackward:()=>ev,selectNodeForward:()=>eb,selectParentNode:()=>ek,selectTextblockEnd:()=>ew,selectTextblockStart:()=>ex,setContent:()=>eM,setMark:()=>eV,setMeta:()=>eH,setNode:()=>eq,setNodeSelection:()=>eJ,setTextDirection:()=>eZ,setTextSelection:()=>eG,sinkListItem:()=>eY,splitBlock:()=>eX,splitListItem:()=>e0,toggleList:()=>e7,toggleMark:()=>e4,toggleNode:()=>e8,toggleWrap:()=>e5,undoInputRule:()=>e6,unsetAllMarks:()=>e9,unsetMark:()=>te,unsetTextDirection:()=>tt,updateAttributes:()=>tn,updateDecorations:()=>to,wrapIn:()=>ti,wrapInList:()=>ta});let tl=new WeakMap,td=void 0!==u&&!1;function tc(e,t){let n=[],r=new Set;for(let o of e)"widget"===o.kind&&"widget"===o.kind&&r.add(o.key),n.push(o.toPMDecoration(t));return{decorations:n,widgetKeys:r}}function tu({position:e,from:t,to:n,docSize:r}){return!(e<t)&&(e<n||e===n&&n===r)}function tp(e){var t;let n=null==(t=e.spec)?void 0:t.key;return"string"==typeof n?n:void 0}function tf(e){return"attr"===e.jsonID}function tm(e,t,n,r){return e.map(t,n,{onRemove:e=>{let t=null==e?void 0:e.key;"string"==typeof t&&r.delete(t)}})}function th(e,t){let n=Object.values(t).flatMap(e=>e.find());return d.zF.create(e,n)}function tg(e){let t=new Set;for(let n of Object.values(e))for(let e of n)t.add(e);return t}let ty=new Set;var tv=class{constructor(e){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{let t=tr.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=e.editor,this.entries=this.resolveEntries(e.entries),this.entries.forEac
1h(({name:e,spec:t})=>(function(e,t){var n;switch(null!=(n=t.update)?n:"document"){case"document":if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(t.shouldUpdate)throw Error(`[tiptap error]: Extension "${e}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}})(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var e,t;return null!=(e=null==(t=tr.getState(this.editor.state))?void 0:t.widgetKeys)?e:ty}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(e){let t=[];for(let{name:n,addDecorations:r}of e){let e=r();e&&t.push({name:n,spec:e})}return t}createPlugin(){let{editor:e,entries:t}=this;return new a.k_({key:tr,state:{init:(e,n)=>{let r={},o={};for(let{name:e,spec:i}of t){let{set:t,widgetKeys:a}=this.buildFullSet(e,i,n);r[e]=t,o[e]=a}let i={decorationSetsByExtension:r,widgetKeysByExtension:o,mergedDecorationSet:this.buildMergedSet(n.doc,r),widgetKeys:tg(o)};return this.warnDuplicateWidgetKeys(i),i},apply:(n,r,o,i)=>{let a=n.getMeta(tr),s=(null==a?void 0:a.type)==="force"&&!a.name,l=(null==a?void 0:a.type)==="force"?a.name:void 0,c={},u={},p=new Set;return(!function(e,t){var n,r;tl.set(e,(null!=(n=tl.get(e))?n:0)+1);try{return t()}finally{let t=(null!=(r=tl.get(e))?r:1)-1;t>0?tl.set(e,t):tl.delete(e)}}(e,()=>{for(let{name:f,spec:m}of t){var a;let t=s||l===f;if(a={editor:e,tr:n,oldState:o,newState:i},t||"manual"!==m.update&&(m.shouldUpdate?m.shouldUpdate(a):a.tr.docChanged))if("changedRanges"===m.update&&n.docChanged&&!t){let e=this.applyChangedRangesRecompute(f,m,r,n,i);c[f]=e.set,u[f]=e.widgetKeys,p.add(f)}else{let{set:e,widgetKeys:t}=this.buildFullSet(f,m,i);c[f]=e,u[f]=t,p.add(f)}else{let e=function(e,t,n){var r,o;let i=null!=(r=t.decorationSetsByExtension[e])?r:d.zF.empty,a=new Set(null!=(o=t.widgetKeysByExtension[e])?o:[]);return{set:tm(i,n.mapping,n.doc,a),widgetKeys:a}}(f,r,n);c[f]=e.set,u[f]=e.widgetKeys}}}),0!==p.size||n.docChanged)?{decorationSetsByExtension:c,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:n,decorationSetsByExtension:c,recomputedNames:p}),widgetKeys:tg(u)}:r}},props:{decorations(e){var t,n;return null!=(t=null==(n=tr.getState(e))?void 0:n.mergedDecorationSet)?t:d.zF.empty}}})}applyChangedRangesRecompute(e,t,n,r,o){let i=function(e,t){if(e.steps.some(e=>{let t;
1return t=!1,e.getMap().forEach(()=>{t=!0}),!(t||tf(e))&&("number"!=typeof e.from||"number"!=typeof e.to)}))return{type:"full"};let n=eL(e).map(({newRange:e})=>e);e.steps.forEach((t,r)=>{if(!tf(t))return;let o=e.mapping.slice(r);n.push({from:o.map(t.pos,-1),to:o.map(t.pos+1)})});let r=[];for(let e of n){let n=function(e,t){let n=null,r=0,o=0;for(let i=0;i<e.childCount&&!(o>t.to);i+=1){let a=o+e.child(i).nodeSize;a>=t.from&&(null===n&&(n=o),r=a),o=a}return null===n?null:{from:n,to:r}}(t,e);n&&r.push(n)}r.sort((e,t)=>e.from-t.from);let o=[];for(let e of r){let t=o[o.length-1];t&&e.from<=t.to?t.to=Math.max(t.to,e.to):o.push({...e})}return{type:"ranges",ranges:o}}(r,o.doc);return"full"===i.type?this.buildFullSet(e,t,o):this.rebuildRanges(e,t,n,r,o,i.ranges)}rebuildRanges(e,t,n,r,o,i){var a,s;let l=null!=(a=n.decorationSetsByExtension[e])?a:d.zF.empty,c=new Set(null!=(s=n.widgetKeysByExtension[e])?s:[]),u=tm(l,r.mapping,r.doc,c),p=o.doc.content.size;for(let{from:n,to:r}of i){let i=u.find(n,r).filter(e=>tu({position:e.from,from:n,to:r,docSize:p}));for(let e of i){let t=tp(e);t&&c.delete(t)}u=u.remove(i);let{decorations:a,widgetKeys:s}=tc(function({decorations:e,from:t,to:n,docSize:r,extensionName:o,warnedExtensions:i}){return e.filter(e=>!!tu({position:e.anchor,from:t,to:n,docSize:r})||e.anchor!==n&&(i.has(o)||(i.add(o),console.warn(`[tiptap warn]: Extension "${o}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)),!1))}({decorations:this.runCreate(e,"createInRange",()=>t.createInRange({editor:this.editor,state:o,view:this.mountedView,from:n,to:r})),from:n,to:r,docSize:p,extensionName:e,warnedExtensions:this.warnedOutOfRangeExtensions}),e);for(let e of(u=u.add(o.doc,a),s))c.add(e)}return{set:u,widgetKeys:c}}buildFullSet(e,t,n){let r=this.runCreate(e,"create",()=>t.create({editor:this.editor,state:n,view:this.mountedView}));var o=n.doc;let{decorations:i,widgetKeys:a}=tc(r,e);return{set:d.zF.create(o,i),widgetKeys:a}}runCreate(e,t,n){try{return n()}catch(n){return console.error(`[tiptap error]: Extension "${e}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,n),[]}}warnDuplicateWidgetKeys(e){if(!td)return;if(0===e.widgetKeys.size)return void this.warnedWidgetKeys.clear();let t=function(e){let t=new Map,n=new Map;for(let a of e.find()){var r,o,i;let e=tp(a);if(!e)continue;let s=null!=(r=a.spec.extensionName)?r:"unknown",l=null!=(o=t.get(e))?o:new Set;l.add(s),t.set(e,l),n.set(e,(null!=(i=n.get(e))?i:0)+1)}return Array.from(t,([e,t])=>({key:e,extensions:t})).filter(({key:e})=>{var t;return(null!=(t=n.get(e))?t:0)>1})}(e.mergedDecorationSet),n=new Set(t.map(({key:e})=>e));for(let{key:e,extensions:n}of t){if(this.warnedWidgetKeys.has(e))continue;let t=Array.from(n).map(e=>`"${e}"`).join(", ");console.warn(`[tiptap warn]: Duplicate widget decoration key "${e}" in extension${1===n.size?"":"s"} ${t}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \`comment-\${id}\`).`)}this.warnedWidgetKeys=n}buildMergedSet(e,t){let n=Object.keys(t);return 1===n.length?t[n[0]]:th(e,t)}mergeAfterApply({entries:e,previous:t,tr:n,decorationSetsByExtension:r,recomputedNames:o}){return 1===e.length?r[e[0].name]:0===o.size?t.mergedDecorationSet.map(n.mapping,n.doc):th(n.doc,r)}};function tb(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}var tk=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function tw(e){var t;let{editor:n,from:r,to:o,text:i,rules:a,plugin:s}=e,{view:l}=n;if(l.composing)return!1;let d=l.state.doc.resolve(r);if(d.parent.type.spec.code||(null==(t=d.nodeBefore||d.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let c=!1,u=((e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,o,i)=>{var a,s;let l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:o,index:i}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(d)+i;
1return a.forEach(e=>{if(c)return;let t=((e,t)=>{if(T(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(u,e.find);if(!t)return;let a=t[0].length-i.length;if(a>0){let e=d.parentOffset-a;if(e<0||d.parent.textBetween(e,d.parentOffset)!==t[0].slice(0,a))return}let m=l.state.tr,h=p({state:l.state,transaction:m}),g={from:r-(t[0].length-i.length),to:o},{commands:y,chain:v,can:b}=new f({editor:n,state:h});null!==e.handler({state:h,range:g,match:t,commands:y,chain:v,can:b})&&m.steps.length&&(e.undoable&&m.setMeta(s,{transform:m,from:r,to:o,text:i}),l.dispatch(m),c=!0)}),c}var tx=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...eT(eS(this,"addOptions",{name:this.name}))}}get storage(){return{...eT(eS(this,"addStorage",{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>(function e(t,n){let r={...t};return tb(t)&&tb(n)&&Object.keys(n).forEach(o=>{tb(n[o])&&tb(t[o])?r[o]=e(t[o],n[o]):r[o]=n[o]}),r})(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},tM=class e extends tx{constructor(...e){super(...e),this.type="mark"}static create(t={}){return new e("function"==typeof t?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let o=r.marks();if(!o.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;let i=o.find(e=>(null==e?void 0:e.type.name)===t.name);return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},tE=class{constructor(e){this.find=e.find,this.handler=e.handler}};let tS=null;var tO=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=e,this.extensions=ez(e),this.schema=function(e,t){var n;let r=ej(e),{nodeExtensions:o,markExtensions:i}=eR(e),a=null==(n=o.find(e=>eS(e,"topNode")))?void 0:n.name,l=Object.fromEntries(o.map(n=>{let o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},a=eP({...e.reduce((e,t)=>{let r=eS(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}},{}),content:eT(eS(n,"content",i)),marks:eT(eS(n,"marks",i)),group:eT(eS(n,"group",i)),inline:eT(eS(n,"inline",i)),atom:eT(eS(n,"atom",i)),selectable:eT(eS(n,"selectable",i)),draggable:eT(eS(n,"draggable",i)),code:eT(eS(n,"code",i)),whitespace:eT(eS(n,"whitespace",i)),linebreakReplacement:eT(eS(n,"linebreakReplacement",i)),defining:eT(eS(n,"defining",i)),isolating:eT(eS(n,"isolating",i)),attrs:Object.fromEntries(o.map(eN))}),s=eT(eS(n,"parseHTML",i));s&&(a.parseDOM=s.map(e=>eD(e,o)));let l=eS(n,"renderHTML",i);l&&(a.toDOM=e=>l({node:e,HTMLAttributes:eI(e,o)}));let d=eS(n,"renderText",i);return d&&(a.toText=d),[n.name,a]})),d=Object.fromEntries(i.map(n=>{let o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},a=eP({...e.reduce((e,t)=>{let r=eS(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}},{}),inclusive:eT(eS(n,"inclusive",i)),excludes:eT(eS(n,"excludes",i)),group:eT(eS(n,"group",i)),spanning:eT(eS(n,"spanning",i)),code:eT(eS(n,"code",i)),attrs:Object.fromEntries(o.map(eN))}),s=eT(eS(n,"parseHTML",i));s&&(a.parseDOM=s.map(e=>eD(e,o)));let l=eS(n,"renderHTML",i);return l&&(a.toDOM=e=>l({mark:e,HTMLAttributes:eI(e,o)})),[n.name,a]}));return new s.Sj({topNode:a,nodes:l,marks:d})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=eS(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:e_(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this,t=eB([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:e_(t.name,this.schema)},r=[],o=eS(t,"addKeyboardShortcuts",n),i={};if("mark"===t.type&&eS(t,"exitable",n)&&(i.ArrowRight=()=>tM.handleExit({editor:e,mark:t})),o){let t=Object.fromEntries(Object.entries(o()).map(([t,n])=>[t,()=>n({editor:e})]));i={...i,...t}}let l=(0,c.w)(i);r.push(l);let d=eS(t,"addInputRules",n);if(eW(t,e.options.enableInputRules)&&d){let t=d();if(t&&t.length){let n=function(e){let{editor:t,rules:n}=e,r=new a.k_({state:{init:()=>null,apply(e,o,i){let a=e.getMeta(r);if(a)return a;let l=e.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:e}=l;"string"==typeof e||(e=eC(s.FK.from(e),i.schema));let{from:o}=l,a=o+e.length;tw({editor:t,from:o,to:a,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput:(e,o,i,a)=>tw({editor:t,from:o,to:i,text:a,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:o}=e.state.selection;o&&tw({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,o){if("Enter"!==o.key)return!1;let{$cursor:i}=e.state.selection;return!!i&&tw({editor:t,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),o=Array.isArray(n)?n:[n];r.push(...o)}}let u=eS(t,"addPasteRules",n);if(eW(t,e.options.enablePasteRules)&&u){let t=u();if(t&&t.length){let n=function(e){let t,{editor:n,rules:r}=e,o=null,i=!1,l=!1,d="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let c=({state:e,from:r,to:o,rule:i,pasteEvt:a})=>{let s=e.tr;if(function(e){let{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:a,dropEvent:s}=e,{commands:l,chain:d,can:c}=new f({editor:t,state:n}),u=[];return n.doc.nodesBetween(r,o,(e,t)=>{var p,f,m,h;if((null==(p=e.type)||null==(p=p.spec)?void 0:p.code)||!(e.isText||e.isTextblock||e.isInline))return;let g=null!=(f=null!=(m=null==(h=e.content)?void 0:h.size)?m:e.nodeSize)?f:0,y=Math.max(r,t),v=Math.min(o,t+g);y>=v||((e,t,n)=>{if(T(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(y-t,v-t,void 0,""),i.find,a).forEac
1h(e=>{if(void 0===e.index)return;let t=y+e.index+1,r=t+e[0].length,o={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},p=i.handler({state:n,range:o,match:e,commands:l,chain:d,can:c,pasteEvent:a,dropEvent:s});u.push(p)})}),u.every(e=>null!==e)}({editor:n,state:p({state:e,transaction:s}),from:Math.max(r-1,0),to:o.b-1,rule:i,pasteEvent:a,dropEvent:t})&&s.steps.length){try{t="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return d="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,s}};return r.map(e=>new a.k_({view(e){let t=t=>{var r;(o=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(tS=n)},r=()=>{tS&&(tS=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,n)=>{if(l=o===e.dom.parentElement,t=n,!l){let e=tS;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;let r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return d=t,i=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let o=t[0],a="paste"===o.getMeta("uiEvent")&&!i,u="drop"===o.getMeta("uiEvent")&&!l,p=o.getMeta("applyPasteRules"),f=!!p;if(!a&&!u&&!f)return;if(f){let{text:t}=p;"string"==typeof t||(t=eC(s.FK.from(t),r.schema));let{from:n}=p,o=n+t.length;return c({rule:e,state:r,from:n,to:{b:o},pasteEvt:(e=>{var t;let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(t=n.clipboardData)||t.setData("text/html",e),n})(t)})}let m=n.doc.content.findDiffStart(r.doc.content),h=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof m&&h&&m!==h.b)return c({rule:e,state:r,from:m,to:h,pasteEvt:d})}}))}({editor:e,rules:t});r.push(...n)}}let m=eS(t,"addProseMirrorPlugins",n);if(m){let e=m();r.push(...e)}return r}),n=this.createDecorationPlugin();return n&&t.push(n),t}createDecorationPlugin(){var e;let{editor:t}=this;null==(e=this.decorationManager)||e.destroy();let n=[];return this.extensions.forEach(e=>{let r=eS(e,"addDecorations",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:e_(e.name,this.schema)});r&&n.push({name:e.name,addDecorations:r})}),this.decorationManager=new tv({editor:t,entries:n}),this.decorationManager.plugin}get attributes(){return ej(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=eR(this.extensions);return Object.fromEntries(t.filter(e=>!!eS(e,"addNodeView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=eS(t,"addNodeView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:w(t.name,this.schema)});if(!r)return[];let o=r();return o?[t.name,(r,i,a,s,l)=>{let d=eI(r,n);return o({node:r,view:i,getPos:a,decorations:s,innerDecorations:l,editor:e,extension:t,HTMLAttributes:d})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return eB([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:e_(n.name,this.schema)},o=eS(n,"dispatchTransaction",r);return o?t=>{o.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return eB([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:e_(n.name,this.schema)},o=eS(n,"transformPastedHTML",r);return o?(t,n)=>{let i=e(t,n);return o.call(r,i)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=eR(this.extensions);return Object.fromEntries(t.filter(e=>!!eS(e,"addMarkView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=eS(t,"addMarkView",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:I(t.name,this.schema)});return r?[t.name,(o,i,a)=>{let s=eI(o,n);return r()({mark:o,view:i,inline:a,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{!function(e,t,n={}){let{state:r}=t,{doc:o,tr:i}=r;o.descendants((t,r)=>{let o=i.mapping.map(r),a=i.mapping.map(r)+t.nodeSize,s=null;if(t.marks.forEach(t=>{if(t!==e)return!1;s=t}),!s)return;let l=!1;
1if(Object.keys(n).forEach(e=>{n[e]!==s.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});i.removeMark(o,a,e.type),i.addMark(o,a,t)}}),i.docChanged&&t.view.dispatch(i)}(o,e,t)}})}]:[]}))}destroy(){var e;null==(e=this.decorationManager)||e.destroy(),this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:e_(e.name,this.schema)};if("mark"===e.type){var n,r;(null==(n=eT(eS(e,"keepOnSplit",t)))||n)&&this.splittableMarks.push(e.name),null==(r=eT(eS(e,"clearable",t)))||r||this.nonClearableMarks.push(e.name)}let o=eS(e,"onBeforeCreate",t),i=eS(e,"onCreate",t),a=eS(e,"onUpdate",t),s=eS(e,"onSelectionUpdate",t),l=eS(e,"onTransaction",t),d=eS(e,"onFocus",t),c=eS(e,"onBlur",t),u=eS(e,"onDestroy",t);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),a&&this.editor.on("update",a),s&&this.editor.on("selectionUpdate",s),l&&this.editor.on("transaction",l),d&&this.editor.on("focus",d),c&&this.editor.on("blur",c),u&&this.editor.on("destroy",u)})}};tO.resolve=ez,tO.sort=eB,tO.flatten=eO;var tC=class e extends tx{constructor(...e){super(...e),this.type="extension"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}};tC.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new a.k_({key:new a.hs("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,i=Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText])),{blockSeparator:a}=this.options,s={...void 0!==a?{blockSeparator:a}:{},textSerializers:i};return[...o.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>(function(e,t,n){let{from:r,to:o}=t,{blockSeparator:i="\n\n",textSerializers:a={}}=n||{},s="";return e.nodesBetween(r,o,(e,n,l,d)=>{e.isBlock&&n>r&&(s+=i);let c=null==a?void 0:a[e.type.name];if(c)return l&&(s+=c({node:e,pos:n,parent:l,index:d,range:t})),!1;if(e.isText){var u;s+=null==e||null==(u=e.text)?void 0:u.slice(Math.max(r,n)-n,o-n)}}),s})(r,{from:e.pos,to:t.pos},s)).join(null!=a?a:"\n\n")}}})]}}),tC.create({name:"commands",addCommands:()=>({...ts})}),tC.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r;let i=()=>{var n,r,i;if(null!=(n=null==(r=this.editor.options.coreExtensionOptions)||null==(r=r.delete)||null==(i=r.filterTransaction)?void 0:i.call(r,e))?n:e.getMeta("y-sync$"))return;let a=function(e,t){let n=new o.dL(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}(e.before,[e,...t]);eL(a).forEach(t=>{a.mapping.mapResult(t.oldRange.from).deletedAfter&&a.mapping.mapResult(t.oldRange.to).deletedBefore&&a.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let o=r+n.nodeSize-2,i=t.oldRange.from<=r&&o<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:o,newFrom:a.mapping.map(r),newTo:a.mapping.map(o),deletedRange:t.oldRange,newRange:t.newRange,partial:!i,editor:this.editor,transaction:e,combinedTransform:a})})});let s=a.mapping;a.steps.forEach((t,n)=>{if(t instanceof o.Ys){var r,i;let o=s.slice(n).map(t.from,-1),l=s.slice(n).map(t.to),d=s.invert().map(o,-1),c=s.invert().map(l),u=o>0&&(null==(r=a.doc.nodeAt(o-1))?void 0:r.marks.some(e=>e.eq(t.mark))),p=null==(i=a.doc.nodeAt(l))?void 0:i.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:d,to:c},newRange:{from:o,to:l},partial:!!(p||u),editor:this.editor,transaction:e,combinedTransform:a})}})};null==(n=null==(r=this.editor.options.coreExtensionOptions)||null==(r=r.delete)?void 0:r.async)||n?setTimeout(i,0):i()}}),tC.create({name:"drop",addProseMirrorPlugins(){return[new a.k_({key:new a.hs("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),tC.create({name:"editable",addProseMirrorPlugins(){return[new a.k_({key:new a.hs("editable"),props:{editable:()=>this.editor.options.editable}})]}});let tT=new a.hs("focusEvents");tC.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;
1return[new a.k_({key:tT,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}}}})]}}),tC.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:o,$anchor:i}=n,{pos:s,parent:l}=i,d=i.parent.isTextblock&&s>0?t.doc.resolve(s-1):i,c=d.parent.type.spec.isolating,u=i.pos-i.parentOffset,p=c&&1===d.parent.childCount?u===i.pos:a.LN.atStart(r).from===s;return!!o&&!!l.type.isTextblock&&!l.textContent.length&&!!p&&(!p||"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()},r={...n},o={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return L()||ea()?o:r},addProseMirrorPlugins(){return[new a.k_({key:new a.hs("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),o=e.some(e=>e.getMeta("preventClearDocument"));if(!r||o)return;let{empty:i,from:s,to:l}=t.selection,d=a.LN.atStart(t.doc).from,c=a.LN.atEnd(t.doc).to;if(i||s!==d||l!==c||!function e(t,{checkChildren:n=!0,ignoreWhitespace:r=!1}={}){if(r){if("hardBreak"===t.type.name)return!0;if(t.isText){var o;return!/\S/.test(null!=(o=t.text)?o:"")}}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(0===t.content.childCount)return!0;if(n){let o=!0;return t.content.forEach(t=>{!1===o||e(t,{ignoreWhitespace:r,checkChildren:n})||(o=!1)}),o}return!1}(n.doc))return;let u=n.tr,m=p({state:n,transaction:u}),{commands:h}=new f({editor:this.editor,state:m});if(h.clearNodes(),u.steps.length)return u}})]}}),tC.create({name:"paste",addProseMirrorPlugins(){return[new a.k_({key:new a.hs("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),tC.create({name:"tabindex",addOptions:()=>({value:void 0}),addProseMirrorPlugins(){return[new a.k_({key:new a.hs("tabindex"),props:{attributes:()=>{var e;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!=(e=this.options.value)?e:"0"}:{}}}})]}}),tC.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=eR(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&("ltr"===t||"rtl"===t||"auto"===t)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new a.k_({key:new a.hs("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}});var tR=class{static Inline(e,t,n={},r){return new tj(e,t,n,r)}static Node(e,t,n={},r){return new tA(e,t,n,r)}static Widget(e,t,n){let{key:r,...o}=n;return new t$(e,t,r,o)}},tj=class extends tR{constructor(e,t,n={},r){super(),this.kind="inline",this.from=e,this.to=t,this.attrs=n,this.spec=r}get anchor(){return this.from}toPMDecoration(e){let t=e?{...this.spec,extensionName:e}:this.spec;return d.NZ.inline(this.from,this.to,this.attrs,t)}},tA=class extends tR{constructor(e,t,n={},r){super(),this.kind="node",this.from=e,this.to=t,this.attrs=n,this.spec=r}get anchor(){return this.from}toPMDecoration(e){let t=e?{...this.spec,extensionName:e}:this.spec;return d.NZ.node(this.from,this.to,this.attrs,t)}},t$=class extends tR{constructor(e,t,n,r){super(),this.kind="widget",this.pos=e,this.render=t,this.key=n,this.spec=r}get anchor(){return this.pos}toPMDecoration(e){let t=e?{...this.spec,key:this.key,extensionName:e}:{...this.spec,key:this.key};return d.NZ.widget(this.pos,this.render,t)}};function tI(e){return new tk({find:e.find,handler:({state:t,range:n,match:r})=>{let o=eT(e.getAttributes,void 0,r);if(!1===o||null===o)return null;let{tr:i}=t,a=r[r.length-1],s=r[0];if(a){let r=s.search(/\S/),l=n.from+s.indexOf(a),d=l+a.length;if(eF(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;
1d<n.to&&i.delete(d,n.to),l>n.from&&i.delete(n.from+r,l);let c=n.from+r+a.length;i.addMark(n.from+r,c,e.type.create(o||{})),i.removeStoredMark(e.type)}},undoable:e.undoable})}function tD(e){return new tE({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{let i=eT(e.getAttributes,void 0,r,o);if(!1===i||null===i)return null;let{tr:a}=t,s=r[r.length-1],l=r[0],d=n.to;if(s){let o=l.search(/\S/),c=n.from+l.indexOf(s),u=c+s.length;if(eF(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;u<n.to&&a.delete(u,n.to),c>n.from&&a.delete(n.from+o,c),d=n.from+o+s.length,a.addMark(n.from+o,d,e.type.create(i||{})),void 0!==r.index&&void 0!==r.input&&r.index+r[0].length>=r.input.length||a.removeStoredMark(e.type)}}})}}}]);
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.