PageSourceSearch

https://pashabank.digital/js/2621.9235e392.js

js pashabank.digital collected 2026-10-08 02:40:29 UTC 320,420 bytes, 3 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2621],{2621:function(t,e,n){n.d(e,{FQ:function(){return B},rk:function(){return Ln},NZ:function(){return wo},AI:function(){return lr},KE:function(){return vo},Fc:function(){return _r},YY:function(){return no},FK:function(){return $o},kI:function(){return bo},fV:function(){return Wr},e4:function(){return hn},CU:function(){return Xr},Db:function(){return Jr},bP:function(){return Vo},$I:function(){return ko},PF:function(){return yo},Yv:function(){return Lo},_n:function(){return Yr},Nz:function(){return Fo},Xk:function(){return Bo},JD:function(){return Wo},fM:function(){return xo},Xh:function(){return cr},gk:function(){return le},AB:function(){return dr},T7:function(){return Qt},Pi:function(){return Wn},t9:function(){return Tr},Yj:function(){return Dr},vq:function(){return F},ui:function(){return Yt},n:function(){return Po},ur:function(){return zr},CO:function(){return pn},Iw:function(){return wt},Ye:function(){return hr},VR:function(){return So},jT:function(){return fr},Wp:function(){return St},oR:function(){return jt},WF:function(){return yt},zb:function(){return mr},GG:function(){return ur},XO:function(){return mo},xe:function(){return te},Nx:function(){return ee},Ir:function(){return be},KP:function(){return re},eL:function(){return ne},tp:function(){return ie},sH:function(){return me},Zx:function(){return Me},yQ:function(){return Ce},Df:function(){return Te},gu:function(){return Ae},EP:function(){return he},FF:function(){return ze},gp:function(){return $e},iI:function(){return oe},su:function(){return se},z6:function(){return Zt},ve:function(){return rt},I2:function(){return ot},hO:function(){return Ie},fl:function(){return Pe},I6:function(){return De},Pg:function(){return q},H_:function(){return Fe},zU:function(){return fe},_w:function(){return Se},dL:function(){return we},wE:function(){return Be},Lt:function(){return Lt},X2:function(){return Ve},hs:function(){return pr},q4:function(){return Ne},Aj:function(){return Oe},sY:function(){return Le},iR:function(){return Ee},tW:function(){return un},h:function(){return Po},cS:function(){return ge},pS:function(){return Hr},$m:function(){return Ke},m0:function(){return dt},QN:function(){return Je},J_:function(){return We},RI:function(){return ce},mr:function(){return Ue},gm:function(){return gr},Tn:function(){return ae},Lv:function(){return qe},U0:function(){return zt},_V:function(){return je},rU:function(){return It},Op:function(){return He},BQ:function(){return _e},FA:function(){return Xe},Et:function(){return yr},Qd:function(){return vr},ZO:function(){return Ge},nt:function(){return Ze},cc:function(){return Qe},bg:function(){return tn},e9:function(){return en},fS:function(){return nn},RP:function(){return rn},uu:function(){return on},e0:function(){return sn},Ak:function(){return an},LU:function(){return ln},hj:function(){return cn},dE:function(){return Ye},IB:function(){return dn},gd:function(){return Q},nr:function(){return ut},Kg:function(){return wr},eE:function(){return at},OF:function(){return ht},Fj:function(){return ar},OX:function(){return Mo},Zc:function(){return jo},wD:function(){return Br},Xu:function(){return Lr},KV:function(){return pe},D9:function(){return jr},n4:function(){return lt},Ce:function(){return Co},gg:function(){return Ko},Xy:function(){return tt},vB:function(){return Nr},Dd:function(){return $r},Uf:function(){return to},MG:function(){return fn},R3:function(){return Re},kj:function(){return Fr},Ro:function(){return xe},w0:function(){return ct},Xt:function(){return gn},Ms:function(){return kt},SY:function(){return Er},xf:function(){return ke},hK:function(){return de},Yp:function(){return No},pD:function(){return Jo},JJ:function(){return Oo},$b:function(){return Kr},tG:function(){return Eo}});var r=Object.defineProperty,o=(t,e)=>{let n={};for(var o in t)r(n,o,{get:t[o],enumerable:!0});return e||r(n,Symbol.toStringTag,{value:"Module"}),n},i=n(57156),s=n(81429),a=n(67599);const l=(t,e)=>!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function c(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const d=(t,e,n)=>{let r=c(t,n);if(!r)return!1;let o=f(r);if(!o){let n=r.blockRange(),o=n&&(0,i.jP)(n);return null!=o&&(e&&e(t.tr.lift(n,o).scrollIntoView()),!0)}let l=o.nodeBefore;if(C(t,o,e,-1))return!0;
1if(0==r.parent.content.size&&(u(l,"end")||a.nh.isSelectable(l)))for(let n=r.depth;;n--){let c=(0,i.$L)(t.doc,r.before(n),r.after(n),s.Ji.empty);if(c&&c.slice.size<c.to-c.from){if(e){let n=t.tr.step(c);n.setSelection(u(l,"end")?a.LN.findFrom(n.doc.resolve(n.mapping.map(o.pos,-1)),-1):a.nh.create(n.doc,o.pos-l.nodeSize)),e(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!(!l.isAtom||o.depth!=r.depth-1||(e&&e(t.tr.delete(o.pos-l.nodeSize,o.pos).scrollIntoView()),0))};function h(t,e,n){let r=e.nodeBefore,o=e.pos-1;for(;!r.isTextblock;o--){if(r.type.spec.isolating)return!1;let t=r.lastChild;if(!t)return!1;r=t}let l=e.nodeAfter,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let t=l.firstChild;if(!t)return!1;l=t}let d=(0,i.$L)(t.doc,o,c,s.Ji.empty);if(!d||d.from!=o||d instanceof i.Ln&&d.slice.size>=c-o)return!1;if(n){let e=t.tr.step(d);e.setSelection(a.U3.create(e.doc,o)),n(e.scrollIntoView())}return!0}function u(t,e,n=!1){for(let r=t;r;r="start"==e?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const p=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=f(r)}let s=i&&i.nodeBefore;return!(!s||!a.nh.isSelectable(s)||(e&&e(t.tr.setSelection(a.nh.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),0))};function f(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function m(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const g=(t,e,n)=>{let r=m(t,n);if(!r)return!1;let o=v(r);if(!o)return!1;let l=o.nodeAfter;if(C(t,o,e,1))return!0;if(0==r.parent.content.size&&(u(l,"start")||a.nh.isSelectable(l))){let n=(0,i.$L)(t.doc,r.before(),r.after(),s.Ji.empty);if(n&&n.slice.size<n.to-n.from){if(e){let r=t.tr.step(n);r.setSelection(u(l,"start")?a.LN.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):a.nh.create(r.doc,r.mapping.map(o.pos))),e(r.scrollIntoView())}return!0}}return!(!l.isAtom||o.depth!=r.depth-1||(e&&e(t.tr.delete(o.pos,o.pos+l.nodeSize).scrollIntoView()),0))},y=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=v(r)}let s=i&&i.nodeAfter;return!(!s||!a.nh.isSelectable(s)||(e&&e(t.tr.setSelection(a.nh.create(t.doc,i.pos)).scrollIntoView()),0))};function v(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const w=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!(!n.parent.type.spec.code||!n.sameParent(r)||(e&&e(t.tr.insertText("\n").scrollIntoView()),0))};function b(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const k=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=b(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let r=n.after(),o=t.tr.replaceWith(r,r,s.createAndFill());o.setSelection(a.LN.near(o.doc.resolve(r),1)),e(o.scrollIntoView())}return!0},x=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof a.i5||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=b(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=t.tr.insert(n,i.createAndFill());s.setSelection(a.U3.create(s.doc,n+1)),e(s.scrollIntoView())}return!0},S=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if((0,i.zy)(t.doc,r))return e&&e(t.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&(0,i.jP)(r);return null!=o&&(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};var M;function C(t,e,n,r){let o,l,c=e.nodeBefore,d=e.nodeAfter,h=c.type.spec.isolating||d.type.spec.isolating;if(!h&&function(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,s=e.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),0):!e.parent.canReplace(s,s+1)||!o.isTextblock&&!(0,i.n9)(t.doc,e.pos)||(n&&n(t.tr.join(e.pos).scrollIntoView()),0)))}(t,e,n))return!0;let p=!h&&e.parent.canReplace(e.index(),e.index()+1);if(p&&(o=(l=c.contentMatchAt(c.childCount)).findWrapping(d.type))&&l.matchType(o[0]||d.type).validEnd){if(n){let r=e.pos+d.nodeSize,a=s.FK.empty;for(let t=o.length-1;t>=0;t--)a=s.FK.from(o[t].create(null,a));a=s.FK.from(c.copy(a));let l=t.tr.step(new i.Wg(e.pos-1,r,e.pos,r,new s.Ji(a,1,0),o.length,!0)),h=l.doc.resolve(r+2*o.length);h.nodeAfter&&h.nodeAfter.type==c.type&&(0,i.n9)(l.doc,h.pos)&&l.join(h.pos),n(l.scrollIntoView())}return!0}let f=d.type.spec.isolating||r>0&&h?null:a.LN.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&(0,i.jP)(m);if(null!=g&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(p&&u(d,"start",!0)&&u(c,"end")){let r=c,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let a=d,l=1;for(;!a.isTextblock;a=a.firstChild)l++;if(r.canReplace(r.childCount,r.childCount,a.content)){if(n){let r=s.FK.empty;for(let t=o.length-1;t>=0;t--)r=s.FK.from(o[t].copy(r));n(t.tr.step(new i.Wg(e.pos-o.length,e.pos+d.nodeSize,e.pos+l,e.pos+d.nodeSize-l,new s.Ji(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function O(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(e.tr.setSelection(a.U3.create(e.doc,t<0?o.start(i):o.end(i)))),!0)}}const N=O(-1),E=O(1);function T(t,e=null){return function(n,r){let o=!1;for(let r=0;r<n.selection.ranges.length&&!o;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(i,s,(r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(t,e))if(r.type==t)o=!0;else{let e=n.doc.resolve(i),r=e.index();o=e.parent.canReplaceWith(r,r+1,t)}})}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,t,e)}r(o.scrollIntoView())}return!0}}function D(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}let A=D(l,d,p),R=D(l,g,y);const z={Enter:D(w,x,S,(t,e)=>{if(t.selection instanceof a.nh&&t.selection.node.isBlock){let{$from:n}=t.selection;return!(!n.parentOffset||!(0,i.zy)(t.doc,n.pos)||(e&&e(t.tr.split(n.pos).scrollIntoView()),0))}if(!t.selection.$from.depth)return!1;let n=t.tr;!t.selection.empty&&(t.selection instanceof a.U3||t.selection instanceof a.i5)&&n.deleteSelection();let r,o,{$from:s}=n.selection,l=n.steps.length,c=[],d=!1,h=!1;for(let t=s.depth;;t--){if(s.node(t).isBlock){d=s.end(t)==s.pos+(s.depth-t),h=s.start(t)==s.pos-(s.depth-t),o=b(s.node(t-1).contentMatchAt(s.indexAfter(t-1)));let e=M;c.unshift(e||(d&&o?{type:o}:null)),r=t;break}if(1==t)return!1;c.unshift(null)}let u=s.pos,p=(0,i.zy)(n.doc,u,c.length,c);if(p||(c[0]=o?{type:o}:null,p=(0,i.zy)(n.doc,u,c.length,c)),!p)return!1;if(n.split(u,c.length,c),!d&&h&&s.node(r).type!=o){let t=n.mapping.slice(l),e=t.map(s.before(r)),i=n.doc.resolve(e);o&&s.node(r-1).canReplaceWith(i.index(),i.index()+1,o)&&n.setNodeMarkup(t.map(s.before(r)),o)}return e&&e(n.scrollIntoView()),!0}),"Mod-Enter":k,Backspace:A,"Mod-Backspace":A,"Shift-Backspace":A,Delete:R,"Mod-Delete":R,"Mod-a":(t,e)=>(e&&e(t.tr.setSelection(new a.i5(t.doc))),!0)},$={"Ctrl-h":z.Backspace,"Alt-Backspace":z["Mod-Backspace"],"Ctrl-d":z.Delete,"Ctrl-Alt-Backspace":z["Mod-Delete"],"Alt-Delete":z["Mod-Delete"],"Alt-d":z["Mod-Delete"],"Ctrl-a":N,"Ctrl-e":E};for(let t in z)$[t]=z[t];"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();var I=n(91633),P=n(62738);function F(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;
1return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var B=class t{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([t,e])=>[t,(...t)=>{const n=e(...t)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!t,l=t||o.tr,c={...Object.fromEntries(Object.entries(n).map(([t,n])=>[t,(...t)=>{const r=this.buildProps(l,e),o=n(...t)(r);return s.push(o),c}])),run:()=>(a||!e||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),s.every(t=>!0===t))};return c}static createFakeChain(){const t=new Proxy({},{get:(e,n)=>{if("then"!==n)return"run"===n?()=>!1:()=>t}});return t}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([t,e])=>[t,(...t)=>e(...t)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}static createFallbackCan(){const e=t.createFakeChain();return new Proxy({chain:()=>e},{get:(t,e)=>{if("then"!==e)return"chain"===e?t.chain:()=>!1}})}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:t,editor:r,view:i,state:F({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([t,e])=>[t,(...t)=>e(...t)(s)]))}};return s}};const V=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),null===(n=window)||void 0===n||null===(n=n.getSelection())||void 0===n||n.removeAllRanges())}),!0),L=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),j=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:o}=r;return!n||(o.forEach(({$from:n,$to:r})=>{t.doc.nodesBetween(n.pos,r.pos,(t,n)=>{if(t.type.isText)return;const{doc:r,mapping:o}=e,s=r.resolve(o.map(n)),a=r.resolve(o.map(n+t.nodeSize)),l=s.blockRange(a);if(!l)return;const c=(0,i.jP)(l);if(t.type.isTextblock){const{defaultType:t}=s.parent.contentMatchAt(s.index());e.setNodeMarkup(l.start,t)}(c||0===c)&&e.lift(l,c)})}),!0)},K=t=>e=>t(e),J=()=>({state:t,dispatch:e})=>x(t,e),W=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new a.U3(r.doc.resolve(Math.max(s-1,0)))),!0},U=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let n=o.depth;n>0;n-=1)if(o.node(n).type===r.type){if(e){const e=o.before(n),r=o.after(n);t.delete(e,r).scrollIntoView()}return!0}return!1};function q(t,e){if("string"==typeof t){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}const H=t=>({tr:e,state:n,dispatch:r})=>{const o=q(t,n.schema),i=e.selection.$anchor;for(let t=i.depth;t>0;t-=1)if(i.node(t).type===o){if(r){const n=i.before(t),r=i.after(t);e.delete(n,r).scrollIntoView()}return!0}return!1},_=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},X=(t,e,n)=>{if(!t.parent.isInline)return t.pos;if("left"===n&&t.pos>t.start()||"right"===n&&t.pos<t.end())return t.pos;return(r=e.nodes[t.parent.type.name].spec).content&&/^text(\*|\+)/.test(r.content)?"left"===n?t.start()-1:t.end()+1:t.pos;var r},Y=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){const n=t.tr,{ranges:r}=t.selection,o=n.steps.length;
1r.forEach(e=>{const r=n.mapping.slice(o),i=n.doc.resolve(r.map(e.$from.pos)),s=n.doc.resolve(r.map(e.$to.pos)),{from:a,to:l}=((t,e,n)=>({from:X(t,n,"left"),to:X(e,n,"right")}))(i,s,t.schema);n.deleteRange(a,l)}),n.selection.empty||n.setSelection(a.U3.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),e(n)}return!0},G=()=>({commands:t})=>t.keyboardShortcut("Enter"),Z=()=>({state:t,dispatch:e})=>k(t,e);function Q(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function tt(t,e,n={strict:!0}){const r=Object.keys(e);return!r.length||r.every(r=>n.strict?e[r]===t[r]:Q(e[r])?e[r].test(t[r]):e[r]===t[r])}function et(t,e,n={}){return t.find(t=>t.type===e&&tt(Object.fromEntries(Object.keys(n).map(e=>[e,t.attrs[e]])),n))}function nt(t,e,n={}){return!!et(t,e,n)}function rt(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(r.node&&r.node.marks.some(t=>t.type===e)||(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(t=>t.type===e))return;if(!n){const t=r.node.marks.find(t=>t.type===e);t&&(n=t.attrs)}if(!et([...r.node.marks],e,n))return;let o=r.index,i=t.start()+r.offset,s=o+1,a=i+r.node.nodeSize;for(;o>0&&nt([...t.parent.child(o-1).marks],e,n);)o-=1,i-=t.parent.child(o).nodeSize;for(;s<t.parent.childCount&&nt([...t.parent.child(s).marks],e,n);)a+=t.parent.child(s).nodeSize,s+=1;return{from:i,to:a}}function ot(t,e){if("string"==typeof t){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const it=(t,e)=>({tr:n,state:r,dispatch:o})=>{const i=ot(t,r.schema),{doc:s,selection:l}=n,{$from:c,from:d,to:h}=l;if(o){const t=rt(c,i,e);if(t&&t.from<=d&&t.to>=h){const e=a.U3.create(s,t.from,t.to);n.setSelection(e)}}return!0},st=t=>e=>{const n="function"==typeof t?t(e):t;for(let t=0;t<n.length;t+=1)if(n[t](e))return!0;return!1};function at(t){return t instanceof a.U3}function lt(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function ct(t,e=null){if(!e)return null;const n=a.LN.atStart(t),r=a.LN.atEnd(t);if("start"===e||!0===e)return n;if("end"===e)return r;const o=n.from,i=r.to;return"all"===e?a.U3.create(t,lt(0,o,i),lt(t.content.size,o,i)):a.U3.create(t,lt(e,o,i),lt(e,o,i))}function dt(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function ht(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function ut(){return"undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}const pt=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(ht()||dt())&&r.dom.focus(),!ut()||ht()||dt()||r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),(null==e?void 0:e.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===t||!1===t)return!0}catch{return!1}if(i&&null===t&&!at(n.state.selection))return s(),!0;const a=ct(o.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},ft=(t,e)=>n=>t.every((t,r)=>e(t,{...n,index:r})),mt=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),gt=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):1===r.nodeType&&gt(r)}return t};function yt(t){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=(new window.DOMParser).parseFromString(e,"text/html").body;return gt(n)}function vt(t){return"function"==typeof(null==t?void 0:t.nodesBetween)}function wt(t,e,n){if(vt(t))return t;const r="object"==typeof t&&null!==t;n={slice:!0,parseOptions:{},...n};const o="string"==typeof t;if(r)try{if(Array.isArray(t)&&t.length>0)return s.FK.fromArray(t.map(t=>e.nodeFromJSON(t)));const r=e.nodeFromJSON(t);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",r),wt("",e,n)}if(o){if(n.errorOnInvalidContent){let r=!1,o="";const i=new s.Sj({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:t=>(r=!0,o="string"==typeof t?t:t.outerHTML,null)}]}})});if(n.slice?s.S4.fromSchema(i).parseSlice(yt(t),n.parseOptions):s.S4.fromSchema(i).parse(yt(t),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const r=s.S4.fromSchema(e);return n.slice?r.parseSlice(yt(t),n.parseOptions).content:r.parse(yt(t),n.parseOptions)}return wt("",e,n)}function bt(t){return!("type"in t)}function kt(t,e,n){const r=t.steps.length-1;if(r<e)return;const o=t.steps[r];if(!(o instanceof i.Ln||o instanceof i.Wg))return;const s=t.mapping.maps[r];let l=0;
1s.forEach((t,e,n,r)=>{0===l&&(l=r)}),t.setSelection(a.LN.near(t.doc.resolve(l),n))}const xt=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){let o;const l=t=>{i.emit("contentError",{editor:i,error:t,disableCollaboration:()=>{"collaboration"in i.storage&&"object"==typeof i.storage.collaboration&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...(n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n}).parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{wt(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(t){l(t)}try{var a;o=wt(e,i.schema,{parseOptions:c,errorOnInvalidContent:null!==(a=n.errorOnInvalidContent)&&void 0!==a?a:i.options.enableContentCheck})}catch(t){return l(t),!1}let{from:d,to:h}="number"==typeof t?{from:t,to:t}:{from:t.from,to:t.to},u=!0,p=!0;const f=bt(o)?o.content:[o];if(f.forEach(t=>{t.check(),u=!!u&&t.isText&&0===t.marks.length,p=!!p&&t.isBlock}),d===h&&p){const{parent:t}=r.doc.resolve(d);!t.isTextblock||t.type.spec.code||t.childCount||(d-=1,h+=1)}let m;if(u)m=Array.isArray(e)?e.map(t=>t.text||"").join(""):vt(e)?f.map(t=>{var e;return null!==(e=t.text)&&void 0!==e?e:""}).join(""):"object"==typeof e&&e&&e.text?e.text:e,r.insertText(m,d,h);else{m=s.FK.from(f);const t=r.doc.resolve(d),e=t.node(),n=0===t.parentOffset,o=e.isText||e.isTextblock,i=e.content.size>0;n&&o&&i&&p&&(d=Math.max(0,d-1)),r.replaceWith(d,h,f)}n.updateSelection&&kt(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:m})}return!0};function St(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Mt=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{pos:o,attrs:i,content:s,updateSelection:a=!0}=t;let l;l="number"==typeof o?e.doc.resolve(o):o||e.selection.$from;const c=St(l.parent.contentMatchAt(l.index()));if(!c)return!1;const d=Object.keys(c.spec.attrs||{}),h=i?Object.fromEntries(Object.entries(i).filter(([t])=>d.includes(t))):{};let u;if(s){const t=wt(s,r.schema);u=c.createAndFill(h,t)}else u=c.createAndFill(h);return!!u&&(n&&(e.insert(l.pos,u),a&&kt(e,e.steps.length-1,-1)),!0)},Ct=()=>({state:t,dispatch:e})=>((t,e)=>{let n,r=t.selection,o=r instanceof a.nh;if(o){if(r.node.isTextblock||!(0,i.n9)(t.doc,r.from))return!1;n=r.from}else if(n=(0,i.N0)(t.doc,r.from,-1),null==n)return!1;if(e){let r=t.tr.join(n);o&&r.setSelection(a.nh.create(r.doc,n-t.doc.resolve(n).nodeBefore.nodeSize)),e(r.scrollIntoView())}return!0})(t,e),Ot=()=>({state:t,dispatch:e})=>((t,e)=>{let n,r=t.selection;if(r instanceof a.nh){if(r.node.isTextblock||!(0,i.n9)(t.doc,r.to))return!1;n=r.to}else if(n=(0,i.N0)(t.doc,r.to,1),null==n)return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0})(t,e),Nt=()=>({state:t,dispatch:e})=>d(t,e),Et=()=>({state:t,dispatch:e})=>g(t,e),Tt=()=>({state:t,dispatch:e,tr:n})=>{try{const r=(0,i.N0)(t.doc,t.selection.$from.pos,-1);return null!=r&&(n.join(r,2),e&&e(n),!0)}catch{return!1}},Dt=()=>({state:t,dispatch:e,tr:n})=>{try{const r=(0,i.N0)(t.doc,t.selection.$from.pos,1);return null!=r&&(n.join(r,2),e&&e(n),!0)}catch{return!1}},At=()=>({state:t,dispatch:e})=>((t,e)=>{let n=c(t,void 0);if(!n)return!1;let r=f(n);return!!r&&h(t,r,e)})(t,e),Rt=()=>({state:t,dispatch:e})=>((t,e)=>{let n=m(t,void 0);if(!n)return!1;let r=v(n);return!!r&&h(t,r,e)})(t,e);function zt(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}const $t=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const i=function(t){const e=t.split(/-(?!$)/);let n,r,o,i,s=e[e.length-1];"Space"===s&&(s=" ");for(let t=0;t<e.length-1;t+=1){const s=e[t];
1if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))n=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else if(/^s(hift)?$/i.test(s))o=!0;else{if(!/^mod$/i.test(s))throw new Error(`Unrecognized modifier name: ${s}`);ht()||zt()?i=!0:r=!0}}return n&&(s=`Alt-${s}`),r&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),o&&(s=`Shift-${s}`),s}(t).split(/-(?!$)/),s=i.find(t=>!["Alt","Ctrl","Meta","Shift"].includes(t)),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",t=>t(n,a))});return null==l||l.steps.forEach(t=>{const e=t.map(r.mapping);e&&o&&r.maybeStep(e)}),!0};function It(t,e,n={}){const{from:r,to:o,empty:i}=t.selection,s=e?q(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(t,e)=>{if(t.isText)return;const n=Math.max(r,e),i=Math.min(o,e+t.nodeSize);a.push({node:t,from:n,to:i})});const l=o-r,c=a.filter(t=>!s||s.name===t.node.type.name).filter(t=>tt(t.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((t,e)=>t+e.to-e.from,0)>=l}const Pt=(t,e={})=>({state:n,dispatch:r})=>!!It(n,q(t,n.schema),e)&&((t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),s=o&&(0,i.jP)(o);return null!=s&&(e&&e(t.tr.lift(o,s).scrollIntoView()),!0)})(n,r),Ft=()=>({state:t,dispatch:e})=>S(t,e),Bt=t=>({state:e,dispatch:n})=>{return(r=q(t,e.schema),function(t,e){let{$from:n,$to:o}=t.selection,a=n.blockRange(o,t=>t.childCount>0&&t.firstChild.type==r);return!!a&&(!e||(n.node(a.depth-1).type==r?function(t,e,n,r){let o=t.tr,a=r.end,l=r.$to.end(r.depth);a<l&&(o.step(new i.Wg(a-1,l,a,l,new s.Ji(s.FK.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new s.u$(o.doc.resolve(r.$from.pos),o.doc.resolve(l),r.depth));const c=(0,i.jP)(r);if(null==c)return!1;o.lift(r,c);let d=o.doc.resolve(o.mapping.map(a,-1)-1);return(0,i.n9)(o.doc,d.pos)&&d.nodeBefore.type==d.nodeAfter.type&&o.join(d.pos),e(o.scrollIntoView()),!0}(t,e,r,a):function(t,e,n){let r=t.tr,o=n.parent;for(let t=n.end,e=n.endIndex-1,i=n.startIndex;e>i;e--)t-=o.child(e).nodeSize,r.delete(t-1,t+1);let a=r.doc.resolve(n.start),l=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let c=0==n.startIndex,d=n.endIndex==o.childCount,h=a.node(-1),u=a.index(-1);if(!h.canReplace(u+(c?0:1),u+1,l.content.append(d?s.FK.empty:s.FK.from(o))))return!1;let p=a.pos,f=p+l.nodeSize;return r.step(new i.Wg(p-(c?1:0),f+(d?1:0),p+1,f-1,new s.Ji((c?s.FK.empty:s.FK.from(o.copy(s.FK.empty))).append(d?s.FK.empty:s.FK.from(o.copy(s.FK.empty))),c?0:1,d?0:1),c?0:1)),e(r.scrollIntoView()),!0}(t,e,a)))})(e,n);var r},Vt=()=>({state:t,dispatch:e})=>w(t,e);function Lt(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function jt(t,e){const n="string"==typeof e?[e]:e;return Object.keys(t).reduce((e,r)=>(n.includes(r)||(e[r]=t[r]),e),{})}const Kt=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Lt("string"==typeof t?t:t.name,r.schema);if(!a)return!1;"node"===a&&(i=q(t,r.schema)),"mark"===a&&(s=ot(t,r.schema));let l=!1;return n.selection.ranges.forEach(t=>{r.doc.nodesBetween(t.$from.pos,t.$to.pos,(t,r)=>{i&&i===t.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,jt(t.attrs,e))),s&&t.marks.length&&t.marks.forEach(i=>{s===i.type&&(l=!0,o&&n.addMark(r,r+t.nodeSize,s.create(jt(i.attrs,e))))})})}),l},Jt=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Wt=()=>({tr:t,dispatch:e})=>{if(e){const e=new a.i5(t.doc);t.setSelection(e)}return!0},Ut=()=>({state:t,dispatch:e})=>p(t,e),qt=()=>({state:t,dispatch:e})=>y(t,e),Ht=()=>({state:t,dispatch:e})=>((t,e)=>{let n,{$from:r,to:o}=t.selection,i=r.sharedDepth(o);return 0!=i&&(n=r.before(i),e&&e(t.tr.setSelection(a.nh.create(t.doc,n))),!0)})(t,e),_t=()=>({state:t,dispatch:e})=>E(t,e),Xt=()=>({state:t,dispatch:e})=>N(t,e);function Yt(t,e,n={},r={}){return wt(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const Gt=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:l}=i;if("full"!==r.preserveWhitespace){const a=Yt(t,o.schema,r,{errorOnInvalidContent:null!=e?e:o.options.enableContentCheck});if(s){const t=bt(a)?a.content:[a];i.replaceWith(0,l.content.size,t).setMeta("preventUpdate",!n)}return!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:null!=e?e:o.options.enableContentCheck})};function Zt(t,e){const n=ot(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,t=>{s.push(...t.marks)});const a=s.find(t=>t.type.name===n.name);return a?{...a.attrs}:{}}function Qt(t,e){const n=new i.dL(t);return e.forEach(t=>{t.steps.forEach(t=>{n.step(t)})}),n}function te(t,e){const n=[];
1return t.descendants((t,r)=>{e(t)&&n.push({node:t,pos:r})}),n}function ee(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(t,e)=>{n(t)&&r.push({node:t,pos:e})}),r}function ne(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function re(t){return e=>ne(e.$from,t)}function oe(t,e,n){return void 0===t.config[e]&&t.parent?oe(t.parent,e,n):"function"==typeof t.config[e]?t.config[e].bind({...n,parent:t.parent?oe(t.parent,e,n):null}):t.config[e]}function ie(t){return t.map(t=>{const e=oe(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return e?[t,...ie(e())]:t}).flat(10)}function se(t,e){const n=s.ZF.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function ae(t){return"function"==typeof t}function le(t,e=void 0,...n){return ae(t)?e?t.bind(e)(...n):t(...n):t}function ce(t={}){return 0===Object.keys(t).length&&t.constructor===Object}function de(t){return{baseExtensions:t.filter(t=>"extension"===t.type),nodeExtensions:t.filter(t=>"node"===t.type),markExtensions:t.filter(t=>"mark"===t.type)}}function he(t){const e=[],{nodeExtensions:n,markExtensions:r}=de(t),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(t=>"text"!==t.name).map(t=>t.name),a=r.map(t=>t.name),l=[...s,...a];return t.forEach(t=>{const n=oe(t,"addGlobalAttributes",{name:t.name,options:t.options,storage:t.storage,extensions:o});n&&n().forEach(t=>{let n;n=Array.isArray(t.types)?t.types:"*"===t.types?l:"nodes"===t.types?s:"marks"===t.types?a:[],n.forEach(n=>{Object.entries(t.attributes).forEach(([t,r])=>{e.push({type:n,name:t,attribute:{...i,...r}})})})})}),o.forEach(t=>{const n=oe(t,"addAttributes",{name:t.name,options:t.options,storage:t.storage});if(!n)return;const r=n();Object.entries(r).forEach(([n,r])=>{const o={...i,...r};"function"==typeof(null==o?void 0:o.default)&&(o.default=o.default()),(null==o?void 0:o.isRequired)&&void 0===(null==o?void 0:o.default)&&delete o.default,e.push({type:t.name,name:n,attribute:o})})}),e}function ue(t){const e=[],n=function(t){const e=[];let n="",r=!1,o=!1,i=0;const s=t.length;for(let a=0;a<s;a+=1){const s=t[a];if("'"!==s||o)if('"'!==s||r){if(!r&&!o){if("("===s){i+=1,n+=s;continue}if(")"===s&&i>0){i-=1,n+=s;continue}if(";"===s&&0===i){e.push(n),n="";continue}}n+=s}else o=!o,n+=s;else r=!r,n+=s}return n&&e.push(n),e}(t||""),r=n.length;for(let t=0;t<r;t+=1){const r=n[t],o=r.indexOf(":");if(-1===o)continue;const i=r.slice(0,o).trim(),s=r.slice(o+1).trim();i&&s&&e.push([i,s])}return e}function pe(...t){return t.filter(t=>!!t).reduce((t,e)=>{const n={...t};return Object.entries(e).forEach(([t,e])=>{if("__proto__"!==t)if(n[t])if("class"===t){const r=e?String(e).split(" "):[],o=n[t]?n[t].split(" "):[],i=r.filter(t=>!o.includes(t));n[t]=[...o,...i].join(" ")}else if("style"===t){const r=new Map([...ue(n[t]),...ue(e)]);n[t]=Array.from(r.entries()).map(([t,e])=>`${t}: ${e}`).join("; ")}else n[t]=e;else n[t]=e;else Object.defineProperty(n,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}),n},{})}function fe(t,e){return e.filter(e=>e.type===t.type.name).filter(t=>t.attribute.rendered).map(e=>e.attribute.renderHTML?e.attribute.renderHTML(t.attrs)||{}:{[e.name]:t.attrs[e.name]}).reduce((t,e)=>pe(t,e),{})}function me(t){return"string"!=typeof t?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):"true"===t||"false"!==t&&t}function ge(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(!1===r)return!1;const o=e.reduce((t,e)=>{const r=e.attribute.parseHTML?e.attribute.parseHTML(n):me(n.getAttribute(e.name));return null==r?t:{...t,[e.name]:r}},{});return{...r,...o}}}}function ye(t){return Object.fromEntries(Object.entries(t).filter(([t,e])=>("attrs"!==t||!ce(e))&&null!=e))}function ve(t){var e,n;const r={};return!(null==t||null===(e=t.attribute)||void 0===e?void 0:e.isRequired)&&"default"in((null==t?void 0:t.attribute)||{})&&(r.default=t.attribute.default),void 0!==(null==t||null===(n=t.attribute)||void 0===n?void 0:n.validate)&&(r.validate=t.attribute.validate),[t.name,r]}function we(t,e){var n;const r=he(t),{nodeExtensions:o,markExtensions:i}=de(t),a=null===(n=o.find(t=>oe(t,"topNode")))||void 0===n?void 0:n.name,l=Object.fromEntries(o.map(n=>{const o=r.filter(t=>t.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:e},s=ye({...t.reduce((t,e)=>{const r=oe(e,"extendNodeSchema",i);return{...t,...r?r(n):{}}
1},{}),content:le(oe(n,"content",i)),marks:le(oe(n,"marks",i)),group:le(oe(n,"group",i)),inline:le(oe(n,"inline",i)),atom:le(oe(n,"atom",i)),selectable:le(oe(n,"selectable",i)),draggable:le(oe(n,"draggable",i)),code:le(oe(n,"code",i)),whitespace:le(oe(n,"whitespace",i)),linebreakReplacement:le(oe(n,"linebreakReplacement",i)),defining:le(oe(n,"defining",i)),isolating:le(oe(n,"isolating",i)),attrs:Object.fromEntries(o.map(ve))}),a=le(oe(n,"parseHTML",i));a&&(s.parseDOM=a.map(t=>ge(t,o)));const l=oe(n,"renderHTML",i);l&&(s.toDOM=t=>l({node:t,HTMLAttributes:fe(t,o)}));const c=oe(n,"renderText",i);return c&&(s.toText=c),[n.name,s]})),c=Object.fromEntries(i.map(n=>{const o=r.filter(t=>t.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:e},s=ye({...t.reduce((t,e)=>{const r=oe(e,"extendMarkSchema",i);return{...t,...r?r(n):{}}},{}),inclusive:le(oe(n,"inclusive",i)),excludes:le(oe(n,"excludes",i)),group:le(oe(n,"group",i)),spanning:le(oe(n,"spanning",i)),code:le(oe(n,"code",i)),attrs:Object.fromEntries(o.map(ve))}),a=le(oe(n,"parseHTML",i));a&&(s.parseDOM=a.map(t=>ge(t,o)));const l=oe(n,"renderHTML",i);return l&&(s.toDOM=t=>l({mark:t,HTMLAttributes:fe(t,o)})),[n.name,s]}));return new s.Sj({topNode:a,nodes:l,marks:c})}function be(t){const e=t.filter((e,n)=>t.indexOf(e)!==n);return Array.from(new Set(e))}function ke(t){return t.sort((t,e)=>{const n=oe(t,"priority")||100,r=oe(e,"priority")||100;return n>r?-1:n<r?1:0})}function xe(t){const e=ke(ie(t)),n=be(e.map(t=>t.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(t=>`'${t}'`).join(", ")}]. This can lead to issues.`),e}function Se(t,e){return we(xe(t),e)}function Me(t,e){const n=Se(e);return se(s.bP.fromJSON(n,t).content,n)}function Ce(t,e){const n=Se(e),r=yt(t);return s.S4.fromSchema(n).parse(r).toJSON()}function Oe(t,e,n){const{from:r,to:o}=e,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let a="";return t.nodesBetween(r,o,(t,n,l,c)=>{t.isBlock&&n>r&&(a+=i);const d=null==s?void 0:s[t.type.name];if(d)return l&&(a+=d({node:t,pos:n,parent:l,index:c,range:e})),!1;var h;t.isText&&(a+=null==t||null===(h=t.text)||void 0===h?void 0:h.slice(Math.max(r,n)-n,o-n))}),a}function Ne(t,e){return Oe(t,{from:0,to:t.content.size},e)}function Ee(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,t])=>t.spec.toText).map(([t,e])=>[t,e.spec.toText]))}function Te(t,e,n){const{blockSeparator:r="\n\n",textSerializers:o={}}=n||{},i=Se(e);return Ne(s.bP.fromJSON(i,t),{blockSeparator:r,textSerializers:{...Ee(i),...o}})}function De(t,e){const n=q(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,t=>{i.push(t)});const s=i.reverse().find(t=>t.type.name===n.name);return s?{...s.attrs}:{}}function Ae(t,e){const n=Lt("string"==typeof e?e:e.name,t.schema);return"node"===n?De(t,e):"mark"===n?Zt(t,e):{}}function Re(t,e=JSON.stringify){const n={};return t.filter(t=>{const r=e(t);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}function ze(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((t,o)=>{const i=[];if(t.ranges.length)t.forEach((t,e)=>{i.push({from:t,to:e})});else{const{from:t,to:e}=n[o];if(void 0===t||void 0===e)return;i.push({from:t,to:e})}i.forEach(({from:t,to:n})=>{const i=e.slice(o).map(t,-1),s=e.slice(o).map(n),a=e.invert().map(i,-1),l=e.invert().map(s);r.push({oldRange:{from:a,to:l},newRange:{from:i,to:s}})})}),function(t){const e=Re(t);return 1===e.length?e:e.filter((t,n)=>!e.filter((t,e)=>e!==n).some(e=>t.oldRange.from>=e.oldRange.from&&t.oldRange.to<=e.oldRange.to&&t.newRange.from>=e.newRange.from&&t.newRange.to<=e.newRange.to))}(r)}function $e(t,e=0){const n=t.type===t.type.schema.topNodeType?0:1,r=e,o=r+t.nodeSize,i=t.marks.map(t=>{const e={type:t.type.name};return Object.keys(t.attrs).length&&(e.attrs={...t.attrs}),e}),s={...t.attrs},a={type:t.type.name,from:r,to:o};return Object.keys(s).length&&(a.attrs=s),i.length&&(a.marks=i),t.content.childCount&&(a.content=[],t.forEach((t,r)=>{var o;null===(o=a.content)||void 0===o||o.push($e(t,e+r+n))})),t.text&&(a.text=t.text),a}function Ie(t,e,n){const r=[];
1return t===e?n.resolve(t).marks().forEach(e=>{const o=rt(n.resolve(t),e.type);o&&r.push({mark:e,...o})}):n.nodesBetween(t,e,(t,e)=>{t&&void 0!==(null==t?void 0:t.nodeSize)&&r.push(...t.marks.map(n=>({from:e,to:e+t.nodeSize,mark:n})))}),r}const Pe=(t,e,n,r=20)=>{const o=t.doc.resolve(n);let i=r,s=null;for(;i>0&&null===s;){const t=o.node(i);(null==t?void 0:t.type.name)===e?s=t:i-=1}return[s,i]},Fe=t=>{const e=t.depth-1;if(e<0)return null;const n=t.index(e);return 0===n?null:t.node(e).child(n-1)};function Be(t,e){return e.nodes[t]||e.marks[t]||null}function Ve(t,e,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{const r=t.find(t=>t.type===e&&t.name===n);return!!r&&r.attribute.keepOnSplit}))}const Le=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(t,e,o,i)=>{var s,a;const l=(null===(s=(a=t.type.spec).toText)||void 0===s?void 0:s.call(a,{node:t,pos:e,parent:o,index:i}))||t.textContent||"%leaf%";n+=t.isAtom&&!t.isText?l:l.slice(0,Math.max(0,r-e))}),n};function je(t,e,n={}){const{empty:r,ranges:o}=t.selection,i=e?ot(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(t=>!i||i.name===t.type.name).find(t=>tt(t.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:e,$to:n})=>{const r=e.pos,o=n.pos;t.doc.nodesBetween(r,o,(t,e)=>{if(i&&t.inlineContent&&!t.type.allowsMarkType(i))return!1;if(!t.isText&&!t.marks.length)return;const n=Math.max(r,e),l=Math.min(o,e+t.nodeSize);s+=l-n,a.push(...t.marks.map(t=>({mark:t,from:n,to:l})))})}),0===s)return!1;const l=a.filter(t=>!i||i.name===t.mark.type.name).filter(t=>tt(t.mark.attrs,n,{strict:!1})).reduce((t,e)=>t+e.to-e.from,0),c=a.filter(t=>!i||t.mark.type!==i&&t.mark.type.excludes(i)).reduce((t,e)=>t+e.to-e.from,0);return(l>0?l+c:l)>=s}function Ke(t,e,n={}){if(!e)return It(t,null,n)||je(t,null,n);const r=Lt(e,t.schema);return"node"===r?It(t,e,n):"mark"===r&&je(t,e,n)}const Je=(t,e)=>{const{$from:n,$to:r,$anchor:o}=t.selection;if(e){const n=re(t=>t.type.name===e)(t.selection);if(!n)return!1;const r=t.doc.resolve(n.pos+1);return o.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},We=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function Ue(t,e){return Array.isArray(e)?e.some(e=>("string"==typeof e?e:e.name)===t.name):e}function qe(t,e){const{nodeExtensions:n}=de(e),r=n.find(e=>e.name===t);if(!r)return!1;const o=le(oe(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function He(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){if(n){if("hardBreak"===t.type.name)return!0;var r;if(t.isText)return!/\S/.test(null!==(r=t.text)&&void 0!==r?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(0===t.content.childCount)return!0;if(e){let r=!0;return t.content.forEach(t=>{!1!==r&&(He(t,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}function _e(t){return t instanceof a.nh}function Xe({selection:t,pos:e,nodeSize:n,selectedOnTextSelection:r=!1}){const{from:o,to:i}=t;return o<=e&&i>=e+n||!!(r&&at(t)&&o>e&&i<e+n)}function Ye(t){if(null===t||"object"!=typeof t)return!1;const e=t;return"function"==typeof e.apply&&"function"==typeof e.getMap&&"function"==typeof e.invert&&"function"==typeof e.map&&"function"==typeof e.merge&&"function"==typeof e.toJSON}function Ge(t){if(null===t||"object"!=typeof t)return!1;const e=t;if(!Ye(e))return!1;const n=e.toJSON();return null!==n&&"object"==typeof n&&"addMark"===n.stepType}function Ze(t){if(null===t||"object"!=typeof t)return!1;const e=t;if(!Ye(e))return!1;const n=e.toJSON();return null!==n&&"object"==typeof n&&"addNodeMark"===n.stepType}function Qe(t){if(null===t||"object"!=typeof t)return!1;const e=t;if(!Ye(e))return!1;const n=e.toJSON();return null!==n&&"object"==typeof n&&"attr"===n.stepType}function tn(t){return null!==t&&"object"==typeof t&&"forEachCell"in t&&"function"==typeof t.forEachCell}function en(t){if(null===t||"object"!=typeof t)return!1;const e=t;if(!Ye(e))return!1;const n=e.toJSON();return null!==n&&"object"==typeof n&&"docAttr"===n.stepType}function nn(t){if(null===t||"object"!=typeof t)return!1;const e=t;return!(!Array.isArray(e.content)||"number"!=typeof e.size||"function"!=typeof e.nodesBetween||"function"!=typeof e.descendants||"function"!=typeof e.textBetween||"function"!=typeof e.append||"function"!=typeof e.cut||"function"!=typeof e.eq||"function"!=typeof e.child||"function"!=typeof e.forEach)}function rn(t){return null!==t&&"object"==typeof t&&"node"in t&&null!=t.node}function on(t){if(null===t||"object"!=typeof t)return!1;const e=t;if(!Ye(e))return!1;const n=e.toJSON();return null!==n&&"object"==typeof n&&"removeMark"===n.stepType}function sn(t){if(null===t||"object"!=typeof t)return!1;const e=t;if(!Ye(e))return!1;const n=e.toJSON();
1return null!==n&&"object"==typeof n&&"removeNodeMark"===n.stepType}function an(t){if(null===t||"object"!=typeof t)return!1;const e=t;if(!Ye(e))return!1;const n=e.toJSON();return null!==n&&"object"==typeof n&&"replaceAround"===n.stepType}function ln(t){if(null===t||"object"!=typeof t)return!1;const e=t;if(!Ye(e))return!1;const n=e.toJSON();return null!==n&&"object"==typeof n&&"replace"===n.stepType}function cn(t){if(null===t||"object"!=typeof t)return!1;const e=t,n=Number.isInteger(e.openStart)&&e.openStart>=0,r=Number.isInteger(e.openEnd)&&e.openEnd>=0,o="number"==typeof e.size&&"function"==typeof e.eq&&"function"==typeof e.toJSON;if(!n||!r||!o)return!1;const i=e.content;return null!==i&&"object"==typeof i&&!!nn(i)}function dn(t){if(null===t||"object"!=typeof t)return!1;const e=t,n=null!==e.doc&&"object"==typeof e.doc&&null===e.failed,r="string"==typeof e.failed&&null===e.doc;return!(!n&&!r)}var hn=class t{constructor(t){this.position=t}static fromJSON(e){return new t(e.position)}toJSON(){return{position:this.position}}};function un(t,e){const n=e.mapping.mapResult(t.position);return{position:new hn(n.pos),mapResult:n}}function pn(t){return new hn(t)}function fn(t,e,n){const r=t.state.doc.content.size,o=lt(e,0,r),i=lt(n,0,r),s=t.coordsAtPos(o),a=t.coordsAtPos(i,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),d=Math.min(s.left,a.left),h=Math.max(s.right,a.right),u={top:l,bottom:c,left:d,right:h,width:h-d,height:c-l,x:d,y:l};return{...u,toJSON:()=>u}}function mn({json:t,validMarks:e,validNodes:n,options:r,rewrittenContent:o=[]}){return t.marks&&Array.isArray(t.marks)&&(t.marks=t.marks.filter(t=>{if(null==t)return!1;const n="string"==typeof t?t:t.type;return!!e.has(n)||(o.push({original:JSON.parse(JSON.stringify(t)),unsupported:n}),!1)})),t.content&&Array.isArray(t.content)&&(t.content=t.content.map(t=>null==t?null:mn({json:t,validMarks:e,validNodes:n,options:r,rewrittenContent:o}).json).filter(t=>null!=t)),t.type&&!n.has(t.type)?(o.push({original:JSON.parse(JSON.stringify(t)),unsupported:t.type}),t.content&&Array.isArray(t.content)&&!1!==(null==r?void 0:r.fallbackToParagraph)?(t.type="paragraph",{json:t,rewrittenContent:o}):{json:null,rewrittenContent:o}):{json:t,rewrittenContent:o}}function gn(t,e,n){return mn({json:t,validNodes:new Set(Object.keys(e.nodes)),validMarks:new Set(Object.keys(e.marks)),options:n})}const yn=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=ot(t,r.schema);if(o)if(s){const t=Zt(r,l);n.addStoredMark(l.create({...t,...e}))}else a.forEach(t=>{const o=t.$from.pos,i=t.$to.pos;r.doc.nodesBetween(o,i,(t,r)=>{const s=Math.max(r,o),a=Math.min(r+t.nodeSize,i);t.marks.find(t=>t.type===l)?t.marks.forEach(t=>{l===t.type&&n.addMark(s,a,l.create({...t.attrs,...e}))}):n.addMark(s,a,l.create(e))})});return function(t,e,n){const{selection:r}=e;let o=null;if(at(r)&&(o=r.$cursor),o){var i;const e=null!==(i=t.storedMarks)&&void 0!==i?i:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(e)||!e.some(t=>t.type.excludes(n)))}const{ranges:s}=r;return s.some(({$from:e,$to:r})=>{let o=0===e.depth&&t.doc.inlineContent&&t.doc.type.allowsMarkType(n);return t.doc.nodesBetween(e.pos,r.pos,(t,e,r)=>{if(o)return!1;if(t.isInline){const e=!r||r.type.allowsMarkType(n),i=!!n.isInSet(t.marks)||!t.marks.some(t=>t.type.excludes(n));o=e&&i}return!o}),o})}(r,n,l)},vn=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),wn=(t,e={})=>({state:n,dispatch:r,chain:o})=>{const i=q(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:t})=>!!T(i,{...s,...e})(n)||t.clearNodes()).command(({state:t})=>T(i,{...s,...e})(t,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},bn=t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,r=lt(t,0,n.content.size),o=a.nh.create(n,r);e.setSelection(o)}return!0},kn=(t,e)=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=r;let s,a;return"number"==typeof e?(s=e,a=e):e&&"from"in e&&"to"in e?(s=e.from,a=e.to):(s=i.from,a=i.to),o&&n.doc.nodesBetween(s,a,(e,r)=>{e.isText||n.setNodeMarkup(r,void 0,{...e.attrs,dir:t})}),!0},xn=t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,{from:r,to:o}="number"==typeof t?{from:t,to:t}:t,i=a.U3.atStart(n).from,s=a.U3.atEnd(n).to,l=lt(r,i,s),c=lt(o,i,s),d=a.U3.create(n,l,c);e.setSelection(d)}return!0},Sn=t=>({state:e,dispatch:n})=>{const r=q(t,e.schema);return(o=r,function(t,e){let{$from:n,$to:r}=t.selection,a=n.blockRange(r,t=>t.childCount>0&&t.firstChild.type==o);if(!a)return!1;let l=a.startIndex;if(0==l)return!1;let c=a.parent,d=c.child(l-1);if(d.type!=o)return!1;if(e){let n=d.lastChild&&d.lastChild.type==c.type,r=s.FK.from(n?o.create():null),l=new s.Ji(s.FK.from(o.create(null,s.FK.from(c.type.create(null,r)))),n?3:1,0),h=a.start,u=a.end;e(t.tr.step(new i.Wg(h-(n?3:1),u,h,u,l,1,!0)).scrollIntoView())}return!0})(e,n);var o};function Mn(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(t=>null==e?void 0:e.includes(t.type.name));t.tr.ensureMarks(r)}}const Cn=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{const{selection:s,doc:l}=e,{$from:c,$to:d}=s,h=Ve(o.extensionManager.attributes,c.node().type.name,c.node().attrs);if(s instanceof a.nh&&s.node.isBlock)return!(!c.parentOffset||!(0,i.zy)(l,c.pos)||(r&&(t&&Mn(n,o.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),0));if(!c.parent.isBlock)return!1;const u=d.parentOffset===d.parent.content.size,p=0===c.depth?void 0:St(c.node(-1).contentMatchAt(c.indexAfter(-1)));let f=u&&p?[{type:p,attrs:h}]:void 0,m=(0,i.zy)(e.doc,e.mapping.map(c.pos),1,f);if(f||m||!(0,i.zy)(e.doc,e.mapping.map(c.pos),1,p?[{type:p}]:void 0)||(m=!0,f=p?[{type:p,attrs:h}]:void 0),r){if(m&&(s instanceof a.U3&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,f),p&&!u&&!c.parentOffset&&c.parent.type!==p)){const t=e.mapping.map(c.before()),n=e.doc.resolve(t);c.node(-1).canReplaceWith(n.index(),n.index()+1,p)&&e.setNodeMarkup(e.mapping.map(c.before()),p)}t&&Mn(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return m},On=(t,e={})=>({tr:n,state:r,dispatch:o,editor:l})=>{const c=q(t,r.schema),{$from:d,$to:h}=r.selection,u=r.selection.node;if(u&&u.isBlock||d.depth<2||!d.sameParent(h))return!1;const p=d.node(-1);if(p.type!==c)return!1;const f=l.extensionManager.attributes;if(0===d.parent.content.size&&d.node(-1).childCount===d.indexAfter(-1)){if
1(2===d.depth||d.node(-3).type!==c||d.index(-2)!==d.node(-2).childCount-1)return!1;if(o){var m;let t=s.FK.empty;const r=d.index(-1)?1:d.index(-2)?2:3;for(let e=d.depth-r;e>=d.depth-3;e-=1)t=s.FK.from(d.node(e).copy(t));const o=d.indexAfter(-1)<d.node(-2).childCount?1:d.indexAfter(-2)<d.node(-3).childCount?2:3,i={...Ve(f,d.node().type.name,d.node().attrs),...e},l=(null===(m=c.contentMatch.defaultType)||void 0===m?void 0:m.createAndFill(i))||void 0;t=t.append(s.FK.from(c.createAndFill(null,l)||void 0));const h=d.before(d.depth-(r-1));n.replace(h,d.after(-o),new s.Ji(t,4-r,0));let u=-1;n.doc.nodesBetween(h,n.doc.content.size,(t,e)=>{if(u>-1)return!1;t.isTextblock&&0===t.content.size&&(u=e+1)}),u>-1&&n.setSelection(a.U3.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}const g=h.pos===d.end()?p.contentMatchAt(0).defaultType:null,y={...Ve(f,p.type.name,p.attrs),...e},v={...Ve(f,d.node().type.name,d.node().attrs),...e};n.delete(d.pos,h.pos);const w=g?[{type:c,attrs:y},{type:g,attrs:v}]:[{type:c,attrs:y}];if(!(0,i.zy)(n.doc,d.pos,2))return!1;if(o){const{selection:t,storedMarks:e}=r,{splittableMarks:i}=l.extensionManager,s=e||t.$to.parentOffset&&t.$from.marks();if(n.split(d.pos,2,w).scrollIntoView(),!s||!o)return!0;const a=s.filter(t=>i.includes(t.type.name));n.ensureMarks(a)}return!0};function Nn(t){return t&&"1"!==t?t:null}function En(t,e){return Nn(t)===Nn(e)}const Tn=(t,e)=>{const n=re(t=>t.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;const o=t.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!(0,i.n9)(t.doc,n.pos)||!En(n.node.attrs.type,null==o?void 0:o.attrs.type)||(t.join(n.pos),!0)},Dn=(t,e)=>{const n=re(t=>t.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;const o=t.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!(0,i.n9)(t.doc,r)||!En(n.node.attrs.type,null==o?void 0:o.attrs.type)||(t.join(r),!0)},An=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:c,commands:d,can:h})=>{const{extensions:u,splittableMarks:p}=o.extensionManager,f=q(t,s.schema),m=q(e,s.schema),{selection:g,storedMarks:y}=s,{$from:v,$to:w}=g,b=v.blockRange(w),k=y||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;const x=re(t=>qe(t.type.name,u))(g),S=0===g.from&&g.to===s.doc.content.size,M=s.doc.content.content,C=1===M.length?M[0]:null,O=S&&C&&qe(C.type.name,u)?{node:C,pos:0,depth:0}:null,N=null!=x?x:O,E=!!O;if((x&&b.depth>=1&&b.depth-x.depth<=1||E)&&N){if(N.node.type===f)return S&&E?c().command(({tr:t,dispatch:e})=>{const n=function(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),o=e.resolve(n.nodeSize-1);return a.U3.between(r,o)}(t);return!!n&&(t.setSelection(n),e&&e(t),!0)}).liftListItem(m).run():d.liftListItem(m);if(qe(N.node.type.name,u)&&f.validContent(N.node.content))return c().command(()=>(i.setNodeMarkup(N.pos,f),!0)).command(()=>Tn(i,f)).command(()=>Dn(i,f)).run()}return n&&k&&l?c().command(()=>{const t=h().wrapInList(f,r),e=k.filter(t=>p.includes(t.type.name));return i.ensureMarks(e),!!t||d.clearNodes()}).wrapInList(f,r).command(()=>Tn(i,f)).command(()=>Dn(i,f)).run():c().command(()=>!!h().wrapInList(f,r)||d.clearNodes()).wrapInList(f,r).command(()=>Tn(i,f)).command(()=>Dn(i,f)).run()},Rn=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=ot(t,r.schema);return je(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},zn=(t,e,n={})=>({state:r,commands:o})=>{const i=q(t,r.schema),s=q(e,r.schema),a=It(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(s,l):o.setNode(i,{...l,...n})},$n=(t,e={})=>({state:n,commands:r})=>{const o=q(t,n.schema);return It(n,o,e)?r.lift(o):r.wrapIn(o,e)},In=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){const e=t.tr,n=i.transform;for(let t=n.steps.length-1;t>=0;t-=1)e.step(n.steps[t].invert(n.docs[t]));if(i.text){const n=e.doc.resolve(i.from).marks();e.replaceWith(i.from,i.to,t.schema.text(i.text,n))}else e.delete(i.from,i.to)}return!0}}return!1},Pn=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:o=!1}=t,{selection:i}=e,{empty:s,ranges:a}=i;if(s)return!0;const{nonClearableMarks:l}=r.extensionManager;if(n){const t=Object.values(r.schema.marks).filter(t=>o||!l.includes(t.name));a.forEach(n=>{for(const r of t)e.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},Fn=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{extendEmptyMarkRange:i=!1}=e,{selection:s}=n,a=ot(t,r.schema),{$from:l,empty:c,ranges:d}=s;if(!o)return!0;
1if(c&&i){var h;let{from:t,to:e}=s;const r=rt(l,a,null===(h=l.marks().find(t=>t.type===a))||void 0===h?void 0:h.attrs);r&&(t=r.from,e=r.to),n.removeMark(t,e,a)}else d.forEach(t=>{n.removeMark(t.$from.pos,t.$to.pos,a)});return n.removeStoredMark(a),!0},Bn=t=>({tr:e,state:n,dispatch:r})=>{const{selection:o}=n;let i,s;return"number"==typeof t?(i=t,s=t):t&&"from"in t&&"to"in t?(i=t.from,s=t.to):(i=o.from,s=o.to),r&&e.doc.nodesBetween(i,s,(t,n)=>{if(t.isText)return;const r={...t.attrs};delete r.dir,e.setNodeMarkup(n,void 0,r)}),!0},Vn=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Lt("string"==typeof t?t:t.name,r.schema);if(!a)return!1;"node"===a&&(i=q(t,r.schema)),"mark"===a&&(s=ot(t,r.schema));let l=!1;return n.selection.ranges.forEach(t=>{const a=t.$from.pos,c=t.$to.pos;let d,h,u,p;n.selection.empty?r.doc.nodesBetween(a,c,(t,e)=>{i&&i===t.type&&(l=!0,u=Math.max(e,a),p=Math.min(e+t.nodeSize,c),d=e,h=t)}):r.doc.nodesBetween(a,c,(t,r)=>{r<a&&i&&i===t.type&&(l=!0,u=Math.max(r,a),p=Math.min(r+t.nodeSize,c),d=r,h=t),r>=a&&r<=c&&(i&&i===t.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,{...t.attrs,...e})),s&&t.marks.length&&t.marks.forEach(i=>{if(s===i.type&&(l=!0,o)){const o=Math.max(r,a),l=Math.min(r+t.nodeSize,c);n.addMark(o,l,s.create({...i.attrs,...e}))}}))}),h&&(void 0!==d&&o&&n.setNodeMarkup(d,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(t=>{s===t.type&&o&&n.addMark(u,p,s.create({...t.attrs,...e}))}))}),l},Ln=new a.hs("__tiptap_decorations__"),jn=t=>({tr:e,dispatch:n})=>(n&&e.setMeta(Ln,{type:"force",name:t}),!0),Kn=(t,e={})=>({state:n,dispatch:r})=>function(t,e=null){return function(n,r){let{$from:o,$to:s}=n.selection,a=o.blockRange(s),l=a&&(0,i.oM)(a,t,e);return!!l&&(r&&r(n.tr.wrap(a,l).scrollIntoView()),!0)}}(q(t,n.schema),e)(n,r),Jn=(t,e={})=>({state:n,dispatch:r})=>function(t,e=null){return function(n,r){let{$from:o,$to:a}=n.selection,l=o.blockRange(a);if(!l)return!1;let c=r?n.tr:null;return!!function(t,e,n,r=null){let o=!1,a=e,l=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&0==e.startIndex){if(0==e.$from.index(e.depth-1))return!1;let t=l.resolve(e.start-2);a=new s.u$(t,t,e.depth),e.endIndex<e.parent.childCount&&(e=new s.u$(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let c=(0,i.oM)(a,n,r,e);return!!c&&(t&&function(t,e,n,r,o){let a=s.FK.empty;for(let t=n.length-1;t>=0;t--)a=s.FK.from(n[t].type.create(n[t].attrs,a));t.step(new i.Wg(e.start-(r?2:0),e.end,e.start,e.end,new s.Ji(a,0,0),n.length,!0));let l=0;for(let t=0;t<n.length;t++)n[t].type==o&&(l=t+1);let c=n.length-l,d=e.start+n.length-(r?2:0),h=e.parent;for(let n=e.startIndex,r=e.endIndex,o=!0;n<r;n++,o=!1)!o&&(0,i.zy)(t.doc,d,c)&&(t.split(d,c),d+=2*c),d+=h.child(n).nodeSize}(t,e,c,o,n),!0)}(c,l,t,e)&&(r&&r(c.scrollIntoView()),!0)}}(q(t,n.schema),e)(n,r);var Wn=o({blur:()=>V,clearContent:()=>L,clearNodes:()=>j,command:()=>K,createParagraphNear:()=>J,cut:()=>W,deleteCurrentNode:()=>U,deleteNode:()=>H,deleteRange:()=>_,deleteSelection:()=>Y,enter:()=>G,exitCode:()=>Z,extendMarkRange:()=>it,first:()=>st,focus:()=>pt,forEach:()=>ft,insertContent:()=>mt,insertContentAt:()=>xt,insertDefaultBlock:()=>Mt,joinBackward:()=>Nt,joinDown:()=>Ot,joinForward:()=>Et,joinItemBackward:()=>Tt,joinItemForward:()=>Dt,joinTextblockBackward:()=>At,joinTextblockForward:()=>Rt,joinUp:()=>Ct,keyboardShortcut:()=>$t,lift:()=>Pt,liftEmptyBlock:()=>Ft,liftListItem:()=>Bt,newlineInCode:()=>Vt,resetAttributes:()=>Kt,scrollIntoView:()=>Jt,selectAll:()=>Wt,selectNodeBackward:()=>Ut,selectNodeForward:()=>qt,selectParentNode:()=>Ht,selectTextblockEnd:()=>_t,selectTextblockStart:()=>Xt,setContent:()=>Gt,setMark:()=>yn,setMeta:()=>vn,setNode:()=>wn,setNodeSelection:()=>bn,setTextDirection:()=>kn,setTextSelection:()=>xn,sinkListItem:()=>Sn,splitBlock:()=>Cn,splitListItem:()=>On,toggleList:()=>An,toggleMark:()=>Rn,toggleNode:()=>zn,toggleWrap:()=>$n,undoInputRule:()=>In,unsetAllMarks:()=>Pn,unsetMark:()=>Fn,unsetTextDirection:()=>Bn,updateAttributes:()=>Vn,updateDecorations:()=>jn,wrapIn:()=>Kn,wrapInList:()=>Jn});const Un=new WeakMap;var qn=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];
1return n&&n.forEach(t=>t.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(t=>t!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}};const Hn="undefined"!=typeof process&&!1;function _n(t){return"widget"===t.kind}function Xn(t,e){const n=[],r=new Set;for(const o of t)"widget"===o.kind&&_n(o)&&r.add(o.key),n.push(o.toPMDecoration(e));return{decorations:n,widgetKeys:r}}function Yn({position:t,from:e,to:n,docSize:r}){return!(t<e)&&(t<n||t===n&&n===r)}function Gn({decorations:t,from:e,to:n,docSize:r,extensionName:o,warnedExtensions:i}){return t.filter(t=>!!Yn({position:t.anchor,from:e,to:n,docSize:r})||(t.anchor===n||i.has(o)||(i.add(o),console.warn(`[tiptap warn]: Extension "${o}" returned a decoration outside the requested range [${e}, ${n}). It was ignored.`)),!1))}function Zn(t){var e;const n=null===(e=t.spec)||void 0===e?void 0:e.key;return"string"==typeof n?n:void 0}function Qn(t){return"attr"===t.jsonID}function tr(t,e){let n=null,r=0,o=0;for(let i=0;i<t.childCount&&!(o>e.to);i+=1){const s=o+t.child(i).nodeSize;s>=e.from&&(null===n&&(n=o),r=s),o=s}return null===n?null:{from:n,to:r}}function er(t,e,n,r){return t.map(e,n,{onRemove:t=>{const e=null==t?void 0:t.key;"string"==typeof e&&r.delete(e)}})}function nr(t,e,n){var r,o;const i=null!==(r=e.decorationSetsByExtension[t])&&void 0!==r?r:I.zF.empty,s=new Set(null!==(o=e.widgetKeysByExtension[t])&&void 0!==o?o:[]);return{set:er(i,n.mapping,n.doc,s),widgetKeys:s}}function rr(t,e){const n=Object.values(e).flatMap(t=>t.find());return I.zF.create(t,n)}function or(t){const e=new Set;for(const n of Object.values(t))for(const t of n)e.add(t);return e}function ir(t,e,n){return!!n||"manual"!==t.update&&(t.shouldUpdate?t.shouldUpdate(e):e.tr.docChanged)}const sr=new Set;function ar(t){var e,n;return null!==(e=null===(n=t.extensionManager)||void 0===n||null===(n=n.decorationManager)||void 0===n?void 0:n.liveWidgetKeys())&&void 0!==e?e:sr}var lr=class{constructor(t){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:t})=>{const e=Ln.getState(t);e&&this.warnDuplicateWidgetKeys(e)},this.editor=t.editor,this.entries=this.resolveEntries(t.entries),this.entries.forEach(({name:t,spec:e})=>function(t,e){var n;switch(null!==(n=e.update)&&void 0!==n?n:"document"){case"document":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(e.shouldUpdate)throw new Error(`[tiptap error]: Extension "${t}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${t}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}(t,e)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var t,e;return null!==(t=null===(e=Ln.getState(this.editor.state))||void 0===e?void 0:e.widgetKeys)&&void 0!==t?t:sr}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(t){const e=[];for(const{name:n,addDecorations:r}of t){const t=r();t&&e.push({name:n,spec:t})}return e}createPlugin(){const{editor:t,entries:e}=this;return new a.k_({key:Ln,state:{init:(t,n)=>{const r={},o={};for(const{name:t,spec:i}of e){const{set:e,widgetKeys:s}=this.buildFullSet(t,i,n);r[t]=e,o[t]=s}const i={decorationSetsByExtension:r,widgetKeysByExtension:o,mergedDecorationSet:this.buildMergedSet(n.doc,r),widgetKeys:or(o)};return this.warnDuplicateWidgetKeys(i),i},apply:(n,r,o,i)=>{const s=n.getMeta(Ln),a="force"===(null==s?void 0:s.type)&&!s.name,l="force"===(null==s?void 0:s.type)?s.name:void 0,c={},d={},h=new Set;return function(t,e){var n;Un.set(t,(null!==(n=Un.get(t))&&void 0!==n?n:0)+1);try{return e()}finally{var r;const e=(null!==(r=Un.get(t))&&void 0!==r?r:1)-1;e>0?Un.set(t,e):Un.delete(t)}}(t,()=>{for(const{name:s,spec:u}of e){const e=a||l===s;if(ir(u,{editor:t,tr:n,oldState:o,newState:i},e))if("changedRanges"===u.update&&n.docChanged&&!e){const t=this.applyChangedRangesRecompute(s,u,r,n,i);
1c[s]=t.set,d[s]=t.widgetKeys,h.add(s)}else{const{set:t,widgetKeys:e}=this.buildFullSet(s,u,i);c[s]=t,d[s]=e,h.add(s)}else{const t=nr(s,r,n);c[s]=t.set,d[s]=t.widgetKeys}}}),0!==h.size||n.docChanged?{decorationSetsByExtension:c,widgetKeysByExtension:d,mergedDecorationSet:this.mergeAfterApply({entries:e,previous:r,tr:n,decorationSetsByExtension:c,recomputedNames:h}),widgetKeys:or(d)}:r}},props:{decorations(t){var e,n;return null!==(e=null===(n=Ln.getState(t))||void 0===n?void 0:n.mergedDecorationSet)&&void 0!==e?e:I.zF.empty}}})}applyChangedRangesRecompute(t,e,n,r,o){const i=function(t,e){if(t.steps.some(t=>!function(t){let e=!1;if(t.getMap().forEach(()=>{e=!0}),e||Qn(t))return!0;const n=t;return"number"==typeof n.from&&"number"==typeof n.to}(t)))return{type:"full"};const n=ze(t).map(({newRange:t})=>t);t.steps.forEach((e,r)=>{if(!Qn(e))return;const o=t.mapping.slice(r);n.push({from:o.map(e.pos,-1),to:o.map(e.pos+1)})});const r=[];for(const t of n){const n=tr(e,t);n&&r.push(n)}r.sort((t,e)=>t.from-e.from);const o=[];for(const t of r){const e=o[o.length-1];e&&t.from<=e.to?e.to=Math.max(e.to,t.to):o.push({...t})}return{type:"ranges",ranges:o}}(r,o.doc);return"full"===i.type?this.buildFullSet(t,e,o):this.rebuildRanges(t,e,n,r,o,i.ranges)}rebuildRanges(t,e,n,r,o,i){var s,a;const l=null!==(s=n.decorationSetsByExtension[t])&&void 0!==s?s:I.zF.empty,c=new Set(null!==(a=n.widgetKeysByExtension[t])&&void 0!==a?a:[]);let d=er(l,r.mapping,r.doc,c);const h=o.doc.content.size;for(const{from:n,to:r}of i){const i=d.find(n,r).filter(t=>Yn({position:t.from,from:n,to:r,docSize:h}));for(const t of i){const e=Zn(t);e&&c.delete(e)}d=d.remove(i);const{decorations:s,widgetKeys:a}=Xn(Gn({decorations:this.runCreate(t,"createInRange",()=>e.createInRange({editor:this.editor,state:o,view:this.mountedView,from:n,to:r})),from:n,to:r,docSize:h,extensionName:t,warnedExtensions:this.warnedOutOfRangeExtensions}),t);d=d.add(o.doc,s);for(const t of a)c.add(t)}return{set:d,widgetKeys:c}}buildFullSet(t,e,n){const r=this.runCreate(t,"create",()=>e.create({editor:this.editor,state:n,view:this.mountedView}));
1return function(t,e,n){const{decorations:r,widgetKeys:o}=Xn(e,n);return{set:I.zF.create(t,r),widgetKeys:o}}(n.doc,r,t)}runCreate(t,e,n){try{return n()}catch(n){return console.error(`[tiptap error]: Extension "${t}" threw in \`addDecorations().${e}()\`. Its decorations were dropped for this update.`,n),[]}}warnDuplicateWidgetKeys(t){if(!Hn)return;if(0===t.widgetKeys.size)return void this.warnedWidgetKeys.clear();const e=function(t){const e=new Map,n=new Map;for(const s of t.find()){var r,o,i;const t=Zn(s);if(!t)continue;const a=null!==(r=s.spec.extensionName)&&void 0!==r?r:"unknown",l=null!==(o=e.get(t))&&void 0!==o?o:new Set;l.add(a),e.set(t,l),n.set(t,(null!==(i=n.get(t))&&void 0!==i?i:0)+1)}return Array.from(e,([t,e])=>({key:t,extensions:e})).filter(({key:t})=>{var e;return(null!==(e=n.get(t))&&void 0!==e?e:0)>1})}(t.mergedDecorationSet),n=new Set(e.map(({key:t})=>t));for(const{key:t,extensions:n}of e){if(this.warnedWidgetKeys.has(t))continue;const e=Array.from(n).map(t=>`"${t}"`).join(", ");console.warn(`[tiptap warn]: Duplicate widget decoration key "${t}" in extension${1===n.size?"":"s"} ${e}. 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(t,e){const n=Object.keys(e);return 1===n.length?e[n[0]]:rr(t,e)}mergeAfterApply({entries:t,previous:e,tr:n,decorationSetsByExtension:r,recomputedNames:o}){return 1===t.length?r[t[0].name]:0===o.size?e.mergedDecorationSet.map(n.mapping,n.doc):rr(n.doc,r)}};function cr(t,e){if(t===e)return!0;if(!t||!e)return!1;const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(n=>Object.prototype.hasOwnProperty.call(e,n)&&Object.is(t[n],e[n]))}function dr(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof a.nh){const t=r.index();return r.parent.canReplaceWith(t,t+1,e)}let o=r.depth;for(;o>=0;){const t=r.index(o);if(r.node(o).contentMatchAt(t).matchType(e))return!0;o-=1}return!1}function hr(t,e,n){const r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(null!==r)return r;const o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute("data-tiptap-style"+(n?`-${n}`:""),""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}function ur(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function pr(t,e){const n=t.getAttribute("style");if(!n)return null;const r=n.split(";").map(t=>t.trim()).filter(Boolean),o=e.toLowerCase();for(let t=r.length-1;t>=0;t-=1){const e=r[t],n=e.indexOf(":");if(-1!==n&&e.slice(0,n).trim().toLowerCase()===o)return e.slice(n+1).trim()}return null}function fr(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&amp;/g,"&")}function mr(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function gr(){return"undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent)}function yr(t){return"number"==typeof t}function vr(t){return"Object"===function(t){return Object.prototype.toString.call(t).slice(8,-1)}(t)&&t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function wr(t){return"string"==typeof t}function br(t){return/\s/.test(t)}function kr(t){return/^\w$/.test(t)}function xr(t,e){for(;e<t.length&&br(t[e]);)e+=1;return e}function Sr(t,e){for(;e<t.length&&!br(t[e]);)e+=1;return e}function Mr(t,e,n){for(;e<t.length&&(kr(t[e])||n&&"-"===t[e]);)e+=1;return e}function Cr(t,e,n){const r=t[e];return"pandoc"!==n||"."!==r&&"#"!==r?'"'===r||"'"===r?function(t,e){const n=t.indexOf(t[e],e+1);return{nextIndex:Sr(t,-1===n?e:n+1)}}(t,e):("pandoc"===n?/^[a-zA-Z]$/.test(r):kr(r))?function(t,e,n){const r="pandoc"===n,o=Mr(t,e+1,r),i=t.slice(e,o),s=function(t,e,n,r){let o=r?xr(t,n):n;if("="!==t[o])return;o=r?xr(t,o+1):o+1;const i=t[o];if('"'!==i&&"'"!==i)return;const s=t.indexOf(i,o+1);return-1!==s?{token:{type:"keyValue",name:e,value:t.slice(o+1,s)},nextIndex:Sr(t,s+1)}:void 0}(t,i,o,r);if(s)return s;const a=o===t.length||br(t[o]);return{token:r&&a?{type:"boolean",name:i}:void 0,nextIndex:"shortcode"===n?Sr(t,o):o}}
1(t,e,n):{nextIndex:Sr(t,e)}:function(t,e){const n=t[e],r=e+1,o=Mr(t,r,!0);return o===r?{nextIndex:Sr(t,o)}:{token:{type:"."===n?"class":"id",name:t.slice(r,o)},nextIndex:Sr(t,o)}}(t,e)}function Or(t,e){const n=[];let r=0;for(;r<t.length&&(r=xr(t,r),!(r>=t.length));){const o=Cr(t,r,e);o.token&&n.push(o.token),r=o.nextIndex}return n}function Nr(t){return(null==t?void 0:t.trim())?function(t){const e={},n=t.filter(t=>"class"===t.type).map(t=>t.name),r=t.find(t=>"id"===t.type);return n.length>0&&(e.class=n.join(" ")),r&&(e.id=r.name),t.forEach(t=>{"keyValue"===t.type&&(e[t.name]=t.value)}),t.forEach(t=>{"boolean"===t.type&&(e[t.name]=!0)}),e}(Or(t,"pandoc")):{}}function Er(t){if(!t||0===Object.keys(t).length)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(t=>e.push(`.${t}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([t,n])=>{"class"!==t&&"id"!==t&&(!0===n?e.push(t):!1!==n&&null!=n&&e.push(`${t}="${String(n)}"`))}),e.join(" ")}function Tr(t){const{nodeName:e,name:n,parseAttributes:r=Nr,serializeAttributes:o=Er,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:a}=t,l=n||e;return{parseMarkdown:(t,n)=>{const r={...i,...t.attributes};return n.createNode(e,r,[])},markdownTokenizer:{name:e,level:"block",start(t){var e;const n=new RegExp(`^:::${l}(?:\\s|$)`,"m"),r=null===(e=t.match(n))||void 0===e?void 0:e.index;return void 0!==r?r:-1},tokenize(t,n,o){const i=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),a=t.match(i);if(!a)return;const c=a[1]||"",d=r(c);return s.find(t=>!(t in d))?void 0:{type:e,raw:a[0],attributes:d}}},renderMarkdown:t=>{const e=(t=>{if(!a)return t;const e={};return a.forEach(n=>{n in t&&(e[n]=t[n])}),e})(t.attrs||{}),n=o(e);return`:::${l}${n?` {${n}}`:""} :::`}}}function Dr(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=Nr,serializeAttributes:i=Er,defaultAttributes:s={},content:a="block",allowedAttributes:l}=t,c=n||e;return{parseMarkdown:(t,n)=>{let o;if(r){const e=r(t);o="string"==typeof e?[{type:"text",text:e}]:e}else o="block"===a?n.parseChildren(t.tokens||[]):n.parseInline(t.tokens||[]);const i={...s,...t.attributes};return n.createNode(e,i,o)},markdownTokenizer:{name:e,level:"block",start(t){var e;const n=new RegExp(`^:::${c}`,"m"),r=null===(e=t.match(n))||void 0===e?void 0:e.index;return void 0!==r?r:-1},tokenize(t,n,r){const i=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),s=t.match(i);if(!s)return;const[l,d=""]=s,h=o(d);let u=1;const p=l.length;let f="";const m=/^:::([\w-]*)(\s.*)?/gm,g=t.slice(p);for(m.lastIndex=0;;){var y;const n=m.exec(g);if(null===n)break;const o=n.index,i=n[1];if(!(null===(y=n[2])||void 0===y?void 0:y.endsWith(":::")))if(i)u+=1;else if(u-=1,0===u){const i=g.slice(0,o);f=i.trim();const s=t.slice(0,p+o+n[0].length);let l=[];if(f)if("block"===a)for(l=r.blockTokens(i),l.forEach(t=>{!t.text||t.tokens&&0!==t.tokens.length||(t.tokens=r.inlineTokens(t.text))});l.length>0;){const t=l[l.length-1];if("paragraph"!==t.type||t.text&&""!==t.text.trim())break;l.pop()}else l=r.inlineTokens(f);return{type:e,raw:s,attributes:h,content:f,tokens:l}}}}},renderMarkdown:(t,e)=>{const n=(t=>{if(!l)return t;const e={};return l.forEach(n=>{n in t&&(e[n]=t[n])}),e})(t.attrs||{}),r=i(n),o=r?` {${r}}`:"",s=e.renderChildren(t.content||[],"\n\n");return`:::${c}${o}\n\n${s}\n\n:::`}}}function Ar(t){const e={};return Or(t,"shortcode").forEach(t=>{"keyValue"===t.type&&(e[t.name]=t.value)}),e}function Rr(t){return Object.entries(t).filter(([,t])=>null!=t).map(([t,e])=>`${t}="${e}"`).join(" ")}function zr(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=Ar,serializeAttributes:i=Rr,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=t,c=n||e,d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(t,n)=>{const o={...s,...t.attributes};if(a)return n.createNode(e,o);const i=r?r(t):t.content||"";return i?n.createNode(e,o,[n.createTextNode(i)]):n.createNode(e,o,[])},markdownTokenizer:{name:e,level:"inline",start(t){const e=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=t.match(e),r=null==n?void 0:n.index;return void 0!==r?r:-1}
1,tokenize(t,n,r){const i=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),s=t.match(i);if(!s)return;let l="",c="";if(a){const[,t]=s;c=t}else{const[,t,e]=s;c=t,l=e||""}const h=o(c.trim());return{type:e,raw:s[0],content:l.trim(),attributes:h}}},renderMarkdown:t=>{let e="";r?e=r(t):t.content&&t.content.length>0&&(e=t.content.filter(t=>"text"===t.type).map(t=>t.text).join(""));const n=(t=>{if(!l)return t;const e={};return l.forEach(n=>{const r="string"==typeof n?n:n.name,o="string"==typeof n?void 0:n.skipIfDefault;if(r in t){const n=t[r];if(void 0!==o&&n===o)return;e[r]=n}}),e})(t.attrs||{}),o=i(n),s=o?` ${o}`:"";return a?`[${c}${s}]`:`[${c}${s}]${e}[/${c}]`}}}function $r(t,e,n){const r=t.split("\n"),o=[];let i="",s=0;const a=e.baseIndentSize||2;for(;s<r.length;){const t=r[s],d=t.match(e.itemPattern);if(!d){if(o.length>0)break;if(""===t.trim()){s+=1,i=`${i}${t}\n`;continue}return}const h=e.extractItemData(d),{indentLevel:u,mainContent:p}=h;i=`${i}${t}\n`;const f=[p];for(s+=1;s<r.length;){var l;const t=r[s];if(""===t.trim()){var c;const e=r.slice(s+1).findIndex(t=>""!==t.trim());if(-1===e)break;if(((null===(c=r[s+1+e].match(/^(\s*)/))||void 0===c||null===(c=c[1])||void 0===c?void 0:c.length)||0)>u){f.push(t),i=`${i}${t}\n`,s+=1;continue}break}if(!(((null===(l=t.match(/^(\s*)/))||void 0===l||null===(l=l[1])||void 0===l?void 0:l.length)||0)>u))break;f.push(t),i=`${i}${t}\n`,s+=1}let m;const g=f.slice(1);if(g.length>0){const t=g.map(t=>t.slice(u+a)).join("\n");t.trim()&&(m=e.customNestedParser?e.customNestedParser(t):n.blockTokens(t))}const y=e.createToken(h,m);o.push(y)}if(0!==o.length)return{items:o,raw:i}}const Ir=4;function Pr(t){let e=0;for(const n of t)e="\t"===n?e+Ir-e%Ir:e+1;return e}function Fr(t,e,n,r,o){if(!t||!Array.isArray(t.content))return"";const i="function"==typeof n?n(r):n,[s,...a]=t.content;let l=`${i}${e.renderChildren([s])}`;return a&&a.length>0&&a.forEach((t,n)=>{var r,s;const a=null!==(r=null===(s=e.renderChild)||void 0===s?void 0:s.call(e,t,n+1))&&void 0!==r?r:e.renderChildren([t]);if(null!=a){const n=t=>{if(!(null==o?void 0:o.alignNestedToPrefix))return e.indent(t);const n=e.indent(""),r=Pr(i);return(Pr(n)>=r?n:" ".repeat(r))+t},r=a.split("\n").map(t=>n(t||"")).join("\n");l+="paragraph"===t.type?`\n\n${r}`:`\n${r}`}}),l}var Br=o({createAtomBlockMarkdownSpec:()=>Tr,createBlockMarkdownSpec:()=>Dr,createInlineMarkdownSpec:()=>zr,parseAttributes:()=>Nr,parseIndentedBlocks:()=>$r,renderNestedMarkdownContent:()=>Fr,serializeAttributes:()=>Er});function Vr(t){return"string"==typeof t.type?t.type:t.type.name}function Lr(t,e){if(t.length!==e.length)return!1;const n=Array.from({length:e.length},()=>!1);return t.every(t=>{const r=Vr(t),o=e.findIndex((e,o)=>!n[o]&&r===Vr(e)&&cr(t.attrs,e.attrs));return-1!==o&&(n[o]=!0,!0)})}function jr(t,e){const n={...t};return vr(t)&&vr(e)&&Object.keys(e).forEach(r=>{vr(e[r])&&vr(t[r])?n[r]=jr(t[r],e[r]):n[r]=e[r]}),n}function Kr(t,e,n={}){const{state:r}=e,{doc:o,tr:i}=r,s=t;o.descendants((e,r)=>{const o=i.mapping.map(r),a=i.mapping.map(r)+e.nodeSize;let l=null;if(e.marks.forEach(t=>{if(t!==s)return!1;l=t}),!l)return;let c=!1;if(Object.keys(n).forEach(t=>{n[t]!==l.attrs[t]&&(c=!0)}),c){const e=t.type.create({...t.attrs,...n});i.removeMark(o,a,t.type),i.addMark(o,a,e)}}),i.docChanged&&e.view.dispatch(i)}var Jr=class{constructor(t,e,n){this.component=t,this.editor=e.editor,this.options={...n},this.mark=e.mark,this.HTMLAttributes=e.HTMLAttributes}get dom(){return this.editor.view.dom}get contentDOM(){return null}updateAttributes(t,e){Kr(e||this.mark,this.editor,t)}ignoreMutation(t){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:t}):!("selection"===t.type||this.contentDOM.contains(t.target)&&"childList"===t.type&&(ht()||dt())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(t=>t.isContentEditable)||(this.contentDOM!==t.target||"attributes"!==t.type)&&this.contentDOM.contains(t.target)))}},Wr=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=null===(e=t.undoable)||void 0===e||e}};const Ur=(t,e)=>{if(Q(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];
1return r.index=n.index,r.input=t,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 qr(t){var e;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(null===(e=c.nodeBefore||c.nodeAfter)||void 0===e?void 0:e.marks.find(t=>t.type.spec.code)))return!1;let d=!1;const h=Le(c)+i;return s.forEach(t=>{if(d)return;const e=Ur(h,t.find);if(!e)return;const s=e[0].length-i.length;if(s>0){const t=c.parentOffset-s;if(t<0||c.parent.textBetween(t,c.parentOffset)!==e[0].slice(0,s))return}const u=l.state.tr,p=F({state:l.state,transaction:u}),f={from:r-(e[0].length-i.length),to:o},{commands:m,chain:g,can:y}=new B({editor:n,state:p});null!==t.handler({state:p,range:f,match:e,commands:m,chain:g,can:y})&&u.steps.length&&(t.undoable&&u.setMeta(a,{transform:u,from:r,to:o,text:i}),l.dispatch(u),d=!0)}),d}function Hr(t){const{editor:e,rules:n}=t,r=new a.k_({state:{init(){return null},apply(t,o,i){const a=t.getMeta(r);if(a)return a;const l=t.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:t}=l;"string"==typeof t||(t=se(s.FK.from(t),i.schema));const{from:o}=l,a=o+t.length;qr({editor:e,from:o,to:a,text:t,rules:n,plugin:r})}),t.selectionSet||t.docChanged?null:o}},props:{handleTextInput(t,o,i,s){return qr({editor:e,from:o,to:i,text:s,rules:n,plugin:r})},handleDOMEvents:{compositionend:t=>(setTimeout(()=>{const{$cursor:o}=t.state.selection;o&&qr({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(t,o){if("Enter"!==o.key)return!1;const{$cursor:i}=t.state.selection;return!!i&&qr({editor:e,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}var _r=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...le(oe(this,"addOptions",{name:this.name}))}}get storage(){return{...le(oe(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>jr(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Xr=class t extends _r{constructor(...t){super(...t),this.type="mark"}static create(e={}){const n="function"==typeof e?e():e;return new t(n)}static handleExit({editor:t,mark:e}){const{tr:n}=t.state,r=t.state.selection.$from;if(r.pos===r.end()){const o=r.marks();if(!o.find(t=>(null==t?void 0:t.type.name)===e.name))return!1;const i=o.find(t=>(null==t?void 0:t.type.name)===e.name);return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),t.view.dispatch(n),!0}return!1}configure(t){return super.configure(t)}extend(t){const e="function"==typeof t?t():t;return super.extend(e)}},Yr=class{constructor(t){this.find=t.find,this.handler=t.handler}};const Gr=(t,e,n)=>{if(Q(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(e=>{const n=[e.text];return n.index=e.index,n.input=t,n.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(e.replaceWith)),n}):[]};let Zr=null;const Qr=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null===(e=n.clipboardData)||void 0===e||e.setData("text/html",t),n};function to(t){const{editor:e,rules:n}=t;let r,o=null,i=!1,l=!1,c="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}const d=({state:t,from:n,to:o,rule:i,pasteEvt:s})=>{const a=t.tr,l=F({state:t,transaction:a});if(function(t){const{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:c,can:d}=new B({editor:e,state:n}),h=[];return n.doc.nodesBetween(r,o,(t,e)=>{var u,p,f,m;if((null===(u=t.type)||void 0===u||null===(u=u.spec)||void 0===u?void 0:u.code)||!(t.isText||t.isTextblock||t.isInline))return;const g=null!==(p=null!==(f=null===(m=t.content)||void 0===m?void 0:m.size)&&void 0!==f?f:t.nodeSize)&&void 0!==p?p:0,y=Math.max(r,e),v=Math.min(o,e+g);if(y>=v)return;const w=t.isText?t.text||"":t.textBetween(y-e,v-e,void 0,"");
1Gr(w,i.find,s).forEach(t=>{if(void 0===t.index)return;const e=y+t.index+1,r=e+t[0].length,o={from:n.tr.mapping.map(e),to:n.tr.mapping.map(r)},u=i.handler({state:n,range:o,match:t,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});h.push(u)})}),h.every(t=>null!==t)}({editor:e,state:l,from:Math.max(n-1,0),to:o.b-1,rule:i,pasteEvent:s,dropEvent:r})&&a.steps.length){try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}return c="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return n.map(t=>new a.k_({view(t){const n=n=>{var r;o=(null===(r=t.dom.parentElement)||void 0===r?void 0:r.contains(n.target))?t.dom.parentElement:null,o&&(Zr=e)},r=()=>{Zr&&(Zr=null)};return window.addEventListener("dragstart",n),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",n),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(t,e)=>{if(l=o===t.dom.parentElement,r=e,!l){const t=Zr;(null==t?void 0:t.isEditable)&&setTimeout(()=>{const e=t.state.selection;e&&t.commands.deleteRange({from:e.from,to:e.to})},10)}return!1},paste:(t,e)=>{var n;const r=null===(n=e.clipboardData)||void 0===n?void 0:n.getData("text/html");return c=e,i=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(e,n,r)=>{const o=e[0],a="paste"===o.getMeta("uiEvent")&&!i,h="drop"===o.getMeta("uiEvent")&&!l,u=o.getMeta("applyPasteRules"),p=!!u;if(!a&&!h&&!p)return;if(p){let{text:e}=u;"string"==typeof e||(e=se(s.FK.from(e),r.schema));const{from:n}=u,o=n+e.length,i=Qr(e);return d({rule:t,state:r,from:n,to:{b:o},pasteEvt:i})}const f=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);return yr(f)&&m&&f!==m.b?d({rule:t,state:r,from:f,to:m,pasteEvt:c}):void 0}}))}var eo=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=e,this.baseExtensions=t,this.extensions=xe(t),this.schema=we(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n=oe(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Be(e.name,this.schema)});return n?{...t,...n()}:t},{})}get plugins(){const{editor:t}=this,e=ke([...this.extensions].reverse()).flatMap(e=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:Be(e.name,this.schema)},r=[],o=oe(e,"addKeyboardShortcuts",n);let i={};if("mark"===e.type&&oe(e,"exitable",n)&&(i.ArrowRight=()=>Xr.handleExit({editor:t,mark:e})),o){const e=Object.fromEntries(Object.entries(o()).map(([e,n])=>[e,()=>n({editor:t})]));i={...i,...e}}const s=(0,P.w)(i);r.push(s);const a=oe(e,"addInputRules",n);if(Ue(e,t.options.enableInputRules)&&a){const e=a();if(e&&e.length){const n=Hr({editor:t,rules:e}),o=Array.isArray(n)?n:[n];r.push(...o)}}const l=oe(e,"addPasteRules",n);if(Ue(e,t.options.enablePasteRules)&&l){const e=l();if(e&&e.length){const n=to({editor:t,rules:e});r.push(...n)}}const c=oe(e,"addProseMirrorPlugins",n);if(c){const t=c();r.push(...t)}return r}),n=this.createDecorationPlugin();return n&&e.push(n),e}createDecorationPlugin(){var t;const{editor:e}=this;null===(t=this.decorationManager)||void 0===t||t.destroy();const n=[];return this.extensions.forEach(t=>{const r=oe(t,"addDecorations",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Be(t.name,this.schema)});r&&n.push({name:t.name,addDecorations:r})}),this.decorationManager=new lr({editor:e,entries:n}),this.decorationManager.plugin}get attributes(){return he(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=de(this.extensions);return Object.fromEntries(e.filter(t=>!!oe(t,"addNodeView")).map(e=>{const n=this.attributes.filter(t=>t.type===e.name),r=oe(e,"addNodeView",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:q(e.name,this.schema)});if(!r)return[];const o=r();return o?[e.name,(r,i,s,a,l)=>{const c=fe(r,n);return o({node:r,view:i,getPos:s,decorations:a,innerDecorations:l,editor:t,extension:e,HTMLAttributes:c})}]:[]}))}dispatchTransaction(t){const{editor:e}=this;return ke([...this.extensions].reverse()).reduceRight((t,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Be(n.name,this.schema)},o=oe(n,"dispatchTransaction",r);return o?e=>{o.call(r,{transaction:e,next:t})}:t},t)}transformPastedHTML(t){const{editor:e}=this;return ke([...this.extensions]).reduce((t,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Be(n.name,this.schema)},o=oe(n,"transformPastedHTML",r);return o?(e,n)=>{const i=t(e,n);return o.call(r,i)}:t},t||(t=>t))}get markViews(){const{editor:t}=this,{markExtensions:e}=de(this.extensions);return Object.fromEntries(e.filter(t=>!!oe(t,"addMarkView")).map(e=>{const n=this.attributes.filter(t=>t.type===e.name),r=oe(e,"addMarkView",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:ot(e.name,this.schema)});return r?[e.name,(o,i,s)=>{const a=fe(o,n);return r()({mark:o,view:i,inline:s,editor:t,extension:e,HTMLAttributes:a,updateAttributes:e=>{Kr(o,t,e)}})}]:[]}))}destroy(){var t;null===(t=this.decorationManager)||void 0===t||t.destroy(),this.extensions.forEach(t=>{let e=t;for(;e.parent;){const t=e.parent;t.child===e&&(t.child=null),e=t}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(t=>[t.name,t.storage])),t.forEach(t=>{const e={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Be(t.name,this.schema)};var n,r;"mark"===t.type&&((null===(n=le(oe(t,"keepOnSplit",e)))||void 0===n||n)&&this.splittableMarks.push(t.name),null===(r=le(oe(t,"clearable",e)))||void 0===r||r||this.nonClearableMarks.push(t.name));const o=oe(t,"onBeforeCreate",e),i=oe(t,"onCreate",e),s=oe(t,"onUpdate",e),a=oe(t,"onSelectionUpdate",e),l=oe(t,"onTransaction",e),c=oe(t,"onFocus",e),d=oe(t,"onBlur",e),h=oe(t,"onDestroy",e);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),h&&this.editor.on("destroy",h)})}};eo.resolve=xe,eo.sort=ke,eo.flatten=ie;var no=class t extends _r{constructor(...t){super(...t),this.type="extension"}static create(e={}){const n="function"==typeof e?e():e;return new t(n)}configure(t){return super.configure(t)}extend(t){const e="function"==typeof t?t():t;return super.extend(e)}};
1const ro=no.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new a.k_({key:new a.hs("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,i=Ee(n),{blockSeparator:s}=this.options,a={...void 0!==s?{blockSeparator:s}:{},textSerializers:i};return[...o.ranges].sort((t,e)=>t.$from.pos-e.$from.pos).map(({$from:t,$to:e})=>Oe(r,{from:t.pos,to:e.pos},a)).join(null!=s?s:"\n\n")}}})]}}),oo=no.create({name:"commands",addCommands(){return{...Wn}}}),io=no.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r;const o=()=>{var n,r,o;if(null!==(n=null===(r=this.editor.options.coreExtensionOptions)||void 0===r||null===(r=r.delete)||void 0===r||null===(o=r.filterTransaction)||void 0===o?void 0:o.call(r,t))&&void 0!==n?n:t.getMeta("y-sync$"))return;const s=Qt(t.before,[t,...e]);ze(s).forEach(e=>{s.mapping.mapResult(e.oldRange.from).deletedAfter&&s.mapping.mapResult(e.oldRange.to).deletedBefore&&s.before.nodesBetween(e.oldRange.from,e.oldRange.to,(n,r)=>{const o=r+n.nodeSize-2,i=e.oldRange.from<=r&&o<=e.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:o,newFrom:s.mapping.map(r),newTo:s.mapping.map(o),deletedRange:e.oldRange,newRange:e.newRange,partial:!i,editor:this.editor,transaction:t,combinedTransform:s})})});const a=s.mapping;s.steps.forEach((e,n)=>{if(e instanceof i.Ys){var r,o;const i=a.slice(n).map(e.from,-1),l=a.slice(n).map(e.to),c=a.invert().map(i,-1),d=a.invert().map(l),h=i>0&&(null===(r=s.doc.nodeAt(i-1))||void 0===r?void 0:r.marks.some(t=>t.eq(e.mark))),u=null===(o=s.doc.nodeAt(l))||void 0===o?void 0:o.marks.some(t=>t.eq(e.mark));this.editor.emit("delete",{type:"mark",mark:e.mark,from:e.from,to:e.to,deletedRange:{from:c,to:d},newRange:{from:i,to:l},partial:Boolean(u||h),editor:this.editor,transaction:t,combinedTransform:s})}})};null===(n=null===(r=this.editor.options.coreExtensionOptions)||void 0===r||null===(r=r.delete)||void 0===r?void 0:r.async)||void 0===n||n?setTimeout(o,0):o()}}),so=no.create({name:"drop",addProseMirrorPlugins(){return[new a.k_({key:new a.hs("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),ao=no.create({name:"editable",addProseMirrorPlugins(){return[new a.k_({key:new a.hs("editable"),props:{editable:()=>this.editor.options.editable}})]}}),lo=new a.hs("focusEvents"),co=no.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new a.k_({key:lo,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),ho=no.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:t})=>[()=>t.undoInputRule(),()=>t.command(({tr:e})=>{const{selection:n,doc:r}=e,{empty:o,$anchor:i}=n,{pos:s,parent:l}=i,c=i.parent.isTextblock&&s>0?e.doc.resolve(s-1):i,d=c.parent.type.spec.isolating,h=i.pos-i.parentOffset,u=d&&1===c.parent.childCount?h===i.pos:a.LN.atStart(r).from===s;return!(!o||!l.type.isTextblock||l.textContent.length||!u||u&&"paragraph"===i.parent.type.name)&&t.clearNodes()}),()=>t.deleteSelection(),()=>t.joinBackward(),()=>t.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:t})=>[()=>t.deleteSelection(),()=>t.deleteCurrentNode(),()=>t.joinForward(),()=>t.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:t})=>[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},o={...n,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ht()||zt()?o:r},addProseMirrorPlugins(){return[new a.k_({key:new a.hs("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(t=>t.getMeta("composition")))return;const r=t.some(t=>t.docChanged)&&!e.doc.eq(n.doc),o=t.some(t=>t.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:l}=e.selection,c=a.LN.atStart(e.doc).from,d=a.LN.atEnd(e.doc).to;
1if(i||s!==c||l!==d)return;if(!He(n.doc))return;const h=n.tr,u=F({state:n,transaction:h}),{commands:p}=new B({editor:this.editor,state:u});return p.clearNodes(),h.steps.length?h:void 0}})]}}),uo=no.create({name:"paste",addProseMirrorPlugins(){return[new a.k_({key:new a.hs("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),po=no.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new a.k_({key:new a.hs("tabindex"),props:{attributes:()=>{var t;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!==(t=this.options.value)&&void 0!==t?t:"0"}:{}}}})]}}),fo=no.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=de(this.extensions);return[{types:t.filter(t=>"text"!==t.name).map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{const e=t.getAttribute("dir");return!e||"ltr"!==e&&"rtl"!==e&&"auto"!==e?this.options.direction:e},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return[new a.k_({key:new a.hs("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}});var mo=o({ClipboardTextSerializer:()=>ro,Commands:()=>oo,Delete:()=>io,Drop:()=>so,Editable:()=>ao,FocusEvents:()=>co,Keymap:()=>ho,Paste:()=>uo,Tabindex:()=>po,TextDirection:()=>fo,focusEventsPluginKey:()=>lo});let go=!1;var yo=class t{get name(){return this.node.type.name}constructor(t,e,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=t,this.editor=e,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return null!==(t=this.actualDepth)&&void 0!==t?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let e=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);e=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:e,to:n},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new t(n,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 t(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 t(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=n.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!o&&!s&&l.depth<=this.depth)return;const c=new t(l,this.editor,o,o||s?n:null);o&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,e={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===t)if(Object.keys(e).length>0){const t=r.node.attrs,n=Object.keys(e);for(let r=0;r<n.length;r+=1){const o=n[r];if(t[o]!==e[o])break}}else n=r;r=r.parent}return n}querySelector(t,e={}){return this.querySelectorAll(t,e,!0)[0]||null}querySelectorAll(t,e={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;const o=Object.keys(e);return this.children.forEach(i=>{n&&r.length>
10||(i.node.type.name===t&&o.every(t=>e[t]===i.node.attrs[t])&&r.push(i),n&&r.length>0||(r=r.concat(i.querySelectorAll(t,e,n))))}),r}setAttribute(t){const{tr:e}=this.editor.state;e.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(e)}},vo=class extends qn{constructor(t={}){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:"undefined"!=typeof document?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:t})=>{throw t},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:un,createMappablePosition:pn},this.setOptions(t),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:t,slice:e,moved:n})=>this.options.onDrop(t,e,n)),this.on("paste",({event:t,slice:e})=>this.options.onPaste(t,e)),this.on("delete",this.options.onDelete);const e=this.createDoc();if(!this.editorState){const t=ct(e,this.options.autofocus);this.editorState=a.$t.create({doc:e,schema:this.schema,selection:t||void 0})}!function(t){if(go)return;let e;go=!0;try{e=i.Ln.fromJSON(t,{from:0,to:0}).slice.content}catch{return}e instanceof s.FK||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.")}(this.schema),this.options.element&&this.mount(this.options.element)}mount(t){if("undefined"==typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;const t=this.editorView.dom;(null==t?void 0:t.editor)&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}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():B.createFakeChain()}can(){return this.commandManager?this.commandManager.can():B.createFallbackCan()}injectCSS(){this.options.injectCSS&&"undefined"!=typeof document&&(this.css=hr('.ProseMirror {\n  position: relative;\n}\n\n.ProseMirror {\n  word-wrap: break-word;\n  white-space: pre-wrap;\n  white-space: break-spaces;\n  -webkit-font-variant-ligatures: none;\n  font-variant-ligatures: none;\n  font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n  white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n  white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n  white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n  display: inline !important;\n  border: none !important;\n  margin: 0 !important;\n  width: 0 !important;\n  height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n  display: none;\n  pointer-events: none;\n  position: absolute;\n  margin: 0;\n}
1\n\n.ProseMirror-gapcursor:after {\n  content: "";\n  display: block;\n  position: absolute;\n  top: -2px;\n  width: 20px;\n  border-top: 1px solid black;\n  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n  to {\n    visibility: hidden;\n  }\n}\n\n.ProseMirror-hideselection *::selection {\n  background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n  background: transparent;\n}\n\n.ProseMirror-hideselection * {\n  caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n  display: block;\n}',this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&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:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if("state"===e)return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return Hn&&!this.hasWarnedStaleDecorationRead&&Un.has(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(t,e){const n=ae(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(t=>{const e="string"==typeof t?`${t}$`:t.key;n=n.filter(t=>!t.key.startsWith(e))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[ao,ro.configure({blockSeparator:null===(t=this.options.coreExtensionOptions)||void 0===t||null===(t=t.clipboardTextSerializer)||void 0===t?void 0:t.blockSeparator}),oo,co,ho,po.configure({value:null===(e=this.options.coreExtensionOptions)||void 0===e||null===(e=e.tabindex)||void 0===e?void 0:e.value}),so,uo,io,fo.configure({direction:this.options.textDirection})].filter(t=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[t.name]):[],...this.options.extensions].filter(t=>["extension","node","mark"].includes(null==t?void 0:t.type));this.extensionManager=new eo(n,this)}createCommandManager(){this.commandManager=new B({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Yt(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message)))throw t;const e=Yt(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=a.$t.create({doc:e,schema:this.schema,selection:ct(e,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>"collaboration"!==t.name),this.createExtensionManager()}}),this.editorState.doc}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),o=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,s=this.extensionManager.transformPastedHTML(i);this.editorView=new I.Lz(t,{...e,attributes:{role:"textbox",...null==e?void 0:e.attributes},dispatchTransaction:o,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS(),this.view.dom.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(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void t.steps.forEach(t=>{var e;return null===(e=this.capturedTransaction)||void 0===e?void 0:e.step(t)}):void(this.capturedTransaction=t);const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),o=n.includes(t),i=this.state;
1if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!o)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const s=n.findLast(t=>t.getMeta("focus")||t.getMeta("blur")),a=null==s?void 0:s.getMeta("focus"),l=null==s?void 0:s.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),t.getMeta("preventUpdate")||!n.some(t=>t.docChanged)||i.doc.eq(e.doc)||this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return Ae(this.state,t)}isActive(t,e){const n="string"==typeof t?t:null,r="string"==typeof t?e:t;return Ke(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return se(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e="\n\n",textSerializers:n={}}=t||{};return Ne(this.state.doc,{blockSeparator:e,textSerializers:{...Ee(this.schema),...n}})}get isEmpty(){return He(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 t,e;return null===(t=null===(e=this.editorView)||void 0===e?void 0:e.isDestroyed)||void 0===t||t}$node(t,e){var n;return(null===(n=this.$doc)||void 0===n?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return(null===(n=this.$doc)||void 0===n?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new yo(e,this,!1,n)}get $doc(){return this.$pos(0)}},wo=class{static Inline(t,e,n={},r){return new bo(t,e,n,r)}static Node(t,e,n={},r){return new ko(t,e,n,r)}static Widget(t,e,n){const{key:r,...o}=n;return new xo(t,e,r,o)}},bo=class extends wo{constructor(t,e,n={},r){super(),this.kind="inline",this.from=t,this.to=e,this.attrs=n,this.spec=r}get anchor(){return this.from}toPMDecoration(t){const e=t?{...this.spec,extensionName:t}:this.spec;return I.NZ.inline(this.from,this.to,this.attrs,e)}},ko=class extends wo{constructor(t,e,n={},r){super(),this.kind="node",this.from=t,this.to=e,this.attrs=n,this.spec=r}get anchor(){return this.from}toPMDecoration(t){const e=t?{...this.spec,extensionName:t}:this.spec;return I.NZ.node(this.from,this.to,this.attrs,e)}},xo=class extends wo{constructor(t,e,n,r){super(),this.kind="widget",this.pos=t,this.render=e,this.key=n,this.spec=r}get anchor(){return this.pos}toPMDecoration(t){const e=t?{...this.spec,key:this.key,extensionName:t}:{...this.spec,key:this.key};return I.NZ.widget(this.pos,this.render,e)}};function So(t){const{editor:e,pos:n,key:r,props:o,cacheKey:i,context:s,create:a,materialize:l,side:c,relaxedSide:d,marks:h,stopEvent:u,ignoreSelection:p,destroy:f}=t,m=function(t,e){const n=t;let r=n[e];if(!r){r={renderers:new Map,props:new Map,pendingProps:new Map,flushScheduled:!1},n[e]=r;const o=r;t.on("destroy",()=>{o.pendingProps.clear(),o.renderers.forEach(t=>t.destroy()),o.renderers.clear(),o.props.clear()})}return r}(e,i);if(m.renderers.has(r)){var g;const t=null!==(g=m.pendingProps.get(r))&&void 0!==g?g:m.props.get(r);t&&cr(t,o)||(m.pendingProps.set(r,o),m.flushScheduled||(m.flushScheduled=!0,queueMicrotask(()=>function(t){t.flushScheduled=!1;for(const[e,n]of t.pendingProps){const r=t.renderers.get(e);r&&(r.updateProps(n),t.props.set(e,{...n}))}t.pendingProps.clear()}(m))))}return wo.Widget(n,(t,e)=>{const n={...o,...s(e)};let i=m.renderers.get(r);return i?i.updateProps(n):(i=a(n),m.renderers.set(r,i),m.props.set(r,{...o})),l(i)},{key:r,side:c,relaxedSide:d,marks:h,stopEvent:u,ignoreSelection:p,destroy:t=>{if(!ar(e).has(r))try{var n;null===(n=m.renderers.get(r))||void 0===n||n.destroy(),m.renderers.delete(r),m.props.delete(r),m.pendingProps.delete(r)}finally{null==f||f(t)}}})}function Mo(t){return new Wr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=le(t.getAttributes,void 0,r);if(!1===o||null===o)return null;const{tr:i}=e,s=r[r.length-1],a=r[0];if(s){const r=a.search(/\S/),l=n.from+a.indexOf(s),c=l+s.length;if(Ie(n.from,n.to,e.doc).filter(e=>e.mark.type.excluded.find(n=>n===t.type&&n!==e.mark.type)).filter(t=>t.to>
1l).length)return null;c<n.to&&i.delete(c,n.to),l>n.from&&i.delete(n.from+r,l);const d=n.from+r+s.length;i.addMark(n.from+r,d,t.type.create(o||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function Co(t){return new Wr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=le(t.getAttributes,void 0,r)||{},{tr:i}=e,s=n.from;let a=n.to;const l=t.type.create(o);if(r[1]){let t=s+r[0].lastIndexOf(r[1]);t>a?t=a:a=t+r[1].length;const e=r[0][r[0].length-1];i.insertText(e,s+r[0].length-1),i.replaceWith(t,a,l)}else if(r[0]){const e=t.type.isInline?s:s-1;i.insert(e,t.type.create(o)).delete(i.mapping.map(s),i.mapping.map(a))}i.scrollIntoView()},undoable:t.undoable})}function Oo(t){return new Wr({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),i=le(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function No(t){return new Wr({find:t.find,handler:({state:e,range:n,match:r})=>{let o=t.replace,i=n.from;const s=n.to;if(r[1]){const t=r[0].lastIndexOf(r[1]);o+=r[0].slice(t+r[1].length),i+=t;const e=i-s;e>0&&(o=r[0].slice(t-e,t)+o,i=s)}e.tr.insertText(o,i,s)},undoable:t.undoable})}function Eo(t){return new Wr({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{const s=le(t.getAttributes,void 0,r)||{},a=e.tr.delete(n.from,n.to),l=a.doc.resolve(n.from).blockRange(),c=l&&(0,i.oM)(l,t.type,s);if(!c)return null;if(a.wrap(l,c),t.keepMarks&&t.editor){const{selection:n,storedMarks:r}=e,{splittableMarks:o}=t.editor.extensionManager,i=r||n.$to.parentOffset&&n.$from.marks();if(i){const t=i.filter(t=>o.includes(t.type.name));a.ensureMarks(t)}}if(t.keepAttributes){const e="bulletList"===t.type.name||"orderedList"===t.type.name?"listItem":"taskList";o().updateAttributes(e,s).run()}const d=a.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&(0,i.n9)(a.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,d))&&a.join(n.from-1)},undoable:t.undoable})}const To=new WeakSet,Do=new WeakSet;function Ao(t){const e=t;return To.add(e),e}function Ro(t){return Array.isArray(t)&&To.has(t)}function zo(t){return t.flatMap(t=>null==t?[]:Array.isArray(t)&&Do.has(t)&&!Ro(t)?zo(t):[t])}function $o(t){return Do.add(t.children),t.children}function Io(t,e){if("slot"===t)return 0;if(t instanceof Function){const n=t(e);return!Array.isArray(n)||Ro(n)||Do.has(n)?n:Ao(n)}const{children:n,...r}=null!=e?e:{};if("svg"===t)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(n)){if(Ro(n))return Ao([t,r,n]);if(0===n.length)return Ao([t,r]);const e=zo(n);return 0===e.length?Ao([t,r]):Ao([t,r,...e])}return Ao(null!=n?[t,r,n]:[t,r])}const Po=(t,e)=>Io(t,e);var Fo=class{constructor(t){var e,n,r,o,i,s;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=new Map,this.handleMouseMove=t=>{if(!this.isResizing||!this.activeHandle)return;const e=t.clientX-this.startX,n=t.clientY-this.startY;this.handleResize(e,n)},this.handleTouchMove=t=>{if(!this.isResizing||!this.activeHandle)return;const e=t.touches[0];if(!e)return;const n=e.clientX-this.startX,r=e.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;const t=this.element.offsetWidth,e=this.element.offsetHeight;this.onCommit(t,e),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=t=>{"Shift"===t.key&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=t=>{"Shift"===t.key&&(this.isShiftKeyPressed=!1)},this.node=t.node,this.editor=t.editor,this.element=t.element,this.element.draggable=!1,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(null===(e=t.options)||void 0===e?void 0:e.min)&&(this.minSize={...this.minSize,...t.options.min}),(null===(n=t.options)||void 0===n?void 0:n.max)&&(this.maxSize=t.options.max),(null==t||null===(r=t.options)||void 0===r?void 0:r.directions)&&(this.directions=t.options.directions),(null===(o=t.options)||void 0===o?void 0:o.preserveAspectRatio)&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(null===(i=t.options)||void 0===i?void 0:i.className)&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(null===(s=t.options)||void 0===s?void 0:s.createCustomHandle)&&(this.createCustomHandle=t.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 t;return null!==(t=this.contentElement)&&void 0!==t?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&0===this.handleMap.size&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type===this.node.type&&(this.node=t,!this.onUpdate||this.onUpdate(t,e,n))}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("keydown",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(){const t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.n
1ame,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),o=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),o&&(t.style.left="0"),i&&(t.style.right="0"),"top"!==e&&"bottom"!==e||(t.style.left="0",t.style.right="0"),"left"!==e&&"right"!==e||(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;e=this.createCustomHandle?this.createCustomHandle(t):this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",e=>this.handleResizeStart(e,t)),e.addEventListener("touchstart",e=>this.handleResizeStart(e,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,"touches"in t?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.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(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:o}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,o,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,o=this.startHeight;const i=t.includes("right"),s=t.includes("left"),a=t.includes("bottom"),l=t.includes("top");return i?r=this.startWidth+e:s&&(r=this.startWidth-e),a?o=this.startHeight+n:l&&(o=this.startHeight-n),"right"!==t&&"left"!==t||(r=this.startWidth+(i?e:-e)),"top"!==t&&"bottom"!==t||(o=this.startHeight+(a?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,o,t):{width:r,height:o}}applyConstraints(t,e,n){var r,o;if(!n){var i,s;let n=Math.max(this.minSize.width,t),r=Math.max(this.minSize.height,e);return(null===(i=this.maxSize)||void 0===i?void 0:i.width)&&(n=Math.min(this.maxSize.width,n)),(null===(s=this.maxSize)||void 0===s?void 0:s.height)&&(r=Math.min(this.maxSize.height,r)),{width:n,height:r}}let a=t,l=e;return a<this.minSize.width&&(a=this.minSize.width,l=a/this.aspectRatio),l<this.minSize.height&&(l=this.minSize.height,a=l*this.aspectRatio),(null===(r=this.maxSize)||void 0===r?void 0:r.width)&&a>this.maxSize.width&&(a=this.maxSize.width,l=a/this.aspectRatio),(null===(o=this.maxSize)||void 0===o?void 0:o.height)&&l>this.maxSize.height&&(l=this.maxSize.height,a=l*this.aspectRatio),{width:a,height:l}}applyAspectRatio(t,e,n){const r="top"===n||"bottom"===n;return"left"===n||"right"===n?{width:t,height:t/this.aspectRatio}:r?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};const Bo=Fo;var Vo=class t extends _r{constructor(...t){super(...t),this.type="node"}static create(e={}){const n="function"==typeof e?e():e;return new t(n)}configure(t){return super.configure(t)}extend(t){const e="function"==typeof t?t():t;return super.extend(e)}},Lo=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=()=>{try{return e.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n;const{view:r}=this.editor,o=t.target,i=3===o.nodeType?null===(e=o.parentElement)||void 0===e?void 0:e.closest("[data-drag-handle]"):o.closest("[data-drag-handle]");if(!this.dom||(null===(n=this.contentDOM)||void 0===n?void 0:n.contains(o))||!i)return;let s=0,l=0;if(this.dom!==i){var c,d,h,u;const e=this.dom.getBoundingClientRect(),n=i.getBoundingClientRect(),r=null!==(c=t.offsetX)&&void 0!==c?c:null===(d=t.nativeEvent)||void 0===d?void 0:d.offsetX,o=null!==(h=t.offsetY)&&void 0!==h?h:null===(u=t.nativeEvent)||void 0===u?void 0:u.offsetY;s=n.x-e.x+r,l=n.y-e.y+o}const p=this.dom.cloneNode(!0);try{const t=this.dom.getBoundingClientRect();p.style.width=`${Math.round(t.width)}px`,p.style.height=`${Math.round(t.height)}px`,p.style.boxSizing="border-box",p.style.pointerEvents="none"}catch{}let f=null;try{var m;f=document.createElement("div"),f.style.position="absolute",f.style.top="-9999px",f.style.left="-9999px",f.style.pointerEvents="none",f.appendChild(p),document.body.appendChild(f),null===(m=t.dataTransfer)||void 0===m||m.setDragImage(p,s,l)}finally{f&&setTimeout(()=>{try{null==f||f.remove()}catch{}},0)}const g=this.getPos();if("number"!=typeof g)return;const y=a.nh.create(r.state.doc,g),v=r.state.tr.setSelection(y);r.dispatch(v)}stopEvent(t){var e;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:t});const n=t.target;if(!this.dom.contains(n)||(null===(e=this.contentDOM)||void 0===e?void 0:e.contains(n)))return!1;const r=t.type.startsWith("drag"),o="dragover"===t.type||"dragenter"===t.type,i="drop"===t.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!r)return!0;const{isEditable:s}=this.editor,{isDragging:l}=this,c=!!this.node.type.spec.draggable,d=a.nh.isSelectable(this.node),h="copy"===t.type,u="paste"===t.type,p="cut"
1===t.type,f="mousedown"===t.type;if(!c&&d&&r&&t.target===this.dom&&t.preventDefault(),c&&r&&!l&&t.target===this.dom)return t.preventDefault(),!1;if(c&&s&&!l&&f){const t=n.closest("[data-drag-handle]");t&&(this.dom===t||this.dom.contains(t))&&(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!(l||o||i||h||u||p||f&&d)}ignoreMutation(t){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:t}):!(!this.node.isLeaf&&!this.node.isAtom&&("selection"===t.type||this.contentDOM.contains(t.target)&&"childList"===t.type&&(ht()||dt())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(t=>t.isContentEditable)||(this.contentDOM!==t.target||"attributes"!==t.type)&&this.contentDOM.contains(t.target))))}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return"number"==typeof n&&(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if("number"!=typeof t)return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function jo(t){return new Yr({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const i=le(t.getAttributes,void 0,r,o);if(!1===i||null===i)return null;const{tr:s}=e,a=r[r.length-1],l=r[0];let c=n.to;if(a){const o=l.search(/\S/),d=n.from+l.indexOf(a),h=d+a.length;if(Ie(n.from,n.to,e.doc).filter(e=>e.mark.type.excluded.find(n=>n===t.type&&n!==e.mark.type)).filter(t=>t.to>d).length)return null;h<n.to&&s.delete(h,n.to),d>n.from&&s.delete(n.from+o,d),c=n.from+o+a.length,s.addMark(n.from+o,c,t.type.create(i||{})),void 0!==r.index&&void 0!==r.input&&r.index+r[0].length>=r.input.length||s.removeStoredMark(t.type)}}})}function Ko(t){return new Yr({find:t.find,handler({match:e,chain:n,range:r,pasteEvent:o}){const i=le(t.getAttributes,void 0,e,o),s=le(t.getContent,void 0,i);if(!1===i||null===i)return null;const a={type:t.type.name,attrs:i};s&&(a.content=s),e.input&&n().deleteRange(r).insertContentAt(r.from,a)}})}function Jo(t){return new Yr({find:t.find,handler:({state:e,range:n,match:r})=>{let o=t.replace,i=n.from;const s=n.to;if(r[1]){const t=r[0].lastIndexOf(r[1]);o+=r[0].slice(t+r[1].length),i+=t;const e=i-s;e>0&&(o=r[0].slice(t-e,t)+o,i=s)}e.tr.insertText(o,i,s)}})}var Wo=class{constructor(t){this.transaction=t,this.currentStep=this.transaction.steps.length}map(t){let e=!1;return{position:this.transaction.steps.slice(this.currentStep).reduce((t,n)=>{const r=n.getMap().mapResult(t);return r.deleted&&(e=!0),r.pos},t),deleted:e}}}},62738:function(t,e,n){n.d(e,{K:function(){return m},w:function(){return f}});for(var r={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},o={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},i="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),s="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),a=0;a<10;a++)r[48+a]=r[96+a]=String(a);for(a=1;a<=24;a++)r[a+111]="F"+a;for(a=65;a<=90;a++)r[a]=String.fromCharCode(a+32),o[a]=String.fromCharCode(a);for(var l in r)o.hasOwnProperty(l)||(o[l]=r[l]);var c=n(67599);const d="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),h="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function u(t){let e,n,r,o,i=t.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let t=0;t<i.length-1;t++){let s=i[t];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))e=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);d?o=!0:n=!0}}return e&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}
vendor: 8,260 bytes, line 1
1function p(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function f(t){return new c.k_({props:{handleKeyDown:m(t)}})}function m(t){let e=function(t){let e=Object.create(null);for(let n in t)e[u(n)]=t[n];return e}(t);return function(t,n){let a,l=function(t){var e=!(i&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||s&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key)&&t.key||(t.shiftKey?o:r)[t.keyCode]||t.key||"Unidentified";return"Esc"==e&&(e="Escape"),"Del"==e&&(e="Delete"),"Left"==e&&(e="ArrowLeft"),"Up"==e&&(e="ArrowUp"),"Right"==e&&(e="ArrowRight"),"Down"==e&&(e="ArrowDown"),e}(n),c=e[p(l,n)];if(c&&c(t.state,t.dispatch,t))return!0;if(1==l.length&&" "!=l){if(n.shiftKey){let r=e[p(l,n,!1)];if(r&&r(t.state,t.dispatch,t))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(h&&n.ctrlKey&&n.altKey)&&(a=r[n.keyCode])&&a!=l){let r=e[p(a,n)];if(r&&r(t.state,t.dispatch,t))return!0}}return!1}}},81429:function(t,e,n){function r(t){this.content=t}n.d(e,{S4:function(){return tt},ZF:function(){return dt},FK:function(){return c},CU:function(){return p},sX:function(){return G},bP:function(){return z},u$:function(){return A},vI:function(){return f},Sj:function(){return Z},Ji:function(){return m}}),r.prototype={constructor:r,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return-1==e?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,i=o.find(t),s=o.content.slice();return-1==i?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new r(s)},remove:function(t){var e=this.find(t);if(-1==e)return this;var n=this.content.slice();return n.splice(e,2),new r(n)},addToStart:function(t,e){return new r([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new r(n)},addBefore:function(t,e,n){var o=this.remove(e),i=o.content.slice(),s=o.find(t);return i.splice(-1==s?i.length:s,0,e,n),new r(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return(t=r.from(t)).size?new r(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=r.from(t)).size?new r(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=r.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},r.from=function(t){if(t instanceof r)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new r(e)};var o=r;function i(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),s=e.child(r);if(o!=s){if(!o.sameMarkup(s))return n;if(o.isText&&o.text!=s.text){let t=o.text,e=s.text,r=0;for(;t[r]==e[r];r++)n++;return r&&r<t.length&&r<e.length&&l(t.charCodeAt(r-1))&&a(t.charCodeAt(r))&&n--,n}if(o.content.size||s.content.size){let t=i(o.content,s.content,n+1);if(null!=t)return t}n+=o.nodeSize}else n+=o.nodeSize}}function s(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};let c=t.child(--o),d=e.child(--i),h=c.nodeSize;if(c!=d){if(!c.sameMarkup(d))return{a:n,b:r};if(c.isText&&c.text!=d.text){let t=c.text,e=d.text,o=t.length,i=e.length;for(;o>0&&i>0&&t[o-1]==e[i-1];)o--,i--,n--,r--;return o&&i&&o<t.length&&l(t.charCodeAt(o-1))&&a(t.charCodeAt(o))&&(n++,r++),{a:n,b:r}}if(c.content.size||d.content.size){let t=s(c.content,d.content,n-1,r-1);if(t)return t}n-=h,r-=h}else n-=h,r-=h}}function a(t){return t>=56320&&t<57344}function l(t){return t>=55296&&t<56320}class c{constructor(t,e){if(this.content=t,this.size=e||0,null==e)for(let e=0;e<t.length;e++)this.size+=t[e].nodeSize}nodesBetween(t,e,n,r=0,o){for(let i=0,s=0;s<e;i++){let a=this.content[i],l=s+a.nodeSize;if(l>t&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,t-o),Math.min(a.content.size,e-o),n,r+o)}s=l}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,n,r){let o="",i=!0;return this.nodesBetween(t,e,(s,a)=>{let l=s.isText?s.text.slice(Math.max(t,a)-a,e-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(i?i=!1:o+=n),o+=l},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,n=t.firstChild,r=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(n)&&(r[r.length-1]=e.withText(e.text+n.text),o=1);o<t.content.length;o++)r.push(t.content[o]);return new c(r,this.size+t.size)}cut(t,e=this.size){if(0==t&&e==this.size)return this;let n=[],r=0;if(e>t)for(let o=0,i=0;i<e;o++){let s=this.content[o],a=i+s.nodeSize;a>t&&((i<t||a>e)&&(s=s.isText?s.cut(Math.max(0,t-i),Math.min(s.text.length,e-i)):s.cut(Math.max(0,t-i-1),Math.min(s.content.size,e-i-1))),n.push(s),r+=s.nodeSize),i=a}return new c(n,r)}cutByIndex(t,e){return t==e?c.empty:0==t&&e==this.content.length?this:new c(this.content.slice(t,e))}replaceChild(t,e){let n=this.content[t];if(n==e)return this;let r=this.content.slice(),o=this.size+e.nodeSize-n.nodeSize;return r[t]=e,new c(r,o)}addToStart(t){return new c([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new c(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,n=0;e<this.content.length;e++){let r=this.content[e];t(r,n,e),n+=r.nodeSize}}findDiffStart(t,e=0){return i(this,t,e)}findDiffEnd(t,e=this.size,n=t.size){return s(this,t,e,n)}findIndex(t){if(0==t)return h(0,t);if(t==this.size)return h(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let e=0,n=0;;e++){let r=n+this.child(e).nodeSize;if(r>=t)return r==t?h(e+1,r):h(e,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,e){if(!e)return c.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return c.fromArray(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return c.empty;let e,n=0;for(let r=0;r<t.length;r++){let o=t[r];n+=o.nodeSize,r&&o.isText&&t[r-1].sameMarkup(o)?(e||(e=t.slice(0,r)),e[e.length-1]=o.withText(e[e.length-1].text+o.text)):e&&e.push(o)}return new c(e||t,n)}static from(t){if(!t)return c.empty;if(t instanceof c)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new c([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}c.empty=new c([],0);const d={index:0,offset:0};function h(t,e){return d.index=t,d.offset=e,d}function u(t,e){if(t===e)return!0;if(!t||"object"!=typeof t||!e||"object"!=typeof e)return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!u(t[n],e[n]))return!1}else{for(let n in t)if(!(n in e)||!u(t[n],e[n]))return!1;for(let n in e)if(!(n in t))return!1}return!0}class p{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,n=!1;for(let r=0;r<t.length;r++){let o=t[r];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,r));else{if(o.type.excludes(this.type))return t;!n&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,r)),e.push(this),n=!0),e&&e.push(o)}}return e||(e=t.slice()),n||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&u(this.attrs,t.attrs)}
vendor: 7,193 bytes, line 1
1toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let n=t.marks[e.type];if(!n)throw new RangeError(`There is no mark type ${e.type} in this schema`);let r=n.create(e.attrs);return n.checkAttrs(r.attrs),r}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].eq(e[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&0==t.length)return p.none;if(t instanceof p)return[t];let e=t.slice();return e.sort((t,e)=>t.type.rank-e.type.rank),e}}p.none=[];class f extends Error{}class m{constructor(t,e,n){this.content=t,this.openStart=e,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let n=y(this.content,t+this.openStart,e,this.openStart+1,this.openEnd+1);return n&&new m(n,this.openStart,this.openEnd)}removeBetween(t,e){return new m(g(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return m.empty;let n=e.openStart||0,r=e.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new m(c.fromJSON(t,e.content),n,r)}static maxOpen(t,e=!0){let n=0,r=0;for(let r=t.firstChild;r&&!r.isLeaf&&(e||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=t.lastChild;n&&!n.isLeaf&&(e||!n.type.spec.isolating);n=n.lastChild)r++;return new m(t,n,r)}}function g(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(o==e||i.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(g(i.content,e-o-1,n-o-1)))}function y(t,e,n,r,o,i){let{index:s,offset:a}=t.findIndex(e),l=t.maybeChild(s);if(a==e||l.isText)return i&&r<=0&&o<=0&&!i.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=y(l.content,e-a-1,n,0==s?r-1:0,s==t.childCount-1?o-1:0,l);return c&&t.replaceChild(s,l.copy(c))}function v(t,e,n){if(n.openStart>t.depth)throw new f("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new f("Inconsistent open depths");return w(t,e,n,0)}function w(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=w(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||t.depth!=r||e.depth!=r){let{start:o,end:s}=function(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let t=n-1;t>=0;t--)r=e.node(t).copy(c.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}(n,t);return M(i,C(t,o,s,e,r))}{let r=t.parent,o=r.content;return M(r,o.cut(0,t.parentOffset).append(n.content).append(o.cut(e.parentOffset)))}}return M(i,O(t,e,r))}function b(t,e){if(!e.type.compatibleContent(t.type))throw new f("Cannot join "+e.type.name+" onto "+t.type.name)}function k(t,e,n){let r=t.node(n);return b(r,e.node(n)),r}function x(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function S(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(x(t.nodeAfter,r),i++));for(let t=i;t<s;t++)x(o.child(t),r);e&&e.depth==n&&e.textOffset&&x(e.nodeBefore,r)}function M(t,e){if(!t.type.validContent(e))throw new f("Invalid content for node "+t.type.name);return t.copy(e)}function C(t,e,n,r,o){let i=t.depth>o&&k(t,e,o+1),s=r.depth>o&&k(n,r,o+1),a=[];return S(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(b(i,s),x(M(i,C(t,e,n,r,o+1)),a)):(i&&x(M(i,O(t,e,o+1)),a),S(e,n,o,a),s&&x(M(s,O(n,r,o+1)),a)),S(r,null,o,a),new c(a)}function O(t,e,n){let r=[];return S(null,t,n,r),t.depth>n&&x(M(k(t,e,n+1),O(t,e,n+1)),r),S(e,null,n,r),new c(r)}m.empty=new m(c.empty,0,0);class N{constructor(t,e,n){this.pos=t,this.path=e,this.parentOffset=n,this.depth=e.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=t.child(e);return n?t.child(e).cut(n):r}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let n=this.path[3*e],r=0==e?0:this.path[3*e-1]+1;for(let e=0;e<t;e++)r+=n.child(e).nodeSize;return r}marks(){let t=this.parent,e=this.index();if(0==t.content.size)return p.none;if(this.textOffset)return t.child(e).marks;let n=t.maybeChild(e-1),r=t.maybeChild(e);if(!n){let t=n;n=r,r=t}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let n=e.marks,r=t.parent.maybeChild(t.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new A(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let n=[],r=0,o=e;for(let e=t;;){let{index:t,offset:i}=e.content.findIndex(o),s=o-i;if(n.push(e,t,r+i),!s)break;if(e=e.child(t),e.isText)break;o=s-1,r+=i+1}return new N(e,n,o)}
vendor: 4,349 bytes, line 1
1static resolveCached(t,e){let n=D.get(t);if(n)for(let t=0;t<n.elts.length;t++){let r=n.elts[t];if(r.pos==e)return r}else D.set(t,n=new E);let r=n.elts[n.i]=N.resolve(t,e);return n.i=(n.i+1)%T,r}}class E{constructor(){this.elts=[],this.i=0}}const T=12,D=new WeakMap;class A{constructor(t,e,n){this.$from=t,this.$to=e,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const R=Object.create(null);class z{constructor(t,e,n,r=p.none){this.type=t,this.attrs=e,this.marks=r,this.content=n||c.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,n,r=0){this.content.nodesBetween(t,e,n,r,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,n,r){return this.content.textBetween(t,e,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,n){return this.type==t&&u(this.attrs,e||t.defaultAttrs||R)&&p.sameSet(this.marks,n||p.none)}copy(t=null){return t==this.content?this:new z(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new z(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return 0==t&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,n=!1){if(t==e)return m.empty;let r=this.resolve(t),o=this.resolve(e),i=n?0:r.sharedDepth(e),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new m(a,r.depth-i,o.depth-i)}replace(t,e,n){return v(this.resolve(t),this.resolve(e),n)}nodeAt(t){for(let e=this;;){let{index:n,offset:r}=e.content.findIndex(t);if(e=e.maybeChild(n),!e)return null;if(r==t||e.isText)return e;t-=r+1}}childAfter(t){let{index:e,offset:n}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:n}}childBefore(t){if(0==t)return{node:null,index:0,offset:0};let{index:e,offset:n}=this.content.findIndex(t);if(n<t)return{node:this.content.child(e),index:e,offset:n};let r=this.content.child(e-1);return{node:r,index:e-1,offset:n-r.nodeSize}}resolve(t){return N.resolveCached(this,t)}resolveNoCache(t){return N.resolve(this,t)}rangeHasMark(t,e,n){let r=!1;return e>t&&this.nodesBetween(t,e,t=>(n.isInSet(t.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),I(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,n=c.empty,r=0,o=n.childCount){let i=this.contentMatchAt(t).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,e);if(!s||!s.validEnd)return!1;for(let t=r;t<o;t++)if(!this.type.allowsMarks(n.child(t).marks))return!1;return!0}canReplaceWith(t,e,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(t).matchType(n),i=o&&o.matchFragment(this.content,e);return!!i&&i.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=p.none;for(let e=0;e<this.marks.length;e++){let n=this.marks[e];n.type.checkAttrs(n.attrs),t=n.addToSet(t)}if(!p.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}
1`);this.content.forEach(t=>t.check())}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(t=>t.toJSON())),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let n;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}let r=c.fromJSON(t,e.content),o=t.nodeType(e.type).create(e.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}z.prototype.text=void 0;class $ extends z{constructor(t,e,n,r){if(super(t,e,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):I(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new $(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new $(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return 0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function I(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class P{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let n=new F(t,e);if(null==n.next)return P.empty;let r=B(n);n.next&&n.err("Unexpected trailing text");let o=function(t){let e=Object.create(null);return function n(r){let o=[];r.forEach(e=>{t[e].forEach(({term:e,to:n})=>{if(!e)return;let r;for(let t=0;t<o.length;t++)o[t][0]==e&&(r=o[t][1]);W(t,n).forEach(t=>{r||o.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)})})});let i=e[r.join(",")]=new P(r.indexOf(t.length-1)>-1);for(let t=0;t<o.length;t++){let r=o[t][1].sort(J);i.next.push({type:o[t][0],next:e[r.join(",")]||n(r)})}return i}(W(t,0))}(function(t){let e=[[]];return o(function t(e,i){if("choice"==e.type)return e.exprs.reduce((e,n)=>e.concat(t(n,i)),[]);if("seq"!=e.type){if("star"==e.type){let s=n();return r(i,s),o(t(e.expr,s),s),[r(s)]}if("plus"==e.type){let s=n();return o(t(e.expr,i),s),o(t(e.expr,s),s),[r(s)]}if("opt"==e.type)return[r(i)].concat(t(e.expr,i));if("range"==e.type){let s=i;for(let r=0;r<e.min;r++){let r=n();o(t(e.expr,s),r),s=r}if(-1==e.max)o(t(e.expr,s),s);else for(let i=e.min;i<e.max;i++){let i=n();r(s,i),o(t(e.expr,s),i),s=i}return[r(s)]}if("name"==e.type)return[r(i,void 0,e.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=t(e.exprs[r],i);if(r==e.exprs.length-1)return s;o(s,i=n())}}(t,0),n()),e;function n(){return e.push([])-1}function r(t,n,r){let o={term:r,to:n};return e[t].push(o),o}function o(t,e){t.forEach(t=>t.to=e)}}(r));return function(t,e){for(let n=0,r=[t];n<r.length;n++){let t=r[n],o=!t.validEnd,i=[];for(let e=0;e<t.next.length;e++){let{type:n,next:s}=t.next[e];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,n=t.childCount){let r=this;for(let o=e;r&&o<n;o++)r=r.matchType(t.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!e.isText&&!e.hasRequiredAttrs())return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let n=0;n<t.next.length;n++)if(this.next[e].type==t.next[n].type)return!0;return!1}fillBefore(t,e=!1,n=0){let r=[this];return function o(i,s){let a=i.matchFragment(t,n);if(a&&(!e||a.validEnd))return c.from(s.map(t=>t.createAndFill()));for(let t=0;t<i.next.length;t++){let{type:e,next:n}=i.next[t];if(!e.isText&&!e.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let t=o(n,s.concat(e));if(t)return t}}return null}(this,[])}findWrapping(t){for(let e=0;e<this.wrapCache.length;e+=2)if(this.wrapCache[e]==t)return this.wrapCache[e+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(t)){let t=[];for(let e=r;e.type;e=e.via)t.push(e.type);return t.reverse()}for(let t=0;t<o.next.length;t++){let{type:i,next:s}=o.next[t];i.isLeaf||i.hasRequiredAttrs()||i.name in e||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),e[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(n){t.push(n);for(let r=0;r<n.next.length;r++)-1==t.indexOf(n.next[r].next)&&e(n.next[r].next)}(this),t.map((e,n)=>{let r=n+(e.validEnd?"*":" ")+" ";for(let n=0;n<e.next.length;n++)r+=(n?", ":"")+e.next[n].type.name+"->"+t.indexOf(e.next[n].next);return r}).join("\n")}}P.empty=new P(!0);class F{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?
vendor: 17,904 bytes, line 1
1=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function B(t){let e=[];do{e.push(V(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function V(t){let e=[];do{e.push(L(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function L(t){let e=function(t){if(t.eat("(")){let e=B(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){let e=function(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let t in n){let r=n[t];r.isInGroup(e)&&o.push(r)}return 0==o.length&&t.err("No node type or group '"+e+"' found"),o}(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}t.err("Unexpected token '"+t.next+"'")}(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=K(t,e)}return e}function j(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function K(t,e){let n=j(t),r=n;return t.eat(",")&&(r="}"!=t.next?j(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function J(t,e){return e-t}function W(t,e){let n=[];return function e(r){let o=t[r];if(1==o.length&&!o[0].term)return e(o[0].to);n.push(r);for(let t=0;t<o.length;t++){let{term:r,to:i}=o[t];r||-1!=n.indexOf(i)||e(i)}}(e),n.sort(J)}function U(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function q(t,e){let n=Object.create(null);for(let r in t){let o=e&&e[r];if(void 0===o){let e=t[r];if(!e.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=e.default}n[r]=o}return n}function H(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${r}`);for(let n in t)t[n].validate&&t[n].validate(e[n])}function _(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Y(t,r,e[r]);return n}class X{constructor(t,e,n){this.name=t,this.schema=e,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=_(t,n.attrs),this.defaultAttrs=U(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==t),this.isText="text"==t}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==P.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:q(this.attrs,t)}create(t=null,e,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new z(this,this.computeAttrs(t),c.from(e),p.setFrom(n))}createChecked(t=null,e,n){return e=c.from(e),this.checkContent(e),new z(this,this.computeAttrs(t),e,p.setFrom(n))}createAndFill(t=null,e,n){if(t=this.computeAttrs(t),(e=c.from(e)).size){let t=this.contentMatch.fillBefore(e);if(!t)return null;e=t.append(e)}let r=this.contentMatch.matchFragment(e),o=r&&r.fillBefore(c.empty,!0);return o?new z(this,t,e.append(o),p.setFrom(n)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let e=0;e<t.childCount;e++)if(!this.allowsMarks(t.child(e).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){H(this.attrs,t,"node",this.name)}allowsMarkType(t){return null==this.markSet||this.markSet.indexOf(t)>-1}allowsMarks(t){if(null==this.markSet)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(null==this.markSet)return t;let e;for(let n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?e&&e.push(t[n]):e||(e=t.slice(0,n));return e?e.length?e:p.none:t}static compile(t,e){let n=Object.create(null);t.forEach((t,r)=>n[t]=new X(t,e,r));let r=e.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let t in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class Y{constructor(t,e,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(t,e,n){let r=n.split("|");return n=>{let o=null===n?"null":typeof n;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}(t,e,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class G{constructor(t,e,n,r){this.name=t,this.rank=e,this.schema=n,this.spec=r,this.attrs=_(t,r.attrs),this.excluded=null;let o=U(this.attrs);this.instance=o?new p(this,o):null}create(t=null){return!t&&this.instance?this.instance:new p(this,q(this.attrs,t))}static compile(t,e){let n=Object.create(null),r=0;return t.forEach((t,o)=>n[t]=new G(t,r++,e,o)),n}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}checkAttrs(t){H(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class Z{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let e=this.spec={};for(let n in t)e[n]=t[n];e.nodes=o.from(t.nodes),e.marks=o.from(t.marks||{}),this.nodes=X.compile(this.spec.nodes,this),this.marks=G.compile(this.spec.marks,this);let n=Object.create(null);for(let t in this.nodes){if(t in this.marks)throw new RangeError(t+" can not be both a node and a mark");let e=this.nodes[t],r=e.spec.content||"",o=e.spec.marks;if(e.contentMatch=n[r]||(n[r]=P.parse(r,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==o?null:o?Q(this,o.split(" ")):""!=o&&e.inlineContent?null:[]}for(let t in this.marks){let e=this.marks[t],n=e.spec.excludes;e.excluded=null==n?[e]:""==n?[]:Q(this,n.split(" "))}this.nodeFromJSON=t=>z.fromJSON(this,t),this.markFromJSON=t=>p.fromJSON(this,t),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,e=null,n,r){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof X))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,r)}text(t,e){let n=this.nodes.text;return new $(n,n.defaultAttrs,t,p.setFrom(e))}mark(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function Q(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let e in t.marks){let r=t.marks[e];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}class tt{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let n=this.matchedStyles=[];e.forEach(t=>{if(function(t){return null!=t.tag}(t))this.tags.push(t);else if(function(t){return null!=t.style}(t)){let e=/[^=]*/.exec(t.style)[0];n.indexOf(e)<0&&n.push(e),this.styles.push(t)}}),this.normalizeLists=!this.tags.some(e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;let n=t.nodes[e.node];return n.contentMatch.matchType(n)})}parse(t,e={}){let n=new st(this,e,!1);return n.addAll(t,p.none,e.from,e.to),n.finish()}parseSlice(t,e={}){let n=new st(this,e,!0);return n.addAll(t,p.none,e.from,e.to),m.maxOpen(n.finish())}matchTag(t,e,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(at(t,n.tag)&&(void 0===n.namespace||t.namespaceURI==n.namespace)&&(!n.context||e.matchesContext(n.context))){if(n.getAttrs){let e=n.getAttrs(t);if(!1===e)continue;n.attrs=e||void 0}return n}}}matchStyle(t,e,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(t)||r.context&&!n.matchesContext(r.context)||i.length>t.length&&(61!=i.charCodeAt(t.length)||i.slice(t.length+1)!=e))){if(r.getAttrs){let t=r.getAttrs(e);if(!1===t)continue;r.attrs=t||void 0}return r}}}static schemaRules(t){let e=[];function n(t){let n=null==t.priority?50:t.priority,r=0;for(;r<e.length;r++){let t=e[r];if((null==t.priority?50:t.priority)<n)break}e.splice(r,0,t)}for(let e in t.marks){let r=t.marks[e].spec.parseDOM;r&&r.forEach(t=>{n(t=lt(t)),t.mark||t.ignore||t.clearMark||(t.mark=e)})}for(let e in t.nodes){let r=t.nodes[e].spec.parseDOM;r&&r.forEach(t=>{n(t=lt(t)),t.node||t.ignore||t.mark||(t.node=e)})}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new tt(t,tt.schemaRules(t)))}}const et={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},nt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},rt={ol:!0,ul:!0};function ot(t,e,n){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&n}class it{constructor(t,e,n,r,o,i){this.type=t,this.attrs=e,this.marks=n,this.solid=r,this.options=i,this.content=[],this.activeMarks=p.none,this.match=o||(4&i?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(c.from(t));if(!e){let e,n=this.type.contentMatch;return(e=n.findWrapping(t.type))?(this.match=n,e):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let t,e=this.content[this.content.length-1];if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let e=c.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(c.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!et.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class st{constructor(t,e,n){this.parser=t,this.options=e,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,o=e.topNode,i=ot(null,e.preserveWhitespace,0)|(n?4:0);r=o?new it(o.type,o.attrs,p.none,!0,e.topMatch||o.type.contentMatch,i):new it(n?null:t.schema.topNodeType,null,p.none,!0,null,i),this.nodes=[r],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,e){3==t.nodeType?this.addTextNode(t,e):1==t.nodeType&&this.addElement(t,e)}addTextNode(t,e){let n=t.nodeValue,r=this.top,o=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:i}=this.parser;if("full"===o||r.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(o)if("full"===o)n=n.replace(/\r\n?/g,"\n");else if(i.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(i.linebreakReplacement.create())){let t=n.split(/\r?\n|\r/);for(let n=0;n<t.length;n++)n&&this.insertNode(i.linebreakReplacement.create(),e,!0),t[n]&&this.insertNode(i.text(t[n]),e,!/\S/.test(t[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let e=r.content[r.content.length-1],o=t.previousSibling;(!e||o&&"BR"==o.nodeName||e.isText&&/[ \t\r\n\u000c]$/.test(e.text))&&(n=n.slice(1))}n&&this.insertNode(i.text(n),e,!/\S/.test(n)),this.findInText(t)}else this.findInside(t)}addElement(t,e,n){let r=this.localPreserveWS,o=this.top;("PRE"==t.tagName||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let i,s=t.nodeName.toLowerCase();rt.hasOwnProperty(s)&&this.parser.normalizeLists&&function(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let t=1==e.nodeType?e.nodeName.toLowerCase():null;t&&rt.hasOwnProperty(t)&&n?(n.appendChild(e),e=n):"li"==t?n=e:t&&(n=null)}}(t);let a=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(i=this.parser.matchTag(t,this,n));t:if(a?a.ignore:nt.hasOwnProperty(s))this.findInside(t),this.ignoreFallback(t,e);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(t=a.skip);let n,r=this.needsBlock;if(et.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),n=!0,o.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,e);break t}let i=a&&a.skip?e:this.readStyles(t,e);i&&this.addAll(t,i),n&&this.sync(o),this.needsBlock=r}else{let n=this.readStyles(t,e);n&&this.addElementByRule(t,a,n,!1===a.consuming?i:void 0)}this.localPreserveWS=r}leafFallback(t,e){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"),e)}ignoreFallback(t,e){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),e,!0)}readStyles(t,e){let n=t.style;if(n&&n.length)for(let t=0;t<this.parser.matchedStyles.length;t++){let r=this.parser.matchedStyles[t],o=n.getPropertyValue(r);if(o)for(let t;;){let n=this.parser.matchStyle(r,o,this,t);if(!n)break;if(n.ignore)return null;if(e=n.clearMark?e.filter(t=>!n.clearMark(t)):e.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;t=n}}return e}addElementByRule(t,e,n,r){let o,i;if(e.node)if(i=this.parser.schema.nodes[e.node],i.isLeaf)this.insertNode(i.create(e.attrs),n,"BR"==t.nodeName)||this.leafFallback(t,n);else{let t=this.enter(i,e.attrs||null,n,e.preserveWhitespace);t&&(o=!0,n=t)}else{let t=this.parser.schema.marks[e.mark];n=n.concat(t.create(e.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(t);else if(r)this.addElement(t,n,r);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach(t=>this.insertNode(t,n,!1));else{let r=t;"string"==typeof e.contentElement?r=t.querySelector(e.contentElement):"function"==typeof e.contentElement?r=e.contentElement(t):e.contentElement&&(r=e.contentElement),this.findAround(t,r,!0),this.addAll(r,n),this.findAround(t,r,!1)}o&&this.sync(s)&&this.open--}addAll(t,e,n,r){let o=n||0;for(let i=n?t.childNodes[n]:t.firstChild,s=null==r?null:t.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(i,e);this.findAtPoint(t,o)}findPlace(t,e,n){let r,o;for(let e=this.open,i=0;e>=0;e--){let s=this.nodes[e],a=s.findWrapping(t);if(a&&(!r||r.length>a.length+i)&&(r=a,o=s,!a.length))break;if(s.solid){if(n)break;i+=2}}if(!r)return null;this.sync(o);for(let t=0;t<r.length;t++)e=this.enterInner(r[t],null,e,!1);return e}insertNode(t,e,n){if(t.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&(e=this.enterInner(t,null,e))}let r=this.findPlace(t,e,n);if(r){this.closeExtra();let e=this.top;e.match&&(e.match=e.match.matchType(t.type));let n=p.none;for(let o of r.concat(t.marks))(e.type?e.type.allowsMarkType(o.type):ct(o.type,t.type))&&(n=o.addToSet(n));return e.content.push(t.mark(n)),!0}return!1}enter(t,e,n,r){let o=this.findPlace(t.create(e),n,!1);return o&&(o=this.enterInner(t,e,n,!0,r)),o}enterInner(t,e,n,r=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(t);let s=ot(t,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let a=p.none;return n=n.filter(e=>!(i.type?i.type.allowsMarkType(e.type):ct(e.type,t))||(a=e.addToSet(a),!1)),this.nodes.push(new it(t,e,a,r,null,s)),this.open++,n}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(t){for(let e=this.open;e>=0;e--){if(this.nodes[e]==t)return this.open=e,!0;this.localPreserveWS&&(this.nodes[e].options|=1)}return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let n=this.nodes[e].content;for(let e=n.length-1;e>=0;e--)t+=n[e].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==e&&(this.find[n].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)null==this.find[e].pos&&1==t.nodeType&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,n){if(t!=e&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==t.nodeType&&t.contains(this.find[r].node)&&e.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(t,s)=>{for(;t>=0;t--){let a=e[t];
vendor: 5,633 bytes, line 1
1if(""==a){if(t==e.length-1||0==t)continue;for(;s>=o;s--)if(i(t-1,s))return!0;return!1}{let t=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!t||t.name!=a&&!t.isInGroup(a))return!1;s--}}return!0};return i(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function at(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function lt(t){let e={};for(let n in t)e[n]=t[n];return e}function ct(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=t=>{i.push(t);for(let n=0;n<t.edgeCount;n++){let{type:r,next:o}=t.edge(n);if(r==e)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class dt{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},n){n||(n=ut(e).createDocumentFragment());let r=n,o=[];return t.forEach(t=>{if(o.length||t.marks.length){let n=0,i=0;for(;n<o.length&&i<t.marks.length;){let e=t.marks[i];if(this.marks[e.type.name]){if(!e.eq(o[n][0])||!1===e.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<t.marks.length;){let n=t.marks[i++],s=this.serializeMark(n,t.isInline,e);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(t,e))}),n}serializeNodeInner(t,e){if(t.isText)return ut(e).createTextNode(t.text);let{dom:n,contentDOM:r}=ft(ut(e),this.nodes[t.type.name](t),null,t.attrs);if(r){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,r)}return n}serializeNode(t,e={}){let n=this.serializeNodeInner(t,e);for(let r=t.marks.length-1;r>=0;r--){let o=this.serializeMark(t.marks[r],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(t,e,n={}){let r=this.marks[t.type.name];return r&&ft(ut(n),r(t,e),null,t.attrs)}static renderSpec(t,e,n=null,r){return"string"==typeof e?{dom:t.createTextNode(e)}:ft(t,e,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new dt(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=ht(t.nodes);return e.text||(e.text=t=>t.text),e}static marksFromSchema(t){return ht(t.marks)}}function ht(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ut(t){return t.document||window.document}const pt=new WeakMap;function ft(t,e,n,r){if(1==e.nodeType)return{dom:e};if(e.dom&&1==e.dom.nodeType)return e;let o,i=e[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=function(t){let e=pt.get(t);return void 0===e&&pt.set(t,e=function(t){let e=null;return function t(n){if(n&&"object"==typeof n)if(Array.isArray(n))if("string"==typeof n[0])e||(e=[]),e.push(n);else for(let e=0;e<n.length;e++)t(n[e]);else for(let e in n)t(n[e])}(t),e}(t)),e}(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s,a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let l=n?t.createElementNS(n,i):t.createElement(i),c=e[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let t in c)if(null!=c[t]){let e=t.indexOf(" ");e>0?l.setAttributeNS(t.slice(0,e),t.slice(e+1),c[t]):"style"==t&&l.style?l.style.cssText=c[t]:l.setAttribute(t,c[t])}}for(let o=d;o<e.length;o++){let i=e[o];if(0===i){if(o<e.length-1||o>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}if("string"==typeof i)l.appendChild(t.createTextNode(i));else{let{dom:e,contentDOM:o}=ft(t,i,n,r);if(l.appendChild(e),o){if(s)throw new RangeError("Multiple content holes");s=o}}}return{dom:l,contentDOM:s}}},67599:function(t,e,n){n.d(e,{$t:function(){return S},LN:function(){return s},U3:function(){return d},hs:function(){return E},i5:function(){return f},k_:function(){return C},nh:function(){return u}});var r=n(81429),o=n(57156);const i=Object.create(null);class s{constructor(t,e,n){this.$anchor=t,this.$head=e,this.ranges=n||[new a(t.min(e),t.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=r.Ji.empty){let n=e.content.lastChild,o=null;for(let t=0;t<e.openEnd;t++)o=n,n=n.lastChild;let i=t.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],d=t.mapping.slice(i);t.replaceRange(d.map(l.pos),d.map(c.pos),a?r.Ji.empty:e),0==a&&y(t,i,(n?n.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(t,e){let n=t.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=t.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);o?t.deleteRange(l,c):(t.replaceRangeWith(l,c,e),y(t,n,e.isInline?-1:1))}}static findFrom(t,e,n=!1){let r=t.parent.inlineContent?new d(t):g(t.node(0),t.parent,t.pos,t.index(),e,n);if(r)return r;for(let r=t.depth-1;r>=0;r--){let o=e<0?g(t.node(0),t.node(r),t.before(r+1),t.index(r),e,n):g(t.node(0),t.node(r),t.after(r+1),t.index(r)+1,e,n);if(o)return o}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new f(t.
vendor: 38,180 bytes, line 1
1node(0))}static atStart(t){return g(t,t,0,0,1)||new f(t)}static atEnd(t){return g(t,t,t.content.size,t.childCount,-1)||new f(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=i[e.type];if(!n)throw new RangeError(`No selection type ${e.type} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in i)throw new RangeError("Duplicate use of selection JSON ID "+t);return i[t]=e,e.prototype.jsonID=t,e}getBookmark(){return d.between(this.$anchor,this.$head).getBookmark()}}s.prototype.visible=!0;class a{constructor(t,e){this.$from=t,this.$to=e}}let l=!1;function c(t){l||t.parent.inlineContent||(l=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class d extends s{constructor(t,e=t){c(t),c(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let n=t.resolve(e.map(this.head));if(!n.parent.inlineContent)return s.near(n);let r=t.resolve(e.map(this.anchor));return new d(r.parent.inlineContent?r:n,n)}replace(t,e=r.Ji.empty){if(super.replace(t,e),e==r.Ji.empty){let e=this.$from.marksAcross(this.$to);e&&t.ensureMarks(e)}}eq(t){return t instanceof d&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new h(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if("number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new d(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,n=e){let r=t.resolve(e);return new this(r,n==e?r:t.resolve(n))}static between(t,e,n){let r=t.pos-e.pos;if(n&&!r||(n=r>=0?1:-1),!e.parent.inlineContent){let t=s.findFrom(e,n,!0)||s.findFrom(e,-n,!0);if(!t)return s.near(e,n);e=t.$head}return t.parent.inlineContent||(0==r||(t=(s.findFrom(t,-n,!0)||s.findFrom(t,n,!0)).$anchor).pos<e.pos!=r<0)&&(t=e),new d(t,e)}}s.jsonID("text",d);class h{constructor(t,e){this.anchor=t,this.head=e}map(t){return new h(t.map(this.anchor),t.map(this.head))}resolve(t){return d.between(t.resolve(this.anchor),t.resolve(this.head))}}class u extends s{constructor(t){let e=t.nodeAfter,n=t.node(0).resolve(t.pos+e.nodeSize);super(t,n),this.node=e}map(t,e){let{deleted:n,pos:r}=e.mapResult(this.anchor),o=t.resolve(r);return n?s.near(o):new u(o)}content(){return new r.Ji(r.FK.from(this.node),0,0)}eq(t){return t instanceof u&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new p(this.anchor)}static fromJSON(t,e){if("number"!=typeof e.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new u(t.resolve(e.anchor))}static create(t,e){return new u(t.resolve(e))}static isSelectable(t){return!t.isText&&!1!==t.type.spec.selectable}}u.prototype.visible=!1,s.jsonID("node",u);class p{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:n}=t.mapResult(this.anchor);return e?new h(n,n):new p(n)}resolve(t){let e=t.resolve(this.anchor),n=e.nodeAfter;return n&&u.isSelectable(n)?new u(e):s.near(e)}}class f extends s{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=r.Ji.empty){if(e==r.Ji.empty){t.delete(0,t.doc.content.size);let e=s.atStart(t.doc);e.eq(t.selection)||t.setSelection(e)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new f(t)}map(t){return new f(t)}eq(t){return t instanceof f}getBookmark(){return m}}s.jsonID("all",f);const m={map(){return this},resolve(t){return new f(t)}};function g(t,e,n,r,o,i=!1){if(e.inlineContent)return d.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let r=e.child(s);if(r.isAtom){if(!i&&u.isSelectable(r))return u.create(t,n-(o<0?r.nodeSize:0))}else{let e=g(t,r,n+o,o<0?r.childCount:0,o,i);if(e)return e}n+=r.nodeSize*o}return null}function y(t,e,n){let r=t.steps.length-1;if(r<e)return;let i,a=t.steps[r];(a instanceof o.Ln||a instanceof o.Wg)&&(t.mapping.maps[r].forEach((t,e,n,r)=>{null==i&&(i=r)}),t.setSelection(s.near(t.doc.resolve(i),n)))}class v extends o.dL{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=2,this}ensureMarks(t){return r.CU.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(t,e){super.addStep(t,e),this.updated=-3&this.updated,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,e=!0){let n=this.selection;return e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||r.CU.none))),n.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,n){let r=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(r.text(t),!0):this.deleteSelection();{if(null==n&&(n=e),!t)return this.deleteRange(e,n);let o=this.storedMarks;if(!o){let t=this.doc.resolve(e);o=n==e?t.marks():t.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,r.text(t,o)),this.selection.empty||this.selection.to!=e+t.length||this.setSelection(s.near(this.selection.$to)),this}}setMeta(t,e){return this.meta["string"==typeof t?t:t.key]=e,this}getMeta(t){return this.meta["string"==typeof t?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function w(t,e){return e&&t?t.bind(e):t}class b{constructor(t,e,n){this.name=t,this.init=w(e.init,n),this.apply=w(e.apply,n)}}const k=[new b("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new b("selection",{init(t,e){return t.selection||s.atStart(e.doc)},apply(t){return t.selection}}),new b("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new b("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class x{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=k.slice(),e&&e.forEach(t=>{if(this.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");this.plugins.push(t),this.pluginsByKey[t.key]=t,t.spec.state&&this.fields.push(new b(t.key,t.spec.state,t))})}}class S{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,e=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=e){let e=this.config.plugins[n];if(e.spec.filterTransaction&&!e.spec.filterTransaction.call(e,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let e=[t],n=this.applyInner(t),r=null;for(;;){let o=!1;for(let i=0;i<this.config.plugins.length;i++){let s=this.config.plugins[i];if(s.spec.appendTransaction){let a=r?r[i].n:0,l=r?r[i].state:this,c=a<e.length&&s.spec.appendTransaction.call(s,a?e.slice(a):e,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",t),!r){r=[];for(let t=0;t<this.config.plugins.length;t++)r.push(t<i?{state:n,n:e.length}:{state:this,n:0})}e.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:e.length})}}if(!o)return{state:n,transactions:e}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let e=new S(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let o=n[r];e[o.name]=o.apply(t,this[o.name],this,e)}return e}get tr(){return new v(this)}static create(t){let e=new x(t.doc?t.doc.type.schema:t.schema,t.plugins),n=new S(e);for(let r=0;r<e.fields.length;r++)n[e.fields[r].name]=e.fields[r].init(t,n);return n}reconfigure(t){let e=new x(this.schema,t.plugins),n=e.fields,r=new S(e);for(let e=0;e<n.length;e++){let o=n[e].name;r[o]=this.hasOwnProperty(o)?this[o]:n[e].init(t,r)}return r}toJSON(t){let e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map(t=>t.toJSON())),t&&"object"==typeof t)for(let n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=t[n],o=r.spec.state;o&&o.toJSON&&(e[n]=o.toJSON.call(r,this[r.key]))}return e}static fromJSON(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let o=new x(t.schema,t.plugins),i=new S(o);return o.fields.forEach(o=>{if("doc"==o.name)i.doc=r.bP.fromJSON(t.schema,e.doc);else if("selection"==o.name)i.selection=s.fromJSON(i.doc,e.selection);else if("storedMarks"==o.name)e.storedMarks&&(i.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(let r in n){let s=n[r],a=s.spec.state;if(s.key==o.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(e,r))return void(i[o.name]=a.fromJSON.call(s,t,e[r],i))}i[o.name]=o.init(t,i)}}),i}}function M(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):"handleDOMEvents"==r&&(o=M(o,e,{})),n[r]=o}return n}class C{constructor(t){this.spec=t,this.props={},t.props&&M(t.props,this,this.props),this.key=t.key?t.key.key:N("plugin")}getState(t){return t[this.key]}}const O=Object.create(null);function N(t){return t in O?t+"$"+ ++O[t]:(O[t]=0,t+"$")}class E{constructor(t="key"){this.key=N(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}},57156:function(t,e,n){n.d(e,{$L:function(){return z},Ln:function(){return v},N0:function(){return A},Um:function(){return R},Wg:function(){return w},X9:function(){return c},Ys:function(){return m},dL:function(){return _},jP:function(){return S},n9:function(){return T},oM:function(){return M},zy:function(){return E}});var r=n(81429);const o=Math.pow(2,16);function i(t,e){return t+e*o}function s(t){return 65535&t}class a{constructor(t,e,n){this.pos=t,this.delInfo=e,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class l{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&l.empty)return l.empty}recover(t){let e=0,n=s(t);if(!this.inverted)for(let t=0;t<n;t++)e+=this.ranges[3*t+2]-this.ranges[3*t+1];return this.ranges[3*n]+e+function(t){return(t-(65535&t))/o}(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,n){let r=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>t)break;let d=this.ranges[l+o],h=this.ranges[l+s],u=c+d;if(t<=u){let o=c+r+((d?t==c?-1:t==u?1:e:e)<0?0:h);if(n)return o;let s=t==(e<0?c:u)?null:i(l/3,t-c),p=t==c?2:t==u?1:4;return(e<0?t!=c:t!=u)&&(p|=8),new a(o,p,s)}r+=h-d}return n?t+r:new a(t+r,0,null)}touches(t,e){let n=0,r=s(e),o=this.inverted?2:1,i=this.inverted?1:2;for(let e=0;e<this.ranges.length;e+=3){let s=this.ranges[e]-(this.inverted?n:0);if(s>t)break;let a=this.ranges[e+o];if(t<=s+a&&e==3*r)return!0;n+=this.ranges[e+i]-a}return!1}forEach(t){let e=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+e],c=this.ranges[r+n];t(s,s+l,a,a+c),o+=c-l}}invert(){return new l(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?l.empty:new l(t<0?[0,-t,0]:[0,0,t])}}l.empty=new l([]);class c{constructor(t,e,n=0,r=(t?t.length:0)){this.mirror=e,this.from=n,this.to=r,this._maps=t||[],this.ownData=!(t||e)}get maps(){return this._maps}slice(t=0,e=this.maps.length){return new c(this._maps,this.mirror,t,e)}appendMap(t,e){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),null!=e&&this.setMirror(this._maps.length-1,e)}appendMapping(t){for(let e=0,n=this._maps.length;e<t._maps.length;e++){let r=t.getMirror(e);this.appendMap(t._maps[e],null!=r&&r<e?n+r:void 0)}}getMirror(t){if(this.mirror)for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,n=this._maps.length+t._maps.length;e>=0;e--){let r=t.getMirror(e);this.appendMap(t._maps[e].invert(),null!=r&&r>e?n-r-1:void 0)}}invert(){let t=new c;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let n=this.from;n<this.to;n++)t=this._maps[n].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,n){let r=0;for(let n=this.from;n<this.to;n++){let o=this._maps[n].mapResult(t,e);if(null!=o.recover){let e=this.getMirror(n);if(null!=e&&e>n&&e<this.to){n=e,t=this._maps[e].recover(o.recover);continue}}r|=o.delInfo,t=o.pos}return n?t:new a(t,r,null)}}const d=Object.create(null);class h{getMap(){return l.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=d[e.stepType];if(!n)throw new RangeError(`No step type ${e.stepType} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in d)throw new RangeError("Duplicate use of step JSON ID "+t);return d[t]=e,e.prototype.jsonID=t,e}}class u{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new u(t,null)}static fail(t){return new u(null,t)}static fromReplace(t,e,n,o){try{return u.ok(t.replace(e,n,o))}catch(t){if(t instanceof r.vI)return u.fail(t.message);throw t}}}function p(t,e,n){let o=[];for(let r=0;r<t.childCount;r++){let i=t.child(r);i.content.size&&(i=i.copy(p(i.content,e,i))),i.isInline&&(i=e(i,n,r)),o.push(i)}return r.FK.fromArray(o)}class f extends h{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=t.resolve(this.from),o=n.node(n.sharedDepth(this.to)),i=new r.Ji(p(e.content,(t,e)=>t.isAtom&&e.type.allowsMarkType(this.mark.type)?t.mark(this.mark.addToSet(t.marks)):t,o),e.openStart,e.openEnd);return u.fromReplace(t,this.from,this.to,i)}invert(){return new m(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new f(e.pos,n.pos,this.mark)}merge(t){return t instanceof f&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new f(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new f(e.from,e.to,t.markFromJSON(e.mark))}}h.jsonID("addMark",f);class m extends h{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=new r.Ji(p(e.content,t=>t.mark(this.mark.removeFromSet(t.marks)),t),e.openStart,e.openEnd);return u.fromReplace(t,this.from,this.to,n)}invert(){return new f(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new m(e.pos,n.pos,this.mark)}merge(t){return t instanceof m&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new m(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new m(e.from,e.to,t.markFromJSON(e.mark))}}h.jsonID("removeMark",m);class g extends h{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return u.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return u.fromReplace(t,this.pos,this.pos+1,new r.Ji(r.FK.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let t=this.mark.addToSet(e.marks);if(t.length==e.marks.length){for(let n=0;n<e.marks.length;n++)if(!e.marks[n].isInSet(t))return new g(this.pos,e.marks[n]);return new g(this.pos,this.mark)}}return new y(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new g(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new g(e.pos,t.markFromJSON(e.mark))}}h.jsonID("addNodeMark",g);class y extends h{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return u.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return u.fromReplace(t,this.pos,this.pos+1,new r.Ji(r.FK.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return e&&this.mark.isInSet(e.marks)?new g(this.pos,this.mark):this}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new y(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new y(e.pos,t.markFromJSON(e.mark))}}h.jsonID("removeNodeMark",y);class v extends h{constructor(t,e,n,r=!1){super(),this.from=t,this.to=e,this.slice=n,this.structure=r}apply(t){return this.structure&&b(t,this.from,this.to)?u.fail("Structure replace would overwrite content"):u.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new l([this.from,this.to-this.from,this.slice.size])}invert(t){return new v(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.to,-1),n=this.from==this.to&&v.MAP_BIAS<0?e:t.mapResult(this.from,1);return n.deletedAcross&&e.deletedAcross?null:new v(n.pos,Math.max(n.pos,e.pos),this.slice,this.structure)}merge(t){if(!(t instanceof v)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let e=this.slice.size+t.slice.size==0?r.Ji.empty:new r.Ji(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new v(t.from,this.to,e,this.structure)}}{let e=this.slice.size+t.slice.size==0?r.Ji.empty:new r.Ji(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new v(this.from,this.to+(t.to-t.from),e,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new v(e.from,e.to,r.Ji.fromJSON(t,e.slice),!!e.structure)}}v.MAP_BIAS=1,h.jsonID("replace",v);class w extends h{constructor(t,e,n,r,o,i,s=!1){super(),this.from=t,this.to=e,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(t){if(this.structure&&(b(t,this.from,this.gapFrom)||b(t,this.gapTo,this.to)))return u.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return u.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,e.content);return n?u.fromReplace(t,this.from,this.to,n):u.fail("Content does not fit in gap")}getMap(){return new l([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new w(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1),r=this.from==this.gapFrom?e.pos:t.map(this.gapFrom,-1),o=this.to==this.gapTo?n.pos:t.map(this.gapTo,1);return e.deletedAcross&&n.deletedAcross||r<e.pos||o>n.pos?null:new w(e.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to||"number"!=typeof e.gapFrom||"number"!=typeof e.gapTo||"number"!=typeof e.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new w(e.from,e.to,e.gapFrom,e.gapTo,r.Ji.fromJSON(t,e.slice),e.insert,!!e.structure)}}function b(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let t=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!t||t.isLeaf)return!0;t=t.firstChild,o--}}return!1}function k(t,e,n,o=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),a=[],l=e+1;for(let e=0;e<s.childCount;e++){let c=s.child(e),d=l+c.nodeSize,h=o.matchType(c.type);if(h){o=h;for(let e=0;e<c.marks.length;e++)n.allowsMarkType(c.marks[e].type)||t.step(new m(l,d,c.marks[e]));if(i&&c.isText&&"pre"!=n.whitespace){let t,e,o=/\r?\n|\r/g;for(;t=o.exec(c.text);)e||(e=new r.Ji(r.FK.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),a.push(new v(l+t.index,l+t.index+t[0].length,e))}}else a.push(new v(l,d,r.Ji.empty));l=d}if(!o.validEnd){let e=o.fillBefore(r.FK.empty,!0);t.replace(l,l,new r.Ji(e,0,0))}for(let e=a.length-1;e>=0;e--)t.step(a[e])}function x(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function S(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth,r=0,o=0;;--n){let i=t.$from.node(n),s=t.$from.index(n)+r,a=t.$to.indexAfter(n)-o;if(n<t.depth&&i.canReplace(s,a,e))return n;if(0==n||i.type.spec.isolating||!x(i,s,a))break;s&&(r=1),a<i.childCount&&(o=1)}return null}function M(t,e,n=null,r=t){let o=function(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}(t,e),i=o&&function(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let t=r;a&&t<o;t++)a=a.matchType(n.child(t).type);return a&&a.validEnd?s:null}(r,e);return i?o.map(C).concat({type:e,attrs:n}).concat(i.map(C)):null}function C(t){return{type:t,attrs:null}}function O(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let o=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(o,o+1,e.type.schema.linebreakReplacement.create())}}})}function N(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+i);t.replaceWith(o,o+1,e.type.schema.text("\n"))}})}function E(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let t=o.depth-1,e=n-2;t>i;t--,e--){let n=o.node(t),i=o.index(t);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),a=r&&r[e+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[e]||n;if(!n.canReplace(i+1,n.childCount)||!l.type.validContent(s))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function T(t,e){let n=t.resolve(e),r=n.index();return D(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function D(t,e){return!(!t||!e||t.isLeaf||!function(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n)return!1;if(!t.type.allowsMarks(i.marks))return!1}return n.validEnd}(t,e))}function A(t,e,n=-1){let r=t.resolve(e);for(let t=r.depth;;t--){let o,i,s=r.index(t);if(t==r.depth?(o=r.nodeBefore,i=r.nodeAfter):n>0?(o=r.node(t+1),s++,i=r.node(t).maybeChild(s)):(o=r.node(t).maybeChild(s-1),i=r.node(t+1)),o&&!o.isTextblock&&D(o,i)&&r.node(t).canReplace(s,s+1))return e;if(0==t)break;e=n<0?r.before(t):r.after(t)}}function R(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let t=0;t<n.openStart;t++)o=o.firstChild.content;for(let t=1;t<=(0==n.openStart&&n.size?2:1);t++)for(let e=r.depth;e>=0;e--){let n=e==r.depth?0:r.pos<=(r.start(e+1)+r.end(e+1))/2?-1:1,i=r.index(e)+(n>0?1:0),s=r.node(e),a=!1;if(1==t)a=s.canReplace(i,i,o);else{let t=s.contentMatchAt(i).findWrapping(o.firstChild.type);a=t&&s.canReplaceWith(i,i,t[0])}if(a)return 0==n?r.pos:n<0?r.before(e+1):r.after(e+1)}return null}function z(t,e,n=e,o=r.Ji.empty){if(e==n&&!o.size)return null;let i=t.resolve(e),s=t.resolve(n);return $(i,s,o)?new v(e,n,o):new I(i,s,o).fit()}function $(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}h.jsonID("replaceAround",w);class I{constructor(t,e,n){this.$from=t,this.$to=e,this.unplaced=n,this.frontier=[],this.placed=r.FK.empty;for(let e=0;e<=t.depth;e++){let n=t.node(e);this.frontier.push({type:n.type,match:n.contentMatchAt(t.indexAfter(e))})}for(let e=t.depth;e>0;e--)this.placed=r.FK.from(t.node(e).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,n=this.$from,o=this.close(t<0?this.$to:n.doc.resolve(t));if(!o)return null;let i=this.placed,s=n.depth,a=o.depth;for(;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;let l=new r.Ji(i,s,a);return t>-1?new w(n.pos,t,this.$to.pos,this.$to.end(),l,e):l.size||n.pos!=this.$to.pos?new v(n.pos,o.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<t;n++){let o=e.firstChild;if(e.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){t=n;break}e=o.content}for(let e=1;e<=2;e++)for(let n=1==e?t:this.unplaced.openStart;n>=0;n--){let t,o=null;n?(o=B(this.unplaced.content,n-1).firstChild,t=o.content):t=this.unplaced.content;let i=t.firstChild;for(let t=this.depth;t>=0;t--){let s,{type:a,match:l}=this.frontier[t],c=null;if(1==e&&(i?l.matchType(i.type)||(c=l.fillBefore(r.FK.from(i),!1)):o&&a.compatibleContent(o.type)))return{sliceDepth:n,frontierDepth:t,parent:o,inject:c};if(2==e&&i&&(s=l.findWrapping(i.type)))return{sliceDepth:n,frontierDepth:t,parent:o,wrap:s};if(o&&l.matchType(o.type))break}}}openMore(){let{content:t,openStart:e,openEnd:n}=this.unplaced;return!(K(t,-1)<=e||(this.unplaced.size>1&&K(t,1)>n&&n++,this.unplaced=new r.Ji(t,e+1,n),0))}dropNode(){let{content:t,openStart:e,openEnd:n}=this.unplaced,o=B(t,e);if(o.childCount<=1&&e>0){let i=t.size-e<=e+o.size;this.unplaced=new r.Ji(P(t,e-1,1),e-1,i?e-1:n)}else this.unplaced=new r.Ji(P(t,e,1),e,n)}placeNodes({sliceDepth:t,frontierDepth:e,parent:n,inject:o,wrap:i}){for(;this.depth>e;)this.closeFrontierNode();if(i)for(let t=0;t<i.length;t++)this.openFrontierNode(i[t]);let s=this.unplaced,a=n?n.content:s.content,l=s.openStart-t,c=0,d=[],{match:h,type:u}=this.frontier[e];if(o){for(let t=0;t<o.childCount;t++)d.push(o.child(t));h=h.matchFragment(o)}let p=a.size+t-(s.content.size-s.openEnd);for(;c<a.childCount;){let t=a.child(c),e=h.matchType(t.type);if(!e)break;c++,(c>1||0==l||t.content.size)&&(h=e,d.push(V(t.mark(u.allowedMarks(t.marks)),1==c?l:0,c==a.childCount?p:-1)))}let f=c==a.childCount;f||(p=-1),this.placed=F(this.placed,e,r.FK.from(d)),this.frontier[e].match=h,f&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let t=0,e=a;t<p;t++){let t=e.lastChild;this.frontier.push({type:t.type,match:t.contentMatchAt(t.childCount)}),e=t.content}this.unplaced=f?0==t?r.Ji.empty:new r.Ji(P(s.content,t-1,1),t-1,p<0?s.openEnd:t-1):new r.Ji(P(s.content,t,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t,e=this.frontier[this.depth];if(!e.type.isTextblock||!L(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:n,type:r}=this.frontier[e],o=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),i=L(t,e,r,n,o);if(i){for(let n=e-1;n>=0;n--){let{match:e,type:r}=this.frontier[n],o=L(t,n,r,e,!0);if(!o||o.childCount)continue t}return{depth:e,fit:i,move:o?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=F(this.placed,e.depth,e.fit)),t=e.move;for(let n=e.depth+1;n<=t.depth;n++){let e=t.node(n),r=e.type.contentMatch.fillBefore(e.content,!0,t.index(n));this.openFrontierNode(e.type,e.attrs,r)}return t}openFrontierNode(t,e=null,n){let o=this.frontier[this.depth];o.match=o.match.matchType(t),this.placed=F(this.placed,this.depth,r.FK.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(r.FK.empty,!0);t.childCount&&(this.placed=F(this.placed,this.frontier.length,t))}}function P(t,e,n){return 0==e?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(P(t.firstChild.content,e-1,n)))}function F(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(F(t.lastChild.content,e-1,n)))}function B(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function V(t,e,n){if(e<=0)return t;let o=t.content;return e>1&&(o=o.replaceChild(0,V(o.firstChild,e-1,1==o.childCount?n-1:0))),e>0&&(o=t.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(r.FK.empty,!0)))),t.copy(o)}function L(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function j(t){return t.spec.defining||t.spec.definingForContent}function K(t,e){for(let n=0;;n++){let r=e<0?t.firstChild:t.lastChild;if(!r||r.isAtom)return n;t=r.content}}function J(t,e,n,o,i){if(e<n){let r=t.firstChild;t=t.replaceChild(0,r.copy(J(r.content,e+1,n,o,r)))}if(e>o){let e=i.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(r.FK.empty,!0))}return t}function W(t,e){let n=[];for(let r=Math.min(t.depth,e.depth);r>=0;r--){let o=t.start(r);if(o<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(o==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==o-1)&&n.push(r)}return n}class U extends h{constructor(t,e,n){super(),this.pos=t,this.attr=e,this.value=n}apply(t){let e=t.nodeAt(this.pos);if(!e)return u.fail("No node at attribute step's position");let n=Object.create(null);for(let t in e.attrs)n[t]=e.attrs[t];n[this.attr]=this.value;let o=e.type.create(n,null,e.marks);return u.fromReplace(t,this.pos,this.pos+1,new r.Ji(r.FK.from(o),0,e.isLeaf?0:1))}getMap(){return l.empty}invert(t){return new U(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new U(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if("number"!=typeof e.pos||"string"!=typeof e.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new U(e.pos,e.attr,e.value)}}h.jsonID("attr",U);class q extends h{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let n in t.attrs)e[n]=t.attrs[n];e[this.attr]=this.value;let n=t.type.create(e,t.content,t.marks);return u.ok(n)}getMap(){return l.empty}invert(t){return new q(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if("string"!=typeof e.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new q(e.attr,e.value)}}h.jsonID("docAttr",q);let H=class extends Error{};H=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},(H.prototype=Object.create(Error.prototype)).constructor=H,H.prototype.name="TransformError";class _{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new c}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new H(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,e=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(t=r.map(t,1),e=r.map(e,-1)),r.forEach((n,r,o,i)=>{t=Math.min(t,o),e=Math.max(e,i)})}return 1e9==t?null:{from:t,to:e}}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,n=r.Ji.empty){let o=z(this.doc,t,e,n);return o&&this.step(o),this}replaceWith(t,e,n){return this.replace(t,e,new r.Ji(r.FK.from(n),0,0))}delete(t,e){return this.replace(t,e,r.Ji.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,n){return function(t,e,n,o){if(!o.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if($(i,s,o))return t.step(new v(e,n,o));let a=W(i,s);0==a[a.length-1]&&a.pop();let l=-(i.depth+1);a.unshift(l);for(let t=i.depth,e=i.pos-1;t>0;t--,e--){let n=i.node(t).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;a.indexOf(t)>-1?l=t:i.before(t)==e&&a.splice(1,0,-t)}let c=a.indexOf(l),d=[],h=o.openStart;for(let t=o.content,e=0;;e++){let n=t.firstChild;if(d.push(n),e==o.openStart)break;t=n.content}for(let t=h-1;t>=0;t--){let e=d[t],n=j(e.type);if(n&&!e.sameMarkup(i.node(Math.abs(l)-1)))h=t;else if(n||!e.type.isTextblock)break}for(let e=o.openStart;e>=0;e--){let l=(e+h+1)%(o.openStart+1),u=d[l];if(u)for(let e=0;e<a.length;e++){let d=a[(e+c)%a.length],h=!0;d<0&&(h=!1,d=-d);let p=i.node(d-1),f=i.index(d-1);if(p.canReplaceWith(f,f,u.type,u.marks))return t.replace(i.before(d),h?s.after(d):n,new r.Ji(J(o.content,0,o.openStart,l),l,o.openEnd))}}let u=t.steps.length;for(let r=a.length-1;r>=0&&(t.replace(e,n,o),!(t.steps.length>u));r--){let t=a[r];t<0||(e=i.before(t),n=s.after(t))}}(this,t,e,n),this}replaceRangeWith(t,e,n){return function(t,e,n,o){if(!o.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=function(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(0==r.parentOffset)for(let t=r.depth-1;t>=0;t--){let e=r.index(t);if(r.node(t).canReplaceWith(e,e,n))return r.before(t+1);if(e>0)return null}if(r.parentOffset==r.parent.content.size)for(let t=r.depth-1;t>=0;t--){let e=r.indexAfter(t);if(r.node(t).canReplaceWith(e,e,n))return r.after(t+1);if(e<r.node(t).childCount)return null}return null}(t.doc,e,o.type);null!=r&&(e=n=r)}t.replaceRange(e,n,new r.Ji(r.FK.from(o),0,0))}(this,t,e,n),this}deleteRange(t,e){return function(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n);if(r.parent.isTextblock&&o.parent.isTextblock&&r.start()!=o.start()&&0==r.parentOffset&&0==o.parentOffset){let i=r.sharedDepth(n),s=!1;for(let t=r.depth;t>i;t--)r.node(t).type.spec.isolating&&(s=!0);for(let t=o.depth;t>i;t--)o.node(t).type.spec.isolating&&(s=!0);if(!s){for(let t=r.depth;t>0&&e==r.start(t);t--)e=r.before(t);for(let t=o.depth;t>0&&n==o.start(t);t--)n=o.before(t);r=t.doc.resolve(e),o=t.doc.resolve(n)}}let i=W(r,o);for(let e=0;e<i.length;e++){let n=i[e],s=e==i.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return t.delete(r.start(n),o.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),o.indexAfter(n-1))))return t.delete(r.before(n),o.after(n))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(e-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i&&r.start(i-1)==o.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),o.index(i-1)))return t.delete(r.before(i),n);t.delete(e,n)}(this,t,e),this}lift(t,e){return function(t,e,n){let{$from:o,$to:i,depth:s}=e,a=o.before(s+1),l=i.after(s+1),c=a,d=l,h=r.FK.empty,u=0;for(let t=s,e=!1;t>n;t--)e||o.index(t)>0?(e=!0,h=r.FK.from(o.node(t).copy(h)),u++):c--;let p=r.FK.empty,f=0;for(let t=s,e=!1;t>n;t--)e||i.after(t+1)<i.end(t)?(e=!0,p=r.FK.from(i.node(t).copy(p)),f++):d++;t.step(new w(c,d,a,l,new r.Ji(h.append(p),u,f),h.size-u,!0))}(this,t,e),this}join(t,e=1){return function(t,e,n){let o=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),a=s.node().type;if(i&&a.inlineContent){let t="pre"==a.whitespace,e=!!a.contentMatch.matchType(i);t&&!e?o=!1:!t&&e&&(o=!0)}let l=t.steps.length;if(!1===o){let r=t.doc.resolve(e+n);N(t,r.node(),r.before(),l)}a.inlineContent&&k(t,e+n-1,a,s.node().contentMatchAt(s.index()),null==o);let c=t.mapping.slice(l),d=c.map(e-n);
vendor: 3,519 bytes, line 1
1if(t.step(new v(d,c.map(e+n,-1),r.Ji.empty,!0)),!0===o){let e=t.doc.resolve(d);O(t,e.node(),e.before(),t.steps.length)}}(this,t,e),this}wrap(t,e){return function(t,e,n){let o=r.FK.empty;for(let t=n.length-1;t>=0;t--){if(o.size){let e=n[t].type.contentMatch.matchFragment(o);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=r.FK.from(n[t].type.create(n[t].attrs,o))}let i=e.start,s=e.end;t.step(new w(i,s,i,s,new r.Ji(o,0,0),n.length,!0))}(this,t,e),this}setBlockType(t,e=t,n,o=null){return function(t,e,n,o,i){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(e,n)=>{let a="function"==typeof i?i(e):i;if(e.isTextblock&&!e.hasMarkup(o,a)&&function(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(t.doc,t.mapping.slice(s).map(n),o)){let i=null;if(o.schema.linebreakReplacement){let t="pre"==o.whitespace,e=!!o.contentMatch.matchType(o.schema.linebreakReplacement);t&&!e?i=!1:!t&&e&&(i=!0)}!1===i&&N(t,e,n,s),k(t,t.mapping.slice(s).map(n,1),o,void 0,null===i);let l=t.mapping.slice(s),c=l.map(n,1),d=l.map(n+e.nodeSize,1);return t.step(new w(c,d,c+1,d-1,new r.Ji(r.FK.from(o.create(a,null,e.marks)),0,0),1,!0)),!0===i&&O(t,e,n,s),!1}})}(this,t,e,n,o),this}setNodeMarkup(t,e,n=null,o){return function(t,e,n,o,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let a=n.create(o,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,a);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new w(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new r.Ji(r.FK.from(a),0,0),1,!0))}(this,t,e,n,o),this}setNodeAttribute(t,e,n){return this.step(new U(t,e,n)),this}setDocAttribute(t,e){return this.step(new q(t,e)),this}addNodeMark(t,e){return this.step(new g(t,e)),this}removeNodeMark(t,e){let n=this.doc.nodeAt(t);if(!n)throw new RangeError("No node at position "+t);if(e instanceof r.CU)e.isInSet(n.marks)&&this.step(new y(t,e));else{let r,o=n.marks,i=[];for(;r=e.isInSet(o);)i.push(new y(t,r)),o=r.removeFromSet(o);for(let t=i.length-1;t>=0;t--)this.step(i[t])}return this}split(t,e=1,n){return function(t,e,n=1,o){let i=t.doc.resolve(e),s=r.FK.empty,a=r.FK.empty;for(let t=i.depth,e=i.depth-n,l=n-1;t>e;t--,l--){s=r.FK.from(i.node(t).copy(s));let e=o&&o[l];a=r.FK.from(e?e.type.create(e.attrs,a):i.node(t).copy(a))}t.step(new v(e,e,new r.Ji(s.append(a),n,n),!0))}(this,t,e,n),this}addMark(t,e,n){return function(t,e,n,r){let o,i,s=[],a=[];t.doc.nodesBetween(e,n,(t,l,c)=>{if(!t.isInline)return;let d=t.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,e),h=Math.min(l+t.nodeSize,n),u=r.addToSet(d);for(let t=0;t<d.length;t++)d[t].isInSet(u)||(o&&o.to==c&&o.mark.eq(d[t])?o.to=h:s.push(o=new m(c,h,d[t])));i&&i.to==c?i.to=h:a.push(i=new f(c,h,r))}}),s.forEach(e=>t.step(e)),a.forEach(e=>t.step(e))}(this,t,e,n),this}removeMark(t,e,n){return function(t,e,n,o){let i=[],s=0;t.doc.nodesBetween(e,n,(t,a)=>{if(!t.isInline)return;s++;let l=null;if(o instanceof r.sX){let e,n=t.marks;for(;e=o.isInSet(n);)(l||(l=[])).push(e),n=e.removeFromSet(n)}else o?o.isInSet(t.marks)&&(l=[o]):l=t.marks;if(l&&l.length){let r=Math.min(a+t.nodeSize,n);for(let t=0;t<l.length;t++){let n,o=l[t];for(let t=0;t<i.length;t++){let e=i[t];e.step==s-1&&o.eq(i[t].style)&&(n=e)}n?(n.to=r,n.step=s):i.push({style:o,from:Math.max(a,e),to:r,step:s})}}}
vendor: 22,738 bytes, line 1
1),i.forEach(e=>t.step(new m(e.from,e.to,e.style)))}(this,t,e,n),this}clearIncompatible(t,e,n){return k(this,t,e,n),this}}},91633:function(t,e,n){n.d(e,{Lz:function(){return un},NZ:function(){return Le},zF:function(){return Je}});var r=n(67599),o=n(81429),i=n(57156);const s=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},a=function(t){let e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e};let l=null;const c=function(t,e,n){let r=l||(l=document.createRange());return r.setEnd(t,null==n?t.nodeValue.length:n),r.setStart(t,e||0),r},d=function(t,e,n,r){return n&&(u(t,e,n,r,-1)||u(t,e,n,r,1))},h=/^(img|br|input|textarea|hr)$/i;function u(t,e,n,r,o){for(var i;;){if(t==n&&e==r)return!0;if(e==(o<0?0:p(t))){let n=t.parentNode;if(!n||1!=n.nodeType||f(t)||h.test(t.nodeName)||"false"==t.contentEditable)return!1;e=s(t)+(o<0?0:1),t=n}else{if(1!=t.nodeType)return!1;{let n=t.childNodes[e+(o<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable){if(!(null===(i=n.pmViewDesc)||void 0===i?void 0:i.ignoreForSelection))return!1;e+=o}else t=n,e=o<0?p(t):0}}}}function p(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function f(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const m=function(t){return t.focusNode&&d(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function g(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const y="undefined"!=typeof navigator?navigator:null,v="undefined"!=typeof document?document:null,w=y&&y.userAgent||"",b=/Edge\/(\d+)/.exec(w),k=/MSIE \d/.exec(w),x=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(w),S=!!(k||x||b),M=k?document.documentMode:x?+x[1]:b?+b[1]:0,C=!S&&/gecko\/(\d+)/i.test(w);C&&(/Firefox\/(\d+)/.exec(w)||[0,0])[1];const O=!S&&/Chrome\/(\d+)/.exec(w),N=!!O,E=O?+O[1]:0,T=!S&&!!y&&/Apple Computer/.test(y.vendor),D=T&&(/Mobile\/\w+/.test(w)||!!y&&y.maxTouchPoints>2),A=D||!!y&&/Mac/.test(y.platform),R=!!y&&/Win/.test(y.platform),z=/Android \d/.test(w),$=!!v&&"webkitFontSmoothing"in v.documentElement.style,I=$?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function P(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function F(t,e){return"number"==typeof t?t:t[e]}function B(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function V(t,e,n){if(!H(e)&&0==e.left)return;let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(1!=s.nodeType){s=a(s);continue}let t=s,n=t==i.body,l=n?P(i):B(t),c=0,d=0;if(e.top<l.top+F(r,"top")?d=-(l.top-e.top+F(o,"top")):e.bottom>l.bottom-F(r,"bottom")&&(d=e.bottom-e.top>l.bottom-l.top?e.top+F(o,"top")-l.top:e.bottom-l.bottom+F(o,"bottom")),e.left<l.left+F(r,"left")?c=-(l.left-e.left+F(o,"left")):e.right>l.right-F(r,"right")&&(c=e.right-l.right+F(o,"right")),c||d)if(n)i.defaultView.scrollBy(c,d);else{let n=t.scrollLeft,r=t.scrollTop;d&&(t.scrollTop+=d),c&&(t.scrollLeft+=c);let o=t.scrollLeft-n,i=t.scrollTop-r;e={left:e.left-o,top:e.top-i,right:e.right-o,bottom:e.bottom-i}}let h=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(h))break;s="absolute"==h?s.offsetParent:a(s)}}function L(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=a(r));return e}function j(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}let K=null;function J(t,e){let n,r,o,i,s=2e8,a=0,l=e.top,d=e.top;for(let h=t.firstChild,u=0;h;h=h.nextSibling,u++){let t;if(1==h.nodeType)t=h.getClientRects();else{if(3!=h.nodeType)continue;t=c(h).getClientRects()}for(let c=0;c<t.length;c++){let p=t[c];if(p.top<=l&&p.bottom>=d){l=Math.max(p.bottom,l),d=Math.min(p.top,d);let t=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(t<s){n=h,s=t,r=t&&3==n.nodeType?{left:p.right<e.left?p.right:p.left,top:e.top}:e,1==h.nodeType&&t&&(a=u+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!o&&p.left<=e.left&&p.right>=e.left&&(o=h,i={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(a=u+1)}}return!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType?function(t,e){let n,r=t.nodeValue.length,o=document.createRange();for(let i=0;i<r;i++){o.setEnd(t,i+1),o.setStart(t,i);let r=_(o,1);if(r.top!=r.bottom&&W(e,r)){n={node:t,offset:i+(e.left>=(r.left+r.right)/2?1:0)};break}}return o.detach(),n||{node:t,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:t,offset:a}:J(n,r)}function W(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function U(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let n=t.childNodes[i];if(1==n.nodeType){let t=n.getClientRects();for(let r=0;r<t.length;r++){let o=t[r];if(W(e,o))return U(n,e,o)}}if((i=(i+1)%r)==o)break}return t}function q(t,e){let n,r=t.dom.ownerDocument,o=0,i=function(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(p(r.offsetNode),r.offset)}}catch(t){}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(p(r.startContainer),r.startOffset)}}}(r,e.left,e.top);i&&({node:n,offset:o}=i);let s,l=(t.root.elementFromPoint?t.root:r).elementFromPoint(e.left,e.top);if(!l||!t.dom.contains(1!=l.nodeType?l.parentNode:l)){let n=t.dom.getBoundingClientRect();if(!W(e,n))return null;if(l=U(t.dom,e,n),!l)return null}if(T)for(let t=l;n&&t;t=a(t))t.draggable&&(n=void 0);if(l=function(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}(l,e),n){if(C&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length),o<n.childNodes.length)){let t,r=n.childNodes[o];"IMG"==r.nodeName&&(t=r.getBoundingClientRect()).right<=e.left&&t.bottom>e.top&&o++}let r;$&&o&&1==n.nodeType&&1==(r=n.childNodes[o-1]).nodeType&&"false"==r.contentEditable&&r.getBoundingClientRect().top>=e.top&&o--,n==t.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&e.top>n.lastChild.getBoundingClientRect().bottom?s=t.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(s=function(t,e,n,r){let o=-1;for(let n=e,i=!1;n!=t.dom;){let e,s=t.docView.nearestDesc(n,!0);if(!s)return null;if(1==s.dom.nodeType&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((e=s.dom.getBoundingClientRect()).width||e.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!i&&e.left>r.left||e.top>r.top?o=s.posBefore:(!i&&e.right<r.left||e.bottom<r.top)&&(o=s.posAfter),i=!0),!s.contentDOM&&o<0&&!s.node.isText))return(s.node.isBlock?r.top<(e.top+e.bottom)/2:r.left<(e.left+e.right)/2)?s.posBefore:s.posAfter;n=s.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}(t,n,o,e))}null==s&&(s=function(t,e,n){let{node:r,offset:o}=J(e,n),i=-1;if(1==r.nodeType&&!r.firstChild){let t=r.getBoundingClientRect();i=t.left!=t.right&&n.left>(t.left+t.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}(t,l,e));let c=t.docView.nearestDesc(l,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function H(t){return t.top<t.bottom||t.left<t.right}function _(t,e){let n=t.getClientRects();if(n.length){let t=n[e<0?0:n.length-1];if(H(t))return t}return Array.prototype.find.call(n,H)||t.getBoundingClientRect()}const X=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Y(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=$||C;if(3==r.nodeType){if(!s||!X.test(r.nodeValue)&&(n<0?o:o!=r.nodeValue.length)){let t=o,e=o,i=n<0?1:-1;return n<0&&!o?(e++,i=-1):n>=0&&o==r.nodeValue.length?(t--,i=1):n<0?t--:e++,G(_(c(r,t,e),i),i<0)}{let t=_(c(r,o,o),n);if(C&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let e=_(c(r,o-1,o-1),-1);if(e.top==t.top){let n=_(c(r,o,o+1),-1);if(n.top!=t.top)return G(n,n.left<e.left)}}return t}}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(null==i&&o&&(n<0||o==p(r))){let t=r.childNodes[o-1];if(1==t.nodeType)return Z(t.getBoundingClientRect(),!1)}if(null==i&&o<p(r)){let t=r.childNodes[o];if(1==t.nodeType)return Z(t.getBoundingClientRect(),!0)}return Z(r.getBoundingClientRect(),n>=0)}if(null==i&&o&&(n<0||o==p(r))){let t=r.childNodes[o-1],e=3==t.nodeType?c(t,p(t)-(s?0:1)):1!=t.nodeType||"BR"==t.nodeName&&t.nextSibling?null:t;if(e)return G(_(e,1),!1)}if(null==i&&o<p(r)){let t=r.childNodes[o];for(;t.pmViewDesc&&t.pmViewDesc.ignoreForCoords;)t=t.nextSibling;let e=t?3==t.nodeType?c(t,0,s?0:1):1==t.nodeType?t:null:null;if(e)return G(_(e,-1),!0)}return G(_(3==r.nodeType?c(r):r,-n),n>=0)}function G(t,e){if(0==t.width)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Z(t,e){if(0==t.height)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Q(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}const tt=/[\u0590-\u08ac]/;let et=null,nt=null,rt=!1;class ot{constructor(t,e,n,r){this.parent=t,this.children=e,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,n){return!1}matchesHack(t){return!1}parseRule(t){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;e<this.children.length;e++)t+=this.children[e].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let e=0,n=this.posAtStart;;e++){let r=this.children[e];if(r==t)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,e,n){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(n<0){let n,r;if(t==this.contentDOM)n=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;n=t.previousSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}{let n,r;if(t==this.contentDOM)n=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;n=t.nextSibling}for(;n&&(!(r=n.pmViewDesc)||r.parent!=this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}}let r;if(t==this.dom&&this.contentDOM)r=e>s(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(let e=t;;e=e.parentNode){if(e==this.dom){r=!1;break}if(e.previousSibling)break}if(null==r&&e==t.childNodes.length)for(let e=t;;e=e.parentNode){if(e==this.dom){r=!0;break}if(e.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(t,e=!1){for(let n=!0,r=t;r;r=r.parentNode){let o,i=this.getDesc(r);if(i&&(!e||i.node)){if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==t.nodeType?t:t.parentNode):o==t))return i;n=!1}}}getDesc(t){let e=t.pmViewDesc;for(let t=e;t;t=t.parent)if(t==this)return e}posFromDOM(t,e,n){for(let r=t;r;r=r.parentNode){let o=this.getDesc(r);if(o)return o.localPosFromDOM(t,e,n)}return-1}descAt(t){for(let e=0,n=0;e<this.children.length;e++){let r=this.children[e],o=n+r.size;if(n==t&&o!=n){for(;!r.border&&r.children.length;)for(let t=0;t<r.children.length;t++){let e=r.children[t];if(e.size){r=e;break}}return r}if(t<o)return r.descAt(t-n-r.border);n=o}}domFromPos(t,e){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let n=0,r=0;for(let e=0;n<this.children.length;n++){let o=this.children[n],i=e+o.size;if(i>t||o instanceof ht){r=t-e;break}e=i}if(r)return this.children[n].domFromPos(r-this.children[n].border,e);for(let t;n&&!(t=this.children[n-1]).size&&t instanceof it&&t.side>=0;n--);if(e<=0){let t,r=!0;for(;t=n?this.children[n-1]:null,t&&t.dom.parentNode!=this.contentDOM;n--,r=!1);return t&&e&&r&&!t.border&&!t.domAtom?t.domFromPos(t.size,e):{node:this.contentDOM,offset:t?s(t.dom)+1:0}}{let t,r=!0;for(;t=n<this.children.length?this.children[n]:null,t&&t.dom.parentNode!=this.contentDOM;n++,r=!1);return t&&r&&!t.border&&!t.domAtom?t.domFromPos(0,e):{node:this.contentDOM,offset:t?s(t.dom):this.contentDOM.childNodes.length}}}parseRange(t,e,n=0){if(0==this.children.length)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,o=-1;for(let i=n,a=0;;a++){let n=this.children[a],l=i+n.size;if(-1==r&&t<=l){let o=i+n.border;if(t>=o&&e<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(t,e,o);t=i;for(let e=a;e>0;e--){let n=this.children[e-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=s(n.dom)+1;break}t-=n.size}-1==r&&(r=0)}if(r>-1&&(l>e||a==this.children.length-1)){e=l;for(let t=a+1;t<this.children.length;t++){let n=this.children[t];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){o=s(n.dom);break}e+=n.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:t,to:e,fromOffset:r,toOffset:o}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let e=this.children[t<0?0:this.children.length-1];return 0==e.size||e.emptyChildAt(t)}domAfterPos(t){let{node:e,offset:n}=this.domFromPos(t,0);if(1!=e.nodeType||n==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[n]}setSelection(t,e,n,r=!1){let o=Math.min(t,e),i=Math.max(t,e);for(let s=0,a=0;s<this.children.length;s++){let l=this.children[s],c=a+l.size;if(o>a&&i<c)return l.setSelection(t-a-l.border,e-a-l.border,n,r);a=c}let a=this.domFromPos(t,t?-1:1),l=e==t?a:this.domFromPos(e,e?-1:1),c=n.root.getSelection(),h=n.domSelectionRange(),u=!1;if((C||T)&&t==e){let{node:t,offset:e}=a;if(3==t.nodeType){if(u=!(!e||"\n"!=t.nodeValue[e-1]),u&&e==t.nodeValue.length)for(let e,n=t;n;n=n.parentNode){if(e=n.nextSibling){"BR"==e.nodeName&&(a=l={node:e.parentNode,offset:s(e)+1});break}let t=n.pmViewDesc;if(t&&t.node&&t.node.isBlock)break}}else{let n=t.childNodes[e-1];u=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(C&&h.focusNode&&h.focusNode!=l.node&&1==h.focusNode.nodeType){let t=h.focusNode.childNodes[h.focusOffset];t&&"false"==t.contentEditable&&(r=!0)}if(!(r||u&&T)&&d(a.node,a.offset,h.anchorNode,h.anchorOffset)&&d(l.node,l.offset,h.focusNode,h.focusOffset))return;let p=!1;if((c.extend||t==e)&&(!u||!C)){c.collapse(a.node,a.offset);try{t!=e&&c.extend(l.node,l.offset),p=!0}catch(t){}}if(!p){if(t>e){let t=a;a=l,l=t}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(t){return!this.contentDOM&&"selection"!=t.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let n=0,r=0;r<this.children.length;r++){let o=this.children[r],i=n+o.size;if(n==i?t<=i&&e>=n:t<i&&e>n){let r=n+o.border,s=i-o.border;if(t>=r&&e<=s)return this.dirty=t==n||e==i?2:1,void(t!=r||e!=s||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(t-r,e-r):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let n=1==t?2:1;e.dirty<n&&(e.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class it extends ot{constructor(t,e,n,r){let o,i=e.type.toDOM;if("function"==typeof i&&(i=i(n,()=>o?o.parent?o.parent.posBeforeChild(o):void 0:r)),!e.type.spec.raw){if(1!=i.nodeType){let t=document.createElement("span");t.appendChild(i),i=t}i.hasAttribute("contenteditable")||(i.contentEditable="false"),i.classList.add("ProseMirror-widget")}super(t,[],i,null),this.widget=e,this.widget=e,o=this}matchesWidget(t){return 0==this.dirty&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let e=this.widget.spec.stopEvent;return!!e&&e(t)}ignoreMutation(t){return"selection"!=t.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class st extends ot{constructor(t,e,n,r){super(t,[],e,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue}}class at extends ot{constructor(t,e,n,r,o){super(t,[],n,r),this.mark=e,this.spec=o}static create(t,e,n,r){let i=r.nodeViews[e.type.name],s=i&&i(e,r,n);return s&&s.dom||(s=o.ZF.renderSpec(document,e.type.spec.toDOM(e,n),null,e.attrs)),new at(t,e,s.dom,s.contentDOM||s.dom,s)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return 3!=this.dirty&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),0!=this.dirty){let t=this.parent;for(;!t.node;)t=t.parent;t.dirty<this.dirty&&(t.dirty=this.dirty),this.dirty=0}}slice(t,e,n){let r=at.create(this.parent,this.mark,!0,n),o=this.children,i=this.size;e<i&&(o=Mt(o,e,i,n)),t>0&&(o=Mt(o,0,t,n));for(let t=0;t<o.length;t++)o[t].parent=r;return r.children=o,r}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class lt extends ot{constructor(t,e,n,r,o,i,s){super(t,[],o,i),this.node=e,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(t,e,n,r,i,s){let a,l=i.nodeViews[e.type.name],c=l&&l(e,i,()=>a?a.parent?a.parent.posBeforeChild(a):void 0:s,n,r),d=c&&c.dom,h=c&&c.contentDOM;if(e.isText)if(d){if(3!=d.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else d=document.createTextNode(e.text);else if(!d){let t=o.ZF.renderSpec(document,e.type.spec.toDOM(e),null,e.attrs);({dom:d,contentDOM:h}=t)}h||e.isText||"BR"==d.nodeName||(d.hasAttribute("contenteditable")||(d.contentEditable="false"),e.type.spec.draggable&&(d.draggable=!0));let u=d;return d=wt(d,n,e),c?a=new ut(t,e,n,r,d,h||null,u,c):e.isText?new dt(t,e,n,r,d,u):new lt(t,e,n,r,d,h||null,u)}parseRule(t){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let t=this.children.length-1;t>=0;t--){let n=this.children[t];if(this.dom.contains(n.dom.parentNode)){e.contentElement=n.dom.parentNode;break}}if(!e.contentElement){let n=t&&t.find(e=>1==e.nodeType&&t.indexOf(e.parentNode)<0&&this.dom.contains(e));n?e.contentElement=n:e.getContent=()=>o.FK.empty}}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(t,e,n){return 0==this.dirty&&t.eq(this.node)&&bt(e,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let n=this.node.inlineContent,r=e,i=t.composing?this.localCompositionInfo(t,e):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new xt(this,s&&s.node,t);!function(t,e,n,r){let o=e.locals(t),i=0;if(0==o.length){for(let n=0;n<t.childCount;n++){let s=t.child(n);r(s,o,e.forChild(i,s),n),i+=s.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){let d,h,u,p;for(;s<o.length&&o[s].to==i;){let t=o[s++];t.widget&&(d?(h||(h=[d])).push(t):d=t)}if(d)if(h){h.sort(St);for(let t=0;t<h.length;t++)n(h[t],c,!!l)}else n(d,c,!!l);if(l)p=-1,u=l,l=null;else{if(!(c<t.childCount))break;p=c,u=t.child(c++)}for(let t=0;t<a.length;t++)a[t].to<=i&&a.splice(t--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);let f=i+u.nodeSize;if(u.isText){let t=f;s<o.length&&o[s].from<t&&(t=o[s].from);for(let e=0;e<a.length;e++)a[e].to<t&&(t=a[e].to);t<f&&(l=u.cut(t-i),u=u.cut(0,t-i),f=t,p=-1)}else for(;s<o.length&&o[s].to<f;)s++;r(u,u.isInline&&!u.isLeaf?a.filter(t=>!t.inline):a.slice(),e.forChild(i,u),p),i=f}}(this.node,this.innerDeco,(e,i,s)=>{e.spec.marks?l.syncToMarks(e.spec.marks,n,t,i):e.type.side>=0&&!s&&l.syncToMarks(i==this.node.childCount?o.CU.none:this.node.child(i).marks,n,t,i),l.placeWidget(e,t,r)},(e,o,s,c)=>{let d;l.syncToMarks(e.marks,n,t,c),l.findNodeMatch(e,o,s,c)||a&&t.state.selection.from>r&&t.state.selection.to<r+e.nodeSize&&(d=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(e,o,s,d,t)||l.updateNextNode(e,o,s,t,c,r)||l.addNode(e,o,s,t,r),r+=e.nodeSize}),l.syncToMarks([],n,t,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(s&&this.protectLocalComposition(t,s),pt(this.contentDOM,this.children,t),D&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))}localCompositionInfo(t,e){let{from:n,to:o}=t.state.selection;if(!(t.state.selection instanceof r.U3)||n<e||o>e+this.node.content.size)return null;let i=t.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let t=i.nodeValue,r=function(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),a=i;if(i+=s.nodeSize,!s.isText)continue;let l=s.text;for(;o<t.childCount;){let e=t.child(o++);if(i+=e.nodeSize,!e.isText)break;l+=e.text}if(i>=n){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let t=a<r?l.lastIndexOf(e,r-a-1):-1;if(t>=0&&t+e.length+a>=n)return a+t;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}(this.node.content,t,n-e,o-e);return r<0?null:{node:i,pos:r,text:t}}return{node:i,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:n,text:r}){if(this.getDesc(e))return;let o=e;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let i=new st(this,o,e,r);
vendor: 4,585 bytes, line 1
1t.input.compositionNodes.push(i),this.children=Mt(this.children,n,n+r.length,t,i)}update(t,e,n,r){return!(3==this.dirty||!t.sameMarkup(this.node)||(this.updateInner(t,e,n,r),0))}updateInner(t,e,n,r){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(t){if(bt(t,this.outerDeco))return;let e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=yt(this.dom,this.nodeDOM,gt(this.outerDeco,this.node,e),gt(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function ct(t,e,n,r,o){wt(r,e,t);let i=new lt(void 0,t,e,n,r,r,r);return i.contentDOM&&i.updateChildren(o,0),i}class dt extends lt{constructor(t,e,n,r,o,i){super(t,e,n,r,o,null,i)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,e,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node)||(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=t,this.dirty=0,0))}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,n){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,n)}ignoreMutation(t){return"characterData"!=t.type&&"selection"!=t.type}slice(t,e,n){let r=this.node.cut(t,e),o=document.createTextNode(r.text);return new dt(this.parent,r,this.outerDeco,this.innerDeco,o,o)}markDirty(t,e){super.markDirty(t,e),this.dom==this.nodeDOM||0!=t&&e!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(t){return this.node.text==t}}class ht extends ot{parseRule(){return{ignore:!0}}matchesHack(t){return 0==this.dirty&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class ut extends lt{constructor(t,e,n,r,o,i,s,a){super(t,e,n,r,o,i,s),this.spec=a}update(t,e,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let o=this.spec.update(t,e,n);return o&&this.updateInner(t,e,n,r),o}return!(!this.contentDOM&&!t.isLeaf)&&super.update(t,e,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,n,r){this.spec.setSelection?this.spec.setSelection(t,e,n.root):super.setSelection(t,e,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function pt(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],a=s.dom;if(a.parentNode==t){for(;a!=r;)r=kt(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(a,r);if(s instanceof at){let e=r?r.previousSibling:t.lastChild;pt(s.contentDOM,s.children,n),r=e?e.nextSibling:t.firstChild}}for(;r;)r=kt(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}const ft=function(t){t&&(this.nodeName=t)};ft.prototype=Object.create(null);const mt=[new ft];function gt(t,e,n){if(0==t.length)return mt;let r=n?mt[0]:new ft,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new ft(s.nodeName));for(let t in s){let i=s[t];null!=i&&(n&&1==o.length&&o.push(r=new ft(e.isInline?"span":"div")),"class"==t?r.class=(r.class?r.class+" ":"")+i:"style"==t?r.style=(r.style?r.style+";":"")+i:"nodeName"!=t&&(r[t]=i))}}}return o}function yt(t,e,n,r){if(n==mt&&r==mt)return e;let o=e;for(let e=0;e<r.length;e++){let i=r[e],s=n[e];if(e){let e;s&&s.nodeName==i.nodeName&&o!=t&&(e=o.parentNode)&&e.nodeName.toLowerCase()==i.nodeName||(e=document.createElement(i.nodeName),e.pmIsDeco=!0,e.appendChild(o),s=mt[0]),o=e}vt(o,s||mt[0],i)}return o}function vt(t,e,n){for(let r in e)"class"==r||"style"==r||"nodeName"==r||r in n||t.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=e[r]&&t.setAttribute(r,n[r]);
vendor: 10,923 bytes, line 1
1if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let e=0;e<r.length;e++)-1==o.indexOf(r[e])&&t.classList.remove(r[e]);for(let e=0;e<o.length;e++)-1==r.indexOf(o[e])&&t.classList.add(o[e]);0==t.classList.length&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let n,r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;n=r.exec(e.style);)t.style.removeProperty(n[1])}n.style&&(t.style.cssText+=n.style)}}function wt(t,e,n){return yt(t,t,mt,gt(e,n,1!=t.nodeType))}function bt(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function kt(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class xt{constructor(t,e,n){this.lock=e,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=function(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];t:for(;o>0;){let a;for(;;)if(r){let t=n.children[r-1];if(!(t instanceof at)){a=t,r--;break}n=t,r=t.children.length}else{if(n==e)break t;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let n=t;n<e;n++)this.top.children[n].destroy();this.top.children.splice(t,e-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,e,n,r){let o=0,i=this.stack.length>>1,s=Math.min(i,t.length);for(;o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(t[o])&&!1!==t[o].type.spec.spanning;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<t.length;){this.stack.push(this.top,this.index+1);let o=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let e=this.index;e<s;e++){let n=this.top.children[e];if(n.matchesMark(t[i])&&!this.isLocked(n.dom)){o=e;break}}if(o<0&&this.index<this.top.children.length){let e=this.top.children[this.index];e instanceof at&&3!=e.dirty&&e.mark.type==t[i].type&&e.spec.update&&!this.isLocked(e.dom)&&e.spec.update(t[i])&&(e.mark=t[i],o=this.index,this.changed=!0)}if(o>-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let r=at.create(this.top,t[i],e,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,i++}}findNodeMatch(t,e,n,r){let o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(t,e,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(t,e,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0||(this.destroyBetween(this.index,i),this.index++,0))}updateNodeAt(t,e,n,r,o){let i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(t,e,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(t){for(;;){let e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){let e=t.pmViewDesc;if(e)for(let t=this.index;t<this.top.children.length;t++)if(this.top.children[t]==e)return t;return-1}t=e}}updateNextNode(t,e,n,r,o,i){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof lt){let l=this.preMatch.matched.get(a);if(null!=l&&l!=o)return!1;let c,d=a.dom,h=this.isLocked(d)&&!(t.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==t.text&&3!=a.dirty&&bt(e,a.outerDeco));if(!h&&a.update(t,e,n,r))return this.destroyBetween(this.index,s),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!h&&(c=this.recreateWrapper(a,t,e,n,r,i)))return this.destroyBetween(this.index,s),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(r,i+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,e,n,r,o,i){if(t.dirty||e.isAtom||!t.children.length||!t.node.content.eq(e.content)||!bt(n,t.outerDeco)||!r.eq(t.innerDeco))return null;let s=lt.create(this.top,e,n,r,o,i);if(s.contentDOM){s.children=t.children,t.children=[];for(let t of s.children)t.parent=s}return t.destroy(),s}addNode(t,e,n,r,o){let i=lt.create(this.top,t,e,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}placeWidget(t,e,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(t)||t!=r.widget&&r.widget.type.toDOM.parentNode){let r=new it(this.top,t,e,n);this.top.children.splice(this.index++,0,r),this.changed=!0}else this.index++}addTextblockHacks(){let t=this.top.children[this.index-1],e=this.top;for(;t instanceof at;)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof dt)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((T||N)&&t&&"false"==t.dom.contentEditable&&this.addHackNode("IMG",e),this.addHackNode("BR",this.top))}addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.children[this.index].matchesHack(t))this.index++;else{let n=document.createElement(t);"IMG"==t&&(n.className="ProseMirror-separator",n.alt=""),"BR"==t&&(n.className="ProseMirror-trailingBreak");let r=new ht(this.top,[],n,null);e!=this.top?e.children.push(r):e.children.splice(this.index++,0,r),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||1==t.nodeType&&t.contains(this.lock.parentNode))}}function St(t,e){return t.type.side-e.type.side}function Mt(t,e,n,r,o){let i=[];for(let s=0,a=0;s<t.length;s++){let l=t[s],c=a,d=a+=l.size;c>=n||d<=e?i.push(l):(c<e&&i.push(l.slice(0,e-c,r)),o&&(i.push(o),o=void 0),d>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Ct(t,e=null){let n=t.domSelectionRange(),o=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),a=i&&0==i.size,l=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c,d,h=o.resolve(l);if(m(n)){for(c=l;i&&!i.node;)i=i.parent;let t=i.node;if(i&&t.isAtom&&r.nh.isSelectable(t)&&i.parent&&(!t.isInline||!function(t,e,n){for(let r=0==e,o=e==p(t);r||o;){if(t==n)return!0;let e=s(t);if(!(t=t.parentNode))return!1;r=r&&0==e,o=o&&e==p(t)}}(n.focusNode,n.focusOffset,i.dom))){let t=i.posBefore;d=new r.nh(l==t?h:o.resolve(t))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let e=l,r=l;for(let o=0;o<n.rangeCount;o++){let i=n.getRangeAt(o);e=Math.min(e,t.docView.posFromDOM(i.startContainer,i.startOffset,1)),r=Math.max(r,t.docView.posFromDOM(i.endContainer,i.endOffset,-1))}if(e<0)return null;[c,l]=r==t.state.selection.anchor?[r,e]:[e,r],h=o.resolve(l)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=o.resolve(c);return d||(d=$t(t,u,h,"pointer"==e||t.state.selection.head<h.pos&&!a?1:-1)),d}function Ot(t){return t.editable?t.hasFocus():Pt(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Nt(t,e=!1){let n=t.state.selection;if(Rt(t,n),!Ot(t))return;let o=t.input.mouseDown;if(!e&&N&&o){let e=t.domSelectionRange(),n=t.domObserver.currentSelection;if(e.anchorNode&&n.anchorNode&&d(e.anchorNode,e.anchorOffset,n.anchorNode,n.anchorOffset)&&o.delaySelUpdate())return void t.domObserver.setCurSelection()}if(t.domObserver.disconnectSelection(),t.cursorWrapper)!function(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r="IMG"==n.nodeName;r?e.collapse(n.parentNode,s(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&S&&M<=11&&(n.disabled=!0,n.disabled=!1)}(t);else{let o,i,{anchor:s,head:a}=n;!Et||n instanceof r.U3||(n.$from.parent.inlineContent||(o=Tt(t,n.from)),n.empty||n.$from.parent.inlineContent||(i=Tt(t,n.to))),t.docView.setSelection(s,a,t,e),Et&&(o&&At(o),i&&At(i)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{Ot(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")},20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const Et=T||N&&E<63;function Tt(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(T&&o&&"false"==o.contentEditable)return Dt(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return Dt(o);if(i)return Dt(i)}}function Dt(t){return t.contentEditable="true",T&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function At(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Rt(t,e){if(e instanceof r.nh){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(zt(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else zt(t)}function zt(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function $t(t,e,n,o){return t.someProp("createSelectionBetween",r=>r(t,e,n))||r.U3.between(e,n,o)}function It(t){return!(t.editable&&!t.hasFocus())&&Pt(t)}function Pt(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function Ft(t,e){let{$anchor:n,$head:o}=t.selection,i=e>0?n.max(o):n.min(o),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&r.LN.findFrom(s,e)}function Bt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Vt(t,e,n){let o=t.state.selection;if(!(o instanceof r.U3)){if(o instanceof r.nh&&o.node.isInline)return Bt(t,new r.U3(e>0?o.$to:o.$from));{let n=Ft(t.state,e);return!!n&&Bt(t,n)}}if(n.indexOf("s")>-1){let{$head:n}=o,i=n.textOffset?null:e<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(n.pos+i.nodeSize*(e<0?-1:1));return Bt(t,new r.U3(o.$anchor,s))}if(!o.empty)return!1;if(t.endOfTextblock(e>0?"forward":"backward")){let n=Ft(t.state,e);return!!(n&&n instanceof r.nh)&&Bt(t,n)}if(!(A&&n.indexOf("m")>-1)){let n,i=o.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return!!(s.isAtom||(n=t.docView.descAt(a))&&!n.contentDOM)&&(r.nh.isSelectable(s)?Bt(t,new r.nh(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):!!$&&Bt(t,new r.U3(t.state.doc.resolve(e<0?a:a+s.nodeSize))))}}function Lt(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}
vendor: 1,693 bytes, line 1
1function jt(t,e){let n=t.pmViewDesc;return n&&0==n.size&&(e<0||t.nextSibling||"BR"!=t.nodeName)}function Kt(t,e){return e<0?function(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,a=!1;for(C&&1==n.nodeType&&r<Lt(n)&&jt(n.childNodes[r],-1)&&(a=!0);;)if(r>0){if(1!=n.nodeType)break;{let t=n.childNodes[r-1];if(jt(t,-1))o=n,i=--r;else{if(3!=t.nodeType)break;n=t,r=n.nodeValue.length}}}else{if(Jt(n))break;{let e=n.previousSibling;for(;e&&jt(e,-1);)o=n.parentNode,i=s(e),e=e.previousSibling;if(e)n=e,r=Lt(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}a?Wt(t,n,r):o&&Wt(t,o,i)}(t):function(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,a=Lt(n);for(;;)if(r<a){if(1!=n.nodeType)break;if(!jt(n.childNodes[r],1))break;o=n,i=++r}else{if(Jt(n))break;{let e=n.nextSibling;for(;e&&jt(e,1);)o=e.parentNode,i=s(e)+1,e=e.nextSibling;if(e)n=e,r=0,a=Lt(n);else{if(n=n.parentNode,n==t.dom)break;r=a=0}}}o&&Wt(t,o,i)}(t)}function Jt(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Wt(t,e,n){if(3!=e.nodeType){let t,r;(r=function(t,e){for(;t&&e==t.childNodes.length&&!f(t);)e=s(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=n,e=0}}(e,n))?(e=r,n=0):(t=function(t,e){for(;t&&!e&&!f(t);)e=s(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=(t=n).childNodes.length}}(e,n))&&(e=t,n=t.nodeValue.length)}let r=t.domSelection();if(!r)return;if(m(r)){let t=document.createRange();t.setEnd(e,n),t.setStart(e,n),r.removeAllRanges(),r.addRange(t)}
vendor: 56,645 bytes, line 1
1else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:o}=t;setTimeout(()=>{t.state==o&&Nt(t)},50)}function Ut(t,e){let n=t.state.doc.resolve(e);if(!N&&!R&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let n=t.coordsAtPos(e-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(e<n.end()){let n=t.coordsAtPos(e+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(t.dom).direction?"rtl":"ltr"}function qt(t,e,n){let o=t.state.selection;if(o instanceof r.U3&&!o.empty||n.indexOf("s")>-1)return!1;if(A&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=o;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let n=Ft(t.state,e);if(n&&n instanceof r.nh)return Bt(t,n)}if(!i.parent.inlineContent){let n=e<0?i:s,a=o instanceof r.i5?r.LN.near(n,e):r.LN.findFrom(n,e);return!!a&&Bt(t,a)}return!1}function Ht(t,e){if(!(t.state.selection instanceof r.U3))return!0;let{$head:n,$anchor:o,empty:i}=t.state.selection;if(!n.sameParent(o))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let r=t.state.tr;return e<0?r.delete(n.pos-s.nodeSize,n.pos):r.delete(n.pos,n.pos+s.nodeSize),t.dispatch(r),!0}return!1}function _t(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Xt(t,e){t.someProp("transformCopied",n=>{e=n(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,s--;let t=r.firstChild;n.push(t.type.name,t.attrs!=t.type.defaultAttrs?t.attrs:null),r=t.content}let a=t.someProp("clipboardSerializer")||o.ZF.fromSchema(t.state.schema),l=oe(),c=l.createElement("div");c.appendChild(a.serializeFragment(r,{document:l}));let d,h=c.firstChild,u=0;for(;h&&1==h.nodeType&&(d=re[h.nodeName.toLowerCase()]);){for(let t=d.length-1;t>=0;t--){let e=l.createElement(d[t]);for(;c.firstChild;)e.appendChild(c.firstChild);c.appendChild(e),u++}h=c.firstChild}return h&&1==h.nodeType&&h.setAttribute("data-pm-slice",`${i} ${s}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:c,text:t.someProp("clipboardTextSerializer",n=>n(e,t))||e.content.textBetween(0,e.content.size,"\n\n"),slice:e}}function Yt(t,e,n,r,i){let s,a,l=i.parent.type.spec.code;if(!n&&!e)return null;let c=!!e&&(r||l||!n);if(c){if(t.someProp("transformPastedText",n=>{e=n(e,l||r,t)}),l)return a=new o.Ji(o.FK.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0),t.someProp("transformPasted",e=>{a=e(a,t,!0)}),a;let n=t.someProp("clipboardTextParser",n=>n(e,i,r,t));if(n)a=n;else{let n=i.marks(),{schema:r}=t.state,a=o.ZF.fromSchema(r);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(t=>{let e=s.appendChild(document.createElement("p"));t&&e.appendChild(a.serializeNode(r.text(t,n)))})}}else t.someProp("transformPastedHTML",e=>{n=e(n,t)}),s=function(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n,r=oe(),o=r.body,i=/<([a-z][^>\s]+)/i.exec(t);if((n=i&&re[i[1].toLowerCase()])&&(t=n.map(t=>"<"+t+">").join("")+t+n.map(t=>"</"+t+">").reverse().join("")),o.innerHTML=function(t){let e=window.trustedTypes;if(!e)return t;if(!ie){if(ie=e.defaultPolicy)try{return ie.createHTML(t)}catch(t){}ie=e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})}return ie.createHTML(t)}(t),n)for(let t=0;t<n.length;t++)o=o.querySelector(n[t])||o;for(let t=0;t<r.styleSheets.length;t++){let e=r.styleSheets[t];for(let t=0;t<e.rules.length;t++){let n=e.rules[t];if(n instanceof CSSStyleRule){let t=o.querySelectorAll(n.selectorText);for(let e=0;e<t.length;e++)t[e].style.cssText+=n.style.cssText}}}return o}(n),$&&function(t){let e=t.querySelectorAll(N?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}(s);let d=s&&s.querySelector("[data-pm-slice]"),h=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let t=+h[3];t>0;t--){let t=s.firstChild;for(;t&&1!=t.nodeType;)t=t.nextSibling;if(!t)break;s=t}if(!a){let e=t.someProp("clipboardParser")||t.someProp("domParser")||o.S4.fromSchema(t.state.schema);a=e.parseSlice(s,{preserveWhitespace:!(!c&&!h),context:i,ruleFromNode(t){return"BR"!=t.nodeName||t.nextSibling||!t.parentNode||Gt.test(t.parentNode.nodeName)?null:{ignore:!0}}})}if(h)a=function(t,e){if(!t.size)return t;let n,r=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(e){return t}let{content:i,openStart:s,openEnd:a}=t;for(let t=n.length-2;t>=0;t-=2){let e=r.nodes[n[t]];if(!e||e.hasRequiredAttrs())break;try{e.checkAttrs(n[t+1])}catch(t){break}i=o.FK.from(e.create(n[t+1],i)),s++,a++}return new o.Ji(i,s,a)}(ne(a,+h[1],+h[2]),h[4]);else if(a=o.Ji.maxOpen(function(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r,i=e.node(n).contentMatchAt(e.index(n)),s=[];if(t.forEach(t=>{if(!s)return;let e,n=i.findWrapping(t.type);if(!n)return s=null;if(e=s.length&&r.length&&Qt(n,r,t,s[s.length-1],0))s[s.length-1]=e;else{s.length&&(s[s.length-1]=te(s[s.length-1],r.length));let e=Zt(t,n);s.push(e),i=i.matchType(e.type),r=n}}),s)return o.FK.from(s)}return t}(a.content,i),!0),a.openStart||a.openEnd){let t=0,e=0;for(let e=a.content.firstChild;t<a.openStart&&!e.type.spec.isolating;t++,e=e.firstChild);for(let t=a.content.lastChild;e<a.openEnd&&!t.type.spec.isolating;e++,t=t.lastChild);a=ne(a,t,e)}return t.someProp("transformPasted",e=>{a=e(a,t,c)}),a}const Gt=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Zt(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,o.FK.from(t));return t}function Qt(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=Qt(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(o.FK.from(Zt(n,t,i+1))))}}function te(t,e){if(0==e)return t;let n=t.content.replaceChild(t.childCount-1,te(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(o.FK.empty,!0);return t.copy(n.append(r))}function ee(t,e,n,r,i,s){let a=e<0?t.firstChild:t.lastChild,l=a.content;return t.childCount>1&&(s=0),i<r-1&&(l=ee(l,e,n,r,i+1,s)),i>=n&&(l=e<0?a.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(o.FK.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(l))}function ne(t,e,n){return e<t.openStart&&(t=new o.Ji(ee(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new o.Ji(ee(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const re={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function oe(){return document.implementation.createHTMLDocument("title")}let ie=null;const se={},ae={},le={touchstart:!0,touchmove:!0};class ce{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function de(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function he(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=e=>ue(t,e))})}function ue(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return!!r&&(r(t,e)||e.defaultPrevented)})}function pe(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function fe(t){return{left:t.clientX,top:t.clientY}}function me(t,e,n,r,o){if(-1==r)return!1;let i=t.state.doc.resolve(r);for(let r=i.depth+1;r>0;r--)if(t.someProp(e,e=>r>i.depth?e(t,n,i.nodeAfter,i.before(r),o,!0):e(t,n,i.node(r),i.before(r),o,!1)))return!0;return!1}function ge(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);"pointer"==n&&r.setMeta("pointer",!0),t.dispatch(r)}function ye(t,e,n,r){return me(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",n=>n(t,e,r))}function ve(t,e,n,o){return me(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",n=>n(t,e,o))||function(t,e,n){if(0!=n.button)return!1;let o=we(t,e,!0),i=t.state.doc;return!!o&&(ge(t,o,"pointer"),o instanceof r.U3&&i.eq(t.state.doc)&&(t.input.mouseDown=new Me(t,o)),!0)}(t,n,o)}function we(t,e,n){let o=t.state.doc;if(-1==e)return o.inlineContent?r.U3.create(o,0,o.content.size):null;let i=o.resolve(e);for(let t=i.depth+1;t>0;t--){let e=t>i.depth?i.nodeAfter:i.node(t),s=i.before(t);if(e.inlineContent)return r.U3.create(o,s+1,s+1+e.content.size);if(n&&r.nh.isSelectable(e))return r.nh.create(o,s)}return null}function be(t){return Te(t)}ae.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=16==n.keyCode||n.shiftKey,!Ce(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!z||!N||13!=n.keyCode))if(229!=n.keyCode&&t.domObserver.forceFlush(),!D||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)t.someProp("handleKeyDown",e=>e(t,n))||function(t,e){let n=e.keyCode,r=function(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);if(8==n||A&&72==n&&"c"==r)return Ht(t,-1)||Kt(t,-1);if(46==n&&!e.shiftKey||A&&68==n&&"c"==r)return Ht(t,1)||Kt(t,1);if(13==n||27==n)return!0;if(37==n||A&&66==n&&"c"==r){let e=37==n?"ltr"==Ut(t,t.state.selection.from)?-1:1:-1;return Vt(t,e,r)||Kt(t,e)}if(39==n||A&&70==n&&"c"==r){let e=39==n?"ltr"==Ut(t,t.state.selection.from)?1:-1:1;return Vt(t,e,r)||Kt(t,e)}return 38==n||A&&80==n&&"c"==r?qt(t,-1,r)||Kt(t,-1):40==n||A&&78==n&&"c"==r?function(t){if(!T||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&1==e.nodeType&&0==n&&e.firstChild&&"false"==e.firstChild.contentEditable){let n=e.firstChild;_t(t,n,"true"),setTimeout(()=>_t(t,n,"false"),20)}return!1}(t)||qt(t,1,r)||Kt(t,1):r==(A?"m":"c")&&(66==n||73==n||89==n||90==n)}(t,n)?n.preventDefault():de(t,"key");else{let e=Date.now();t.input.lastIOSEnter=e,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==e&&(t.someProp("handleKeyDown",e=>e(t,g(13,"Enter"))),t.input.lastIOSEnter=0)},200)}},ae.keyup=(t,e)=>{16==e.keyCode&&(t.input.shiftKey=!1)},ae.keypress=(t,e)=>{let n=e;if(Ce(t)||!n.charCode||n.ctrlKey&&!n.altKey||A&&n.metaKey)return;if(t.someProp("handleKeyPress",e=>e(t,n)))return void n.preventDefault();let o=t.state.selection;if(!(o instanceof r.U3&&o.$from.sameParent(o.$to))){let e=String.fromCharCode(n.charCode),r=()=>t.state.tr.insertText(e).scrollIntoView();/[\r\n]/.test(e)||t.someProp("handleTextInput",n=>n(t,o.$from.pos,o.$to.pos,e,r))||t.dispatch(r()),n.preventDefault()}};const ke=A?"metaKey":"ctrlKey";se.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=be(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&function(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}(n,t.input.lastClick)&&!n[ke]&&t.input.lastClick.button==n.button&&("singleClick"==t.input.lastClick.type?i="doubleClick":"doubleClick"==t.input.lastClick.type&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let s=t.posAtCoords(fe(n));s&&("singleClick"==i?t.input.mouseDown=new Se(t,s,n,!!r):("doubleClick"==i?ye:ve)(t,s.pos,s.inside,n)?n.preventDefault():de(t,"pointer"))};class xe{constructor(t){this.view=t,this.mightDrag=null,t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(t){this.done()}move(t){0==t.buttons&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class Se extends xe{constructor(t,e,n,o){let i,s;if(super(t),this.pos=e,this.event=n,this.flushed=o,this.delayedSelectionSync=!1,this.startDoc=t.state.doc,this.selectNode=!!n[ke],this.allowDefault=n.shiftKey,e.inside>-1)i=t.state.doc.nodeAt(e.inside),s=e.inside;else{let n=t.state.doc.resolve(e.pos);i=n.parent,s=n.depth?n.before():0}const a=o?null:n.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l&&1==l.nodeDOM.nodeType?l.nodeDOM:null;let{selection:c}=t.state;0==n.button&&(i.type.spec.draggable&&!1!==i.type.spec.selectable||c instanceof r.nh&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!C||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),de(t,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||Nt(this.view)})}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(fe(t))),this.updateAllowDefault(t),this.allowDefault||!e?de(this.view,"pointer"):function(t,e,n,o,i){return me(t,"handleClickOn",e,n,o)||t.someProp("handleClick",n=>n(t,e,o))||(i?function(t,e){if(-1==e)return!1;let n,o,i=t.state.selection;i instanceof r.nh&&(n=i.node);let s=t.state.doc.resolve(e);for(let t=s.depth+1;t>0;t--){let e=t>s.depth?s.nodeAfter:s.node(t);if(r.nh.isSelectable(e)){o=n&&i.$from.depth>0&&t>=i.$from.depth&&s.before(i.$from.depth+1)==i.$from.pos?s.before(i.$from.depth):s.before(t);break}}return null!=o&&(ge(t,r.nh.create(t.state.doc,o),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;let n=t.state.doc.resolve(e),o=n.nodeAfter;return!!(o&&o.isAtom&&r.nh.isSelectable(o))&&(ge(t,new r.nh(n),"pointer"),!0)}(t,n))}(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||T&&this.mightDrag&&!this.mightDrag.node.isAtom||N&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(ge(this.view,r.LN.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):de(this.view,"pointer")}move(t){this.updateAllowDefault(t),de(this.view,"pointer"),super.move(t)}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return!!this.allowDefault&&(this.delayedSelectionSync=!0,!0)}}class Me extends xe{constructor(t,e){super(t),this.startSelection=e,this.startDoc=t.state.doc}move(t){if(0==t.buttons||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc))return void this.done();t.preventDefault(),de(this.view,"pointer");let e=this.view.posAtCoords(fe(t)),n=e&&we(this.view,e.inside,!1);if(!n)return;let{doc:o}=this.view.state,i=this.startSelection,[s,a]=n.from<i.from?[i.to,n.from]:[i.from,n.to];ge(this.view,r.U3.create(o,s,a),"pointer")}}function Ce(t,e){return!!t.composing||!!(T&&Math.abs(Date.now()-t.input.compositionEndedAt)<500)&&(t.input.compositionEndedAt=-2e8,!0)}se.touchstart=t=>{t.input.lastTouch=Date.now(),be(t),de(t,"pointer")},se.touchmove=t=>{t.input.lastTouch=Date.now(),de(t,"pointer")},se.contextmenu=t=>be(t);const Oe=z?5e3:-1;function Ne(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Te(t),e))}function Ee(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Te(t,e=!1){if(!(z&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Ee(t),e||t.docView&&t.docView.dirty){let n=Ct(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):!t.markCursor&&!e||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.updateState(t.state):t.dispatch(t.state.tr.deleteSelection()),!0}return!1}}ae.compositionstart=ae.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof r.U3&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(t=>!1===t.type.spec.inclusive)||N&&R&&function(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||1!=e.nodeType||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(t)))t.markCursor=t.state.storedMarks||n.marks(),Te(t,!0),t.markCursor=null;else if(Te(t,!e.selection.empty),C&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let e=t.domSelectionRange();for(let n=e.focusNode,r=e.focusOffset;n&&1==n.nodeType&&0!=r;){let e=r<0?n.lastChild:n.childNodes[r-1];if(!e)break;if(3==e.nodeType){let n=t.domSelection();n&&n.collapse(e,e.nodeValue.length);break}n=e,r=-1}}t.input.composing=!0}Ne(t,Oe)},ae.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Ne(t,20))};const De=S&&M<15||D&&I<604;function Ae(t,e,n,r,i){let s=Yt(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",e=>e(t,i,s||o.Ji.empty)))return!0;if(!s)return!1;let a=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(s),l=a?t.state.tr.replaceSelectionWith(a,r):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Re(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}se.copy=ae.cut=(t,e)=>{let n=e,r=t.state.selection,o="cut"==n.type;if(r.empty)return;let i=De?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Xt(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},ae.paste=(t,e)=>{let n=e;if(t.composing&&!z)return;let r=De?null:n.clipboardData,o=t.input.shiftKey&&45!=t.input.lastKeyCode;r&&Ae(t,Re(r),r.getData("text/html"),o,n)?n.preventDefault():function(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&45!=t.input.lastKeyCode;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ae(t,r.value,null,o,e):Ae(t,r.textContent,r.innerHTML,o,e)},50)}(t,n)};class ze{constructor(t,e,n){this.slice=t,this.move=e,this.node=n}}const $e=A?"altKey":"ctrlKey";function Ie(t,e){let n;return t.someProp("dragCopies",t=>{n=n||t(e)}),null!=n?!n:!e[$e]}se.dragstart=(t,e)=>{let n=e,o=t.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let i,s=t.state.selection,a=s.empty?null:t.posAtCoords(fe(n));if(a&&a.pos>=s.from&&a.pos<=(s instanceof r.nh?s.to-1:s.to));else if(o&&o.mightDrag)i=r.nh.create(t.state.doc,o.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let e=t.docView.nearestDesc(n.target,!0);e&&e.node.type.spec.draggable&&e!=t.docView&&(i=r.nh.create(t.state.doc,e.posBefore))}let l=(i||t.state.selection).content(),{dom:c,text:d,slice:h}=Xt(t,l);(!n.dataTransfer.files.length||!N||E>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(De?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",De||n.dataTransfer.setData("text/plain",d),t.dragging=new ze(h,Ie(t,n),i)},se.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},ae.dragover=ae.dragenter=(t,e)=>e.preventDefault(),ae.drop=(t,e)=>{try{!function(t,e,n){if(!e.dataTransfer)return;let s=t.posAtCoords(fe(e));if(!s)return;let a=t.state.doc.resolve(s.pos),l=n&&n.slice;l?t.someProp("transformPasted",e=>{l=e(l,t,!1)}):l=Yt(t,Re(e.dataTransfer),De?null:e.dataTransfer.getData("text/html"),!1,a);let c=!(!n||!Ie(t,e));if(t.someProp("handleDrop",n=>n(t,e,l||o.Ji.empty,c)))return void e.preventDefault();if(!l)return;e.preventDefault();let d=l?(0,i.Um)(t.state.doc,a.pos,l):a.pos;null==d&&(d=a.pos);let h=t.state.tr;if(c){let{node:t}=n;t?t.replace(h):h.deleteSelection()}let u=h.mapping.map(d),p=0==l.openStart&&0==l.openEnd&&1==l.content.childCount,f=h.doc;if(p?h.replaceRangeWith(u,u,l.content.firstChild):h.replaceRange(u,u,l),h.doc.eq(f))return;let m=h.doc.resolve(u);if(p&&r.nh.isSelectable(l.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(l.content.firstChild))h.setSelection(new r.nh(m));else{let e=h.mapping.map(d);h.mapping.maps[h.mapping.maps.length-1].forEach((t,n,r,o)=>e=o),h.setSelection($t(t,m,h.doc.resolve(e)))}t.focus(),t.dispatch(h.setMeta("uiEvent","drop"))}(t,e,t.dragging)}finally{t.dragging=null}},se.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Nt(t)},20))},se.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},se.beforeinput=(t,e)=>{if(z&&"deleteContentBackward"==e.inputType){t.domObserver.flushSoon();let{domChangeCount:e}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=e)return;if(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",e=>e(t,g(8,"Backspace"))))return;let{$cursor:n}=t.state.selection;n&&n.pos>0&&t.dispatch(t.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let t in ae)se[t]=ae[t];function Pe(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Fe{constructor(t,e){this.toDOM=t,this.spec=e||Ke,this.side=this.spec.side||0}map(t,e,n,r){let{pos:o,deleted:i}=t.mapResult(e.from+r,this.side<0?-1:1);return i?null:new Le(o-n,o-n,this)}valid(){return!0}eq(t){return this==t||t instanceof Fe&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Pe(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Be{constructor(t,e){this.attrs=t,this.spec=e||Ke}map(t,e,n,r){let o=t.map(e.from+r,this.spec.inclusiveStart?-1:1)-n,i=t.map(e.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Le(o,i,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof Be&&Pe(this.attrs,t.attrs)&&Pe(this.spec,t.spec)}static is(t){return t.type instanceof Be}destroy(){}}class Ve{constructor(t,e){this.attrs=t,this.spec=e||Ke}map(t,e,n,r){let o=t.mapResult(e.from+r,1);if(o.deleted)return null;let i=t.mapResult(e.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Le(o.pos-n,i.pos-n,this)}valid(t,e){let n,{index:r,offset:o}=t.content.findIndex(e.from);return o==e.from&&!(n=t.child(r)).isText&&o+n.nodeSize==e.to}eq(t){return this==t||t instanceof Ve&&Pe(this.attrs,t.attrs)&&Pe(this.spec,t.spec)}destroy(){}}class Le{constructor(t,e,n){this.from=t,this.to=e,this.type=n}copy(t,e){return new Le(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,n){return this.type.map(t,this,e,n)}static widget(t,e,n){return new Le(t,t,new Fe(e,n))}static inline(t,e,n,r){return new Le(t,e,new Be(n,r))}static node(t,e,n,r){return new Le(t,e,new Ve(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Be}get widget(){return this.type instanceof Fe}}const je=[],Ke={};class Je{constructor(t,e){this.local=t.length?t:je,this.children=e.length?e:je}static create(t,e){return e.length?Xe(e,t,0,Ke):We}find(t,e,n){let r=[];return this.findInner(null==t?0:t,null==e?1e9:e,r,0,n),r}findInner(t,e,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=e&&s.to>=t&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<e&&this.children[i+1]>t){let s=this.children[i]+1;this.children[i+2].findInner(t-s,e-s,n,r+s,o)}}map(t,e,n){return this==We||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Ke)}mapInner(t,e,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(t,n,r);a&&a.type.valid(e,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(t,e,n,r,o,i,s){let a=t.slice();for(let t=0,e=i;t<n.maps.length;t++){let r=0;n.maps[t].forEach((t,n,o,i)=>{let s=i-o-(n-t);for(let o=0;o<a.length;o+=3){let i=a[o+1];if(i<0||t>i+e-r)continue;let l=a[o]+e-r;n>=l?a[o+1]=t<=l?-2:-1:t>=e&&s&&(a[o]+=s,a[o+1]+=s)}r+=s}),e=n.maps[t].map(e,-1)}let l=!1;for(let e=0;e<a.length;e+=3)if(a[e+1]<0){if(-2==a[e+1]){l=!0,a[e+1]=-1;continue}let c=n.map(t[e]+i),d=c-o;if(d<0||d>=r.content.size){l=!0;continue}let h=n.map(t[e+1]+i,-1)-o,{index:u,offset:p}=r.content.findIndex(d),f=r.maybeChild(u);if(f&&p==d&&p+f.nodeSize==h){let r=a[e+2].mapInner(n,f,c+1,t[e]+i+1,s);r!=We?(a[e]=d,a[e+1]=h,a[e+2]=r):(a[e+1]=-2,l=!0)}else l=!0}if(l){let l=function(t,e,n,r,o,i,s){function a(t,e){for(let i=0;i<t.local.length;i++){let a=t.local[i].map(r,o,e);a?n.push(a):s.onRemove&&s.onRemove(t.local[i].spec)}for(let n=0;n<t.children.length;n+=3)a(t.children[n+2],t.children[n]+e+1)}for(let n=0;n<t.length;n+=3)-1==t[n+1]&&a(t[n+2],e[n]+i+1);return n}(a,t,e,n,o,i,s),c=Xe(l,r,0,s);e=c.local;for(let t=0;t<a.length;t+=3)a[t+1]<0&&(a.splice(t,3),t-=3);for(let t=0,e=0;t<c.children.length;t+=3){let n=c.children[t];for(;e<a.length&&a[e]<n;)e+=3;a.splice(e,0,c.children[t],c.children[t+1],c.children[t+2])}}return new Je(e.sort(Ye),a)}(this.children,i||[],t,e,n,r,o):i?new Je(i.sort(Ye),je):We}add(t,e){return e.length?this==We?Je.create(t,e):this.addInner(t,e,0):this}addInner(t,e,n){let r,o=0;t.forEach((t,i)=>{let s,a=i+n;if(s=He(e,t,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(t,s,a+1):r.splice(o,0,i,i+t.nodeSize,Xe(s,t,a+1,Ke)),o+=3}});let i=qe(o?_e(e):e,-n);for(let e=0;e<i.length;e++)i[e].type.valid(t,i[e])||i.splice(e--,1);return new Je(i.length?this.local.concat(i).sort(Ye):this.local,r||this.children)}remove(t){return 0==t.length||this==We?this:this.removeInner(t,0)}removeInner(t,e){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+e,s=n[r+1]+e;for(let e,n=0;n<t.length;n++)(e=t[n])&&e.from>i&&e.to<s&&(t[n]=null,(o||(o=[])).push(e));if(!o)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(o,i+1);a!=We?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length)for(let n,o=0;o<t.length;o++)if(n=t[o])for(let t=0;t<r.length;t++)r[t].eq(n,e)&&(r==this.local&&(r=this.local.slice()),r.splice(t--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Je(r,n):We}forChild(t,e){if(this==We)return this;if(e.isLeaf)return Je.empty;let n,r;for(let e=0;e<this.children.length;e+=3)if(this.children[e]>=t){this.children[e]==t&&(n=this.children[e+2]);break}let o=t+1,i=o+e.content.size;for(let t=0;t<this.local.length;t++){let e=this.local[t];if(e.from<i&&e.to>o&&e.type instanceof Be){let t=Math.max(o,e.from)-o,n=Math.min(i,e.to)-o;t<n&&(r||(r=[])).push(e.copy(t,n))}}if(r){let t=new Je(r.sort(Ye),je);return n?new Ue([t,n]):t}return n||We}eq(t){if(this==t)return!0;if(!(t instanceof Je)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(t){return Ge(this.localsInner(t))}localsInner(t){if(this==We)return je;if(t.inlineContent||!this.local.some(Be.is))return this.local;let e=[];for(let t=0;t<this.local.length;t++)this.local[t].type instanceof Be||e.push(this.local[t]);return e}forEachSet(t){t(this)}}Je.empty=new Je([],[]),Je.removeOverlap=Ge;const We=Je.empty;class Ue{constructor(t){this.members=t}map(t,e){const n=this.members.map(n=>n.map(t,e,Ke));return Ue.from(n)}forChild(t,e){if(e.isLeaf)return Je.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(t,e);o!=We&&(o instanceof Ue?n=n.concat(o.members):n.push(o))}return Ue.from(n)}eq(t){if(!(t instanceof Ue)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(t){let e,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(t);if(o.length)if(e){n&&(e=e.slice(),n=!1);for(let t=0;t<o.length;t++)e.push(o[t])}else e=o}return e?Ge(n?e:e.sort(Ye)):je}static from(t){switch(t.length){case 0:return We;case 1:return t[0];default:return new Ue(t.every(t=>t instanceof Je)?t:t.reduce((t,e)=>t.concat(e instanceof Je?e:e.members),[]))}}forEachSet(t){for(let e=0;e<this.members.length;e++)this.members[e].forEachSet(t)}}function qe(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new Le(o.from+e,o.to+e,o.type))}return n}function He(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let e,i=0;i<t.length;i++)(e=t[i])&&e.from>n&&e.to<r&&((o||(o=[])).push(e),t[i]=null);return o}function _e(t){let e=[];for(let n=0;n<t.length;n++)null!=t[n]&&e.push(t[n]);return e}function Xe(t,e,n,r){let o=[],i=!1;e.forEach((e,s)=>{let a=He(t,e,s+n);if(a){i=!0;let t=Xe(a,e,n+s+1,r);t!=We&&o.push(s,s+e.nodeSize,t)}});let s=qe(i?_e(t):t,-n).sort(Ye);for(let t=0;t<s.length;t++)s[t].type.valid(e,s[t])||(r.onRemove&&r.onRemove(s[t].spec),s.splice(t--,1));return s.length||o.length?new Je(s,o):We}function Ye(t,e){return t.from-e.from||t.to-e.to}function Ge(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from!=r.from){i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),Ze(e,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),Ze(e,o+1,i.copy(r.to,i.to)))}}return e}function Ze(t,e,n){for(;e<t.length&&Ye(n,t[e])>0;)e++;t.splice(e,0,n)}function Qe(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=We&&e.push(r)}),t.cursorWrapper&&e.push(Je.create(t.state.doc,[t.cursorWrapper.deco])),Ue.from(e)}const tn={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},en=S&&M<=11;class nn{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class rn{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new nn,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(e=>{for(let t=0;t<e.length;t++)this.queue.push(e[t]);S&&M<=11&&e.some(t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length)?this.flushSoon():T&&t.composing&&e.some(t=>"childList"==t.type&&"TR"==t.target.nodeName)?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),en&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,tn)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;e<t.length;e++)this.queue.push(t[e]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(It(this.view)){if(this.suppressingSelectionUpdates)return Nt(this.view);if(S&&M<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&d(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let e,n=new Set;for(let e=t.focusNode;e;e=a(e))n.add(e);for(let r=t.anchorNode;r;r=a(r))if(n.has(r)){e=r;break}let r=e&&this.view.docView.nearestDesc(e);return r&&r.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.pendingRecords();e.length&&(this.queue=[]);let n=t.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&It(t)&&!this.ignoreSelectionChange(n),i=-1,s=-1,a=!1,l=[];if(t.editable)for(let t=0;t<e.length;t++){let n=this.registerMutation(e[t],l);n&&(i=i<0?n.from:Math.min(n.from,i),s=s<0?n.to:Math.max(n.to,s),n.typeOver&&(a=!0))}if(l.some(t=>"BR"==t.nodeName)&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode||N&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&e.some(t=>"childList"==t.type&&t.removedNodes.length))){for(let t of l)if("BR"==t.nodeName&&t.parentNode){let e=t.nextSibling;for(;e&&1==e.nodeType;){if("false"==e.contentEditable){t.parentNode.removeChild(t);break}e=e.firstChild}}}else if(C&&l.length){let e=l.filter(t=>"BR"==t.nodeName);if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of e){let e=r.parentNode;!e||"LI"!=e.nodeName||n&&ln(t,n)==e||r.remove()}}}let c=null;i<0&&o&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&m(n)&&(c=Ct(t))&&c.eq(r.LN.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Nt(t),this.currentSelection.set(n),t.scrollToSelection()):(i>-1||o)&&(i>-1&&(t.docView.markDirty(i,s),function(t){if(!on.has(t)&&(on.set(t,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace))){if(t.requiresGeckoHackNode=C,sn)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),sn=!0}}(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(t,e){var n;let{focusNode:r,focusOffset:o}=t.domSelectionRange();for(let i of e)if("TR"==(null===(n=i.parentNode)||void 0===n?void 0:n.nodeName)){let e=i.nextSibling;for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.nextSibling;if(e){let n=e;for(;;){let t=n.firstChild;if(!t||1!=t.nodeType||"false"==t.contentEditable||/^(BR|IMG)$/.test(t.nodeName))break;n=t}n.insertBefore(i,n.firstChild),r==i&&t.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}(t,l)),this.handleDOMChange(i,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(n)||Nt(t),this.currentSelection.set(n))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){for(let n=0;n<t.addedNodes.length;n++){let r=t.addedNodes[n];e.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(t.target))return{from:n.posBefore,to:n.posAfter};let r=t.previousSibling,o=t.nextSibling;if(S&&M<=11&&t.addedNodes.length)for(let e=0;e<t.addedNodes.length;e++){let{previousSibling:n,nextSibling:i}=t.addedNodes[e];(!n||Array.prototype.indexOf.call(t.addedNodes,n)<0)&&(r=n),(!i||Array.prototype.indexOf.call(t.addedNodes,i)<0)&&(o=i)}let i=r&&r.parentNode==t.target?s(r)+1:0,a=n.localPosFromDOM(t.target,i,-1),l=o&&o.parentNode==t.target?s(o):t.target.childNodes.length;return{from:a,to:n.localPosFromDOM(t.target,l,1)}}return"attributes"==t.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=t.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let on=new WeakMap,sn=!1;function an(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return d(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function ln(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let e=t.docView.nearestDesc(n,!0);if(e&&e.node.isBlock)return n}return null}const cn=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function dn(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:$t(t,e.resolve(n.anchor),e.resolve(n.head))}function hn(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let e=t.node(r).maybeChild(t.indexAfter(r));for(;e&&!e.isLeaf;)e=e.firstChild,o++}return o}class un{constructor(t,e){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new ce,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(yn),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):"function"==typeof t?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=mn(this),fn(this),this.nodeViews=gn(this),this.docView=ct(this.state.doc,pn(this),Qe(this),this.dom,this),this.domObserver=new rn(this,(t,e,n,i)=>function(t,e,n,i,s){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let e=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,n=Ct(t,e);if(n&&!t.state.selection.eq(n)){if(N&&z&&13===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",e=>e(t,g(13,"Enter"))))return;let r=t.state.tr.setSelection(n);"pointer"==e?r.setMeta("pointer",!0):"key"==e&&r.scrollIntoView(),a&&r.setMeta("composition",a),t.dispatch(r)}return}let l=t.state.doc.resolve(e),c=l.sharedDepth(n);e=l.before(c+1),n=t.state.doc.resolve(n).after(c+1);let d,h,u=t.state.selection,p=function(t,e,n,r){let i,{node:s,fromOffset:a,toOffset:l,from:c,to:d}=t.docView.parseRange(e,n),h=t.domSelectionRange(),u=h.anchorNode;if(u&&t.dom.contains(1==u.nodeType?u:u.parentNode)&&(i=[{node:u,offset:h.anchorOffset}],m(h)||i.push({node:h.focusNode,offset:h.focusOffset})),N&&8===t.input.lastKeyCode)for(let t=l;t>a;t--){let e=s.childNodes[t-1],n=e.pmViewDesc;if("BR"==e.nodeName&&!n){l=t;break}if(!n||n.size)break}let p=t.state.doc,f=t.someProp("domParser")||o.S4.fromSchema(t.state.schema),g=p.resolve(c),y=null,v=f.parse(s,{topNode:g.parent,topMatch:g.parent.contentMatchAt(g.index()),topOpen:!0,from:a,to:l,preserveWhitespace:"pre"!=g.parent.type.whitespace||"full",findPositions:i,ruleFromNode:(w=r,t=>{let e=t.pmViewDesc;if(e)return e.parseRule(w);if("BR"==t.nodeName&&t.parentNode){if(T&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}if(t.parentNode.lastChild==t||T&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if("IMG"==t.nodeName&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}),context:g});var w;if(i&&null!=i[0].pos){let t=i[0].pos,e=i[1]&&i[1].pos;null==e&&(e=t),y={anchor:t+c,head:e+c}}return{doc:v,sel:y,from:c,to:d}}(t,e,n,s),f=t.state.doc,y=f.slice(p.from,p.to);8===t.input.lastKeyCode&&Date.now()-100<t.input.lastKeyCodeTime?(d=t.state.selection.to,h="end"):(d=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let v=function(t,e,n,r,o){let i=t.findDiffStart(e,n),s=n+t.size,a=n+e.size;if(null==i)return null;let{a:l,b:c}=t.findDiffEnd(e,s,a);return"end"==o&&(r-=l+Math.max(0,i-Math.min(l,c))-i),l<i&&s<a?(i-=r<=i&&r>=l?i-r:0,c=i+(c-l),l=i):c<i&&(i-=r<=i&&r>=c?i-r:0,l=i+(l-c),c=i),{start:i,endA:l,endB:c}}(y.content,p.doc.content,p.from,d,h);if(v&&t.input.domChangeCount++,(D&&t.input.lastIOSEnter>Date.now()-225||z)&&s.some(t=>1==t.nodeType&&!cn.test(t.nodeName))&&(!v||v.endA>=v.endB)&&t.someProp("handleKeyDown",e=>e(t,g(13,"Enter"))))return void(t.input.lastIOSEnter=0);if(!v){if(!(i&&u instanceof r.U3&&!u.empty&&u.$head.sameParent(u.$anchor))||t.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){let e=dn(t,t.state.doc,p.sel);if(e&&!e.eq(t.state.selection)){let n=t.state.tr.setSelection(e);a&&n.setMeta("composition",a),t.dispatch(n)}}return}v={start:u.from,endA:u.to,endB:u.to}}t.state.selection.from<t.state.selection.to&&v.start==v.endB&&t.state.selection instanceof r.U3&&(v.start>t.state.selection.from&&v.start<=t.state.selection.from+2&&t.state.selection.from>=p.from?v.start=t.state.selection.from:v.endA<t.state.selection.to&&v.endA>=t.state.selection.to-2&&t.state.selection.to<=p.to&&(v.endB+=t.state.selection.to-v.endA,v.endA=t.state.selection.to)),S&&M<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>p.from&&"  "==p.doc.textBetween(v.start-p.from-1,v.start-p.from+1)&&(v.start--,v.endA--,v.endB--);let w=p.doc.resolveNoCache(v.start-p.from),b=p.doc.resolveNoCache(v.endB-p.from),k=f.resolve(v.start),x=w.sameParent(b)&&w.parent.inlineContent&&k.end()>=v.endA;if((D&&t.input.lastIOSEnter>Date.now()-225&&(!x||s.some(t=>"DIV"==t.nodeName||"P"==t.nodeName))||!x&&w.pos<p.doc.content.size&&(!w.sameParent(b)||!w.parent.inlineContent)&&w.pos<b.pos&&!/\S/.test(p.doc.textBetween(w.pos,b.pos,"","")))&&t.someProp("handleKeyDown",e=>e(t,g(13,"Enter"))))return void(t.input.lastIOSEnter=0);if(t.state.selection.anchor>v.start&&function(t,e,n,r,o){if(n-e<=o.pos-r.pos||hn(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(!r.parent.isTextblock){let t=i.nodeAfter;return null!=t&&n==e+t.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(hn(i,!0,!0));return!(!s.parent.isTextblock||s.pos>n||hn(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(f,v.start,v.endA,w,b)&&t.someProp("handleKeyDown",e=>e(t,g(8,"Backspace"))))return void(z&&N&&t.domObserver.suppressSelectionUpdates());N&&v.endB==v.start&&(t.input.lastChromeDelete=Date.now()),z&&!x&&w.start()!=b.start()&&0==b.parentOffset&&w.depth==b.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==v.endA&&(v.endB-=2,b=p.doc.resolveNoCache(v.endB-p.from),setTimeout(()=>{t.someProp("handleKeyDown",function(e){return e(t,g(13,"Enter"))})},20));let C,O=v.start,E=v.endA,A=e=>{let n=e||t.state.tr.replace(O,E,p.doc.slice(v.start-p.from,v.endB-p.from));if(p.sel){let e=dn(t,n.doc,p.sel);e&&!(N&&t.composing&&e.empty&&(v.start!=v.endB||t.input.lastChromeDelete<Date.now()-100)&&(e.head==O||e.head==n.mapping.map(E)-1)||S&&e.empty&&e.head==O)&&n.setSelection(e)}return a&&n.setMeta("composition",a),n.scrollIntoView()};if(x)if(w.pos==b.pos){S&&M<=11&&0==w.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Nt(t),20));let e=A(t.state.tr.delete(O,E)),n=f.resolve(v.start).marksAcross(f.resolve(v.endA));n&&e.ensureMarks(n),t.dispatch(e)}else if(v.endA==v.endB&&(C=function(t,e){let n,r,i,s=t.firstChild.marks,a=e.firstChild.marks,l=s,c=a;for(let t=0;t<a.length;t++)l=a[t].removeFromSet(l);for(let t=0;t<s.length;t++)c=s[t].removeFromSet(c);if(1==l.length&&0==c.length)r=l[0],n="add",i=t=>t.mark(r.addToSet(t.marks));else{if(0!=l.length||1!=c.length)return null;r=c[0],n="remove",i=t=>t.mark(r.removeFromSet(t.marks))}let d=[];for(let t=0;t<e.childCount;t++)d.push(i(e.child(t)));if(o.FK.from(d).eq(t))return{mark:r,type:n}}(w.parent.content.cut(w.parentOffset,b.parentOffset),k.parent.content.cut(k.parentOffset,v.endA-k.start())))){let e=A(t.state.tr);"add"==C.type?e.addMark(O,E,C.mark):e.removeMark(O,E,C.mark),t.dispatch(e)}else if(w.parent.child(w.index()).isText&&w.index()==b.index()-(b.textOffset?0:1)){let e=w.parent.textBetween(w.parentOffset,b.parentOffset),n=()=>A(t.state.tr.insertText(e,O,E));t.someProp("handleTextInput",r=>r(t,O,E,e,n))||t.dispatch(n())}else t.dispatch(A());else t.dispatch(A())}(this,t,e,n,i)),this.domObserver.start(),function(t){for(let e in se){let n=se[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=e=>{!pe(t,e)||ue(t,e)||!t.editable&&e.type in ae||n(t,e)},le[e]?{passive:!0}:void 0)}T&&t.dom.addEventListener("input",()=>null),he(t)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&he(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(yn),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let t in this._props)e[t]=this._props[t];e.state=this.state;for(let n in t)e[n]=t[n];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){var n;let r=this.state,o=!1,i=!1;t.storedMarks&&this.composing&&(Ee(this),i=!0),this.state=t;let a=r.plugins!=t.plugins||this._props.plugins!=e.plugins;if(a||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let t=gn(this);(function(t,e){let n=0,r=0;for(let r in t){if(t[r]!=e[r])return!0;n++}for(let t in e)r++;return n!=r})(t,this.nodeViews)&&(this.nodeViews=t,o=!0)}(a||e.handleDOMEvents!=this._props.handleDOMEvents)&&he(this),this.editable=mn(this),fn(this);let l=Qe(this),c=pn(this),h=r.plugins==t.plugins||r.doc.eq(t.doc)?t.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",u=o||!this.docView.matchesNode(t.doc,c,l);!u&&t.selection.eq(r.selection)||(i=!0);let m="preserve"==h&&i&&null==this.dom.style.overflowAnchor&&function(t){let e,n,r=t.dom.getBoundingClientRect(),o=Math.max(0,r.top);for(let i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=t.root.elementFromPoint(i,s);if(!r||r==t.dom||!t.dom.contains(r))continue;let a=r.getBoundingClientRect();if(a.top>=o-20){e=r,n=a.top;break}}return{refDOM:e,refTop:n,stack:L(t.dom)}}(this);if(i){this.domObserver.stop();let e=u&&(S||N)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&function(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}(r.selection,t.selection);if(u){let n=N?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=function(t,e){for(;;){if(3==t.nodeType&&e)return t;if(1==t.nodeType&&e>0){if("false"==t.contentEditable)return null;e=p(t=t.childNodes[e-1])}else{if(!t.parentNode||f(t))return null;e=s(t),t=t.parentNode}}}(e.focusNode,e.focusOffset),r=function(t,e){for(;;){if(3==t.nodeType&&e<t.nodeValue.length)return t;if(1==t.nodeType&&e<t.childNodes.length){if("false"==t.contentEditable)return null;t=t.childNodes[e],e=0}else{if(!t.parentNode||f(t))return null;e=s(t)+1,t=t.parentNode}}}(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let e=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!e||!e.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let t=n.pmViewDesc;if(t&&t.isText(n.nodeValue))return r}}return n||r}(this)),!o&&this.docView.update(t.doc,c,l,this)||(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=ct(t.doc,c,l,this.dom,this)),!n||this.trackWrites&&this.dom.contains(this.trackWrites)||(e=!0)}let n=this.input.mouseDown;e||!(n&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return d(e.node,e.offset,n.anchorNode,n.anchorOffset)}(this)&&n.delaySelUpdate())?Nt(this,e):(Rt(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==h?this.dom.scrollTop=0:"to selection"==h?this.scrollToSelection():m&&function({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;j(n,0==r?0:r-e)}(m)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(t&&this.dom.contains(1==t.nodeType?t:t.parentNode))if(this.someProp("handleScrollToSelection",t=>t(this)));else if(this.state.selection instanceof r.nh){let e=this.docView.domAfterPos(this.state.selection.from);1==e.nodeType&&V(this,e.getBoundingClientRect(),t)}else V(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let e=0;e<this.pluginViews.length;e++){let n=this.pluginViews[e];n.update&&n.update(this,t)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let e=this.directPlugins[t];e.spec.view&&this.pluginViews.push(e.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let e=this.state.plugins[t];e.spec.view&&this.pluginViews.push(e.spec.view(this))}}}updateDraggedNode(t,e){let n=t.node,o=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)o=n.from;else{let t=n.from+(this.state.doc.content.size-e.doc.content.size);(t>0&&t<this.state.doc.content.size&&this.state.doc.nodeAt(t))==n.node&&(o=t)}this.dragging=new ze(t.slice,t.move,o<0?void 0:r.nh.create(this.state.doc,o))}someProp(t,e){let n,r=this._props&&this._props[t];if(null!=r&&(n=e?e(r):r))return n;for(let r=0;r<this.directPlugins.length;r++){let o=this.directPlugins[r].props[t];if(null!=o&&(n=e?e(o):o))return n}let o=this.state.plugins;if(o)for(let r=0;r<o.length;r++){let i=o[r].props[t];if(null!=i&&(n=e?e(i):i))return n}}hasFocus(){if(S){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if("false"==t.contentEditable)return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(t){if(t.setActive)return t.setActive();if(K)return t.focus(K);let e=L(t);t.focus(null==K?{get preventScroll(){return K={preventScroll:!0},!0}}:void 0),K||(K=!1,j(e,0))}(this.dom),Nt(this),this.domObserver.start()}get root(){let t=this._root;if(null==t)for(let t=this.dom.parentNode;t;t=t.parentNode)if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t;return t||document}updateRoot(){this._root=null}posAtCoords(t){return q(this,t)}coordsAtPos(t,e=1){return Y(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,n=-1){let r=this.docView.posFromDOM(t,e,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(t,e){return function(t,e,n){return et==e&&nt==n?rt:(et=e,nt=n,rt="up"==n||"down"==n?function(t,e,n){let r=e.selection,o="up"==n?r.$from:r.$to;return Q(t,e,()=>{let{node:e}=t.docView.domFromPos(o.pos,"up"==n?-1:1);for(;;){let n=t.docView.nearestDesc(e,!0);if(!n)break;if(n.node.isBlock){e=n.contentDOM||n.dom;break}e=n.dom.parentNode}let r=Y(t,o.pos,1);for(let t=e.firstChild;t;t=t.nextSibling){let e;if(1==t.nodeType)e=t.getClientRects();else{if(3!=t.nodeType)continue;e=c(t,0,t.nodeValue.length).getClientRects()}for(let t=0;t<e.length;t++){let o=e[t];if(o.bottom>o.top+1&&("up"==n?r.top-o.top>2*(o.bottom-r.top):o.bottom-r.bottom>2*(r.bottom-o.top)))return!1}}return!0})}(t,e,n):function(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=t.domSelection();return a?tt.test(r.parent.textContent)&&a.modify?Q(t,e,()=>{let{focusNode:e,focusOffset:o,anchorNode:i,anchorOffset:s}=t.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:d,focusOffset:h}=t.domSelectionRange(),u=d&&!c.contains(1==d.nodeType?d:d.parentNode)||e==d&&o==h;try{a.collapse(i,s),e&&(e!=i||o!=s)&&a.extend&&a.extend(e,o)}catch(t){}return null!=l&&(a.caretBidiLevel=l),u}):"left"==n||"backward"==n?i:s:r.pos==r.start()||r.pos==r.end()}(t,e,n))}(this,e||this.state,t)}pasteHTML(t,e){return Ae(this,"",t,!1,e||new ClipboardEvent("paste"))}pasteText(t,e){return Ae(this,t,null,!0,e||new ClipboardEvent("paste"))}serializeForClipboard(t){return Xt(this,t)}destroy(){this.docView&&(function(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Qe(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,l=null)}get isDestroyed(){return null==this.docView}dispatchEvent(t){return function(t,e){ue(t,e)||!se[e.type]||!t.editable&&e.type in ae||se[e.type](t,e)}(this,t)}domSelectionRange(){let t=this.domSelection();return t?T&&11===this.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t,e){if(e.getComposedRanges){let n=e.getComposedRanges(t.root)[0];if(n)return an(t,n)}let n;function r(t){t.preventDefault(),t.stopImmediatePropagation(),n=t.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?an(t,n):null}
1(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function pn(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if("function"==typeof n&&(n=n(t.state)),n)for(let t in n)"class"==t?e.class+=" "+n[t]:"style"==t?e.style=(e.style?e.style+";":"")+n[t]:e[t]||"contenteditable"==t||"nodeName"==t||(e[t]=String(n[t]))}),e.translate||(e.translate="no"),[Le.node(0,t.state.doc.content.size,e)]}function fn(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:Le.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function mn(t){return!t.someProp("editable",e=>!1===e(t.state))}function gn(t){let e=Object.create(null);function n(t){for(let n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function yn(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}un.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))}}}]);
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3591c60b-dd63-4097-bde9-aa923abb9e1a")}catch(e){}}()
3//# debugId=3591c60b-dd63-4097-bde9-aa923abb9e1a

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.