From 592425bfc96b1913a5279c2988b490eb39ad2aea Mon Sep 17 00:00:00 2001 From: gabek Date: Mon, 12 Dec 2022 14:54:55 +0000 Subject: [PATCH] Bundle embedded web app --- static/web/404.html | 4 ++-- static/web/404/index.html | 4 ++-- static/web/_next/static/chunks/4ad82c5e-170dc8748c5bb2d7.js | 1 - static/web/_next/static/chunks/4ad82c5e-573627f1f4333b92.js | 1 + .../_buildManifest.js | 2 +- .../_ssgManifest.js | 0 static/web/admin/access-tokens/index.html | 2 +- static/web/admin/actions/index.html | 2 +- static/web/admin/chat/messages/index.html | 2 +- static/web/admin/chat/users/index.html | 2 +- static/web/admin/config-chat/index.html | 2 +- static/web/admin/config-federation/index.html | 2 +- static/web/admin/config-notify/index.html | 2 +- static/web/admin/config-public-details/index.html | 2 +- static/web/admin/config-server-details/index.html | 2 +- static/web/admin/config-social-items/index.html | 2 +- static/web/admin/config-storage/index.html | 2 +- static/web/admin/config-video/index.html | 2 +- static/web/admin/config/appearance/index.html | 2 +- static/web/admin/config/streamkeys/index.html | 2 +- static/web/admin/federation/actions/index.html | 2 +- static/web/admin/federation/followers/index.html | 2 +- static/web/admin/hardware-info/index.html | 2 +- static/web/admin/help/index.html | 2 +- static/web/admin/index.html | 2 +- static/web/admin/logs/index.html | 2 +- static/web/admin/stream-health/index.html | 2 +- static/web/admin/upgrade/index.html | 2 +- static/web/admin/viewer-info/index.html | 2 +- static/web/admin/webhooks/index.html | 2 +- static/web/embed/chat/readonly/index.html | 2 +- static/web/embed/chat/readwrite/index.html | 2 +- static/web/embed/video/index.html | 2 +- static/web/index.html | 4 ++-- 34 files changed, 35 insertions(+), 35 deletions(-) delete mode 100644 static/web/_next/static/chunks/4ad82c5e-170dc8748c5bb2d7.js create mode 100644 static/web/_next/static/chunks/4ad82c5e-573627f1f4333b92.js rename static/web/_next/static/{AHfwI8q2tdwt5dN-doVir => dEsHH1RLiHgALIdBFBzcU}/_buildManifest.js (97%) rename static/web/_next/static/{AHfwI8q2tdwt5dN-doVir => dEsHH1RLiHgALIdBFBzcU}/_ssgManifest.js (100%) diff --git a/static/web/404.html b/static/web/404.html index f81031281..1d8a62d02 100644 --- a/static/web/404.html +++ b/static/web/404.html @@ -1,4 +1,4 @@ -404: This page could not be found

404

This page could not be found.

\ No newline at end of file + }

404

This page could not be found.

\ No newline at end of file diff --git a/static/web/404/index.html b/static/web/404/index.html index f81031281..1d8a62d02 100644 --- a/static/web/404/index.html +++ b/static/web/404/index.html @@ -1,4 +1,4 @@ -404: This page could not be found

404

This page could not be found.

\ No newline at end of file + }

404

This page could not be found.

\ No newline at end of file diff --git a/static/web/_next/static/chunks/4ad82c5e-170dc8748c5bb2d7.js b/static/web/_next/static/chunks/4ad82c5e-170dc8748c5bb2d7.js deleted file mode 100644 index 86e38319c..000000000 --- a/static/web/_next/static/chunks/4ad82c5e-170dc8748c5bb2d7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5762],{47421:function(t,e,i){let s;i.d(e,{$1:function(){return iw},$f:function(){return im},AE:function(){return i_},Eu:function(){return sW},HQ:function(){return sq},Nm:function(){return tF},OO:function(){return tA},S2:function(){return i4},SJ:function(){return sy},Sd:function(){return sm},Uw:function(){return iR},W$:function(){return i2},ZO:function(){return iZ},Zs:function(){return i3},bF:function(){return sd},gB:function(){return su},hJ:function(){return sn},l9:function(){return ts},lg:function(){return tR},mH:function(){return sb},p:function(){return tn},qr:function(){return iF},tk:function(){return ir},v5:function(){return sk}});var o,n,r,l=i(78120),h=i(28699),a=i(33952);function c(t){return(11==t.nodeType?t.getSelection?t:t.ownerDocument:t).getSelection()}function d(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function u(t,e){if(!e.anchorNode)return!1;try{return d(t,e.anchorNode)}catch(i){return!1}}function f(t){return 3==t.nodeType?M(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function p(t,e,i,s){return!!i&&(g(t,e,i,s,-1)||g(t,e,i,s,1))}function m(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function g(t,e,i,s,o){for(;;){if(t==i&&e==s)return!0;if(e==(o<0?0:v(t))){if("DIV"==t.nodeName)return!1;let n=t.parentNode;if(!n||1!=n.nodeType)return!1;e=m(t)+(o<0?0:1),t=n}else{if(1!=t.nodeType||1==(t=t.childNodes[e+(o<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=o<0?v(t):0}}}function v(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}let w={left:0,right:0,top:0,bottom:0};function b(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}class y{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,s){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=s}}let x=null;function S(t){if(t.setActive)return t.setActive();if(x)return t.focus(x);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==x?{get preventScroll(){return x={preventScroll:!0},!0}}:void 0),!x){x=!1;for(let s=0;se)return c.domBoundsAround(t,e,h);if(d>=t&&-1==s&&(s=l,o=h),h>e&&c.dom.parentNode==this.dom){n=l,r=a;break}a=d,h=d+c.breakAfter}return{from:o,to:r<0?i+this.length:r,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:n=0?this.children[n].dom:null}}markDirty(t=!1){this.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(t){this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,i=D){this.markDirty();for(let s=t;sthis.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function E(t,e,i,s,o,n,r,l,h){let{children:a}=t,c=a.length?a[e]:null,d=n.length?n[n.length-1]:null,u=d?d.breakAfter:r;if(!(e==s&&c&&!r&&!u&&n.length<2&&c.merge(i,o,n.length?d:null,0==i,l,h))){if(s0&&(!r&&n.length&&c.merge(i,c.length,n[0],!1,l,0)?c.breakAfter=n.shift().breakAfter:(i2);var K={mac:j||/Mac/.test(L.platform),windows:/Win/.test(L.platform),linux:/Linux|X11/.test(L.platform),ie:W,ie_version:N?V.documentMode||6:P?+P[1]:H?+H[1]:0,gecko:z,gecko_version:z?+(/Firefox\/(\d+)/.exec(L.userAgent)||[0,0])[1]:0,chrome:!!F,chrome_version:F?+F[1]:0,ios:j,android:/Android\b/.test(L.userAgent),webkit:I,safari:q,webkit_version:I?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=V.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class $ extends T{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){3==t.nodeType&&this.createDOM(t)}merge(t,e,i){return(!i||i instanceof $&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new $(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new A(this.dom,t)}domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return X(this.dom,t,e)}}class G extends T{constructor(t,e=[],i=0){for(let s of(super(),this.mark=t,this.children=e,this.length=i,e))s.setParent(this)}setAttrs(t){if(C(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t){this.dom?4&this.dirty&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t)}merge(t,e,i,s,o,n){return(!i||!!(i instanceof G&&i.mark.eq(this.mark))&&(!t||!(o<=0))&&(!(et&&e.push(i=t&&(s=o),i=r,o++}let l=this.length-t;return this.length=t,s>-1&&(this.children.length=s,this.markDirty()),new G(this.mark,e,l)}domAtPos(t){return Z(this,t)}coordsAt(t,e){return J(this,t,e)}}function X(t,e,i){let s=t.nodeValue.length;e>s&&(e=s);let o=e,n=e,r=0;0==e&&i<0||e==s&&i>=0?!(K.chrome||K.gecko)&&(e?(o--,r=1):n=0)?0:l.length-1];return K.safari&&!r&&0==h.width&&(h=Array.prototype.find.call(l,t=>t.width)||h),r?b(h,r<0):h||null}class _ extends T{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||_)(t,e,i)}split(t){let e=_.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(){this.dom&&this.widget.updateDOM(this.dom)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(this.editorView)),this.dom.contentEditable="false")}getSide(){return this.side}merge(t,e,i,s,o,n){return(!i||i instanceof _&&!!this.widget.compare(i.widget)&&(!(t>0)||!(o<=0))&&(!(e0?i.length-1:0;s=i[o],t>0?0!=o:o!=i.length-1&&!(s.top0?-1:1);return this.length?s:b(s,this.side>0)}get isEditable(){return!1}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class U extends _{domAtPos(t){let{topView:e,text:i}=this.widget;return e?Y(t,0,e,i,(t,e)=>t.domAtPos(e),t=>new A(i,Math.min(t,i.nodeValue.length))):new A(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:s}=this.widget;return i?function t(e,i,s,o){if(s instanceof G)for(let n of s.children){let r=0,l=d(n.dom,o);if(d(n.dom,e))return r+(l?t(e,i,n,o):n.localPosFromDOM(e,i));r+=l?o.nodeValue.length:n.length}else if(s.dom==o)return Math.min(i,o.nodeValue.length);return s.localPosFromDOM(e,i)}(t,e,i,s):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:s}=this.widget;return i?Y(t,e,i,s,(t,e,i)=>t.coordsAt(e,i),(t,e)=>X(s,t,e)):X(s,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function Y(t,e,i,s,o,n){if(i instanceof G){for(let r=i.dom.firstChild;r;r=r.nextSibling){let l=T.get(r);if(!l)return n(t,e);let h=d(r,s),a=l.length+(h?s.nodeValue.length:0);if(t=l.getSide())return h?Y(t,e,l,s,o,n):o(l,t,e);t-=a}return o(i,i.length,-1)}return i.dom==s?n(t,e):o(i,t,e)}class Q extends T{constructor(t){super(),this.side=t}get length(){return 0}merge(){return!1}become(t){return t instanceof Q&&t.side==this.side}split(){return new Q(this.side)}sync(){if(!this.dom){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),this.setDOM(t)}}getSide(){return this.side}domAtPos(t){return A.before(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,s=i?i.children.indexOf(t):-1;for(;i&&s>=0;)if(e<0?s>0:s0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return l.xv.empty}}function Z(t,e){let i=t.dom,{children:s}=t,o=0;for(let n=0;o=r.getSide())){if(e>n&&e0;h--){let a=s[h-1];if(a.dom.parentNode==i)return a.domAtPos(a.length)}for(let c=o;c=i&&(a.children.length?t(a,i-h):!n&&(c>i||h==c&&a.getSide()>0)?(n=a,r=i-h):(ha.getSide())&&(s=a,o=i-h)),h=c}}(t,e);let l=(i<0?s:n)||s||n;return l?l.coordsAt(Math.max(0,l==s?o:r),i):function(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let i=f(e);return i[i.length-1]||null}(t)}function tt(t,e){for(let i in t)"class"==i&&e.class?e.class+=" "+t.class:"style"==i&&e.style?e.style+=";"+t.style:e[i]=t[i];return e}function te(t,e){if(t==e)return!0;if(!t||!e)return!1;let i=Object.keys(t),s=Object.keys(e);if(i.length!=s.length)return!1;for(let o of i)if(-1==s.indexOf(o)||t[o]!==e[o])return!1;return!0}function ti(t,e,i){let s=null;if(e)for(let o in e)i&&o in i||t.removeAttribute(s=o);if(i)for(let n in i)e&&e[n]==i[n]||t.setAttribute(s=n,i[n]);return!!s}$.prototype.children=_.prototype.children=Q.prototype.children=D;class ts{eq(t){return!1}updateDOM(t){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return -1}ignoreEvent(t){return!0}get customView(){return null}destroy(t){}}var to=((o=to||(to={}))[o.Text=0]="Text",o[o.WidgetBefore=1]="WidgetBefore",o[o.WidgetAfter=2]="WidgetAfter",o[o.WidgetRange=3]="WidgetRange",o);class tn extends l.uU{constructor(t,e,i,s){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=s}get heightRelevant(){return!1}static mark(t){return new tr(t)}static widget(t){let e=t.side||0,i=!!t.block;return e+=i?e>0?3e8:-4e8:e>0?1e8:-1e8,new th(t,e,e,i,t.widget||null,!1)}static replace(t){let e=!!t.block,i,s;if(t.isBlockGap)i=-5e8,s=4e8;else{let{start:o,end:n}=ta(t,e);i=(o?e?-3e8:-1:5e8)-1,s=(n?e?2e8:1:-6e8)+1}return new th(t,i,s,e,t.widget||null,!0)}static line(t){return new tl(t)}static set(t,e=!1){return l.Xs.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}tn.none=l.Xs.empty;class tr extends tn{constructor(t){let{start:e,end:i}=ta(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){return this==t||t instanceof tr&&this.tagName==t.tagName&&this.class==t.class&&te(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw RangeError("Mark decorations may not be empty");return super.range(t,e)}}tr.prototype.point=!1;class tl extends tn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof tl&&te(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}tl.prototype.mapMode=l.gc.TrackBefore,tl.prototype.point=!0;class th extends tn{constructor(t,e,i,s,o,n){super(e,i,o,t),this.block=s,this.isReplace=n,this.mapMode=s?e<=0?l.gc.TrackBefore:l.gc.TrackAfter:l.gc.TrackDel}get type(){return this.startSide=5}eq(t){var e,i;return t instanceof th&&((e=this.widget)==(i=t.widget)||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}function ta(t,e=!1){let{inclusiveStart:i,inclusiveEnd:s}=t;return null==i&&(i=t.inclusive),null==s&&(s=t.inclusive),{start:null!=i?i:e,end:null!=s?s:e}}function tc(t,e,i,s=0){let o=i.length-1;o>=0&&i[o]+s>=t?i[o]=Math.max(i[o],e):i.push(t,e)}th.prototype.point=!0;class td extends T{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,i,s,o,n){if(i){if(!(i instanceof td))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),B(this,t,e,i?i.children:[],o,n),!0}split(t){let e=new td;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i,off:s}=this.childPos(t);s&&(e.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let o=i;o0&&0==this.children[i-1].length;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e}transferDOM(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)}setDeco(t){te(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){!function t(e,i,s){let o,{children:n}=e;s>0&&i instanceof G&&n.length&&(o=n[n.length-1])instanceof G&&o.mark.eq(i.mark)?t(o,i.children[0],s-1):(n.push(i),i.setParent(e)),e.length+=i.length}(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=tt(e,this.attrs||{})),i&&(this.attrs=tt({class:i},this.attrs||{}))}domAtPos(t){return Z(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t){var e;this.dom?4&this.dirty&&(C(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&&(ti(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t);let i=this.dom.lastChild;for(;i&&T.get(i) instanceof G;)i=i.lastChild;if(!i||!this.length||"BR"!=i.nodeName&&(null===(e=T.get(i))||void 0===e?void 0:e.isEditable)==!1&&(!K.ios||!this.children.some(t=>t instanceof $))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let t=0;for(let e of this.children){if(!(e instanceof $)||/[^ -~]/.test(e.text))return null;let i=f(e.dom);if(1!=i.length)return null;t+=i[0].width}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length}:null}coordsAt(t,e){return J(this,t,e)}become(t){return!1}get type(){return to.Text}static find(t,e){for(let i=0,s=0;i=e){if(o instanceof td)return o;if(n>e)break}s=n+o.breakAfter}return null}}class tu extends T{constructor(t,e,i){super(),this.widget=t,this.length=e,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,s,o,n){return(!i||i instanceof tu&&!!this.widget.compare(i.widget)&&(!(t>0)||!(o<=0))&&(!(e0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:n}=this.cursor.next(this.skip);if(this.skip=0,n)throw 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=s,this.textOff=0}let r=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(tp(new $(this.text.slice(this.textOff,this.textOff+r)),e),i),this.atCursorPos=!0,this.textOff+=r,t-=r,i=0}}span(t,e,i,s){this.buildText(e-t,i,s),this.pos=e,this.openStart<0&&(this.openStart=s)}point(t,e,i,s,o,n){if(this.disallowBlockEffectsFor[n]&&i instanceof th){if(i.block)throw RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw RangeError("Decorations that replace line breaks may not be specified via plugins")}let r=e-t;if(i instanceof th){if(i.block){let{type:l}=i;l!=to.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new tu(i.widget||new tm("div"),r,l))}else{let h=_.create(i.widget||new tm("span"),r,r?0:i.startSide),a=this.atCursorPos&&!h.isEditable&&o<=s.length&&(t0),c=!h.isEditable&&(ts.length||i.startSide<=0),d=this.getLine();2!=this.pendingBuffer||a||(this.pendingBuffer=0),this.flushBuffer(s),a&&(d.append(tp(new Q(1),s),o),o=s.length+Math.max(0,o-s.length)),d.append(tp(h,s),o),this.atCursorPos=c,this.pendingBuffer=c?ts.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);r&&(this.textOff+r<=this.text.length?this.textOff+=r:(this.skip+=r-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=o)}static build(t,e,i,s,o){let n=new tf(t,e,i,o);return n.openEnd=l.Xs.spans(s,e,i,n),n.openStart<0&&(n.openStart=n.openEnd),n.finish(n.openEnd),n}}function tp(t,e){for(let i of e)t=new G(i,[t],t.length);return t}class tm extends ts{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}}let tg=l.r$.define(),tv=l.r$.define(),tw=l.r$.define(),tb=l.r$.define(),ty=l.r$.define(),tx=l.r$.define(),tS=l.r$.define({combine:t=>t.some(t=>t)}),tM=l.r$.define({combine:t=>t.some(t=>t)});class tk{constructor(t,e="nearest",i="nearest",s=5,o=5){this.range=t,this.y=e,this.x=i,this.yMargin=s,this.xMargin=o}map(t){return t.empty?this:new tk(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}let tC=l.Py.define({map:(t,e)=>t.map(e)});function tA(t,e,i){let s=t.facet(tb);s.length?s[0](e):window.onerror?window.onerror(String(e),i,void 0,void 0,e):i?console.error(i+":",e):console.error(e)}let tD=l.r$.define({combine:t=>!t.length||t[0]}),tT=0,tO=l.r$.define();class tR{constructor(t,e,i,s){this.id=t,this.create=e,this.domEventHandlers=i,this.extension=s(this)}static define(t,e){let{eventHandlers:i,provide:s,decorations:o}=e||{};return new tR(tT++,t,i,t=>{let e=[tO.of(t)];return o&&e.push(tV.of(e=>{let i=e.plugin(t);return i?o(i):tn.none})),s&&e.push(s(t)),e})}static fromClass(t,e){return tR.define(e=>new t(e),e)}}class tE{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(s){if(tA(e.state,s,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(i){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(o){tA(t.state,o,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(i){tA(t.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}let tB=l.r$.define(),tL=l.r$.define(),tV=l.r$.define(),tH=l.r$.define(),tN=l.r$.define(),tP=l.r$.define();class tW{constructor(t,e,i,s){this.fromA=t,this.toA=e,this.fromB=i,this.toB=s}join(t){return new tW(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let s=t[e-1];if(!(s.fromA>i.toA)){if(s.toAa)break;o+=2}if(!l)return i;new tW(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),n=l.toA,r=l.toB}}}class tz{constructor(t,e,i){for(let s of(this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=l.as.empty(this.startState.doc.length),i))this.changes=this.changes.compose(s.changes);let o=[];this.changes.iterChangedRanges((t,e,i,s)=>o.push(new tW(t,e,i,s))),this.changedRanges=o;let n=t.hasFocus;n!=t.inputState.notifiedFocused&&(t.inputState.notifiedFocused=n,this.flags|=1)}static create(t,e,i){return new tz(t,e,i)}get viewportChanged(){return(4&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(10&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}var tF=((n=tF||(tF={}))[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n);let tI=tF.LTR,tq=tF.RTL;function tj(t){let e=[];for(let i=0;i=e){if(r.level==i)return n;(o<0||(0!=s?s<0?r.frome:t[o].level>r.level))&&(o=n)}}if(o<0)throw RangeError("Index out of range");return o}}let tJ=[];function t0(t){return[new tZ(0,t,0)]}let t1="";class t2{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(l.yy.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+="￿"}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let s=t;;){this.findPointBefore(i,s),this.readNode(s);let o=s.nextSibling;if(o==e)break;let n=T.get(s),r=T.get(o);(n&&r?n.breakAfter:(n?n.breakAfter:t8(s))||t8(o)&&("BR"!=s.nodeName||s.cmIgnore))&&this.lineBreak(),s=o}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let s=0,o=this.lineSeparator?null:/\r\n?|\n/g;;){let n=-1,r=1,l;if(this.lineSeparator?(n=e.indexOf(this.lineSeparator,s),r=this.lineSeparator.length):(l=o.exec(e))&&(n=l.index,r=l[0].length),this.append(e.slice(s,n<0?e.length:n)),n<0)break;if(this.lineBreak(),r>1)for(let h of this.points)h.node==t&&h.pos>this.text.length&&(h.pos-=r-1);s=n+r}}readNode(t){if(t.cmIgnore)return;let e=T.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(3==t.nodeType?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+Math.min(e,i.offset))}}function t8(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class t3{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class t9 extends T{constructor(t){super(),this.view=t,this.compositionDeco=tn.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new td],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new tW(0,0,0,t.state.doc.length)],0)}get editorView(){return this.view}get length(){return this.view.state.doc.length}update(t){var e,i,s;let o,n=t.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:t,toA:e})=>ethis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=tn.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=t4(t);if(!i)return tn.none;let{from:s,to:o,node:n,text:r}=i,l=e.mapPos(s,1),h=Math.max(l,e.mapPos(o,-1)),{state:a}=t,c=3==n.nodeType?n.nodeValue:new t2([],a).readRange(n.firstChild,null).text;if(h-l{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=K.chrome||K.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to=0?t[s]:null;if(!o)break;let{fromA:n,toA:r,fromB:l,toB:h}=o,{content:a,breakAtStart:c,openStart:d,openEnd:u}=tf.build(this.view.state.doc,l,h,this.decorations,this.dynamicDecorationMap),{i:f,off:p}=i.findPos(r,1),{i:m,off:g}=i.findPos(n,-1);E(this,m,g,f,p,a,c,d,u)}}updateSelection(t=!1,e=!1){var i;if((t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange(),!(e||this.mayControlSelection()))return;let s=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,n=this.domAtPos(o.anchor),r=o.empty?n:this.domAtPos(o.head);if(K.gecko&&o.empty&&1==(i=n).node.nodeType&&i.node.firstChild&&(0==i.offset||"false"==i.node.childNodes[i.offset-1].contentEditable)&&(i.offset==i.node.childNodes.length||"false"==i.node.childNodes[i.offset].contentEditable)){let l=document.createTextNode("");this.view.observer.ignore(()=>n.node.insertBefore(l,n.node.childNodes[n.offset]||null)),n=r=new A(l,0),s=!0}let h=this.view.observer.selectionRange;!s&&h.focusNode&&p(n.node,n.offset,h.anchorNode,h.anchorOffset)&&p(r.node,r.offset,h.focusNode,h.focusOffset)||(this.view.observer.ignore(()=>{K.android&&K.chrome&&this.dom.contains(h.focusNode)&&function(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let t=c(this.view.root);if(t){if(o.empty){if(K.gecko){var e,i;let s=(e=n.node,i=n.offset,1!=e.nodeType?0:(i&&"false"==e.childNodes[i-1].contentEditable?1:0)|(io.head&&([n,r]=[r,n]),d.setEnd(r.node,r.offset),d.setStart(n.node,n.offset),t.removeAllRanges(),t.addRange(d)}}}),this.view.observer.setSelectionRange(n,r)),this.impreciseAnchor=n.precise?null:new A(h.anchorNode,h.anchorOffset),this.impreciseHead=r.precise?null:new A(h.focusNode,h.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=c(t.root),{anchorNode:s,anchorOffset:o}=t.observer.selectionRange;if(!i||!e.empty||!e.assoc||!i.modify)return;let n=td.find(this,e.head);if(!n)return;let r=n.posAtStart;if(e.head==r||e.head==r+n.length)return;let l=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!l||!h||l.bottom>h.top)return;let a=this.domAtPos(e.head+e.assoc);i.collapse(a.node,a.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let d=t.observer.selectionRange;t.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=e.from&&i.collapse(s,o)}mayControlSelection(){let t=this.view.root.activeElement;return t==this.dom||u(this.dom,this.view.observer.selectionRange)&&!(t&&this.dom.contains(t))}nearest(t){for(let e=t;e;){let i=T.get(e);if(i&&i.rootView==this)return i;e=e.parentNode}return null}posFromDOM(t,e){let i=this.nearest(t);if(!i)throw RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}domAtPos(t){let{i:e,off:i}=this.childCursor().findPos(t,-1);for(;en||t==n&&o.type!=to.WidgetBefore&&o.type!=to.WidgetAfter&&(!s||2==e||this.children[s-1].breakAfter||this.children[s-1].type==to.WidgetBefore&&e>-2))return o.coordsAt(t-n,e);i=n}}measureVisibleLineHeights(t){let e=[],{from:i,to:s}=t,o=this.view.contentDOM.clientWidth,n=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,l=this.view.textDirection==tF.LTR;for(let h=0,a=0;as)break;if(h>=i){let u=c.dom.getBoundingClientRect();if(e.push(u.height),n){let p=c.dom.lastChild,m=p?f(p):[];if(m.length){let g=m[m.length-1],v=l?g.right-u.left:u.right-g.left;v>r&&(r=v,this.minWidth=o,this.minWidthFrom=h,this.minWidthTo=d)}}}h=d+c.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return"rtl"==getComputedStyle(this.children[e].dom).direction?tF.RTL:tF.LTR}measureTextSize(){for(let t of this.children)if(t instanceof td){let e=t.measureTextSize();if(e)return e}let i=document.createElement("div"),s,o;return i.className="cm-line",i.style.width="99999px",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(i);let t=f(i.firstChild)[0];s=i.getBoundingClientRect().height,o=t?t.width/27:7,i.remove()}),{lineHeight:s,charWidth:o}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new R(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,s=0;;s++){let o=s==e.viewports.length?null:e.viewports[s],n=o?o.from-1:this.length;if(n>i){let r=e.lineBlockAt(n).bottom-e.lineBlockAt(i).top;t.push(tn.replace({widget:new t5(r),block:!0,inclusive:!0,isBlockGap:!0}).range(i,n))}if(!o)break;i=o.to+1}return tn.set(t)}updateDeco(){let t=this.view.state.facet(tV).map((t,e)=>(this.dynamicDecorationMap[e]="function"==typeof t)?t(this.view):t);for(let e=t.length;ee.anchor?-1:1),s;if(!i)return;!e.empty&&(s=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let o=0,n=0,r=0,l=0;for(let h of this.view.state.facet(tN).map(t=>t(this.view)))if(h){let{left:a,right:c,top:d,bottom:u}=h;null!=a&&(o=Math.max(o,a)),null!=c&&(n=Math.max(n,c)),null!=d&&(r=Math.max(r,d)),null!=u&&(l=Math.max(l,u))}let f={left:i.left-o,top:i.top-r,right:i.right+n,bottom:i.bottom+l};!function(t,e,i,s,o,n,r,l){let h=t.ownerDocument,a=h.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let d,u=c==h.body;if(u)d={left:0,right:a.innerWidth,top:0,bottom:a.innerHeight};else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let f=c.getBoundingClientRect();d={left:f.left,right:f.left+c.clientWidth,top:f.top,bottom:f.top+c.clientHeight}}let p=0,m=0;if("nearest"==o)e.top0&&e.bottom>d.bottom+m&&(m=e.bottom-d.bottom+m+r)):e.bottom>d.bottom&&(m=e.bottom-d.bottom+r,i<0&&e.top-m0&&e.right>d.right+p&&(p=e.right-d.right+p+n)):e.right>d.right&&(p=e.right-d.right+n,i<0&&e.leftMath.abs(w-p)&&(s="nearest"),b&&1>Math.abs(b-m)&&(o="nearest")}}if(u)break;c=c.assignedSlot||c.parentNode}else if(11==c.nodeType)c=c.host;else break}(this.view.scrollDOM,f,e.head0&&i<=0)e=v(t=t.childNodes[e-1]);else{if(1!=t.nodeType||!(e=0))return null;t=t.childNodes[e],e=0}}}class et{constructor(){this.changes=[]}compareRange(t,e){tc(t,e,this.changes)}comparePoint(t,e){tc(t,e,this.changes)}}function ee(t,e){return t.tope.top+1}function ei(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function eo(t,e,i){let s=t.nodeValue.length,o=-1,n=1e9,r=0;for(let l=0;li?c.top-i:i-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&d=(c.left+c.right)/2,f=u;if((K.chrome||K.gecko)&&M(t,l).getBoundingClientRect().left==c.right&&(f=!u),d<=0)return{node:t,offset:l+(f?1:0)};o=l+(f?1:0),n=d}}}return{node:t,offset:o>-1?o:r>0?t.nodeValue.length:0}}function en(t,{x:e,y:i},s,o=-1){var n;let r=t.contentDOM.getBoundingClientRect(),l=r.top+t.viewState.paddingTop,h,{docHeight:a}=t.viewState,c=i-l;if(c<0)return 0;if(c>a)return t.state.doc.length;for(let d=t.defaultLineHeight/2,u=!1;(h=t.elementAtHeight(c)).type!=to.Text;)for(;!((c=o>0?h.bottom+d:h.top-d)>=0)||!(c<=a);){if(u)return s?null:0;u=!0,o=-o}i=l+c;let p=h.from;if(pt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:s?null:er(t,r,h,e,i);let m=t.dom.ownerDocument,g=t.root.elementFromPoint?t.root:m,v=g.elementFromPoint(e,i);v&&!t.contentDOM.contains(v)&&(v=null),!v&&(e=Math.max(r.left+1,Math.min(r.right-1,e)),(v=g.elementFromPoint(e,i))&&!t.contentDOM.contains(v)&&(v=null));let w,b=-1;if(v&&(null===(n=t.docView.nearest(v))||void 0===n?void 0:n.isEditable)!=!1){if(m.caretPositionFromPoint){let y=m.caretPositionFromPoint(e,i);y&&({offsetNode:w,offset:b}=y)}else if(m.caretRangeFromPoint){let x=m.caretRangeFromPoint(e,i);x&&({startContainer:w,startOffset:b}=x,(!t.contentDOM.contains(w)||K.safari&&function(t,e,i){let s;if(3!=t.nodeType||e!=(s=t.nodeValue.length))return!1;for(let o=t.nextSibling;o;o=o.nextSibling)if(1!=o.nodeType||"BR"!=o.nodeName)return!1;return M(t,s-1,s).getBoundingClientRect().left>i}(w,b,e)||K.chrome&&function(t,e,i){if(0!=e)return!1;for(let s=t;;){let o=s.parentNode;if(!o||1!=o.nodeType||o.firstChild!=s)return!1;if(o.classList.contains("cm-line"))break;s=o}return i-(1==t.nodeType?t.getBoundingClientRect():M(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect()).left>5}(w,b,e))&&(w=void 0))}}if(!w||!t.docView.dom.contains(w)){let S=td.find(t.docView,p);if(!S)return c>h.top+h.height/2?h.to:h.from;({node:w,offset:b}=function t(e,i,s){let o,n,r,l,h,a,c,d,u=!1;for(let p=e.firstChild;p;p=p.nextSibling){let m=f(p);for(let g=0;gi?v.left-i:Math.max(0,i-v.right),x=(w=b).top>s?w.top-s:Math.max(0,s-w.bottom);if(0==y&&0==x)return 3==p.nodeType?eo(p,i,s):t(p,i,s);(!h||d>x||d==x&&c>y)&&(h=p,a=b,c=y,d=x,u=!y||(y>0?g0)),0==y?s>b.bottom&&(!r||r.bottomb.top)&&(n=p,l=b):r&&ee(r,b)?r=es(r,b.bottom):l&&ee(l,b)&&(l=ei(l,b.top))}}if(r&&r.bottom>=s?(h=o,a=r):l&&l.top<=s&&(h=n,a=l),!h)return{node:e,offset:0};let S=Math.max(a.left,Math.min(a.right,i));if(3==h.nodeType)return eo(h,S,s);if(u&&"false"!=h.contentEditable)return t(h,S,s);let M=Array.prototype.indexOf.call(e.childNodes,h)+(i>=(a.left+a.right)/2?1:0);return{node:e,offset:M}}(S.dom,e,i))}return t.docView.posFromDOM(w,b)}function er(t,e,i,s,o){let n=Math.round((s-e.left)*t.defaultCharacterWidth);t.lineWrapping&&i.height>1.5*t.defaultLineHeight&&(n+=Math.floor((o-i.top)/t.defaultLineHeight)*t.viewState.heightOracle.lineLength);let r=t.state.sliceDoc(i.from,i.to);return i.from+(0,l.Gz)(r,n,t.state.tabSize)}function el(t,e,i,s){let o=t.state.doc.lineAt(e.head),n=t.bidiSpans(o),r=t.textDirectionAt(o.from);for(let h=e,a=null;;){let c=function(t,e,i,s,o){var n;let r=s.head-t.from,h=-1;if(0==r){if(!o||!t.length)return null;e[0].level!=i&&(r=e[0].side(!1,i),h=0)}else if(r==t.length){if(o)return null;let a=e[e.length-1];a.level!=i&&(r=a.side(!0,i),h=e.length-1)}h<0&&(h=tZ.find(e,r,null!==(n=s.bidiLevel)&&void 0!==n?n:-1,s.assoc));let c=e[h];r==c.side(o,i)&&(r=(c=e[h+=o?1:-1]).side(!o,i));let d=o==(c.dir==i),u=(0,l.cp)(t.text,r,d);if(t1=t.text.slice(Math.min(r,u),Math.max(r,u)),u!=c.side(o,i))return l.jT.cursor(u+t.from,d?-1:1,c.level);let f=h==(o?e.length-1:0)?null:e[h+(o?1:-1)];return f||c.level==i?f&&f.levele(t));for(;;){let o=!1;for(let n of s)n.between(i.from-1,i.from+1,(t,s,n)=>{i.from>t&&i.fromi.from?l.jT.cursor(t,1):l.jT.cursor(s,-1),o=!0)});if(!o)return i}}class ea{constructor(t){for(let e in this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.mouseSelection=null,em){let i=em[e];t.contentDOM.addEventListener(e,s=>{!(!ep(t,s)||this.ignoreDuringComposition(s))&&("keydown"==e&&this.keydown(t,s)||(this.mustFlushObserver(s)&&t.observer.forceFlush(),this.runCustomHandlers(e,t,s)?s.preventDefault():i(t,s)))},eg[e]),this.registeredEvents.push(e)}K.chrome&&102==K.chrome_version&&t.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?t.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,t.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=t.hasFocus,K.safari&&t.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}ensureHandlers(t,e){var i;let s;for(let o of(this.customHandlers=[],e))if(s=null===(i=o.update(t).spec)||void 0===i?void 0:i.domEventHandlers)for(let n in this.customHandlers.push({plugin:o.value,handlers:s}),s)0>this.registeredEvents.indexOf(n)&&"scroll"!=n&&(this.registeredEvents.push(n),t.contentDOM.addEventListener(n,e=>{ep(t,e)&&this.runCustomHandlers(n,t,e)&&e.preventDefault()}))}runCustomHandlers(t,e,i){for(let s of this.customHandlers){let o=s.handlers[t];if(o)try{if(o.call(s.plugin,i,e)||i.defaultPrevented)return!0}catch(n){tA(e.state,n)}}return!1}runScrollHandlers(t,e){for(let i of(this.lastScrollTop=t.scrollDOM.scrollTop,this.lastScrollLeft=t.scrollDOM.scrollLeft,this.customHandlers)){let s=i.handlers.scroll;if(s)try{s.call(i.plugin,e,t)}catch(o){tA(t.state,o)}}}keydown(t,e){let i;return this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),!!(9==e.keyCode&&Date.now()t.keyCode==e.keyCode))&&!e.ctrlKey||ed.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey))&&(this.pendingIOSKey=i||e,setTimeout(()=>this.flushIOSKey(t),250),!0))}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,k(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(K.safari&&!K.ios&&Date.now()-this.compositionEndedAt<100)&&(this.compositionEndedAt=0,!0))}mustFlushObserver(t){return"keydown"==t.type&&229!=t.keyCode}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}let ec=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],ed="dthko",eu=[16,17,18,20,91,92,224,225];class ef{constructor(t,e,i,s){let o,n;this.view=t,this.style=i,this.mustSelect=s,this.lastEvent=e;let r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(l.yy.allowMultipleSelections)&&((o=t.state.facet(tg)).length?o[0](e):K.mac?e.metaKey:e.ctrlKey),this.dragMove=(n=t.state.facet(tv)).length?n[0](e):K.mac?!e.altKey:!e.ctrlKey,this.dragging=!!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let s=c(t.root);if(!s||0==s.rangeCount)return!0;let o=s.getRangeAt(0).getClientRects();for(let n=0;n=e.clientX&&r.top<=e.clientY&&r.bottom>=e.clientY)return!0}return!1}(t,e)&&1==eD(e)&&null,!1===this.dragging&&(e.preventDefault(),this.select(e))}move(t){if(0==t.buttons)return this.destroy();!1===this.dragging&&this.select(this.lastEvent=t)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}select(t){let e=this.style.get(t,this.extend,this.multiple);(this.mustSelect||!e.eq(this.view.state.selection)||e.main.assoc!=this.view.state.selection.main.assoc)&&this.view.dispatch({selection:e,userEvent:"select.pointer",scrollIntoView:!0}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function ep(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i=e.target,s;i!=t.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(s=T.get(i))&&s.ignoreEvent(e))return!1;return!0}let em=Object.create(null),eg=Object.create(null),ev=K.ie&&K.ie_version<15||K.ios&&K.webkit_version<604;function ew(t,e){let{state:i}=t,s,o=1,n=i.toText(e),r=n.lines==i.selection.ranges.length;if(null!=eO&&i.selection.ranges.every(t=>t.empty)&&eO==n.toString()){let h=-1;s=i.changeByRange(t=>{let s=i.doc.lineAt(t.from);if(s.from==h)return{range:t};h=s.from;let a=i.toText((r?n.line(o++).text:e)+i.lineBreak);return{changes:{from:s.from,insert:a},range:l.jT.cursor(t.from+a.length)}})}else s=r?i.changeByRange(t=>{let e=n.line(o++);return{changes:{from:t.from,to:t.to,insert:e.text},range:l.jT.cursor(t.from+e.length)}}):i.replaceSelection(n);t.dispatch(s,{userEvent:"input.paste",scrollIntoView:!0})}function eb(t,e,i,s){if(1==s)return l.jT.cursor(e,i);if(2==s)return function(t,e,i=1){let s=t.charCategorizer(e),o=t.doc.lineAt(e),n=e-o.from;if(0==o.length)return l.jT.cursor(e);0==n?i=1:n==o.length&&(i=-1);let r=n,h=n;i<0?r=(0,l.cp)(o.text,n,!1):h=(0,l.cp)(o.text,n);let a=s(o.text.slice(r,h));for(;r>0;){let c=(0,l.cp)(o.text,r,!1);if(s(o.text.slice(c,r))!=a)break;r=c}for(;h{t.inputState.setSelectionOrigin("select"),27==e.keyCode?t.inputState.lastEscPress=Date.now():0>eu.indexOf(e.keyCode)&&(t.inputState.lastEscPress=0)},em.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},em.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},eg.touchstart=eg.touchmove={passive:!0},em.mousedown=(t,e)=>{let i,s,o,n,r;if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let h=null;for(let a of t.state.facet(tw))if(h=a(t,e))break;if(h||0!=e.button||(i=eS(t,e),s=eD(e),o=t.state.selection,n=i,r=e,h={update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),o=o.map(t.changes),r=null)},get(e,h,a){let c;r&&e.clientX==r.clientX&&e.clientY==r.clientY?c=n:(c=n=eS(t,e),r=e);let d=eb(t,c.pos,c.bias,s);if(i.pos!=c.pos&&!h){let u=eb(t,i.pos,i.bias,s),f=Math.min(u.from,d.from),p=Math.max(u.to,d.to);d=f1&&o.ranges.some(t=>t.eq(d))?function(t,e){for(let i=0;;i++)if(t.ranges[i].eq(e))return l.jT.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}(o,d):a?o.addRange(d):l.jT.create([d])}}),h){let c=t.root.activeElement!=t.contentDOM;c&&t.observer.ignore(()=>S(t.contentDOM)),t.inputState.startMouseSelection(new ef(t,e,h,c))}};let ey=(t,e)=>t>=e.top&&t<=e.bottom,ex=(t,e,i)=>ey(e,i)&&t>=i.left&&t<=i.right;function eS(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:function(t,e,i,s){let o=td.find(t.docView,e);if(!o)return 1;let n=e-o.posAtStart;if(0==n)return 1;if(n==o.length)return -1;let r=o.coordsAt(n,-1);if(r&&ex(i,s,r))return -1;let l=o.coordsAt(n,1);return l&&ex(i,s,l)?1:r&&ey(s,r)?-1:1}(t,i,e.clientX,e.clientY)}}let eM=K.ie&&K.ie_version<=11,ek=null,eC=0,eA=0;function eD(t){if(!eM)return t.detail;let e=ek,i=eA;return ek=t,eA=Date.now(),eC=!e||i>Date.now()-400&&2>Math.abs(e.clientX-t.clientX)&&2>Math.abs(e.clientY-t.clientY)?(eC+1)%3:1}function eT(t,e,i,s){if(!i)return;let o=t.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:n}=t.inputState,r=s&&n&&n.dragging&&n.dragMove?{from:n.dragging.from,to:n.dragging.to}:null,l={from:o,insert:i},h=t.state.changes(r?[r,l]:l);t.focus(),t.dispatch({changes:h,selection:{anchor:h.mapPos(o,-1),head:h.mapPos(o,1)},userEvent:r?"move.drop":"input.drop"})}em.dragstart=(t,e)=>{let{selection:{main:i}}=t.state,{mouseSelection:s}=t.inputState;s&&(s.dragging=i),e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove")},em.drop=(t,e)=>{if(!e.dataTransfer)return;if(t.state.readOnly)return e.preventDefault();let i=e.dataTransfer.files;if(i&&i.length){e.preventDefault();let s=Array(i.length),o=0,n=()=>{++o==i.length&&eT(t,e,s.filter(t=>null!=t).join(t.state.lineBreak),!1)};for(let r=0;r{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(s[r]=l.result),n()},l.readAsText(i[r])}}else eT(t,e,e.dataTransfer.getData("Text"),!0)},em.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=ev?null:e.clipboardData;i?(ew(t,i.getData("text/plain")),e.preventDefault()):function(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(()=>{t.focus(),i.remove(),ew(t,i.value)},50)}(t)};let eO=null;function eR(t){setTimeout(()=>{t.hasFocus!=t.inputState.notifiedFocused&&t.update([])},10)}em.copy=em.cut=(t,e)=>{let{text:i,ranges:s,linewise:o}=function(t){let e=[],i=[],s=!1;for(let o of t.selection.ranges)o.empty||(e.push(t.sliceDoc(o.from,o.to)),i.push(o));if(!e.length){let n=-1;for(let{from:r}of t.selection.ranges){let l=t.doc.lineAt(r);l.number>n&&(e.push(l.text),i.push({from:l.from,to:Math.min(t.doc.length,l.to+1)})),n=l.number}s=!0}return{text:e.join(t.lineBreak),ranges:i,linewise:s}}(t.state);if(!i&&!o)return;eO=o?i:null;let n=ev?null:e.clipboardData;n?(e.preventDefault(),n.clearData(),n.setData("text/plain",i)):function(t,e){let i=t.dom.parentNode;if(!i)return;let s=i.appendChild(document.createElement("textarea"));s.style.cssText="position: fixed; left: -10000px; top: 10px",s.value=e,s.focus(),s.selectionEnd=e.length,s.selectionStart=0,setTimeout(()=>{s.remove(),t.focus()},50)}(t,i),"cut"!=e.type||t.state.readOnly||t.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"})},em.focus=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),eR(t)},em.blur=t=>{t.observer.clearSelectionRange(),eR(t)},em.compositionstart=em.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},em.compositionend=t=>{t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionFirstChange=null,K.chrome&&K.android&&t.observer.flushSoon(),setTimeout(()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])},50)},em.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},em.beforeinput=(t,e)=>{var i;let s;if(K.chrome&&K.android&&(s=ec.find(t=>t.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),"Backspace"==s.key||"Delete"==s.key)){let o=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout(()=>{var e;((null===(e=window.visualViewport)||void 0===e?void 0:e.height)||0)>o+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}};let eE=["pre-wrap","normal","pre-line","break-spaces"];class eB{constructor(t){this.lineWrapping=t,this.doc=l.xv.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength)),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return eE.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,r=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=n;if(this.lineWrapping=n,this.lineHeight=e,this.charWidth=i,this.lineLength=s,r){this.heightSamples={};for(let l=0;l0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>.001&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return eN.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,s){let o=this;for(let n=s.length-1;n>=0;n--){let{fromA:r,toA:l,fromB:h,toB:a}=s[n],c=o.lineAt(r,eH.ByPosNoHeight,e,0,0),d=c.to>=l?c:o.lineAt(l,eH.ByPosNoHeight,e,0,0);for(a+=d.to-l,l=d.to;n>0&&c.from<=s[n-1].toA;)r=s[n-1].fromA,h=s[n-1].fromB,n--,r2*o){let n=t[e-1];n.break?t.splice(--e,1,n.left,null,n.right):t.splice(--e,1,n.left,n.right),i+=1+n.break,s-=n.size}else if(o>2*s){let r=t[i];r.break?t.splice(i,1,r.left,null,r.right):t.splice(i,1,r.left,r.right),i+=2+r.break,o-=r.size}else break}else if(s=o&&n(this.blockAt(0,i,s,o))}updateHeight(t,e=0,i=!1,s){return s&&s.from<=e&&s.more&&this.setHeight(t,s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class eW extends eP{constructor(t,e){super(t,e,to.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let s=i[0];return 1==i.length&&(s instanceof eW||s instanceof ez&&4&s.flags)&&10>Math.abs(this.length-s.length)?(s instanceof ez?s=new eW(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):eN.of(i)}updateHeight(t,e=0,i=!1,s){return s&&s.from<=e&&s.more?this.setHeight(t,s.heights[s.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ez extends eN{constructor(t){super(t,0)}lines(t,e){let i=t.lineAt(e).number,s=t.lineAt(e+this.length).number;return{firstLine:i,lastLine:s,lineHeight:this.height/(s-i+1)}}blockAt(t,e,i,s){let{firstLine:o,lastLine:n,lineHeight:r}=this.lines(e,s),l=Math.max(0,Math.min(n-o,Math.floor((t-i)/r))),{from:h,length:a}=e.line(o+l);return new eV(h,a,i+r*l,r,to.Text)}lineAt(t,e,i,s,o){if(e==eH.ByHeight)return this.blockAt(t,i,s,o);if(e==eH.ByPosNoHeight){let{from:n,to:r}=i.lineAt(t);return new eV(n,r-n,0,0,to.Text)}let{firstLine:l,lineHeight:h}=this.lines(i,o),{from:a,length:c,number:d}=i.lineAt(t);return new eV(a,c,s+h*(d-l),h,to.Text)}forEachLine(t,e,i,s,o,n){let{firstLine:r,lineHeight:l}=this.lines(i,o);for(let h=Math.max(t,o),a=Math.min(o+this.length,e);h<=a;){let c=i.lineAt(h);h==t&&(s+=l*(c.number-r)),n(new eV(c.from,c.length,s,l,to.Text)),s+=l,h=c.to+1}}replace(t,e,i){let s=this.length-e;if(s>0){let o=i[i.length-1];o instanceof ez?i[i.length-1]=new ez(o.length+s):i.push(null,new ez(s-1))}if(t>0){let n=i[0];n instanceof ez?i[0]=new ez(t+n.length):i.unshift(new ez(t-1),null)}return eN.of(i)}decomposeLeft(t,e){e.push(new ez(t-1),null)}decomposeRight(t,e){e.push(null,new ez(this.length-t-1))}updateHeight(t,e=0,i=!1,s){let o=e+this.length;if(s&&s.from<=e+this.length&&s.more){let n=[],r=Math.max(e,s.from),l=-1,h=t.heightChanged;for(s.from>e&&n.push(new ez(s.from-e-1).updateHeight(t,e));r<=o&&s.more;){let a=t.doc.lineAt(r).length;n.length&&n.push(null);let c=s.heights[s.index++];-1==l?l=c:Math.abs(c-l)>=.001&&(l=-2);let d=new eW(a,c);d.outdated=!1,n.push(d),r+=a+1}r<=o&&n.push(null,new ez(o-r).updateHeight(t,r));let u=eN.of(n);return t.heightChanged=h||l<0||Math.abs(u.height-this.height)>=.001||Math.abs(l-this.lines(t.doc,e).lineHeight)>=.001,u}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class eF extends eN{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return 1&this.flags}blockAt(t,e,i,s){let o=i+this.left.height;return tr))return h;let a=e==eH.ByPosNoHeight?eH.ByPosNoHeight:eH.ByPos;return l?h.join(this.right.lineAt(r,a,i,n,r)):this.left.lineAt(r,a,i,s,o).join(h)}forEachLine(t,e,i,s,o,n){let r=s+this.left.height,l=o+this.left.length+this.break;if(this.break)t=l&&this.right.forEachLine(t,e,i,r,l,n);else{let h=this.lineAt(l,eH.ByPos,i,s,o);t=t&&h.from<=e&&n(h),e>h.to&&this.right.forEachLine(h.to+1,e,i,r,l,n)}}replace(t,e,i){let s=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-s,e-s,i));let o=[];t>0&&this.decomposeLeft(t,o);let n=o.length;for(let r of i)o.push(r);if(t>0&&eI(o,n-1),e=++i&&e.push(null),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,s=i+this.break;if(t>=s)return this.right.decomposeRight(t-s,e);t2*e.size||e.size>2*t.size?eN.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)}updateHeight(t,e=0,i=!1,s){let{left:o,right:n}=this,r=e+o.length+this.break,l=null;return(s&&s.from<=e+o.length&&s.more?l=o=o.updateHeight(t,e,i,s):o.updateHeight(t,e,i),s&&s.from<=r+n.length&&s.more?l=n=n.updateHeight(t,r,i,s):n.updateHeight(t,r,i),l)?this.balanced(o,n):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function eI(t,e){let i,s;null==t[e]&&(i=t[e-1])instanceof ez&&(s=t[e+1])instanceof ez&&t.splice(e-1,3,new ez(i.length+1+s.length))}class eq{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let i=Math.min(e,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof eW?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new eW(i-this.pos,-1)),this.writtenTo=i,e>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t=5)&&this.addLineDeco(s,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new eW(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new ez(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof eW)return t;let e=new eW(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=to.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=to.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof eW||this.isCovered?(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&"visible"!=d.overflow){let u=c.getBoundingClientRect();n=Math.max(n,u.left),r=Math.min(r,u.right),l=Math.max(l,u.top),h=a==t.parentNode?u.bottom:Math.min(h,u.bottom)}a="absolute"==d.position||"fixed"==d.position?c.offsetParent:c.parentNode}else if(11==a.nodeType)a=a.host;else break;return{left:n-i.left,right:Math.max(n,r)-i.left,top:l-(i.top+e),bottom:Math.max(l,h)-(i.top+e)}}function e$(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class eG{constructor(t,e,i){this.from=t,this.to=e,this.size=i}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i"function"!=typeof t&&"cm-lineWrapping"==t.class);this.heightOracle=new eB(e),this.stateDeco=t.facet(tV).filter(t=>"function"!=typeof t),this.heightMap=eN.empty().applyChanges(this.stateDeco,l.xv.empty,this.heightOracle.setDoc(t.doc),[new tW(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=tn.set(this.lineGaps.map(t=>t.draw(!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let s=i?e.head:e.anchor;if(!t.some(({from:t,to:e})=>s>=t&&s<=e)){let{from:o,to:n}=this.lineBlockAt(s);t.push(new eU(o,n))}}this.viewports=t.sort((t,e)=>t.from-e.from),this.scaler=this.heightMap.height<=7e6?eZ:new eJ(this.heightOracle.doc,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.state.doc,0,0,t=>{this.viewportLines.push(1==this.scaler.scale?t:e0(t,this.scaler))})}update(t,e=null){var i,s;let o;this.state=t.state;let n=this.stateDeco;this.stateDeco=this.state.facet(tV).filter(t=>"function"!=typeof t);let r=t.changedRanges,h=tW.extendWithRanges(r,(i=this.stateDeco,s=t?t.changes:l.as.empty(this.state.doc.length),o=new ej,l.Xs.compare(n,i,s,o,0),o.changes)),a=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),h),this.heightMap.height!=a&&(t.flags|=2);let c=h.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.headc.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,e));let d=!t.changes.empty||2&t.flags||c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,this.updateForViewport(),d&&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(tM)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,i=window.getComputedStyle(e),s=this.heightOracle,o=i.whiteSpace;this.defaultTextDirection="rtl"==i.direction?tF.RTL:tF.LTR;let n=this.heightOracle.mustRefreshForWrapping(o),r=n||this.mustMeasureContent||this.contentDOMHeight!=e.clientHeight;this.contentDOMHeight=e.clientHeight,this.mustMeasureContent=!1;let h=0,a=0,c=parseInt(i.paddingTop)||0,d=parseInt(i.paddingBottom)||0;(this.paddingTop!=c||this.paddingBottom!=d)&&(this.paddingTop=c,this.paddingBottom=d,h|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(r=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=8);let u=(this.printing?e$:eK)(e,this.paddingTop),f=u.top-this.pixelViewport.top,p=u.bottom-this.pixelViewport.bottom;this.pixelViewport=u;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(r=!0)),!this.inView&&!this.scrollTarget)return 0;let g=e.clientWidth;if((this.contentDOMWidth!=g||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=g,this.editorHeight=t.scrollDOM.clientHeight,h|=8),r){let v=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(v)&&(n=!0),n||s.lineWrapping&&Math.abs(g-this.contentDOMWidth)>s.charWidth){let{lineHeight:w,charWidth:b}=t.docView.measureTextSize();(n=w>0&&s.refresh(o,w,b,g/b,v))&&(t.docView.minWidth=0,h|=8)}for(let y of(f>0&&p>0?a=Math.max(f,p):f<0&&p<0&&(a=Math.min(f,p)),s.heightChanged=!1,this.viewports)){let x=y.from==this.viewport.from?v:t.docView.measureVisibleLineHeights(y);this.heightMap=(n?eN.empty().applyChanges(this.stateDeco,l.xv.empty,this.heightOracle,[new tW(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,n,new eL(y.from,x))}s.heightChanged&&(h|=2)}let S=!this.viewportIsAppropriate(this.viewport,a)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return S&&(this.viewport=this.getViewport(a,this.scrollTarget)),this.updateForViewport(),(2&h||S)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(n?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,o=this.state.doc,{visibleTop:n,visibleBottom:r}=this,l=new eU(s.lineAt(n-1e3*i,eH.ByHeight,o,0,0).from,s.lineAt(r+(1-i)*1e3,eH.ByHeight,o,0,0).to);if(e){let{head:h}=e.range;if(hl.to){let a=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=s.lineAt(h,eH.ByPos,o,0,0),d;d="center"==e.y?(c.top+c.bottom)/2-a/2:"start"==e.y||"nearest"==e.y&&h=r+Math.max(10,Math.min(i,250)))&&s>n-2e3&&o>1,n=s<<1;if(this.defaultTextDirection!=tF.LTR&&!i)return[];let r=[],h=(s,n,a,c)=>{if(n-ss&&ft.from>=a.from&&t.to<=a.to&&Math.abs(t.from-s)t.frome));if(!p){if(nt.from<=n&&t.to>=n)){let m=e.moveToLineBoundary(l.jT.cursor(n),!1,!0).head;m>s&&(n=m)}p=new eG(s,n,this.gapSize(a,s,n,c))}r.push(p)};for(let a of this.viewportLines){let c,d;if(a.lengtho&&(s.push({from:o,to:t}),n+=t-o),o=e}},20),oa.from&&h(a.from,c,a,u),dt.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];l.Xs.spans(t,this.viewport.from,this.viewport.to,{span(t,i){e.push({from:t,to:i})},point(){}},20);let i=e.length!=this.visibleRanges.length||this.visibleRanges.some((t,i)=>t.from!=e[i].from||t.to!=e[i].to);return this.visibleRanges=e,i?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||e0(this.heightMap.lineAt(t,eH.ByPos,this.state.doc,0,0),this.scaler)}lineBlockAtHeight(t){return e0(this.heightMap.lineAt(this.scaler.fromDOM(t),eH.ByHeight,this.state.doc,0,0),this.scaler)}elementAtHeight(t){return e0(this.heightMap.blockAt(this.scaler.fromDOM(t),this.state.doc,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class eU{constructor(t,e){this.from=t,this.to=e}}function eY({total:t,ranges:e},i){if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;let s=Math.floor(t*i);for(let o=0;;o++){let{from:n,to:r}=e[o],l=r-n;if(s<=l)return n+s;s-=l}}function eQ(t,e){let i=0;for(let{from:s,to:o}of t.ranges){if(e<=o){i+=e-s;break}i+=o-s}return i/t.total}let eZ={toDOM:t=>t,fromDOM:t=>t,scale:1};class eJ{constructor(t,e,i){let s=0,o=0,n=0;for(let r of(this.viewports=i.map(({from:i,to:o})=>{let n=e.lineAt(i,eH.ByPos,t,0,0).top,r=e.lineAt(o,eH.ByPos,t,0,0).bottom;return s+=r-n,{from:i,to:o,top:n,bottom:r,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(e.height-s),this.viewports))r.domTop=n+(r.top-o)*this.scale,n=r.domBottom=r.domTop+(r.bottom-r.top),o=r.bottom}toDOM(t){for(let e=0,i=0,s=0;;e++){let o=ee0(t,e)):t.type)}let e1=l.r$.define({combine:t=>t.join(" ")}),e2=l.r$.define({combine:t=>t.indexOf(!0)>-1}),e8=h.V.newName(),e3=h.V.newName(),e9=h.V.newName(),e5={"&light":"."+e3,"&dark":"."+e9};function e4(t,e,i){return new h.V(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,e=>{if("&"==e)return t;if(!i||!i[e])throw RangeError(`Unsupported selector: ${e}`);return i[e]}):t+" "+e})}let e6=e4("."+e8,{"&.cm-editor":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused .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-focused .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',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"}},e5);class e7{constructor(t,e,i,s){this.typeOver=s,this.bounds=null,this.text="";let{impreciseHead:o,impreciseAnchor:n}=t.docView;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){let r=o||n?[]:function(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:s,focusNode:o,focusOffset:n}=t.observer.selectionRange;return i&&(e.push(new t3(i,s)),(o!=i||n!=s)&&e.push(new t3(o,n))),e}(t),h=new t2(r,t.state);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=function(t,e){if(0==t.length)return null;let i=t[0].pos,s=2==t.length?t[1].pos:i;return i>-1&&s>-1?l.jT.single(i+e,s+e):null}(r,this.bounds.from)}else{let a=t.observer.selectionRange,c=o&&o.node==a.focusNode&&o.offset==a.focusOffset||!d(t.contentDOM,a.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(a.focusNode,a.focusOffset),u=n&&n.node==a.anchorNode&&n.offset==a.anchorOffset||!d(t.contentDOM,a.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(a.anchorNode,a.anchorOffset);this.newSel=l.jT.single(u,c)}}}function it(t,e){let i;let{newSel:s}=e,o=t.state.selection.main;if(e.bounds){let{from:n,to:r}=e.bounds,h=o.from,a=null;(8===t.inputState.lastKeyCode&&t.inputState.lastKeyTime>Date.now()-100||K.android&&e.text.length0&&l>0&&t.charCodeAt(r-1)==e.charCodeAt(l-1);)r--,l--;if("end"==s){let h=Math.max(0,n-Math.min(r,l));i-=r+h-n}if(r=r?n-i:0;n-=a,l=n+(l-r),r=n}else if(l=l?n-i:0;n-=c,r=n+(r-l),l=n}return{from:n,toA:r,toB:l}}(t.state.doc.sliceString(n,r,"￿"),e.text,h-n,a);c&&(K.chrome&&13==t.inputState.lastKeyCode&&c.toB==c.from+2&&"￿￿"==e.text.slice(c.from,c.toB)&&c.toB--,i={from:n+c.from,to:n+c.toA,insert:l.xv.of(e.text.slice(c.from,c.toB).split("￿"))})}else s&&(!t.hasFocus||!t.state.facet(tD)||s.main.eq(o))&&(s=null);if(!i&&!s)return!1;if(!i&&e.typeOver&&!o.empty&&s&&s.main.empty?i={from:o.from,to:o.to,insert:t.state.doc.slice(o.from,o.to)}:i&&i.from>=o.from&&i.to<=o.to&&(i.from!=o.from||i.to!=o.to)&&o.to-o.from-(i.to-i.from)<=4?i={from:o.from,to:o.to,insert:t.state.doc.slice(o.from,i.from).append(i.insert).append(t.state.doc.slice(i.to,o.to))}:(K.mac||K.android)&&i&&i.from==i.to&&i.from==o.head-1&&/^\. ?$/.test(i.insert.toString())?(s&&2==i.insert.length&&(s=l.jT.single(s.main.anchor-1,s.main.head-1)),i={from:o.from,to:o.to,insert:l.xv.of([" "])}):K.chrome&&i&&i.from==i.to&&i.from==o.head&&"\n "==i.insert.toString()&&t.lineWrapping&&(s&&(s=l.jT.single(s.main.anchor-1,s.main.head-1)),i={from:o.from,to:o.to,insert:l.xv.of([" "])}),i){let d,u=t.state;if(K.ios&&t.inputState.flushIOSKey(t)||K.android&&(i.from==o.from&&i.to==o.to&&1==i.insert.length&&2==i.insert.lines&&k(t.contentDOM,"Enter",13)||i.from==o.from-1&&i.to==o.to&&0==i.insert.length&&k(t.contentDOM,"Backspace",8)||i.from==o.from&&i.to==o.to+1&&0==i.insert.length&&k(t.contentDOM,"Delete",46)))return!0;let f=i.insert.toString();if(t.state.facet(tx).some(e=>e(t,i.from,i.to,f)))return!0;if(t.inputState.composing>=0&&t.inputState.composing++,i.from>=o.from&&i.to<=o.to&&i.to-i.from>=(o.to-o.from)/3&&(!s||s.main.empty&&s.main.from==i.from+i.insert.length)&&t.inputState.composing<0){let p=o.fromi.to?u.sliceDoc(i.to,o.to):"";d=u.replaceSelection(t.state.toText(p+i.insert.sliceString(0,void 0,t.state.lineBreak)+m))}else{let g=u.changes(i),v=s&&!u.selection.main.eq(s.main)&&s.main.to<=g.newLength?s.main:void 0;if(u.selection.ranges.length>1&&t.inputState.composing>=0&&i.to<=o.to&&i.to>=o.to-10){let w=t.state.sliceDoc(i.from,i.to),b=t4(t)||t.state.doc.lineAt(o.head),y=o.to-i.to,x=o.to-o.from;d=u.changeByRange(e=>{if(e.from==o.from&&e.to==o.to)return{changes:g,range:v||e.map(g)};let s=e.to-y,n=s-w.length;if(e.to-e.from!=x||t.state.sliceDoc(n,s)!=w||b&&e.to>=b.from&&e.from<=b.to)return{range:e};let r=u.changes({from:n,to:s,insert:i.insert}),h=e.to-o.to;return{changes:r,range:v?l.jT.range(Math.max(0,v.anchor+h),Math.max(0,v.head+h)):e.map(r)}})}else d={changes:g,selection:v&&u.selection.replaceRange(v)}}let S="input.type";return t.composing&&(S+=".compose",t.inputState.compositionFirstChange&&(S+=".start",t.inputState.compositionFirstChange=!1)),t.dispatch(d,{scrollIntoView:!0,userEvent:S}),!0}if(!s||s.main.eq(o))return!1;{let M=!1,C="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(M=!0),C=t.inputState.lastSelectionOrigin),t.dispatch({selection:s,scrollIntoView:M,userEvent:C}),!0}}let ie={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ii=K.ie&&K.ie_version<=11;class is{constructor(t){this.view=t,this.active=!1,this.selectionRange=new y,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let i of e)this.queue.push(i);(K.ie&&K.ie_version<=11||K.ios&&t.composing)&&e.some(t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length)?this.flushSoon():this.flush()}),ii&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate)this.view.requestMeasure()),this.resizeContent.observe(t.contentDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runScrollHandlers(this.view,t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,i)=>e!=t[i]))){for(let e of(this.gapIntersection.disconnect(),t))this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(tD)?i.root.activeElement!=this.dom:!u(i.dom,s))return;let o=s.anchorNode&&i.docView.nearest(s.anchorNode);if(o&&o.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(K.ie&&K.ie_version<=11||K.android&&K.chrome)&&!i.state.selection.main.empty&&s.focusNode&&p(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=K.safari&&11==t.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t){let e=null;function i(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",i,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",i,!0),!e)return null;let s=e.startContainer,o=e.startOffset,n=e.endContainer,r=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return p(l.node,l.offset,n,r)&&([s,o,n,r]=[n,r,s,o]),{anchorNode:s,anchorOffset:o,focusNode:n,focusOffset:r}}(this.view)||c(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=u(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&k(this.dom,t.key,t.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}processRecords(){let t=this.queue;for(let e of this.observer.takeRecords())t.push(e);t.length&&(this.queue=[]);let i=-1,s=-1,o=!1;for(let n of t){let r=this.readMutation(n);r&&(r.typeOver&&(o=!0),-1==i?{from:i,to:s}=r:(i=Math.min(r.from,i),s=Math.max(r.to,s)))}return{from:i,to:s,typeOver:o}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),s=this.selectionChanged&&u(this.dom,this.selectionRange);return t<0&&!s?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new e7(this.view,t,e,i))}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return!1;let i=this.view.state,s=it(this.view,e);return this.view.state==i&&this.view.update([]),s}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.dirty|=4),"childList"==t.type){let i=io(e,t.previousSibling||t.target.previousSibling,-1),s=io(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:s?e.posBefore(s):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var t,e,i,s;for(let o of(this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect(),null===(s=this.resizeContent)||void 0===s||s.disconnect(),this.scrollTargets))o.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function io(t,e,i){for(;e;){let s=T.get(e);if(s&&s.parent==t)return s;let o=e.parentNode;e=o!=t.dom?o:i>0?e.nextSibling:e.previousSibling}return null}class ir{constructor(t={}){for(let e of(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.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=t.dispatch||(t=>this.update([t])),this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(t.parent)||document,this.viewState=new e_(t.state||l.yy.create(t)),this.plugins=this.state.facet(tO).map(t=>new tE(t)),this.plugins))e.update(this);this.observer=new is(this),this.inputState=new ea(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new t9(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof l.YW?t[0]:this.state.update(...t))}update(t){if(0!=this.updateState)throw Error("Calls to EditorView.update are not allowed while an update is in progress");let e=!1,i=!1,s,o=this.state;for(let n of t){if(n.startState!=o)throw RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=n.state}if(this.destroyed){this.viewState.state=o;return}let r=this.observer.delayedAndroidKey,h=null;if(r?(this.observer.clearDelayedAndroidKey(),((h=this.observer.readChange())&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(h=null)):this.observer.clear(),o.facet(l.yy.phrases)!=this.state.facet(l.yy.phrases))return this.setState(o);s=tz.create(this,o,t);let a=this.viewState.scrollTarget;try{for(let c of(this.updateState=2,t)){if(a&&(a=a.map(c.changes)),c.scrollIntoView){let{main:d}=c.state.selection;a=new tk(d.empty?d:l.jT.cursor(d.head,d.head>d.anchor?-1:1))}for(let u of c.effects)u.is(tC)&&(a=u.value)}this.viewState.update(s,a),this.bidiCache=ia.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),e=this.docView.update(s),this.state.facet(tP)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(t=>t.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(e1)!=s.state.facet(e1)&&(this.viewState.mustMeasureContent=!0),(e||i||a||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!s.empty)for(let f of this.state.facet(ty))f(s);h&&!it(this,h)&&r.force&&k(this.contentDOM,r.key,r.keyCode)}setState(t){if(0!=this.updateState)throw Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let e=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);for(let s of(this.viewState=new e_(t),this.plugins=t.facet(tO).map(t=>new tE(t)),this.pluginMap.clear(),this.plugins))s.update(this);this.docView=new t9(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(tO),i=t.state.facet(tO);if(e!=i){let s=[];for(let o of i){let n=e.indexOf(o);if(n<0)s.push(new tE(o));else{let r=this.plugins[n];r.mustUpdate=t,s.push(r)}}for(let l of this.plugins)l.mustUpdate!=t&&l.destroy(this);this.plugins=s,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let h of this.plugins)h.mustUpdate=t;for(let a=0;a-1&&cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:s,clientHeight:o}=this.scrollDOM,n=s>i-o-4?i:s;try{for(let r=0;;r++){this.updateState=1;let l=this.viewport,h=this.viewState.lineBlockAtHeight(n),a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(r>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];4&a||([this.measureRequests,c]=[c,this.measureRequests]);let d=c.map(t=>{try{return t.read(this)}catch(e){return tA(this.state,e),ih}}),u=tz.create(this,this.state,[]),f=!1,p=!1;u.flags|=a,e?e.flags|=a:e=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),f=this.docView.update(u));for(let m=0;m1||w<-1)&&(this.scrollDOM.scrollTop+=w,p=!0)}}if(f&&this.docView.updateSelection(!0),this.viewport.from==l.from&&this.viewport.to==l.to&&!p&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let b of this.state.facet(ty))b(e)}get themeClasses(){return e8+" "+(this.state.facet(e2)?e9:e3)+" "+this.state.facet(e1)}updateAttrs(){let t=ic(this,tB,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(tD)?"true":"false",class:"cm-content",style:`${K.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),ic(this,tL,e);let i=this.observer.ignore(()=>{let i=ti(this.contentDOM,this.contentAttrs,e),s=ti(this.dom,this.editorAttrs,t);return i||s});return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let s of i.effects)s.is(ir.announce)&&(e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=s.value)}mountStyles(){this.styleModules=this.state.facet(tP),h.V.mount(this.root,this.styleModules.concat(e6).reverse())}readMeasured(){if(2==this.updateState)throw Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(null!=t.key){for(let e=0;ee.spec==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return eh(this,t,el(this,t,e,i))}moveByGroup(t,e){return eh(this,t,el(this,t,e,e=>{var i;let s,o;return i=t.head,o=(s=this.state.charCategorizer(i))(e),t=>{let e=s(t);return o==l.D0.Space&&(o=e),o==e}}))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,s){let o=t.state.doc.lineAt(e.head),n=s&&t.lineWrapping?t.coordsAtPos(e.assoc<0&&e.head>o.from?e.head-1:e.head):null;if(n){let r=t.dom.getBoundingClientRect(),h=t.textDirectionAt(o.from),a=t.posAtCoords({x:i==(h==tF.LTR)?r.right-1:r.left+1,y:(n.top+n.bottom)/2});if(null!=a)return l.jT.cursor(a,i?-1:1)}let c=td.find(t.docView,e.head),d=c?i?c.posAtEnd:c.posAtStart:i?o.to:o.from;return l.jT.cursor(d,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return eh(this,t,function(t,e,i,s){let o=e.head,n=i?1:-1;if(o==(i?t.state.doc.length:0))return l.jT.cursor(o,e.assoc);let r=e.goalColumn,h,a=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(o),d=t.documentTop;if(c)null==r&&(r=c.left-a.left),h=n<0?c.top:c.bottom;else{let u=t.viewState.lineBlockAt(o);null==r&&(r=Math.min(a.right-a.left,t.defaultCharacterWidth*(o-u.from))),h=(n<0?u.top:u.bottom)+d}let f=a.left+r,p=null!=s?s:t.defaultLineHeight>>1;for(let m=0;;m+=10){let g=h+(p+m)*n,v=en(t,{x:f,y:g},!1,n);if(ga.bottom||(n<0?vo))return l.jT.cursor(v,e.assoc,void 0,r)}}(this,t,e,i))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),en(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(t),o=this.bidiSpans(s);return b(i,o[tZ.find(o,t-s.from,-1,e)].dir==tF.LTR==e>0)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(tS)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>il)return t0(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let s=function(t,e){let i=t.length,s=e==tI?1:2,o=e==tI?2:1;if(!t||1==s&&!tQ.test(t))return t0(i);for(let n=0,r=s,l=s;n=0;M-=3)if(tX[M+1]==-x){let k=tX[M+2],C=2&k?s:4&k?1&k?o:s:0;C&&(tJ[v]=tJ[tX[M]]=C),w=M;break}}else if(189==tX.length)break;else tX[w++]=v,tX[w++]=y,tX[w++]=b}else if(2==(S=tJ[v])||1==S){let A=S==s;b=A?0:1;for(let D=w-3;D>=0;D-=3){let T=tX[D+2];if(2&T)break;if(A)tX[D+2]|=2;else{if(4&T)break;tX[D+2]|=4}}}for(let O=0;ON;){let z=W,F=2!=tJ[--W];for(;W>N&&F==(2!=tJ[W-1]);)W--;V.push(new tZ(W,z,F?2:1))}else V.push(new tZ(N,H,0))}else for(let I=0;IDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{S(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return tC.of(new tk("number"==typeof t?l.jT.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return tR.define(()=>({}),{eventHandlers:t})}static theme(t,e){let i=h.V.newName(),s=[e1.of(i),tP.of(e4(`.${i}`,t))];return e&&e.dark&&s.push(e2.of(!0)),s}static baseTheme(t){return l.Wl.lowest(tP.of(e4("."+e8,t,e5)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),s=i&&T.get(i)||T.get(t);return(null===(e=null==s?void 0:s.rootView)||void 0===e?void 0:e.view)||null}}ir.styleModule=tP,ir.inputHandler=tx,ir.perLineTextDirection=tS,ir.exceptionSink=tb,ir.updateListener=ty,ir.editable=tD,ir.mouseSelectionStyle=tw,ir.dragMovesSelection=tv,ir.clickAddsSelectionRange=tg,ir.decorations=tV,ir.atomicRanges=tH,ir.scrollMargins=tN,ir.darkTheme=e2,ir.contentAttributes=tL,ir.editorAttributes=tB,ir.lineWrapping=ir.contentAttributes.of({class:"cm-lineWrapping"}),ir.announce=l.Py.define();let il=4096,ih={};class ia{constructor(t,e,i,s){this.from=t,this.to=e,this.dir=i,this.order=s}static update(t,e){if(e.empty)return t;let i=[],s=t.length?t[t.length-1].dir:tF.LTR;for(let o=Math.max(0,t.length-10);o=0;o--){let n=s[o],r="function"==typeof n?n(t):n;r&&tt(r,i)}return i}let id=K.mac?"mac":K.windows?"win":K.linux?"linux":"key";function iu(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t}let ip=l.Wl.default(ir.domEventHandlers({keydown:(t,e)=>iy(iv(e.state),t,e,"editor")})),im=l.r$.define({enables:ip}),ig=new WeakMap;function iv(t){let e=t.facet(im),i=ig.get(e);return i||ig.set(e,i=function(t,e=id){let i=Object.create(null),s=Object.create(null),o=(t,e)=>{let i=s[t];if(null==i)s[t]=e;else if(i!=e)throw Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},n=(t,s,n,r)=>{var l,h;let a=i[t]||(i[t]=Object.create(null)),c=s.split(/ (?!$)/).map(t=>(function(t,e){let i,s,o,n;let r=t.split(/-(?!$)/),l=r[r.length-1];"Space"==l&&(l=" ");for(let h=0;h{let i=ib={view:e,prefix:u,scope:t};return setTimeout(()=>{ib==i&&(ib=null)},4e3),!0}]})}let f=c.join(" ");o(f,!1);let p=a[f]||(a[f]={preventDefault:!1,run:(null===(h=null===(l=a._any)||void 0===l?void 0:l.run)||void 0===h?void 0:h.slice())||[]});n&&p.run.push(n),r&&(p.preventDefault=!0)};for(let r of t){let l=r.scope?r.scope.split(" "):["editor"];if(r.any)for(let h of l){let a=i[h]||(i[h]=Object.create(null));for(let c in a._any||(a._any={preventDefault:!1,run:[]}),a)a[c].run.push(r.any)}let d=r[e]||r.key;if(d)for(let u of l)n(u,d,r.run,r.preventDefault),r.shift&&n(u,"Shift-"+d,r.shift,r.preventDefault)}return i}(e.reduce((t,e)=>t.concat(e),[]))),i}function iw(t,e,i){return iy(iv(t.state),e,t,i)}let ib=null;function iy(t,e,i,s){let o=(0,a.YG)(e),n=(0,l.gm)(o,0),r=(0,l.nZ)(n)==o.length&&" "!=o,h="",c=!1;ib&&ib.view==i&&ib.scope==s&&(h=ib.prefix+" ",(c=0>eu.indexOf(e.keyCode))&&(ib=null));let d=new Set,u=t=>{if(t){for(let s of t.run)if(!d.has(s)&&(d.add(s),s(i,e)))return!0;t.preventDefault&&(c=!0)}return!1},f=t[s],p,m;if(f){if(u(f[h+iu(o,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&(p=a.ue[e.keyCode])&&p!=o){if(u(f[h+iu(p,e,!0)])||e.shiftKey&&(m=a.uY[e.keyCode])!=o&&m!=p&&u(f[h+iu(m,e,!1)]))return!0}else if(r&&e.shiftKey&&u(f[h+iu(o,e,!0)]))return!0;if(u(f._any))return!0}return c}class ix{constructor(t,e,i,s,o){this.className=t,this.left=e,this.top=i,this.width=s,this.height=o}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(!i.empty)return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let s=Math.max(i.from,t.viewport.from),o=Math.min(i.to,t.viewport.to),n=t.textDirection==tF.LTR,r=t.contentDOM,l=r.getBoundingClientRect(),h=iS(t),a=window.getComputedStyle(r.firstChild),c=l.left+parseInt(a.paddingLeft)+Math.min(0,parseInt(a.textIndent)),d=l.right-parseInt(a.paddingRight),u=ik(t,s),f=ik(t,o),p=u.type==to.Text?u:null,m=f.type==to.Text?f:null;if(t.lineWrapping&&(p&&(p=iM(t,s,p)),m&&(m=iM(t,o,m))),p&&m&&p.from==m.from)return y(x(i.from,i.to,p));{let g=p?x(i.from,null,p):S(u,!1),v=m?x(null,i.to,m):S(f,!0),w=[];return(p||u).to<(m||f).from-1?w.push(b(c,g.bottom,d,v.top)):g.bottoma&&f.from=m)break;b>p&&h(Math.max(w,p),null==e&&w<=a,Math.min(b,m),null==i&&b>=u,v.dir)}if((p=g.to+1)>=m)break}return 0==l.length&&h(a,null==e,u,null==i,t.textDirection),{top:o,bottom:r,horizontal:l}}function S(t,e){let i=l.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i);{let s=t.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let o=iS(t);return[new ix(e,s.left-o.left,s.top-o.top,null,s.bottom-s.top)]}}}function iS(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==tF.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function iM(t,e,i){let s=l.jT.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(s,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(s,!0,!0).from),type:to.Text}}function ik(t,e){let i=t.lineBlockAt(e);if(Array.isArray(i.type)){for(let s of i.type)if(s.to>e||s.to==e&&(s.to==i.to||s.type==to.Text))return s}return i}class iC{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(iA)!=t.state.facet(iA)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(iA);for(;e{var i;return i=this.drawn[e],!(t.constructor==i.constructor&&t.eq(i))})){let e=this.dom.firstChild,i=0;for(let s of t)s.update&&e&&s.constructor&&this.drawn[i].constructor&&s.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(s.draw(),e);for(;e;){let o=e.nextSibling;e.remove(),e=o}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}let iA=l.r$.define();function iD(t){return[tR.define(e=>new iC(e,t)),iA.of(t)]}let iT=!K.ios,iO=l.r$.define({combine:t=>(0,l.BO)(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function iR(t={}){return[iO.of(t),iB,iV,iN,tM.of(!0)]}function iE(t){return t.startState.facet(iO)!=t.startState.facet(iO)}let iB=iD({above:!0,markers(t){let{state:e}=t,i=e.facet(iO),s=[];for(let o of e.selection.ranges){let n=o==e.selection.main;if(o.empty?!n||iT:i.drawRangeCursor){let r=n?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",h=o.empty?o:l.jT.cursor(o.head,o.head>o.anchor?-1:1);for(let a of ix.forRange(t,r,h))s.push(a)}}return s},update(t,e){t.transactions.some(t=>t.scrollIntoView)&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=iE(t);return i&&iL(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){iL(e.state,t)},class:"cm-cursorLayer"});function iL(t,e){e.style.animationDuration=t.facet(iO).cursorBlinkRate+"ms"}let iV=iD({above:!1,markers:t=>t.state.selection.ranges.map(e=>e.empty?[]:ix.forRange(t,"cm-selectionBackground",e)).reduce((t,e)=>t.concat(e)),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||iE(t),class:"cm-selectionLayer"}),iH={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};iT&&(iH[".cm-line"].caretColor="transparent !important");let iN=l.Wl.highest(ir.theme(iH)),iP=l.Py.define({map:(t,e)=>null==t?null:e.mapPos(t)}),iW=l.QQ.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce((t,e)=>e.is(iP)?e.value:t,t))}),iz=tR.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(iW);null==i?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(iW)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(iW),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(iW)!=t&&this.view.dispatch({effects:iP.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function iF(){return[iW,iz]}function iI(t,e,i,s,o){e.lastIndex=0;for(let n=t.iterRange(i,s),r=i,l;!n.next().done;r+=n.value.length)if(!n.lineBreak)for(;l=e.exec(n.value);)o(r+l.index,l)}class iq{constructor(t){let{regexp:e,decoration:i,decorate:s,boundary:o,maxLength:n=1e3}=t;if(!e.global)throw RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,s)this.addMatch=(t,e,i,o)=>s(o,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,s,o)=>{let n=i(t,e,s);n&&o(s,s+t[0].length,n)};else if(i)this.addMatch=(t,e,s,o)=>o(s,s+t[0].length,i);else throw RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=n}createDeco(t){let e=new l.f_,i=e.add.bind(e);for(let{from:s,to:o}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let s=[];for(let{from:o,to:n}of i)o=Math.max(t.state.doc.lineAt(o).from,o-e),n=Math.min(t.state.doc.lineAt(n).to,n+e),s.length&&s[s.length-1].to>=o?s[s.length-1].to=n:s.push({from:o,to:n});return s}(t,this.maxLength))iI(t.state.doc,this.regexp,s,o,(e,s)=>this.addMatch(s,t,e,i));return e.finish()}updateDeco(t,e){let i=1e9,s=-1;return(t.docChanged&&t.changes.iterChanges((e,o,n,r)=>{r>t.view.viewport.from&&n1e3)?this.createDeco(t.view):s>-1?this.updateRange(t.view,e.map(t.changes),i,s):e}updateRange(t,e,i,s){for(let o of t.visibleRanges){let n=Math.max(o.from,i),r=Math.min(o.to,s);if(r>n){let l=t.state.doc.lineAt(n),h=l.tol.from;n--)if(this.boundary.test(l.text[n-1-l.from])){a=n;break}for(;rd.push(i.range(t,e));if(l==h)for(this.regexp.lastIndex=a-l.from;(u=this.regexp.exec(l.text))&&u.indexthis.addMatch(i,t,e,f));e=e.update({filterFrom:a,filterTo:c,filter:(t,e)=>tc,add:d})}}return e}}let ij=null!=/x/.unicode?"gu":"g",iK=RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]",ij),i$={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"},iG=null,iX=l.r$.define({combine(t){let e=(0,l.BO)(t,{render:null,specialChars:iK,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==iG&&"undefined"!=typeof document&&document.body){let e=document.body.style;iG=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)!=null}return iG||!1}())&&(e.specialChars=RegExp(" |"+e.specialChars.source,ij)),e.addSpecialChars&&(e.specialChars=RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,ij)),e}});function i_(t={}){return[iX.of(t),iU||(iU=tR.fromClass(class{constructor(t){this.view=t,this.decorations=tn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(iX)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new iq({regexp:t.specialChars,decoration:(e,i,s)=>{let{doc:o}=i.state,n=(0,l.gm)(e[0],0);if(9==n){let r=o.lineAt(s),h=i.state.tabSize,a=(0,l.IS)(r.text,h,s-r.from);return tn.replace({widget:new iQ((h-a%h)*this.view.defaultCharacterWidth)})}return this.decorationCache[n]||(this.decorationCache[n]=tn.replace({widget:new iY(t,n)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(iX);t.startState.facet(iX)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let iU=null;class iY extends ts{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){var e;let i=(e=this.code)>=32?"•":10==e?"␤":String.fromCharCode(9216+e),s=t.state.phrase("Control character")+" "+(i$[this.code]||"0x"+this.code.toString(16)),o=this.options.render&&this.options.render(this.code,s,i);if(o)return o;let n=document.createElement("span");return n.textContent=i,n.title=s,n.setAttribute("aria-label",s),n.className="cm-specialChar",n}ignoreEvent(){return!1}}class iQ extends ts{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent=" ",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}function iZ(){return i0}let iJ=tn.line({class:"cm-activeLine"}),i0=tR.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,i=[];for(let s of t.state.selection.ranges){let o=t.lineBlockAt(s.head);o.from>e&&(i.push(iJ.range(o.from)),e=o.from)}return tn.set(i)}},{decorations:t=>t.decorations});class i1 extends ts{constructor(t){super(),this.content=t}toDOM(){let 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}ignoreEvent(){return!1}}function i2(t){return tR.fromClass(class{constructor(e){this.view=e,this.placeholder=tn.set([tn.widget({widget:new i1(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?tn.none:this.placeholder}},{decorations:t=>t.decorations})}function i8(t,e){var i;let s,o=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(o),r=o-n.from,h=r>2e3?-1:r==n.length?(i=e.clientX,(s=t.coordsAtPos(t.viewport.from))?Math.round(Math.abs((s.left-i)/t.defaultCharacterWidth)):-1):(0,l.IS)(n.text,t.state.tabSize,o-n.from);return{line:n.number,col:h,off:r}}function i3(t){let e=(null==t?void 0:t.eventFilter)||(t=>t.altKey&&0==t.button);return ir.mouseSelectionStyle.of((t,i)=>{let s,o;return e(i)?(s=i8(t,i),o=t.state.selection,s?{update(t){if(t.docChanged){let e=t.changes.mapPos(t.startState.doc.line(s.line).from),i=t.state.doc.lineAt(e);s={line:i.number,col:s.col,off:Math.min(s.off,i.length)},o=o.map(t.changes)}},get(e,i,n){let r=i8(t,e);if(!r)return o;let h=function(t,e,i){let s=Math.min(e.line,i.line),o=Math.max(e.line,i.line),n=[];if(e.off>2e3||i.off>2e3||e.col<0||i.col<0){let r=Math.min(e.off,i.off),h=Math.max(e.off,i.off);for(let a=s;a<=o;a++){let c=t.doc.line(a);c.length<=h&&n.push(l.jT.range(c.from+r,c.to+h))}}else{let d=Math.min(e.col,i.col),u=Math.max(e.col,i.col);for(let f=s;f<=o;f++){let p=t.doc.line(f),m=(0,l.Gz)(p.text,d,t.tabSize,!0);if(m<0)n.push(l.jT.cursor(p.to));else{let g=(0,l.Gz)(p.text,u,t.tabSize);n.push(l.jT.range(p.from+m,p.from+g))}}}return n}(t.state,s,r);return h.length?n?l.jT.create(h.concat(o.ranges)):l.jT.create(h):o}}:null):null})}let i9={Alt:[18,t=>t.altKey],Control:[17,t=>t.ctrlKey],Shift:[16,t=>t.shiftKey],Meta:[91,t=>t.metaKey]},i5={style:"cursor: crosshair"};function i4(t={}){let[e,i]=i9[t.key||"Alt"],s=tR.fromClass(class{constructor(t){this.view=t,this.isDown=!1}set(t){this.isDown!=t&&(this.isDown=t,this.view.update([]))}},{eventHandlers:{keydown(t){this.set(t.keyCode==e||i(t))},keyup(t){t.keyCode!=e&&i(t)||this.set(!1)},mousemove(t){this.set(i(t))}}});return[s,ir.contentAttributes.of(t=>{var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.isDown)?i5:null})]}let i6="-10000px";class i7{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter(t=>t),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),s=i.filter(t=>t);if(i===this.input){for(let o of this.tooltipViews)o.update&&o.update(t);return!1}let n=[];for(let r=0;rn.indexOf(u)&&(u.dom.remove(),null===(e=u.destroy)||void 0===e||e.call(u));return this.input=i,this.tooltips=s,this.tooltipViews=n,!0}}function st(t){let{win:e}=t;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}let se=l.r$.define({combine(t){var e,i,s;return{position:K.ios?"absolute":(null===(e=t.find(t=>t.position))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find(t=>t.parent))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(s=t.find(t=>t.tooltipSpace))||void 0===s?void 0:s.tooltipSpace)||st}}}),si=tR.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(se);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new i7(t,sn,t=>this.createTooltip(t)),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){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}observeIntersection(){if(this.intersectionObserver)for(let t of(this.intersectionObserver.disconnect(),this.manager.tooltipViews))this.intersectionObserver.observe(t.dom)}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,s=t.state.facet(se);if(s.position!=this.position){for(let o of(this.position=s.position,this.manager.tooltipViews))o.dom.style.position=this.position;i=!0}if(s.parent!=this.parent){for(let n of(this.parent&&this.container.remove(),this.parent=s.parent,this.createContainer(),this.manager.tooltipViews))this.container.appendChild(n.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",e.dom.appendChild(i)}return e.dom.style.position=this.position,e.dom.style.top=i6,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;for(let i of(this.view.win.removeEventListener("resize",this.measureSoon),this.manager.tooltipViews))i.dom.remove(),null===(t=i.destroy)||void 0===t||t.call(i);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)}),size:this.manager.tooltipViews.map(({dom:t})=>t.getBoundingClientRect()),space:this.view.state.facet(se).tooltipSpace(this.view)}}writeMeasure(t){let{editor:e,space:i}=t,s=[];for(let o=0;o=Math.min(e.bottom,i.bottom)||h.rightMath.min(e.right,i.right)+.1){l.style.top=i6;continue}let c=n.arrow?r.dom.querySelector(".cm-tooltip-arrow"):null,d=c?7:0,u=a.right-a.left,f=a.bottom-a.top,p=r.offset||so,m=this.view.textDirection==tF.LTR,g=a.width>i.right-i.left?m?i.left:i.right-a.width:m?Math.min(h.left-(c?14:0)+p.x,i.right-u):Math.max(i.left,h.left-u+(c?14:0)-p.x),v=!!n.above;!n.strictSide&&(v?h.top-(a.bottom-a.top)-p.yi.bottom)&&v==i.bottom-h.bottom>h.top-i.top&&(v=!v);let w=(v?h.top-i.top:i.bottom-h.bottom)-d;if(wg&&x.topb&&(b=v?x.top-f-2-d:x.bottom+d+2);"absolute"==this.position?(l.style.top=b-t.parent.top+"px",l.style.left=g-t.parent.left+"px"):(l.style.top=b+"px",l.style.left=g+"px"),c&&(c.style.left=`${h.left+(m?p.x:-p.x)-(g+14-7)}px`),!0!==r.overlap&&s.push({left:g,top:b,right:y,bottom:b+f}),l.classList.toggle("cm-tooltip-above",v),l.classList.toggle("cm-tooltip-below",!v),r.positioned&&r.positioned(t.space)}}maybeMeasure(){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)))for(let t of this.manager.tooltipViews)t.dom.style.top=i6}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),ss=ir.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:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),so={x:0,y:0},sn=l.r$.define({enables:[si,ss]}),sr=l.r$.define();class sl{constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new i7(t,sr,t=>this.createHostedView(t))}static create(t){return new sl(t)}createHostedView(t){let e=t.create(this.view);return e.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(e.dom),this.mounted&&e.mount&&e.mount(this.view),e}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}}let sh=sn.compute([sr],t=>{let e=t.facet(sr).filter(t=>t);return 0===e.length?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.filter(t=>null!=t.end).map(t=>t.end)),create:sl.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class sa{constructor(t,e,i,s,o){this.view=t,this.source=e,this.field=i,this.setHover=s,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active)return;let t=Date.now()-this.lastMove.time;ti.bottom||t.xi.right+this.view.defaultCharacterWidth)return;let s=this.view.bidiSpans(this.view.state.doc.lineAt(e)).find(t=>t.from<=e&&t.to>=e),o=s&&s.dir==tF.RTL?-1:1,n=this.source(this.view,e,t.x{this.pending==r&&(this.pending=null,t&&this.view.dispatch({effects:this.setHover.of(t)}))},t=>tA(this.view.state,t,"hover tooltip"))}else n&&this.view.dispatch({effects:this.setHover.of(n)})}mousemove(t){var e;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let i=this.active;if(i&&!sc(this.lastMove.target)||this.pending){let{pos:s}=i||this.pending,o=null!==(e=null==i?void 0:i.end)&&void 0!==e?e:s;(s==o?this.view.posAtCoords(this.lastMove)!=s:!function(t,e,i,s,o,n){let r=document.createRange(),l=t.domAtPos(e),h=t.domAtPos(i);r.setEnd(h.node,h.offset),r.setStart(l.node,l.offset);let a=r.getClientRects();r.detach();for(let c=0;c=Math.max(d.top-o,o-d.bottom,d.left-s,s-d.right))return!0}return!1}(this.view,s,o,t.clientX,t.clientY,0))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!sc(t.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function sc(t){for(let e=t;e;e=e.parentNode)if(1==e.nodeType&&e.classList.contains("cm-tooltip"))return!0;return!1}function sd(t,e={}){let i=l.Py.define(),s=l.QQ.define({create:()=>null,update(t,s){if(t&&(e.hideOnChange&&(s.docChanged||s.selection)||e.hideOn&&e.hideOn(s,t)))return null;if(t&&s.docChanged){let o=s.changes.mapPos(t.pos,-1,l.gc.TrackDel);if(null==o)return null;let n=Object.assign(Object.create(null),t);n.pos=o,null!=t.end&&(n.end=s.changes.mapPos(t.end)),t=n}for(let r of s.effects)r.is(i)&&(t=r.value),r.is(sf)&&(t=null);return t},provide:t=>sr.from(t)});return[s,tR.define(o=>new sa(o,t,s,i,e.hoverTime||300)),sh]}function su(t,e){let i=t.plugin(si);if(!i)return null;let s=i.manager.tooltips.indexOf(e);return s<0?null:i.manager.tooltipViews[s]}let sf=l.Py.define(),sp=l.r$.define({combine(t){let e,i;for(let s of t)e=e||s.topContainer,i=i||s.bottomContainer;return{topContainer:e,bottomContainer:i}}});function sm(t,e){let i=t.plugin(sg),s=i?i.specs.indexOf(e):-1;return s>-1?i.panels[s]:null}let sg=tR.fromClass(class{constructor(t){this.input=t.state.facet(sb),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(e=>e(t));let e=t.state.facet(sp);for(let i of(this.top=new sv(t,!0,e.topContainer),this.bottom=new sv(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top)),this.panels))i.dom.classList.add("cm-panel"),i.mount&&i.mount()}update(t){let e=t.state.facet(sp);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new sv(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new sv(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(sb);if(i!=this.input){let s=i.filter(t=>t),o=[],n=[],r=[],l=[];for(let h of s){let a=this.specs.indexOf(h),c;a<0?(c=h(t.view),l.push(c)):(c=this.panels[a]).update&&c.update(t),o.push(c),(c.top?n:r).push(c)}for(let d of(this.specs=s,this.panels=o,this.top.sync(n),this.bottom.sync(r),l))d.dom.classList.add("cm-panel"),d.mount&&d.mount()}else for(let u of this.panels)u.update&&u.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>ir.scrollMargins.of(e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}})});class sv{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&0>t.indexOf(e)&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(0==this.panels.length){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let i of this.panels)if(i.dom.parentNode==this.dom){for(;e!=i.dom;)e=sw(e);e=e.nextSibling}else this.dom.insertBefore(i.dom,e);for(;e;)e=sw(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function sw(t){let e=t.nextSibling;return t.remove(),e}let sb=l.r$.define({enables:sg});class sy extends l.uU{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}sy.prototype.elementClass="",sy.prototype.toDOM=void 0,sy.prototype.mapMode=l.gc.TrackBefore,sy.prototype.startSide=sy.prototype.endSide=-1,sy.prototype.point=!0;let sx=l.r$.define(),sS={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>l.Xs.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},sM=l.r$.define();function sk(t){return[sA(),sM.of(Object.assign(Object.assign({},sS),t))]}let sC=l.r$.define({combine:t=>t.some(t=>t)});function sA(t){let e=[sD];return t&&!1===t.fixed&&e.push(sC.of(!0)),e}let sD=tR.fromClass(class{constructor(t){for(let e of(this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=t.state.facet(sM).map(e=>new sE(t,e)),this.gutters))this.dom.appendChild(e.dom);this.fixed=!t.state.facet(sC),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,i=t.view.viewport,s=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(s<(i.to-i.from)*.8)}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(sC)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let i=l.Xs.iter(this.view.state.facet(sx),this.view.viewport.from),s=[],o=this.gutters.map(t=>new sR(t,this.view.viewport,-this.view.documentPadding.top));for(let n of this.view.viewportLineBlocks){let r;if(Array.isArray(n.type)){for(let h of n.type)if(h.type==to.Text){r=h;break}}else r=n.type==to.Text?n:void 0;if(r)for(let a of(s.length&&(s=[]),sO(i,s,n.from),o))a.line(this.view,r,s)}for(let c of o)c.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(sM),i=t.state.facet(sM),s=t.docChanged||t.heightChanged||t.viewportChanged||!l.Xs.eq(t.startState.facet(sx),t.state.facet(sx),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let o of this.gutters)o.update(t)&&(s=!0);else{s=!0;let n=[];for(let r of i){let h=e.indexOf(r);h<0?n.push(new sE(this.view,r)):(this.gutters[h].update(t),n.push(this.gutters[h]))}for(let a of this.gutters)a.dom.remove(),0>n.indexOf(a)&&a.destroy();for(let c of n)this.dom.appendChild(c.dom);this.gutters=n}return s}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>ir.scrollMargins.of(e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==tF.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null})});function sT(t){return Array.isArray(t)?t:[t]}function sO(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class sR{constructor(t,e,i){this.gutter=t,this.height=i,this.localMarkers=[],this.i=0,this.cursor=l.Xs.iter(t.markers,e.from)}line(t,e,i){this.localMarkers.length&&(this.localMarkers=[]),sO(this.cursor,this.localMarkers,e.from);let s=i.length?this.localMarkers.concat(i):this.localMarkers,o=this.gutter.config.lineMarker(t,e,s);o&&s.unshift(o);let n=this.gutter;if(0==s.length&&!n.config.renderEmptyElements)return;let r=e.top-this.height;if(this.i==n.elements.length){let l=new sB(t,e.height,r,s);n.elements.push(l),n.dom.appendChild(l.dom)}else n.elements[this.i].update(t,e.height,r,s);this.height=e.bottom,this.i++}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class sE{constructor(t,e){for(let i in this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:""),e.domEventHandlers)this.dom.addEventListener(i,s=>{let o=t.lineBlockAtHeight(s.clientY-t.documentTop);e.domEventHandlers[i](t,o,s)&&s.preventDefault()});this.markers=sT(e.markers(t)),e.initialSpacer&&(this.spacer=new sB(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=sT(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],t);i!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[i])}let s=t.view.viewport;return!l.Xs.eq(this.markers,e,s.from,s.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t)}destroy(){for(let t of this.elements)t.destroy()}}class sB{constructor(t,e,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,s)}update(t,e,i,s){this.height!=e&&(this.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),!function(t,e){if(t.length!=e.length)return!1;for(let i=0;i(0,l.BO)(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let s in e){let o=i[s],n=e[s];i[s]=o?(t,e,i)=>o(t,e,i)||n(t,e,i):n}return i}})});class sH extends sy{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function sN(t,e){return t.state.facet(sV).formatNumber(e,t.state)}let sP=sM.compute([sV],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(sL),lineMarker:(t,e,i)=>i.some(t=>t.toDOM)?null:new sH(sN(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(sV)!=t.state.facet(sV),initialSpacer:t=>new sH(sN(t,sz(t.state.doc.lines))),updateSpacer(t,e){let i=sN(e.view,sz(e.view.state.doc.lines));return i==t.number?t:new sH(i)},domEventHandlers:t.facet(sV).domEventHandlers}));function sW(t={}){return[sV.of(t),sA(),sP]}function sz(t){let e=9;for(;e{let e=[],i=-1;for(let s of t.selection.ranges){let o=t.doc.lineAt(s.head).from;o>i&&(i=o,e.push(sF.range(o)))}return l.Xs.of(e)});function sq(){return sI}}}]); \ No newline at end of file diff --git a/static/web/_next/static/chunks/4ad82c5e-573627f1f4333b92.js b/static/web/_next/static/chunks/4ad82c5e-573627f1f4333b92.js new file mode 100644 index 000000000..b60294a19 --- /dev/null +++ b/static/web/_next/static/chunks/4ad82c5e-573627f1f4333b92.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5762],{47421:function(t,e,i){let s;i.d(e,{$1:function(){return ib},$f:function(){return ig},AE:function(){return iU},Eu:function(){return sz},HQ:function(){return sj},Nm:function(){return tF},OO:function(){return tA},S2:function(){return i6},SJ:function(){return sx},Sd:function(){return sg},Uw:function(){return iE},W$:function(){return i8},ZO:function(){return iJ},Zs:function(){return i9},bF:function(){return su},gB:function(){return sf},hJ:function(){return sr},l9:function(){return ts},lg:function(){return tR},mH:function(){return sy},p:function(){return tn},qr:function(){return iI},tk:function(){return il},v5:function(){return sC}});var o,n,r,l=i(78120),h=i(28699),a=i(33952);function c(t){return(11==t.nodeType?t.getSelection?t:t.ownerDocument:t).getSelection()}function d(t,e){return!!e&&(t==e||t.contains(1!=e.nodeType?e.parentNode:e))}function u(t,e){if(!e.anchorNode)return!1;try{return d(t,e.anchorNode)}catch(i){return!1}}function f(t){return 3==t.nodeType?M(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function p(t,e,i,s){return!!i&&(g(t,e,i,s,-1)||g(t,e,i,s,1))}function m(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e}function g(t,e,i,s,o){for(;;){if(t==i&&e==s)return!0;if(e==(o<0?0:v(t))){if("DIV"==t.nodeName)return!1;let n=t.parentNode;if(!n||1!=n.nodeType)return!1;e=m(t)+(o<0?0:1),t=n}else{if(1!=t.nodeType||1==(t=t.childNodes[e+(o<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;e=o<0?v(t):0}}}function v(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}let w={left:0,right:0,top:0,bottom:0};function b(t,e){let i=e?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}class y{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){this.set(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset)}set(t,e,i,s){this.anchorNode=t,this.anchorOffset=e,this.focusNode=i,this.focusOffset=s}}let x=null;function S(t){if(t.setActive)return t.setActive();if(x)return t.focus(x);let e=[];for(let i=t;i&&(e.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==x?{get preventScroll(){return x={preventScroll:!0},!0}}:void 0),!x){x=!1;for(let s=0;se)return c.domBoundsAround(t,e,h);if(d>=t&&-1==s&&(s=l,o=h),h>e&&c.dom.parentNode==this.dom){n=l,r=a;break}a=d,h=d+c.breakAfter}return{from:o,to:r<0?i+this.length:r,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:n=0?this.children[n].dom:null}}markDirty(t=!1){this.dirty|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.dirty|=2),1&e.dirty)return;e.dirty|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.dirty&&this.markParentsDirty(!0))}setDOM(t){this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,i=D){this.markDirty();for(let s=t;sthis.pos||t==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let i=this.children[--this.i];this.pos-=i.length+i.breakAfter}}}function E(t,e,i,s,o,n,r,l,h){let{children:a}=t,c=a.length?a[e]:null,d=n.length?n[n.length-1]:null,u=d?d.breakAfter:r;if(!(e==s&&c&&!r&&!u&&n.length<2&&c.merge(i,o,n.length?d:null,0==i,l,h))){if(s0&&(!r&&n.length&&c.merge(i,c.length,n[0],!1,l,0)?c.breakAfter=n.shift().breakAfter:(i2);var K={mac:j||/Mac/.test(L.platform),windows:/Win/.test(L.platform),linux:/Linux|X11/.test(L.platform),ie:W,ie_version:N?V.documentMode||6:P?+P[1]:H?+H[1]:0,gecko:z,gecko_version:z?+(/Firefox\/(\d+)/.exec(L.userAgent)||[0,0])[1]:0,chrome:!!F,chrome_version:F?+F[1]:0,ios:j,android:/Android\b/.test(L.userAgent),webkit:I,safari:q,webkit_version:I?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=V.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class $ extends T{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){3==t.nodeType&&this.createDOM(t)}merge(t,e,i){return(!i||i instanceof $&&!(this.length-(e-t)+i.length>256))&&(this.text=this.text.slice(0,t)+(i?i.text:"")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new $(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new A(this.dom,t)}domBoundsAround(t,e,i){return{from:i,to:i+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return X(this.dom,t,e)}}class G extends T{constructor(t,e=[],i=0){for(let s of(super(),this.mark=t,this.children=e,this.length=i,e))s.setParent(this)}setAttrs(t){if(C(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.dirty|=6)}sync(t){this.dom?4&this.dirty&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t)}merge(t,e,i,s,o,n){return(!i||!!(i instanceof G&&i.mark.eq(this.mark))&&(!t||!(o<=0))&&(!(et&&e.push(i=t&&(s=o),i=r,o++}let l=this.length-t;return this.length=t,s>-1&&(this.children.length=s,this.markDirty()),new G(this.mark,e,l)}domAtPos(t){return Z(this,t)}coordsAt(t,e){return J(this,t,e)}}function X(t,e,i){let s=t.nodeValue.length;e>s&&(e=s);let o=e,n=e,r=0;0==e&&i<0||e==s&&i>=0?!(K.chrome||K.gecko)&&(e?(o--,r=1):n=0)?0:l.length-1];return K.safari&&!r&&0==h.width&&(h=Array.prototype.find.call(l,t=>t.width)||h),r?b(h,r<0):h||null}class _ extends T{constructor(t,e,i){super(),this.widget=t,this.length=e,this.side=i,this.prevWidget=null}static create(t,e,i){return new(t.customView||_)(t,e,i)}split(t){let e=_.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(){this.dom&&this.widget.updateDOM(this.dom)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(this.editorView)),this.dom.contentEditable="false")}getSide(){return this.side}merge(t,e,i,s,o,n){return(!i||i instanceof _&&!!this.widget.compare(i.widget)&&(!(t>0)||!(o<=0))&&(!(e0?i.length-1:0;s=i[o],t>0?0!=o:o!=i.length-1&&!(s.top0?-1:1);return this.length?s:b(s,this.side>0)}get isEditable(){return!1}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class U extends _{domAtPos(t){let{topView:e,text:i}=this.widget;return e?Y(t,0,e,i,(t,e)=>t.domAtPos(e),t=>new A(i,Math.min(t,i.nodeValue.length))):new A(i,Math.min(t,i.nodeValue.length))}sync(){this.setDOM(this.widget.toDOM())}localPosFromDOM(t,e){let{topView:i,text:s}=this.widget;return i?function t(e,i,s,o){if(s instanceof G)for(let n of s.children){let r=0,l=d(n.dom,o);if(d(n.dom,e))return r+(l?t(e,i,n,o):n.localPosFromDOM(e,i));r+=l?o.nodeValue.length:n.length}else if(s.dom==o)return Math.min(i,o.nodeValue.length);return s.localPosFromDOM(e,i)}(t,e,i,s):Math.min(e,this.length)}ignoreMutation(){return!1}get overrideDOMText(){return null}coordsAt(t,e){let{topView:i,text:s}=this.widget;return i?Y(t,e,i,s,(t,e,i)=>t.coordsAt(e,i),(t,e)=>X(s,t,e)):X(s,t,e)}destroy(){var t;super.destroy(),null===(t=this.widget.topView)||void 0===t||t.destroy()}get isEditable(){return!0}canReuseDOM(){return!0}}function Y(t,e,i,s,o,n){if(i instanceof G){for(let r=i.dom.firstChild;r;r=r.nextSibling){let l=T.get(r);if(!l)return n(t,e);let h=d(r,s),a=l.length+(h?s.nodeValue.length:0);if(t=l.getSide())return h?Y(t,e,l,s,o,n):o(l,t,e);t-=a}return o(i,i.length,-1)}return i.dom==s?n(t,e):o(i,t,e)}class Q extends T{constructor(t){super(),this.side=t}get length(){return 0}merge(){return!1}become(t){return t instanceof Q&&t.side==this.side}split(){return new Q(this.side)}sync(){if(!this.dom){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),this.setDOM(t)}}getSide(){return this.side}domAtPos(t){return A.before(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){let e=this.dom.getBoundingClientRect(),i=function(t,e){let i=t.parent,s=i?i.children.indexOf(t):-1;for(;i&&s>=0;)if(e<0?s>0:s0?-1:1);return i&&i.tope.top?{left:e.left,right:e.right,top:i.top,bottom:i.bottom}:e}get overrideDOMText(){return l.xv.empty}}function Z(t,e){let i=t.dom,{children:s}=t,o=0;for(let n=0;o=r.getSide())){if(e>n&&e0;h--){let a=s[h-1];if(a.dom.parentNode==i)return a.domAtPos(a.length)}for(let c=o;c=i&&(a.children.length?t(a,i-h):!n&&(c>i||h==c&&a.getSide()>0)?(n=a,r=i-h):(ha.getSide())&&(s=a,o=i-h)),h=c}}(t,e);let l=(i<0?s:n)||s||n;return l?l.coordsAt(Math.max(0,l==s?o:r),i):function(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let i=f(e);return i[i.length-1]||null}(t)}function tt(t,e){for(let i in t)"class"==i&&e.class?e.class+=" "+t.class:"style"==i&&e.style?e.style+=";"+t.style:e[i]=t[i];return e}function te(t,e){if(t==e)return!0;if(!t||!e)return!1;let i=Object.keys(t),s=Object.keys(e);if(i.length!=s.length)return!1;for(let o of i)if(-1==s.indexOf(o)||t[o]!==e[o])return!1;return!0}function ti(t,e,i){let s=null;if(e)for(let o in e)i&&o in i||t.removeAttribute(s=o);if(i)for(let n in i)e&&e[n]==i[n]||t.setAttribute(s=n,i[n]);return!!s}$.prototype.children=_.prototype.children=Q.prototype.children=D;class ts{eq(t){return!1}updateDOM(t){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return -1}ignoreEvent(t){return!0}get customView(){return null}destroy(t){}}var to=((o=to||(to={}))[o.Text=0]="Text",o[o.WidgetBefore=1]="WidgetBefore",o[o.WidgetAfter=2]="WidgetAfter",o[o.WidgetRange=3]="WidgetRange",o);class tn extends l.uU{constructor(t,e,i,s){super(),this.startSide=t,this.endSide=e,this.widget=i,this.spec=s}get heightRelevant(){return!1}static mark(t){return new tr(t)}static widget(t){let e=t.side||0,i=!!t.block;return e+=i?e>0?3e8:-4e8:e>0?1e8:-1e8,new th(t,e,e,i,t.widget||null,!1)}static replace(t){let e=!!t.block,i,s;if(t.isBlockGap)i=-5e8,s=4e8;else{let{start:o,end:n}=ta(t,e);i=(o?e?-3e8:-1:5e8)-1,s=(n?e?2e8:1:-6e8)+1}return new th(t,i,s,e,t.widget||null,!0)}static line(t){return new tl(t)}static set(t,e=!1){return l.Xs.of(t,e)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}tn.none=l.Xs.empty;class tr extends tn{constructor(t){let{start:e,end:i}=ta(t);super(e?-1:5e8,i?1:-6e8,null,t),this.tagName=t.tagName||"span",this.class=t.class||"",this.attrs=t.attributes||null}eq(t){return this==t||t instanceof tr&&this.tagName==t.tagName&&this.class==t.class&&te(this.attrs,t.attrs)}range(t,e=t){if(t>=e)throw RangeError("Mark decorations may not be empty");return super.range(t,e)}}tr.prototype.point=!1;class tl extends tn{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof tl&&te(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw RangeError("Line decoration ranges must be zero-length");return super.range(t,e)}}tl.prototype.mapMode=l.gc.TrackBefore,tl.prototype.point=!0;class th extends tn{constructor(t,e,i,s,o,n){super(e,i,o,t),this.block=s,this.isReplace=n,this.mapMode=s?e<=0?l.gc.TrackBefore:l.gc.TrackAfter:l.gc.TrackDel}get type(){return this.startSide=5}eq(t){var e,i;return t instanceof th&&((e=this.widget)==(i=t.widget)||!!(e&&i&&e.compare(i)))&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=t)throw RangeError("Widget decorations can only have zero-length ranges");return super.range(t,e)}}function ta(t,e=!1){let{inclusiveStart:i,inclusiveEnd:s}=t;return null==i&&(i=t.inclusive),null==s&&(s=t.inclusive),{start:null!=i?i:e,end:null!=s?s:e}}function tc(t,e,i,s=0){let o=i.length-1;o>=0&&i[o]+s>=t?i[o]=Math.max(i[o],e):i.push(t,e)}th.prototype.point=!0;class td extends T{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,e,i,s,o,n){if(i){if(!(i instanceof td))return!1;this.dom||i.transferDOM(this)}return s&&this.setDeco(i?i.attrs:null),B(this,t,e,i?i.children:[],o,n),!0}split(t){let e=new td;if(e.breakAfter=this.breakAfter,0==this.length)return e;let{i,off:s}=this.childPos(t);s&&(e.append(this.children[i].split(s),0),this.children[i].merge(s,this.children[i].length,null,!1,0,0),i++);for(let o=i;o0&&0==this.children[i-1].length;)this.children[--i].destroy();return this.children.length=i,this.markDirty(),this.length=t,e}transferDOM(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)}setDeco(t){te(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){!function t(e,i,s){let o,{children:n}=e;s>0&&i instanceof G&&n.length&&(o=n[n.length-1])instanceof G&&o.mark.eq(i.mark)?t(o,i.children[0],s-1):(n.push(i),i.setParent(e)),e.length+=i.length}(this,t,e)}addLineDeco(t){let e=t.spec.attributes,i=t.spec.class;e&&(this.attrs=tt(e,this.attrs||{})),i&&(this.attrs=tt({class:i},this.attrs||{}))}domAtPos(t){return Z(this,t)}reuseDOM(t){"DIV"==t.nodeName&&(this.setDOM(t),this.dirty|=6)}sync(t){var e;this.dom?4&this.dirty&&(C(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&&(ti(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(t);let i=this.dom.lastChild;for(;i&&T.get(i) instanceof G;)i=i.lastChild;if(!i||!this.length||"BR"!=i.nodeName&&(null===(e=T.get(i))||void 0===e?void 0:e.isEditable)==!1&&(!K.ios||!this.children.some(t=>t instanceof $))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let t=0;for(let e of this.children){if(!(e instanceof $)||/[^ -~]/.test(e.text))return null;let i=f(e.dom);if(1!=i.length)return null;t+=i[0].width}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length}:null}coordsAt(t,e){return J(this,t,e)}become(t){return!1}get type(){return to.Text}static find(t,e){for(let i=0,s=0;i=e){if(o instanceof td)return o;if(n>e)break}s=n+o.breakAfter}return null}}class tu extends T{constructor(t,e,i){super(),this.widget=t,this.length=e,this.type=i,this.breakAfter=0,this.prevWidget=null}merge(t,e,i,s,o,n){return(!i||i instanceof tu&&!!this.widget.compare(i.widget)&&(!(t>0)||!(o<=0))&&(!(e0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:n}=this.cursor.next(this.skip);if(this.skip=0,n)throw 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=s,this.textOff=0}let r=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-i)),this.getLine().append(tp(new $(this.text.slice(this.textOff,this.textOff+r)),e),i),this.atCursorPos=!0,this.textOff+=r,t-=r,i=0}}span(t,e,i,s){this.buildText(e-t,i,s),this.pos=e,this.openStart<0&&(this.openStart=s)}point(t,e,i,s,o,n){if(this.disallowBlockEffectsFor[n]&&i instanceof th){if(i.block)throw RangeError("Block decorations may not be specified via plugins");if(e>this.doc.lineAt(this.pos).to)throw RangeError("Decorations that replace line breaks may not be specified via plugins")}let r=e-t;if(i instanceof th){if(i.block){let{type:l}=i;l!=to.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new tu(i.widget||new tm("div"),r,l))}else{let h=_.create(i.widget||new tm("span"),r,r?0:i.startSide),a=this.atCursorPos&&!h.isEditable&&o<=s.length&&(t0),c=!h.isEditable&&(ts.length||i.startSide<=0),d=this.getLine();2!=this.pendingBuffer||a||(this.pendingBuffer=0),this.flushBuffer(s),a&&(d.append(tp(new Q(1),s),o),o=s.length+Math.max(0,o-s.length)),d.append(tp(h,s),o),this.atCursorPos=c,this.pendingBuffer=c?ts.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(i);r&&(this.textOff+r<=this.text.length?this.textOff+=r:(this.skip+=r-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=o)}static build(t,e,i,s,o){let n=new tf(t,e,i,o);return n.openEnd=l.Xs.spans(s,e,i,n),n.openStart<0&&(n.openStart=n.openEnd),n.finish(n.openEnd),n}}function tp(t,e){for(let i of e)t=new G(i,[t],t.length);return t}class tm extends ts{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}}let tg=l.r$.define(),tv=l.r$.define(),tw=l.r$.define(),tb=l.r$.define(),ty=l.r$.define(),tx=l.r$.define(),tS=l.r$.define({combine:t=>t.some(t=>t)}),tM=l.r$.define({combine:t=>t.some(t=>t)});class tk{constructor(t,e="nearest",i="nearest",s=5,o=5){this.range=t,this.y=e,this.x=i,this.yMargin=s,this.xMargin=o}map(t){return t.empty?this:new tk(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin)}}let tC=l.Py.define({map:(t,e)=>t.map(e)});function tA(t,e,i){let s=t.facet(tb);s.length?s[0](e):window.onerror?window.onerror(String(e),i,void 0,void 0,e):i?console.error(i+":",e):console.error(e)}let tD=l.r$.define({combine:t=>!t.length||t[0]}),tT=0,tO=l.r$.define();class tR{constructor(t,e,i,s){this.id=t,this.create=e,this.domEventHandlers=i,this.extension=s(this)}static define(t,e){let{eventHandlers:i,provide:s,decorations:o}=e||{};return new tR(tT++,t,i,t=>{let e=[tO.of(t)];return o&&e.push(tV.of(e=>{let i=e.plugin(t);return i?o(i):tn.none})),s&&e.push(s(t)),e})}static fromClass(t,e){return tR.define(e=>new t(e),e)}}class tE{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(s){if(tA(e.state,s,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(i){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(o){tA(t.state,o,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(t){var e;if(null===(e=this.value)||void 0===e?void 0:e.destroy)try{this.value.destroy()}catch(i){tA(t.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}let tB=l.r$.define(),tL=l.r$.define(),tV=l.r$.define(),tH=l.r$.define(),tN=l.r$.define(),tP=l.r$.define();class tW{constructor(t,e,i,s){this.fromA=t,this.toA=e,this.fromB=i,this.toB=s}join(t){return new tW(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,i=this;for(;e>0;e--){let s=t[e-1];if(!(s.fromA>i.toA)){if(s.toAa)break;o+=2}if(!l)return i;new tW(l.fromA,l.toA,l.fromB,l.toB).addToSet(i),n=l.toA,r=l.toB}}}class tz{constructor(t,e,i){for(let s of(this.view=t,this.state=e,this.transactions=i,this.flags=0,this.startState=t.state,this.changes=l.as.empty(this.startState.doc.length),i))this.changes=this.changes.compose(s.changes);let o=[];this.changes.iterChangedRanges((t,e,i,s)=>o.push(new tW(t,e,i,s))),this.changedRanges=o;let n=t.hasFocus;n!=t.inputState.notifiedFocused&&(t.inputState.notifiedFocused=n,this.flags|=1)}static create(t,e,i){return new tz(t,e,i)}get viewportChanged(){return(4&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(10&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}var tF=((n=tF||(tF={}))[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n);let tI=tF.LTR,tq=tF.RTL;function tj(t){let e=[];for(let i=0;i=e){if(r.level==i)return n;(o<0||(0!=s?s<0?r.frome:t[o].level>r.level))&&(o=n)}}if(o<0)throw RangeError("Index out of range");return o}}let tJ=[];function t0(t){return[new tZ(0,t,0)]}let t1="";class t2{constructor(t,e){this.points=t,this.text="",this.lineSeparator=e.facet(l.yy.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+="￿"}readRange(t,e){if(!t)return this;let i=t.parentNode;for(let s=t;;){this.findPointBefore(i,s),this.readNode(s);let o=s.nextSibling;if(o==e)break;let n=T.get(s),r=T.get(o);(n&&r?n.breakAfter:(n?n.breakAfter:t8(s))||t8(o)&&("BR"!=s.nodeName||s.cmIgnore))&&this.lineBreak(),s=o}return this.findPointBefore(i,e),this}readTextNode(t){let e=t.nodeValue;for(let i of this.points)i.node==t&&(i.pos=this.text.length+Math.min(i.offset,e.length));for(let s=0,o=this.lineSeparator?null:/\r\n?|\n/g;;){let n=-1,r=1,l;if(this.lineSeparator?(n=e.indexOf(this.lineSeparator,s),r=this.lineSeparator.length):(l=o.exec(e))&&(n=l.index,r=l[0].length),this.append(e.slice(s,n<0?e.length:n)),n<0)break;if(this.lineBreak(),r>1)for(let h of this.points)h.node==t&&h.pos>this.text.length&&(h.pos-=r-1);s=n+r}}readNode(t){if(t.cmIgnore)return;let e=T.get(t),i=e&&e.overrideDOMText;if(null!=i){this.findPointInside(t,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else 3==t.nodeType?this.readTextNode(t):"BR"==t.nodeName?t.nextSibling&&this.lineBreak():1==t.nodeType&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let i of this.points)i.node==t&&t.childNodes[i.offset]==e&&(i.pos=this.text.length)}findPointInside(t,e){for(let i of this.points)(3==t.nodeType?i.node==t:t.contains(i.node))&&(i.pos=this.text.length+Math.min(e,i.offset))}}function t8(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}class t3{constructor(t,e){this.node=t,this.offset=e,this.pos=-1}}class t9 extends T{constructor(t){super(),this.view=t,this.compositionDeco=tn.none,this.decorations=[],this.dynamicDecorationMap=[],this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new td],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new tW(0,0,0,t.state.doc.length)],0)}get editorView(){return this.view}get length(){return this.view.state.doc.length}update(t){var e,i,s;let o,n=t.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:t,toA:e})=>ethis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=tn.none:(t.transactions.length||this.dirty)&&(this.compositionDeco=function(t,e){let i=t4(t);if(!i)return tn.none;let{from:s,to:o,node:n,text:r}=i,l=e.mapPos(s,1),h=Math.max(l,e.mapPos(o,-1)),{state:a}=t,c=3==n.nodeType?n.nodeValue:new t2([],a).readRange(n.firstChild,null).text;if(h-l{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let t=K.chrome||K.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(t),this.dirty=0,t&&(t.written||i.selectionRange.focusNode!=t.node)&&(this.forceSelection=!0),this.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to=0?t[s]:null;if(!o)break;let{fromA:n,toA:r,fromB:l,toB:h}=o,{content:a,breakAtStart:c,openStart:d,openEnd:u}=tf.build(this.view.state.doc,l,h,this.decorations,this.dynamicDecorationMap),{i:f,off:p}=i.findPos(r,1),{i:m,off:g}=i.findPos(n,-1);E(this,m,g,f,p,a,c,d,u)}}updateSelection(t=!1,e=!1){var i;if((t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange(),!(e||this.mayControlSelection()))return;let s=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,n=this.domAtPos(o.anchor),r=o.empty?n:this.domAtPos(o.head);if(K.gecko&&o.empty&&1==(i=n).node.nodeType&&i.node.firstChild&&(0==i.offset||"false"==i.node.childNodes[i.offset-1].contentEditable)&&(i.offset==i.node.childNodes.length||"false"==i.node.childNodes[i.offset].contentEditable)){let l=document.createTextNode("");this.view.observer.ignore(()=>n.node.insertBefore(l,n.node.childNodes[n.offset]||null)),n=r=new A(l,0),s=!0}let h=this.view.observer.selectionRange;!s&&h.focusNode&&p(n.node,n.offset,h.anchorNode,h.anchorOffset)&&p(r.node,r.offset,h.focusNode,h.focusOffset)||(this.view.observer.ignore(()=>{K.android&&K.chrome&&this.dom.contains(h.focusNode)&&function(t,e){for(let i=t;i&&i!=e;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let t=c(this.view.root);if(t){if(o.empty){if(K.gecko){var e,i;let s=(e=n.node,i=n.offset,1!=e.nodeType?0:(i&&"false"==e.childNodes[i-1].contentEditable?1:0)|(io.head&&([n,r]=[r,n]),d.setEnd(r.node,r.offset),d.setStart(n.node,n.offset),t.removeAllRanges(),t.addRange(d)}}}),this.view.observer.setSelectionRange(n,r)),this.impreciseAnchor=n.precise?null:new A(h.anchorNode,h.anchorOffset),this.impreciseHead=r.precise?null:new A(h.focusNode,h.focusOffset)}enforceCursorAssoc(){if(this.compositionDeco.size)return;let{view:t}=this,e=t.state.selection.main,i=c(t.root),{anchorNode:s,anchorOffset:o}=t.observer.selectionRange;if(!i||!e.empty||!e.assoc||!i.modify)return;let n=td.find(this,e.head);if(!n)return;let r=n.posAtStart;if(e.head==r||e.head==r+n.length)return;let l=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!l||!h||l.bottom>h.top)return;let a=this.domAtPos(e.head+e.assoc);i.collapse(a.node,a.offset),i.modify("move",e.assoc<0?"forward":"backward","lineboundary"),t.observer.readSelectionRange();let d=t.observer.selectionRange;t.docView.posFromDOM(d.anchorNode,d.anchorOffset)!=e.from&&i.collapse(s,o)}mayControlSelection(){let t=this.view.root.activeElement;return t==this.dom||u(this.dom,this.view.observer.selectionRange)&&!(t&&this.dom.contains(t))}nearest(t){for(let e=t;e;){let i=T.get(e);if(i&&i.rootView==this)return i;e=e.parentNode}return null}posFromDOM(t,e){let i=this.nearest(t);if(!i)throw RangeError("Trying to find position for a DOM position outside of the document");return i.localPosFromDOM(t,e)+i.posAtStart}domAtPos(t){let{i:e,off:i}=this.childCursor().findPos(t,-1);for(;en||t==n&&o.type!=to.WidgetBefore&&o.type!=to.WidgetAfter&&(!s||2==e||this.children[s-1].breakAfter||this.children[s-1].type==to.WidgetBefore&&e>-2))return o.coordsAt(t-n,e);i=n}}measureVisibleLineHeights(t){let e=[],{from:i,to:s}=t,o=this.view.contentDOM.clientWidth,n=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,r=-1,l=this.view.textDirection==tF.LTR;for(let h=0,a=0;as)break;if(h>=i){let u=c.dom.getBoundingClientRect();if(e.push(u.height),n){let p=c.dom.lastChild,m=p?f(p):[];if(m.length){let g=m[m.length-1],v=l?g.right-u.left:u.right-g.left;v>r&&(r=v,this.minWidth=o,this.minWidthFrom=h,this.minWidthTo=d)}}}h=d+c.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return"rtl"==getComputedStyle(this.children[e].dom).direction?tF.RTL:tF.LTR}measureTextSize(){for(let t of this.children)if(t instanceof td){let e=t.measureTextSize();if(e)return e}let i=document.createElement("div"),s,o;return i.className="cm-line",i.style.width="99999px",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(i);let t=f(i.firstChild)[0];s=i.getBoundingClientRect().height,o=t?t.width/27:7,i.remove()}),{lineHeight:s,charWidth:o}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new R(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let i=0,s=0;;s++){let o=s==e.viewports.length?null:e.viewports[s],n=o?o.from-1:this.length;if(n>i){let r=e.lineBlockAt(n).bottom-e.lineBlockAt(i).top;t.push(tn.replace({widget:new t5(r),block:!0,inclusive:!0,isBlockGap:!0}).range(i,n))}if(!o)break;i=o.to+1}return tn.set(t)}updateDeco(){let t=this.view.state.facet(tV).map((t,e)=>(this.dynamicDecorationMap[e]="function"==typeof t)?t(this.view):t);for(let e=t.length;ee.anchor?-1:1),s;if(!i)return;!e.empty&&(s=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let o=0,n=0,r=0,l=0;for(let h of this.view.state.facet(tN).map(t=>t(this.view)))if(h){let{left:a,right:c,top:d,bottom:u}=h;null!=a&&(o=Math.max(o,a)),null!=c&&(n=Math.max(n,c)),null!=d&&(r=Math.max(r,d)),null!=u&&(l=Math.max(l,u))}let f={left:i.left-o,top:i.top-r,right:i.right+n,bottom:i.bottom+l};!function(t,e,i,s,o,n,r,l){let h=t.ownerDocument,a=h.defaultView||window;for(let c=t;c;)if(1==c.nodeType){let d,u=c==h.body;if(u)d={left:0,right:a.innerWidth,top:0,bottom:a.innerHeight};else{if(c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let f=c.getBoundingClientRect();d={left:f.left,right:f.left+c.clientWidth,top:f.top,bottom:f.top+c.clientHeight}}let p=0,m=0;if("nearest"==o)e.top0&&e.bottom>d.bottom+m&&(m=e.bottom-d.bottom+m+r)):e.bottom>d.bottom&&(m=e.bottom-d.bottom+r,i<0&&e.top-m0&&e.right>d.right+p&&(p=e.right-d.right+p+n)):e.right>d.right&&(p=e.right-d.right+n,i<0&&e.leftMath.abs(w-p)&&(s="nearest"),b&&1>Math.abs(b-m)&&(o="nearest")}}if(u)break;c=c.assignedSlot||c.parentNode}else if(11==c.nodeType)c=c.host;else break}(this.view.scrollDOM,f,e.head0&&i<=0)e=v(t=t.childNodes[e-1]);else{if(1!=t.nodeType||!(e=0))return null;t=t.childNodes[e],e=0}}}class et{constructor(){this.changes=[]}compareRange(t,e){tc(t,e,this.changes)}comparePoint(t,e){tc(t,e,this.changes)}}function ee(t,e){return t.tope.top+1}function ei(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function eo(t,e,i){let s=t.nodeValue.length,o=-1,n=1e9,r=0;for(let l=0;li?c.top-i:i-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&d=(c.left+c.right)/2,f=u;if((K.chrome||K.gecko)&&M(t,l).getBoundingClientRect().left==c.right&&(f=!u),d<=0)return{node:t,offset:l+(f?1:0)};o=l+(f?1:0),n=d}}}return{node:t,offset:o>-1?o:r>0?t.nodeValue.length:0}}function en(t,{x:e,y:i},s,o=-1){var n;let r=t.contentDOM.getBoundingClientRect(),l=r.top+t.viewState.paddingTop,h,{docHeight:a}=t.viewState,c=i-l;if(c<0)return 0;if(c>a)return t.state.doc.length;for(let d=t.defaultLineHeight/2,u=!1;(h=t.elementAtHeight(c)).type!=to.Text;)for(;!((c=o>0?h.bottom+d:h.top-d)>=0)||!(c<=a);){if(u)return s?null:0;u=!0,o=-o}i=l+c;let p=h.from;if(pt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:s?null:er(t,r,h,e,i);let m=t.dom.ownerDocument,g=t.root.elementFromPoint?t.root:m,v=g.elementFromPoint(e,i);v&&!t.contentDOM.contains(v)&&(v=null),!v&&(e=Math.max(r.left+1,Math.min(r.right-1,e)),(v=g.elementFromPoint(e,i))&&!t.contentDOM.contains(v)&&(v=null));let w,b=-1;if(v&&(null===(n=t.docView.nearest(v))||void 0===n?void 0:n.isEditable)!=!1){if(m.caretPositionFromPoint){let y=m.caretPositionFromPoint(e,i);y&&({offsetNode:w,offset:b}=y)}else if(m.caretRangeFromPoint){let x=m.caretRangeFromPoint(e,i);x&&({startContainer:w,startOffset:b}=x,(!t.contentDOM.contains(w)||K.safari&&function(t,e,i){let s;if(3!=t.nodeType||e!=(s=t.nodeValue.length))return!1;for(let o=t.nextSibling;o;o=o.nextSibling)if(1!=o.nodeType||"BR"!=o.nodeName)return!1;return M(t,s-1,s).getBoundingClientRect().left>i}(w,b,e)||K.chrome&&function(t,e,i){if(0!=e)return!1;for(let s=t;;){let o=s.parentNode;if(!o||1!=o.nodeType||o.firstChild!=s)return!1;if(o.classList.contains("cm-line"))break;s=o}return i-(1==t.nodeType?t.getBoundingClientRect():M(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect()).left>5}(w,b,e))&&(w=void 0))}}if(!w||!t.docView.dom.contains(w)){let S=td.find(t.docView,p);if(!S)return c>h.top+h.height/2?h.to:h.from;({node:w,offset:b}=function t(e,i,s){let o,n,r,l,h,a,c,d,u=!1;for(let p=e.firstChild;p;p=p.nextSibling){let m=f(p);for(let g=0;gi?v.left-i:Math.max(0,i-v.right),x=(w=b).top>s?w.top-s:Math.max(0,s-w.bottom);if(0==y&&0==x)return 3==p.nodeType?eo(p,i,s):t(p,i,s);(!h||d>x||d==x&&c>y)&&(h=p,a=b,c=y,d=x,u=!y||(y>0?g0)),0==y?s>b.bottom&&(!r||r.bottomb.top)&&(n=p,l=b):r&&ee(r,b)?r=es(r,b.bottom):l&&ee(l,b)&&(l=ei(l,b.top))}}if(r&&r.bottom>=s?(h=o,a=r):l&&l.top<=s&&(h=n,a=l),!h)return{node:e,offset:0};let S=Math.max(a.left,Math.min(a.right,i));if(3==h.nodeType)return eo(h,S,s);if(u&&"false"!=h.contentEditable)return t(h,S,s);let M=Array.prototype.indexOf.call(e.childNodes,h)+(i>=(a.left+a.right)/2?1:0);return{node:e,offset:M}}(S.dom,e,i))}return t.docView.posFromDOM(w,b)}function er(t,e,i,s,o){let n=Math.round((s-e.left)*t.defaultCharacterWidth);t.lineWrapping&&i.height>1.5*t.defaultLineHeight&&(n+=Math.floor((o-i.top)/t.defaultLineHeight)*t.viewState.heightOracle.lineLength);let r=t.state.sliceDoc(i.from,i.to);return i.from+(0,l.Gz)(r,n,t.state.tabSize)}function el(t,e,i,s){let o=t.state.doc.lineAt(e.head),n=t.bidiSpans(o),r=t.textDirectionAt(o.from);for(let h=e,a=null;;){let c=function(t,e,i,s,o){var n;let r=s.head-t.from,h=-1;if(0==r){if(!o||!t.length)return null;e[0].level!=i&&(r=e[0].side(!1,i),h=0)}else if(r==t.length){if(o)return null;let a=e[e.length-1];a.level!=i&&(r=a.side(!0,i),h=e.length-1)}h<0&&(h=tZ.find(e,r,null!==(n=s.bidiLevel)&&void 0!==n?n:-1,s.assoc));let c=e[h];r==c.side(o,i)&&(r=(c=e[h+=o?1:-1]).side(!o,i));let d=o==(c.dir==i),u=(0,l.cp)(t.text,r,d);if(t1=t.text.slice(Math.min(r,u),Math.max(r,u)),u!=c.side(o,i))return l.jT.cursor(u+t.from,d?-1:1,c.level);let f=h==(o?e.length-1:0)?null:e[h+(o?1:-1)];return f||c.level==i?f&&f.levele(t));for(;;){let o=!1;for(let n of s)n.between(i.from-1,i.from+1,(t,s,n)=>{i.from>t&&i.fromi.from?l.jT.cursor(t,1):l.jT.cursor(s,-1),o=!0)});if(!o)return i}}class ea{constructor(t){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.mouseSelection=null;let e=(e,i)=>{!this.ignoreDuringComposition(i)&&("keydown"==i.type&&this.keydown(t,i)||(this.mustFlushObserver(i)&&t.observer.forceFlush(),this.runCustomHandlers(i.type,t,i)?i.preventDefault():e(t,i)))};for(let i in eg){let s=eg[i];t.contentDOM.addEventListener(i,i=>{em(t,i)&&e(s,i)},ev[i]),this.registeredEvents.push(i)}t.scrollDOM.addEventListener("mousedown",i=>{i.target==t.scrollDOM&&e(eg.mousedown,i)}),K.chrome&&102==K.chrome_version&&t.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?t.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,t.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=t.hasFocus,K.safari&&t.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}ensureHandlers(t,e){var i;let s;for(let o of(this.customHandlers=[],e))if(s=null===(i=o.update(t).spec)||void 0===i?void 0:i.domEventHandlers)for(let n in this.customHandlers.push({plugin:o.value,handlers:s}),s)0>this.registeredEvents.indexOf(n)&&"scroll"!=n&&(this.registeredEvents.push(n),t.contentDOM.addEventListener(n,e=>{em(t,e)&&this.runCustomHandlers(n,t,e)&&e.preventDefault()}))}runCustomHandlers(t,e,i){for(let s of this.customHandlers){let o=s.handlers[t];if(o)try{if(o.call(s.plugin,i,e)||i.defaultPrevented)return!0}catch(n){tA(e.state,n)}}return!1}runScrollHandlers(t,e){for(let i of(this.lastScrollTop=t.scrollDOM.scrollTop,this.lastScrollLeft=t.scrollDOM.scrollLeft,this.customHandlers)){let s=i.handlers.scroll;if(s)try{s.call(i.plugin,e,t)}catch(o){tA(t.state,o)}}}keydown(t,e){let i;return this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),!!(9==e.keyCode&&Date.now()t.keyCode==e.keyCode))&&!e.ctrlKey||ed.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey))&&(this.pendingIOSKey=i||e,setTimeout(()=>this.flushIOSKey(t),250),!0))}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,k(t.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(t){return!!/^key/.test(t.type)&&(this.composing>0||!!(K.safari&&!K.ios&&Date.now()-this.compositionEndedAt<100)&&(this.compositionEndedAt=0,!0))}mustFlushObserver(t){return"keydown"==t.type&&229!=t.keyCode}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}let ec=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],ed="dthko",eu=[16,17,18,20,91,92,224,225];function ef(t){return .7*t+8}class ep{constructor(t,e,i,s){let o,n;this.view=t,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=function(t){let e=t.ownerDocument;for(let i=t.parentNode;i&&i!=e.body;)if(1==i.nodeType){if(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)return i;i=i.assignedSlot||i.parentNode}else if(11==i.nodeType)i=i.host;else break;return null}(t.contentDOM);let r=t.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(l.yy.allowMultipleSelections)&&((o=t.state.facet(tg)).length?o[0](e):K.mac?e.metaKey:e.ctrlKey),this.dragMove=(n=t.state.facet(tv)).length?n[0](e):K.mac?!e.altKey:!e.ctrlKey,this.dragging=!!function(t,e){let{main:i}=t.state.selection;if(i.empty)return!1;let s=c(t.root);if(!s||0==s.rangeCount)return!0;let o=s.getRangeAt(0).getClientRects();for(let n=0;n=e.clientX&&r.top<=e.clientY&&r.bottom>=e.clientY)return!0}return!1}(t,e)&&1==eT(e)&&null,!1===this.dragging&&(e.preventDefault(),this.select(e))}move(t){var e;if(0==t.buttons)return this.destroy();if(!1!==this.dragging)return;this.select(this.lastEvent=t);let i=0,s=0,o=(null===(e=this.scrollParent)||void 0===e?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight};t.clientX<=o.left?i=-ef(o.left-t.clientX):t.clientX>=o.right&&(i=ef(t.clientX-o.right)),t.clientY<=o.top?s=-ef(o.top-t.clientY):t.clientY>=o.bottom&&(s=ef(t.clientY-o.bottom)),this.setScrollSpeed(i,s)}up(t){null==this.dragging&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener("mousemove",this.move),t.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){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)}select(t){let e=this.style.get(t,this.extend,this.multiple);(this.mustSelect||!e.eq(this.view.state.selection)||e.main.assoc!=this.view.state.selection.main.assoc)&&this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}update(t){t.docChanged&&this.dragging&&(this.dragging=this.dragging.map(t.changes)),this.style.update(t)&&setTimeout(()=>this.select(this.lastEvent),20)}}function em(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i=e.target,s;i!=t.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(s=T.get(i))&&s.ignoreEvent(e))return!1;return!0}let eg=Object.create(null),ev=Object.create(null),ew=K.ie&&K.ie_version<15||K.ios&&K.webkit_version<604;function eb(t,e){let{state:i}=t,s,o=1,n=i.toText(e),r=n.lines==i.selection.ranges.length;if(null!=eR&&i.selection.ranges.every(t=>t.empty)&&eR==n.toString()){let h=-1;s=i.changeByRange(t=>{let s=i.doc.lineAt(t.from);if(s.from==h)return{range:t};h=s.from;let a=i.toText((r?n.line(o++).text:e)+i.lineBreak);return{changes:{from:s.from,insert:a},range:l.jT.cursor(t.from+a.length)}})}else s=r?i.changeByRange(t=>{let e=n.line(o++);return{changes:{from:t.from,to:t.to,insert:e.text},range:l.jT.cursor(t.from+e.length)}}):i.replaceSelection(n);t.dispatch(s,{userEvent:"input.paste",scrollIntoView:!0})}function ey(t,e,i,s){if(1==s)return l.jT.cursor(e,i);if(2==s)return function(t,e,i=1){let s=t.charCategorizer(e),o=t.doc.lineAt(e),n=e-o.from;if(0==o.length)return l.jT.cursor(e);0==n?i=1:n==o.length&&(i=-1);let r=n,h=n;i<0?r=(0,l.cp)(o.text,n,!1):h=(0,l.cp)(o.text,n);let a=s(o.text.slice(r,h));for(;r>0;){let c=(0,l.cp)(o.text,r,!1);if(s(o.text.slice(c,r))!=a)break;r=c}for(;h{t.inputState.setSelectionOrigin("select"),27==e.keyCode?t.inputState.lastEscPress=Date.now():0>eu.indexOf(e.keyCode)&&(t.inputState.lastEscPress=0)},eg.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},eg.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},ev.touchstart=ev.touchmove={passive:!0},eg.mousedown=(t,e)=>{let i,s,o;if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let n=null;for(let r of t.state.facet(tw))if(n=r(t,e))break;if(n||0!=e.button||(i=eM(t,e),s=eT(e),o=t.state.selection,n={update(t){t.docChanged&&(i.pos=t.changes.mapPos(i.pos),o=o.map(t.changes))},get(e,n,r){let h=eM(t,e),a=ey(t,h.pos,h.bias,s);if(i.pos!=h.pos&&!n){let c=ey(t,i.pos,i.bias,s),d=Math.min(c.from,a.from),u=Math.max(c.to,a.to);a=d1&&o.ranges.some(t=>t.eq(a))?function(t,e){for(let i=0;;i++)if(t.ranges[i].eq(e))return l.jT.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0))}(o,a):r?o.addRange(a):l.jT.create([a])}}),n){let h=t.root.activeElement!=t.contentDOM;h&&t.observer.ignore(()=>S(t.contentDOM)),t.inputState.startMouseSelection(new ep(t,e,n,h))}};let ex=(t,e)=>t>=e.top&&t<=e.bottom,eS=(t,e,i)=>ex(e,i)&&t>=i.left&&t<=i.right;function eM(t,e){let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:i,bias:function(t,e,i,s){let o=td.find(t.docView,e);if(!o)return 1;let n=e-o.posAtStart;if(0==n)return 1;if(n==o.length)return -1;let r=o.coordsAt(n,-1);if(r&&eS(i,s,r))return -1;let l=o.coordsAt(n,1);return l&&eS(i,s,l)?1:r&&ex(s,r)?-1:1}(t,i,e.clientX,e.clientY)}}let ek=K.ie&&K.ie_version<=11,eC=null,eA=0,eD=0;function eT(t){if(!ek)return t.detail;let e=eC,i=eD;return eC=t,eD=Date.now(),eA=!e||i>Date.now()-400&&2>Math.abs(e.clientX-t.clientX)&&2>Math.abs(e.clientY-t.clientY)?(eA+1)%3:1}function eO(t,e,i,s){if(!i)return;let o=t.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:n}=t.inputState,r=s&&n&&n.dragging&&n.dragMove?{from:n.dragging.from,to:n.dragging.to}:null,l={from:o,insert:i},h=t.state.changes(r?[r,l]:l);t.focus(),t.dispatch({changes:h,selection:{anchor:h.mapPos(o,-1),head:h.mapPos(o,1)},userEvent:r?"move.drop":"input.drop"})}eg.dragstart=(t,e)=>{let{selection:{main:i}}=t.state,{mouseSelection:s}=t.inputState;s&&(s.dragging=i),e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),e.dataTransfer.effectAllowed="copyMove")},eg.drop=(t,e)=>{if(!e.dataTransfer)return;if(t.state.readOnly)return e.preventDefault();let i=e.dataTransfer.files;if(i&&i.length){e.preventDefault();let s=Array(i.length),o=0,n=()=>{++o==i.length&&eO(t,e,s.filter(t=>null!=t).join(t.state.lineBreak),!1)};for(let r=0;r{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(s[r]=l.result),n()},l.readAsText(i[r])}}else eO(t,e,e.dataTransfer.getData("Text"),!0)},eg.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let i=ew?null:e.clipboardData;i?(eb(t,i.getData("text/plain")),e.preventDefault()):function(t){let e=t.dom.parentNode;if(!e)return;let i=e.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.focus(),setTimeout(()=>{t.focus(),i.remove(),eb(t,i.value)},50)}(t)};let eR=null;function eE(t){setTimeout(()=>{t.hasFocus!=t.inputState.notifiedFocused&&t.update([])},10)}eg.copy=eg.cut=(t,e)=>{let{text:i,ranges:s,linewise:o}=function(t){let e=[],i=[],s=!1;for(let o of t.selection.ranges)o.empty||(e.push(t.sliceDoc(o.from,o.to)),i.push(o));if(!e.length){let n=-1;for(let{from:r}of t.selection.ranges){let l=t.doc.lineAt(r);l.number>n&&(e.push(l.text),i.push({from:l.from,to:Math.min(t.doc.length,l.to+1)})),n=l.number}s=!0}return{text:e.join(t.lineBreak),ranges:i,linewise:s}}(t.state);if(!i&&!o)return;eR=o?i:null;let n=ew?null:e.clipboardData;n?(e.preventDefault(),n.clearData(),n.setData("text/plain",i)):function(t,e){let i=t.dom.parentNode;if(!i)return;let s=i.appendChild(document.createElement("textarea"));s.style.cssText="position: fixed; left: -10000px; top: 10px",s.value=e,s.focus(),s.selectionEnd=e.length,s.selectionStart=0,setTimeout(()=>{s.remove(),t.focus()},50)}(t,i),"cut"!=e.type||t.state.readOnly||t.dispatch({changes:s,scrollIntoView:!0,userEvent:"delete.cut"})},eg.focus=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),eE(t)},eg.blur=t=>{t.observer.clearSelectionRange(),eE(t)},eg.compositionstart=eg.compositionupdate=t=>{null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},eg.compositionend=t=>{t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionFirstChange=null,K.chrome&&K.android&&t.observer.flushSoon(),setTimeout(()=>{t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])},50)},eg.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},eg.beforeinput=(t,e)=>{var i;let s;if(K.chrome&&K.android&&(s=ec.find(t=>t.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),"Backspace"==s.key||"Delete"==s.key)){let o=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout(()=>{var e;((null===(e=window.visualViewport)||void 0===e?void 0:e.height)||0)>o+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}};let eB=["pre-wrap","normal","pre-line","break-spaces"];class eL{constructor(t){this.lineWrapping=t,this.doc=l.xv.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let i=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(i+=Math.ceil((e-t-i*this.lineLength*.5)/this.lineLength)),this.lineHeight*i}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return eB.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let i=0;i-1,r=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=n;if(this.lineWrapping=n,this.lineHeight=e,this.charWidth=i,this.lineLength=s,r){this.heightSamples={};for(let l=0;l0}set outdated(t){this.flags=(t?2:0)|-3&this.flags}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>.001&&(t.heightChanged=!0),this.height=e)}replace(t,e,i){return eP.of(i)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,i,s){let o=this;for(let n=s.length-1;n>=0;n--){let{fromA:r,toA:l,fromB:h,toB:a}=s[n],c=o.lineAt(r,eN.ByPosNoHeight,e,0,0),d=c.to>=l?c:o.lineAt(l,eN.ByPosNoHeight,e,0,0);for(a+=d.to-l,l=d.to;n>0&&c.from<=s[n-1].toA;)r=s[n-1].fromA,h=s[n-1].fromB,n--,r2*o){let n=t[e-1];n.break?t.splice(--e,1,n.left,null,n.right):t.splice(--e,1,n.left,n.right),i+=1+n.break,s-=n.size}else if(o>2*s){let r=t[i];r.break?t.splice(i,1,r.left,null,r.right):t.splice(i,1,r.left,r.right),i+=2+r.break,o-=r.size}else break}else if(s=o&&n(this.blockAt(0,i,s,o))}updateHeight(t,e=0,i=!1,s){return s&&s.from<=e&&s.more&&this.setHeight(t,s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ez extends eW{constructor(t,e){super(t,e,to.Text),this.collapsed=0,this.widgetHeight=0}replace(t,e,i){let s=i[0];return 1==i.length&&(s instanceof ez||s instanceof eF&&4&s.flags)&&10>Math.abs(this.length-s.length)?(s instanceof eF?s=new ez(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):eP.of(i)}updateHeight(t,e=0,i=!1,s){return s&&s.from<=e&&s.more?this.setHeight(t,s.heights[s.index++]):(i||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class eF extends eP{constructor(t){super(t,0)}lines(t,e){let i=t.lineAt(e).number,s=t.lineAt(e+this.length).number;return{firstLine:i,lastLine:s,lineHeight:this.height/(s-i+1)}}blockAt(t,e,i,s){let{firstLine:o,lastLine:n,lineHeight:r}=this.lines(e,s),l=Math.max(0,Math.min(n-o,Math.floor((t-i)/r))),{from:h,length:a}=e.line(o+l);return new eH(h,a,i+r*l,r,to.Text)}lineAt(t,e,i,s,o){if(e==eN.ByHeight)return this.blockAt(t,i,s,o);if(e==eN.ByPosNoHeight){let{from:n,to:r}=i.lineAt(t);return new eH(n,r-n,0,0,to.Text)}let{firstLine:l,lineHeight:h}=this.lines(i,o),{from:a,length:c,number:d}=i.lineAt(t);return new eH(a,c,s+h*(d-l),h,to.Text)}forEachLine(t,e,i,s,o,n){let{firstLine:r,lineHeight:l}=this.lines(i,o);for(let h=Math.max(t,o),a=Math.min(o+this.length,e);h<=a;){let c=i.lineAt(h);h==t&&(s+=l*(c.number-r)),n(new eH(c.from,c.length,s,l,to.Text)),s+=l,h=c.to+1}}replace(t,e,i){let s=this.length-e;if(s>0){let o=i[i.length-1];o instanceof eF?i[i.length-1]=new eF(o.length+s):i.push(null,new eF(s-1))}if(t>0){let n=i[0];n instanceof eF?i[0]=new eF(t+n.length):i.unshift(new eF(t-1),null)}return eP.of(i)}decomposeLeft(t,e){e.push(new eF(t-1),null)}decomposeRight(t,e){e.push(null,new eF(this.length-t-1))}updateHeight(t,e=0,i=!1,s){let o=e+this.length;if(s&&s.from<=e+this.length&&s.more){let n=[],r=Math.max(e,s.from),l=-1,h=t.heightChanged;for(s.from>e&&n.push(new eF(s.from-e-1).updateHeight(t,e));r<=o&&s.more;){let a=t.doc.lineAt(r).length;n.length&&n.push(null);let c=s.heights[s.index++];-1==l?l=c:Math.abs(c-l)>=.001&&(l=-2);let d=new ez(a,c);d.outdated=!1,n.push(d),r+=a+1}r<=o&&n.push(null,new eF(o-r).updateHeight(t,r));let u=eP.of(n);return t.heightChanged=h||l<0||Math.abs(u.height-this.height)>=.001||Math.abs(l-this.lines(t.doc,e).lineHeight)>=.001,u}return(i||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class eI extends eP{constructor(t,e,i){super(t.length+e+i.length,t.height+i.height,e|(t.outdated||i.outdated?2:0)),this.left=t,this.right=i,this.size=t.size+i.size}get break(){return 1&this.flags}blockAt(t,e,i,s){let o=i+this.left.height;return tr))return h;let a=e==eN.ByPosNoHeight?eN.ByPosNoHeight:eN.ByPos;return l?h.join(this.right.lineAt(r,a,i,n,r)):this.left.lineAt(r,a,i,s,o).join(h)}forEachLine(t,e,i,s,o,n){let r=s+this.left.height,l=o+this.left.length+this.break;if(this.break)t=l&&this.right.forEachLine(t,e,i,r,l,n);else{let h=this.lineAt(l,eN.ByPos,i,s,o);t=t&&h.from<=e&&n(h),e>h.to&&this.right.forEachLine(h.to+1,e,i,r,l,n)}}replace(t,e,i){let s=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-s,e-s,i));let o=[];t>0&&this.decomposeLeft(t,o);let n=o.length;for(let r of i)o.push(r);if(t>0&&eq(o,n-1),e=++i&&e.push(null),t>i&&this.right.decomposeLeft(t-i,e)}decomposeRight(t,e){let i=this.left.length,s=i+this.break;if(t>=s)return this.right.decomposeRight(t-s,e);t2*e.size||e.size>2*t.size?eP.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)}updateHeight(t,e=0,i=!1,s){let{left:o,right:n}=this,r=e+o.length+this.break,l=null;return(s&&s.from<=e+o.length&&s.more?l=o=o.updateHeight(t,e,i,s):o.updateHeight(t,e,i),s&&s.from<=r+n.length&&s.more?l=n=n.updateHeight(t,r,i,s):n.updateHeight(t,r,i),l)?this.balanced(o,n):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function eq(t,e){let i,s;null==t[e]&&(i=t[e-1])instanceof eF&&(s=t[e+1])instanceof eF&&t.splice(e-1,3,new eF(i.length+1+s.length))}class ej{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let i=Math.min(e,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof ez?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new ez(i-this.pos,-1)),this.writtenTo=i,e>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,i){if(t=5)&&this.addLineDeco(s,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new ez(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let i=new eF(e-t);return this.oracle.doc.lineAt(t).to==e&&(i.flags|=4),i}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof ez)return t;let e=new ez(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine(),t.type!=to.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,t.type!=to.WidgetBefore&&(this.covering=t)}addLineDeco(t,e){let i=this.ensureLine();i.length+=e,i.collapsed+=e,i.widgetHeight=Math.max(i.widgetHeight,t),this.writtenTo=this.pos=this.pos+e}finish(t){let e=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||e instanceof ez||this.isCovered?(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&"visible"!=d.overflow){let u=c.getBoundingClientRect();n=Math.max(n,u.left),r=Math.min(r,u.right),l=Math.max(l,u.top),h=a==t.parentNode?u.bottom:Math.min(h,u.bottom)}a="absolute"==d.position||"fixed"==d.position?c.offsetParent:c.parentNode}else if(11==a.nodeType)a=a.host;else break;return{left:n-i.left,right:Math.max(n,r)-i.left,top:l-(i.top+e),bottom:Math.max(l,h)-(i.top+e)}}function eG(t,e){let i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:e,bottom:i.bottom-(i.top+e)}}class eX{constructor(t,e,i){this.from=t,this.to=e,this.size=i}static same(t,e){if(t.length!=e.length)return!1;for(let i=0;i"function"!=typeof t&&"cm-lineWrapping"==t.class);this.heightOracle=new eL(e),this.stateDeco=t.facet(tV).filter(t=>"function"!=typeof t),this.heightMap=eP.empty().applyChanges(this.stateDeco,l.xv.empty,this.heightOracle.setDoc(t.doc),[new tW(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=tn.set(this.lineGaps.map(t=>t.draw(!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let i=0;i<=1;i++){let s=i?e.head:e.anchor;if(!t.some(({from:t,to:e})=>s>=t&&s<=e)){let{from:o,to:n}=this.lineBlockAt(s);t.push(new eY(o,n))}}this.viewports=t.sort((t,e)=>t.from-e.from),this.scaler=this.heightMap.height<=7e6?eJ:new e0(this.heightOracle.doc,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.state.doc,0,0,t=>{this.viewportLines.push(1==this.scaler.scale?t:e1(t,this.scaler))})}update(t,e=null){var i,s;let o;this.state=t.state;let n=this.stateDeco;this.stateDeco=this.state.facet(tV).filter(t=>"function"!=typeof t);let r=t.changedRanges,h=tW.extendWithRanges(r,(i=this.stateDeco,s=t?t.changes:l.as.empty(this.state.doc.length),o=new eK,l.Xs.compare(n,i,s,o,0),o.changes)),a=this.heightMap.height;this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),h),this.heightMap.height!=a&&(t.flags|=2);let c=h.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.headc.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,e));let d=!t.changes.empty||2&t.flags||c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,this.updateForViewport(),d&&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(tM)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,i=window.getComputedStyle(e),s=this.heightOracle,o=i.whiteSpace;this.defaultTextDirection="rtl"==i.direction?tF.RTL:tF.LTR;let n=this.heightOracle.mustRefreshForWrapping(o),r=n||this.mustMeasureContent||this.contentDOMHeight!=e.clientHeight;this.contentDOMHeight=e.clientHeight,this.mustMeasureContent=!1;let h=0,a=0,c=parseInt(i.paddingTop)||0,d=parseInt(i.paddingBottom)||0;(this.paddingTop!=c||this.paddingBottom!=d)&&(this.paddingTop=c,this.paddingBottom=d,h|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(s.lineWrapping&&(r=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=8);let u=(this.printing?eG:e$)(e,this.paddingTop),f=u.top-this.pixelViewport.top,p=u.bottom-this.pixelViewport.bottom;this.pixelViewport=u;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(r=!0)),!this.inView&&!this.scrollTarget)return 0;let g=e.clientWidth;if((this.contentDOMWidth!=g||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=g,this.editorHeight=t.scrollDOM.clientHeight,h|=8),r){let v=t.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(v)&&(n=!0),n||s.lineWrapping&&Math.abs(g-this.contentDOMWidth)>s.charWidth){let{lineHeight:w,charWidth:b}=t.docView.measureTextSize();(n=w>0&&s.refresh(o,w,b,g/b,v))&&(t.docView.minWidth=0,h|=8)}for(let y of(f>0&&p>0?a=Math.max(f,p):f<0&&p<0&&(a=Math.min(f,p)),s.heightChanged=!1,this.viewports)){let x=y.from==this.viewport.from?v:t.docView.measureVisibleLineHeights(y);this.heightMap=(n?eP.empty().applyChanges(this.stateDeco,l.xv.empty,this.heightOracle,[new tW(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(s,0,n,new eV(y.from,x))}s.heightChanged&&(h|=2)}let S=!this.viewportIsAppropriate(this.viewport,a)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return S&&(this.viewport=this.getViewport(a,this.scrollTarget)),this.updateForViewport(),(2&h||S)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(n?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let i=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),s=this.heightMap,o=this.state.doc,{visibleTop:n,visibleBottom:r}=this,l=new eY(s.lineAt(n-1e3*i,eN.ByHeight,o,0,0).from,s.lineAt(r+(1-i)*1e3,eN.ByHeight,o,0,0).to);if(e){let{head:h}=e.range;if(hl.to){let a=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=s.lineAt(h,eN.ByPos,o,0,0),d;d="center"==e.y?(c.top+c.bottom)/2-a/2:"start"==e.y||"nearest"==e.y&&h=r+Math.max(10,Math.min(i,250)))&&s>n-2e3&&o>1,n=s<<1;if(this.defaultTextDirection!=tF.LTR&&!i)return[];let r=[],h=(s,n,a,c)=>{if(n-ss&&ft.from>=a.from&&t.to<=a.to&&Math.abs(t.from-s)t.frome));if(!p){if(nt.from<=n&&t.to>=n)){let m=e.moveToLineBoundary(l.jT.cursor(n),!1,!0).head;m>s&&(n=m)}p=new eX(s,n,this.gapSize(a,s,n,c))}r.push(p)};for(let a of this.viewportLines){let c,d;if(a.lengtho&&(s.push({from:o,to:t}),n+=t-o),o=e}},20),oa.from&&h(a.from,c,a,u),dt.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];l.Xs.spans(t,this.viewport.from,this.viewport.to,{span(t,i){e.push({from:t,to:i})},point(){}},20);let i=e.length!=this.visibleRanges.length||this.visibleRanges.some((t,i)=>t.from!=e[i].from||t.to!=e[i].to);return this.visibleRanges=e,i?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||e1(this.heightMap.lineAt(t,eN.ByPos,this.state.doc,0,0),this.scaler)}lineBlockAtHeight(t){return e1(this.heightMap.lineAt(this.scaler.fromDOM(t),eN.ByHeight,this.state.doc,0,0),this.scaler)}elementAtHeight(t){return e1(this.heightMap.blockAt(this.scaler.fromDOM(t),this.state.doc,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class eY{constructor(t,e){this.from=t,this.to=e}}function eQ({total:t,ranges:e},i){if(i<=0)return e[0].from;if(i>=1)return e[e.length-1].to;let s=Math.floor(t*i);for(let o=0;;o++){let{from:n,to:r}=e[o],l=r-n;if(s<=l)return n+s;s-=l}}function eZ(t,e){let i=0;for(let{from:s,to:o}of t.ranges){if(e<=o){i+=e-s;break}i+=o-s}return i/t.total}let eJ={toDOM:t=>t,fromDOM:t=>t,scale:1};class e0{constructor(t,e,i){let s=0,o=0,n=0;for(let r of(this.viewports=i.map(({from:i,to:o})=>{let n=e.lineAt(i,eN.ByPos,t,0,0).top,r=e.lineAt(o,eN.ByPos,t,0,0).bottom;return s+=r-n,{from:i,to:o,top:n,bottom:r,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(e.height-s),this.viewports))r.domTop=n+(r.top-o)*this.scale,n=r.domBottom=r.domTop+(r.bottom-r.top),o=r.bottom}toDOM(t){for(let e=0,i=0,s=0;;e++){let o=ee1(t,e)):t.type)}let e2=l.r$.define({combine:t=>t.join(" ")}),e8=l.r$.define({combine:t=>t.indexOf(!0)>-1}),e3=h.V.newName(),e9=h.V.newName(),e5=h.V.newName(),e4={"&light":"."+e9,"&dark":"."+e5};function e6(t,e,i){return new h.V(e,{finish:e=>/&/.test(e)?e.replace(/&\w*/,e=>{if("&"==e)return t;if(!i||!i[e])throw RangeError(`Unsupported selector: ${e}`);return i[e]}):t+" "+e})}let e7=e6("."+e3,{"&.cm-editor":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused .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-focused .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',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"}},e4);class it{constructor(t,e,i,s){this.typeOver=s,this.bounds=null,this.text="";let{impreciseHead:o,impreciseAnchor:n}=t.docView;if(t.state.readOnly&&e>-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,i,0))){let r=o||n?[]:function(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:i,anchorOffset:s,focusNode:o,focusOffset:n}=t.observer.selectionRange;return i&&(e.push(new t3(i,s)),(o!=i||n!=s)&&e.push(new t3(o,n))),e}(t),h=new t2(r,t.state);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=function(t,e){if(0==t.length)return null;let i=t[0].pos,s=2==t.length?t[1].pos:i;return i>-1&&s>-1?l.jT.single(i+e,s+e):null}(r,this.bounds.from)}else{let a=t.observer.selectionRange,c=o&&o.node==a.focusNode&&o.offset==a.focusOffset||!d(t.contentDOM,a.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(a.focusNode,a.focusOffset),u=n&&n.node==a.anchorNode&&n.offset==a.anchorOffset||!d(t.contentDOM,a.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(a.anchorNode,a.anchorOffset);this.newSel=l.jT.single(u,c)}}}function ie(t,e){let i;let{newSel:s}=e,o=t.state.selection.main;if(e.bounds){let{from:n,to:r}=e.bounds,h=o.from,a=null;(8===t.inputState.lastKeyCode&&t.inputState.lastKeyTime>Date.now()-100||K.android&&e.text.length0&&l>0&&t.charCodeAt(r-1)==e.charCodeAt(l-1);)r--,l--;if("end"==s){let h=Math.max(0,n-Math.min(r,l));i-=r+h-n}if(r=r?n-i:0;n-=a,l=n+(l-r),r=n}else if(l=l?n-i:0;n-=c,r=n+(r-l),l=n}return{from:n,toA:r,toB:l}}(t.state.doc.sliceString(n,r,"￿"),e.text,h-n,a);c&&(K.chrome&&13==t.inputState.lastKeyCode&&c.toB==c.from+2&&"￿￿"==e.text.slice(c.from,c.toB)&&c.toB--,i={from:n+c.from,to:n+c.toA,insert:l.xv.of(e.text.slice(c.from,c.toB).split("￿"))})}else s&&(!t.hasFocus||!t.state.facet(tD)||s.main.eq(o))&&(s=null);if(!i&&!s)return!1;if(!i&&e.typeOver&&!o.empty&&s&&s.main.empty?i={from:o.from,to:o.to,insert:t.state.doc.slice(o.from,o.to)}:i&&i.from>=o.from&&i.to<=o.to&&(i.from!=o.from||i.to!=o.to)&&o.to-o.from-(i.to-i.from)<=4?i={from:o.from,to:o.to,insert:t.state.doc.slice(o.from,i.from).append(i.insert).append(t.state.doc.slice(i.to,o.to))}:(K.mac||K.android)&&i&&i.from==i.to&&i.from==o.head-1&&/^\. ?$/.test(i.insert.toString())?(s&&2==i.insert.length&&(s=l.jT.single(s.main.anchor-1,s.main.head-1)),i={from:o.from,to:o.to,insert:l.xv.of([" "])}):K.chrome&&i&&i.from==i.to&&i.from==o.head&&"\n "==i.insert.toString()&&t.lineWrapping&&(s&&(s=l.jT.single(s.main.anchor-1,s.main.head-1)),i={from:o.from,to:o.to,insert:l.xv.of([" "])}),i){let d,u=t.state;if(K.ios&&t.inputState.flushIOSKey(t)||K.android&&(i.from==o.from&&i.to==o.to&&1==i.insert.length&&2==i.insert.lines&&k(t.contentDOM,"Enter",13)||i.from==o.from-1&&i.to==o.to&&0==i.insert.length&&k(t.contentDOM,"Backspace",8)||i.from==o.from&&i.to==o.to+1&&0==i.insert.length&&k(t.contentDOM,"Delete",46)))return!0;let f=i.insert.toString();if(t.state.facet(tx).some(e=>e(t,i.from,i.to,f)))return!0;if(t.inputState.composing>=0&&t.inputState.composing++,i.from>=o.from&&i.to<=o.to&&i.to-i.from>=(o.to-o.from)/3&&(!s||s.main.empty&&s.main.from==i.from+i.insert.length)&&t.inputState.composing<0){let p=o.fromi.to?u.sliceDoc(i.to,o.to):"";d=u.replaceSelection(t.state.toText(p+i.insert.sliceString(0,void 0,t.state.lineBreak)+m))}else{let g=u.changes(i),v=s&&!u.selection.main.eq(s.main)&&s.main.to<=g.newLength?s.main:void 0;if(u.selection.ranges.length>1&&t.inputState.composing>=0&&i.to<=o.to&&i.to>=o.to-10){let w=t.state.sliceDoc(i.from,i.to),b=t4(t)||t.state.doc.lineAt(o.head),y=o.to-i.to,x=o.to-o.from;d=u.changeByRange(e=>{if(e.from==o.from&&e.to==o.to)return{changes:g,range:v||e.map(g)};let s=e.to-y,n=s-w.length;if(e.to-e.from!=x||t.state.sliceDoc(n,s)!=w||b&&e.to>=b.from&&e.from<=b.to)return{range:e};let r=u.changes({from:n,to:s,insert:i.insert}),h=e.to-o.to;return{changes:r,range:v?l.jT.range(Math.max(0,v.anchor+h),Math.max(0,v.head+h)):e.map(r)}})}else d={changes:g,selection:v&&u.selection.replaceRange(v)}}let S="input.type";return t.composing&&(S+=".compose",t.inputState.compositionFirstChange&&(S+=".start",t.inputState.compositionFirstChange=!1)),t.dispatch(d,{scrollIntoView:!0,userEvent:S}),!0}if(!s||s.main.eq(o))return!1;{let M=!1,C="select";return t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(M=!0),C=t.inputState.lastSelectionOrigin),t.dispatch({selection:s,scrollIntoView:M,userEvent:C}),!0}}let ii={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},is=K.ie&&K.ie_version<=11;class io{constructor(t){this.view=t,this.active=!1,this.selectionRange=new y,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let i of e)this.queue.push(i);(K.ie&&K.ie_version<=11||K.ios&&t.composing)&&e.some(t=>"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length)?this.flushSoon():this.flush()}),is&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var t;(null===(t=this.view.docView)||void 0===t?void 0:t.lastUpdate)this.view.requestMeasure()),this.resizeContent.observe(t.contentDOM)),this.addWindowListeners(this.win=t.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runScrollHandlers(this.view,t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,i)=>e!=t[i]))){for(let e of(this.gapIntersection.disconnect(),t))this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(tD)?i.root.activeElement!=this.dom:!u(i.dom,s))return;let o=s.anchorNode&&i.docView.nearest(s.anchorNode);if(o&&o.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(K.ie&&K.ie_version<=11||K.android&&K.chrome)&&!i.state.selection.main.empty&&s.focusNode&&p(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=K.safari&&11==t.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t){let e=null;function i(t){t.preventDefault(),t.stopImmediatePropagation(),e=t.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",i,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",i,!0),!e)return null;let s=e.startContainer,o=e.startOffset,n=e.endContainer,r=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return p(l.node,l.offset,n,r)&&([s,o,n,r]=[n,r,s,o]),{anchorNode:s,anchorOffset:o,focusNode:n,focusOffset:r}}(this.view)||c(t.root);if(!e||this.selectionRange.eq(e))return!1;let i=u(this.dom,e);return i&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let t=this.delayedAndroidKey;t&&(this.clearDelayedAndroidKey(),!this.flush()&&t.force&&k(this.dom,t.key,t.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}this.delayedAndroidKey&&"Enter"!=t||(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}processRecords(){let t=this.queue;for(let e of this.observer.takeRecords())t.push(e);t.length&&(this.queue=[]);let i=-1,s=-1,o=!1;for(let n of t){let r=this.readMutation(n);r&&(r.typeOver&&(o=!0),-1==i?{from:i,to:s}=r:(i=Math.min(r.from,i),s=Math.max(r.to,s)))}return{from:i,to:s,typeOver:o}}readChange(){let{from:t,to:e,typeOver:i}=this.processRecords(),s=this.selectionChanged&&u(this.dom,this.selectionRange);return t<0&&!s?null:(t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new it(this.view,t,e,i))}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return!1;let i=this.view.state,s=ie(this.view,e);return this.view.state==i&&this.view.update([]),s}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty("attributes"==t.type),"attributes"==t.type&&(e.dirty|=4),"childList"==t.type){let i=ir(e,t.previousSibling||t.target.previousSibling,-1),s=ir(e,t.nextSibling||t.target.nextSibling,1);return{from:i?e.posAfter(i):e.posAtStart,to:s?e.posBefore(s):e.posAtEnd,typeOver:!1}}return"characterData"==t.type?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener("resize",this.onResize),t.addEventListener("beforeprint",this.onPrint),t.addEventListener("scroll",this.onScroll),t.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener("scroll",this.onScroll),t.removeEventListener("resize",this.onResize),t.removeEventListener("beforeprint",this.onPrint),t.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var t,e,i,s;for(let o of(this.stop(),null===(t=this.intersection)||void 0===t||t.disconnect(),null===(e=this.gapIntersection)||void 0===e||e.disconnect(),null===(i=this.resizeScroll)||void 0===i||i.disconnect(),null===(s=this.resizeContent)||void 0===s||s.disconnect(),this.scrollTargets))o.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function ir(t,e,i){for(;e;){let s=T.get(e);if(s&&s.parent==t)return s;let o=e.parentNode;e=o!=t.dom?o:i>0?e.nextSibling:e.previousSibling}return null}class il{constructor(t={}){for(let e of(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.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=t.dispatch||(t=>this.update([t])),this.dispatch=this.dispatch.bind(this),this._root=t.root||function(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}(t.parent)||document,this.viewState=new eU(t.state||l.yy.create(t)),this.plugins=this.state.facet(tO).map(t=>new tE(t)),this.plugins))e.update(this);this.observer=new io(this),this.inputState=new ea(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new t9(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),t.parent&&t.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...t){this._dispatch(1==t.length&&t[0]instanceof l.YW?t[0]:this.state.update(...t))}update(t){if(0!=this.updateState)throw Error("Calls to EditorView.update are not allowed while an update is in progress");let e=!1,i=!1,s,o=this.state;for(let n of t){if(n.startState!=o)throw RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=n.state}if(this.destroyed){this.viewState.state=o;return}let r=this.observer.delayedAndroidKey,h=null;if(r?(this.observer.clearDelayedAndroidKey(),((h=this.observer.readChange())&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(h=null)):this.observer.clear(),o.facet(l.yy.phrases)!=this.state.facet(l.yy.phrases))return this.setState(o);s=tz.create(this,o,t);let a=this.viewState.scrollTarget;try{for(let c of(this.updateState=2,t)){if(a&&(a=a.map(c.changes)),c.scrollIntoView){let{main:d}=c.state.selection;a=new tk(d.empty?d:l.jT.cursor(d.head,d.head>d.anchor?-1:1))}for(let u of c.effects)u.is(tC)&&(a=u.value)}this.viewState.update(s,a),this.bidiCache=ic.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),e=this.docView.update(s),this.state.facet(tP)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(t=>t.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(e2)!=s.state.facet(e2)&&(this.viewState.mustMeasureContent=!0),(e||i||a||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!s.empty)for(let f of this.state.facet(ty))f(s);h&&!ie(this,h)&&r.force&&k(this.contentDOM,r.key,r.keyCode)}setState(t){if(0!=this.updateState)throw Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let e=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);for(let s of(this.viewState=new eU(t),this.plugins=t.facet(tO).map(t=>new tE(t)),this.pluginMap.clear(),this.plugins))s.update(this);this.docView=new t9(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(tO),i=t.state.facet(tO);if(e!=i){let s=[];for(let o of i){let n=e.indexOf(o);if(n<0)s.push(new tE(o));else{let r=this.plugins[n];r.mustUpdate=t,s.push(r)}}for(let l of this.plugins)l.mustUpdate!=t&&l.destroy(this);this.plugins=s,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let h of this.plugins)h.mustUpdate=t;for(let a=0;a-1&&cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,{scrollHeight:i,scrollTop:s,clientHeight:o}=this.scrollDOM,n=s>i-o-4?i:s;try{for(let r=0;;r++){this.updateState=1;let l=this.viewport,h=this.viewState.lineBlockAtHeight(n),a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(r>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];4&a||([this.measureRequests,c]=[c,this.measureRequests]);let d=c.map(t=>{try{return t.read(this)}catch(e){return tA(this.state,e),ia}}),u=tz.create(this,this.state,[]),f=!1,p=!1;u.flags|=a,e?e.flags|=a:e=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),f=this.docView.update(u));for(let m=0;m1||w<-1)&&(this.scrollDOM.scrollTop+=w,p=!0)}}if(f&&this.docView.updateSelection(!0),this.viewport.from==l.from&&this.viewport.to==l.to&&!p&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let b of this.state.facet(ty))b(e)}get themeClasses(){return e3+" "+(this.state.facet(e8)?e5:e9)+" "+this.state.facet(e2)}updateAttrs(){let t=id(this,tB,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),e={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(tD)?"true":"false",class:"cm-content",style:`${K.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(e["aria-readonly"]="true"),id(this,tL,e);let i=this.observer.ignore(()=>{let i=ti(this.contentDOM,this.contentAttrs,e),s=ti(this.dom,this.editorAttrs,t);return i||s});return this.editorAttrs=t,this.contentAttrs=e,i}showAnnouncements(t){let e=!0;for(let i of t)for(let s of i.effects)s.is(il.announce)&&(e&&(this.announceDOM.textContent=""),e=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=s.value)}mountStyles(){this.styleModules=this.state.facet(tP),h.V.mount(this.root,this.styleModules.concat(e7).reverse())}readMeasured(){if(2==this.updateState)throw Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(null!=t.key){for(let e=0;ee.spec==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,i){return eh(this,t,el(this,t,e,i))}moveByGroup(t,e){return eh(this,t,el(this,t,e,e=>{var i;let s,o;return i=t.head,o=(s=this.state.charCategorizer(i))(e),t=>{let e=s(t);return o==l.D0.Space&&(o=e),o==e}}))}moveToLineBoundary(t,e,i=!0){return function(t,e,i,s){let o=t.state.doc.lineAt(e.head),n=s&&t.lineWrapping?t.coordsAtPos(e.assoc<0&&e.head>o.from?e.head-1:e.head):null;if(n){let r=t.dom.getBoundingClientRect(),h=t.textDirectionAt(o.from),a=t.posAtCoords({x:i==(h==tF.LTR)?r.right-1:r.left+1,y:(n.top+n.bottom)/2});if(null!=a)return l.jT.cursor(a,i?-1:1)}let c=td.find(t.docView,e.head),d=c?i?c.posAtEnd:c.posAtStart:i?o.to:o.from;return l.jT.cursor(d,i?-1:1)}(this,t,e,i)}moveVertically(t,e,i){return eh(this,t,function(t,e,i,s){let o=e.head,n=i?1:-1;if(o==(i?t.state.doc.length:0))return l.jT.cursor(o,e.assoc);let r=e.goalColumn,h,a=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(o),d=t.documentTop;if(c)null==r&&(r=c.left-a.left),h=n<0?c.top:c.bottom;else{let u=t.viewState.lineBlockAt(o);null==r&&(r=Math.min(a.right-a.left,t.defaultCharacterWidth*(o-u.from))),h=(n<0?u.top:u.bottom)+d}let f=a.left+r,p=null!=s?s:t.defaultLineHeight>>1;for(let m=0;;m+=10){let g=h+(p+m)*n,v=en(t,{x:f,y:g},!1,n);if(ga.bottom||(n<0?vo))return l.jT.cursor(v,e.assoc,void 0,r)}}(this,t,e,i))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),en(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let i=this.docView.coordsAt(t,e);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(t),o=this.bidiSpans(s);return b(i,o[tZ.find(o,t-s.from,-1,e)].dir==tF.LTR==e>0)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(tS)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>ih)return t0(t.length);let e=this.textDirectionAt(t.from);for(let i of this.bidiCache)if(i.from==t.from&&i.dir==e)return i.order;let s=function(t,e){let i=t.length,s=e==tI?1:2,o=e==tI?2:1;if(!t||1==s&&!tQ.test(t))return t0(i);for(let n=0,r=s,l=s;n=0;M-=3)if(tX[M+1]==-x){let k=tX[M+2],C=2&k?s:4&k?1&k?o:s:0;C&&(tJ[v]=tJ[tX[M]]=C),w=M;break}}else if(189==tX.length)break;else tX[w++]=v,tX[w++]=y,tX[w++]=b}else if(2==(S=tJ[v])||1==S){let A=S==s;b=A?0:1;for(let D=w-3;D>=0;D-=3){let T=tX[D+2];if(2&T)break;if(A)tX[D+2]|=2;else{if(4&T)break;tX[D+2]|=4}}}for(let O=0;ON;){let z=W,F=2!=tJ[--W];for(;W>N&&F==(2!=tJ[W-1]);)W--;V.push(new tZ(W,z,F?2:1))}else V.push(new tZ(N,H,0))}else for(let I=0;IDate.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{S(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((9==t.nodeType?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return tC.of(new tk("number"==typeof t?l.jT.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}static domEventHandlers(t){return tR.define(()=>({}),{eventHandlers:t})}static theme(t,e){let i=h.V.newName(),s=[e2.of(i),tP.of(e6(`.${i}`,t))];return e&&e.dark&&s.push(e8.of(!0)),s}static baseTheme(t){return l.Wl.lowest(tP.of(e6("."+e3,t,e4)))}static findFromDOM(t){var e;let i=t.querySelector(".cm-content"),s=i&&T.get(i)||T.get(t);return(null===(e=null==s?void 0:s.rootView)||void 0===e?void 0:e.view)||null}}il.styleModule=tP,il.inputHandler=tx,il.perLineTextDirection=tS,il.exceptionSink=tb,il.updateListener=ty,il.editable=tD,il.mouseSelectionStyle=tw,il.dragMovesSelection=tv,il.clickAddsSelectionRange=tg,il.decorations=tV,il.atomicRanges=tH,il.scrollMargins=tN,il.darkTheme=e8,il.contentAttributes=tL,il.editorAttributes=tB,il.lineWrapping=il.contentAttributes.of({class:"cm-lineWrapping"}),il.announce=l.Py.define();let ih=4096,ia={};class ic{constructor(t,e,i,s){this.from=t,this.to=e,this.dir=i,this.order=s}static update(t,e){if(e.empty)return t;let i=[],s=t.length?t[t.length-1].dir:tF.LTR;for(let o=Math.max(0,t.length-10);o=0;o--){let n=s[o],r="function"==typeof n?n(t):n;r&&tt(r,i)}return i}let iu=K.mac?"mac":K.windows?"win":K.linux?"linux":"key";function ip(t,e,i){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),!1!==i&&e.shiftKey&&(t="Shift-"+t),t}let im=l.Wl.default(il.domEventHandlers({keydown:(t,e)=>ix(iw(e.state),t,e,"editor")})),ig=l.r$.define({enables:im}),iv=new WeakMap;function iw(t){let e=t.facet(ig),i=iv.get(e);return i||iv.set(e,i=function(t,e=iu){let i=Object.create(null),s=Object.create(null),o=(t,e)=>{let i=s[t];if(null==i)s[t]=e;else if(i!=e)throw Error("Key binding "+t+" is used both as a regular binding and as a multi-stroke prefix")},n=(t,s,n,r)=>{var l,h;let a=i[t]||(i[t]=Object.create(null)),c=s.split(/ (?!$)/).map(t=>(function(t,e){let i,s,o,n;let r=t.split(/-(?!$)/),l=r[r.length-1];"Space"==l&&(l=" ");for(let h=0;h{let i=iy={view:e,prefix:u,scope:t};return setTimeout(()=>{iy==i&&(iy=null)},4e3),!0}]})}let f=c.join(" ");o(f,!1);let p=a[f]||(a[f]={preventDefault:!1,run:(null===(h=null===(l=a._any)||void 0===l?void 0:l.run)||void 0===h?void 0:h.slice())||[]});n&&p.run.push(n),r&&(p.preventDefault=!0)};for(let r of t){let l=r.scope?r.scope.split(" "):["editor"];if(r.any)for(let h of l){let a=i[h]||(i[h]=Object.create(null));for(let c in a._any||(a._any={preventDefault:!1,run:[]}),a)a[c].run.push(r.any)}let d=r[e]||r.key;if(d)for(let u of l)n(u,d,r.run,r.preventDefault),r.shift&&n(u,"Shift-"+d,r.shift,r.preventDefault)}return i}(e.reduce((t,e)=>t.concat(e),[]))),i}function ib(t,e,i){return ix(iw(t.state),e,t,i)}let iy=null;function ix(t,e,i,s){let o=(0,a.YG)(e),n=(0,l.gm)(o,0),r=(0,l.nZ)(n)==o.length&&" "!=o,h="",c=!1;iy&&iy.view==i&&iy.scope==s&&(h=iy.prefix+" ",(c=0>eu.indexOf(e.keyCode))&&(iy=null));let d=new Set,u=t=>{if(t){for(let s of t.run)if(!d.has(s)&&(d.add(s),s(i,e)))return!0;t.preventDefault&&(c=!0)}return!1},f=t[s],p,m;if(f){if(u(f[h+ip(o,e,!r)]))return!0;if(r&&(e.altKey||e.metaKey||e.ctrlKey)&&(p=a.ue[e.keyCode])&&p!=o){if(u(f[h+ip(p,e,!0)])||e.shiftKey&&(m=a.uY[e.keyCode])!=o&&m!=p&&u(f[h+ip(m,e,!1)]))return!0}else if(r&&e.shiftKey&&u(f[h+ip(o,e,!0)]))return!0;if(u(f._any))return!0}return c}class iS{constructor(t,e,i,s,o){this.className=t,this.left=e,this.top=i,this.width=s,this.height=o}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className==this.className&&(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",null!=this.width&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,i){if(!i.empty)return function(t,e,i){if(i.to<=t.viewport.from||i.from>=t.viewport.to)return[];let s=Math.max(i.from,t.viewport.from),o=Math.min(i.to,t.viewport.to),n=t.textDirection==tF.LTR,r=t.contentDOM,l=r.getBoundingClientRect(),h=iM(t),a=window.getComputedStyle(r.firstChild),c=l.left+parseInt(a.paddingLeft)+Math.min(0,parseInt(a.textIndent)),d=l.right-parseInt(a.paddingRight),u=iC(t,s),f=iC(t,o),p=u.type==to.Text?u:null,m=f.type==to.Text?f:null;if(t.lineWrapping&&(p&&(p=ik(t,s,p)),m&&(m=ik(t,o,m))),p&&m&&p.from==m.from)return y(x(i.from,i.to,p));{let g=p?x(i.from,null,p):S(u,!1),v=m?x(null,i.to,m):S(f,!0),w=[];return(p||u).to<(m||f).from-1?w.push(b(c,g.bottom,d,v.top)):g.bottoma&&f.from=m)break;b>p&&h(Math.max(w,p),null==e&&w<=a,Math.min(b,m),null==i&&b>=u,v.dir)}if((p=g.to+1)>=m)break}return 0==l.length&&h(a,null==e,u,null==i,t.textDirection),{top:o,bottom:r,horizontal:l}}function S(t,e){let i=l.top+(e?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}(t,e,i);{let s=t.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let o=iM(t);return[new iS(e,s.left-o.left,s.top-o.top,null,s.bottom-s.top)]}}}function iM(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==tF.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function ik(t,e,i){let s=l.jT.cursor(e);return{from:Math.max(i.from,t.moveToLineBoundary(s,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(s,!0,!0).from),type:to.Text}}function iC(t,e){let i=t.lineBlockAt(e);if(Array.isArray(i.type)){for(let s of i.type)if(s.to>e||s.to==e&&(s.to==i.to||s.type==to.Text))return s}return i}class iA{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),e.above&&this.dom.classList.add("cm-layer-above"),e.class&&this.dom.classList.add(e.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(iD)!=t.state.facet(iD)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&t.view.requestMeasure(this.measureReq)}setOrder(t){let e=0,i=t.facet(iD);for(;e{var i;return i=this.drawn[e],!(t.constructor==i.constructor&&t.eq(i))})){let e=this.dom.firstChild,i=0;for(let s of t)s.update&&e&&s.constructor&&this.drawn[i].constructor&&s.update(e,this.drawn[i])?(e=e.nextSibling,i++):this.dom.insertBefore(s.draw(),e);for(;e;){let o=e.nextSibling;e.remove(),e=o}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}let iD=l.r$.define();function iT(t){return[tR.define(e=>new iA(e,t)),iD.of(t)]}let iO=!K.ios,iR=l.r$.define({combine:t=>(0,l.BO)(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})});function iE(t={}){return[iR.of(t),iL,iH,iP,tM.of(!0)]}function iB(t){return t.startState.facet(iR)!=t.startState.facet(iR)}let iL=iT({above:!0,markers(t){let{state:e}=t,i=e.facet(iR),s=[];for(let o of e.selection.ranges){let n=o==e.selection.main;if(o.empty?!n||iO:i.drawRangeCursor){let r=n?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",h=o.empty?o:l.jT.cursor(o.head,o.head>o.anchor?-1:1);for(let a of iS.forRange(t,r,h))s.push(a)}}return s},update(t,e){t.transactions.some(t=>t.scrollIntoView)&&(e.style.animationName="cm-blink"==e.style.animationName?"cm-blink2":"cm-blink");let i=iB(t);return i&&iV(t.state,e),t.docChanged||t.selectionSet||i},mount(t,e){iV(e.state,t)},class:"cm-cursorLayer"});function iV(t,e){e.style.animationDuration=t.facet(iR).cursorBlinkRate+"ms"}let iH=iT({above:!1,markers:t=>t.state.selection.ranges.map(e=>e.empty?[]:iS.forRange(t,"cm-selectionBackground",e)).reduce((t,e)=>t.concat(e)),update:(t,e)=>t.docChanged||t.selectionSet||t.viewportChanged||iB(t),class:"cm-selectionLayer"}),iN={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};iO&&(iN[".cm-line"].caretColor="transparent !important");let iP=l.Wl.highest(il.theme(iN)),iW=l.Py.define({map:(t,e)=>null==t?null:e.mapPos(t)}),iz=l.QQ.define({create:()=>null,update:(t,e)=>(null!=t&&(t=e.changes.mapPos(t)),e.effects.reduce((t,e)=>e.is(iW)?e.value:t,t))}),iF=tR.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let i=t.state.field(iz);null==i?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(iz)!=i||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let t=this.view.state.field(iz),e=null!=t&&this.view.coordsAtPos(t);if(!e)return null;let i=this.view.scrollDOM.getBoundingClientRect();return{left:e.left-i.left+this.view.scrollDOM.scrollLeft,top:e.top-i.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}}drawCursor(t){this.cursor&&(t?(this.cursor.style.left=t.left+"px",this.cursor.style.top=t.top+"px",this.cursor.style.height=t.height+"px"):this.cursor.style.left="-100000px")}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(iz)!=t&&this.view.dispatch({effects:iW.of(t)})}},{eventHandlers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){t.target!=this.view.contentDOM&&this.view.contentDOM.contains(t.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function iI(){return[iz,iF]}function iq(t,e,i,s,o){e.lastIndex=0;for(let n=t.iterRange(i,s),r=i,l;!n.next().done;r+=n.value.length)if(!n.lineBreak)for(;l=e.exec(n.value);)o(r+l.index,l)}class ij{constructor(t){let{regexp:e,decoration:i,decorate:s,boundary:o,maxLength:n=1e3}=t;if(!e.global)throw RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=e,s)this.addMatch=(t,e,i,o)=>s(o,i,i+t[0].length,t,e);else if("function"==typeof i)this.addMatch=(t,e,s,o)=>{let n=i(t,e,s);n&&o(s,s+t[0].length,n)};else if(i)this.addMatch=(t,e,s,o)=>o(s,s+t[0].length,i);else throw RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=n}createDeco(t){let e=new l.f_,i=e.add.bind(e);for(let{from:s,to:o}of function(t,e){let i=t.visibleRanges;if(1==i.length&&i[0].from==t.viewport.from&&i[0].to==t.viewport.to)return i;let s=[];for(let{from:o,to:n}of i)o=Math.max(t.state.doc.lineAt(o).from,o-e),n=Math.min(t.state.doc.lineAt(n).to,n+e),s.length&&s[s.length-1].to>=o?s[s.length-1].to=n:s.push({from:o,to:n});return s}(t,this.maxLength))iq(t.state.doc,this.regexp,s,o,(e,s)=>this.addMatch(s,t,e,i));return e.finish()}updateDeco(t,e){let i=1e9,s=-1;return(t.docChanged&&t.changes.iterChanges((e,o,n,r)=>{r>t.view.viewport.from&&n1e3)?this.createDeco(t.view):s>-1?this.updateRange(t.view,e.map(t.changes),i,s):e}updateRange(t,e,i,s){for(let o of t.visibleRanges){let n=Math.max(o.from,i),r=Math.min(o.to,s);if(r>n){let l=t.state.doc.lineAt(n),h=l.tol.from;n--)if(this.boundary.test(l.text[n-1-l.from])){a=n;break}for(;rd.push(i.range(t,e));if(l==h)for(this.regexp.lastIndex=a-l.from;(u=this.regexp.exec(l.text))&&u.indexthis.addMatch(i,t,e,f));e=e.update({filterFrom:a,filterTo:c,filter:(t,e)=>tc,add:d})}}return e}}let iK=null!=/x/.unicode?"gu":"g",i$=RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]",iK),iG={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"},iX=null,i_=l.r$.define({combine(t){let e=(0,l.BO)(t,{render:null,specialChars:i$,addSpecialChars:null});return(e.replaceTabs=!function(){var t;if(null==iX&&"undefined"!=typeof document&&document.body){let e=document.body.style;iX=(null!==(t=e.tabSize)&&void 0!==t?t:e.MozTabSize)!=null}return iX||!1}())&&(e.specialChars=RegExp(" |"+e.specialChars.source,iK)),e.addSpecialChars&&(e.specialChars=RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,iK)),e}});function iU(t={}){return[i_.of(t),iY||(iY=tR.fromClass(class{constructor(t){this.view=t,this.decorations=tn.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(i_)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new ij({regexp:t.specialChars,decoration:(e,i,s)=>{let{doc:o}=i.state,n=(0,l.gm)(e[0],0);if(9==n){let r=o.lineAt(s),h=i.state.tabSize,a=(0,l.IS)(r.text,h,s-r.from);return tn.replace({widget:new iZ((h-a%h)*this.view.defaultCharacterWidth)})}return this.decorationCache[n]||(this.decorationCache[n]=tn.replace({widget:new iQ(t,n)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(i_);t.startState.facet(i_)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))]}let iY=null;class iQ extends ts{constructor(t,e){super(),this.options=t,this.code=e}eq(t){return t.code==this.code}toDOM(t){var e;let i=(e=this.code)>=32?"•":10==e?"␤":String.fromCharCode(9216+e),s=t.state.phrase("Control character")+" "+(iG[this.code]||"0x"+this.code.toString(16)),o=this.options.render&&this.options.render(this.code,s,i);if(o)return o;let n=document.createElement("span");return n.textContent=i,n.title=s,n.setAttribute("aria-label",s),n.className="cm-specialChar",n}ignoreEvent(){return!1}}class iZ extends ts{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent=" ",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}function iJ(){return i1}let i0=tn.line({class:"cm-activeLine"}),i1=tR.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,i=[];for(let s of t.state.selection.ranges){let o=t.lineBlockAt(s.head);o.from>e&&(i.push(i0.range(o.from)),e=o.from)}return tn.set(i)}},{decorations:t=>t.decorations});class i2 extends ts{constructor(t){super(),this.content=t}toDOM(){let 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}ignoreEvent(){return!1}}function i8(t){return tR.fromClass(class{constructor(e){this.view=e,this.placeholder=tn.set([tn.widget({widget:new i2(t),side:1}).range(0)])}get decorations(){return this.view.state.doc.length?tn.none:this.placeholder}},{decorations:t=>t.decorations})}function i3(t,e){var i;let s,o=t.posAtCoords({x:e.clientX,y:e.clientY},!1),n=t.state.doc.lineAt(o),r=o-n.from,h=r>2e3?-1:r==n.length?(i=e.clientX,(s=t.coordsAtPos(t.viewport.from))?Math.round(Math.abs((s.left-i)/t.defaultCharacterWidth)):-1):(0,l.IS)(n.text,t.state.tabSize,o-n.from);return{line:n.number,col:h,off:r}}function i9(t){let e=(null==t?void 0:t.eventFilter)||(t=>t.altKey&&0==t.button);return il.mouseSelectionStyle.of((t,i)=>{let s,o;return e(i)?(s=i3(t,i),o=t.state.selection,s?{update(t){if(t.docChanged){let e=t.changes.mapPos(t.startState.doc.line(s.line).from),i=t.state.doc.lineAt(e);s={line:i.number,col:s.col,off:Math.min(s.off,i.length)},o=o.map(t.changes)}},get(e,i,n){let r=i3(t,e);if(!r)return o;let h=function(t,e,i){let s=Math.min(e.line,i.line),o=Math.max(e.line,i.line),n=[];if(e.off>2e3||i.off>2e3||e.col<0||i.col<0){let r=Math.min(e.off,i.off),h=Math.max(e.off,i.off);for(let a=s;a<=o;a++){let c=t.doc.line(a);c.length<=h&&n.push(l.jT.range(c.from+r,c.to+h))}}else{let d=Math.min(e.col,i.col),u=Math.max(e.col,i.col);for(let f=s;f<=o;f++){let p=t.doc.line(f),m=(0,l.Gz)(p.text,d,t.tabSize,!0);if(m<0)n.push(l.jT.cursor(p.to));else{let g=(0,l.Gz)(p.text,u,t.tabSize);n.push(l.jT.range(p.from+m,p.from+g))}}}return n}(t.state,s,r);return h.length?n?l.jT.create(h.concat(o.ranges)):l.jT.create(h):o}}:null):null})}let i5={Alt:[18,t=>t.altKey],Control:[17,t=>t.ctrlKey],Shift:[16,t=>t.shiftKey],Meta:[91,t=>t.metaKey]},i4={style:"cursor: crosshair"};function i6(t={}){let[e,i]=i5[t.key||"Alt"],s=tR.fromClass(class{constructor(t){this.view=t,this.isDown=!1}set(t){this.isDown!=t&&(this.isDown=t,this.view.update([]))}},{eventHandlers:{keydown(t){this.set(t.keyCode==e||i(t))},keyup(t){t.keyCode!=e&&i(t)||this.set(!1)},mousemove(t){this.set(i(t))}}});return[s,il.contentAttributes.of(t=>{var e;return(null===(e=t.plugin(s))||void 0===e?void 0:e.isDown)?i4:null})]}let i7="-10000px";class st{constructor(t,e,i){this.facet=e,this.createTooltipView=i,this.input=t.state.facet(e),this.tooltips=this.input.filter(t=>t),this.tooltipViews=this.tooltips.map(i)}update(t){var e;let i=t.state.facet(this.facet),s=i.filter(t=>t);if(i===this.input){for(let o of this.tooltipViews)o.update&&o.update(t);return!1}let n=[];for(let r=0;rn.indexOf(u)&&(u.dom.remove(),null===(e=u.destroy)||void 0===e||e.call(u));return this.input=i,this.tooltips=s,this.tooltipViews=n,!0}}function se(t){let{win:e}=t;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}let si=l.r$.define({combine(t){var e,i,s;return{position:K.ios?"absolute":(null===(e=t.find(t=>t.position))||void 0===e?void 0:e.position)||"fixed",parent:(null===(i=t.find(t=>t.parent))||void 0===i?void 0:i.parent)||null,tooltipSpace:(null===(s=t.find(t=>t.tooltipSpace))||void 0===s?void 0:s.tooltipSpace)||se}}}),ss=tR.fromClass(class{constructor(t){this.view=t,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(si);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new st(t,sr,t=>this.createTooltip(t)),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){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}observeIntersection(){if(this.intersectionObserver)for(let t of(this.intersectionObserver.disconnect(),this.manager.tooltipViews))this.intersectionObserver.observe(t.dom)}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t);e&&this.observeIntersection();let i=e||t.geometryChanged,s=t.state.facet(si);if(s.position!=this.position){for(let o of(this.position=s.position,this.manager.tooltipViews))o.dom.style.position=this.position;i=!0}if(s.parent!=this.parent){for(let n of(this.parent&&this.container.remove(),this.parent=s.parent,this.createContainer(),this.manager.tooltipViews))this.container.appendChild(n.dom);i=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);i&&this.maybeMeasure()}createTooltip(t){let e=t.create(this.view);if(e.dom.classList.add("cm-tooltip"),t.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",e.dom.appendChild(i)}return e.dom.style.position=this.position,e.dom.style.top=i7,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var t,e;for(let i of(this.view.win.removeEventListener("resize",this.measureSoon),this.manager.tooltipViews))i.dom.remove(),null===(t=i.destroy)||void 0===t||t.call(i);null===(e=this.intersectionObserver)||void 0===e||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=this.view.dom.getBoundingClientRect();return{editor:t,parent:this.parent?this.container.getBoundingClientRect():t,pos:this.manager.tooltips.map((t,e)=>{let i=this.manager.tooltipViews[e];return i.getCoords?i.getCoords(t.pos):this.view.coordsAtPos(t.pos)}),size:this.manager.tooltipViews.map(({dom:t})=>t.getBoundingClientRect()),space:this.view.state.facet(si).tooltipSpace(this.view)}}writeMeasure(t){let{editor:e,space:i}=t,s=[];for(let o=0;o=Math.min(e.bottom,i.bottom)||h.rightMath.min(e.right,i.right)+.1){l.style.top=i7;continue}let c=n.arrow?r.dom.querySelector(".cm-tooltip-arrow"):null,d=c?7:0,u=a.right-a.left,f=a.bottom-a.top,p=r.offset||sn,m=this.view.textDirection==tF.LTR,g=a.width>i.right-i.left?m?i.left:i.right-a.width:m?Math.min(h.left-(c?14:0)+p.x,i.right-u):Math.max(i.left,h.left-u+(c?14:0)-p.x),v=!!n.above;!n.strictSide&&(v?h.top-(a.bottom-a.top)-p.yi.bottom)&&v==i.bottom-h.bottom>h.top-i.top&&(v=!v);let w=(v?h.top-i.top:i.bottom-h.bottom)-d;if(wg&&x.topb&&(b=v?x.top-f-2-d:x.bottom+d+2);"absolute"==this.position?(l.style.top=b-t.parent.top+"px",l.style.left=g-t.parent.left+"px"):(l.style.top=b+"px",l.style.left=g+"px"),c&&(c.style.left=`${h.left+(m?p.x:-p.x)-(g+14-7)}px`),!0!==r.overlap&&s.push({left:g,top:b,right:y,bottom:b+f}),l.classList.toggle("cm-tooltip-above",v),l.classList.toggle("cm-tooltip-below",!v),r.positioned&&r.positioned(t.space)}}maybeMeasure(){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)))for(let t of this.manager.tooltipViews)t.dom.style.top=i7}},{eventHandlers:{scroll(){this.maybeMeasure()}}}),so=il.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:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),sn={x:0,y:0},sr=l.r$.define({enables:[ss,so]}),sl=l.r$.define();class sh{constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new st(t,sl,t=>this.createHostedView(t))}static create(t){return new sh(t)}createHostedView(t){let e=t.create(this.view);return e.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(e.dom),this.mounted&&e.mount&&e.mount(this.view),e}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}}let sa=sr.compute([sl],t=>{let e=t.facet(sl).filter(t=>t);return 0===e.length?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.filter(t=>null!=t.end).map(t=>t.end)),create:sh.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class sc{constructor(t,e,i,s,o){this.view=t,this.source=e,this.field=i,this.setHover=s,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active)return;let t=Date.now()-this.lastMove.time;ti.bottom||t.xi.right+this.view.defaultCharacterWidth)return;let s=this.view.bidiSpans(this.view.state.doc.lineAt(e)).find(t=>t.from<=e&&t.to>=e),o=s&&s.dir==tF.RTL?-1:1,n=this.source(this.view,e,t.x{this.pending==r&&(this.pending=null,t&&this.view.dispatch({effects:this.setHover.of(t)}))},t=>tA(this.view.state,t,"hover tooltip"))}else n&&this.view.dispatch({effects:this.setHover.of(n)})}mousemove(t){var e;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let i=this.active;if(i&&!sd(this.lastMove.target)||this.pending){let{pos:s}=i||this.pending,o=null!==(e=null==i?void 0:i.end)&&void 0!==e?e:s;(s==o?this.view.posAtCoords(this.lastMove)!=s:!function(t,e,i,s,o,n){let r=document.createRange(),l=t.domAtPos(e),h=t.domAtPos(i);r.setEnd(h.node,h.offset),r.setStart(l.node,l.offset);let a=r.getClientRects();r.detach();for(let c=0;c=Math.max(d.top-o,o-d.bottom,d.left-s,s-d.right))return!0}return!1}(this.view,s,o,t.clientX,t.clientY,0))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!sd(t.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function sd(t){for(let e=t;e;e=e.parentNode)if(1==e.nodeType&&e.classList.contains("cm-tooltip"))return!0;return!1}function su(t,e={}){let i=l.Py.define(),s=l.QQ.define({create:()=>null,update(t,s){if(t&&(e.hideOnChange&&(s.docChanged||s.selection)||e.hideOn&&e.hideOn(s,t)))return null;if(t&&s.docChanged){let o=s.changes.mapPos(t.pos,-1,l.gc.TrackDel);if(null==o)return null;let n=Object.assign(Object.create(null),t);n.pos=o,null!=t.end&&(n.end=s.changes.mapPos(t.end)),t=n}for(let r of s.effects)r.is(i)&&(t=r.value),r.is(sp)&&(t=null);return t},provide:t=>sl.from(t)});return[s,tR.define(o=>new sc(o,t,s,i,e.hoverTime||300)),sa]}function sf(t,e){let i=t.plugin(ss);if(!i)return null;let s=i.manager.tooltips.indexOf(e);return s<0?null:i.manager.tooltipViews[s]}let sp=l.Py.define(),sm=l.r$.define({combine(t){let e,i;for(let s of t)e=e||s.topContainer,i=i||s.bottomContainer;return{topContainer:e,bottomContainer:i}}});function sg(t,e){let i=t.plugin(sv),s=i?i.specs.indexOf(e):-1;return s>-1?i.panels[s]:null}let sv=tR.fromClass(class{constructor(t){this.input=t.state.facet(sy),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(e=>e(t));let e=t.state.facet(sm);for(let i of(this.top=new sw(t,!0,e.topContainer),this.bottom=new sw(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top)),this.panels))i.dom.classList.add("cm-panel"),i.mount&&i.mount()}update(t){let e=t.state.facet(sm);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new sw(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new sw(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let i=t.state.facet(sy);if(i!=this.input){let s=i.filter(t=>t),o=[],n=[],r=[],l=[];for(let h of s){let a=this.specs.indexOf(h),c;a<0?(c=h(t.view),l.push(c)):(c=this.panels[a]).update&&c.update(t),o.push(c),(c.top?n:r).push(c)}for(let d of(this.specs=s,this.panels=o,this.top.sync(n),this.bottom.sync(r),l))d.dom.classList.add("cm-panel"),d.mount&&d.mount()}else for(let u of this.panels)u.update&&u.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>il.scrollMargins.of(e=>{let i=e.plugin(t);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}})});class sw{constructor(t,e,i){this.view=t,this.top=e,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&0>t.indexOf(e)&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(0==this.panels.length){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let i of this.panels)if(i.dom.parentNode==this.dom){for(;e!=i.dom;)e=sb(e);e=e.nextSibling}else this.dom.insertBefore(i.dom,e);for(;e;)e=sb(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function sb(t){let e=t.nextSibling;return t.remove(),e}let sy=l.r$.define({enables:sv});class sx extends l.uU{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}sx.prototype.elementClass="",sx.prototype.toDOM=void 0,sx.prototype.mapMode=l.gc.TrackBefore,sx.prototype.startSide=sx.prototype.endSide=-1,sx.prototype.point=!0;let sS=l.r$.define(),sM={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>l.Xs.empty,lineMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},sk=l.r$.define();function sC(t){return[sD(),sk.of(Object.assign(Object.assign({},sM),t))]}let sA=l.r$.define({combine:t=>t.some(t=>t)});function sD(t){let e=[sT];return t&&!1===t.fixed&&e.push(sA.of(!0)),e}let sT=tR.fromClass(class{constructor(t){for(let e of(this.view=t,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=t.state.facet(sk).map(e=>new sB(t,e)),this.gutters))this.dom.appendChild(e.dom);this.fixed=!t.state.facet(sA),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}update(t){if(this.updateGutters(t)){let e=this.prevViewport,i=t.view.viewport,s=Math.min(e.to,i.to)-Math.max(e.from,i.from);this.syncGutters(s<(i.to-i.from)*.8)}t.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(sA)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&this.dom.remove();let i=l.Xs.iter(this.view.state.facet(sS),this.view.viewport.from),s=[],o=this.gutters.map(t=>new sE(t,this.view.viewport,-this.view.documentPadding.top));for(let n of this.view.viewportLineBlocks){let r;if(Array.isArray(n.type)){for(let h of n.type)if(h.type==to.Text){r=h;break}}else r=n.type==to.Text?n:void 0;if(r)for(let a of(s.length&&(s=[]),sR(i,s,n.from),o))a.line(this.view,r,s)}for(let c of o)c.finish();t&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(t){let e=t.startState.facet(sk),i=t.state.facet(sk),s=t.docChanged||t.heightChanged||t.viewportChanged||!l.Xs.eq(t.startState.facet(sS),t.state.facet(sS),t.view.viewport.from,t.view.viewport.to);if(e==i)for(let o of this.gutters)o.update(t)&&(s=!0);else{s=!0;let n=[];for(let r of i){let h=e.indexOf(r);h<0?n.push(new sB(this.view,r)):(this.gutters[h].update(t),n.push(this.gutters[h]))}for(let a of this.gutters)a.dom.remove(),0>n.indexOf(a)&&a.destroy();for(let c of n)this.dom.appendChild(c.dom);this.gutters=n}return s}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove()}},{provide:t=>il.scrollMargins.of(e=>{let i=e.plugin(t);return i&&0!=i.gutters.length&&i.fixed?e.textDirection==tF.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null})});function sO(t){return Array.isArray(t)?t:[t]}function sR(t,e,i){for(;t.value&&t.from<=i;)t.from==i&&e.push(t.value),t.next()}class sE{constructor(t,e,i){this.gutter=t,this.height=i,this.localMarkers=[],this.i=0,this.cursor=l.Xs.iter(t.markers,e.from)}line(t,e,i){this.localMarkers.length&&(this.localMarkers=[]),sR(this.cursor,this.localMarkers,e.from);let s=i.length?this.localMarkers.concat(i):this.localMarkers,o=this.gutter.config.lineMarker(t,e,s);o&&s.unshift(o);let n=this.gutter;if(0==s.length&&!n.config.renderEmptyElements)return;let r=e.top-this.height;if(this.i==n.elements.length){let l=new sL(t,e.height,r,s);n.elements.push(l),n.dom.appendChild(l.dom)}else n.elements[this.i].update(t,e.height,r,s);this.height=e.bottom,this.i++}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}}class sB{constructor(t,e){for(let i in this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:""),e.domEventHandlers)this.dom.addEventListener(i,s=>{let o=t.lineBlockAtHeight(s.clientY-t.documentTop);e.domEventHandlers[i](t,o,s)&&s.preventDefault()});this.markers=sO(e.markers(t)),e.initialSpacer&&(this.spacer=new sL(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let e=this.markers;if(this.markers=sO(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],t);i!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[i])}let s=t.view.viewport;return!l.Xs.eq(this.markers,e,s.from,s.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(t)}destroy(){for(let t of this.elements)t.destroy()}}class sL{constructor(t,e,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,e,i,s)}update(t,e,i,s){this.height!=e&&(this.dom.style.height=(this.height=e)+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),!function(t,e){if(t.length!=e.length)return!1;for(let i=0;i(0,l.BO)(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,e){let i=Object.assign({},t);for(let s in e){let o=i[s],n=e[s];i[s]=o?(t,e,i)=>o(t,e,i)||n(t,e,i):n}return i}})});class sN extends sx{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function sP(t,e){return t.state.facet(sH).formatNumber(e,t.state)}let sW=sk.compute([sH],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:t=>t.state.facet(sV),lineMarker:(t,e,i)=>i.some(t=>t.toDOM)?null:new sN(sP(t,t.state.doc.lineAt(e.from).number)),lineMarkerChange:t=>t.startState.facet(sH)!=t.state.facet(sH),initialSpacer:t=>new sN(sP(t,sF(t.state.doc.lines))),updateSpacer(t,e){let i=sP(e.view,sF(e.view.state.doc.lines));return i==t.number?t:new sN(i)},domEventHandlers:t.facet(sH).domEventHandlers}));function sz(t={}){return[sH.of(t),sD(),sW]}function sF(t){let e=9;for(;e{let e=[],i=-1;for(let s of t.selection.ranges){let o=t.doc.lineAt(s.head).from;o>i&&(i=o,e.push(sI.range(o)))}return l.Xs.of(e)});function sj(){return sq}}}]); \ No newline at end of file diff --git a/static/web/_next/static/AHfwI8q2tdwt5dN-doVir/_buildManifest.js b/static/web/_next/static/dEsHH1RLiHgALIdBFBzcU/_buildManifest.js similarity index 97% rename from static/web/_next/static/AHfwI8q2tdwt5dN-doVir/_buildManifest.js rename to static/web/_next/static/dEsHH1RLiHgALIdBFBzcU/_buildManifest.js index 32f30b8e7..5984536cb 100644 --- a/static/web/_next/static/AHfwI8q2tdwt5dN-doVir/_buildManifest.js +++ b/static/web/_next/static/dEsHH1RLiHgALIdBFBzcU/_buildManifest.js @@ -1 +1 @@ -self.__BUILD_MANIFEST=function(a,s,c,e,i,t,n,d,f,b,h,o,m,u,k,g,r,j,p,l,_,w,v,y,I,B,F,A){return{__rewrites:{beforeFiles:[],afterFiles:[{source:"/api/:path*"},{source:"/hls/:path*"},{source:"/img/:path*"},{source:"/logo"},{source:"/thumbnail.jpg"}],fallback:[]},"/":[s,a,c,t,n,f,o,m,j,"static/chunks/4466-2e8c1156cd6902a6.js",b,"static/css/089ea92974e6f7ca.css","static/chunks/pages/index-77383441e78cee11.js"],"/_error":["static/chunks/pages/_error-02cc11fd74b4e5ff.js"],"/admin":[s,a,c,e,i,t,n,d,h,m,"static/chunks/8676-c38bd41883242e8e.js","static/chunks/pages/admin-f61cf9b387d8362c.js"],"/admin/access-tokens":[s,a,c,e,i,"static/chunks/pages/admin/access-tokens-91177ddb58bd90ee.js"],"/admin/actions":[u,s,a,c,e,p,"static/chunks/pages/admin/actions-0b45668aebec7dde.js"],"/admin/chat/messages":[u,s,a,c,e,i,n,l,"static/chunks/pages/admin/chat/messages-7e88922542839f8a.js"],"/admin/chat/users":[u,s,a,c,e,i,t,n,l,"static/chunks/pages/admin/chat/users-8fc28dfaa9e52d37.js"],"/admin/config/appearance":[_,o,w,v,"static/css/6c8941159bdd16f6.css","static/chunks/pages/admin/config/appearance-be1829febefc4db6.js"],"/admin/config/streamkeys":[s,a,c,e,p,"static/chunks/pages/admin/config/streamkeys-6a3f2badc0712b01.js"],"/admin/config-chat":["static/chunks/pages/admin/config-chat-fab037451220beb1.js"],"/admin/config-federation":["static/chunks/8572-deca358d1a965d80.js","static/chunks/pages/admin/config-federation-3e7e0a54acf1bd9b.js"],"/admin/config-notify":["static/chunks/pages/admin/config-notify-b525013f97b7a9a9.js"],"/admin/config-public-details":[_,s,a,c,e,k,w,"static/chunks/1043-926dbac42978d9db.js","static/chunks/pages/admin/config-public-details-085c048afcb776d7.js"],"/admin/config-server-details":[y,"static/chunks/pages/admin/config-server-details-fafadf003f21dada.js"],"/admin/config-social-items":[s,a,c,e,"static/chunks/pages/admin/config-social-items-f022d29681248095.js"],"/admin/config-storage":["static/chunks/pages/admin/config-storage-7c5510a084d9c01c.js"],"/admin/config-video":[s,a,c,e,y,"static/chunks/6962-f197cc126c73fb7f.js","static/chunks/pages/admin/config-video-ea088d6f81d33fcc.js"],"/admin/federation/actions":[s,a,c,e,i,"static/chunks/pages/admin/federation/actions-d79f77b8b18148ad.js"],"/admin/federation/followers":[s,a,c,e,i,t,"static/chunks/pages/admin/federation/followers-8c2d451ee44fb398.js"],"/admin/hardware-info":[g,i,t,d,h,r,k,"static/chunks/pages/admin/hardware-info-d1ca2af204c98f51.js"],"/admin/help":[t,d,o,v,"static/chunks/7830-37f6f9f7aaae2bbf.js","static/chunks/pages/admin/help-cf85d400d1ada208.js"],"/admin/logs":[s,a,c,e,i,m,"static/chunks/pages/admin/logs-c494c4dc6f214d8b.js"],"/admin/stream-health":[g,i,t,d,h,r,"static/chunks/2934-4a8cbef0e0cea1a5.js","static/chunks/pages/admin/stream-health-f2cf52294c67fcb8.js"],"/admin/upgrade":[s,a,c,e,"static/chunks/2069-c5012847917b76df.js","static/chunks/pages/admin/upgrade-41783a74d59f851b.js"],"/admin/viewer-info":[g,s,a,c,e,i,t,n,d,h,r,k,"static/chunks/pages/admin/viewer-info-9a828a713dcea351.js"],"/admin/webhooks":[s,a,c,e,"static/chunks/pages/admin/webhooks-c59eaaf1fe4ac78c.js"],"/embed/chat/readonly":[I,B,f,F,b,A,"static/css/c43a4bf0142c5559.css","static/chunks/pages/embed/chat/readonly-1d789cb2de5c6857.js"],"/embed/chat/readwrite":[I,B,a,f,F,"static/chunks/911-9156415c36038fd8.js",b,A,"static/css/0db0271556306928.css","static/chunks/pages/embed/chat/readwrite-56b92edb498f6991.js"],"/embed/video":["static/chunks/d6e1aeb5-0705bf43bcd6af77.js",n,f,"static/css/7c735c05af084bb2.css","static/chunks/7902-139b487986de3737.js",j,b,"static/chunks/2239-ceff4252276e3d5e.js","static/css/f065863129f648da.css","static/chunks/pages/embed/video-04abad59027d2c31.js"],sortedPages:["/","/_app","/_error","/admin","/admin/access-tokens","/admin/actions","/admin/chat/messages","/admin/chat/users","/admin/config/appearance","/admin/config/streamkeys","/admin/config-chat","/admin/config-federation","/admin/config-notify","/admin/config-public-details","/admin/config-server-details","/admin/config-social-items","/admin/config-storage","/admin/config-video","/admin/federation/actions","/admin/federation/followers","/admin/hardware-info","/admin/help","/admin/logs","/admin/stream-health","/admin/upgrade","/admin/viewer-info","/admin/webhooks","/embed/chat/readonly","/embed/chat/readwrite","/embed/video"]}}("static/chunks/3903-37c1af34070ecbf4.js","static/chunks/8909-6d59cce6f69e27ae.js","static/chunks/4267-cfe0f573c442773c.js","static/chunks/2206-8da9006b177e3283.js","static/chunks/8091-5d2e0cdb05cd1ef7.js","static/chunks/575-11393a44fd60b818.js","static/chunks/5938-b5bac17e4fa31c49.js","static/chunks/5101-e2c6238798b20535.js","static/chunks/6395-f04016ae318b5e91.js","static/chunks/7466-1e76829814bac0c3.js","static/chunks/4763-cd081ceb0032736f.js","static/chunks/1082-51b9f63c6446d49d.js","static/chunks/5360-8155b586c5f545d5.js","static/chunks/29107295-1453a3860b50f70e.js","static/chunks/7910-44b63d030e4b1767.js","static/chunks/ee8b1517-9cf421a7da630c58.js","static/chunks/236-f876fd1a47451d45.js","static/chunks/8245-b34a27e35386277e.js","static/chunks/8119-57984c2c349ea105.js","static/chunks/9550-db4a457e5e1bbbcf.js","static/chunks/4ad82c5e-170dc8748c5bb2d7.js","static/chunks/1943-896020ebd27dae4b.js","static/chunks/1938-c04d908728a12ddb.js","static/chunks/3286-716fef4ced844a4d.js","static/chunks/d3048c20-93c008b4ff3ddb0e.js","static/chunks/d2094a0f-7059b9f8abbc2737.js","static/chunks/3729-e88e6289f5436bb5.js","static/chunks/4977-167fb026492a9609.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file +self.__BUILD_MANIFEST=function(a,s,c,e,i,t,n,d,f,b,h,o,m,u,k,g,r,j,p,l,_,w,v,y,I,B,F,A){return{__rewrites:{beforeFiles:[],afterFiles:[{source:"/api/:path*"},{source:"/hls/:path*"},{source:"/img/:path*"},{source:"/logo"},{source:"/thumbnail.jpg"}],fallback:[]},"/":[s,a,c,t,n,f,o,m,j,"static/chunks/4466-2e8c1156cd6902a6.js",b,"static/css/089ea92974e6f7ca.css","static/chunks/pages/index-77383441e78cee11.js"],"/_error":["static/chunks/pages/_error-02cc11fd74b4e5ff.js"],"/admin":[s,a,c,e,i,t,n,d,h,m,"static/chunks/8676-c38bd41883242e8e.js","static/chunks/pages/admin-f61cf9b387d8362c.js"],"/admin/access-tokens":[s,a,c,e,i,"static/chunks/pages/admin/access-tokens-91177ddb58bd90ee.js"],"/admin/actions":[u,s,a,c,e,p,"static/chunks/pages/admin/actions-0b45668aebec7dde.js"],"/admin/chat/messages":[u,s,a,c,e,i,n,l,"static/chunks/pages/admin/chat/messages-7e88922542839f8a.js"],"/admin/chat/users":[u,s,a,c,e,i,t,n,l,"static/chunks/pages/admin/chat/users-8fc28dfaa9e52d37.js"],"/admin/config/appearance":[_,o,w,v,"static/css/6c8941159bdd16f6.css","static/chunks/pages/admin/config/appearance-be1829febefc4db6.js"],"/admin/config/streamkeys":[s,a,c,e,p,"static/chunks/pages/admin/config/streamkeys-6a3f2badc0712b01.js"],"/admin/config-chat":["static/chunks/pages/admin/config-chat-fab037451220beb1.js"],"/admin/config-federation":["static/chunks/8572-deca358d1a965d80.js","static/chunks/pages/admin/config-federation-3e7e0a54acf1bd9b.js"],"/admin/config-notify":["static/chunks/pages/admin/config-notify-b525013f97b7a9a9.js"],"/admin/config-public-details":[_,s,a,c,e,k,w,"static/chunks/1043-926dbac42978d9db.js","static/chunks/pages/admin/config-public-details-085c048afcb776d7.js"],"/admin/config-server-details":[y,"static/chunks/pages/admin/config-server-details-fafadf003f21dada.js"],"/admin/config-social-items":[s,a,c,e,"static/chunks/pages/admin/config-social-items-f022d29681248095.js"],"/admin/config-storage":["static/chunks/pages/admin/config-storage-7c5510a084d9c01c.js"],"/admin/config-video":[s,a,c,e,y,"static/chunks/6962-f197cc126c73fb7f.js","static/chunks/pages/admin/config-video-ea088d6f81d33fcc.js"],"/admin/federation/actions":[s,a,c,e,i,"static/chunks/pages/admin/federation/actions-d79f77b8b18148ad.js"],"/admin/federation/followers":[s,a,c,e,i,t,"static/chunks/pages/admin/federation/followers-8c2d451ee44fb398.js"],"/admin/hardware-info":[g,i,t,d,h,r,k,"static/chunks/pages/admin/hardware-info-d1ca2af204c98f51.js"],"/admin/help":[t,d,o,v,"static/chunks/7830-37f6f9f7aaae2bbf.js","static/chunks/pages/admin/help-cf85d400d1ada208.js"],"/admin/logs":[s,a,c,e,i,m,"static/chunks/pages/admin/logs-c494c4dc6f214d8b.js"],"/admin/stream-health":[g,i,t,d,h,r,"static/chunks/2934-4a8cbef0e0cea1a5.js","static/chunks/pages/admin/stream-health-f2cf52294c67fcb8.js"],"/admin/upgrade":[s,a,c,e,"static/chunks/2069-c5012847917b76df.js","static/chunks/pages/admin/upgrade-41783a74d59f851b.js"],"/admin/viewer-info":[g,s,a,c,e,i,t,n,d,h,r,k,"static/chunks/pages/admin/viewer-info-9a828a713dcea351.js"],"/admin/webhooks":[s,a,c,e,"static/chunks/pages/admin/webhooks-c59eaaf1fe4ac78c.js"],"/embed/chat/readonly":[I,B,f,F,b,A,"static/css/c43a4bf0142c5559.css","static/chunks/pages/embed/chat/readonly-1d789cb2de5c6857.js"],"/embed/chat/readwrite":[I,B,a,f,F,"static/chunks/911-9156415c36038fd8.js",b,A,"static/css/0db0271556306928.css","static/chunks/pages/embed/chat/readwrite-56b92edb498f6991.js"],"/embed/video":["static/chunks/d6e1aeb5-0705bf43bcd6af77.js",n,f,"static/css/7c735c05af084bb2.css","static/chunks/7902-139b487986de3737.js",j,b,"static/chunks/2239-ceff4252276e3d5e.js","static/css/f065863129f648da.css","static/chunks/pages/embed/video-04abad59027d2c31.js"],sortedPages:["/","/_app","/_error","/admin","/admin/access-tokens","/admin/actions","/admin/chat/messages","/admin/chat/users","/admin/config/appearance","/admin/config/streamkeys","/admin/config-chat","/admin/config-federation","/admin/config-notify","/admin/config-public-details","/admin/config-server-details","/admin/config-social-items","/admin/config-storage","/admin/config-video","/admin/federation/actions","/admin/federation/followers","/admin/hardware-info","/admin/help","/admin/logs","/admin/stream-health","/admin/upgrade","/admin/viewer-info","/admin/webhooks","/embed/chat/readonly","/embed/chat/readwrite","/embed/video"]}}("static/chunks/3903-37c1af34070ecbf4.js","static/chunks/8909-6d59cce6f69e27ae.js","static/chunks/4267-cfe0f573c442773c.js","static/chunks/2206-8da9006b177e3283.js","static/chunks/8091-5d2e0cdb05cd1ef7.js","static/chunks/575-11393a44fd60b818.js","static/chunks/5938-b5bac17e4fa31c49.js","static/chunks/5101-e2c6238798b20535.js","static/chunks/6395-f04016ae318b5e91.js","static/chunks/7466-1e76829814bac0c3.js","static/chunks/4763-cd081ceb0032736f.js","static/chunks/1082-51b9f63c6446d49d.js","static/chunks/5360-8155b586c5f545d5.js","static/chunks/29107295-1453a3860b50f70e.js","static/chunks/7910-44b63d030e4b1767.js","static/chunks/ee8b1517-9cf421a7da630c58.js","static/chunks/236-f876fd1a47451d45.js","static/chunks/8245-b34a27e35386277e.js","static/chunks/8119-57984c2c349ea105.js","static/chunks/9550-db4a457e5e1bbbcf.js","static/chunks/4ad82c5e-573627f1f4333b92.js","static/chunks/1943-896020ebd27dae4b.js","static/chunks/1938-c04d908728a12ddb.js","static/chunks/3286-716fef4ced844a4d.js","static/chunks/d3048c20-93c008b4ff3ddb0e.js","static/chunks/d2094a0f-7059b9f8abbc2737.js","static/chunks/3729-e88e6289f5436bb5.js","static/chunks/4977-167fb026492a9609.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/static/web/_next/static/AHfwI8q2tdwt5dN-doVir/_ssgManifest.js b/static/web/_next/static/dEsHH1RLiHgALIdBFBzcU/_ssgManifest.js similarity index 100% rename from static/web/_next/static/AHfwI8q2tdwt5dN-doVir/_ssgManifest.js rename to static/web/_next/static/dEsHH1RLiHgALIdBFBzcU/_ssgManifest.js diff --git a/static/web/admin/access-tokens/index.html b/static/web/admin/access-tokens/index.html index 73c7cbaf1..73f4a7a1e 100644 --- a/static/web/admin/access-tokens/index.html +++ b/static/web/admin/access-tokens/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Access Tokens

Access tokens are used to allow external, 3rd party tools to perform specific actions on your Owncast server. They should be kept secure and never included in client code, instead they should be kept on a server that you control.
Read more about how to use these tokens, with examples, at our documentation.
NameTokenScopesLast Used
No data

\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Access Tokens

Access tokens are used to allow external, 3rd party tools to perform specific actions on your Owncast server. They should be kept secure and never included in client code, instead they should be kept on a server that you control.
Read more about how to use these tokens, with examples, at our documentation.
NameTokenScopesLast Used
No data

\ No newline at end of file diff --git a/static/web/admin/actions/index.html b/static/web/admin/actions/index.html index 968a9d96e..f58a70ec6 100644 --- a/static/web/admin/actions/index.html +++ b/static/web/admin/actions/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

External Actions

External action URLs are 3rd party UI you can display, embedded, into your Owncast page when a user clicks on a button to launch your action.
Read more about how to use actions, with examples, at our documentation.
NameDescriptionURLIconColorOpens
No data

\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

External Actions

External action URLs are 3rd party UI you can display, embedded, into your Owncast page when a user clicks on a button to launch your action.
Read more about how to use actions, with examples, at our documentation.
NameDescriptionURLIconColorOpens
No data

\ No newline at end of file diff --git a/static/web/admin/chat/messages/index.html b/static/web/admin/chat/messages/index.html index ffe5eeb24..48b7295f9 100644 --- a/static/web/admin/chat/messages/index.html +++ b/static/web/admin/chat/messages/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Chat Messages

Manage the messages from viewers that show up on your stream.

Check multiple messages to change their visibility to:
Time
User
Message
No data
\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Chat Messages

Manage the messages from viewers that show up on your stream.

Check multiple messages to change their visibility to:
Time
User
Message
No data
\ No newline at end of file diff --git a/static/web/admin/chat/users/index.html b/static/web/admin/chat/users/index.html index 4aa7d119c..f2bb199d6 100644 --- a/static/web/admin/chat/users/index.html +++ b/static/web/admin/chat/users/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

When a stream is active and chat is enabled, connected chat clients will be displayed here.

\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

When a stream is active and chat is enabled, connected chat clients will be displayed here.

\ No newline at end of file diff --git a/static/web/admin/config-chat/index.html b/static/web/admin/config-chat/index.html index 6f5fd7cfb..88a5b8d9d 100644 --- a/static/web/admin/config-chat/index.html +++ b/static/web/admin/config-chat/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline
\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline
\ No newline at end of file diff --git a/static/web/admin/config-federation/index.html b/static/web/admin/config-federation/index.html index 5a850b20f..46c128e4b 100644 --- a/static/web/admin/config-federation/index.html +++ b/static/web/admin/config-federation/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline
\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline
\ No newline at end of file diff --git a/static/web/admin/config-notify/index.html b/static/web/admin/config-notify/index.html index c54c0d077..67e3d6c78 100644 --- a/static/web/admin/config-notify/index.html +++ b/static/web/admin/config-notify/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Notifications

Let your viewers know when you go live by supporting any of the below notification channels. Learn more about live notifications.


The full url to your Owncast server is required to enable social features. Must use SSL (https). Once people start following your instance you should not change this.

The full url to your Owncast server is required to enable social features. Must use SSL (https). Once people start following your instance you should not change this.

Browser Alerts

Viewers can opt into being notified when you go live with their browser.

Not all browsers support this.

Enable browser notifications

The text to send when you go live.

Twitter

Let your Twitter followers know each time you go live.

Enable Twitter

The text to send when you go live.

Discord

Let your Discord channel know each time you go live.

Create a webhook under Edit Channel / Integrations on your Discord channel and provide it below.

Enable Discord

The webhook assigned to your channel.

The text to send when you go live.

Fediverse Social

Enabling the Fediverse social features will not just alert people to when you go live, but also enable other functionality.

Fediverse social features: Disabled

Custom

Build your own notifications by using custom webhooks.

\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Notifications

Let your viewers know when you go live by supporting any of the below notification channels. Learn more about live notifications.


The full url to your Owncast server is required to enable social features. Must use SSL (https). Once people start following your instance you should not change this.

The full url to your Owncast server is required to enable social features. Must use SSL (https). Once people start following your instance you should not change this.

Browser Alerts

Viewers can opt into being notified when you go live with their browser.

Not all browsers support this.

Enable browser notifications

The text to send when you go live.

Twitter

Let your Twitter followers know each time you go live.

Enable Twitter

The text to send when you go live.

Discord

Let your Discord channel know each time you go live.

Create a webhook under Edit Channel / Integrations on your Discord channel and provide it below.

Enable Discord

The webhook assigned to your channel.

The text to send when you go live.

Fediverse Social

Enabling the Fediverse social features will not just alert people to when you go live, but also enable other functionality.

Fediverse social features: Disabled

Custom

Build your own notifications by using custom webhooks.

\ No newline at end of file diff --git a/static/web/admin/config-public-details/index.html b/static/web/admin/config-public-details/index.html index 1923b21a6..9e9f8dbdc 100644 --- a/static/web/admin/config-public-details/index.html +++ b/static/web/admin/config-public-details/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

General Settings

The following are displayed on your site to describe your stream and its content. Learn more.

Custom Page Content

Edit the content of your page by using simple Markdown syntax.


\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

General Settings

The following are displayed on your site to describe your stream and its content. Learn more.

Custom Page Content

Edit the content of your page by using simple Markdown syntax.


\ No newline at end of file diff --git a/static/web/admin/config-server-details/index.html b/static/web/admin/config-server-details/index.html index 4513d8fb1..6480dd49a 100644 --- a/static/web/admin/config-server-details/index.html +++ b/static/web/admin/config-server-details/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Server Settings

You should change your stream key from the default and keep it safe. For most people it's likely the other settings will not need to be changed.

\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Server Settings

You should change your stream key from the default and keep it safe. For most people it's likely the other settings will not need to be changed.

\ No newline at end of file diff --git a/static/web/admin/config-social-items/index.html b/static/web/admin/config-social-items/index.html index fb1145307..dce999677 100644 --- a/static/web/admin/config-social-items/index.html +++ b/static/web/admin/config-social-items/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Social Items

\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Social Items

\ No newline at end of file diff --git a/static/web/admin/config-storage/index.html b/static/web/admin/config-storage/index.html index 0f2d4ba67..a0aa2237f 100644 --- a/static/web/admin/config-storage/index.html +++ b/static/web/admin/config-storage/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Storage

Owncast supports optionally using external storage providers to stream your video. Learn more about this by visiting our Storage Documentation.

Configuring this incorrectly will likely cause your video to be unplayable. Double check the documentation for your storage provider on how to configure the bucket you created for Owncast.

Keep in mind this is for live streaming, not for archival, recording or VOD purposes.

\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Storage

Owncast supports optionally using external storage providers to stream your video. Learn more about this by visiting our Storage Documentation.

Configuring this incorrectly will likely cause your video to be unplayable. Double check the documentation for your storage provider on how to configure the bucket you created for Owncast.

Keep in mind this is for live streaming, not for archival, recording or VOD purposes.

\ No newline at end of file diff --git a/static/web/admin/config-video/index.html b/static/web/admin/config-video/index.html index c0ab8c6b1..d7577ee6c 100644 --- a/static/web/admin/config-video/index.html +++ b/static/web/admin/config-video/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Video configuration

Before changing your video configuration visit the video documentation to learn how it impacts your stream performance. The general rule is to start conservatively by having one middle quality stream output variant and experiment with adding more of varied qualities.

Stream output

NameVideo bitrateCPU Usage
No name800 kbpsMedium

Latency Buffer

While it's natural to want to keep your latency as low as possible, you may experience reduced error tolerance and stability the lower you go. The lowest setting is not recommended.

For interactive live streams you may want to experiment with a lower latency, for non-interactive broadcasts you may want to increase it. Read to learn more.

LowestHighest

\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Video configuration

Before changing your video configuration visit the video documentation to learn how it impacts your stream performance. The general rule is to start conservatively by having one middle quality stream output variant and experiment with adding more of varied qualities.

Stream output

NameVideo bitrateCPU Usage
No name800 kbpsMedium

Latency Buffer

While it's natural to want to keep your latency as low as possible, you may experience reduced error tolerance and stability the lower you go. The lowest setting is not recommended.

For interactive live streams you may want to experiment with a lower latency, for non-interactive broadcasts you may want to increase it. Read to learn more.

LowestHighest

\ No newline at end of file diff --git a/static/web/admin/config/appearance/index.html b/static/web/admin/config/appearance/index.html index b877f53e1..61b30a390 100644 --- a/static/web/admin/config/appearance/index.html +++ b/static/web/admin/config/appearance/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline
Loading...
\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline
Loading...
\ No newline at end of file diff --git a/static/web/admin/config/streamkeys/index.html b/static/web/admin/config/streamkeys/index.html index c68d5a404..f680665a9 100644 --- a/static/web/admin/config/streamkeys/index.html +++ b/static/web/admin/config/streamkeys/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Streaming Keys

A streaming key is used with your broadcasting software to authenticate itself to Owncast. Most people will only need one. However, if you share a server with others or you want different keys for different broadcasting sources you can add more here.
These keys are unrelated to the admin password and will not grant you access to make changes to Owncast's configuration.
Read more about broadcasting at the documentation.
KeyComment
No data

\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Streaming Keys

A streaming key is used with your broadcasting software to authenticate itself to Owncast. Most people will only need one. However, if you share a server with others or you want different keys for different broadcasting sources you can add more here.
These keys are unrelated to the admin password and will not grant you access to make changes to Owncast's configuration.
Read more about broadcasting at the documentation.
KeyComment
No data

\ No newline at end of file diff --git a/static/web/admin/federation/actions/index.html b/static/web/admin/federation/actions/index.html index 2b7707f7c..53a612e27 100644 --- a/static/web/admin/federation/actions/index.html +++ b/static/web/admin/federation/actions/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Fediverse Actions

Below is a list of actions that were taken by others in response to your posts as well as people who requested to follow you.
ActionFromWhen
No data
\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Fediverse Actions

Below is a list of actions that were taken by others in response to your posts as well as people who requested to follow you.
ActionFromWhen
No data
\ No newline at end of file diff --git a/static/web/admin/federation/followers/index.html b/static/web/admin/federation/followers/index.html index 3b78fc79f..53122be2b 100644 --- a/static/web/admin/federation/followers/index.html +++ b/static/web/admin/federation/followers/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

The following accounts get notified when you go live or send a post.

NameURL
Added
Remove
No data
\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

The following accounts get notified when you go live or send a post.

NameURL
Added
Remove
No data
\ No newline at end of file diff --git a/static/web/admin/hardware-info/index.html b/static/web/admin/hardware-info/index.html index b4f4c8e96..364fbbf28 100644 --- a/static/web/admin/hardware-info/index.html +++ b/static/web/admin/hardware-info/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Hardware Info


CPU
0%
Memory
0%
Disk
0%
Loading...
\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Hardware Info


CPU
0%
Memory
0%
Disk
0%
Loading...
\ No newline at end of file diff --git a/static/web/admin/help/index.html b/static/web/admin/help/index.html index d0161827f..41c4b780c 100644 --- a/static/web/admin/help/index.html +++ b/static/web/admin/help/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

How can we help you?

Troubleshooting

Fix your problems

Documentation

Read the Docs

Common tasks

I want to configure my owncast instance
Help configuring my broadcasting software
I want to embed my stream into another site
I want to customize my website
I want to tweak my video output
I want to use an external storage provider

Other

I found a bug
If you found a bug, then please let us know
I have a general question
Most general questions are answered in our FAQ or exist in our discussions
I want to build add-ons for Owncast
You can build your own bots, overlays, tools and add-ons with our developer APIs. 
\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

How can we help you?

Troubleshooting

Fix your problems

Documentation

Read the Docs

Common tasks

I want to configure my owncast instance
Help configuring my broadcasting software
I want to embed my stream into another site
I want to customize my website
I want to tweak my video output
I want to use an external storage provider

Other

I found a bug
If you found a bug, then please let us know
I have a general question
Most general questions are answered in our FAQ or exist in our discussions
I want to build add-ons for Owncast
You can build your own bots, overlays, tools and add-ons with our developer APIs. 
\ No newline at end of file diff --git a/static/web/admin/index.html b/static/web/admin/index.html index 634d1fd51..4748f9397 100644 --- a/static/web/admin/index.html +++ b/static/web/admin/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

No stream is active

You should start one.

Chat is disabled
Chat will continue to be disabled until you begin a live stream.
Find an audience on the Owncast Directory
List yourself in the Owncast Directory and show off your stream. Enable it in settings.
fediverse
Add your Owncast instance to the Fediverse
Enable Owncast social features to have your instance join the Fediverse, allowing people to follow, share and engage with your live stream.

News & Updates from Owncast

\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

No stream is active

You should start one.

Chat is disabled
Chat will continue to be disabled until you begin a live stream.
Find an audience on the Owncast Directory
List yourself in the Owncast Directory and show off your stream. Enable it in settings.
fediverse
Add your Owncast instance to the Fediverse
Enable Owncast social features to have your instance join the Fediverse, allowing people to follow, share and engage with your live stream.

News & Updates from Owncast

\ No newline at end of file diff --git a/static/web/admin/logs/index.html b/static/web/admin/logs/index.html index c9ebe0acd..6eca68682 100644 --- a/static/web/admin/logs/index.html +++ b/static/web/admin/logs/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline
\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline
\ No newline at end of file diff --git a/static/web/admin/stream-health/index.html b/static/web/admin/stream-health/index.html index c2c2775dc..e87276f9a 100644 --- a/static/web/admin/stream-health/index.html +++ b/static/web/admin/stream-health/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Stream Performance

\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Stream Performance

\ No newline at end of file diff --git a/static/web/admin/upgrade/index.html b/static/web/admin/upgrade/index.html index 9de1f8e5d..1b258bc1b 100644 --- a/static/web/admin/upgrade/index.html +++ b/static/web/admin/upgrade/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Thu Jan 01 1970

Downloads

NameSize
No data
\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Thu Jan 01 1970

Downloads

NameSize
No data
\ No newline at end of file diff --git a/static/web/admin/viewer-info/index.html b/static/web/admin/viewer-info/index.html index 3f0aafd0a..ae1a8c9d0 100644 --- a/static/web/admin/viewer-info/index.html +++ b/static/web/admin/viewer-info/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Viewer Info


Max viewers last stream
0
All-time max viewers
0
User AgentLocation
Watch Time
No data
\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Viewer Info


Max viewers last stream
0
All-time max viewers
0
User AgentLocation
Watch Time
No data
\ No newline at end of file diff --git a/static/web/admin/webhooks/index.html b/static/web/admin/webhooks/index.html index f837b0a47..2ab9f90ff 100644 --- a/static/web/admin/webhooks/index.html +++ b/static/web/admin/webhooks/index.html @@ -1 +1 @@ -Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Webhooks

A webhook is a callback made to an external API in response to an event that takes place within Owncast. This can be used to build chat bots or sending automatic notifications that you've started streaming.
Read more about how to use webhooks, with examples, at our documentation.
URLEvents
No data

\ No newline at end of file +Owncast Admin

What is your stream about today?

What is your stream about today?
Offline

Webhooks

A webhook is a callback made to an external API in response to an event that takes place within Owncast. This can be used to build chat bots or sending automatic notifications that you've started streaming.
Read more about how to use webhooks, with examples, at our documentation.
URLEvents
No data

\ No newline at end of file diff --git a/static/web/embed/chat/readonly/index.html b/static/web/embed/chat/readonly/index.html index 194f07681..0b3d34ed2 100644 --- a/static/web/embed/chat/readonly/index.html +++ b/static/web/embed/chat/readonly/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/static/web/embed/chat/readwrite/index.html b/static/web/embed/chat/readwrite/index.html index 725f45d25..04344126a 100644 --- a/static/web/embed/chat/readwrite/index.html +++ b/static/web/embed/chat/readwrite/index.html @@ -1 +1 @@ -
\ No newline at end of file +
\ No newline at end of file diff --git a/static/web/embed/video/index.html b/static/web/embed/video/index.html index 0779159fc..f170b6c3e 100644 --- a/static/web/embed/video/index.html +++ b/static/web/embed/video/index.html @@ -1 +1 @@ -
This stream is offline. Check back soon!
\ No newline at end of file +
This stream is offline. Check back soon!
\ No newline at end of file diff --git a/static/web/index.html b/static/web/index.html index 9bfffc5d0..ca9d73605 100644 --- a/static/web/index.html +++ b/static/web/index.html @@ -1,9 +1,9 @@ {{.Name}}
{{.Name}}
Logo
Preview
\ No newline at end of file +
Logo
Preview
\ No newline at end of file