PageSourceSearch

https://pika.page/assets/prosemirror-view-01624d44abfd58a18cda9837921a908cb291c5472b921559f8b857c0ce1ac6b7.js

js pika.page collected 2026-09-25 18:54:37 UTC 99,602 bytes, 8 lines download raw bytes

vendor: 16,815 bytes, lines 1-3
1// [email protected] downloaded from https://ga.jspm.io/npm:[email protected]/dist/index.js
2
3import{TextSelection as e,NodeSelection as t,Selection as n,AllSelection as r}from"prosemirror-state";import{DOMSerializer as i,Fragment as a,Mark as o,Slice as s,DOMParser as c}from"prosemirror-model";import{dropPoint as l}from"prosemirror-transform";const u=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},d=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let f=null;const p=function(e,t,n){let r=f||(f=document.createRange());return r.setEnd(e,n==null?e.nodeValue.length:n),r.setStart(e,t||0),r},m=function(){f=null},h=function(e,t,n,r){return n&&(_(e,t,n,r,-1)||_(e,t,n,r,1))},g=/^(img|br|input|textarea|hr)$/i;function _(e,t,n,r,i){for(var a;;){if(e==n&&t==r)return!0;if(t==(i<0?0:v(e))){let n=e.parentNode;if(!n||n.nodeType!=1||S(e)||g.test(e.nodeName)||e.contentEditable==`false`)return!1;t=u(e)+(i<0?0:1),e=n}else if(e.nodeType==1){let n=e.childNodes[t+(i<0?-1:0)];if(n.nodeType==1&&n.contentEditable==`false`)if((a=n.pmViewDesc)!=null&&a.ignoreForSelection)t+=i;else return!1;else e=n,t=i<0?v(e):0}else return!1}}function v(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function y(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable==`false`)return null;e=e.childNodes[t-1],t=v(e)}else if(e.parentNode&&!S(e))t=u(e),e=e.parentNode;else return null}}function b(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable==`false`)return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!S(e))t=u(e)+1,e=e.parentNode;else return null}}function x(e,t,n){for(let r=t==0,i=t==v(e);r||i;){if(e==n)return!0;let t=u(e);if(e=e.parentNode,!e)return!1;r=r&&t==0,i=i&&t==v(e)}}function S(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const C=function(e){return e.focusNode&&h(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function w(e,t){let n=document.createEvent(`Event`);return n.initEvent(`keydown`,!0,!0),n.keyCode=e,n.key=n.code=t,n}function ee(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function te(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(v(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(v(r.startContainer),r.startOffset)}}}const T=typeof navigator<`u`?navigator:null,ne=typeof document<`u`?document:null,E=T&&T.userAgent||``,re=/Edge\/(\d+)/.exec(E),ie=/MSIE \d/.exec(E),ae=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(E),D=!!(ie||ae||re),O=ie?document.documentMode:ae?+ae[1]:re?+re[1]:0,k=!D&&/gecko\/(\d+)/i.test(E);k&&+(/Firefox\/(\d+)/.exec(E)||[0,0])[1];const oe=!D&&/Chrome\/(\d+)/.exec(E),A=!!oe,se=oe?+oe[1]:0,j=!D&&!!T&&/Apple Computer/.test(T.vendor),M=j&&(/Mobile\/\w+/.test(E)||!!T&&T.maxTouchPoints>2),N=M||(T?/Mac/.test(T.platform):!1),ce=T?/Win/.test(T.platform):!1,P=/Android \d/.test(E),F=!!ne&&`webkitFontSmoothing`in ne.documentElement.style,le=F?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ue(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}}function I(e,t){return typeof e==`number`?e:e[t]}function de(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function fe(e,t,n){if(!Ee(t)&&t.left==0)return;let r=e.someProp(`scrollThreshold`)||0,i=e.someProp(`scrollMargin`)||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=d(o);continue}let e=o,n=e==a.body,s=n?ue(a):de(e),c=0,l=0;if(t.top<s.top+I(r,`top`)?l=-(s.top-t.top+I(i,`top`)):t.bottom>s.bottom-I(r,`bottom`)&&(l=t.bottom-t.top>s.bottom-s.top?t.top+I(i,`top`)-s.top:t.bottom-s.bottom+I(i,`bottom`)),t.left<s.left+I(r,`left`)?c=-(s.left-t.left+I(i,`left`)):t.right>s.right-I(r,`right`)&&(c=t.right-s.right+I(i,`right`)),c||l)if(n)a.defaultView.scrollBy(c,l);else{let n=e.scrollLeft,r=e.scrollTop;l&&(e.scrollTop+=l),c&&(e.scrollLeft+=c);let i=e.scrollLeft-n,a=e.scrollTop-r;t={left:t.left-i,top:t.top-a,right:t.right-i,bottom:t.bottom-a}}let u=n?`fixed`:getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(u))break;o=u==`absolute`?o.offsetParent:d(o)}}function pe(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let t=e.root.elementFromPoint(a,o);if(!t||t==e.dom||!e.dom.contains(t))continue;let s=t.getBoundingClientRect();if(s.top>=n-20){r=t,i=s.top;break}}return{refDOM:r,refTop:i,stack:me(e.dom)}}function me(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=d(r));return t}function he({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;ge(n,r==0?0:r-t)}function ge(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:a}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=a&&(r.scrollLeft=a)}}let L=null;function _e(e){if(e.setActive)return e.setActive();if(L)return e.focus(L);let t=me(e);e.focus(L==null?{get preventScroll(){return L={preventScroll:!0},!0}}:void 0),L||(L=!1,ge(t,0))}function ve(e,t){let n,r=2e8,i,a=0,o=t.top,s=t.top,c,l;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let e;if(u.nodeType==1)e=u.getClientRects();else if(u.nodeType==3)e=p(u).getClientRects();else continue;for(let f=0;f<e.length;f++){let p=e[f];if(p.top<=o&&p.bottom>=s){o=Math.max(p.bottom,o),s=Math.min(p.top,s);let e=p.left>t.left?p.left-t.left:p.right<t.left?t.left-p.right:0;if(e<r){n=u,r=e,i=e&&n.nodeType==3?{left:p.right<t.left?p.right:p.left,top:t.top}:t,u.nodeType==1&&e&&(a=d+ +(t.left>=(p.left+p.right)/2));continue}}else p.top>t.top&&!c&&p.left<=t.left&&p.right>=t.left&&(c=u,l={left:Math.max(p.left,Math.min(p.right,t.left)),top:p.top});!n&&(t.left>=p.right&&t.top>=p.top||t.left>=p.left&&t.top>=p.bottom)&&(a=d+1)}}return!n&&c&&(n=c,i=l,r=0),n&&n.nodeType==3?ye(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:ve(n,i)}function ye(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a<n;a++){r.setEnd(e,a+1),r.setStart(e,a);let n=R(r,1);if(n.top!=n.bottom&&be(t,n)){i={node:e,offset:a+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}function be(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function xe(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function Se(e,t,n){let{node:r,offset:i}=ve(t,n),a=-1;if(r.nodeType==1&&!r.firstChild){let e=r.getBoundingClientRect();a=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function Ce(e,t,n,r){let i=-1;for(let n=t,a=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),o;if(!t)return null;if(t.dom.nodeType==1&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((o=t.dom.getBoundingClientRect()).width||o.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!a&&o.left>r.left||o.top>r.top?i=t.posBefore:(!a&&o.right<r.left||o.bottom<r.top)&&(i=t.posAfter),a=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(o.top+o.bottom)/2:r.left<(o.left+o.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}function we(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),a=i;;){let n=e.childNodes[a];if(n.nodeType==1){let e=n.getClientRects();for(let r=0;r<e.length;r++){let i=e[r];if(be(t,i))return we(n,t,i)}}if((a=(a+1)%r)==i)break}return e}function Te(e,t){let n=e.dom.ownerDocument,r,i=0,a=te(n,t.left,t.top);a&&({node:r,offset:i}=a);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),s;if(!o||!e.dom.contains(o.nodeType==1?o:o.parentNode)){let n=e.dom.getBoundingClientRect();if(!be(t,n)||(o=we(e.dom,t,n),!o))return null}if(j)for(let e=o;r&&e;e=d(e))e.draggable&&(r=void 0);if(o=xe(o,t),r){if(k&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e=r.childNodes[i],n;e.nodeName==`IMG`&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&i++}let n;F&&i&&r.nodeType==1&&(n=r.childNodes[i-1]).nodeType==1&&n.contentEditable==`false`&&n.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!=`BR`)&&(s=Ce(e,r,i,t))}s==null&&(s=Se(e,o,t));let c=e.docView.nearestDesc(o,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function Ee(e){return e.top<e.bottom||e.left<e.right}function R(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(Ee(e))return e}return Array.prototype.find.call(n,Ee)||e.getBoundingClientRect()}const De=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Oe(e,t,n){let{node:r,offset:i,atom:a}=e.docView.domFromPos(t,n<0?-1:1),o=F||k;if(r.nodeType==3)if(o&&(De.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=R(p(r,i,i),n);if(k&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=R(p(r,i-1,i-1),-1);if(t.top==e.top){let n=R(p(r,i,i+1),-1);if(n.top!=e.top)return z(n,n.left<t.left)}}return e}else{let e=i,t=i,a=n<0?1:-1;return n<0&&!i?(t++,a=-1):n>=0&&i==r.nodeValue.length?(e--,a=1):n<0?e--:t++,z(R(p(r,e,t),a),a<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==v(r))){let e=r.childNodes[i-1];if(e.nodeType==1)return ke(e.getBoundingClientRect(),!1)}if(a==null&&i<v(r)){let e=r.childNodes[i];if(e.nodeType==1)return ke(e.getBoundingClientRect(),!0)}return ke(r.getBoundingClientRect(),n>=0)}if(a==null&&i&&(n<0||i==v(r))){let e=r.childNodes[i-1],t=e.nodeType==3?p(e,v(e)-+!o):e.nodeType==1&&(e.nodeName!=`BR`||!e.nextSibling)?e:null;if(t)return z(R(t,1),!1)}if(a==null&&i<v(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?e.nodeType==3?p(e,0,+!o):e.nodeType==1?e:null:null;if(t)return z(R(t,-1),!0)}return z(R(r.nodeType==3?p(r):r,-n),n>=0)}function z(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function ke(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function Ae(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function je(e,t,n){let r=t.selection,i=n==`up`?r.$from:r.$to;return Ae(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,n==`up`?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=Oe(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(e.nodeType==1)t=e.getClientRects();else if(e.nodeType==3)t=p(e,0,e.nodeValue.length).getClientRects();else continue;for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&(n==`up`?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})}const Me=/[\u0590-\u08ac]/;function Ne(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!Me.test(r.parent.textContent)||!s.modify?n==`left`||n==`backward`?a:o:Ae(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:a,anchorOffset:o}=e.domSelectionRange(),c=s.caretBidiLevel;s.modify(`move`,n,`character`);let l=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:u,focusOffset:d}=e.domSelectionRange(),f=u&&!l.contains(u.nodeType==1?u:u.parentNode)||t==u&&i==d;try{s.collapse(a,o),t&&(t!=a||i!=o)&&s.extend&&s.extend(t,i)}catch(e){}return c!=null&&(s.caretBidiLevel=c),f}):r.pos==r.start()||r.pos==r.end()}let Pe=null,Fe=null,Ie=!1;function Le(e,t,n){return Pe==t&&Fe==n?Ie:(Pe=t,Fe=n,Ie=n==`up`||n==`down`?je(e,t,n):Ne(e,t,n))}const Re=0,ze=1,Be=2,Ve=3;class ViewDesc{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(e){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,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>u(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(r==null?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),a;if(i&&(!t||i.node))if(n&&(a=i.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))n=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return-1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],a=t+i.size;if(a>e||i instanceof TrailingHackViewDesc){r=e-t;break}t=a}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof WidgetViewDesc&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;e=n?this.children[n-1]:null,!(!e||e.dom.parentNode==this.contentDOM);n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?u(e.dom)+1:0}}else{let e,r=!0;for(;e=n<this.children.length?this.children[n]:null,!(!e||e.dom.parentNode==this.contentDOM);n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?u(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let a=n,o=0;;o++){let n=this.children[o],s=a+n.size;if(r==-1&&e<=s){let i=a+n.border;if(e>=i&&t<=s-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=a;for(let t=o;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=u(n.dom)+1;break}e-=n.size}r==-1&&(r=0)}if(r>-1&&(s>t||o==this.children.length-1)){t=s;for(let e=o+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=u(n.dom);break}t+=n.size}i==-1&&(i=this.contentDOM.childNodes.length);break}a=s}return{node:this.contentDOM,from:e,to:t,fromOffset:r,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 t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);
3if(t.nodeType!=1||n==t.childNodes.length)throw RangeError(`No node after pos `+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),a=Math.max(e,t);for(let o=0,s=0;o<this.children.length;o++){let c=this.children[o],l=s+c.size;if(i>s&&a<l)return c.setSelection(e-s-c.border,t-s-c.border,n,r);s=l}let o=this.domFromPos(e,e?-1:1),s=t==e?o:this.domFromPos(t,t?-1:1),c=n.root.getSelection(),l=n.domSelectionRange(),d=!1;if((k||j)&&e==t){let{node:e,offset:t}=o;if(e.nodeType==3){if(d=!!(t&&e.nodeValue[t-1]==`
4`),d&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){n.nodeName==`BR`&&(o=s={node:n.parentNode,offset:u(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&(n.nodeName==`BR`||n.contentEditable==`false`)}}if(k&&l.focusNode&&l.focusNode!=s.node&&l.focusNode.nodeType==1){let e=l.focusNode.childNodes[l.focusOffset];e&&e.contentEditable==`false`&&(r=!0)}if(!(r||d&&j)&&h(o.node,o.offset,l.anchorNode,l.anchorOffset)&&h(s.node,s.offset,l.focusNode,l.focusOffset))return;let f=!1;if((c.extend||e==t)&&!(d&&k)){c.collapse(o.node,o.offset);try{e!=t&&c.extend(s.node,s.offset),f=!0}catch(e){}}if(!f){if(e>t){let e=o;o=s,s=e}let n=document.createRange();n.setEnd(s.node,s.offset),n.setStart(o.node,o.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&e.type!=`selection`}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],a=n+i.size;if(n==a?e<=a&&t>=n:e<a&&t>n){let r=n+i.border,o=a-i.border;if(e>=r&&t<=o){this.dirty=e==n||t==a?2:1,e==r&&t==o&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-r,t-r);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?2:3}n=a}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=e==1?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class WidgetViewDesc extends ViewDesc{constructor(e,t,n,r){let i,a=t.type.toDOM;if(typeof a==`function`&&(a=a(n,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(a.nodeType!=1){let e=document.createElement(`span`);e.appendChild(a),a=e}a.hasAttribute(`contenteditable`)||(a.contentEditable=`false`),a.classList.add(`ProseMirror-widget`)}super(e,[],a,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==0&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!=`selection`||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class CompositionViewDesc extends ViewDesc{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e==this.textDOM?this.posAtStart+t:this.posAtStart+(t?this.size:0)}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type===`characterData`&&e.target.nodeValue==e.oldValue}}class MarkViewDesc extends ViewDesc{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}static create(e,t,n,r){let a=r.nodeViews[t.type.name],o=a&&a(t,r,n);return(!o||!o.dom)&&(o=i.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new MarkViewDesc(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&3||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=3&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=0){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=MarkViewDesc.create(this.parent,this.mark,!0,n),i=this.children,a=this.size;t<a&&(i=nt(i,t,a,n)),e>0&&(i=nt(i,0,e,n));for(let e=0;e<i.length;e++)i[e].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class NodeViewDesc extends ViewDesc{constructor(e,t,n,r,i,a,o){super(e,[],i,a),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=o}
vendor: 20,024 bytes, line 4
4static create(e,t,n,r,a,o){let s=a.nodeViews[t.type.name],c,l=s&&s(t,a,()=>{if(!c)return o;if(c.parent)return c.parent.posBeforeChild(c)},n,r),u=l&&l.dom,d=l&&l.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw RangeError(`Text must be rendered as a DOM text node`)}else if(!u){let e=i.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:u,contentDOM:d}=e)}!d&&!t.isText&&u.nodeName!=`BR`&&(u.hasAttribute(`contenteditable`)||(u.contentEditable=`false`),t.type.spec.draggable&&(u.draggable=!0));let f=u;return u=Je(u,n,t),l?c=new CustomNodeViewDesc(e,t,n,r,u,d||null,f,l):t.isText?new TextViewDesc(e,t,n,r,u,f):new NodeViewDesc(e,t,n,r,u,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace==`pre`&&(t.preserveWhitespace=`full`),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}if(!t.contentElement){let n=e&&e.find(t=>t.nodeType==1&&e.indexOf(t.parentNode)<0&&this.dom.contains(t));n?t.contentElement=n:t.getContent=()=>a.empty}}return t}matchesNode(e,t,n){return this.dirty==0&&e.eq(this.node)&&Ye(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,a=i&&i.pos>-1?i:null,s=i&&i.pos<0,c=new ViewTreeUpdater(this,a&&a.node,e);$e(this.node,this.innerDeco,(t,i,a)=>{t.spec.marks?c.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!a&&c.syncToMarks(i==this.node.childCount?o.none:this.node.child(i).marks,n,e,i),c.placeWidget(t,e,r)},(t,a,o,l)=>{c.syncToMarks(t.marks,n,e,l);let u;c.findNodeMatch(t,a,o,l)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(u=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(t,a,o,u,e)||c.updateNextNode(t,a,o,e,l,r)||c.addNode(t,a,o,e,r),r+=t.nodeSize}),c.syncToMarks([],n,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==2)&&(a&&this.protectLocalComposition(e,a),Ue(this.contentDOM,this.children,e),M&&et(this.dom))}localCompositionInfo(t,n){let{from:r,to:i}=t.state.selection;if(!(t.state.selection instanceof e)||r<n||i>n+this.node.content.size)return null;let a=t.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let e=a.nodeValue,t=tt(this.node.content,e,r-n,i-n);return t<0?null:{node:a,pos:t,text:e}}else return{node:a,pos:-1,text:``}}protectLocalComposition(e,{node:t,pos:n,text:r}){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 a=new CompositionViewDesc(this,i,t,r);e.input.compositionNodes.push(a),this.children=nt(this.children,n,n+r.length,e,a)}update(e,t,n,r){return this.dirty==3||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(Ye(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,n=this.dom;this.dom=Ke(this.dom,this.nodeDOM,Ge(this.outerDeco,this.node,t),Ge(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove(`ProseMirror-selectednode`),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute(`draggable`))}get domAtom(){return this.node.isAtom}}function He(e,t,n,r,i){Je(r,t,e);let a=new NodeViewDesc(void 0,e,t,n,r,r,r);return a.contentDOM&&a.updateChildren(i,0),a}class TextViewDesc extends NodeViewDesc{constructor(e,t,n,r,i,a){super(e,t,n,r,i,null,a)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return this.dirty==3||this.dirty!=0&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=0||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.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,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return e.type!=`characterData`&&e.type!=`selection`}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new TextViewDesc(this.parent,r,this.outerDeco,this.innerDeco,i,i)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class TrailingHackViewDesc extends ViewDesc{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==0&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName==`IMG`}}class CustomNodeViewDesc extends NodeViewDesc{constructor(e,t,n,r,i,a,o,s){super(e,t,n,r,i,a,o),this.spec=s}update(e,t,n,r){if(this.dirty==3)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}else if(!this.contentDOM&&!e.isLeaf)return!1;else return super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Ue(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a<t.length;a++){let o=t[a],s=o.dom;if(s.parentNode==e){for(;s!=r;)r=Xe(r),i=!0;r=r.nextSibling}else i=!0,e.insertBefore(s,r);if(o instanceof MarkViewDesc){let t=r?r.previousSibling:e.lastChild;Ue(o.contentDOM,o.children,n),r=t?t.nextSibling:e.firstChild}}for(;r;)r=Xe(r),i=!0;i&&n.trackWrites==e&&(n.trackWrites=null)}const We=function(e){e&&(this.nodeName=e)};We.prototype=Object.create(null);const B=[new We];function Ge(e,t,n){if(e.length==0)return B;let r=n?B[0]:new We,i=[r];for(let a=0;a<e.length;a++){let o=e[a].type.attrs;if(o){o.nodeName&&i.push(r=new We(o.nodeName));for(let e in o){let a=o[e];a!=null&&(n&&i.length==1&&i.push(r=new We(t.isInline?`span`:`div`)),e==`class`?r.class=(r.class?r.class+` `:``)+a:e==`style`?r.style=(r.style?r.style+`;`:``)+a:e!=`nodeName`&&(r[e]=a))}}}return i}function Ke(e,t,n,r){if(n==B&&r==B)return t;let i=t;for(let t=0;t<r.length;t++){let a=r[t],o=n[t];if(t){let t;o&&o.nodeName==a.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==a.nodeName?i=t:(t=document.createElement(a.nodeName),t.pmIsDeco=!0,t.appendChild(i),o=B[0],i=t)}qe(i,o||B[0],a)}return i}function qe(e,t,n){for(let r in t)r!=`class`&&r!=`style`&&r!=`nodeName`&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!=`class`&&r!=`style`&&r!=`nodeName`&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(` `).filter(Boolean):[],i=n.class?n.class.split(` `).filter(Boolean):[];for(let t=0;t<r.length;t++)i.indexOf(r[t])==-1&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)r.indexOf(i[t])==-1&&e.classList.add(i[t]);e.classList.length==0&&e.removeAttribute(`class`)}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}function Je(e,t,n){return Ke(e,e,B,Ge(t,n,e.nodeType!=1))}function Ye(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function Xe(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class ViewTreeUpdater{constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Ze(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,a=this.stack.length>>1,o=Math.min(a,e.length);for(;i<o&&(i==a-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<a;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),a--;for(;a<e.length;){this.stack.push(this.top,this.index+1);let i=-1,o=this.top.children.length;r<this.preMatch.index&&(o=Math.min(this.index+3,o));for(let t=this.index;t<o;t++){let n=this.top.children[t];if(n.matchesMark(e[a])&&!this.isLocked(n.dom)){i=t;break}}if(i<0&&this.index<this.top.children.length){let t=this.top.children[this.index];t instanceof MarkViewDesc&&t.dirty!=3&&t.mark.type==e[a].type&&t.spec.update&&!this.isLocked(t.dom)&&t.spec.update(e[a])&&(t.mark=e[a],i=this.index,this.changed=!0)}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=MarkViewDesc.create(this.top,e[a],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,a++}}findNodeMatch(e,t,n,r){let i=-1,a;if(r>=this.preMatch.index&&(a=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,n))i=this.top.children.indexOf(a,this.index);else for(let r=this.index,a=Math.min(this.top.children.length,r+5);r<a;r++){let a=this.top.children[r];if(a.matchesNode(e,t,n)&&!this.preMatch.matched.has(a)){i=r;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let a=this.top.children[r];return a.dirty==3&&a.dom==a.contentDOM&&(a.dirty=2),a.update(e,t,n,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}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,n,r,i,a){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof NodeViewDesc){let c=this.preMatch.matched.get(s);if(c!=null&&c!=i)return!1;let l=s.dom,u,d=this.isLocked(l)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&s.dirty!=3&&Ye(t,s.outerDeco));if(!d&&s.update(e,t,n,r))return this.destroyBetween(this.index,o),s.dom!=l&&(this.changed=!0),this.index++,!0;if(!d&&(u=this.recreateWrapper(s,e,t,n,r,a)))return this.destroyBetween(this.index,o),this.top.children[this.index]=u,u.contentDOM&&(u.dirty=2,u.updateChildren(r,a+1),u.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Ye(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let o=NodeViewDesc.create(this.top,t,n,r,i,a);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,t,n,r,i){let a=NodeViewDesc.create(this.top,e,t,n,r,i);a.contentDOM&&a.updateChildren(r,i+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new WidgetViewDesc(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof MarkViewDesc;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof TextViewDesc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((j||A)&&e&&e.dom.contentEditable==`false`&&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 n=document.createElement(e);e==`IMG`&&(n.className=`ProseMirror-separator`,n.alt=``),e==`BR`&&(n.className=`ProseMirror-trailingBreak`);let r=new TrailingHackViewDesc(this.top,[],n,null);t==this.top?t.children.splice(this.index++,0,r):t.children.push(r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Ze(e,t){let n=t,r=n.children.length,i=e.childCount,a=/* @__PURE__ */ new Map,o=[];outer:for(;i>0;){let s;for(;;)if(r){let e=n.children[r-1];if(e instanceof MarkViewDesc)n=e,r=e.children.length;else{s=e,r--;break}}else if(n==t)break outer;else r=n.parent.children.indexOf(n),n=n.parent;let c=s.node;if(c){if(c!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function Qe(e,t){return e.type.side-t.type.side}function $e(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let n=0;n<e.childCount;n++){let o=e.child(n);r(o,i,t.forChild(a,o),n),a+=o.nodeSize}return}let o=0,s=[],c=null;for(let l=0;;){let u,d;for(;o<i.length&&i[o].to==a;){let e=i[o++];e.widget&&(u?(d||(d=[u])).push(e):u=e)}if(u)if(d){d.sort(Qe);for(let e=0;e<d.length;e++)n(d[e],l,!!c)}else n(u,l,!!c);let f,p;if(c)p=-1,f=c,c=null;else if(l<e.childCount)p=l,f=e.child(l++);else break;for(let e=0;e<s.length;e++)s[e].to<=a&&s.splice(e--,1);for(;o<i.length&&i[o].from<=a&&i[o].to>a;)s.push(i[o++]);let m=a+f.nodeSize;if(f.isText){let e=m;o<i.length&&i[o].from<e&&(e=i[o].from);for(let t=0;t<s.length;t++)s[t].to<e&&(e=s[t].to);e<m&&(c=f.cut(e-a),f=f.cut(0,e-a),m=e,p=-1)}else for(;o<i.length&&i[o].to<m;)o++;let h=f.isInline&&!f.isLeaf?s.filter(e=>!e.inline):s.slice();r(f,h,t.forChild(a,f),p),a=m}}function et(e){if(e.nodeName==`UL`||e.nodeName==`OL`){let t=e.style.cssText;e.style.cssText=t+`; list-style: square !important`,window.getComputedStyle(e).listStyle,e.style.cssText=t}}function tt(e,t,n,r){for(let i=0,a=0;i<e.childCount&&a<=r;){let o=e.child(i++),s=a;if(a+=o.nodeSize,!o.isText)continue;let c=o.text;for(;i<e.childCount;){let t=e.child(i++);if(a+=t.nodeSize,!t.isText)break;c+=t.text}if(a>=n){if(a>=r&&c.slice(r-t.length-s,r-s)==t)return r-t.length;let e=s<r?c.lastIndexOf(t,r-s-1):-1;if(e>=0&&e+t.length+s>=n)return s+e;if(n==r&&c.length>=r+t.length-s&&c.slice(r-s,r-s+t.length)==t)return r}}return-1}function nt(e,t,n,r,i){let a=[];for(let o=0,s=0;o<e.length;o++){let c=e[o],l=s,u=s+=c.size;l>=n||u<=t?a.push(c):(l<t&&a.push(c.slice(0,t-l,r)),i&&(a.push(i),i=void 0),u>n&&a.push(c.slice(n-l,c.size,r)))}return a}function rt(e,n=null){let r=e.domSelectionRange(),i=e.state.doc;if(!r.focusNode)return null;let a=e.docView.nearestDesc(r.focusNode),o=a&&a.size==0,s=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(s<0)return null;let c=i.resolve(s),l,u;if(C(r)){for(l=s;a&&!a.node;)a=a.parent;let e=a.node;if(a&&e.isAtom&&t.isSelectable(e)&&a.parent&&!(e.isInline&&x(r.focusNode,r.focusOffset,a.dom))){let e=a.posBefore;u=new t(s==e?c:i.resolve(e))}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let t=s,n=s;for(let i=0;i<r.rangeCount;i++){let a=r.getRangeAt(i);t=Math.min(t,e.docView.posFromDOM(a.startContainer,a.startOffset,1)),n=Math.max(n,e.docView.posFromDOM(a.endContainer,a.endOffset,-1))}if(t<0)return null;[l,s]=n==e.state.selection.anchor?[n,t]:[t,n],c=i.resolve(s)}else l=e.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(l<0)return null}let d=i.resolve(l);if(!u){let t=n==`pointer`||e.state.selection.head<c.pos&&!o?1:-1;u=pt(e,d,c,t)}return u}function it(e){return e.editable?e.hasFocus():ht(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function V(t,n=!1){let r=t.state.selection;if(dt(t,r),!it(t))return;let i=t.input.mouseDown;if(!n&&A&&i){let e=t.domSelectionRange(),n=t.domObserver.currentSelection;if(e.anchorNode&&n.anchorNode&&h(e.anchorNode,e.anchorOffset,n.anchorNode,n.anchorOffset)&&i.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)ut(t);else{let{anchor:i,head:a}=r,o,s;at&&!(r instanceof e)&&(r.$from.parent.inlineContent||(o=ot(t,r.from)),!r.empty&&!r.$from.parent.inlineContent&&(s=ot(t,r.to))),t.docView.setSelection(i,a,t,n),at&&(o&&ct(o),s&&ct(s)),r.visible?t.dom.classList.remove(`ProseMirror-hideselection`):(t.dom.classList.add(`ProseMirror-hideselection`),`onselectionchange`in document&&lt(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const at=j||A&&se<63;function ot(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,a=r?n.childNodes[r-1]:null;if(j&&i&&i.contentEditable==`false`)return st(i);if((!i||i.contentEditable==`false`)&&(!a||a.contentEditable==`false`)){if(i)return st(i);if(a)return st(a)}}function st(e){return e.contentEditable=`true`,j&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function ct(e){e.contentEditable=`false`,e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function lt(e){let t=e.dom.ownerDocument;t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;t.addEventListener(`selectionchange`,e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener(`selectionchange`,e.input.hideSelectionGuard),setTimeout(()=>{(!it(e)||e.state.selection.visible)&&e.dom.classList.remove(`ProseMirror-hideselection`)},20))})}function ut(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName==`IMG`;r?t.collapse(n.parentNode,u(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&D&&O<=11&&(n.disabled=!0,n.disabled=!1)}function dt(e,n){if(n instanceof t){let t=e.docView.descAt(n.from);t!=e.lastSelectedViewDesc&&(ft(e),t&&t.selectNode(),e.lastSelectedViewDesc=t)}else ft(e)}function ft(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function pt(t,n,r,i){return t.someProp(`createSelectionBetween`,e=>e(t,n,r))||e.between(n,r,i)}function mt(e){return e.editable&&!e.hasFocus()?!1:ht(e)}function ht(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function gt(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return h(t.node,t.offset,n.anchorNode,n.anchorOffset)}function _t(e,t){let{$anchor:r,$head:i}=e.selection,a=t>0?r.max(i):r.min(i),o=a.parent.inlineContent?a.depth?e.doc.resolve(t>0?a.after():a.before()):null:a;return o&&n.findFrom(o,t)}function H(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function vt(n,r,i){let a=n.state.selection;if(a instanceof e){if(i.indexOf(`s`)>-1){let{$head:t}=a,i=t.textOffset?null:r<0?t.nodeBefore:t.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=n.state.doc.resolve(t.pos+i.nodeSize*(r<0?-1:1));return H(n,new e(a.$anchor,o))}else if(!a.empty)return!1;else if(n.endOfTextblock(r>0?`forward`:`backward`)){let e=_t(n.state,r);return e&&e instanceof t?H(n,e):!1}else if(!(N&&i.indexOf(`m`)>-1)){let i=a.$head,o=i.textOffset?null:r<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let c=r<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=n.docView.descAt(c))&&!s.contentDOM?t.isSelectable(
vendor: 6,015 bytes, lines 4-7
4o)?H(n,new t(r<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):F?H(n,new e(n.state.doc.resolve(r<0?c:c+o.nodeSize))):!1:!1}}else if(a instanceof t&&a.node.isInline)return H(n,new e(r>0?a.$to:a.$from));else{let e=_t(n.state,r);return e?H(n,e):!1}}function yt(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function U(e,t){let n=e.pmViewDesc;return n?n.size==0&&(t<0||e.nextSibling||e.nodeName!=`BR`):e.nodeType==1&&e.contentEditable==`false`}function W(e,t){return t<0?bt(e):xt(e)}function bt(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(k&&n.nodeType==1&&r<yt(n)&&U(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let e=n.childNodes[r-1];if(U(e,-1))i=n,a=--r;else if(e.nodeType==3)n=e,r=n.nodeValue.length;else break}}else if(St(n))break;else{let t=n.previousSibling;for(;t&&U(t,-1);)i=n.parentNode,a=u(t),t=t.previousSibling;if(t)n=t,r=yt(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}o?Tt(e,n,r):i&&Tt(e,i,a)}function xt(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=yt(n),a,o;for(;;)if(r<i){if(n.nodeType!=1)break;let e=n.childNodes[r];if(U(e,1))a=n,o=++r;else break}else if(St(n))break;else{let t=n.nextSibling;for(;t&&U(t,1);)a=t.parentNode,o=u(t)+1,t=t.nextSibling;if(t)n=t,r=0,i=yt(n);else{if(n=n.parentNode,n==e.dom)break;r=i=0}}a&&Tt(e,a,o)}function St(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ct(e,t){for(;e&&t==e.childNodes.length&&!S(e);)t=u(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=0}}function wt(e,t){for(;e&&!t&&!S(e);)t=u(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable==`false`)break;e=n,t=e.childNodes.length}}function Tt(e,t,n){if(t.nodeType!=3){let e,r;(r=Ct(t,n))?(t=r,n=0):(e=wt(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(C(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&V(e)},50)}function Et(e,t){let n=e.state.doc.resolve(t);if(!(A||ce)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?`ltr`:`rtl`}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?`ltr`:`rtl`}}return getComputedStyle(e.dom).direction==`rtl`?`rtl`:`ltr`}function Dt(i,a,o){let s=i.state.selection;if(s instanceof e&&!s.empty||o.indexOf(`s`)>-1||N&&o.indexOf(`m`)>-1)return!1;let{$from:c,$to:l}=s;if(!c.parent.inlineContent||i.endOfTextblock(a<0?`up`:`down`)){let e=_t(i.state,a);if(e&&e instanceof t)return H(i,e)}if(!c.parent.inlineContent){let e=a<0?c:l,t=s instanceof r?n.near(e,a):n.findFrom(e,a);return t?H(i,t):!1}return!1}function Ot(t,n){if(!(t.state.selection instanceof e))return!0;let{$head:r,$anchor:i,empty:a}=t.state.selection;if(!r.sameParent(i))return!0;if(!a)return!1;if(t.endOfTextblock(n>0?`forward`:`backward`))return!0;let o=!r.textOffset&&(n<0?r.nodeBefore:r.nodeAfter);if(o&&!o.isText){let e=t.state.tr;return n<0?e.delete(r.pos-o.nodeSize,r.pos):e.delete(r.pos,r.pos+o.nodeSize),t.dispatch(e),!0}return!1}function kt(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function At(e){if(!j||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable==`false`){let n=t.firstChild;kt(e,n,`true`),setTimeout(()=>kt(e,n,`false`),20)}return!1}function jt(e){let t=``;return e.ctrlKey&&(t+=`c`),e.metaKey&&(t+=`m`),e.altKey&&(t+=`a`),e.shiftKey&&(t+=`s`),t}function Mt(e,t){let n=t.keyCode,r=jt(t);if(n==8||N&&n==72&&r==`c`)return Ot(e,-1)||W(e,-1);if(n==46&&!t.shiftKey||N&&n==68&&r==`c`)return Ot(e,1)||W(e,1);if(n==13||n==27)return!0;if(n==37||N&&n==66&&r==`c`){let t=n==37?Et(e,e.state.selection.from)==`ltr`?-1:1:-1;return vt(e,t,r)||W(e,t)}else if(n==39||N&&n==70&&r==`c`){let t=n==39?Et(e,e.state.selection.from)==`ltr`?1:-1:1;return vt(e,t,r)||W(e,t)}else if(n==38||N&&n==80&&r==`c`)return Dt(e,-1,r)||W(e,-1);else if(n==40||N&&n==78&&r==`c`)return At(e)||Dt(e,1,r)||W(e,1);else if(r==(N?`m`:`c`)&&(n==66||n==73||n==89||n==90))return!0;return!1}function Nt(e,t){e.someProp(`transformCopied`,n=>{t=n(t,e)});let n=[],{content:r,openStart:a,openEnd:o}=t;for(;a>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){a--,o--;let e=r.firstChild;n.push(e.type.name,e.attrs==e.type.defaultAttrs?null:e.attrs),r=e.content}let s=e.someProp(`clipboardSerializer`)||i.fromSchema(e.state.schema),c=Ut(),l=c.createElement(`div`);l.appendChild(s.serializeFragment(r,{document:c}));let u=l.firstChild,d,f=0;for(;u&&u.nodeType==1&&(d=Ht[u.nodeName.toLowerCase()]);){for(let e=d.length-1;e>=0;e--){let t=c.createElement(d[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),f++}u=l.firstChild}return u&&u.nodeType==1&&u.setAttribute(`data-pm-slice`,`${a} ${o}${f?` -${f}`:``} ${JSON.stringify(n)}`),{dom:l,text:e.someProp(`clipboardTextSerializer`,n=>n(t,e))||t.content.textBetween(0,t.content.size,`
5
6`),slice:t}}function Pt(e,t,n,r,o){let l=o.parent.type.spec.code,u,d;if(!n&&!t)return null;let f=!!t&&(r||l||!n);if(f){if(e.someProp(`transformPastedText`,n=>{t=n(t,l||r,e)}),l)return d=new s(a.from(e.state.schema.text(t.replace(/\r\n?/g,`
7`))),0,0),e.someProp(`transformPasted`,t=>{d=t(d,e,!0)}),d;let n=e.someProp(`clipboardTextParser`,n=>n(t,o,r,e));if(n)d=n;else{let n=o.marks(),{schema:r}=e.state,a=i.fromSchema(r);u=document.createElement(`div`),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=u.appendChild(document.createElement(`p`));e&&t.appendChild(a.serializeNode(r.text(e,n)))})}}else e.someProp(`transformPastedHTML`,t=>{n=t(n,e)}),u=Gt(n),F&&Kt(u);
vendor: 22,194 bytes, line 7
7let p=u&&u.querySelector(`[data-pm-slice]`),m=p&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(p.getAttribute(`data-pm-slice`)||``);if(m&&m[3])for(let e=+m[3];e>0;e--){let e=u.firstChild;for(;e&&e.nodeType!=1;)e=e.nextSibling;if(!e)break;u=e}if(d||(d=(e.someProp(`clipboardParser`)||e.someProp(`domParser`)||c.fromSchema(e.state.schema)).parseSlice(u,{preserveWhitespace:!!(f||m),context:o,ruleFromNode(e){return e.nodeName==`BR`&&!e.nextSibling&&e.parentNode&&!Ft.test(e.parentNode.nodeName)?{ignore:!0}:null}})),m)d=qt(Vt(d,+m[1],+m[2]),m[4]);else if(d=s.maxOpen(It(d.content,o),!0),d.openStart||d.openEnd){let e=0,t=0;for(let t=d.content.firstChild;e<d.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=d.content.lastChild;t<d.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);d=Vt(d,e,t)}return e.someProp(`transformPasted`,t=>{d=t(d,e,f)}),d}const Ft=/^(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 It(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,o=[];if(e.forEach(e=>{if(!o)return;let t=r.findWrapping(e.type),n;if(!t)return o=null;if(n=o.length&&i.length&&Rt(t,i,e,o[o.length-1],0))o[o.length-1]=n;else{o.length&&(o[o.length-1]=zt(o[o.length-1],i.length));let n=Lt(e,t);o.push(n),r=r.matchType(n.type),i=t}}),o)return a.from(o)}return e}function Lt(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,a.from(e));return e}function Rt(e,t,n,r,i){if(i<e.length&&i<t.length&&e[i]==t[i]){let o=Rt(e,t,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==e.length-1?n.type:e[i+1]))return r.copy(r.content.append(a.from(Lt(n,e,i+1))))}}function zt(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,zt(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(a.empty,!0);return e.copy(n.append(r))}function Bt(e,t,n,r,i,o){let s=t<0?e.firstChild:e.lastChild,c=s.content;return e.childCount>1&&(o=0),i<r-1&&(c=Bt(c,t,n,r,i+1,o)),i>=n&&(c=t<0?s.contentMatchAt(0).fillBefore(c,o<=i).append(c):c.append(s.contentMatchAt(s.childCount).fillBefore(a.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(c))}function Vt(e,t,n){return t<e.openStart&&(e=new s(Bt(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new s(Bt(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const Ht={thead:[`table`],tbody:[`table`],tfoot:[`table`],caption:[`table`],colgroup:[`table`],col:[`table`,`colgroup`],tr:[`table`,`tbody`],td:[`table`,`tbody`,`tr`],th:[`table`,`tbody`,`tr`]};function Ut(){return document.implementation.createHTMLDocument(`title`)}let G=null;function Wt(e){let t=window.trustedTypes;if(!t)return e;if(!G){if(G=t.defaultPolicy)try{return G.createHTML(e)}catch(e){}G=t.createPolicy(`ProseMirrorClipboard`,{createHTML:e=>e})}return G.createHTML(e)}function Gt(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=Ut(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(e),a;if((a=i&&Ht[i[1].toLowerCase()])&&(e=a.map(e=>`<`+e+`>`).join(``)+e+a.map(e=>`</`+e+`>`).reverse().join(``)),r.innerHTML=Wt(e),a)for(let e=0;e<a.length;e++)r=r.querySelector(a[e])||r;for(let e=0;e<n.styleSheets.length;e++){let t=n.styleSheets[e];for(let e=0;e<t.rules.length;e++){let n=t.rules[e];if(n instanceof CSSStyleRule){let e=r.querySelectorAll(n.selectorText);for(let t=0;t<e.length;t++)e[t].style.cssText+=n.style.cssText}}}return r}function Kt(e){let t=e.querySelectorAll(A?`span:not([class]):not([style])`:`span.Apple-converted-space`);for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==`\xA0`&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(` `),r)}}function qt(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch(t){return e}let{content:i,openStart:o,openEnd:c}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;try{t.checkAttrs(r[e+1])}catch(e){break}i=a.from(t.create(r[e+1],i)),o++,c++}return new s(i,o,c)}const K={},q={},Jt={touchstart:!0,touchmove:!0};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 Yt(e){for(let t in K){let n=K[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{$t(e,t)&&!Qt(e,t)&&(e.editable||!(t.type in q))&&n(e,t)},Jt[t]?{passive:!0}:void 0)}j&&e.dom.addEventListener(`input`,()=>null),Zt(e)}function J(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function Xt(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Zt(e){e.someProp(`handleDOMEvents`,t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>Qt(e,t))})}function Qt(e,t){return e.someProp(`handleDOMEvents`,n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function $t(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function en(e,t){!Qt(e,t)&&K[t.type]&&(e.editable||!(t.type in q))&&K[t.type](e,t)}q.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!mn(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(P&&A&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),M&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp(`handleKeyDown`,t=>t(e,w(13,`Enter`))),e.input.lastIOSEnter=0)},200)}else e.someProp(`handleKeyDown`,t=>t(e,n))||Mt(e,n)?n.preventDefault():J(e,`key`)},q.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)},q.keypress=(t,n)=>{let r=n;if(mn(t)||!r.charCode||r.ctrlKey&&!r.altKey||N&&r.metaKey)return;if(t.someProp(`handleKeyPress`,e=>e(t,r))){r.preventDefault();return}let i=t.state.selection;if(!(i instanceof e)||!i.$from.sameParent(i.$to)){let e=String.fromCharCode(r.charCode),n=()=>t.state.tr.insertText(e).scrollIntoView();!/[\r\n]/.test(e)&&!t.someProp(`handleTextInput`,r=>r(t,i.$from.pos,i.$to.pos,e,n))&&t.dispatch(n()),r.preventDefault()}};function Y(e){return{left:e.clientX,top:e.clientY}}function tn(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function nn(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let r=a.depth+1;r>0;r--)if(e.someProp(t,t=>r>a.depth?t(e,n,a.nodeAfter,a.before(r),i,!0):t(e,n,a.node(r),a.before(r),i,!1)))return!0;return!1}function rn(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n==`pointer`&&r.setMeta(`pointer`,!0),e.dispatch(r)}function an(e,n){if(n==-1)return!1;let r=e.state.doc.resolve(n),i=r.nodeAfter;return i&&i.isAtom&&t.isSelectable(i)?(rn(e,new t(r),`pointer`),!0):!1}function on(e,n){if(n==-1)return!1;let r=e.state.selection,i,a;r instanceof t&&(i=r.node);let o=e.state.doc.resolve(n);for(let e=o.depth+1;e>0;e--){let n=e>o.depth?o.nodeAfter:o.node(e);if(t.isSelectable(n)){a=i&&r.$from.depth>0&&e>=r.$from.depth&&o.before(r.$from.depth+1)==r.$from.pos?o.before(r.$from.depth):o.before(e);break}}return a==null?!1:(rn(e,t.create(e.state.doc,a),`pointer`),!0)}function sn(e,t,n,r,i){return nn(e,`handleClickOn`,t,n,r)||e.someProp(`handleClick`,n=>n(e,t,r))||(i?on(e,n):an(e,n))}function cn(e,t,n,r){return nn(e,`handleDoubleClickOn`,t,n,r)||e.someProp(`handleDoubleClick`,n=>n(e,t,r))}function ln(e,t,n,r){return nn(e,`handleTripleClickOn`,t,n,r)||e.someProp(`handleTripleClick`,n=>n(e,t,r))||un(e,n,r)}function un(t,n,r){if(r.button!=0)return!1;let i=dn(t,n,!0),a=t.state.doc;return i?(rn(t,i,`pointer`),i instanceof e&&a.eq(t.state.doc)&&(t.input.mouseDown=new TripleClickDrag(t,i)),!0):!1}function dn(n,r,i){let a=n.state.doc;if(r==-1)return a.inlineContent?e.create(a,0,a.content.size):null;let o=a.resolve(r);for(let n=o.depth+1;n>0;n--){let r=n>o.depth?o.nodeAfter:o.node(n),s=o.before(n);if(r.inlineContent)return e.create(a,s+1,s+1+r.content.size);if(i&&t.isSelectable(r))return t.create(a,s)}return null}function fn(e){return bn(e)}const pn=N?`metaKey`:`ctrlKey`;K.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=fn(e),i=Date.now(),a=`singleClick`;i-e.input.lastClick.time<500&&tn(n,e.input.lastClick)&&!n[pn]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type==`singleClick`?a=`doubleClick`:e.input.lastClick.type==`doubleClick`&&(a=`tripleClick`)),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(Y(n));o&&(a==`singleClick`?e.input.mouseDown=new LeftMouseDown(e,o,n,!!r):(a==`doubleClick`?cn:ln)(e,o.pos,o.inside,n)?n.preventDefault():J(e,`pointer`))};class MouseDown{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener(`mouseup`,this.up=this.up.bind(this)),e.root.addEventListener(`mousemove`,this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener(`mouseup`,this.up),this.view.root.removeEventListener(`mousemove`,this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class LeftMouseDown extends MouseDown{constructor(e,n,r,i){super(e),this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[pn],this.allowDefault=r.shiftKey;let a,o;if(n.inside>-1)a=e.state.doc.nodeAt(n.inside),o=n.inside;else{let t=e.state.doc.resolve(n.pos);a=t.parent,o=t.depth?t.before():0}let s=i?null:r.target,c=s?e.docView.nearestDesc(s,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:l}=e.state;r.button==0&&(a.type.spec.draggable&&a.type.spec.selectable!==!1||l instanceof t&&l.from<=o&&l.to>o)&&(this.mightDrag={node:a,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&k&&!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()),J(e,`pointer`)}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute(`draggable`),this.mightDrag.setUneditable&&this.target.removeAttribute(`contentEditable`),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||V(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Y(e))),this.updateAllowDefault(e),this.allowDefault||!t?J(this.view,`pointer`):sn(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||j&&this.mightDrag&&!this.mightDrag.node.isAtom||A&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(rn(this.view,n.near(this.view.state.doc.resolve(t.pos)),`pointer`),e.preventDefault()):J(this.view,`pointer`)}move(e){this.updateAllowDefault(e),J(this.view,`pointer`),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class TripleClickDrag extends MouseDown{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(t){if(t.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}t.preventDefault(),J(this.view,`pointer`);let n=this.view.posAtCoords(Y(t)),r=n&&dn(this.view,n.inside,!1);if(!r)return;let{doc:i}=this.view.state,a=this.startSelection,[o,s]=r.from<a.from?[a.to,r.from]:[a.from,r.to];rn(this.view,e.create(i,o,s),`pointer`)}}K.touchstart=e=>{e.input.lastTouch=Date.now(),fn(e),J(e,`pointer`)},K.touchmove=e=>{e.input.lastTouch=Date.now(),J(e,`pointer`)},K.contextmenu=e=>fn(e);function mn(e,t){return e.composing?!0:j&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const hn=P?5e3:-1;q.compositionstart=q.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:n}=t,r=n.selection.$to;if(n.selection instanceof e&&n.selection.empty&&(n.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some(e=>e.type.spec.inclusive===!1)||A&&ce&&gn(t)))t.markCursor=t.state.storedMarks||r.marks(),bn(t,!0),t.markCursor=null;else if(bn(t,!n.selection.empty),k&&n.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let e=t.domSelectionRange();for(let n=e.focusNode,r=e.focusOffset;n&&n.nodeType==1&&r!=0;){let e=r<0?n.lastChild:n.childNodes[r-1];if(!e)break;if(e.nodeType==3){let n=t.domSelection();n&&n.collapse(e,e.nodeValue.length);break}else n=e,r=-1}}t.input.composing=!0}_n(t,hn)};function gn(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable==`false`}q.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),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++,_n(e,20))};function _n(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>bn(e),t))}function vn(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function yn(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=y(t.focusNode,t.focusOffset),r=b(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}function bn(e,t=!1){if(!(P&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),vn(e),t||e.docView&&e.docView.dirty){let n=rt(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function xn(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement(`div`));n.appendChild(t),n.style.cssText=`position: fixed; left: -10000px; top: 10px`;let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const Sn=D&&O<15||M&&le<604;K.copy=q.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type==`cut`;if(r.empty)return;let a=Sn?null:n.clipboardData,{dom:o,text:s}=Nt(e,r.content());a?(n.preventDefault(),a.clearData(),a.setData(`text/html`,o.innerHTML),a.setData(`text/plain`,s)):xn(e,o),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta(`uiEvent`,`cut`))};function Cn(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function wn(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?`textarea`:`div`));n||(r.contentEditable=`true`),r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.focus();let i=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Tn(e,r.value,null,i,t):Tn(e,r.textContent,r.innerHTML,i,t)},50)}function Tn(e,t,n,r,i){let a=Pt(e,t,n,r,e.state.selection.$from);if(e.someProp(`handlePaste`,t=>t(e,i,a||s.empty)))return!0;if(!a)return!1;let o=Cn(a),c=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(c.scrollIntoView().setMeta(`paste`,!0).setMeta(`uiEvent`,`paste`)),!0}function En(e){let t=e.getData(`text/plain`)||e.getData(`Text`);if(t)return t;let n=e.getData(`text/uri-list`);return n?n.replace(/\r?\n/g,` `):``}q.paste=(e,t)=>{let n=t;if(e.composing&&!P)return;let r=Sn?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Tn(e,En(r),r.getData(`text/html`),i,n)?n.preventDefault():wn(e,n)};class Dragging{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const Dn=N?`altKey`:`ctrlKey`;function On(e,t){let n;return e.someProp(`dragCopies`,e=>{n=n||e(t)}),n==null?!t[Dn]:!n}K.dragstart=(e,n)=>{let r=n,i=e.input.mouseDown;if(i&&i.done(),!r.dataTransfer)return;let a=e.state.selection,o=a.empty?null:e.posAtCoords(Y(r)),s;if(!(o&&o.pos>=a.from&&o.pos<=(a instanceof t?a.to-1:a.to))){if(i&&i.mightDrag)s=t.create(e.state.doc,i.mightDrag.pos);else if(r.target&&r.target.nodeType==1){let n=e.docView.nearestDesc(r.target,!0);n&&n.node.type.spec.draggable&&n!=e.docView&&(s=t.create(e.state.doc,n.posBefore))}}let{dom:c,text:l,slice:u}=Nt(e,(s||e.state.selection).content());(!r.dataTransfer.files.length||!A||se>120)&&r.dataTransfer.clearData(),r.dataTransfer.setData(Sn?`Text`:`text/html`,c.innerHTML),r.dataTransfer.effectAllowed=`copyMove`,Sn||r.dataTransfer.setData(`text/plain`,l),e.dragging=new Dragging(u,On(e,r),s)},K.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{kn(e,t,e.dragging)}finally{e.dragging=null}};function kn(e,n,r){if(!n.dataTransfer)return;let i=e.posAtCoords(Y(n));if(!i)return;let a=e.state.doc.resolve(i.pos),o=r&&r.slice;o?e.someProp(`transformPasted`,t=>{o=t(o,e,!1)}):o=Pt(e,En(n.dataTransfer),Sn?null:n.dataTransfer.getData(`text/html`),!1,a);let c=!!(r&&On(e,n));if(e.someProp(`handleDrop`,t=>t(e,n,o||s.empty,c))){n.preventDefault();return}if(!o)return;n.preventDefault();let u=o?l(e.state.doc,a.pos,o):a.pos;u==null&&(u=a.pos);let d=e.state.tr;if(c){let{node:e}=r;e?e.replace(d):d.deleteSelection()}let f=d.mapping.map(u),p=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,m=d.doc;if(p?d.replaceRangeWith(f,f,o.content.firstChild):d.replaceRange(f,f,o),d.doc.eq(m))return;let h=d.doc.resolve(f);if(p&&t.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))d.setSelection(new t(h));else{let t=d.mapping.map(u);d.mapping.maps[d.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),d.setSelection(pt(e,h,d.doc.resolve(t)))}e.focus(),e.dispatch(d.setMeta(`uiEvent`,`drop`))}K.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())&&V(e)},20))},K.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove(`ProseMirror-focused`),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},K.beforeinput=(e,t)=>{if(P&&t.inputType==`deleteContentBackward`){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,w(8,`Backspace`)))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in q)K[e]=q[e];function An(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class WidgetType{constructor(e,t){this.toDOM=e,this.spec=t||Z,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:a}=e.mapResult(t.from+r,this.side<0?-1:1);return a?null:new Decoration(i-n,i-n,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&&An(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class InlineType{constructor(e,t){this.attrs=e,this.spec=t||Z}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,a=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=a?null:new Decoration(i,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof InlineType&&An(this.attrs,e.attrs)&&An(this.spec,e.spec)}static is(e){return e.type instanceof InlineType}destroy(){}}class NodeType{constructor(e,t){this.attrs=e,this.spec=t||Z}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let a=e.mapResult(t.to+r,-1);return a.deleted||a.pos<=i.pos?null:new Decoration(i.pos-n,a.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof NodeType&&An(this.attrs,e.attrs)&&An(this.spec,e.spec)}destroy(){}}class Decoration{constructor(e,t,n){this.from=e,this.to=t,this.type=n}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,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new Decoration(e,e,new WidgetType(t,n))}static inline(e,t,n,r){return new Decoration(e,t,new InlineType(n,r))}
vendor: 4,424 bytes, line 7
7static node(e,t,n,r){return new Decoration(e,t,new NodeType(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof InlineType}get widget(){return this.type instanceof WidgetType}}const X=[],Z={};class DecorationSet{constructor(e,t){this.local=e.length?e:X,this.children=t.length?t:X}static create(e,t){return t.length?In(t,e,0,Z):Q}find(e,t,n){let r=[];return this.findInner(e==null?0:e,t==null?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let a=0;a<this.local.length;a++){let o=this.local[a];o.from<=t&&o.to>=e&&(!i||i(o.spec))&&n.push(o.copy(o.from+r,o.to+r))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let o=this.children[a]+1;this.children[a+2].findInner(e-o,t-o,n,r+o,i)}}map(e,t,n){return this==Q||e.maps.length==0?this:this.mapInner(e,t,0,0,n||Z)}mapInner(e,t,n,r,i){let a;for(let o=0;o<this.local.length;o++){let s=this.local[o].map(e,n,r);s&&s.type.valid(t,s)?(a||(a=[])).push(s):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?jn(this.children,a||[],e,t,n,r,i):a?new DecorationSet(a.sort($),X):Q}add(e,t){return t.length?this==Q?DecorationSet.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach((e,a)=>{let o=a+n,s;if(s=Pn(t,e,o)){for(r||(r=this.children.slice());i<r.length&&r[i]<a;)i+=3;r[i]==a?r[i+2]=r[i+2].addInner(e,s,o+1):r.splice(i,0,a,a+e.nodeSize,In(s,e,o+1,Z)),i+=3}});let a=Mn(i?Fn(t):t,-n);for(let t=0;t<a.length;t++)a[t].type.valid(e,a[t])||a.splice(t--,1);return new DecorationSet(a.length?this.local.concat(a).sort($):this.local,r||this.children)}remove(e){return e.length==0||this==Q?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let i,a=n[r]+t,o=n[r+1]+t;for(let t=0,n;t<e.length;t++)(n=e[t])&&n.from>a&&n.to<o&&(e[t]=null,(i||(i=[])).push(n));if(!i)continue;n==this.children&&(n=this.children.slice());let s=n[r+2].removeInner(i,a+1);s==Q?(n.splice(r,3),r-=3):n[r+2]=s}if(r.length){for(let n=0,i;n<e.length;n++)if(i=e[n])for(let e=0;e<r.length;e++)r[e].eq(i,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1))}return n==this.children&&r==this.local?this:r.length||n.length?new DecorationSet(r,n):Q}forChild(e,t){if(this==Q)return this;if(t.isLeaf)return DecorationSet.empty;let n,r;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let i=e+1,a=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<a&&t.to>i&&t.type instanceof InlineType){let e=Math.max(i,t.from)-i,n=Math.min(a,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new DecorationSet(r.sort($),X);return n?new DecorationGroup([e,n]):e}return n||Q}eq(e){if(this==e)return!0;if(!(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 Ln(this.localsInner(e))}localsInner(e){if(this==Q)return X;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=Ln;const Q=DecorationSet.empty;class DecorationGroup{constructor(e){this.members=e}map(e,t){let n=this.members.map(n=>n.map(e,t,Z));return DecorationGroup.from(n)}forChild(e,t){if(t.isLeaf)return DecorationSet.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=Q&&(i instanceof DecorationGroup?n=n.concat(i.members):n.push(i))}return DecorationGroup.from(n)}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,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}}return t?Ln(n?t:t.sort($)):X}static from(e){switch(e.length){case 0:return Q;case 1:return e[0];default:return new DecorationGroup(e.every(e=>e instanceof DecorationSet)?e:e.reduce((e,t)=>
vendor: 7,211 bytes, line 7
7e.concat(t instanceof DecorationSet?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function jn(e,t,n,r,i,a,o){let s=e.slice();for(let e=0,t=a;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,a)=>{let o=a-i-(n-e);for(let i=0;i<s.length;i+=3){let a=s[i+1];if(a<0||e>a+t-r)continue;let c=s[i]+t-r;n>=c?s[i+1]=e<=c?-2:-1:e>=t&&o&&(s[i]+=o,s[i+1]+=o)}r+=o}),t=n.maps[e].map(t,-1)}let c=!1;for(let t=0;t<s.length;t+=3)if(s[t+1]<0){if(s[t+1]==-2){c=!0,s[t+1]=-1;continue}let l=n.map(e[t]+a),u=l-i;if(u<0||u>=r.content.size){c=!0;continue}let d=n.map(e[t+1]+a,-1)-i,{index:f,offset:p}=r.content.findIndex(u),m=r.maybeChild(f);if(m&&p==u&&p+m.nodeSize==d){let r=s[t+2].mapInner(n,m,l+1,e[t]+a+1,o);r==Q?(s[t+1]=-2,c=!0):(s[t]=u,s[t+1]=d,s[t+2]=r)}else c=!0}if(c){let c=In(Nn(s,e,t,n,i,a,o),r,0,o);t=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<s.length&&s[t]<n;)t+=3;s.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new DecorationSet(t.sort($),s)}function Mn(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new Decoration(i.from+t,i.to+t,i.type))}return n}function Nn(e,t,n,r,i,a,o){function s(e,t){for(let a=0;a<e.local.length;a++){let s=e.local[a].map(r,i,t);s?n.push(s):o.onRemove&&o.onRemove(e.local[a].spec)}for(let n=0;n<e.children.length;n+=3)s(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)e[n+1]==-1&&s(e[n+2],t[n]+a+1);return n}function Pn(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,a;t<e.length;t++)(a=e[t])&&a.from>n&&a.to<r&&((i||(i=[])).push(a),e[t]=null);return i}function Fn(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function In(e,t,n,r){let i=[],a=!1;t.forEach((t,o)=>{let s=Pn(e,t,o+n);if(s){a=!0;let e=In(s,t,n+o+1,r);e!=Q&&i.push(o,o+t.nodeSize,e)}});let o=Mn(a?Fn(e):e,-n).sort($);for(let e=0;e<o.length;e++)o[e].type.valid(t,o[e])||(r.onRemove&&r.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new DecorationSet(o,i):Q}function $(e,t){return e.from-t.from||e.to-t.to}function Ln(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let a=t[i];if(a.from==r.from){a.to!=r.to&&(t==e&&(t=e.slice()),t[i]=a.copy(a.from,r.to),Rn(t,i+1,a.copy(r.to,a.to)));continue}else{a.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,a.from),Rn(t,i,r.copy(a.from,r.to)));break}}}return t}function Rn(e,t,n){for(;t<e.length&&$(n,e[t])>0;)t++;e.splice(t,0,n)}function zn(e){let t=[];return e.someProp(`decorations`,n=>{let r=n(e.state);r&&r!=Q&&t.push(r)}),e.cursorWrapper&&t.push(DecorationSet.create(e.state.doc,[e.cursorWrapper.deco])),DecorationGroup.from(t)}const Bn={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Vn=D&&O<=11;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}}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]);D&&O<=11&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():j&&e.composing&&t.some(e=>e.type==`childList`&&e.target.nodeName==`TR`)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Vn&&(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,Bn)),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(mt(this.view)){if(this.suppressingSelectionUpdates)return V(this.view);if(D&&O<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&h(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=/* @__PURE__ */ new Set,n;for(let n=e.focusNode;n;n=d(n))t.add(n);for(let r=e.anchorNode;r;r=d(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:`selection`,target:n.nodeType==3?n.parentNode:n}))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 r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&mt(e)&&!this.ignoreSelectionChange(r),a=-1,o=-1,s=!1,c=[];if(e.editable)for(let e=0;e<t.length;e++){let n=this.registerMutation(t[e],c);n&&(a=a<0?n.from:Math.min(n.from,a),o=o<0?n.to:Math.max(n.to,o),n.typeOver&&(s=!0))}if(c.some(e=>e.nodeName==`BR`)&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||A&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&t.some(e=>e.type==`childList`&&e.removedNodes.length))){for(let e of c)if(e.nodeName==`BR`&&e.parentNode){let t=e.nextSibling;for(;t&&t.nodeType==1;){if(t.contentEditable==`false`){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(k&&c.length){let t=c.filter(e=>e.nodeName==`BR`);if(t.length==2){let[e,n]=t;e.parentNode&&e.parentNode.parentNode==n.parentNode?n.remove():e.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of t){let t=r.parentNode;t&&t.nodeName==`LI`&&(!n||qn(e,n)!=t)&&r.remove()}}}let l=null;a<0&&i&&e.input.lastFocus>
vendor: 3,502 bytes, line 7
7Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&C(r)&&(l=rt(e))&&l.eq(n.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,V(e),this.currentSelection.set(r),e.scrollToSelection()):(a>-1||i)&&(a>-1&&(e.docView.markDirty(a,o),Wn(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,Jn(e,c)),this.handleDOMChange(a,o,s,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||V(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if(e.type==`attributes`&&(n==this.view.docView||e.attributeName==`contenteditable`||e.attributeName==`style`&&!e.oldValue&&!e.target.getAttribute(`style`))||!n||n.ignoreMutation(e))return null;if(e.type==`childList`){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),r.nodeType==3&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(D&&O<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:a}=e.addedNodes[t];(!n||Array.prototype.indexOf.call(e.addedNodes,n)<0)&&(r=n),(!a||Array.prototype.indexOf.call(e.addedNodes,a)<0)&&(i=a)}let a=r&&r.parentNode==e.target?u(r)+1:0,o=n.localPosFromDOM(e.target,a,-1),s=i&&i.parentNode==e.target?u(i):e.target.childNodes.length;return{from:o,to:n.localPosFromDOM(e.target,s,1)}}else if(e.type==`attributes`)return{from:n.posAtStart-n.border,to:n.posAtEnd+n.border};else return this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}}}let Hn=/* @__PURE__ */ new WeakMap,Un=!1;function Wn(e){if(!Hn.has(e)&&(Hn.set(e,null),[`normal`,`nowrap`,`pre-line`].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=k,Un)return;console.warn(`ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.`),Un=!0}}function Gn(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return h(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function Kn(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Gn(e,n)}let n;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener(`beforeinput`,r,!0),document.execCommand(`indent`),e.dom.removeEventListener(`beforeinput`,r,!0),n?Gn(e,n):null}function qn(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}function Jn(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let a of t)if(((n=a.parentNode)==null?void 0:n.nodeName)==`TR`){let t=a.nextSibling;for(;t&&t.nodeName!=`TD`&&t.nodeName!=`TH`;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||e.nodeType!=1||e.contentEditable==`false`||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(a,n.firstChild),r==a&&e.domSelection().collapse(a,i)}else a.parentNode.removeChild(a)}}function Yn(e,t,n,r){let{node:i,fromOffset:a,toOffset:o,from:s,to:l}=e.docView.parseRange(t,n),u=e.domSelectionRange(),d,f=u.anchorNode;if(f&&e.dom.contains(f.nodeType==1?f:f.parentNode)&&(d=[{node:f,offset:u.anchorOffset}
vendor: 1,470 bytes, line 7
7],C(u)||d.push({node:u.focusNode,offset:u.focusOffset})),A&&e.input.lastKeyCode===8)for(let e=o;e>a;e--){let t=i.childNodes[e-1],n=t.pmViewDesc;if(t.nodeName==`BR`&&!n){o=e;break}if(!n||n.size)break}let p=e.state.doc,m=e.someProp(`domParser`)||c.fromSchema(e.state.schema),h=p.resolve(s),g=null,_=m.parse(i,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:a,to:o,preserveWhitespace:h.parent.type.whitespace==`pre`?`full`:!0,findPositions:d,ruleFromNode:Xn(r),context:h});if(d&&d[0].pos!=null){let e=d[0].pos,t=d[1]&&d[1].pos;t==null&&(t=e),g={anchor:e+s,head:t+s}}return{doc:_,sel:g,from:s,to:l}}const Xn=e=>t=>{let n=t.pmViewDesc;if(n)return n.parseRule(e);if(t.nodeName==`BR`&&t.parentNode){if(j&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let e=document.createElement(`div`);return e.appendChild(document.createElement(`li`)),{skip:e}}else if(t.parentNode.lastChild==t||j&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName==`IMG`&&t.getAttribute(`mark-placeholder`))return{ignore:!0};return null},Zn=/^(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 Qn(t,n,r,i,a){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,n<0){let e=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,n=rt(t,e);
vendor: 4,399 bytes, line 7
7if(n&&!t.state.selection.eq(n)){if(A&&P&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp(`handleKeyDown`,e=>e(t,w(13,`Enter`))))return;let r=t.state.tr.setSelection(n);e==`pointer`?r.setMeta(`pointer`,!0):e==`key`&&r.scrollIntoView(),o&&r.setMeta(`composition`,o),t.dispatch(r)}return}let s=t.state.doc.resolve(n),c=s.sharedDepth(r);n=s.before(c+1),r=t.state.doc.resolve(r).after(c+1);let l=t.state.selection,u=Yn(t,n,r,a),d=t.state.doc,f=d.slice(u.from,u.to),p,m;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,m=`end`):(p=t.state.selection.from,m=`start`),t.input.lastKeyCode=null;let h=rr(f.content,u.doc.content,u.from,p,m);if(h&&t.input.domChangeCount++,(M&&t.input.lastIOSEnter>Date.now()-225||P)&&a.some(e=>e.nodeType==1&&!Zn.test(e.nodeName))&&(!h||h.endA>=h.endB)&&t.someProp(`handleKeyDown`,e=>e(t,w(13,`Enter`)))){t.input.lastIOSEnter=0;return}if(!h)if(i&&l instanceof e&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))h={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let e=$n(t,t.state.doc,u.sel);if(e&&!e.eq(t.state.selection)){let n=t.state.tr.setSelection(e);o&&n.setMeta(`composition`,o),t.dispatch(n)}}return}t.state.selection.from<t.state.selection.to&&h.start==h.endB&&t.state.selection instanceof e&&(h.start>t.state.selection.from&&h.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?h.start=t.state.selection.from:h.endA<t.state.selection.to&&h.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(h.endB+=t.state.selection.to-h.endA,h.endA=t.state.selection.to)),D&&O<=11&&h.endB==h.start+1&&h.endA==h.start&&h.start>u.from&&u.doc.textBetween(h.start-u.from-1,h.start-u.from+1)==` \xA0`&&(h.start--,h.endA--,h.endB--);let g=u.doc.resolveNoCache(h.start-u.from),_=u.doc.resolveNoCache(h.endB-u.from),v=d.resolve(h.start),y=g.sameParent(_)&&g.parent.inlineContent&&v.end()>=h.endA;if((M&&t.input.lastIOSEnter>Date.now()-225&&(!y||a.some(e=>e.nodeName==`DIV`||e.nodeName==`P`))||!y&&g.pos<u.doc.content.size&&(!g.sameParent(_)||!g.parent.inlineContent)&&g.pos<_.pos&&!/\S/.test(u.doc.textBetween(g.pos,_.pos,``,``)))&&t.someProp(`handleKeyDown`,e=>e(t,w(13,`Enter`)))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>h.start&&tr(d,h.start,h.endA,g,_)&&t.someProp(`handleKeyDown`,e=>e(t,w(8,`Backspace`)))){P&&A&&t.domObserver.suppressSelectionUpdates();return}A&&h.endB==h.start&&(t.input.lastChromeDelete=Date.now()),P&&!y&&g.start()!=_.start()&&_.parentOffset==0&&g.depth==_.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==h.endA&&(h.endB-=2,_=u.doc.resolveNoCache(h.endB-u.from),setTimeout(()=>{t.someProp(`handleKeyDown`,function(e){return e(t,w(13,`Enter`))})},20));let b=h.start,x=h.endA,S=e=>{let n=e||t.state.tr.replace(b,x,u.doc.slice(h.start-u.from,h.endB-u.from));if(u.sel){let e=$n(t,n.doc,u.sel);e&&!(A&&t.composing&&e.empty&&(h.start!=h.endB||t.input.lastChromeDelete<Date.now()-100)&&(e.head==b||e.head==n.mapping.map(x)-1)||D&&e.empty&&e.head==b)&&n.setSelection(e)}return o&&n.setMeta(`composition`,o),n.scrollIntoView()},C;if(y)if(g.pos==_.pos){D&&O<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>V(t),20));let e=S(t.state.tr.delete(b,x)),n=d.resolve(h.start).marksAcross(d.resolve(h.endA));n&&e.ensureMarks(n),t.dispatch(e)}else if(h.endA==h.endB&&(C=er(g.parent.content.cut(g.parentOffset,_.parentOffset),v.parent.content.cut(v.parentOffset,h.endA-v.start())))){let e=S(t.state.tr);C.type==`add`?e.addMark(b,x,C.mark):e.removeMark(b,x,C.mark),t.dispatch(e)}else if(g.parent.child(g.index()).isText&&g.index()==_.index()-+!_.textOffset){let e=g.parent.textBetween(g.parentOffset,_.parentOffset),n=()=>S(t.state.tr.insertText(e,b,x));t.someProp(`handleTextInput`,r=>r(t,b,x,e,n))||t.dispatch(n())}else t.dispatch(S());else t.dispatch(S())}function $n(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:pt(e,t.resolve(n.anchor),t.resolve(n.head))}function er(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,o=r,s,c,l;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)o=n[e].removeFromSet(o);if(i.length==1&&o.length==0)c=i[0],s=`add`,l=e=>e.mark(c.addToSet(e.marks));else if(i.length==0&&o.length==1)c=o[0],s=`remove`,l=e=>e.mark(c.removeFromSet(e.marks));else return null;let u=[];for(let e=0;e<t.childCount;e++)u.push(l(t.child(e)));
vendor: 8,603 bytes, line 7
7if(a.from(u).eq(e))return{mark:c,type:s}}function tr(e,t,n,r,i){if(n-t<=i.pos-r.pos||nr(r,!0,!1)<i.pos)return!1;let a=e.resolve(t);if(!r.parent.isTextblock){let e=a.nodeAfter;return e!=null&&n==t+e.nodeSize}if(a.parentOffset<a.parent.content.size||!a.parent.isTextblock)return!1;let o=e.resolve(nr(a,!0,!0));return!o.parent.isTextblock||o.pos>n||nr(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function nr(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}function rr(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:c,b:l}=e.findDiffEnd(t,o,s);if(i==`end`){let e=Math.max(0,a-Math.min(c,l));r-=c+e-a}if(c<a&&o<s){let e=r<=a&&r>=c?a-r:0;a-=e,l=a+(l-c),c=a}else if(l<a){let e=r<=a&&r>=l?a-r:0;a-=e,c=a+(c-l),l=a}return{start:a,endA:c,endB:l}}const ir=Pt,ar=bn;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(fr),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement(`div`),e&&(e.appendChild?e.appendChild(this.dom):typeof e==`function`?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=cr(this),sr(this),this.nodeViews=ur(this),this.docView=He(this.state.doc,or(this),zn(this),this.dom,this),this.domObserver=new DOMObserver(this,(e,t,n,r)=>Qn(this,e,t,n,r)),this.domObserver.start(),Yt(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Zt(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(fr),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];t.state=this.state;for(let n in e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n;let r=this.state,i=!1,a=!1;e.storedMarks&&this.composing&&(vn(this),a=!0),this.state=e;let o=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(o||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=ur(this);dr(e,this.nodeViews)&&(this.nodeViews=e,i=!0)}(o||t.handleDOMEvents!=this._props.handleDOMEvents)&&Zt(this),this.editable=cr(this),sr(this);let s=zn(this),c=or(this),l=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?`reset`:e.scrollToSelection>r.scrollToSelection?`to selection`:`preserve`,u=i||!this.docView.matchesNode(e.doc,c,s);(u||!e.selection.eq(r.selection))&&(a=!0);let d=l==`preserve`&&a&&this.dom.style.overflowAnchor==null&&pe(this);if(a){this.domObserver.stop();let t=u&&(D||A)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&lr(r.selection,e.selection);if(u){let n=A?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=yn(this)),(i||!this.docView.update(e.doc,c,s,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=He(e.doc,c,s,this.dom,this)),n&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(t=!0)}let n=this.input.mouseDown;t||!(n&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&gt(this)&&n.delaySelUpdate())?V(this,t):(dt(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(n=this.dragging)!=null&&n.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),l==`reset`?this.dom.scrollTop=0:l==`to selection`?this.scrollToSelection():d&&he(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp(`handleScrollToSelection`,e=>e(this)))if(this.state.selection instanceof t){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&fe(this,t.getBoundingClientRect(),e)}else fe(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){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))}}else for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let e=r.from+(this.state.doc.content.size-n.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==r.node&&(i=e)}this.dragging=new Dragging(e.slice,e.move,i<0?void 0:t.create(this.state.doc,i))}someProp(e,t){let n=this._props&&this._props[e],r;if(n!=null&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(i!=null&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let a=i[n].props[e];if(a!=null&&(r=t?t(a):a))return r}}hasFocus(){if(D){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(e.contentEditable==`false`)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&_e(this.dom),V(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&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 Te(this,e)}coordsAtPos(e,t=1){return Oe(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,n=-1){let r=this.docView.posFromDOM(e,t,n);if(r==null)throw RangeError(`DOM position not inside the editor`);return r}endOfTextblock(e,t){return Le(this,t||this.state,e)}pasteHTML(e,t){return Tn(this,``,e,!1,t||new ClipboardEvent(`paste`))}pasteText(e,t){return Tn(this,e,null,!0,t||new ClipboardEvent(`paste`))}serializeForClipboard(e){return Nt(this,e)}destroy(){this.docView&&(Xt(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],zn(this),this),this.dom.textContent=``):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,m())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return en(this,e)}domSelectionRange(){let e=this.domSelection();return e?j&&this.root.nodeType===11&&ee(this.dom.ownerDocument)==this.dom&&Kn(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}EditorView.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function or(e){let t=Object.create(null);return t.class=`ProseMirror`,t.contenteditable=String(e.editable),e.someProp(`attributes`,n=>{if(typeof n==`function`&&(n=n(e.state)),n)for(let e in n)e==`class`?t.class+=` `+n[e]:e==`style`?t.style=(t.style?t.style+`;`:``)+n[e]:!t[e]&&e!=`contenteditable`&&e!=`nodeName`&&(t[e]=String(n[e]))}),t.translate||(t.translate=`no`),[Decoration.node(0,e.state.doc.content.size,t)]}function sr(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 cr(e){return!e.someProp(`editable`,t=>t(e.state)===!1)}function lr(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function ur(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}
7return e.someProp(`nodeViews`,n),e.someProp(`markViews`,n),t}function dr(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r}function fr(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`)}export{Decoration,DecorationSet,EditorView,ar as __endComposition,ir as __parseFromClipboard};
8

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.