PageSourceSearch

https://pika.page/assets/@tiptap--core-749936f8cca8dd64814b44ec1dda877a492f5d4809fce1534ec97f15f8bbeba4.js

js pika.page collected 2026-10-03 21:40:20 UTC 117,072 bytes, 159 lines download raw bytes

1// @tiptap/[email protected] downloaded from https://ga.jspm.io/npm:@tiptap/[email protected]/dist/index.js
2
3import{liftTarget as e,ReplaceStep as t,ReplaceAroundStep as n,joinPoint as r,Transform as i,canSplit as a,canJoin as o,RemoveMarkStep as s,findWrapping as c}from"@tiptap/pm/transform";import{createParagraphNear as l,exitCode as u,joinUp as d,joinDown as f,joinBackward as p,joinForward as m,joinTextblockBackward as h,joinTextblockForward as g,lift as _,liftEmptyBlock as ee,newlineInCode as te,selectNodeBackward as ne,selectNodeForward as v,selectParentNode as re,selectTextblockEnd as ie,selectTextblockStart as ae,setBlockType as oe,wrapIn as y}from"@tiptap/pm/commands";import{TextSelection as b,Selection as x,AllSelection as se,NodeSelection as S,PluginKey as C,Plugin as w,EditorState as ce}from"@tiptap/pm/state";import{Fragment as T,Schema as le,DOMParser as ue,DOMSerializer as de,Node as fe,Slice as pe}from"@tiptap/pm/model";import{liftListItem as me,sinkListItem as he,wrapInList as ge}from"@tiptap/pm/schema-list";import{DecorationSet as E,EditorView as _e,Decoration as ve}from"@tiptap/pm/view";import{keymap as ye}from"@tiptap/pm/keymap";var be=Object.defineProperty,xe=(e,t)=>{let n={};for(var r in e)be(n,r,{get:e[r],enumerable:!0});return t||be(n,Symbol.toStringTag,{value:`Module`}),n};function D(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=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 a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var O=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,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>{let n=(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n};return[e,n]}))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>{let r=(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u};return[e,r]})),run:l};return u}static createFakeChain(){let e=new Proxy({},{get:(t,n)=>{if(n!==`then`)return n===`run`?()=>!1:()=>e}});return e}createCan(e){let{rawCommands:t,state:n}=this,r=!1,i=e||n.tr,a=this.buildProps(i,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...a,dispatch:void 0})])),chain:()=>this.createChain(i,!1)}}static createFallbackCan(){let e=CommandManager.createFakeChain();return new Proxy({chain:()=>e},{get:(e,t)=>{if(t!==`then`)return t===`chain`?e.chain:()=>!1}})}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:D({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)(o)]))}};return o}};const Se=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),(n=window)==null||(n=n.getSelection())==null||n.removeAllRanges()}}),!0),Ce=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),we=()=>({state:t,tr:n,dispatch:r})=>{let{selection:i}=n,{ranges:a}=i;return r&&a.forEach(({$from:r,$to:i})=>{t.doc.nodesBetween(r.pos,i.pos,(t,r)=>{if(t.type.isText)return;let{doc:i,mapping:a}=n,o=i.resolve(a.map(r)),s=i.resolve(a.map(r+t.nodeSize)),c=o.blockRange(s);if(!c)return;let l=e(c);if(t.type.isTextblock){let{defaultType:e}=o.parent.contentMatchAt(o.index());n.setNodeMarkup(c.start,e)}(l||l===0)&&n.lift(c,l)})}),!0},Te=e=>t=>e(t),Ee=()=>({state:e,dispatch:t})=>l(e,t),De=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new b(r.doc.resolve(Math.max(o-1,0)))),!0},Oe=()=>({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)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function k(e,t){if(typeof e==`string`){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}const ke=e=>({tr:t,state:n,dispatch:r})=>{let i=k(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},Ae=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},je=e=>e.content?/^text(\*|\+)/.test(e.content):!1,Me=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos<e.end())return e.pos;let r=t.nodes[e.parent.type.name].spec;return je(r)?n===`left`?e.start()-1:e.end()+1:e.pos},Ne=(e,t,n)=>({from:Me(e,n,`left`),to:Me(t,n,`right`)}),Pe=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{let r=n.mapping.slice(i),{from:a,to:o}=Ne(n.doc.resolve(r.map(t.$from.pos)),n.doc.resolve(r.map(t.$to.pos)),e.schema);n.deleteRange(a,o)}),n.selection.empty||n.setSelection(b.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},Fe=()=>({commands:e})=>e.keyboardShortcut(`Enter`),Ie=()=>({state:e,dispatch:t})=>u(e,t);function Le(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function A(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(r=>n.strict?t[r]===e[r]:Le(t[r])?t[r].test(e[r]):t[r]===e[r]):!0}function Re(e,t,n={}){return e.find(e=>e.type===t&&A(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function ze(e,t,n={}){return!!Re(e,t,n)}function Be(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(!Re([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;
vendor: 2,033 bytes, line 3
3for(;i>0&&ze([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&ze([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function j(e,t){if(typeof e==`string`){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}const Ve=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=j(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=Be(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=b.create(o,e.from,e.to);n.setSelection(t)}}return!0},He=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function Ue(e){return e instanceof b}function M(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function We(e,t=null){if(!t)return null;let n=x.atStart(e),r=x.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?b.create(e,M(0,i,a),M(e.content.size,i,a)):b.create(e,M(t,i,a),M(t,i,a))}function N(){return[`Android`].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function P(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function Ge(){return typeof navigator<`u`?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const Ke=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(P()||N())&&r.dom.focus(),Ge()&&!P()&&!N()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t!=null&&t.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!Ue(n.state.selection))return o(),!0;let s=We(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},qe=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),Je=(e,t)=>
3({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Ye=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&Ye(r)}return e};function F(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return Ye(n)}function Xe(e){return typeof(e==null?void 0:e.nodesBetween)==`function`}function I(e,t,n){if(Xe(e))return e;let r=typeof e==`object`&&!!e;n={slice:!0,parseOptions:{},...n};let i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return T.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),I(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new le({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,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?ue.fromSchema(a).parseSlice(F(e),n.parseOptions):ue.fromSchema(a).parse(F(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:/* @__PURE__ */ Error(`Invalid element found: ${i}`)})}let r=ue.fromSchema(t);return n.slice?r.parseSlice(F(e),n.parseOptions).content:r.parse(F(e),n.parseOptions)}return I(``,t,n)}function Ze(e){return!(`type`in e)}function Qe(e,r,i){let a=e.steps.length-1;if(a<r)return;let o=e.steps[a];if(!(o instanceof t||o instanceof n))return;let s=e.mapping.maps[a],c=0;s.forEach((e,t,n,r)=>{c===0&&(c=r)}),e.setSelection(x.near(e.doc.resolve(c),i))}const $e=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,s=e=>
3{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{I(t,a.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(e){s(e)}try{var o;i=I(t,a.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)==null?a.options.enableContentCheck:o})}catch(e){return s(e),!1}let{from:l,to:u}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},d=!0,f=!0,p=Ze(i)?i.content:[i];if(p.forEach(e=>{e.check(),d=d?e.isText&&e.marks.length===0:!1,f=f?e.isBlock:!1}),l===u&&f){let{parent:e}=r.doc.resolve(l);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--l,u+=1)}let m;if(d)m=Array.isArray(t)?t.map(e=>e.text||``).join(``):Xe(t)?p.map(e=>{var t;return(t=e.text)==null?``:t}).join(``):typeof t==`object`&&t&&t.text?t.text:t,r.insertText(m,l,u);else{m=T.from(p);let e=r.doc.resolve(l),t=e.node(),n=e.parentOffset===0,i=t.isText||t.isTextblock,a=t.content.size>0;n&&i&&a&&f&&(l=Math.max(0,l-1)),r.replaceWith(l,u,p)}n.updateSelection&&Qe(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:l,text:m}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:l,text:m})}return!0};function et(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}const tt=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{pos:i,attrs:a,content:o,updateSelection:s=!0}=e,c;c=typeof i==`number`?t.doc.resolve(i):i||t.selection.$from;let l=et(c.parent.contentMatchAt(c.index()));if(!l)return!1;let u=Object.keys(l.spec.attrs||{}),d=a?Object.fromEntries(Object.entries(a).filter(([e])=>u.includes(e))):{},f;if(o){let e=I(o,r.schema);f=l.createAndFill(d,e)}else f=l.createAndFill(d);return f?(n&&(t.insert(c.pos,f),s&&Qe(t,t.steps.length-1,-1)),!0):!1},nt=()=>({state:e,dispatch:t})=>d(e,t),rt=()=>({state:e,dispatch:t})=>f(e,t),it=()=>({state:e,dispatch:t})=>p(e,t),at=()=>({state:e,dispatch:t})=>m(e,t),ot=()=>({state:e,dispatch:t,tr:n})=>{try{let i=r(e.doc,e.selection.$from.pos,-1);return i==null?!1:(n.join(i,2),t&&t(n),!0)}catch{return!1}},st=()=>({state:e,dispatch:t,tr:n})=>{try{let i=r(e.doc,e.selection.$from.pos,1);return i==null?!1:(n.join(i,2),t&&t(n),!0)}catch{return!1}},ct=()=>({state:e,dispatch:t})=>h(e,t),lt=()=>({state:e,dispatch:t})=>g(e,t);function ut(){return typeof navigator<`u`?/Mac/.test(navigator.platform):!1}function dt(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))P()||ut()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}const ft=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=dt(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0}),c=t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))});return c==null||c.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function L(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?k(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>o?o.name===e.node.type.name:!0).filter(e=>A(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}const pt=(e,t={})=>({state:n,dispatch:r})=>L(n,k(e,n.schema),t)?_(n,r):!1,mt=()=>({state:e,dispatch:t})=>ee(e,t),ht=e=>({state:t,dispatch:n})=>me(k(e,t.schema))(t,n),gt=()=>({state:e,dispatch:t})=>te(e,t);function R(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function _t(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}const vt=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=R(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=k(e,r.schema)),s===`mark`&&(o=j(e,r.schema));let c=!1;
vendor: 3,400 bytes, line 3
3return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,_t(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(_t(a.attrs,t))))})})}),c},yt=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),bt=()=>({tr:e,dispatch:t})=>{if(t){let t=new se(e.doc);e.setSelection(t)}return!0},xt=()=>({state:e,dispatch:t})=>ne(e,t),St=()=>({state:e,dispatch:t})=>v(e,t),Ct=()=>({state:e,dispatch:t})=>re(e,t),wt=()=>({state:e,dispatch:t})=>ie(e,t),Tt=()=>({state:e,dispatch:t})=>ae(e,t);function Et(e,t,n={},r={}){return I(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const Dt=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=Et(e,i.schema,r,{errorOnInvalidContent:t==null?i.options.enableContentCheck:t});if(o){let e=Ze(s)?s.content:[s];a.replaceWith(0,c.content.size,e).setMeta(`preventUpdate`,!n)}return!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t==null?i.options.enableContentCheck:t})};function Ot(e,t){let n=j(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function kt(e,t){let n=new i(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function At(e,t){let n=[];return e.descendants((e,r)=>{t(e)&&n.push({node:e,pos:r})}),n}function jt(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function Mt(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function Nt(e){return t=>Mt(t.$from,e)}function z(e,t,n){return e.config[t]===void 0&&e.parent?z(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?z(e.parent,t,n):null}):e.config[t]}function Pt(e){return e.map(e=>{let t=z(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...Pt(t())]:e}).flat(10)}function B(e,t){let n=de.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function Ft(e){return typeof e==`function`}function V(e,t=void 0,...n){return Ft(e)?t?e.bind(t)(...n):e(...n):e}function It(e={}){return Object.keys(e).length===0&&e.constructor===Object}function H(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function Lt(e){let t=[],{nodeExtensions:n,markExtensions:r}=H(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=z(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}
3),i.forEach(e=>{let n=z(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof(i==null?void 0:i.default)==`function`&&(i.default=i.default()),i!=null&&i.isRequired&&(i==null?void 0:i.default)===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function Rt(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i){r=!r,n+=o;continue}if(o===`"`&&!r){i=!i,n+=o;continue}if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}return n&&t.push(n),t}function zt(e){let t=[],n=Rt(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function Bt(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(e===`__proto__`){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0});return}if(!n[e]){n[e]=t;return}if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...zt(n[e]),...zt(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function U(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)=>Bt(e,t),{})}function Vt(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`?!0:e===`false`?!1:e:e}function Ht(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):Vt(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function Ut(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&It(t)?!1:t!=null))}function Wt(e){var t,n;let r={};return!(!(e==null||(t=e.attribute)==null)&&t.isRequired)&&`default`in((e==null?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(e==null||(n=e.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function Gt(e,t){var n;let r=Lt(e),{nodeExtensions:i,markExtensions:a}=H(e);return new le({topNode:(n=i.find(e=>z(e,`topNode`)))==null?void 0:n.name,nodes:Object.fromEntries(i.map(n=>{let i=r.filter(e=>e.type===n.name),a={name:n.name,options:n.options,storage:n.storage,editor:t},o=Ut({...e.reduce((e,t)=>{let r=z(t,`extendNodeSchema`,a);return{...e,...r?r(n):{}}},{}),content:V(z(n,`content`,a)),marks:V(z(n,`marks`,a)),group:V(z(n,`group`,a)),inline:V(z(n,`inline`,a)),atom:V(z(n,`atom`,a)),selectable:V(z(n,`selectable`,a)),draggable:V(z(n,`draggable`,a)),code:V(z(n,`code`,a)),whitespace:V(z(n,`whitespace`,a)),linebreakReplacement:V(z(n,`linebreakReplacement`,a)),defining:V(z(n,`defining`,a)),isolating:V(z(n,`isolating`,a)),attrs:Object.fromEntries(i.map(Wt))}),s=V(z(n,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>Ht(e,i)));let c=z(n,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:U(e,i)}));let l=z(n,`renderText`,a);return l&&(o.toText=l),[n.name,o]})),marks:Object.fromEntries(a.map(n=>{let i=r.filter(e=>e.type===n.name),a={name:n.name,options:n.options,storage:n.storage,editor:t},o=Ut({...e.reduce((e,t)=>{let r=z(t,`extendMarkSchema`,a);return{...e,...r?r(n):{}}},{}),inclusive:V(z(n,`inclusive`,a)),excludes:V(z(n,`excludes`,a)),group:V(z(n,`group`,a)),spanning:V(z(n,`spanning`,a)),code:V(z(n,`code`,a)),attrs:Object.fromEntries(i.map(Wt))}),s=V(z(n,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>Ht(e,i)));let c=z(n,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:U(e,i)})),[n.name,o]}))})}function Kt(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function W(e){let t=100;return e.sort((e,t)=>{let n=z(e,`priority`)||100,r=z(t,`priority`)||100;return n>r?-1:+(n<r)})}function qt(e){let t=W(Pt(e)),n=Kt(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}function Jt(e,t){return Gt(qt(e),t)}function Yt(e,t){let n=Jt(t);return B(fe.fromJSON(n,e).content,n)}function Xt(e,t){let n=Jt(t),r=F(e);return ue.fromSchema(n).parse(r).toJSON()}function Zt(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
4
5`,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o==null?void 0:o[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;if(e.isText){var d;s+=e==null||(d=e.text)==null?void 0:d.slice(Math.max(r,n)-n,i-n)}}),s}function Qt(e,t){return Zt(e,{from:0,to:e.content.size},t)}function $t(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function en(e,t,n){let{blockSeparator:r=`
6
7`,textSerializers:i={}}=n||{},a=Jt(t);return Qt(fe.fromJSON(a,e),{blockSeparator:r,textSerializers:{...$t(a),...i}})}function tn(e,t){let n=k(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function nn(e,t){let n=R(typeof t==`string`?t:t.name,e.schema);return n===`node`?tn(e,t):n===`mark`?Ot(e,t):{}}function rn(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function an(e){let t=rn(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function on(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),an(r)}function sn(e,t=0){let n=e.type===e.type.schema.topNodeType?0:1,r=t,i=r+e.nodeSize,a=e.marks.map(e=>{let t={type:e.type.name};return Object.keys(e.attrs).length&&(t.attrs={...e.attrs}),t}),o={...e.attrs},s={type:e.type.name,from:r,to:i};return Object.keys(o).length&&(s.attrs=o),a.length&&(s.marks=a),e.content.childCount&&(s.content=[],e.forEach((e,r)=>{var i;(i=s.content)==null||i.push(sn(e,t+r+n))})),e.text&&(s.text=e.text),s}function cn(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=Be(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{!e||(e==null?void 0:e.nodeSize)===void 0||r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}const ln=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);(e==null?void 0:e.type.name)===t?o=e:--a}return[o,a]},un=e=>{let t=e.depth-1;if(t<0)return null;let n=e.index(t);return n===0?null:e.node(t).child(n-1)};function G(e,t){return t.nodes[e]||t.marks[e]||null}function K(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:!1}))}const dn=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o,s;let c=((o=(s=e.type.spec).toText)==null?void 0:o.call(s,{node:e,pos:t,parent:i,index:a}))||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?c:c.slice(0,Math.max(0,r-t))}),n};function fn(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?j(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>a?a.name===e.type.name:!0).find(e=>A(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>a?a.name===e.mark.type.name:!0).filter(e=>A(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>a?e.mark.type!==a&&e.mark.type.excludes(a):!0).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function pn(e,t,n={}){if(!t)return L(e,null,n)||fn(e,null,n);let r=R(t,e.schema);return r===`node`?L(e,t,n):r===`mark`?fn(e,t,n):!1}const mn=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=Nt(e=>
7e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},hn=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function gn(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function _n(e,t){let{nodeExtensions:n}=H(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=V(z(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`?i.split(` `).includes(`list`):!1}function vn(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText){var r;return!/\S/.test((r=e.text)==null?``:r)}}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(vn(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function yn(e){return e instanceof S}function bn({selection:e,pos:t,nodeSize:n,selectedOnTextSelection:r=!1}){let{from:i,to:a}=e;return!!(i<=t&&a>=t+n||r&&Ue(e)&&i>t&&a<t+n)}function q(e){if(typeof e!=`object`||!e)return!1;let t=e;return!(typeof t.apply!=`function`||typeof t.getMap!=`function`||typeof t.invert!=`function`||typeof t.map!=`function`||typeof t.merge!=`function`||typeof t.toJSON!=`function`)}function xn(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!q(t))return!1;let n=t.toJSON();return!(typeof n!=`object`||!n||n.stepType!==`addMark`)}function Sn(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!q(t))return!1;let n=t.toJSON();return!(typeof n!=`object`||!n||n.stepType!==`addNodeMark`)}function Cn(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!q(t))return!1;let n=t.toJSON();return!(typeof n!=`object`||!n||n.stepType!==`attr`)}function wn(e){return typeof e!=`object`||!e?!1:`forEachCell`in e&&typeof e.forEachCell==`function`}function Tn(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!q(t))return!1;let n=t.toJSON();return!(typeof n!=`object`||!n||n.stepType!==`docAttr`)}function En(e){if(typeof e!=`object`||!e)return!1;let t=e;return!(!Array.isArray(t.content)||typeof t.size!=`number`||typeof t.nodesBetween!=`function`||typeof t.descendants!=`function`||typeof t.textBetween!=`function`||typeof t.append!=`function`||typeof t.cut!=`function`||typeof t.eq!=`function`||typeof t.child!=`function`||typeof t.forEach!=`function`)}function Dn(e){return typeof e!=`object`||!e?!1:`node`in e&&e.node!=null}function On(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!q(t))return!1;let n=t.toJSON();return!(typeof n!=`object`||!n||n.stepType!==`removeMark`)}function kn(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!q(t))return!1;let n=t.toJSON();return!(typeof n!=`object`||!n||n.stepType!==`removeNodeMark`)}function An(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!q(t))return!1;let n=t.toJSON();return!(typeof n!=`object`||!n||n.stepType!==`replaceAround`)}function jn(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!q(t))return!1;let n=t.toJSON();return!(typeof n!=`object`||!n||n.stepType!==`replace`)}function Mn(e){if(typeof e!=`object`||!e)return!1;let t=e,n=Number.isInteger(t.openStart)&&t.openStart>=0,r=Number.isInteger(t.openEnd)&&t.openEnd>=0,i=typeof t.size==`number`&&typeof t.eq==`function`&&typeof t.toJSON==`function`;if(!n||!r||!i)return!1;let a=t.content;return!(typeof a!=`object`||!a||!En(a))}function Nn(e){if(typeof e!=`object`||!e)return!1;let t=e,n=t.doc!==null&&typeof t.doc==`object`&&t.failed===null,r=typeof t.failed==`string`&&t.doc===null;return!(!n&&!r)}var Pn=class MappablePosition{constructor(e){this.position=e}static fromJSON(e){return new MappablePosition(e.position)}toJSON(){return{position:this.position}}};function Fn(e,t){let n=t.mapping.mapResult(e.position);return{position:new Pn(n.pos),mapResult:n}}function In(e){return new Pn(e)}function Ln(e,t,n){let r=0,i=e.state.doc.content.size,a=M(t,0,i),o=M(n,0,i),s=e.coordsAtPos(a),c=e.coordsAtPos(o,-1),l=Math.min(s.top,c.top),u=Math.max(s.bottom,c.bottom),d=Math.min(s.left,c.left),f=Math.max(s.right,c.right),p={top:l,bottom:u,left:d,right:f,width:f-d,height:u-l,x:d,y:l};return{...p,toJSON:()=>p}}function Rn({json:e,validMarks:t,validNodes:n,options:r,rewrittenContent:i=[]}){return e.marks&&Array.isArray(e.marks)&&(e.marks=e.marks.filter(e=>{if(e==null)return!1;let n=typeof e==`string`?e:e.type;return t.has(n)?!0:(i.push({original:JSON.parse(JSON.stringify(e)),unsupported:n}),!1)})),e.content&&Array.isArray(e.content)&&(e.content=e.content.map(e=>e==null?null:Rn({json:e,validMarks:t,validNodes:n,options:r,rewrittenContent:i}).json).filter(e=>e!=null)),e.type&&!n.has(e.type)?(i.push({original:JSON.parse(JSON.stringify(e)),unsupported:e.type}),e.content&&Array.isArray(e.content)&&(r==null?void 0:r.fallbackToParagraph)!==!1?(e.type=`paragraph`,{json:e,rewrittenContent:i}):{json:null,rewrittenContent:i}):{json:e,rewrittenContent:i}}function zn(e,t,n){return Rn({json:e,validNodes:new Set(Object.keys(t.nodes)),validM
vendor: 4,769 bytes, line 7
7arks:new Set(Object.keys(t.marks)),options:n})}function Bn(e,t,n){let{selection:r}=t,i=null;if(Ue(r)&&(i=r.$cursor),i){var a;let t=(a=e.storedMarks)==null?i.marks():a;return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:o}=r;return o.some(({$from:t,$to:r})=>{let i=t.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;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),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}const Vn=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=j(e,r.schema);if(i)if(o){let e=Ot(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})});return Bn(r,n,c)},Hn=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),Un=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=k(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>oe(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>oe(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},Wn=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=M(e,0,n.content.size),i=S.create(n,r);t.setSelection(i)}return!0},Gn=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},Kn=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=b.atStart(n).from,o=b.atEnd(n).to,s=M(r,a,o),c=M(i,a,o),l=b.create(n,s,c);t.setSelection(l)}return!0},qn=e=>({state:t,dispatch:n})=>he(k(e,t.schema))(t,n);function Jn(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t==null?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}const Yn=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:o,doc:s}=t,{$from:c,$to:l}=o,u=i.extensionManager.attributes,d=K(u,c.node().type.name,c.node().attrs);if(o instanceof S&&o.node.isBlock)return!c.parentOffset||!a(s,c.pos)?!1:(r&&(e&&Jn(n,i.extensionManager.splittableMarks),t.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;let f=l.parentOffset===l.parent.content.size,p=c.depth===0?void 0:et(c.node(-1).contentMatchAt(c.indexAfter(-1))),m=f&&p?[{type:p,attrs:d}]:void 0,h=a(t.doc,t.mapping.map(c.pos),1,m);if(!m&&!h&&a(t.doc,t.mapping.map(c.pos),1,p?[{type:p}]:void 0)&&(h=!0,m=p?[{type:p,attrs:d}]:void 0),r){if(h&&(o instanceof b&&t.deleteSelection(),t.split(t.mapping.map(c.pos),1,m),p&&!f&&!c.parentOffset&&c.parent.type!==p)){let e=t.mapping.map(c.before()),n=t.doc.resolve(e);c.node(-1).canReplaceWith(n.index(),n.index()+1,p)&&t.setNodeMarkup(t.mapping.map(c.before()),p)}e&&Jn(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return h},Xn=(e,t={})=>({tr:n,state:r,dispatch:i,editor:o})=>{let s=k(e,r.schema),{$from:c,$to:l}=r.selection,u=r.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(l))return!1;let d=c.node(-1);if(d.type!==s)return!1;let f=o.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==s||c.index(-2)!==c.node(-2).childCount-1)return!1;if(i){var p;let e=T.empty,r=c.index(-1)?1:c.index(-2)?2:3;for(let t=c.depth-r;t>=c.depth-3;--t)e=T.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,a={...K(f,c.node().type.name,c.node().attrs),...t},o=((p=s.contentMatch.defaultType)==null?void 0:p.createAndFill(a))||void 0;e=e.append(T.from(s.createAndFill(null,o)||void 0));let l=c.before(c.depth-(r-1));n.replace(l,c.after(-i),new pe(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(b.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let m=l.pos===c.end()?d.contentMatchAt(0).defaultType:null,h={...K(f,d.type.name,d.attrs),...t},g={...K(f,c.node().type.name,c.node().attrs),...t};n.delete(c.pos,l.pos);let _=m?[{type:s,attrs:h},{type:m,attrs:g}]:[{type:s,attrs:h}];if(!a(n.doc,c.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:a}=o.extensionManager,s=t||e.$to.parentOffset&&e.$from.marks();if(n.split(c.pos,2,_).scrollIntoView(),!s||!i)return!0;let l=s.filter(e=>
7a.includes(e.type.name));n.ensureMarks(l)}return!0};function Zn(e){return!e||e===`1`?null:e}function Qn(e,t){return Zn(e)===Zn(t)}const $n=(e,t)=>{let n=Nt(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(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===(i==null?void 0:i.type)&&o(e.doc,n.pos))||!Qn(n.node.attrs.type,i==null?void 0:i.attrs.type)||e.join(n.pos),!0},er=(e,t)=>{let n=Nt(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===(i==null?void 0:i.type)&&o(e.doc,r))||!Qn(n.node.attrs.type,i==null?void 0:i.attrs.type)||e.join(r),!0};function tr(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return b.between(r,i)}const nr=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=k(e,o.schema),m=k(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:ee}=h,te=_.blockRange(ee),ne=g||h.$to.parentOffset&&h.$from.marks();if(!te)return!1;let v=Nt(e=>
vendor: 5,014 bytes, line 7
7_n(e.type.name,d))(h),re=h.from===0&&h.to===o.doc.content.size,ie=o.doc.content.content,ae=ie.length===1?ie[0]:null,oe=re&&ae&&_n(ae.type.name,d)?{node:ae,pos:0,depth:0}:null,y=v==null?oe:v,b=!!v&&te.depth>=1&&te.depth-v.depth<=1,x=!!oe;if((b||x)&&y){if(y.node.type===p)return re&&x?c().command(({tr:e,dispatch:t})=>{let n=tr(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(_n(y.node.type.name,d)&&p.validContent(y.node.content))return c().command(()=>(a.setNodeMarkup(y.pos,p),!0)).command(()=>$n(a,p)).command(()=>er(a,p)).run()}return!n||!ne||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>$n(a,p)).command(()=>er(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=ne.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>$n(a,p)).command(()=>er(a,p)).run()},rr=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=j(e,r.schema);return fn(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},ir=(e,t,n={})=>({state:r,commands:i})=>{let a=k(e,r.schema),o=k(t,r.schema),s=L(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},ar=(e,t={})=>({state:n,commands:r})=>{let i=k(e,n.schema);return L(n,i,t)?r.lift(i):r.wrapIn(i,t)},or=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},sr=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:c}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!c.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},cr=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=j(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){var d;let{from:e,to:t}=o,r=Be(c,s,(d=c.marks().find(e=>e.type===s))==null?void 0:d.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},lr=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},ur=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=R(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=k(e,r.schema)),s===`mark`&&(o=j(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},J=new C(`__tiptap_decorations__`),dr=e=>({tr:t,dispatch:n})=>(n&&t.setMeta(J,{type:`force`,name:e}),!0),fr=(e,t={})=>({state:n,dispatch:r})=>y(k(e,n.schema),t)(n,r),pr=(e,t={})=>({state:n,dispatch:r})=>ge(k(e,n.schema),t)(n,r);var mr=/* @__PURE__ */ xe({blur:()=>Se,clearContent:()=>Ce,clearNodes:()=>we,command:()=>Te,createParagraphNear:()=>Ee,cut:()=>De,deleteCurrentNode:()=>Oe,deleteNode:()=>ke,deleteRange:()=>Ae,deleteSelection:()=>Pe,enter:()=>Fe,exitCode:()=>Ie,extendMarkRange:()=>Ve,first:()=>He,focus:()=>Ke,forEach:()=>qe,insertContent:()=>Je,insertContentAt:()=>$e,insertDefaultBlock:()=>tt,joinBackward:()=>it,joinDown:()=>rt,joinForward:()=>at,joinItemBackward:()=>ot,joinItemForward:()=>st,joinTextblockBackward:()=>ct,joinTextblockForward:()=>lt,joinUp:()=>nt,keyboardShortcut:()=>ft,lift:()=>pt,liftEmptyBlock:()=>mt,liftListItem:()=>ht,newlineInCode:()=>gt,resetAttributes:()=>vt,scrollIntoView:()=>yt,selectAll:()=>bt,selectNodeBackward:()=>xt,selectNodeForward:()=>St,selectParentNode:()=>Ct,selectTextblockEnd:()=>wt,selectTextblockStart:()=>Tt,setContent:()=>Dt,setMark:()=>Vn,setMeta:()=>Hn,setNode:()=>Un,setNodeSelection:()=>Wn,setTextDirection:()=>Gn,setTextSelection:()=>Kn,sinkListItem:()=>qn,splitBlock:()=>Yn,splitListItem:()=>Xn,toggleList:()=>nr,toggleMark:()=>rr,toggleNode:()=>ir,toggleWrap:()=>ar,undoInputRule:()=>
7or,unsetAllMarks:()=>sr,unsetMark:()=>cr,unsetTextDirection:()=>lr,updateAttributes:()=>ur,updateDecorations:()=>dr,wrapIn:()=>fr,wrapInList:()=>pr});const Y=/* @__PURE__ */ new WeakMap;function hr(e,t){var n;Y.set(e,((n=Y.get(e))==null?0:n)+1);try{return t()}finally{var r;let t=((r=Y.get(e))==null?1:r)-1;t>0?Y.set(e,t):Y.delete(e)}}function gr(e){return Y.has(e)}var EventEmitter=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}};const _r=typeof process<`u`&&process.env.NODE_ENV!==`production`;function vr(e){return e.kind===`widget`}function yr(e,t){let n=[],r=/* @__PURE__ */ new Set;for(let i of e)i.kind===`widget`&&vr(i)&&r.add(i.key),n.push(i.toPMDecoration(t));return{decorations:n,widgetKeys:r}}
7function br(e,t,n){let{decorations:r,widgetKeys:i}=yr(t,n);return{set:E.create(e,r),widgetKeys:i}}function xr({position:e,from:t,to:n,docSize:r}){return e<t?!1:e<n?!0:e===n&&n===r}function Sr({decorations:e,from:t,to:n,docSize:r,extensionName:i,warnedExtensions:a}){return e.filter(e=>xr({position:e.anchor,from:t,to:n,docSize:r})?!0:(e.anchor===n||a.has(i)||(a.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)),!1))}function Cr(e){var t;let n=(t=e.spec)==null?void 0:t.key;return typeof n==`string`?n:void 0}function wr(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map;for(let o of e.find()){var r,i,a;let e=Cr(o);if(!e)continue;let s=(r=o.spec.extensionName)==null?`unknown`:r,c=(i=t.get(e))==null?/* @__PURE__ */ new Set:i;c.add(s),t.set(e,c),n.set(e,((a=n.get(e))==null?0:a)+1)}return Array.from(t,([e,t])=>({key:e,extensions:t})).filter(({key:e})=>{var t;return((t=n.get(e))==null?0:t)>1})}function Tr(e){return e.jsonID===`attr`}function Er(e){let t=!1;
7if(e.getMap().forEach(()=>{t=!0}),t||Tr(e))return!0;let n=e;return typeof n.from==`number`&&typeof n.to==`number`}function Dr(e,t){let n=null,r=0,i=0;for(let a=0;a<e.childCount&&!(i>t.to);a+=1){let o=i+e.child(a).nodeSize;o>=t.from&&(n===null&&(n=i),r=o),i=o}return n===null?null:{from:n,to:r}}function Or(e,t){if(e.steps.some(e=>!Er(e)))return{type:`full`};let n=on(e).map(({newRange:e})=>e);e.steps.forEach((t,r)=>{if(!Tr(t))return;let i=e.mapping.slice(r);n.push({from:i.map(t.pos,-1),to:i.map(t.pos+1)})});let r=[];for(let e of n){let n=Dr(t,e);n&&r.push(n)}r.sort((e,t)=>e.from-t.from);let i=[];for(let e of r){let t=i[i.length-1];t&&e.from<=t.to?t.to=Math.max(t.to,e.to):i.push({...e})}return{type:`ranges`,ranges:i}}function kr(e,t,n,r){return e.map(t,n,{onRemove:e=>{let t=e==null?void 0:e.key;typeof t==`string`&&r.delete(t)}})}function Ar(e,t,n){var r,i;let a=(r=t.decorationSetsByExtension[e])==null?E.empty:r,o=new Set((i=t.widgetKeysByExtension[e])==null?[]:i);return{set:kr(a,n.mapping,n.doc,o),widgetKeys:o}}function jr(e,t){let n=Object.values(t).flatMap(e=>e.find());return E.create(e,n)}function Mr(e){let t=/* @__PURE__ */ new Set;for(let n of Object.values(e))for(let e of n)t.add(e);return t}function Nr(e,t){var n;switch((n=t.update)==null?`document`:n){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".`)}}function Pr(e,t,n){return n?!0:e.update===`manual`?!1:e.shouldUpdate?e.shouldUpdate(t):t.tr.docChanged}const Fr=/* @__PURE__ */ new Set;function Ir(e){var t,n;return(t=(n=e.extensionManager)==null||(n=n.decorationManager)==null?void 0:n.liveWidgetKeys())==null?Fr:t}var DecorationManager=class{constructor(e){this.warnedWidgetKeys=/* @__PURE__ */ new Set,this.warnedOutOfRangeExtensions=/* @__PURE__ */ new Set,this.handleBeforeTransaction=({nextState:e})=>{let t=J.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=e.editor,this.entries=this.resolveEntries(e.entries),this.entries.forEach(({name:e,spec:t})=>Nr(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(e=(t=J.getState(this.editor.state))==null?void 0:t.widgetKeys)==null?Fr:e}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 w({key:J,state:{init:(e,n)=>{let r={},i={};for(let{name:e,spec:a}of t){let{set:t,widgetKeys:o}=this.buildFullSet(e,a,n);r[e]=t,i[e]=o}let a={decorationSetsByExtension:r,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(n.doc,r),widgetKeys:Mr(i)};return this.warnDuplicateWidgetKeys(a),a},apply:(n,r,i,a)=>{let o=n.getMeta(J),s=(o==null?void 0:o.type)===`force`&&!o.name,c=(o==null?void 0:o.type)===`force`?o.name:void 0,l={},u={},d=/* @__PURE__ */ new Set;return hr(e,()=>{for(let{name:o,spec:f}of t){let t=s||c===o;if(!Pr(f,{editor:e,tr:n,oldState:i,newState:a},t)){let e=Ar(o,r,n);l[o]=e.set,u[o]=e.widgetKeys}else if(f.update===`changedRanges`&&n.docChanged&&!t){let e=this.applyChangedRangesRecompute(o,f,r,n,a);l[o]=e.set,u[o]=e.widgetKeys,d.add(o)}else{let{set:e,widgetKeys:t}=this.buildFullSet(o,f,a);l[o]=e,u[o]=t,d.add(o)}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:l,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:n,decorationSetsByExtension:l,recomputedNames:d}),widgetKeys:Mr(u)}}},props:{decorations(e){var t,n;return(t=(n=J.getState(e))==null?void 0:n.mergedDecorationSet)==null?E.empty:t}}})}applyChangedRangesRecompute(e,t,n,r,i){let a=Or(r,i.doc);return a.type===`full`?this.buildFullSet(e,t,i):this.rebuildRanges(e,t,n,r,i,a.ranges)}rebuildRanges(e,t,n,r,i,a){var o,s;let c=(o=n.decorationSetsByExtension[e])==null?E.empty:o,l=new Set((s=n.widgetKeysByExtension[e])==null?[]:s),u=kr(c,r.mapping,r.doc,l),d=i.doc.content.size;
7for(let{from:n,to:r}of a){let a=u.find(n,r).filter(e=>xr({position:e.from,from:n,to:r,docSize:d}));for(let e of a){let t=Cr(e);t&&l.delete(t)}u=u.remove(a);let{decorations:o,widgetKeys:s}=yr(Sr({decorations:this.runCreate(e,`createInRange`,()=>t.createInRange({editor:this.editor,state:i,view:this.mountedView,from:n,to:r})),from:n,to:r,docSize:d,extensionName:e,warnedExtensions:this.warnedOutOfRangeExtensions}),e);u=u.add(i.doc,o);for(let e of s)l.add(e)}return{set:u,widgetKeys:l}}buildFullSet(e,t,n){let r=this.runCreate(e,`create`,()=>t.create({editor:this.editor,state:n,view:this.mountedView}));return br(n.doc,r,e)}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(!_r)return;if(e.widgetKeys.size===0){this.warnedWidgetKeys.clear();return}let t=wr(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${n.size===1?``:`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 n.length===1?t[n[0]]:jr(e,t)}mergeAfterApply({entries:e,previous:t,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return e.length===1?r[e[0].name]:i.size===0?t.mergedDecorationSet.map(n.mapping,n.doc):jr(n.doc,r)}};function Lr(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>Object.prototype.hasOwnProperty.call(t,n)&&Object.is(e[n],t[n])):!1}function Rr(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof S){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function zr(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)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}function Br(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)}function Vr(e,t){let n=e.getAttribute(`style`);if(!n)return null;let r=n.split(`;`).map(e=>e.trim()).filter(Boolean),i=t.toLowerCase();for(let e=r.length-1;e>=0;--e){let t=r[e],n=t.indexOf(`:`);if(n!==-1&&t.slice(0,n).trim().toLowerCase()===i)return t.slice(n+1).trim()}return null}function Hr(e){return e.replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`).replace(/&amp;/g,`&`)}function Ur(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function Wr(){return typeof navigator<`u`?/Firefox/.test(navigator.userAgent):!1}function Gr(e){return typeof e==`number`}function Kr(e){return Object.prototype.toString.call(e).slice(8,-1)}function X(e){return Kr(e)===`Object`?e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype:!1}function qr(e){return typeof e==`string`}function Jr(e){return/\s/.test(e)}function Yr(e){return/^[a-zA-Z]$/.test(e)}function Xr(e){return/^\w$/.test(e)}function Zr(e,t){for(;t<e.length&&Jr(e[t]);)t+=1;return t}function Z(e,t){for(;t<e.length&&!Jr(e[t]);)t+=1;return t}function Qr(e,t,n){for(;t<e.length&&(Xr(e[t])||n&&e[t]===`-`);)t+=1;return t}function $r(e,t){let n=e[t],r=t+1,i=Qr(e,r,!0);return i===r?{nextIndex:Z(e,i)}:{token:{type:n===`.`?`class`:`id`,name:e.slice(r,i)},nextIndex:Z(e,i)}}function ei(e,t){let n=e.indexOf(e[t],t+1);return{nextIndex:Z(e,n===-1?t:n+1)}}function ti(e,t,n,r){let i=r?Zr(e,n):n;if(e[i]!==`=`)return;i=r?Zr(e,i+1):i+1;let a=e[i];if(a!==`"`&&a!==`'`)return;let o=e.indexOf(a,i+1);if(o!==-1)return{token:{type:`keyValue`,name:t,value:e.slice(i+1,o)},nextIndex:Z(e,o+1)}}function ni(e,t,n){let r=n===`pandoc`,i=Qr(e,t+1,r),a=e.slice(t,i),o=ti(e,a,i,r);if(o)return o;let s=i===e.length||Jr(e[i]);return{token:r&&s?{type:`boolean`,name:a}:void 0,nextIndex:n===`shortcode`?Z(e,i):i}}function ri(e,t,n){let r=e[t];return n===`pandoc`&&(r===`.`||r===`#`)?$r(e,t):r===`"`||r===`'`?ei(e,t):(n===`pandoc`?Yr(r):Xr(r))?ni(e,t,n):{nextIndex:Z(e,t)}}function ii(e,t){let n=[],r=0;for(;r<e.length&&(r=Zr(e,r),!(r>=e.length));){let i=ri(e,r,t);i.token&&n.push(i.token),r=i.nextIndex}return n}function ai(e){let t={},n=e.filter(e=>e.type===`class`).map(e=>e.name),r=e.find(e=>e.type===`id`);return n.length>
70&&(t.class=n.join(` `)),r&&(t.id=r.name),e.forEach(e=>{e.type===`keyValue`&&(t[e.name]=e.value)}),e.forEach(e=>{e.type===`boolean`&&(t[e.name]=!0)}),t}function oi(e){return e!=null&&e.trim()?ai(ii(e,`pandoc`)):{}}function si(e){if(!e||Object.keys(e).length===0)return``;let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{e===`class`||e===`id`||(n===!0?t.push(e):n!==!1&&n!=null&&t.push(`${e}="${String(n)}"`))}),t.join(` `)}function ci(e){let{nodeName:t,name:n,parseAttributes:r=oi,serializeAttributes:i=si,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,c=n||t,l=e=>{if(!s)return e;let t={};return s.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let r={...a,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:`block`,start(e){var t;let n=RegExp(`^:::${c}(?:\\s|$)`,`m`),r=(t=e.match(n))==null?void 0:t.index;return r===void 0?-1:r},tokenize(e,n,i){let a=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),s=e.match(a);if(!s)return;let l=r(s[1]||``);if(!o.find(e=>!(e in l)))return{type:t,raw:s[0],attributes:l}}},renderMarkdown:e=>{let t=i(l(e.attrs||{}));return`:::${c}${t?` {${t}}`:``} :::`}}}function li(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=oi,serializeAttributes:a=si,defaultAttributes:o={},content:s=`block`,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{n in e&&(t[n]=e[n])}),t};return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i=typeof t==`string`?[{type:`text`,text:t}]:t}else i=s===`block`?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let a={...o,...e.attributes};return n.createNode(t,a,i)},markdownTokenizer:{name:t,level:`block`,start(e){var t;let n=RegExp(`^:::${l}`,`m`),r=(t=e.match(n))==null?void 0:t.index;return r===void 0?-1:r},tokenize(e,n,r){let a=RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),o=e.match(a);if(!o)return;let[c,u=``]=o,d=i(u),f=1,p=c.length,m=``,h=/^:::([\w-]*)(\s.*)?/gm,g=e.slice(p);for(h.lastIndex=0;;){var _;let n=h.exec(g);if(n===null)break;let i=n.index,a=n[1];if(!((_=n[2])!=null&&_.endsWith(`:::`))){if(a)f+=1;else if(--f,f===0){let a=g.slice(0,i);m=a.trim();let o=e.slice(0,p+i+n[0].length),c=[];if(m)if(s===`block`)for(c=r.blockTokens(a),c.forEach(e=>{e.text&&(!e.tokens||e.tokens.length===0)&&(e.tokens=r.inlineTokens(e.text))});c.length>0;){let e=c[c.length-1];if(e.type===`paragraph`&&(!e.text||e.text.trim()===``))c.pop();else break}else c=r.inlineTokens(m);return{type:t,raw:o,attributes:d,content:m,tokens:c}}}}}},renderMarkdown:(e,t)=>{let n=a(u(e.attrs||{}));return`:::${l}${n?` {${n}}`:``}\n\n${t.renderChildren(e.content||[],`
8
9`)}\n\n:::`}}}function ui(e){let t={};return ii(e,`shortcode`).forEach(e=>{e.type===`keyValue`&&(t[e.name]=e.value)}),t}function di(e){return Object.entries(e).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(` `)}function fi(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=ui,serializeAttributes:a=di,defaultAttributes:o={},selfClosing:s=!1,allowedAttributes:c}=e,l=n||t,u=e=>{if(!c)return e;let t={};return c.forEach(n=>{let r=typeof n==`string`?n:n.name,i=typeof n==`string`?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(i!==void 0&&n===i)return;t[r]=n}}),t},d=l.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return{parseMarkdown:(e,n)=>{let i={...o,...e.attributes};if(s)return n.createNode(t,i);let a=r?r(e):e.content||``;return a?n.createNode(t,i,[n.createTextNode(a)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:`inline`,start(e){let t=RegExp(s?`\\[${d}\\s*[^\\]]*\\]`:`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t),r=n==null?void 0:n.index;return r===void 0?-1:r},tokenize(e,n,r){let a=RegExp(s?`^\\[${d}\\s*([^\\]]*)\\]`:`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),o=e.match(a);if(!o)return;let c=``,l=``;if(s){let[,e]=o;l=e}else{let[,e,t]=o;l=e,c=t||``}let u=i(l.trim());return{type:t,raw:o[0],content:c.trim(),attributes:u}}},renderMarkdown:e=>{let t=``;r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>e.type===`text`).map(e=>e.text).join(``));let n=a(u(e.attrs||{})),i=n?` ${n}`:``;return s?`[${l}${i}]`:`[${l}${i}]${t}[/${l}]`}}}function pi(e,t,n){let r=e.split(`
10`),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],u=e.match(t.itemPattern);if(!u){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e}\n`;continue}else return}let d=t.extractItemData(u),{indentLevel:f,mainContent:p}=d;a=`${a}${e}\n`;let m=[p];for(o+=1;o<r.length;){var c;let e=r[o];if(e.trim()===``){var l;let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((((l=r[o+1+t].match(/^(\s*)/))==null||(l=l[1])==null?void 0:l.length)||0)>f){m.push(e),a=`${a}${e}\n`,o+=1;continue}else break}if((((c=e.match(/^(\s*)/))==null||(c=c[1])==null?void 0:c.length)||0)>f)m.push(e),a=`${a}${e}\n`,o+=1;else break}let h,g=m.slice(1);if(g.length>0){let e=g.map(e=>e.slice(f+s)).join(`
11`);e.trim()&&(h=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let _=t.createToken(d,h);i.push(_)}if(i.length!==0)return{items:i,raw:a}}const mi=4;function hi(e){let t=0;for(let n of e)t=n===`	`?t+4-t%4:t+1;return t}function gi(e,t,n,r,i){if(!e||!Array.isArray(e.content))return``;let a=typeof n==`function`?n(r):n,[o,...s]=e.content,c=`${a}${t.renderChildren([o])}`;return s&&s.length>
110&&s.forEach((e,n)=>{var r,o;let s=(r=(o=t.renderChild)==null?void 0:o.call(t,e,n+1))==null?t.renderChildren([e]):r;if(s!=null){let n=e=>{if(!(i!=null&&i.alignNestedToPrefix))return t.indent(e);let n=t.indent(``),r=hi(a);return(hi(n)>=r?n:` `.repeat(r))+e},r=s.split(`
12`).map(e=>n(e||``)).join(`
13`);c+=e.type===`paragraph`?`\n\n${r}`:`\n${r}`}}),c}var _i=/* @__PURE__ */ xe({createAtomBlockMarkdownSpec:()=>ci,createBlockMarkdownSpec:()=>li,createInlineMarkdownSpec:()=>fi,parseAttributes:()=>oi,parseIndentedBlocks:()=>pi,renderNestedMarkdownContent:()=>gi,serializeAttributes:()=>si});function vi(e){return typeof e.type==`string`?e.type:e.type.name}function yi(e,t){if(e.length!==t.length)return!1;let n=Array.from({length:t.length},()=>!1);return e.every(e=>{let r=vi(e),i=t.findIndex((t,i)=>!n[i]&&r===vi(t)&&Lr(e.attrs,t.attrs));return i===-1?!1:(n[i]=!0,!0)})}function bi(e,t){let n={...e};return X(e)&&X(t)&&Object.keys(t).forEach(r=>{X(t[r])&&X(e[r])?n[r]=bi(e[r],t[r]):n[r]=t[r]}),n}function xi(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var MarkView=class{constructor(e,t,n){this.component=e,this.editor=t.editor,this.options={...n},this.mark=t.mark,this.HTMLAttributes=t.HTMLAttributes}get dom(){return this.editor.view.dom}get contentDOM(){return null}updateAttributes(e,t){xi(t||this.mark,this.editor,e)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation==`function`?this.options.ignoreMutation({mutation:e}):e.type===`selection`||this.contentDOM.contains(e.target)&&e.type===`childList`&&(P()||N())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===e.target&&e.type===`attributes`?!0:!this.contentDOM.contains(e.target)}},InputRule=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=(t=e.undoable)==null?!0:t}};const Si=(e,t)=>{if(Le(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 Ci(e){var t;let{editor:n,from:r,to:i,text:a,rules:o,plugin:s}=e,{view:c}=n;if(c.composing)return!1;let l=c.state.doc.resolve(r);if(l.parent.type.spec.code||(t=l.nodeBefore||l.nodeAfter)!=null&&t.marks.find(e=>e.type.spec.code))return!1;let u=!1,d=dn(l)+a;return o.forEach(e=>{if(u)return;let t=Si(d,e.find);if(!t)return;let o=t[0].length-a.length;if(o>0){let e=l.parentOffset-o;if(e<0||l.parent.textBetween(e,l.parentOffset)!==t[0].slice(0,o))return}let f=c.state.tr,p=D({state:c.state,transaction:f}),m={from:r-(t[0].length-a.length),to:i}
13,{commands:h,chain:g,can:_}=new O({editor:n,state:p});e.handler({state:p,range:m,match:t,commands:h,chain:g,can:_})===null||!f.steps.length||(e.undoable&&f.setMeta(s,{transform:f,from:r,to:i,text:a}),c.dispatch(f),u=!0)}),u}function wi(e){let{editor:t,rules:n}=e,r=new w({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:B(T.from(e),a.schema);let{from:i}=s;Ci({editor:t,from:i,to:i+e.length,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return Ci({editor:t,from:i,to:a,text:o,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&Ci({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?Ci({editor:t,from:a.pos,to:a.pos,text:`
14`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var Extendable=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{...V(z(this,`addOptions`,{name:this.name}))}}get storage(){return{...V(z(this,`addStorage`,{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>bi(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}},Ti=class Mark extends Extendable{constructor(...e){super(...e),this.type=`mark`}static create(e={}){return new Mark(typeof e==`function`?e():e)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>(e==null?void 0:e.type.name)===t.name))return!1;let a=i.find(e=>(e==null?void 0:e.type.name)===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},PasteRule=class{constructor(e){this.find=e.find,this.handler=e.handler}};const Ei=(e,t,n)=>{if(Le(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}):[]};function Di(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new O({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{var f,p,m,h;if(!((f=e.type)==null||(f=f.spec)==null)&&f.code||!(e.isText||e.isTextblock||e.isInline))return;let g=(p=(m=(h=e.content)==null?void 0:h.size)==null?e.nodeSize:m)==null?0:p,_=Math.max(r,t),ee=Math.min(i,t+g);_>=ee||Ei(e.isText?e.text||``:e.textBetween(_-t,ee-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=_+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}let Oi=null;const ki=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function Ai(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr;if(!(!Di({editor:t,state:D({state:e,transaction:c}),from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})||!c.steps.length)){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return n.map(e=>new w({view(e){let n=n=>{var i;r=(i=e.dom.parentElement)!=null&&i.contains(n.target)?e.dom.parentElement:null,r&&(Oi=t)},i=()=>{Oi&&(Oi=null)};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=Oi;e!=null&&e.isEditable&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>
14{var n;let r=(n=t.clipboardData)==null?void 0:n.getData(`text/html`);return o=t,i=!!(r!=null&&r.includes(`data-pm-slice`)),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:B(T.from(t),r.schema);let{from:n}=d,i=n+t.length,a=ki(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(!(!Gr(p)||!m||p===m.b))return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var ExtensionManager=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=e,this.extensions=qt(e),this.schema=Gt(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=z(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:G(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this,t=W([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:G(t.name,this.schema)},r=[],i=z(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&z(t,`exitable`,n)&&(a.ArrowRight=()=>Ti.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=ye(a);r.push(o);let s=z(t,`addInputRules`,n);if(gn(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=wi({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=z(t,`addPasteRules`,n);if(gn(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=Ai({editor:e,rules:t});r.push(...n)}}let l=z(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r}),n=this.createDecorationPlugin();return n&&t.push(n),t}createDecorationPlugin(){var e;let{editor:t}=this;(e=this.decorationManager)==null||e.destroy();let n=[];return this.extensions.forEach(e=>{let r=z(e,`addDecorations`,{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:G(e.name,this.schema)});r&&n.push({name:e.name,addDecorations:r})}),this.decorationManager=new DecorationManager({editor:t,entries:n}),this.decorationManager.plugin}get attributes(){return Lt(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=H(this.extensions);return Object.fromEntries(t.filter(e=>!!z(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=z(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:k(t.name,this.schema)});if(!r)return[];let i=r();if(!i)return[];let a=(r,a,o,s,c)=>i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:U(r,n)});return[t.name,a]}))}dispatchTransaction(e){let{editor:t}=this;return W([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:G(n.name,this.schema)},i=z(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return W([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:G(n.name,this.schema)},i=z(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=H(this.extensions);return Object.fromEntries(t.filter(e=>!!z(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=z(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:j(t.name,this.schema)});if(!r)return[];let i=(i,a,o)=>{let s=U(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{xi(i,e,t)}})};return[t.name,i]}))}destroy(){var e;(e=this.decorationManager)==null||e.destroy(),this.extensions.forEach(e
14=>{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:G(e.name,this.schema)};if(e.type===`mark`){var n,r;((n=V(z(e,`keepOnSplit`,t)))==null||n)&&this.splittableMarks.push(e.name),(r=V(z(e,`clearable`,t)))==null||r||this.nonClearableMarks.push(e.name)}let i=z(e,`onBeforeCreate`,t),a=z(e,`onCreate`,t),o=z(e,`onUpdate`,t),s=z(e,`onSelectionUpdate`,t),c=z(e,`onTransaction`,t),l=z(e,`onFocus`,t),u=z(e,`onBlur`,t),d=z(e,`onDestroy`,t);i&&this.editor.on(`beforeCreate`,i),a&&this.editor.on(`create`,a),o&&this.editor.on(`update`,o),s&&this.editor.on(`selectionUpdate`,s),c&&this.editor.on(`transaction`,c),l&&this.editor.on(`focus`,l),u&&this.editor.on(`blur`,u),d&&this.editor.on(`destroy`,d)})}};ExtensionManager.resolve=qt,ExtensionManager.sort=W,ExtensionManager.flatten=Pt;var Q=class Extension extends Extendable{constructor(...e){super(...e),this.type=`extension`}static create(e={}){return new Extension(typeof e==`function`?e():e)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};const ji=Q.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new w({key:new C(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=$t(n),{blockSeparator:o}=this.options,s={...o===void 0?{}:{blockSeparator:o},textSerializers:a};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>Zt(r,{from:e.pos,to:t.pos},s)).join(o==null?`
15
16`:o)}}})]}}),Mi=Q.create({name:`commands`,addCommands(){return{...mr}}}),Ni=Q.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){var n,r;let i=()=>{var n,r,i;if((n=(r=this.editor.options.coreExtensionOptions)==null||(r=r.delete)==null||(i=r.filterTransaction)==null?void 0:i.call(r,e))==null?e.getMeta(`y-sync$`):n)return;let a=kt(e.before,[e,...t]);on(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 i=r+n.nodeSize-2,o=t.oldRange.from<=r&&i<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:r,to:i,newFrom:a.mapping.map(r),newTo:a.mapping.map(i),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:a})})});let o=a.mapping;a.steps.forEach((t,n)=>{if(t instanceof s){var r,i;let s=o.slice(n).map(t.from,-1),c=o.slice(n).map(t.to),l=o.invert().map(s,-1),u=o.invert().map(c),d=s>0?(r=a.doc.nodeAt(s-1))==null?void 0:r.marks.some(e=>e.eq(t.mark)):!1,f=(i=a.doc.nodeAt(c))==null?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:l,to:u},newRange:{from:s,to:c},partial:!!(f||d),editor:this.editor,transaction:e,combinedTransform:a})}})};(n=(r=this.editor.options.coreExtensionOptions)==null||(r=r.delete)==null?void 0:r.async)==null||n?setTimeout(i,0):i()}}),Pi=Q.create({name:`drop`,addProseMirrorPlugins(){return[new w({key:new C(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Fi=Q.create({name:`editable`,addProseMirrorPlugins(){return[new w({key:new C(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),Ii=new C(`focusEvents`),Li=Q.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new w({key:Ii,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}}}})]}}),Ri=Q.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:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:x.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n=()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),r={Enter:n,"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()},i={...r},a={...r,"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 P()||ut()?a:i},addProseMirrorPlugins(){return[new w({key:new C(`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),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=x.atStart(t.doc).from,l=x.atEnd(t.doc).to;
16if(a||!(o===c&&s===l)||!vn(n.doc))return;let u=n.tr,d=D({state:n,transaction:u}),{commands:f}=new O({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),zi=Q.create({name:`paste`,addProseMirrorPlugins(){return[new w({key:new C(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),Bi=Q.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new w({key:new C(`tabindex`),props:{attributes:()=>{var e;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(e=this.options.value)==null?`0`:e}}}})]}}),Vi=Q.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=H(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new w({key:new C(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}});var Hi=/* @__PURE__ */ xe({ClipboardTextSerializer:()=>ji,Commands:()=>Mi,Delete:()=>Ni,Drop:()=>Pi,Editable:()=>Fi,FocusEvents:()=>Li,Keymap:()=>Ri,Paste:()=>zi,Tabindex:()=>Bi,TextDirection:()=>Vi,focusEventsPluginKey:()=>Ii});let Ui=!1;function Wi(e){if(Ui)return;Ui=!0;let n;try{n=t.fromJSON(e,{from:0,to:0}).slice.content}catch{return}n instanceof T||console.warn(`[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.`)}var Gi=class NodePos{get name(){return this.node.type.name}constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)==null?this.resolvedPos.depth:e}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(this.content.size===0){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}get parent(){if(this.depth===0)return null;let e=this.resolvedPos.start(this.resolvedPos.depth-1);return new NodePos(this.resolvedPos.doc.resolve(e),this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new 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=t.isAtom&&!t.isText,a=t.isInline,o=this.pos+n+ +!i;if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;let s=this.resolvedPos.doc.resolve(o);if(!r&&!a&&s.depth<=this.depth)return;let c=new NodePos(s,this.editor,r,r||a?t:null);r&&(c.actualDepth=this.depth+1),e.push(c)}),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=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);
16return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}};const Ki=`.ProseMirror {
17  position: relative;
18}
19
20.ProseMirror {
21  word-wrap: break-word;
22  white-space: pre-wrap;
23  white-space: break-spaces;
24  -webkit-font-variant-ligatures: none;
25  font-variant-ligatures: none;
26  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
27}
28
29.ProseMirror [contenteditable="false"] {
30  white-space: normal;
31}
32
33.ProseMirror [contenteditable="false"] [contenteditable="true"] {
34  white-space: pre-wrap;
35}
36
37.ProseMirror pre {
38  white-space: pre-wrap;
39}
40
41img.ProseMirror-separator {
42  display: inline !important;
43  border: none !important;
44  margin: 0 !important;
45  width: 0 !important;
46  height: 0 !important;
47}
48
49.ProseMirror-gapcursor {
50  display: none;
51  pointer-events: none;
52  position: absolute;
53  margin: 0;
54}
55
56.ProseMirror-gapcursor:after {
57  content: "";
58  display: block;
59  position: absolute;
60  top: -2px;
61  width: 20px;
62  border-top: 1px solid black;
63  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
64}
65
66@keyframes ProseMirror-cursor-blink {
67  to {
68    visibility: hidden;
69  }
70}
71
72.ProseMirror-hideselection *::selection {
73  background: transparent;
74}
75
76.ProseMirror-hideselection *::-moz-selection {
77  background: transparent;
78}
79
80.ProseMirror-hideselection * {
81  caret-color: transparent;
82}
83
84.ProseMirror-focused .ProseMirror-gapcursor {
85  display: block;
86}`;var Editor=class extends EventEmitter{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Fn,createMappablePosition:In},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc();if(!this.editorState){let e=We(t,this.options.autofocus);this.editorState=ce.create({doc:t,schema:this.schema,selection:e||void 0})}Wi(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit
86(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;let e=this.editorView.dom;e!=null&&e.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():O.createFakeChain()}can(){return this.commandManager?this.commandManager.can():O.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=zr(`.ProseMirror {
87  position: relative;
88}
89
90.ProseMirror {
91  word-wrap: break-word;
92  white-space: pre-wrap;
93  white-space: break-spaces;
94  -webkit-font-variant-ligatures: none;
95  font-variant-ligatures: none;
96  font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
97}
98
99.ProseMirror [contenteditable="false"] {
100  white-space: normal;
101}
102
103.ProseMirror [contenteditable="false"] [contenteditable="true"] {
104  white-space: pre-wrap;
105}
106
107.ProseMirror pre {
108  white-space: pre-wrap;
109}
110
111img.ProseMirror-separator {
112  display: inline !important;
113  border: none !important;
114  margin: 0 !important;
115  width: 0 !important;
116  height: 0 !important;
117}
118
119.ProseMirror-gapcursor {
120  display: none;
121  pointer-events: none;
122  position: absolute;
123  margin: 0;
124}
125
126.ProseMirror-gapcursor:after {
127  content: "";
128  display: block;
129  position: absolute;
130  top: -2px;
131  width: 20px;
132  border-top: 1px solid black;
133  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
134}
135
136@keyframes ProseMirror-cursor-blink {
137  to {
138    visibility: hidden;
139  }
140}
141
142.ProseMirror-hideselection *::selection {
143  background: transparent;
144}
145
146.ProseMirror-hideselection *::-moz-selection {
147  background: transparent;
148}
149
150.ProseMirror-hideselection * {
151  caret-color: transparent;
152}
153
154.ProseMirror-focused .ProseMirror-gapcursor {
155  display: block;
156}`,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!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,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return _r&&!this.hasWarnedStaleDecorationRead&&gr(this)&&(this.hasWarnedStaleDecorationRead=!0,console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=Ft(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[Fi,ji.configure({blockSeparator:(e=this.options.coreExtensionOptions)==null||(e=e.clipboardTextSeri
156alizer)==null?void 0:e.blockSeparator}),Mi,Li,Ri,Bi.configure({value:(t=this.options.coreExtensionOptions)==null||(t=t.tabindex)==null?void 0:t.value}),Pi,zi,Ni,Vi.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions==`object`?this.options.enableCoreExtensions[e.name]!==!1:!0):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e==null?void 0:e.type));this.extensionManager=new ExtensionManager(n,this)}createCommandManager(){this.commandManager=new O({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Et(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(e.message))throw e;let t=Et(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=ce.create({doc:t,schema:this.schema,selection:We(t,this.options.autofocus)||void 0}),this.emit(`contentError`,{editor:this,error:e,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),this.editorState.doc}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new _e(e,{...t,attributes:{role:`textbox`,...t==null?void 0:t.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>{var t;return(t=this.capturedTransaction)==null?void 0:t.step(e)});return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o==null?void 0:o.getMeta(`focus`),c=o==null?void 0:o.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return nn(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return pn(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return B(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
157
158`,textSerializers:n={}}=e||{};return Qt(this.state.doc,{blockSeparator:t,textSerializers:{...$t(this.schema),...n}})}get isEmpty(){return vn(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)==null?!0:e}$node(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;
158return new Gi(t,this,!1,n)}get $doc(){return this.$pos(0)}},Decoration=class{static Inline(e,t,n={},r){return new InlineDecoration(e,t,n,r)}static Node(e,t,n={},r){return new NodeDecoration(e,t,n,r)}static Widget(e,t,n){let{key:r,...i}=n;return new WidgetDecoration(e,t,r,i)}},InlineDecoration=class extends Decoration{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 ve.inline(this.from,this.to,this.attrs,t)}},NodeDecoration=class extends Decoration{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 ve.node(this.from,this.to,this.attrs,t)}},WidgetDecoration=class extends Decoration{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 ve.widget(this.pos,this.render,t)}};function qi(e,t){let n=e,r=n[t];if(!r){r={renderers:/* @__PURE__ */ new Map,props:/* @__PURE__ */ new Map,pendingProps:/* @__PURE__ */ new Map,flushScheduled:!1},n[t]=r;let i=r;e.on(`destroy`,()=>{i.pendingProps.clear(),i.renderers.forEach(e=>e.destroy()),i.renderers.clear(),i.props.clear()})}return r}function Ji(e){e.flushScheduled=!1;for(let[t,n]of e.pendingProps){let r=e.renderers.get(t);r&&(r.updateProps(n),e.props.set(t,{...n}))}e.pendingProps.clear()}function Yi(e){let{editor:t,pos:n,key:r,props:i,cacheKey:a,context:o,create:s,materialize:c,side:l,relaxedSide:u,marks:d,stopEvent:f,ignoreSelection:p,destroy:m}=e,h=qi(t,a);if(h.renderers.has(r)){var g;let e=(g=h.pendingProps.get(r))==null?h.props.get(r):g;(!e||!Lr(e,i))&&(h.pendingProps.set(r,i),h.flushScheduled||(h.flushScheduled=!0,queueMicrotask(()=>Ji(h))))}let _=(e,t)=>{let n={...i,...o(t)},a=h.renderers.get(r);return a?a.updateProps(n):(a=s(n),h.renderers.set(r,a),h.props.set(r,{...i})),c(a)};return Decoration.Widget(n,_,{key:r,side:l,relaxedSide:u,marks:d,stopEvent:f,ignoreSelection:p,destroy:e=>{if(!Ir(t).has(r))try{var n;(n=h.renderers.get(r))==null||n.destroy(),h.renderers.delete(r),h.props.delete(r),h.pendingProps.delete(r)}finally{m==null||m(e)}}})}function Xi(e){return new InputRule({find:e.find,handler:({state:t,range:n,match:r})=>{let i=V(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(cn(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;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function Zi(e){return new InputRule({find:e.find,handler:({state:t,range:n,match:r})=>{let i=V(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function Qi(e){return new InputRule({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=V(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,a)},undoable:e.undoable})}function $i(e){return new InputRule({find:e.find,handler:({state:t,range:n,match:r})=>{let i=e.replace,a=n.from,o=n.to;if(r[1]){let e=r[0].lastIndexOf(r[1]);i+=r[0].slice(e+r[1].length),a+=e;let t=a-o;t>0&&(i=r[0].slice(e-t,e)+i,a=o)}t.tr.insertText(i,a,o)},undoable:e.undoable})}function ea(e){return new InputRule({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=V(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),u=l&&c(l,e.type,a);if(!u)return null;if(s.wrap(l,u),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>
158i.includes(e.type.name));s.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let d=s.doc.resolve(n.from-1).nodeBefore;d&&d.type===e.type&&o(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,d))&&s.join(n.from-1)},undoable:e.undoable})}const ta=/* @__PURE__ */ new WeakSet,na=/* @__PURE__ */ new WeakSet;function $(e){let t=e;return ta.add(t),t}function ra(e){return Array.isArray(e)&&ta.has(e)}function ia(e){return e.flatMap(e=>e==null?[]:Array.isArray(e)&&na.has(e)&&!ra(e)?ia(e):[e])}function aa(e){return na.add(e.children),e.children}function oa(e,t){if(e===`slot`)return 0;if(e instanceof Function){let n=e(t);return Array.isArray(n)&&!ra(n)&&!na.has(n)?$(n):n}let{children:n,...r}=t==null?{}:t;if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);if(Array.isArray(n)){if(ra(n))return $([e,r,n]);if(n.length===0)return $([e,r]);let t=ia(n);return t.length===0?$([e,r]):$([e,r,...t])}return $(n==null?[e,r]:[e,r,n])}const sa=(e,t)=>oa(e,t),ca=e=>`touches`in e;var ResizableNodeView=class{constructor(e){var t,n,r,i,a,o;this.directions=[`bottom-left`,`bottom-right`,`top-left`,`top-right`],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:``,wrapper:``,handle:``,resizing:``},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=/* @__PURE__ */ new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;let t=e.touches[0];if(!t)return;let n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;let e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`keydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp)},this.handleKeyDown=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{e.key===`Shift`&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.element.draggable=!1,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,(t=e.options)!=null&&t.min&&(this.minSize={...this.minSize,...e.options.min}),(n=e.options)!=null&&n.max&&(this.maxSize=e.options.max),!(e==null||(r=e.options)==null)&&r.directions&&(this.directions=e.options.directions),(i=e.options)!=null&&i.preserveAspectRatio&&(this.preserveAspectRatio=e.options.preserveAspectRatio),(a=e.options)!=null&&a.className&&(this.classNames={container:e.options.className.container||``,wrapper:e.options.className.wrapper||``,handle:e.options.className.handle||``,resizing:e.options.className.resizing||``}),(o=e.options)!=null&&o.createCustomHandle&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on(`update`,this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var e;return(e=this.contentElement)==null?null:e}handleEditorUpdate(){let e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type?(this.node=e,this.onUpdate?this.onUpdate(e,t,n):!0):!1}destroy(){this.isResizing&&(this.container.dataset.resizeState=`false`,this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener(`mousemove`,this.handleMouseMove),document.removeEventListener(`mouseup`,this.handleMouseUp),document.removeEventListener(`ke
158ydown`,this.handleKeyDown),document.removeEventListener(`keyup`,this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off(`update`,this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let e=document.createElement(`div`);return e.dataset.resizeContainer=``,e.dataset.node=this.node.type.name,e.style.display=this.node.type.isInline?`inline-flex`:`flex`,this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){let e=document.createElement(`div`);return e.style.position=`relative`,e.style.display=`block`,e.dataset.resizeWrapper=``,this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){let t=document.createElement(`div`);return t.dataset.resizeHandle=e,t.style.position=`absolute`,this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){let n=t.includes(`top`),r=t.includes(`bottom`),i=t.includes(`left`),a=t.includes(`right`);n&&(e.style.top=`0`),r&&(e.style.bottom=`0`),i&&(e.style.left=`0`),a&&(e.style.right=`0`),(t===`top`||t===`bottom`)&&(e.style.left=`0`,e.style.right=`0`),(t===`left`||t===`right`)&&(e.style.top=`0`,e.style.bottom=`0`)}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener(`mousedown`,t=>this.handleResizeStart(t,e)),t.addEventListener(`touchstart`,t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){let e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,ca(e)?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState=`true`,this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener(`mousemove`,this.handleMouseMove),document.addEventListener(`touchmove`,this.handleTouchMove),document.addEventListener(`mouseup`,this.handleMouseUp),document.addEventListener(`keydown`,this.handleKeyDown),document.addEventListener(`keyup`,this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:i}=this.calculateNewDimensions(this.activeHandle,e,t),a=this.applyConstraints(r,i,n);this.element.style.width=`${a.width}px`,this.element.style.height=`${a.height}px`,this.onResize&&this.onResize(a.width,a.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,i=this.startHeight,a=e.includes(`right`),o=e.includes(`left`),s=e.includes(`bottom`),c=e.includes(`top`);return a?r=this.startWidth+t:o&&(r=this.startWidth-t),s?i=this.startHeight+n:c&&(i=this.startHeight-n),(e===`right`||e===`left`)&&(r=this.startWidth+(a?t:-t)),(e===`top`||e===`bottom`)&&(i=this.startHeight+(s?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,i,e):{width:r,height:i}}applyConstraints(e,t,n){var r,i;if(!n){var a,o;let n=Math.max(this.minSize.width,e),r=Math.max(this.minSize.height,t);return(a=this.maxSize)!=null&&a.width&&(n=Math.min(this.maxSize.width,n)),(o=this.maxSize)!=null&&o.height&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let s=e,c=t;return s<this.minSize.width&&(s=this.minSize.width,c=s/this.aspectRatio),c<this.minSize.height&&(c=this.minSize.height,s=c*this.aspectRatio),(r=this.maxSize)!=null&&r.width&&s>this.maxSize.width&&(s=this.maxSize.width,c=s/this.aspectRatio),(i=this.maxSize)!=null&&i.height&&c>this.maxSize.height&&(c=this.maxSize.height,s=c*this.aspectRatio),{width:s,height:c}}applyAspectRatio(e,t,n){return n===`left`||n===`right`?{width:e,height:e/this.aspectRatio}:n===`top`||n===`bottom`?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}};const la=ResizableNodeView;
158var ua=class Node extends Extendable{constructor(...e){super(...e),this.type=`node`}static create(e={}){return new Node(typeof e==`function`?e():e)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},NodeView=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=()=>{try{return t.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,n;let{view:r}=this.editor,i=e.target,a=i.nodeType===3?(t=i.parentElement)==null?void 0:t.closest(`[data-drag-handle]`):i.closest(`[data-drag-handle]`);if(!this.dom||(n=this.contentDOM)!=null&&n.contains(i)||!a)return;let o=0,s=0;if(this.dom!==a){var c,l,u,d;let t=this.dom.getBoundingClientRect(),n=a.getBoundingClientRect(),r=(c=e.offsetX)==null?(l=e.nativeEvent)==null?void 0:l.offsetX:c,i=(u=e.offsetY)==null?(d=e.nativeEvent)==null?void 0:d.offsetY:u;o=n.x-t.x+r,s=n.y-t.y+i}let f=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();f.style.width=`${Math.round(e.width)}px`,f.style.height=`${Math.round(e.height)}px`,f.style.boxSizing=`border-box`,f.style.pointerEvents=`none`}catch{}let p=null;try{var m;p=document.createElement(`div`),p.style.position=`absolute`,p.style.top=`-9999px`,p.style.left=`-9999px`,p.style.pointerEvents=`none`,p.appendChild(f),document.body.appendChild(p),(m=e.dataTransfer)==null||m.setDragImage(f,o,s)}finally{p&&setTimeout(()=>{try{p==null||p.remove()}catch{}},0)}let h=this.getPos();if(typeof h!=`number`)return;let g=S.create(r.state.doc,h),_=r.state.tr.setSelection(g);r.dispatch(_)}stopEvent(e){var t;if(!this.dom)return!1;if(typeof this.options.stopEvent==`function`)return this.options.stopEvent({event:e});let n=e.target;if(!(this.dom.contains(n)&&!((t=this.contentDOM)!=null&&t.contains(n))))return!1;let r=e.type.startsWith(`drag`),i=e.type===`dragover`||e.type===`dragenter`,a=e.type===`drop`;if(([`INPUT`,`BUTTON`,`SELECT`,`TEXTAREA`].includes(n.tagName)||n.isContentEditable)&&!a&&!r)return!0;let{isEditable:o}=this.editor,{isDragging:s}=this,c=!!this.node.type.spec.draggable,l=S.isSelectable(this.node),u=e.type===`copy`,d=e.type===`paste`,f=e.type===`cut`,p=e.type===`mousedown`;if(!c&&l&&r&&e.target===this.dom&&e.preventDefault(),c&&r&&!s&&e.target===this.dom)return e.preventDefault(),!1;if(c&&o&&!s&&p){let e=n.closest(`[data-drag-handle]`);e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener(`dragend`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`drop`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`mouseup`,()=>{this.isDragging=!1},{once:!0}))}return!(s||i||a||u||d||f||p&&l)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation==`function`?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type===`selection`||this.contentDOM.contains(e.target)&&e.type===`childList`&&(P()||N())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===e.target&&e.type===`attributes`?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();
158return typeof n==`number`?(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0):!1})}deleteNode(){let e=this.getPos();if(typeof e!=`number`)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function da(e){return new PasteRule({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=V(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(cn(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>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}function fa(e){return new PasteRule({find:e.find,handler({match:t,chain:n,range:r,pasteEvent:i}){let a=V(e.getAttributes,void 0,t,i),o=V(e.getContent,void 0,a);if(a===!1||a===null)return null;let s={type:e.type.name,attrs:a};o&&(s.content=o),t.input&&n().deleteRange(r).insertContentAt(r.from,s)}})}function pa(e){return new PasteRule({find:e.find,handler:({state:t,range:n,match:r})=>{let i=e.replace,a=n.from,o=n.to;if(r[1]){let e=r[0].lastIndexOf(r[1]);i+=r[0].slice(e+r[1].length),a+=e;let t=a-o;t>0&&(i=r[0].slice(e-t,e)+i,a=o)}t.tr.insertText(i,a,o)}})}var Tracker=class{constructor(e){this.transaction=e,this.currentStep=this.transaction.steps.length}map(e){let t=!1;return{position:this.transaction.steps.slice(this.currentStep).reduce((e,n)=>{let r=n.getMap().mapResult(e);return r.deleted&&(t=!0),r.pos},e),deleted:t}}};export{O as CommandManager,J as DECORATION_MANAGER_PLUGIN_KEY,Decoration,DecorationManager,Editor,Extendable,Q as Extension,aa as Fragment,InlineDecoration,InputRule,Pn as MappablePosition,Ti as Mark,MarkView,ua as Node,NodeDecoration,Gi as NodePos,NodeView,PasteRule,ResizableNodeView,la as ResizableNodeview,Tracker,WidgetDecoration,Lr as attrsEqual,V as callOrReturn,Rr as canInsertNode,kt as combineTransactionSteps,mr as commands,ci as createAtomBlockMarkdownSpec,li as createBlockMarkdownSpec,D as createChainableState,Et as createDocument,sa as createElement,fi as createInlineMarkdownSpec,In as createMappablePosition,I as createNodeFromContent,zr as createStyleTag,Yi as createWidgetDecoration,Hr as decodeHtmlEntities,et as defaultBlockAt,_t as deleteProps,F as elementFromString,Ur as encodeHtmlEntities,Br as escapeForRegEx,Hi as extensions,At as findChildren,jt as findChildrenInRange,Kt as findDuplicates,Nt as findParentNode,Mt as findParentNodeClosestToPos,Pt as flattenExtensions,Vt as fromString,Yt as generateHTML,Xt as generateJSON,en as generateText,nn as getAttributes,Lt as getAttributesFromExtensions,on as getChangedRanges,sn as getDebugJSON,z as getExtensionField,B as getHTMLFromFragment,Ot as getMarkAttributes,Be as getMarkRange,j as getMarkType,cn as getMarksBetween,ln as getNodeAtPosition,tn as getNodeAttributes,k as getNodeType,un as getPreviousBlockSibling,U as getRenderedAttributes,Jt as getSchema,Gt as getSchemaByResolvedExtensions,G as getSchemaTypeByName,R as getSchemaTypeNameByName,K as getSplittedAttributes,Vr as getStyleProperty,Qt as getText,Zt as getTextBetween,dn as getTextContentFromNodes,$t as getTextSerializersFromSchema,Fn as getUpdatedPosition,sa as h,Ht as injectExtensionAttributesToParseRule,wi as inputRulesPlugin,pn as isActive,N as isAndroid,mn as isAtEndOfNode,hn as isAtStartOfNode,It as isEmptyObject,gn as isExtensionRulesEnabled,Wr as isFirefox,Ft as isFunction,_n as isList,ut as isMacOS,fn as isMarkActive,L as isNodeActive,vn as isNodeEmpty,yn as isNodeSelection,bn as isNodeViewSelected,Gr as isNumber,X as isPlainObject,xn as isProseMirrorAddMarkStep,Sn as isProseMirrorAddNodeMarkStep,Cn as isProseMirrorAttrStep,wn as isProseMirrorCellSelection,Tn as isProseMirrorDocAttrStep,En as isProseMirrorFragment,Dn as isProseMirrorNodeSelection,On as isProseMirrorRemoveMarkStep,kn as isProseMirrorRemoveNodeMarkStep,An as isProseMirrorReplaceAroundStep,jn as isProseMirrorReplaceStep,Mn as isProseMirrorSlice,q as isProseMirrorStep,Nn as isProseMirrorStepResult,Le as isRegExp,Ge as isSafari,qr as isString,Ue as isTextSelection,P as isiOS,Ir as liveWidgetKeys,Xi as markInputRule,da as markPasteRule,_i as markdown,yi as marksEqual,Bt as mergeAttributes,bi as mergeDeep,M as minMax,Zi as nodeInputRule,fa as nodePasteRule,A as objectIncludes,oi as parseAttributes,pi as parseIndentedBlocks,Ai as pasteRulesPlugin,Ln as posToDOMRect,rn as removeDuplicates,gi as renderNestedMarkdownContent,qt as resolveExtensions,We as resolveFocusPosition,zn as rewriteUnknownContent,Qe as selectionToInsertionEnd,si as serializeAttributes,W as sortExtensions,H as splitExtensions,$i as textInputRule,pa as textPasteRule,Qi as textblockTypeInputRule,xi as updateMarkViewAttributes,ea as wrappingInputRule};
159

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.