1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[572],{109:function(e,t,o){o.d(t,{EH:function(){return DecorationSet},p:function(){return Decoration},tk:function(){return EditorView}});var n=o(7789),i=o(2059),s=o(2312);let domIndex=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},parentNode=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},r=null,textRange=function(e,t,o){let n=r||(r=document.createRange());return n.setEnd(e,null==o?e.nodeValue.length:o),n.setStart(e,t||0),n},clearReusedRange=function(){r=null},isEquivalentPosition=function(e,t,o,n){return o&&(scanFor(e,t,o,n,-1)||scanFor(e,t,o,n,1))},l=/^(img|br|input|textarea|hr)$/i;function scanFor(e,t,o,n,i){for(var s;;){if(e==o&&t==n)return!0;if(t==(i<0?0:nodeSize(e))){let o=e.parentNode;if(!o||1!=o.nodeType||hasBlockDesc(e)||l.test(e.nodeName)||"false"==e.contentEditable)return!1;t=domIndex(e)+(i<0?0:1),e=o}else{if(1!=e.nodeType)return!1;let o=e.childNodes[t+(i<0?-1:0)];if(1==o.nodeType&&"false"==o.contentEditable){if(null===(s=o.pmViewDesc)||void 0===s||!s.ignoreForSelection)return!1;t+=i}else e=o,t=i<0?nodeSize(e):0}}}function nodeSize(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function hasBlockDesc(e){let t;for(let o=e;o&&!(t=o.pmViewDesc);o=o.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}let selectionCollapsed=function(e){return e.focusNode&&isEquivalentPosition(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function keyEvent(e,t){let o=document.createEvent("Event");
vendor: 4,454 bytes, line 1
1return o.initEvent("keydown",!0,!0),o.keyCode=e,o.key=o.code=t,o}let d="undefined"!=typeof navigator?navigator:null,a="undefined"!=typeof document?document:null,c=d&&d.userAgent||"",h=/Edge\/(\d+)/.exec(c),p=/MSIE \d/.exec(c),u=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(c),f=!!(p||u||h),m=p?document.documentMode:u?+u[1]:h?+h[1]:0,g=!f&&/gecko\/(\d+)/i.test(c);g&&(/Firefox\/(\d+)/.exec(c)||[0,0])[1];let y=!f&&/Chrome\/(\d+)/.exec(c),b=!!y,D=y?+y[1]:0,v=!f&&!!d&&/Apple Computer/.test(d.vendor),w=v&&(/Mobile\/\w+/.test(c)||!!d&&d.maxTouchPoints>2),S=w||!!d&&/Mac/.test(d.platform),N=!!d&&/Win/.test(d.platform),O=/Android \d/.test(c),C=!!a&&"webkitFontSmoothing"in a.documentElement.style,M=C?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function getSide(e,t){return"number"==typeof e?e:e[t]}function scrollRectIntoView(e,t,o){let n=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,s=e.dom.ownerDocument;for(let r=o||e.dom;r;){if(1!=r.nodeType){r=parentNode(r);continue}let e=r,o=e==s.body,l=o?function(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}(s):function(e){let t=e.getBoundingClientRect(),o=t.width/e.offsetWidth||1,n=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*o,top:t.top,bottom:t.top+e.clientHeight*n}}(e),d=0,a=0;if(t.top<l.top+getSide(n,"top")?a=-(l.top-t.top+getSide(i,"top")):t.bottom>l.bottom-getSide(n,"bottom")&&(a=t.bottom-t.top>l.bottom-l.top?t.top+getSide(i,"top")-l.top:t.bottom-l.bottom+getSide(i,"bottom")),t.left<l.left+getSide(n,"left")?d=-(l.left-t.left+getSide(i,"left")):t.right>l.right-getSide(n,"right")&&(d=t.right-l.right+getSide(i,"right")),d||a){if(o)s.defaultView.scrollBy(d,a);else{let o=e.scrollLeft,n=e.scrollTop;a&&(e.scrollTop+=a),d&&(e.scrollLeft+=d);let i=e.scrollLeft-o,s=e.scrollTop-n;t={left:t.left-i,top:t.top-s,right:t.right-i,bottom:t.bottom-s}}}let c=o?"fixed":getComputedStyle(r).position;if(/^(fixed|sticky)$/.test(c))break;r="absolute"==c?r.offsetParent:parentNode(r)}}function scrollStack(e){let t=[],o=e.ownerDocument;for(let n=e;n&&(t.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),e!=o);n=parentNode(n));return t}function restoreScrollStack(e,t){for(let o=0;o<e.length;o++){let{dom:n,top:i,left:s}=e[o];n.scrollTop!=i+t&&(n.scrollTop=i+t),n.scrollLeft!=s&&(n.scrollLeft=s)}}let k=null;function inRect(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function nonZero(e){return e.top<e.bottom||e.left<e.right}function singleRect(e,t){let o=e.getClientRects();if(o.length){let e=o[t<0?0:o.length-1];if(nonZero(e))return e}return Array.prototype.find.call(o,nonZero)||e.getBoundingClientRect()}let T=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function coordsAtPos(e,t,o){let{node:n,offset:i,atom:s}=e.docView.domFromPos(t,o<0?-1:1),r=C||g;if(3==n.nodeType){if(r&&(T.test(n.nodeValue)||(o<0?!i:i==n.nodeValue.length))){let e=singleRect(textRange(n,i,i),o);if(g&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let t=singleRect(textRange(n,i-1,i-1),-1);if(t.top==e.top){let o=singleRect(textRange(n,i,i+1),-1);if(o.top!=e.top)return flattenV(o,o.left<t.left)}}return e}{let e=i,t=i,s=o<0?1:-1;return o<0&&!i?(t++,s=-1):o>=0&&i==n.nodeValue.length?(e--,s=1):o<0?e--:t++,flattenV(singleRect(textRange(n,e,t),s),s<0)}}if(!e.state.doc.resolve(t-(s||0)).parent.inlineContent){if(null==s&&i&&(o<0||i==nodeSize(n))){let e=n.childNodes[i-1];if(1==e.nodeType)return flattenH(e.getBoundingClientRect(),!1)}if(null==s&&i<nodeSize(n)){let e=n.childNodes[i];if(1==e.nodeType)return flattenH(e.getBoundingClientRect(),!0)}return flattenH(n.getBoundingClientRect(),o>=0)}if(null==s&&i&&(o<0||i==nodeSize(n))){let e=n.childNodes[i-1],t=3==e.nodeType?textRange(e,nodeSize(e)-(r?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return flattenV(singleRect(t,1),!1)}if(null==s&&i<nodeSize(n)){let e=n.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?textRange(e,0,r?0:1):1==e.nodeType?e:null:null;if(t)return flattenV(singleRect(t,-1),!0)}return flattenV(singleRect(3==n.nodeType?textRange(n):n,-o),o>=0)}function flattenV(e,t){if(0==e.width)return e;let o=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:o,right:o}}function flattenH(e,t){if(0==e.height)return e;let o=t?e.top:e.bottom;
1return{top:o,bottom:o,left:e.left,right:e.right}}function withFlushedState(e,t,o){let n=e.state,i=e.root.activeElement;n!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return o()}finally{n!=t&&e.updateState(n),i!=e.dom&&i&&i.focus()}}let x=/[\u0590-\u08ac]/,V=null,E=null,P=!1;let ViewDesc=class ViewDesc{constructor(e,t,o,n){this.parent=e,this.children=t,this.dom=o,this.contentDOM=n,this.dirty=0,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,o=this.posAtStart;;t++){let n=this.children[t];if(n==e)return o;o+=n.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(e,t,o){let n;if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(o<0){let o,n;if(e==this.contentDOM)o=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((n=o.pmViewDesc)&&n.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(n)+n.size:this.posAtStart}{let o,n;if(e==this.contentDOM)o=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((n=o.pmViewDesc)&&n.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(n):this.posAtEnd}}if(e==this.dom&&this.contentDOM)n=t>domIndex(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))n=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){n=!1;break}if(t.previousSibling)break}if(null==n&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){n=!0;break}if(t.nextSibling)break}}return(null==n?o>0:n)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let o=!0,n=e;n;n=n.parentNode){let i=this.getDesc(n),s;if(i&&(!t||i.node)){if(!o||!(s=i.nodeDOM)||(1==s.nodeType?s.contains(1==e.nodeType?e:e.parentNode):s==e))return i;o=!1}}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,o){for(let n=e;n;n=n.parentNode){let i=this.getDesc(n);if(i)return i.localPosFromDOM(e,t,o)}return -1}descAt(e){for(let t=0,o=0;t<this.children.length;t++){let n=this.children[t],i=o+n.size;if(o==e&&i!=o){for(;!n.border&&n.children.length;)for(let e=0;e<n.children.length;e++){let t=n.children[e];if(t.size){n=t;break}}return n}if(e<i)return n.descAt(e-o-n.border);o=i}}
1domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,n=0;for(let t=0;o<this.children.length;o++){let i=this.children[o],s=t+i.size;if(s>e||i instanceof TrailingHackViewDesc){n=e-t;break}t=s}if(n)return this.children[o].domFromPos(n-this.children[o].border,t);for(let e;o&&!(e=this.children[o-1]).size&&e instanceof WidgetViewDesc&&e.side>=0;o--);if(t<=0){let e,n=!0;for(;(e=o?this.children[o-1]:null)&&e.dom.parentNode!=this.contentDOM;o--,n=!1);return e&&t&&n&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?domIndex(e.dom)+1:0}}{let e,n=!0;for(;(e=o<this.children.length?this.children[o]:null)&&e.dom.parentNode!=this.contentDOM;o++,n=!1);return e&&n&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?domIndex(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,o=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let n=-1,i=-1;for(let s=o,r=0;;r++){let o=this.children[r],l=s+o.size;if(-1==n&&e<=l){let i=s+o.border;if(e>=i&&t<=l-o.border&&o.node&&o.contentDOM&&this.contentDOM.contains(o.contentDOM))return o.parseRange(e,t,i);e=s;for(let t=r;t>0;t--){let o=this.children[t-1];if(o.size&&o.dom.parentNode==this.contentDOM&&!o.emptyChildAt(1)){n=domIndex(o.dom)+1;break}e-=o.size}-1==n&&(n=0)}if(n>-1&&(l>t||r==this.children.length-1)){t=l;for(let e=r+1;e<this.children.length;e++){let o=this.children[e];if(o.size&&o.dom.parentNode==this.contentDOM&&!o.emptyChildAt(-1)){i=domIndex(o.dom);break}t+=o.size}-1==i&&(i=this.contentDOM.childNodes.length);break}s=l}return{node:this.contentDOM,from:e,to:t,fromOffset:n,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:o}=this.domFromPos(e,0);if(1!=t.nodeType||o==t.childNodes.length)throw RangeError("No node after pos "+e);return t.childNodes[o]}setSelection(e,t,o,n=!1){let i=Math.min(e,t),s=Math.max(e,t);for(let r=0,l=0;r<this.children.length;r++){let d=this.children[r],a=l+d.size;if(i>l&&s<a)return d.setSelection(e-l-d.border,t-l-d.border,o,n);l=a}let r=this.domFromPos(e,e?-1:1),l=t==e?r:this.domFromPos(t,t?-1:1),d=o.root.getSelection(),a=o.domSelectionRange(),c=!1;if((g||v)&&e==t){let{node:e,offset:t}=r;if(3==e.nodeType){if((c=!!(t&&"\n"==e.nodeValue[t-1]))&&t==e.nodeValue.length)for(let t=e,o;t;t=t.parentNode){if(o=t.nextSibling){"BR"==o.nodeName&&(r=l={node:o.parentNode,offset:domIndex(o)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let o=e.childNodes[t-1];c=o&&("BR"==o.nodeName||"false"==o.contentEditable)}}if(g&&a.focusNode&&a.focusNode!=l.node&&1==a.focusNode.nodeType){let e=a.focusNode.childNodes[a.focusOffset];e&&"false"==e.contentEditable&&(n=!0)}if(!(n||c&&v)&&isEquivalentPosition(r.node,r.offset,a.anchorNode,a.anchorOffset)&&isEquivalentPosition(l.node,l.offset,a.focusNode,a.focusOffset))return;let h=!1;if((d.extend||e==t)&&!(c&&g)){d.collapse(r.node,r.offset);try{e!=t&&d.extend(l.node,l.offset),h=!0}catch(e){}}if(!h){if(e>t){let e=r;r=l,l=e}let o=document.createRange();o.setEnd(l.node,l.offset),o.setStart(r.node,r.offset),d.removeAllRanges(),d.addRange(o)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let o=0,n=0;n<this.children.length;n++){let i=this.children[n],s=o+i.size;if(o==s?e<=s&&t>=o:e<s&&t>o){let n=o+i.border,r=s-i.border;if(e>=n&&t<=r){this.dirty=e==o||t==s?2:1,e==n&&t==r&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-n,t-n);return}i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}o=s}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let o=1==e?2:1;t.dirty<o&&(t.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}};let WidgetViewDesc=class WidgetViewDesc extends ViewDesc{constructor(e,t,o,n){let i,s=t.type.toDOM;if("function"==typeof s&&(s=s(o,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:n)),!t.type.spec.raw){if(1!=s.nodeType){let e=document.createElement("span");e.appendChild(s),s=e}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.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}};let CompositionViewDesc=class CompositionViewDesc extends ViewDesc{constructor(e,t,o,n){super(e,[],t,null),this.textDOM=o,this.text=n}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}};let MarkViewDesc=class MarkViewDesc extends ViewDesc{constructor(e,t,o,n,i){super(e,[],o,n),this.mark=t,this.spec=i}
1static create(e,t,o,n){let s=n.nodeViews[t.type.name],r=s&&s(t,n,o);return r&&r.dom||(r=i.PW.renderSpec(document,t.type.spec.toDOM(t,o),null,t.attrs)),new MarkViewDesc(e,t,r.dom,r.contentDOM||r.dom,r)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,o){let n=MarkViewDesc.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;t<s&&(i=replaceNodes(i,t,s,o)),e>0&&(i=replaceNodes(i,0,e,o));for(let e=0;e<i.length;e++)i[e].parent=n;return n.children=i,n}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}};let NodeViewDesc=class NodeViewDesc extends ViewDesc{constructor(e,t,o,n,i,s,r,l,d){super(e,[],i,s),this.node=t,this.outerDeco=o,this.innerDeco=n,this.nodeDOM=r}static create(e,t,o,n,s,r){let l=s.nodeViews[t.type.name],d,a=l&&l(t,s,()=>d?d.parent?d.parent.posBeforeChild(d):void 0:r,o,n),c=a&&a.dom,h=a&&a.contentDOM;if(t.isText){if(c){if(3!=c.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text)}else if(!c){let e=i.PW.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:h}=e)}h||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let p=c;return(c=applyOuterDeco(c,o,t),a)?d=new CustomNodeViewDesc(e,t,o,n,c,h||null,p,a,s,r+1):t.isText?new TextViewDesc(e,t,o,n,c,p,s):new NodeViewDesc(e,t,o,n,c,h||null,p,s,r+1)}parseRule(){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 o=this.children[t];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>i.HY.empty)}else e.contentElement=this.contentDOM}else e.getContent=()=>this.node.content;return e}matchesNode(e,t,o){return 0==this.dirty&&e.eq(this.node)&&sameOuterDeco(t,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let o=this.node.inlineContent,n=t,s=e.composing?this.localCompositionInfo(e,t):null,r=s&&s.pos>-1?s:null,l=s&&s.pos<0,d=new ViewTreeUpdater(this,r&&r.node,e);(function(e,t,o,n){let i=t.locals(e),s=0;if(0==i.length){for(let o=0;o<e.childCount;o++){let r=e.child(o);n(r,i,t.forChild(s,r),o),s+=r.nodeSize}return}let r=0,l=[],d=null;for(let a=0;;){let c,h,p,u;for(;r<i.length&&i[r].to==s;){let e=i[r++];e.widget&&(c?(h||(h=[c])).push(e):c=e)}if(c){if(h){h.sort(compareSide);for(let e=0;e<h.length;e++)o(h[e],a,!!d)}else o(c,a,!!d)}if(d)u=-1,p=d,d=null;else if(a<e.childCount)u=a,p=e.child(a++);else break;for(let e=0;e<l.length;e++)l[e].to<=s&&l.splice(e--,1);for(;r<i.length&&i[r].from<=s&&i[r].to>s;)l.push(i[r++]);let f=s+p.nodeSize;if(p.isText){let e=f;r<i.length&&i[r].from<e&&(e=i[r].from);for(let t=0;t<l.length;t++)l[t].to<e&&(e=l[t].to);e<f&&(d=p.cut(e-s),p=p.cut(0,e-s),f=e,u=-1)}else for(;r<i.length&&i[r].to<f;)r++;let m=p.isInline&&!p.isLeaf?l.filter(e=>!e.inline):l.slice();n(p,m,t.forChild(s,p),u),s=f}})(this.node,this.innerDeco,(t,s,r)=>{t.spec.marks?d.syncToMarks(t.spec.marks,o,e,s):t.type.side>=0&&!r&&d.syncToMarks(s==this.node.childCount?i.vc.none:this.node.child(s).marks,o,e,s),d.placeWidget(t,e,n)},(t,i,r,a)=>{let c;d.syncToMarks(t.marks,o,e,a),d.findNodeMatch(t,i,r,a)||l&&e.state.selection.from>n&&e.state.selection.to<n+t.nodeSize&&(c=d.findIndexWithChild(s.node))>-1&&d.updateNodeAt(t,i,r,c,e)||d.updateNextNode(t,i,r,e,a,n)||d.addNode(t,i,r,e,n),n+=t.nodeSize}),d.syncToMarks([],o,e,0),this.node.isTextblock&&d.addTextblockHacks(),d.destroyRest(),(d.changed||2==this.dirty)&&(r&&this.protectLocalComposition(e,r),function renderDescs(e,t,o){let n=e.firstChild,i=!1;for(let s=0;s<t.length;s++){let r=t[s],l=r.dom;if(l.parentNode==e){for(;l!=n;)n=rm(n),i=!0;n=n.nextSibling}else i=!0,e.insertBefore(l,n);if(r instanceof MarkViewDesc){let t=n?n.previousSibling:e.lastChild;renderDescs(r.contentDOM,r.children,o),n=t?t.nextSibling:e.firstChild}}for(;n;)n=rm(n),i=!0;i&&o.trackWrites==e&&(o.trackWrites=null)}(this.contentDOM,this.children,e),w&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:o,to:i}=e.state.selection;if(!(e.state.selection instanceof n.Bs)||o<t||i>t+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(!this.node.inlineContent)return{node:s,pos:-1,text:""};{let e=s.nodeValue,n=function(e,t,o,n){for(let i=0,s=0;i<e.childCount&&s<=n;){let r=e.child(i++),l=s;if(s+=r.nodeSize,!r.isText)continue;let d=r.text;for(;i<e.childCount;){let t=e.child(i++);if(s+=t.nodeSize,!t.isText)break;d+=t.text}if(s>
1=o){if(s>=n&&d.slice(n-t.length-l,n-l)==t)return n-t.length;let e=l<n?d.lastIndexOf(t,n-l-1):-1;if(e>=0&&e+t.length+l>=o)return l+e;if(o==n&&d.length>=n+t.length-l&&d.slice(n-l,n-l+t.length)==t)return n}}return -1}(this.node.content,e,o-t,i-t);return n<0?null:{node:s,pos:n,text:e}}}protectLocalComposition(e,{node:t,pos:o,text:n}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new CompositionViewDesc(this,i,t,n);e.input.compositionNodes.push(s),this.children=replaceNodes(this.children,o,o+n.length,e,s)}update(e,t,o,n){return!!(3!=this.dirty&&e.sameMarkup(this.node))&&(this.updateInner(e,t,o,n),!0)}updateInner(e,t,o,n){this.updateOuterDeco(t),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(n,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(sameOuterDeco(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,o=this.dom;this.dom=patchOuterDeco(this.dom,this.nodeDOM,computeOuterDeco(this.outerDeco,this.node,t),computeOuterDeco(e,this.node,t)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}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 docViewDesc(e,t,o,n,i){applyOuterDeco(n,t,e);let s=new NodeViewDesc(void 0,e,t,o,n,n,n,i,0);return s.contentDOM&&s.updateChildren(i,0),s}let TextViewDesc=class TextViewDesc extends NodeViewDesc{constructor(e,t,o,n,i,s,r){super(e,t,o,n,i,null,s,r,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,o,n){return!!(3!=this.dirty&&(0==this.dirty||this.inParent())&&e.sameMarkup(this.node))&&(this.updateOuterDeco(t),(0!=this.dirty||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,n.trackWrites==this.nodeDOM&&(n.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,o){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,o)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,o){let n=this.node.cut(e,t),i=document.createTextNode(n.text);return new TextViewDesc(this.parent,n,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(0==e||t==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}};let TrailingHackViewDesc=class TrailingHackViewDesc extends ViewDesc{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}};let CustomNodeViewDesc=class CustomNodeViewDesc extends NodeViewDesc{constructor(e,t,o,n,i,s,r,l,d,a){super(e,t,o,n,i,s,r,d,a),this.spec=l}update(e,t,o,n){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,o);return i&&this.updateInner(e,t,o,n),i}return(!!this.contentDOM||!!e.isLeaf)&&super.update(e,t,o,n)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,o,n){this.spec.setSelection?this.spec.setSelection(e,t,o.root):super.setSelection(e,t,o,n)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};let OuterDecoLevel=function(e){e&&(this.nodeName=e)};OuterDecoLevel.prototype=Object.create(null);let A=[new OuterDecoLevel];function computeOuterDeco(e,t,o){if(0==e.length)return A;let n=o?A[0]:new OuterDecoLevel,i=[n];for(let s=0;s<e.length;
1s++){let r=e[s].type.attrs;if(r)for(let e in r.nodeName&&i.push(n=new OuterDecoLevel(r.nodeName)),r){let s=r[e];null!=s&&(o&&1==i.length&&i.push(n=new OuterDecoLevel(t.isInline?"span":"div")),"class"==e?n.class=(n.class?n.class+" ":"")+s:"style"==e?n.style=(n.style?n.style+";":"")+s:"nodeName"!=e&&(n[e]=s))}}return i}function patchOuterDeco(e,t,o,n){if(o==A&&n==A)return t;let i=t;for(let t=0;t<n.length;t++){let s=n[t],r=o[t];if(t){let t;r&&r.nodeName==s.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==s.nodeName||((t=document.createElement(s.nodeName)).pmIsDeco=!0,t.appendChild(i),r=A[0]),i=t}!function(e,t,o){for(let n in t)"class"==n||"style"==n||"nodeName"==n||n in o||e.removeAttribute(n);for(let n in o)"class"!=n&&"style"!=n&&"nodeName"!=n&&o[n]!=t[n]&&e.setAttribute(n,o[n]);if(t.class!=o.class){let n=t.class?t.class.split(" ").filter(Boolean):[],i=o.class?o.class.split(" ").filter(Boolean):[];for(let t=0;t<n.length;t++)-1==i.indexOf(n[t])&&e.classList.remove(n[t]);for(let t=0;t<i.length;t++)-1==n.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=o.style){if(t.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,n;for(;n=o.exec(t.style);)e.style.removeProperty(n[1])}o.style&&(e.style.cssText+=o.style)}}(i,r||A[0],s)}return i}function applyOuterDeco(e,t,o){return patchOuterDeco(e,e,A,computeOuterDeco(t,o,1!=e.nodeType))}function sameOuterDeco(e,t){if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].type.eq(t[o].type))return!1;return!0}function rm(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}let ViewTreeUpdater=class ViewTreeUpdater{constructor(e,t,o){this.lock=t,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let o=t,n=o.children.length,i=e.childCount,s=new Map,r=[];e:for(;i>0;){let l;for(;;)if(n){let e=o.children[n-1];if(e instanceof MarkViewDesc)o=e,n=e.children.length;else{l=e,n--;break}}else if(o==t)break e;else n=o.parent.children.indexOf(o),o=o.parent;let d=l.node;if(d){if(d!=e.child(i-1))break;--i,s.set(l,i),r.push(l)}}return{index:i,matched:s,matches:r.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let o=e;o<t;o++)this.top.children[o].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,o,n){let i=0,s=this.stack.length>>1,r=Math.min(s,e.length);for(;i<r&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&!1!==e[i].type.spec.spanning;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let i=-1,r=this.top.children.length;n<this.preMatch.index&&(r=Math.min(this.index+3,r));for(let t=this.index;t<r;t++){let o=this.top.children[t];if(o.matchesMark(e[s])&&!this.isLocked(o.dom)){i=t;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let n=MarkViewDesc.create(this.top,e[s],t,o);this.top.children.splice(this.index,0,n),this.top=n,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,o,n){let i=-1,s;if(n>=this.preMatch.index&&(s=this.preMatch.matches[n-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,o))i=this.top.children.indexOf(s,this.index);else for(let n=this.index,s=Math.min(this.top.children.length,n+5);n<s;n++){let s=this.top.children[n];if(s.matchesNode(e,t,o)&&!this.preMatch.matched.has(s)){i=n;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,o,n,i){let s=this.top.children[n];return 3==s.dirty&&s.dom==s.contentDOM&&(s.dirty=2),!!s.update(e,t,o,i)&&(this.destroyBetween(this.index,n),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return -1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return -1}e=t}}updateNextNode(e,t,o,n,i,s){for(let r=this.index;r<this.top.children.length;r++){let l=this.top.children[r];if(l instanceof NodeViewDesc){let d=this.preMatch.matched.get(l);if(null!=d&&d!=i)return!1;let a=l.dom,c,h=this.isLocked(a)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&3!=l.dirty&&sameOuterDeco(t,l.outerDeco));if(!h&&l.update(e,t,o,n))return this.destroyBetween(this.index,r),l.dom!=a&&(this.changed=!0),this.index++,!0;if(!h&&(c=this.recreateWrapper(l,e,t,o,n,s)))return this.destroyBetween(this.index,r),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(n,s+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,o,n,i,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!sameOuterDeco(o,e.outerDeco)||!n.eq(e.innerDeco))return null;let r=NodeViewDesc.create(this.top,t,o,n,i,s);if(r.contentDOM)for(let t of(r.children=e.children,e.children=[],r.children))t.parent=r;return e.destroy(),r}addNode(e,t,o,n,i){let s=NodeViewDesc.create(this.top,e,t,o,n,i);s.contentDOM&&s.updateChildren(n,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,o){let n=this.index<this.top.children.length?this.top.children[this.index]:null;if(n&&n.matchesWidget(e)&&(e==n.widget||!n.widget.type.toDOM.parentNode))this.index++;else{let n=new WidgetViewDesc(this.top,e,t,o);this.top.children.splice(this.index++,0,n),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof MarkViewDesc;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof TextViewDesc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((v||b)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);"IMG"==e&&(o.className="ProseMirror-separator",o.alt=""),"BR"==e&&(
1o.className="ProseMirror-trailingBreak");let n=new TrailingHackViewDesc(this.top,[],o,null);t!=this.top?t.children.push(n):t.children.splice(this.index++,0,n),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}};function compareSide(e,t){return e.type.side-t.type.side}function replaceNodes(e,t,o,n,i){let s=[];for(let r=0,l=0;r<e.length;r++){let d=e[r],a=l,c=l+=d.size;a>=o||c<=t?s.push(d):(a<t&&s.push(d.slice(0,t-a,n)),i&&(s.push(i),i=void 0),c>o&&s.push(d.slice(o-a,d.size,n)))}return s}function selectionFromDOM(e,t=null){let o=e.domSelectionRange(),i=e.state.doc;if(!o.focusNode)return null;let s=e.docView.nearestDesc(o.focusNode),r=s&&0==s.size,l=e.docView.posFromDOM(o.focusNode,o.focusOffset,1);if(l<0)return null;let d=i.resolve(l),a,c;if(selectionCollapsed(o)){for(a=l;s&&!s.node;)s=s.parent;let e=s.node;if(s&&e.isAtom&&n.qv.isSelectable(e)&&s.parent&&!(e.isInline&&function(e,t,o){for(let n=0==t,i=t==nodeSize(e);n||i;){if(e==o)return!0;let t=domIndex(e);if(!(e=e.parentNode))return!1;n=n&&0==t,i=i&&t==nodeSize(e)}}(o.focusNode,o.focusOffset,s.dom))){let e=s.posBefore;c=new n.qv(l==e?d:i.resolve(e))}}else{if(o instanceof e.dom.ownerDocument.defaultView.Selection&&o.rangeCount>1){let t=l,n=l;for(let i=0;i<o.rangeCount;i++){let s=o.getRangeAt(i);t=Math.min(t,e.docView.posFromDOM(s.startContainer,s.startOffset,1)),n=Math.max(n,e.docView.posFromDOM(s.endContainer,s.endOffset,-1))}if(t<0)return null;[a,l]=n==e.state.selection.anchor?[n,t]:[t,n],d=i.resolve(l)}else a=e.docView.posFromDOM(o.anchorNode,o.anchorOffset,1);if(a<0)return null}let h=i.resolve(a);if(!c){let o="pointer"==t||e.state.selection.head<d.pos&&!r?1:-1;c=selectionBetween(e,h,d,o)}return c}function editorOwnsSelection(e){return e.editable?e.hasFocus():hasSelection(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function selectionToDOM(e,t=!1){let o=e.state.selection;if(syncNodeSelection(e,o),editorOwnsSelection(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&b){let t=e.domSelectionRange(),o=e.domObserver.currentSelection;if(t.anchorNode&&o.anchorNode&&isEquivalentPosition(t.anchorNode,t.anchorOffset,o.anchorNode,o.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let o=e.cursorWrapper.dom,n="IMG"==o.nodeName;n?t.collapse(o.parentNode,domIndex(o)+1):t.collapse(o,0),!n&&!e.state.selection.visible&&f&&m<=11&&(o.disabled=!0,o.disabled=!1)}(e);else{let i,s,r,l,{anchor:d,head:a}=o,c,h;!R||o instanceof n.Bs||(o.$from.parent.inlineContent||(c=temporarilyEditableNear(e,o.from)),o.empty||o.$from.parent.inlineContent||(h=temporarilyEditableNear(e,o.to))),e.docView.setSelection(d,a,e,t),R&&(c&&resetEditable(c),h&&resetEditable(h)),o.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((i=e.dom.ownerDocument).removeEventListener("selectionchange",e.input.hideSelectionGuard),r=(s=e.domSelectionRange()).anchorNode,l=s.anchorOffset,i.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>
1{(s.anchorNode!=r||s.anchorOffset!=l)&&(i.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!editorOwnsSelection(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}let R=v||b&&D<63;function temporarilyEditableNear(e,t){let{node:o,offset:n}=e.docView.domFromPos(t,0),i=n<o.childNodes.length?o.childNodes[n]:null,s=n?o.childNodes[n-1]:null;if(v&&i&&"false"==i.contentEditable)return setEditable(i);if((!i||"false"==i.contentEditable)&&(!s||"false"==s.contentEditable)){if(i)return setEditable(i);if(s)return setEditable(s)}}function setEditable(e){return e.contentEditable="true",v&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function resetEditable(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function syncNodeSelection(e,t){if(t instanceof n.qv){let o=e.docView.descAt(t.from);o!=e.lastSelectedViewDesc&&(clearNodeSelection(e),o&&o.selectNode(),e.lastSelectedViewDesc=o)}else clearNodeSelection(e)}function clearNodeSelection(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function selectionBetween(e,t,o,i){return e.someProp("createSelectionBetween",n=>n(e,t,o))||n.Bs.between(t,o,i)}function hasFocusAndSelection(e){return(!e.editable||!!e.hasFocus())&&hasSelection(e)}function hasSelection(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function moveSelectionBlock(e,t){let{$anchor:o,$head:i}=e.selection,s=t>0?o.max(i):o.min(i),r=s.parent.inlineContent?s.depth?e.doc.resolve(t>0?s.after():s.before()):null:s;return r&&n.Y1.findFrom(r,t)}function apply(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function selectHorizontally(e,t,o){let i=e.state.selection;if(i instanceof n.Bs){if(o.indexOf("s")>-1){let{$head:o}=i,s=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let r=e.state.doc.resolve(o.pos+s.nodeSize*(t<0?-1:1));return apply(e,new n.Bs(i.$anchor,r))}if(!i.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let o=moveSelectionBlock(e.state,t);return!!o&&o instanceof n.qv&&apply(e,o)}if(!(S&&o.indexOf("m")>-1)){let o=i.$head,s=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter,r;if(!s||s.isText)return!1;let l=t<0?o.pos-s.nodeSize:o.pos;return!!(s.isAtom||(r=e.docView.descAt(l))&&!r.contentDOM)&&(n.qv.isSelectable(s)?apply(e,new n.qv(t<0?e.state.doc.resolve(o.pos-s.nodeSize):o)):!!C&&apply(e,new n.Bs(e.state.doc.resolve(t<0?l:l+s.nodeSize))))}}else{if(i instanceof n.qv&&i.node.isInline)return apply(e,new n.Bs(t>0?i.$to:i.$from));let o=moveSelectionBlock(e.state,t);return!!o&&apply(e,o)}}function nodeLen(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function isIgnorable(e,t){let o=e.pmViewDesc;return o&&0==o.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function skipIgnoredNodes(e,t){return t<0?function(e){let t=e.domSelectionRange(),o=t.focusNode,n=t.focusOffset;if(!o)return;let i,s,r=!1;for(g&&1==o.nodeType&&n<nodeLen(o)&&isIgnorable(o.childNodes[n],-1)&&(r=!0);;)if(n>0){if(1!=o.nodeType)break;{let e=o.childNodes[n-1];if(isIgnorable(e,-1))i=o,s=--n;else if(3==e.nodeType)n=(o=e).nodeValue.length;else break}}else if(isBlockNode(o))break;else{let t=o.previousSibling;for(;t&&isIgnorable(t,-1);)i=o.parentNode,s=domIndex(t),t=t.previousSibling;if(t)n=nodeLen(o=t);else{if((o=o.parentNode)==e.dom)break;n=0}}r?setSelFocus(e,o,n):i&&setSelFocus(e,i,s)}(e):function(e){let t,o,n=e.domSelectionRange(),i=n.focusNode,s=n.focusOffset;if(!i)return;let r=nodeLen(i);for(;;)if(s<r){if(1!=i.nodeType)break;if(isIgnorable(i.childNodes[s],1))t=i,o=++s;else break}else if(isBlockNode(i))break;else{let n=i.nextSibling;for(;n&&isIgnorable(n,1);)t=n.parentNode,o=domIndex(n)+1,n=n.nextSibling;if(n)s=0,r=nodeLen(i=n);else{if((i=i.parentNode)==e.dom)break;s=r=0}}t&&setSelFocus(e,t,o)}(e)}function isBlockNode(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function setSelFocus(e,t,o){if(3!=t.nodeType){let e,n;(n=function(e,t){for(;e&&t==e.childNodes.length&&!hasBlockDesc(e);)t=domIndex(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let o=e.childNodes[t];
1if(3==o.nodeType)return o;if(1==o.nodeType&&"false"==o.contentEditable)break;e=o,t=0}}(t,o))?(t=n,o=0):(e=function(e,t){for(;e&&!t&&!hasBlockDesc(e);)t=domIndex(e),e=e.parentNode;for(;e&&t;){let o=e.childNodes[t-1];if(3==o.nodeType)return o;if(1==o.nodeType&&"false"==o.contentEditable)break;t=(e=o).childNodes.length}}(t,o))&&(t=e,o=e.nodeValue.length)}let n=e.domSelection();if(!n)return;if(selectionCollapsed(n)){let e=document.createRange();e.setEnd(t,o),e.setStart(t,o),n.removeAllRanges(),n.addRange(e)}else n.extend&&n.extend(t,o);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&selectionToDOM(e)},50)}function findDirection(e,t){let o=e.state.doc.resolve(t);if(!(b||N)&&o.parent.inlineContent){let n=e.coordsAtPos(t);if(t>o.start()){let o=e.coordsAtPos(t-1),i=(o.top+o.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(o.left-n.left)>1)return o.left<n.left?"ltr":"rtl"}if(t<o.end()){let o=e.coordsAtPos(t+1),i=(o.top+o.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(o.left-n.left)>1)return o.left>n.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function selectVertically(e,t,o){let i=e.state.selection;if(i instanceof n.Bs&&!i.empty||o.indexOf("s")>-1||S&&o.indexOf("m")>-1)return!1;let{$from:s,$to:r}=i;if(!s.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let o=moveSelectionBlock(e.state,t);if(o&&o instanceof n.qv)return apply(e,o)}if(!s.parent.inlineContent){let o=t<0?s:r,l=i instanceof n.C1?n.Y1.near(o,t):n.Y1.findFrom(o,t);return!!l&&apply(e,l)}return!1}function stopNativeHorizontalDelete(e,t){if(!(e.state.selection instanceof n.Bs))return!0;let{$head:o,$anchor:i,empty:s}=e.state.selection;if(!o.sameParent(i))return!0;if(!s)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let r=!o.textOffset&&(t<0?o.nodeBefore:o.nodeAfter);if(r&&!r.isText){let n=e.state.tr;return t<0?n.delete(o.pos-r.nodeSize,o.pos):n.delete(o.pos,o.pos+r.nodeSize),e.dispatch(n),!0}return!1}function switchEditable(e,t,o){e.domObserver.stop(),t.contentEditable=o,e.domObserver.start()}function serializeForClipboard(e,t){e.someProp("transformCopied",o=>{t=o(t,e)});let o=[],{content:n,openStart:s,openEnd:r}=t;for(;s>1&&r>1&&1==n.childCount&&1==n.firstChild.childCount;){s--,r--;let e=n.firstChild;o.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),n=e.content}let l=e.someProp("clipboardSerializer")||i.PW.fromSchema(e.state.schema),d=detachedDoc(),a=d.createElement("div");a.appendChild(l.serializeFragment(n,{document:d}));let c=a.firstChild,h,p=0;for(;c&&1==c.nodeType&&(h=I[c.nodeName.toLowerCase()]);){for(let e=h.length-1;e>=0;e--){let t=d.createElement(h[e]);for(;a.firstChild;)t.appendChild(a.firstChild);a.appendChild(t),p++}c=a.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${s} ${r}${p?` -${p}`:""} ${JSON.stringify(o)}`),{dom:a,text:e.someProp("clipboardTextSerializer",o=>o(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function parseFromClipboard(e,t,o,n,s){let r,l,d=s.parent.type.spec.code;if(!o&&!t)return null;let a=!!t&&(n||d||!o);if(a){if(e.someProp("transformPastedText",o=>{t=o(t,d||n,e)}),d)return l=new i.p2(i.HY.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{l=t(l,e,!0)}),l;let o=e.someProp("clipboardTextParser",o=>o(t,s,n,e));if(o)l=o;else{let o=s.marks(),{schema:n}=e.state,l=i.PW.fromSchema(n);r=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=r.appendChild(document.createElement("p"));e&&t.appendChild(l.serializeNode(n.text(e,o)))})}}else e.someProp("transformPastedHTML",t=>{o=t(o,e)}),r=function(e){var t;let o,n=/^(\s*<meta [^>]*>)*/.exec(e);n&&(e=e.slice(n[0].length));let i=detachedDoc().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(e),r;if((r=s&&I[s[1].toLowerCase()])&&(e=r.map(e=>"<"+e+">").join("")+e+r.map(e=>"</"+e+">").reverse().join("")),i.innerHTML=(t=e,(o=window.trustedTypes)?(F||(F=o.defaultPolicy||o.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),F.createHTML(t)):t),r)for(let e=0;e<r.length;e++)i=i.querySelector(r[e])||i;return i}(o),C&&function(e){let t=e.querySelectorAll(b?"span:not([class]):not
1([style])":"span.Apple-converted-space");for(let o=0;o<t.length;o++){let n=t[o];1==n.childNodes.length&&"\xa0"==n.textContent&&n.parentNode&&n.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),n)}}(r);let c=r&&r.querySelector("[data-pm-slice]"),h=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(h&&h[3])for(let e=+h[3];e>0;e--){let e=r.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;r=e}if(l||(l=(e.someProp("clipboardParser")||e.someProp("domParser")||i.aw.fromSchema(e.state.schema)).parseSlice(r,{preserveWhitespace:!!(a||h),context:s,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||B.test(e.parentNode.nodeName)?null:{ignore:!0}})),h)l=function(e,t){if(!e.size)return e;let o=e.content.firstChild.type.schema,n;try{n=JSON.parse(t)}catch(t){return e}let{content:s,openStart:r,openEnd:l}=e;for(let e=n.length-2;e>=0;e-=2){let t=o.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;s=i.HY.from(t.create(n[e+1],s)),r++,l++}return new i.p2(s,r,l)}(closeSlice(l,+h[1],+h[2]),h[4]);else if((l=i.p2.maxOpen(function(e,t){if(e.childCount<2)return e;for(let o=t.depth;o>=0;o--){let n=t.node(o).contentMatchAt(t.index(o)),s,r=[];if(e.forEach(e=>{if(!r)return;let t=n.findWrapping(e.type),o;if(!t)return r=null;if(o=r.length&&s.length&&function addToSibling(e,t,o,n,s){if(s<e.length&&s<t.length&&e[s]==t[s]){let r=addToSibling(e,t,o,n.lastChild,s+1);if(r)return n.copy(n.content.replaceChild(n.childCount-1,r));if(n.contentMatchAt(n.childCount).matchType(s==e.length-1?o.type:e[s+1]))return n.copy(n.content.append(i.HY.from(withWrappers(o,e,s+1))))}}(t,s,e,r[r.length-1],0))r[r.length-1]=o;else{r.length&&(r[r.length-1]=function closeRight(e,t){if(0==t)return e;let o=e.content.replaceChild(e.childCount-1,closeRight(e.lastChild,t-1)),n=e.contentMatchAt(e.childCount).fillBefore(i.HY.empty,!0);return e.copy(o.append(n))}(r[r.length-1],s.length));let o=withWrappers(e,t);r.push(o),n=n.matchType(o.type),s=t}}),r)return i.HY.from(r)}return e}(l.content,s),!0)).openStart||l.openEnd){let e=0,t=0;for(let t=l.content.firstChild;e<l.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=l.content.lastChild;t<l.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);l=closeSlice(l,e,t)}return e.someProp("transformPasted",t=>{l=t(l,e,a)}),l}let B=/^(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 withWrappers(e,t,o=0){for(let n=t.length-1;n>=o;n--)e=t[n].create(null,i.HY.from(e));return e}function closeRange(e,t,o,n,s,r){let l=t<0?e.firstChild:e.lastChild,d=l.content;return e.childCount>1&&(r=0),s<n-1&&(d=closeRange(d,t,o,n,s+1,r)),s>=o&&(d=t<0?l.contentMatchAt(0).fillBefore(d,r<=s).append(d):d.append(l.contentMatchAt(l.childCount).fillBefore(i.HY.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,l.copy(d))}function closeSlice(e,t,o){return t<e.openStart&&(e=new i.p2(closeRange(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),o<e.openEnd&&(e=new i.p2(closeRange(e.content,1,o,e.openEnd,0,0),e.openStart,o)),e}let I={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},z=null;function detachedDoc(){return z||(z=document.implementation.createHTMLDocument("title"))}let F=null,L={},q={},H={touchstart:!0,touchmove:!0};let InputState=class InputState{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 setSelectionOrigin(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ensureListeners(e){e.someProp("handleDOMEvents",t=>{for(let o in t)e.input.eventHandlers[o]||e.dom.addEventListener(o,e.input.eventHandlers[o]=t=>runCustomHandler(e,t))})}function runCustomHandler(e,t){return e.someProp("handleDOMEvents",o=>{let n=o[t.type];return!!n&&(n(e,t)||t.defaultPrevented)})}function eventCoords(e){return{left:e.clientX,top:e.clientY}}function runHandlerOnContext(e,t,o,n,i){if(-1==n)return!1;let s=e.state.doc.resolve(n);for(let n=s.depth+1;n>0;n--)if(e.someProp(t,t=>n>s.depth?t(e,o,s.nodeAfter,s.before(n),i,!0):t(e,o,s.node(n),s.before(n),i,!1)))return!0;return!1}function updateSelection(e,t,o){if(e.focused||e.focus(),e.state.selection.eq(t))return;let n=e.state.tr.setSelection(t);"pointer"==o&&n.setMeta("pointer",!0),e.dispatch(n)}q.keydown=(e,t)=>{if(e.input.shiftKey=16==t.keyCode||t.shiftKey,!inOrNearComposition(e,t)&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!O||!b||13!=t.keyCode)){if(229!=t.keyCode&&e.domObserver.forceFlush(),!w||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",o=>o(e,t))||function(e,t){let o;let n=t.keyCode,i=(o="",t.ctrlKey&&(o+="c"),t.metaKey&&(o+="m"),t.altKey&&
1(o+="a"),t.shiftKey&&(o+="s"),o);if(8==n||S&&72==n&&"c"==i)return stopNativeHorizontalDelete(e,-1)||skipIgnoredNodes(e,-1);if(46==n&&!t.shiftKey||S&&68==n&&"c"==i)return stopNativeHorizontalDelete(e,1)||skipIgnoredNodes(e,1);if(13==n||27==n)return!0;if(37==n||S&&66==n&&"c"==i){let t=37==n?"ltr"==findDirection(e,e.state.selection.from)?-1:1:-1;return selectHorizontally(e,t,i)||skipIgnoredNodes(e,t)}if(39==n||S&&70==n&&"c"==i){let t=39==n?"ltr"==findDirection(e,e.state.selection.from)?1:-1:1;return selectHorizontally(e,t,i)||skipIgnoredNodes(e,t)}if(38==n||S&&80==n&&"c"==i)return selectVertically(e,-1,i)||skipIgnoredNodes(e,-1);if(40==n||S&&78==n&&"c"==i)return function(e){if(!v||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:o}=e.domSelectionRange();if(t&&1==t.nodeType&&0==o&&t.firstChild&&"false"==t.firstChild.contentEditable){let o=t.firstChild;switchEditable(e,o,"true"),setTimeout(()=>switchEditable(e,o,"false"),20)}return!1}(e)||selectVertically(e,1,i)||skipIgnoredNodes(e,1);else if(i==(S?"m":"c")&&(66==n||73==n||89==n||90==n))return!0;return!1}(e,t)?t.preventDefault():setSelectionOrigin(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,keyEvent(13,"Enter"))),e.input.lastIOSEnter=0)},200)}}},q.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},q.keypress=(e,t)=>{if(inOrNearComposition(e,t)||!t.charCode||t.ctrlKey&&!t.altKey||S&&t.metaKey)return;if(e.someProp("handleKeyPress",o=>o(e,t))){t.preventDefault();return}let o=e.state.selection;if(!(o instanceof n.Bs)||!o.$from.sameParent(o.$to)){let n=String.fromCharCode(t.charCode),deflt=()=>e.state.tr.insertText(n).scrollIntoView();/[\r\n]/.test(n)||e.someProp("handleTextInput",t=>t(e,o.$from.pos,o.$to.pos,n,deflt))||e.dispatch(deflt()),t.preventDefault()}};let W=S?"metaKey":"ctrlKey";L.mousedown=(e,t)=>{var o;let i,s;e.input.shiftKey=t.shiftKey;let r=endComposition(e),l=Date.now(),d="singleClick";l-e.input.lastClick.time<500&&(i=(o=e.input.lastClick).x-t.clientX)*i+(s=o.y-t.clientY)*s<100&&!t[W]&&e.input.lastClick.button==t.button&&("singleClick"==e.input.lastClick.type?d="doubleClick":"doubleClick"==e.input.lastClick.type&&(d="tripleClick")),e.input.lastClick={time:l,x:t.clientX,y:t.clientY,type:d,button:t.button};let a=e.posAtCoords(eventCoords(t));a&&("singleClick"==d?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new MouseDown(e,a,t,!!r)):("doubleClick"==d?function(e,t,o,n){return runHandlerOnContext(e,"handleDoubleClickOn",t,o,n)||e.someProp("handleDoubleClick",o=>o(e,t,n))}:function(e,t,o,i){return runHandlerOnContext(e,"handleTripleClickOn",t,o,i)||e.someProp("handleTripleClick",o=>o(e,t,i))||function(e,t,o){if(0!=o.button)return!1;let i=e.state.doc;if(-1==t)return!!i.inlineContent&&(updateSelection(e,n.Bs.create(i,0,i.content.size),"pointer"),!0);let s=i.resolve(t);for(let t=s.depth+1;t>0;t--){let o=t>s.depth?s.nodeAfter:s.node(t),r=s.before(t);if(o.inlineContent)updateSelection(e,n.Bs.create(i,r+1,r+1+o.content.size),"pointer");else{if(!n.qv.isSelectable(o))continue;updateSelection(e,n.qv.create(i,r),"pointer")}return!0}}(e,o,i)})(e,a.pos,a.inside,t)?t.preventDefault():setSelectionOrigin(e,"pointer"))};let MouseDown=class MouseDown{constructor(e,t,o,i){let s,r;if(this.view=e,this.pos=t,this.event=o,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[W],this.allowDefault=o.shiftKey,t.inside>-1)s=e.state.doc.nodeAt(t.inside),r=t.inside;else{let o=e.state.doc.resolve(t.pos);s=o.parent,r=o.depth?o.before():0}let l=i?null:o.target,d=l?e.docView.nearestDesc(l,!0):null;this.target=d&&1==d.nodeDOM.nodeType?d.nodeDOM:null;let{selection:a}=e.state;0==o.button&&(s.type.spec.draggable&&!1!==s.type.spec.selectable||a instanceof n.qv&&a.from<=r&&a.to>r)&&(this.mightDrag={node:s,pos:r,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&g&&!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()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),setSelectionOrigin(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),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(()=>selectionToDOM(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;if(this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(eventCoords(e))),this.updateAllowDefault(e),this.allowDefault||!t)setSelectionOrigin(this.view,"pointer");else{var o,i,s,r;
1(o=this.view,i=t.pos,s=t.inside,r=this.selectNode,runHandlerOnContext(o,"handleClickOn",i,s,e)||o.someProp("handleClick",t=>t(o,i,e))||(r?function(e,t){if(-1==t)return!1;let o=e.state.selection,i,s;o instanceof n.qv&&(i=o.node);let r=e.state.doc.resolve(t);for(let e=r.depth+1;e>0;e--){let t=e>r.depth?r.nodeAfter:r.node(e);if(n.qv.isSelectable(t)){s=i&&o.$from.depth>0&&e>=o.$from.depth&&r.before(o.$from.depth+1)==o.$from.pos?r.before(o.$from.depth):r.before(e);break}}return null!=s&&(updateSelection(e,n.qv.create(e.state.doc,s),"pointer"),!0)}(o,s):function(e,t){if(-1==t)return!1;let o=e.state.doc.resolve(t),i=o.nodeAfter;return!!(i&&i.isAtom&&n.qv.isSelectable(i))&&(updateSelection(e,new n.qv(o),"pointer"),!0)}(o,s)))?e.preventDefault():0==e.button&&(this.flushed||v&&this.mightDrag&&!this.mightDrag.node.isAtom||b&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to)))?(updateSelection(this.view,n.Y1.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):setSelectionOrigin(this.view,"pointer")}}move(e){this.updateAllowDefault(e),setSelectionOrigin(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};function inOrNearComposition(e,t){return!!e.composing||!!(v&&500>Math.abs(t.timeStamp-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}L.touchstart=e=>{e.input.lastTouch=Date.now(),endComposition(e),setSelectionOrigin(e,"pointer")},L.touchmove=e=>{e.input.lastTouch=Date.now(),setSelectionOrigin(e,"pointer")},L.contextmenu=e=>endComposition(e);let K=O?5e3:-1;function scheduleComposeEnd(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>endComposition(e),t))}function clearComposition(e){let t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function endComposition(e,t=!1){if(!O||!(e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),clearComposition(e),t||e.docView&&e.docView.dirty){let o=selectionFromDOM(e),n=e.state.selection;return o&&!o.eq(n)?e.dispatch(e.state.tr.setSelection(o)):(e.markCursor||t)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}q.compositionstart=q.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,o=t.selection.$to;if(t.selection instanceof n.Bs&&(t.storedMarks||!o.textOffset&&o.parentOffset&&o.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||b&&N&&function(e){let{focusNode:t,focusOffset:o}=e.domSelectionRange();if(!t||1!=t.nodeType||o>=t.childNodes.length)return!1;let n=t.childNodes[o];return 1==n.nodeType&&"false"==n.contentEditable}(e)))e.markCursor=e.state.storedMarks||o.marks(),endComposition(e,!0),e.markCursor=null;else if(endComposition(e,!t.selection.empty),g&&t.selection.empty&&o.parentOffset&&!o.textOffset&&o.nodeBefore.marks.length){let t=e.domSelectionRange();for(let o=t.focusNode,n=t.focusOffset;o&&1==o.nodeType&&0!=n;){let t=n<0?o.lastChild:o.childNodes[n-1];if(!t)break;if(3==t.nodeType){let o=e.domSelection();o&&o.collapse(t,t.nodeValue.length);break}o=t,n=-1}}e.input.composing=!0}scheduleComposeEnd(e,K)},q.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,scheduleComposeEnd(e,20))};let $=f&&m<15||w&&M<604;function doPaste(e,t,o,n,s){let r=parseFromClipboard(e,t,o,n,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,s,r||i.p2.empty)))return!0;if(!r)return!1;let l=0==r.openStart&&0==r.openEnd&&1==r.content.childCount?r.content.firstChild:null,d=l?e.state.tr.replaceSelectionWith(l,n):e.state.tr.replaceSelection(r);return e.dispatch(d.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function getText(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;
1let o=e.getData("text/uri-list");return o?o.replace(/\r?\n/g," "):""}L.copy=q.cut=(e,t)=>{let o=e.state.selection,n="cut"==t.type;if(o.empty)return;let i=$?null:t.clipboardData,{dom:s,text:r}=serializeForClipboard(e,o.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",s.innerHTML),i.setData("text/plain",r)):function(e,t){if(!e.dom.parentNode)return;let o=e.dom.parentNode.appendChild(document.createElement("div"));o.appendChild(t),o.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout(()=>{o.parentNode&&o.parentNode.removeChild(o),e.focus()},50)}(e,s),n&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},q.paste=(e,t)=>{if(e.composing&&!O)return;let o=$?null:t.clipboardData,n=e.input.shiftKey&&45!=e.input.lastKeyCode;o&&doPaste(e,getText(o),o.getData("text/html"),n,t)?t.preventDefault():function(e,t){if(!e.dom.parentNode)return;let o=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,n=e.dom.parentNode.appendChild(document.createElement(o?"textarea":"div"));o||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),n.parentNode&&n.parentNode.removeChild(n),o?doPaste(e,n.value,null,i,t):doPaste(e,n.textContent,n.innerHTML,i,t)},50)}(e,t)};let Dragging=class Dragging{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}};let _=S?"altKey":"ctrlKey";function dragMoves(e,t){let o;return e.someProp("dragCopies",e=>{o=o||e(t)}),null!=o?!o:!t[_]}for(let e in L.dragstart=(e,t)=>{let o;let i=e.input.mouseDown;if(i&&i.done(),!t.dataTransfer)return;let s=e.state.selection,r=s.empty?null:e.posAtCoords(eventCoords(t));if(r&&r.pos>=s.from&&r.pos<=(s instanceof n.qv?s.to-1:s.to));else if(i&&i.mightDrag)o=n.qv.create(e.state.doc,i.mightDrag.pos);else if(t.target&&1==t.target.nodeType){let i=e.docView.nearestDesc(t.target,!0);i&&i.node.type.spec.draggable&&i!=e.docView&&(o=n.qv.create(e.state.doc,i.posBefore))}let l=(o||e.state.selection).content(),{dom:d,text:a,slice:c}=serializeForClipboard(e,l);t.dataTransfer.files.length&&b&&!(D>120)||t.dataTransfer.clearData(),t.dataTransfer.setData($?"Text":"text/html",d.innerHTML),t.dataTransfer.effectAllowed="copyMove",$||t.dataTransfer.setData("text/plain",a),e.dragging=new Dragging(c,dragMoves(e,t),o)},L.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},q.dragover=q.dragenter=(e,t)=>t.preventDefault(),q.drop=(e,t)=>{try{(function(e,t,o){if(!t.dataTransfer)return;let r=e.posAtCoords(eventCoords(t));if(!r)return;let l=e.state.doc.resolve(r.pos),d=o&&o.slice;d?e.someProp("transformPasted",t=>{d=t(d,e,!1)}):d=parseFromClipboard(e,getText(t.dataTransfer),$?null:t.dataTransfer.getData("text/html"),!1,l);let a=!!(o&&dragMoves(e,t));if(e.someProp("handleDrop",o=>o(e,t,d||i.p2.empty,a))){t.preventDefault();return}if(!d)return;t.preventDefault();let c=d?(0,s.nj)(e.state.doc,l.pos,d):l.pos;null==c&&(c=l.pos);let h=e.state.tr;if(a){let{node:e}=o;e?e.replace(h):h.deleteSelection()}let p=h.mapping.map(c),u=0==d.openStart&&0==d.openEnd&&1==d.content.childCount,f=h.doc;if(u?h.replaceRangeWith(p,p,d.content.firstChild):h.replaceRange(p,p,d),h.doc.eq(f))return;let m=h.doc.resolve(p);if(u&&n.qv.isSelectable(d.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(d.content.firstChild))h.setSelection(new n.qv(m));else{let t=h.mapping.map(c);h.mapping.maps[h.mapping.maps.length-1].forEach((e,o,n,i)=>t=i),h.setSelection(selectionBetween(e,m,h.doc.resolve(t)))}e.focus(),e.dispatch(h.setMeta("uiEvent","drop"))})(e,t,e.dragging)}finally{e.dragging=null}},L.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&selectionToDOM(e)},20))},L.blur=(e,t)=>{e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},L.beforeinput=(e,t)=>{if(b&&O&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,keyEvent(8,"Backspace")))))return;let{$cursor:o}=e.state.selection;o&&o.pos>0&&e.dispatch(e.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}},q)L[e]=q[e];function compareObjs(e,t){if(e==t)return!0;for(let o in e)if(e[o]!==t[o])return!1;for(let o in t)if(!(o in e))return!1;return!0}let WidgetType=class WidgetType{constructor(e,t){this.toDOM=e,this.spec=t||Y,this.side=this.spec.side||0}map(e,t,o,n){let{pos:i,deleted:s}=e.mapResult(t.from+n,this.side<0?-1:1);return s?null:new Decoration(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof WidgetType&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&compareObjs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}};let InlineType=class InlineType{constructor(e,t){this.attrs=e,this.spec=t||Y}map(e,t,o,n){let i=e.map(t.from+n,this.spec.inclusiveStart?-1:1)-o,s=e.map(t.to+n,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new Decoration(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof InlineType&&compareObjs(this.attrs,e.attrs)&&compareObjs(this.spec,e.spec)}static is(e){return e.type instanceof InlineType}destroy(){}};let NodeType=class NodeType{constructor(e,t){this.attrs=e,this.spec=t||Y}map(e,t,o,n){let i=e.mapResult(t.from+n,1);if(i.deleted)return null;let s=e.mapResult(t.to+n,-1);return s.deleted||s.pos<=i.pos?null:new Decoration(i.pos-o,s.pos-o,this)}valid(e,t){let{index:o,offset:n}=e.content.findIndex(t.from),i;return n==t.from&&!(i=e.child(o)).isText&&n+i.nodeSize==t.to}eq(e){return this==e||e instanceof NodeType&&compareObjs(this.attrs,e.attrs)&&compareObjs(this.spec,e.spec)}destroy(){}};let Decoration=class Decoration{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new Decoration(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,o){return this.type.map(e,this,t,o)}static widget(e,t,o){return new Decoration(e,e,new WidgetType(t,o))}static inline(e,t,o,n){return new Decoration(e,t,new InlineType(o,n))}
vendor: 4,097 bytes, line 1
1static node(e,t,o,n){return new Decoration(e,t,new NodeType(o,n))}get spec(){return this.type.spec}get inline(){return this.type instanceof InlineType}get widget(){return this.type instanceof WidgetType}};let G=[],Y={};let DecorationSet=class DecorationSet{constructor(e,t){this.local=e.length?e:G,this.children=t.length?t:G}static create(e,t){return t.length?buildTree(t,e,0,Y):j}find(e,t,o){let n=[];return this.findInner(null==e?0:e,null==t?1e9:t,n,0,o),n}findInner(e,t,o,n,i){for(let s=0;s<this.local.length;s++){let r=this.local[s];r.from<=t&&r.to>=e&&(!i||i(r.spec))&&o.push(r.copy(r.from+n,r.to+n))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let r=this.children[s]+1;this.children[s+2].findInner(e-r,t-r,o,n+r,i)}}map(e,t,o){return this==j||0==e.maps.length?this:this.mapInner(e,t,0,0,o||Y)}mapInner(e,t,o,n,i){let s;for(let r=0;r<this.local.length;r++){let l=this.local[r].map(e,o,n);l&&l.type.valid(t,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[r].spec)}return this.children.length?function(e,t,o,n,i,s,r){let l=e.slice();for(let e=0,t=s;e<o.maps.length;e++){let n=0;o.maps[e].forEach((e,o,i,s)=>{let r=s-i-(o-e);for(let i=0;i<l.length;i+=3){let s=l[i+1];if(s<0||e>s+t-n)continue;let d=l[i]+t-n;o>=d?l[i+1]=e<=d?-2:-1:e>=t&&r&&(l[i]+=r,l[i+1]+=r)}n+=r}),t=o.maps[e].map(t,-1)}let d=!1;for(let t=0;t<l.length;t+=3)if(l[t+1]<0){if(-2==l[t+1]){d=!0,l[t+1]=-1;continue}let a=o.map(e[t]+s),c=a-i;if(c<0||c>=n.content.size){d=!0;continue}let h=o.map(e[t+1]+s,-1)-i,{index:p,offset:u}=n.content.findIndex(c),f=n.maybeChild(p);if(f&&u==c&&u+f.nodeSize==h){let n=l[t+2].mapInner(o,f,a+1,e[t]+s+1,r);n!=j?(l[t]=c,l[t+1]=h,l[t+2]=n):(l[t+1]=-2,d=!0)}else d=!0}if(d){let d=buildTree(function(e,t,o,n,i,s,r){for(let l=0;l<e.length;l+=3)-1==e[l+1]&&function gather(e,t){for(let s=0;s<e.local.length;s++){let l=e.local[s].map(n,i,t);l?o.push(l):r.onRemove&&r.onRemove(e.local[s].spec)}for(let o=0;o<e.children.length;o+=3)gather(e.children[o+2],e.children[o]+t+1)}(e[l+2],t[l]+s+1);return o}(l,e,t,o,i,s,r),n,0,r);t=d.local;for(let e=0;e<l.length;e+=3)l[e+1]<0&&(l.splice(e,3),e-=3);for(let e=0,t=0;e<d.children.length;e+=3){let o=d.children[e];for(;t<l.length&&l[t]<o;)t+=3;l.splice(t,0,d.children[e],d.children[e+1],d.children[e+2])}}return new DecorationSet(t.sort(byPos),l)}(this.children,s||[],e,t,o,n,i):s?new DecorationSet(s.sort(byPos),G):j}add(e,t){return t.length?this==j?DecorationSet.create(e,t):this.addInner(e,t,0):this}addInner(e,t,o){let n,i=0;e.forEach((e,s)=>{let r=s+o,l;if(l=takeSpansForNode(t,e,r)){for(n||(n=this.children.slice());i<n.length&&n[i]<s;)i+=3;n[i]==s?n[i+2]=n[i+2].addInner(e,l,r+1):n.splice(i,0,s,s+e.nodeSize,buildTree(l,e,r+1,Y)),i+=3}});let s=moveSpans(i?withoutNulls(t):t,-o);for(let t=0;t<s.length;t++)s[t].type.valid(e,s[t])||s.splice(t--,1);return new DecorationSet(s.length?this.local.concat(s).sort(byPos):this.local,n||this.children)}remove(e){return 0==e.length||this==j?this:this.removeInner(e,0)}removeInner(e,t){let o=this.children,n=this.local;for(let n=0;n<o.length;n+=3){let i;let s=o[n]+t,r=o[n+1]+t;for(let t=0,o;t<e.length;t++)(o=e[t])&&o.from>s&&o.to<r&&(e[t]=null,(i||(i=[])).push(o));if(!i)continue;o==this.children&&(o=this.children.slice());let l=o[n+2].removeInner(i,s+1);l!=j?o[n+2]=l:(o.splice(n,3),n-=3)}if(n.length){for(let o=0,i;o<e.length;o++)if(i=e[o])for(let e=0;e<n.length;e++)n[e].eq(i,t)&&(n==this.local&&(n=this.local.slice()),n.splice(e--,1))}return o==this.children&&n==this.local?this:n.length||o.length?new DecorationSet(n,o):j}forChild(e,t){let o,n;if(this==j)return this;if(t.isLeaf)return DecorationSet.empty;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(o=this.children[t+2]);break}let i=e+1,s=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<s&&t.to>i&&t.type instanceof InlineType){let e=Math.max(i,t.from)-i,o=Math.min(s,t.to)-i;e<o&&(n||(n=[])).push(t.copy(e,o))}}if(n){let e=new DecorationSet(n.sort(byPos),G);return o?new DecorationGroup([e,o]):e}return o||j}eq(e){if(this==e)return!0;
1if(!(e instanceof DecorationSet)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return removeOverlap(this.localsInner(e))}localsInner(e){if(this==j)return G;if(e.inlineContent||!this.local.some(InlineType.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof InlineType||t.push(this.local[e]);return t}forEachSet(e){e(this)}};DecorationSet.empty=new DecorationSet([],[]),DecorationSet.removeOverlap=removeOverlap;let j=DecorationSet.empty;let DecorationGroup=class DecorationGroup{constructor(e){this.members=e}map(e,t){let o=this.members.map(o=>o.map(e,t,Y));return DecorationGroup.from(o)}forChild(e,t){if(t.isLeaf)return DecorationSet.empty;let o=[];for(let n=0;n<this.members.length;n++){let i=this.members[n].forChild(e,t);i!=j&&(i instanceof DecorationGroup?o=o.concat(i.members):o.push(i))}return DecorationGroup.from(o)}eq(e){if(!(e instanceof DecorationGroup)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,o=!0;for(let n=0;n<this.members.length;n++){let i=this.members[n].localsInner(e);if(i.length){if(t){o&&(t=t.slice(),o=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}}return t?removeOverlap(o?t:t.sort(byPos)):G}static from(e){switch(e.length){case 0:return j;case 1:return e[0];default:return new DecorationGroup(e.every(e=>e instanceof DecorationSet)?e:e.reduce((e,t)=>e.concat(t instanceof DecorationSet?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}};function moveSpans(e,t){if(!t||!e.length)return e;let o=[];for(let n=0;n<e.length;n++){let i=e[n];o.push(new Decoration(i.from+t,i.to+t,i.type))}return o}function takeSpansForNode(e,t,o){if(t.isLeaf)return null;let n=o+t.nodeSize,i=null;for(let t=0,s;t<e.length;t++)(s=e[t])&&s.from>o&&s.to<n&&((i||(i=[])).push(s),e[t]=null);return i}function withoutNulls(e){let t=[];for(let o=0;o<e.length;o++)null!=e[o]&&t.push(e[o]);return t}function buildTree(e,t,o,n){let i=[],s=!1;t.forEach((t,r)=>{let l=takeSpansForNode(e,t,r+o);if(l){s=!0;let e=buildTree(l,t,o+r+1,n);e!=j&&i.push(r,r+t.nodeSize,e)}});let r=moveSpans(s?withoutNulls(e):e,-o).sort(byPos);for(let e=0;e<r.length;e++)r[e].type.valid(t,r[e])||(n.onRemove&&n.onRemove(r[e].spec),r.splice(e--,1));return r.length||i.length?new DecorationSet(r,i):j}function byPos(e,t){return e.from-t.from||e.to-t.to}function removeOverlap(e){let t=e;for(let o=0;o<t.length-1;o++){let n=t[o];if(n.from!=n.to)for(let i=o+1;i<t.length;i++){let s=t[i];if(s.from==n.from){s.to!=n.to&&(t==e&&(t=e.slice()),t[i]=s.copy(s.from,n.to),insertAhead(t,i+1,s.copy(n.to,s.to)));continue}s.from<n.to&&(t==e&&(t=e.slice()),t[o]=n.copy(n.from,s.from),insertAhead(t,i,n.copy(s.from,n.to)));break}}return t}function insertAhead(e,t,o){for(;t<e.length&&byPos(o,e[t])>0;)t++;e.splice(t,0,o)}function viewDecorations(e){let t=[];return e.someProp("decorations",o=>{let n=o(e.state);n&&n!=j&&t.push(n)}),e.cursorWrapper&&t.push(DecorationSet.create(e.state.doc,[e.cursorWrapper.deco])),DecorationGroup.from(t)}let U={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},X=f&&m<=11;let SelectionState=class SelectionState{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}};let DOMObserver=class DOMObserver{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new SelectionState,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);f&&m<=11&&t.some(e=>
1"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():v&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),X&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.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,U)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);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(hasFocusAndSelection(this.view)){if(this.suppressingSelectionUpdates)return selectionToDOM(this.view);if(f&&m<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&isEquivalentPosition(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,o;for(let o=e.focusNode;o;o=parentNode(o))t.add(o);for(let n=e.anchorNode;n;n=parentNode(n))if(t.has(n)){o=n;break}let n=o&&this.view.docView.nearestDesc(o);if(n&&n.ignoreMutation({type:"selection",target:3==o.nodeType?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let o=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&hasFocusAndSelection(e)&&!this.ignoreSelectionChange(o),s=-1,r=-1,l=!1,d=[];if(e.editable)for(let e=0;e<t.length;e++){let o=this.registerMutation(t[e],d);o&&(s=s<0?o.from:Math.min(o.from,s),r=r<0?o.to:Math.max(o.to,r),o.typeOver&&(l=!0))}if(d.some(e=>"BR"==e.nodeName)&&(8==e.input.lastKeyCode||46==e.input.lastKeyCode)){for(let e of d)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;for(;t&&1==t.nodeType;){if("false"==t.contentEditable){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(g&&d.length){let t=d.filter(e=>"BR"==e.nodeName);if(2==t.length){let[e,o]=t;e.parentNode&&e.parentNode.parentNode==o.parentNode?o.remove():e.remove()}else{let{focusNode:o}=this.currentSelection;for(let n of t){let t=n.parentNode;t&&"LI"==t.nodeName&&(!o||function(e,t){for(let o=t.parentNode;o&&o!=e.dom;o=o.parentNode){let t=e.docView.nearestDesc(o,!0);if(t&&t.node.isBlock)return o}return null}(e,o)!=t)&&n.remove()}}}let a=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&selectionCollapsed(o)&&(a=selectionFromDOM(e))&&a.eq(n.Y1.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,selectionToDOM(e),this.currentSelection.set(o),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,r),Z.has(e)||(Z.set(e,null),-1===["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))||(e.requiresGeckoHackNode=g,J||(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."),J=!0))),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,function(e,t){var o;let{focusNode:n,focusOffset:i}=e.domSelectionRange();for(let s of t)if((null===(o=s.parentNode)||void 0===o?void 0:o.nodeName)=="TR"){let t=s.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let o=t;for(;;){let e=o.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;o=e}o.insertBefore(s,o.firstChild),n==s&&e.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}(e,d)),this.handleDOMChange(s,r,l,d),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||selectionToDOM(e),this.currentSelection.set(o))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(o==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||
vendor: 4,289 bytes, line 1
1!o||o.ignoreMutation(e))return null;if("childList"==e.type){for(let o=0;o<e.addedNodes.length;o++){let n=e.addedNodes[o];t.push(n),3==n.nodeType&&(this.lastChangedTextNode=n)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let n=e.previousSibling,i=e.nextSibling;if(f&&m<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:o,nextSibling:s}=e.addedNodes[t];(!o||0>Array.prototype.indexOf.call(e.addedNodes,o))&&(n=o),(!s||0>Array.prototype.indexOf.call(e.addedNodes,s))&&(i=s)}let s=n&&n.parentNode==e.target?domIndex(n)+1:0,r=o.localPosFromDOM(e.target,s,-1),l=i&&i.parentNode==e.target?domIndex(i):e.target.childNodes.length;return{from:r,to:o.localPosFromDOM(e.target,l,1)}}return"attributes"==e.type?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}};let Z=new WeakMap,J=!1;function rangeToSelectionRange(e,t){let o=t.startContainer,n=t.startOffset,i=t.endContainer,s=t.endOffset,r=e.domAtPos(e.state.selection.anchor);return isEquivalentPosition(r.node,r.offset,i,s)&&([o,n,i,s]=[i,s,o,n]),{anchorNode:o,anchorOffset:n,focusNode:i,focusOffset:s}}function ruleFromNode(e){let t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(v&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||v&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}let Q=/^(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 resolveSelection(e,t,o){return Math.max(o.anchor,o.head)>t.content.size?null:selectionBetween(e,t.resolve(o.anchor),t.resolve(o.head))}function skipClosingAndOpening(e,t,o){let n=e.depth,i=t?e.end():e.pos;for(;n>0&&(t||e.indexAfter(n)==e.node(n).childCount);)n--,i++,t=!1;if(o){let t=e.node(n).maybeChild(e.indexAfter(n));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function isSurrogatePair(e){if(2!=e.length)return!1;let t=e.charCodeAt(0),o=e.charCodeAt(1);return t>=56320&&t<=57343&&o>=55296&&o<=56319}let EditorView=class EditorView{constructor(e,t){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 InputState,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(checkStateComponent),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=getEditable(this),updateCursorWrapper(this),this.nodeViews=buildNodeViews(this),this.docView=docViewDesc(this.state.doc,computeDocDeco(this),viewDecorations(this),this.dom,this),this.domObserver=new DOMObserver(this,(e,t,o,s)=>(function(e,t,o,s,r){let l,d,a,c=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,o=selectionFromDOM(e,t);if(o&&!e.state.selection.eq(o)){if(b&&O&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,keyEvent(13,"Enter"))))return;let n=e.state.tr.setSelection(o);"pointer"==t?n.setMeta("pointer",!0):"key"==t&&n.scrollIntoView(),c&&n.setMeta("composition",c),e.dispatch(n)}return}let h=e.state.doc.resolve(t),p=h.sharedDepth(o);t=h.before(p+1),o=e.state.doc.resolve(o).after(p+1);let u=e.state.selection,g=function(e,t,o){let n,{node:s,fromOffset:r,toOffset:l,from:d,to:a}=e.docView.parseRange(t,o),c=e.domSelectionRange(),h=c.anchorNode;if(h&&e.dom.contains(1==h.nodeType?h:h.parentNode)&&(n=[{node:h,offset:c.anchorOffset}],selectionCollapsed(c)||n.push({node:c.focusNode,offset:c.focusOffset})),b&&8===e.input.lastKeyCode)for(let e=l;e>r;
1e--){let t=s.childNodes[e-1],o=t.pmViewDesc;if("BR"==t.nodeName&&!o){l=e;break}if(!o||o.size)break}let p=e.state.doc,u=e.someProp("domParser")||i.aw.fromSchema(e.state.schema),f=p.resolve(d),m=null,g=u.parse(s,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:r,to:l,preserveWhitespace:"pre"!=f.parent.type.whitespace||"full",findPositions:n,ruleFromNode,context:f});if(n&&null!=n[0].pos){let e=n[0].pos,t=n[1]&&n[1].pos;null==t&&(t=e),m={anchor:e+d,head:t+d}}return{doc:g,sel:m,from:d,to:a}}(e,t,o),y=e.state.doc,D=y.slice(g.from,g.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,d="end"):(l=e.state.selection.from,d="start"),e.input.lastKeyCode=null;let v=function(e,t,o,n,i){let s=e.findDiffStart(t,o);if(null==s)return null;let{a:r,b:l}=e.findDiffEnd(t,o+e.size,o+t.size);if("end"==i){let e=Math.max(0,s-Math.min(r,l));n-=r+e-s}if(r<s&&e.size<t.size){let e=n<=s&&n>=r?s-n:0;(s-=e)&&s<t.size&&isSurrogatePair(t.textBetween(s-1,s+1))&&(s+=e?1:-1),l=s+(l-r),r=s}else if(l<s){let t=n<=s&&n>=l?s-n:0;(s-=t)&&s<e.size&&isSurrogatePair(e.textBetween(s-1,s+1))&&(s+=t?1:-1),r=s+(r-l),l=s}return{start:s,endA:r,endB:l}}(D.content,g.doc.content,g.from,l,d);if(v&&e.input.domChangeCount++,(w&&e.input.lastIOSEnter>Date.now()-225||O)&&r.some(e=>1==e.nodeType&&!Q.test(e.nodeName))&&(!v||v.endA>=v.endB)&&e.someProp("handleKeyDown",t=>t(e,keyEvent(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!v){if(s&&u instanceof n.Bs&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(g.sel&&g.sel.anchor!=g.sel.head))v={start:u.from,endA:u.to,endB:u.to};else{if(g.sel){let t=resolveSelection(e,e.state.doc,g.sel);if(t&&!t.eq(e.state.selection)){let o=e.state.tr.setSelection(t);c&&o.setMeta("composition",c),e.dispatch(o)}}return}}e.state.selection.from<e.state.selection.to&&v.start==v.endB&&e.state.selection instanceof n.Bs&&(v.start>e.state.selection.from&&v.start<=e.state.selection.from+2&&e.state.selection.from>=g.from?v.start=e.state.selection.from:v.endA<e.state.selection.to&&v.endA>=e.state.selection.to-2&&e.state.selection.to<=g.to&&(v.endB+=e.state.selection.to-v.endA,v.endA=e.state.selection.to)),f&&m<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>g.from&&" \xa0"==g.doc.textBetween(v.start-g.from-1,v.start-g.from+1)&&(v.start--,v.endA--,v.endB--);let S=g.doc.resolveNoCache(v.start-g.from),N=g.doc.resolveNoCache(v.endB-g.from),C=y.resolve(v.start),M=S.sameParent(N)&&S.parent.inlineContent&&C.end()>=v.endA;if((w&&e.input.lastIOSEnter>Date.now()-225&&(!M||r.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!M&&S.pos<g.doc.content.size&&(!S.sameParent(N)||!S.parent.inlineContent)&&S.pos<N.pos&&!/\S/.test(g.doc.textBetween(S.pos,N.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,keyEvent(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>v.start&&function(e,t,o,n,i){if(o-t<=i.pos-n.pos||skipClosingAndOpening(n,!0,!1)<i.pos)return!1;let s=e.resolve(t);if(!n.parent.isTextblock){let e=s.nodeAfter;return null!=e&&o==t+e.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let r=e.resolve(skipClosingAndOpening(s,!0,!0));return!(!r.parent.isTextblock||r.pos>o||skipClosingAndOpening(r,!0,!1)<o)&&n.parent.content.cut(n.parentOffset).eq(r.parent.content)}(y,v.start,v.endA,S,N)&&e.someProp("handleKeyDown",t=>t(e,keyEvent(8,"Backspace")))){O&&b&&e.domObserver.suppressSelectionUpdates();return}b&&v.endB==v.start&&(e.input.lastChromeDelete=Date.now()),O&&!M&&S.start()!=N.start()&&0==N.parentOffset&&S.depth==N.depth&&g.sel&&g.sel.anchor==g.sel.head&&g.sel.head==v.endA&&(v.endB-=2,N=g.doc.resolveNoCache(v.endB-g.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,keyEvent(13,"Enter"))})},20));let k=v.start,T=v.endA,mkTr=t=>{let o=t||e.state.tr.replace(k,T,g.doc.slice(v.start-g.from,v.endB-g.from));if(g.sel){let t=resolveSelection(e,o.doc,g.sel);t&&!(b&&e.composing&&t.empty&&(v.start!=v.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==k||t.head==o.mapping.map(T)-1)||f&&t.empty&&t.head==k)&&o.setSelection(t)}return c&&o.setMeta("composition",c),o.scrollIntoView()};if(M){if(S.pos==N.pos){f&&m<=11&&0==S.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>selectionToDOM(e),20));let t=mkTr(e.state.tr.delete(k,T)),o=y.resolve(v.start).marksAcross(y.resolve(v.endA));o&&t.ensureMarks(o),e.dispatch(t)}else if(v.endA==v.endB&&(a=function(e,t){let o=e.firstChild.marks,n=t.firstChild.marks,s=o,r=n,l,d,a;for(let e=0;e<n.length;e++)s=n[e].removeFromSet(s);for(let e=0;e<o.length;e++)r=o[e].removeFromSet(r);if(1==s.length&&0==r.length)d=s[0],l="add",a=e=>e.mark(d.addToSet(e.marks));else{if(0!=s.length||1!=r.length)return null;d=r[0],l="remove",a=e=>e.mark(d.removeFromSet(e.marks))}let c=[];for(let e=0;e<t.childCount;e++)c.push(a(t.child(e)));if(i.HY.from(c).eq(e))return{mark:d,type:l}}(S.parent.content.cut(S.parentOffset,N.parentOffset),C.parent.content.cut(C.parentOffset,v.endA-C.start())))){let t=mkTr(e.state.tr);"add"==a.type?t.addMark(k,T,a.mark):t.removeMark(k,T,a.mark),e.dispatch(t)}else if(S.parent.child(S.index()).isText&&S.index()==N.index()-(N.textOffset?0:1)){let t=S.parent.textBetween(S.parentOffset,N.parentOffset),deflt=()=>mkTr(e.state.tr.insertText(t,k,T));e.someProp("handleTextInput",o=>o(e,k,T,t,deflt))||e.dispatch(deflt())}else e.dispatch(mkTr())}else e.dispatch(mkTr())})(this,e,t,o,s)),this.domObserver.start(),function(e){for(let t in L){let o=L[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!function(e,t){if(!t.bubbles)return!0;
1if(t.defaultPrevented)return!1;for(let o=t.target;o!=e.dom;o=o.parentNode)if(!o||11==o.nodeType||o.pmViewDesc&&o.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||runCustomHandler(e,t)||!e.editable&&t.type in q||o(e,t)},H[t]?{passive:!0}:void 0)}v&&e.dom.addEventListener("input",()=>null),ensureListeners(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;for(let t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ensureListeners(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(checkStateComponent),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];for(let o in t.state=this.state,e)t[o]=e[o];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var o,n,i;let s=this.state,r=!1,l=!1;e.storedMarks&&this.composing&&(clearComposition(this),l=!0),this.state=e;let d=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(d||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=buildNodeViews(this);(function(e,t){let o=0,n=0;for(let n in e){if(e[n]!=t[n])return!0;o++}for(let e in t)n++;return o!=n})(e,this.nodeViews)&&(this.nodeViews=e,r=!0)}(d||t.handleDOMEvents!=this._props.handleDOMEvents)&&ensureListeners(this),this.editable=getEditable(this),updateCursorWrapper(this);let a=viewDecorations(this),c=computeDocDeco(this),h=s.plugins==e.plugins||s.doc.eq(e.doc)?e.scrollToSelection>s.scrollToSelection?"to selection":"preserve":"reset",p=r||!this.docView.matchesNode(e.doc,c,a);(p||!e.selection.eq(s.selection))&&(l=!0);let u="preserve"==h&&l&&null==this.dom.style.overflowAnchor&&function(e){let t,o,n=e.dom.getBoundingClientRect(),i=Math.max(0,n.top);for(let s=(n.left+n.right)/2,r=i+1;r<Math.min(innerHeight,n.bottom);r+=5){let n=e.root.elementFromPoint(s,r);if(!n||n==e.dom||!e.dom.contains(n))continue;let l=n.getBoundingClientRect();if(l.top>=i-20){t=n,o=l.top;break}}return{refDOM:t,refTop:o,stack:scrollStack(e.dom)}}(this);if(l){let t,o,l;this.domObserver.stop();let d=p&&(f||b)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&(n=s.selection,i=e.selection,l=Math.min(n.$anchor.sharedDepth(n.head),i.$anchor.sharedDepth(i.head)),n.$anchor.start(l)!=i.$anchor.start(l));if(p){let t=b?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let o=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=nodeSize(e=e.childNodes[t-1])}else{if(!e.parentNode||hasBlockDesc(e))return null;t=domIndex(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),n=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||hasBlockDesc(e))return null;t=domIndex(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(o&&n&&o!=n){let t=n.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(o==i||n==i)return i;if(!t||!t.isText(n.nodeValue))return n;if(e.input.compositionNode==n){let e=o.pmViewDesc;if(!(!e||!e.isText(o.nodeValue)))return n}}return o||n}(this)),(r||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=docViewDesc(e.doc,c,a,this.dom,this)),!t||this.trackWrites&&this.dom.contains(this.trackWrites)||(d=!0)}d||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(t=this.docView.domFromPos(this.state.selection.anchor,0),o=this.domSelectionRange(),isEquivalentPosition(t.node,t.offset,o.anchorNode,o.anchorOffset)))?selectionToDOM(this,d):(syncNodeSelection(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),(null===(o=this.dragging)||void 0===o?void 0:o.node)&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),"reset"==h?this.dom.scrollTop=0:"to selection"==h?this.scrollToSelection():u&&function({refDOM:e,refTop:t,stack:o}){let n=e?e.getBoundingClientRect().top:0;restoreScrollStack(o,0==n?0:n-t)}(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode)){if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof n.qv){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&scrollRectIntoView(this,t.getBoundingClientRect(),e)}else scrollRectIntoView(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let o=this.pluginViews[t];o.update&&o.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let o=e.node,i=-1;
1if(o.from<this.state.doc.content.size&&this.state.doc.nodeAt(o.from)==o.node)i=o.from;else{let e=o.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==o.node&&(i=e)}this.dragging=new Dragging(e.slice,e.move,i<0?void 0:n.qv.create(this.state.doc,i))}someProp(e,t){let o=this._props&&this._props[e],n;if(null!=o&&(n=t?t(o):o))return n;for(let o=0;o<this.directPlugins.length;o++){let i=this.directPlugins[o].props[e];if(null!=i&&(n=t?t(i):i))return n}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let s=i[o].props[e];if(null!=s&&(n=t?t(s):s))return n}}hasFocus(){if(f){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(k)return e.focus(k);let t=scrollStack(e);e.focus(null==k?{get preventScroll(){return k={preventScroll:!0},!0}}:void 0),k||(k=!1,restoreScrollStack(t,0))}(this.dom),selectionToDOM(this),this.domObserver.start()}get root(){let e=this._root;if(null==e){for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return function(e,t){var o;let n,i,s=e.dom.ownerDocument,r,l=0,d=function(e,t,o){if(e.caretPositionFromPoint)try{let n=e.caretPositionFromPoint(t,o);if(n)return{node:n.offsetNode,offset:Math.min(nodeSize(n.offsetNode),n.offset)}}catch(e){}if(e.caretRangeFromPoint){let n=e.caretRangeFromPoint(t,o);if(n)return{node:n.startContainer,offset:Math.min(nodeSize(n.startContainer),n.startOffset)}}}(s,t.left,t.top);d&&({node:r,offset:l}=d);let a=(e.root.elementFromPoint?e.root:s).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){let o=e.dom.getBoundingClientRect();if(!inRect(t,o)||!(a=function elementFromPoint(e,t,o){let n=e.childNodes.length;if(n&&o.top<o.bottom)for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(t.top-o.top)/(o.bottom-o.top))-2)),s=i;;){let o=e.childNodes[s];if(1==o.nodeType){let e=o.getClientRects();for(let n=0;n<e.length;n++){let i=e[n];if(inRect(t,i))return elementFromPoint(o,t,i)}}if((s=(s+1)%n)==i)break}return e}(e.dom,t,o)))return null}if(v)for(let e=a;r&&e;e=parentNode(e))e.draggable&&(r=void 0);if(a=(n=(o=a).parentNode)&&/^li$/i.test(n.nodeName)&&t.left<o.getBoundingClientRect().left?n:o,r){let o;if(g&&1==r.nodeType&&(l=Math.min(l,r.childNodes.length))<r.childNodes.length){let e=r.childNodes[l],o;"IMG"==e.nodeName&&(o=e.getBoundingClientRect()).right<=t.left&&o.bottom>t.top&&l++}C&&l&&1==r.nodeType&&1==(o=r.childNodes[l-1]).nodeType&&"false"==o.contentEditable&&o.getBoundingClientRect().top>=t.top&&l--,r==e.dom&&l==r.childNodes.length-1&&1==r.lastChild.nodeType&&t.top>r.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==l||1!=r.nodeType||"BR"!=r.childNodes[l-1].nodeName)&&(i=function(e,t,o,n){let i=-1;for(let o=t,s=!1;o!=e.dom;){let t=e.docView.nearestDesc(o,!0),r;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((r=t.dom.getBoundingClientRect()).width||r.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!s&&r.left>n.left||r.top>n.top?i=t.posBefore:(!s&&r.right<n.left||r.bottom<n.top)&&(i=t.posAfter),s=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?n.top<(r.top+r.bottom)/2:n.left<(r.left+r.right)/2)?t.posBefore:t.posAfter;o=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,o,-1)}(e,r,l,t))}null==i&&(i=function(e,t,o){let{node:n,offset:i}=function findOffsetInNode(e,t){let o,n,i,s=2e8,r,l=0,d=t.top,a=t.top;for(let c=e.firstChild,h=0;c;c=c.nextSibling,h++){let e;if(1==c.nodeType)e=c.getClientRects();else{if(3!=c.nodeType)continue;e=textRange(c).getClientRects()}for(let p=0;p<e.length;p++){let u=e[p];if(u.top<=d&&u.bottom>=a){d=Math.max(u.bottom,d),a=Math.min(u.top,a);let e=u.left>t.left?u.left-t.left:u.right<t.left?t.left-u.right:0;if(e<s){i=c,s=e,r=e&&3==i.nodeType?{left:u.right<t.left?u.right:u.left,top:t.top}:t,1==c.nodeType&&e&&(l=h+(t.left>=(u.left+u.right)/2?1:0));continue}}else u.top>t.top&&!o&&u.left<=t.left&&u.right>=t.left&&(o=c,n={left:Math.max(u.left,Math.min(u.right,t.left)),top:u.top});!i&&(t.left>=u.right&&t.top>=u.top||t.left>=u.left&&t.top>=u.bottom)&&(l=h+1)}}return(!i&&o&&(i=o,r=n,s=0),i&&3==i.nodeType)?function(e,t){let o=e.nodeValue.length,n=document.createRange(),i;for(let s=0;s<o;s++){n.setEnd(e,s+1),n.setStart(e,s);let o=singleRect(n,1);if(o.top!=o.bottom&&inRect(t,o)){i={node:e,offset:s+(t.left>=(o.left+o.right)/2?1:0)};break}}return n.detach(),i||{node:e,offset:0}}(i,r):!i||s&&1==i.nodeType?{node:e,offset:l}:findOffsetInNode(i,r)}(t,o),s=-1;if(1==n.nodeType&&!n.firstChild){let e=n.getBoundingClientRect();s=e.left!=e.right&&o.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(n,i,s)}(e,a,t));let c=e.docView.nearestDesc(a,!0);return{pos:i,inside:c?c.posAtStart-c.border:-1}}(this,e)}coordsAtPos(e,t=1){return coordsAtPos(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,o=-1){let n=this.docView.posFromDOM(e,t,o);if(null==n)throw RangeError("DOM position not inside the editor");return n}endOfTextblock(e,t){var o,n,i;let s,r;return o=this,n=t||this.state,i=e,V==n&&E==i?P:(V=n,E=i,P="up"==i||"down"==i?(s=n.selection,r="up"==i?s.$from:s.$to,withFlushedState(o,n,()=>{let{node:e}=o.docView.domFromPos(r.pos,"up"==i?-1:1);for(;;){let t=o.docView.nearestDesc(e,!0);if(!t)break;
1if(t.node.isBlock){e=t.contentDOM||t.dom;break}e=t.dom.parentNode}let t=coordsAtPos(o,r.pos,1);for(let o=e.firstChild;o;o=o.nextSibling){let e;if(1==o.nodeType)e=o.getClientRects();else{if(3!=o.nodeType)continue;e=textRange(o,0,o.nodeValue.length).getClientRects()}for(let o=0;o<e.length;o++){let n=e[o];if(n.bottom>n.top+1&&("up"==i?t.top-n.top>(n.bottom-t.top)*2:n.bottom-t.bottom>(t.bottom-n.top)*2))return!1}}return!0})):function(e,t,o){let{$head:n}=t.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,s=i==n.parent.content.size,r=e.domSelection();return r?x.test(n.parent.textContent)&&r.modify?withFlushedState(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:s,anchorOffset:l}=e.domSelectionRange(),d=r.caretBidiLevel;r.modify("move",o,"character");let a=n.depth?e.docView.domAfterPos(n.before()):e.dom,{focusNode:c,focusOffset:h}=e.domSelectionRange(),p=c&&!a.contains(1==c.nodeType?c:c.parentNode)||t==c&&i==h;try{r.collapse(s,l),t&&(t!=s||i!=l)&&r.extend&&r.extend(t,i)}catch(e){}return null!=d&&(r.caretBidiLevel=d),p}):"left"==o||"backward"==o?!i:s:n.pos==n.start()||n.pos==n.end()}(o,n,i))}pasteHTML(e,t){return doPaste(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return doPaste(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return serializeForClipboard(this,e)}destroy(){this.docView&&(!function(e){for(let t in e.domObserver.stop(),e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],viewDecorations(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,clearReusedRange())}get isDestroyed(){return null==this.docView}dispatchEvent(e){runCustomHandler(this,e)||!L[e.type]||!this.editable&&e.type in q||L[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?v&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){let o;if(t.getComposedRanges){let o=t.getComposedRanges(e.root)[0];if(o)return rangeToSelectionRange(e,o)}function read(e){e.preventDefault(),e.stopImmediatePropagation(),o=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",read,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",read,!0),o?rangeToSelectionRange(e,o):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};function computeDocDeco(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",o=>{if("function"==typeof o&&(o=o(e.state)),o)for(let e in o)"class"==e?t.class+=" "+o[e]:"style"==e?t.style=(t.style?t.style+";":"")+o[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(o[e]))}),t.translate||(t.translate="no"),[Decoration.node(0,e.state.doc.content.size,t)]}function updateCursorWrapper(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Decoration.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function getEditable(e){return!e.someProp("editable",t=>!1===t(e.state))}function buildNodeViews(e){let t=Object.create(null);function add(e){for(let o in e)Object.prototype.hasOwnProperty.call(t,o)||(t[o]=e[o])}return e.someProp("nodeViews",add),e.someProp("markViews",add),t}function checkStateComponent(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}EditorView.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}}}]);
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.