PageSourceSearch

https://static.toss.im/frontend/toss.im/toss-im-career/_next/static/chunks/64372fe3-2eb8e401b1e81eed.js

js toss.im collected 2026-09-24 08:35:02 UTC 179,137 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2299],{16783:function(t,e,i){i.d(e,{p:function(){return bt},Nm:function(){return ie},tk:function(){return un},SJ:function(){return Zn},lg:function(){return $t},l9:function(){return yt},gB:function(){return Jn},ZO:function(){return zn},AE:function(){return Hn},$f:function(){return wn},Eu:function(){return vr},OO:function(){return jt},hJ:function(){return Yn}});var n=i(57540),r=i(26221),o=i(14091);function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function h(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function u(t,e,i){return e&&h(t.prototype,e),i&&h(t,i),t}function c(t,e,i){return c="undefined"!==typeof Reflect&&Reflect.get?Reflect.get:function(t,e,i){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}(t,e);if(n){var r=Object.getOwnPropertyDescriptor(n,e);return r.get?r.get.call(i||t):r.value}},c(t,e,i||t)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function d(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&g(t,e)}function v(t,e){return!e||"object"!==function(t){return t&&"undefined"!==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}(e)&&"function"!==typeof e?a(t):e}function g(t,e){return g=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},g(t,e)}function p(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!==typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t,e){if(t){if("string"===typeof t)return s(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(i):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?s(t,e):void 0}}function y(t){var e=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var i,n=f(t);if(e){var r=f(this).constructor;i=Reflect.construct(n,arguments,r)}else i=n.apply(this,arguments);return v(this,i)}}function w(t){return(11==t.nodeType?t.getSelection?t:t.ownerDocument:t).getSelection()}function b(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function k(t,e){if(!e.anchorNode)return!1;try{return b(t,e.anchorNode)}catch(i){return!1}}function S(t){return 3==t.nodeType?L(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function x(t,e,i,n){return!!i&&(A(t,e,i,n,-1)||A(t,e,i,n,1))}function M(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function A(t,e,i,n,r){for(;;){if(t==i&&e==n)return!0;if(e==(r<0?0:D(t))){if("DIV"==t.nodeName)return!1;var o=t.parentNode;if(!o||1!=o.nodeType)return!1;e=M(t)+(r<0?0:1),t=o}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[e+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=r<0?D(t):0}}}function D(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function C(t,e){var i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function O(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}var T,E=function(){function t(){l(this,t),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return u(t,[{key:"eq",value:function(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}},{key:"setRange",value:function(t){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}}
1,{key:"set",value:function(t,e,i,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=n}}]),t}(),R=null;function B(t){if(t.setActive)return t.setActive();if(R)return t.focus(R);for(var e=[],i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==R?{get preventScroll(){return R={preventScroll:!0},!0}}:void 0),!R){R=!1;for(var n=0;n<e.length;){var r=e[n++],o=e[n++],s=e[n++];r.scrollTop!=o&&(r.scrollTop=o),r.scrollLeft!=s&&(r.scrollLeft=s)}}}function L(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,n=T||(T=document.createRange());return n.setEnd(t,i),n.setStart(t,e),n}function H(t,e,i){var n={key:e,code:e,keyCode:i,which:i,cancelable:!0},r=new KeyboardEvent("keydown",n);r.synthetic=!0,t.dispatchEvent(r);var o=new KeyboardEvent("keyup",n);return o.synthetic=!0,t.dispatchEvent(o),r.defaultPrevented||o.defaultPrevented}function V(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function P(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}var N=function(){function t(e,i){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];l(this,t),this.node=e,this.offset=i,this.precise=n}return u(t,null,[{key:"before",value:function(e,i){return new t(e.parentNode,M(e),i)}},{key:"after",value:function(e,i){return new t(e.parentNode,M(e)+1,i)}}]),t}(),W=[],z=function(){function t(){l(this,t),this.parent=null,this.dom=null,this.dirty=2}return u(t,[{key:"overrideDOMText",get:function(){return null}},{key:"posAtStart",get:function(){return this.parent?this.parent.posBefore(this):0}},{key:"posAtEnd",get:function(){return this.posAtStart+this.length}},{key:"posBefore",value:function(t){var e=this.posAtStart,i=!0,n=!1,r=void 0;try{for(var o,s=this.children[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){var a=o.value;if(a==t)return e;e+=a.length+a.breakAfter}}catch(l){n=!0,r=l}finally{try{i||null==s.return||s.return()}finally{if(n)throw r}}throw new RangeError("Invalid child in posBefore")}},{key:"posAfter",value:function(t){return this.posBefore(t)+t.length}},{key:"sync",value:function(e,i){if(2&this.dirty){var n,r=this.dom,o=null,s=!0,a=!1,l=void 0;try{for(var h,u=this.children[Symbol.iterator]();!(s=(h=u.next()).done);s=!0){var c=h.value;if(c.dirty){if(!c.dom&&(n=o?o.nextSibling:r.firstChild)){var f=t.get(n);(!f||!f.parent&&f.canReuseDOM(c))&&c.reuseDOM(n)}c.sync(e,i),c.dirty=0}if(n=o?o.nextSibling:r.firstChild,i&&!i.written&&i.node==r&&n!=c.dom&&(i.written=!0),c.dom.parentNode==r)for(;n&&n!=c.dom;)n=F(n);else r.insertBefore(c.dom,n);o=c.dom}}catch(w){a=!0,l=w}finally{try{s||null==u.return||u.return()}finally{if(a)throw l}}for((n=o?o.nextSibling:r.firstChild)&&i&&i.node==r&&(i.written=!0);n;)n=F(n)}else if(1&this.dirty){var d=!0,v=!1,g=void 0;try{for(var p,m=this.children[Symbol.iterator]();!(d=(p=m.next()).done);d=!0){var y=p.value;y.dirty&&(y.sync(e,i),y.dirty=0)}}catch(w){v=!0,g=w}finally{try{d||null==m.return||m.return()}finally{if(v)throw g}}}}},{key:"reuseDOM",value:function(t){}},{key:"localPosFromDOM",value:function(e,i){var n;if(e==this.dom)n=this.dom.childNodes[i];else{for(var r=0==D(e)?0:0==i?-1:1;;){var o=e.parentNode;if(o==this.dom)break;0==r&&o.firstChild!=o.lastChild&&(r=e==o.firstChild?-1:1),e=o}n=r<0?e:e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!t.get(n);)n=n.nextSibling;if(!n)return this.length;for(var s=0,a=0;;s++){var l=this.children[s];if(l.dom==n)return a;a+=l.length+l.breakAfter}}},{key:"domBoundsAround",value:function(t,e){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=-1,r=-1,o=-1,s=-1,a=0,l=i,h=i;a<this.children.length;a++){var u=this.children[a],c=l+u.length;if(l<t&&c>e)return u.domBoundsAround(t,e,l);if(c>=t&&-1==n&&(n=a,r=l),l>e&&u.dom.parentNode==this.dom){o=a,s=h;break}h=c,l=c+u.breakAfter}return{from:r,to:s<0?i+this.length:s,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}},{key:"markDirty",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.dirty|=2,this.markParentsDirty(t)}},{key:"markParentsDirty",value:function(t){for(var e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}},{key:"setParent",value:function(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}},{key:"setDOM",value:function(t){this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this}},{key:"rootView",get:function(){for(var t=this;;){var e=t.parent;if(!e)return t;t=e}}},{key:"replaceChildren",value:function(t,e){var i,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:W;this.markDirty();for(var r=t;r<e;r++){var o=this.children[r];o.parent==this&&o.destroy()}(i=this.children).splice.apply(i,[t,e-t].concat(p(n)));for(var s=0;s<n.length;s++)n[s].setParent(this)}},{key:"ignoreMutation",value:function(t){return!1}},{key:"ignoreEvent",value:function(t){return!1}},{key:"childCursor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length;return new I(this.children,t,this.children.length)}},{key:"childPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.childCursor().findPos(t,e)}},{key:"toString",value:function(){var t=this.constructor.name.replace("View","");return t+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==t?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}},{key:"isEditable",get:function(){return!0}},{key:"isWidget",get:function(){return!1}},{key:"isHidden",get:function(){return!1}}
1,{key:"merge",value:function(t,e,i,n,r,o){return!1}},{key:"become",value:function(t){return!1}},{key:"canReuseDOM",value:function(t){return t.constructor==this.constructor}},{key:"getSide",value:function(){return 0}},{key:"destroy",value:function(){this.parent=null}}],[{key:"get",value:function(t){return t.cmView}}]),t}();function F(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}z.prototype.breakAfter=0;var I=function(){function t(e,i,n){l(this,t),this.children=e,this.pos=i,this.i=n,this.off=0}return u(t,[{key:"findPos",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;;){if(t>this.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;var i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}]),t}();function j(t,e,i,n,r,o,s,a,l){var h=t.children,u=h.length?h[e]:null,c=o.length?o[o.length-1]:null,f=c?c.breakAfter:s;if(!(e==n&&u&&!s&&!f&&o.length<2&&u.merge(i,r,o.length?c:null,0==i,a,l))){if(n<h.length){var d=h[n];d&&r<d.length?(e==n&&(d=d.split(r),r=0),!f&&c&&d.merge(0,r,c,!0,0,l)?o[o.length-1]=d:(r&&d.merge(0,r,null,!1,0,l),o.push(d))):(null===d||void 0===d?void 0:d.breakAfter)&&(c?c.breakAfter=1:s=1),n++}for(u&&(u.breakAfter=s,i>0&&(!s&&o.length&&u.merge(i,u.length,o[0],!1,a,0)?u.breakAfter=o.shift().breakAfter:(i<u.length||u.children.length&&0==u.children[u.children.length-1].length)&&u.merge(i,u.length,null,!1,a,0),e++));e<n&&o.length;)if(h[n-1].become(o[o.length-1]))n--,o.pop(),l=o.length?0:a;else{if(!h[e].become(o[0]))break;e++,o.shift(),a=o.length?0:l}!o.length&&e&&n<h.length&&!h[e-1].breakAfter&&h[n].merge(0,0,h[e-1],!1,a,l)&&e--,(e<n||o.length)&&t.replaceChildren(e,n,o)}}function K(t,e,i,n,r,o){var s=t.childCursor(),a=s.findPos(i,1),l=a.i,h=a.off,u=s.findPos(e,-1),c=u.i,f=u.off,d=e-i,v=!0,g=!1,p=void 0;try{for(var m,y=n[Symbol.iterator]();!(v=(m=y.next()).done);v=!0){d+=m.value.length}}catch(w){g=!0,p=w}finally{try{v||null==y.return||y.return()}finally{if(g)throw p}}t.length+=d,j(t,c,f,l,h,n,0,r,o)}var q="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},G="undefined"!=typeof document?document:{documentElement:{style:{}}},$=/Edge\/(\d+)/.exec(q.userAgent),_=/MSIE \d/.test(q.userAgent),X=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(q.userAgent),U=!!(_||X||$),Y=!U&&/gecko\/(\d+)/i.test(q.userAgent),J=!U&&/Chrome\/(\d+)/.exec(q.userAgent),Z="webkitFontSmoothing"in G.documentElement.style,Q=!U&&/Apple Computer/.test(q.vendor),tt=Q&&(/Mobile\/\w+/.test(q.userAgent)||q.maxTouchPoints>2),et={mac:tt||/Mac/.test(q.platform),windows:/Win/.test(q.platform),linux:/Linux|X11/.test(q.platform),ie:U,ie_version:_?G.documentMode||6:X?+X[1]:$?+$[1]:0,gecko:Y,gecko_version:Y?+(/Firefox\/(\d+)/.exec(q.userAgent)||[0,0])[1]:0,chrome:!!J,chrome_version:J?+J[1]:0,ios:tt,android:/Android\b/.test(q.userAgent),webkit:Z,safari:Q,webkit_version:Z?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=G.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},it=function(t){d(i,t);var e=y(i);function i(t){var n;return l(this,i),(n=e.call(this)).text=t,n}return u(i,[{key:"length",get:function(){return this.text.length}},{key:"createDOM",value:function(t){this.setDOM(t||document.createTextNode(this.text))}},{key:"sync",value:function(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}},{key:"reuseDOM",value:function(t){3==t.nodeType&&this.createDOM(t)}},{key:"merge",value:function(t,e,n){return(!n||n instanceof i&&!(this.length-(e-t)+n.length>256))&&(this.text=this.text.slice(0,t)+(n?n.text:"")+this.text.slice(e),this.markDirty(),!0)}},{key:"split",value:function(t){var e=new i(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}},{key:"localPosFromDOM",value:function(t,e){return t==this.dom?e:e?this.text.length:0}},{key:"domAtPos",value:function(t){return new N(this.dom,t)}},{key:"domBoundsAround",value:function(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}},{key:"coordsAt",value:function(t,e){return rt(this.dom,t,e)}}]),i}(z),nt=function(t){d(i,t);var e=y(i);function i(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;l(this,i),(n=e.call(this)).mark=t,n.children=r,n.length=o;var s=!0,h=!1,u=void 0;try{for(var c,f=r[Symbol.iterator]();!(s=(c=f.next()).done);s=!0){var d=c.value;d.setParent(a(n))}}catch(v){h=!0,u=v}finally{try{s||null==f.return||f.return()}finally{if(h)throw u}}return n}return u(i,[{key:"setAttrs",value:function(t){if(P(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(var e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}}
1,{key:"reuseDOM",value:function(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}},{key:"sync",value:function(t,e){this.dom?4&this.dirty&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),c(f(i.prototype),"sync",this).call(this,t,e)}},{key:"merge",value:function(t,e,n,r,o,s){return(!n||!(!(n instanceof i&&n.mark.eq(this.mark))||t&&o<=0||e<this.length&&s<=0))&&(K(this,t,e,n?n.children:[],o-1,s-1),this.markDirty(),!0)}},{key:"split",value:function(t){var e=[],n=0,r=-1,o=0,s=!0,a=!1,l=void 0;try{for(var h,u=this.children[Symbol.iterator]();!(s=(h=u.next()).done);s=!0){var c=h.value,f=n+c.length;f>t&&e.push(n<t?c.split(t-n):c),r<0&&n>=t&&(r=o),n=f,o++}}catch(v){a=!0,l=v}finally{try{s||null==u.return||u.return()}finally{if(a)throw l}}var d=this.length-t;return this.length=t,r>-1&&(this.children.length=r,this.markDirty()),new i(this.mark,e,d)}},{key:"domAtPos",value:function(t){return ft(this,t)}},{key:"coordsAt",value:function(t,e){return vt(this,t,e)}}]),i}(z);function rt(t,e,i){var n=t.nodeValue.length;e>n&&(e=n);var r=e,o=e,s=0;0==e&&i<0||e==n&&i>=0?et.chrome||et.gecko||(e?(r--,s=1):o<n&&(o++,s=-1)):i<0?r--:o<n&&o++;var a=L(t,r,o).getClientRects();if(!a.length)return null;var l=a[(s?s<0:i>=0)?0:a.length-1];return et.safari&&!s&&0==l.width&&(l=Array.prototype.find.call(a,(function(t){return t.width}))||l),s?C(l,s<0):l||null}var ot=function(t){d(i,t);var e=y(i);function i(t,n,r){var o;return l(this,i),(o=e.call(this)).widget=t,o.length=n,o.side=r,o.prevWidget=null,o}return u(i,[{key:"split",value:function(t){var e=i.create(this.widget,this.length-t,this.side);return this.length-=t,e}},{key:"sync",value:function(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.dom.contentEditable="false")}},{key:"getSide",value:function(){return this.side}},{key:"merge",value:function(t,e,n,r,o,s){return!(n&&(!(n instanceof i&&this.widget.compare(n.widget))||t>0&&o<=0||e<this.length&&s<=0))&&(this.length=t+(n?n.length:0)+(this.length-e),!0)}},{key:"become",value:function(t){return t instanceof i&&t.side==this.side&&this.widget.constructor==t.widget.constructor&&(this.widget.compare(t.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,!0)}},{key:"ignoreMutation",value:function(){return!0}},{key:"ignoreEvent",value:function(t){return this.widget.ignoreEvent(t)}},{key:"overrideDOMText",get:function(){if(0==this.length)return n.xv.empty;for(var t=this;t.parent;)t=t.parent;var e=t.view,i=e&&e.state.doc,r=this.posAtStart;return i?i.slice(r,r+this.length):n.xv.empty}},{key:"domAtPos",value:function(t){return(this.length?0==t:this.side>0)?N.before(this.dom):N.after(this.dom,t==this.length)}},{key:"domBoundsAround",value:function(){return null}},{key:"coordsAt",value:function(t,e){var i=this.widget.coordsAt(this.dom,t,e);if(i)return i;var n=this.dom.getClientRects(),r=null;if(!n.length)return null;for(var o=t>0?n.length-1:0;r=n[o],!(t>0?0==o:o==n.length-1||r.top<r.bottom);o+=t>0?-1:1);return this.length?r:C(r,this.side>0)}},{key:"isEditable",get:function(){return!1}},{key:"isWidget",get:function(){return!0}},{key:"isHidden",get:function(){return this.widget.isHidden}},{key:"destroy",value:function(){c(f(i.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}],[{key:"create",value:function(t,e,n){return new(t.customView||i)(t,e,n)}}]),i}(z),st=function(t){d(i,t);var e=y(i);function i(){return l(this,i),e.apply(this,arguments)}return u(i,[{key:"domAtPos",value:function(t){var e=this.widget,i=e.topView,n=e.text;return i?at(t,0,i,n,this.length-i.length,(function(t,e){return t.domAtPos(e)}),(function(t,e){return new N(t,Math.min(e,t.nodeValue.length))})):new N(n,Math.min(t,n.nodeValue.length))}},{key:"sync",value:function(){this.setDOM(this.widget.toDOM())}},{key:"localPosFromDOM",value:function(t,e){var i=this.widget,n=i.topView,r=i.text;return n?ht(t,e,n,r,this.length-n.length):Math.min(e,this.length)}},{key:"ignoreMutation",value:function(){return!1}},{key:"overrideDOMText",get:function(){return null}},{key:"coordsAt",value:function(t,e){var i=this.widget,n=i.topView,r=i.text;
1return n?at(t,e,n,r,this.length-n.length,(function(t,e,i){return t.coordsAt(e,i)}),(function(t,e,i){return rt(t,e,i)})):rt(r,t,e)}},{key:"destroy",value:function(){var t;c(f(i.prototype),"destroy",this).call(this),null===(t=this.widget.topView)||void 0===t||t.destroy()}},{key:"isEditable",get:function(){return!0}},{key:"canReuseDOM",value:function(){return!0}}]),i}(ot);function at(t,e,i,n,r,o,s){if(i instanceof nt){for(var a=i.dom.firstChild;a;a=a.nextSibling){var l=z.get(a);if(l){var h=b(a,n),u=l.length+(h?r:0);if(t<u||t==u&&l.getSide()<=0)return h?at(t,e,l,n,r,o,s):o(l,t,e);t-=u}else{var c=lt(t,e,a,s);if("number"!=typeof c)return c;t=c}}return o(i,i.length,-1)}return i.dom==n?s(n,t,e):o(i,t,e)}function lt(t,e,i,n){if(3==i.nodeType){var r=i.nodeValue.length;if(t<=r)return n(i,t,e);t-=r}else if(1==i.nodeType&&"false"!=i.contentEditable)for(var o=i.firstChild;o;o=o.nextSibling){var s=lt(t,e,o,n);if("number"!=typeof s)return s;t=s}return t}function ht(t,e,i,n,r){if(i instanceof nt)for(var o=0,s=i.dom.firstChild;s;s=s.nextSibling){var a=z.get(s);if(a){var l=b(s,n);if(b(s,t))return o+(l?ht(t,e,a,n,r):a.localPosFromDOM(t,e));o+=a.length+(l?r:0)}else{var h=ut(t,e,s);if(null!=h.result)return o+h.result;o+=h.size}}else if(i.dom==n)return Math.min(e,n.nodeValue.length);return i.localPosFromDOM(t,e)}function ut(t,e,i){if(3==i.nodeType)return t==i?{result:e}:{size:i.nodeValue.length};if(1!=i.nodeType||"false"==i.contentEditable)return i.contains(t)?{result:0}:{size:0};for(var n=0,r=i.firstChild,o=0;;r=r.nextSibling,o++){if(t==i&&o==e)return{result:n};if(!r)return{size:n};var s=ut(t,e,r);if(null!=s.result)return{result:e+s.result};n+=s.size}}var ct=function(t){d(i,t);var e=y(i);function i(t){var n;return l(this,i),(n=e.call(this)).side=t,n}return u(i,[{key:"length",get:function(){return 0}},{key:"merge",value:function(){return!1}},{key:"become",value:function(t){return t instanceof i&&t.side==this.side}},{key:"split",value:function(){return new i(this.side)}},{key:"sync",value:function(){if(!this.dom){var t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),this.setDOM(t)}}},{key:"getSide",value:function(){return this.side}},{key:"domAtPos",value:function(t){return this.side>0?N.before(this.dom):N.after(this.dom)}},{key:"localPosFromDOM",value:function(){return 0}},{key:"domBoundsAround",value:function(){return null}},{key:"coordsAt",value:function(t){return this.dom.getBoundingClientRect()}},{key:"overrideDOMText",get:function(){return n.xv.empty}},{key:"isHidden",get:function(){return!0}}]),i}(z);function ft(t,e){for(var i=t.dom,n=t.children,r=0,o=0;r<n.length;r++){var s=n[r],a=o+s.length;if(!(a==o&&s.getSide()<=0)){if(e>o&&e<a&&s.dom.parentNode==i)return s.domAtPos(e-o);if(e<=o)break;o=a}}for(var l=r;l>0;l--){var h=n[l-1];if(h.dom.parentNode==i)return h.domAtPos(h.length)}for(var u=r;u<n.length;u++){var c=n[u];if(c.dom.parentNode==i)return c.domAtPos(0)}return new N(i,0)}function dt(t,e,i){var n,r=t.children;i>0&&e instanceof nt&&r.length&&(n=r[r.length-1])instanceof nt&&n.mark.eq(e.mark)?dt(n,e.children[0],i-1):(r.push(e),e.setParent(t)),t.length+=e.length}function vt(t,e,i){var n=null,r=-1,o=null,s=-1;!function t(e,a){for(var l=0,h=0;l<e.children.length&&h<=a;l++){var u=e.children[l],c=h+u.length;c>=a&&(u.children.length?t(u,a-h):(!o||o.isHidden&&i>0)&&(c>a||h==c&&u.getSide()>0)?(o=u,s=a-h):(h<a||h==c&&u.getSide()<0&&!u.isHidden)&&(n=u,r=a-h)),h=c}}(t,e);var a=(i<0?n:o)||n||o;return a?a.coordsAt(Math.max(0,a==n?r:s),i):function(t){var e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();var i=S(e);return i[i.length-1]||null}(t)}function gt(t,e){for(var i in t)"class"==i&&e.class?e.class+=" "+t.class:"style"==i&&e.style?e.style+=";"+t.style:e[i]=t[i];return e}function pt(t,e){if(t==e)return!0;if(!t||!e)return!1;var i=Object.keys(t),n=Object.keys(e);if(i.length!=n.length)return!1;var r=!0,o=!1,s=void 0;try{for(var a,l=i[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var h=a.value;if(-1==n.indexOf(h)||t[h]!==e[h])return!1}}catch(u){o=!0,s=u}finally{try{r||null==l.return||l.return()}finally{if(o)throw s}}return!0}function mt(t,e,i){var n=null;if(e)for(var r in e)i&&r in i||t.removeAttribute(n=r);if(i)for(var o in i)e&&e[o]==i[o]||t.setAttribute(n=o,i[o]);return!!n}it.prototype.children=ot.prototype.children=ct.prototype.children=W;var yt=function(){function t(){l(this,t)}return u(t,[{key:"eq",value:function(t){return!1}},{key:"updateDOM",value:function(t,e){return!1}},{key:"compare",value:function(t){return this==t||this.constructor==t.constructor&&this.eq(t)}},{key:"estimatedHeight",get:function(){return-1}},{key:"ignoreEvent",value:function(t){return!0}}
1,{key:"coordsAt",value:function(t,e,i){return null}},{key:"customView",get:function(){return null}},{key:"isHidden",get:function(){return!1}},{key:"destroy",value:function(t){}}]),t}(),wt=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(wt||(wt={})),bt=function(t){d(i,t);var e=y(i);function i(t,n,r,o){var s;return l(this,i),(s=e.call(this)).startSide=t,s.endSide=n,s.widget=r,s.spec=o,s}return u(i,[{key:"heightRelevant",get:function(){return!1}},{key:"hasHeight",value:function(){return!!this.widget&&this.widget.estimatedHeight>-1}}],[{key:"mark",value:function(t){return new kt(t)}},{key:"widget",value:function(t){var e=t.side||0,i=!!t.block;return new xt(t,e+=i?e>0?3e8:-4e8:e>0?1e8:-1e8,e,i,t.widget||null,!1)}},{key:"replace",value:function(t){var e,i,n=!!t.block;if(t.isBlockGap)e=-5e8,i=4e8;else{var r=Mt(t,n);e=(r.start?n?-3e8:-1:5e8)-1,i=1+(r.end?n?2e8:1:-6e8)}return new xt(t,e,i,n,t.widget||null,!0)}},{key:"line",value:function(t){return new St(t)}},{key:"set",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return n.Xs.of(t,e)}}]),i}(n.uU);bt.none=n.Xs.empty;var kt=function(t){d(i,t);var e=y(i);function i(t){var n;l(this,i);var r=Mt(t),o=r.start,s=r.end;return(n=e.call(this,o?-1:5e8,s?1:-6e8,null,t)).tagName=t.tagName||"span",n.class=t.class||"",n.attrs=t.attributes||null,n}return u(i,[{key:"eq",value:function(t){return this==t||t instanceof i&&this.tagName==t.tagName&&this.class==t.class&&pt(this.attrs,t.attrs)}},{key:"range",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(t>=e)throw new RangeError("Mark decorations may not be empty");return c(f(i.prototype),"range",this).call(this,t,e)}}]),i}(bt);kt.prototype.point=!1;var St=function(t){d(i,t);var e=y(i);function i(t){return l(this,i),e.call(this,-2e8,-2e8,null,t)}return u(i,[{key:"eq",value:function(t){return t instanceof i&&this.spec.class==t.spec.class&&pt(this.spec.attributes,t.spec.attributes)}},{key:"range",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(e!=t)throw new RangeError("Line decoration ranges must be zero-length");return c(f(i.prototype),"range",this).call(this,t,e)}}]),i}(bt);St.prototype.mapMode=n.gc.TrackBefore,St.prototype.point=!0;var xt=function(t){d(i,t);var e=y(i);function i(t,r,o,s,a,h){var u;return l(this,i),(u=e.call(this,r,o,a,t)).block=s,u.isReplace=h,u.mapMode=s?r<=0?n.gc.TrackBefore:n.gc.TrackAfter:n.gc.TrackDel,u}return u(i,[{key:"type",get:function(){return this.startSide<this.endSide?wt.WidgetRange:this.startSide<=0?wt.WidgetBefore:wt.WidgetAfter}},{key:"heightRelevant",get:function(){return this.block||!!this.widget&&this.widget.estimatedHeight>=5}},{key:"eq",value:function(t){return t instanceof i&&(e=this.widget,n=t.widget,e==n||!!(e&&n&&e.compare(n)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var e,n}},{key:"range",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return c(f(i.prototype),"range",this).call(this,t,e)}}]),i}(bt);function Mt(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=t.inclusiveStart,n=t.inclusiveEnd;return null==i&&(i=t.inclusive),null==n&&(n=t.inclusive),{start:null!==i&&void 0!==i?i:e,end:null!==n&&void 0!==n?n:e}}function At(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=i.length-1;r>=0&&i[r]+n>=t?i[r]=Math.max(i[r],e):i.push(t,e)}xt.prototype.point=!0;var Dt=function(t){d(i,t);var e=y(i);function i(){var t;return l(this,i),(t=e.call.apply(e,[this].concat(Array.prototype.slice.call(arguments)))).children=[],t.length=0,t.prevAttrs=void 0,t.attrs=null,t.breakAfter=0,t}return u(i,[{key:"merge",value:function(t,e,n,r,o,s){if(n){if(!(n instanceof i))return!1;this.dom||n.transferDOM(this)}return r&&this.setDeco(n?n.attrs:null),K(this,t,e,n?n.children:[],o,s),!0}},{key:"split",value:function(t){var e=new i;if(e.breakAfter=this.breakAfter,0==this.length)return e;var n=this.childPos(t),r=n.i,o=n.off;o&&(e.append(this.children[r].split(o),0),this.children[r].merge(o,this.children[r].length,null,!1,0,0),r++);for(var s=r;s<this.children.length;s++)e.append(this.children[s],0);for(;r>0&&0==this.children[r-1].length;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=t,e}},{key:"transferDOM",value:function(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}},{key:"setDeco",value:function(t){pt(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}},{key:"append",value:function(t,e){dt(this,t,e)}},{key:"addLineDeco",value:function(t){var e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=gt(e,this.attrs||{})),i&&(this.attrs=gt({class:i},this.attrs||{}))}},{key:"domAtPos",value:function(t){return ft(this,t)}},{key:"reuseDOM",value:function(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}},{key:"sync",value:function(t,e){var n;
1this.dom?4&this.dirty&&(P(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(mt(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),c(f(i.prototype),"sync",this).call(this,t,e);for(var r=this.dom.lastChild;r&&z.get(r)instanceof nt;)r=r.lastChild;if(!r||!this.length||"BR"!=r.nodeName&&0==(null===(n=z.get(r))||void 0===n?void 0:n.isEditable)&&(!et.ios||!this.children.some((function(t){return t instanceof it})))){var o=document.createElement("BR");o.cmIgnore=!0,this.dom.appendChild(o)}}},{key:"measureTextSize",value:function(){if(0==this.children.length||this.length>20)return null;var t,e=0,i=!0,n=!1,r=void 0;try{for(var o,s=this.children[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){var a=o.value;if(!(a instanceof it)||/[^ -~]/.test(a.text))return null;var l=S(a.dom);if(1!=l.length)return null;e+=l[0].width,t=l[0].height}}catch(h){n=!0,r=h}finally{try{i||null==s.return||s.return()}finally{if(n)throw r}}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}},{key:"coordsAt",value:function(t,e){var i=vt(this,t,e);if(!this.children.length&&i&&this.parent){var n=this.parent.view.viewState.heightOracle,r=i.bottom-i.top;if(Math.abs(r-n.lineHeight)<2&&n.textHeight<r){var o=(r-n.textHeight)/2;return{top:i.top+o,bottom:i.bottom-o,left:i.left,right:i.left}}}return i}},{key:"become",value:function(t){return!1}},{key:"type",get:function(){return wt.Text}}],[{key:"find",value:function(t,e){for(var n=0,r=0;n<t.children.length;n++){var o=t.children[n],s=r+o.length;if(s>=e){if(o instanceof i)return o;if(s>e)break}r=s+o.breakAfter}return null}}]),i}(z),Ct=function(t){d(i,t);var e=y(i);function i(t,n,r){var o;return l(this,i),(o=e.call(this)).widget=t,o.length=n,o.type=r,o.breakAfter=0,o.prevWidget=null,o}return u(i,[{key:"merge",value:function(t,e,n,r,o,s){return!(n&&(!(n instanceof i&&this.widget.compare(n.widget))||t>0&&o<=0||e<this.length&&s<=0))&&(this.length=t+(n?n.length:0)+(this.length-e),!0)}},{key:"domAtPos",value:function(t){return 0==t?N.before(this.dom):N.after(this.dom,t==this.length)}},{key:"split",value:function(t){var e=this.length-t;this.length=t;var n=new i(this.widget,e,this.type);return n.breakAfter=this.breakAfter,n}},{key:"children",get:function(){return W}},{key:"sync",value:function(t){this.dom&&this.widget.updateDOM(this.dom,t)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.dom.contentEditable="false")}},{key:"overrideDOMText",get:function(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):n.xv.empty}},{key:"domBoundsAround",value:function(){return null}},{key:"become",value:function(t){return t instanceof i&&t.type==this.type&&t.widget.constructor==this.widget.constructor&&(t.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=t.widget,this.length=t.length,this.breakAfter=t.breakAfter,!0)}},{key:"ignoreMutation",value:function(){return!0}},{key:"ignoreEvent",value:function(t){return this.widget.ignoreEvent(t)}},{key:"isEditable",get:function(){return!1}},{key:"isWidget",get:function(){return!0}},{key:"coordsAt",value:function(t,e){return this.widget.coordsAt(this.dom,t,e)}},{key:"destroy",value:function(){c(f(i.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}]),i}(z),Ot=function(){function t(e,i,n,r){l(this,t),this.doc=e,this.pos=i,this.end=n,this.disallowBlockEffectsFor=r,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=i}return u(t,[{key:"posCovered",value:function(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;var t=this.content[this.content.length-1];return!t.breakAfter&&!(t instanceof Ct&&t.type==wt.WidgetBefore)}},{key:"getLine",value:function(){return this.curLine||(this.content.push(this.curLine=new Dt),this.atCursorPos=!0),this.curLine}},{key:"flushBuffer",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(Tt(new ct(-1),t),t.length),this.pendingBuffer=0)}},{key:"addBlockWidget",value:function(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}},{key:"finish",value:function(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||this.getLine()}}
1,{key:"buildText",value:function(t,e,i){for(;t>0;){if(this.textOff==this.text.length){var n=this.cursor.next(this.skip),r=n.value,o=n.lineBreak,s=n.done;if(this.skip=0,s)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,t--;continue}this.text=r,this.textOff=0}var a=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(Tt(new it(this.text.slice(this.textOff,this.textOff+a)),e),i),this.atCursorPos=!0,this.textOff+=a,t-=a,i=0}}},{key:"span",value:function(t,e,i,n){this.buildText(e-t,i,n),this.pos=e,this.openStart<0&&(this.openStart=n)}},{key:"point",value:function(t,e,i,n,r,o){if(this.disallowBlockEffectsFor[o]&&i instanceof xt){if(i.block)throw new RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}var s=e-t;if(i instanceof xt)if(i.block){var a=i.type;a!=wt.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new Ct(i.widget||new Et("div"),s,a))}else{var l=ot.create(i.widget||new Et("span"),s,s?0:i.startSide),h=this.atCursorPos&&!l.isEditable&&r<=n.length&&(t<e||i.startSide>0),u=!l.isEditable&&(t<e||r>n.length||i.startSide<=0),c=this.getLine();2!=this.pendingBuffer||h||l.isEditable||(this.pendingBuffer=0),this.flushBuffer(n),h&&(c.append(Tt(new ct(1),n),r),r=n.length+Math.max(0,r-n.length)),c.append(Tt(l,n),r),this.atCursorPos=u,this.pendingBuffer=u?t<e||r>n.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);s&&(this.textOff+s<=this.text.length?this.textOff+=s:(this.skip+=s-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r)}}],[{key:"build",value:function(e,i,r,o,s){var a=new t(e,i,r,s);return a.openEnd=n.Xs.spans(o,i,r,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}]),t}();function Tt(t,e){var i=!0,n=!1,r=void 0;try{for(var o,s=e[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){var a=o.value;t=new nt(a,[t],t.length)}}catch(l){n=!0,r=l}finally{try{i||null==s.return||s.return()}finally{if(n)throw r}}return t}var Et=function(t){d(i,t);var e=y(i);function i(t){var n;return l(this,i),(n=e.call(this)).tag=t,n}return u(i,[{key:"eq",value:function(t){return t.tag==this.tag}},{key:"toDOM",value:function(){return document.createElement(this.tag)}},{key:"updateDOM",value:function(t){return t.nodeName.toLowerCase()==this.tag}},{key:"isHidden",get:function(){return!0}}]),i}(yt),Rt=n.r$.define(),Bt=n.r$.define(),Lt=n.r$.define(),Ht=n.r$.define(),Vt=n.r$.define(),Pt=n.r$.define(),Nt=n.r$.define(),Wt=n.r$.define({combine:function(t){return t.some((function(t){return t}))}}),zt=n.r$.define({combine:function(t){return t.some((function(t){return t}))}}),Ft=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"nearest",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"nearest",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:5;l(this,t),this.range=e,this.y=i,this.x=n,this.yMargin=r,this.xMargin=o}return u(t,[{key:"map",value:function(e){return e.empty?this:new t(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}]),t}(),It=n.Py.define({map:function(t,e){return t.map(e)}});function jt(t,e,i){var n=t.facet(Ht);n.length?n[0](e):window.onerror?window.onerror(String(e),i,void 0,void 0,e):i?console.error(i+":",e):console.error(e)}var Kt=n.r$.define({combine:function(t){return!t.length||t[0]}}),qt=0,Gt=n.r$.define(),$t=function(){function t(e,i,n,r){l(this,t),this.id=e,this.create=i,this.domEventHandlers=n,this.extension=r(this)}return u(t,null,[{key:"define",value:function(e,i){var n=i||{},r=n.eventHandlers,o=n.provide,s=n.decorations;return new t(qt++,e,r,(function(t){var e=[Gt.of(t)];return s&&e.push(Yt.of((function(e){var i=e.plugin(t);return i?s(i):bt.none}))),o&&e.push(o(t)),e}))}},{key:"fromClass",value:function(e,i){return t.define((function(t){return new e(t)}),i)}}]),t}(),_t=function(){function t(e){l(this,t),this.spec=e,this.mustUpdate=null,this.value=null}return u(t,[{key:"update",value:function(t){if(this.value){if(this.mustUpdate){var e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(i){if(jt(e.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(n){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(i){jt(t.state,i,"CodeMirror plugin crashed"),this.deactivate()}return this}},{key:"destroy",value:function(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(i){jt(t.state,i,"CodeMirror plugin crashed")}}},{key:"deactivate",value:function(){this.spec=this.value=null}}]),t}(),Xt=n.r$.define(),Ut=n.r$.define(),Yt=n.r$.define(),Jt=n.r$.define(),Zt=n.r$.define(),Qt=n.r$.define(),te=function(){function t(e,i,n,r){l(this,t),this.fromA=e,this.toA=i,this.fromB=n,this.toB=r}return u(t,[{key:"join",value:function(e){return new t(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}},{key:"addToSet",value:function(t){for(var e=t.length,i=this;e>0;e--){var n=t[e-1];if(!(n.fromA>i.toA)){if(n.toA<i.fromA)break;
1i=i.join(n),t.splice(e-1,1)}}return t.splice(e,0,i),t}}],[{key:"extendWithRanges",value:function(e,i){if(0==i.length)return e;for(var n=[],r=0,o=0,s=0,a=0;;r++){for(var l=r==e.length?null:e[r],h=s-a,u=l?l.fromB:1e9;o<i.length&&i[o]<u;){var c=i[o],f=i[o+1],d=Math.max(a,c),v=Math.min(u,f);if(d<=v&&new t(d+h,v+h,d,v).addToSet(n),f>u)break;o+=2}if(!l)return n;new t(l.fromA,l.toA,l.fromB,l.toB).addToSet(n),s=l.toA,a=l.toB}}}]),t}(),ee=function(){function t(e,i,r){l(this,t),this.view=e,this.state=i,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=n.as.empty(this.startState.doc.length);var o=!0,s=!1,a=void 0;try{for(var h,u=r[Symbol.iterator]();!(o=(h=u.next()).done);o=!0){var c=h.value;this.changes=this.changes.compose(c.changes)}}catch(d){s=!0,a=d}finally{try{o||null==u.return||u.return()}finally{if(s)throw a}}var f=[];this.changes.iterChangedRanges((function(t,e,i,n){return f.push(new te(t,e,i,n))})),this.changedRanges=f}return u(t,[{key:"viewportChanged",get:function(){return(4&this.flags)>0}},{key:"heightChanged",get:function(){return(2&this.flags)>0}},{key:"geometryChanged",get:function(){return this.docChanged||(10&this.flags)>0}},{key:"focusChanged",get:function(){return(1&this.flags)>0}},{key:"docChanged",get:function(){return!this.changes.empty}},{key:"selectionSet",get:function(){return this.transactions.some((function(t){return t.selection}))}},{key:"empty",get:function(){return 0==this.flags&&0==this.transactions.length}}],[{key:"create",value:function(e,i,n){return new t(e,i,n)}}]),t}(),ie=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(ie||(ie={})),ne=ie.LTR,re=ie.RTL;function oe(t){for(var e=[],i=0;i<t.length;i++)e.push(1<<+t[i]);return e}for(var se=oe("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),ae=oe("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),le=Object.create(null),he=[],ue=0,ce=["()","[]","{}"];ue<ce.length;ue++){var fe=ce[ue],de=fe.charCodeAt(0),ve=fe.charCodeAt(1);le[de]=ve,le[ve]=-de}function ge(t){return t<=247?se[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?ae[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8203?256:64336<=t&&t<=65023?4:8204==t?256:1}var pe=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,me=function(){function t(e,i,n){l(this,t),this.from=e,this.to=i,this.level=n}return u(t,[{key:"dir",get:function(){return this.level%2?re:ne}},{key:"side",value:function(t,e){return this.dir==e==t?this.to:this.from}}],[{key:"find",value:function(t,e,i,n){for(var r=-1,o=0;o<t.length;o++){var s=t[o];if(s.from<=e&&s.to>=e){if(s.level==i)return o;(r<0||(0!=n?n<0?s.from<e:s.to>e:t[r].level>s.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}]),t}(),ye=[];function we(t,e){var i=t.length,n=e==ne?1:2,r=e==ne?2:1;if(!t||1==n&&!pe.test(t))return be(i);for(var o=0,s=n,a=n;o<i;o++){var l=ge(t.charCodeAt(o));512==l?l=s:8==l&&4==a&&(l=16),ye[o]=4==l?2:l,7&l&&(a=l),s=l}for(var h=0,u=n,c=n;h<i;h++){var f=ye[h];if(128==f)h<i-1&&u==ye[h+1]&&24&u?f=ye[h]=u:ye[h]=256;else if(64==f){for(var d=h+1;d<i&&64==ye[d];)d++;for(var v=h&&8==u||d<i&&8==ye[d]?1==c?1:8:256,g=h;g<d;g++)ye[g]=v;h=d-1}else 8==f&&1==c&&(ye[h]=1);u=f,7&f&&(c=f)}for(var p,m,y,w=0,b=0,k=0;w<i;w++)if(m=le[p=t.charCodeAt(w)])if(m<0){for(var S=b-3;S>=0;S-=3)if(he[S+1]==-m){var x=he[S+2],M=2&x?n:4&x?1&x?r:n:0;M&&(ye[w]=ye[he[S]]=M),b=S;break}}else{if(189==he.length)break;he[b++]=w,he[b++]=p,he[b++]=k}else if(2==(y=ye[w])||1==y){var A=y==n;k=A?0:1;for(var D=b-3;D>=0;D-=3){var C=he[D+2];if(2&C)break;if(A)he[D+2]|=2;else{if(4&C)break;he[D+2]|=4}}}for(var O=0;O<i;O++)if(256==ye[O]){for(var T=O+1;T<i&&256==ye[T];)T++;for(var E=1==(O?ye[O-1]:n),R=E==(1==(T<i?ye[T]:n))?E?1:2:n,B=O;B<T;B++)ye[B]=R;O=T-1}var L=[];if(1==n)for(var H=0;H<i;){for(var V=H,P=1!=ye[H++];H<i&&P==(1!=ye[H]);)H++;if(P)for(var N=H;N>V;){for(var W=N,z=2!=ye[--N];N>V&&z==(2!=ye[N-1]);)N--;L.push(new me(N,W,z?2:1))}else L.push(new me(V,H,0))}else for(var F=0;F<i;){for(var I=F,j=2==ye[F++];F<i&&j==(2==ye[F]);)F++;L.push(new me(I,F,j?1:2))}return L}function be(t){return[new me(0,t,0)]}var ke="";function Se(t,e,i,r,o){var s,a=r.head-t.from,l=-1;if(0==a){if(!o||!t.length)return null;e[0].level!=i&&(a=e[0].side(!1,i),l=0)}else if(a==t.length){if(o)return null;var h=e[e.length-1];h.level!=i&&(a=h.side(!0,i),l=e.length-1)}l<0&&(l=me.find(e,a,null!==(s=r.bidiLevel)&&void 0!==s?s:-1,r.assoc));var u=e[l];a==u.side(o,i)&&(a=(u=e[l+=o?1:-1]).side(!o,i));var c=o==(u.dir==i),f=(0,n.cp)(t.text,a,c);if(ke=t.text.slice(Math.min(a,f),Math.max(a,f)),f!=u.side(o,i))return n.jT.cursor(f+t.from,c?-1:1,u.level);var d=l==(o?e.length-1:0)?null:e[l+(o?1:-1)];return d||u.level==i?d&&d.level<u.level?n.jT.cursor(d.side(!o,i)+t.from,o?1:-1,d.level):n.jT.cursor(f+t.from,o?-1:1,u.level):n.jT.cursor(o?t.to:t.from,o?-1:1,i)}var xe="\uffff",Me=function(){function t(e,i){l(this,t),this.points=e,this.text="",this.lineSeparator=i.facet(n.yy.lineSeparator)}return u(t,[{key:"append",value:function(t){this.text+=t}},{key:"lineBreak",value:function(){this.text+=xe}},{key:"readRange",value:function(t,e){if(!t)return this;for(var i=t.parentNode,n=t;;){this.findPointBefore(i,n),this.readNode(n);var r=n.nextSibling;if(r==e)break;var o=z.get(n),s=z.get(r);(o&&s?o.breakAfter:(o?o.breakAfter:Ae(n))||Ae(r)&&("BR"!=n.nodeName||n.cmIgnore))&&this.lineBreak(),n=r}return this.findPointBefore(i,e),this}},{key:"readTextNode",value:function(t){var e=t.nodeValue,i=!0,n=!1,r=void 0;try{for(var o,s=this.points[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){var a=o.value;a.node==t&&(a.pos=this.text.length+Math.min(a.offset,e.length))}}catch(w){n=!0,r=w}finally{try{i||null==s.return||s.return()}finally{if(n)throw r}}for(var l=0,h=this.lineSeparator?null:/\r\n?|\n/g;;){var u=-1,c=1,f=void 0;if(this.lineSeparator?(u=e.indexOf(this.lineSeparator,l),c=this.lineSeparator.length):(f=h.exec(e))&&(u=f.index,c=f[0].length),this.append(e.slice(l,u<0?e.length:u)),u<0)break;if(this.lineBreak(),c>1){var d=!0,v=!1,g=void 0;try{for(var p,m=this.points[Symbol.iterator]();!(d=(p=m.next()).done);d=!0){var y=p.value;y.node==t&&y.pos>this.text.length&&(y.pos-=c-1)}}catch(w){v=!0,g=w}finally{try{d||null==m.return||m.return()}finally{if(v)throw g}}}l=u+c}}},{key:"readNode",value:function(t){if(!t.cmIgnore){var e=z.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(var n=i.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}}},{key:"findPointBefore",value:function(t,e){var i=!0,n=!1,r=void 0;try{for(var o,s=this.points[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){var a=o.value;a.node==t&&t.childNodes[a.offset]==e&&(a.pos=this.text.length)}}catch(l){n=!0,r=l}finally{try{i||null==s.return||s.return()}finally{if(n)throw r}}}},{key:"findPointInside",value:function(t,e){var i=!0,n=!1,r=void 0;try{for(var o,s=this.points[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){var a=o.value;(3==t.nodeType?a.node==t:t.contains(a.node))&&(a.pos=this.text.length+Math.min(e,a.offset))}}catch(l){n=!0,r=l}finally{try{i||null==s.return||s.return()}finally{if(n)throw r}}}}]),t}();function Ae(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.no
1deName)}var De=function t(e,i){l(this,t),this.node=e,this.offset=i,this.pos=-1},Ce=function(t){d(i,t);var e=y(i);function i(t){var n;return l(this,i),(n=e.call(this)).view=t,n.compositionDeco=bt.none,n.decorations=[],n.dynamicDecorationMap=[],n.minWidth=0,n.minWidthFrom=0,n.minWidthTo=0,n.impreciseAnchor=null,n.impreciseHead=null,n.forceSelection=!1,n.lastUpdate=Date.now(),n.setDOM(t.contentDOM),n.children=[new Dt],n.children[0].setParent(a(n)),n.updateDeco(),n.updateInner([new te(0,0,0,t.state.doc.length)],0),n}return u(i,[{key:"length",get:function(){return this.view.state.doc.length}},{key:"update",value:function(t){var e=this,i=t.changedRanges;this.minWidth>0&&i.length&&(i.every((function(t){var i=t.fromA;return t.toA<e.minWidthFrom||i>e.minWidthTo}))?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=bt.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){var i=Ee(t);if(!i)return bt.none;var n=i.from,r=i.to,o=i.node,s=i.text,a=e.mapPos(n,1),l=Math.max(a,e.mapPos(r,-1)),h=t.state,u=3==o.nodeType?o.nodeValue:new Me([],h).readRange(o.firstChild,null).text;if(l-a<u.length)if(h.doc.sliceString(a,Math.min(h.doc.length,a+u.length),xe)==u)l=a+u.length;else{if(h.doc.sliceString(Math.max(0,l-u.length),l,xe)!=u)return bt.none;a=l-u.length}else if(h.doc.sliceString(a,l,xe)!=u)return bt.none;var c=z.get(o);c instanceof st?c=c.widget.topView:c&&(c.parent=null);return bt.set(bt.replace({widget:new Re(o,s,c),inclusive:!0}).range(a,l))}(this.view,t.changes)),(et.ie||et.chrome)&&!this.compositionDeco.size&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);var r=function(t,e,i){var r=new He;return n.Xs.compare(t,e,i,r),r.changes}(this.decorations,this.updateDeco(),t.changes);return i=te.extendWithRanges(i,r),(0!=this.dirty||0!=i.length)&&(this.updateInner(i,t.startState.doc.length),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}},{key:"updateInner",value:function(t,e){var i=this;this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e);var n=this.view.observer;n.ignore((function(){i.dom.style.height=i.view.viewState.contentHeight+"px",i.dom.style.flexBasis=i.minWidth?i.minWidth+"px":"";var t=et.chrome||et.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;i.sync(i.view,t),i.dirty=0,t&&(t.written||n.selectionRange.focusNode!=t.node)&&(i.forceSelection=!0),i.dom.style.height=""}));var r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){var o=!0,s=!1,a=void 0;try{for(var l,h=this.children[Symbol.iterator]();!(o=(l=h.next()).done);o=!0){var u=l.value;u instanceof Ct&&u.widget instanceof Te&&r.push(u.dom)}}catch(c){s=!0,a=c}finally{try{o||null==h.return||h.return()}finally{if(s)throw a}}}n.updateGaps(r)}},{key:"updateChildren",value:function(t,e){for(var i=this.childCursor(e),n=t.length-1;;n--){var r=n>=0?t[n]:null;if(!r)break;var o=r.fromA,s=r.toA,a=r.fromB,l=r.toB,h=Ot.build(this.view.state.doc,a,l,this.decorations,this.dynamicDecorationMap),u=h.content,c=h.breakAtStart,f=h.openStart,d=h.openEnd,v=i.findPos(s,1),g=v.i,p=v.off,m=i.findPos(o,-1);j(this,m.i,m.off,g,p,u,c,f,d)}}},{key:"updateSelection",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this;!t&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();var n=this.view.root.activeElement,r=n==this.dom,o=!r&&k(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(r||e||o){var s=this.forceSelection;this.forceSelection=!1;var a=this.view.state.selection.main,l=this.domAtPos(a.anchor),h=a.empty?l:this.domAtPos(a.head);if(et.gecko&&a.empty&&!this.compositionDeco.size&&Oe(l)){var u=document.createTextNode("");this.view.observer.ignore((function(){return l.node.insertBefore(u,l.node.childNodes[l.offset]||null)})),l=h=new N(u,0),s=!0}var c=this.view.observer.selectionRange;!s&&c.focusNode&&x(l.node,l.offset,c.anchorNode,c.anchorOffset)&&x(h.node,h.offset,c.focusNode,c.focusOffset)||(this.view.observer.ignore((function(){et.android&&et.chrome&&i.dom.contains(c.focusNode)&&Ve(c.focusNode,i.dom)&&(i.dom.blur(),i.dom.focus({preventScroll:!0}));var t=w(i.view.root);
1if(t)if(a.empty){if(et.gecko){var e=Le(l.node,l.offset);if(e&&3!=e){var r=Be(l.node,l.offset,1==e?1:-1);r&&(l=new N(r,1==e?0:r.nodeValue.length))}}t.collapse(l.node,l.offset),null!=a.bidiLevel&&null!=c.cursorBidiLevel&&(c.cursorBidiLevel=a.bidiLevel)}else if(t.extend){t.collapse(l.node,l.offset);try{t.extend(h.node,h.offset)}catch(f){}}else{var s,u=document.createRange();a.anchor>a.head&&(l=(s=[h,l])[0],h=s[1]),u.setEnd(h.node,h.offset),u.setStart(l.node,l.offset),t.removeAllRanges(),t.addRange(u)}else;o&&i.view.root.activeElement==i.dom&&(i.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(l,h)),this.impreciseAnchor=l.precise?null:new N(c.anchorNode,c.anchorOffset),this.impreciseHead=h.precise?null:new N(c.focusNode,c.focusOffset)}}},{key:"enforceCursorAssoc",value:function(){if(!this.compositionDeco.size){var t=this.view,e=t.state.selection.main,i=w(t.root),n=t.observer.selectionRange,r=n.anchorNode,o=n.anchorOffset;if(i&&e.empty&&e.assoc&&i.modify){var s=Dt.find(this,e.head);if(s){var a=s.posAtStart;if(e.head!=a&&e.head!=a+s.length){var l=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(l&&h&&!(l.bottom>h.top)){var u=this.domAtPos(e.head+e.assoc);i.collapse(u.node,u.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();var c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&i.collapse(r,o)}}}}}}},{key:"nearest",value:function(t){for(var e=t;e;){var i=z.get(e);if(i&&i.rootView==this)return i;e=e.parentNode}return null}},{key:"posFromDOM",value:function(t,e){var i=this.nearest(t);if(!i)throw new RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}},{key:"domAtPos",value:function(t){for(var e=this.childCursor().findPos(t,-1),i=e.i,n=e.off;i<this.children.length-1;){var r=this.children[i];if(n<r.length||r instanceof Dt)break;i++,n=0}return this.children[i].domAtPos(n)}},{key:"coordsAt",value:function(t,e){for(var i=this.length,n=this.children.length-1;;n--){var r=this.children[n],o=i-r.breakAfter-r.length;if(t>o||t==o&&r.type!=wt.WidgetBefore&&r.type!=wt.WidgetAfter&&(!n||2==e||this.children[n-1].breakAfter||this.children[n-1].type==wt.WidgetBefore&&e>-2))return r.coordsAt(t-o,e);i=o}}},{key:"measureVisibleLineHeights",value:function(t){for(var e=[],i=t.from,n=t.to,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,a=this.view.textDirection==ie.LTR,l=0,h=0;h<this.children.length;h++){var u=this.children[h],c=l+u.length;if(c>n)break;if(l>=i){var f=u.dom.getBoundingClientRect();if(e.push(f.height),o){var d=u.dom.lastChild,v=d?S(d):[];if(v.length){var g=v[v.length-1],p=a?g.right-f.left:f.right-g.left;p>s&&(s=p,this.minWidth=r,this.minWidthFrom=l,this.minWidthTo=c)}}}l=c+u.breakAfter}return e}},{key:"textDirectionAt",value:function(t){var e=this.childPos(t,1).i;return"rtl"==getComputedStyle(this.children[e].dom).direction?ie.RTL:ie.LTR}},{key:"measureTextSize",value:function(){var t=this,e=!0,i=!1,n=void 0;try{for(var r,o=this.children[Symbol.iterator]();!(e=(r=o.next()).done);e=!0){var s=r.value;if(s instanceof Dt){var a=s.measureTextSize();if(a)return a}}}catch(f){i=!0,n=f}finally{try{e||null==o.return||o.return()}finally{if(i)throw n}}var l,h,u,c=document.createElement("div");return c.className="cm-line",c.style.width="99999px",c.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((function(){t.dom.appendChild(c);var e=S(c.firstChild)[0];l=c.getBoundingClientRect().height,h=e?e.width/27:7,u=e?e.height:l,c.remove()})),{lineHeight:l,charWidth:h,textHeight:u}}},{key:"childCursor",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length,e=this.children.length;return e&&(t-=this.children[--e].length),new I(this.children,t,e)}},{key:"computeBlockGapDeco",value:function(){for(var t=[],e=this.view.viewState,i=0,n=0;;n++){var r=n==e.viewports.length?null:e.viewports[n],o=r?r.from-1:this.length;if(o>i){var s=e.lineBlockAt(o).bottom-e.lineBlockAt(i).top;t.push(bt.replace({widget:new Te(s),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;
1i=r.to+1}return bt.set(t)}},{key:"updateDeco",value:function(){for(var t=this,e=this.view.state.facet(Yt).map((function(e,i){return(t.dynamicDecorationMap[i]="function"==typeof e)?e(t.view):e})),i=e.length;i<e.length+3;i++)this.dynamicDecorationMap[i]=!1;return this.decorations=p(e).concat([this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco])}},{key:"scrollIntoView",value:function(t){var e,i=this,n=t.range,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(r){!n.empty&&(e=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,e.left),top:Math.min(r.top,e.top),right:Math.max(r.right,e.right),bottom:Math.max(r.bottom,e.bottom)});var o=0,s=0,a=0,l=0,h=!0,u=!1,c=void 0;try{for(var f,d=this.view.state.facet(Zt).map((function(t){return t(i.view)}))[Symbol.iterator]();!(h=(f=d.next()).done);h=!0){var v=f.value;if(v){var g=v.left,p=v.right,m=v.top,y=v.bottom;null!=g&&(o=Math.max(o,g)),null!=p&&(s=Math.max(s,p)),null!=m&&(a=Math.max(a,m)),null!=y&&(l=Math.max(l,y))}}}catch(b){u=!0,c=b}finally{try{h||null==d.return||d.return()}finally{if(u)throw c}}var w={left:r.left-o,top:r.top-a,right:r.right+s,bottom:r.bottom+l};!function(t,e,i,n,r,o,s,a){for(var l=t.ownerDocument,h=l.defaultView||window,u=t;u;)if(1==u.nodeType){var c=void 0,f=u==l.body;if(f)c=O(h);else{if(u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}var d=u.getBoundingClientRect();c={left:d.left,right:d.left+u.clientWidth,top:d.top,bottom:d.top+u.clientHeight}}var v=0,g=0;if("nearest"==r)e.top<c.top?(g=-(c.top-e.top+s),i>0&&e.bottom>c.bottom+g&&(g=e.bottom-c.bottom+g+s)):e.bottom>c.bottom&&(g=e.bottom-c.bottom+s,i<0&&e.top-g<c.top&&(g=-(c.top+g-e.top+s)));else{var p=e.bottom-e.top,m=c.bottom-c.top;g=("center"==r&&p<=m?e.top+p/2-m/2:"start"==r||"center"==r&&i<0?e.top-s:e.bottom-m+s)-c.top}if("nearest"==n?e.left<c.left?(v=-(c.left-e.left+o),i>0&&e.right>c.right+v&&(v=e.right-c.right+v+o)):e.right>c.right&&(v=e.right-c.right+o,i<0&&e.left<c.left+v&&(v=-(c.left+v-e.left+o))):v=("center"==n?e.left+(e.right-e.left)/2-(c.right-c.left)/2:"start"==n==a?e.left-o:e.right-(c.right-c.left)+o)-c.left,v||g)if(f)h.scrollBy(v,g);else{var y=0,w=0;if(g){var b=u.scrollTop;u.scrollTop+=g,w=u.scrollTop-b}if(v){var k=u.scrollLeft;u.scrollLeft+=v,y=u.scrollLeft-k}e={left:e.left-y,top:e.top-w,right:e.right-y,bottom:e.bottom-w},y&&Math.abs(y-v)<1&&(n="nearest"),w&&Math.abs(w-g)<1&&(r="nearest")}if(f)break;u=u.assignedSlot||u.parentNode}else{if(11!=u.nodeType)break;u=u.host}}(this.view.scrollDOM,w,n.head<n.anchor?-1:1,t.x,t.y,t.xMargin,t.yMargin,this.view.textDirection==ie.LTR)}}}]),i}(z);function Oe(t){return 1==t.node.nodeType&&t.node.firstChild&&(0==t.offset||"false"==t.node.childNodes[t.offset-1].contentEditable)&&(t.offset==t.node.childNodes.length||"false"==t.node.childNodes[t.offset].contentEditable)}var Te=function(t){d(i,t);var e=y(i);function i(t){var n;return l(this,i),(n=e.call(this)).height=t,n}return u(i,[{key:"toDOM",value:function(){var t=document.createElement("div");return this.updateDOM(t),t}},{key:"eq",value:function(t){return t.height==this.height}},{key:"updateDOM",value:function(t){return t.style.height=this.height+"px",!0}},{key:"estimatedHeight",get:function(){return this.height}}]),i}(yt);function Ee(t){var e=t.observer.selectionRange,i=e.focusNode&&Be(e.focusNode,e.focusOffset,0);if(!i)return null;var n=t.docView.nearest(i);if(!n)return null;if(n instanceof Dt){for(var r=i;r.parentNode!=n.dom;)r=r.parentNode;for(var o=r.previousSibling;o&&!z.get(o);)o=o.previousSibling;var s=o?z.get(o).posAtEnd:n.posAtStart;return{from:s,to:s,node:r,text:i}}for(;;){var a=n.parent;if(!a)return null;if(a instanceof Dt)break;n=a}var l=n.posAtStart;return{from:l,to:l+n.length,node:n.dom,text:i}}var Re=function(t){d(i,t);var e=y(i);function i(t,n,r){var o;return l(this,i),(o=e.call(this)).top=t,o.text=n,o.topView=r,o}return u(i,[{key:"eq",value:function(t){return this.top==t.top&&this.text==t.text}},{key:"toDOM",value:function(){return this.top}},{key:"ignoreEvent",value:function(){return!1}},{key:"customView",get:function(){return st}}]),i}(yt);function Be(t,e,i){if(i<=0)for(var n=t,r=e;;){if(3==n.nodeType)return n;if(!(1==n.nodeType&&r>0))break;r=D(n=n.childNodes[r-1])}if(i>=0)for(var o=t,s=e;;){if(3==o.nodeType)return o;if(!(1==o.nodeType&&s<o.childNodes.length&&i>=0))break;o=o.childNodes[s],s=0}return null}function Le(t,e){return 1!=t.nodeType?0:(e&&"false"==t.childNodes[e-1].contentEditable?1:0)|(e<t.childNodes.length&&"false"==t.childNodes[e].contentEditable?2:0)}
1var He=function(){function t(){l(this,t),this.changes=[]}return u(t,[{key:"compareRange",value:function(t,e){At(t,e,this.changes)}},{key:"comparePoint",value:function(t,e){At(t,e,this.changes)}}]),t}();function Ve(t,e){for(var i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}function Pe(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function Ne(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function We(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function ze(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function Fe(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function Ie(t,e,i){for(var n,r,o,s,a,l,h,u,c=!1,f=t.firstChild;f;f=f.nextSibling)for(var d=S(f),v=0;v<d.length;v++){var g=d[v];r&&We(r,g)&&(g=ze(Fe(g,r.bottom),r.top));var p=Pe(e,g),m=Ne(i,g);if(0==p&&0==m)return 3==f.nodeType?je(f,e,i):Ie(f,e,i);if(!n||s>m||s==m&&o>p){n=f,r=g,o=p,s=m;var y=m?i<g.top?-1:1:p?e<g.left?-1:1:0;c=!y||(y>0?v<d.length-1:v>0)}0==p?i>g.bottom&&(!h||h.bottom<g.bottom)?(a=f,h=g):i<g.top&&(!u||u.top>g.top)&&(l=f,u=g):h&&We(h,g)?h=Fe(h,g.bottom):u&&We(u,g)&&(u=ze(u,g.top))}if(h&&h.bottom>=i?(n=a,r=h):u&&u.top<=i&&(n=l,r=u),!n)return{node:t,offset:0};var w=Math.max(r.left,Math.min(r.right,e));return 3==n.nodeType?je(n,w,i):c&&"false"!=n.contentEditable?Ie(n,w,i):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,n)+(e>=(r.left+r.right)/2?1:0)}}function je(t,e,i){for(var n=t.nodeValue.length,r=-1,o=1e9,s=0,a=0;a<n;a++)for(var l=L(t,a,a+1).getClientRects(),h=0;h<l.length;h++){var u=l[h];if(u.top!=u.bottom){s||(s=e-u.left);var c=(u.top>i?u.top-i:i-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&c<o){var f=e>=(u.left+u.right)/2,d=f;if(et.chrome||et.gecko)L(t,a).getBoundingClientRect().left==u.right&&(d=!f);if(c<=0)return{node:t,offset:a+(d?1:0)};r=a+(d?1:0),o=c}}}return{node:t,offset:r>-1?r:s>0?t.nodeValue.length:0}}function Ke(t,e,i){var n,r,o,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,h=t.viewState.docHeight,u=e.x,c=e.y,f=c-l;if(f<0)return 0;if(f>h)return t.state.doc.length;for(var d=t.defaultLineHeight/2,v=!1;(o=t.elementAtHeight(f)).type!=wt.Text;)for(;!((f=s>0?o.bottom+d:o.top-d)>=0&&f<=h);){if(v)return i?null:0;v=!0,s=-s}c=l+f;var g=o.from;if(g<t.viewport.from)return 0==t.viewport.from?0:i?null:qe(t,a,o,u,c);if(g>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:qe(t,a,o,u,c);var p=t.dom.ownerDocument,m=t.root.elementFromPoint?t.root:p,y=m.elementFromPoint(u,c);y&&!t.contentDOM.contains(y)&&(y=null),y||(u=Math.max(a.left+1,Math.min(a.right-1,u)),(y=m.elementFromPoint(u,c))&&!t.contentDOM.contains(y)&&(y=null));var w,b=-1;if(y&&0!=(null===(n=t.docView.nearest(y))||void 0===n?void 0:n.isEditable))if(p.caretPositionFromPoint){var k,S=p.caretPositionFromPoint(u,c);S&&(w=(k=S).offsetNode,b=k.offset)}else if(p.caretRangeFromPoint){var x,M=p.caretRangeFromPoint(u,c);if(M)w=(x=M).startContainer,b=x.startOffset,(!t.contentDOM.contains(w)||et.safari&&Ge(w,b,u)||et.chrome&&$e(w,b,u))&&(w=void 0)}if(!w||!t.docView.dom.contains(w)){var A,D=Dt.find(t.docView,g);if(!D)return f>o.top+o.height/2?o.to:o.from;w=(A=Ie(D.dom,u,c)).node,b=A.offset}var C=t.docView.nearest(w);if(!C)return null;if(C.isWidget&&1==(null===(r=C.dom)||void 0===r?void 0:r.nodeType)){var O=C.dom.getBoundingClientRect();return e.y<O.top||e.y<=O.bottom&&e.x<=(O.left+O.right)/2?C.posAtStart:C.posAtEnd}return C.localPosFromDOM(w,b)+C.posAtStart}function qe(t,e,i,r,o){var s=Math.round((r-e.left)*t.defaultCharacterWidth);t.lineWrapping&&i.height>1.5*t.defaultLineHeight&&(s+=Math.floor((o-i.top)/t.defaultLineHeight)*t.viewState.heightOracle.lineLength);var a=t.state.sliceDoc(i.from,i.to);return i.from+(0,n.Gz)(a,s,t.state.tabSize)}function Ge(t,e,i){var n;if(3!=t.nodeType||e!=(n=t.nodeValue.length))return!1;for(var r=t.nextSibling;r;r=r.nextSibling)if(1!=r.nodeType||"BR"!=r.nodeName)return!1;return L(t,n-1,n).getBoundingClientRect().left>i}function $e(t,e,i){if(0!=e)return!1;for(var n=t;;){var r=n.parentNode;if(!r||1!=r.nodeType||r.firstChild!=n)return!1;if(r.classList.contains("cm-line"))break;n=r}return i-(1==t.nodeType?t.getBoundingClientRect():L(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect()).left>5}function _e(t,e,i,r){var o=t.state.doc.lineAt(e.head),s=r&&t.lineWrapping?t.coordsAtPos(e.assoc<0&&e.head>o.from?e.head-1:e.head):null;if(s){var a=t.dom.getBoundingClientRect(),l=t.textDirectionAt(o.from),h=t.posAtCoords({x:i==(l==ie.LTR)?a.right-1:a.left+1,y:(s.top+s.bottom)/2});if(null!=h)return n.jT.cursor(h,i?-1:1)}
1var u=Dt.find(t.docView,e.head),c=u?i?u.posAtEnd:u.posAtStart:i?o.to:o.from;return n.jT.cursor(c,i?-1:1)}function Xe(t,e,i,r){for(var o=t.state.doc.lineAt(e.head),s=t.bidiSpans(o),a=t.textDirectionAt(o.from),l=e,h=null;;){var u=Se(o,s,a,l,i),c=ke;if(!u){if(o.number==(i?t.state.doc.lines:1))return l;c="\n",o=t.state.doc.line(o.number+(i?1:-1)),s=t.bidiSpans(o),u=n.jT.cursor(i?o.from:o.to)}if(h){if(!h(c))return l}else{if(!r)return u;h=r(c)}l=u}}function Ue(t,e,i){for(var r=t.state.facet(Jt).map((function(e){return e(t)}));;){var o=!1,s=!0,a=!1,l=void 0;try{for(var h,u=r[Symbol.iterator]();!(s=(h=u.next()).done);s=!0){h.value.between(i.from-1,i.from+1,(function(t,r,s){i.from>t&&i.from<r&&(i=e.head>i.from?n.jT.cursor(t,1):n.jT.cursor(r,-1),o=!0)}))}}catch(c){a=!0,l=c}finally{try{s||null==u.return||u.return()}finally{if(a)throw l}}if(!o)return i}}var Ye=function(){function t(e){var i=this,n=function(t){var n=ni[t];e.contentDOM.addEventListener(t,(function(t){ii(e,t)&&o(n,t)}),ri[t]),i.registeredEvents.push(t)},r=this;l(this,t),this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;var o=function(t,i){r.ignoreDuringComposition(i)||"keydown"==i.type&&r.keydown(e,i)||(r.mustFlushObserver(i)&&e.observer.forceFlush(),r.runCustomHandlers(i.type,e,i)?i.preventDefault():t(e,i))};for(var s in ni)n(s);e.scrollDOM.addEventListener("mousedown",(function(t){if(t.target==e.scrollDOM&&t.clientY>e.contentDOM.getBoundingClientRect().bottom&&(o(ni.mousedown,t),!t.defaultPrevented&&2==t.button)){var i=e.contentDOM.style.minHeight;e.contentDOM.style.minHeight="100%",setTimeout((function(){return e.contentDOM.style.minHeight=i}),200)}})),e.scrollDOM.addEventListener("drop",(function(t){t.target==e.scrollDOM&&t.clientY>e.contentDOM.getBoundingClientRect().bottom&&o(ni.drop,t)})),et.chrome&&102==et.chrome_version&&e.scrollDOM.addEventListener("wheel",(function(){r.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(r.chromeScrollHack),r.chromeScrollHack=setTimeout((function(){r.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""}),100)}),{passive:!0}),this.notifiedFocused=e.hasFocus,et.safari&&e.contentDOM.addEventListener("input",(function(){return null}))}return u(t,[{key:"setSelectionOrigin",value:function(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}},{key:"ensureHandlers",value:function(t,e){var i,n,r=this;this.customHandlers=[];var o=!0,s=!1,a=void 0;try{for(var l,h=e[Symbol.iterator]();!(o=(l=h.next()).done);o=!0){var u=l.value;if(n=null===(i=u.update(t).spec)||void 0===i?void 0:i.domEventHandlers){var c=this,f=function(e){c.registeredEvents.indexOf(e)<0&&"scroll"!=e&&(c.registeredEvents.push(e),t.contentDOM.addEventListener(e,(function(i){ii(t,i)&&r.runCustomHandlers(e,t,i)&&i.preventDefault()})))};for(var d in this.customHandlers.push({plugin:u.value,handlers:n}),n)f(d)}}}catch(v){s=!0,a=v}finally{try{o||null==h.return||h.return()}finally{if(s)throw a}}}},{key:"runCustomHandlers",value:function(t,e,i){var n=!0,r=!1,o=void 0;try{for(var s,a=this.customHandlers[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var l=s.value,h=l.handlers[t];if(h)try{if(h.call(l.plugin,i,e)||i.defaultPrevented)return!0}catch(u){jt(e.state,u)}}}catch(c){r=!0,o=c}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return!1}},{key:"runScrollHandlers",value:function(t,e){this.lastScrollTop=t.scrollDOM.scrollTop,this.lastScrollLeft=t.scrollDOM.scrollLeft;var i=!0,n=!1,r=void 0;try{for(var o,s=this.customHandlers[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){var a=o.value,l=a.handlers.scroll;if(l)try{l.call(a.plugin,e,t)}catch(h){jt(t.state,h)}}}catch(u){n=!0,r=u}finally{try{i||null==s.return||s.return()}finally{if(n)throw r}}}},{key:"keydown",value:function(t,e){var i,n=this;return this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&Date.now()<this.lastEscPress+2e3||(27!=e.keyCode&&Qe.indexOf(e.keyCode)<0&&(t.inputState.lastEscPress=0),!et.android||!et.chrome||e.synthetic||13!=e.keyCode&&8!=e.keyCode?!(!et.ios||e.synthetic||e.altKey||e.metaKey||!((i=Je.find((function(t){return t.keyCode==e.keyCode})))&&!e.ctrlKey||Ze.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey))&&(this.pendingIOSKey=i||e,setTimeout((function(){return n.flushIOSKey(t)}),250),!0):(t.observer.delayAndroidKey(e.key,e.keyCode),!0))}},{key:"flushIOSKey",value:function(t){var e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,H(t.contentDOM,e.key,e.keyCode))}},{key:"ignoreDuringComposition",value:function(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(et.safari&&!et.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}},{key:"mustFlushObserver",value:function(t){return"keydown"==t.type&&229!=t.keyCode}},{key:"startMouseSelection",value:function(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}},{key:"update",value:function(t){this.mouseSelection&&this.mouseSelection.update(t),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}},{key:"destroy",value:function(){this.mouseSelection&&this.mouseSelection.destroy()}}]),t}(),Je=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"}
1,{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Ze="dthko",Qe=[16,17,18,20,91,92,224,225];function ti(t){return.7*Math.max(0,t)+8}var ei=function(){function t(e,i,r,o){l(this,t),this.view=e,this.style=r,this.mustSelect=o,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=i,this.scrollParent=function(t){for(var e=t.ownerDocument,i=t.parentNode;i&&i!=e.body;)if(1==i.nodeType){if(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)return i;i=i.assignedSlot||i.parentNode}else{if(11!=i.nodeType)break;i=i.host}return null}(e.contentDOM);var s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=i.shiftKey,this.multiple=e.state.facet(n.yy.allowMultipleSelections)&&function(t,e){var i=t.state.facet(Rt);return i.length?i[0](e):et.mac?e.metaKey:e.ctrlKey}(e,i),this.dragMove=function(t,e){var i=t.state.facet(Bt);return i.length?i[0](e):et.mac?!e.altKey:!e.ctrlKey}(e,i),this.dragging=!(!function(t,e){if(t.state.selection.main.empty)return!1;var i=w(t.root);if(!i||0==i.rangeCount)return!0;for(var n=i.getRangeAt(0).getClientRects(),r=0;r<n.length;r++){var o=n[r];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}(e,i)||1!=pi(i))&&null}return u(t,[{key:"start",value:function(t){!1===this.dragging&&(t.preventDefault(),this.select(t))}},{key:"move",value:function(t){var e;if(0==t.buttons)return this.destroy();if(!1===this.dragging){this.select(this.lastEvent=t);var i=0,n=0,r=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=r.left+6?i=-ti(r.left-t.clientX):t.clientX>=r.right-6&&(i=ti(t.clientX-r.right)),t.clientY<=r.top+6?n=-ti(r.top-t.clientY):t.clientY>=r.bottom-6&&(n=ti(t.clientY-r.bottom)),this.setScrollSpeed(i,n)}}},{key:"up",value:function(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}},{key:"destroy",value:function(){this.setScrollSpeed(0,0);var t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}},{key:"setScrollSpeed",value:function(t,e){var i=this;this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval((function(){return i.scroll()}),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}},{key:"scroll",value:function(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}},{key:"select",value:function(t){var e=this.style.get(t,this.extend,this.multiple);!this.mustSelect&&e.eq(this.view.state.selection)&&e.main.assoc==this.view.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}},{key:"update",value:function(t){var e=this;t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout((function(){return e.select(e.lastEvent)}),20)}}]),t}();function ii(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(var i,n=e.target;n!=t.contentDOM;n=n.parentNode)if(!n||11==n.nodeType||(i=z.get(n))&&i.ignoreEvent(e))return!1;return!0}var ni=Object.create(null),ri=Object.create(null),oi=et.ie&&et.ie_version<15||et.ios&&et.webkit_version<604;function si(t,e){var i,r=t.state,o=1,s=r.toText(e),a=s.lines==r.selection.ranges.length,l=null!=yi&&r.selection.ranges.every((function(t){return t.empty}))&&yi==s.toString();if(l){var h=-1;i=r.changeByRange((function(t){var i=r.doc.lineAt(t.from);if(i.from==h)return{range:t};h=i.from;var l=r.toText((a?s.line(o++).text:e)+r.lineBreak);return{changes:{from:i.from,insert:l},range:n.jT.cursor(t.from+l.length)}}))}else i=a?r.changeByRange((function(t){var e=s.line(o++);return{changes:{from:t.from,to:t.to,insert:e.text},range:n.jT.cursor(t.from+e.length)}})):r.replaceSelection(s);t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function ai(t,e,i,r){if(1==r)return n.jT.cursor(e,i);if(2==r)return function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=t.charCategorizer(e),o=t.doc.lineAt(e),s=e-o.from;if(0==o.length)return n.jT.cursor(e);0==s?i=1:s==o.length&&(i=-1);var a=s,l=s;i<0?a=(0,n.cp)(o.text,s,!1):l=(0,n.cp)(o.text,s);for(var h=r(o.text.slice(a,l));a>0;){var u=(0,n.cp)(o.text,a,!1);if(r(o.text.slice(u,a))!=h)break;a=u}for(;l<o.length;){var c=(0,n.cp)(o.text,l);if(r(o.text.slice(l,c))!=h)break;l=c}return n.jT.range(a+o.from,l+o.from)}(t.state,e,i);var o=Dt.find(t.docView,e),s=t.state.doc.lineAt(o?o.posAtEnd:e),a=o?o.posAtStart:s.from,l=o?o.posAtEnd:s.to;return l<t.state.doc.length&&l==s.to&&l++,n.jT.range(a,l)}ni.keydown=function(t,e){t.inputState.setSelectionOrigin("select"),27==e.keyCode&&(t.inputState.lastEscPress=Date.now())},ni.touchstart=function(t,e){t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},ni.touchmove=function(t){t.inputState.setSelectionOrigin("select.pointer")},ri.touchstart=ri.touchmove={passive:!0},ni.mousedown=function(t,e){if(t.observer.flush(),!(t.inputState.lastTouchTime>Date.now()-2e3)){var i=null,r=!0,o=!1,s=void 0;try{for(var a,l=t.state.facet(Lt)[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){if(i=(0,a.value)(t,e))break}}catch(u){o=!0,s=u}finally{try{r||null==l.return||l.return()}finally{if(o)throw s}}if(i||0!=e.button||(i=function(t,e){var i=ci(t,e),r=pi(e),o=t.state.selection;return{update:function(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),o=o.map(t.changes))},get:function(e,s,a){var l,h=ci(t,e),u=ai(t,h.pos,h.bias,r);if(i.pos!=h.pos&&!s){var c=ai(t,i.pos,i.bias,r),f=Math.min(c.from,u.from),d=Math.max(c.to,u.to);
1u=f<u.from?n.jT.range(f,d):n.jT.range(d,f)}return s?o.replaceRange(o.main.extend(u.from,u.to)):a&&1==r&&o.ranges.length>1&&(l=function(t,e){for(var i=0;i<t.ranges.length;i++){var r=t.ranges[i],o=r.from,s=r.to;if(o<=e&&s>=e)return n.jT.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}return null}(o,h.pos))?l:a?o.addRange(u):n.jT.create([u])}}}(t,e)),i){var h=t.root.activeElement!=t.contentDOM;t.inputState.startMouseSelection(new ei(t,e,i,h)),h&&t.observer.ignore((function(){return B(t.contentDOM)})),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}}};var li=function(t,e){return t>=e.top&&t<=e.bottom},hi=function(t,e,i){return li(e,i)&&t>=i.left&&t<=i.right};function ui(t,e,i,n){var r=Dt.find(t.docView,e);if(!r)return 1;var o=e-r.posAtStart;if(0==o)return 1;if(o==r.length)return-1;var s=r.coordsAt(o,-1);if(s&&hi(i,n,s))return-1;var a=r.coordsAt(o,1);return a&&hi(i,n,a)?1:s&&li(n,s)?-1:1}function ci(t,e){var i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:ui(t,i,e.clientX,e.clientY)}}var fi=et.ie&&et.ie_version<=11,di=null,vi=0,gi=0;function pi(t){if(!fi)return t.detail;var e=di,i=gi;return di=t,gi=Date.now(),vi=!e||i>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(vi+1)%3:1}function mi(t,e,i,n){if(i){var r=t.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();var o=t.inputState.mouseSelection,s=n&&o&&o.dragging&&o.dragMove?{from:o.dragging.from,to:o.dragging.to}:null,a={from:r,insert:i},l=t.state.changes(s?[s,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"})}}ni.dragstart=function(t,e){var i=t.state.selection.main,n=t.inputState.mouseSelection;n&&(n.dragging=i),e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove")},ni.drop=function(t,e){if(e.dataTransfer){if(t.state.readOnly)return e.preventDefault();var i=e.dataTransfer.files;if(i&&i.length){var n=function(t){var e=new FileReader;e.onerror=s,e.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(r[t]=e.result),s()},e.readAsText(i[t])};e.preventDefault();for(var r=Array(i.length),o=0,s=function(){++o==i.length&&mi(t,e,r.filter((function(t){return null!=t})).join(t.state.lineBreak),!1)},a=0;a<i.length;a++)n(a)}else mi(t,e,e.dataTransfer.getData("Text"),!0)}},ni.paste=function(t,e){if(t.state.readOnly)return e.preventDefault();t.observer.flush();var i=oi?null:e.clipboardData;i?(si(t,i.getData("text/plain")||i.getData("text/uri-text")),e.preventDefault()):function(t){var e=t.dom.parentNode;if(e){var i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout((function(){t.focus(),i.remove(),si(t,i.value)}),50)}}(t)};var yi=null;ni.copy=ni.cut=function(t,e){var i=function(t){var e=[],i=[],n=!1,r=!0,o=!1,s=void 0;try{for(var a,l=t.selection.ranges[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var h=a.value;h.empty||(e.push(t.sliceDoc(h.from,h.to)),i.push(h))}}catch(y){o=!0,s=y}finally{try{r||null==l.return||l.return()}finally{if(o)throw s}}if(!e.length){var u=-1,c=!0,f=!1,d=void 0;try{for(var v,g=t.selection.ranges[Symbol.iterator]();!(c=(v=g.next()).done);c=!0){var p=v.value.from,m=t.doc.lineAt(p);m.number>u&&(e.push(m.text),i.push({from:m.from,to:Math.min(t.doc.length,m.to+1)})),u=m.number}}catch(y){f=!0,d=y}finally{try{c||null==g.return||g.return()}finally{if(f)throw d}}n=!0}return{text:e.join(t.lineBreak),ranges:i,linewise:n}}(t.state),n=i.text,r=i.ranges,o=i.linewise;if(n||o){yi=o?n:null;var s=oi?null:e.clipboardData;s?(e.preventDefault(),s.clearData(),s.setData("text/plain",n)):function(t,e){var i=t.dom.parentNode;if(i){var n=i.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout((function(){n.remove(),t.focus()}),50)}}(t,n),"cut"!=e.type||t.state.readOnly||t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"})}};var wi=n.q6.define();function bi(t,e){var i=[],n=!0,r=!1,o=void 0;try{for(var s,a=t.facet(Nt)[Symbol.iterator]();!(n=(s=a.next()).done);
1n=!0){var l=(0,s.value)(t,e);l&&i.push(l)}}catch(h){r=!0,o=h}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return i?t.update({effects:i,annotations:wi.of(!0)}):null}function ki(t){setTimeout((function(){var e=t.hasFocus;if(e!=t.inputState.notifiedFocused){var i=bi(t.state,e);i?t.dispatch(i):t.update([])}}),10)}ni.focus=function(t){t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),ki(t)},ni.blur=function(t){t.observer.clearSelectionRange(),ki(t)},ni.compositionstart=ni.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},ni.compositionend=function(t){t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,et.chrome&&et.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((function(){return t.observer.flush()})):setTimeout((function(){t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},ni.contextmenu=function(t){t.inputState.lastContextMenu=Date.now()},ni.beforeinput=function(t,e){var i,n;if(et.chrome&&et.android&&(n=Je.find((function(t){return t.inputType==e.inputType})))&&(t.observer.delayAndroidKey(n.key,n.keyCode),"Backspace"==n.key||"Delete"==n.key)){var r=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout((function(){var e;((null===(e=window.visualViewport)||void 0===e?void 0:e.height)||0)>r+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())}),100)}};var Si=["pre-wrap","normal","pre-line","break-spaces"],xi=function(){function t(e){l(this,t),this.lineWrapping=e,this.doc=n.xv.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}return u(t,[{key:"heightForGap",value:function(t,e){var i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}},{key:"heightForLine",value:function(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}},{key:"setDoc",value:function(t){return this.doc=t,this}},{key:"mustRefreshForWrapping",value:function(t){return Si.indexOf(t)>-1!=this.lineWrapping}},{key:"mustRefreshForHeights",value:function(t){for(var e=!1,i=0;i<t.length;i++){var n=t[i];n<0?i++:this.heightSamples[Math.floor(10*n)]||(e=!0,this.heightSamples[Math.floor(10*n)]=!0)}return e}},{key:"refresh",value:function(t,e,i,n,r,o){var s=Si.indexOf(t)>-1,a=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=e,this.charWidth=i,this.textHeight=n,this.lineLength=r,a){this.heightSamples={};for(var l=0;l<o.length;l++){var h=o[l];h<0?l++:this.heightSamples[Math.floor(10*h)]=!0}}return a}}]),t}(),Mi=function(){function t(e,i){l(this,t),this.from=e,this.heights=i,this.index=0}return u(t,[{key:"more",get:function(){return this.index<this.heights.length}}]),t}(),Ai=function(){function t(e,i,n,r,o,s){l(this,t),this.from=e,this.length=i,this.top=n,this.height=r,this.children=o,this.deco=s}return u(t,[{key:"type",get:function(){var t,e,i;return null!==(i=null!==(t=this.children)&&void 0!==t?t:null===(e=this.deco)||void 0===e?void 0:e.type)&&void 0!==i?i:wt.Text}},{key:"widget",get:function(){return this.deco&&this.deco.widget}},{key:"to",get:function(){return this.from+this.length}},{key:"bottom",get:function(){return this.top+this.height}},{key:"join",value:function(e){var i=(this.children||[this]).concat(e.children||[e]);return new t(this.from,this.length+e.length,this.top,this.height+e.height,i,null)}}]),t}(),Di=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(Di||(Di={})),Ci=.001,Oi=function(){function t(e,i){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;l(this,t),this.length=e,this.height=i,this.flags=n}return u(t,[{key:"outdated",get:function(){return(2&this.flags)>0}
1,set:function(t){this.flags=(t?2:0)|-3&this.flags}},{key:"setHeight",value:function(t,e){this.height!=e&&(Math.abs(this.height-e)>Ci&&(t.heightChanged=!0),this.height=e)}},{key:"replace",value:function(e,i,n){return t.of(n)}},{key:"decomposeLeft",value:function(t,e){e.push(this)}},{key:"decomposeRight",value:function(t,e){e.push(this)}},{key:"applyChanges",value:function(t,e,i,n){for(var r=this,o=i.doc,s=n.length-1;s>=0;s--){var a=n[s],l=a.fromA,h=a.toA,u=a.fromB,c=a.toB,f=r.lineAt(l,Di.ByPosNoHeight,i.setDoc(e),0,0),d=f.to>=h?f:r.lineAt(h,Di.ByPosNoHeight,i,0,0);for(c+=d.to-h,h=d.to;s>0&&f.from<=n[s-1].toA;)l=n[s-1].fromA,u=n[s-1].fromB,s--,l<f.from&&(f=r.lineAt(l,Di.ByPosNoHeight,i,0,0));u+=f.from-l,l=f.from;var v=Hi.build(i.setDoc(o),t,u,c);r=r.replace(l,h,v)}return r.updateHeight(i,0)}}],[{key:"empty",value:function(){return new Ei(0,0)}},{key:"of",value:function(e){if(1==e.length)return e[0];for(var i=0,n=e.length,r=0,o=0;;)if(i==n)if(r>2*o){var s=e[i-1];s.break?e.splice(--i,1,s.left,null,s.right):e.splice(--i,1,s.left,s.right),n+=1+s.break,r-=s.size}else{if(!(o>2*r))break;var a=e[n];a.break?e.splice(n,1,a.left,null,a.right):e.splice(n,1,a.left,a.right),n+=2+a.break,o-=a.size}else if(r<o){var l=e[i++];l&&(r+=l.size)}else{var h=e[--n];h&&(o+=h.size)}var u=0;return null==e[i-1]?(u=1,i--):null==e[i]&&(u=1,n++),new Bi(t.of(e.slice(0,i)),u,t.of(e.slice(n)))}}]),t}();Oi.prototype.size=1;var Ti=function(t){d(i,t);var e=y(i);function i(t,n,r){var o;return l(this,i),(o=e.call(this,t,n)).deco=r,o}return u(i,[{key:"blockAt",value:function(t,e,i,n){return new Ai(n,this.length,i,this.height,null,this.deco)}},{key:"lineAt",value:function(t,e,i,n,r){return this.blockAt(0,i,n,r)}},{key:"forEachLine",value:function(t,e,i,n,r,o){t<=r+this.length&&e>=r&&o(this.blockAt(0,i,n,r))}},{key:"updateHeight",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>3?arguments[3]:void 0;return i&&i.from<=e&&i.more&&this.setHeight(t,i.heights[i.index++]),this.outdated=!1,this}},{key:"toString",value:function(){return"block(".concat(this.length,")")}}]),i}(Oi),Ei=function(t){d(i,t);var e=y(i);function i(t,n){var r;return l(this,i),(r=e.call(this,t,n,null)).collapsed=0,r.widgetHeight=0,r}return u(i,[{key:"replace",value:function(t,e,n){var r=n[0];return 1==n.length&&(r instanceof i||r instanceof Ri&&4&r.flags)&&Math.abs(this.length-r.length)<10?(r instanceof Ri?r=new i(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):Oi.of(n)}},{key:"updateHeight",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0;return n&&n.from<=e&&n.more?this.setHeight(t,n.heights[n.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}},{key:"toString",value:function(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")")}}]),i}(Ti),Ri=function(t){d(i,t);var e=y(i);function i(t){return l(this,i),e.call(this,t,0)}return u(i,[{key:"heightMetrics",value:function(t,e){var i,n=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,o=r-n+1,s=0;if(t.lineWrapping){var a=Math.min(this.height,t.lineHeight*o);i=a/o,this.length>o+1&&(s=(this.height-a)/(this.length-o-1))}else i=this.height/o;return{firstLine:n,lastLine:r,perLine:i,perChar:s}}},{key:"blockAt",value:function(t,e,i,n){var r=this.heightMetrics(e,n),o=r.firstLine,s=r.lastLine,a=r.perLine,l=r.perChar;if(e.lineWrapping){var h=n+Math.round(Math.max(0,Math.min(1,(t-i)/this.height))*this.length),u=e.doc.lineAt(h),c=a+u.length*l,f=Math.max(i,t-c/2);return new Ai(u.from,u.length,f,c,null,null)}var d=Math.max(0,Math.min(s-o,Math.floor((t-i)/a))),v=e.doc.line(o+d),g=v.from,p=v.length;return new Ai(g,p,i+a*d,a,null,null)}},{key:"lineAt",value:function(t,e,i,n,r){if(e==Di.ByHeight)return this.blockAt(t,i,n,r);if(e==Di.ByPosNoHeight){var o=i.doc.lineAt(t),s=o.from,a=o.to;return new Ai(s,a-s,0,0,null,null)}var l=this.heightMetrics(i,r),h=l.firstLine,u=l.perLine,c=l.perChar,f=i.doc.lineAt(t),d=u+f.length*c,v=f.number-h,g=n+u*v+c*(f.from-r-v);return new Ai(f.from,f.length,Math.max(n,Math.min(g,n+this.height-d)),d,null,
1null)}},{key:"forEachLine",value:function(t,e,i,n,r,o){t=Math.max(t,r),e=Math.min(e,r+this.length);for(var s=this.heightMetrics(i,r),a=s.firstLine,l=s.perLine,h=s.perChar,u=t,c=n;u<=e;){var f=i.doc.lineAt(u);if(u==t){var d=f.number-a;c+=l*d+h*(t-r-d)}var v=l+h*f.length;o(new Ai(f.from,f.length,c,v,null,null)),c+=v,u=f.to+1}}},{key:"replace",value:function(t,e,n){var r=this.length-e;if(r>0){var o=n[n.length-1];o instanceof i?n[n.length-1]=new i(o.length+r):n.push(null,new i(r-1))}if(t>0){var s=n[0];s instanceof i?n[0]=new i(t+s.length):n.unshift(new i(t-1),null)}return Oi.of(n)}},{key:"decomposeLeft",value:function(t,e){e.push(new i(t-1),null)}},{key:"decomposeRight",value:function(t,e){e.push(null,new i(this.length-t-1))}},{key:"updateHeight",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,o=e+this.length;if(r&&r.from<=e+this.length&&r.more){var s=[],a=Math.max(e,r.from),l=-1;for(r.from>e&&s.push(new i(r.from-e-1).updateHeight(t,e));a<=o&&r.more;){var h=t.doc.lineAt(a).length;s.length&&s.push(null);var u=r.heights[r.index++];-1==l?l=u:Math.abs(u-l)>=Ci&&(l=-2);var c=new Ei(h,u);c.outdated=!1,s.push(c),a+=h+1}a<=o&&s.push(null,new i(o-a).updateHeight(t,a));var f=Oi.of(s);return(l<0||Math.abs(f.height-this.height)>=Ci||Math.abs(l-this.heightMetrics(t,e).perLine)>=Ci)&&(t.heightChanged=!0),f}return(n||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}},{key:"toString",value:function(){return"gap(".concat(this.length,")")}}]),i}(Oi),Bi=function(t){d(i,t);var e=y(i);function i(t,n,r){var o;return l(this,i),(o=e.call(this,t.length+n+r.length,t.height+r.height,n|(t.outdated||r.outdated?2:0))).left=t,o.right=r,o.size=t.size+r.size,o}return u(i,[{key:"break",get:function(){return 1&this.flags}},{key:"blockAt",value:function(t,e,i,n){var r=i+this.left.height;return t<r?this.left.blockAt(t,e,i,n):this.right.blockAt(t,e,r,n+this.left.length+this.break)}},{key:"lineAt",value:function(t,e,i,n,r){var o=n+this.left.height,s=r+this.left.length+this.break,a=e==Di.ByHeight?t<o:t<s,l=a?this.left.lineAt(t,e,i,n,r):this.right.lineAt(t,e,i,o,s);if(this.break||(a?l.to<s:l.from>s))return l;var h=e==Di.ByPosNoHeight?Di.ByPosNoHeight:Di.ByPos;return a?l.join(this.right.lineAt(s,h,i,o,s)):this.left.lineAt(s,h,i,n,r).join(l)}},{key:"forEachLine",value:function(t,e,i,n,r,o){var s=n+this.left.height,a=r+this.left.length+this.break;if(this.break)t<a&&this.left.forEachLine(t,e,i,n,r,o),e>=a&&this.right.forEachLine(t,e,i,s,a,o);else{var l=this.lineAt(a,Di.ByPos,i,n,r);t<l.from&&this.left.forEachLine(t,l.from-1,i,n,r,o),l.to>=t&&l.from<=e&&o(l),e>l.to&&this.right.forEachLine(l.to+1,e,i,s,a,o)}}},{key:"replace",value:function(t,e,i){var n=this.left.length+this.break;if(e<n)return this.balanced(this.left.replace(t,e,i),this.right);if(t>this.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,i));var r=[];t>0&&this.decomposeLeft(t,r);var o=r.length,s=!0,a=!1,l=void 0;try{for(var h,u=i[Symbol.iterator]();!(s=(h=u.next()).done);s=!0){var c=h.value;r.push(c)}}catch(d){a=!0,l=d}finally{try{s||null==u.return||u.return()}finally{if(a)throw l}}if(t>0&&Li(r,o-1),e<this.length){var f=r.length;this.decomposeRight(e,r),Li(r,f)}return Oi.of(r)}},{key:"decomposeLeft",value:function(t,e){var i=this.left.length;if(t<=i)return this.left.decomposeLeft(t,e);e.push(this.left),this.break&&t>=++i&&e.push(null),t>i&&this.right.decomposeLeft(t-i,e)}},{key:"decomposeRight",value:function(t,e){var i=this.left.length,n=i+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t<i&&this.left.decomposeRight(t,e),this.break&&t<n&&e.push(null),e.push(this.right)}},{key:"balanced",value:function(t,e){return t.size>2*e.size||e.size>2*t.size?Oi.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}},{key:"updateHeight",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3?arguments[3]:void 0,r=this,o=r.left,s=r.right,a=e+o.length+this.break,l=null;return n&&n.from<=e+o.length&&n.more?l=o=o.updateHeight(t,e,i,n):o.updateHeight(t,e,i),n&&n.from<=a+s.length&&n.more?l=s=s.updateHeight(t,a,i,n):s.updateHeight(t,a,i),l?this.balanced(o,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}},{key:"toString",value:function(){return this.left+(this.break?" ":"-")+this.right}}]),i}(Oi);function Li(t,e){var i,n;null==t[e]&&(i=t[e-1])instanceof Ri&&(n=t[e+1])instanceof Ri&&t.splice(e-1,3,new Ri(i.length+1+n.length))}var Hi=function(){function t(e,i){l(this,t),this.pos=e,this.oracle=i,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}return u(t,[{key:"isCovered",get:function(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}},{key:"span",value:function(t,e){if(this.lineStart>-1){var i=Math.min(e,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Ei?n.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Ei(i-this.pos,-1)),this.writtenTo=i,e>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}}
1,{key:"point",value:function(t,e,i){if(t<e||i.heightRelevant){var n=i.widget?i.widget.estimatedHeight:0;n<0&&(n=this.oracle.lineHeight);var r=e-t;i.block?this.addBlock(new Ti(r,n,i)):(r||n>=5)&&this.addLineDeco(n,r)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}},{key:"enterLine",value:function(){if(!(this.lineStart>-1)){var t=this.oracle.doc.lineAt(this.pos),e=t.from,i=t.to;this.lineStart=e,this.lineEnd=i,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ei(this.pos-e,-1)),this.writtenTo=this.pos}}},{key:"blankContent",value:function(t,e){var i=new Ri(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}},{key:"ensureLine",value:function(){this.enterLine();var t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Ei)return t;var e=new Ei(0,-1);return this.nodes.push(e),e}},{key:"addBlock",value:function(t){var e;this.enterLine();var i=null===(e=t.deco)||void 0===e?void 0:e.type;i!=wt.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,i!=wt.WidgetBefore&&(this.covering=t)}},{key:"addLineDeco",value:function(t,e){var i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}},{key:"finish",value:function(t){var e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof Ei||this.isCovered?(this.writtenTo<this.pos||null==e)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Ei(0,-1));var i=t,n=!0,r=!1,o=void 0;try{for(var s,a=this.nodes[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var l=s.value;l instanceof Ei&&l.updateHeight(this.oracle,i),i+=l?l.length:1}}catch(h){r=!0,o=h}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return this.nodes}}],[{key:"build",value:function(e,i,r,o){var s=new t(r,e);return n.Xs.spans(i,r,o,s,0),s.finish(r)}}]),t}();function Vi(t,e,i){var r=new Pi;return n.Xs.compare(t,e,i,r,0),r.changes}var Pi=function(){function t(){l(this,t),this.changes=[]}return u(t,[{key:"compareRange",value:function(){}},{key:"comparePoint",value:function(t,e,i,n){(t<e||i&&i.heightRelevant||n&&n.heightRelevant)&&At(t,e,this.changes,5)}}]),t}();function Ni(t,e){for(var i=t.getBoundingClientRect(),n=t.ownerDocument,r=n.defaultView||window,o=Math.max(0,i.left),s=Math.min(r.innerWidth,i.right),a=Math.max(0,i.top),l=Math.min(r.innerHeight,i.bottom),h=t.parentNode;h&&h!=n.body;)if(1==h.nodeType){var u=h,c=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&"visible"!=c.overflow){var f=u.getBoundingClientRect();o=Math.max(o,f.left),s=Math.min(s,f.right),a=Math.max(a,f.top),l=h==t.parentNode?f.bottom:Math.min(l,f.bottom)}h="absolute"==c.position||"fixed"==c.position?u.offsetParent:u.parentNode}else{if(11!=h.nodeType)break;h=h.host}return{left:o-i.left,right:Math.max(o,s)-i.left,top:a-(i.top+e),bottom:Math.max(a,l)-(i.top+e)}}function Wi(t,e){var i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}var zi=function(){function t(e,i,n){l(this,t),this.from=e,this.to=i,this.size=n}return u(t,[{key:"draw",value:function(t){return bt.replace({widget:new Fi(this.size,t)}).range(this.from,this.to)}}],[{key:"same",value:function(t,e){if(t.length!=e.length)return!1;for(var i=0;i<t.length;i++){var n=t[i],r=e[i];if(n.from!=r.from||n.to!=r.to||n.size!=r.size)return!1}return!0}}]),t}(),Fi=function(t){d(i,t);var e=y(i);function i(t,n){var r;return l(this,i),(r=e.call(this)).size=t,r.vertical=n,r}return u(i,[{key:"eq",value:function(t){return t.size==this.size&&t.vertical==this.vertical}},{key:"toDOM",value:function(){var t=document.createElement("div");return this.vertical?t.style.height=this.size+"px":(t.style.width=this.size+"px",t.style.height="2px",t.style.display="inline-block"),t}},{key:"estimatedHeight",get:function(){return this.vertical?this.size:-1}}]),i}(yt),Ii=function(){function t(e){l(this,t),this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaler=$i,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ie.LTR,this.visibleRanges=[],this.mustEnfor
1ceCursorAssoc=!1;var i=e.facet(Ut).some((function(t){return"function"!=typeof t&&"cm-lineWrapping"==t.class}));this.heightOracle=new xi(i),this.stateDeco=e.facet(Yt).filter((function(t){return"function"!=typeof t})),this.heightMap=Oi.empty().applyChanges(this.stateDeco,n.xv.empty,this.heightOracle.setDoc(e.doc),[new te(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=bt.set(this.lineGaps.map((function(t){return t.draw(!1)}))),this.computeVisibleRanges()}return u(t,[{key:"updateForViewport",value:function(){for(var t=this,e=function(e){var r=e?n.head:n.anchor;if(!i.some((function(t){var e=t.from,i=t.to;return r>=e&&r<=i}))){var o=t.lineBlockAt(r),s=o.from,a=o.to;i.push(new ji(s,a))}},i=[this.viewport],n=this.state.selection.main,r=0;r<=1;r++)e(r);this.viewports=i.sort((function(t,e){return t.from-e.from})),this.scaler=this.heightMap.height<=7e6?$i:new _i(this.heightOracle,this.heightMap,this.viewports)}},{key:"updateViewportLines",value:function(){var t=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(function(e){t.viewportLines.push(1==t.scaler.scale?e:Xi(e,t.scaler))}))}},{key:"update",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.state=t.state;var i=this.stateDeco;this.stateDeco=this.state.facet(Yt).filter((function(t){return"function"!=typeof t}));var r=t.changedRanges,o=te.extendWithRanges(r,Vi(i,this.stateDeco,t?t.changes:n.as.empty(this.state.doc.length))),s=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),o),this.heightMap.height!=s&&(t.flags|=2);var a=o.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.head<a.from||e.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,e));var l=!t.changes.empty||2&t.flags||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),l&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(zt)&&(this.mustEnforceCursorAssoc=!0)}},{key:"measure",value:function(t){var e=t.contentDOM,i=window.getComputedStyle(e),r=this.heightOracle,o=i.whiteSpace;this.defaultTextDirection="rtl"==i.direction?ie.RTL:ie.LTR;var s=this.heightOracle.mustRefreshForWrapping(o),a=e.getBoundingClientRect(),l=s||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;var h=0,u=0,c=parseInt(i.paddingTop)||0,f=parseInt(i.paddingBottom)||0;this.paddingTop==c&&this.paddingBottom==f||(this.paddingTop=c,this.paddingBottom=f,h|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(r.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=8);var d=(this.printing?Wi:Ni)(e,this.paddingTop),v=d.top-this.pixelViewport.top,g=d.bottom-this.pixelViewport.bottom;this.pixelViewport=d;var p=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;
1if(p!=this.inView&&(this.inView=p,p&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;var m=a.width;if(this.contentDOMWidth==m&&this.editorHeight==t.scrollDOM.clientHeight||(this.contentDOMWidth=a.width,this.editorHeight=t.scrollDOM.clientHeight,h|=8),l){var y=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(y)&&(s=!0),s||r.lineWrapping&&Math.abs(m-this.contentDOMWidth)>r.charWidth){var w=t.docView.measureTextSize(),b=w.lineHeight,k=w.charWidth,S=w.textHeight;(s=b>0&&r.refresh(o,b,k,S,m/k,y))&&(t.docView.minWidth=0,h|=8)}v>0&&g>0?u=Math.max(v,g):v<0&&g<0&&(u=Math.min(v,g)),r.heightChanged=!1;var x=!0,M=!1,A=void 0;try{for(var D,C=this.viewports[Symbol.iterator]();!(x=(D=C.next()).done);x=!0){var O=D.value,T=O.from==this.viewport.from?y:t.docView.measureVisibleLineHeights(O);this.heightMap=(s?Oi.empty().applyChanges(this.stateDeco,n.xv.empty,this.heightOracle,[new te(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,s,new Mi(O.from,T))}}catch(R){M=!0,A=R}finally{try{x||null==C.return||C.return()}finally{if(M)throw A}}r.heightChanged&&(h|=2)}var E=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return E&&(this.viewport=this.getViewport(u,this.scrollTarget)),this.updateForViewport(),(2&h||E)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}},{key:"visibleTop",get:function(){return this.scaler.fromDOM(this.pixelViewport.top)}},{key:"visibleBottom",get:function(){return this.scaler.fromDOM(this.pixelViewport.bottom)}},{key:"getViewport",value:function(t,e){var i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,r=this.heightOracle,o=this.visibleTop,s=this.visibleBottom,a=new ji(n.lineAt(o-1e3*i,Di.ByHeight,r,0,0).from,n.lineAt(s+1e3*(1-i),Di.ByHeight,r,0,0).to);if(e){var l=e.range.head;if(l<a.from||l>a.to){var h,u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=n.lineAt(l,Di.ByPos,r,0,0);h="center"==e.y?(c.top+c.bottom)/2-u/2:"start"==e.y||"nearest"==e.y&&l<a.from?c.top:c.bottom-u,a=new ji(n.lineAt(h-500,Di.ByHeight,r,0,0).from,n.lineAt(h+u+500,Di.ByHeight,r,0,0).to)}}return a}},{key:"mapViewport",value:function(t,e){var i=e.mapPos(t.from,-1),n=e.mapPos(t.to,1);return new ji(this.heightMap.lineAt(i,Di.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(n,Di.ByPos,this.heightOracle,0,0).to)}},{key:"viewportIsAppropriate",value:function(t){var e=t.from,i=t.to,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(!this.inView)return!0;var r=this.heightMap.lineAt(e,Di.ByPos,this.heightOracle,0,0).top,o=this.heightMap.lineAt(i,Di.ByPos,this.heightOracle,0,0).bottom,s=this,a=s.visibleTop,l=s.visibleBottom;return(0==e||r<=a-Math.max(10,Math.min(-n,250)))&&(i==this.state.doc.length||o>=l+Math.max(10,Math.min(n,250)))&&r>a-2e3&&o<l+2e3}},{key:"mapLineGaps",value:function(t,e){if(!t.length||e.empty)return t;var i=[],n=!0,r=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var l=s.value;e.touchesRange(l.from,l.to)||i.push(new zi(e.mapPos(l.from),e.mapPos(l.to),l.size))}}catch(h){r=!0,o=h}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return i}},{key:"ensureLineGaps",value:function(t,e){var i=this,r=this.heightOracle.lineWrapping,o=r?1e4:2e3,s=o>>1,a=o<<1;if(this.defaultTextDirection!=ie.LTR&&!r)return[];var l=[],h=function(o,a,u,c){if(!(a-o<s)){var f=i.state.selection.main,d=[f.from];f.empty||d.push(f.to);var v=!0,g=!1,p=void 0;try{for(var m,y=d[Symbol.iterator]();!(v=(m=y.next()).done);v=!0){var w=m.value;if(w>o&&w<a)return h(o,w-10,u,c),void h(w+10,a,u,c)}}catch(S){g=!0,p=S}finally{try{v||null==y.return||y.return()}finally{if(g)throw p}}var b=function(t,e){var i=!0,n=!1,r=void 0;try{for(var o,s=t[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){var a=o.value;if(e(a))return a}}catch(S){n=!0,r=S}finally{try{i||null==s.return||s.return()}finally{if(n)throw r}}return}(t,(function(t){return t.from>=u.from&&t.to<=u.to&&Math.abs(t.from-o)<s&&Math.abs(t.to-a)<s&&!d.some((function(e){return t.from<e&&t.to>e}))}));if(!b){if(a<u.to&&e&&r&&e.visibleRanges.some((function(t){return t.from<=a&&t.to>=a}))){var k=e.moveToLineBoundary(n.jT.cursor(a),!1,!0).head;k>o&&(a=k)}b=new zi(o,a,i.gapSize(u,o,a,c))}l.push(b)}},u=!0,c=!1,f=void 0;try{for(var d,v=this.viewportLines[Symbol.iterator]();!(u=(d=v.next()).done);u=!0){var g=d.value;if(!(g.length<a)){var p=Ki(g.from,g.to,this.stateDeco);if(!(p.total<a)){var m=this.scrollTarget?this.scrollTarget.range.head:null,y=void 0,w=void 0;
1if(r){var b=o/this.heightOracle.lineLength*this.heightOracle.lineHeight,k=void 0,S=void 0;if(null!=m){var x=Gi(p,m),M=((this.visibleBottom-this.visibleTop)/2+b)/g.height;k=x-M,S=x+M}else k=(this.visibleTop-g.top-b)/g.height,S=(this.visibleBottom-g.top+b)/g.height;y=qi(p,k),w=qi(p,S)}else{var A=p.total*this.heightOracle.charWidth,D=o*this.heightOracle.charWidth,C=void 0,O=void 0;if(null!=m){var T=Gi(p,m),E=((this.pixelViewport.right-this.pixelViewport.left)/2+D)/A;C=T-E,O=T+E}else C=(this.pixelViewport.left-D)/A,O=(this.pixelViewport.right+D)/A;y=qi(p,C),w=qi(p,O)}y>g.from&&h(g.from,y,g,p),w<g.to&&h(w,g.to,g,p)}}}}catch(R){c=!0,f=R}finally{try{u||null==v.return||v.return()}finally{if(c)throw f}}return l}},{key:"gapSize",value:function(t,e,i,n){var r=Gi(n,i)-Gi(n,e);return this.heightOracle.lineWrapping?t.height*r:n.total*this.heightOracle.charWidth*r}},{key:"updateLineGaps",value:function(t){var e=this;zi.same(t,this.lineGaps)||(this.lineGaps=t,this.lineGapDeco=bt.set(t.map((function(t){return t.draw(e.heightOracle.lineWrapping)}))))}},{key:"computeVisibleRanges",value:function(){var t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));var e=[];n.Xs.spans(t,this.viewport.from,this.viewport.to,{span:function(t,i){e.push({from:t,to:i})},point:function(){}},20);var i=e.length!=this.visibleRanges.length||this.visibleRanges.some((function(t,i){return t.from!=e[i].from||t.to!=e[i].to}));return this.visibleRanges=e,i?4:0}},{key:"lineBlockAt",value:function(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find((function(e){return e.from<=t&&e.to>=t}))||Xi(this.heightMap.lineAt(t,Di.ByPos,this.heightOracle,0,0),this.scaler)}},{key:"lineBlockAtHeight",value:function(t){return Xi(this.heightMap.lineAt(this.scaler.fromDOM(t),Di.ByHeight,this.heightOracle,0,0),this.scaler)}},{key:"elementAtHeight",value:function(t){return Xi(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}},{key:"docHeight",get:function(){return this.scaler.toDOM(this.heightMap.height)}},{key:"contentHeight",get:function(){return this.docHeight+this.paddingTop+this.paddingBottom}}]),t}(),ji=function t(e,i){l(this,t),this.from=e,this.to=i};function Ki(t,e,i){var r=[],o=t,s=0;return n.Xs.spans(i,t,e,{span:function(){},point:function(t,e){t>o&&(r.push({from:o,to:t}),s+=t-o),o=e}},20),o<e&&(r.push({from:o,to:e}),s+=e-o),{total:s,ranges:r}}function qi(t,e){var i=t.total,n=t.ranges;if(e<=0)return n[0].from;if(e>=1)return n[n.length-1].to;for(var r=Math.floor(i*e),o=0;;o++){var s=n[o],a=s.from,l=s.to-a;if(r<=l)return a+r;r-=l}}function Gi(t,e){var i=0,n=!0,r=!1,o=void 0;try{for(var s,a=t.ranges[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var l=s.value,h=l.from,u=l.to;if(e<=u){i+=e-h;break}i+=u-h}}catch(c){r=!0,o=c}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return i/t.total}var $i={toDOM:function(t){return t},fromDOM:function(t){return t},scale:1},_i=function(){function t(e,i,n){l(this,t);var r=0,o=0,s=0;this.viewports=n.map((function(t){var n=t.from,o=t.to,s=i.lineAt(n,Di.ByPos,e,0,0).top,a=i.lineAt(o,Di.ByPos,e,0,0).bottom;return r+=a-s,{from:n,to:o,top:s,bottom:a,domTop:0,domBottom:0}})),this.scale=(7e6-r)/(i.height-r);var a=!0,h=!1,u=void 0;try{for(var c,f=this.viewports[Symbol.iterator]();!(a=(c=f.next()).done);a=!0){var d=c.value;d.domTop=s+(d.top-o)*this.scale,s=d.domBottom=d.domTop+(d.bottom-d.top),o=d.bottom}}catch(v){h=!0,u=v}finally{try{a||null==f.return||f.return()}finally{if(h)throw u}}}return u(t,[{key:"toDOM",value:function(t){for(var e=0,i=0,n=0;;e++){var r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.top)return n+(t-i)*this.scale;if(t<=r.bottom)return r.domTop+(t-r.top);i=r.bottom,n=r.domBottom}}},{key:"fromDOM",value:function(t){for(var e=0,i=0,n=0;;e++){var r=e<this.viewports.length?this.viewports[e]:null;if(!r||t<r.domTop)return i+(t-n)/this.scale;if(t<=r.domBottom)return r.top+(t-r.domTop);i=r.bottom,n=r.domBottom}}}]),t}();function Xi(t,e){if(1==e.scale)return t;var i=e.toDOM(t.top),n=e.toDOM(t.bottom);return new Ai(t.from,t.length,i,n-i,t.children&&t.children.map((function(t){return Xi(t,e)})),t.deco)}var Ui=n.r$.define({combine:function(t){return t.join(" ")}}),Yi=n.r$.define({combine:function(t){return t.indexOf(!0)>-1}}),Ji=r.V.newName(),Zi=r.V.newName(),Qi=r.V.newName(),tn={"&light":"."+Zi,"&dark":"."+Qi};function en(t,e,i){return new r.V(e,{finish:function(e){return/&/.test(e)?e.replace(/&\w*/,(function(e){if("&"==e)return t;if(!i||!i[e])throw new RangeError("Unsupported selector: ".concat(e));return i[e]})):t+" "+e}})}var nn=en("."+Ji,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}}
1,"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},tn),rn=function t(e,i,r,o){l(this,t),this.typeOver=o,this.bounds=null,this.text="";var s=e.docView,a=s.impreciseHead,h=s.impreciseAnchor;if(e.state.readOnly&&i>-1)this.newSel=null;else if(i>-1&&(this.bounds=e.docView.domBoundsAround(i,r,0))){var u=a||h?[]:function(t){var e=[];if(t.root.activeElement!=t.contentDOM)return e;var i=t.observer.selectionRange,n=i.anchorNode,r=i.anchorOffset,o=i.focusNode,s=i.focusOffset;n&&(e.push(new De(n,r)),o==n&&s==r||e.push(new De(o,s)));return e}(e),c=new Me(u,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=function(t,e){if(0==t.length)return null;var i=t[0].pos,r=2==t.length?t[1].pos:i;return i>-1&&r>-1?n.jT.single(i+e,r+e):null}(u,this.bounds.from)}else{var f=e.observer.selectionRange,d=a&&a.node==f.focusNode&&a.offset==f.focusOffset||!b(e.contentDOM,f.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(f.focusNode,f.focusOffset),v=h&&h.node==f.anchorNode&&h.offset==f.anchorOffset||!b(e.contentDOM,f.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(f.anchorNode,f.anchorOffset);this.newSel=n.jT.single(v,d)}};function on(t,e){var i,r=e.newSel,o=t.state.selection.main;if(e.bounds){var s=e.bounds,a=s.from,l=s.to,h=o.from,u=null;(8===t.inputState.lastKeyCode&&t.inputState.lastKeyTime>
1Date.now()-100||et.android&&e.text.length<l-a)&&(h=o.to,u="end");var c=function(t,e,i,n){var r=Math.min(t.length,e.length),o=0;for(;o<r&&t.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==r&&t.length==e.length)return null;var s=t.length,a=e.length;for(;s>0&&a>0&&t.charCodeAt(s-1)==e.charCodeAt(a-1);)s--,a--;if("end"==n){i-=s+Math.max(0,o-Math.min(s,a))-o}if(s<o&&t.length<e.length){a=(o-=i<=o&&i>=s?o-i:0)+(a-s),s=o}else if(a<o){s=(o-=i<=o&&i>=a?o-i:0)+(s-a),a=o}return{from:o,toA:s,toB:a}}(t.state.doc.sliceString(a,l,xe),e.text,h-a,u);c&&(et.chrome&&13==t.inputState.lastKeyCode&&c.toB==c.from+2&&"\uffff\uffff"==e.text.slice(c.from,c.toB)&&c.toB--,i={from:a+c.from,to:a+c.toA,insert:n.xv.of(e.text.slice(c.from,c.toB).split(xe))})}else r&&(!t.hasFocus&&t.state.facet(Kt)||r.main.eq(o))&&(r=null);if(!i&&!r)return!1;if(!i&&e.typeOver&&!o.empty&&r&&r.main.empty?i={from:o.from,to:o.to,insert:t.state.doc.slice(o.from,o.to)}:i&&i.from>=o.from&&i.to<=o.to&&(i.from!=o.from||i.to!=o.to)&&o.to-o.from-(i.to-i.from)<=4?i={from:o.from,to:o.to,insert:t.state.doc.slice(o.from,i.from).append(i.insert).append(t.state.doc.slice(i.to,o.to))}:(et.mac||et.android)&&i&&i.from==i.to&&i.from==o.head-1&&/^\. ?$/.test(i.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(r&&2==i.insert.length&&(r=n.jT.single(r.main.anchor-1,r.main.head-1)),i={from:o.from,to:o.to,insert:n.xv.of([" "])}):et.chrome&&i&&i.from==i.to&&i.from==o.head&&"\n "==i.insert.toString()&&t.lineWrapping&&(r&&(r=n.jT.single(r.main.anchor-1,r.main.head-1)),i={from:o.from,to:o.to,insert:n.xv.of([" "])}),i){var f=t.state;if(et.ios&&t.inputState.flushIOSKey(t))return!0;if(et.android&&(i.from==o.from&&i.to==o.to&&1==i.insert.length&&2==i.insert.lines&&H(t.contentDOM,"Enter",13)||i.from==o.from-1&&i.to==o.to&&0==i.insert.length&&H(t.contentDOM,"Backspace",8)||i.from==o.from&&i.to==o.to+1&&0==i.insert.length&&H(t.contentDOM,"Delete",46)))return!0;var d,v=i.insert.toString();if(t.state.facet(Pt).some((function(e){return e(t,i.from,i.to,v)})))return!0;if(t.inputState.composing>=0&&t.inputState.composing++,i.from>=o.from&&i.to<=o.to&&i.to-i.from>=(o.to-o.from)/3&&(!r||r.main.empty&&r.main.from==i.from+i.insert.length)&&t.inputState.composing<0){var g=o.from<i.from?f.sliceDoc(o.from,i.from):"",p=o.to>i.to?f.sliceDoc(i.to,o.to):"";d=f.replaceSelection(t.state.toText(g+i.insert.sliceString(0,void 0,t.state.lineBreak)+p))}else{var m=f.changes(i),y=r&&r.main.to<=m.newLength?r.main:void 0;if(f.selection.ranges.length>1&&t.inputState.composing>=0&&i.to<=o.to&&i.to>=o.to-10){var w=t.state.sliceDoc(i.from,i.to),b=Ee(t)||t.state.doc.lineAt(o.head),k=o.to-i.to,S=o.to-o.from;d=f.changeByRange((function(e){if(e.from==o.from&&e.to==o.to)return{changes:m,range:y||e.map(m)};var r=e.to-k,s=r-w.length;if(e.to-e.from!=S||t.state.sliceDoc(s,r)!=w||b&&e.to>=b.from&&e.from<=b.to)return{range:e};var a=f.changes({from:s,to:r,insert:i.insert}),l=e.to-o.to;return{changes:a,range:y?n.jT.range(Math.max(0,y.anchor+l),Math.max(0,y.head+l)):e.map(a)}}))}else d={changes:m,selection:y&&f.selection.replaceRange(y)}}var x="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,x+=".compose",t.inputState.compositionFirstChange&&(x+=".start",t.inputState.compositionFirstChange=!1)),t.dispatch(d,{scrollIntoView:!0,userEvent:x}),!0}if(r&&!r.main.eq(o)){var M=!1,A="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(M=!0),A=t.inputState.lastSelectionOrigin),t.dispatch({selection:r,scrollIntoView:M,userEvent:A}),!0}return!1}var sn={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},an=et.ie&&et.ie_version<=11,ln=function(){function t(e){var i=this;l(this,t),this.view=e,this.active=!1,this.selectionRange=new E,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((function(t){var n=!0,r=!1,o=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done);
1n=!0){var l=s.value;i.queue.push(l)}}catch(h){r=!0,o=h}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}(et.ie&&et.ie_version<=11||et.ios&&e.composing)&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?i.flushSoon():i.flush()})),an&&(this.onCharData=function(t){i.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),i.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((function(){var t;(null===(t=i.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&i.onResize()})),this.resizeScroll.observe(e.scrollDOM),this.resizeContent=new ResizeObserver((function(){return i.view.requestMeasure()})),this.resizeContent.observe(e.contentDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((function(t){i.parentCheck<0&&(i.parentCheck=setTimeout(i.listenForScroll.bind(i),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=i.intersecting&&(i.intersecting=!i.intersecting,i.intersecting!=i.view.inView&&i.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((function(t){t.length>0&&t[t.length-1].intersectionRatio>0&&i.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}return u(t,[{key:"onScrollChanged",value:function(t){this.view.inputState.runScrollHandlers(this.view,t),this.intersecting&&this.view.measure()}},{key:"onScroll",value:function(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}},{key:"onResize",value:function(){var t=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((function(){t.resizeTimeout=-1,t.view.requestMeasure()}),50))}},{key:"onPrint",value:function(){var t=this;this.view.viewState.printing=!0,this.view.measure(),setTimeout((function(){t.view.viewState.printing=!1,t.view.requestMeasure()}),500)}},{key:"updateGaps",value:function(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((function(e,i){return e!=t[i]})))){this.gapIntersection.disconnect();var e=!0,i=!1,n=void 0;try{for(var r,o=t[Symbol.iterator]();!(e=(r=o.next()).done);e=!0){var s=r.value;this.gapIntersection.observe(s)}}catch(a){i=!0,n=a}finally{try{e||null==o.return||o.return()}finally{if(i)throw n}}this.gaps=t}}},{key:"onSelectionChange",value:function(t){var e=this.selectionChanged;if(this.readSelectionRange()&&!this.delayedAndroidKey){var i=this.view,n=this.selectionRange;if(i.state.facet(Kt)?i.root.activeElement==this.dom:k(i.dom,n)){var r=n.anchorNode&&i.docView.nearest(n.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(et.ie&&et.ie_version<=11||et.android&&et.chrome)&&!i.state.selection.main.empty&&n.focusNode&&x(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}}}},{key:"readSelectionRange",value:function(){var t=this.view,e=et.safari&&11==t.root.nodeType&&function(t){for(var e=t.activeElement;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t){var e=null;function i(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",i,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",i,!0),!e)return null;var n,r=e.startContainer,o=e.startOffset,s=e.endContainer,a=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);x(l.node,l.offset,s,a)&&(r=(n=[s,a,r,o])[0],o=n[1],s=n[2],a=n[3]);return{anchorNode:r,anchorOffset:o,focusNode:s,focusOffset:a}}(this.view)||w(t.root);if(!e||this.selectionRange.eq(e))return!1;var i=k(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime<Date.now()-300&&function(t,e){var i=e.focusNode,n=e.focusOffset;if(!i||e.anchorNode!=i||e.anchorOffset!=n)return!1;for(;;)if(n){if(1!=i.nodeType)return!1;var r=i.childNodes[n-1];"false"==r.contentEditable?n--:n=D(i=r)}else{if(i==t)return!0;n=M(i),i=i.parentNode}}(this.dom,e)?(this.view.inputState.lastFocusTime=0,t.docView.updateSelection(),!1):(this.selectionRange.setRange(e),i&&(this.selectionChanged=!0),!0)}},{key:"setSelectionRange",value:function(t,e){this.selectionRange.set(t.node,t.offset,e.node,e.offset),this.selectionChanged=!1}},{key:"clearSelectionRange",value:function(){this.selectionRange.set(null,0,null,0)}},{key:"listenForScroll",value:function(){this.parentCheck=-1;for(var t=0,e=null,i=this.dom;i;)if(1==i.nodeType)!e&&t<this.scrollTargets.length&&this.scrollTargets[t]==i?t++:e||(e=this.scrollTargets.slice(0,t)),e&&e.push(i),i=i.assignedSlot||i.parentNode;else{if(11!=i.nodeType)break;i=i.host}if(t<this.scrollTargets.length&&!e&&(e=this.scrollTargets.slice(0,t)),e){var n=!0,r=!1,o=void 0;try{for(var s,a=this.scrollTargets[Symbol.iterator]();!(n=(s=a.next()).done);
1n=!0){s.value.removeEventListener("scroll",this.onScroll)}}catch(d){r=!0,o=d}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}var l=!0,h=!1,u=void 0;try{for(var c,f=(this.scrollTargets=e)[Symbol.iterator]();!(l=(c=f.next()).done);l=!0){c.value.addEventListener("scroll",this.onScroll)}}catch(d){h=!0,u=d}finally{try{l||null==f.return||f.return()}finally{if(h)throw u}}}}},{key:"ignore",value:function(t){if(!this.active)return t();try{return this.stop(),t()}finally{this.start(),this.clear()}}},{key:"start",value:function(){this.active||(this.observer.observe(this.dom,sn),an&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}},{key:"stop",value:function(){this.active&&(this.active=!1,this.observer.disconnect(),an&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}},{key:"clear",value:function(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}},{key:"delayAndroidKey",value:function(t,e){var i,n=this;if(!this.delayedAndroidKey){this.flushingAndroidKey=this.view.win.requestAnimationFrame((function(){var t=n.delayedAndroidKey;t&&(n.clearDelayedAndroidKey(),!n.flush()&&t.force&&H(n.dom,t.key,t.keyCode))}))}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange<Date.now()-50||!!(null===(i=this.delayedAndroidKey)||void 0===i?void 0:i.force)})}},{key:"clearDelayedAndroidKey",value:function(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}},{key:"flushSoon",value:function(){var t=this;this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame((function(){t.delayedFlush=-1,t.flush()})))}},{key:"forceFlush",value:function(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}},{key:"pendingRecords",value:function(){var t=!0,e=!1,i=void 0;try{for(var n,r=this.observer.takeRecords()[Symbol.iterator]();!(t=(n=r.next()).done);t=!0){var o=n.value;this.queue.push(o)}}catch(s){e=!0,i=s}finally{try{t||null==r.return||r.return()}finally{if(e)throw i}}return this.queue}},{key:"processRecords",value:function(){var t=this.pendingRecords();t.length&&(this.queue=[]);var e=-1,i=-1,n=!1,r=!0,o=!1,s=void 0;try{for(var a,l=t[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var h,u=a.value,c=this.readMutation(u);if(c)if(c.typeOver&&(n=!0),-1==e)e=(h=c).from,i=h.to;else e=Math.min(c.from,e),i=Math.max(c.to,i)}}catch(f){o=!0,s=f}finally{try{r||null==l.return||l.return()}finally{if(o)throw s}}return{from:e,to:i,typeOver:n}}},{key:"readChange",value:function(){var t=this.processRecords(),e=t.from,i=t.to,n=t.typeOver,r=this.selectionChanged&&k(this.dom,this.selectionRange);return e<0&&!r?null:(e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new rn(this.view,e,i,n))}},{key:"flush",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();var e=this.readChange();if(!e)return!1;var i=this.view.state,n=on(this.view,e);return this.view.state==i&&this.view.update([]),n}},{key:"readMutation",value:function(t){var e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.dirty|=4),"childList"==t.type){var i=hn(e,t.previousSibling||t.target.previousSibling,-1),n=hn(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}},{key:"setWindow",value:function(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}},{key:"addWindowListeners",value:function(t){t.addEventListener("resize",this.onResize),t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}},{key:"removeWindowListeners",value:function(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"destroy",value:function(){var t,e,i,n;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect(),null===(n=this.resizeContent)||void 0===n||n.disconnect();var r=!0,o=!1,s=void 0;try{for(var a,l=this.scrollTargets[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){a.value.removeEventListener("scroll",this.onScroll)}}catch(h){o=!0,s=h}finally{try{r||null==l.return||l.return()}finally{if(o)throw s}}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}]),t}();function hn(t,e,i){for(;e;){var n=z.get(e);if(n&&n.parent==t)return n;var r=e.parentNode;e=r!=t.dom?r:i>0?e.nextSibling:e.previousSibling}return null}var un=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=this;l(this,t),this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="
1cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=e.dispatch||function(t){return i.update([t])},this.dispatch=this.dispatch.bind(this),this._root=e.root||V(e.parent)||document,this.viewState=new Ii(e.state||n.yy.create(e)),this.plugins=this.state.facet(Gt).map((function(t){return new _t(t)}));var r=!0,o=!1,s=void 0;try{for(var a,h=this.plugins[Symbol.iterator]();!(r=(a=h.next()).done);r=!0){var u=a.value;u.update(this)}}catch(c){o=!0,s=c}finally{try{r||null==h.return||h.return()}finally{if(o)throw s}}this.observer=new ln(this),this.inputState=new Ye(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new Ce(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}return u(t,[{key:"state",get:function(){return this.viewState.state}},{key:"viewport",get:function(){return this.viewState.viewport}},{key:"visibleRanges",get:function(){return this.viewState.visibleRanges}},{key:"inView",get:function(){return this.viewState.inView}},{key:"composing",get:function(){return this.inputState.composing>0}},{key:"compositionStarted",get:function(){return this.inputState.composing>=0}},{key:"root",get:function(){return this._root}},{key:"win",get:function(){return this.dom.ownerDocument.defaultView||window}},{key:"dispatch",value:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var r;this._dispatch(1==e.length&&e[0]instanceof n.YW?e[0]:(r=this.state).update.apply(r,p(e)))}},{key:"update",value:function(t){var e=this;if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");var i,r=!1,o=!1,s=this.state,a=!0,l=!1,h=void 0;try{for(var u,c=t[Symbol.iterator]();!(a=(u=c.next()).done);a=!0){var f=u.value;if(f.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=f.state}}catch(W){l=!0,h=W}finally{try{a||null==c.return||c.return()}finally{if(l)throw h}}if(this.destroyed)this.viewState.state=s;else{var d=this.hasFocus,v=0,g=null;t.some((function(t){return t.annotation(wi)}))?(this.inputState.notifiedFocused=d,v=1):d!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=d,(g=bi(s,d))||(v=1));var p=this.observer.delayedAndroidKey,m=null;if(p?(this.observer.clearDelayedAndroidKey(),((m=this.observer.readChange())&&!this.state.doc.eq(s.doc)||
1!this.state.selection.eq(s.selection))&&(m=null)):this.observer.clear(),s.facet(n.yy.phrases)!=this.state.facet(n.yy.phrases))return this.setState(s);i=ee.create(this,s,t),i.flags|=v;var y=this.viewState.scrollTarget;try{this.updateState=2;var w=!0,b=!1,k=void 0;try{for(var S,x=t[Symbol.iterator]();!(w=(S=x.next()).done);w=!0){var M=S.value;if(y&&(y=y.map(M.changes)),M.scrollIntoView){var A=M.state.selection.main;y=new Ft(A.empty?A:n.jT.cursor(A.head,A.head>A.anchor?-1:1))}var D=!0,C=!1,O=void 0;try{for(var T,E=M.effects[Symbol.iterator]();!(D=(T=E.next()).done);D=!0){var R=T.value;R.is(It)&&(y=R.value)}}catch(W){C=!0,O=W}finally{try{D||null==E.return||E.return()}finally{if(C)throw O}}}}catch(W){b=!0,k=W}finally{try{w||null==x.return||x.return()}finally{if(b)throw k}}this.viewState.update(i,y),this.bidiCache=dn.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),r=this.docView.update(i),this.state.facet(Qt)!=this.styleModules&&this.mountStyles(),o=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(r,t.some((function(t){return t.isUserEvent("select.pointer")})))}finally{this.updateState=0}i.startState.facet(Ui)!=i.state.facet(Ui)&&(this.viewState.mustMeasureContent=!0),(r||o||y||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure();var B=!0,L=!1,V=void 0;if(!i.empty)try{for(var P,N=this.state.facet(Vt)[Symbol.iterator]();!(B=(P=N.next()).done);B=!0){(0,P.value)(i)}}catch(W){L=!0,V=W}finally{try{B||null==N.return||N.return()}finally{if(L)throw V}}(g||m)&&Promise.resolve().then((function(){g&&e.state==g.startState&&e.dispatch(g),m&&!on(e,m)&&p.force&&H(e.contentDOM,p.key,p.keyCode)}))}}},{key:"setState",value:function(t){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)this.viewState.state=t;else{this.updateState=2;var e=this.hasFocus;try{var i=!0,n=!1,r=void 0;try{for(var o,s=this.plugins[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){o.value.destroy(this)}}catch(f){n=!0,r=f}finally{try{i||null==s.return||s.return()}finally{if(n)throw r}}this.viewState=new Ii(t),this.plugins=t.facet(Gt).map((function(t){return new _t(t)})),this.pluginMap.clear();var a=!0,l=!1,h=void 0;try{for(var u,c=this.plugins[Symbol.iterator]();!(a=(u=c.next()).done);a=!0){u.value.update(this)}}catch(f){l=!0,h=f}finally{try{a||null==c.return||c.return()}finally{if(l)throw h}}this.docView=new Ce(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}}},{key:"updatePlugins",value:function(t){var e=t.startState.facet(Gt),i=t.state.facet(Gt);if(e!=i){var n=[],r=!0,o=!1,s=void 0;try{for(var a,l=i[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var h=a.value,u=e.indexOf(h);if(u<0)n.push(new _t(h));else{var c=this.plugins[u];c.mustUpdate=t,n.push(c)}}}catch(M){o=!0,s=M}finally{try{r||null==l.return||l.return()}finally{if(o)throw s}}var f=!0,d=!1,v=void 0;try{for(var g,p=this.plugins[Symbol.iterator]();!(f=(g=p.next()).done);f=!0){var m=g.value;m.mustUpdate!=t&&m.destroy(this)}}catch(M){d=!0,v=M}finally{try{f||null==p.return||p.return()}finally{if(d)throw v}}this.plugins=n,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else{var y=!0,w=!1,b=void 0;try{for(var k,S=this.plugins[Symbol.iterator]();!(y=(k=S.next()).done);y=!0){k.value.mustUpdate=t}}catch(M){w=!0,b=M}finally{try{y||null==S.return||S.return()}finally{if(w)throw b}}}for(var x=0;x<this.plugins.length;x++)this.plugins[x].update(this)}},{key:"measure",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=this;if(!this.destroyed){this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,t&&this.observer.forceFlush();var i=null,n=this.scrollDOM,r=n.scrollHeight,o=n.scrollTop,s=n.clientHeight,a=o>r-s-4?r:o;try{for(var l=this,h=function(t){l.updateState=1;var n=l.viewport,r=l.viewState.lineBlockAtHeight(a),o=l.viewState.measure(l);
1if(!o&&!l.measureRequests.length&&null==l.viewState.scrollTarget)return"break";if(t>5)return console.warn(l.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize"),"break";var s,h=[];4&o||(s=[h,l.measureRequests],l.measureRequests=s[0],h=s[1]);var u=h.map((function(t){try{return t.read(e)}catch(i){return jt(e.state,i),fn}})),c=ee.create(l,l.state,[]),f=!1,d=!1;c.flags|=o,i?i.flags|=o:i=c,l.updateState=2,c.empty||(l.updatePlugins(c),l.inputState.update(c),l.updateAttrs(),f=l.docView.update(c));for(var v=0;v<h.length;v++)if(u[v]!=fn)try{var g=h[v];g.write&&g.write(u[v],l)}catch(m){jt(l.state,m)}if(l.viewState.editorHeight)if(l.viewState.scrollTarget)l.docView.scrollIntoView(l.viewState.scrollTarget),l.viewState.scrollTarget=null,d=!0;else{var p=l.viewState.lineBlockAt(r.from).top-r.top;(p>1||p<-1)&&(l.scrollDOM.scrollTop+=p,d=!0)}return f&&l.docView.updateSelection(!0),l.viewport.from!=n.from||l.viewport.to!=n.to||d||0!=l.measureRequests.length?void 0:"break"},u=0;;u++){var c=h(u);if("break"===c)break}}finally{this.updateState=0,this.measureScheduled=-1}var f=!0,d=!1,v=void 0;if(i&&!i.empty)try{for(var g,p=this.state.facet(Vt)[Symbol.iterator]();!(f=(g=p.next()).done);f=!0){var m=g.value;m(i)}}catch(y){d=!0,v=y}finally{try{f||null==p.return||p.return()}finally{if(d)throw v}}}}},{key:"themeClasses",get:function(){return Ji+" "+(this.state.facet(Yi)?Qi:Zi)+" "+this.state.facet(Ui)}},{key:"updateAttrs",value:function(){var t=this,e=vn(this,Xt,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),i={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Kt)?"true":"false",class:"cm-content",style:"".concat(et.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};this.state.readOnly&&(i["aria-readonly"]="true"),vn(this,Ut,i);var n=this.observer.ignore((function(){var n=mt(t.contentDOM,t.contentAttrs,i),r=mt(t.dom,t.editorAttrs,e);return n||r}));return this.editorAttrs=e,this.contentAttrs=i,n}},{key:"showAnnouncements",value:function(e){var i=!0,n=!0,r=!1,o=void 0,s=!0,a=!1,l=void 0;try{for(var h,u=e[Symbol.iterator]();!(s=(h=u.next()).done);s=!0){var c=h.value;try{for(var f,d=c.effects[Symbol.iterator]();!(n=(f=d.next()).done);n=!0){var v=f.value;if(v.is(t.announce))i&&(this.announceDOM.textContent=""),i=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=v.value}}catch(g){r=!0,o=g}finally{try{n||null==d.return||d.return()}finally{if(r)throw o}}}}catch(g){a=!0,l=g}finally{try{s||null==u.return||u.return()}finally{if(a)throw l}}}},{key:"mountStyles",value:function(){this.styleModules=this.state.facet(Qt),r.V.mount(this.root,this.styleModules.concat(nn).reverse())}},{key:"readMeasured",value:function(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}},{key:"requestMeasure",value:function(t){var e=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((function(){return e.measure()}))),t){if(this.measureRequests.indexOf(t)>-1)return;if(null!=t.key)for(var i=0;i<this.measureRequests.length;i++)if(this.measureRequests[i].key===t.key)return void(this.measureRequests[i]=t);this.measureRequests.push(t)}}},{key:"plugin",value:function(t){var e=this.pluginMap.get(t);return(void 0===e||e&&e.spec!=t)&&this.pluginMap.set(t,e=this.plugins.find((function(e){return e.spec==t}))||null),e&&e.update(this).value}},{key:"documentTop",get:function(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}},{key:"documentPadding",get:function(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}},{key:"elementAtHeight",value:function(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}},{key:"lineBlockAtHeight",value:function(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}},{key:"viewportLineBlocks",get:function(){return this.viewState.viewportLines}},{key:"lineBlockAt",value:function(t){return this.viewState.lineBlockAt(t)}},{key:"contentHeight",get:function(){return this.viewState.contentHeight}}
1,{key:"moveByChar",value:function(t,e,i){return Ue(this,t,Xe(this,t,e,i))}},{key:"moveByGroup",value:function(t,e){var i=this;return Ue(this,t,Xe(this,t,e,(function(e){return function(t,e,i){var r=t.state.charCategorizer(e),o=r(i);return function(t){var e=r(t);return o==n.D0.Space&&(o=e),o==e}}(i,t.head,e)})))}},{key:"moveToLineBoundary",value:function(t,e){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return _e(this,t,e,i)}},{key:"moveVertically",value:function(t,e,i){return Ue(this,t,function(t,e,i,r){var o=e.head,s=i?1:-1;if(o==(i?t.state.doc.length:0))return n.jT.cursor(o,e.assoc);var a,l=e.goalColumn,h=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(o),c=t.documentTop;if(u)null==l&&(l=u.left-h.left),a=s<0?u.top:u.bottom;else{var f=t.viewState.lineBlockAt(o);null==l&&(l=Math.min(h.right-h.left,t.defaultCharacterWidth*(o-f.from))),a=(s<0?f.top:f.bottom)+c}for(var d=h.left+l,v=null!==r&&void 0!==r?r:t.defaultLineHeight>>1,g=0;;g+=10){var p=a+(v+g)*s,m=Ke(t,{x:d,y:p},!1,s);if(p<h.top||p>h.bottom||(s<0?m<o:m>o))return n.jT.cursor(m,e.assoc,void 0,l)}}(this,t,e,i))}},{key:"domAtPos",value:function(t){return this.docView.domAtPos(t)}},{key:"posAtDOM",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.posFromDOM(t,e)}},{key:"posAtCoords",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.readMeasured(),Ke(this,t,e)}},{key:"coordsAtPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.readMeasured();var i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;var n=this.state.doc.lineAt(t),r=this.bidiSpans(n),o=r[me.find(r,t-n.from,-1,e)];return C(i,o.dir==ie.LTR==e>0)}},{key:"defaultCharacterWidth",get:function(){return this.viewState.heightOracle.charWidth}},{key:"defaultLineHeight",get:function(){return this.viewState.heightOracle.lineHeight}},{key:"textDirection",get:function(){return this.viewState.defaultTextDirection}},{key:"textDirectionAt",value:function(t){return!this.state.facet(Wt)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}},{key:"lineWrapping",get:function(){return this.viewState.heightOracle.lineWrapping}},{key:"bidiSpans",value:function(t){if(t.length>cn)return be(t.length);var e=this.textDirectionAt(t.from),i=!0,n=!1,r=void 0;try{for(var o,s=this.bidiCache[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){var a=o.value;if(a.from==t.from&&a.dir==e)return a.order}}catch(h){n=!0,r=h}finally{try{i||null==s.return||s.return()}finally{if(n)throw r}}var l=we(t.text,e);return this.bidiCache.push(new dn(t.from,t.to,e,l)),l}},{key:"hasFocus",get:function(){var t;return(this.dom.ownerDocument.hasFocus()||et.safari&&(null===(t=this.inputState)||void 0===t?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}},{key:"focus",value:function(){var t=this;this.observer.ignore((function(){B(t.contentDOM),t.docView.updateSelection()}))}},{key:"setRoot",value:function(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}},{key:"destroy",value:function(){var t=!0,e=!1,i=void 0;try{for(var n,r=this.plugins[Symbol.iterator]();!(t=(n=r.next()).done);t=!0){n.value.destroy(this)}}catch(o){e=!0,i=o}finally{try{t||null==r.return||r.return()}finally{if(e)throw i}}this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}}],[{key:"scrollIntoView",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return It.of(new Ft("number"==typeof t?n.jT.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}},{key:"domEventHandlers",value:function(t){return $t.define((function(){return{}}),{eventHandlers:t})}},{key:"theme",value:function(t,e){var i=r.V.newName(),n=[Ui.of(i),Qt.of(en(".".concat(i),t))];return e&&e.dark&&n.push(Yi.of(!0)),n}},{key:"baseTheme",value:function(t){return n.Wl.lowest(Qt.of(en("."+Ji,t,tn)))}},{key:"findFromDOM",value:function(t){var e,i=t.querySelector(".cm-content"),n=i&&z.get(i)||z.get(t);return(null===(e=null===n||void 0===n?void 0:n.rootView)||void 0===e?void 0:e.view
1)||null}}]),t}();un.styleModule=Qt,un.inputHandler=Pt,un.focusChangeEffect=Nt,un.perLineTextDirection=Wt,un.exceptionSink=Ht,un.updateListener=Vt,un.editable=Kt,un.mouseSelectionStyle=Lt,un.dragMovesSelection=Bt,un.clickAddsSelectionRange=Rt,un.decorations=Yt,un.atomicRanges=Jt,un.scrollMargins=Zt,un.darkTheme=Yi,un.contentAttributes=Ut,un.editorAttributes=Xt,un.lineWrapping=un.contentAttributes.of({class:"cm-lineWrapping"}),un.announce=n.Py.define();var cn=4096,fn={},dn=function(){function t(e,i,n,r){l(this,t),this.from=e,this.to=i,this.dir=n,this.order=r}return u(t,null,[{key:"update",value:function(e,i){if(i.empty)return e;for(var n=[],r=e.length?e[e.length-1].dir:ie.LTR,o=Math.max(0,e.length-10);o<e.length;o++){var s=e[o];s.dir!=r||i.touchesRange(s.from,s.to)||n.push(new t(i.mapPos(s.from,1),i.mapPos(s.to,-1),s.dir,s.order))}return n}}]),t}();function vn(t,e,i){for(var n=t.state.facet(e),r=n.length-1;r>=0;r--){var o=n[r],s="function"==typeof o?o(t):o;s&&gt(s,i)}return i}var gn=et.mac?"mac":et.windows?"win":et.linux?"linux":"key";function pn(t,e){var i,n,r,o,s=t.split(/-(?!$)/),a=s[s.length-1];"Space"==a&&(a=" ");for(var l=0;l<s.length-1;++l){var h=s[l];if(/^(cmd|meta|m)$/i.test(h))o=!0;else if(/^a(lt)?$/i.test(h))i=!0;else if(/^(c|ctrl|control)$/i.test(h))n=!0;else if(/^s(hift)?$/i.test(h))r=!0;else{if(!/^mod$/i.test(h))throw new Error("Unrecognized modifier name: "+h);"mac"==e?o=!0:n=!0}}return i&&(a="Alt-"+a),n&&(a="Ctrl-"+a),o&&(a="Meta-"+a),r&&(a="Shift-"+a),a}function mn(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t}var yn=n.Wl.default(un.domEventHandlers({keydown:function(t,e){return Mn(kn(e.state),t,e,"editor")}})),wn=n.r$.define({enables:yn}),bn=new WeakMap;function kn(t){var e=t.facet(wn),i=bn.get(e);return i||bn.set(e,i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gn,i=Object.create(null),n=Object.create(null),r=function(t,e){var i=n[t];if(null==i)n[t]=e;else if(i!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},o=function(t,n,o,s){for(var a,l,h=function(e){var i=c.slice(0,e).join(" ");r(i,!0),u[i]||(u[i]={preventDefault:!0,run:[function(e){var n=Sn={view:e,prefix:i,scope:t};return setTimeout((function(){Sn==n&&(Sn=null)}),xn),!0}]})},u=i[t]||(i[t]=Object.create(null)),c=n.split(/ (?!$)/).map((function(t){return pn(t,e)})),f=1;f<c.length;f++)h(f);var d=c.join(" ");r(d,!1);var v=u[d]||(u[d]={preventDefault:!1,run:(null===(l=null===(a=u._any)||void 0===a?void 0:a.run)||void 0===l?void 0:l.slice())||[]});o&&v.run.push(o),s&&(v.preventDefault=!0)},s=!0,a=!1,l=void 0;try{for(var h,u=t[Symbol.iterator]();!(s=(h=u.next()).done);s=!0){var c=h.value,f=c.scope?c.scope.split(" "):["editor"],d=!0,v=!1,g=void 0;if(c.any)try{for(var p,m=f[Symbol.iterator]();!(d=(p=m.next()).done);d=!0){var y=p.value,w=i[y]||(i[y]=Object.create(null));for(var b in w._any||(w._any={preventDefault:!1,run:[]}),w)w[b].run.push(c.any)}}catch(O){v=!0,g=O}finally{try{d||null==m.return||m.return()}finally{if(v)throw g}}var k=c[e]||c.key;if(k){var S=!0,x=!1,M=void 0;try{for(var A,D=f[Symbol.iterator]();!(S=(A=D.next()).done);S=!0){var C=A.value;o(C,k,c.run,c.preventDefault),c.shift&&o(C,"Shift-"+k,c.shift,c.preventDefault)}}catch(O){x=!0,M=O}finally{try{S||null==D.return||D.return()}finally{if(x)throw M}}}}}catch(O){a=!0,l=O}finally{try{s||null==u.return||u.return()}finally{if(a)throw l}}return i}(e.reduce((function(t,e){return t.concat(e)}),[]))),i}var Sn=null,xn=4e3;function Mn(t,e,i,r){var s=(0,o.YG)(e),a=(0,n.gm)(s,0),l=(0,n.nZ)(a)==s.length&&" "!=s,h="",u=!1;Sn&&Sn.view==i&&Sn.scope==r&&(h=Sn.prefix+" ",(u=Qe.indexOf(e.keyCode)<0)&&(Sn=null));var c,f,d=new Set,v=function(t){if(t){var n=!0,r=!1,o=void 0;try{for(var s,a=t.run[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var l=s.value;if(!d.has(l)&&(d.add(l),l(i,e)))return!0}}catch(h){r=!0,o=h}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}t.preventDefault&&(u=!0)}return!1},g=t[r];if(g){if(v(g[h+mn(s,e,!l)]))return!0;
1if(l&&(e.altKey||e.metaKey||e.ctrlKey)&&!(et.windows&&e.ctrlKey&&e.altKey)&&(c=o.ue[e.keyCode])&&c!=s){if(v(g[h+mn(c,e,!0)]))return!0;if(e.shiftKey&&(f=o.uY[e.keyCode])!=s&&f!=c&&v(g[h+mn(f,e,!1)]))return!0}else if(l&&e.shiftKey&&v(g[h+mn(s,e,!0)]))return!0;if(v(g._any))return!0}return u}var An=!et.ios;var Dn={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};An&&(Dn[".cm-line"].caretColor="transparent !important");function Cn(t,e,i,n,r){e.lastIndex=0;for(var o,s=t.iterRange(i,n),a=i;!s.next().done;a+=s.value.length)if(!s.lineBreak)for(;o=e.exec(s.value);)r(a+o.index,o)}var On=function(){function t(e){l(this,t);var i=e.regexp,n=e.decoration,r=e.decorate,o=e.boundary,s=e.maxLength,a=void 0===s?1e3:s;if(!i.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=i,r)this.addMatch=function(t,e,i,n){return r(n,i,i+t[0].length,t,e)};else if("function"==typeof n)this.addMatch=function(t,e,i,r){var o=n(t,e,i);o&&r(i,i+t[0].length,o)};else{if(!n)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,i,r){return r(i,i+t[0].length,n)}}this.boundary=o,this.maxLength=a}return u(t,[{key:"createDeco",value:function(t){var e=this,i=new n.f_,r=i.add.bind(i),o=!0,s=!1,a=void 0;try{for(var l,h=function(t,e){var i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;var n=[],r=!0,o=!1,s=void 0;try{for(var a,l=i[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var h=a.value,u=h.from,c=h.to;u=Math.max(t.state.doc.lineAt(u).from,u-e),c=Math.min(t.state.doc.lineAt(c).to,c+e),n.length&&n[n.length-1].to>=u?n[n.length-1].to=c:n.push({from:u,to:c})}}catch(f){o=!0,s=f}finally{try{r||null==l.return||l.return()}finally{if(o)throw s}}return n}(t,this.maxLength)[Symbol.iterator]();!(o=(l=h.next()).done);o=!0){var u=l.value,c=u.from,f=u.to;Cn(t.state.doc,this.regexp,c,f,(function(i,n){return e.addMatch(n,t,i,r)}))}}catch(d){s=!0,a=d}finally{try{o||null==h.return||h.return()}finally{if(s)throw a}}return i.finish()}},{key:"updateDeco",value:function(t,e){var i=1e9,n=-1;return t.docChanged&&t.changes.iterChanges((function(e,r,o,s){s>t.view.viewport.from&&o<t.view.viewport.to&&(i=Math.min(o,i),n=Math.max(s,n))})),t.viewportChanged||n-i>1e3?this.createDeco(t.view):n>-1?this.updateRange(t.view,e.map(t.changes),i,n):e}},{key:"updateRange",value:function(t,e,i,n){var r=this,o=!0,s=!1,a=void 0;try{for(var l,h=this,u=function(){var o=l.value,s=Math.max(o.from,i),a=Math.min(o.to,n);if(a>s){var u=t.state.doc.lineAt(s),c=u.to<a?t.state.doc.lineAt(a):u,f=Math.max(o.from,u.from),d=Math.min(o.to,c.to);if(h.boundary){for(;s>u.from;s--)if(h.boundary.test(u.text[s-1-u.from])){f=s;break}for(;a<c.to;a++)if(h.boundary.test(c.text[a-c.from])){d=a;break}}var v=[],g=void 0,p=function(t,e,i){return v.push(i.range(t,e))};if(u==c)for(h.regexp.lastIndex=f-u.from;(g=h.regexp.exec(u.text))&&g.index<d-u.from;)h.addMatch(g,t,g.index+u.from,p);else Cn(t.state.doc,h.regexp,f,d,(function(e,i){return r.addMatch(i,t,e,p)}));e=e.update({filterFrom:f,filterTo:d,filter:function(t,e){return t<f||e>d},add:v})}},c=t.visibleRanges[Symbol.iterator]();!(o=(l=c.next()).done);o=!0)u()}catch(f){s=!0,a=f}finally{try{o||null==c.return||c.return()}finally{if(s)throw a}}return e}}]),t}(),Tn=null!=/x/.unicode?"gu":"g",En=new RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]",Tn),Rn={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},Bn=null;var Ln=n.r$.define({combine:function(t){var e=(0,n.BO)(t,{render:null,specialChars:En,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==Bn&&"undefined"!=typeof document&&document.body){var e=document.body.style;Bn=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return Bn||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Tn)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Tn)),e}}
1);function Hn(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Ln.of(t),Pn()]}var Vn=null;function Pn(){return Vn||(Vn=$t.fromClass(function(){function t(e){l(this,t),this.view=e,this.decorations=bt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Ln)),this.decorations=this.decorator.createDeco(e)}return u(t,[{key:"makeDecorator",value:function(t){var e=this;return new On({regexp:t.specialChars,decoration:function(i,r,o){var s=r.state.doc,a=(0,n.gm)(i[0],0);if(9==a){var l=s.lineAt(o),h=r.state.tabSize,u=(0,n.IS)(l.text,h,o-l.from);return bt.replace({widget:new Wn((h-u%h)*e.view.defaultCharacterWidth)})}return e.decorationCache[a]||(e.decorationCache[a]=bt.replace({widget:new Nn(t,a)}))},boundary:t.replaceTabs?void 0:/[^]/})}},{key:"update",value:function(t){var e=t.state.facet(Ln);t.startState.facet(Ln)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}}]),t}(),{decorations:function(t){return t.decorations}}))}var Nn=function(t){d(i,t);var e=y(i);function i(t,n){var r;return l(this,i),(r=e.call(this)).options=t,r.code=n,r}return u(i,[{key:"eq",value:function(t){return t.code==this.code}},{key:"toDOM",value:function(t){var e,i=(e=this.code)>=32?"\u2022":10==e?"\u2424":String.fromCharCode(9216+e),n=t.state.phrase("Control character")+" "+(Rn[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,n,i);if(r)return r;var o=document.createElement("span");return o.textContent=i,o.title=n,o.setAttribute("aria-label",n),o.className="cm-specialChar",o}},{key:"ignoreEvent",value:function(){return!1}}]),i}(yt),Wn=function(t){d(i,t);var e=y(i);function i(t){var n;return l(this,i),(n=e.call(this)).width=t,n}return u(i,[{key:"eq",value:function(t){return t.width==this.width}},{key:"toDOM",value:function(){var t=document.createElement("span");return t.textContent="\t",t.className="cm-tab",t.style.width=this.width+"px",t}},{key:"ignoreEvent",value:function(){return!1}}]),i}(yt);function zn(){return In}var Fn=bt.line({class:"cm-activeLine"}),In=$t.fromClass(function(){function t(e){l(this,t),this.decorations=this.getDeco(e)}return u(t,[{key:"update",value:function(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}},{key:"getDeco",value:function(t){var e=-1,i=[],n=!0,r=!1,o=void 0;try{for(var s,a=t.state.selection.ranges[Symbol.iterator]();!(n=(s=a.next()).done);n=!0){var l=s.value,h=t.lineBlockAt(l.head);h.from>e&&(i.push(Fn.range(h.from)),e=h.from)}}catch(u){r=!0,o=u}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}return bt.set(i)}}]),t}(),{decorations:function(t){return t.decorations}});var jn="-10000px",Kn=function(){function t(e,i,n){l(this,t),this.facet=i,this.createTooltipView=n,this.input=e.state.facet(i),this.tooltips=this.input.filter((function(t){return t})),this.tooltipViews=this.tooltips.map(n)}return u(t,[{key:"update",value:function(t){var e,i=t.state.facet(this.facet),n=i.filter((function(t){return t}));if(i===this.input){var r=!0,o=!1,s=void 0;try{for(var a,l=this.tooltipViews[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){var h=a.value;h.update&&h.update(t)}}catch(x){o=!0,s=x}finally{try{r||null==l.return||l.return()}finally{if(o)throw s}}return!1}for(var u=[],c=0;c<n.length;c++){var f=n[c],d=-1;if(f){for(var v=0;v<this.tooltips.length;v++){var g=this.tooltips[v];g&&g.create==f.create&&(d=v)}if(d<0)u[c]=this.createTooltipView(f);else{var p=u[c]=this.tooltipViews[d];p.update&&p.update(t)}}}var m=!0,y=!1,w=void 0;try{for(var b,k=this.tooltipViews[Symbol.iterator]();!(m=(b=k.next()).done);m=!0){var S=b.value;u.indexOf(S)<0&&(S.dom.remove(),null===(e=S.destroy)||void 0===e||e.call(S))}}catch(x){y=!0,w=x}finally{try{m||null==k.return||k.return()}finally{if(y)throw w}}return this.input=i,this.tooltips=n,this.tooltipViews=u,!0}}]),t}();function qn(t){var e=t.win;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}var Gn=n.r$.define({combine:function(t){var e,i,n;return{position:et.ios?"absolute":(null===(e=t.find((function(t){return t.position})))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find((function(t){return t.parent})))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(n=t.find((function(t){return t.tooltipSpace})))||void 0===n?void 0:n.tooltipSpace)||qn}}}),$n=new WeakMap,_n=$t.fromClass(function(){function t(e){var i=this;l(this,t),this.view=e,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;var n=e.state.facet(Gn);this.position=n.position,this.parent=n.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new Kn(e,Yn,(function(t){return i.createTooltip(t)})),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((function(t){Date.now()>i.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&i.measureSoon()}),{threshold:[1]}
1):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}return u(t,[{key:"createContainer",value:function(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}},{key:"observeIntersection",value:function(){if(this.intersectionObserver){this.intersectionObserver.disconnect();var t=!0,e=!1,i=void 0;try{for(var n,r=this.manager.tooltipViews[Symbol.iterator]();!(t=(n=r.next()).done);t=!0){var o=n.value;this.intersectionObserver.observe(o.dom)}}catch(s){e=!0,i=s}finally{try{t||null==r.return||r.return()}finally{if(e)throw i}}}}},{key:"measureSoon",value:function(){var t=this;this.measureTimeout<0&&(this.measureTimeout=setTimeout((function(){t.measureTimeout=-1,t.maybeMeasure()}),50))}},{key:"update",value:function(t){t.transactions.length&&(this.lastTransaction=Date.now());var e=this.manager.update(t);e&&this.observeIntersection();var i=e||t.geometryChanged,n=t.state.facet(Gn);if(n.position!=this.position){this.position=n.position;var r=!0,o=!1,s=void 0;try{for(var a,l=this.manager.tooltipViews[Symbol.iterator]();!(r=(a=l.next()).done);r=!0){a.value.dom.style.position=this.position}}catch(g){o=!0,s=g}finally{try{r||null==l.return||l.return()}finally{if(o)throw s}}i=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();var h=!0,u=!1,c=void 0;try{for(var f,d=this.manager.tooltipViews[Symbol.iterator]();!(h=(f=d.next()).done);h=!0){var v=f.value;this.container.appendChild(v.dom)}}catch(g){u=!0,c=g}finally{try{h||null==d.return||d.return()}finally{if(u)throw c}}i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}},{key:"createTooltip",value:function(t){var e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){var i=document.createElement("div");i.className="cm-tooltip-arrow",e.dom.appendChild(i)}return e.dom.style.position=this.position,e.dom.style.top=jn,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}},{key:"destroy",value:function(){var t,e;this.view.win.removeEventListener("resize",this.measureSoon);var i=!0,n=!1,r=void 0;try{for(var o,s=this.manager.tooltipViews[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){var a=o.value;a.dom.remove(),null===(t=a.destroy)||void 0===t||t.call(a)}}catch(l){n=!0,r=l}finally{try{i||null==s.return||s.return()}finally{if(n)throw r}}null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}},{key:"readMeasure",value:function(){var t=this,e=this.view.dom.getBoundingClientRect();return{editor:e,parent:this.parent?this.container.getBoundingClientRect():e,pos:this.manager.tooltips.map((function(e,i){var n=t.manager.tooltipViews[i];return n.getCoords?n.getCoords(e.pos):t.view.coordsAtPos(e.pos)})),size:this.manager.tooltipViews.map((function(t){return t.dom.getBoundingClientRect()})),space:this.view.state.facet(Gn).tooltipSpace(this.view)}}},{key:"writeMeasure",value:function(t){for(var e,i=t.editor,n=t.space,r=[],o=0;o<this.manager.tooltips.length;o++){var s=this.manager.tooltips[o],a=this.manager.tooltipViews[o],l=a.dom,h=t.pos[o],u=t.size[o];if(!h||h.bottom<=Math.max(i.top,n.top)||h.top>=Math.min(i.bottom,n.bottom)||h.right<Math.max(i.left,n.left)-.1||h.left>Math.min(i.right,n.right)+.1)l.style.top=jn;else{var c=s.arrow?a.dom.querySelector(".cm-tooltip-arrow"):null,f=c?7:0,d=u.right-u.left,v=null!==(e=$n.get(a))&&void 0!==e?e:u.bottom-u.top,g=a.offset||Un,p=this.view.textDirection==ie.LTR,m=u.width>n.right-n.left?p?n.left:n.right-u.width:p?Math.min(h.left-(c?14:0)+g.x,n.right-d):Math.max(n.left,h.left-d+(c?14:0)-g.x),y=!!s.above;!s.strictSide&&(y?h.top-(u.bottom-u.top)-g.y<n.top:h.bottom+(u.bottom-u.top)+g.y>n.bottom)&&y==n.bottom-h.bottom>h.top-n.top&&(y=!y);var w=(y?h.top-n.top:n.bottom-h.bottom)-f;if(w<v&&!1!==a.resize){if(w<this.view.defaultLineHeight){l.style.top=jn;continue}$n.set(a,v),l.style.height=(v=w)+"px"}else l.style.height&&(l.style.height="");var b=y?h.top-v-f-g.y:h.bottom+f+g.y,k=m+d;if(!0!==a.overlap){var S=!0,x=!1,M=void 0;try{for(var A,D=r[Symbol.iterator]();!(S=(A=D.next()).done);S=!0){var C=A.value;C.left<k&&C.right>m&&C.top<b+v&&C.bottom>b&&(b=y?C.top-v-2-f:C.bottom+f+2)}}catch(O){x=!0,M=O}finally{try{S||null==D.return||D.return()}finally{if(x)throw M}}}"absolute"==this.position?(l.style.top=b-t.parent.top+"px",l.style.left=m-t.parent.left+"px"):(l.style.top=b+"px",l.
1style.left=m+"px"),c&&(c.style.left="".concat(h.left+(p?g.x:-g.x)-(m+14-7),"px")),!0!==a.overlap&&r.push({left:m,top:b,right:k,bottom:b+v}),l.classList.toggle("cm-tooltip-above",y),l.classList.toggle("cm-tooltip-below",!y),a.positioned&&a.positioned(t.space)}}}},{key:"maybeMeasure",value:function(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView)){this.inView=this.view.inView;var t=!0,e=!1,i=void 0;if(!this.inView)try{for(var n,r=this.manager.tooltipViews[Symbol.iterator]();!(t=(n=r.next()).done);t=!0){n.value.dom.style.top=jn}}catch(o){e=!0,i=o}finally{try{t||null==r.return||r.return()}finally{if(e)throw i}}}}}]),t}(),{eventHandlers:{scroll:function(){this.maybeMeasure()}}}),Xn=un.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"".concat(7,"px"),width:"".concat(14,"px"),position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"".concat(7,"px solid transparent"),borderRight:"".concat(7,"px solid transparent")},".cm-tooltip-above &":{bottom:"-".concat(7,"px"),"&:before":{borderTop:"".concat(7,"px solid #bbb")},"&:after":{borderTop:"".concat(7,"px solid #f5f5f5"),bottom:"1px"}},".cm-tooltip-below &":{top:"-".concat(7,"px"),"&:before":{borderBottom:"".concat(7,"px solid #bbb")},"&:after":{borderBottom:"".concat(7,"px solid #f5f5f5"),top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Un={x:0,y:0},Yn=n.r$.define({enables:[_n,Xn]});function Jn(t,e){var i=t.plugin(_n);if(!i)return null;var n=i.manager.tooltips.indexOf(e);return n<0?null:i.manager.tooltipViews[n]}var Zn=function(t){d(i,t);var e=y(i);function i(){return l(this,i),e.apply(this,arguments)}return u(i,[{key:"compare",value:function(t){return this==t||this.constructor==t.constructor&&this.eq(t)}},{key:"eq",value:function(t){return!1}},{key:"destroy",value:function(t){}}]),i}(n.uU);Zn.prototype.elementClass="",Zn.prototype.toDOM=void 0,Zn.prototype.mapMode=n.gc.TrackBefore,Zn.prototype.startSide=Zn.prototype.endSide=-1,Zn.prototype.point=!0;var Qn=n.r$.define(),tr=n.r$.define();var er=n.r$.define({combine:function(t){return t.some((function(t){return t}))}});function ir(t){var e=[nr];return t&&!1===t.fixed&&e.push(er.of(!0)),e}var nr=$t.fromClass(function(){function t(e){l(this,t),this.view=e,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=e.state.facet(tr).map((function(t){return new ar(e,t)}));var i=!0,n=!1,r=void 0;try{for(var o,s=this.gutters[Symbol.iterator]();!(i=(o=s.next()).done);i=!0){var a=o.value;this.dom.appendChild(a.dom)}}catch(h){n=!0,r=h}finally{try{i||null==s.return||s.return()}finally{if(n)throw r}}this.fixed=!e.state.facet(er),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}return u(t,[{key:"update",value:function(t){if(this.updateGutters(t)){var e=this.prevViewport,i=t.view.viewport,n=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(n<.8*(i.to-i.from))}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(er)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}},{key:"syncGutters",value:function(t){var e=this,i=this.dom.nextSibling;t&&this.dom.remove();var r=n.Xs.iter(this.view.state.facet(Qn),this.view.viewport.from),o=[],s=this.gutters.map((function(t){return new sr(t,e.view.viewport,-e.view.documentPadding.top)})),a=!0,l=!1,h=void 0;try{for(var u,c=this.view.viewportLineBlocks[Symbol.iterator]();!(a=(u=c.next()).done);a=!0){var f=u.value;if(o.length&&(o=[]),Array.isArray(f.type)){var d=!0,v=!0,g=!1,p=void 0;try{for(var m,y=f.type[Symbol.iterator]();!(v=(m=y.next()).done);v=!0){var w=m.value;if(w.type==wt.Text&&d){or(r,o,w.from);var b=!0,k=!1,S=void 0;try{for(var x,M=s[Symbol.iterator]();!(b=(x=M.next()).done);b=!0){x.value.line(this.view,w,o)}}catch(F){k=!0,S=F}finally{try{b||null==M.return||M.return()}finally{if(k)throw S}}d=!1}else if(w.widget){var A=!0,D=!1,C=void 0;try{for(var O,T=s[Symbol.iterator]();!(A=(O=T.next()).done);A=!0){O.value.widget(this.view,w)}}catch(F){D=!0,C=F}finally{try{A||null==T.return||T.return()}finally{if(D)throw C}}}}}catch(F){g=!0,p=F}finally{try{v||null==y.return||y.return()}finally{if(g)throw p}
1}}else if(f.type==wt.Text){or(r,o,f.from);var E=!0,R=!1,B=void 0;try{for(var L,H=s[Symbol.iterator]();!(E=(L=H.next()).done);E=!0){L.value.line(this.view,f,o)}}catch(F){R=!0,B=F}finally{try{E||null==H.return||H.return()}finally{if(R)throw B}}}}}catch(F){l=!0,h=F}finally{try{a||null==c.return||c.return()}finally{if(l)throw h}}var V=!0,P=!1,N=void 0;try{for(var W,z=s[Symbol.iterator]();!(V=(W=z.next()).done);V=!0){W.value.finish()}}catch(F){P=!0,N=F}finally{try{V||null==z.return||z.return()}finally{if(P)throw N}}t&&this.view.scrollDOM.insertBefore(this.dom,i)}},{key:"updateGutters",value:function(t){var e=t.startState.facet(tr),i=t.state.facet(tr),r=t.docChanged||t.heightChanged||t.viewportChanged||!n.Xs.eq(t.startState.facet(Qn),t.state.facet(Qn),t.view.viewport.from,t.view.viewport.to);if(e==i){var o=!0,s=!1,a=void 0;try{for(var l,h=this.gutters[Symbol.iterator]();!(o=(l=h.next()).done);o=!0){l.value.update(t)&&(r=!0)}}catch(E){s=!0,a=E}finally{try{o||null==h.return||h.return()}finally{if(s)throw a}}}else{r=!0;var u=[],c=!0,f=!1,d=void 0;try{for(var v,g=i[Symbol.iterator]();!(c=(v=g.next()).done);c=!0){var p=v.value,m=e.indexOf(p);m<0?u.push(new ar(this.view,p)):(this.gutters[m].update(t),u.push(this.gutters[m]))}}catch(E){f=!0,d=E}finally{try{c||null==g.return||g.return()}finally{if(f)throw d}}var y=!0,w=!1,b=void 0;try{for(var k,S=this.gutters[Symbol.iterator]();!(y=(k=S.next()).done);y=!0){var x=k.value;x.dom.remove(),u.indexOf(x)<0&&x.destroy()}}catch(E){w=!0,b=E}finally{try{y||null==S.return||S.return()}finally{if(w)throw b}}var M=!0,A=!1,D=void 0;try{for(var C,O=u[Symbol.iterator]();!(M=(C=O.next()).done);M=!0){var T=C.value;this.dom.appendChild(T.dom)}}catch(E){A=!0,D=E}finally{try{M||null==O.return||O.return()}finally{if(A)throw D}}this.gutters=u}return r}},{key:"destroy",value:function(){var t=!0,e=!1,i=void 0;try{for(var n,r=this.gutters[Symbol.iterator]();!(t=(n=r.next()).done);t=!0){n.value.destroy()}}catch(o){e=!0,i=o}finally{try{t||null==r.return||r.return()}finally{if(e)throw i}}this.dom.remove()}}]),t}(),{provide:function(t){return un.scrollMargins.of((function(e){var i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==ie.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))}});function rr(t){return Array.isArray(t)?t:[t]}function or(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}var sr=function(){function t(e,i,r){l(this,t),this.gutter=e,this.height=r,this.i=0,this.cursor=n.Xs.iter(e.markers,i.from)}return u(t,[{key:"addElement",value:function(t,e,i){var n=this.gutter,r=e.top-this.height;if(this.i==n.elements.length){var o=new lr(t,e.height,r,i);n.elements.push(o),n.dom.appendChild(o.dom)}else n.elements[this.i].update(t,e.height,r,i);this.height=e.bottom,this.i++}},{key:"line",value:function(t,e,i){var n=[];or(this.cursor,n,e.from),i.length&&(n=n.concat(i));var r=this.gutter.config.lineMarker(t,e,n);r&&n.unshift(r);var o=this.gutter;(0!=n.length||o.config.renderEmptyElements)&&this.addElement(t,e,n)}},{key:"widget",value:function(t,e){var i=this.gutter.config.widgetMarker(t,e.widget,e);i&&this.addElement(t,e,[i])}},{key:"finish",value:function(){for(var t=this.gutter;t.elements.length>this.i;){var e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}]),t}(),ar=function(){function t(e,i){var n=this,r=function(t){n.dom.addEventListener(t,(function(n){var r,s=n.target;if(s!=o.dom&&o.dom.contains(s)){for(;s.parentNode!=o.dom;)s=s.parentNode;var a=s.getBoundingClientRect();r=(a.top+a.bottom)/2}else r=n.clientY;var l=e.lineBlockAtHeight(r-e.documentTop);i.domEventHandlers[t](e,l,n)&&n.preventDefault()}))},o=this;for(var s in l(this,t),this.view=e,this.config=i,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:""),i.domEventHandlers)r(s);this.markers=rr(i.markers(e)),i.initialSpacer&&(this.spacer=new lr(e,0,0,[i.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}return u(t,[{key:"update",value:function(t){var e=this.markers;if(this.markers=rr(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){var i=this.config.updateSpacer(this.spacer.markers[0],t);i!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[i])}var r=t.view.viewport;
1return!n.Xs.eq(this.markers,e,r.from,r.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t)}},{key:"destroy",value:function(){var t=!0,e=!1,i=void 0;try{for(var n,r=this.elements[Symbol.iterator]();!(t=(n=r.next()).done);t=!0){n.value.destroy()}}catch(o){e=!0,i=o}finally{try{t||null==r.return||r.return()}finally{if(e)throw i}}}}]),t}(),lr=function(){function t(e,i,n,r){l(this,t),this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,i,n,r)}return u(t,[{key:"update",value:function(t,e,i,n){this.height!=e&&(this.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),function(t,e){if(t.length!=e.length)return!1;for(var i=0;i<t.length;i++)if(!t[i].compare(e[i]))return!1;return!0}(this.markers,n)||this.setMarkers(t,n)}},{key:"setMarkers",value:function(t,e){for(var i="cm-gutterElement",n=this.dom.firstChild,r=0,o=0;;){var s=o,a=r<e.length?e[r++]:null,l=!1;if(a){var h=a.elementClass;h&&(i+=" "+h);for(var u=o;u<this.markers.length;u++)if(this.markers[u].compare(a)){s=u,l=!0;break}}else s=this.markers.length;for(;o<s;){var c=this.markers[o++];if(c.toDOM){c.destroy(n);var f=n.nextSibling;n.remove(),n=f}}if(!a)break;a.toDOM&&(l?n=n.nextSibling:this.dom.insertBefore(a.toDOM(t),n)),l&&o++}this.dom.className=i,this.markers=e}},{key:"destroy",value:function(){this.setMarkers(null,[])}}]),t}();var hr=n.r$.define(),ur=n.r$.define({combine:function(t){return(0,n.BO)(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers:function(t,e){var i=function(t){var i=n[t],r=e[t];n[t]=i?function(t,e,n){return i(t,e,n)||r(t,e,n)}:r},n=Object.assign({},t);for(var r in e)i(r);return n}})}}),cr=function(t){d(i,t);var e=y(i);function i(t){var n;return l(this,i),(n=e.call(this)).number=t,n}return u(i,[{key:"eq",value:function(t){return this.number==t.number}},{key:"toDOM",value:function(){return document.createTextNode(this.number)}}]),i}(Zn);function fr(t,e){return t.state.facet(ur).formatNumber(e,t.state)}var dr=tr.compute([ur],(function(t){return{class:"cm-lineNumbers",renderEmptyElements:!1,markers:function(t){return t.state.facet(hr)},lineMarker:function(t,e,i){return i.some((function(t){return t.toDOM}))?null:new cr(fr(t,t.state.doc.lineAt(e.from).number))},widgetMarker:function(){return null},lineMarkerChange:function(t){return t.startState.facet(ur)!=t.state.facet(ur)},initialSpacer:function(t){return new cr(fr(t,gr(t.state.doc.lines)))},updateSpacer:function(t,e){var i=fr(e.view,gr(e.view.state.doc.lines));return i==t.number?t:new cr(i)},domEventHandlers:t.facet(ur).domEventHandlers}}));function vr(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[ur.of(t),ir(),dr]}function gr(t){for(var e=9;e<t;)e=10*e+9;return e}}}]);
2//# sourceMappingURL=64372fe3-2eb8e401b1e81eed.js.map

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.