!function(){function t(t,e,n){return(e=g(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function e(t){return function(t){if(Array.isArray(t))return d(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||f(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 n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=f(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function r(t,e,i){return e=l(e),function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return o(t)}(t,a()?Reflect.construct(e,i||[],l(t).constructor):e.apply(t,i))}function o(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function a(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(a=function(){return!!t})()}function s(){return s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var i=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}(t,e);if(i){var r=Object.getOwnPropertyDescriptor(i,e);return r.get?r.get.call(arguments.length<3?t:n):r.value}},s.apply(this,arguments)}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function u(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}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}function c(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,r,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=o.call(n)).done)&&(s.push(i.value),s.length!==e);l=!0);}catch(t){u=!0,r=t}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return s}}(t,e)||f(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){if(t){if("string"==typeof t)return d(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(t,e):void 0}}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n.ant-tabs-nav{margin-left:0;margin-bottom:0}[data-v-215c20bb] .card-container .ant-tabs-card>.ant-tabs-nav .ant-tabs-tab{background-color:#f5f5f5;margin:0;border-radius:0;transition:none}[data-v-215c20bb] .card-container .ant-tabs-card>.ant-tabs-nav .ant-tabs-tab-active{background-color:#fff;border-bottom:none}[data-v-215c20bb] .card-container2{flex-grow:3;padding:0 24px 0 0;background-color:#f5f5f5;border:1px solid #eee;display:flex;flex-direction:column;border-top:none}[data-v-215c20bb] .card-container2 .ant-tabs,[data-v-215c20bb] .card-container2 .ant-tabs-content{height:100%}[data-v-215c20bb] .card-container2 .ant-tabs-content-holder{background-color:#fff}[data-v-215c20bb] .card-container2 .ant-tabs>.ant-tabs-nav{margin-left:24px;margin-bottom:0}[data-v-215c20bb] .card-container2 .ant-tabs-card>.ant-tabs-nav .ant-tabs-tab{background-color:#f5f5f5;margin:0;border-radius:0;transition:none}[data-v-215c20bb] .card-container2 .ant-tabs-card>.ant-tabs-nav .ant-tabs-tab-active{background-color:#fff;border-bottom:none}\n",document.head.appendChild(h);var B={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z"}}]},name:"play-circle",theme:"outlined"};function I(t){for(var e=1;ethis.length)throw new RangeError("Invalid position ".concat(t," in document of length ").concat(this.length));return this.lineInner(t,!1,1,0)}},{key:"line",value:function(t){if(t<1||t>this.lines)throw new RangeError("Invalid line number ".concat(t," in ").concat(this.lines,"-line document"));return this.lineInner(t,!0,1,0)}},{key:"replace",value:function(t,e,n){var i=c(vt(this,t,e),2);t=i[0],e=i[1];var r=[];return this.decompose(0,t,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(e,this.length,r,1),ut.from(r,this.length-(e-t)+n.length)}},{key:"append",value:function(t){return this.replace(this.length,this.length,t)}},{key:"slice",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=c(vt(this,t,e),2);t=n[0],e=n[1];var i=[];return this.decompose(t,e,i,0),ut.from(i,e-t)}},{key:"eq",value:function(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;for(var e=this.scanIdentical(t,1),n=this.length-this.scanIdentical(t,-1),i=new ft(this),r=new ft(t),o=e,a=e;;){if(i.next(o),r.next(o),o=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(a+=i.value.length,i.done||a>=n)return!0}}},{key:"iter",value:function(){return new ft(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)}},{key:"iterRange",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return new dt(this,t,e)}},{key:"iterLines",value:function(t,e){var n;if(null==t)n=this.iter();else{null==e&&(e=this.lines+1);var i=this.line(t).from;n=this.iterRange(i,Math.max(i,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new Ot(n)}},{key:"toString",value:function(){return this.sliceString(0)}},{key:"toJSON",value:function(){var t=[];return this.flatten(t),t}}],[{key:"of",value:function(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new lt(e):ut.from(lt.split(e,[])):t.empty}}]),t}(),lt=function(t){function e(t){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){var e,n=-1,r=i(t);try{for(r.s();!(e=r.n()).done;){n+=e.value.length+1}}catch(o){r.e(o)}finally{r.f()}return n}(t);return O(this,e),(n=r(this,e)).text=t,n.length=o,n}return u(e,t),v(e,[{key:"lines",get:function(){return this.text.length}},{key:"children",get:function(){return null}},{key:"lineInner",value:function(t,e,n,i){for(var r=0;;r++){var o=this.text[r],a=i+o.length;if((e?n:a)>=t)return new pt(i,a,n,o);i=a+1,n++}}},{key:"decompose",value:function(t,n,i,r){var o=t<=0&&n>=this.length?this:new e(ct(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(1&r){var a=i.pop(),s=ht(o.text,a.text.slice(),0,o.length);if(s.length<=32)i.push(new e(s,a.length+o.length));else{var l=s.length>>1;i.push(new e(s.slice(0,l)),new e(s.slice(l)))}}else i.push(o)}},{key:"replace",value:function(t,n,i){if(!(i instanceof e))return s(l(e.prototype),"replace",this).call(this,t,n,i);var r=c(vt(this,t,n),2);t=r[0],n=r[1];var o=ht(this.text,ht(i.text,ct(this.text,0,t)),n),a=this.length+i.length-(n-t);return o.length<=32?new e(o,a):ut.from(e.split(o,[]),a)}},{key:"sliceString",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",i=c(vt(this,t,e),2);t=i[0],e=i[1];for(var r="",o=0,a=0;o<=e&&at&&a&&(r+=n),to&&(r+=s.slice(Math.max(0,t-o),e-o)),o=l+1}return r}},{key:"flatten",value:function(t){var e,n=i(this.text);try{for(n.s();!(e=n.n()).done;){var r=e.value;t.push(r)}}catch(o){n.e(o)}finally{n.f()}}},{key:"scanIdentical",value:function(){return 0}}],[{key:"split",value:function(t,n){var r,o=[],a=-1,s=i(t);try{for(s.s();!(r=s.n()).done;){var l=r.value;o.push(l),a+=l.length+1,32==o.length&&(n.push(new e(o,a)),o=[],a=-1)}}catch(u){s.e(u)}finally{s.f()}return a>-1&&n.push(new e(o,a)),n}}]),e}(st),ut=function(t){function e(t,n){var o;O(this,e),(o=r(this,e)).children=t,o.length=n,o.lines=0;var a,s=i(t);try{for(s.s();!(a=s.n()).done;){var l=a.value;o.lines+=l.lines}}catch(u){s.e(u)}finally{s.f()}return o}return u(e,t),v(e,[{key:"lineInner",value:function(t,e,n,i){for(var r=0;;r++){var o=this.children[r],a=i+o.length,s=n+o.lines-1;if((e?s:a)>=t)return o.lineInner(t,e,n,i);i=a+1,n=s+1}}},{key:"decompose",value:function(t,e,n,i){for(var r=0,o=0;o<=e&&r=o){var l=i&((o<=t?1:0)|(s>=e?2:0));o>=t&&s<=e&&!l?n.push(a):a.decompose(t-o,e-o,n,l)}o=s+1}}},{key:"replace",value:function(t,n,i){var r=c(vt(this,t,n),2);if(t=r[0],n=r[1],i.lines=a&&n<=h){var f=u.replace(t-a,n-a,i),d=this.lines-u.lines+f.lines;if(f.lines>4&&f.lines>d>>6){var O=this.children.slice();return O[o]=f,new e(O,this.length-(n-t)+i.length)}return s(l(e.prototype),"replace",this).call(this,a,h,f)}a=h+1}return s(l(e.prototype),"replace",this).call(this,t,n,i)}},{key:"sliceString",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",i=c(vt(this,t,e),2);t=i[0],e=i[1];for(var r="",o=0,a=0;ot&&o&&(r+=n),ta&&(r+=s.sliceString(t-a,e-a,n)),a=l+1}return r}},{key:"flatten",value:function(t){var e,n=i(this.children);try{for(n.s();!(e=n.n()).done;){e.value.flatten(t)}}catch(r){n.e(r)}finally{n.f()}}},{key:"scanIdentical",value:function(t,n){if(!(t instanceof e))return 0;for(var i=0,r=c(n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1],4),o=r[0],a=r[1],s=r[2],l=r[3];;o+=n,a+=n){if(o==s||a==l)return i;var u=this.children[o],h=t.children[a];if(u!=h)return i+u.scanIdentical(h,n);i+=u.length+1}}}],[{key:"from",value:function(t){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.reduce((function(t,e){return t+e.length+1}),-1),o=0,a=i(t);try{for(a.s();!(n=a.n()).done;){o+=n.value.lines}}catch(b){a.e(b)}finally{a.f()}if(o<32){var s,l=[],u=i(t);try{for(u.s();!(s=u.n()).done;){s.value.flatten(l)}}catch(b){u.e(b)}finally{u.f()}return new lt(l,r)}var h=Math.max(32,o>>5),c=h<<1,f=h>>1,d=[],O=0,p=-1,v=[];function g(t){var n;if(t.lines>c&&t instanceof e){var r,o=i(t.children);try{for(o.s();!(r=o.n()).done;){g(r.value)}}catch(b){o.e(b)}finally{o.f()}}else t.lines>f&&(O>f||!O)?(m(),d.push(t)):t instanceof lt&&O&&(n=v[v.length-1])instanceof lt&&t.lines+n.lines<=32?(O+=t.lines,p+=t.length+1,v[v.length-1]=new lt(n.text.concat(t.text),n.length+1+t.length)):(O+t.lines>h&&m(),O+=t.lines,p+=t.length+1,v.push(t))}function m(){0!=O&&(d.push(1==v.length?v[0]:e.from(v,p)),p=-1,O=v.length=0)}var y,k=i(t);try{for(k.s();!(y=k.n()).done;){g(y.value)}}catch(b){k.e(b)}finally{k.f()}return m(),1==d.length?d[0]:new e(d,r)}}]),e}(st);function ht(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e9,r=0,o=0,a=!0;o=n&&(l>i&&(s=s.slice(0,i-r)),r1&&void 0!==arguments[1]?arguments[1]:1;O(this,t),this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof lt?e.text.length:e.children.length)<<1]}return v(t,[{key:"nextInner",value:function(t,e){for(this.done=this.lineBreak=!1;;){var n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],o=r>>1,a=i instanceof lt?i.text.length:i.children.length;if(o==(e>0?a:0)){if(0==n)return this.done=!0,this.value="",this;e>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(e>0?0:1)){if(this.offsets[n]+=e,0==t)return this.lineBreak=!0,this.value="\n",this;t--}else if(i instanceof lt){var s=i.text[o+(e<0?-1:0)];if(this.offsets[n]+=e,s.length>Math.max(0,t))return this.value=0==t?s:e>0?s.slice(t):s.slice(0,s.length-t),this;t-=s.length}else{var l=i.children[o+(e<0?-1:0)];t>l.length?(t-=l.length,this.offsets[n]+=e):(e<0&&this.offsets[n]--,this.nodes.push(l),this.offsets.push(e>0?1:(l instanceof lt?l.text.length:l.children.length)<<1))}}}},{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}]),t}(),dt=function(){function t(e,n,i){O(this,t),this.value="",this.done=!1,this.cursor=new ft(e,n>i?-1:1),this.pos=n>i?e.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}return v(t,[{key:"nextInner",value:function(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);var n=e<0?this.pos-this.from:this.to-this.pos;t>n&&(t=n),n-=t;var i=this.cursor.next(t).value;return this.pos+=(i.length+t)*e,this.value=i.length<=n?i:e<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}},{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}},{key:"lineBreak",get:function(){return this.cursor.lineBreak&&""!=this.value}}]),t}(),Ot=function(){function t(e){O(this,t),this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}return v(t,[{key:"next",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=this.inner.next(t),n=e.done,i=e.lineBreak,r=e.value;return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}},{key:"lineBreak",get:function(){return!1}}]),t}();"undefined"!=typeof Symbol&&(st.prototype[Symbol.iterator]=function(){return this.iter()},ft.prototype[Symbol.iterator]=dt.prototype[Symbol.iterator]=Ot.prototype[Symbol.iterator]=function(){return this});var pt=function(){function t(e,n,i,r){O(this,t),this.from=e,this.to=n,this.number=i,this.text=r}return v(t,[{key:"length",get:function(){return this.to-this.from}}]),t}();function vt(t,e,n){return[e=Math.max(0,Math.min(t.length,e)),Math.max(e,Math.min(t.length,n))]}for(var gt="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((function(t){return t?parseInt(t,36):1})),mt=1;mtt)return gt[e-1]<=t;return!1}function kt(t){return t>=127462&&t<=127487}var bt=8205;function wt(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?Qt:xt)(t,e,!(arguments.length>3&&void 0!==arguments[3])||arguments[3])}function Qt(t,e,n){if(e==t.length)return e;e&&St(t.charCodeAt(e))&&Pt(t.charCodeAt(e-1))&&e--;var i=$t(t,e);for(e+=Rt(i);e=0&&kt($t(t,a));)o++,a-=2;if(o%2==0)break;e+=2}}return e}function xt(t,e,n){for(;e>0;){var i=Qt(t,e-2,n);if(i=56320&&t<57344}function Pt(t){return t>=55296&&t<56320}function $t(t,e){var n=t.charCodeAt(e);if(!Pt(n)||e+1==t.length)return n;var i=t.charCodeAt(e+1);return St(i)?i-56320+(n-55296<<10)+65536:n}function Zt(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function Rt(t){return t<65536?1:2}var Tt=/\r\n?|\n/,At=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(At||(At={})),Ct=function(){function t(e){O(this,t),this.sections=e}return v(t,[{key:"length",get:function(){for(var t=0,e=0;e1&&void 0!==arguments[1]&&arguments[1])}},{key:"invertedDesc",get:function(){for(var e=[],n=0;n1&&void 0!==arguments[1]&&arguments[1];return t.empty?this:qt(this,t,e)}},{key:"mapPos",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:At.Simple,i=0,r=0,o=0;ot)return r+(t-i);r+=a}else{if(n!=At.Simple&&l>=t&&(n==At.TrackDel&&it||n==At.TrackBefore&&it))return null;if(l>t||l==t&&e<0&&!a)return t==i||e<0?r:r+s;r+=s}i=l}if(t>i)throw new RangeError("Position ".concat(t," is out of range for changeset of length ").concat(i));return r}},{key:"touchesRange",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,n=0,i=0;n=0&&i<=e&&r>=t)return!(ie)||"cover";i=r}return!1}},{key:"toString",value:function(){for(var t="",e=0;e=0?":"+i:"")}return t}},{key:"toJSON",value:function(){return this.sections}}],[{key:"fromJSON",value:function(e){if(!Array.isArray(e)||e.length%2||e.some((function(t){return"number"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(e)}},{key:"create",value:function(e){return new t(e)}}]),t}(),Mt=function(t){function e(t,n){var i;return O(this,e),(i=r(this,e,[t])).inserted=n,i}return u(e,t),v(e,[{key:"apply",value:function(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return Yt(this,(function(e,n,i,r,o){return t=t.replace(i,i+(n-e),o)}),!1),t}},{key:"mapDesc",value:function(t){return qt(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"invert",value:function(t){for(var n=this.sections.slice(),i=[],r=0,o=0;r=0){n[r]=s,n[r+1]=a;for(var l=r>>1;i.length1&&void 0!==arguments[1]&&arguments[1];return t.empty?this:qt(this,t,e,!0)}},{key:"iterChanges",value:function(t){Yt(this,t,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"desc",get:function(){return Ct.create(this.sections)}},{key:"filter",value:function(t){var n=[],i=[],r=[],o=new zt(this);t:for(var a=0,s=0;;){for(var l=a==t.length?1e9:t[a++];s0&&Xt(i,n,o.text),o.forward(u),s+=u}for(var c=t[a++];s>1].toJSON()))}return t}}],[{key:"of",value:function(t,n,r){var o=[],a=[],s=0,l=null;function u(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||o.length){sp||d<0||p>n)throw new RangeError("Invalid change range ".concat(d," to ").concat(p," (in doc of length ").concat(n,")"));var g=v?"string"==typeof v?st.of(v.split(r||Tt)):v:st.empty,m=g.length;if(d==p&&0==m)return;ds&&Wt(o,d-s,-1),Wt(o,p-d,m),Xt(a,o,g),s=p}}(t),u(!l),l}},{key:"empty",value:function(t){return new e(t?[t,-1]:[],[])}},{key:"fromJSON",value:function(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");for(var n=[],i=[],r=0;r3&&void 0!==arguments[3]&&arguments[3];if(!(0==e&&n<=0)){var r=t.length-2;r>=0&&n<=0&&n==t[r+1]?t[r]+=e:0==e&&0==t[r]?t[r+1]+=n:i?(t[r]+=e,t[r+1]+=n):t.push(e,n)}}function Xt(t,e,n){if(0!=n.length){var i=e.length-2>>1;if(i>1])),!(n||a==t.sections.length||t.sections[a+1]<0);)s=t.sections[a++],l=t.sections[a++];e(r,u,o,h,c),r=u,o=h}}}function qt(t,e,n){for(var i=[],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3]?[]:null,o=new zt(t),a=new zt(e),s=-1;;)if(-1==o.ins&&-1==a.ins){var l=Math.min(o.len,a.len);Wt(i,l,-1),o.forward(l),a.forward(l)}else if(a.ins>=0&&(o.ins<0||s==o.i||0==o.off&&(a.len=0&&s=0)){if(o.done&&a.done)return r?Mt.createSet(i,r):Ct.create(i);throw new Error("Mismatched change set lengths")}for(var c=0,f=o.len;f;)if(-1==a.ins){var d=Math.min(f,a.len);c+=d,f-=d,a.forward(d)}else{if(!(0==a.ins&&a.len2&&void 0!==arguments[2]&&arguments[2]?[]:null,r=new zt(t),o=new zt(e),a=!1;;){if(r.done&&o.done)return i?Mt.createSet(n,i):Ct.create(n);if(0==r.ins)Wt(n,r.len,0,a),r.next();else if(0!=o.len||o.done){if(r.done||o.done)throw new Error("Mismatched change set lengths");var s=Math.min(r.len2,o.len),l=n.length;if(-1==r.ins){var u=-1==o.ins?-1:o.off?0:o.ins;Wt(n,s,u,a),i&&u&&Xt(i,n,o.text)}else-1==o.ins?(Wt(n,r.off?0:r.len,s,a),i&&Xt(i,n,r.textBit(s))):(Wt(n,r.off?0:r.len,o.off?0:o.ins,a),i&&!o.off&&Xt(i,n,o.text));a=(r.ins>s||o.ins>=0&&o.len>s)&&(a||n.length>l),r.forward2(s),o.forward(s)}else Wt(n,0,o.ins,a),i&&Xt(i,n,o.text),o.next()}}var zt=function(){function t(e){O(this,t),this.set=e,this.i=0,this.next()}return v(t,[{key:"next",value:function(){var t=this.set.sections;this.i>1;return e>=t.length?st.empty:t[e]}},{key:"textBit",value:function(t){var e=this.set.inserted,n=this.i-2>>1;return n>=e.length&&!t?st.empty:e[n].slice(this.off,null==t?void 0:this.off+t)}},{key:"forward",value:function(t){t==this.len?this.next():(this.len-=t,this.off+=t)}},{key:"forward2",value:function(t){-1==this.ins?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}]),t}(),Dt=function(){function t(e,n,i){O(this,t),this.from=e,this.to=n,this.flags=i}return v(t,[{key:"anchor",get:function(){return 32&this.flags?this.to:this.from}},{key:"head",get:function(){return 32&this.flags?this.from:this.to}},{key:"empty",get:function(){return this.from==this.to}},{key:"assoc",get:function(){return 8&this.flags?-1:16&this.flags?1:0}},{key:"bidiLevel",get:function(){var t=7&this.flags;return 7==t?null:t}},{key:"goalColumn",get:function(){var t=this.flags>>6;return 16777215==t?void 0:t}},{key:"map",value:function(e){var n,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return this.empty?n=i=e.mapPos(this.from,r):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new t(n,i,this.flags)}},{key:"extend",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(t<=this.anchor&&e>=this.anchor)return Et.range(t,e);var n=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return Et.range(this.anchor,n)}},{key:"eq",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!(this.anchor!=t.anchor||this.head!=t.head||e&&this.empty&&this.assoc!=t.assoc)}},{key:"toJSON",value:function(){return{anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function(t){if(!t||"number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid JSON representation for SelectionRange");return Et.range(t.anchor,t.head)}},{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}(),Et=function(){function t(e,n){O(this,t),this.ranges=e,this.mainIndex=n}return v(t,[{key:"map",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return e.empty?this:t.create(this.ranges.map((function(t){return t.map(e,n)})),this.mainIndex)}},{key:"eq",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(var n=0;n1&&void 0!==arguments[1])||arguments[1];return t.create([e].concat(this.ranges),n?0:this.mainIndex+1)}},{key:"replaceRange",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.mainIndex,i=this.ranges.slice();return i[n]=e,t.create(i,this.mainIndex)}},{key:"toJSON",value:function(){return{ranges:this.ranges.map((function(t){return t.toJSON()})),main:this.mainIndex}}}],[{key:"fromJSON",value:function(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new t(e.ranges.map((function(t){return Dt.fromJSON(t)})),e.main)}},{key:"single",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return new t([t.range(e,n)],0)}},{key:"create",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0==e.length)throw new RangeError("A selection needs at least one range");for(var i=0,r=0;r1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;return Dt.create(t,t,(0==e?0:e<0?8:16)|(null==n?7:Math.min(6,n))|(null!=i?i:16777215)<<6)}},{key:"range",value:function(t,e,n,i){var r=(null!=n?n:16777215)<<6|(null==i?7:Math.min(6,i));return et?8:0)|r)}},{key:"normalized",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=e[n];e.sort((function(t,e){return t.from-e.from})),n=e.indexOf(i);for(var r=1;ro.head?t.range(l,s):t.range(s,l))}}return new t(e,n)}}]),t}();function _t(t,e){var n,r=i(t.ranges);try{for(r.s();!(n=r.n()).done;){if(n.value.to>e)throw new RangeError("Selection points outside of document")}}catch(o){r.e(o)}finally{r.f()}}var Vt=0,Ut=function(){function t(e,n,i,r,o){O(this,t),this.combine=e,this.compareInput=n,this.compare=i,this.isStatic=r,this.id=Vt++,this.default=e([]),this.extensions="function"==typeof o?o(this):o}return v(t,[{key:"reader",get:function(){return this}},{key:"of",value:function(t){return new Bt([],this,0,t)}},{key:"compute",value:function(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Bt(t,this,1,e)}},{key:"computeN",value:function(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Bt(t,this,2,e)}},{key:"from",value:function(t,e){return e||(e=function(t){return t}),this.compute([t],(function(n){return e(n.field(t))}))}}],[{key:"define",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new t(e.combine||function(t){return t},e.compareInput||function(t,e){return t===e},e.compare||(e.combine?function(t,e){return t===e}:Nt),!!e.static,e.enables)}}]),t}();function Nt(t,e){return t==e||t.length==e.length&&t.every((function(t,n){return t===e[n]}))}var Bt=function(){function t(e,n,i,r){O(this,t),this.dependencies=e,this.facet=n,this.type=i,this.value=r,this.id=Vt++}return v(t,[{key:"dynamicSlot",value:function(t){var e,n,r=this,o=this.value,a=this.facet.compareInput,s=this.id,l=t[s]>>1,u=2==this.type,h=!1,c=!1,f=[],d=i(this.dependencies);try{for(d.s();!(n=d.n()).done;){var O=n.value;"doc"==O?h=!0:"selection"==O?c=!0:0==(1&(null!==(e=t[O.id])&&void 0!==e?e:1))&&f.push(t[O.id])}}catch(p){d.e(p)}finally{d.f()}return{create:function(t){return t.values[l]=o(t),1},update:function(t,e){if(h&&e.docChanged||c&&(e.docChanged||e.selection)||Gt(t,f)){var n=o(t);if(u?!It(n,t.values[l],a):!a(n,t.values[l]))return t.values[l]=n,1}return 0},reconfigure:function(t,e){var n,i=e.config.address[s];if(null!=i){var h=le(e,i);if(r.dependencies.every((function(n){return n instanceof Ut?e.facet(n)===t.facet(n):!(n instanceof Ht)||e.field(n,!1)==t.field(n,!1)}))||(u?It(n=o(t),h,a):a(n=o(t),h)))return t.values[l]=h,0}else n=o(t);return t.values[l]=n,1}}}}]),t}();function It(t,e,n){if(t.length!=e.length)return!1;for(var i=0;i>1;return{create:function(t){return t.values[n]=e.create(t),1},update:function(t,i){var r=t.values[n],o=e.updateF(r,i);return e.compareF(r,o)?0:(t.values[n]=o,1)},reconfigure:function(t,i){return null!=i.config.address[e.id]?(t.values[n]=i.field(e),0):(t.values[n]=e.create(t),1)}}}},{key:"init",value:function(t){return[this,Lt.of({field:this,create:t})]}},{key:"extension",get:function(){return this}}],[{key:"define",value:function(e){var n=new t(Vt++,e.create,e.update,e.compare||function(t,e){return t===e},e);return e.provide&&(n.provides=e.provide(n)),n}}]),t}(),Ft=4,Jt=3,Kt=2,te=1;function ee(t){return function(e){return new ie(e,t)}}var ne={highest:ee(0),high:ee(te),default:ee(Kt),low:ee(Jt),lowest:ee(Ft)},ie=v((function t(e,n){O(this,t),this.inner=e,this.prec=n})),re=function(){function t(){O(this,t)}return v(t,[{key:"of",value:function(t){return new oe(this,t)}},{key:"reconfigure",value:function(e){return t.reconfigure.of({compartment:this,extension:e})}},{key:"get",value:function(t){return t.config.compartments.get(this)}}]),t}(),oe=v((function t(e,n){O(this,t),this.compartment=e,this.inner=n})),ae=function(){function t(e,n,i,r,o,a){for(O(this,t),this.base=e,this.compartments=n,this.dynamicSlots=i,this.address=r,this.staticValues=o,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}}],[{key:"resolve",value:function(e,n,r){var o,a=[],s=Object.create(null),l=new Map,u=i(function(t,e,n){var r=[[],[],[],[],[]],o=new Map;function a(t,s){var l=o.get(t);if(null!=l){if(l<=s)return;var u=r[l].indexOf(t);u>-1&&r[l].splice(u,1),t instanceof oe&&n.delete(t.compartment)}if(o.set(t,s),Array.isArray(t)){var h,c=i(t);try{for(c.s();!(h=c.n()).done;){a(h.value,s)}}catch(O){c.e(O)}finally{c.f()}}else if(t instanceof oe){if(n.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");var f=e.get(t.compartment)||t.inner;n.set(t.compartment,f),a(f,s)}else if(t instanceof ie)a(t.inner,t.prec);else if(t instanceof Ht)r[s].push(t),t.provides&&a(t.provides,s);else if(t instanceof Bt)r[s].push(t),t.facet.extensions&&a(t.facet.extensions,Kt);else{var d=t.extension;if(!d)throw new Error("Unrecognized extension value in extension set (".concat(t,"). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks."));a(d,s)}}return a(t,Kt),r.reduce((function(t,e){return t.concat(e)}))}(e,n,l));try{for(u.s();!(o=u.n()).done;){var h=o.value;h instanceof Ht?a.push(h):(s[h.facet.id]||(s[h.facet.id]=[])).push(h)}}catch(k){u.e(k)}finally{u.f()}for(var c=Object.create(null),f=[],d=[],O=function(){var t=v[p];c[t.id]=d.length<<1,d.push((function(e){return t.slot(e)}))},p=0,v=a;p>1;function l(t){for(var n=[],a=0;a>1,i=t.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;t.status[n]=4;var r=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|r}function le(t,e){return 1&e?t.config.staticValues[e>>1]:t.values[e>>1]}var ue=Ut.define(),he=Ut.define({combine:function(t){return t.some((function(t){return t}))},static:!0}),ce=Ut.define({combine:function(t){return t.length?t[0]:void 0},static:!0}),fe=Ut.define(),de=Ut.define(),Oe=Ut.define(),pe=Ut.define({combine:function(t){return!!t.length&&t[0]}}),ve=function(){function t(e,n){O(this,t),this.type=e,this.value=n}return v(t,null,[{key:"define",value:function(){return new ge}}]),t}(),ge=function(){function t(){O(this,t)}return v(t,[{key:"of",value:function(t){return new ve(this,t)}}]),t}(),me=function(){function t(e){O(this,t),this.map=e}return v(t,[{key:"of",value:function(t){return new ye(this,t)}}]),t}(),ye=function(){function t(e,n){O(this,t),this.type=e,this.value=n}return v(t,[{key:"map",value:function(e){var n=this.type.map(this.value,e);return void 0===n?void 0:n==this.value?this:new t(this.type,n)}},{key:"is",value:function(t){return this.type==t}}],[{key:"define",value:function(){return new me((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).map||function(t){return t})}},{key:"mapEffects",value:function(t,e){if(!t.length)return t;var n,r=[],o=i(t);try{for(o.s();!(n=o.n()).done;){var a=n.value.map(e);a&&r.push(a)}}catch(s){o.e(s)}finally{o.f()}return r}}]),t}();ye.reconfigure=ye.define(),ye.appendConfig=ye.define();var ke=function(){function t(e,n,i,r,o,a){O(this,t),this.startState=e,this.changes=n,this.selection=i,this.effects=r,this.annotations=o,this.scrollIntoView=a,this._doc=null,this._state=null,i&&_t(i,n.newLength),o.some((function(e){return e.type==t.time}))||(this.annotations=o.concat(t.time.of(Date.now())))}return v(t,[{key:"newDoc",get:function(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}},{key:"newSelection",get:function(){return this.selection||this.startState.selection.map(this.changes)}},{key:"state",get:function(){return this._state||this.startState.applyTransaction(this),this._state}},{key:"annotation",value:function(t){var e,n=i(this.annotations);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(r.type==t)return r.value}}catch(o){n.e(o)}finally{n.f()}}},{key:"docChanged",get:function(){return!this.changes.empty}},{key:"reconfigured",get:function(){return this.startState.config!=this.state.config}},{key:"isUserEvent",value:function(e){var n=this.annotation(t.userEvent);return!(!n||!(n==e||n.length>e.length&&n.slice(0,e.length)==e&&"."==n[e.length]))}}],[{key:"create",value:function(e,n,i,r,o,a){return new t(e,n,i,r,o,a)}}]),t}();function be(t,e){for(var n=[],i=0,r=0;;){var o=void 0,a=void 0;if(i=t[i]))o=t[i++],a=t[i++];else{if(!(r=0;r--){var o=n[r](t);o&&Object.keys(o).length&&(i=we(i,Qe(e,o,t.changes.newLength),!0))}return i==t?t:ke.create(e,t.changes,t.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(t){var e,n=t.startState,r=!0,o=i(n.facet(fe));try{for(o.s();!(e=o.n()).done;){var a=(0,e.value)(t);if(!1===a){r=!1;break}Array.isArray(a)&&(r=!0===r?a:be(r,a))}}catch(d){o.e(d)}finally{o.f()}if(!0!==r){var s,l;if(!1===r)l=t.changes.invertedDesc,s=Mt.empty(n.doc.length);else{var u=t.changes.filter(r);s=u.changes,l=u.filtered.mapDesc(u.changes).invertedDesc}t=ke.create(n,s,t.selection&&t.selection.map(l),ye.mapEffects(t.effects,l),t.annotations,t.scrollIntoView)}for(var h=n.facet(de),c=h.length-1;c>=0;c--){var f=h[c](t);t=f instanceof ke?f:Array.isArray(f)&&1==f.length&&f[0]instanceof ke?f[0]:xe(n,Pe(f),!1)}return t}(s):s)}ke.time=ve.define(),ke.userEvent=ve.define(),ke.addToHistory=ve.define(),ke.remote=ve.define();var Se=[];function Pe(t){return null==t?Se:Array.isArray(t)?t:[t]}var $e,Ze=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Ze||(Ze={})),Re=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{$e=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(Gv){}function Te(t){return function(e){if(!/\S/.test(e))return Ze.Space;if(function(t){if($e)return $e.test(t);for(var e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||Re.test(n)))return!0}return!1}(e))return Ze.Word;for(var n=0;n-1)return Ze.Word;return Ze.Other}}var Ae=function(){function t(e,n,i,r,o,a){O(this,t),this.config=e,this.doc=n,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=o,a&&(a._state=this);for(var s=0;s1&&void 0!==arguments[1])||arguments[1],n=this.config.address[t.id];if(null!=n)return se(this,n),le(this,n);if(e)throw new RangeError("Field is not present in this state")}},{key:"update",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n0&&void 0!==arguments[0]?arguments[0]:[];return e instanceof Mt?e:Mt.of(e,this.doc.length,this.facet(t.lineSeparator))}},{key:"toText",value:function(e){return st.of(e.split(this.facet(t.lineSeparator)||Tt))}},{key:"sliceDoc",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.doc.length;return this.doc.sliceString(t,e,this.lineBreak)}},{key:"facet",value:function(t){var e=this.config.address[t.id];return null==e?t.default:(se(this,e),le(this,e))}},{key:"toJSON",value:function(t){var e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(var n in t){var i=t[n];i instanceof Ht&&null!=this.config.address[i.id]&&(e[n]=i.spec.toJSON(this.field(t[n]),this))}return e}},{key:"tabSize",get:function(){return this.facet(t.tabSize)}},{key:"lineBreak",get:function(){return this.facet(t.lineSeparator)||"\n"}},{key:"readOnly",get:function(){return this.facet(pe)}},{key:"phrase",value:function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;or.length?t:r[n-1]}))),e}},{key:"languageDataAt",value:function(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,o=[],a=i(this.facet(ue));try{for(a.s();!(n=a.n()).done;){var s,l=i((0,n.value)(this,e,r));try{for(l.s();!(s=l.n()).done;){var u=s.value;Object.prototype.hasOwnProperty.call(u,t)&&o.push(u[t])}}catch(h){l.e(h)}finally{l.f()}}}catch(h){a.e(h)}finally{a.f()}return o}},{key:"charCategorizer",value:function(t){return Te(this.languageDataAt("wordChars",t).join(""))}},{key:"wordAt",value:function(t){for(var e=this.doc.lineAt(t),n=e.text,i=e.from,r=e.length,o=this.charCategorizer(t),a=t-i,s=t-i;a>0;){var l=wt(n,a,!1);if(o(n.slice(l,a))!=Ze.Word)break;a=l}for(;s1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");var r=[];if(i){var o=function(){if(Object.prototype.hasOwnProperty.call(e,a)){var t=i[a],n=e[a];r.push(t.init((function(e){return t.spec.fromJSON(n,e)})))}};for(var a in i)o()}return t.create({doc:e.doc,selection:Et.fromJSON(e.selection),extensions:n.extensions?r.concat([n.extensions]):r})}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=ae.resolve(e.extensions||[],new Map),i=e.doc instanceof st?e.doc:st.of((e.doc||"").split(n.staticFacet(t.lineSeparator)||Tt)),r=e.selection?e.selection instanceof Et?e.selection:Et.single(e.selection.anchor,e.selection.head):Et.single(0);return _t(r,i.length),n.staticFacet(he)||(r=r.asSingle()),new t(n,i,r,n.dynamicSlots.map((function(){return null})),(function(t,e){return e.create(t)}),null)}}]),t}();function Ce(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o={},a=i(t);try{for(a.s();!(n=a.n()).done;)for(var s=n.value,l=0,u=Object.keys(s);l1&&void 0!==arguments[1]?arguments[1]:t;return We.create(t,e,this)}}]),t}();Me.prototype.startSide=Me.prototype.endSide=0,Me.prototype.point=!1,Me.prototype.mapMode=At.TrackDel;var We=function(){function t(e,n,i){O(this,t),this.from=e,this.to=n,this.value=i}return v(t,null,[{key:"create",value:function(e,n,i){return new t(e,n,i)}}]),t}();function Xe(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}var Ye=function(){function t(e,n,i,r){O(this,t),this.from=e,this.to=n,this.value=i,this.maxPoint=r}return v(t,[{key:"length",get:function(){return this.to[this.to.length-1]}},{key:"findIndex",value:function(t,e,n){for(var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=n?this.to:this.from,o=i,a=r.length;;){if(o==a)return o;var s=o+a>>1,l=r[s]-t||(n?this.value[s].endSide:this.value[s].startSide)-e;if(s==o)return l>=0?o:a;l>=0?a=s:o=s+1}}},{key:"between",value:function(t,e,n,i){for(var r=this.findIndex(e,-1e9,!0),o=this.findIndex(n,1e9,!1,r);r(d=n.mapPos(c,u.endSide))||f==d&&u.startSide>0&&u.endSide<=0)continue;(d-f||u.endSide-u.startSide)<0||(a<0&&(a=f),u.point&&(s=Math.max(s,d-f)),i.push(u),r.push(f-a),o.push(d-a))}return{mapped:i.length?new t(r,o,i,s):null,pos:a}}}]),t}(),qe=function(){function t(e,n,i,r){O(this,t),this.chunkPos=e,this.chunk=n,this.nextLayer=i,this.maxPoint=r}return v(t,[{key:"length",get:function(){var t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}},{key:"size",get:function(){if(this.isEmpty)return 0;var t,e=this.nextLayer.size,n=i(this.chunk);try{for(n.s();!(t=n.n()).done;){e+=t.value.value.length}}catch(r){n.e(r)}finally{n.f()}return e}},{key:"chunkEnd",value:function(t){return this.chunkPos[t]+this.chunk[t].length}},{key:"update",value:function(e){var n=e.add,i=void 0===n?[]:n,r=e.sort,o=void 0!==r&&r,a=e.filterFrom,s=void 0===a?0:a,l=e.filterTo,u=void 0===l?this.length:l,h=e.filter;if(0==i.length&&!h)return this;if(o&&(i=i.slice().sort(Xe)),this.isEmpty)return i.length?t.of(i):this;for(var c=new De(this,null,-1).goto(0),f=0,d=[],O=new je;c.value||f=0){var p=i[f++];O.addInner(p.from,p.to,p.value)||d.push(p)}else 1==c.rangeIndex&&c.chunkIndexthis.chunkEnd(c.chunkIndex)||uc.to||u=r&&t<=r+o.length&&!1===o.between(r,t-r,e-r,n))return}this.nextLayer.between(t,e,n)}}},{key:"iter",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return Ee.from([this]).goto(t)}},{key:"isEmpty",get:function(){return this.nextLayer==this}}],[{key:"create",value:function(e,n,i,r){return new t(e,n,i,r)}},{key:"iter",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return Ee.from(t).goto(e)}},{key:"compare",value:function(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=t.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r})),a=e.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=r})),s=ze(o,a,n),l=new Ve(o,s,r),u=new Ve(a,s,r);n.iterGaps((function(t,e,n){return Ue(l,t,u,e,n,i)})),n.empty&&0==n.length&&Ue(l,0,u,0,0,i)}},{key:"eq",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0;null==i&&(i=999999999);var r=t.filter((function(t){return!t.isEmpty&&e.indexOf(t)<0})),o=e.filter((function(e){return!e.isEmpty&&t.indexOf(e)<0}));if(r.length!=o.length)return!1;if(!r.length)return!0;for(var a=ze(r,o),s=new Ve(r,a,0).goto(n),l=new Ve(o,a,0).goto(n);;){if(s.to!=l.to||!Ne(s.active,l.active)||s.point&&(!l.point||!s.point.eq(l.point)))return!1;if(s.to>i)return!0;s.next(),l.next()}}},{key:"spans",value:function(t,e,n,i){for(var r=new Ve(t,null,arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1).goto(e),o=e,a=r.openStart;;){var s=Math.min(r.to,n);if(r.point){var l=r.activeForPoint(r.to),u=r.pointFromo&&(i.span(o,s,r.active,a),a=r.openEnd(s));if(r.to>n)return a+(r.point&&r.to>n?1:0);o=r.to,r.next()}}},{key:"of",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=new je,o=i(t instanceof We?[t]:n?function(t){if(t.length>1)for(var e=t[0],n=1;n0)return t.slice().sort(Xe);e=i}return t}(t):t);try{for(o.s();!(e=o.n()).done;){var a=e.value;r.add(a.from,a.to,a.value)}}catch(s){o.e(s)}finally{o.f()}return r.finish()}},{key:"join",value:function(e){if(!e.length)return t.empty;for(var n=e[e.length-1],i=e.length-2;i>=0;i--)for(var r=e[i];r!=t.empty;r=r.nextLayer)n=new t(r.chunkPos,r.chunk,n,Math.max(r.maxPoint,n.maxPoint));return n}}]),t}();qe.empty=new qe([],[],null,-1),qe.empty.nextLayer=qe.empty;var je=function(){function t(){O(this,t),this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}return v(t,[{key:"finishChunk",value:function(t){this.chunks.push(new Ye(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}},{key:"add",value:function(e,n,i){this.addInner(e,n,i)||(this.nextLayer||(this.nextLayer=new t)).add(e,n,i)}},{key:"addInner",value:function(t,e,n){var i=t-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(t-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=n,this.lastFrom=t,this.lastTo=e,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}},{key:"addChunk",value:function(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);var n=e.value.length-1;return this.last=e.value[n],this.lastFrom=e.from[n]+t,this.lastTo=e.to[n]+t,!0}},{key:"finish",value:function(){return this.finishInner(qe.empty)}},{key:"finishInner",value:function(t){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return t;var e=qe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}]),t}();function ze(t,e,n){var r,o=new Map,a=i(t);try{for(a.s();!(r=a.n()).done;)for(var s=r.value,l=0;l3&&void 0!==arguments[3]?arguments[3]:0;O(this,t),this.layer=e,this.skip=n,this.minPoint=i,this.rank=r}return v(t,[{key:"startSide",get:function(){return this.value?this.value.startSide:0}},{key:"endSide",get:function(){return this.value?this.value.endSide:0}},{key:"goto",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}},{key:"gotoInner",value:function(t,e,n){for(;this.chunkIndex=this.minPoint)break}}},{key:"setRangeIndex",value:function(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex1&&void 0!==arguments[1]?arguments[1]:-1e9,r=i(this.heap);try{for(r.s();!(e=r.n()).done;){e.value.goto(t,n)}}catch(a){r.e(a)}finally{r.f()}for(var o=this.heap.length>>1;o>=0;o--)_e(this.heap,o);return this.next(),this}},{key:"forward",value:function(t,e){var n,r=i(this.heap);try{for(r.s();!(n=r.n()).done;){n.value.forward(t,e)}}catch(a){r.e(a)}finally{r.f()}for(var o=this.heap.length>>1;o>=0;o--)_e(this.heap,o);(this.to-t||this.value.endSide-e)<0&&this.next()}},{key:"next",value:function(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{var t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),_e(this.heap,0)}}}],[{key:"from",value:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=[],o=0;o=i&&r.push(new De(a,n,i,o));return 1==r.length?r[0]:new t(r)}}]),t}();function _e(t,e){for(var n=t[e];;){var i=1+(e<<1);if(i>=t.length)break;var r=t[i];if(i+1=0&&(r=t[i+1],i++),n.compare(r)<0)break;t[i]=n,t[e]=r,e=i}}var Ve=function(){function t(e,n,i){O(this,t),this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Ee.from(e,n,i)}return v(t,[{key:"goto",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}},{key:"forward",value:function(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}},{key:"removeActive",value:function(t){Be(this.active,t),Be(this.activeTo,t),Be(this.activeRank,t),this.minActive=Ge(this.active,this.activeTo)}},{key:"addActive",value:function(t){for(var e=0,n=this.cursor,i=n.value,r=n.to,o=n.rank;e0;)e++;Ie(this.active,e,i),Ie(this.activeTo,e,r),Ie(this.activeRank,e,o),t&&Ie(t,e,this.cursor.from),this.minActive=Ge(this.active,this.activeTo)}},{key:"next",value:function(){var t=this.to,e=this.point;this.point=null;for(var n=this.openStart<0?[]:null;;){var i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>t){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&Be(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}var r=this.cursor.value;if(r.point){if(!(e&&this.cursor.to==this.to&&this.cursor.from=0&&n[o]=0&&!(this.activeRank[n]t||this.activeTo[n]==t&&this.active[n].endSide>=this.point.endSide)&&e.push(this.active[n]);return e.reverse()}},{key:"openEnd",value:function(t){for(var e=0,n=this.activeTo.length-1;n>=0&&this.activeTo[n]>t;n--)e++;return e}}]),t}();function Ue(t,e,n,i,r,o){t.goto(e),n.goto(i);for(var a=i+r,s=i,l=i-e;;){var u=t.to+l-n.to||t.endSide-n.endSide,h=u<0?t.to+l:n.to,c=Math.min(h,a);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&Ne(t.activeForPoint(t.to),n.activeForPoint(n.to))||o.comparePoint(s,c,t.point,n.point):c>s&&!Ne(t.active,n.active)&&o.compareRange(s,c,t.active,n.active),h>a)break;s=h,u<=0&&t.next(),u>=0&&n.next()}}function Ne(t,e){if(t.length!=e.length)return!1;for(var n=0;n=e;i--)t[i+1]=t[i];t[e]=n}function Ge(t,e){for(var n=-1,i=1e9,r=0;r2&&void 0!==arguments[2]?arguments[2]:t.length,i=0,r=0;r=e)return r;if(r==t.length)break;o+=9==t.charCodeAt(r)?n-o%n:1,r=wt(t,r)}return!0===i?-1:t.length}for(var Fe="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),Je="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),Ke="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{},tn=function(){function t(e,i){O(this,t),this.rules=[];var r=(i||{}).finish;function o(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function a(t,e,i,s){var l=[],u=/^@(\w+)\b/.exec(t[0]),h=u&&"keyframes"==u[1];if(u&&null==e)return i.push(t[0]+";");for(var c in e){var f=e[c];if(/&/.test(c))a(c.split(/,\s*/).map((function(e){return t.map((function(t){return e.replace(/&/,t)}))})).reduce((function(t,e){return t.concat(e)})),f,i);else if(f&&"object"==n(f)){if(!u)throw new RangeError("The value of a property ("+c+") should be a primitive value.");a(o(c),f,l,h)}else null!=f&&l.push(c.replace(/_.*/,"").replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}))+": "+f+";")}(l.length||h)&&i.push((!r||u||s?t:t.map(r)).join(", ")+" {"+l.join(" ")+"}")}for(var s in e)a(o(s),e[s],this.rules)}return v(t,[{key:"getRules",value:function(){return this.rules.join("\n")}}],[{key:"newName",value:function(){var t=Ke[Fe]||1;return Ke[Fe]=t+1,"ͼ"+t.toString(36)}},{key:"mount",value:function(t,e,n){var i=t[Je],r=n&&n.nonce;i?r&&i.setNonce(r):i=new nn(t,r),i.mount(Array.isArray(e)?e:[e],t)}}]),t}(),en=new Map,nn=function(){function t(e,n){O(this,t);var i=e.ownerDocument||e,r=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){var o=en.get(i);if(o)return e[Je]=o;this.sheet=new r.CSSStyleSheet,en.set(i,this)}else this.styleTag=i.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[Je]=this}return v(t,[{key:"mount",value:function(t,n){for(var i=this.sheet,r=0,o=0,a=0;a-1&&(this.modules.splice(l,1),o--,l=-1),-1==l){if(this.modules.splice(o++,0,s),i)for(var u=0;u",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},an="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),sn="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ln=0;ln<10;ln++)rn[48+ln]=rn[96+ln]=String(ln);for(ln=1;ln<=24;ln++)rn[ln+111]="F"+ln;for(ln=65;ln<=90;ln++)rn[ln]=String.fromCharCode(ln+32),on[ln]=String.fromCharCode(ln);for(var un in rn)on.hasOwnProperty(un)||(on[un]=rn[un]);function hn(t){return(11==t.nodeType?t.getSelection?t:t.ownerDocument:t).getSelection()}function cn(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function fn(t,e){if(!e.anchorNode)return!1;try{return cn(t,e.anchorNode)}catch(Gv){return!1}}function dn(t){return 3==t.nodeType?Pn(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function On(t,e,n,i){return!!n&&(gn(t,e,n,i,-1)||gn(t,e,n,i,1))}function pn(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function vn(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function gn(t,e,n,i,r){for(;;){if(t==n&&e==i)return!0;if(e==(r<0?0:mn(t))){if("DIV"==t.nodeName)return!1;var o=t.parentNode;if(!o||1!=o.nodeType)return!1;e=pn(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?mn(t):0}}}function mn(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function yn(t,e){var n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function kn(t){var e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function bn(t,e){var n=e.width/t.offsetWidth,i=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-t.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}var wn,Qn=function(){function t(){O(this,t),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return v(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){var e=t.anchorNode,n=t.focusNode;this.set(e,Math.min(t.anchorOffset,e?mn(e):0),n,Math.min(t.focusOffset,n?mn(n):0))}},{key:"set",value:function(t,e,n,i){this.anchorNode=t,this.anchorOffset=e,this.focusNode=n,this.focusOffset=i}}]),t}(),xn=null;function Sn(t){if(t.setActive)return t.setActive();if(xn)return t.focus(xn);for(var e=[],n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(null==xn?{get preventScroll(){return xn={preventScroll:!0},!0}}:void 0),!xn){xn=!1;for(var i=0;i2&&void 0!==arguments[2]?arguments[2]:e,i=wn||(wn=document.createRange());return i.setEnd(t,n),i.setStart(t,e),i}function $n(t,e,n,i){var r={key:e,code:e,keyCode:n,which:n,cancelable:!0};i&&(r.altKey=i.altKey,r.ctrlKey=i.ctrlKey,r.shiftKey=i.shiftKey,r.metaKey=i.metaKey);var o=new KeyboardEvent("keydown",r);o.synthetic=!0,t.dispatchEvent(o);var a=new KeyboardEvent("keyup",r);return a.synthetic=!0,t.dispatchEvent(a),o.defaultPrevented||a.defaultPrevented}function Zn(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function Rn(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function Tn(t,e){for(var n=t,i=e;;){if(3==n.nodeType&&i>0)return{node:n,offset:i};if(1==n.nodeType&&i>0){if("false"==n.contentEditable)return null;i=mn(n=n.childNodes[i-1])}else{if(!n.parentNode||vn(n))return null;i=pn(n),n=n.parentNode}}}function An(t,e){for(var n=t,i=e;;){if(3==n.nodeType&&i2&&void 0!==arguments[2])||arguments[2];O(this,t),this.node=e,this.offset=n,this.precise=i}return v(t,null,[{key:"before",value:function(e,n){return new t(e.parentNode,pn(e),n)}},{key:"after",value:function(e,n){return new t(e.parentNode,pn(e)+1,n)}}]),t}(),Mn=[],Wn=function(){function t(){O(this,t),this.parent=null,this.dom=null,this.flags=2}return v(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,n=this.posAtStart,r=i(this.children);try{for(r.s();!(e=r.n()).done;){var o=e.value;if(o==t)return n;n+=o.length+o.breakAfter}}catch(a){r.e(a)}finally{r.f()}throw new RangeError("Invalid child in posBefore")}},{key:"posAfter",value:function(t){return this.posBefore(t)+t.length}},{key:"sync",value:function(e,n){if(2&this.flags){var r,o,a=this.dom,s=null,l=i(this.children);try{for(l.s();!(o=l.n()).done;){var u=o.value;if(7&u.flags){if(!u.dom&&(r=s?s.nextSibling:a.firstChild)){var h=t.get(r);(!h||!h.parent&&h.canReuseDOM(u))&&u.reuseDOM(r)}u.sync(e,n),u.flags&=-8}if(r=s?s.nextSibling:a.firstChild,n&&!n.written&&n.node==a&&r!=u.dom&&(n.written=!0),u.dom.parentNode==a)for(;r&&r!=u.dom;)r=Xn(r);else a.insertBefore(u.dom,r);s=u.dom}}catch(O){l.e(O)}finally{l.f()}for((r=s?s.nextSibling:a.firstChild)&&n&&n.node==a&&(n.written=!0);r;)r=Xn(r)}else if(1&this.flags){var c,f=i(this.children);try{for(f.s();!(c=f.n()).done;){var d=c.value;7&d.flags&&(d.sync(e,n),d.flags&=-8)}}catch(O){f.e(O)}finally{f.f()}}}},{key:"reuseDOM",value:function(t){}},{key:"localPosFromDOM",value:function(e,n){var i;if(e==this.dom)i=this.dom.childNodes[n];else{for(var r=0==mn(e)?0:0==n?-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}i=r<0?e:e.nextSibling}if(i==this.dom.firstChild)return 0;for(;i&&!t.get(i);)i=i.nextSibling;if(!i)return this.length;for(var a=0,s=0;;a++){var l=this.children[a];if(l.dom==i)return s;s+=l.length+l.breakAfter}}},{key:"domBoundsAround",value:function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=-1,r=-1,o=-1,a=-1,s=0,l=n,u=n;se)return h.domBoundsAround(t,e,l);if(c>=t&&-1==i&&(i=s,r=l),l>e&&h.dom.parentNode==this.dom){o=s,a=u;break}u=c,l=c+h.breakAfter}return{from:r,to:a<0?n+this.length:a,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}},{key:"markDirty",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.flags|=2,this.markParentsDirty(t)}},{key:"markParentsDirty",value:function(t){for(var e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),1&e.flags)return;e.flags|=1,t=!1}}},{key:"setParent",value:function(t){this.parent!=t&&(this.parent=t,7&this.flags&&this.markParentsDirty(!0))}},{key:"setDOM",value:function(t){this.dom!=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,n){var i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Mn;this.markDirty();for(var o=t;o0&&void 0!==arguments[0]?arguments[0]:this.length;return new Yn(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}},{key:"merge",value:function(t,e,n,i,r,o){return!1}},{key:"become",value:function(t){return!1}},{key:"canReuseDOM",value:function(t){return t.constructor==this.constructor&&!(8&(this.flags|t.flags))}},{key:"getSide",value:function(){return 0}},{key:"destroy",value:function(){var t,e=i(this.children);try{for(e.s();!(t=e.n()).done;){var n=t.value;n.parent==this&&n.destroy()}}catch(r){e.e(r)}finally{e.f()}this.parent=null}}],[{key:"get",value:function(t){return t.cmView}}]),t}();function Xn(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}Wn.prototype.breakAfter=0;var Yn=function(){function t(e,n,i){O(this,t),this.children=e,this.pos=n,this.i=i,this.off=0}return v(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 n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}]),t}();function qn(t,e,n,i,r,o,a,s,l){var u=t.children,h=u.length?u[e]:null,c=o.length?o[o.length-1]:null,f=c?c.breakAfter:a;if(!(e==i&&h&&!a&&!f&&o.length<2&&h.merge(n,r,o.length?c:null,0==n,s,l))){if(i0&&(!a&&o.length&&h.merge(n,h.length,o[0],!1,s,0)?h.breakAfter=o.shift().breakAfter:(n2),Hn={mac:Ln||/Mac/.test(zn.platform),windows:/Win/.test(zn.platform),linux:/Linux|X11/.test(zn.platform),ie:Un,ie_version:_n?Dn.documentMode||6:Vn?+Vn[1]:En?+En[1]:0,gecko:Nn,gecko_version:Nn?+(/Firefox\/(\d+)/.exec(zn.userAgent)||[0,0])[1]:0,chrome:!!Bn,chrome_version:Bn?+Bn[1]:0,ios:Ln,android:/Android\b/.test(zn.userAgent),webkit:In,safari:Gn,webkit_version:In?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Dn.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},Fn=function(t){function e(t){var n;return O(this,e),(n=r(this,e)).text=t,n}return u(e,t),v(e,[{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,n,i){return!(8&this.flags||i&&(!(i instanceof e)||this.length-(n-t)+i.length>256||8&i.flags))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(n),this.markDirty(),!0)}},{key:"split",value:function(t){var n=new e(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),n.flags|=8&this.flags,n}},{key:"localPosFromDOM",value:function(t,e){return t==this.dom?e:e?this.text.length:0}},{key:"domAtPos",value:function(t){return new Cn(this.dom,t)}},{key:"domBoundsAround",value:function(t,e,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}},{key:"coordsAt",value:function(t,e){return function(t,e,n){var i=t.nodeValue.length;e>i&&(e=i);var r=e,o=e,a=0;0==e&&n<0||e==i&&n>=0?Hn.chrome||Hn.gecko||(e?(r--,a=1):o=0)?0:s.length-1];Hn.safari&&!a&&0==l.width&&(l=Array.prototype.find.call(s,(function(t){return t.width}))||l);return a?yn(l,a<0):l||null}(this.dom,t,e)}}]),e}(Wn),Jn=function(t){function e(t){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;O(this,e),(n=r(this,e)).mark=t,n.children=a,n.length=s;var l,u=i(a);try{for(u.s();!(l=u.n()).done;){l.value.setParent(o(n))}}catch(h){u.e(h)}finally{u.f()}return n}return u(e,t),v(e,[{key:"setAttrs",value:function(t){if(Zn(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}},{key:"canReuseDOM",value:function(t){return s(l(e.prototype),"canReuseDOM",this).call(this,t)&&!(8&(this.flags|t.flags))}},{key:"reuseDOM",value:function(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}},{key:"sync",value:function(t,n){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),s(l(e.prototype),"sync",this).call(this,t,n)}},{key:"merge",value:function(t,n,i,r,o,a){return(!i||!(!(i instanceof e&&i.mark.eq(this.mark))||t&&o<=0||nt&&r.push(o=t&&(a=s),o=h,s++}}catch(f){l.e(f)}finally{l.f()}var c=this.length-t;return this.length=t,a>-1&&(this.children.length=a,this.markDirty()),new e(this.mark,r,c)}},{key:"domAtPos",value:function(t){return ei(this,t)}},{key:"coordsAt",value:function(t,e){return ii(this,t,e)}}]),e}(Wn);var Kn=function(t){function e(t,n,i){var o;return O(this,e),(o=r(this,e)).widget=t,o.length=n,o.side=i,o.prevWidget=null,o}return u(e,t),v(e,[{key:"split",value:function(t){var n=e.create(this.widget,this.length-t,this.side);return this.length-=t,n}},{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.widget.editable||(this.dom.contentEditable="false"))}},{key:"getSide",value:function(){return this.side}},{key:"merge",value:function(t,n,i,r,o,a){return!(i&&(!(i instanceof e&&this.widget.compare(i.widget))||t>0&&o<=0||n0)?Cn.before(this.dom):Cn.after(this.dom,t==this.length)}},{key:"domBoundsAround",value:function(){return null}},{key:"coordsAt",value:function(t,e){var n=this.widget.coordsAt(this.dom,t,e);if(n)return n;var i=this.dom.getClientRects(),r=null;if(!i.length)return null;for(var o=this.side?this.side<0:t>0,a=o?i.length-1:0;r=i[a],!(t>0?0==a:a==i.length-1||r.top0?Cn.before(this.dom):Cn.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 st.empty}},{key:"isHidden",get:function(){return!0}}]),e}(Wn);function ei(t,e){for(var n=t.dom,i=t.children,r=0,o=0;ro&&e0;l--){var u=i[l-1];if(u.dom.parentNode==n)return u.domAtPos(u.length)}for(var h=r;h0&&e instanceof Jn&&r.length&&(i=r[r.length-1])instanceof Jn&&i.mark.eq(e.mark)?ni(i,e.children[0],n-1):(r.push(e),e.setParent(t)),t.length+=e.length}function ii(t,e,n){var i=null,r=-1,o=null,a=-1;!function t(e,s){for(var l=0,u=0;l=s&&(h.children.length?t(h,s-u):(!o||o.isHidden&&n>0)&&(c>s||u==c&&h.getSide()>0)?(o=h,a=s-u):(u-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(var o=0,a=i;o0&&0==this.children[r-1].length;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=t,n}},{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){ai(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}},{key:"append",value:function(t,e){ni(this,t,e)}},{key:"addLineDeco",value:function(t){var e=t.spec.attributes,n=t.spec.class;e&&(this.attrs=ri(e,this.attrs||{})),n&&(this.attrs=ri({class:n},this.attrs||{}))}},{key:"domAtPos",value:function(t){return ei(this,t)}},{key:"reuseDOM",value:function(t){"DIV"==t.nodeName&&(this.setDOM(t),this.flags|=6)}},{key:"sync",value:function(t,n){var i;this.dom?4&this.flags&&(Zn(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&&(si(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),s(l(e.prototype),"sync",this).call(this,t,n);for(var r=this.dom.lastChild;r&&Wn.get(r)instanceof Jn;)r=r.lastChild;if(!(r&&this.length&&("BR"==r.nodeName||0!=(null===(i=Wn.get(r))||void 0===i?void 0:i.isEditable)||Hn.ios&&this.children.some((function(t){return t instanceof Fn}))))){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,n=0,r=i(this.children);try{for(r.s();!(e=r.n()).done;){var o=e.value;if(!(o instanceof Fn)||/[^ -~]/.test(o.text))return null;var a=dn(o.dom);if(1!=a.length)return null;n+=a[0].width,t=a[0].height}}catch(s){r.e(s)}finally{r.f()}return n?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:n/this.length,textHeight:t}:null}},{key:"coordsAt",value:function(t,e){var n=ii(this,t,e);if(!this.children.length&&n&&this.parent){var i=this.parent.view.viewState.heightOracle,r=n.bottom-n.top;if(Math.abs(r-i.lineHeight)<2&&i.textHeight=n){if(o instanceof e)return o;if(a>n)break}r=a+o.breakAfter}return null}}]),e}(Wn),hi=function(t){function e(t,n,i){var o;return O(this,e),(o=r(this,e)).widget=t,o.length=n,o.deco=i,o.breakAfter=0,o.prevWidget=null,o}return u(e,t),v(e,[{key:"merge",value:function(t,n,i,r,o,a){return!(i&&(!(i instanceof e&&this.widget.compare(i.widget))||t>0&&o<=0||n0)}}]),e}(Wn),ci=function(){function t(){O(this,t)}return v(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:"lineBreaks",get:function(){return 0}},{key:"ignoreEvent",value:function(t){return!0}},{key:"coordsAt",value:function(t,e,n){return null}},{key:"isHidden",get:function(){return!1}},{key:"editable",get:function(){return!1}},{key:"destroy",value:function(t){}}]),t}(),fi=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(fi||(fi={})),di=function(t){function e(t,n,i,o){var a;return O(this,e),(a=r(this,e)).startSide=t,a.endSide=n,a.widget=i,a.spec=o,a}return u(e,t),v(e,[{key:"heightRelevant",get:function(){return!1}},{key:"hasHeight",value:function(){return!!this.widget&&this.widget.estimatedHeight>-1}}],[{key:"mark",value:function(t){return new Oi(t)}},{key:"widget",value:function(t){var e=Math.max(-1e4,Math.min(1e4,t.side||0)),n=!!t.block;return e+=n&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new vi(t,e,e,n,t.widget||null,!1)}},{key:"replace",value:function(t){var e,n,i=!!t.block;if(t.isBlockGap)e=-5e8,n=4e8;else{var r=gi(t,i);e=(r.start?i?-3e8:-1:5e8)-1,n=1+(r.end?i?2e8:1:-6e8)}return new vi(t,e,n,i,t.widget||null,!0)}},{key:"line",value:function(t){return new pi(t)}},{key:"set",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return qe.of(t,e)}}]),e}(Me);di.none=qe.empty;var Oi=function(t){function e(t){var n;O(this,e);var i=gi(t);return(n=r(this,e,[i.start?-1:5e8,i.end?1:-6e8,null,t])).tagName=t.tagName||"span",n.class=t.class||"",n.attrs=t.attributes||null,n}return u(e,t),v(e,[{key:"eq",value:function(t){var n,i;return this==t||t instanceof e&&this.tagName==t.tagName&&(this.class||(null===(n=this.attrs)||void 0===n?void 0:n.class))==(t.class||(null===(i=t.attrs)||void 0===i?void 0:i.class))&&ai(this.attrs,t.attrs,"class")}},{key:"range",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(t>=n)throw new RangeError("Mark decorations may not be empty");return s(l(e.prototype),"range",this).call(this,t,n)}}]),e}(di);Oi.prototype.point=!1;var pi=function(t){function e(t){return O(this,e),r(this,e,[-2e8,-2e8,null,t])}return u(e,t),v(e,[{key:"eq",value:function(t){return t instanceof e&&this.spec.class==t.spec.class&&ai(this.spec.attributes,t.spec.attributes)}},{key:"range",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(n!=t)throw new RangeError("Line decoration ranges must be zero-length");return s(l(e.prototype),"range",this).call(this,t,n)}}]),e}(di);pi.prototype.mapMode=At.TrackBefore,pi.prototype.point=!0;var vi=function(t){function e(t,n,i,o,a,s){var l;return O(this,e),(l=r(this,e,[n,i,a,t])).block=o,l.isReplace=s,l.mapMode=o?n<=0?At.TrackBefore:At.TrackAfter:At.TrackDel,l}return u(e,t),v(e,[{key:"type",get:function(){return this.startSide!=this.endSide?fi.WidgetRange:this.startSide<=0?fi.WidgetBefore:fi.WidgetAfter}},{key:"heightRelevant",get:function(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}},{key:"eq",value:function(t){return t instanceof e&&(n=this.widget,i=t.widget,n==i||!!(n&&i&&n.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide;var n,i}},{key:"range",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;if(this.isReplace&&(t>n||t==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=t)throw new RangeError("Widget decorations can only have zero-length ranges");return s(l(e.prototype),"range",this).call(this,t,n)}}]),e}(di);function gi(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.inclusiveStart,i=t.inclusiveEnd;return null==n&&(n=t.inclusive),null==i&&(i=t.inclusive),{start:null!=n?n:e,end:null!=i?i:e}}function mi(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=n.length-1;r>=0&&n[r]+i>=t?n[r]=Math.max(n[r],e):n.push(t,e)}vi.prototype.point=!0;var yi=function(){function t(e,n,i,r){O(this,t),this.doc=e,this.pos=n,this.end=i,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=n}return v(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 hi&&t.deco.endSide<0)}},{key:"getLine",value:function(){return this.curLine||(this.content.push(this.curLine=new ui),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(ki(new ti(-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()||t&&this.content.length&&this.content[this.content.length-1]instanceof hi||this.getLine()}},{key:"buildText",value:function(t,e,n){for(;t>0;){if(this.textOff==this.text.length){var i=this.cursor.next(this.skip),r=i.value,o=i.lineBreak,a=i.done;if(this.skip=0,a)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 s=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-n)),this.getLine().append(ki(new Fn(this.text.slice(this.textOff,this.textOff+s)),e),n),this.atCursorPos=!0,this.textOff+=s,t-=s,n=0}}},{key:"span",value:function(t,e,n,i){this.buildText(e-t,n,i),this.pos=e,this.openStart<0&&(this.openStart=i)}},{key:"point",value:function(t,e,n,i,r,o){if(this.disallowBlockEffectsFor[o]&&n instanceof vi){if(n.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 a=e-t;if(n instanceof vi)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new hi(n.widget||bi.block,a,n));else{var s=Kn.create(n.widget||bi.inline,a,a?0:n.startSide),l=this.atCursorPos&&!s.isEditable&&r<=i.length&&(t0),u=!s.isEditable&&(ti.length||n.startSide<=0),h=this.getLine();2!=this.pendingBuffer||l||s.isEditable||(this.pendingBuffer=0),this.flushBuffer(i),l&&(h.append(ki(new ti(1),i),r),r=i.length+Math.max(0,r-i.length)),h.append(ki(s,i),r),this.atCursorPos=u,this.pendingBuffer=u?ti.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=r)}}],[{key:"build",value:function(e,n,i,r,o){var a=new t(e,n,i,o);return a.openEnd=qe.spans(r,n,i,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}]),t}();function ki(t,e){var n,r=i(e);try{for(r.s();!(n=r.n()).done;){var o=n.value;t=new Jn(o,[t],t.length)}}catch(a){r.e(a)}finally{r.f()}return t}var bi=function(t){function e(t){var n;return O(this,e),(n=r(this,e)).tag=t,n}return u(e,t),v(e,[{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}}]),e}(ci);bi.inline=new bi("span"),bi.block=new bi("div");var wi=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(wi||(wi={})),Qi=wi.LTR,xi=wi.RTL;function Si(t){for(var e=[],n=0;n=e){if(a.level==n)return o;(r<0||(0!=i?i<0?a.frome:t[r].level>a.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}]),t}();function ji(t,e){if(t.length!=e.length)return!1;for(var n=0;nl&&a.push(new qi(l,v.from,O)),Ei(t,v.direction==Qi!=!(O%2)?i+1:i,r,v.inner,v.from,v.to,a),l=v.to;p=v.to}else{if(p==n||(h?zi[p]!=s:zi[p]==s))break;p++}d?Di(t,l,p,i+1,r,d,a):le;){var b=!0,w=!1;if(!k||y>o[k-1].to){var Q=zi[y-1];Q!=s&&(b=!1,w=16==Q)}var x=b||1!=s?null:[],S=b?i:i+1,P=y;t:for(;;)if(k&&P==o[k-1].to){if(w)break t;var $=o[--k];if(!b)for(var Z=$.from,R=k;;){if(Z==e)break t;if(!R||o[R-1].to!=Z){if(zi[Z-1]==s)break t;break}Z=o[--R].from}if(x)x.push($);else $.to=0;p-=3)if(Ri[p+1]==-h){var v=Ri[p+2],g=2&v?r:4&v?1&v?o:r:0;g&&(zi[O]=zi[Ri[p]]=g),s=p;break}}else{if(189==Ri.length)break;Ri[s++]=O,Ri[s++]=u,Ri[s++]=l}else if(2==(c=zi[O])||1==c){var m=c==r;l=m?0:1;for(var y=s-3;y>=0;y-=3){var k=Ri[y+2];if(2&k)break;if(m)Ri[y+2]|=2;else{if(4&k)break;Ri[y+2]|=4}}}}(t,r,o,i,s),function(t,e,n,i){for(var r=0,o=i;r<=n.length;r++)for(var a=r?n[r-1].to:t,s=rl;)d==p&&(d=n[--O].from,p=O?n[O-1].to:t),zi[--d]=f;l=h}else o=u,l++}}(r,o,i,s),Di(t,r,o,e,n,i,a)}function _i(t){return[new qi(0,t,0)]}var Vi="";function Ui(t,e,n,i,r){var o,a=i.head-t.from,s=qi.find(e,a,null!==(o=i.bidiLevel)&&void 0!==o?o:-1,i.assoc),l=e[s],u=l.side(r,n);if(a==u){var h=s+=r?1:-1;if(h<0||h>=e.length)return null;a=(l=e[s=h]).side(!r,n),u=l.side(r,n)}var c=wt(t.text,a,l.forward(r,n));(cl.to)&&(c=u),Vi=t.text.slice(Math.min(a,c),Math.max(a,c));var f=s==(r?e.length-1:0)?null:e[s+(r?1:-1)];return f&&c==u&&f.level+(r?0:1)1&&void 0!==arguments[1]?arguments[1]:"nearest",i=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,a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];O(this,t),this.range=e,this.y=n,this.x=i,this.yMargin=r,this.xMargin=o,this.isSnapshot=a}return v(t,[{key:"map",value:function(e){return e.empty?this:new t(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},{key:"clip",value:function(e){return this.range.to<=e.doc.length?this:new t(Et.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}]),t}(),ir=ye.define({map:function(t,e){return t.map(e)}});function rr(t,e,n){var i=t.facet(Li);i.length?i[0](e):window.onerror?window.onerror(String(e),n,void 0,void 0,e):n?console.error(n+":",e):console.error(e)}var or=Ut.define({combine:function(t){return!t.length||t[0]}}),ar=0,sr=Ut.define(),lr=function(){function t(e,n,i,r,o){O(this,t),this.id=e,this.create=n,this.domEventHandlers=i,this.domEventObservers=r,this.extension=o(this)}return v(t,null,[{key:"define",value:function(e,n){var i=n||{},r=i.eventHandlers,o=i.eventObservers,a=i.provide,s=i.decorations;return new t(ar++,e,r,o,(function(t){var e=[sr.of(t)];return s&&e.push(fr.of((function(e){var n=e.plugin(t);return n?s(n):di.none}))),a&&e.push(a(t)),e}))}},{key:"fromClass",value:function(e,n){return t.define((function(t){return new e(t)}),n)}}]),t}(),ur=function(){function t(e){O(this,t),this.spec=e,this.mustUpdate=null,this.value=null}return v(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(op){if(rr(e.state,op,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(Gv){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(op){rr(t.state,op,"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(op){rr(t.state,op,"CodeMirror plugin crashed")}}},{key:"deactivate",value:function(){this.spec=this.value=null}}]),t}(),hr=Ut.define(),cr=Ut.define(),fr=Ut.define(),dr=Ut.define(),Or=Ut.define(),pr=Ut.define();function vr(t,e){var n=t.state.facet(pr);if(!n.length)return n;var i=n.map((function(e){return e instanceof Function?e(t):e})),r=[];return qe.spans(i,e.from,e.to,{point:function(){},span:function(t,n,i,o){for(var a=t-e.from,s=n-e.from,l=r,u=i.length-1;u>=0;u--,o--){var h=i[u].spec.bidiIsolate,c=void 0;if(null==h&&(h=Ni(e.text,a,s)),o>0&&l.length&&(c=l[l.length-1]).to==a&&c.direction==h)c.to=s,l=c.inner;else{var f={from:a,to:s,direction:h,inner:[]};l.push(f),l=f.inner}}}}),r}var gr=Ut.define();function mr(t){var e,n=0,r=0,o=0,a=0,s=i(t.state.facet(gr));try{for(s.s();!(e=s.n()).done;){var l=(0,e.value)(t);l&&(null!=l.left&&(n=Math.max(n,l.left)),null!=l.right&&(r=Math.max(r,l.right)),null!=l.top&&(o=Math.max(o,l.top)),null!=l.bottom&&(a=Math.max(a,l.bottom)))}}catch(u){s.e(u)}finally{s.f()}return{left:n,right:r,top:o,bottom:a}}var yr=Ut.define(),kr=function(){function t(e,n,i,r){O(this,t),this.fromA=e,this.toA=n,this.fromB=i,this.toB=r}return v(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,n=this;e>0;e--){var i=t[e-1];if(!(i.fromA>n.toA)){if(i.toAh)break;o+=2}if(!l)return i;new t(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),a=l.toA,s=l.toB}}}]),t}(),br=function(){function t(e,n,r){O(this,t),this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Mt.empty(this.startState.doc.length);var o,a=i(r);try{for(a.s();!(o=a.n()).done;){var s=o.value;this.changes=this.changes.compose(s.changes)}}catch(u){a.e(u)}finally{a.f()}var l=[];this.changes.iterChangedRanges((function(t,e,n,i){return l.push(new kr(t,e,n,i))})),this.changedRanges=l}return v(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,n,i){return new t(e,n,i)}}]),t}(),wr=function(t){function n(t){var e;return O(this,n),(e=r(this,n)).view=t,e.decorations=[],e.dynamicDecorationMap=[],e.domChanged=null,e.hasComposition=null,e.markedForComposition=new Set,e.lastCompositionAfterCursor=!1,e.minWidth=0,e.minWidthFrom=0,e.minWidthTo=0,e.impreciseAnchor=null,e.impreciseHead=null,e.forceSelection=!1,e.lastUpdate=Date.now(),e.setDOM(t.contentDOM),e.children=[new ui],e.children[0].setParent(o(e)),e.updateDeco(),e.updateInner([new kr(0,0,0,t.state.doc.length)],0,null),e}return u(n,t),v(n,[{key:"length",get:function(){return this.view.state.doc.length}},{key:"update",value:function(t){var e,n=this,i=t.changedRanges;this.minWidth>0&&i.length&&(i.every((function(t){var e=t.fromA;return t.toAn.minWidthTo}))?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);var r=-1;this.view.inputState.composing>=0&&((null===(e=this.domChanged)||void 0===e?void 0:e.newSel)?r=this.domChanged.newSel.head:function(t,e){var n=!1;e&&t.iterChangedRanges((function(t,i){te.from&&(n=!0)}));return n}(t.changes,this.hasComposition)||t.selectionSet||(r=t.state.selection.main.head));var o=r>-1?function(t,e,n){var i=xr(t,n);if(!i)return null;var r=i.node,o=i.from,a=i.to,s=r.nodeValue;if(/[\n\r]/.test(s))return null;if(t.state.doc.sliceString(i.from,i.to)!=s)return null;for(var l=e.invertedDesc,u=new kr(l.mapPos(o),l.mapPos(a),o,a),h=[],c=r.parentNode;;c=c.parentNode){var f=Wn.get(c);if(f instanceof Jn)h.push({node:c,deco:f.mark});else{if(f instanceof ui||"DIV"==c.nodeName&&c.parentNode==t.contentDOM)return{range:u,text:r,marks:h,line:c};if(c==t.contentDOM)return null;h.push({node:c,deco:new Oi({inclusive:!0,attributes:li(c),tagName:c.tagName.toLowerCase()})})}}}(this.view,t.changes,r):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();var a=this.hasComposition,s=a.from,l=a.to;i=new kr(s,l,t.changes.mapPos(s,-1),t.changes.mapPos(l,1)).addToSet(i.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(Hn.ie||Hn.chrome)&&!o&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);var u,h,c,f,d=this.decorations,O=this.updateDeco(),p=(u=d,h=O,c=t.changes,f=new Sr,qe.compare(u,h,c,f),f.changes);return i=kr.extendWithRanges(i,p),!!(7&this.flags||0!=i.length)&&(this.updateInner(i,t.startState.doc.length,o),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}},{key:"updateInner",value:function(t,e,n){var r=this;this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,n);var o=this.view.observer;o.ignore((function(){r.dom.style.height=r.view.viewState.contentHeight/r.view.scaleY+"px",r.dom.style.flexBasis=r.minWidth?r.minWidth+"px":"";var t=Hn.chrome||Hn.ios?{node:o.selectionRange.focusNode,written:!1}:void 0;r.sync(r.view,t),r.flags&=-8,t&&(t.written||o.selectionRange.focusNode!=t.node)&&(r.forceSelection=!0),r.dom.style.height=""})),this.markedForComposition.forEach((function(t){return t.flags&=-9}));var a=[];if(this.view.viewport.from||this.view.viewport.to=0?i[o]:null;if(!a)break;var s=a.fromA,l=a.toA,u=a.fromB,h=a.toB,c=void 0,f=void 0,d=void 0,O=void 0;if(n&&n.range.fromBu){var p=yi.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),v=yi.build(this.view.state.doc,n.range.toB,h,this.decorations,this.dynamicDecorationMap);f=p.breakAtStart,d=p.openStart,O=v.openEnd;var g=this.compositionView(n);v.breakAtStart?g.breakAfter=1:v.content.length&&g.merge(g.length,g.length,v.content[0],!1,v.openStart,0)&&(g.breakAfter=v.content[0].breakAfter,v.content.shift()),p.content.length&&g.merge(0,0,p.content[p.content.length-1],!0,0,p.openEnd)&&p.content.pop(),c=p.content.concat(g).concat(v.content)}else{var m=yi.build(this.view.state.doc,u,h,this.decorations,this.dynamicDecorationMap);c=m.content,f=m.breakAtStart,d=m.openStart,O=m.openEnd}var y=r.findPos(l,1),k=y.i,b=y.off,w=r.findPos(s,-1);qn(this,w.i,w.off,k,b,c,f,d,O)}n&&this.fixCompositionDOM(n)}},{key:"compositionView",value:function(t){var e=new Fn(t.text.nodeValue);e.flags|=8;var n,r=i(t.marks);try{for(r.s();!(n=r.n()).done;){var o=n.value.deco;e=new Jn(o,[e],e.length)}}catch(s){r.e(s)}finally{r.f()}var a=new ui;return a.append(e,0),a}},{key:"fixCompositionDOM",value:function(t){var e=this,n=function(t,n){n.flags|=8|(n.children.some((function(t){return 7&t.flags}))?1:0),e.markedForComposition.add(n);var i=Wn.get(t);i&&i!=n&&(i.dom=null),n.setDOM(t)},i=this.childPos(t.range.fromB,1),r=this.children[i.i];n(t.line,r);for(var o=t.marks.length-1;o>=-1;o--)i=r.childPos(i.off,1),r=r.children[i.i],n(o>=0?t.marks[o].node:t.text,r)}},{key:"updateSelection",value:function(){var t=this,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();var n=this.view.root.activeElement,i=n==this.dom,r=!i&&fn(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(i||e||r){var o=this.forceSelection;this.forceSelection=!1;var a,s=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(s.anchor)),u=s.empty?l:this.moveToLine(this.domAtPos(s.head));if(Hn.gecko&&s.empty&&!this.hasComposition&&(1==(a=l).node.nodeType&&a.node.firstChild&&(0==a.offset||"false"==a.node.childNodes[a.offset-1].contentEditable)&&(a.offset==a.node.childNodes.length||"false"==a.node.childNodes[a.offset].contentEditable))){var h=document.createTextNode("");this.view.observer.ignore((function(){return l.node.insertBefore(h,l.node.childNodes[l.offset]||null)})),l=u=new Cn(h,0),o=!0}var c=this.view.observer.selectionRange;!o&&c.focusNode&&(On(l.node,l.offset,c.anchorNode,c.anchorOffset)&&On(u.node,u.offset,c.focusNode,c.focusOffset)||this.suppressWidgetCursorChange(c,s))||(this.view.observer.ignore((function(){Hn.android&&Hn.chrome&&t.dom.contains(c.focusNode)&&function(t,e){for(var n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(c.focusNode,t.dom)&&(t.dom.blur(),t.dom.focus({preventScroll:!0}));var e,i,o=hn(t.view.root);if(o)if(s.empty){if(Hn.gecko){var a=(e=l.node,i=l.offset,1!=e.nodeType?0:(i&&"false"==e.childNodes[i-1].contentEditable?1:0)|(is.head){var d=[u,l];l=d[0],u=d[1]}f.setEnd(u.node,u.offset),f.setStart(l.node,l.offset),o.removeAllRanges(),o.addRange(f)}else;r&&t.view.root.activeElement==t.dom&&(t.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(l,u)),this.impreciseAnchor=l.precise?null:new Cn(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new Cn(c.focusNode,c.focusOffset)}}},{key:"suppressWidgetCursorChange",value:function(t,e){return this.hasComposition&&e.empty&&On(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}},{key:"enforceCursorAssoc",value:function(){if(!this.hasComposition){var t=this.view,e=t.state.selection.main,n=hn(t.root),i=t.observer.selectionRange,r=i.anchorNode,o=i.anchorOffset;if(n&&e.empty&&e.assoc&&n.modify){var a=ui.find(this,e.head);if(a){var s=a.posAtStart;if(e.head!=s&&e.head!=s+a.length){var l=this.coordsAt(e.head,-1),u=this.coordsAt(e.head,1);if(l&&u&&!(l.bottom>u.top)){var h=this.domAtPos(e.head+e.assoc);n.collapse(h.node,h.offset),n.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&&n.collapse(r,o)}}}}}}},{key:"moveToLine",value:function(t){var e,n=this.dom;if(t.node!=n)return t;for(var i=t.offset;!e&&i=0;o--){var a=Wn.get(n.childNodes[o]);a instanceof ui&&(e=a.domAtPos(a.length))}return e?new Cn(e.node,e.offset,!0):t}},{key:"nearest",value:function(t){for(var e=t;e;){var n=Wn.get(e);if(n&&n.rootView==this)return n;e=e.parentNode}return null}},{key:"posFromDOM",value:function(t,e){var n=this.nearest(t);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(t,e)+n.posAtStart}},{key:"domAtPos",value:function(t){for(var e=this.childCursor().findPos(t,-1),n=e.i,i=e.off;n=0;o--){var a=this.children[o],s=r-a.breakAfter,l=s-a.length;if(st||a.covers(1))&&(!n||a instanceof ui&&!(n instanceof ui&&e>=0))&&(n=a,i=l),r=l}return n?n.coordsAt(t-i,e):null}},{key:"coordsForChar",value:function(t){var e=this.childPos(t,1),n=e.i,i=e.off,r=this.children[n];if(!(r instanceof ui))return null;for(;r.children.length;){for(var o=r.childPos(i,1),a=o.i,s=o.off;;a++){if(a==r.children.length)return null;if((r=r.children[a]).length)break}i=s}if(!(r instanceof Fn))return null;var l=wt(r.text,i);if(l==i)return null;for(var u=Pn(r.dom,i,l).getClientRects(),h=0;hMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,s=this.view.textDirection==wi.LTR,l=0,u=0;ui)break;if(l>=n){var f=h.dom.getBoundingClientRect();if(e.push(f.height),o){var d=h.dom.lastChild,O=d?dn(d):[];if(O.length){var p=O[O.length-1],v=s?p.right-f.left:f.right-p.left;v>a&&(a=v,this.minWidth=r,this.minWidthFrom=l,this.minWidthTo=c)}}}l=c+h.breakAfter}return e}},{key:"textDirectionAt",value:function(t){var e=this.childPos(t,1).i;return"rtl"==getComputedStyle(this.children[e].dom).direction?wi.RTL:wi.LTR}},{key:"measureTextSize",value:function(){var t,e=this,n=i(this.children);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r instanceof ui){var o=r.measureTextSize();if(o)return o}}}catch(h){n.e(h)}finally{n.f()}var a,s,l,u=document.createElement("div");return u.className="cm-line",u.style.width="99999px",u.style.position="absolute",u.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((function(){e.dom.appendChild(u);var t=dn(u.firstChild)[0];a=u.getBoundingClientRect().height,s=t?t.width/27:7,l=t?t.height:a,u.remove()})),{lineHeight:a,charWidth:s,textHeight:l}}},{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 Yn(this.children,t,e)}},{key:"computeBlockGapDeco",value:function(){for(var t=[],e=this.view.viewState,n=0,i=0;;i++){var r=i==e.viewports.length?null:e.viewports[i],o=r?r.from-1:this.length;if(o>n){var a=(e.lineBlockAt(o).bottom-e.lineBlockAt(n).top)/this.view.scaleY;t.push(di.replace({widget:new Qr(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!r)break;n=r.to+1}return di.set(t)}},{key:"updateDeco",value:function(){var t=this,n=0,i=this.view.state.facet(fr).map((function(e){return(t.dynamicDecorationMap[n++]="function"==typeof e)?e(t.view):e})),r=!1,o=this.view.state.facet(dr).map((function(e,n){var i="function"==typeof e;return i&&(r=!0),i?e(t.view):e}));for(o.length&&(this.dynamicDecorationMap[n++]=r,i.push(qe.join(o))),this.decorations=[].concat(e(i),[this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]);ns.anchor?-1:1);if(l){!s.empty&&(a=this.coordsAt(s.anchor,s.anchor>s.head?-1:1))&&(l={left:Math.min(l.left,a.left),top:Math.min(l.top,a.top),right:Math.max(l.right,a.right),bottom:Math.max(l.bottom,a.bottom)});var u=mr(this.view),h={left:l.left-u.left,top:l.top-u.top,right:l.right+u.right,bottom:l.bottom+u.bottom},c=this.view.scrollDOM,f=c.offsetWidth,d=c.offsetHeight;!function(t,e,n,i,r,o,a,s){for(var l=t.ownerDocument,u=l.defaultView||window,h=t,c=!1;h&&!c;)if(1==h.nodeType){var f=void 0,d=h==l.body,O=1,p=1;if(d)f=kn(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(c=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}var v=h.getBoundingClientRect(),g=bn(h,v);O=g.scaleX,p=g.scaleY,f={left:v.left,right:v.left+h.clientWidth*O,top:v.top,bottom:v.top+h.clientHeight*p}}var m=0,y=0;if("nearest"==r)e.top0&&e.bottom>f.bottom+y&&(y=e.bottom-f.bottom+y+a)):e.bottom>f.bottom&&(y=e.bottom-f.bottom+a,n<0&&e.top-y0&&e.right>f.right+m&&(m=e.right-f.right+m+o)):e.right>f.right&&(m=e.right-f.right+o,n<0&&e.leftt?e.left-t:Math.max(0,t-e.right)}function $r(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function Zr(t,e){return t.tope.top+1}function Rr(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function Ar(t,e,n){for(var i,r,o,a,s,l,u,h,c=!1,f=t.firstChild;f;f=f.nextSibling)for(var d=dn(f),O=0;Og||a==g&&o>v){i=f,r=p,o=v,a=g;var m=g?n0?O0)}0==v?n>p.bottom&&(!u||u.bottomp.top)&&(l=f,h=p):u&&Zr(u,p)?u=Tr(u,p.bottom):h&&Zr(h,p)&&(h=Rr(h,p.top))}if(u&&u.bottom>=n?(i=s,r=u):h&&h.top<=n&&(i=l,r=h),!i)return{node:t,offset:0};var y=Math.max(r.left,Math.min(r.right,e));return 3==i.nodeType?Cr(i,y,n):c&&"false"!=i.contentEditable?Ar(i,y,n):{node:t,offset:Array.prototype.indexOf.call(t.childNodes,i)+(e>=(r.left+r.right)/2?1:0)}}function Cr(t,e,n){for(var i=t.nodeValue.length,r=-1,o=1e9,a=0,s=0;sn?h.top-n:n-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&c=(h.left+h.right)/2,d=f;if(Hn.chrome||Hn.gecko)Pn(t,s).getBoundingClientRect().left==h.right&&(d=!f);if(c<=0)return{node:t,offset:s+(d?1:0)};r=s+(d?1:0),o=c}}}return{node:t,offset:r>-1?r:a>0?t.nodeValue.length:0}}function Mr(t,e,n){var i,r,o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,s=t.contentDOM.getBoundingClientRect(),l=s.top+t.viewState.paddingTop,u=t.viewState.docHeight,h=e.x,c=e.y,f=c-l;if(f<0)return 0;if(f>u)return t.state.doc.length;for(var d=t.viewState.heightOracle.textHeight/2,O=!1;(o=t.elementAtHeight(f)).type!=fi.Text;)for(;!((f=a>0?o.bottom+d:o.top-d)>=0&&f<=u);){if(O)return n?null:0;O=!0,a=-a}c=l+f;var p=o.from;if(pt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:Wr(t,s,o,h,c);var v=t.dom.ownerDocument,g=t.root.elementFromPoint?t.root:v,m=g.elementFromPoint(h,c);m&&!t.contentDOM.contains(m)&&(m=null),m||(h=Math.max(s.left+1,Math.min(s.right-1,h)),(m=g.elementFromPoint(h,c))&&!t.contentDOM.contains(m)&&(m=null));var y,k=-1;if(m&&0!=(null===(i=t.docView.nearest(m))||void 0===i?void 0:i.isEditable))if(v.caretPositionFromPoint){var b=v.caretPositionFromPoint(h,c);b&&(y=b.offsetNode,k=b.offset)}else if(v.caretRangeFromPoint){var w=v.caretRangeFromPoint(h,c);w&&(y=w.startContainer,k=w.startOffset,(!t.contentDOM.contains(y)||Hn.safari&&function(t,e,n){var i;if(3!=t.nodeType||e!=(i=t.nodeValue.length))return!1;for(var r=t.nextSibling;r;r=r.nextSibling)if(1!=r.nodeType||"BR"!=r.nodeName)return!1;return Pn(t,i-1,i).getBoundingClientRect().left>n}(y,k,h)||Hn.chrome&&function(t,e,n){if(0!=e)return!1;for(var i=t;;){var r=i.parentNode;if(!r||1!=r.nodeType||r.firstChild!=i)return!1;if(r.classList.contains("cm-line"))break;i=r}var o=1==t.nodeType?t.getBoundingClientRect():Pn(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-o.left>5}(y,k,h))&&(y=void 0))}if(!y||!t.docView.dom.contains(y)){var Q=ui.find(t.docView,p);if(!Q)return f>o.top+o.height/2?o.to:o.from;var x=Ar(Q.dom,h,c);y=x.node,k=x.offset}var S=t.docView.nearest(y);if(!S)return null;if(S.isWidget&&1==(null===(r=S.dom)||void 0===r?void 0:r.nodeType)){var P=S.dom.getBoundingClientRect();return e.y1.5*t.defaultLineHeight){var a=t.viewState.heightOracle.textHeight;o+=Math.floor((r-n.top-.5*(t.defaultLineHeight-a))/a)*t.viewState.heightOracle.lineLength}var s=t.state.sliceDoc(n.from,n.to);return n.from+He(s,o,t.state.tabSize)}function Xr(t,e){var n=t.lineBlockAt(e);if(Array.isArray(n.type)){var r,o=i(n.type);try{for(o.s();!(r=o.n()).done;){var a=r.value;if(a.to>e||a.to==e&&(a.to==n.to||a.type==fi.Text))return a}}catch(s){o.e(s)}finally{o.f()}}return n}function Yr(t,e,n,i){for(var r=t.state.doc.lineAt(e.head),o=t.bidiSpans(r),a=t.textDirectionAt(r.from),s=e,l=null;;){var u=Ui(r,o,a,s,n),h=Vi;if(!u){if(r.number==(n?t.state.doc.lines:1))return s;h="\n",r=t.state.doc.line(r.number+(n?1:-1)),o=t.bidiSpans(r),u=t.visualLineSide(r,!n)}if(l){if(!l(h))return s}else{if(!i)return u;l=i(h)}s=u}}function qr(t,e,n){for(var r,o=function(){var r,o=0,a=i(t);try{for(a.s();!(r=a.n()).done;){r.value.between(e-1,e+1,(function(t,i,r){if(e>t&&en.from?-1:1);return i==n.from?n:Et.cursor(i,i-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout((function(){return n.flushIOSKey()}),250),!0):(this.view.observer.delayAndroidKey(t.key,t.keyCode),!0))}},{key:"flushIOSKey",value:function(t){var e=this.pendingIOSKey;return!!e&&(!("Enter"==e.key&&t&&t.from0||!!(Hn.safari&&!Hn.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}},{key:"startMouseSelection",value:function(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}},{key:"update",value:function(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}},{key:"destroy",value:function(){this.mouseSelection&&this.mouseSelection.destroy()}}]),t}();function Dr(t,e){return function(n,i){try{return e.call(t,i,n)}catch(op){rr(n.state,op)}}}function Er(t){var e=Object.create(null);function n(t){return e[t]||(e[t]={observers:[],handlers:[]})}var r,o=i(t);try{for(o.s();!(r=o.n()).done;){var a=r.value,s=a.spec;if(s&&s.domEventHandlers)for(var l in s.domEventHandlers){var u=s.domEventHandlers[l];u&&n(l).handlers.push(Dr(a.value,u))}if(s&&s.domEventObservers)for(var h in s.domEventObservers){var c=s.domEventObservers[h];c&&n(h).observers.push(Dr(a.value,c))}}}catch(O){o.e(O)}finally{o.f()}for(var f in Ir)n(f).handlers.push(Ir[f]);for(var d in Gr)n(d).observers.push(Gr[d]);return e}var _r=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Vr="dthko",Ur=[16,17,18,20,91,92,224,225];function Nr(t){return.7*Math.max(0,t)+8}var Br=function(){function t(e,n,i,r){O(this,t),this.view=e,this.startEvent=n,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParent=function(t){for(var e=t.ownerDocument,n=t.parentNode;n&&n!=e.body;)if(1==n.nodeType){if(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else{if(11!=n.nodeType)break;n=n.host}return null}(e.contentDOM),this.atoms=e.state.facet(Or).map((function(t){return t(e)}));var o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Ae.allowMultipleSelections)&&function(t,e){var n=t.state.facet(Bi);return n.length?n[0](e):Hn.mac?e.metaKey:e.ctrlKey}(e,n),this.dragging=!(!function(t,e){var n=t.state.selection.main;if(n.empty)return!1;var i=hn(t.root);if(!i||0==i.rangeCount)return!0;for(var r=i.getRangeAt(0).getClientRects(),o=0;o=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}(e,n)||1!=ao(n))&&null}return v(t,[{key:"start",value:function(t){!1===this.dragging&&this.select(t)}},{key:"move",value:function(t){var e;if(0==t.buttons)return this.destroy();if(!(this.dragging||null==this.dragging&&(n=this.startEvent,i=t,Math.max(Math.abs(n.clientX-i.clientX),Math.abs(n.clientY-i.clientY))<10))){var n,i;this.select(this.lastEvent=t);var r=0,o=0,a=(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},s=mr(this.view);t.clientX-s.left<=a.left+6?r=-Nr(a.left-t.clientX):t.clientX+s.right>=a.right-6&&(r=Nr(t.clientX-a.right)),t.clientY-s.top<=a.top+6?o=-Nr(a.top-t.clientY):t.clientY+s.bottom>=a.bottom-6&&(o=Nr(t.clientY-a.bottom)),this.setScrollSpeed(r,o)}}},{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=this.view.inputState.draggedContent=null}},{key:"setScrollSpeed",value:function(t,e){var n=this;this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval((function(){return n.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:"skipAtoms",value:function(t){for(var e=null,n=0;n2&&void 0!==arguments[2]?arguments[2]:1,i=t.charCategorizer(e),r=t.doc.lineAt(e),o=e-r.from;if(0==r.length)return Et.cursor(e);0==o?n=1:o==r.length&&(n=-1);var a=o,s=o;n<0?a=wt(r.text,o,!1):s=wt(r.text,o);for(var l=i(r.text.slice(a,s));a>0;){var u=wt(r.text,a,!1);if(i(r.text.slice(u,a))!=l)break;a=u}for(;sDate.now()-2e3)return!1;var n,r=null,o=i(t.state.facet(Gi));try{for(o.s();!(n=o.n()).done;){if(r=(0,n.value)(t,e))break}}catch(l){o.e(l)}finally{o.f()}if(r||0!=e.button||(r=function(t,e){var n=eo(t,e),i=ao(e),r=t.state.selection;return{update:function(t){t.docChanged&&(n.pos=t.changes.mapPos(n.pos),r=r.map(t.changes))},get:function(e,o,a){var s,l=eo(t,e),u=Fr(t,l.pos,l.bias,i);if(n.pos!=l.pos&&!o){var h=Fr(t,n.pos,n.bias,i),c=Math.min(h.from,u.from),f=Math.max(h.to,u.to);u=c1&&(s=function(t,e){for(var n=0;n=e)return Et.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}(r,l.pos))?s:a?r.addRange(u):Et.create([u])}}}(t,e)),r){var a=!t.hasFocus;t.inputState.startMouseSelection(new Br(t,e,r,a)),a&&t.observer.ignore((function(){return Sn(t.contentDOM)}));var s=t.inputState.mouseSelection;if(s)return s.start(e),!1===s.dragging}return!1};var Jr=function(t,e){return t>=e.top&&t<=e.bottom},Kr=function(t,e,n){return Jr(e,n)&&t>=n.left&&t<=n.right};function to(t,e,n,i){var r=ui.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 a=r.coordsAt(o,-1);if(a&&Kr(n,i,a))return-1;var s=r.coordsAt(o,1);return s&&Kr(n,i,s)?1:a&&Jr(i,a)?-1:1}function eo(t,e){var n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:to(t,n,e.clientX,e.clientY)}}var no=Hn.ie&&Hn.ie_version<=11,io=null,ro=0,oo=0;function ao(t){if(!no)return t.detail;var e=io,n=oo;return io=t,oo=Date.now(),ro=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(ro+1)%3:1}function so(t,e,n,i){if(n){var r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),o=t.inputState.draggedContent,a=i&&o&&function(t,e){var n=t.state.facet(Ii);return n.length?n[0](e):Hn.mac?!e.altKey:!e.ctrlKey}(t,e)?{from:o.from,to:o.to}:null,s={from:r,insert:n},l=t.state.changes(a?[a,s]:s);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:a?"move.drop":"input.drop"}),t.inputState.draggedContent=null}}Ir.dragstart=function(t,e){var n=t.state.selection.main;if(e.target.draggable){var i=t.docView.nearest(e.target);if(i&&i.isWidget){var r=i.posAtStart,o=r+i.length;(r>=n.to||o<=n.from)&&(n=Et.range(r,o))}}var a=t.inputState;return a.mouseSelection&&(a.mouseSelection.dragging=!0),a.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(n.from,n.to)),e.dataTransfer.effectAllowed="copyMove"),!1},Ir.dragend=function(t){return t.inputState.draggedContent=null,!1},Ir.drop=function(t,e){if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;var n=e.dataTransfer.files;if(n&&n.length){for(var i=Array(n.length),r=0,o=function(){++r==n.length&&so(t,e,i.filter((function(t){return null!=t})).join(t.state.lineBreak),!1)},a=function(t){var e=new FileReader;e.onerror=o,e.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(e.result)||(i[t]=e.result),o()},e.readAsText(n[t])},s=0;su&&(n.push(f.text),r.push({from:f.from,to:Math.min(t.doc.length,f.to+1)})),u=f.number}}catch(d){h.e(d)}finally{h.f()}o=!0}return{text:n.join(t.lineBreak),ranges:r,linewise:o}}(t.state),r=n.text,o=n.ranges,a=n.linewise;if(!r&&!a)return!1;lo=a?r:null,"cut"!=e.type||t.state.readOnly||t.dispatch({changes:o,scrollIntoView:!0,userEvent:"delete.cut"});var s=Lr?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",r),!0):(function(t,e){var n=t.dom.parentNode;if(n){var i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout((function(){i.remove(),t.focus()}),50)}}(t,r),!1)};var uo=ve.define();function ho(t,e){var n,r=[],o=i(t.facet(Ji));try{for(o.s();!(n=o.n()).done;){var a=(0,n.value)(t,e);a&&r.push(a)}}catch(s){o.e(s)}finally{o.f()}return r?t.update({effects:r,annotations:uo.of(!0)}):null}function co(t){setTimeout((function(){var e=t.hasFocus;if(e!=t.inputState.notifiedFocused){var n=ho(t.state,e);n?t.dispatch(n):t.update([])}}),10)}Gr.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),co(t)},Gr.blur=function(t){t.observer.clearSelectionRange(),co(t)},Gr.compositionstart=Gr.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},Gr.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,Hn.chrome&&Hn.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((function(){return t.observer.flush()})):setTimeout((function(){t.inputState.composing<0&&t.docView.hasComposition&&t.update([])}),50)},Gr.contextmenu=function(t){t.inputState.lastContextMenu=Date.now()},Ir.beforeinput=function(t,e){var n,i;if(Hn.chrome&&Hn.android&&(i=_r.find((function(t){return t.inputType==e.inputType})))&&(t.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){var r=(null===(n=window.visualViewport)||void 0===n?void 0:n.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)}return Hn.ios&&"deleteContentForward"==e.inputType&&t.observer.flushSoon(),Hn.safari&&"insertText"==e.inputType&&t.inputState.composing>=0&&setTimeout((function(){return Gr.compositionend(t,e)}),20),!1};var fo=new Set;var Oo=["pre-wrap","normal","pre-line","break-spaces"],po=function(){function t(e){O(this,t),this.lineWrapping=e,this.doc=st.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}return v(t,[{key:"heightForGap",value:function(t,e){var n=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((e-t-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}},{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 Oo.indexOf(t)>-1!=this.lineWrapping}},{key:"mustRefreshForHeights",value:function(t){for(var e=!1,n=0;n-1,s=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=e,this.charWidth=n,this.textHeight=i,this.lineLength=r,s){this.heightSamples={};for(var l=0;l2&&void 0!==arguments[2]?arguments[2]:2;O(this,t),this.length=e,this.height=n,this.flags=i}return v(t,[{key:"outdated",get:function(){return(2&this.flags)>0},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)>yo&&(t.heightChanged=!0),this.height=e)}},{key:"replace",value:function(e,n,i){return t.of(i)}},{key:"decomposeLeft",value:function(t,e){e.push(this)}},{key:"decomposeRight",value:function(t,e){e.push(this)}},{key:"applyChanges",value:function(t,e,n,i){for(var r=this,o=n.doc,a=i.length-1;a>=0;a--){var s=i[a],l=s.fromA,u=s.toA,h=s.fromB,c=s.toB,f=r.lineAt(l,mo.ByPosNoHeight,n.setDoc(e),0,0),d=f.to>=u?f:r.lineAt(u,mo.ByPosNoHeight,n,0,0);for(c+=d.to-u,u=d.to;a>0&&f.from<=i[a-1].toA;)l=i[a-1].fromA,h=i[a-1].fromB,a--,l2*o){var a=e[n-1];a.break?e.splice(--n,1,a.left,null,a.right):e.splice(--n,1,a.left,a.right),i+=1+a.break,r-=a.size}else{if(!(o>2*r))break;var s=e[i];s.break?e.splice(i,1,s.left,null,s.right):e.splice(i,1,s.left,s.right),i+=2+s.break,o-=s.size}else if(r=r&&o(this.blockAt(0,n,i,r))}},{key:"updateHeight",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>3?arguments[3]:void 0;return n&&n.from<=e&&n.more&&this.setHeight(t,n.heights[n.index++]),this.outdated=!1,this}},{key:"toString",value:function(){return"block(".concat(this.length,")")}}]),e}(ko),wo=function(t){function e(t,n){var i;return O(this,e),(i=r(this,e,[t,n,null])).collapsed=0,i.widgetHeight=0,i.breaks=0,i}return u(e,t),v(e,[{key:"blockAt",value:function(t,e,n,i){return new go(i,this.length,n,this.height,this.breaks)}},{key:"replace",value:function(t,n,i){var r=i[0];return 1==i.length&&(r instanceof e||r instanceof Qo&&4&r.flags)&&Math.abs(this.length-r.length)<10?(r instanceof Qo?r=new e(r.length,this.height):r.height=this.height,this.outdated||(r.outdated=!1),r):ko.of(i)}},{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],i=arguments.length>3?arguments[3]:void 0;return i&&i.from<=e&&i.more?this.setHeight(t,i.heights[i.index++]):(n||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}},{key:"toString",value:function(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")")}}]),e}(bo),Qo=function(t){function e(t){return O(this,e),r(this,e,[t,0])}return u(e,t),v(e,[{key:"heightMetrics",value:function(t,e){var n,i=t.doc.lineAt(e).number,r=t.doc.lineAt(e+this.length).number,o=r-i+1,a=0;if(t.lineWrapping){var s=Math.min(this.height,t.lineHeight*o);n=s/o,this.length>o+1&&(a=(this.height-s)/(this.length-o-1))}else n=this.height/o;return{firstLine:i,lastLine:r,perLine:n,perChar:a}}},{key:"blockAt",value:function(t,e,n,i){var r=this.heightMetrics(e,i),o=r.firstLine,a=r.lastLine,s=r.perLine,l=r.perChar;if(e.lineWrapping){var u=i+(t0){var o=i[i.length-1];o instanceof e?i[i.length-1]=new e(o.length+r):i.push(null,new e(r-1))}if(t>0){var a=i[0];a instanceof e?i[0]=new e(t+a.length):i.unshift(new e(t-1),null)}return ko.of(i)}},{key:"decomposeLeft",value:function(t,n){n.push(new e(t-1),null)}},{key:"decomposeRight",value:function(t,n){n.push(null,new e(this.length-t-1))}},{key:"updateHeight",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,o=n+this.length;if(r&&r.from<=n+this.length&&r.more){var a=[],s=Math.max(n,r.from),l=-1;for(r.from>n&&a.push(new e(r.from-n-1).updateHeight(t,n));s<=o&&r.more;){var u=t.doc.lineAt(s).length;a.length&&a.push(null);var h=r.heights[r.index++];-1==l?l=h:Math.abs(h-l)>=yo&&(l=-2);var c=new wo(u,h);c.outdated=!1,a.push(c),s+=u+1}s<=o&&a.push(null,new e(o-s).updateHeight(t,s));var f=ko.of(a);return(l<0||Math.abs(f.height-this.height)>=yo||Math.abs(l-this.heightMetrics(t,n).perLine)>=yo)&&(t.heightChanged=!0),f}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(n,n+this.length)),this.outdated=!1),this}},{key:"toString",value:function(){return"gap(".concat(this.length,")")}}]),e}(ko),xo=function(t){function e(t,n,i){var o;return O(this,e),(o=r(this,e,[t.length+n+i.length,t.height+i.height,n|(t.outdated||i.outdated?2:0)])).left=t,o.right=i,o.size=t.size+i.size,o}return u(e,t),v(e,[{key:"break",get:function(){return 1&this.flags}},{key:"blockAt",value:function(t,e,n,i){var r=n+this.left.height;return ta))return l;var u=e==mo.ByPosNoHeight?mo.ByPosNoHeight:mo.ByPos;return s?l.join(this.right.lineAt(a,u,n,o,a)):this.left.lineAt(a,u,n,i,r).join(l)}},{key:"forEachLine",value:function(t,e,n,i,r,o){var a=i+this.left.height,s=r+this.left.length+this.break;if(this.break)t=s&&this.right.forEachLine(t,e,n,a,s,o);else{var l=this.lineAt(s,mo.ByPos,n,i,r);t=t&&l.from<=e&&o(l),e>l.to&&this.right.forEachLine(l.to+1,e,n,a,s,o)}}},{key:"replace",value:function(t,e,n){var r=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-r,e-r,n));var o=[];t>0&&this.decomposeLeft(t,o);var a,s=o.length,l=i(n);try{for(l.s();!(a=l.n()).done;){var u=a.value;o.push(u)}}catch(c){l.e(c)}finally{l.f()}if(t>0&&So(o,s-1),e=++n&&e.push(null),t>n&&this.right.decomposeLeft(t-n,e)}},{key:"decomposeRight",value:function(t,e){var n=this.left.length,i=n+this.break;if(t>=i)return this.right.decomposeRight(t-i,e);t2*e.size||e.size>2*t.size?ko.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,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0,r=this.left,o=this.right,a=e+r.length+this.break,s=null;return i&&i.from<=e+r.length&&i.more?s=r=r.updateHeight(t,e,n,i):r.updateHeight(t,e,n),i&&i.from<=a+o.length&&i.more?s=o=o.updateHeight(t,a,n,i):o.updateHeight(t,a,n),s?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}},{key:"toString",value:function(){return this.left+(this.break?" ":"-")+this.right}}]),e}(ko);function So(t,e){var n,i;null==t[e]&&(n=t[e-1])instanceof Qo&&(i=t[e+1])instanceof Qo&&t.splice(e-1,3,new Qo(n.length+1+i.length))}var Po=function(){function t(e,n){O(this,t),this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}return v(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 n=Math.min(e,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof wo?i.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new wo(n-this.pos,-1)),this.writtenTo=n,e>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}},{key:"point",value:function(t,e,n){if(t=5)&&this.addLineDeco(i,r,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)){var t=this.oracle.doc.lineAt(this.pos),e=t.from,n=t.to;this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new wo(this.pos-e,-1)),this.writtenTo=this.pos}}},{key:"blankContent",value:function(t,e){var n=new Qo(e-t);return this.oracle.doc.lineAt(t).to==e&&(n.flags|=4),n}},{key:"ensureLine",value:function(){this.enterLine();var t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof wo)return t;var e=new wo(0,-1);return this.nodes.push(e),e}},{key:"addBlock",value:function(t){this.enterLine();var e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}},{key:"addLineDeco",value:function(t,e,n){var i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,t),i.breaks+=e,this.writtenTo=this.pos=this.pos+n}},{key:"finish",value:function(t){var e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof wo||this.isCovered?(this.writtenToh.clientHeight||h.scrollWidth>h.clientWidth)&&"visible"!=c.overflow){var f=h.getBoundingClientRect();o=Math.max(o,f.left),a=Math.min(a,f.right),s=Math.max(s,f.top),l=u==t.parentNode?f.bottom:Math.min(l,f.bottom)}u="absolute"==c.position||"fixed"==c.position?h.offsetParent:h.parentNode}else{if(11!=u.nodeType)break;u=u.host}return{left:o-n.left,right:Math.max(o,a)-n.left,top:s-(n.top+e),bottom:Math.max(s,l)-(n.top+e)}}function Ro(t,e){var n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}var To=function(){function t(e,n,i){O(this,t),this.from=e,this.to=n,this.size=i}return v(t,[{key:"draw",value:function(t,e){return di.replace({widget:new Ao(this.size*(e?t.scaleY:t.scaleX),e)}).range(this.from,this.to)}}],[{key:"same",value:function(t,e){if(t.length!=e.length)return!1;for(var n=0;n=e&&i<=n}))){var o=t.lineBlockAt(i),a=o.from,s=o.to;e.push(new Mo(a,s))}},r=0;r<=1;r++)i();this.viewports=e.sort((function(t,e){return t.from-e.from})),this.scaler=this.heightMap.height<=7e6?qo:new jo(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:zo(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 n=this.stateDeco;this.stateDeco=this.state.facet(fr).filter((function(t){return"function"!=typeof t}));var i,r,o,a,s=t.changedRanges,l=kr.extendWithRanges(s,(i=n,r=this.stateDeco,o=t?t.changes:Mt.empty(this.state.doc.length),a=new $o,qe.compare(i,r,o,a,0),a.changes)),u=this.heightMap.height,h=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),l),this.heightMap.height!=u&&(t.flags|=2),h?(this.scrollAnchorPos=t.changes.mapPos(h.from,-1),this.scrollAnchorHeight=h.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);var c=l.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.headc.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,e));var f=!t.changes.empty||2&t.flags||c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,this.updateForViewport(),f&&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(tr)&&(this.mustEnforceCursorAssoc=!0)}},{key:"measure",value:function(t){var e=t.contentDOM,n=window.getComputedStyle(e),r=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?wi.RTL:wi.LTR;var a=this.heightOracle.mustRefreshForWrapping(o),s=e.getBoundingClientRect(),l=a||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;var u=0,h=0;if(s.width&&s.height){var c=bn(e,s),f=c.scaleX,d=c.scaleY;(f>.005&&Math.abs(this.scaleX-f)>.005||d>.005&&Math.abs(this.scaleY-d)>.005)&&(this.scaleX=f,this.scaleY=d,u|=8,a=l=!0)}var O=(parseInt(n.paddingTop)||0)*this.scaleY,p=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==O&&this.paddingBottom==p||(this.paddingTop=O,this.paddingBottom=p,u|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(r.lineWrapping&&(l=!0),this.editorWidth=t.scrollDOM.clientWidth,u|=8);var v=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=v&&(this.scrollAnchorHeight=-1,this.scrollTop=v),this.scrolledToBottom=Rn(t.scrollDOM);var g=(this.printing?Ro:Zo)(e,this.paddingTop),m=g.top-this.pixelViewport.top,y=g.bottom-this.pixelViewport.bottom;this.pixelViewport=g;var k=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(k!=this.inView&&(this.inView=k,k&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;var b=s.width;if(this.contentDOMWidth==b&&this.editorHeight==t.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=t.scrollDOM.clientHeight,u|=8),l){var w=t.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(w)&&(a=!0),a||r.lineWrapping&&Math.abs(b-this.contentDOMWidth)>r.charWidth){var Q=t.docView.measureTextSize(),x=Q.lineHeight,S=Q.charWidth,P=Q.textHeight;(a=x>0&&r.refresh(o,x,S,P,b/S,w))&&(t.docView.minWidth=0,u|=8)}m>0&&y>0?h=Math.max(m,y):m<0&&y<0&&(h=Math.min(m,y)),r.heightChanged=!1;var $,Z=i(this.viewports);try{for(Z.s();!($=Z.n()).done;){var R=$.value,T=R.from==this.viewport.from?w:t.docView.measureVisibleLineHeights(R);this.heightMap=(a?ko.empty().applyChanges(this.stateDeco,st.empty,this.heightOracle,[new kr(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new vo(R.from,T))}}catch(C){Z.e(C)}finally{Z.f()}r.heightChanged&&(u|=2)}var A=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return A&&(this.viewport=this.getViewport(h,this.scrollTarget)),this.updateForViewport(),(2&u||A)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,t)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),u}},{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 n=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),i=this.heightMap,r=this.heightOracle,o=this.visibleTop,a=this.visibleBottom,s=new Mo(i.lineAt(o-1e3*n,mo.ByHeight,r,0,0).from,i.lineAt(a+1e3*(1-n),mo.ByHeight,r,0,0).to);if(e){var l=e.range.head;if(ls.to){var u,h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=i.lineAt(l,mo.ByPos,r,0,0);u="center"==e.y?(c.top+c.bottom)/2-h/2:"start"==e.y||"nearest"==e.y&&l1&&void 0!==arguments[1]?arguments[1]:0;if(!this.inView)return!0;var r=this.heightMap.lineAt(e,mo.ByPos,this.heightOracle,0,0).top,o=this.heightMap.lineAt(n,mo.ByPos,this.heightOracle,0,0).bottom,a=this.visibleTop,s=this.visibleBottom;return(0==e||r<=a-Math.max(10,Math.min(-i,250)))&&(n==this.state.doc.length||o>=s+Math.max(10,Math.min(i,250)))&&r>a-2e3&&o>1,s=o<<1;if(this.defaultTextDirection!=wi.LTR&&!r)return[];var l,u=[],h=function o(s,l,h,c){if(!(l-ss&&v=h.from&&t.to<=h.to&&Math.abs(t.from-s)e}))}));if(!g){if(l=l}))){var m=e.moveToLineBoundary(Et.cursor(l),!1,!0).head;m>s&&(l=m)}g=new To(s,l,n.gapSize(h,s,l,c))}u.push(g)}},c=i(this.viewportLines);try{for(c.s();!(l=c.n()).done;){var f=l.value;if(!(f.lengthf.from&&h(f.from,p,f,d),v=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find((function(e){return e.from<=t&&e.to>=t}))||zo(this.heightMap.lineAt(t,mo.ByPos,this.heightOracle,0,0),this.scaler)}},{key:"lineBlockAtHeight",value:function(t){return zo(this.heightMap.lineAt(this.scaler.fromDOM(t),mo.ByHeight,this.heightOracle,0,0),this.scaler)}},{key:"scrollAnchorAt",value:function(t){var e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}},{key:"elementAtHeight",value:function(t){return zo(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}(),Mo=v((function t(e,n){O(this,t),this.from=e,this.to=n}));function Wo(t,e,n){var i=[],r=t,o=0;return qe.spans(n,t,e,{span:function(){},point:function(t,e){t>r&&(i.push({from:r,to:t}),o+=t-r),r=e}},20),r=1)return i[i.length-1].to;for(var r=Math.floor(n*e),o=0;;o++){var a=i[o],s=a.from,l=a.to-s;if(r<=l)return s+r;r-=l}}function Yo(t,e){var n,r=0,o=i(t.ranges);try{for(o.s();!(n=o.n()).done;){var a=n.value,s=a.from,l=a.to;if(e<=l){r+=e-s;break}r+=l-s}}catch(u){o.e(u)}finally{o.f()}return r/t.total}var qo={toDOM:function(t){return t},fromDOM:function(t){return t},scale:1},jo=function(){function t(e,n,r){O(this,t);var o=0,a=0,s=0;this.viewports=r.map((function(t){var i=t.from,r=t.to,a=n.lineAt(i,mo.ByPos,e,0,0).top,s=n.lineAt(r,mo.ByPos,e,0,0).bottom;return o+=s-a,{from:i,to:r,top:a,bottom:s,domTop:0,domBottom:0}})),this.scale=(7e6-o)/(n.height-o);var l,u=i(this.viewports);try{for(u.s();!(l=u.n()).done;){var h=l.value;h.domTop=s+(h.top-a)*this.scale,s=h.domBottom=h.domTop+(h.bottom-h.top),a=h.bottom}}catch(c){u.e(c)}finally{u.f()}}return v(t,[{key:"toDOM",value:function(t){for(var e=0,n=0,i=0;;e++){var r=e-1}}),_o=tn.newName(),Vo=tn.newName(),Uo=tn.newName(),No={"&light":"."+Vo,"&dark":"."+Uo};function Bo(t,e,n){return new tn(e,{finish:function(e){return/&/.test(e)?e.replace(/&\w*/,(function(e){if("&"==e)return t;if(!n||!n[e])throw new RangeError("Unsupported selector: ".concat(e));return n[e]})):t+" "+e}})}var Io=Bo("."+_o,{"&":{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",minHeight:"100%",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"}},"&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"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&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",insetInlineStart: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,\')',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"}},No),Go="￿",Lo=function(){function t(e,n){O(this,t),this.points=e,this.text="",this.lineSeparator=n.facet(Ae.lineSeparator)}return v(t,[{key:"append",value:function(t){this.text+=t}},{key:"lineBreak",value:function(){this.text+=Go}},{key:"readRange",value:function(t,e){if(!t)return this;for(var n=t.parentNode,i=t;;){this.findPointBefore(n,i);var r=this.text.length;this.readNode(i);var o=i.nextSibling;if(o==e)break;var a=Wn.get(i),s=Wn.get(o);(a&&s?a.breakAfter:(a?a.breakAfter:vn(i))||vn(o)&&("BR"!=i.nodeName||i.cmIgnore)&&this.text.length>r)&&this.lineBreak(),i=o}return this.findPointBefore(n,e),this}},{key:"readTextNode",value:function(t){var e,n=t.nodeValue,r=i(this.points);try{for(r.s();!(e=r.n()).done;){var o=e.value;o.node==t&&(o.pos=this.text.length+Math.min(o.offset,n.length))}}catch(O){r.e(O)}finally{r.f()}for(var a=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){var l=-1,u=1,h=void 0;if(this.lineSeparator?(l=n.indexOf(this.lineSeparator,a),u=this.lineSeparator.length):(h=s.exec(n))&&(l=h.index,u=h[0].length),this.append(n.slice(a,l<0?n.length:l)),l<0)break;if(this.lineBreak(),u>1){var c,f=i(this.points);try{for(f.s();!(c=f.n()).done;){var d=c.value;d.node==t&&d.pos>this.text.length&&(d.pos-=u-1)}}catch(O){f.e(O)}finally{f.f()}}a=l+u}}},{key:"readNode",value:function(t){if(!t.cmIgnore){var e=Wn.get(t),n=e&&e.overrideDOMText;if(null!=n){this.findPointInside(t,n.length);for(var i=n.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.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 n,r=i(this.points);try{for(r.s();!(n=r.n()).done;){var o=n.value;o.node==t&&t.childNodes[o.offset]==e&&(o.pos=this.text.length)}}catch(a){r.e(a)}finally{r.f()}}},{key:"findPointInside",value:function(t,e){var n,r=i(this.points);try{for(r.s();!(n=r.n()).done;){var o=n.value;(3==t.nodeType?o.node==t:t.contains(o.node))&&(o.pos=this.text.length+(Ho(t,o.node,o.offset)?e:0))}}catch(a){r.e(a)}finally{r.f()}}}]),t}();function Ho(t,e,n){for(;;){if(!e||n-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,i,0))){var l=a||s?[]:function(t){var e=[];if(t.root.activeElement!=t.contentDOM)return e;var n=t.observer.selectionRange,i=n.anchorNode,r=n.anchorOffset,o=n.focusNode,a=n.focusOffset;i&&(e.push(new Fo(i,r)),o==i&&a==r||e.push(new Fo(o,a)));return e}(e),u=new Lo(l,e.state);u.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=u.text,this.newSel=function(t,e){if(0==t.length)return null;var n=t[0].pos,i=2==t.length?t[1].pos:n;return n>-1&&i>-1?Et.single(n+e,i+e):null}(l,this.bounds.from)}else{var h=e.observer.selectionRange,c=a&&a.node==h.focusNode&&a.offset==h.focusOffset||!cn(e.contentDOM,h.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(h.focusNode,h.focusOffset),f=s&&s.node==h.anchorNode&&s.offset==h.anchorOffset||!cn(e.contentDOM,h.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(h.anchorNode,h.anchorOffset),d=e.viewport;if((Hn.ios||Hn.chrome)&&e.state.selection.main.empty&&c!=f&&(d.from>0||d.toDate.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){var a=e.bounds,s=a.from,l=a.to,u=r.from,h=null;(8===o||Hn.android&&e.text.length0&&s>0&&t.charCodeAt(a-1)==e.charCodeAt(s-1);)a--,s--;if("end"==i){n-=a+Math.max(0,o-Math.min(a,s))-o}if(a=a?o-n:0)+(s-a),a=o}else if(s=s?o-n:0)+(a-s),s=o}return{from:o,toA:a,toB:s}}(t.state.doc.sliceString(s,l,Go),e.text,u-s,h);c&&(Hn.chrome&&13==o&&c.toB==c.from+2&&e.text.slice(c.from,c.toB)==Go+Go&&c.toB--,n={from:s+c.from,to:s+c.toA,insert:st.of(e.text.slice(c.from,c.toB).split(Go))})}else i&&(!t.hasFocus&&t.state.facet(or)||i.main.eq(r))&&(i=null);if(!n&&!i)return!1;if(!n&&e.typeOver&&!r.empty&&i&&i.main.empty?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,r.to)}:n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,r.to))}:(Hn.mac||Hn.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=Et.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:st.of([" "])}):Hn.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&t.lineWrapping&&(i&&(i=Et.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:st.of([" "])}),n){if(Hn.ios&&t.inputState.flushIOSKey(n))return!0;if(Hn.android&&(n.to==r.to&&(n.from==r.from||n.from==r.from-1&&" "==t.state.sliceDoc(n.from,r.from))&&1==n.insert.length&&2==n.insert.lines&&$n(t.contentDOM,"Enter",13)||(n.from==r.from-1&&n.to==r.to&&0==n.insert.length||8==o&&n.insert.lengthr.head)&&$n(t.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&$n(t.contentDOM,"Delete",46)))return!0;var f,d=n.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;var O=function(){return f||(f=function(t,e,n){var i,r=t.state,o=r.selection.main;if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){var a=o.frome.to?r.sliceDoc(e.to,o.to):"";i=r.replaceSelection(t.state.toText(a+e.insert.sliceString(0,void 0,t.state.lineBreak)+s))}else{var l=r.changes(e),u=n&&n.main.to<=l.newLength?n.main:void 0;if(r.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=o.to&&e.to>=o.to-10){var h,c=t.state.sliceDoc(e.from,e.to),f=n&&xr(t,n.main.head);if(f){var d=e.insert.length-(e.to-e.from);h={from:f.from,to:f.to-d}}else h=t.state.doc.lineAt(o.head);var O=o.to-e.to,p=o.to-o.from;i=r.changeByRange((function(n){if(n.from==o.from&&n.to==o.to)return{changes:l,range:u||n.map(l)};var i=n.to-O,a=i-c.length;if(n.to-n.from!=p||t.state.sliceDoc(a,i)!=c||n.to>=h.from&&n.from<=h.to)return{range:n};var s=r.changes({from:a,to:i,insert:e.insert}),f=n.to-o.to;return{changes:s,range:u?Et.range(Math.max(0,u.anchor+f),Math.max(0,u.head+f)):n.map(s)}}))}else i={changes:l,selection:u&&r.selection.replaceRange(u)}}var v="input.type";(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,v+=".compose",t.inputState.compositionFirstChange&&(v+=".start",t.inputState.compositionFirstChange=!1));return r.update(i,{userEvent:v,scrollIntoView:!0})}(t,n,i))};return t.state.facet(Fi).some((function(e){return e(t,n.from,n.to,d,O)}))||t.dispatch(O()),!0}if(i&&!i.main.eq(r)){var p=!1,v="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(p=!0),v=t.inputState.lastSelectionOrigin),t.dispatch({selection:i,scrollIntoView:p,userEvent:v}),!0}return!1}var ta={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ea=Hn.ie&&Hn.ie_version<=11,na=function(){function t(e){var n=this;O(this,t),this.view=e,this.active=!1,this.selectionRange=new Qn,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.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((function(t){var r,o=i(t);try{for(o.s();!(r=o.n()).done;){var a=r.value;n.queue.push(a)}}catch(s){o.e(s)}finally{o.f()}(Hn.ie&&Hn.ie_version<=11||Hn.ios&&e.composing)&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?n.flushSoon():n.flush()})),ea&&(this.onCharData=function(t){n.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),n.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),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((function(){var t;(null===(t=n.view.docView)||void 0===t?void 0:t.lastUpdate)0&&t[t.length-1].intersectionRatio>0!=n.intersecting&&(n.intersecting=!n.intersecting,n.intersecting!=n.view.inView&&n.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&&n.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}return v(t,[{key:"onScrollChanged",value:function(t){this.view.inputState.runHandlers("scroll",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(t){var e=this;("change"!=t.type||t.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout((function(){e.view.viewState.printing=!1,e.view.requestMeasure()}),500))}},{key:"updateGaps",value:function(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((function(e,n){return e!=t[n]})))){this.gapIntersection.disconnect();var e,n=i(t);try{for(n.s();!(e=n.n()).done;){var r=e.value;this.gapIntersection.observe(r)}}catch(o){n.e(o)}finally{n.f()}this.gaps=t}}},{key:"onSelectionChange",value:function(t){var e=this.selectionChanged;if(this.readSelectionRange()&&!this.delayedAndroidKey){var n=this.view,i=this.selectionRange;if(n.state.facet(or)?n.root.activeElement==this.dom:fn(n.dom,i)){var r=i.anchorNode&&n.docView.nearest(i.anchorNode);r&&r.ignoreEvent(t)?e||(this.selectionChanged=!1):(Hn.ie&&Hn.ie_version<=11||Hn.android&&Hn.chrome)&&!n.state.selection.main.empty&&i.focusNode&&On(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}}}},{key:"readSelectionRange",value:function(){var t=this.view,e=hn(t.root);if(!e)return!1;var n=Hn.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,e){if(e.getComposedRanges){var n=e.getComposedRanges(t.root)[0];if(n)return ra(t,n)}var i=null;function r(t){t.preventDefault(),t.stopImmediatePropagation(),i=t.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),i?ra(t,i):null}(this.view,e)||e;if(!n||this.selectionRange.eq(n))return!1;var i=fn(this.dom,n);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}},{key:"pendingRecords",value:function(){var t,e=i(this.observer.takeRecords());try{for(e.s();!(t=e.n()).done;){var n=t.value;this.queue.push(n)}}catch(r){e.e(r)}finally{e.f()}return this.queue}},{key:"processRecords",value:function(){var t=this.pendingRecords();t.length&&(this.queue=[]);var e,n=-1,r=-1,o=!1,a=i(t);try{for(a.s();!(e=a.n()).done;){var s=e.value,l=this.readMutation(s);l&&(l.typeOver&&(o=!0),-1==n?(n=l.from,r=l.to):(n=Math.min(l.from,n),r=Math.max(l.to,r)))}}catch(u){a.e(u)}finally{a.f()}return{from:n,to:r,typeOver:o}}},{key:"readChange",value:function(){var t=this.processRecords(),e=t.from,n=t.to,i=t.typeOver,r=this.selectionChanged&&fn(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;var o=new Jo(this.view,e,n,i);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}},{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 this.view.requestMeasure(),!1;var n=this.view.state,i=Ko(this.view,e);return this.view.state==n&&this.view.update([]),i}},{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.flags|=4),"childList"==t.type){var n=ia(e,t.previousSibling||t.target.previousSibling,-1),i=ia(e,t.nextSibling||t.target.nextSibling,1);return{from:n?e.posAfter(n):e.posAtStart,to:i?e.posBefore(i):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),this.printQuery?this.printQuery.addEventListener("change",this.onPrint):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),this.printQuery?this.printQuery.removeEventListener("change",this.onPrint):t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"destroy",value:function(){var t,e,n;this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();var r,o=i(this.scrollTargets);try{for(o.s();!(r=o.n()).done;){r.value.removeEventListener("scroll",this.onScroll)}}catch(a){o.e(a)}finally{o.f()}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}]),t}();function ia(t,e,n){for(;e;){var i=Wn.get(e);if(i&&i.parent==t)return i;var r=e.parentNode;e=r!=t.dom?r:n>0?e.nextSibling:e.previousSibling}return null}function ra(t,e){var n=e.startContainer,i=e.startOffset,r=e.endContainer,o=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);if(On(a.node,a.offset,r,o)){var s=[r,o,n,i];n=s[0],i=s[1],r=s[2],o=s[3]}return{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:o}}var oa=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};O(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="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),n.parent&&n.parent.appendChild(this.dom);var r=n.dispatch;this.dispatchTransactions=n.dispatchTransactions||r&&function(t){return t.forEach((function(t){return r(t,e)}))}||function(t){return e.update(t)},this.dispatch=this.dispatch.bind(this),this._root=n.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(n.parent)||document,this.viewState=new Co(n.state||Ae.create(n)),n.scrollTo&&n.scrollTo.is(ir)&&(this.viewState.scrollTarget=n.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(sr).map((function(t){return new ur(t)}));var o,a=i(this.plugins);try{for(a.s();!(o=a.n()).done;){o.value.update(this)}}catch(s){a.e(s)}finally{a.f()}this.observer=new na(this),this.inputState=new zr(this),this.inputState.ensureHandlers(this.plugins),this.docView=new wr(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}return v(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,e=arguments.length,n=new Array(e),i=0;iy.anchor?-1:1))}var k,b=i(m.effects);try{for(b.s();!(k=b.n()).done;){var w=k.value;w.is(ir)&&(p=w.value.clip(this.state))}}catch(P){b.e(P)}finally{b.f()}}}catch(P){g.e(P)}finally{g.f()}this.viewState.update(n,p),this.bidiCache=la.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),o=this.docView.update(n),this.state.facet(yr)!=this.styleModules&&this.mountStyles(),a=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(o,t.some((function(t){return t.isUserEvent("select.pointer")})))}finally{this.updateState=0}if(n.startState.facet(Do)!=n.state.facet(Do)&&(this.viewState.mustMeasureContent=!0),(o||a||p||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),o&&this.docViewUpdate(),!n.empty){var Q,x=i(this.state.facet(Hi));try{for(x.s();!(Q=x.n()).done;){var S=Q.value;try{S(n)}catch(w){rr(this.state,w,"update listener")}}}catch(P){x.e(P)}finally{x.f()}}(f||O)&&Promise.resolve().then((function(){f&&e.state==f.startState&&e.dispatch(f),O&&!Ko(e,O)&&d.force&&$n(e.contentDOM,d.key,d.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 n,r=i(this.plugins);try{for(r.s();!(n=r.n()).done;){n.value.destroy(this)}}catch(s){r.e(s)}finally{r.f()}this.viewState=new Co(t),this.plugins=t.facet(sr).map((function(t){return new ur(t)})),this.pluginMap.clear();var o,a=i(this.plugins);try{for(a.s();!(o=a.n()).done;){o.value.update(this)}}catch(s){a.e(s)}finally{a.f()}this.docView.destroy(),this.docView=new wr(this),this.inputState.ensureHandlers(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(sr),n=t.state.facet(sr);if(e!=n){var r,o=[],a=i(n);try{for(a.s();!(r=a.n()).done;){var s=r.value,l=e.indexOf(s);if(l<0)o.push(new ur(s));else{var u=this.plugins[l];u.mustUpdate=t,o.push(u)}}}catch(v){a.e(v)}finally{a.f()}var h,c=i(this.plugins);try{for(c.s();!(h=c.n()).done;){var f=h.value;f.mustUpdate!=t&&f.destroy(this)}}catch(v){c.e(v)}finally{c.f()}this.plugins=o,this.pluginMap.clear()}else{var d,O=i(this.plugins);try{for(O.s();!(d=O.n()).done;){d.value.mustUpdate=t}}catch(v){O.e(v)}finally{O.f()}}for(var p=0;p0&&void 0!==arguments[0])||arguments[0];if(!this.destroyed){if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();var n=null,r=this.scrollDOM,o=r.scrollTop*this.scaleY,a=this.viewState,s=a.scrollAnchorPos,l=a.scrollAnchorHeight;Math.abs(o-this.viewState.scrollTop)>1&&(l=-1),this.viewState.scrollAnchorHeight=-1;try{for(var u=0;;u++){if(l<0)if(Rn(r))s=-1,l=this.viewState.heightMap.height;else{var h=this.viewState.scrollAnchorAt(o);s=h.from,l=h.top}this.updateState=1;var c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(u>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}var f=[];if(!(4&c)){var d=[f,this.measureRequests];this.measureRequests=d[0],f=d[1]}var O=f.map((function(e){try{return e.read(t)}catch(op){return rr(t.state,op),sa}})),p=br.create(this,this.state,[]),v=!1;p.flags|=c,n?n.flags|=c:n=p,this.updateState=2,p.empty||(this.updatePlugins(p),this.inputState.update(p),this.updateAttrs(),(v=this.docView.update(p))&&this.docViewUpdate());for(var g=0;g1||y<-1){o+=y,r.scrollTop=o/this.scaleY,l=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty){var k,b=i(this.state.facet(Hi));try{for(b.s();!(k=b.n()).done;){(0,k.value)(n)}}catch(w){b.e(w)}finally{b.f()}}}}},{key:"themeClasses",get:function(){return _o+" "+(this.state.facet(Eo)?Uo:Vo)+" "+this.state.facet(Do)}},{key:"updateAttrs",value:function(){var t=this,e=ua(this,hr,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(or)?"true":"false",class:"cm-content",style:"".concat(Hn.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),ua(this,cr,n);var i=this.observer.ignore((function(){var i=si(t.contentDOM,t.contentAttrs,n),r=si(t.dom,t.editorAttrs,e);return i||r}));return this.editorAttrs=e,this.contentAttrs=n,i}},{key:"showAnnouncements",value:function(e){var n,r=!0,o=i(e);try{for(o.s();!(n=o.n()).done;){var a,s=i(n.value.effects);try{for(s.s();!(a=s.n()).done;){var l=a.value;if(l.is(t.announce))r&&(this.announceDOM.textContent=""),r=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=l.value}}catch(u){s.e(u)}finally{s.f()}}}catch(u){o.e(u)}finally{o.f()}}},{key:"mountStyles",value:function(){this.styleModules=this.state.facet(yr);var e=this.state.facet(t.cspNonce);tn.mount(this.root,this.styleModules.concat(Io).reverse(),e?{nonce:e}:void 0)}},{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 n=0;nr.from?e.head-1:e.head):null;if(o){var a=t.dom.getBoundingClientRect(),s=t.textDirectionAt(r.from),l=t.posAtCoords({x:n==(s==wi.LTR)?a.right-1:a.left+1,y:(o.top+o.bottom)/2});if(null!=l)return Et.cursor(l,n?-1:1)}return Et.cursor(n?r.to:r.from,n?-1:1)}(this,t,e,!(arguments.length>2&&void 0!==arguments[2])||arguments[2])}},{key:"moveVertically",value:function(t,e,n){return jr(this,t,function(t,e,n,i){var r=e.head,o=n?1:-1;if(r==(n?t.state.doc.length:0))return Et.cursor(r,e.assoc);var a,s=e.goalColumn,l=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(r,e.assoc||-1),h=t.documentTop;if(u)null==s&&(s=u.left-l.left),a=o<0?u.top:u.bottom;else{var c=t.viewState.lineBlockAt(r);null==s&&(s=Math.min(l.right-l.left,t.defaultCharacterWidth*(r-c.from))),a=(o<0?c.top:c.bottom)+h}for(var f=l.left+s,d=null!=i?i:t.viewState.heightOracle.textHeight>>1,O=0;;O+=10){var p=a+(d+O)*o,v=Mr(t,{x:f,y:p},!1,o);if(pl.bottom||(o<0?vr)){var g=t.docView.coordsForChar(v),m=!g||p1&&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(),Mr(this,t,e)}},{key:"coordsAtPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;this.readMeasured();var n=this.docView.coordsAt(t,e);if(!n||n.left==n.right)return n;var i=this.state.doc.lineAt(t),r=this.bidiSpans(i);return yn(n,r[qi.find(r,t-i.from,-1,e)].dir==wi.LTR==e>0)}},{key:"coordsForChar",value:function(t){return this.readMeasured(),this.docView.coordsForChar(t)}},{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(Ki)||tthis.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>aa)return _i(t.length);var e,n,r=this.textDirectionAt(t.from),o=i(this.bidiCache);try{for(o.s();!(n=o.n()).done;){var a=n.value;if(a.from==t.from&&a.dir==r&&(a.fresh||ji(a.isolates,e=vr(this,t))))return a.order}}catch(l){o.e(l)}finally{o.f()}e||(e=vr(this,t));var s=function(t,e,n){if(!t)return[new qi(0,0,e==xi?1:0)];if(e==Qi&&!n.length&&!Yi.test(t))return _i(t.length);if(n.length)for(;t.length>zi.length;)zi[zi.length]=256;var i=[],r=e==Qi?0:1;return Ei(t,r,r,n,0,t.length,i),i}(t.text,r,e);return this.bidiCache.push(new la(t.from,t.to,r,e,!0,s)),s}},{key:"hasFocus",get:function(){var t;return(this.dom.ownerDocument.hasFocus()||Hn.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(){Sn(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,e=i(this.plugins);try{for(e.s();!(t=e.n()).done;){t.value.destroy(this)}}catch(n){e.e(n)}finally{e.f()}this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}},{key:"scrollSnapshot",value:function(){var t=this.scrollDOM,e=t.scrollTop,n=t.scrollLeft,i=this.viewState.scrollAnchorAt(e);return ir.of(new nr(Et.cursor(i.from),"start","start",i.top-e,n,!0))}}],[{key:"scrollIntoView",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return ir.of(new nr("number"==typeof t?Et.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}},{key:"domEventHandlers",value:function(t){return lr.define((function(){return{}}),{eventHandlers:t})}},{key:"domEventObservers",value:function(t){return lr.define((function(){return{}}),{eventObservers:t})}},{key:"theme",value:function(t,e){var n=tn.newName(),i=[Do.of(n),yr.of(Bo(".".concat(n),t))];return e&&e.dark&&i.push(Eo.of(!0)),i}},{key:"baseTheme",value:function(t){return ne.lowest(yr.of(Bo("."+_o,t,No)))}},{key:"findFromDOM",value:function(t){var e,n=t.querySelector(".cm-content"),i=n&&Wn.get(n)||Wn.get(t);return(null===(e=null==i?void 0:i.rootView)||void 0===e?void 0:e.view)||null}}]),t}();oa.styleModule=yr,oa.inputHandler=Fi,oa.scrollHandler=er,oa.focusChangeEffect=Ji,oa.perLineTextDirection=Ki,oa.exceptionSink=Li,oa.updateListener=Hi,oa.editable=or,oa.mouseSelectionStyle=Gi,oa.dragMovesSelection=Ii,oa.clickAddsSelectionRange=Bi,oa.decorations=fr,oa.outerDecorations=dr,oa.atomicRanges=Or,oa.bidiIsolatedRanges=pr,oa.scrollMargins=gr,oa.darkTheme=Eo,oa.cspNonce=Ut.define({combine:function(t){return t.length?t[0]:""}}),oa.contentAttributes=cr,oa.editorAttributes=hr,oa.lineWrapping=oa.contentAttributes.of({class:"cm-lineWrapping"}),oa.announce=ye.define();var aa=4096,sa={},la=function(){function t(e,n,i,r,o,a){O(this,t),this.from=e,this.to=n,this.dir=i,this.isolates=r,this.fresh=o,this.order=a}return v(t,null,[{key:"update",value:function(e,n){if(n.empty&&!e.some((function(t){return t.fresh})))return e;for(var i=[],r=e.length?e[e.length-1].dir:wi.LTR,o=Math.max(0,e.length-10);o=0;r--){var o=i[r],a="function"==typeof o?o(t):o;a&&ri(a,n)}return n}var ha=Hn.mac?"mac":Hn.windows?"win":Hn.linux?"linux":"key";function ca(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==n&&e.shiftKey&&(t="Shift-"+t),t}var fa=ne.default(oa.domEventHandlers({keydown:function(t,e){return ma(pa(e.state),t,e,"editor")}})),da=Ut.define({enables:fa}),Oa=new WeakMap;function pa(t){var e=t.facet(da),n=Oa.get(e);return n||Oa.set(e,n=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ha,r=Object.create(null),o=Object.create(null),a=function(t,e){var n=o[t];if(null==n)o[t]=e;else if(n!=e)throw new Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},s=function(t,e,i,o,s){for(var l,u,h=r[t]||(r[t]=Object.create(null)),c=e.split(/ (?!$)/).map((function(t){return function(t,e){var n,i,r,o,a=t.split(/-(?!$)/),s=a[a.length-1];"Space"==s&&(s=" ");for(var l=0;l=t.viewport.to)return[];var r=Math.max(n.from,t.viewport.from),o=Math.min(n.to,t.viewport.to),a=t.textDirection==wi.LTR,s=t.contentDOM,l=s.getBoundingClientRect(),u=ka(t),h=s.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=l.right-(c?parseInt(c.paddingRight):0),O=Xr(t,r),p=Xr(t,o),v=O.type==fi.Text?O:null,g=p.type==fi.Text?p:null;if(v&&(t.lineWrapping||O.widgetLineBreaks)&&(v=ba(t,r,v)),g&&(t.lineWrapping||p.widgetLineBreaks)&&(g=ba(t,o,g)),v&&g&&v.from==g.from)return w(Q(n.from,n.to,v));var m=v?Q(n.from,null,v):x(O,!1),y=g?Q(null,n.to,g):x(p,!0),k=[];return(v||O).to<(g||p).from-(v&&g?1:0)||O.widgetLineBreaks>1&&m.bottom+t.defaultLineHeight/2c&&v.from=m)break;x>g&&u(Math.max(Q,g),null==e&&Q<=c,Math.min(x,m),null==n&&x>=O,w.dir)}}catch(S){b.e(S)}finally{b.f()}if((g=k.to+1)>=m)break}}}catch(S){p.e(S)}finally{p.f()}return 0==l.length&&u(c,null==e,O,null==n,t.textDirection),{top:o,bottom:s,horizontal:l}}function x(t,e){var n=l.top+(e?t.top:t.bottom);return{top:n,bottom:n,horizontal:[]}}}var Qa=function(){function t(e,n){O(this,t),this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}return v(t,[{key:"update",value:function(t){t.startState.facet(xa)!=t.state.facet(xa)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}},{key:"docViewUpdate",value:function(t){!1!==this.layer.updateOnDocViewUpdate&&t.requestMeasure(this.measureReq)}},{key:"setOrder",value:function(t){for(var e=0,n=t.facet(xa);e0&&void 0!==arguments[0]?arguments[0]:{};return[$a.of(t),Ta,Ca,Wa,tr.of(!0)]}function Ra(t){return t.startState.facet($a)!=t.state.facet($a)}var Ta=Sa({above:!0,markers:function(t){var e,n=t.state,r=n.facet($a),o=[],a=i(n.selection.ranges);try{for(a.s();!(e=a.n()).done;){var s=e.value,l=s==n.selection.main;if(s.empty?!l||Pa:r.drawRangeCursor){var u,h=l?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=s.empty?s:Et.cursor(s.head,s.head>s.anchor?-1:1),f=i(ya.forRange(t,h,c));try{for(f.s();!(u=f.n()).done;){var d=u.value;o.push(d)}}catch(O){f.e(O)}finally{f.f()}}}}catch(O){a.e(O)}finally{a.f()}return o},update:function(t,e){t.transactions.some((function(t){return t.selection}))&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");var n=Ra(t);return n&&Aa(t.state,e),t.docChanged||t.selectionSet||n},mount:function(t,e){Aa(e.state,t)},class:"cm-cursorLayer"});function Aa(t,e){e.style.animationDuration=t.facet($a).cursorBlinkRate+"ms"}var Ca=Sa({above:!1,markers:function(t){return t.state.selection.ranges.map((function(e){return e.empty?[]:ya.forRange(t,"cm-selectionBackground",e)})).reduce((function(t,e){return t.concat(e)}))},update:function(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||Ra(t)},class:"cm-selectionLayer"}),Ma={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Pa&&(Ma[".cm-line"].caretColor="transparent !important",Ma[".cm-content"]={caretColor:"transparent !important"});var Wa=ne.highest(oa.theme(Ma)),Xa=ye.define({map:function(t,e){return null==t?null:e.mapPos(t)}}),Ya=Ht.define({create:function(){return null},update:function(t,e){return null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce((function(t,e){return e.is(Xa)?e.value:t}),t)}}),qa=lr.fromClass(function(){function t(e){O(this,t),this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}return v(t,[{key:"update",value:function(t){var e,n=t.state.field(Ya);null==n?null!=this.cursor&&(null===(e=this.cursor)||void 0===e||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(Ya)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}},{key:"readPos",value:function(){var t=this.view,e=t.state.field(Ya),n=null!=e&&t.coordsAtPos(e);if(!n)return null;var i=t.scrollDOM.getBoundingClientRect();return{left:n.left-i.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-i.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}},{key:"drawCursor",value:function(t){if(this.cursor){var e=this.view,n=e.scaleX,i=e.scaleY;t?(this.cursor.style.left=t.left/n+"px",this.cursor.style.top=t.top/i+"px",this.cursor.style.height=t.height/i+"px"):this.cursor.style.left="-100000px"}}},{key:"destroy",value:function(){this.cursor&&this.cursor.remove()}},{key:"setDropPos",value:function(t){this.view.state.field(Ya)!=t&&this.view.dispatch({effects:Xa.of(t)})}}]),t}(),{eventObservers:{dragover:function(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave:function(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend:function(){this.setDropPos(null)},drop:function(){this.setDropPos(null)}}});function ja(t,e,n,i,r){e.lastIndex=0;for(var o,a=t.iterRange(n,i),s=n;!a.next().done;s+=a.value.length)if(!a.lineBreak)for(;o=e.exec(a.value);)r(s+o.index,o)}var za=function(){function t(e){O(this,t);var n=e.regexp,i=e.decoration,r=e.decorate,o=e.boundary,a=e.maxLength,s=void 0===a?1e3:a;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,r)this.addMatch=function(t,e,n,i){return r(i,n,n+t[0].length,t,e)};else if("function"==typeof i)this.addMatch=function(t,e,n,r){var o=i(t,e,n);o&&r(n,n+t[0].length,o)};else{if(!i)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,e,n,r){return r(n,n+t[0].length,i)}}this.boundary=o,this.maxLength=s}return v(t,[{key:"createDeco",value:function(t){var e,n=this,r=new je,o=r.add.bind(r),a=i(function(t,e){var n=t.visibleRanges;if(1==n.length&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;var r,o=[],a=i(n);try{for(a.s();!(r=a.n()).done;){var s=r.value,l=s.from,u=s.to;l=Math.max(t.state.doc.lineAt(l).from,l-e),u=Math.min(t.state.doc.lineAt(u).to,u+e),o.length&&o[o.length-1].to>=l?o[o.length-1].to=u:o.push({from:l,to:u})}}catch(h){a.e(h)}finally{a.f()}return o}(t,this.maxLength));try{for(a.s();!(e=a.n()).done;){var s=e.value,l=s.from,u=s.to;ja(t.state.doc,this.regexp,l,u,(function(e,i){return n.addMatch(i,t,e,o)}))}}catch(h){a.e(h)}finally{a.f()}return r.finish()}},{key:"updateDeco",value:function(t,e){var n=1e9,i=-1;return t.docChanged&&t.changes.iterChanges((function(e,r,o,a){a>t.view.viewport.from&&o1e3?this.createDeco(t.view):i>-1?this.updateRange(t.view,e.map(t.changes),n,i):e}},{key:"updateRange",value:function(t,e,n,r){var o,a=this,s=i(t.visibleRanges);try{var l=function(){var i=o.value,s=Math.max(i.from,n),l=Math.min(i.to,r);if(l>s){var u=t.state.doc.lineAt(s),h=u.tou.from;s--)if(a.boundary.test(u.text[s-1-u.from])){c=s;break}for(;lf},add:O})}};for(s.s();!(o=s.n()).done;)l()}catch(u){s.e(u)}finally{s.f()}return e}}]),t}(),Da=null!=/x/.unicode?"gu":"g",Ea=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",Da),_a={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"},Va=null;var Ua=Ut.define({combine:function(t){var e=Ce(t,{render:null,specialChars:Ea,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==Va&&"undefined"!=typeof document&&document.body){var e=document.body.style;Va=null!=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)}return Va||!1}())&&(e.specialChars=new RegExp("\t|"+e.specialChars.source,Da)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Da)),e}});function Na(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Ua.of(t),Ba||(Ba=lr.fromClass(function(){function t(e){O(this,t),this.view=e,this.decorations=di.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Ua)),this.decorations=this.decorator.createDeco(e)}return v(t,[{key:"makeDecorator",value:function(t){var e=this;return new za({regexp:t.specialChars,decoration:function(n,i,r){var o=i.state.doc,a=$t(n[0],0);if(9==a){var s=o.lineAt(r),l=i.state.tabSize,u=Le(s.text,l,r-s.from);return di.replace({widget:new Ga((l-u%l)*e.view.defaultCharacterWidth/e.view.scaleX)})}return e.decorationCache[a]||(e.decorationCache[a]=di.replace({widget:new Ia(t,a)}))},boundary:t.replaceTabs?void 0:/[^]/})}},{key:"update",value:function(t){var e=t.state.facet(Ua);t.startState.facet(Ua)!=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 Ba=null;var Ia=function(t){function e(t,n){var i;return O(this,e),(i=r(this,e)).options=t,i.code=n,i}return u(e,t),v(e,[{key:"eq",value:function(t){return t.code==this.code}},{key:"toDOM",value:function(t){var e=function(t){return t>=32?"•":10==t?"␤":String.fromCharCode(9216+t)}(this.code),n=t.state.phrase("Control character")+" "+(_a[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,e);if(i)return i;var r=document.createElement("span");return r.textContent=e,r.title=n,r.setAttribute("aria-label",n),r.className="cm-specialChar",r}},{key:"ignoreEvent",value:function(){return!1}}]),e}(ci),Ga=function(t){function e(t){var n;return O(this,e),(n=r(this,e)).width=t,n}return u(e,t),v(e,[{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}}]),e}(ci);var La=di.line({class:"cm-activeLine"}),Ha=lr.fromClass(function(){function t(e){O(this,t),this.decorations=this.getDeco(e)}return v(t,[{key:"update",value:function(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}},{key:"getDeco",value:function(t){var e,n=-1,r=[],o=i(t.state.selection.ranges);try{for(o.s();!(e=o.n()).done;){var a=e.value,s=t.lineBlockAt(a.head);s.from>n&&(r.push(La.range(s.from)),n=s.from)}}catch(l){o.e(l)}finally{o.f()}return di.set(r)}}]),t}(),{decorations:function(t){return t.decorations}}),Fa=function(t){function e(t){var n;return O(this,e),(n=r(this,e)).content=t,n}return u(e,t),v(e,[{key:"toDOM",value:function(){var t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?t.setAttribute("aria-label","placeholder "+this.content):t.setAttribute("aria-hidden","true"),t}},{key:"coordsAt",value:function(t){var e=t.firstChild?dn(t.firstChild):[];if(!e.length)return null;var n=window.getComputedStyle(t.parentNode),i=yn(e[0],"rtl"!=n.direction),r=parseInt(n.lineHeight);return i.bottom-i.top>1.5*r?{left:i.left,right:i.right,top:i.top,bottom:i.top+r}:i}},{key:"ignoreEvent",value:function(){return!1}}]),e}(ci);var Ja=2e3;function Ka(t,e){var n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),i=t.state.doc.lineAt(n),r=n-i.from,o=r>Ja?-1:r==i.length?function(t,e){var n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}(t,e.clientX):Le(i.text,t.state.tabSize,n-i.from);return{line:i.number,col:o,off:r}}function ts(t,e){var n=Ka(t,e),i=t.state.selection;return n?{update:function(t){if(t.docChanged){var e=t.changes.mapPos(t.startState.doc.line(n.line).from),r=t.state.doc.lineAt(e);n={line:r.number,col:n.col,off:Math.min(n.off,r.length)},i=i.map(t.changes)}},get:function(e,r,o){var a=Ka(t,e);if(!a)return i;var s=function(t,e,n){var i=Math.min(e.line,n.line),r=Math.max(e.line,n.line),o=[];if(e.off>Ja||n.off>Ja||e.col<0||n.col<0)for(var a=Math.min(e.off,n.off),s=Math.max(e.off,n.off),l=i;l<=r;l++){var u=t.doc.line(l);u.length<=s&&o.push(Et.range(u.from+a,u.to+s))}else for(var h=Math.min(e.col,n.col),c=Math.max(e.col,n.col),f=i;f<=r;f++){var d=t.doc.line(f),O=He(d.text,h,t.tabSize,!0);if(O<0)o.push(Et.cursor(d.to));else{var p=He(d.text,c,t.tabSize);o.push(Et.range(d.from+O,d.from+p))}}return o}(t.state,n,a);return s.length?o?Et.create(s.concat(i.ranges)):Et.create(s):i}}:null}function es(t){var e=(null==t?void 0:t.eventFilter)||function(t){return t.altKey&&0==t.button};return oa.mouseSelectionStyle.of((function(t,n){return e(n)?ts(t,n):null}))}var ns={Alt:[18,function(t){return!!t.altKey}],Control:[17,function(t){return!!t.ctrlKey}],Shift:[16,function(t){return!!t.shiftKey}],Meta:[91,function(t){return!!t.metaKey}]},is={style:"cursor: crosshair"};function rs(){var t=c(ns[(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).key||"Alt"],2),e=t[0],n=t[1],i=lr.fromClass(function(){function t(e){O(this,t),this.view=e,this.isDown=!1}return v(t,[{key:"set",value:function(t){this.isDown!=t&&(this.isDown=t,this.view.update([]))}}]),t}(),{eventObservers:{keydown:function(t){this.set(t.keyCode==e||n(t))},keyup:function(t){t.keyCode!=e&&n(t)||this.set(!1)},mousemove:function(t){this.set(n(t))}}});return[i,oa.contentAttributes.of((function(t){var e;return(null===(e=t.plugin(i))||void 0===e?void 0:e.isDown)?is:null}))]}var os="-10000px",as=function(){function t(e,n,i,r){O(this,t),this.facet=n,this.createTooltipView=i,this.removeTooltipView=r,this.input=e.state.facet(n),this.tooltips=this.input.filter((function(t){return t}));var o=null;this.tooltipViews=this.tooltips.map((function(t){return o=i(t,o)}))}return v(t,[{key:"update",value:function(t,e){var n,r=t.state.facet(this.facet),o=r.filter((function(t){return t}));if(r===this.input){var a,s=i(this.tooltipViews);try{for(s.s();!(a=s.n()).done;){var l=a.value;l.update&&l.update(t)}}catch(k){s.e(k)}finally{s.f()}return!1}for(var u=[],h=e?[]:null,c=0;cn.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&n.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}return v(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,e=i(this.manager.tooltipViews);try{for(e.s();!(t=e.n()).done;){var n=t.value;this.intersectionObserver.observe(n.dom)}}catch(r){e.e(r)}finally{e.f()}}}},{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,this.above);e&&this.observeIntersection();var n=e||t.geometryChanged,r=t.state.facet(ls);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;var o,a=i(this.manager.tooltipViews);try{for(a.s();!(o=a.n()).done;){o.value.dom.style.position=this.position}}catch(h){a.e(h)}finally{a.f()}n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();var s,l=i(this.manager.tooltipViews);try{for(l.s();!(s=l.n()).done;){var u=s.value;this.container.appendChild(u.dom)}}catch(h){l.e(h)}finally{l.f()}n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}},{key:"createTooltip",value:function(t,e){var n=t.create(this.view),i=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){var r=document.createElement("div");r.className="cm-tooltip-arrow",n.dom.appendChild(r)}return n.dom.style.position=this.position,n.dom.style.top=os,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}},{key:"destroy",value:function(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);var r,o=i(this.manager.tooltipViews);try{for(o.s();!(r=o.n()).done;){var a=r.value;a.dom.remove(),null===(t=a.destroy)||void 0===t||t.call(a)}}catch(s){o.e(s)}finally{o.f()}this.parent&&this.container.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}},{key:"readMeasure",value:function(){var t=this,e=this.view.dom.getBoundingClientRect(),n=1,i=1,r=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){var o=this.manager.tooltipViews[0].dom;if(Hn.gecko)r=o.offsetParent!=this.container.ownerDocument.body;else if(o.style.top==os&&"0px"==o.style.left){var a=o.getBoundingClientRect();r=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}}if(r||"absolute"==this.position)if(this.parent){var s=this.parent.getBoundingClientRect();s.width&&s.height&&(n=s.width/this.parent.offsetWidth,i=s.height/this.parent.offsetHeight)}else{var l=this.view.viewState;n=l.scaleX,i=l.scaleY}return{editor:e,parent:this.parent?this.container.getBoundingClientRect():e,pos:this.manager.tooltips.map((function(e,n){var i=t.manager.tooltipViews[n];return i.getCoords?i.getCoords(e.pos):t.view.coordsAtPos(e.pos)})),size:this.manager.tooltipViews.map((function(t){return t.dom.getBoundingClientRect()})),space:this.view.state.facet(ls).tooltipSpace(this.view),scaleX:n,scaleY:i,makeAbsolute:r}}},{key:"writeMeasure",value:function(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";var n,r=i(this.manager.tooltipViews);try{for(r.s();!(n=r.n()).done;){n.value.dom.style.position="absolute"}}catch(A){r.e(A)}finally{r.f()}}for(var o=t.editor,a=t.space,s=t.scaleX,l=t.scaleY,u=[],h=0;h=Math.min(o.bottom,a.bottom)||O.rightMath.min(o.right,a.right)+.1)d.style.top=os;else{var v=c.arrow?f.dom.querySelector(".cm-tooltip-arrow"):null,g=v?7:0,m=p.right-p.left,y=null!==(e=us.get(f))&&void 0!==e?e:p.bottom-p.top,k=f.offset||fs,b=this.view.textDirection==wi.LTR,w=p.width>a.right-a.left?b?a.left:a.right-p.width:b?Math.min(O.left-(v?14:0)+k.x,a.right-m):Math.max(a.left,O.left-m+(v?14:0)-k.x),Q=this.above[h];!c.strictSide&&(Q?O.top-(p.bottom-p.top)-k.ya.bottom)&&Q==a.bottom-O.bottom>O.top-a.top&&(Q=this.above[h]=!Q);var x=(Q?O.top-a.top:a.bottom-O.bottom)-g;if(xw&&R.topS&&(S=Q?R.top-y-2-g:R.bottom+g+2)}}catch(A){Z.e(A)}finally{Z.f()}}if("absolute"==this.position?(d.style.top=(S-t.parent.top)/l+"px",d.style.left=(w-t.parent.left)/s+"px"):(d.style.top=S/l+"px",d.style.left=w/s+"px"),v){var T=O.left+(b?k.x:-k.x)-(w+14-7);v.style.left=T/s+"px"}!0!==f.overlap&&u.push({left:w,top:S,right:P,bottom:S+y}),d.classList.toggle("cm-tooltip-above",Q),d.classList.toggle("cm-tooltip-below",!Q),f.positioned&&f.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,!this.inView))){var t,e=i(this.manager.tooltipViews);try{for(e.s();!(t=e.n()).done;){t.value.dom.style.top=os}}catch(n){e.e(n)}finally{e.f()}}}}]),t}(),{eventObservers:{scroll:function(){this.maybeMeasure()}}}),cs=oa.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"}}}),fs={x:0,y:0},ds=Ut.define({enables:[hs,cs]}),Os=Ut.define({combine:function(t){return t.reduce((function(t,e){return t.concat(e)}),[])}}),ps=function(){function t(e){var n=this;O(this,t),this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new as(e,Os,(function(t,e){return n.createHostedView(t,e)}),(function(t){return t.dom.remove()}))}return v(t,[{key:"createHostedView",value:function(t,e){var n=t.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}},{key:"mount",value:function(t){var e,n=i(this.manager.tooltipViews);try{for(n.s();!(e=n.n()).done;){var r=e.value;r.mount&&r.mount(t)}}catch(o){n.e(o)}finally{n.f()}this.mounted=!0}},{key:"positioned",value:function(t){var e,n=i(this.manager.tooltipViews);try{for(n.s();!(e=n.n()).done;){var r=e.value;r.positioned&&r.positioned(t)}}catch(o){n.e(o)}finally{n.f()}}},{key:"update",value:function(t){this.manager.update(t)}},{key:"destroy",value:function(){var t,e,n=i(this.manager.tooltipViews);try{for(n.s();!(e=n.n()).done;){var r=e.value;null===(t=r.destroy)||void 0===t||t.call(r)}}catch(o){n.e(o)}finally{n.f()}}},{key:"passProp",value:function(t){var e,n=void 0,r=i(this.manager.tooltipViews);try{for(r.s();!(e=r.n()).done;){var o=e.value[t];if(void 0!==o)if(void 0===n)n=o;else if(n!==o)return}}catch(a){r.e(a)}finally{r.f()}return n}},{key:"offset",get:function(){return this.passProp("offset")}},{key:"getCoords",get:function(){return this.passProp("getCoords")}},{key:"overlap",get:function(){return this.passProp("overlap")}},{key:"resize",get:function(){return this.passProp("resize")}}],[{key:"create",value:function(e){return new t(e)}}]),t}(),vs=ds.compute([Os],(function(t){var n=t.facet(Os);return 0===n.length?null:{pos:Math.min.apply(Math,e(n.map((function(t){return t.pos})))),end:Math.max.apply(Math,e(n.map((function(t){var e;return null!==(e=t.end)&&void 0!==e?e:t.pos})))),create:ps.create,above:n[0].above,arrow:n.some((function(t){return t.arrow}))}})),gs=function(){function t(e,n,i,r,o){O(this,t),this.view=e,this.source=n,this.field=i,this.setHover=r,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}return v(t,[{key:"update",value:function(){var t=this;this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((function(){return t.startHover()}),20))}},{key:"active",get:function(){return this.view.state.field(this.field)}},{key:"checkHover",value:function(){if(this.hoverTimeout=-1,!this.active.length){var t=Date.now()-this.lastMove.time;ta.bottom||n.xa.right+e.defaultCharacterWidth)return;var s=e.bidiSpans(e.state.doc.lineAt(r)).find((function(t){return t.from<=r&&t.to>=r})),l=s&&s.dir==wi.RTL?-1:1;o=n.x-1?t.manager.tooltipViews[e]:null}},{key:"mousemove",value:function(t){var e,n;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));var i=this.active,r=this.tooltip;if(i.length&&r&&!function(t,e){var n=t.getBoundingClientRect();return e.clientX>=n.left-ms&&e.clientX<=n.right+ms&&e.clientY>=n.top-ms&&e.clientY<=n.bottom+ms}(r.dom,t)||this.pending){var o=(i[0]||this.pending).pos,a=null!==(n=null===(e=i[0])||void 0===e?void 0:e.end)&&void 0!==n?n:o;(o==a?this.view.posAtCoords(this.lastMove)==o:function(t,e,n,i,r,o){var a=t.scrollDOM.getBoundingClientRect(),s=t.documentTop+t.documentPadding.top+t.contentHeight;if(a.left>i||a.rightr||Math.min(a.bottom,s)=e&&l<=n}(this.view,o,a,t.clientX,t.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}},{key:"mouseleave",value:function(t){if(clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active.length){var e=this.tooltip;e&&e.dom.contains(t.relatedTarget)?this.watchTooltipLeave(e.dom):this.view.dispatch({effects:this.setHover.of([])})}}},{key:"watchTooltipLeave",value:function(t){var e=this;t.addEventListener("mouseleave",(function n(i){t.removeEventListener("mouseleave",n),e.active.length&&!e.view.dom.contains(i.relatedTarget)&&e.view.dispatch({effects:e.setHover.of([])})}))}},{key:"destroy",value:function(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}]),t}(),ms=4;function ys(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=ye.define(),r=Ht.define({create:function(){return[]},update:function(t,r){if(t.length&&(e.hideOnChange&&(r.docChanged||r.selection)?t=[]:e.hideOn&&(t=t.filter((function(t){return!e.hideOn(r,t)}))),r.docChanged)){var o,a=[],s=i(t);try{for(s.s();!(o=s.n()).done;){var l=o.value,u=r.changes.mapPos(l.pos,-1,At.TrackDel);if(null!=u){var h=Object.assign(Object.create(null),l);h.pos=u,null!=h.end&&(h.end=r.changes.mapPos(h.end)),a.push(h)}}}catch(O){s.e(O)}finally{s.f()}t=a}var c,f=i(r.effects);try{for(f.s();!(c=f.n()).done;){var d=c.value;d.is(n)&&(t=d.value),d.is(bs)&&(t=[])}}catch(O){f.e(O)}finally{f.f()}return t},provide:function(t){return Os.from(t)}});return[r,lr.define((function(i){return new gs(i,t,r,n,e.hoverTime||300)})),vs]}function ks(t,e){var n=t.plugin(hs);if(!n)return null;var i=n.manager.tooltips.indexOf(e);return i<0?null:n.manager.tooltipViews[i]}var bs=ye.define(),ws=Ut.define({combine:function(t){var e,n,r,o=i(t);try{for(o.s();!(r=o.n()).done;){var a=r.value;e=e||a.topContainer,n=n||a.bottomContainer}}catch(s){o.e(s)}finally{o.f()}return{topContainer:e,bottomContainer:n}}});function Qs(t,e){var n=t.plugin(xs),i=n?n.specs.indexOf(e):-1;return i>-1?n.panels[i]:null}var xs=lr.fromClass(function(){function t(e){O(this,t),this.input=e.state.facet($s),this.specs=this.input.filter((function(t){return t})),this.panels=this.specs.map((function(t){return t(e)}));var n=e.state.facet(ws);this.top=new Ss(e,!0,n.topContainer),this.bottom=new Ss(e,!1,n.bottomContainer),this.top.sync(this.panels.filter((function(t){return t.top}))),this.bottom.sync(this.panels.filter((function(t){return!t.top})));var r,o=i(this.panels);try{for(o.s();!(r=o.n()).done;){var a=r.value;a.dom.classList.add("cm-panel"),a.mount&&a.mount()}}catch(s){o.e(s)}finally{o.f()}}return v(t,[{key:"update",value:function(t){var e=t.state.facet(ws);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ss(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ss(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();var n=t.state.facet($s);if(n!=this.input){var r,o=n.filter((function(t){return t})),a=[],s=[],l=[],u=[],h=i(o);try{for(h.s();!(r=h.n()).done;){var c=r.value,f=this.specs.indexOf(c),d=void 0;f<0?(d=c(t.view),u.push(d)):(d=this.panels[f]).update&&d.update(t),a.push(d),(d.top?s:l).push(d)}}catch(k){h.e(k)}finally{h.f()}this.specs=o,this.panels=a,this.top.sync(s),this.bottom.sync(l);for(var O=0,p=u;Othis.i;){var e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}]),t}(),zs=function(){function t(e,n){var i=this;O(this,t),this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");var r=function(t){i.dom.addEventListener(t,(function(r){var o,a=r.target;if(a!=i.dom&&i.dom.contains(a)){for(;a.parentNode!=i.dom;)a=a.parentNode;var s=a.getBoundingClientRect();o=(s.top+s.bottom)/2}else o=r.clientY;var l=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[t](e,l,r)&&r.preventDefault()}))};for(var o in n.domEventHandlers)r(o);this.markers=Ys(n.markers(e)),n.initialSpacer&&(this.spacer=new Ds(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}return v(t,[{key:"update",value:function(t){var e=this.markers;if(this.markers=Ys(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){var n=this.config.updateSpacer(this.spacer.markers[0],t);n!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[n])}var i=t.view.viewport;return!qe.eq(this.markers,e,i.from,i.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t)}},{key:"destroy",value:function(){var t,e=i(this.elements);try{for(e.s();!(t=e.n()).done;){t.value.destroy()}}catch(n){e.e(n)}finally{e.f()}}}]),t}(),Ds=function(){function t(e,n,i,r){O(this,t),this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,i,r)}return v(t,[{key:"update",value:function(t,e,n,i){this.height!=e&&(this.height=e,this.dom.style.height=e+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(t,e){if(t.length!=e.length)return!1;for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{};return[_s.of(t),Ws(),Ns]}function Is(t){for(var e=9;er&&(r=s,n.push(Gs.range(s)))}}catch(l){o.e(l)}finally{o.f()}return qe.of(n)}));var Hs=0,Fs=v((function t(e,n){O(this,t),this.from=e,this.to=n})),Js=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};O(this,t),this.id=Hs++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return v(t,[{key:"add",value:function(t){var e=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof t&&(t=el.match(t)),function(n){var i=t(n);return void 0===i?null:[e,i]}}}]),t}();Js.closedBy=new Js({deserialize:function(t){return t.split(" ")}}),Js.openedBy=new Js({deserialize:function(t){return t.split(" ")}}),Js.group=new Js({deserialize:function(t){return t.split(" ")}}),Js.isolate=new Js({deserialize:function(t){if(t&&"rtl"!=t&&"ltr"!=t&&"auto"!=t)throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),Js.contextHash=new Js({perNode:!0}),Js.lookAhead=new Js({perNode:!0}),Js.mounted=new Js({perNode:!0});var Ks=function(){function t(e,n,i){O(this,t),this.tree=e,this.overlay=n,this.parser=i}return v(t,null,[{key:"get",value:function(t){return t&&t.props&&t.props[Js.mounted.id]}}]),t}(),tl=Object.create(null),el=function(){function t(e,n,i){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;O(this,t),this.name=e,this.props=n,this.id=i,this.flags=r}return v(t,[{key:"prop",value:function(t){return this.props[t.id]}},{key:"isTop",get:function(){return(1&this.flags)>0}},{key:"isSkipped",get:function(){return(2&this.flags)>0}},{key:"isError",get:function(){return(4&this.flags)>0}},{key:"isAnonymous",get:function(){return(8&this.flags)>0}},{key:"is",value:function(t){if("string"==typeof t){if(this.name==t)return!0;var e=this.prop(Js.group);return!!e&&e.indexOf(t)>-1}return this.id==t}}],[{key:"define",value:function(e){var n=e.props&&e.props.length?Object.create(null):tl,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),o=new t(e.name||"",n,e.id,r);if(e.props){var a,s=i(e.props);try{for(s.s();!(a=s.n()).done;){var l=a.value;if(Array.isArray(l)||(l=l(o)),l){if(l[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[l[0].id]=l[1]}}}catch(u){s.e(u)}finally{s.f()}}return o}},{key:"match",value:function(t){var e=Object.create(null);for(var n in t){var r,o=i(n.split(" "));try{for(o.s();!(r=o.n()).done;){var a=r.value;e[a]=t[n]}}catch(s){o.e(s)}finally{o.f()}}return function(t){for(var n=t.prop(Js.group),i=-1;i<(n?n.length:0);i++){var r=e[i<0?t.name:n[i]];if(r)return r}}}}]),t}();el.none=new el("",Object.create(null),0,8);var nl,il=function(){function t(e){O(this,t),this.types=e;for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:0;return new yl(this.topNode,t)}},{key:"cursorAt",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=rl.get(this)||this.topNode,i=new yl(n);return i.moveTo(t,e),rl.set(this,i._tree),i}},{key:"topNode",get:function(){return new fl(this,0,0,null)}},{key:"resolve",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=hl(rl.get(this)||this.topNode,t,e,!1);return rl.set(this,n),n}},{key:"resolveInner",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=hl(ol.get(this)||this.topNode,t,e,!0);return ol.set(this,n),n}},{key:"resolveStack",value:function(t){return function(t,e,n){for(var i=t.resolveInner(e,n),r=null,o=i instanceof fl?i:i.context.parent;o;o=o.parent)if(o.index<0){var a=o.parent;(r||(r=[i])).push(a.resolve(e,n)),o=a}else{var s=Ks.get(o.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){var l=new fl(s.tree,s.overlay[0].from+o.from,-1,o);(r||(r=[i])).push(hl(l,e,n,!1))}}return r?gl(r):i}(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}},{key:"iterate",value:function(t){for(var e=t.enter,n=t.leave,i=t.from,r=void 0===i?0:i,o=t.to,a=void 0===o?this.length:o,s=t.mode||0,l=(s&nl.IncludeAnonymous)>0,u=this.cursor(s|nl.IncludeAnonymous);;){var h=!1;if(u.from<=a&&u.to>=r&&(!l&&u.type.isAnonymous||!1!==e(u))){if(u.firstChild())continue;h=!0}for(;h&&n&&(l||!u.type.isAnonymous)&&n(u),!u.nextSibling();){if(!u.parent())return;h=!0}}}},{key:"prop",value:function(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}},{key:"propValues",get:function(){var t=[];if(this.props)for(var e in this.props)t.push([+e,this.props[e]]);return t}},{key:"balance",value:function(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.children.length<=8?this:xl(el.none,this.children,this.positions,0,this.children.length,0,this.length,(function(n,i,r){return new t(e.type,n,i,r,e.propValues)}),n.makeTree||function(e,n,i){return new t(el.none,e,n,i)})}}],[{key:"build",value:function(t){return bl(t)}}]),t}();al.empty=new al(el.none,[],[],0);var sl=function(){function t(e,n){O(this,t),this.buffer=e,this.index=n}return v(t,[{key:"id",get:function(){return this.buffer[this.index-4]}},{key:"start",get:function(){return this.buffer[this.index-3]}},{key:"end",get:function(){return this.buffer[this.index-2]}},{key:"size",get:function(){return this.buffer[this.index-1]}},{key:"pos",get:function(){return this.index}},{key:"next",value:function(){this.index-=4}},{key:"fork",value:function(){return new t(this.buffer,this.index)}}]),t}(),ll=function(){function t(e,n,i){O(this,t),this.buffer=e,this.length=n,this.set=i}return v(t,[{key:"type",get:function(){return el.none}},{key:"toString",value:function(){for(var t=[],e=0;e0));s=o[s+3]);return a}},{key:"slice",value:function(e,n,i){for(var r=this.buffer,o=new Uint16Array(n-e),a=0,s=e,l=0;s=e&&ne;case 1:return n<=e&&i>e;case 2:return i>e;case 4:return!0}}function hl(t,e,n,i){for(var r;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"getChild",value:function(t){var e=dl(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null);return e.length?e[0]:null}},{key:"getChildren",value:function(t){return dl(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null)}},{key:"resolve",value:function(t){return hl(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function(t){return hl(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"matchContext",value:function(t){return Ol(this,t)}},{key:"enterUnfinishedNodesBefore",value:function(t){for(var e=this.childBefore(t),n=this;e;){var i=e.lastChild;if(!i||i.to!=e.to)break;i.type.isError&&i.from==i.to?(n=e,e=i.prevSibling):e=i}return n}},{key:"node",get:function(){return this}},{key:"next",get:function(){return this.parent}}]),t}(),fl=function(t){function e(t,n,i,o){var a;return O(this,e),(a=r(this,e))._tree=t,a.from=n,a.index=i,a._parent=o,a}return u(e,t),v(e,[{key:"type",get:function(){return this._tree.type}},{key:"name",get:function(){return this._tree.type.name}},{key:"to",get:function(){return this.from+this._tree.length}},{key:"nextChild",value:function(t,n,i,r){for(var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=this;;){for(var s=a._tree,l=s.children,u=s.positions,h=n>0?l.length:-1;t!=h;t+=n){var c=l[t],f=u[t]+a.from;if(ul(r,i,f,f+c.length))if(c instanceof ll){if(o&nl.ExcludeBuffers)continue;var d=c.findChild(0,c.buffer.length,n,i-f,r);if(d>-1)return new vl(new pl(a,c,t,f),null,d)}else if(o&nl.IncludeAnonymous||!c.type.isAnonymous||kl(c)){var O=void 0;if(!(o&nl.IgnoreMounts)&&(O=Ks.get(c))&&!O.overlay)return new e(O.tree,f,t,a);var p=new e(c,f,t,a);return o&nl.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(n<0?c.children.length-1:0,n,i,r)}}if(o&nl.IncludeAnonymous||!a.type.isAnonymous)return null;if(t=a.index>=0?a.index+n:n<0?-1:a._parent._tree.children.length,!(a=a._parent))return null}}},{key:"firstChild",get:function(){return this.nextChild(0,1,0,4)}},{key:"lastChild",get:function(){return this.nextChild(this._tree.children.length-1,-1,0,4)}},{key:"childAfter",value:function(t){return this.nextChild(0,1,t,2)}},{key:"childBefore",value:function(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}},{key:"enter",value:function(t,n){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(o&nl.IgnoreOverlays)&&(r=Ks.get(this._tree))&&r.overlay){var a,s=t-this.from,l=i(r.overlay);try{for(l.s();!(a=l.n()).done;){var u=a.value,h=u.from,c=u.to;if((n>0?h<=s:h=s:c>s))return new e(r.tree,r.overlay[0].from+this.from,-1,this)}}catch(f){l.e(f)}finally{l.f()}}return this.nextChild(0,1,t,n,o)}},{key:"nextSignificantParent",value:function(){for(var t=this;t.type.isAnonymous&&t._parent;)t=t._parent;return t}},{key:"parent",get:function(){return this._parent?this._parent.nextSignificantParent():null}},{key:"nextSibling",get:function(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}},{key:"prevSibling",get:function(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}},{key:"tree",get:function(){return this._tree}},{key:"toTree",value:function(){return this._tree}},{key:"toString",value:function(){return this._tree.toString()}}]),e}(cl);function dl(t,e,n,i){var r=t.cursor(),o=[];if(!r.firstChild())return o;if(null!=n)for(var a=!1;!a;)if(a=r.type.is(n),!r.nextSibling())return o;for(;;){if(null!=i&&r.type.is(i))return o;if(r.type.is(e)&&o.push(r.node),!r.nextSibling())return null==i?o:[]}}function Ol(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length-1,i=t.parent;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[n]&&e[n]!=i.name)return!1;n--}}return!0}var pl=v((function t(e,n,i,r){O(this,t),this.parent=e,this.buffer=n,this.index=i,this.start=r})),vl=function(t){function e(t,n,i){var o;return O(this,e),(o=r(this,e)).context=t,o._parent=n,o.index=i,o.type=t.buffer.set.types[t.buffer.buffer[i]],o}return u(e,t),v(e,[{key:"name",get:function(){return this.type.name}},{key:"from",get:function(){return this.context.start+this.context.buffer.buffer[this.index+1]}},{key:"to",get:function(){return this.context.start+this.context.buffer.buffer[this.index+2]}},{key:"child",value:function(t,n,i){var r=this.context.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],t,n-this.context.start,i);return o<0?null:new e(this.context,this,o)}},{key:"firstChild",get:function(){return this.child(1,0,4)}},{key:"lastChild",get:function(){return this.child(-1,0,4)}},{key:"childAfter",value:function(t){return this.child(1,t,2)}},{key:"childBefore",value:function(t){return this.child(-1,t,-2)}},{key:"enter",value:function(t,n){if((arguments.length>2&&void 0!==arguments[2]?arguments[2]:0)&nl.ExcludeBuffers)return null;var i=this.context.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return r<0?null:new e(this.context,this,r)}},{key:"parent",get:function(){return this._parent||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}},{key:"nextSibling",get:function(){var t=this.context.buffer,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}},{key:"prevSibling",get:function(){var t=this.context.buffer,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}},{key:"tree",get:function(){return null}},{key:"toTree",value:function(){var t=[],e=[],n=this.context.buffer,i=this.index+4,r=n.buffer[this.index+3];if(r>i){var o=n.buffer[this.index+1];t.push(n.slice(i,r,o)),e.push(0)}return new al(this.type,t,e,this.to-this.from)}},{key:"toString",value:function(){return this.context.buffer.childString(this.index)}}]),e}(cl);function gl(t){if(!t.length)return null;for(var e=0,n=t[0],i=1;in.from||r.to1&&void 0!==arguments[1]?arguments[1]:0;if(O(this,t),this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof fl)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(var i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}return v(t,[{key:"name",get:function(){return this.type.name}},{key:"yieldNode",value:function(t){return!!t&&(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0)}},{key:"yieldBuf",value:function(t,e){this.index=t;var n=this.buffer,i=n.start,r=n.buffer;return this.type=e||r.set.types[r.buffer[t]],this.from=i+r.buffer[t+1],this.to=i+r.buffer[t+2],!0}},{key:"yield",value:function(t){return!!t&&(t instanceof fl?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)))}},{key:"toString",value:function(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}},{key:"enterChild",value:function(t,e,n){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,n,this.mode));var i=this.buffer.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],t,e-this.buffer.start,n);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r))}},{key:"firstChild",value:function(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function(t){return this.enterChild(1,t,2)}},{key:"childBefore",value:function(t){return this.enterChild(-1,t,-2)}},{key:"enter",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(n&nl.ExcludeBuffers)&&this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,n))}},{key:"parent",value:function(){if(!this.buffer)return this.yieldNode(this.mode&nl.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var t=this.mode&nl.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}},{key:"sibling",value:function(t){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode));var e=this.buffer.buffer,n=this.stack.length-1;if(t<0){var i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(e.findChild(i,this.index,-1,0,4))}else{var r=e.buffer[this.index+3];if(r<(n<0?e.buffer.length:e.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode))}},{key:"nextSibling",value:function(){return this.sibling(1)}},{key:"prevSibling",value:function(){return this.sibling(-1)}},{key:"atLastNode",value:function(t){var e,n,i=this.buffer;if(i){if(t>0){if(this.index-1)for(var s=e+t,l=t<0?-1:n._tree.children.length;s!=l;s+=t){var u=n._tree.children[s];if(this.mode&nl.IncludeAnonymous||u instanceof ll||!u.type.isAnonymous||kl(u))return!1}}return!0}},{key:"move",value:function(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}},{key:"next",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(1,t)}},{key:"prev",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(-1,t)}},{key:"moveTo",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(var o=t;o;o=o._parent)if(o.index==i){if(i==this.index)return o;e=o,n=r+1;break t}i=this.stack[--r]}for(var a=n;a=0;r--){if(r<0)return Ol(this.node,t,i);var o=n[e.buffer[this.stack[r]]];if(!o.isAnonymous){if(t[i]&&t[i]!=o.name)return!1;i--}}return!0}}]),t}();function kl(t){return t.children.some((function(t){return t instanceof ll||!t.type.isAnonymous||kl(t)}))}function bl(t){var e,n=t.buffer,i=t.nodeSet,r=t.maxBufferLength,o=void 0===r?1024:r,a=t.reused,s=void 0===a?[]:a,l=t.minRepeatType,u=void 0===l?i.types.length:l,h=Array.isArray(n)?new sl(n,n.length):n,c=i.types,f=0,d=0;function O(t,e,n,r,a,l){for(var y=h.id,k=h.start,b=h.end,w=h.size,Q=d;w<0;){if(h.next(),-1==w){var x=s[y];return n.push(x),void r.push(k-t)}if(-3==w)return void(f=y);if(-4==w)return void(d=y);throw new RangeError("Unrecognized record size: ".concat(w))}var S,P,$=c[y],Z=k-t;if(b-k<=o&&(P=function(t,e){var n=h.fork(),i=0,r=0,a=0,s=n.end-o,l={size:0,start:0,skip:0};t:for(var c=n.pos-t;n.pos>c;){var f=n.size;if(n.id==e&&f>=0)l.size=i,l.start=r,l.skip=a,a+=4,i+=4,n.next();else{var d=n.pos-f;if(f<0||d=u?4:0,p=n.start;for(n.next();n.pos>d;){if(n.size<0){if(-3!=n.size)break t;O+=4}else n.id>=u&&(O+=4);n.next()}r=p,i+=f,a+=O}}(e<0||i==t)&&(l.size=i,l.start=r,l.skip=a);return l.size>4?l:void 0}(h.pos-e,a))){for(var R=new Uint16Array(P.size-P.skip),T=h.pos-P.size,A=R.length;h.pos>T;)A=m(P.start,R,A);S=new ll(R,b-P.start,i),Z=P.start-t}else{var C=h.pos-w;h.next();for(var M=[],W=[],X=y>=u?y:-1,Y=0,q=b;h.pos>C;)X>=0&&h.id==X&&h.size>=0?(h.end<=q-o&&(v(M,W,k,Y,h.end,q,X,Q),Y=M.length,q=h.end),h.next()):l>2500?p(k,C,M,W):O(k,C,M,W,X,l+1);if(X>=0&&Y>0&&Y-1&&Y>0){var j=function(t){return function(e,n,i){var r,o,a=0,s=e.length-1;if(s>=0&&(r=e[s])instanceof al){if(!s&&r.type==t&&r.length==i)return r;(o=r.prop(Js.lookAhead))&&(a=n[s]+r.length+o)}return g(t,e,n,i,a)}}($);S=xl($,M,W,0,M.length,0,b-k,j,j)}else S=g($,M,W,b-k,Q-b)}n.push(S),r.push(Z)}function p(t,e,n,r){for(var a=[],s=0,l=-1;h.pos>e;){var u=h.id,c=h.start,f=h.end;if(h.size>4)h.next();else{if(l>-1&&c=0;p-=3)d[v++]=a[p],d[v++]=a[p+1]-O,d[v++]=a[p+2]-O,d[v++]=v;n.push(new ll(d,a[2]-O,i)),r.push(O-t)}}function v(t,e,n,r,o,a,s,l){for(var u=[],h=[];t.length>r;)u.push(t.pop()),h.push(e.pop()+n-o);t.push(g(i.types[s],u,h,a-o,l-a)),e.push(o-n)}function g(t,e,n,i){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o=arguments.length>5?arguments[5]:void 0;if(f){var a=[Js.contextHash,f];o=o?[a].concat(o):[a]}if(r>25){var s=[Js.lookAhead,r];o=o?[s].concat(o):[s]}return new al(t,e,n,i,o)}function m(t,e,n){var i=h.id,r=h.start,o=h.end,a=h.size;if(h.next(),a>=0&&i4)for(var l=h.pos-(a-4);h.pos>l;)n=m(t,e,n);e[--n]=s,e[--n]=o-t,e[--n]=r-t,e[--n]=i}else-3==a?f=i:-4==a&&(d=i);return n}for(var y=[],k=[];h.pos>0;)O(t.start||0,t.bufferStart||0,y,k,-1,0);var b=null!==(e=t.length)&&void 0!==e?e:y.length?k[0]+y[0].length:0;return new al(c[t.topID],y.reverse(),k.reverse(),b)}var wl=new WeakMap;function Ql(t,e){if(!t.isAnonymous||e instanceof ll||e.type!=t)return 1;var n=wl.get(e);if(null==n){n=1;var r,o=i(e.children);try{for(o.s();!(r=o.n()).done;){var a=r.value;if(a.type!=t||!(a instanceof al)){n=1;break}n+=Ql(t,a)}}catch(s){o.e(s)}finally{o.f()}wl.set(e,n)}return n}function xl(t,e,n,i,r,o,a,s,l){for(var u=0,h=i;h=c)break;p+=v}if(u==h+1){if(p>c){var g=n[h];e(g.children,g.positions,0,g.children.length,i[h]+s);continue}f.push(n[h])}else{var m=i[u-1]+n[u-1].length-O;f.push(xl(t,n,i,h,u,O,m,null,l))}d.push(O+s-o)}}(e,n,i,r,0),(s||l)(f,d,a)}var Sl=function(){function t(){O(this,t),this.map=new WeakMap}return v(t,[{key:"setBuffer",value:function(t,e,n){var i=this.map.get(t);i||this.map.set(t,i=new Map),i.set(e,n)}},{key:"getBuffer",value:function(t,e){var n=this.map.get(t);return n&&n.get(e)}},{key:"set",value:function(t,e){t instanceof vl?this.setBuffer(t.context.buffer,t.index,e):t instanceof fl&&this.map.set(t.tree,e)}},{key:"get",value:function(t){return t instanceof vl?this.getBuffer(t.context.buffer,t.index):t instanceof fl?this.map.get(t.tree):void 0}},{key:"cursorSet",value:function(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}},{key:"cursorGet",value:function(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}]),t}(),Pl=function(){function t(e,n,i,r){var o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];O(this,t),this.from=e,this.to=n,this.tree=i,this.offset=r,this.open=(o?1:0)|(a?2:0)}return v(t,[{key:"openStart",get:function(){return(1&this.open)>0}},{key:"openEnd",get:function(){return(2&this.open)>0}}],[{key:"addTree",value:function(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=[new t(0,e.length,e,0,!1,o)],s=i(r);try{for(s.s();!(n=s.n()).done;){var l=n.value;l.to>e.length&&a.push(l)}}catch(u){s.e(u)}finally{s.f()}return a}},{key:"applyChanges",value:function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:128;if(!n.length)return e;for(var r=[],o=1,a=e.length?e[0]:null,s=0,l=0,u=0;;s++){var h=s=i)for(;a&&a.from=f.from||c<=f.to||u){var d=Math.max(f.from,l)-u,O=Math.min(f.to,c)-u;f=d>=O?null:new t(d,O,f.tree,f.offset+u,s>0,!!h)}if(f&&r.push(f),a.to>c)break;a=o-1?e:Cl.get(e.base||e,e.modified.concat(t).sort((function(t,e){return t.id-e.id})))}}}]),t}(),Al=0,Cl=function(){function t(){O(this,t),this.instances=[],this.id=Al++}return v(t,null,[{key:"get",value:function(e,n){if(!n.length)return e;var r=n[0].instances.find((function(t){return t.base==e&&(i=n,r=t.modified,i.length==r.length&&i.every((function(t,e){return t==r[e]})));var i,r}));if(r)return r;var o,a=[],s=new Tl(a,e,n),l=i(n);try{for(l.s();!(o=l.n()).done;){o.value.instances.push(s)}}catch(v){l.e(v)}finally{l.f()}var u,h=function(t){for(var e=[[]],n=0;n0&&c+3==s.length){u=1;break}var f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(h);if(!f)throw new RangeError("Invalid path: "+s);if(l.push("*"==f[0]?"":'"'==f[0][0]?JSON.parse(f[0]):f[0]),(c+=f[0].length)==s.length)break;var d=s[c++];if(c==s.length&&"!"==d){u=0;break}if("/"!=d)throw new RangeError("Invalid path: "+s);h=s.slice(c)}var O=l.length-1,p=l[O];if(!p)throw new RangeError("Invalid path: "+s);var v=new Xl(r,u,O>0?l.slice(0,O):null);e[p]=v.sort(e[p])}}}catch(g){a.e(g)}finally{a.f()}}return Wl.add(e)}var Wl=new Js,Xl=function(){function t(e,n,i,r){O(this,t),this.tags=e,this.mode=n,this.context=i,this.next=r}return v(t,[{key:"opaque",get:function(){return 0==this.mode}},{key:"inherit",get:function(){return 1==this.mode}},{key:"sort",value:function(t){return!t||t.depth3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.length,o=new jl(i,Array.isArray(e)?e:[e],n);o.highlightRange(t.cursor(),i,r,"",o.highlighters),o.flush(r)}Xl.empty=new Xl([],2,null);var jl=function(){function t(e,n,i){O(this,t),this.at=e,this.highlighters=n,this.span=i,this.class=""}return v(t,[{key:"startSpan",value:function(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}},{key:"flush",value:function(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}},{key:"highlightRange",value:function(t,e,n,r,o){var a=t.type,s=t.from,l=t.to;if(!(s>=n||l<=e)){a.isTop&&(o=this.highlighters.filter((function(t){return!t.scope||t.scope(a)})));var u=r,h=function(t){var e=t.type.prop(Wl);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}(t)||Xl.empty,c=function(t,e){var n,r=null,o=i(t);try{for(o.s();!(n=o.n()).done;){var a=n.value.style(e);a&&(r=r?r+" "+a:a)}}catch(s){o.e(s)}finally{o.f()}return r}(o,h.tags);if(c&&(u&&(u+=" "),u+=c,1==h.mode&&(r+=(r?" ":"")+c)),this.startSpan(Math.max(e,s),u),!h.opaque){var f=t.tree&&t.tree.prop(Js.mounted);if(f&&f.overlay){for(var d=t.node.enter(f.overlay[0].from+s,1),O=this.highlighters.filter((function(t){return!t.scope||t.scope(f.tree.type)})),p=t.firstChild(),v=0,g=s;;v++){var m=v=y)&&t.nextSibling()););if(!m||y>n)break;(g=m.to+s)>e&&(this.highlightRange(d.cursor(),Math.max(e,m.from+s),Math.min(n,g),"",O),this.startSpan(Math.min(n,g),u))}p&&t.parent()}else if(t.firstChild()){f&&(r="");do{if(!(t.to<=e)){if(t.from>=n)break;this.highlightRange(t,e,n,r,o),this.startSpan(Math.min(n,t.to),u)}}while(t.nextSibling());t.parent()}}}}}]),t}();var zl,Dl=Tl.define,El=Dl(),_l=Dl(),Vl=Dl(_l),Ul=Dl(_l),Nl=Dl(),Bl=Dl(Nl),Il=Dl(Nl),Gl=Dl(),Ll=Dl(Gl),Hl=Dl(),Fl=Dl(),Jl=Dl(),Kl=Dl(Jl),tu=Dl(),eu={comment:El,lineComment:Dl(El),blockComment:Dl(El),docComment:Dl(El),name:_l,variableName:Dl(_l),typeName:Vl,tagName:Dl(Vl),propertyName:Ul,attributeName:Dl(Ul),className:Dl(_l),labelName:Dl(_l),namespace:Dl(_l),macroName:Dl(_l),literal:Nl,string:Bl,docString:Dl(Bl),character:Dl(Bl),attributeValue:Dl(Bl),number:Il,integer:Dl(Il),float:Dl(Il),bool:Dl(Nl),regexp:Dl(Nl),escape:Dl(Nl),color:Dl(Nl),url:Dl(Nl),keyword:Hl,self:Dl(Hl),null:Dl(Hl),atom:Dl(Hl),unit:Dl(Hl),modifier:Dl(Hl),operatorKeyword:Dl(Hl),controlKeyword:Dl(Hl),definitionKeyword:Dl(Hl),moduleKeyword:Dl(Hl),operator:Fl,derefOperator:Dl(Fl),arithmeticOperator:Dl(Fl),logicOperator:Dl(Fl),bitwiseOperator:Dl(Fl),compareOperator:Dl(Fl),updateOperator:Dl(Fl),definitionOperator:Dl(Fl),typeOperator:Dl(Fl),controlOperator:Dl(Fl),punctuation:Jl,separator:Dl(Jl),bracket:Kl,angleBracket:Dl(Kl),squareBracket:Dl(Kl),paren:Dl(Kl),brace:Dl(Kl),content:Gl,heading:Ll,heading1:Dl(Ll),heading2:Dl(Ll),heading3:Dl(Ll),heading4:Dl(Ll),heading5:Dl(Ll),heading6:Dl(Ll),contentSeparator:Dl(Gl),list:Dl(Gl),quote:Dl(Gl),emphasis:Dl(Gl),strong:Dl(Gl),link:Dl(Gl),monospace:Dl(Gl),strikethrough:Dl(Gl),inserted:Dl(),deleted:Dl(),changed:Dl(),invalid:Dl(),meta:tu,documentMeta:Dl(tu),annotation:Dl(tu),processingInstruction:Dl(tu),definition:Tl.defineModifier(),constant:Tl.defineModifier(),function:Tl.defineModifier(),standard:Tl.defineModifier(),local:Tl.defineModifier(),special:Tl.defineModifier()};Yl([{tag:eu.link,class:"tok-link"},{tag:eu.heading,class:"tok-heading"},{tag:eu.emphasis,class:"tok-emphasis"},{tag:eu.strong,class:"tok-strong"},{tag:eu.keyword,class:"tok-keyword"},{tag:eu.atom,class:"tok-atom"},{tag:eu.bool,class:"tok-bool"},{tag:eu.url,class:"tok-url"},{tag:eu.labelName,class:"tok-labelName"},{tag:eu.inserted,class:"tok-inserted"},{tag:eu.deleted,class:"tok-deleted"},{tag:eu.literal,class:"tok-literal"},{tag:eu.string,class:"tok-string"},{tag:eu.number,class:"tok-number"},{tag:[eu.regexp,eu.escape,eu.special(eu.string)],class:"tok-string2"},{tag:eu.variableName,class:"tok-variableName"},{tag:eu.local(eu.variableName),class:"tok-variableName tok-local"},{tag:eu.definition(eu.variableName),class:"tok-variableName tok-definition"},{tag:eu.special(eu.variableName),class:"tok-variableName2"},{tag:eu.definition(eu.propertyName),class:"tok-propertyName tok-definition"},{tag:eu.typeName,class:"tok-typeName"},{tag:eu.namespace,class:"tok-namespace"},{tag:eu.className,class:"tok-className"},{tag:eu.macroName,class:"tok-macroName"},{tag:eu.propertyName,class:"tok-propertyName"},{tag:eu.operator,class:"tok-operator"},{tag:eu.comment,class:"tok-comment"},{tag:eu.meta,class:"tok-meta"},{tag:eu.invalid,class:"tok-invalid"},{tag:eu.punctuation,class:"tok-punctuation"}]);var nu=new Js;function iu(t){return Ut.define({combine:t?function(e){return e.concat(t)}:void 0})}var ru=new Js,ou=function(){function t(e,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";O(this,t),this.data=e,this.name=o,Ae.prototype.hasOwnProperty("tree")||Object.defineProperty(Ae.prototype,"tree",{get:function(){return lu(this)}}),this.parser=n,this.extension=[gu.of(this),Ae.languageData.of((function(t,e,n){var r=au(t,e,n),o=r.type.prop(nu);if(!o)return[];var a=t.facet(o),s=r.type.prop(ru);if(s){var l,u=r.resolve(e-r.from,n),h=i(s);try{for(h.s();!(l=h.n()).done;){var c=l.value;if(c.test(u,t)){var f=t.facet(c.facet);return"replace"==c.type?f:f.concat(a)}}}catch(d){h.e(d)}finally{h.f()}}return a}))].concat(r)}return v(t,[{key:"isActiveAt",value:function(t,e){return au(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1).type.prop(nu)==this.data}},{key:"findRegions",value:function(t){var e=this,n=t.facet(gu);if((null==n?void 0:n.data)==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];var r=[];return function t(n,o){if(n.prop(nu)!=e.data){var a=n.prop(Js.mounted);if(a){if(a.tree.prop(nu)==e.data){if(a.overlay){var s,l=i(a.overlay);try{for(l.s();!(s=l.n()).done;){var u=s.value;r.push({from:u.from+o,to:u.to+o})}}catch(d){l.e(d)}finally{l.f()}}else r.push({from:o,to:o+n.length});return}if(a.overlay){var h=r.length;if(t(a.tree,a.overlay[0].from+o),r.length>h)return}}for(var c=0;c=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-n,e-n)}}]),t}(),hu=null,cu=function(){function t(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,s=arguments.length>6?arguments[6]:void 0,l=arguments.length>7?arguments[7]:void 0;O(this,t),this.parser=e,this.state=n,this.fragments=i,this.tree=r,this.treeLen=o,this.viewport=a,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}return v(t,[{key:"startParse",value:function(){return this.parser.startParse(new uu(this.state.doc),this.fragments)}},{key:"work",value:function(t,e){var n=this;return null!=e&&e>=this.state.doc.length&&(e=void 0),this.tree!=al.empty&&this.isDone(null!=e?e:this.state.doc.length)?(this.takeTree(),!0):this.withContext((function(){var i;if("number"==typeof t){var r=Date.now()+t;t=function(){return Date.now()>r}}for(n.parse||(n.parse=n.startParse()),null!=e&&(null==n.parse.stoppedAt||n.parse.stoppedAt>e)&&e=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext((function(){for(;!(e=n.parse.advance()););})),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(Pl.addTree(this.tree,this.fragments,!0)),this.parse=null)}},{key:"withContext",value:function(t){var e=hu;hu=this;try{return t()}finally{hu=e}}},{key:"withoutTempSkipped",value:function(t){for(var e;e=this.tempSkipped.pop();)t=fu(t,e.from,e.to);return t}},{key:"changes",value:function(e,n){var r=this.fragments,o=this.tree,a=this.treeLen,s=this.viewport,l=this.skipped;if(this.takeTree(),!e.empty){var u=[];if(e.iterChangedRanges((function(t,e,n,i){return u.push({fromA:t,toA:e,fromB:n,toB:i})})),r=Pl.applyChanges(r,u),o=al.empty,a=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){l=[];var h,c=i(this.skipped);try{for(c.s();!(h=c.n()).done;){var f=h.value,d=e.mapPos(f.from,1),O=e.mapPos(f.to,-1);dt.from&&(this.fragments=fu(this.fragments,r,o),this.skipped.splice(n--,1))}return!(this.skipped.length>=e)&&(this.reset(),!0)}},{key:"reset",value:function(){this.parse&&(this.takeTree(),this.parse=null)}},{key:"skipUntilInView",value:function(t,e){this.skipped.push({from:t,to:e})}},{key:"isDone",value:function(t){t=Math.min(t,this.state.doc.length);var e=this.fragments;return this.treeLen>=t&&e.length&&0==e[0].from&&e[0].to>=t}}],[{key:"create",value:function(e,n,i){return new t(e,n,[],al.empty,0,i,[],null)}},{key:"getSkippingParser",value:function(t){return new(function(e){function n(){return O(this,n),r(this,n,arguments)}return u(n,e),v(n,[{key:"createParse",value:function(e,n,r){var o=r[0].from,a=r[r.length-1].to;return{parsedPos:o,advance:function(){var e=hu;if(e){var n,s=i(r);try{for(s.s();!(n=s.n()).done;){var l=n.value;e.tempSkipped.push(l)}}catch(u){s.e(u)}finally{s.f()}t&&(e.scheduleOn=e.scheduleOn?Promise.all([e.scheduleOn,t]):t)}return this.parsedPos=a,new al(el.none,[],[],a-o)},stoppedAt:null,stopAt:function(){}}}}]),n}($l))}},{key:"get",value:function(){return hu}}]),t}();function fu(t,e,n){return Pl.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}var du=function(){function t(e){O(this,t),this.context=e,this.tree=e.tree}return v(t,[{key:"apply",value:function(e){if(!e.docChanged&&this.tree==this.context.tree)return this;var n=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,i)||n.takeTree(),new t(n)}}],[{key:"init",value:function(e){var n=Math.min(3e3,e.doc.length),i=cu.create(e.facet(gu).parser,e,{from:0,to:n});return i.work(20,n)||i.takeTree(),new t(i)}}]),t}();ou.state=Ht.define({create:du.init,update:function(t,e){var n,r=i(e.effects);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.is(ou.setState))return o.value}}catch(a){r.e(a)}finally{r.f()}return e.startState.facet(gu)!=e.state.facet(gu)?du.init(e.state):t.apply(e)}});var Ou=function(t){var e=setTimeout((function(){return t()}),500);return function(){return clearTimeout(e)}};"undefined"!=typeof requestIdleCallback&&(Ou=function(t){var e=-1,n=setTimeout((function(){e=requestIdleCallback(t,{timeout:400})}),100);return function(){return e<0?clearTimeout(n):cancelIdleCallback(e)}});var pu="undefined"!=typeof navigator&&(null===(zl=navigator.scheduling)||void 0===zl?void 0:zl.isInputPending)?function(){return navigator.scheduling.isInputPending()}:null,vu=lr.fromClass(function(){function t(e){O(this,t),this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}return v(t,[{key:"update",value:function(t){var e=this.view.state.field(ou.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}},{key:"scheduleWork",value:function(){if(!this.working){var t=this.view.state,e=t.field(ou.state);e.tree==e.context.tree&&e.context.isDone(t.doc.length)||(this.working=Ou(this.work))}}},{key:"work",value:function(t){this.working=null;var e=Date.now();if(this.chunkEndr+1e3,l=o.context.work((function(){return pu&&pu()||Date.now()>a}),r+(s?0:1e5));this.chunkBudget-=Date.now()-e,(l||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:ou.setState.of(new du(o.context))})),this.chunkBudget>0&&(!l||s)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}}}},{key:"checkAsyncSchedule",value:function(t){var e=this;t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then((function(){return e.scheduleWork()})).catch((function(t){return rr(e.view.state,t)})).then((function(){return e.workScheduled--})),t.scheduleOn=null)}},{key:"destroy",value:function(){this.working&&this.working()}},{key:"isWorking",value:function(){return!!(this.working||this.workScheduled>0)}}]),t}(),{eventHandlers:{focus:function(){this.scheduleWork()}}}),gu=Ut.define({combine:function(t){return t.length?t[0]:null},enables:function(t){return[ou.state,vu,oa.contentAttributes.compute([t],(function(e){var n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}}))]}}),mu=v((function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];O(this,t),this.language=e,this.support=n,this.extension=[e,n]})),yu=Ut.define(),ku=Ut.define({combine:function(t){if(!t.length)return" ";var e=t[0];if(!e||/\S/.test(e)||Array.from(e).some((function(t){return t!=e[0]})))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function bu(t){var e=t.facet(ku);return 9==e.charCodeAt(0)?t.tabSize*e.length:e.length}function wu(t,e){var n="",i=t.tabSize,r=t.facet(ku)[0];if("\t"==r){for(;e>=i;)n+="\t",e-=i;r=" "}for(var o=0;o=e?function(t,e,n){var i=e.resolveStack(n),r=i.node.enterUnfinishedNodesBefore(n);if(r!=i.node){for(var o=[],a=r;a!=i.node;a=a.parent)o.push(a);for(var s=o.length-1;s>=0;s--)i={node:o[s],next:i}}return Pu(i,t,n)}(t,a,e):null}var xu=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};O(this,t),this.state=e,this.options=n,this.unit=bu(e)}return v(t,[{key:"lineAt",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.state.doc.lineAt(t),i=this.options,r=i.simulateBreak,o=i.simulateDoubleBreak;return null!=r&&r>=n.from&&r<=n.to?o&&r==t?{text:"",from:t}:(e<0?r1&&void 0!==arguments[1]?arguments[1]:1;if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";var n=this.lineAt(t,e),i=n.text,r=n.from;return i.slice(t-r,Math.min(i.length,t+100-r))}},{key:"column",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.lineAt(t,e),i=n.text,r=n.from,o=this.countColumn(i,t-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(o+=a-this.countColumn(i,i.search(/\S|$/))),o}},{key:"countColumn",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.length;return Le(t,this.state.tabSize,e)}},{key:"lineIndent",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=this.lineAt(t,e),i=n.text,r=n.from,o=this.options.overrideIndentation;if(o){var a=o(r);if(a>-1)return a}return this.countColumn(i,i.search(/\S|$/))}},{key:"simulatedBreak",get:function(){return this.options.simulateBreak||null}}]),t}(),Su=new Js;function Pu(t,e,n){for(var i=t;i;i=i.next){var r=$u(i.node);if(r)return r(Ru.create(e,n,i))}return 0}function $u(t){var e=t.type.prop(Su);if(e)return e;var n,i=t.firstChild;if(i&&(n=i.type.prop(Js.closedBy))){var r=t.lastChild,o=r&&n.indexOf(r.name)>-1;return function(t){return Cu(t,!0,1,void 0,o&&!function(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}(t)?r.from:void 0)}}return null==t.parent?Zu:null}function Zu(){return 0}var Ru=function(t){function e(t,n,i){var o;return O(this,e),(o=r(this,e,[t.state,t.options])).base=t,o.pos=n,o.context=i,o}return u(e,t),v(e,[{key:"node",get:function(){return this.context.node}},{key:"textAfter",get:function(){return this.textAfterPos(this.pos)}},{key:"baseIndent",get:function(){return this.baseIndentFor(this.node)}},{key:"baseIndentFor",value:function(t){for(var e=this.state.doc.lineAt(t.from);;){for(var n=t.resolve(e.from);n.parent&&n.parent.from==n.from;)n=n.parent;if(Tu(n,t))break;e=this.state.doc.lineAt(n.from)}return this.lineIndent(e.from)}},{key:"continue",value:function(){return Pu(this.context.next,this.base,this.pos)}}],[{key:"create",value:function(t,n,i){return new e(t,n,i)}}]),e}(xu);function Tu(t,e){for(var n=e;n;n=n.parent)if(t==n)return!0;return!1}function Au(t){var e=t.closing,n=t.align,i=void 0===n||n,r=t.units,o=void 0===r?1:r;return function(t){return Cu(t,i,o,e)}}function Cu(t,e,n,i,r){var o=t.textAfter,a=o.match(/^\s*/)[0].length,s=i&&o.slice(a,a+i.length)==i||r==t.pos+a,l=e?function(t){var e=t.node,n=e.childAfter(e.from),i=e.lastChild;if(!n)return null;for(var r=t.options.simulateBreak,o=t.state.doc.lineAt(n.from),a=null==r||r<=o.from?o.to:Math.min(o.to,r),s=n.to;;){var l=e.childAfter(s);if(!l||l==i)return null;if(!l.type.isSkipped)return l.from0&&void 0!==arguments[0]?arguments[0]:{},e=t.except,n=t.units,i=void 0===n?1:n;return function(t){var n=e&&e.test(t.textAfter);return t.baseIndent+(n?0:i*t.unit)}}var Wu=Ut.define(),Xu=new Js;function Yu(t){var e=t.firstChild,n=t.lastChild;return e&&e.ton)){if(a&&l.from=e&&h.to>n&&(a=h)}}}return a}(t,e,n)}function ju(t,e){var n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);return n>=i?void 0:{from:n,to:i}}var zu=ye.define({map:ju}),Du=ye.define({map:ju});function Eu(t){var e,n=[],r=i(t.state.selection.ranges);try{var o=function(){var i=e.value.head;if(n.some((function(t){return t.from<=i&&t.to>=i})))return 1;n.push(t.lineBlockAt(i))};for(r.s();!(e=r.n()).done;)o()}catch(a){r.e(a)}finally{r.f()}return n}var _u=Ht.define({create:function(){return di.none},update:function(t,e){t=t.map(e.changes);var n,r=i(e.effects);try{var o=function(){var i=n.value;if(i.is(zu)&&!function(t,e,n){var i=!1;return t.between(e,e,(function(t,r){t==e&&r==n&&(i=!0)})),i}(t,i.value.from,i.value.to)){var r=e.state.facet(Gu).preparePlaceholder,o=r?di.replace({widget:new Ju(r(e.state,i.value))}):Fu;t=t.update({add:[o.range(i.value.from,i.value.to)]})}else i.is(Du)&&(t=t.update({filter:function(t,e){return i.value.from!=t||i.value.to!=e},filterFrom:i.value.from,filterTo:i.value.to}))};for(r.s();!(n=r.n()).done;)o()}catch(l){r.e(l)}finally{r.f()}if(e.selection){var a=!1,s=e.selection.main.head;t.between(s,s,(function(t,e){ts&&(a=!0)})),a&&(t=t.update({filterFrom:s,filterTo:s,filter:function(t,e){return e<=s||t>=s}}))}return t},provide:function(t){return oa.decorations.from(t)},toJSON:function(t,e){var n=[];return t.between(0,e.doc.length,(function(t,e){n.push(t,e)})),n},fromJSON:function(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");for(var e=[],n=0;nt)&&(r={from:t,to:e})})),r}function Uu(t,e){return t.field(_u,!1)?e:e.concat(ye.appendConfig.of(Lu()))}function Nu(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.state.doc.lineAt(e.from).number,r=t.state.doc.lineAt(e.to).number;return oa.announce.of("".concat(t.state.phrase(n?"Folded lines":"Unfolded lines")," ").concat(i," ").concat(t.state.phrase("to")," ").concat(r,"."))}var Bu=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:function(t){var e,n=i(Eu(t));try{for(n.s();!(e=n.n()).done;){var r=e.value,o=qu(t.state,r.from,r.to);if(o)return t.dispatch({effects:Uu(t.state,[zu.of(o),Nu(t,o)])}),!0}}catch(a){n.e(a)}finally{n.f()}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:function(t){if(!t.state.field(_u,!1))return!1;var e,n=[],r=i(Eu(t));try{for(r.s();!(e=r.n()).done;){var o=e.value,a=Vu(t.state,o.from,o.to);a&&n.push(Du.of(a),Nu(t,a,!1))}}catch(s){r.e(s)}finally{r.f()}return n.length&&t.dispatch({effects:n}),n.length>0}},{key:"Ctrl-Alt-[",run:function(t){for(var e=t.state,n=[],i=0;i0&&void 0!==arguments[0]?arguments[0]:{},e=Object.assign(Object.assign({},Ku),t),n=new th(e,!0),r=new th(e,!1),o=lr.fromClass(function(){function t(e){O(this,t),this.from=e.viewport.from,this.markers=this.buildMarkers(e)}return v(t,[{key:"update",value:function(t){(t.docChanged||t.viewportChanged||t.startState.facet(gu)!=t.state.facet(gu)||t.startState.field(_u,!1)!=t.state.field(_u,!1)||lu(t.startState)!=lu(t.state)||e.foldingChanged(t))&&(this.markers=this.buildMarkers(t.view))}},{key:"buildMarkers",value:function(t){var e,o=new je,a=i(t.viewportLineBlocks);try{for(a.s();!(e=a.n()).done;){var s=e.value,l=Vu(t.state,s.from,s.to)?r:qu(t.state,s.from,s.to)?n:null;l&&o.add(s.from,s.from,l)}}catch(u){a.e(u)}finally{a.f()}return o.finish()}}]),t}()),a=e.domEventHandlers;return[o,Cs({class:"cm-foldGutter",markers:function(t){var e;return(null===(e=t.plugin(o))||void 0===e?void 0:e.markers)||qe.empty},initialSpacer:function(){return new th(e,!1)},domEventHandlers:Object.assign(Object.assign({},a),{click:function(t,e,n){if(a.click&&a.click(t,e,n))return!0;var i=Vu(t.state,e.from,e.to);if(i)return t.dispatch({effects:Du.of(i)}),!0;var r=qu(t.state,e.from,e.to);return!!r&&(t.dispatch({effects:zu.of(r)}),!0)}})}),Lu()]}var nh=oa.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),ih=function(){function t(e,n){var i;function r(t){var e=tn.newName();return(i||(i=Object.create(null)))["."+e]=t,e}O(this,t),this.specs=e;var o="string"==typeof n.all?n.all:n.all?r(n.all):void 0,a=n.scope;this.scope=a instanceof ou?function(t){return t.prop(nu)==a.data}:a?function(t){return t==a}:void 0,this.style=Yl(e.map((function(t){return{tag:t.tag,class:t.class||r(Object.assign({},t,{tag:null}))}})),{all:o}).style,this.module=i?new tn(i):null,this.themeType=n.themeType}return v(t,null,[{key:"define",value:function(e,n){return new t(e,n||{})}}]),t}(),rh=Ut.define(),oh=Ut.define({combine:function(t){return t.length?[t[0]]:null}});function ah(t){var e=t.facet(rh);return e.length?e:t.facet(oh)}var sh=function(){function t(e){O(this,t),this.markCache=Object.create(null),this.tree=lu(e.state),this.decorations=this.buildDeco(e,ah(e.state)),this.decoratedTo=e.viewport.to}return v(t,[{key:"update",value:function(t){var e=lu(t.state),n=ah(t.state),i=n!=ah(t.startState),r=t.view.viewport,o=t.changes.mapPos(this.decoratedTo,1);e.length=r.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(e!=this.tree||t.viewportChanged||i)&&(this.tree=e,this.decorations=this.buildDeco(t.view,n),this.decoratedTo=r.to)}},{key:"buildDeco",value:function(t,e){var n=this;if(!e||!this.tree.length)return di.none;var r,o=new je,a=i(t.visibleRanges);try{for(a.s();!(r=a.n()).done;){var s=r.value,l=s.from,u=s.to;ql(this.tree,e,(function(t,e,i){o.add(t,e,n.markCache[i]||(n.markCache[i]=di.mark({class:i})))}),l,u)}}catch(h){a.e(h)}finally{a.f()}return o.finish()}}]),t}(),lh=ne.high(lr.fromClass(sh,{decorations:function(t){return t.decorations}})),uh=ih.define([{tag:eu.meta,color:"#404740"},{tag:eu.link,textDecoration:"underline"},{tag:eu.heading,textDecoration:"underline",fontWeight:"bold"},{tag:eu.emphasis,fontStyle:"italic"},{tag:eu.strong,fontWeight:"bold"},{tag:eu.strikethrough,textDecoration:"line-through"},{tag:eu.keyword,color:"#708"},{tag:[eu.atom,eu.bool,eu.url,eu.contentSeparator,eu.labelName],color:"#219"},{tag:[eu.literal,eu.inserted],color:"#164"},{tag:[eu.string,eu.deleted],color:"#a11"},{tag:[eu.regexp,eu.escape,eu.special(eu.string)],color:"#e40"},{tag:eu.definition(eu.variableName),color:"#00f"},{tag:eu.local(eu.variableName),color:"#30a"},{tag:[eu.typeName,eu.namespace],color:"#085"},{tag:eu.className,color:"#167"},{tag:[eu.special(eu.variableName),eu.macroName],color:"#256"},{tag:eu.definition(eu.propertyName),color:"#00c"},{tag:eu.comment,color:"#940"},{tag:eu.invalid,color:"#f00"}]),hh=oa.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),ch=1e4,fh="()[]{}",dh=Ut.define({combine:function(t){return Ce(t,{afterCursor:!0,brackets:fh,maxScanDistance:ch,renderMatch:vh})}}),Oh=di.mark({class:"cm-matchingBracket"}),ph=di.mark({class:"cm-nonmatchingBracket"});function vh(t){var e=[],n=t.matched?Oh:ph;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}var gh=Ht.define({create:function(){return di.none},update:function(t,e){if(!e.docChanged&&!e.selection)return t;var n,r=[],o=e.state.facet(dh),a=i(e.state.selection.ranges);try{for(a.s();!(n=a.n()).done;){var s=n.value;if(s.empty){var l=Qh(e.state,s.head,-1,o)||s.head>0&&Qh(e.state,s.head-1,1,o)||o.afterCursor&&(Qh(e.state,s.head,1,o)||s.head0&&void 0!==arguments[0]?arguments[0]:{};return[dh.of(t),mh]}var kh=new Js;function bh(t,e,n){var i=t.prop(e<0?Js.openedBy:Js.closedBy);if(i)return i;if(1==t.name.length){var r=n.indexOf(t.name);if(r>-1&&r%2==(e<0?1:0))return[n[r+e]]}return null}function wh(t){var e=t.type.prop(kh);return e?e(t.node):t}function Qh(t,e,n){for(var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=i.maxScanDistance||ch,o=i.brackets||fh,a=lu(t),s=a.resolveInner(e,n),l=s;l;l=l.parent){var u=bh(l.type,n,o);if(u&&l.from0?e>=h.from&&eh.from&&e<=h.to))return xh(t,e,n,l,h,u,o)}}return function(t,e,n,i,r,o,a){var s=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=a.indexOf(s);if(l<0||l%2==0!=n>0)return null;for(var u={from:n<0?e-1:e,to:n>0?e+1:e},h=t.doc.iterRange(e,n>0?t.doc.length:0),c=0,f=0;!h.next().done&&f<=o;){var d=h.value;n<0&&(f+=d.length);for(var O=e+f*n,p=n>0?0:d.length-1,v=n>0?d.length:-1;p!=v;p+=n){var g=a.indexOf(d[p]);if(!(g<0||i.resolveInner(O+p,1).type!=r))if(g%2==0==n>0)c++;else{if(1==c)return{start:u,end:{from:O+p,to:O+p+1},matched:g>>1==l>>1};c--}}n>0&&(f+=d.length)}return h.done?{start:u,matched:!1}:null}(t,e,n,a,s.type,r,o)}function xh(t,e,n,i,r,o,a){var s=i.parent,l={from:r.from,to:r.to},u=0,h=null==s?void 0:s.cursor();if(h&&(n<0?h.childBefore(i.from):h.childAfter(i.to)))do{if(n<0?h.to<=i.from:h.from>=i.to){if(0==u&&o.indexOf(h.type.name)>-1&&h.from-1||($h.push(t),console.warn(e))}function Yh(e,n){var r,o=[],a=i(n.split(" "));try{for(a.s();!(r=a.n()).done;){var s,l=r.value,u=[],h=i(l.split("."));try{for(h.s();!(s=h.n()).done;){var c=s.value,f=e[c]||eu[c];f?"function"==typeof f?u.length?u=u.map(f):Xh(c,"Modifier ".concat(c," used at start of tag")):u.length?Xh(c,"Tag ".concat(c," used as modifier")):u=Array.isArray(f)?f:[f]:Xh(c,"Unknown highlighting tag ".concat(c))}}catch(k){h.e(k)}finally{h.f()}var d,O=i(u);try{for(O.s();!(d=O.n()).done;){var p=d.value;o.push(p)}}catch(k){O.e(k)}finally{O.f()}}}catch(k){a.e(k)}finally{a.f()}if(!o.length)return 0;var v=n.replace(/ /g,"_"),g=v+" "+o.map((function(t){return t.id})),m=Zh[g];if(m)return m.id;var y=Zh[g]=el.define({id:Ph.length,name:v,props:[Ml(t({},v,o))]});return Ph.push(y),y.id}wi.RTL,wi.LTR;function qh(t,e){return function(n){var i=n.state,r=n.dispatch;if(i.readOnly)return!1;var o=t(e,i);return!!o&&(r(i.update(o)),!0)}}var jh=qh(Uh,0),zh=qh(Vh,0),Dh=qh((function(t,e){return Vh(t,e,function(t){var e,n=[],r=i(t.selection.ranges);try{for(r.s();!(e=r.n()).done;){var o=e.value,a=t.doc.lineAt(o.from),s=o.to<=a.to?a:t.doc.lineAt(o.to),l=n.length-1;l>=0&&n[l].to>a.from?n[l].to=s.to:n.push({from:a.from+/^\s*/.exec(a.text)[0].length,to:s.to})}}catch(u){r.e(u)}finally{r.f()}return n}(e))}),0);function Eh(t,e){var n=t.languageDataAt("commentTokens",e);return n.length?n[0]:{}}var _h=50;function Vh(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.selection.ranges,i=n.map((function(t){return Eh(e,t.from).block}));if(!i.every((function(t){return t})))return null;var r=n.map((function(t,n){return function(t,e,n,i){var r,o,a=e.open,s=e.close,l=t.sliceDoc(n-_h,n),u=t.sliceDoc(i,i+_h),h=/\s*$/.exec(l)[0].length,c=/^\s*/.exec(u)[0].length,f=l.length-h;if(l.slice(f-a.length,f)==a&&u.slice(c,c+s.length)==s)return{open:{pos:n-h,margin:h&&1},close:{pos:i+c,margin:c&&1}};i-n<=2*_h?r=o=t.sliceDoc(n,i):(r=t.sliceDoc(n,n+_h),o=t.sliceDoc(i-_h,i));var d=/^\s*/.exec(r)[0].length,O=/\s*$/.exec(o)[0].length,p=o.length-O-s.length;return r.slice(d,d+a.length)==a&&o.slice(p,p+s.length)==s?{open:{pos:n+d+a.length,margin:/\s/.test(r.charAt(d+a.length))?1:0},close:{pos:i-O-s.length,margin:/\s/.test(o.charAt(p-1))?1:0}}:null}(e,i[n],t.from,t.to)}));if(2!=t&&!r.every((function(t){return t})))return{changes:e.changes(n.map((function(t,e){return r[e]?[]:[{from:t.from,insert:i[e].open+" "},{from:t.to,insert:" "+i[e].close}]})))};if(1!=t&&r.some((function(t){return t}))){for(var o,a=[],s=0;s2&&void 0!==arguments[2]?arguments[2]:e.selection.ranges);try{for(a.s();!(n=a.n()).done;){var s=n.value,l=s.from,u=s.to,h=r.length,c=1e9,f=Eh(e,l).line;if(f){for(var d=l;d<=u;){var O=e.doc.lineAt(d);if(O.from>o&&(l==u||u>O.from)){o=O.from;var p=/^\s*/.exec(O.text)[0].length,v=p==O.length,g=O.text.slice(p,p+f.length)==f?p:-1;p=0}))){var Z,R=[],T=i(r);try{for(T.s();!(Z=T.n()).done;){var A=Z.value,C=A.line,M=A.comment,W=A.token;if(M>=0){var X=C.from+M,Y=X+W.length;" "==C.text[Y-C.from]&&Y++,R.push({from:X,to:Y})}}}catch(q){T.e(q)}finally{T.f()}return{changes:R}}return null}var Nh=ve.define(),Bh=ve.define(),Ih=Ut.define(),Gh=Ut.define({combine:function(t){return Ce(t,{minDepth:100,newGroupDelay:500,joinToEvent:function(t,e){return e}},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:function(t,e){return function(n,i){return t(n,i)||e(n,i)}}})}}),Lh=Ht.define({create:function(){return fc.empty},update:function(t,e){var n=e.state.facet(Gh),i=e.annotation(Nh);if(i){var r=nc.fromTransaction(e,i.selection),o=i.side,a=0==o?t.undone:t.done;return a=r?ic(a,a.length,n.minDepth,r):sc(a,e.startState.selection),new fc(0==o?i.rest:a,0==o?a:i.rest)}var s=e.annotation(Bh);if("full"!=s&&"before"!=s||(t=t.isolate()),!1===e.annotation(ke.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);var l=nc.fromTransaction(e),u=e.annotation(ke.time),h=e.annotation(ke.userEvent);return l?t=t.addChanges(l,u,h,n,e):e.selection&&(t=t.addSelection(e.startState.selection,u,h,n.newGroupDelay)),"full"!=s&&"after"!=s||(t=t.isolate()),t},toJSON:function(t){return{done:t.done.map((function(t){return t.toJSON()})),undone:t.undone.map((function(t){return t.toJSON()}))}},fromJSON:function(t){return new fc(t.done.map(nc.fromJSON),t.undone.map(nc.fromJSON))}});function Hh(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Lh,Gh.of(t),oa.domEventHandlers({beforeinput:function(t,e){var n="historyUndo"==t.inputType?Jh:"historyRedo"==t.inputType?Kh:null;return!!n&&(t.preventDefault(),n(e))}})]}function Fh(t,e){return function(n){var i=n.state,r=n.dispatch;if(!e&&i.readOnly)return!1;var o=i.field(Lh,!1);if(!o)return!1;var a=o.pop(t,i,e);return!!a&&(r(a),!0)}}var Jh=Fh(0,!1),Kh=Fh(1,!1),tc=Fh(0,!0),ec=Fh(1,!0),nc=function(){function t(e,n,i,r,o){O(this,t),this.changes=e,this.effects=n,this.mapped=i,this.startSelection=r,this.selectionsAfter=o}return v(t,[{key:"setSelAfter",value:function(e){return new t(this.changes,this.effects,this.mapped,this.startSelection,e)}},{key:"toJSON",value:function(){var t,e,n;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((function(t){return t.toJSON()}))}}}],[{key:"fromJSON",value:function(e){return new t(e.changes&&Mt.fromJSON(e.changes),[],e.mapped&&Ct.fromJSON(e.mapped),e.startSelection&&Et.fromJSON(e.startSelection),e.selectionsAfter.map(Et.fromJSON))}},{key:"fromTransaction",value:function(e,n){var r,o=oc,a=i(e.startState.facet(Ih));try{for(a.s();!(r=a.n()).done;){var s=(0,r.value)(e);s.length&&(o=o.concat(s))}}catch(l){a.e(l)}finally{a.f()}return!o.length&&e.changes.empty?null:new t(e.changes.invert(e.startState.doc),o,void 0,n||e.startState.selection,oc)}},{key:"selection",value:function(e){return new t(void 0,oc,void 0,void 0,e)}}]),t}();function ic(t,e,n,i){var r=e+1>n+20?e-n-1:0,o=t.slice(r,e);return o.push(i),o}function rc(t,e){return t.length?e.length?t.concat(e):t:e}var oc=[],ac=200;function sc(t,e){if(t.length){var n=t[t.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-ac));return i.length&&i[i.length-1].eq(e)?t:(i.push(e),ic(t,t.length-1,1e9,n.setSelAfter(i)))}return[nc.selection([e])]}function lc(t){var e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function uc(t,e){if(!t.length)return t;for(var n=t.length,i=oc;n;){var r=hc(t[n-1],e,i);if(r.changes&&!r.changes.empty||r.effects.length){var o=t.slice(0,n);return o[n-1]=r,o}e=r.mapped,n--,i=r.selectionsAfter}return i.length?[nc.selection(i)]:oc}function hc(t,e,n){var i=rc(t.selectionsAfter.length?t.selectionsAfter.map((function(t){return t.map(e)})):oc,n);if(!t.changes)return nc.selection(i);var r=t.changes.map(e),o=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(o):o;return new nc(r,ye.mapEffects(t.effects,e),a,t.startSelection.map(o),i)}var cc=/^(input\.type|delete)($|\.)/,fc=function(){function t(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;O(this,t),this.done=e,this.undone=n,this.prevTime=i,this.prevUserEvent=r}return v(t,[{key:"isolate",value:function(){return this.prevTime?new t(this.done,this.undone):this}},{key:"addChanges",value:function(e,n,i,r,o){var a=this.done,s=a[a.length-1];return a=s&&s.changes&&!s.changes.empty&&e.changes&&(!i||cc.test(i))&&(!s.selectionsAfter.length&&n-this.prevTime=s&&r<=l&&(i=!0)}})),i}(s.changes,e.changes))||"input.type.compose"==i)?ic(a,a.length-1,r.minDepth,new nc(e.changes.compose(s.changes),rc(e.effects,s.effects),s.mapped,s.startSelection,oc)):ic(a,a.length,r.minDepth,e),new t(a,oc,n,i)}},{key:"addSelection",value:function(e,n,i,r){var o,a,s=this.done.length?this.done[this.done.length-1].selectionsAfter:oc;return s.length>0&&n-this.prevTime2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function xc(t,e,n){for(var i=lu(t).resolveInner(e.head),r=n?Js.closedBy:Js.openedBy,o=e.head;;){var a=n?i.childAfter(o):i.childBefore(o);if(!a)break;Qc(t,a,r)?i=a:o=n?a.to:a.from}var s,l;return l=i.type.prop(r)&&(s=n?Qh(t,i.from,1):Qh(t,i.to,-1))&&s.matched?n?s.end.to:s.end.from:n?i.to:i.from,Et.cursor(l,n?-1:1)}function Sc(t,e){return vc(t,(function(n){if(!n.empty)return gc(n,e);var i=t.moveVertically(n,e);return i.head!=n.head?i:t.moveToLineBoundary(n,e)}))}var Pc=function(t){return Sc(t,!1)},$c=function(t){return Sc(t,!0)};function Zc(t){var e,n=t.scrollDOM.clientHeightl&&a.bottomr&&(n="delete.forward",a=Lc(t,a,!0)),r=Math.min(r,a),o=Math.max(o,a)}else r=Lc(t,r,!1),o=Lc(t,o,!0);return r==o?{range:i}:{changes:{from:r,to:o},range:Et.cursor(r,re&&(e=n?i:t)}))}}catch(a){o.e(a)}finally{o.f()}}return e}var Hc=function(t,e,n){return Gc(t,(function(i){var r,o,a=i.from,s=t.state,l=s.doc.lineAt(a);if(n&&!e&&a>l.from&&a=s.number){var u=n[n.length-1];u.to=l.to,u.ranges.push(a)}else n.push({from:s.from,to:l.to,ranges:[a]});r=l.number+1}}catch(h){o.e(h)}finally{o.f()}return n}function nf(t,e,n){if(t.readOnly)return!1;var r,o=[],a=[],s=i(ef(t));try{for(s.s();!(r=s.n()).done;){var l=r.value;if(n?l.to!=t.doc.length:0!=l.from){var u=t.doc.lineAt(n?l.to+1:l.from-1),h=u.length+1;if(n){o.push({from:l.to,to:u.to},{from:l.from,insert:u.text+t.lineBreak});var c,f=i(l.ranges);try{for(f.s();!(c=f.n()).done;){var d=c.value;a.push(Et.range(Math.min(t.doc.length,d.anchor+h),Math.min(t.doc.length,d.head+h)))}}catch(g){f.e(g)}finally{f.f()}}else{o.push({from:u.from,to:l.from},{from:l.to,insert:t.lineBreak+u.text});var O,p=i(l.ranges);try{for(p.s();!(O=p.n()).done;){var v=O.value;a.push(Et.range(v.anchor-h,v.head-h))}}catch(g){p.e(g)}finally{p.f()}}}}}catch(g){s.e(g)}finally{s.f()}return!!o.length&&(e(t.update({changes:o,scrollIntoView:!0,selection:Et.create(a,t.selection.mainIndex),userEvent:"move.line"})),!0)}function rf(t,e,n){if(t.readOnly)return!1;var r,o=[],a=i(ef(t));try{for(a.s();!(r=a.n()).done;){var s=r.value;n?o.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):o.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)})}}catch(l){a.e(l)}finally{a.f()}return e(t.update({changes:o,scrollIntoView:!0,userEvent:"input.copyline"})),!0}var of=af(!1);function af(t){return function(e){var n=e.state,i=e.dispatch;if(n.readOnly)return!1;var r=n.changeByRange((function(e){var i=e.from,r=e.to,o=n.doc.lineAt(i),a=!t&&i==r&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};var n,i=lu(t).resolveInner(e),r=i.childBefore(e),o=i.childAfter(e);return r&&o&&r.to<=e&&o.from>=e&&(n=r.type.prop(Js.closedBy))&&n.indexOf(o.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(o.from).from&&!/\S/.test(t.sliceDoc(r.to,o.from))?{from:r.to,to:o.from}:null}(n,i);t&&(i=r=(r<=o.to?o:n.doc.lineAt(r)).to);var s=new xu(n,{simulateBreak:i,simulateDoubleBreak:!!a}),l=Qu(s,i);for(null==l&&(l=Le(/^\s*/.exec(n.doc.lineAt(i).text)[0],n.tabSize));ro.from&&in&&(i.empty||i.to>a.from)&&(e(a,r,i),n=a.number),o=a.to+1}var s=t.changes(r);return{changes:r,range:Et.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}}))}var lf=function(t){var e=t.state,n=t.dispatch;return!e.readOnly&&(n(e.update(sf(e,(function(t,n){n.push({from:t.from,insert:e.facet(ku)})})),{userEvent:"input.indent"})),!0)},uf=function(t){var e=t.state,n=t.dispatch;return!e.readOnly&&(n(e.update(sf(e,(function(t,n){var i=/^\s*/.exec(t.text)[0];if(i){for(var r=Le(i,e.tabSize),o=0,a=wu(e,Math.max(0,r-bu(e)));o1?r=Et.create([i.main]):i.main.empty||(r=Et.create([Et.cursor(i.main.head)])),!!r&&(n(pc(e,r)),!0)}},{key:"Mod-Enter",run:af(!0)},{key:"Alt-l",mac:"Ctrl-l",run:function(t){var e=t.state,n=t.dispatch,i=ef(e).map((function(t){var n=t.from,i=t.to;return Et.range(n,Math.min(i+1,e.doc.length))}));return n(e.update({selection:Et.create(i),userEvent:"select"})),!0}},{key:"Mod-i",run:function(t){var e=t.state,n=t.dispatch,i=Oc(e.selection,(function(t){for(var n,i=lu(e).resolveStack(t.from,1);i;i=i.next){var r=i.node;if((r.from=t.to||r.to>t.to&&r.from<=t.from)&&(null===(n=r.parent)||void 0===n?void 0:n.parent))return Et.range(r.to,r.from)}return t}));return n(pc(e,i)),!0},preventDefault:!0},{key:"Mod-[",run:uf},{key:"Mod-]",run:lf},{key:"Mod-Alt-\\",run:function(t){var e=t.state,n=t.dispatch;if(e.readOnly)return!1;var i=Object.create(null),r=new xu(e,{overrideIndentation:function(t){var e=i[t];return null==e?-1:e}}),o=sf(e,(function(t,n,o){var a=Qu(r,t.from);if(null!=a){/\S/.test(t.text)||(a=0);var s=/^\s*/.exec(t.text)[0],l=wu(e,a);(s!=l||o.from0?n--:i0&&Qh(t,e.head-1,1)||e.headn?n:Math.max(0,e.head-1)}))}},{mac:"Mod-Delete",run:function(t){return Gc(t,(function(e){var n=t.moveToLineBoundary(e,!0).head;return e.head2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.length,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;O(this,t),this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,r),this.bufferStart=i,this.normalize=o?function(t){return o(Of(t))}:Of,this.query=this.normalize(n)}return v(t,[{key:"peek",value:function(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return $t(this.buffer,this.bufferPos)}},{key:"next",value:function(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}},{key:"nextOverlapping",value:function(){for(;;){var t=this.peek();if(t<0)return this.done=!0,this;var e=Zt(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=Rt(t);for(var i=this.normalize(e),r=0,o=n;;r++){var a=i.charCodeAt(r),s=this.match(a,o,this.bufferPos+this.bufferStart);if(r==i.length-1){if(s)return this.value=s,this;break}o==n&&r3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e.length;if(O(this,t),this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=vf,/\\[sWDnr]|\n|\r|\[\^/.test(n))return new bf(e,n,i,r,o);this.re=new RegExp(n,gf+((null==i?void 0:i.ignoreCase)?"i":"")),this.test=null==i?void 0:i.test,this.iter=e.iter();var a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=wf(e,r),this.getLine(this.curLineStart)}return v(t,[{key:"getLine",value:function(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}},{key:"nextLine",value:function(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}},{key:"next",value:function(){for(var t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;var e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){var n=this.curLineStart+e.index,i=n+e[0].length;if(this.matchPos=wf(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,i,e)))return this.value={from:n,to:i,match:e},this;t=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=i||r.to<=n){var o=new t(n,e.sliceString(n,i));return yf.set(e,o),o}if(r.from==n&&r.to==i)return r;var a=r.text,s=r.from;return s>n&&(a=e.sliceString(n,s)+a,s=n),r.to=this.to?this.to:this.text.lineAt(t).to}},{key:"next",value:function(){for(;;){var t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){var n=this.flat.from+e.index,i=n+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,i,e)))return this.value={from:n,to:i,match:e},this.matchPos=wf(this.text,i+(n==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=kf.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}]),t}();function wf(t,e){if(e>=t.length)return e;for(var n,i=t.lineAt(e);e=56320&&n<57344;)e++;return e}function Qf(t){var e=ff("input",{class:"cm-textfield",name:"line",value:String(t.state.doc.lineAt(t.state.selection.main.head).number)});function n(){var n=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(e.value);if(n){var i=t.state,r=i.doc.lineAt(i.selection.main.head),o=c(n,5),a=o[1],s=o[2],l=o[3],u=o[4],h=l?+l.slice(1):0,f=s?+s:r.number;if(s&&u){var d=f/100;a&&(d=d*("-"==a?-1:1)+r.number/i.doc.lines),f=Math.round(i.doc.lines*d)}else s&&a&&(f=f*("-"==a?-1:1)+r.number);var O=i.doc.line(Math.max(1,Math.min(i.doc.lines,f))),p=Et.cursor(O.from+Math.max(0,Math.min(h,O.length)));t.dispatch({effects:[xf.of(!1),oa.scrollIntoView(p.from,{y:"center"})],selection:p}),t.focus()}}return{dom:ff("form",{class:"cm-gotoLine",onkeydown:function(e){27==e.keyCode?(e.preventDefault(),t.dispatch({effects:xf.of(!1)}),t.focus()):13==e.keyCode&&(e.preventDefault(),n())},onsubmit:function(t){t.preventDefault(),n()}},ff("label",t.state.phrase("Go to line"),": ",e)," ",ff("button",{class:"cm-button",type:"submit"},t.state.phrase("go")))}}"undefined"!=typeof Symbol&&(mf.prototype[Symbol.iterator]=bf.prototype[Symbol.iterator]=function(){return this});var xf=ye.define(),Sf=Ht.define({create:function(){return!0},update:function(t,e){var n,r=i(e.effects);try{for(r.s();!(n=r.n()).done;){var o=n.value;o.is(xf)&&(t=o.value)}}catch(a){r.e(a)}finally{r.f()}return t},provide:function(t){return $s.from(t,(function(t){return t?Qf:null}))}}),Pf=oa.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),$f={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Zf=Ut.define({combine:function(t){return Ce(t,$f,{highlightWordAroundCursor:function(t,e){return t||e},minSelectionLength:Math.min,maxMatches:Math.min})}});function Rf(t){var e=[Wf,Mf];return t&&e.push(Zf.of(t)),e}var Tf=di.mark({class:"cm-selectionMatch"}),Af=di.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Cf(t,e,n,i){return!(0!=n&&t(e.sliceDoc(n-1,n))==Ze.Word||i!=e.doc.length&&t(e.sliceDoc(i,i+1))==Ze.Word)}var Mf=lr.fromClass(function(){function t(e){O(this,t),this.decorations=this.getDeco(e)}return v(t,[{key:"update",value:function(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}},{key:"getDeco",value:function(t){var e=t.state.facet(Zf),n=t.state,r=n.selection;if(r.ranges.length>1)return di.none;var o,a=r.main,s=null;if(a.empty){if(!e.highlightWordAroundCursor)return di.none;var l=n.wordAt(a.head);if(!l)return di.none;s=n.charCategorizer(a.head),o=n.sliceDoc(l.from,l.to)}else{var u=a.to-a.from;if(u200)return di.none;if(e.wholeWords){if(o=n.sliceDoc(a.from,a.to),!Cf(s=n.charCategorizer(a.head),n,a.from,a.to)||!function(t,e,n,i){return t(e.sliceDoc(n,n+1))==Ze.Word&&t(e.sliceDoc(i-1,i))==Ze.Word}(s,n,a.from,a.to))return di.none}else if(!(o=n.sliceDoc(a.from,a.to)))return di.none}var h,c=[],f=i(t.visibleRanges);try{for(f.s();!(h=f.n()).done;)for(var d=h.value,O=new pf(n.doc,o,d.from,d.to);!O.next().done;){var p=O.value,v=p.from,g=p.to;if((!s||Cf(s,n,v,g))&&(a.empty&&v<=a.from&&g>=a.to?c.push(Af.range(v,g)):(v>=a.to||g<=a.from)&&c.push(Tf.range(v,g)),c.length>e.maxMatches))return di.none}}catch(m){f.e(m)}finally{f.f()}return di.set(c)}}]),t}(),{decorations:function(t){return t.decorations}}),Wf=oa.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});var Xf=Ut.define({combine:function(t){return Ce(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:function(t){return new hd(t)},scrollToMatch:function(t){return oa.scrollIntoView(t)}})}}),Yf=function(){function t(e){O(this,t),this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(t){try{return new RegExp(t,gf),!0}catch(zl){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}return v(t,[{key:"unquote",value:function(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(function(t,e){return"n"==e?"\n":"r"==e?"\r":"t"==e?"\t":"\\"}))}},{key:"eq",value:function(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}},{key:"create",value:function(){return this.regexp?new Vf(this):new zf(this)}},{key:"getCursor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2?arguments[2]:void 0,i=t.doc?t:Ae.create({doc:t});return null==n&&(n=i.doc.length),this.regexp?Df(this,i,e,n):jf(this,i,e,n)}}]),t}(),qf=v((function t(e){O(this,t),this.spec=e}));function jf(t,e,n,i){return new pf(e.doc,t.unquoted,n,i,t.caseSensitive?void 0:function(t){return t.toLowerCase()},t.wholeWord?function(t,e){return function(n,i,r,o){return(o>n||o+r.length=e)return null;i.push(n.value)}return i}},{key:"highlight",value:function(t,e,n,i){for(var r=jf(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,t.doc.length));!r.next().done;)i(r.value.from,r.value.to)}}]),e}(qf);function Df(t,e,n,i){return new mf(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?(r=e.charCategorizer(e.selection.main.head),function(t,e,n){return!n[0].length||(r(Ef(n.input,n.index))!=Ze.Word||r(_f(n.input,n.index))!=Ze.Word)&&(r(_f(n.input,n.index+n[0].length))!=Ze.Word||r(Ef(n.input,n.index+n[0].length))!=Ze.Word)}):void 0},n,i);var r}function Ef(t,e){return t.slice(wt(t,e,!1),e)}function _f(t,e){return t.slice(e,wt(t,e))}var Vf=function(t){function e(){return O(this,e),r(this,e,arguments)}return u(e,t),v(e,[{key:"nextMatch",value:function(t,e,n){var i=Df(this.spec,t,n,t.doc.length).next();return i.done&&(i=Df(this.spec,t,0,e).next()),i.done?null:i.value}},{key:"prevMatchInRange",value:function(t,e,n){for(var i=1;;i++){for(var r=Math.max(e,n-1e4*i),o=Df(this.spec,t,r,n),a=null;!o.next().done;)a=o.value;if(a&&(r==e||a.from>r+10))return a;if(r==e)return null}}},{key:"prevMatch",value:function(t,e,n){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,n,t.doc.length)}},{key:"getReplacement",value:function(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(function(e,n){return"$"==n?"$":"&"==n?t.match[0]:"0"!=n&&+n=e)return null;i.push(n.value)}return i}},{key:"highlight",value:function(t,e,n,i){for(var r=Df(this.spec,t,Math.max(0,e-250),Math.min(n+250,t.doc.length));!r.next().done;)i(r.value.from,r.value.to)}}]),e}(qf),Uf=ye.define(),Nf=ye.define(),Bf=Ht.define({create:function(t){return new If(rd(t).create(),null)},update:function(t,e){var n,r=i(e.effects);try{for(r.s();!(n=r.n()).done;){var o=n.value;o.is(Uf)?t=new If(o.value.create(),t.panel):o.is(Nf)&&(t=new If(t.query,o.value?id:null))}}catch(a){r.e(a)}finally{r.f()}return t},provide:function(t){return $s.from(t,(function(t){return t.panel}))}}),If=v((function t(e,n){O(this,t),this.query=e,this.panel=n})),Gf=di.mark({class:"cm-searchMatch"}),Lf=di.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Hf=lr.fromClass(function(){function t(e){O(this,t),this.view=e,this.decorations=this.highlight(e.state.field(Bf))}return v(t,[{key:"update",value:function(t){var e=t.state.field(Bf);(e!=t.startState.field(Bf)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}},{key:"highlight",value:function(t){var e=t.query;if(!t.panel||!e.spec.valid)return di.none;for(var n=this.view,i=new je,r=0,o=n.visibleRanges,a=o.length;ro[r+1].from-500;)u=o[++r].to;e.highlight(n.state,l,u,(function(t,e){var r=n.state.selection.ranges.some((function(n){return n.from==t&&n.to==e}));i.add(t,e,r?Lf:Gf)}))}return i.finish()}}]),t}(),{decorations:function(t){return t.decorations}});function Ff(t){return function(e){var n=e.state.field(Bf,!1);return n&&n.query.spec.valid?t(e,n):sd(e)}}var Jf=Ff((function(t,e){var n=e.query,i=t.state.selection.main.to,r=n.nextMatch(t.state,i,i);if(!r)return!1;var o=Et.single(r.from,r.to),a=t.state.facet(Xf);return t.dispatch({selection:o,effects:[Od(t,r),a.scrollToMatch(o.main,t)],userEvent:"select.search"}),ad(t),!0})),Kf=Ff((function(t,e){var n=e.query,i=t.state,r=i.selection.main.from,o=n.prevMatch(i,r,r);if(!o)return!1;var a=Et.single(o.from,o.to),s=t.state.facet(Xf);return t.dispatch({selection:a,effects:[Od(t,o),s.scrollToMatch(a.main,t)],userEvent:"select.search"}),ad(t),!0})),td=Ff((function(t,e){var n=e.query.matchAll(t.state,1e3);return!(!n||!n.length)&&(t.dispatch({selection:Et.create(n.map((function(t){return Et.range(t.from,t.to)}))),userEvent:"select.search.matches"}),!0)})),ed=Ff((function(t,e){var n=e.query,i=t.state,r=i.selection.main,o=r.from,a=r.to;if(i.readOnly)return!1;var s=n.nextMatch(i,o,o);if(!s)return!1;var l,u,h=[],c=[];if(s.from==o&&s.to==a&&(u=i.toText(n.getReplacement(s)),h.push({from:s.from,to:s.to,insert:u}),s=n.nextMatch(i,s.from,s.to),c.push(oa.announce.of(i.phrase("replaced match on line $",i.doc.lineAt(o).number)+"."))),s){var f=0==h.length||h[0].from>=s.to?0:s.to-s.from-u.length;l=Et.single(s.from-f,s.to-f),c.push(Od(t,s)),c.push(i.facet(Xf).scrollToMatch(l.main,t))}return t.dispatch({changes:h,selection:l,effects:c,userEvent:"input.replace"}),!0})),nd=Ff((function(t,e){var n=e.query;if(t.state.readOnly)return!1;var i=n.matchAll(t.state,1e9).map((function(t){return{from:t.from,to:t.to,insert:n.getReplacement(t)}}));if(!i.length)return!1;var r=t.state.phrase("replaced $ matches",i.length)+".";return t.dispatch({changes:i,effects:oa.announce.of(r),userEvent:"input.replace.all"}),!0}));function id(t){return t.state.facet(Xf).createPanel(t)}function rd(t,e){var n,i,r,o,a,s=t.selection.main,l=s.empty||s.to>s.from+100?"":t.sliceDoc(s.from,s.to);if(e&&!l)return e;var u=t.facet(Xf);return new Yf({search:(null!==(n=null==e?void 0:e.literal)&&void 0!==n?n:u.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:null!==(i=null==e?void 0:e.caseSensitive)&&void 0!==i?i:u.caseSensitive,literal:null!==(r=null==e?void 0:e.literal)&&void 0!==r?r:u.literal,regexp:null!==(o=null==e?void 0:e.regexp)&&void 0!==o?o:u.regexp,wholeWord:null!==(a=null==e?void 0:e.wholeWord)&&void 0!==a?a:u.wholeWord})}function od(t){var e=Qs(t,id);return e&&e.dom.querySelector("[main-field]")}function ad(t){var e=od(t);e&&e==t.root.activeElement&&e.select()}var sd=function(t){var e=t.state.field(Bf,!1);if(e&&e.panel){var n=od(t);if(n&&n!=t.root.activeElement){var i=rd(t.state,e.query.spec);i.valid&&t.dispatch({effects:Uf.of(i)}),n.focus(),n.select()}}else t.dispatch({effects:[Nf.of(!0),e?Uf.of(rd(t.state,e.query.spec)):ye.appendConfig.of(vd)]});return!0},ld=function(t){var e=t.state.field(Bf,!1);if(!e||!e.panel)return!1;var n=Qs(t,id);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Nf.of(!1)}),!0},ud=[{key:"Mod-f",run:sd,scope:"editor search-panel"},{key:"F3",run:Jf,shift:Kf,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Jf,shift:Kf,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:ld,scope:"editor search-panel"},{key:"Mod-Shift-l",run:function(t){var e=t.state,n=t.dispatch,i=e.selection;if(i.ranges.length>1||i.main.empty)return!1;for(var r=i.main,o=r.from,a=r.to,s=[],l=0,u=new pf(e.doc,e.sliceDoc(o,a));!u.next().done;){if(s.length>1e3)return!1;u.value.from==o&&(l=s.length),s.push(Et.range(u.value.from,u.value.to))}return n(e.update({selection:Et.create(s,l),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:function(t){var e=Qs(t,Qf);if(!e){var n=[xf.of(!0)];null==t.state.field(Sf,!1)&&n.push(ye.appendConfig.of([Sf,Pf])),t.dispatch({effects:n}),e=Qs(t,Qf)}return e&&e.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:function(t){var e=t.state,n=t.dispatch,i=e.selection.ranges;if(i.some((function(t){return t.from===t.to})))return function(t){var e=t.state,n=t.dispatch,i=e.selection,r=Et.create(i.ranges.map((function(t){return e.wordAt(t.head)||Et.cursor(t.head)})),i.mainIndex);return!r.eq(i)&&(n(e.update({selection:r})),!0)}({state:e,dispatch:n});var r=e.sliceDoc(i[0].from,i[0].to);if(e.selection.ranges.some((function(t){return e.sliceDoc(t.from,t.to)!=r})))return!1;var o=function(t,e){for(var n,i=t.selection,r=i.main,o=i.ranges,a=t.wordAt(r.head),s=a&&a.from==r.from&&a.to==r.to,l=function(n,i){if(i.next(),!i.done){if(n&&o.some((function(t){return t.from==i.value.from})))return u=n,h=i,0;if(s){var r=t.wordAt(i.value.from);if(!r||r.from!=i.value.from||r.to!=i.value.to)return u=n,h=i,0}return{v:i.value}}if(n)return{v:null};i=new pf(t.doc,e,0,Math.max(0,o[o.length-1].from-1)),u=n=!0,h=i},u=!1,h=new pf(t.doc,e,o[o.length-1].to);;)if(0!==(n=l(u,h))&&n)return n.v}(e,r);return!!o&&(n(e.update({selection:e.selection.addRange(Et.range(o.from,o.to),!1),effects:oa.scrollIntoView(o.to)})),!0)},preventDefault:!0}],hd=function(){function t(n){var i=this;O(this,t),this.view=n;var r=this.query=n.state.field(Bf).query.spec;function o(t,e,n){return ff("button",{class:"cm-button",name:t,onclick:e,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=ff("input",{value:r.search,placeholder:cd(n,"Find"),"aria-label":cd(n,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=ff("input",{value:r.replace,placeholder:cd(n,"Replace"),"aria-label":cd(n,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=ff("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=ff("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=ff("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit}),this.dom=ff("div",{onkeydown:function(t){return i.keydown(t)},class:"cm-search"},[this.searchField,o("next",(function(){return Jf(n)}),[cd(n,"next")]),o("prev",(function(){return Kf(n)}),[cd(n,"previous")]),o("select",(function(){return td(n)}),[cd(n,"all")]),ff("label",null,[this.caseField,cd(n,"match case")]),ff("label",null,[this.reField,cd(n,"regexp")]),ff("label",null,[this.wordField,cd(n,"by word")])].concat(e(n.state.readOnly?[]:[ff("br"),this.replaceField,o("replace",(function(){return ed(n)}),[cd(n,"replace")]),o("replaceAll",(function(){return nd(n)}),[cd(n,"replace all")])]),[ff("button",{name:"close",onclick:function(){return ld(n)},"aria-label":cd(n,"close"),type:"button"},["×"])]))}return v(t,[{key:"commit",value:function(){var t=new Yf({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:Uf.of(t)}))}},{key:"keydown",value:function(t){var e,n,i;e=this.view,n=t,i="search-panel",ma(pa(e.state),n,e,i)?t.preventDefault():13==t.keyCode&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?Kf:Jf)(this.view)):13==t.keyCode&&t.target==this.replaceField&&(t.preventDefault(),ed(this.view))}},{key:"update",value:function(t){var e,n=i(t.transactions);try{for(n.s();!(e=n.n()).done;){var r,o=i(e.value.effects);try{for(o.s();!(r=o.n()).done;){var a=r.value;a.is(Uf)&&!a.value.eq(this.query)&&this.setQuery(a.value)}}catch(s){o.e(s)}finally{o.f()}}}catch(s){n.e(s)}finally{n.f()}}},{key:"setQuery",value:function(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}},{key:"mount",value:function(){this.searchField.select()}},{key:"pos",get:function(){return 80}},{key:"top",get:function(){return this.view.state.facet(Xf).top}}]),t}();function cd(t,e){return t.state.phrase(e)}var fd=30,dd=/[\s\.,:;?!]/;function Od(t,e){var n=e.from,i=e.to,r=t.state.doc.lineAt(n),o=t.state.doc.lineAt(i).to,a=Math.max(r.from,n-fd),s=Math.min(o,i+fd),l=t.state.sliceDoc(a,s);if(a!=r.from)for(var u=0;ul.length-fd;h--)if(!dd.test(l[h-1])&&dd.test(l[h])){l=l.slice(0,h);break}return oa.announce.of("".concat(t.state.phrase("current match"),". ").concat(l," ").concat(t.state.phrase("on line")," ").concat(r.number,"."))}var pd=oa.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),vd=[Bf,ne.low(Hf),pd],gd=function(){function t(e,n,i){O(this,t),this.state=e,this.pos=n,this.explicit=i,this.abortListeners=[]}return v(t,[{key:"tokenBefore",value:function(t){for(var e=lu(this.state).resolveInner(this.pos,-1);e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}},{key:"matchBefore",value:function(t){var e=this.state.doc.lineAt(this.pos),n=Math.max(e.from,this.pos-250),i=e.text.slice(n-e.from,this.pos-e.from),r=i.search(wd(t,!1));return r<0?null:{from:n+r,to:this.pos,text:i.slice(r)}}},{key:"aborted",get:function(){return null==this.abortListeners}},{key:"addEventListener",value:function(t,e){"abort"==t&&this.abortListeners&&this.abortListeners.push(e)}}]),t}();function md(t){var e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),"[".concat(n?"\\w":"").concat(e.replace(/[^\w\s]/g,"\\$&"),"]")}function yd(t){var e=t.map((function(t){return"string"==typeof t?{label:t}:t})),n=c(e.every((function(t){return/^\w+$/.test(t.label)}))?[/\w*$/,/\w+$/]:function(t){var e,n=Object.create(null),r=Object.create(null),o=i(t);try{for(o.s();!(e=o.n()).done;){var a=e.value.label;n[a[0]]=!0;for(var s=1;s=48&&P<=57||P>=97&&P<=122?2:P>=65&&P<=90?1:0:($=Zt(P))!=$.toLowerCase()?1:$!=$.toUpperCase()?2:0;(!Q||1==Z&&b||0==S&&0!=Z)&&(e[v]==P||n[v]==P&&(g=!0)?o[v++]=Q:o.length&&(w=!1)),S=Z,Q+=Rt(P)}return v==h&&0==o[0]&&w?this.result((g?-200:0)-100,o,t):m==h&&0==y?this.ret(-200-t.length+(k==t.length?0:-100),[0,k]):u>-1?this.ret(-700-t.length,[u,u+this.pattern.length]):m==h?this.ret(-900-t.length,[y,k]):v==h?this.result((g?-200:0)-100-700+(w?0:-1100),o,t):2==e.length?null:this.result((i[0]?-700:0)-200-1100,i,t)}},{key:"result",value:function(t,e,n){var r,o=[],a=0,s=i(e);try{for(s.s();!(r=s.n()).done;){var l=r.value,u=l+(this.astral?Rt($t(n,l)):1);a&&o[a-1]==l?o[a-1]=u:(o[a++]=l,o[a++]=u)}}catch(h){s.e(h)}finally{s.f()}return this.ret(t-n.length,o)}}]),t}(),Rd=function(){function t(e){O(this,t),this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}return v(t,[{key:"match",value:function(t){if(t.length=p||v>e.top?a=n.bottom-e.top:(c="bottom",a=e.bottom-n.top)}var g=(e.bottom-e.top)/o.offsetHeight,m=(e.right-e.left)/o.offsetWidth;return{style:"".concat(c,": ").concat(a/g,"px; max-width: ").concat(s/m,"px"),class:"cm-completionInfo-"+(h?l?"left-narrow":"right-narrow":u?"left":"right")}}function Md(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){var i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}var r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}var Wd=function(){function t(n,i,r){var o=this;O(this,t),this.view=n,this.stateField=i,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:function(){return o.measureInfo()},write:function(t){return o.placeInfo(t)},key:this},this.space=null,this.currentClass="";var a=n.state.field(i),s=a.open,l=s.options,u=s.selected,h=n.state.facet(Td);this.optionContent=function(t){var n=t.addToOptions.slice();return t.icons&&n.push({render:function(t){var n,i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&(n=i.classList).add.apply(n,e(t.type.split(/\s+/g).map((function(t){return"cm-completionIcon-"+t})))),i.setAttribute("aria-hidden","true"),i},position:20}),n.push({render:function(t,e,n,i){var r=document.createElement("span");r.className="cm-completionLabel";for(var o=t.displayLabel||t.label,a=0,s=0;sa&&r.appendChild(document.createTextNode(o.slice(a,l)));var h=r.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(o.slice(l,u))),h.className="cm-completionMatchedText",a=u}return a-1&&n.selected=this.range.to)&&(this.range=Md(n.options.length,n.selected,this.view.state.facet(Td).maxRenderedOptions),this.showOptions(n.options,e.id)),this.updateSelectedOption(n.selected)){this.destroyInfo();var i=n.options[n.selected].completion,r=i.info;if(!r)return;var o="string"==typeof r?document.createTextNode(r):r(i);if(!o)return;"then"in o?o.then((function(n){n&&t.view.state.field(t.stateField,!1)==e&&t.addInfoPane(n,i)})).catch((function(e){return rr(t.view.state,e,"completion info")})):this.addInfoPane(o,i)}}},{key:"addInfoPane",value:function(t,e){this.destroyInfo();var n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",null!=t.nodeType)n.appendChild(t),this.infoDestroy=null;else{var i=t.dom,r=t.destroy;n.appendChild(i),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSelectedOption",value:function(t){for(var e,n,i,r,o,a=null,s=this.list.firstChild,l=this.range.from;s;s=s.nextSibling,l++)"LI"==s.nodeName&&s.id?l==t?s.hasAttribute("aria-selected")||(s.setAttribute("aria-selected","true"),a=s):s.hasAttribute("aria-selected")&&s.removeAttribute("aria-selected"):l--;return a&&(e=this.list,n=a,i=e.getBoundingClientRect(),r=n.getBoundingClientRect(),o=i.height/e.offsetHeight,r.topi.bottom&&(e.scrollTop+=(r.bottom-i.bottom)/o)),a}},{key:"measureInfo",value:function(){var t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;var e=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=t.getBoundingClientRect(),r=this.space;if(!r){var o=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return i.top>Math.min(r.bottom,e.bottom)-10||i.bottomn.from||0==n.from))if(o=c,"string"!=typeof h&&h.header)r.appendChild(h.header(h));else r.appendChild(document.createElement("completion-section")).textContent=c}var f=r.appendChild(document.createElement("li"));f.id=e+"-"+a,f.setAttribute("role","option");var d=this.optionClass(l);d&&(f.className=d);var O,p=i(this.optionContent);try{for(p.s();!(O=p.n()).done;){var v=(0,O.value)(l,this.view.state,this.view,u);v&&f.appendChild(v)}}catch(g){p.e(g)}finally{p.f()}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.to=this.options.length?this:new t(this.options,Dd(n,e),this.tooltip,this.timestamp,e,this.disabled)}},{key:"map",value:function(e){return new t(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}],[{key:"build",value:function(e,n,r,o,a){var s=function(t,e){var n,r=[],o=null,a=function(t){r.push(t);var e=t.completion.section;if(e){o||(o=[]);var n="string"==typeof e?e:e.name;o.some((function(t){return t.name==n}))||o.push("string"==typeof e?{name:n}:e)}},s=e.facet(Td),l=i(t);try{for(l.s();!(n=l.n()).done;){var u=n.value;if(u.hasResult()){var h=u.result.getMatch;if(!1===u.result.filter){var c,f=i(u.result.options);try{for(f.s();!(c=f.n()).done;){var d=c.value;a(new kd(d,u.source,h?h(d):[],1e9-r.length))}}catch(q){f.e(q)}finally{f.f()}}else{var O,p=e.sliceDoc(u.from,u.to),v=void 0,g=s.filterStrict?new Rd(p):new Zd(p),m=i(u.result.options);try{for(m.s();!(O=m.n()).done;){var y=O.value;if(v=g.match(y.label)){var k=y.displayLabel?h?h(y,v.matched):[]:v.matched;a(new kd(y,u.source,k,v.score+(y.boost||0)))}}}catch(q){m.e(q)}finally{m.f()}}}}}catch(q){l.e(q)}finally{l.f()}if(o){var b,w=Object.create(null),Q=0,x=i(o.sort((function(t,e){var n,i;return(null!==(n=t.rank)&&void 0!==n?n:1e9)-(null!==(i=e.rank)&&void 0!==i?i:1e9)||(t.nameYd(C)&&(A[A.length-1]=X),C=X.completion}}catch(q){W.e(q)}finally{W.f()}return A}(e,n);if(!s.length)return o&&e.some((function(t){return 1==t.state}))?new t(o.options,o.attrs,o.tooltip,o.timestamp,o.selected,!0):null;var l=n.facet(Td).selectOnOpen?0:-1;if(o&&o.selected!=l&&-1!=o.selected)for(var u=o.options[o.selected].completion,h=0;h-1&&(n["aria-activedescendant"]=t+"-"+e),n}var Ed=[];function _d(t,e){if(t.isUserEvent("input.complete")){var n=t.annotation(Qd);if(n&&e.activateOnCompletion(n))return"input"}return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}var Vd=function(){function t(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;O(this,t),this.source=e,this.state=n,this.explicitPos=i}return v(t,[{key:"hasResult",value:function(){return!1}},{key:"update",value:function(e,n){var r=_d(e,n),o=this;r?o=o.handleUserEvent(e,r,n):e.docChanged?o=o.handleChange(e):e.selection&&0!=o.state&&(o=new t(o.source,0));var a,s=i(e.effects);try{for(s.s();!(a=s.n()).done;){var l=a.value;if(l.is(Pd))o=new t(o.source,1,l.value?bd(e.state):-1);else if(l.is($d))o=new t(o.source,0);else if(l.is(Nd)){var u,h=i(l.value);try{for(h.s();!(u=h.n()).done;){var c=u.value;c.source==o.source&&(o=c)}}catch(f){h.e(f)}finally{h.f()}}}}catch(f){s.e(f)}finally{s.f()}return o}},{key:"handleUserEvent",value:function(e,n,i){return"delete"!=n&&i.activateOnTyping?new t(this.source,1):this.map(e.changes)}},{key:"handleChange",value:function(e){return e.changes.touchesRange(bd(e.startState))?new t(this.source,0):this.map(e.changes)}},{key:"map",value:function(e){return e.empty||this.explicitPos<0?this:new t(this.source,this.state,e.mapPos(this.explicitPos))}}]),t}(),Ud=function(t){function e(t,n,i,o,a){var s;return O(this,e),(s=r(this,e,[t,2,n])).result=i,s.from=o,s.to=a,s}return u(e,t),v(e,[{key:"hasResult",value:function(){return!0}},{key:"handleUserEvent",value:function(t,n,i){var r,o=this.result;o.map&&!t.changes.empty&&(o=o.map(o,t.changes));var a=t.changes.mapPos(this.from),s=t.changes.mapPos(this.to,1),l=bd(t.state);if((this.explicitPos<0?l<=a:ls||!o||"delete"==n&&bd(t.startState)==this.from)return new Vd(this.source,"input"==n&&i.activateOnTyping?1:0);var u=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos);return function(t,e,n,i){if(!t)return!1;var r=e.sliceDoc(n,i);return"function"==typeof t?t(r,n,i,e):wd(t,!0).test(r)}(o.validFor,t.state,a,s)?new e(this.source,u,o,a,s):o.update&&(o=o.update(o,a,s,new gd(t.state,l,u>=0)))?new e(this.source,u,o,o.from,null!==(r=o.to)&&void 0!==r?r:bd(t.state)):new Vd(this.source,1,u)}},{key:"handleChange",value:function(t){return t.changes.touchesRange(this.from,this.to)?new Vd(this.source,0):this.map(t.changes)}},{key:"map",value:function(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new e(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new Vd(this.source,0)}}]),e}(Vd);var Nd=ye.define({map:function(t,e){return t.map((function(t){return t.map(e)}))}}),Bd=ye.define(),Id=Ht.define({create:function(){return jd.start()},update:function(t,e){return t.update(e)},provide:function(t){return[ds.from(t,(function(t){return t.tooltip})),oa.contentAttributes.from(t,(function(t){return t.attrs}))]}});function Gd(t,e){var n,i,r,o,a,s,l,u=e.completion.apply||e.completion.label,h=t.state.field(Id).active.find((function(t){return t.source==e.source}));return h instanceof Ud&&("string"==typeof u?t.dispatch(Object.assign(Object.assign({},(n=t.state,i=u,r=h.from,o=h.to,a=n.selection.main,s=r-a.from,l=o-a.from,Object.assign(Object.assign({},n.changeByRange((function(t){return t!=a&&r!=o&&n.sliceDoc(t.from+s,t.from+l)!=n.sliceDoc(r,o)?{range:t}:{changes:{from:t.from+s,to:o==a.from?t.to:t.from+l,insert:i},range:Et.cursor(t.from+s+i.length)}}))),{scrollIntoView:!0,userEvent:"input.complete"}))),{annotations:Qd.of(e.completion)})):u(t,e.completion,h.from,h.to),!0)}var Ld=Xd(Id,Gd);function Hd(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"option";return function(n){var i=n.state.field(Id,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+o*(t?1:-1):t?0:a-1;return s<0?s="page"==e?0:a-1:s>=a&&(s="page"==e?a-1:0),n.dispatch({effects:Bd.of(s)}),!0}}var Fd=v((function t(e,n){O(this,t),this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0})),Jd=lr.fromClass(function(){function t(e){O(this,t),this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;var n,r=i(e.state.field(Id).active);try{for(r.s();!(n=r.n()).done;){var o=n.value;1==o.state&&this.startQuery(o)}}catch(a){r.e(a)}finally{r.f()}}return v(t,[{key:"update",value:function(t){var n=this,r=t.state.field(Id),o=t.state.facet(Td);if(t.selectionSet||t.docChanged||t.startState.field(Id)!=r){for(var a=t.transactions.some((function(t){return(t.selection||t.docChanged)&&!_d(t,o)})),s=0;s50&&Date.now()-l.time>1e3){var u,h=i(l.context.abortListeners);try{for(h.s();!(u=h.n()).done;){var c=u.value;try{c()}catch(op){rr(this.view.state,op)}}}catch(g){h.e(g)}finally{h.f()}l.context.abortListeners=null,this.running.splice(s--,1)}else{var f;(f=l.updates).push.apply(f,e(t.transactions))}}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some((function(t){return t.effects.some((function(t){return t.is(Pd)}))}))&&(this.pendingStart=!0);var d=this.pendingStart?50:o.activateOnTypingDelay;if(this.debounceUpdate=r.active.some((function(t){return 1==t.state&&!n.running.some((function(e){return e.active.source==t.source}))}))?setTimeout((function(){return n.startUpdate()}),d):-1,0!=this.composing){var O,p=i(t.transactions);try{for(p.s();!(O=p.n()).done;){var v=O.value;"input"==_d(v,o)?this.composing=2:2==this.composing&&v.selection&&(this.composing=3)}}catch(g){p.e(g)}finally{p.f()}}}}},{key:"startUpdate",value:function(){var t=this;this.debounceUpdate=-1,this.pendingStart=!1;var e,n=i(this.view.state.field(Id).active);try{var r=function(){var n=e.value;1!=n.state||t.running.some((function(t){return t.active.source==n.source}))||t.startQuery(n)};for(n.s();!(e=n.n()).done;)r()}catch(o){n.e(o)}finally{n.f()}}},{key:"startQuery",value:function(t){var e=this,n=this.view.state,i=bd(n),r=new gd(n,i,t.explicitPos==i),o=new Fd(t,r);this.running.push(o),Promise.resolve(t.source(r)).then((function(t){o.context.aborted||(o.done=t||null,e.scheduleAccept())}),(function(t){e.view.dispatch({effects:$d.of(null)}),rr(e.view.state,t)}))}},{key:"scheduleAccept",value:function(){var t=this;this.running.every((function(t){return void 0!==t.done}))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((function(){return t.accept()}),this.view.state.facet(Td).updateSyncTime))}},{key:"accept",value:function(){var t,e=this;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;for(var n=[],r=this.view.state.facet(Td),o=function(o){var s=e.running[o];if(void 0===s.done)return a=o,0;if(e.running.splice(o--,1),s.done){var l,u=new Ud(s.active.source,s.active.explicitPos,s.done,s.done.from,null!==(t=s.done.to)&&void 0!==t?t:bd(s.updates.length?s.updates[0].startState:e.view.state)),h=i(s.updates);try{for(h.s();!(l=h.n()).done;){var c=l.value;u=u.update(c,r)}}catch(g){h.e(g)}finally{h.f()}if(u.hasResult())return n.push(u),a=o,0}var f=e.view.state.field(Id).active.find((function(t){return t.source==s.active.source}));if(f&&1==f.state)if(null==s.done){var d,O=new Vd(s.active.source,0),p=i(s.updates);try{for(p.s();!(d=p.n()).done;){var v=d.value;O=O.update(v,r)}}catch(g){p.e(g)}finally{p.f()}1!=O.state&&n.push(O)}else e.startQuery(f);a=o},a=0;a1||t.ctrlKey&&(!Kd||!t.altKey)||t.metaKey)return!1;var i=n.open.options[n.open.selected],r=n.active.find((function(t){return t.source==i.source})),o=i.completion.commitCharacters||r.result.commitCharacters;return o&&o.indexOf(t.key)>-1&&Gd(e,i),!1}})),eO=oa.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"".concat(400,"px"),boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"".concat(30,"px")},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"".concat(30,"px")},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),nO=v((function t(e,n,i,r){O(this,t),this.field=e,this.line=n,this.from=i,this.to=r})),iO=function(){function t(e,n,i){O(this,t),this.field=e,this.from=n,this.to=i}return v(t,[{key:"map",value:function(e){var n=e.mapPos(this.from,-1,At.TrackDel),i=e.mapPos(this.to,1,At.TrackDel);return null==n||null==i?null:new t(this.field,n,i)}}]),t}(),rO=function(){function t(e,n){O(this,t),this.lines=e,this.fieldPositions=n}return v(t,[{key:"instantiate",value:function(t,e){var n,r=[],o=[e],a=t.doc.lineAt(e),s=/^\s*/.exec(a.text)[0],l=i(this.lines);try{for(l.s();!(n=l.n()).done;){var u=n.value;if(r.length){for(var h=s,c=/^\t*/.exec(u)[0].length,f=0;f=d&&m.field++}}catch(w){g.e(w)}finally{g.f()}}s.push(new nO(d,a.length,n.index,n.index+f.length)),h=h.slice(0,n.index)+f+h.slice(n.index+n[0].length)}for(;u=/\\([{}])/.exec(h);){h=h.slice(0,u.index)+u[1]+h.slice(u.index+u[0].length);var y,k=i(s);try{for(k.s();!(y=k.n()).done;){var b=y.value;b.line==a.length&&b.from>u.index&&(b.from--,b.to--)}}catch(w){k.e(w)}finally{k.f()}}a.push(h)}}catch(w){l.e(w)}finally{l.f()}return new t(a,s)}}]),t}(),oO=di.widget({widget:new(function(t){function e(){return O(this,e),r(this,e,arguments)}return u(e,t),v(e,[{key:"toDOM",value:function(){var t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}},{key:"ignoreEvent",value:function(){return!1}}]),e}(ci))}),aO=di.mark({class:"cm-snippetField"}),sO=function(){function t(e,n){O(this,t),this.ranges=e,this.active=n,this.deco=di.set(e.map((function(t){return(t.from==t.to?oO:aO).range(t.from,t.to)})))}return v(t,[{key:"map",value:function(e){var n,r=[],o=i(this.ranges);try{for(o.s();!(n=o.n()).done;){var a=n.value.map(e);if(!a)return null;r.push(a)}}catch(s){o.e(s)}finally{o.f()}return new t(r,this.active)}},{key:"selectionInsideField",value:function(t){var e=this;return t.ranges.every((function(t){return e.ranges.some((function(n){return n.field==e.active&&n.from<=t.from&&n.to>=t.to}))}))}}]),t}(),lO=ye.define({map:function(t,e){return t&&t.map(e)}}),uO=ye.define(),hO=Ht.define({create:function(){return null},update:function(t,e){var n,r=i(e.effects);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.is(lO))return o.value;if(o.is(uO)&&t)return new sO(t.ranges,o.value)}}catch(a){r.e(a)}finally{r.f()}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:function(t){return oa.decorations.from(t,(function(t){return t?t.deco:di.none}))}});function cO(t,e){return Et.create(t.filter((function(t){return t.field==e})).map((function(t){return Et.range(t.from,t.to)})))}function fO(t){var e=rO.parse(t);return function(t,n,i,r){var o=e.instantiate(t.state,i),a=o.text,s=o.ranges,l={changes:{from:i,to:r,insert:st.of(a)},scrollIntoView:!0,annotations:n?[Qd.of(n),ke.userEvent.of("input.complete")]:void 0};if(s.length&&(l.selection=cO(s,0)),s.some((function(t){return t.field>0}))){var u=new sO(s,0),h=l.effects=[lO.of(u)];void 0===t.state.field(hO,!1)&&h.push(ye.appendConfig.of([hO,vO,mO,eO]))}t.dispatch(t.state.update(l))}}function dO(t){return function(e){var n=e.state,i=e.dispatch,r=n.field(hO,!1);if(!r||t<0&&0==r.active)return!1;var o=r.active+t,a=t>0&&!r.ranges.some((function(e){return e.field==o+t}));return i(n.update({selection:cO(r.ranges,o),effects:lO.of(a?null:new sO(r.ranges,o)),scrollIntoView:!0})),!0}}var OO=[{key:"Tab",run:dO(1),shift:dO(-1)},{key:"Escape",run:function(t){var e=t.state,n=t.dispatch;return!!e.field(hO,!1)&&(n(e.update({effects:lO.of(null)})),!0)}}],pO=Ut.define({combine:function(t){return t.length?t[0]:OO}}),vO=ne.highest(da.compute([pO],(function(t){return t.facet(pO)})));function gO(t,e){return Object.assign(Object.assign({},e),{apply:fO(t)})}var mO=oa.domEventHandlers({mousedown:function(t,e){var n,i=e.state.field(hO,!1);if(!i||null==(n=e.posAtCoords({x:t.clientX,y:t.clientY})))return!1;var r=i.ranges.find((function(t){return t.from<=n&&t.to>=n}));return!(!r||r.field==i.active)&&(e.dispatch({selection:cO(i.ranges,r.field),effects:lO.of(i.ranges.some((function(t){return t.field>r.field}))?new sO(i.ranges,r.field):null),scrollIntoView:!0}),!0)}}),yO={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},kO=ye.define({map:function(t,e){var n=e.mapPos(t,-1,At.TrackAfter);return null==n?void 0:n}}),bO=new(function(t){function e(){return O(this,e),r(this,e,arguments)}return u(e,t),v(e)}(Me));bO.startSide=1,bO.endSide=-1;var wO=Ht.define({create:function(){return qe.empty},update:function(t,e){if(t=t.map(e.changes),e.selection){var n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:function(t){return t>=n.from&&t<=n.to}})}var r,o=i(e.effects);try{for(o.s();!(r=o.n()).done;){var a=r.value;a.is(kO)&&(t=t.update({add:[bO.range(a.value,a.value+1)]}))}}catch(s){o.e(s)}finally{o.f()}return t}});var QO="()[]{}<>";function xO(t){for(var e=0;e2||2==r.length&&1==Rt($t(r,0))||e!=o.from||n!=o.to)return!1;var a=function(t,e){var n,r=SO(t,t.selection.main.head),o=r.brackets||yO.brackets,a=i(o);try{for(a.s();!(n=a.n()).done;){var s=n.value,l=xO($t(s,0));if(e==s)return l==s?MO(t,s,o.indexOf(s+s+s)>-1,r):AO(t,s,l,r.before||yO.before);if(e==l&&RO(t,t.selection.main.from))return CO(t,s,l)}}catch(u){a.e(u)}finally{a.f()}return null}(t.state,r);return!!a&&(t.dispatch(a),!0)})),ZO=[{key:"Backspace",run:function(t){var e=t.state,n=t.dispatch;if(e.readOnly)return!1;var r=SO(e,e.selection.main.head).brackets||yO.brackets,o=null,a=e.changeByRange((function(t){if(t.empty){var n,a=function(t,e){var n=t.sliceString(e-2,e);return Rt($t(n,0))==n.length?n:n.slice(1)}(e.doc,t.head),s=i(r);try{for(s.s();!(n=s.n()).done;){var l=n.value;if(l==a&&TO(e.doc,t.head)==xO($t(l,0)))return{changes:{from:t.head-l.length,to:t.head+l.length},range:Et.cursor(t.head-l.length)}}}catch(u){s.e(u)}finally{s.f()}}return{range:o=t}}));return o||n(e.update(a,{scrollIntoView:!0,userEvent:"delete.backward"})),!o}}];function RO(t,e){var n=!1;return t.field(wO).between(0,t.doc.length,(function(t){t==e&&(n=!0)})),n}function TO(t,e){var n=t.sliceString(e,e+2);return n.slice(0,Rt($t(n,0)))}function AO(t,e,n,i){var r=null,o=t.changeByRange((function(o){if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:kO.of(o.to+e.length),range:Et.range(o.anchor+e.length,o.head+e.length)};var a=TO(t.doc,o.head);return!a||/\s/.test(a)||i.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:kO.of(o.head+e.length),range:Et.cursor(o.head+e.length)}:{range:r=o}}));return r?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function CO(t,e,n){var i=null,r=t.changeByRange((function(e){return e.empty&&TO(t.doc,e.head)==n?{changes:{from:e.head,to:e.head+n.length,insert:n},range:Et.cursor(e.head+n.length)}:i={range:e}}));return i?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function MO(t,e,n,i){var r=i.stringPrefixes||yO.stringPrefixes,o=null,a=t.changeByRange((function(i){if(!i.empty)return{changes:[{insert:e,from:i.from},{insert:e,from:i.to}],effects:kO.of(i.to+e.length),range:Et.range(i.anchor+e.length,i.head+e.length)};var a,s=i.head,l=TO(t.doc,s);if(l==e){if(WO(t,s))return{changes:{insert:e+e,from:s},effects:kO.of(s+e.length),range:Et.cursor(s+e.length)};if(RO(t,s)){var u=n&&t.sliceDoc(s,s+3*e.length)==e+e+e?e+e+e:e;return{changes:{from:s,to:s+u.length,insert:u},range:Et.cursor(s+u.length)}}}else{if(n&&t.sliceDoc(s-2*e.length,s)==e+e&&(a=XO(t,s-2*e.length,r))>-1&&WO(t,a))return{changes:{insert:e+e+e+e,from:s},effects:kO.of(s+e.length),range:Et.cursor(s+e.length)};if(t.charCategorizer(s)(l)!=Ze.Word&&XO(t,s,r)>-1&&!function(t,e,n,i){for(var r=lu(t).resolveInner(e,-1),o=i.reduce((function(t,e){return Math.max(t,e.length)}),0),a=0;a<5;a++){var s=t.sliceDoc(r.from,Math.min(r.to,r.from+n.length+o)),l=s.indexOf(n);if(!l||l>-1&&i.indexOf(s.slice(0,l))>-1){for(var u=r.firstChild;u&&u.from==r.from&&u.to-u.from>n.length+l;){if(t.sliceDoc(u.to-n.length,u.to)==n)return!1;u=u.firstChild}return!0}var h=r.to==e&&r.parent;if(!h)break;r=h}return!1}(t,s,e,r))return{changes:{insert:e+e,from:s},effects:kO.of(s+e.length),range:Et.cursor(s+e.length)}}return{range:o=i}}));return o?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function WO(t,e){var n=lu(t).resolveInner(e+1);return n.parent&&n.from==e}function XO(t,e,n){var r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Ze.Word)return e;var o,a=i(n);try{for(a.s();!(o=a.n()).done;){var s=o.value,l=e-s.length;if(t.sliceDoc(l,e)==s&&r(t.sliceDoc(l-1,l))!=Ze.Word)return l}}catch(u){a.e(u)}finally{a.f()}return-1}function YO(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[tO,Id,Td.of(t),Jd,jO,eO]}var qO=[{key:"Ctrl-Space",run:function(t){return!!t.state.field(Id,!1)&&(t.dispatch({effects:Pd.of(!0)}),!0)}},{key:"Escape",run:function(t){var e=t.state.field(Id,!1);return!(!e||!e.active.some((function(t){return 0!=t.state})))&&(t.dispatch({effects:$d.of(null)}),!0)}},{key:"ArrowDown",run:Hd(!0)},{key:"ArrowUp",run:Hd(!1)},{key:"PageDown",run:Hd(!0,"page")},{key:"PageUp",run:Hd(!1,"page")},{key:"Enter",run:function(t){var e=t.state.field(Id,!1);return!(t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=null;return t.between(n,1e9,(function(t,n,r){var o=r.spec;if(!e||o.diagnostic==e)return i=new zO(t,n,o.diagnostic),!1})),i}var _O=ye.define(),VO=ye.define(),UO=ye.define(),NO=Ht.define({create:function(){return new DO(di.none,null,null)},update:function(t,e){if(e.docChanged){var n=t.diagnostics.map(e.changes),r=null;if(t.selected){var o=e.changes.mapPos(t.selected.from,1);r=EO(n,t.selected.diagnostic,o)||EO(n,null,o)}t=new DO(n,t.panel,r)}var a,s=i(e.effects);try{for(s.s();!(a=s.n()).done;){var l=a.value;l.is(_O)?t=DO.init(l.value,t.panel,e.state):l.is(VO)?t=new DO(t.diagnostics,l.value?np.open:null,t.selected):l.is(UO)&&(t=new DO(t.diagnostics,t.panel,l.value))}}catch(u){s.e(u)}finally{s.f()}return t},provide:function(t){return[$s.from(t,(function(t){return t.panel})),oa.decorations.from(t,(function(t){return t.diagnostics}))]}}),BO=di.mark({class:"cm-lintRange cm-lintRange-active",inclusive:!0});function IO(t,e,n){var i=t.state.field(NO).diagnostics,r=[],o=2e8,a=0;i.between(e-(n<0?1:0),e+(n>0?1:0),(function(t,i,s){var l=s.spec;e>=t&&e<=i&&(t==i||(e>t||n>0)&&(e=65&&t.keyCode<=90&&n.selectedIndex>=0))return;for(var i=n.items[n.selectedIndex].diagnostic,r=JO(i.actions),o=0;or&&(t.items.splice(r,h-r),o=!0)),i&&l.diagnostic==i.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),a=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),r++}));ri.bottom&&(t.list.scrollTop+=(n.bottom-i.bottom)/r)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}},{key:"sync",value:function(){var t=this.list.firstChild;function e(){var e=t;t=e.nextSibling,e.remove()}var n,r=i(this.items);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o.dom.parentNode==this.list){for(;t!=o.dom;)e();t=o.dom.nextSibling}else this.list.insertBefore(o.dom,t)}}catch(a){r.e(a)}finally{r.f()}for(;t;)e()}},{key:"moveSelection",value:function(t){if(!(this.selectedIndex<0)){var e=EO(this.view.state.field(NO).diagnostics,this.items[t].diagnostic);e&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:UO.of(e)})}}}],[{key:"open",value:function(e){return new t(e)}}]),t}();function ip(t){return function(t){return'url(\'data:image/svg+xml,1&&void 0!==arguments[1]?arguments[1]:'viewBox="0 0 40 40"',">").concat(encodeURIComponent(t),"')")}(''),'width="6" height="3"')}var rp,op,ap=oa.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:ip("#d11")},".cm-lintRange-warning":{backgroundImage:ip("orange")},".cm-lintRange-info":{backgroundImage:ip("#999")},".cm-lintRange-hint":{backgroundImage:ip("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),sp=[NO,oa.decorations.compute([NO],(function(t){var e=t.field(NO),n=e.selected,i=e.panel;return n&&i&&n.from!=n.to?di.set([BO.range(n.from,n.to)]):di.none})),ys(IO,{hideOn:function(t,e){var n=e.pos,i=e.end||n,r=t.state.facet(FO).hideOn(t,n,i);if(null!=r)return r;var o=t.startState.doc.lineAt(e.pos);return!(!t.effects.some((function(t){return t.is(_O)}))&&!t.changes.touchesRange(o.from,Math.max(o.to,i)))}}),ap],lp=function(){return[Bs(),Ls,Na(),Hh(),eh(),Za(),[Ya,qa],Ae.allowMultipleSelections.of(!0),Ae.transactionFilter.of((function(t){if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;var e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;var n=t.newDoc,r=t.newSelection.main.head,o=n.lineAt(r);if(r>o.from+200)return t;var a=n.sliceString(o.from,r);if(!e.some((function(t){return t.test(a)})))return t;var s,l=t.state,u=-1,h=[],c=i(l.selection.ranges);try{for(c.s();!(s=c.n()).done;){var f=s.value.head,d=l.doc.lineAt(f);if(d.from!=u){u=d.from;var O=Qu(l,d.from);if(null!=O){var p=/^\s*/.exec(d.text)[0],v=wu(l,O);p!=v&&h.push({from:d.from,to:d.from+p.length,insert:v})}}}}catch(g){c.e(g)}finally{c.f()}return h.length?[t,{changes:h,sequential:!0}]:t})),(t=uh,n={fallback:!0},o=[lh],t instanceof ih&&(t.module&&o.push(oa.styleModule.of(t.module)),r=t.themeType),(null==n?void 0:n.fallback)?o.push(oh.of(t)):r?o.push(rh.computeN([oa.darkTheme],(function(e){return e.facet(oa.darkTheme)==("dark"==r)?[t]:[]}))):o.push(rh.of(t)),o),yh(),[$O,wO],YO(),es(),rs(),Ha,Rf(),da.of([].concat(ZO,e(hf),ud,dc,Bu,qO,HO))];var t,n,r,o}(),up=Object.freeze({autofocus:!1,disabled:!1,indentWithTab:!0,tabSize:2,placeholder:"",autoDestroy:!0,extensions:[lp]}),hp=Symbol("vue-codemirror-global-config"),cp=function(t){var e=new re;return{compartment:e,run:function(n){e.get(t.state)?t.dispatch({effects:e.reconfigure(n)}):t.dispatch({effects:ye.appendConfig.of(e.of(n))})}}},fp=function(t,e){var n=cp(t),i=n.compartment,r=n.run;return function(n){var o=i.get(t.state);r((null!=n?n:o!==e)?e:[])}},dp={type:Boolean,default:void 0},Op={autofocus:dp,disabled:dp,indentWithTab:dp,tabSize:Number,placeholder:String,style:Object,autoDestroy:dp,phrases:Object,root:Object,extensions:Array,selection:Object},pp={modelValue:{type:String,default:""}},vp=Object.assign(Object.assign({},Op),pp);(op=rp||(rp={})).Change="change",op.Update="update",op.Focus="focus",op.Blur="blur",op.Ready="ready",op.ModelUpdate="update:modelValue";var gp={};gp[rp.Change]=function(t,e){return!0},gp[rp.Update]=function(t){return!0},gp[rp.Focus]=function(t){return!0},gp[rp.Blur]=function(t){return!0},gp[rp.Ready]=function(t){return!0};var mp={};mp[rp.ModelUpdate]=gp[rp.Change];var yp=Object.assign(Object.assign({},gp),mp),kp=p({name:"VueCodemirror",props:Object.assign({},vp),emits:Object.assign({},yp),setup:function(t,e){var n=g(),i=g(),r=g(),o=Object.assign(Object.assign({},up),m(hp,{})),a=y((function(){var e={};return Object.keys(x(t)).forEach((function(n){var i;"modelValue"!==n&&(e[n]=null!==(i=t[n])&&void 0!==i?i:o[n])})),e}));return k((function(){var s;i.value=function(t){var e=t.onUpdate,n=t.onChange,i=t.onFocus,r=t.onBlur,o=function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r9&&void 0!==arguments[9]?arguments[9]:0,c=arguments.length>10?arguments[10]:void 0;O(this,t),this.p=e,this.stack=n,this.state=i,this.reducePos=r,this.pos=o,this.score=a,this.buffer=s,this.bufferBase=l,this.curContext=u,this.lookAhead=h,this.parent=c}return v(t,[{key:"toString",value:function(){return"[".concat(this.stack.filter((function(t,e){return e%3==0})).concat(this.state),"]@").concat(this.pos).concat(this.score?"!"+this.score:"")}},{key:"context",get:function(){return this.curContext?this.curContext.context:null}},{key:"pushState",value:function(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}},{key:"reduce",value:function(t){var e,n=t>>19,i=65535&t,r=this.p.parser,o=r.dynamicPrecedence(i);if(o&&(this.score+=o),0==n)return this.pushState(r.getGoto(this.state,i,!0),this.reducePos),i=2e3&&!(null===(e=this.p.parser.nodeSet.types[i])||void 0===e?void 0:e.isAnonymous)&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(i,s)}},{key:"storeNode",value:function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4,r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(0==t&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==o.buffer[a-4]&&o.buffer[a-1]>-1){if(e==n)return;if(o.buffer[a-2]>=e)return void(o.buffer[a-2]=n)}}if(r&&this.pos!=n){var s=this.buffer.length;if(s>0&&0!=this.buffer[s-4])for(;s>0&&this.buffer[s-2]>n;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,i>4&&(i-=4);this.buffer[s]=t,this.buffer[s+1]=e,this.buffer[s+2]=n,this.buffer[s+3]=i}else this.buffer.push(t,e,n,i)}},{key:"shift",value:function(t,e,n,i){if(131072&t)this.pushState(65535&t,this.pos);else if(0==(262144&t)){var r=t,o=this.p.parser;(i>this.pos||e<=o.maxNode)&&(this.pos=i,o.stateFlag(r,1)||(this.reducePos=i)),this.pushState(r,n),this.shiftContext(e,n),e<=o.maxNode&&this.buffer.push(e,n,i,4)}else this.pos=i,this.shiftContext(e,n),e<=this.p.parser.maxNode&&this.buffer.push(e,n,i,4)}},{key:"apply",value:function(t,e,n,i){65536&t?this.reduce(t):this.shift(t,e,n,i)}},{key:"useNode",value:function(t,e){var n=this.p.reused.length-1;(n<0||this.p.reused[n]!=t)&&(this.p.reused.push(t),n++);var i=this.pos;this.reducePos=this.pos=i+t.length,this.pushState(e,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}},{key:"split",value:function(){for(var e=this,n=e.buffer.length;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;for(var i=e.buffer.slice(n),r=e.bufferBase+n;e&&r==e.bufferBase;)e=e.parent;return new t(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,r,this.curContext,this.lookAhead,e)}},{key:"recoverByDelete",value:function(t,e){var n=t<=this.p.parser.maxNode;n&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,n?8:4),this.pos=this.reducePos=e,this.score-=190}},{key:"canShift",value:function(t){for(var e=new xp(this);;){var n=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(0==n)return!1;if(0==(65536&n))return!0;e.reduce(n)}}},{key:"recoverByInsert",value:function(t){if(this.stack.length>=300)return[];var e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){for(var n,i=[],r=0;r>19,i=65535&e,r=this.stack.length-3*n;if(r<0||t.getGoto(this.stack[r],i,!1)<0){var o=this.findForcedReduction();if(null==o)return!1;e=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}},{key:"findForcedReduction",value:function(){var t=this,e=this.p.parser,n=[];return function i(r,o){if(!n.includes(r))return n.push(r),e.allActions(r,(function(n){if(393216&n);else if(65536&n){var r=(n>>19)-o;if(r>1){var a=65535&n,s=t.stack.length-3*r;if(s>=0&&e.getGoto(t.stack[s],a,!1)>=0)return r<<19|65536|a}}else{var l=i(n,o+1);if(null!=l)return l}}))}(this.state,0)}},{key:"forceAll",value:function(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}},{key:"deadEnd",get:function(){if(3!=this.stack.length)return!1;var t=this.p.parser;return 65535==t.data[t.stateSlot(this.state,1)]&&!t.stateSlot(this.state,4)}},{key:"restart",value:function(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}},{key:"sameState",value:function(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(var e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}},{key:"close",value:function(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}],[{key:"start",value:function(e,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=e.parser.context;return new t(e,[],n,i,i,0,[],0,r?new Qp(r,r.start):null,0,null)}}]),t}(),Qp=v((function t(e,n){O(this,t),this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0})),xp=function(){function t(e){O(this,t),this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}return v(t,[{key:"reduce",value:function(t){var e=65535&t,n=t>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);var i=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=i}}]),t}(),Sp=function(){function t(e,n,i){O(this,t),this.stack=e,this.pos=n,this.index=i,this.buffer=e.buffer,0==this.index&&this.maybeNext()}return v(t,[{key:"maybeNext",value:function(){var t=this.stack.parent;null!=t&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}},{key:"id",get:function(){return this.buffer[this.index-4]}},{key:"start",get:function(){return this.buffer[this.index-3]}},{key:"end",get:function(){return this.buffer[this.index-2]}},{key:"size",get:function(){return this.buffer[this.index-1]}},{key:"next",value:function(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}},{key:"fork",value:function(){return new t(this.stack,this.pos,this.index)}}],[{key:"create",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.bufferBase+e.buffer.length;return new t(e,n,n-e.bufferBase)}}]),t}();function Pp(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Uint16Array;if("string"!=typeof t)return t;for(var n=null,i=0,r=0;i=92&&a--,a>=34&&a--;var l=a-32;if(l>=46&&(l-=46,s=!0),o+=l,s)break;o*=46}n?n[r++]=o:n=new e(o)}return n}var $p=v((function t(){O(this,t),this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0})),Zp=new $p,Rp=function(){function t(e,n){O(this,t),this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Zp,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}return v(t,[{key:"resolveOffset",value:function(t,e){for(var n=this.range,i=this.rangeIndex,r=this.pos+t;rn.to:r>=n.to;){if(i==this.ranges.length-1)return null;var a=this.ranges[++i];r+=a.from-n.to,n=a}return r}},{key:"clipPos",value:function(t){if(t>=this.range.from&&tt)return Math.max(t,r.from)}}catch(o){n.e(o)}finally{n.f()}return this.end}},{key:"peek",value:function(t){var e,n,i=this.chunkOff+t;if(i>=0&&i=this.chunk2Pos&&ea.to&&(this.chunk2=this.chunk2.slice(0,a.to-e)),n=this.chunk2.charCodeAt(0)}}return e>=this.token.lookAhead&&(this.token.lookAhead=e+1),n}},{key:"acceptToken",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=e?this.resolveOffset(e,-1):this.pos;if(null==n||n=this.chunk2Pos&&this.posthis.range.to?n.slice(0,this.range.to-this.pos):n,this.chunkPos=this.pos,this.chunkOff=0}}},{key:"readNext",value:function(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}},{key:"advance",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}},{key:"setDone",value:function(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}},{key:"reset",value:function(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=Zp,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);var n,r="",o=i(this.ranges);try{for(o.s();!(n=o.n()).done;){var a=n.value;if(a.from>=e)break;a.to>t&&(r+=this.input.read(Math.max(a.from,t),Math.min(a.to,e)))}}catch(s){o.e(s)}finally{o.f()}return r}}]),t}(),Tp=function(){function t(e,n){O(this,t),this.data=e,this.id=n}return v(t,[{key:"token",value:function(t,e){var n=e.p.parser;Mp(this.data,t,e,this.id,n.data,n.tokenPrecTable)}}]),t}();Tp.prototype.contextual=Tp.prototype.fallback=Tp.prototype.extend=!1;var Ap=function(){function t(e,n,i){O(this,t),this.precTable=n,this.elseToken=i,this.data="string"==typeof e?Pp(e):e}return v(t,[{key:"token",value:function(t,e){for(var n=t.pos,i=0;;){var r=t.next<0,o=t.resolveOffset(1,1);if(Mp(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(null==this.elseToken)return;if(r||i++,null==o)break;t.reset(o,t.token)}i&&(t.reset(n,t.token),t.acceptToken(this.elseToken,i))}}]),t}();Ap.prototype.contextual=Tp.prototype.fallback=Tp.prototype.extend=!1;var Cp=v((function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};O(this,t),this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}));function Mp(t,e,n,i,r,o){var a,s,l,u,h,c=0,f=1<0){var v=t[p];if(d.allows(v)&&(-1==e.token.value||e.token.value==v||(a=v,s=e.token.value,h=void 0,(h=Wp(l=r,u=o,s))<0||Wp(l,u,a)m&&65535==t[O+3*y-3])){for(;m>1,b=O+k+(k<<1),w=t[b],Q=t[b+1]||65536;if(g=Q)){c=t[b+2],e.advance();continue t}m=k+1}}break}c=t[O+3*y-1]}}function Wp(t,e,n){for(var i,r=e;65535!=(i=t[r]);r++)if(i==n)return r-e;return-1}var Xp="undefined"!=typeof process&&process.env&&/\bparse\b/.test({}.LOG),Yp=null;function qp(t,e,n){var i=t.cursor(nl.IncludeAnonymous);for(i.moveTo(e);;)if(!(n<0?i.childBefore(e):i.childAfter(e)))for(;;){if((n<0?i.toe)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(t.length,Math.max(i.from+1,e+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:t.length}}var jp=function(){function t(e,n){O(this,t),this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}return v(t,[{key:"nextFragment",value:function(){var t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?qp(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?qp(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}},{key:"nodeAt",value:function(t){if(tt)return this.nextStart=o,null;if(r instanceof al){if(o==t){if(o=Math.max(this.safeFrom,t)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[e]++,this.nextStart=o+r.length}else this.trees.pop(),this.start.pop(),this.index.pop()}}}]),t}(),zp=function(){function t(e,n){O(this,t),this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map((function(t){return new $p}))}return v(t,[{key:"getActions",value:function(t){for(var e=0,n=null,i=t.p.parser,r=i.tokenizers,o=i.stateSlot(t.state,3),a=t.curContext?t.curContext.hash:0,s=0,l=0;lh.end+25&&(s=Math.max(h.lookAhead,s)),0!=h.value)){var c=e;if(h.extended>-1&&(e=this.addActions(t,h.extended,h.end,e)),e=this.addActions(t,h.value,h.end,e),!u.extend&&(n=h,e>c))break}}for(;this.actions.length>e;)this.actions.pop();return s&&t.setLookAhead(s),n||t.pos!=this.stream.end||((n=new $p).value=t.p.parser.eofTerm,n.start=n.end=t.pos,e=this.addActions(t,n.value,n.end,e)),this.mainToken=n,this.actions}},{key:"getMainToken",value:function(t){if(this.mainToken)return this.mainToken;var e=new $p,n=t.pos,i=t.p;return e.start=n,e.end=Math.min(n+1,i.stream.end),e.value=n==i.stream.end?i.parser.eofTerm:0,e}},{key:"updateCachedToken",value:function(t,e,n){var i=this.stream.clipPos(n.pos);if(e.token(this.stream.reset(i,t),n),t.value>-1){for(var r=n.p.parser,o=0;o=0&&n.p.parser.dialect.allows(a>>1)){0==(1&a)?t.value=a>>1:t.extended=a>>1;break}}}else t.value=0,t.end=this.stream.clipPos(i+1)}},{key:"putAction",value:function(t,e,n,i){for(var r=0;r4*e.bufferLength?new jp(i,e.nodeSet):null}return v(t,[{key:"parsedPos",get:function(){return this.minStackPos}},{key:"advance",value:function(){var t,e,n=this.stacks,r=this.minStackPos,o=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){for(var a=c(n,1)[0];a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(var s=0;sr)o.push(l);else{if(this.advanceStack(l,o,n))continue;t||(t=[],e=[]),t.push(l);var u=this.tokens.getMainToken(l);e.push(u.value,u.end)}break}if(!o.length){var h=t&&function(t){var e,n=null,r=i(t);try{for(r.s();!(e=r.n()).done;){var o=e.value,a=o.p.stoppedAt;(o.pos==o.p.stream.end||null!=a&&o.pos>a)&&o.p.parser.stateFlag(o.state,2)&&(!n||n.scorethis.stoppedAt?t[0]:this.runRecovery(t,e,o);if(f)return Xp&&console.log("Force-finish "+this.stackID(f)),this.stackToTree(f.forceAll())}if(this.recovering){var d=1==this.recovering?1:3*this.recovering;if(o.length>d)for(o.sort((function(t,e){return e.score-t.score}));o.length>d;)o.pop();o.some((function(t){return t.reducePos>r}))&&this.recovering--}else if(o.length>1){t:for(var O=0;O500&&g.buffer.length>500){if(!((p.score-g.score||p.buffer.length-g.buffer.length)>0)){o.splice(O--,1);continue t}o.splice(v--,1)}}o.length>12&&o.splice(12,o.length-12)}this.minStackPos=o[0].pos;for(var m=1;m ":"";if(null!=this.stoppedAt&&i>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments)for(var a=t.curContext&&t.curContext.tracker.strict,s=a?t.curContext.hash:0,l=this.fragments.nodeAt(i);l;){var u=this.parser.nodeSet.types[l.type.id]==l.type?r.getGoto(t.state,l.type.id):-1;if(u>-1&&l.length&&(!a||(l.prop(Js.contextHash)||0)==s))return t.useNode(l,u),Xp&&console.log(o+this.stackID(t)+" (via reuse of ".concat(r.getName(l.type.id),")")),!0;if(!(l instanceof al)||0==l.children.length||l.positions[0]>0)break;var h=l.children[0];if(!(h instanceof al&&0==l.positions[0]))break;l=h}var c=r.stateSlot(t.state,4);if(c>0)return t.reduce(c),Xp&&console.log(o+this.stackID(t)+" (via always-reduce ".concat(r.getName(65535&c),")")),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););for(var f=this.tokens.getActions(t),d=0;di?e.push(m):n.push(m)}return!1}},{key:"advanceFully",value:function(t,e){for(var n=t.pos;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>n)return Ep(t,e),!0}}},{key:"runRecovery",value:function(t,e,n){for(var r=null,o=!1,a=0;a ":"";if(s.deadEnd){if(o)continue;if(o=!0,s.restart(),Xp&&console.log(h+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))continue}for(var c=s.split(),f=h,d=0;c.forceReduce()&&d<10;d++){if(Xp&&console.log(f+this.stackID(c)+" (via force-reduce)"),this.advanceFully(c,n))break;Xp&&(f=this.stackID(c)+" -> ")}var O,p=i(s.recoverByInsert(l));try{for(p.s();!(O=p.n()).done;){var v=O.value;Xp&&console.log(h+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,n)}}catch(g){p.e(g)}finally{p.f()}this.stream.end>s.pos?(u==s.pos&&(u++,l=0),s.recoverByDelete(l,u),Xp&&console.log(h+this.stackID(s)+" (via recover-delete ".concat(this.parser.getName(l),")")),Ep(s,n)):(!r||r.score=0)f(y,g,v[m++]);else{for(var k=v[m+-y],b=-y;b>0;b--)f(v[m++],g,k);m++}}}}catch(x){p.e(x)}finally{p.f()}}a.nodeSet=new il(s.map((function(e,n){return el.define({name:n>=a.minRepeatTerm?void 0:e,id:n,props:h[n],top:u.indexOf(n)>-1,error:0==n,skipped:t.skippedNodes&&t.skippedNodes.indexOf(n)>-1})}))),t.propSources&&(a.nodeSet=(o=a.nodeSet).extend.apply(o,e(t.propSources))),a.strict=!1,a.bufferLength=1024;var w=Pp(t.tokenData);a.context=t.context,a.specializerSpecs=t.specialized||[],a.specialized=new Uint16Array(a.specializerSpecs.length);for(var Q=0;Q2&&void 0!==arguments[2]&&arguments[2],i=this.goto;if(e>=i[0])return-1;for(var r=i[e+1];;){var o=i[r++],a=1&o,s=i[r++];if(a&&n)return s;for(var l=r+(o>>1);r0}},{key:"validAction",value:function(t,e){return!!this.allActions(t,(function(t){return t==e||null}))}},{key:"allActions",value:function(t,e){for(var n=this.stateSlot(t,4),i=n?e(n):void 0,r=this.stateSlot(t,1);null==i;r+=3){if(65535==this.data[r]){if(1!=this.data[r+1])break;r=Bp(this.data,r+2)}i=e(Bp(this.data,r+1))}return i}},{key:"nextStates",value:function(t){for(var e=this,n=[],i=function(t){if(65535==e.data[t]){if(1!=e.data[t+1])return r=t,1;t=Bp(e.data,t+2)}if(0==(1&e.data[t+2])){var i=e.data[t+1];n.some((function(t,e){return 1&e&&t==i}))||n.push(e.data[t],i)}r=t},r=this.stateSlot(t,1);!i(r);r+=3);return n}},{key:"configure",value:function(t){var i,r=Object.assign(Object.create(n.prototype),this);if(t.props&&(r.nodeSet=(i=this.nodeSet).extend.apply(i,e(t.props))),t.top){var o=this.topRules[t.top];if(!o)throw new RangeError("Invalid top rule name ".concat(t.top));r.top=o}return t.tokenizers&&(r.tokenizers=this.tokenizers.map((function(e){var n=t.tokenizers.find((function(t){return t.from==e}));return n?n.to:e}))),t.specializers&&(r.specializers=this.specializers.slice(),r.specializerSpecs=this.specializerSpecs.map((function(e,n){var i=t.specializers.find((function(t){return t.from==e.external}));if(!i)return e;var o=Object.assign(Object.assign({},e),{external:i.to});return r.specializers[n]=Ip(o),o}))),t.contextTracker&&(r.context=t.contextTracker),t.dialect&&(r.dialect=this.parseDialect(t.dialect)),null!=t.strict&&(r.strict=t.strict),t.wrap&&(r.wrappers=r.wrappers.concat(t.wrap)),null!=t.bufferLength&&(r.bufferLength=t.bufferLength),r}},{key:"hasWrappers",value:function(){return this.wrappers.length>0}},{key:"getName",value:function(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}},{key:"eofTerm",get:function(){return this.maxNode+1}},{key:"topNode",get:function(){return this.nodeSet.types[this.top[1]]}},{key:"dynamicPrecedence",value:function(t){var e=this.dynamicPrecedences;return null==e?0:e[t]||0}},{key:"parseDialect",value:function(t){var e=Object.keys(this.dialects),n=e.map((function(){return!1}));if(t){var r,o=i(t.split(" "));try{for(o.s();!(r=o.n()).done;){var a=r.value,s=e.indexOf(a);s>=0&&(n[s]=!0)}}catch(f){o.e(f)}finally{o.f()}}for(var l=null,u=0;u-1||(47!=i||47!=(n=t.peek(1))&&42!=n)&&(125==i||59==i||-1==i||e.context||t.acceptToken(312))}),{contextual:!0}),Jp=new Cp((function(t,e){var n=t.next;if(43==n||45==n){if(t.advance(),n==t.next){t.advance();var i=!e.context&&e.canShift(1);t.acceptToken(i?1:2)}}else 63==n&&46==t.peek(1)&&(t.advance(),t.advance(),(t.next<48||t.next>57)&&t.acceptToken(3))}),{contextual:!0});function Kp(t,e){return t>=65&&t<=90||t>=97&&t<=122||95==t||t>=192||!e&&t>=48&&t<=57}var tv=new Cp((function(t,e){if(60==t.next&&e.dialectEnabled(0)&&(t.advance(),47!=t.next)){for(var n=0;Gp.indexOf(t.next)>-1;)t.advance(),n++;if(Kp(t.next,!0)){for(t.advance(),n++;Kp(t.next,!1);)t.advance(),n++;for(;Gp.indexOf(t.next)>-1;)t.advance(),n++;if(44==t.next)return;for(var i=0;;i++){if(7==i){if(!Kp(t.next,!0))return;break}if(t.next!="extends".charCodeAt(i))break;t.advance(),n++}}t.acceptToken(4,-n)}})),ev=Ml({"get set async static":eu.modifier,"for while do if else switch try catch finally return throw break continue default case":eu.controlKeyword,"in of await yield void typeof delete instanceof":eu.operatorKeyword,"let var const using function class extends":eu.definitionKeyword,"import export from":eu.moduleKeyword,"with debugger as new":eu.keyword,TemplateString:eu.special(eu.string),super:eu.atom,BooleanLiteral:eu.bool,this:eu.self,null:eu.null,Star:eu.modifier,VariableName:eu.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":eu.function(eu.variableName),VariableDefinition:eu.definition(eu.variableName),Label:eu.labelName,PropertyName:eu.propertyName,PrivatePropertyName:eu.special(eu.propertyName),"CallExpression/MemberExpression/PropertyName":eu.function(eu.propertyName),"FunctionDeclaration/VariableDefinition":eu.function(eu.definition(eu.variableName)),"ClassDeclaration/VariableDefinition":eu.definition(eu.className),PropertyDefinition:eu.definition(eu.propertyName),PrivatePropertyDefinition:eu.definition(eu.special(eu.propertyName)),UpdateOp:eu.updateOperator,"LineComment Hashbang":eu.lineComment,BlockComment:eu.blockComment,Number:eu.number,String:eu.string,Escape:eu.escape,ArithOp:eu.arithmeticOperator,LogicOp:eu.logicOperator,BitOp:eu.bitwiseOperator,CompareOp:eu.compareOperator,RegExp:eu.regexp,Equals:eu.definitionOperator,Arrow:eu.function(eu.punctuation),": Spread":eu.punctuation,"( )":eu.paren,"[ ]":eu.squareBracket,"{ }":eu.brace,"InterpolationStart InterpolationEnd":eu.special(eu.brace),".":eu.derefOperator,", ;":eu.separator,"@":eu.meta,TypeName:eu.typeName,TypeDefinition:eu.definition(eu.typeName),"type enum interface implements namespace module declare":eu.definitionKeyword,"abstract global Privacy readonly override":eu.modifier,"is keyof unique infer":eu.operatorKeyword,JSXAttributeValue:eu.attributeValue,JSXText:eu.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":eu.angleBracket,"JSXIdentifier JSXNameSpacedName":eu.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":eu.attributeName,"JSXBuiltin/JSXIdentifier":eu.standard(eu.tagName)}),nv={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,extends:54,this:58,true:66,false:66,null:78,void:82,typeof:86,super:102,new:136,delete:148,yield:157,await:161,class:166,public:229,private:229,protected:229,readonly:231,instanceof:250,satisfies:253,in:254,const:256,import:290,keyof:345,unique:349,infer:355,is:391,abstract:411,implements:413,type:415,let:418,var:420,using:423,interface:429,enum:433,namespace:439,module:441,declare:445,global:449,for:468,of:477,while:480,with:484,do:488,if:492,else:494,switch:498,case:504,try:510,catch:514,finally:518,return:522,throw:526,break:530,continue:534,debugger:538},iv={__proto__:null,async:123,get:125,set:127,declare:189,public:191,private:191,protected:191,static:193,abstract:195,override:197,readonly:203,accessor:205,new:395},rv={__proto__:null,"<":187},ov=Np.deserialize({version:14,states:"$=dO%TQ^OOO%[Q^OOO'_Q`OOP(lOWOOO*zQ?NdO'#CiO+RO!bO'#CjO+aO#tO'#CjO+oO!0LbO'#D^O.QQ^O'#DdO.bQ^O'#DoO%[Q^O'#DwO0fQ^O'#EPOOQ?Mr'#EX'#EXO1PQWO'#EUOOQO'#Em'#EmOOQO'#Ih'#IhO1XQWO'#GpO1dQWO'#ElO1iQWO'#ElO3hQ?NdO'#JmO6[Q?NdO'#JnO6uQWO'#F[O6zQ&jO'#FsOOQ?Mr'#Fe'#FeO7VO,YO'#FeO7eQ7[O'#FzO9RQWO'#FyOOQ?Mr'#Jn'#JnOOQ?Mp'#Jm'#JmO9WQWO'#GtOOQU'#KZ'#KZO9cQWO'#IUO9hQ?MxO'#IVOOQU'#JZ'#JZOOQU'#IZ'#IZQ`Q^OOO`Q^OOO9pQMnO'#DsO9wQ^O'#D{O:OQ^O'#D}O9^QWO'#GpO:VQ7[O'#CoO:eQWO'#EkO:pQWO'#EvO:uQ7[O'#FdO;dQWO'#GpOOQO'#K['#K[O;iQWO'#K[O;wQWO'#GxO;wQWO'#GyO;wQWO'#G{O9^QWO'#HOOVQWO'#CeO>gQWO'#H_O>oQWO'#HeO>oQWO'#HgO`Q^O'#HiO>oQWO'#HkO>oQWO'#HnO>tQWO'#HtO>yQ?MyO'#HzO%[Q^O'#H|O?UQ?MyO'#IOO?aQ?MyO'#IQO9hQ?MxO'#ISO?lQ?NdO'#CiO@nQ`O'#DiQOQWOOO%[Q^O'#D}OAUQWO'#EQO:VQ7[O'#EkOAaQWO'#EkOAlQpO'#FdOOQU'#Cg'#CgOOQ?Mp'#Dn'#DnOOQ?Mp'#Jq'#JqO%[Q^O'#JqOOQO'#Jt'#JtOOQO'#Id'#IdOBlQ`O'#EdOOQ?Mp'#Ec'#EcOOQ?Mp'#Jx'#JxOChQ?NQO'#EdOCrQ`O'#ETOOQO'#Js'#JsODWQ`O'#JtOEeQ`O'#ETOCrQ`O'#EdPErO#@ItO'#CbPOOO)CDx)CDxOOOO'#I['#I[OE}O!bO,59UOOQ?Mr,59U,59UOOOO'#I]'#I]OF]O#tO,59UO%[Q^O'#D`OOOO'#I_'#I_OFkO!0LbO,59xOOQ?Mr,59x,59xOFyQ^O'#I`OG^QWO'#JoOI]QrO'#JoO+}Q^O'#JoOIdQWO,5:OOIzQWO'#EmOJXQWO'#KOOJdQWO'#J}OJdQWO'#J}OJlQWO,5;ZOJqQWO'#J|OOQ?Mv,5:Z,5:ZOJxQ^O,5:ZOLvQ?NdO,5:cOMgQWO,5:kONQQ?MxO'#J{ONXQWO'#JzO9WQWO'#JzONmQWO'#JzONuQWO,5;YONzQWO'#JzO!#PQrO'#JnOOQ?Mr'#Ci'#CiO%[Q^O'#EPO!#oQrO,5:pOOQQ'#Ju'#JuOOQO-EpOOQU'#Jc'#JcOOQU,5>q,5>qOOQU-EtQWO'#HTO9^QWO'#HVO!DgQWO'#HVO:VQ7[O'#HXO!DlQWO'#HXOOQU,5=m,5=mO!DqQWO'#HYO!ESQWO'#CoO!EXQWO,59PO!EcQWO,59PO!GhQ^O,59POOQU,59P,59PO!GxQ?MxO,59PO%[Q^O,59PO!JTQ^O'#HaOOQU'#Hb'#HbOOQU'#Hc'#HcO`Q^O,5=yO!JkQWO,5=yO`Q^O,5>PO`Q^O,5>RO!JpQWO,5>TO`Q^O,5>VO!JuQWO,5>YO!JzQ^O,5>`OOQU,5>f,5>fO%[Q^O,5>fO9hQ?MxO,5>hOOQU,5>j,5>jO# UQWO,5>jOOQU,5>l,5>lO# UQWO,5>lOOQU,5>n,5>nO# rQ`O'#D[O%[Q^O'#JqO# |Q`O'#JqO#!kQ`O'#DjO#!|Q`O'#DjO#%_Q^O'#DjO#%fQWO'#JpO#%nQWO,5:TO#%sQWO'#EqO#&RQWO'#KPO#&ZQWO,5;[O#&`Q`O'#DjO#&mQ`O'#ESOOQ?Mr,5:l,5:lO%[Q^O,5:lO#&tQWO,5:lO>tQWO,5;VO!A}Q`O,5;VO!BVQ7[O,5;VO:VQ7[O,5;VO#&|QWO,5@]O#'RQ(CYO,5:pOOQO-EzO+}Q^O,5>zOOQO,5?Q,5?QO#*ZQ^O'#I`OOQO-E<^-E<^O#*hQWO,5@ZO#*pQrO,5@ZO#*wQWO,5@iOOQ?Mr1G/j1G/jO%[Q^O,5@jO#+PQWO'#IfOOQO-EoQWO1G3oO$4tQ^O1G3qO$8xQ^O'#HpOOQU1G3t1G3tO$9VQWO'#HvO>tQWO'#HxOOQU1G3z1G3zO$9_Q^O1G3zO9hQ?MxO1G4QOOQU1G4S1G4SOOQ?Mp'#G]'#G]O9hQ?MxO1G4UO9hQ?MxO1G4WO$=fQWO,5@]O!(oQ^O,5;]O9WQWO,5;]O>tQWO,5:UO!(oQ^O,5:UO!A}Q`O,5:UO$=kQ07bO,5:UOOQO,5;],5;]O$=uQ`O'#IaO$>]QWO,5@[OOQ?Mr1G/o1G/oO$>eQ`O'#IgO$>oQWO,5@kOOQ?Mp1G0v1G0vO#!|Q`O,5:UOOQO'#Ic'#IcO$>wQ`O,5:nOOQ?Mv,5:n,5:nO#&wQWO1G0WOOQ?Mr1G0W1G0WO%[Q^O1G0WOOQ?Mr1G0q1G0qO>tQWO1G0qO!A}Q`O1G0qO!BVQ7[O1G0qOOQ?Mp1G5w1G5wO!ArQ?MxO1G0ZOOQO1G0j1G0jO%[Q^O1G0jO$?OQ?MxO1G0jO$?ZQ?MxO1G0jO!A}Q`O1G0ZOCrQ`O1G0ZO$?iQ?MxO1G0jOOQO1G0Z1G0ZO$?}Q?NdO1G0jPOOO-EzO$@kQWO1G5uO$@sQWO1G6TO$@{QrO1G6UO9WQWO,5?QO$AVQ?NdO1G6RO%[Q^O1G6RO$AgQ?MxO1G6RO$AxQWO1G6QO$AxQWO1G6QO9WQWO1G6QO$BQQWO,5?TO9WQWO,5?TOOQO,5?T,5?TO$BfQWO,5?TO$)nQWO,5?TOOQO-E[OOQU,5>[,5>[O%[Q^O'#HqO%:PQWO'#HsOOQU,5>b,5>bO9WQWO,5>bOOQU,5>d,5>dOOQU7+)f7+)fOOQU7+)l7+)lOOQU7+)p7+)pOOQU7+)r7+)rO%:UQ`O1G5wO%:jQ07bO1G0wO%:tQWO1G0wOOQO1G/p1G/pO%;PQ07bO1G/pO>tQWO1G/pO!(oQ^O'#DjOOQO,5>{,5>{OOQO-E<_-E<_OOQO,5?R,5?ROOQO-EtQWO7+&]O!A}Q`O7+&]OOQO7+%u7+%uO$?}Q?NdO7+&UOOQO7+&U7+&UO%[Q^O7+&UO%;ZQ?MxO7+&UO!ArQ?MxO7+%uO!A}Q`O7+%uO%;fQ?MxO7+&UO%;tQ?NdO7++mO%[Q^O7++mO%|O%[Q^O,5>|OOQO-E<`-E<`O%HZQWO1G5xOOQ?Mr<]OOQU,5>_,5>_O&;mQWO1G3|O9WQWO7+&cO!(oQ^O7+&cOOQO7+%[7+%[O&;rQ07bO1G6UO>tQWO7+%[OOQ?Mr<tQWO<tQWO7+)hO'){QWO<{AN>{O%[Q^OAN?[OOQO<]Q7[OG27QOOQO<mQ07bO7+*jOOQUG27iG27iO&:OQWOG27iO!&_Q7[OG27iOOQUG27kG27kO9hQ?MxOG27kOOQUG27sG27sO'>wQ07bOG25TOOQOLD*bLD*bOOQU!$(!Y!$(!YO#&wQWO!$(!YO!&_Q7[O!$(!YO'?RQ?NdOG27QOOQ?MpG26uG26uOOQULD-TLD-TO&:OQWOLD-TOOQULD-VLD-VOOQU!)9Et!)9EtO#&wQWO!)9EtOOQU!$(!o!$(!oOOQU!.K;`!.K;`O'AaQ07bOG27QO!(oQ^O'#DwO1PQWO'#EUO'CSQrO'#JmO'CZQMnO'#DsO'CbQ^O'#D{O'CiQrO'#CiO'FPQrO'#CiO!(oQ^O'#D}O'FaQ^O,5;WO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O,5;bO!(oQ^O'#IlO'HdQWO,5kOh%WOk+aO![']O%f+`O~O!d+cOa(WX![(WX'u(WX!Y(WX~Oa%lO![XO'u%lO~Oh%WO!i%cO~Oh%WO!i%cO(O%eO~O!d#vO#h(tO~Ob+nO%g+oO(O+kO(QTO(TUO!Z)TP~O!Y+pO`)SX~O[+tO~O`+uO~O![%}O(O%eO(P!lO`)SP~Oh%WO#]+zO~Oh%WOk+}O![$}O~O![,PO~O},RO![XO~O%k%tO~O!u,WO~Oe,]O~Ob,^O(O#nO(QTO(TUO!Z)RP~Oe%{O~O%g!QO(O&WO~P=RO[,cO`,bO~OPYOQYOSfOdzOeyOmkOoYOpkOqkOwkOyYO{YO!PWO!TkO!UkO!fuO!iZO!lYO!mYO!nYO!pvO!uxO!y]O%e}O(QTO(TUO([VO(j[O(yiO~O![!eO!r!gO$V!kO(O!dO~P!EkO`,bOa%lO'u%lO~OPYOQYOSfOd!jOe!iOmkOoYOpkOqkOwkOyYO{YO!PWO!TkO!UkO![!eO!fuO!iZO!lYO!mYO!nYO!pvO!u!hO$V!kO(O!dO(QTO(TUO([VO(j[O(yiO~Oa,hO!rwO#t!OO%i!OO%j!OO%k!OO~P!HTO!i&lO~O&Y,nO~O![,pO~O&k,rO&m,sOP&haQ&haS&haY&haa&had&hae&ham&hao&hap&haq&haw&hay&ha{&ha!P&ha!T&ha!U&ha![&ha!f&ha!i&ha!l&ha!m&ha!n&ha!p&ha!r&ha!u&ha!y&ha#t&ha$V&ha%e&ha%g&ha%i&ha%j&ha%k&ha%n&ha%p&ha%s&ha%t&ha%v&ha&S&ha&Y&ha&[&ha&^&ha&`&ha&c&ha&i&ha&o&ha&q&ha&s&ha&u&ha&w&ha's&ha(O&ha(Q&ha(T&ha([&ha(j&ha(y&ha!Z&ha&a&hab&ha&f&ha~O(O,xO~Oh!bX!Y!OX!Z!OX!d!OX!d!bX!i!bX#]!OX~O!Y!bX!Z!bX~P# ZO!d,}O#],|Oh(eX!Y#eX!Y(eX!Z#eX!Z(eX!d(eX!i(eX~Oh%WO!d-PO!i%cO!Y!^X!Z!^X~Op!nO!P!oO(QTO(TUO(`!mO~OP:kOQ:kOSfOdkOg'XX!Y'XX~P!+hO!Y.wOg(ka~OSfO![3uO$c3vO~O!Z3zO~Os3{O~P#.aOa$lq!Y$lq'u$lq's$lq!V$lq!h$lqs$lq![$lq%f$lq!d$lq~P!9mO!V3|O~P#.aO}){O!P)|O(u%QOk'ea(t'ea!Y'ea#]'ea~Og'ea#}'ea~P%+]O}){O!P)|Ok'ga(t'ga(u'ga!Y'ga#]'ga~Og'ga#}'ga~P%,OO(m$ZO~P#.aO!VfX!V$xX!YfX!Y$xX!d%PX#]fX~P!/gO(O;lO~P!1_OmkO(O4OO~P.iO!P%fO!X4QO![%gO(O%eO!Y'aX!h'aX~O!Y/hO!h(za~O!Y/hO!d#vO!h(za~O!Y/hO!d#vO(m'mO!h(za~Og$zi!Y$zi#]$zi#}$zi~P!0pO!X4YO!V'cX!Y'cX~P!3^O!Y/pO!V({a~O!Y/pO!V({a~P#.aO!d#vO#s4bO~Oo4eO!d#vO(m'mO~O(t%OOk%^i}%^i!P%^i(u%^i!Y%^i#]%^i~Og%^i#}%^i~P%0^O(u%QOk%`i}%`i!P%`i(t%`i!Y%`i#]%`i~Og%`i#}%`i~P%1POg(Yi!Y(Yi~P!0pO#]4lOg(Yi!Y(Yi~P!0pO!h4oO~Oa$mq!Y$mq'u$mq's$mq!V$mq!h$mqs$mq![$mq%f$mq!d$mq~P!9mO!V4sO~O!Y4tO![(|X~P#.aOa$xX![$xX%Z]X'u$xX!Y$xX~P!/gO%Z4wOalXklX}lX!PlX![lX'ulX(tlX(ulX!YlX~O%Z4wO~Ob4}O%g5OO(O+kO(QTO(TUO!Y'pX!Z'pX~O!Y0wO!Z)Ta~O[5SO~O`5TO~Oa%lO'u%lO~P#.aO![$}O~P#.aO!Y5]O#]5_O!Z)QX~O!Z5`O~Op!nO!P5aO!_!yO!`!vO!a!vO!y:lO#Q!pO#R!pO#S!pO#T!pO#U!pO#X5fO#Y!zO(P!lO(QTO(TUO(`!mO(j!sO~O!Z5eO~P%6ZOk5kO![1aO%f5jO~Oh%WOk5kO![1aO%f5jO~Ob5rO(O#nO(QTO(TUO!Y'oX!Z'oX~O!Y1lO!Z)Ra~O(QTO(TUO(`5tO~O`5xO~O#s5{O&W5|O~PMlO!h5}O~P%[Oa6PO~Oa6PO~P%[Ob2SO!Z6UO&f2RO~P`O!d6WO~O!d6YOh(ei!Y(ei!Z(ei!d(ei!i(ei~O!Y#ei!Z#ei~P#D_O#]6ZO!Y#ei!Z#ei~O!Y!^i!Z!^i~P#D_Oa%lO#]6dO'u%lO~Oa%lO!d#vO#]6dO'u%lO~O!Y(oq!h(oqa(oq'u(oq~P!9mO!Y(fO!h(nq~O!P%fO![%gO#g6kO(O%eO~O![']O%f6nO~Ok6rO![']O%f6nO~O#h'eaP'eaR'ea['eaa'eao'ea!i'ea!m'ea#O'ea#k'ea#l'ea#m'ea#n'ea#o'ea#p'ea#q'ea#r'ea#s'ea#u'ea#w'ea#y'ea#z'ea'u'ea(['ea(m'ea!h'ea!V'ea's'eas'ea!['ea%f'ea!d'ea~P%+]O#h'gaP'gaR'ga['gaa'gao'ga!i'ga!m'ga#O'ga#k'ga#l'ga#m'ga#n'ga#o'ga#p'ga#q'ga#r'ga#s'ga#u'ga#w'ga#y'ga#z'ga'u'ga(['ga(m'ga!h'ga!V'ga's'gas'ga!['ga%f'ga!d'ga~P%,OO#h$ziP$ziR$zi[$zia$zio$zi!Y$zi!i$zi!m$zi#O$zi#k$zi#l$zi#m$zi#n$zi#o$zi#p$zi#q$zi#r$zi#s$zi#u$zi#w$zi#y$zi#z$zi'u$zi([$zi(m$zi!h$zi!V$zi's$zi#]$zis$zi![$zi%f$zi!d$zi~P#.aO#h%^iP%^iR%^i[%^ia%^io%^i!i%^i!m%^i#O%^i#k%^i#l%^i#m%^i#n%^i#o%^i#p%^i#q%^i#r%^i#s%^i#u%^i#w%^i#y%^i#z%^i'u%^i([%^i(m%^i!h%^i!V%^i's%^is%^i![%^i%f%^i!d%^i~P%0^O#h%`iP%`iR%`i[%`ia%`io%`i!i%`i!m%`i#O%`i#k%`i#l%`i#m%`i#n%`i#o%`i#p%`i#q%`i#r%`i#s%`i#u%`i#w%`i#y%`i#z%`i'u%`i([%`i(m%`i!h%`i!V%`i's%`is%`i![%`i%f%`i!d%`i~P%1PO!Y'Ua!h'Ua~P!9mO!Y.lO!h(fi~O#}#`i!Y#`i!Z#`i~P#D_OP$]OR#zO}#yO!P#{O!i#xO!m$]O([VO[#jio#ji#O#ji#l#ji#m#ji#n#ji#o#ji#p#ji#q#ji#r#ji#s#ji#u#ji#w#ji#y#ji#z#ji#}#ji(m#ji(t#ji(u#ji!Y#ji!Z#ji~O#k#ji~P%HpO#k:tO~P%HpOP$]OR#zO}#yO!P#{O!i#xO!m$]O#k:tO#l:uO#m:uO#n:uO([VO[#ji#O#ji#o#ji#p#ji#q#ji#r#ji#s#ji#u#ji#w#ji#y#ji#z#ji#}#ji(m#ji(t#ji(u#ji!Y#ji!Z#ji~Oo#ji~P%JxOo:vO~P%JxOP$]OR#zOo:vO}#yO!P#{O!i#xO!m$]O#k:tO#l:uO#m:uO#n:uO#o:wO([VO#u#ji#w#ji#y#ji#z#ji#}#ji(m#ji(t#ji(u#ji!Y#ji!Z#ji~O[#ji#O#ji#p#ji#q#ji#r#ji#s#ji~P%MQO[;SO#O:xO#p:xO#q:xO#r;RO#s:xO~P%MQOP$]OR#zO[;SOo:vO}#yO!P#{O!i#xO!m$]O#O:xO#k:tO#l:uO#m:uO#n:uO#o:wO#p:xO#q:xO#r;RO#s:xO#u:yO([VO(u#}O#y#ji#z#ji#}#ji(m#ji(t#ji!Y#ji!Z#ji~O#w:{O~P& iO#w#ji~P& iOP$]OR#zO[;SOo:vO}#yO!P#{O!i#xO!m$]O#O:xO#k:tO#l:uO#m:uO#n:uO#o:wO#p:xO#q:xO#r;RO#s:xO#u:yO([VO#y#ji#z#ji#}#ji(m#ji!Y#ji!Z#ji~O#w#ji(t#ji(u#ji~P&#qO#w:{O(t#|O(u#}O~P&#qOP$]OR#zO[;SOo:vO}#yO!P#{O!i#xO!m$]O#O:xO#k:tO#l:uO#m:uO#n:uO#o:wO#p:xO#q:xO#r;RO#s:xO#u:yO#w:{O#y:}O([VO(t#|O(u#}O~O#z#ji#}#ji(m#ji!Y#ji!Z#ji~P&&POa#{y!Y#{y'u#{y's#{y!V#{y!h#{ys#{y![#{y%f#{y!d#{y~P!9mOk < TypeParamList TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:376,context:Lp,nodeProps:[["isolate",-8,5,6,14,34,36,48,50,52,""],["group",-26,9,17,19,65,204,208,212,213,215,218,221,231,233,239,241,243,245,248,254,260,262,264,266,268,270,271,"Statement",-34,13,14,29,32,33,39,48,51,52,54,59,67,69,73,77,79,81,82,107,108,117,118,135,138,140,141,142,143,144,146,147,166,167,169,"Expression",-23,28,30,34,38,40,42,171,173,175,176,178,179,180,182,183,184,186,187,188,198,200,202,203,"Type",-3,85,100,106,"ClassItem"],["openedBy",23,"<",35,"InterpolationStart",53,"[",57,"{",70,"(",159,"JSXStartCloseTag"],["closedBy",24,">",37,"InterpolationEnd",47,"]",58,"}",71,")",164,"JSXEndTag"]],propSources:[ev],skippedNodes:[0,5,6,274],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$h&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$h&j(U!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(U!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$h&j(RpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(RpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Rp(U!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$h&j(Rp(U!b'w0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(S#S$h&j'x0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$h&j(Rp(U!b'x0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$h&j!m),Q(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#u(Ch$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#u(Ch$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(Q':f$h&j(U!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$h&j(U!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$h&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$c`$h&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$c``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$c`$h&j(U!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(U!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$c`(U!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$h&j(Rp(U!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$h&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(U!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$h&j(RpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(RpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Rp(U!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$h&j!U7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!U7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!U7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$h&j(U!b!U7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(U!b!U7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(U!b!U7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(U!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$h&j(U!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$h&j(Rp(U!bp'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$h&j(Rp(U!bp'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$h&j(Rp(U!bp'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$h&j(Rp(U!bp'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!d$b$h&j#})Lv(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$h&j(Rp(U!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#O-8192){var s,l=i(dv(t,e.node));try{for(l.s();!(s=l.n()).done;){var u=s.value;r.push(u)}}catch(h){l.e(h)}finally{l.f()}return!1}})),lv.set(e,r),r}var Ov=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,pv=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function vv(t){var e=lu(t.state).resolveInner(t.pos,-1);if(pv.indexOf(e.name)>-1)return null;var n="VariableName"==e.name||e.to-e.from<20&&Ov.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;for(var i=[],r=e;r;r=r.parent)uv.has(r.name)&&(i=i.concat(dv(t.state.doc,r)));return{options:i,from:n?e.from:t.pos,validFor:Ov}}var gv=su.define({name:"javascript",parser:ov.configure({props:[Su.add({IfStatement:Mu({except:/^\s*({|else\b)/}),TryStatement:Mu({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:function(t){return t.baseIndent},SwitchBody:function(t){var e=t.textAfter,n=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return t.baseIndent+(n?0:i?1:2)*t.unit},Block:Au({closing:"}"}),ArrowFunction:function(t){return t.baseIndent+t.unit},"TemplateString BlockComment":function(){return null},"Statement Property":Mu({except:/^{/}),JSXElement:function(t){var e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape:function(t){var e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag":function(t){return t.column(t.node.from)+t.unit}}),Xu.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Yu,BlockComment:function(t){return{from:t.from+2,to:t.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),mv={test:function(t){return/^JSX/.test(t.name)},facet:iu({commentTokens:{block:{open:"{/*",close:"*/}"}}})},yv=gv.configure({dialect:"ts"},"typescript"),kv=gv.configure({dialect:"jsx",props:[ru.add((function(t){return t.isTop?[mv]:void 0}))]}),bv=gv.configure({dialect:"jsx ts",props:[ru.add((function(t){return t.isTop?[mv]:void 0}))]},"typescript"),wv=function(t){return{label:t,type:"keyword"}},Qv="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(wv),xv=Qv.concat(["declare","implements","private","protected","public"].map(wv));function Sv(){var t,e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.jsx?n.typescript?bv:kv:n.typescript?yv:gv,r=n.typescript?sv.concat(xv):av.concat(Qv);return new mu(i,[gv.data.of({autocomplete:(t=pv,e=yd(r),function(n){for(var i=lu(n.state).resolveInner(n.pos,-1);i;i=i.parent){if(t.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(n)})}),gv.data.of({autocomplete:vv}),n.jsx?Zv:[]])}function Pv(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,i=null==e?void 0:e.firstChild;i;i=i.nextSibling)if("JSXIdentifier"==i.name||"JSXBuiltin"==i.name||"JSXNamespacedName"==i.name||"JSXMemberExpression"==i.name)return t.sliceString(i.from,Math.min(i.to,n));return""}var $v="object"==("undefined"==typeof navigator?"undefined":n(navigator))&&/Android\b/.test(navigator.userAgent),Zv=oa.inputHandler.of((function(t,e,n,i,r){if(($v?t.composing:t.compositionStarted)||t.state.readOnly||e!=n||">"!=i&&"/"!=i||!gv.isActiveAt(t.state,e,-1))return!1;var o=r(),a=o.state,s=a.changeByRange((function(t){var e,n,r=t.head,o=lu(a).resolveInner(r-1,-1);if("JSXStartTag"==o.name&&(o=o.parent),a.doc.sliceString(r-1,r)!=i||"JSXAttributeValue"==o.name&&o.to>r);else{if(">"==i&&"JSXFragmentTag"==o.name)return{range:t,changes:{from:r,insert:""}};if("/"==i&&"JSXStartCloseTag"==o.name){var s=o.parent,l=s.parent;if(l&&s.from==r-2&&((n=Pv(a.doc,l.firstChild,r))||"JSXFragmentTag"==(null===(e=l.firstChild)||void 0===e?void 0:e.name))){var u="".concat(n,">");return{range:Et.cursor(r+u.length,-1),changes:{from:r,insert:u}}}}else if(">"==i){var h=function(t){for(;;){if("JSXOpenTag"==t.name||"JSXSelfClosingTag"==t.name||"JSXFragmentTag"==t.name)return t;if("JSXEscape"==t.name||!t.parent)return null;t=t.parent}}(o);if(h&&"JSXOpenTag"==h.name&&!/^\/?>|^<\//.test(a.doc.sliceString(r,r+2))&&(n=Pv(a.doc,h,r)))return{range:t,changes:{from:r,insert:"")}}}}return{range:t}}));return!s.changes.empty&&(t.dispatch([o,a.update(s,{userEvent:"input.complete",scrollIntoView:!0})]),!0)})),Rv=Ml({String:eu.string,Number:eu.number,"True False":eu.bool,PropertyName:eu.propertyName,Null:eu.null,",":eu.separator,"[ ]":eu.squareBracket,"{ }":eu.brace}),Tv=Np.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[Rv],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Av=su.define({name:"json",parser:Tv.configure({props:[Su.add({Object:Mu({except:/^\s*\}/}),Array:Mu({except:/^\s*\]/})}),Xu.add({"Object Array":Yu})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Cv(){return new mu(Av)}var Mv=function(t){return E("data-v-215c20bb"),t=t(),_(),t},Wv={class:"cus-animation",style:{height:"100%",width:"100%",padding:"16px 20px",display:"flex","flex-direction":"column"}},Xv={class:"card-container",style:{"flex-grow":"5",height:"0px"}},Yv={style:{height:"100%",display:"flex"}},qv={style:{"border-left":"1px solid #eee"}},jv={style:{height:"100%","flex-grow":"1"}},zv={style:{height:"100%",display:"flex"}},Dv={style:{"border-left":"1px solid #eee"}},Ev={style:{height:"100%","flex-grow":"1"}},_v=Mv((function(){return A("div",{style:{"margin-right":"5px"}},[A("span",null,"JavaScript")],-1)})),Vv={class:"card-container2",style:{"flex-grow":"3",height:"0px",overflow:"hidden"}},Uv={style:{"margin-right":"0px"}},Nv=Mv((function(){return A("span",{style:{"margin-right":"0px"}},"输入类型:",-1)})),Bv=Mv((function(){return A("span",{style:{"margin-left":"40px"}},"处理步骤:",-1)})),Iv={style:{padding:"16px 0px 10px 44px"}};a("default",V(p({__name:"Index",setup:function(t){var e=S(null),i=P({x:1300}),r=Sv(),o=[Sv()],a=function(t){E.value=!1;var e=c.value[0];t!=h.value[parseInt(e)].code?h.value[parseInt(e)].isChange=!0:h.value[parseInt(e)].isChange=!1},s=S(!1),l=Cv(),u=[Cv()],h=S([]),c=S(["0"]),d=S(0),O=S(""),p=S("mqtt"),v=S("web"),g=S(""),m=S(""),y=function(t){var e=t.key;h.value[d.value].draft=O.value,h.value[d.value].draft!=h.value[d.value].code&&(h.value[d.value].isChange=!0),d.value=e,O.value=h.value[e].draft},b=S(1),w=S([]),Q=S(["0"]),x=S(""),E=S(!1),_=function(){N({url:"/script/get-code",data:{type:"prod"}},(function(t){console.log(t),0==t.code?(w.value=t.data,x.value=w.value[0].code):M.error(t.data),O.value==x.value?s.value=!0:s.value=!1}))},V=function(t){console.log(t.key),x.value=w.value[t.key].code},B=function(t){console.log(t),2!=t||x.value||_()},I=function(){var t,e;t=c.value[0],e=h.value[parseInt(t)].fileName,console.log(t,e),N({url:"/script/set-code",data:{type:"test",fileName:e,code:O.value}},(function(e){console.log(e),0==e.code?(M.success("保存成功"),h.value[parseInt(t)].code=O.value,h.value[parseInt(t)].isChange=!1):M.error(e.data)}))},G=function(){""!=g.value?N({url:"/script/test",data:{from:p.value,to:v.value,input:g.value}},(function(t){console.log(t),console.log(n(t.data)),"object"==n(t.data)?m.value=JSON.stringify(t.data,null,2):m.value=t.data+"",b.value=2,"web"!=v.value&&"pc"!=v.value||(E.value=!0)}),(function(t){console.log(t),m.value=t.msg,b.value=2})):M.error("模拟输入不能为空")},L=function(){console.log("prod"),N({url:"/script/publish"},(function(t){console.log(t),0==t.code?(M.success("发布成功"),_()):M.error(t.data),E.value=!1}))};return k((function(){var t;console.log("device onMounted..."),i.y=(null===(t=e.value)||void 0===t?void 0:t.clientHeight)-113,N({url:"/script/get-code",data:{type:"test"}},(function(t){if(console.log(t),0==t.code){h.value=t.data;for(var e=0;e