@langsword/trace 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/trace.umd.js CHANGED
@@ -1,36 +1,88 @@
1
- (function(et,en){typeof exports=="object"&&typeof module<"u"?en(exports,require("pinia"),require("axios")):typeof define=="function"&&define.amd?define(["exports","pinia","axios"],en):(et=typeof globalThis<"u"?globalThis:et||self,en(et.LangswordTrace={},et.Pinia,et.axios))})(this,function(et,en,Mo){"use strict";var xa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},bi={exports:{}},Ca;function Yt(){return Ca||(Ca=1,function(y,f){(function(h,P){y.exports=P()})(xa,function(){var h=navigator.userAgent,P=navigator.platform,T=/gecko\/\d/i.test(h),E=/MSIE \d/.test(h),O=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(h),C=/Edge\/(\d+)/.exec(h),_=E||O||C,b=_&&(E?document.documentMode||6:+(C||O)[1]),D=!C&&/WebKit\//.test(h),Q=D&&/Qt\/\d+\.\d+/.test(h),N=!C&&/Chrome\/(\d+)/.exec(h),Y=N&&+N[1],B=/Opera\//.test(h),J=/Apple Computer/.test(navigator.vendor),I=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(h),x=/PhantomJS/.test(h),k=J&&(/Mobile\/\w+/.test(h)||navigator.maxTouchPoints>2),W=/Android/.test(h),X=k||W||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(h),Z=k||/Mac/.test(P),ie=/\bCrOS\b/.test(h),se=/win/i.test(P),fe=B&&h.match(/Version\/(\d*\.\d*)/);fe&&(fe=Number(fe[1])),fe&&fe>=15&&(B=!1,D=!0);var Ie=Z&&(Q||B&&(fe==null||fe<12.11)),Ne=T||_&&b>=9;function ye(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var je=function(e,t){var n=e.className,r=ye(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function R(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function $(e,t){return R(e).appendChild(t)}function g(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var a=0;a<t.length;++a)i.appendChild(t[a]);return i}function Je(e,t,n,r){var i=g(e,t,n,r);return i.setAttribute("role","presentation"),i}var Ke;document.createRange?Ke=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:Ke=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function Re(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function _e(e){var t=e.ownerDocument||e,n;try{n=e.activeElement}catch{n=t.body||null}for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}function xe(e,t){var n=e.className;ye(t).test(n)||(e.className+=(n?" ":"")+t)}function Ee(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!ye(n[r]).test(t)&&(t+=" "+n[r]);return t}var hr=function(e){e.select()};k?hr=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:_&&(hr=function(e){try{e.select()}catch{}});function ct(e){return e.display.wrapper.ownerDocument}function mt(e){return Pe(e.display.wrapper)}function Pe(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function ae(e){return ct(e).defaultView}function re(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ue(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function ve(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var a=r||0,s=i||0;;){var o=e.indexOf(" ",a);if(o<0||o>=t)return s+(t-a);s+=o-a,s+=n-s%n,a=o+1}}var Dt=function(){this.id=null,this.f=null,this.time=0,this.handler=re(this.onTimeout,this)};Dt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Dt.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function oe(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var Qe=50,jt={toString:function(){return"CodeMirror.Pass"}},ht={scroll:!1},Ot={origin:"*mouse"},dt={origin:"+move"};function Mt(e,t,n){for(var r=0,i=0;;){var a=e.indexOf(" ",r);a==-1&&(a=e.length);var s=a-r;if(a==e.length||i+s>=t)return r+Math.min(s,t-i);if(i+=a-r,i+=n-i%n,r=a+1,i>=t)return r}}var Wt=[""];function rn(e){for(;Wt.length<=e;)Wt.push(he(Wt)+" ");return Wt[e]}function he(e){return e[e.length-1]}function dr(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function Si(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Wn(){}function Hn(e,t){var n;return Object.create?n=Object.create(e):(Wn.prototype=e,n=new Wn),t&&ue(t,n),n}var ki=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function nn(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||ki.test(e))}function Ht(e,t){return t?t.source.indexOf("\\w")>-1&&nn(e)?!0:t.test(e):nn(e)}function Fn(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ft=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function De(e){return e.charCodeAt(0)>=768&&Ft.test(e)}function Jt(e,t,n){for(;(n<0?t>0:t<e.length)&&De(e.charAt(t));)t+=n;return t}function Nt(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,a=r<0?Math.ceil(i):Math.floor(i);if(a==t)return e(a)?t:n;e(a)?n=a:t=a+r}}function Qt(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,a=0;a<e.length;++a){var s=e[a];(s.from<n&&s.to>t||t==n&&s.to==t)&&(r(Math.max(s.from,t),Math.min(s.to,n),s.level==1?"rtl":"ltr",a),i=!0)}i||r(t,n,"ltr")}var pr=null;function Zt(e,t,n){var r;pr=null;for(var i=0;i<e.length;++i){var a=e[i];if(a.from<t&&a.to>t)return i;a.to==t&&(a.from!=a.to&&n=="before"?r=i:pr=i),a.from==t&&(a.from!=a.to&&n!="before"?r=i:pr=i)}return r??pr}var Ti=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(u){return u<=247?e.charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?t.charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":u==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,o=/[1n]/;function l(u,d,v){this.level=u,this.from=d,this.to=v}return function(u,d){var v=d=="ltr"?"L":"R";if(u.length==0||d=="ltr"&&!r.test(u))return!1;for(var w=u.length,m=[],L=0;L<w;++L)m.push(n(u.charCodeAt(L)));for(var A=0,F=v;A<w;++A){var z=m[A];z=="m"?m[A]=F:F=z}for(var K=0,U=v;K<w;++K){var q=m[K];q=="1"&&U=="r"?m[K]="n":a.test(q)&&(U=q,q=="r"&&(m[K]="R"))}for(var te=1,V=m[0];te<w-1;++te){var le=m[te];le=="+"&&V=="1"&&m[te+1]=="1"?m[te]="1":le==","&&V==m[te+1]&&(V=="1"||V=="n")&&(m[te]=V),V=le}for(var me=0;me<w;++me){var ze=m[me];if(ze==",")m[me]="N";else if(ze=="%"){var we=void 0;for(we=me+1;we<w&&m[we]=="%";++we);for(var ft=me&&m[me-1]=="!"||we<w&&m[we]=="1"?"1":"N",at=me;at<we;++at)m[at]=ft;me=we-1}}for(var Oe=0,st=v;Oe<w;++Oe){var Ge=m[Oe];st=="L"&&Ge=="1"?m[Oe]="L":a.test(Ge)&&(st=Ge)}for(var Ae=0;Ae<w;++Ae)if(i.test(m[Ae])){var Me=void 0;for(Me=Ae+1;Me<w&&i.test(m[Me]);++Me);for(var Te=(Ae?m[Ae-1]:v)=="L",ot=(Me<w?m[Me]:v)=="L",Zr=Te==ot?Te?"L":"R":v,cr=Ae;cr<Me;++cr)m[cr]=Zr;Ae=Me-1}for(var Ye=[],Pt,Ue=0;Ue<w;)if(s.test(m[Ue])){var ba=Ue;for(++Ue;Ue<w&&s.test(m[Ue]);++Ue);Ye.push(new l(0,ba,Ue))}else{var Xt=Ue,kr=Ye.length,Tr=d=="rtl"?1:0;for(++Ue;Ue<w&&m[Ue]!="L";++Ue);for(var Ve=Xt;Ve<Ue;)if(o.test(m[Ve])){Xt<Ve&&(Ye.splice(kr,0,new l(1,Xt,Ve)),kr+=Tr);var Vr=Ve;for(++Ve;Ve<Ue&&o.test(m[Ve]);++Ve);Ye.splice(kr,0,new l(2,Vr,Ve)),kr+=Tr,Xt=Ve}else++Ve;Xt<Ue&&Ye.splice(kr,0,new l(1,Xt,Ue))}return d=="ltr"&&(Ye[0].level==1&&(Pt=u.match(/^\s+/))&&(Ye[0].from=Pt[0].length,Ye.unshift(new l(0,0,Pt[0].length))),he(Ye).level==1&&(Pt=u.match(/\s+$/))&&(he(Ye).to-=Pt[0].length,Ye.push(new l(0,w-Pt[0].length,w)))),d=="rtl"?Ye.reverse():Ye}}();function ce(e,t){var n=e.order;return n==null&&(n=e.order=Ti(e.text,t)),n}var Bn=[],ee=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Bn).concat(n)}};function Bt(e,t){return e._handlers&&e._handlers[t]||Bn}function $e(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var a=oe(i,n);a>-1&&(r[t]=i.slice(0,a).concat(i.slice(a+1)))}}}function Ce(e,t){var n=Bt(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Se(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Ce(e,n||t.type,e,t),tt(t)||t.codemirrorIgnore}function gt(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)oe(n,t[r])==-1&&n.push(t[r])}function lt(e,t){return Bt(e,t).length>0}function bt(e){e.prototype.on=function(t,n){ee(this,t,n)},e.prototype.off=function(t,n){$e(this,t,n)}}function qe(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function _r(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function tt(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Vt(e){qe(e),_r(e)}function an(e){return e.target||e.srcElement}function wt(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),Z&&e.ctrlKey&&t==1&&(t=3),t}var Li=function(){if(_&&b<9)return!1;var e=g("div");return"draggable"in e||"dragDrop"in e}(),Dr;function zn(e){if(Dr==null){var t=g("span","​");$(e,g("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Dr=t.offsetWidth<=1&&t.offsetHeight>2&&!(_&&b<8))}var n=Dr?g("span","​"):g("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var sn;function er(e){if(sn!=null)return sn;var t=$(e,document.createTextNode("AخA")),n=Ke(t,0,1).getBoundingClientRect(),r=Ke(t,1,2).getBoundingClientRect();return R(e),!n||n.left==n.right?!1:sn=r.right-n.right<3}var yt=`
1
+ (function(de,Be){typeof exports=="object"&&typeof module<"u"?Be(exports,require("pinia"),require("axios"),require("vue")):typeof define=="function"&&define.amd?define(["exports","pinia","axios","vue"],Be):(de=typeof globalThis<"u"?globalThis:de||self,Be(de.LangswordTrace={},de.Pinia,de.axios,de.Vue))})(this,function(de,Be,Nt,Ff){"use strict";var lv=Object.defineProperty;var Rf=de=>{throw TypeError(de)};var uv=(de,Be,Nt)=>Be in de?lv(de,Be,{enumerable:!0,configurable:!0,writable:!0,value:Nt}):de[Be]=Nt;var Ne=(de,Be,Nt)=>uv(de,typeof Be!="symbol"?Be+"":Be,Nt),fv=(de,Be,Nt)=>Be.has(de)||Rf("Cannot "+Nt);var zf=(de,Be,Nt)=>Be.has(de)?Rf("Cannot add the same private member more than once"):Be instanceof WeakSet?Be.add(de):Be.set(de,Nt);var Ia=(de,Be,Nt)=>(fv(de,Be,"access private method"),Nt);var Br,ao,Pf;var so=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Na={exports:{}},oo;function br(){return oo||(oo=1,function(f,a){(function(s,l){f.exports=l()})(so,function(){var s=navigator.userAgent,l=navigator.platform,h=/gecko\/\d/i.test(s),g=/MSIE \d/.test(s),p=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(s),y=/Edge\/(\d+)/.exec(s),w=g||p||y,b=w&&(g?document.documentMode||6:+(y||p)[1]),k=!y&&/WebKit\//.test(s),A=k&&/Qt\/\d+\.\d+/.test(s),L=!y&&/Chrome\/(\d+)/.exec(s),H=L&&+L[1],P=/Opera\//.test(s),$=/Apple Computer/.test(navigator.vendor),N=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(s),E=/PhantomJS/.test(s),D=$&&(/Mobile\/\w+/.test(s)||navigator.maxTouchPoints>2),R=/Android/.test(s),G=D||R||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(s),Z=D||/Mac/.test(l),ee=/\bCrOS\b/.test(s),ne=/win/i.test(l),ue=P&&s.match(/Version\/(\d*\.\d*)/);ue&&(ue=Number(ue[1])),ue&&ue>=15&&(P=!1,k=!0);var Ee=Z&&(A||P&&(ue==null||ue<12.11)),ke=h||w&&b>=9;function Ce(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var ct=function(e,t){var n=e.className,r=Ce(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function W(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Y(e,t){return W(e).appendChild(t)}function T(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function ht(e,t,n,r){var i=T(e,t,n,r);return i.setAttribute("role","presentation"),i}var st;document.createRange?st=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:st=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function Ze(e,t){if(t.nodeType==3&&(t=t.parentNode),e.contains)return e.contains(t);do if(t.nodeType==11&&(t=t.host),t==e)return!0;while(t=t.parentNode)}function qe(e){var t=e.ownerDocument||e,n;try{n=e.activeElement}catch{n=t.body||null}for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}function ze(e,t){var n=e.className;Ce(t).test(n)||(e.className+=(n?" ":"")+t)}function Qe(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!Ce(n[r]).test(t)&&(t+=" "+n[r]);return t}var $r=function(e){e.select()};D?$r=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:w&&($r=function(e){try{e.select()}catch{}});function At(e){return e.display.wrapper.ownerDocument}function Wt(e){return Ve(e.display.wrapper)}function Ve(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function oe(e){return At(e).defaultView}function ie(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function he(e,t,n){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(n!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function xe(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var o=r||0,u=i||0;;){var c=e.indexOf(" ",o);if(c<0||c>=t)return u+(t-o);u+=c-o,u+=n-u%n,o=c+1}}var Vt=function(){this.id=null,this.f=null,this.time=0,this.handler=ie(this.onTimeout,this)};Vt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Vt.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function fe(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var dt=50,wr={toString:function(){return"CodeMirror.Pass"}},Ot={scroll:!1},Jt={origin:"*mouse"},Et={origin:"+move"};function er(e,t,n){for(var r=0,i=0;;){var o=e.indexOf(" ",r);o==-1&&(o=e.length);var u=o-r;if(o==e.length||i+u>=t)return r+Math.min(u,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}var lr=[""];function Jn(e){for(;lr.length<=e;)lr.push(me(lr)+" ");return lr[e]}function me(e){return e[e.length-1]}function Ur(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function os(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function Zi(){}function Qi(e,t){var n;return Object.create?n=Object.create(e):(Zi.prototype=e,n=new Zi),t&&he(t,n),n}var ls=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ei(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||ls.test(e))}function ur(e,t){return t?t.source.indexOf("\\w")>-1&&ei(e)?!0:t.test(e):ei(e)}function Vi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var fr=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function Ge(e){return e.charCodeAt(0)>=768&&fr.test(e)}function xr(e,t,n){for(;(n<0?t>0:t<e.length)&&Ge(e.charAt(t));)t+=n;return t}function tr(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function kr(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var u=e[o];(u.from<n&&u.to>t||t==n&&u.to==t)&&(r(Math.max(u.from,t),Math.min(u.to,n),u.level==1?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}var jr=null;function Sr(e,t,n){var r;jr=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&n=="before"?r=i:jr=i),o.from==t&&(o.from!=o.to&&n!="before"?r=i:jr=i)}return r??jr}var us=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(v){return v<=247?e.charAt(v):1424<=v&&v<=1524?"R":1536<=v&&v<=1785?t.charAt(v-1536):1774<=v&&v<=2220?"r":8192<=v&&v<=8203?"w":v==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,u=/[Lb1n]/,c=/[1n]/;function d(v,x,C){this.level=v,this.from=x,this.to=C}return function(v,x){var C=x=="ltr"?"L":"R";if(v.length==0||x=="ltr"&&!r.test(v))return!1;for(var O=v.length,_=[],M=0;M<O;++M)_.push(n(v.charCodeAt(M)));for(var F=0,U=C;F<O;++F){var j=_[F];j=="m"?_[F]=U:U=j}for(var K=0,q=C;K<O;++K){var Q=_[K];Q=="1"&&q=="r"?_[K]="n":o.test(Q)&&(q=Q,Q=="r"&&(_[K]="R"))}for(var re=1,J=_[0];re<O-1;++re){var ce=_[re];ce=="+"&&J=="1"&&_[re+1]=="1"?_[re]="1":ce==","&&J==_[re+1]&&(J=="1"||J=="n")&&(_[re]=J),J=ce}for(var Le=0;Le<O;++Le){var nt=_[Le];if(nt==",")_[Le]="N";else if(nt=="%"){var Me=void 0;for(Me=Le+1;Me<O&&_[Me]=="%";++Me);for(var Tt=Le&&_[Le-1]=="!"||Me<O&&_[Me]=="1"?"1":"N",wt=Le;wt<Me;++wt)_[wt]=Tt;Le=Me-1}}for(var Xe=0,xt=C;Xe<O;++Xe){var at=_[Xe];xt=="L"&&at=="1"?_[Xe]="L":o.test(at)&&(xt=at)}for(var Ye=0;Ye<O;++Ye)if(i.test(_[Ye])){var Ke=void 0;for(Ke=Ye+1;Ke<O&&i.test(_[Ke]);++Ke);for(var We=(Ye?_[Ye-1]:C)=="L",kt=(Ke<O?_[Ke]:C)=="L",Fn=We==kt?We?"L":"R":C,zr=Ye;zr<Ke;++zr)_[zr]=Fn;Ye=Ke-1}for(var ft=[],sr,it=0;it<O;)if(u.test(_[it])){var no=it;for(++it;it<O&&u.test(_[it]);++it);ft.push(new d(0,no,it))}else{var yr=it,en=ft.length,tn=x=="rtl"?1:0;for(++it;it<O&&_[it]!="L";++it);for(var gt=yr;gt<it;)if(c.test(_[gt])){yr<gt&&(ft.splice(en,0,new d(1,yr,gt)),en+=tn);var Hn=gt;for(++gt;gt<it&&c.test(_[gt]);++gt);ft.splice(en,0,new d(2,Hn,gt)),en+=tn,yr=gt}else++gt;yr<it&&ft.splice(en,0,new d(1,yr,it))}return x=="ltr"&&(ft[0].level==1&&(sr=v.match(/^\s+/))&&(ft[0].from=sr[0].length,ft.unshift(new d(0,0,sr[0].length))),me(ft).level==1&&(sr=v.match(/\s+$/))&&(me(ft).to-=sr[0].length,ft.push(new d(0,O-sr[0].length,O)))),x=="rtl"?ft.reverse():ft}}();function ge(e,t){var n=e.order;return n==null&&(n=e.order=us(e.text,t)),n}var Ji=[],te=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Ji).concat(n)}};function cr(e,t){return e._handlers&&e._handlers[t]||Ji}function ot(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=fe(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Pe(e,t){var n=cr(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Fe(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Pe(e,n||t.type,e,t),vt(t)||t.codemirrorIgnore}function zt(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)fe(n,t[r])==-1&&n.push(t[r])}function St(e,t){return cr(e,t).length>0}function Bt(e){e.prototype.on=function(t,n){te(this,t,n)},e.prototype.off=function(t,n){ot(this,t,n)}}function lt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function dn(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function vt(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Cr(e){lt(e),dn(e)}function ti(e){return e.target||e.srcElement}function $t(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),Z&&e.ctrlKey&&t==1&&(t=3),t}var fs=function(){if(w&&b<9)return!1;var e=T("div");return"draggable"in e||"dragDrop"in e}(),pn;function ea(e){if(pn==null){var t=T("span","​");Y(e,T("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(pn=t.offsetWidth<=1&&t.offsetHeight>2&&!(w&&b<8))}var n=pn?T("span","​"):T("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var ri;function Tr(e){if(ri!=null)return ri;var t=Y(e,document.createTextNode("AخA")),n=st(t,0,1).getBoundingClientRect(),r=st(t,1,2).getBoundingClientRect();return W(e),!n||n.left==n.right?!1:ri=r.right-n.right<3}var Pt=`
2
2
 
3
3
  b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
4
- `,t);i==-1&&(i=e.length);var a=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),s=a.indexOf("\r");s!=-1?(n.push(a.slice(0,s)),t+=s+1):(n.push(a),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},tr=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},Un=function(){var e=g("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),xt=null;function _i(e){if(xt!=null)return xt;var t=$(e,g("span","x")),n=t.getBoundingClientRect(),r=Ke(t,0,1).getBoundingClientRect();return xt=Math.abs(n.left-r.left)>1}var Or={},Ct={};function St(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Or[e]=t}function vr(e,t){Ct[e]=t}function Mr(e){if(typeof e=="string"&&Ct.hasOwnProperty(e))e=Ct[e];else if(e&&typeof e.name=="string"&&Ct.hasOwnProperty(e.name)){var t=Ct[e.name];typeof t=="string"&&(t={name:t}),e=Hn(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Mr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Mr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Nr(e,t){t=Mr(t);var n=Or[t.name];if(!n)return Nr(e,"text/plain");var r=n(e,t);if(rr.hasOwnProperty(t.name)){var i=rr[t.name];for(var a in i)i.hasOwnProperty(a)&&(r.hasOwnProperty(a)&&(r["_"+a]=r[a]),r[a]=i[a])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var s in t.modeProps)r[s]=t.modeProps[s];return r}var rr={};function Ar(e,t){var n=rr.hasOwnProperty(e)?rr[e]:rr[e]={};ue(t,n)}function At(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function on(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Ir(e,t,n){return e.startState?e.startState(t,n):!0}var ke=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};ke.prototype.eol=function(){return this.pos>=this.string.length},ke.prototype.sol=function(){return this.pos==this.lineStart},ke.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},ke.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},ke.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},ke.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},ke.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},ke.prototype.skipToEnd=function(){this.pos=this.string.length},ke.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},ke.prototype.backUp=function(e){this.pos-=e},ke.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=ve(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?ve(this.string,this.lineStart,this.tabSize):0)},ke.prototype.indentation=function(){return ve(this.string,null,this.tabSize)-(this.lineStart?ve(this.string,this.lineStart,this.tabSize):0)},ke.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(s){return n?s.toLowerCase():s},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var a=this.string.slice(this.pos).match(e);return a&&a.index>0?null:(a&&t!==!1&&(this.pos+=a[0].length),a)}},ke.prototype.current=function(){return this.string.slice(this.start,this.pos)},ke.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},ke.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},ke.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function j(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],a=i.chunkSize();if(t<a){n=i;break}t-=a}return n.lines[t]}function zt(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(a){var s=a.text;i==n.line&&(s=s.slice(0,n.ch)),i==t.line&&(s=s.slice(t.ch)),r.push(s),++i}),r}function ln(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function pt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function c(e){if(e.parent==null)return null;for(var t=e.parent,n=oe(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function p(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],a=i.height;if(t<a){e=i;continue e}t-=a,n+=i.chunkSize()}return n}while(!e.lines);for(var s=0;s<e.lines.length;++s){var o=e.lines[s],l=o.height;if(t<l)break;t-=l}return n+s}function M(e,t){return t>=e.first&&t<e.first+e.size}function H(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function S(e,t,n){if(n===void 0&&(n=null),!(this instanceof S))return new S(e,t,n);this.line=e,this.ch=t,this.sticky=n}function G(e,t){return e.line-t.line||e.ch-t.ch}function de(e,t){return e.sticky==t.sticky&&G(e,t)==0}function We(e){return S(e.line,e.ch)}function rt(e,t){return G(e,t)<0?t:e}function Rr(e,t){return G(e,t)<0?e:t}function Ma(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ne(e,t){if(t.line<e.first)return S(e.first,0);var n=e.first+e.size-1;return t.line>n?S(n,j(e,n).text.length):Ko(t,j(e,t.line).text.length)}function Ko(e,t){var n=e.ch;return n==null||n>t?S(e.line,t):n<0?S(e.line,0):e}function Na(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ne(e,t[r]);return n}var Gn=function(e,t){this.state=e,this.lookAhead=t},It=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};It.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},It.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},It.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},It.fromSaved=function(e,t,n){return t instanceof Gn?new It(e,At(e.mode,t.state),n,t.lookAhead):new It(e,At(e.mode,t),n)},It.prototype.save=function(e){var t=e!==!1?At(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Gn(t,this.maxLookAhead):t};function Aa(e,t,n,r){var i=[e.state.modeGen],a={};Ha(e,t.text,e.doc.mode,n,function(u,d){return i.push(u,d)},a,r);for(var s=n.state,o=function(u){n.baseTokens=i;var d=e.state.overlays[u],v=1,w=0;n.state=!0,Ha(e,t.text,d.mode,n,function(m,L){for(var A=v;w<m;){var F=i[v];F>m&&i.splice(v,1,m,i[v+1],F),v+=2,w=Math.min(m,F)}if(L)if(d.opaque)i.splice(A,v-A,m,"overlay "+L),v=A+2;else for(;A<v;A+=2){var z=i[A+1];i[A+1]=(z?z+" ":"")+"overlay "+L}},a),n.state=s,n.baseTokens=null,n.baseTokenPos=1},l=0;l<e.state.overlays.length;++l)o(l);return{styles:i,classes:a.bgClass||a.textClass?a:null}}function Ia(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=un(e,c(t)),i=t.text.length>e.options.maxHighlightLength&&At(e.doc.mode,r.state),a=Aa(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=a.styles,a.classes?t.styleClasses=a.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function un(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new It(r,!0,t);var a=$o(e,t,n),s=a>r.first&&j(r,a-1).stateAfter,o=s?It.fromSaved(r,s,a):new It(r,Ir(r.mode),a);return r.iter(a,t,function(l){Di(e,l.text,o);var u=o.line;l.stateAfter=u==t-1||u%5==0||u>=i.viewFrom&&u<i.viewTo?o.save():null,o.nextLine()}),n&&(r.modeFrontier=o.line),o}function Di(e,t,n,r){var i=e.doc.mode,a=new ke(t,e.options.tabSize,n);for(a.start=a.pos=r||0,t==""&&Ra(i,n.state);!a.eol();)Oi(i,a,n.state),a.start=a.pos}function Ra(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=on(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}}function Oi(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=on(e,n).mode);var a=e.token(t,n);if(t.pos>t.start)return a}throw new Error("Mode "+e.name+" failed to advance stream.")}var Ea=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Pa(e,t,n,r){var i=e.doc,a=i.mode,s;t=ne(i,t);var o=j(i,t.line),l=un(e,t.line,n),u=new ke(o.text,e.options.tabSize,l),d;for(r&&(d=[]);(r||u.pos<t.ch)&&!u.eol();)u.start=u.pos,s=Oi(a,u,l.state),r&&d.push(new Ea(u,s,At(i.mode,l.state)));return r?d:new Ea(u,s,l.state)}function Wa(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Ha(e,t,n,r,i,a,s){var o=n.flattenSpans;o==null&&(o=e.options.flattenSpans);var l=0,u=null,d=new ke(t,e.options.tabSize,r),v,w=e.options.addModeClass&&[null];for(t==""&&Wa(Ra(n,r.state),a);!d.eol();){if(d.pos>e.options.maxHighlightLength?(o=!1,s&&Di(e,t,r,d.pos),d.pos=t.length,v=null):v=Wa(Oi(n,d,r.state,w),a),w){var m=w[0].name;m&&(v="m-"+(v?m+" "+v:m))}if(!o||u!=v){for(;l<d.start;)l=Math.min(d.start,l+5e3),i(l,u);u=v}d.start=d.pos}for(;l<d.pos;){var L=Math.min(d.pos,l+5e3);i(L,u),l=L}}function $o(e,t,n){for(var r,i,a=e.doc,s=n?-1:t-(e.doc.mode.innerMode?1e3:100),o=t;o>s;--o){if(o<=a.first)return a.first;var l=j(a,o-1),u=l.stateAfter;if(u&&(!n||o+(u instanceof Gn?u.lookAhead:0)<=a.modeFrontier))return o;var d=ve(l.text,null,e.options.tabSize);(i==null||r>d)&&(i=o-1,r=d)}return i}function qo(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;r>n;r--){var i=j(e,r).stateAfter;if(i&&(!(i instanceof Gn)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}var Fa=!1,Ut=!1;function Xo(){Fa=!0}function Yo(){Ut=!0}function Kn(e,t,n){this.marker=e,this.from=t,this.to=n}function fn(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function jo(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Jo(e,t,n){var r=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));r&&e.markedSpans&&r.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],r&&r.add(e.markedSpans)),t.marker.attachLine(e)}function Qo(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var a=e[i],s=a.marker,o=a.from==null||(s.inclusiveLeft?a.from<=t:a.from<t);if(o||a.from==t&&s.type=="bookmark"&&(!n||!a.marker.insertLeft)){var l=a.to==null||(s.inclusiveRight?a.to>=t:a.to>t);(r||(r=[])).push(new Kn(s,a.from,l?null:a.to))}}return r}function Zo(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var a=e[i],s=a.marker,o=a.to==null||(s.inclusiveRight?a.to>=t:a.to>t);if(o||a.from==t&&s.type=="bookmark"&&(!n||a.marker.insertLeft)){var l=a.from==null||(s.inclusiveLeft?a.from<=t:a.from<t);(r||(r=[])).push(new Kn(s,l?null:a.from-t,a.to==null?null:a.to-t))}}return r}function Mi(e,t){if(t.full)return null;var n=M(e,t.from.line)&&j(e,t.from.line).markedSpans,r=M(e,t.to.line)&&j(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,a=t.to.ch,s=G(t.from,t.to)==0,o=Qo(n,i,s),l=Zo(r,a,s),u=t.text.length==1,d=he(t.text).length+(u?i:0);if(o)for(var v=0;v<o.length;++v){var w=o[v];if(w.to==null){var m=fn(l,w.marker);m?u&&(w.to=m.to==null?null:m.to+d):w.to=i}}if(l)for(var L=0;L<l.length;++L){var A=l[L];if(A.to!=null&&(A.to+=d),A.from==null){var F=fn(o,A.marker);F||(A.from=d,u&&(o||(o=[])).push(A))}else A.from+=d,u&&(o||(o=[])).push(A)}o&&(o=Ba(o)),l&&l!=o&&(l=Ba(l));var z=[o];if(!u){var K=t.text.length-2,U;if(K>0&&o)for(var q=0;q<o.length;++q)o[q].to==null&&(U||(U=[])).push(new Kn(o[q].marker,null,null));for(var te=0;te<K;++te)z.push(U);z.push(l)}return z}function Ba(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function Vo(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(m){if(m.markedSpans)for(var L=0;L<m.markedSpans.length;++L){var A=m.markedSpans[L].marker;A.readOnly&&(!r||oe(r,A)==-1)&&(r||(r=[])).push(A)}}),!r)return null;for(var i=[{from:t,to:n}],a=0;a<r.length;++a)for(var s=r[a],o=s.find(0),l=0;l<i.length;++l){var u=i[l];if(!(G(u.to,o.from)<0||G(u.from,o.to)>0)){var d=[l,1],v=G(u.from,o.from),w=G(u.to,o.to);(v<0||!s.inclusiveLeft&&!v)&&d.push({from:u.from,to:o.from}),(w>0||!s.inclusiveRight&&!w)&&d.push({from:o.to,to:u.to}),i.splice.apply(i,d),l+=d.length-3}}return i}function za(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function Ua(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function $n(e){return e.inclusiveLeft?-1:0}function qn(e){return e.inclusiveRight?1:0}function Ni(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),a=G(r.from,i.from)||$n(e)-$n(t);if(a)return-a;var s=G(r.to,i.to)||qn(e)-qn(t);return s||t.id-e.id}function Ga(e,t){var n=Ut&&e.markedSpans,r;if(n)for(var i=void 0,a=0;a<n.length;++a)i=n[a],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||Ni(r,i.marker)<0)&&(r=i.marker);return r}function Ka(e){return Ga(e,!0)}function Xn(e){return Ga(e,!1)}function el(e,t){var n=Ut&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var a=n[i];a.marker.collapsed&&(a.from==null||a.from<t)&&(a.to==null||a.to>t)&&(!r||Ni(r,a.marker)<0)&&(r=a.marker)}return r}function $a(e,t,n,r,i){var a=j(e,t),s=Ut&&a.markedSpans;if(s)for(var o=0;o<s.length;++o){var l=s[o];if(l.marker.collapsed){var u=l.marker.find(0),d=G(u.from,n)||$n(l.marker)-$n(i),v=G(u.to,r)||qn(l.marker)-qn(i);if(!(d>=0&&v<=0||d<=0&&v>=0)&&(d<=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?G(u.to,n)>=0:G(u.to,n)>0)||d>=0&&(l.marker.inclusiveRight&&i.inclusiveLeft?G(u.from,r)<=0:G(u.from,r)<0)))return!0}}}function kt(e){for(var t;t=Ka(e);)e=t.find(-1,!0).line;return e}function tl(e){for(var t;t=Xn(e);)e=t.find(1,!0).line;return e}function rl(e){for(var t,n;t=Xn(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function Ai(e,t){var n=j(e,t),r=kt(n);return n==r?t:c(r)}function qa(e,t){if(t>e.lastLine())return t;var n=j(e,t),r;if(!nr(e,n))return t;for(;r=Xn(n);)n=r.find(1,!0).line;return c(n)+1}function nr(e,t){var n=Ut&&t.markedSpans;if(n){for(var r=void 0,i=0;i<n.length;++i)if(r=n[i],!!r.marker.collapsed){if(r.from==null)return!0;if(!r.marker.widgetNode&&r.from==0&&r.marker.inclusiveLeft&&Ii(e,t,r))return!0}}}function Ii(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return Ii(e,r.line,fn(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,a=0;a<t.markedSpans.length;++a)if(i=t.markedSpans[a],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Ii(e,t,i))return!0}function Gt(e){e=kt(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var a=n.parent;a;n=a,a=n.parent)for(var s=0;s<a.children.length;++s){var o=a.children[s];if(o==n)break;t+=o.height}return t}function Yn(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Ka(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Xn(r);){var a=n.find(0,!0);t-=r.text.length-a.from.ch,r=a.to.line,t+=r.text.length-a.to.ch}return t}function Ri(e){var t=e.display,n=e.doc;t.maxLine=j(n,n.first),t.maxLineLength=Yn(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=Yn(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Er=function(e,t,n){this.text=e,Ua(this,t),this.height=n?n(this):1};Er.prototype.lineNo=function(){return c(this)},bt(Er);function nl(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),za(e),Ua(e,n);var i=r?r(e):1;i!=e.height&&pt(e,i)}function il(e){e.parent=null,za(e)}var al={},sl={};function Xa(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?sl:al;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Ya(e,t){var n=Je("span",null,null,D?"padding-right: .1px":null),r={pre:Je("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var a=i?t.rest[i-1]:t.line,s=void 0;r.pos=0,r.addToken=ll,er(e.display.measure)&&(s=ce(a,e.doc.direction))&&(r.addToken=fl(r.addToken,s)),r.map=[];var o=t!=e.display.externalMeasured&&c(a);cl(a,r,Ia(e,a,o)),a.styleClasses&&(a.styleClasses.bgClass&&(r.bgClass=Ee(a.styleClasses.bgClass,r.bgClass||"")),a.styleClasses.textClass&&(r.textClass=Ee(a.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(zn(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(D){var l=r.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Ce(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ee(r.pre.className,r.textClass||"")),r}function ol(e){var t=g("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ll(e,t,n,r,i,a,s){if(t){var o=e.splitSpaces?ul(t,e.trailingSpace):t,l=e.cm.state.specialChars,u=!1,d;if(!l.test(t))e.col+=t.length,d=document.createTextNode(o),e.map.push(e.pos,e.pos+t.length,d),_&&b<9&&(u=!0),e.pos+=t.length;else{d=document.createDocumentFragment();for(var v=0;;){l.lastIndex=v;var w=l.exec(t),m=w?w.index-v:t.length-v;if(m){var L=document.createTextNode(o.slice(v,v+m));_&&b<9?d.appendChild(g("span",[L])):d.appendChild(L),e.map.push(e.pos,e.pos+m,L),e.col+=m,e.pos+=m}if(!w)break;v+=m+1;var A=void 0;if(w[0]==" "){var F=e.cm.options.tabSize,z=F-e.col%F;A=d.appendChild(g("span",rn(z),"cm-tab")),A.setAttribute("role","presentation"),A.setAttribute("cm-text"," "),e.col+=z}else w[0]=="\r"||w[0]==`
5
- `?(A=d.appendChild(g("span",w[0]=="\r"?"␍":"␤","cm-invalidchar")),A.setAttribute("cm-text",w[0]),e.col+=1):(A=e.cm.options.specialCharPlaceholder(w[0]),A.setAttribute("cm-text",w[0]),_&&b<9?d.appendChild(g("span",[A])):d.appendChild(A),e.col+=1);e.map.push(e.pos,e.pos+1,A),e.pos++}}if(e.trailingSpace=o.charCodeAt(t.length-1)==32,n||r||i||u||a||s){var K=n||"";r&&(K+=r),i&&(K+=i);var U=g("span",[d],K,a);if(s)for(var q in s)s.hasOwnProperty(q)&&q!="style"&&q!="class"&&U.setAttribute(q,s[q]);return e.content.appendChild(U)}e.content.appendChild(d)}}function ul(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var a=e.charAt(i);a==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(a=" "),r+=a,n=a==" "}return r}function fl(e,t){return function(n,r,i,a,s,o,l){i=i?i+" cm-force-border":"cm-force-border";for(var u=n.pos,d=u+r.length;;){for(var v=void 0,w=0;w<t.length&&(v=t[w],!(v.to>u&&v.from<=u));w++);if(v.to>=d)return e(n,r,i,a,s,o,l);e(n,r.slice(0,v.to-u),i,a,null,o,l),a=null,r=r.slice(v.to-u),u=v.to}}}function ja(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function cl(e,t,n){var r=e.markedSpans,i=e.text,a=0;if(!r){for(var s=1;s<n.length;s+=2)t.addToken(t,i.slice(a,a=n[s]),Xa(n[s+1],t.cm.options));return}for(var o=i.length,l=0,u=1,d="",v,w,m=0,L,A,F,z,K;;){if(m==l){L=A=F=w="",K=null,z=null,m=1/0;for(var U=[],q=void 0,te=0;te<r.length;++te){var V=r[te],le=V.marker;if(le.type=="bookmark"&&V.from==l&&le.widgetNode)U.push(le);else if(V.from<=l&&(V.to==null||V.to>l||le.collapsed&&V.to==l&&V.from==l)){if(V.to!=null&&V.to!=l&&m>V.to&&(m=V.to,A=""),le.className&&(L+=" "+le.className),le.css&&(w=(w?w+";":"")+le.css),le.startStyle&&V.from==l&&(F+=" "+le.startStyle),le.endStyle&&V.to==m&&(q||(q=[])).push(le.endStyle,V.to),le.title&&((K||(K={})).title=le.title),le.attributes)for(var me in le.attributes)(K||(K={}))[me]=le.attributes[me];le.collapsed&&(!z||Ni(z.marker,le)<0)&&(z=V)}else V.from>l&&m>V.from&&(m=V.from)}if(q)for(var ze=0;ze<q.length;ze+=2)q[ze+1]==m&&(A+=" "+q[ze]);if(!z||z.from==l)for(var we=0;we<U.length;++we)ja(t,0,U[we]);if(z&&(z.from||0)==l){if(ja(t,(z.to==null?o+1:z.to)-l,z.marker,z.from==null),z.to==null)return;z.to==l&&(z=!1)}}if(l>=o)break;for(var ft=Math.min(o,m);;){if(d){var at=l+d.length;if(!z){var Oe=at>ft?d.slice(0,ft-l):d;t.addToken(t,Oe,v?v+L:L,F,l+Oe.length==m?A:"",w,K)}if(at>=ft){d=d.slice(ft-l),l=ft;break}l=at,F=""}d=i.slice(a,a=n[u++]),v=Xa(n[u++],t.cm.options)}}}function Ja(e,t,n){this.line=t,this.rest=rl(t),this.size=this.rest?c(he(this.rest))-n+1:1,this.node=this.text=null,this.hidden=nr(e,t)}function jn(e,t,n){for(var r=[],i,a=t;a<n;a=i){var s=new Ja(e.doc,j(e.doc,a),a);i=a+s.size,r.push(s)}return r}var Pr=null;function hl(e){Pr?Pr.ops.push(e):e.ownsGroup=Pr={ops:[e],delayedCallbacks:[]}}function dl(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function pl(e,t){var n=e.ownsGroup;if(n)try{dl(n)}finally{Pr=null,t(n)}}var cn=null;function He(e,t){var n=Bt(e,t);if(n.length){var r=Array.prototype.slice.call(arguments,2),i;Pr?i=Pr.delayedCallbacks:cn?i=cn:(i=cn=[],setTimeout(vl,0));for(var a=function(o){i.push(function(){return n[o].apply(null,r)})},s=0;s<n.length;++s)a(s)}}function vl(){var e=cn;cn=null;for(var t=0;t<e.length;++t)e[t]()}function Qa(e,t,n,r){for(var i=0;i<t.changes.length;i++){var a=t.changes[i];a=="text"?yl(e,t):a=="gutter"?Va(e,t,n,r):a=="class"?Ei(e,t):a=="widget"&&ml(e,t,r)}t.changes=null}function hn(e){return e.node==e.text&&(e.node=g("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),_&&b<8&&(e.node.style.zIndex=2)),e.node}function gl(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=hn(t);t.background=r.insertBefore(g("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function Za(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Ya(e,t)}function yl(e,t){var n=t.text.className,r=Za(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,Ei(e,t)):n&&(t.text.className=n)}function Ei(e,t){gl(e,t),t.line.wrapClass?hn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Va(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=hn(t);t.gutterBackground=g("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var a=t.line.gutterMarkers;if(e.options.lineNumbers||a){var s=hn(t),o=t.gutter=g("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(o.setAttribute("aria-hidden","true"),e.display.input.setUneditable(o),s.insertBefore(o,t.text),t.line.gutterClass&&(o.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!a||!a["CodeMirror-linenumbers"])&&(t.lineNumber=o.appendChild(g("div",H(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),a)for(var l=0;l<e.display.gutterSpecs.length;++l){var u=e.display.gutterSpecs[l].className,d=a.hasOwnProperty(u)&&a[u];d&&o.appendChild(g("div",[d],"CodeMirror-gutter-elt","left: "+r.gutterLeft[u]+"px; width: "+r.gutterWidth[u]+"px"))}}}function ml(e,t,n){t.alignable&&(t.alignable=null);for(var r=ye("CodeMirror-linewidget"),i=t.node.firstChild,a=void 0;i;i=a)a=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);es(e,t,n)}function bl(e,t,n,r){var i=Za(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Ei(e,t),Va(e,t,n,r),es(e,t,r),t.node}function es(e,t,n){if(ts(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)ts(e,t.rest[r],t,n,!1)}function ts(e,t,n,r,i){if(t.widgets)for(var a=hn(n),s=0,o=t.widgets;s<o.length;++s){var l=o[s],u=g("div",[l.node],"CodeMirror-linewidget"+(l.className?" "+l.className:""));l.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),wl(l,u,n,r),e.display.input.setUneditable(u),i&&l.above?a.insertBefore(u,n.gutter||n.text):a.appendChild(u),He(l,"redraw")}}function wl(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function dn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Re(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),$(t.display.measure,g("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Kt(e,t){for(var n=an(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Jn(e){return e.lineSpace.offsetTop}function Pi(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function rs(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=$(e.measure,g("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Rt(e){return Qe-e.display.nativeBarWidth}function gr(e){return e.display.scroller.clientWidth-Rt(e)-e.display.barWidth}function Wi(e){return e.display.scroller.clientHeight-Rt(e)-e.display.barHeight}function xl(e,t,n){var r=e.options.lineWrapping,i=r&&gr(e);if(!t.measure.heights||r&&t.measure.width!=i){var a=t.measure.heights=[];if(r){t.measure.width=i;for(var s=t.text.firstChild.getClientRects(),o=0;o<s.length-1;o++){var l=s[o],u=s[o+1];Math.abs(l.bottom-u.bottom)>2&&a.push((l.bottom+u.top)/2-n.top)}}a.push(n.bottom-n.top)}}function ns(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(c(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function Cl(e,t){t=kt(t);var n=c(t),r=e.display.externalMeasured=new Ja(e.doc,t,n);r.lineN=n;var i=r.built=Ya(e,r);return r.text=i.pre,$(e.display.lineMeasure,i.pre),r}function is(e,t,n,r){return Et(e,Wr(e,t),n,r)}function Hi(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[br(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Wr(e,t){var n=c(t),r=Hi(e,n);r&&!r.text?r=null:r&&r.changes&&(Qa(e,r,n,Gi(e)),e.curOp.forceUpdate=!0),r||(r=Cl(e,t));var i=ns(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Et(e,t,n,r,i){t.before&&(n=-1);var a=n+(r||""),s;return t.cache.hasOwnProperty(a)?s=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(xl(e,t.view,t.rect),t.hasHeights=!0),s=kl(e,t,n,r),s.bogus||(t.cache[a]=s)),{left:s.left,right:s.right,top:i?s.rtop:s.top,bottom:i?s.rbottom:s.bottom}}var as={left:0,right:0,top:0,bottom:0};function ss(e,t,n){for(var r,i,a,s,o,l,u=0;u<e.length;u+=3)if(o=e[u],l=e[u+1],t<o?(i=0,a=1,s="left"):t<l?(i=t-o,a=i+1):(u==e.length-3||t==l&&e[u+3]>t)&&(a=l-o,i=a-1,t>=l&&(s="right")),i!=null){if(r=e[u+2],o==l&&n==(r.insertLeft?"left":"right")&&(s=n),n=="left"&&i==0)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[(u-=3)+2],s="left";if(n=="right"&&i==l-o)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)r=e[(u+=3)+2],s="right";break}return{node:r,start:i,end:a,collapse:s,coverStart:o,coverEnd:l}}function Sl(e,t){var n=as;if(t=="left")for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;i>=0&&(n=e[i]).left==n.right;i--);return n}function kl(e,t,n,r){var i=ss(t.map,n,r),a=i.node,s=i.start,o=i.end,l=i.collapse,u;if(a.nodeType==3){for(var d=0;d<4;d++){for(;s&&De(t.line.text.charAt(i.coverStart+s));)--s;for(;i.coverStart+o<i.coverEnd&&De(t.line.text.charAt(i.coverStart+o));)++o;if(_&&b<9&&s==0&&o==i.coverEnd-i.coverStart?u=a.parentNode.getBoundingClientRect():u=Sl(Ke(a,s,o).getClientRects(),r),u.left||u.right||s==0)break;o=s,s=s-1,l="right"}_&&b<11&&(u=Tl(e.display.measure,u))}else{s>0&&(l=r="right");var v;e.options.lineWrapping&&(v=a.getClientRects()).length>1?u=v[r=="right"?v.length-1:0]:u=a.getBoundingClientRect()}if(_&&b<9&&!s&&(!u||!u.left&&!u.right)){var w=a.parentNode.getClientRects()[0];w?u={left:w.left,right:w.left+Fr(e.display),top:w.top,bottom:w.bottom}:u=as}for(var m=u.top-t.rect.top,L=u.bottom-t.rect.top,A=(m+L)/2,F=t.view.measure.heights,z=0;z<F.length-1&&!(A<F[z]);z++);var K=z?F[z-1]:0,U=F[z],q={left:(l=="right"?u.right:u.left)-t.rect.left,right:(l=="left"?u.left:u.right)-t.rect.left,top:K,bottom:U};return!u.left&&!u.right&&(q.bogus=!0),e.options.singleCursorHeightPerLine||(q.rtop=m,q.rbottom=L),q}function Tl(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!_i(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function os(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function ls(e){e.display.externalMeasure=null,R(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)os(e.display.view[t])}function pn(e){ls(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function us(e){return N&&W?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function fs(e){return N&&W?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function Fi(e){var t=kt(e),n=t.widgets,r=0;if(n)for(var i=0;i<n.length;++i)n[i].above&&(r+=dn(n[i]));return r}function Qn(e,t,n,r,i){if(!i){var a=Fi(t);n.top+=a,n.bottom+=a}if(r=="line")return n;r||(r="local");var s=Gt(t);if(r=="local"?s+=Jn(e.display):s-=e.display.viewOffset,r=="page"||r=="window"){var o=e.display.lineSpace.getBoundingClientRect();s+=o.top+(r=="window"?0:fs(ct(e)));var l=o.left+(r=="window"?0:us(ct(e)));n.left+=l,n.right+=l}return n.top+=s,n.bottom+=s,n}function cs(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=us(ct(e)),i-=fs(ct(e));else if(n=="local"||!n){var a=e.display.sizer.getBoundingClientRect();r+=a.left,i+=a.top}var s=e.display.lineSpace.getBoundingClientRect();return{left:r-s.left,top:i-s.top}}function Zn(e,t,n,r,i){return r||(r=j(e.doc,t.line)),Qn(e,r,is(e,r,t.ch,i),n)}function Tt(e,t,n,r,i,a){r=r||j(e.doc,t.line),i||(i=Wr(e,r));function s(L,A){var F=Et(e,i,L,A?"right":"left",a);return A?F.left=F.right:F.right=F.left,Qn(e,r,F,n)}var o=ce(r,e.doc.direction),l=t.ch,u=t.sticky;if(l>=r.text.length?(l=r.text.length,u="before"):l<=0&&(l=0,u="after"),!o)return s(u=="before"?l-1:l,u=="before");function d(L,A,F){var z=o[A],K=z.level==1;return s(F?L-1:L,K!=F)}var v=Zt(o,l,u),w=pr,m=d(l,v,u=="before");return w!=null&&(m.other=d(l,w,u!="before")),m}function hs(e,t){var n=0;t=ne(e.doc,t),e.options.lineWrapping||(n=Fr(e.display)*t.ch);var r=j(e.doc,t.line),i=Gt(r)+Jn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Bi(e,t,n,r,i){var a=S(e,t,n);return a.xRel=i,r&&(a.outside=r),a}function zi(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Bi(r.first,0,null,-1,-1);var i=p(r,n),a=r.first+r.size-1;if(i>a)return Bi(r.first+r.size-1,j(r,a).text.length,null,1,1);t<0&&(t=0);for(var s=j(r,i);;){var o=Ll(e,s,i,t,n),l=el(s,o.ch+(o.xRel>0||o.outside>0?1:0));if(!l)return o;var u=l.find(1);if(u.line==i)return u;s=j(r,i=u.line)}}function ds(e,t,n,r){r-=Fi(t);var i=t.text.length,a=Nt(function(s){return Et(e,n,s-1).bottom<=r},i,0);return i=Nt(function(s){return Et(e,n,s).top>r},a,i),{begin:a,end:i}}function ps(e,t,n,r){n||(n=Wr(e,t));var i=Qn(e,t,Et(e,n,r),"line").top;return ds(e,t,n,i)}function Ui(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ll(e,t,n,r,i){i-=Gt(t);var a=Wr(e,t),s=Fi(t),o=0,l=t.text.length,u=!0,d=ce(t,e.doc.direction);if(d){var v=(e.options.lineWrapping?Dl:_l)(e,t,n,a,d,r,i);u=v.level!=1,o=u?v.from:v.to-1,l=u?v.to:v.from-1}var w=null,m=null,L=Nt(function(te){var V=Et(e,a,te);return V.top+=s,V.bottom+=s,Ui(V,r,i,!1)?(V.top<=i&&V.left<=r&&(w=te,m=V),!0):!1},o,l),A,F,z=!1;if(m){var K=r-m.left<m.right-r,U=K==u;L=w+(U?0:1),F=U?"after":"before",A=K?m.left:m.right}else{!u&&(L==l||L==o)&&L++,F=L==0?"after":L==t.text.length?"before":Et(e,a,L-(u?1:0)).bottom+s<=i==u?"after":"before";var q=Tt(e,S(n,L,F),"line",t,a);A=q.left,z=i<q.top?-1:i>=q.bottom?1:0}return L=Jt(t.text,L,1),Bi(n,L,F,z,r-A)}function _l(e,t,n,r,i,a,s){var o=Nt(function(v){var w=i[v],m=w.level!=1;return Ui(Tt(e,S(n,m?w.to:w.from,m?"before":"after"),"line",t,r),a,s,!0)},0,i.length-1),l=i[o];if(o>0){var u=l.level!=1,d=Tt(e,S(n,u?l.from:l.to,u?"after":"before"),"line",t,r);Ui(d,a,s,!0)&&d.top>s&&(l=i[o-1])}return l}function Dl(e,t,n,r,i,a,s){var o=ds(e,t,r,s),l=o.begin,u=o.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var d=null,v=null,w=0;w<i.length;w++){var m=i[w];if(!(m.from>=u||m.to<=l)){var L=m.level!=1,A=Et(e,r,L?Math.min(u,m.to)-1:Math.max(l,m.from)).right,F=A<a?a-A+1e9:A-a;(!d||v>F)&&(d=m,v=F)}}return d||(d=i[i.length-1]),d.from<l&&(d={from:l,to:d.to,level:d.level}),d.to>u&&(d={from:d.from,to:u,level:d.level}),d}var yr;function Hr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(yr==null){yr=g("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)yr.appendChild(document.createTextNode("x")),yr.appendChild(g("br"));yr.appendChild(document.createTextNode("x"))}$(e.measure,yr);var n=yr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),R(e.measure),n||1}function Fr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=g("span","xxxxxxxxxx"),n=g("pre",[t],"CodeMirror-line-like");$(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Gi(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,a=t.gutters.firstChild,s=0;a;a=a.nextSibling,++s){var o=e.display.gutterSpecs[s].className;n[o]=a.offsetLeft+a.clientLeft+i,r[o]=a.clientWidth}return{fixedPos:Ki(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ki(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function vs(e){var t=Hr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Fr(e.display)-3);return function(i){if(nr(e.doc,i))return 0;var a=0;if(i.widgets)for(var s=0;s<i.widgets.length;s++)i.widgets[s].height&&(a+=i.widgets[s].height);return n?a+(Math.ceil(i.text.length/r)||1)*t:a+t}}function $i(e){var t=e.doc,n=vs(e);t.iter(function(r){var i=n(r);i!=r.height&&pt(r,i)})}function mr(e,t,n,r){var i=e.display;if(!n&&an(t).getAttribute("cm-not-content")=="true")return null;var a,s,o=i.lineSpace.getBoundingClientRect();try{a=t.clientX-o.left,s=t.clientY-o.top}catch{return null}var l=zi(e,a,s),u;if(r&&l.xRel>0&&(u=j(e.doc,l.line).text).length==l.ch){var d=ve(u,u.length,e.options.tabSize)-u.length;l=S(l.line,Math.max(0,Math.round((a-rs(e.display).left)/Fr(e.display))-d))}return l}function br(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function nt(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ut&&Ai(e.doc,t)<i.viewTo&&ar(e);else if(n<=i.viewFrom)Ut&&qa(e.doc,n+r)>i.viewFrom?ar(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)ar(e);else if(t<=i.viewFrom){var a=Vn(e,n,n+r,1);a?(i.view=i.view.slice(a.index),i.viewFrom=a.lineN,i.viewTo+=r):ar(e)}else if(n>=i.viewTo){var s=Vn(e,t,t,-1);s?(i.view=i.view.slice(0,s.index),i.viewTo=s.lineN):ar(e)}else{var o=Vn(e,t,t,-1),l=Vn(e,n,n+r,1);o&&l?(i.view=i.view.slice(0,o.index).concat(jn(e,o.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):ar(e)}var u=i.externalMeasured;u&&(n<u.lineN?u.lineN+=r:t<u.lineN+u.size&&(i.externalMeasured=null))}function ir(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var a=r.view[br(e,t)];if(a.node!=null){var s=a.changes||(a.changes=[]);oe(s,n)==-1&&s.push(n)}}}function ar(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Vn(e,t,n,r){var i=br(e,t),a,s=e.display.view;if(!Ut||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var o=e.display.viewFrom,l=0;l<i;l++)o+=s[l].size;if(o!=t){if(r>0){if(i==s.length-1)return null;a=o+s[i].size-t,i++}else a=o-t;t+=a,n+=a}for(;Ai(e.doc,n)!=n;){if(i==(r<0?0:s.length-1))return null;n+=r*s[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Ol(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=jn(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=jn(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(br(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(jn(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,br(e,n)))),r.viewTo=n}function gs(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function vn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ys(e,t){t===void 0&&(t=!0);var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),a=r.selection=document.createDocumentFragment(),s=e.options.$customCursor;s&&(t=!0);for(var o=0;o<n.sel.ranges.length;o++)if(!(!t&&o==n.sel.primIndex)){var l=n.sel.ranges[o];if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var u=l.empty();if(s){var d=s(e,l);d&&qi(e,d,i)}else(u||e.options.showCursorWhenSelecting)&&qi(e,l.head,i);u||Ml(e,l,a)}}return r}function qi(e,t,n){var r=Tt(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(g("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var a=Zn(e,t,"div",null,null),s=a.right-a.left;i.style.width=(s>0?s:e.defaultCharWidth())+"px"}if(r.other){var o=n.appendChild(g("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ei(e,t){return e.top-t.top||e.left-t.left}function Ml(e,t,n){var r=e.display,i=e.doc,a=document.createDocumentFragment(),s=rs(e.display),o=s.left,l=Math.max(r.sizerWidth,gr(e)-r.sizer.offsetLeft)-s.right,u=i.direction=="ltr";function d(U,q,te,V){q<0&&(q=0),q=Math.round(q),V=Math.round(V),a.appendChild(g("div",null,"CodeMirror-selected","position: absolute; left: "+U+`px;
6
- top: `+q+"px; width: "+(te??l-U)+`px;
7
- height: `+(V-q)+"px"))}function v(U,q,te){var V=j(i,U),le=V.text.length,me,ze;function we(Oe,st){return Zn(e,S(U,Oe),"div",V,st)}function ft(Oe,st,Ge){var Ae=ps(e,V,null,Oe),Me=st=="ltr"==(Ge=="after")?"left":"right",Te=Ge=="after"?Ae.begin:Ae.end-(/\s/.test(V.text.charAt(Ae.end-1))?2:1);return we(Te,Me)[Me]}var at=ce(V,i.direction);return Qt(at,q||0,te??le,function(Oe,st,Ge,Ae){var Me=Ge=="ltr",Te=we(Oe,Me?"left":"right"),ot=we(st-1,Me?"right":"left"),Zr=q==null&&Oe==0,cr=te==null&&st==le,Ye=Ae==0,Pt=!at||Ae==at.length-1;if(ot.top-Te.top<=3){var Ue=(u?Zr:cr)&&Ye,ba=(u?cr:Zr)&&Pt,Xt=Ue?o:(Me?Te:ot).left,kr=ba?l:(Me?ot:Te).right;d(Xt,Te.top,kr-Xt,Te.bottom)}else{var Tr,Ve,Vr,wa;Me?(Tr=u&&Zr&&Ye?o:Te.left,Ve=u?l:ft(Oe,Ge,"before"),Vr=u?o:ft(st,Ge,"after"),wa=u&&cr&&Pt?l:ot.right):(Tr=u?ft(Oe,Ge,"before"):o,Ve=!u&&Zr&&Ye?l:Te.right,Vr=!u&&cr&&Pt?o:ot.left,wa=u?ft(st,Ge,"after"):l),d(Tr,Te.top,Ve-Tr,Te.bottom),Te.bottom<ot.top&&d(o,Te.bottom,null,ot.top),d(Vr,ot.top,wa-Vr,ot.bottom)}(!me||ei(Te,me)<0)&&(me=Te),ei(ot,me)<0&&(me=ot),(!ze||ei(Te,ze)<0)&&(ze=Te),ei(ot,ze)<0&&(ze=ot)}),{start:me,end:ze}}var w=t.from(),m=t.to();if(w.line==m.line)v(w.line,w.ch,m.ch);else{var L=j(i,w.line),A=j(i,m.line),F=kt(L)==kt(A),z=v(w.line,w.ch,F?L.text.length+1:null).end,K=v(m.line,F?0:null,m.ch).start;F&&(z.top<K.top-2?(d(z.right,z.top,null,z.bottom),d(o,K.top,K.left,K.bottom)):d(z.right,z.top,K.left-z.right,z.bottom)),z.bottom<K.top&&d(o,z.bottom,null,K.top)}n.appendChild(a)}function Xi(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Br(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function ms(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||ji(e))}function Yi(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Br(e))},100)}function ji(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Ce(e,"focus",e,t),e.state.focused=!0,xe(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),D&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Xi(e))}function Br(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Ce(e,"blur",e,t),e.state.focused=!1,je(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function ti(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,a=0,s=0;s<t.view.length;s++){var o=t.view[s],l=e.options.lineWrapping,u=void 0,d=0;if(!o.hidden){if(i+=o.line.height,_&&b<8){var v=o.node.offsetTop+o.node.offsetHeight;u=v-n,n=v}else{var w=o.node.getBoundingClientRect();u=w.bottom-w.top,!l&&o.text.firstChild&&(d=o.text.firstChild.getBoundingClientRect().right-w.left-1)}var m=o.line.height-u;if((m>.005||m<-.005)&&(i<r&&(a-=m),pt(o.line,u),bs(o.line),o.rest))for(var L=0;L<o.rest.length;L++)bs(o.rest[L]);if(d>e.display.sizerWidth){var A=Math.ceil(d/Fr(e.display));A>e.display.maxLineLength&&(e.display.maxLineLength=A,e.display.maxLine=o.line,e.display.maxLineChanged=!0)}}}Math.abs(a)>2&&(t.scroller.scrollTop+=a)}function bs(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function ri(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Jn(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,a=p(t,r),s=p(t,i);if(n&&n.ensure){var o=n.ensure.from.line,l=n.ensure.to.line;o<a?(a=o,s=p(t,Gt(j(t,o))+e.wrapper.clientHeight)):Math.min(l,t.lastLine())>=s&&(a=p(t,Gt(j(t,l))-e.wrapper.clientHeight),s=l)}return{from:a,to:Math.max(s,a+1)}}function Nl(e,t){if(!Se(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null,a=n.wrapper.ownerDocument;if(t.top+r.top<0?i=!0:t.bottom+r.top>(a.defaultView.innerHeight||a.documentElement.clientHeight)&&(i=!1),i!=null&&!x){var s=g("div","​",null,`position: absolute;
8
- top: `+(t.top-n.viewOffset-Jn(e.display))+`px;
9
- height: `+(t.bottom-t.top+Rt(e)+n.barHeight)+`px;
10
- left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(s),s.scrollIntoView(i),e.display.lineSpace.removeChild(s)}}}function Al(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?S(t.line,t.ch+1,"before"):t,t=t.ch?S(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var a=0;a<5;a++){var s=!1,o=Tt(e,t),l=!n||n==t?o:Tt(e,n);i={left:Math.min(o.left,l.left),top:Math.min(o.top,l.top)-r,right:Math.max(o.left,l.left),bottom:Math.max(o.bottom,l.bottom)+r};var u=Ji(e,i),d=e.doc.scrollTop,v=e.doc.scrollLeft;if(u.scrollTop!=null&&(yn(e,u.scrollTop),Math.abs(e.doc.scrollTop-d)>1&&(s=!0)),u.scrollLeft!=null&&(wr(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-v)>1&&(s=!0)),!s)break}return i}function Il(e,t){var n=Ji(e,t);n.scrollTop!=null&&yn(e,n.scrollTop),n.scrollLeft!=null&&wr(e,n.scrollLeft)}function Ji(e,t){var n=e.display,r=Hr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,a=Wi(e),s={};t.bottom-t.top>a&&(t.bottom=t.top+a);var o=e.doc.height+Pi(n),l=t.top<r,u=t.bottom>o-r;if(t.top<i)s.scrollTop=l?0:t.top;else if(t.bottom>i+a){var d=Math.min(t.top,(u?o:t.bottom)-a);d!=i&&(s.scrollTop=d)}var v=e.options.fixedGutter?0:n.gutters.offsetWidth,w=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-v,m=gr(e)-n.gutters.offsetWidth,L=t.right-t.left>m;return L&&(t.right=t.left+m),t.left<10?s.scrollLeft=0:t.left<w?s.scrollLeft=Math.max(0,t.left+v-(L?0:10)):t.right>m+w-3&&(s.scrollLeft=t.right+(L?0:10)-m),s}function Qi(e,t){t!=null&&(ni(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function zr(e){ni(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function gn(e,t,n){(t!=null||n!=null)&&ni(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Rl(e,t){ni(e),e.curOp.scrollToPos=t}function ni(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=hs(e,t.from),r=hs(e,t.to);ws(e,n,r,t.margin)}}function ws(e,t,n,r){var i=Ji(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});gn(e,i.scrollLeft,i.scrollTop)}function yn(e,t){Math.abs(e.doc.scrollTop-t)<2||(T||Vi(e,{top:t}),xs(e,t,!0),T&&Vi(e),wn(e,100))}function xs(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function wr(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Ls(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function mn(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Pi(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Rt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var xr=function(e,t,n){this.cm=n;var r=this.vert=g("div",[g("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=g("div",[g("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),ee(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ee(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,_&&b<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};xr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var a=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+a)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},xr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},xr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},xr.prototype.zeroWidthHack=function(){var e=Z&&!I?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new Dt,this.disableVert=new Dt},xr.prototype.enableZeroWidthBar=function(e,t,n){e.style.visibility="";function r(){var i=e.getBoundingClientRect(),a=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);a!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},xr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var bn=function(){};bn.prototype.update=function(){return{bottom:0,right:0}},bn.prototype.setScrollLeft=function(){},bn.prototype.setScrollTop=function(){},bn.prototype.clear=function(){};function Ur(e,t){t||(t=mn(e));var n=e.display.barWidth,r=e.display.barHeight;Cs(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&ti(e),Cs(e,mn(e)),n=e.display.barWidth,r=e.display.barHeight}function Cs(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var Ss={native:xr,null:bn};function ks(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&je(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ss[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ee(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?wr(e,t):yn(e,t)},e),e.display.scrollbars.addClass&&xe(e.display.wrapper,e.display.scrollbars.addClass)}var El=0;function Cr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++El,markArrays:null},hl(e.curOp)}function Sr(e){var t=e.curOp;t&&pl(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;Pl(n)})}function Pl(e){for(var t=e.ops,n=0;n<t.length;n++)Wl(t[n]);for(var r=0;r<t.length;r++)Hl(t[r]);for(var i=0;i<t.length;i++)Fl(t[i]);for(var a=0;a<t.length;a++)Bl(t[a]);for(var s=0;s<t.length;s++)zl(t[s])}function Wl(e){var t=e.cm,n=t.display;Gl(t),e.updateMaxLine&&Ri(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ii(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Hl(e){e.updatedDisplay=e.mustUpdate&&Zi(e.cm,e.update)}function Fl(e){var t=e.cm,n=t.display;e.updatedDisplay&&ti(t),e.barMeasure=mn(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=is(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Rt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-gr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Bl(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&wr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==_e(mt(t));e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Ur(t,e.barMeasure),e.updatedDisplay&&ta(t,e.barMeasure),e.selectionChanged&&Xi(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&ms(e.cm)}function zl(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Ts(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&xs(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&wr(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Al(t,ne(r,e.scrollToPos.from),ne(r,e.scrollToPos.to),e.scrollToPos.margin);Nl(t,i)}var a=e.maybeHiddenMarkers,s=e.maybeUnhiddenMarkers;if(a)for(var o=0;o<a.length;++o)a[o].lines.length||Ce(a[o],"hide");if(s)for(var l=0;l<s.length;++l)s[l].lines.length&&Ce(s[l],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Ce(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ut(e,t){if(e.curOp)return t();Cr(e);try{return t()}finally{Sr(e)}}function Fe(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Cr(e);try{return t.apply(e,arguments)}finally{Sr(e)}}}function Ze(e){return function(){if(this.curOp)return e.apply(this,arguments);Cr(this);try{return e.apply(this,arguments)}finally{Sr(this)}}}function Be(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Cr(t);try{return e.apply(this,arguments)}finally{Sr(t)}}}function wn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,re(Ul,e))}function Ul(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=un(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(a){if(r.line>=e.display.viewFrom){var s=a.styles,o=a.text.length>e.options.maxHighlightLength?At(t.mode,r.state):null,l=Aa(e,a,r,!0);o&&(r.state=o),a.styles=l.styles;var u=a.styleClasses,d=l.classes;d?a.styleClasses=d:u&&(a.styleClasses=null);for(var v=!s||s.length!=a.styles.length||u!=d&&(!u||!d||u.bgClass!=d.bgClass||u.textClass!=d.textClass),w=0;!v&&w<s.length;++w)v=s[w]!=a.styles[w];v&&i.push(r.line),a.stateAfter=r.save(),r.nextLine()}else a.text.length<=e.options.maxHighlightLength&&Di(e,a.text,r),a.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return wn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ut(e,function(){for(var a=0;a<i.length;a++)ir(e,i[a],"text")})}}var ii=function(e,t,n){var r=e.display;this.viewport=t,this.visible=ri(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=gr(e),this.force=n,this.dims=Gi(e),this.events=[]};ii.prototype.signal=function(e,t){lt(e,t)&&this.events.push(arguments)},ii.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Ce.apply(null,this.events[e])};function Gl(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Rt(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Rt(e)+"px",t.scrollbarsClipped=!0)}function Kl(e){if(e.hasFocus())return null;var t=_e(mt(e));if(!t||!Re(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=ae(e).getSelection();r.anchorNode&&r.extend&&Re(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function $l(e){if(!(!e||!e.activeElt||e.activeElt==_e(Pe(e.activeElt)))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&Re(document.body,e.anchorNode)&&Re(document.body,e.focusNode))){var t=e.activeElt.ownerDocument,n=t.defaultView.getSelection(),r=t.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),n.removeAllRanges(),n.addRange(r),n.extend(e.focusNode,e.focusOffset)}}function Zi(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return ar(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&gs(e)==0)return!1;_s(e)&&(ar(e),t.dims=Gi(e));var i=r.first+r.size,a=Math.max(t.visible.from-e.options.viewportMargin,r.first),s=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<a&&a-n.viewFrom<20&&(a=Math.max(r.first,n.viewFrom)),n.viewTo>s&&n.viewTo-s<20&&(s=Math.min(i,n.viewTo)),Ut&&(a=Ai(e.doc,a),s=qa(e.doc,s));var o=a!=n.viewFrom||s!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Ol(e,a,s),n.viewOffset=Gt(j(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var l=gs(e);if(!o&&l==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var u=Kl(e);return l>4&&(n.lineDiv.style.display="none"),ql(e,n.updateLineNumbers,t.dims),l>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,$l(u),R(n.cursorDiv),R(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,o&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,wn(e,400)),n.updateLineNumbers=null,!0}function Ts(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==gr(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+Pi(e.display)-Wi(e),n.top)}),t.visible=ri(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ri(e.display,e.doc,n));if(!Zi(e,t))break;ti(e);var i=mn(e);vn(e),Ur(e,i),ta(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Vi(e,t){var n=new ii(e,t);if(Zi(e,n)){ti(e),Ts(e,n);var r=mn(e);vn(e),Ur(e,r),ta(e,r),n.finish()}}function ql(e,t,n){var r=e.display,i=e.options.lineNumbers,a=r.lineDiv,s=a.firstChild;function o(L){var A=L.nextSibling;return D&&Z&&e.display.currentWheelTarget==L?L.style.display="none":L.parentNode.removeChild(L),A}for(var l=r.view,u=r.viewFrom,d=0;d<l.length;d++){var v=l[d];if(!v.hidden)if(!v.node||v.node.parentNode!=a){var w=bl(e,v,u,n);a.insertBefore(w,s)}else{for(;s!=v.node;)s=o(s);var m=i&&t!=null&&t<=u&&v.lineNumber;v.changes&&(oe(v.changes,"gutter")>-1&&(m=!1),Qa(e,v,u,n)),m&&(R(v.lineNumber),v.lineNumber.appendChild(document.createTextNode(H(e.options,u)))),s=v.node.nextSibling}u+=v.size}for(;s;)s=o(s)}function ea(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",He(e,"gutterChanged",e)}function ta(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Rt(e)+"px"}function Ls(e){var t=e.display,n=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Ki(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,a=r+"px",s=0;s<n.length;s++)if(!n[s].hidden){e.options.fixedGutter&&(n[s].gutter&&(n[s].gutter.style.left=a),n[s].gutterBackground&&(n[s].gutterBackground.style.left=a));var o=n[s].alignable;if(o)for(var l=0;l<o.length;l++)o[l].style.left=a}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function _s(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=H(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(g("div",[g("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),a=i.firstChild.offsetWidth,s=i.offsetWidth-a;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(a,r.lineGutter.offsetWidth-s)+1,r.lineNumWidth=r.lineNumInnerWidth+s,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ea(e.display),!0}return!1}function ra(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var a=e[i],s=null;if(typeof a!="string"&&(s=a.style,a=a.className),a=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:a,style:s})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Ds(e){var t=e.gutters,n=e.gutterSpecs;R(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],a=i.className,s=i.style,o=t.appendChild(g("div",null,"CodeMirror-gutter "+a));s&&(o.style.cssText=s),a=="CodeMirror-linenumbers"&&(e.lineGutter=o,o.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",ea(e)}function xn(e){Ds(e.display),nt(e),Ls(e)}function Xl(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=g("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=g("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=Je("div",null,"CodeMirror-code"),i.selectionDiv=g("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=g("div",null,"CodeMirror-cursors"),i.measure=g("div",null,"CodeMirror-measure"),i.lineMeasure=g("div",null,"CodeMirror-measure"),i.lineSpace=Je("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var a=Je("div",[i.lineSpace],"CodeMirror-lines");i.mover=g("div",[a],null,"position: relative"),i.sizer=g("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=g("div",null,null,"position: absolute; height: "+Qe+"px; width: 1px;"),i.gutters=g("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=g("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=g("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),N&&Y===105&&(i.wrapper.style.clipPath="inset(0px)"),i.wrapper.setAttribute("translate","no"),_&&b<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!D&&!(T&&X)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=ra(r.gutters,r.lineNumbers),Ds(i),n.init(i)}var ai=0,$t=null;_?$t=-.53:T?$t=15:N?$t=-.7:J&&($t=-1/3);function Os(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function Yl(e){var t=Os(e);return t.x*=$t,t.y*=$t,t}function Ms(e,t){N&&Y==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var n=Os(t),r=n.x,i=n.y,a=$t;t.deltaMode===0&&(r=t.deltaX,i=t.deltaY,a=1);var s=e.display,o=s.scroller,l=o.scrollWidth>o.clientWidth,u=o.scrollHeight>o.clientHeight;if(r&&l||i&&u){if(i&&Z&&D){e:for(var d=t.target,v=s.view;d!=o;d=d.parentNode)for(var w=0;w<v.length;w++)if(v[w].node==d){e.display.currentWheelTarget=d;break e}}if(r&&!T&&!B&&a!=null){i&&u&&yn(e,Math.max(0,o.scrollTop+i*a)),wr(e,Math.max(0,o.scrollLeft+r*a)),(!i||i&&u)&&qe(t),s.wheelStartX=null;return}if(i&&a!=null){var m=i*a,L=e.doc.scrollTop,A=L+s.wrapper.clientHeight;m<0?L=Math.max(0,L+m-50):A=Math.min(e.doc.height,A+m+50),Vi(e,{top:L,bottom:A})}ai<20&&t.deltaMode!==0&&(s.wheelStartX==null?(s.wheelStartX=o.scrollLeft,s.wheelStartY=o.scrollTop,s.wheelDX=r,s.wheelDY=i,setTimeout(function(){if(s.wheelStartX!=null){var F=o.scrollLeft-s.wheelStartX,z=o.scrollTop-s.wheelStartY,K=z&&s.wheelDY&&z/s.wheelDY||F&&s.wheelDX&&F/s.wheelDX;s.wheelStartX=s.wheelStartY=null,K&&($t=($t*ai+K)/(ai+1),++ai)}},200)):(s.wheelDX+=r,s.wheelDY+=i))}}var vt=function(e,t){this.ranges=e,this.primIndex=t};vt.prototype.primary=function(){return this.ranges[this.primIndex]},vt.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!de(n.anchor,r.anchor)||!de(n.head,r.head))return!1}return!0},vt.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new pe(We(this.ranges[t].anchor),We(this.ranges[t].head));return new vt(e,this.primIndex)},vt.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},vt.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(G(t,r.from())>=0&&G(e,r.to())<=0)return n}return-1};var pe=function(e,t){this.anchor=e,this.head=t};pe.prototype.from=function(){return Rr(this.anchor,this.head)},pe.prototype.to=function(){return rt(this.anchor,this.head)},pe.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Lt(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(w,m){return G(w.from(),m.from())}),n=oe(t,i);for(var a=1;a<t.length;a++){var s=t[a],o=t[a-1],l=G(o.to(),s.from());if(r&&!s.empty()?l>0:l>=0){var u=Rr(o.from(),s.from()),d=rt(o.to(),s.to()),v=o.empty()?s.from()==s.head:o.from()==o.head;a<=n&&--n,t.splice(--a,2,new pe(v?d:u,v?u:d))}}return new vt(t,n)}function sr(e,t){return new vt([new pe(e,t||e)],0)}function or(e){return e.text?S(e.from.line+e.text.length-1,he(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Ns(e,t){if(G(e,t.from)<0)return e;if(G(e,t.to)<=0)return or(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=or(t).ch-t.to.ch),S(n,r)}function na(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new pe(Ns(i.anchor,t),Ns(i.head,t)))}return Lt(e.cm,n,e.sel.primIndex)}function As(e,t,n){return e.line==t.line?S(n.line,e.ch-t.ch+n.ch):S(n.line+(e.line-t.line),e.ch)}function jl(e,t,n){for(var r=[],i=S(e.first,0),a=i,s=0;s<t.length;s++){var o=t[s],l=As(o.from,i,a),u=As(or(o),i,a);if(i=o.to,a=u,n=="around"){var d=e.sel.ranges[s],v=G(d.head,d.anchor)<0;r[s]=new pe(v?u:l,v?l:u)}else r[s]=new pe(l,l)}return new vt(r,e.sel.primIndex)}function ia(e){e.doc.mode=Nr(e.options,e.doc.modeOption),Cn(e)}function Cn(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,wn(e,100),e.state.modeGen++,e.curOp&&nt(e)}function Is(e,t){return t.from.ch==0&&t.to.ch==0&&he(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function aa(e,t,n,r){function i(K){return n?n[K]:null}function a(K,U,q){nl(K,U,q,r),He(K,"change",K,t)}function s(K,U){for(var q=[],te=K;te<U;++te)q.push(new Er(u[te],i(te),r));return q}var o=t.from,l=t.to,u=t.text,d=j(e,o.line),v=j(e,l.line),w=he(u),m=i(u.length-1),L=l.line-o.line;if(t.full)e.insert(0,s(0,u.length)),e.remove(u.length,e.size-u.length);else if(Is(e,t)){var A=s(0,u.length-1);a(v,v.text,m),L&&e.remove(o.line,L),A.length&&e.insert(o.line,A)}else if(d==v)if(u.length==1)a(d,d.text.slice(0,o.ch)+w+d.text.slice(l.ch),m);else{var F=s(1,u.length-1);F.push(new Er(w+d.text.slice(l.ch),m,r)),a(d,d.text.slice(0,o.ch)+u[0],i(0)),e.insert(o.line+1,F)}else if(u.length==1)a(d,d.text.slice(0,o.ch)+u[0]+v.text.slice(l.ch),i(0)),e.remove(o.line+1,L);else{a(d,d.text.slice(0,o.ch)+u[0],i(0)),a(v,w+v.text.slice(l.ch),m);var z=s(1,u.length-1);L>1&&e.remove(o.line+1,L-1),e.insert(o.line+1,z)}He(e,"change",e,t)}function lr(e,t,n){function r(i,a,s){if(i.linked)for(var o=0;o<i.linked.length;++o){var l=i.linked[o];if(l.doc!=a){var u=s&&l.sharedHist;n&&!u||(t(l.doc,u),r(l.doc,i,u))}}}r(e,null,!0)}function Rs(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,$i(e),ia(e),Es(e),e.options.direction=t.direction,e.options.lineWrapping||Ri(e),e.options.mode=t.modeOption,nt(e)}function Es(e){(e.doc.direction=="rtl"?xe:je)(e.display.lineDiv,"CodeMirror-rtl")}function Jl(e){ut(e,function(){Es(e),nt(e)})}function si(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function sa(e,t){var n={from:We(t.from),to:or(t),text:zt(e,t.from,t.to)};return Hs(e,n,t.from.line,t.to.line+1),lr(e,function(r){return Hs(r,n,t.from.line,t.to.line+1)},!0),n}function Ps(e){for(;e.length;){var t=he(e);if(t.ranges)e.pop();else break}}function Ql(e,t){if(t)return Ps(e.done),he(e.done);if(e.done.length&&!he(e.done).ranges)return he(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),he(e.done)}function Ws(e,t,n,r){var i=e.history;i.undone.length=0;var a=+new Date,s,o;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>a-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(s=Ql(i,i.lastOp==r)))o=he(s.changes),G(t.from,t.to)==0&&G(t.from,o.to)==0?o.to=or(t):s.changes.push(sa(e,t));else{var l=he(i.done);for((!l||!l.ranges)&&oi(e.sel,i.done),s={changes:[sa(e,t)],generation:i.generation},i.done.push(s);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,o||Ce(e,"historyAdded")}function Zl(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function Vl(e,t,n,r){var i=e.history,a=r&&r.origin;n==i.lastSelOp||a&&i.lastSelOrigin==a&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==a||Zl(e,a,he(i.done),t))?i.done[i.done.length-1]=t:oi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=a,i.lastSelOp=n,r&&r.clearRedo!==!1&&Ps(i.undone)}function oi(e,t){var n=he(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Hs(e,t,n,r){var i=t["spans_"+e.id],a=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(s){s.markedSpans&&((i||(i=t["spans_"+e.id]={}))[a]=s.markedSpans),++a})}function eu(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function tu(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(eu(n[i]));return r}function Fs(e,t){var n=tu(e,t),r=Mi(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var a=n[i],s=r[i];if(a&&s)e:for(var o=0;o<s.length;++o){for(var l=s[o],u=0;u<a.length;++u)if(a[u].marker==l.marker)continue e;a.push(l)}else s&&(n[i]=s)}return n}function Gr(e,t,n){for(var r=[],i=0;i<e.length;++i){var a=e[i];if(a.ranges){r.push(n?vt.prototype.deepCopy.call(a):a);continue}var s=a.changes,o=[];r.push({changes:o});for(var l=0;l<s.length;++l){var u=s[l],d=void 0;if(o.push({from:u.from,to:u.to,text:u.text}),t)for(var v in u)(d=v.match(/^spans_(\d+)$/))&&oe(t,Number(d[1]))>-1&&(he(o)[v]=u[v],delete u[v])}}return r}function oa(e,t,n,r){if(r){var i=e.anchor;if(n){var a=G(t,i)<0;a!=G(n,i)<0?(i=t,t=n):a!=G(t,n)<0&&(t=n)}return new pe(i,t)}else return new pe(n||t,t)}function li(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),Xe(e,new vt([oa(e.sel.primary(),t,n,i)],0),r)}function Bs(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),a=0;a<e.sel.ranges.length;a++)r[a]=oa(e.sel.ranges[a],t[a],null,i);var s=Lt(e.cm,r,e.sel.primIndex);Xe(e,s,n)}function la(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,Xe(e,Lt(e.cm,i,e.sel.primIndex),r)}function zs(e,t,n,r){Xe(e,sr(t,n),r)}function ru(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var a=0;a<i.length;a++)this.ranges[a]=new pe(ne(e,i[a].anchor),ne(e,i[a].head))},origin:n&&n.origin};return Ce(e,"beforeSelectionChange",e,r),e.cm&&Ce(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Lt(e.cm,r.ranges,r.ranges.length-1):t}function Us(e,t,n){var r=e.history.done,i=he(r);i&&i.ranges?(r[r.length-1]=t,ui(e,t,n)):Xe(e,t,n)}function Xe(e,t,n){ui(e,t,n),Vl(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function ui(e,t,n){(lt(e,"beforeSelectionChange")||e.cm&&lt(e.cm,"beforeSelectionChange"))&&(t=ru(e,t,n));var r=n&&n.bias||(G(t.primary().head,e.sel.primary().head)<0?-1:1);Gs(e,$s(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&e.cm.getOption("readOnly")!="nocursor"&&zr(e.cm)}function Gs(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,gt(e.cm)),He(e,"cursorActivity",e))}function Ks(e){Gs(e,$s(e,e.sel,null,!1))}function $s(e,t,n,r){for(var i,a=0;a<t.ranges.length;a++){var s=t.ranges[a],o=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[a],l=fi(e,s.anchor,o&&o.anchor,n,r),u=s.head==s.anchor?l:fi(e,s.head,o&&o.head,n,r);(i||l!=s.anchor||u!=s.head)&&(i||(i=t.ranges.slice(0,a)),i[a]=new pe(l,u))}return i?Lt(e.cm,i,t.primIndex):t}function Kr(e,t,n,r,i){var a=j(e,t.line);if(a.markedSpans)for(var s=0;s<a.markedSpans.length;++s){var o=a.markedSpans[s],l=o.marker,u="selectLeft"in l?!l.selectLeft:l.inclusiveLeft,d="selectRight"in l?!l.selectRight:l.inclusiveRight;if((o.from==null||(u?o.from<=t.ch:o.from<t.ch))&&(o.to==null||(d?o.to>=t.ch:o.to>t.ch))){if(i&&(Ce(l,"beforeCursorEnter"),l.explicitlyCleared))if(a.markedSpans){--s;continue}else break;if(!l.atomic)continue;if(n){var v=l.find(r<0?1:-1),w=void 0;if((r<0?d:u)&&(v=qs(e,v,-r,v&&v.line==t.line?a:null)),v&&v.line==t.line&&(w=G(v,n))&&(r<0?w<0:w>0))return Kr(e,v,t,r,i)}var m=l.find(r<0?-1:1);return(r<0?u:d)&&(m=qs(e,m,r,m.line==t.line?a:null)),m?Kr(e,m,t,r,i):null}}return t}function fi(e,t,n,r,i){var a=r||1,s=Kr(e,t,n,a,i)||!i&&Kr(e,t,n,a,!0)||Kr(e,t,n,-a,i)||!i&&Kr(e,t,n,-a,!0);return s||(e.cantEdit=!0,S(e.first,0))}function qs(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ne(e,S(t.line-1)):null:n>0&&t.ch==(r||j(e,t.line)).text.length?t.line<e.first+e.size-1?S(t.line+1,0):null:new S(t.line,t.ch+n)}function Xs(e){e.setSelection(S(e.firstLine(),0),S(e.lastLine()),ht)}function Ys(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,a,s,o){i&&(r.from=ne(e,i)),a&&(r.to=ne(e,a)),s&&(r.text=s),o!==void 0&&(r.origin=o)}),Ce(e,"beforeChange",e,r),e.cm&&Ce(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function $r(e,t,n){if(e.cm){if(!e.cm.curOp)return Fe(e.cm,$r)(e,t,n);if(e.cm.state.suppressEdits)return}if(!((lt(e,"beforeChange")||e.cm&&lt(e.cm,"beforeChange"))&&(t=Ys(e,t,!0),!t))){var r=Fa&&!n&&Vo(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)js(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else js(e,t)}}function js(e,t){if(!(t.text.length==1&&t.text[0]==""&&G(t.from,t.to)==0)){var n=na(e,t);Ws(e,t,n,e.cm?e.cm.curOp.id:NaN),Sn(e,t,n,Mi(e,t));var r=[];lr(e,function(i,a){!a&&oe(r,i.history)==-1&&(Vs(i.history,t),r.push(i.history)),Sn(i,t,null,Mi(i,t))})}}function ci(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!n)){for(var i=e.history,a,s=e.sel,o=t=="undo"?i.done:i.undone,l=t=="undo"?i.undone:i.done,u=0;u<o.length&&(a=o[u],!(n?a.ranges&&!a.equals(e.sel):!a.ranges));u++);if(u!=o.length){for(i.lastOrigin=i.lastSelOrigin=null;;)if(a=o.pop(),a.ranges){if(oi(a,l),n&&!a.equals(e.sel)){Xe(e,a,{clearRedo:!1});return}s=a}else if(r){o.push(a);return}else break;var d=[];oi(s,l),l.push({changes:d,generation:i.generation}),i.generation=a.generation||++i.maxGeneration;for(var v=lt(e,"beforeChange")||e.cm&&lt(e.cm,"beforeChange"),w=function(A){var F=a.changes[A];if(F.origin=t,v&&!Ys(e,F,!1))return o.length=0,{};d.push(sa(e,F));var z=A?na(e,F):he(o);Sn(e,F,z,Fs(e,F)),!A&&e.cm&&e.cm.scrollIntoView({from:F.from,to:or(F)});var K=[];lr(e,function(U,q){!q&&oe(K,U.history)==-1&&(Vs(U.history,F),K.push(U.history)),Sn(U,F,null,Fs(U,F))})},m=a.changes.length-1;m>=0;--m){var L=w(m);if(L)return L.v}}}}function Js(e,t){if(t!=0&&(e.first+=t,e.sel=new vt(dr(e.sel.ranges,function(i){return new pe(S(i.anchor.line+t,i.anchor.ch),S(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){nt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)ir(e.cm,r,"gutter")}}function Sn(e,t,n,r){if(e.cm&&!e.cm.curOp)return Fe(e.cm,Sn)(e,t,n,r);if(t.to.line<e.first){Js(e,t.text.length-1-(t.to.line-t.from.line));return}if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);Js(e,i),t={from:S(e.first,0),to:S(t.to.line+i,t.to.ch),text:[he(t.text)],origin:t.origin}}var a=e.lastLine();t.to.line>a&&(t={from:t.from,to:S(a,j(e,a).text.length),text:[t.text[0]],origin:t.origin}),t.removed=zt(e,t.from,t.to),n||(n=na(e,t)),e.cm?nu(e.cm,t,r):aa(e,t,r),ui(e,n,ht),e.cantEdit&&fi(e,S(e.firstLine(),0))&&(e.cantEdit=!1)}}function nu(e,t,n){var r=e.doc,i=e.display,a=t.from,s=t.to,o=!1,l=a.line;e.options.lineWrapping||(l=c(kt(j(r,a.line))),r.iter(l,s.line+1,function(m){if(m==i.maxLine)return o=!0,!0})),r.sel.contains(t.from,t.to)>-1&&gt(e),aa(r,t,n,vs(e)),e.options.lineWrapping||(r.iter(l,a.line+t.text.length,function(m){var L=Yn(m);L>i.maxLineLength&&(i.maxLine=m,i.maxLineLength=L,i.maxLineChanged=!0,o=!1)}),o&&(e.curOp.updateMaxLine=!0)),qo(r,a.line),wn(e,400);var u=t.text.length-(s.line-a.line)-1;t.full?nt(e):a.line==s.line&&t.text.length==1&&!Is(e.doc,t)?ir(e,a.line,"text"):nt(e,a.line,s.line+1,u);var d=lt(e,"changes"),v=lt(e,"change");if(v||d){var w={from:a,to:s,text:t.text,removed:t.removed,origin:t.origin};v&&He(e,"change",e,w),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(w)}e.display.selForContextMenu=null}function qr(e,t,n,r,i){var a;r||(r=n),G(r,n)<0&&(a=[r,n],n=a[0],r=a[1]),typeof t=="string"&&(t=e.splitLines(t)),$r(e,{from:n,to:r,text:t,origin:i})}function Qs(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Zs(e,t,n,r){for(var i=0;i<e.length;++i){var a=e[i],s=!0;if(a.ranges){a.copied||(a=e[i]=a.deepCopy(),a.copied=!0);for(var o=0;o<a.ranges.length;o++)Qs(a.ranges[o].anchor,t,n,r),Qs(a.ranges[o].head,t,n,r);continue}for(var l=0;l<a.changes.length;++l){var u=a.changes[l];if(n<u.from.line)u.from=S(u.from.line+r,u.from.ch),u.to=S(u.to.line+r,u.to.ch);else if(t<=u.to.line){s=!1;break}}s||(e.splice(0,i+1),i=0)}}function Vs(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Zs(e.done,n,r,i),Zs(e.undone,n,r,i)}function kn(e,t,n,r){var i=t,a=t;return typeof t=="number"?a=j(e,Ma(e,t)):i=c(t),i==null?null:(r(a,i)&&e.cm&&ir(e.cm,i,n),a)}function Tn(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}Tn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,il(i),He(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function Ln(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}Ln.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var a=Math.min(t,i-e),s=r.height;if(r.removeInner(e,a),this.height-=s-r.height,i==a&&(this.children.splice(n--,1),r.parent=null),(t-=a)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Tn))){var o=[];this.collapse(o),this.children=[new Tn(o)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],a=i.chunkSize();if(e<=a){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var s=i.lines.length%25+25,o=s;o<i.lines.length;){var l=new Tn(i.lines.slice(o,o+=25));i.height-=l.height,this.children.splice(++r,0,l),l.parent=this}i.lines=i.lines.slice(0,s),this.maybeSpill()}break}e-=a}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Ln(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=oe(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new Ln(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],a=i.chunkSize();if(e<a){var s=Math.min(t,a-e);if(i.iterN(e,s,n))return!0;if((t-=s)==0)break;e=0}else e-=a}}};var _n=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};_n.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=c(n);if(!(r==null||!t)){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var a=dn(this);pt(n,Math.max(0,n.height-a)),e&&(ut(e,function(){eo(e,n,-a),ir(e,r,"widget")}),He(e,"lineWidgetCleared",e,this,r))}},_n.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=dn(this)-t;i&&(nr(this.doc,r)||pt(r,r.height+i),n&&ut(n,function(){n.curOp.forceUpdate=!0,eo(n,r,i),He(n,"lineWidgetChanged",n,e,c(r))}))},bt(_n);function eo(e,t,n){Gt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Qi(e,n)}function iu(e,t,n,r){var i=new _n(e,n,r),a=e.cm;return a&&i.noHScroll&&(a.display.alignWidgets=!0),kn(e,t,"widget",function(s){var o=s.widgets||(s.widgets=[]);if(i.insertAt==null?o.push(i):o.splice(Math.min(o.length,Math.max(0,i.insertAt)),0,i),i.line=s,a&&!nr(e,s)){var l=Gt(s)<e.scrollTop;pt(s,s.height+dn(i)),l&&Qi(a,i.height),a.curOp.forceUpdate=!0}return!0}),a&&He(a,"lineWidgetAdded",a,i,typeof t=="number"?t:c(t)),i}var to=0,ur=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++to};ur.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Cr(e),lt(this,"clear")){var n=this.find();n&&He(this,"clear",n.from,n.to)}for(var r=null,i=null,a=0;a<this.lines.length;++a){var s=this.lines[a],o=fn(s.markedSpans,this);e&&!this.collapsed?ir(e,c(s),"text"):e&&(o.to!=null&&(i=c(s)),o.from!=null&&(r=c(s))),s.markedSpans=jo(s.markedSpans,o),o.from==null&&this.collapsed&&!nr(this.doc,s)&&e&&pt(s,Hr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var l=0;l<this.lines.length;++l){var u=kt(this.lines[l]),d=Yn(u);d>e.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=d,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&nt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ks(e.doc)),e&&He(e,"markerCleared",e,this,r,i),t&&Sr(e),this.parent&&this.parent.clear()}},ur.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var a=this.lines[i],s=fn(a.markedSpans,this);if(s.from!=null&&(n=S(t?a:c(a),s.from),e==-1))return n;if(s.to!=null&&(r=S(t?a:c(a),s.to),e==1))return r}return n&&{from:n,to:r}},ur.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;!t||!r||ut(r,function(){var i=t.line,a=c(t.line),s=Hi(r,a);if(s&&(os(s),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!nr(n.doc,i)&&n.height!=null){var o=n.height;n.height=null;var l=dn(n)-o;l&&pt(i,i.height+l)}He(r,"markerChanged",r,e)})},ur.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||oe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},ur.prototype.detachLine=function(e){if(this.lines.splice(oe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},bt(ur);function Xr(e,t,n,r,i){if(r&&r.shared)return au(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return Fe(e.cm,Xr)(e,t,n,r,i);var a=new ur(e,i),s=G(t,n);if(r&&ue(r,a,!1),s>0||s==0&&a.clearWhenEmpty!==!1)return a;if(a.replacedWith&&(a.collapsed=!0,a.widgetNode=Je("span",[a.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||a.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(a.widgetNode.insertLeft=!0)),a.collapsed){if($a(e,t.line,t,n,a)||t.line!=n.line&&$a(e,n.line,t,n,a))throw new Error("Inserting collapsed marker partially overlapping an existing one");Yo()}a.addToHistory&&Ws(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var o=t.line,l=e.cm,u;if(e.iter(o,n.line+1,function(v){l&&a.collapsed&&!l.options.lineWrapping&&kt(v)==l.display.maxLine&&(u=!0),a.collapsed&&o!=t.line&&pt(v,0),Jo(v,new Kn(a,o==t.line?t.ch:null,o==n.line?n.ch:null),e.cm&&e.cm.curOp),++o}),a.collapsed&&e.iter(t.line,n.line+1,function(v){nr(e,v)&&pt(v,0)}),a.clearOnEnter&&ee(a,"beforeCursorEnter",function(){return a.clear()}),a.readOnly&&(Xo(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),a.collapsed&&(a.id=++to,a.atomic=!0),l){if(u&&(l.curOp.updateMaxLine=!0),a.collapsed)nt(l,t.line,n.line+1);else if(a.className||a.startStyle||a.endStyle||a.css||a.attributes||a.title)for(var d=t.line;d<=n.line;d++)ir(l,d,"text");a.atomic&&Ks(l.doc),He(l,"markerAdded",l,a)}return a}var Dn=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Dn.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();He(this,"clear")}},Dn.prototype.find=function(e,t){return this.primary.find(e,t)},bt(Dn);function au(e,t,n,r,i){r=ue(r),r.shared=!1;var a=[Xr(e,t,n,r,i)],s=a[0],o=r.widgetNode;return lr(e,function(l){o&&(r.widgetNode=o.cloneNode(!0)),a.push(Xr(l,ne(l,t),ne(l,n),r,i));for(var u=0;u<l.linked.length;++u)if(l.linked[u].isParent)return;s=he(a)}),new Dn(a,s)}function ro(e){return e.findMarks(S(e.first,0),e.clipPos(S(e.lastLine())),function(t){return t.parent})}function su(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),a=e.clipPos(i.from),s=e.clipPos(i.to);if(G(a,s)){var o=Xr(e,a,s,r.primary,r.primary.type);r.markers.push(o),o.parent=r}}}function ou(e){for(var t=function(r){var i=e[r],a=[i.primary.doc];lr(i.primary.doc,function(l){return a.push(l)});for(var s=0;s<i.markers.length;s++){var o=i.markers[s];oe(a,o.doc)==-1&&(o.parent=null,i.markers.splice(s--,1))}},n=0;n<e.length;n++)t(n)}var lu=0,it=function(e,t,n,r,i){if(!(this instanceof it))return new it(e,t,n,r,i);n==null&&(n=0),Ln.call(this,[new Tn([new Er("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var a=S(n,0);this.sel=sr(a),this.history=new si(null),this.id=++lu,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),aa(this,{from:a,to:a,text:e}),Xe(this,sr(a),ht)};it.prototype=Hn(Ln.prototype,{constructor:it,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ln(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:Be(function(e){var t=S(this.first,0),n=this.first+this.size-1;$r(this,{from:t,to:S(n,j(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&gn(this.cm,0,0),Xe(this,sr(t),ht)}),replaceRange:function(e,t,n,r){t=ne(this,t),n=n?ne(this,n):t,qr(this,e,t,n,r)},getRange:function(e,t,n){var r=zt(this,ne(this,e),ne(this,t));return n===!1?r:n===""?r.join(""):r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(M(this,e))return j(this,e)},getLineNumber:function(e){return c(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=j(this,e)),kt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ne(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Be(function(e,t,n){zs(this,ne(this,typeof e=="number"?S(e,t||0):e),null,n)}),setSelection:Be(function(e,t,n){zs(this,ne(this,e),ne(this,t||e),n)}),extendSelection:Be(function(e,t,n){li(this,ne(this,e),t&&ne(this,t),n)}),extendSelections:Be(function(e,t){Bs(this,Na(this,e),t)}),extendSelectionsBy:Be(function(e,t){var n=dr(this.sel.ranges,e);Bs(this,Na(this,n),t)}),setSelections:Be(function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new pe(ne(this,e[i].anchor),ne(this,e[i].head||e[i].anchor));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),Xe(this,Lt(this.cm,r,t),n)}}),addSelection:Be(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new pe(ne(this,e),ne(this,t||e))),Xe(this,Lt(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=zt(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=zt(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:Be(function(e,t,n){for(var r=[],i=this.sel,a=0;a<i.ranges.length;a++){var s=i.ranges[a];r[a]={from:s.from(),to:s.to(),text:this.splitLines(e[a]),origin:n}}for(var o=t&&t!="end"&&jl(this,r,t),l=r.length-1;l>=0;l--)$r(this,r[l]);o?Us(this,o):this.cm&&zr(this.cm)}),undo:Be(function(){ci(this,"undo")}),redo:Be(function(){ci(this,"redo")}),undoSelection:Be(function(){ci(this,"undo",!0)}),redoSelection:Be(function(){ci(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new si(this.history),lr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Gr(this.history.done),undone:Gr(this.history.undone)}},setHistory:function(e){var t=this.history=new si(this.history);t.done=Gr(e.done.slice(0),null,!0),t.undone=Gr(e.undone.slice(0),null,!0)},setGutterMarker:Be(function(e,t,n){return kn(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Fn(i)&&(r.gutterMarkers=null),!0})}),clearGutter:Be(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&kn(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Fn(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!M(this,e)||(t=e,e=j(this,e),!e))return null}else if(t=c(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:Be(function(e,t,n){return kn(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(ye(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:Be(function(e,t,n){return kn(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",a=r[i];if(a)if(n==null)r[i]=null;else{var s=a.match(ye(n));if(!s)return!1;var o=s.index+s[0].length;r[i]=a.slice(0,s.index)+(!s.index||o==a.length?"":" ")+a.slice(o)||null}else return!1;return!0})}),addLineWidget:Be(function(e,t,n){return iu(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Xr(this,ne(this,e),ne(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ne(this,e),Xr(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ne(this,e);var t=[],n=j(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ne(this,e),t=ne(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(a){var s=a.markedSpans;if(s)for(var o=0;o<s.length;o++){var l=s[o];!(l.to!=null&&i==e.line&&e.ch>=l.to||l.from==null&&i!=e.line||l.from!=null&&i==t.line&&l.from>=t.ch)&&(!n||n(l.marker))&&r.push(l.marker.parent||l.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var a=i.text.length+r;if(a>e)return t=e,!0;e-=a,++n}),ne(this,S(n,t))},indexFromPos:function(e){e=ne(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new it(ln(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new it(ln(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],su(r,ro(this)),r},unlinkDoc:function(e){if(e instanceof be&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),ou(ro(this));break}}if(e.history==this.history){var r=[e.id];lr(e,function(i){return r.push(i.id)},!0),e.history=new si(null),e.history.done=Gr(this.history.done,r),e.history.undone=Gr(this.history.undone,r)}},iterLinkedDocs:function(e){lr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):yt(e)},lineSeparator:function(){return this.lineSep||`
11
- `},setDirection:Be(function(e){e!="rtl"&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&Jl(this.cm))})}),it.prototype.eachLine=it.prototype.iter;var no=0;function uu(e){var t=this;if(io(t),!(Se(t,e)||Kt(t.display,e))){qe(e),_&&(no=+new Date);var n=mr(t,e,!0),r=e.dataTransfer.files;if(!(!n||t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,a=Array(i),s=0,o=function(){++s==i&&Fe(t,function(){n=ne(t.doc,n);var m={from:n,to:n,text:t.doc.splitLines(a.filter(function(L){return L!=null}).join(t.doc.lineSeparator())),origin:"paste"};$r(t.doc,m),Us(t.doc,sr(ne(t.doc,n),ne(t.doc,or(m))))})()},l=function(m,L){if(t.options.allowDropFileTypes&&oe(t.options.allowDropFileTypes,m.type)==-1){o();return}var A=new FileReader;A.onerror=function(){return o()},A.onload=function(){var F=A.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(F)){o();return}a[L]=F,o()},A.readAsText(m)},u=0;u<r.length;u++)l(r[u],u);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var d=e.dataTransfer.getData("Text");if(d){var v;if(t.state.draggingText&&!t.state.draggingText.copy&&(v=t.listSelections()),ui(t.doc,sr(n,n)),v)for(var w=0;w<v.length;++w)qr(t.doc,"",v[w].anchor,v[w].head,"drag");t.replaceSelection(d,"around","paste"),t.display.input.focus()}}catch{}}}}function fu(e,t){if(_&&(!e.state.draggingText||+new Date-no<100)){Vt(t);return}if(!(Se(e,t)||Kt(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!J)){var n=g("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",B&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),B&&n.parentNode.removeChild(n)}}function cu(e,t){var n=mr(e,t);if(n){var r=document.createDocumentFragment();qi(e,n,r),e.display.dragCursor||(e.display.dragCursor=g("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),$(e.display.dragCursor,r)}}function io(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function ao(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var a=0;a<n.length;a++)e(n[a])})}}var so=!1;function hu(){so||(du(),so=!0)}function du(){var e;ee(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,ao(pu)},100))}),ee(window,"blur",function(){return ao(Br)})}function pu(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var fr={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},On=0;On<10;On++)fr[On+48]=fr[On+96]=String(On);for(var hi=65;hi<=90;hi++)fr[hi]=String.fromCharCode(hi);for(var Mn=1;Mn<=12;Mn++)fr[Mn+111]=fr[Mn+63235]="F"+Mn;var qt={};qt.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},qt.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},qt.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},qt.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},qt.default=Z?qt.macDefault:qt.pcDefault;function vu(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,a,s=0;s<t.length-1;s++){var o=t[s];if(/^(cmd|meta|m)$/i.test(o))a=!0;else if(/^a(lt)?$/i.test(o))n=!0;else if(/^(c|ctrl|control)$/i.test(o))r=!0;else if(/^s(hift)?$/i.test(o))i=!0;else throw new Error("Unrecognized modifier name: "+o)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),a&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function gu(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=dr(n.split(" "),vu),a=0;a<i.length;a++){var s=void 0,o=void 0;a==i.length-1?(o=i.join(" "),s=r):(o=i.slice(0,a+1).join(" "),s="...");var l=t[o];if(!l)t[o]=s;else if(l!=s)throw new Error("Inconsistent bindings for "+o)}delete e[n]}for(var u in t)e[u]=t[u];return e}function Yr(e,t,n,r){t=di(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Yr(e,t.fallthrough,n,r);for(var a=0;a<t.fallthrough.length;a++){var s=Yr(e,t.fallthrough[a],n,r);if(s)return s}}}function oo(e){var t=typeof e=="string"?e:fr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function lo(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(Ie?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(Ie?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function uo(e,t){if(B&&e.keyCode==34&&e.char)return!1;var n=fr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),lo(n,e,t))}function di(e){return typeof e=="string"?qt[e]:e}function jr(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var a=t(n[i]);r.length&&G(a.from,he(r).to)<=0;){var s=r.pop();if(G(s.from,a.from)<0){a.from=s.from;break}}r.push(a)}ut(e,function(){for(var o=r.length-1;o>=0;o--)qr(e.doc,"",r[o].from,r[o].to,"+delete");zr(e)})}function ua(e,t,n){var r=Jt(e.text,t+n,n);return r<0||r>e.text.length?null:r}function fa(e,t,n){var r=ua(e,t.ch,n);return r==null?null:new S(t.line,r,n<0?"after":"before")}function ca(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var a=ce(n,t.doc.direction);if(a){var s=i<0?he(a):a[0],o=i<0==(s.level==1),l=o?"after":"before",u;if(s.level>0||t.doc.direction=="rtl"){var d=Wr(t,n);u=i<0?n.text.length-1:0;var v=Et(t,d,u).top;u=Nt(function(w){return Et(t,d,w).top==v},i<0==(s.level==1)?s.from:s.to-1,u),l=="before"&&(u=ua(n,u,1))}else u=i<0?s.to:s.from;return new S(r,u,l)}}return new S(r,i<0?n.text.length:0,i<0?"before":"after")}function yu(e,t,n,r){var i=ce(t,e.doc.direction);if(!i)return fa(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var a=Zt(i,n.ch,n.sticky),s=i[a];if(e.doc.direction=="ltr"&&s.level%2==0&&(r>0?s.to>n.ch:s.from<n.ch))return fa(t,n,r);var o=function(z,K){return ua(t,z instanceof S?z.ch:z,K)},l,u=function(z){return e.options.lineWrapping?(l=l||Wr(e,t),ps(e,t,l,z)):{begin:0,end:t.text.length}},d=u(n.sticky=="before"?o(n,-1):n.ch);if(e.doc.direction=="rtl"||s.level==1){var v=s.level==1==r<0,w=o(n,v?1:-1);if(w!=null&&(v?w<=s.to&&w<=d.end:w>=s.from&&w>=d.begin)){var m=v?"before":"after";return new S(n.line,w,m)}}var L=function(z,K,U){for(var q=function(me,ze){return ze?new S(n.line,o(me,1),"before"):new S(n.line,me,"after")};z>=0&&z<i.length;z+=K){var te=i[z],V=K>0==(te.level!=1),le=V?U.begin:o(U.end,-1);if(te.from<=le&&le<te.to||(le=V?te.from:o(te.to,-1),U.begin<=le&&le<U.end))return q(le,V)}},A=L(a+r,r,d);if(A)return A;var F=r>0?d.end:o(d.begin,-1);return F!=null&&!(r>0&&F==t.text.length)&&(A=L(r>0?0:i.length-1,r,u(F)),A)?A:null}var Nn={selectAll:Xs,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ht)},killLine:function(e){return jr(e,function(t){if(t.empty()){var n=j(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:S(t.head.line+1,0)}:{from:t.head,to:S(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return jr(e,function(t){return{from:S(t.from().line,0),to:ne(e.doc,S(t.to().line+1,0))}})},delLineLeft:function(e){return jr(e,function(t){return{from:S(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return jr(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return jr(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(S(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(S(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return fo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return co(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return mu(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},dt)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},dt)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?co(e,t.head):r},dt)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var a=n[i].from(),s=ve(e.getLine(a.line),a.ch,r);t.push(rn(r-s%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return ut(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)if(t[r].empty()){var i=t[r].head,a=j(e.doc,i.line).text;if(a){if(i.ch==a.length&&(i=new S(i.line,i.ch-1)),i.ch>0)i=new S(i.line,i.ch+1),e.replaceRange(a.charAt(i.ch-1)+a.charAt(i.ch-2),S(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var s=j(e.doc,i.line-1).text;s&&(i=new S(i.line,1),e.replaceRange(a.charAt(0)+e.doc.lineSeparator()+s.charAt(s.length-1),S(i.line-1,s.length-1),i,"+transpose"))}}n.push(new pe(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return ut(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);zr(e)})},openLine:function(e){return e.replaceSelection(`
12
- `,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function fo(e,t){var n=j(e.doc,t),r=kt(n);return r!=n&&(t=c(r)),ca(!0,e,r,t,1)}function mu(e,t){var n=j(e.doc,t),r=tl(n);return r!=n&&(t=c(r)),ca(!0,e,n,t,-1)}function co(e,t){var n=fo(e,t.line),r=j(e.doc,n.line),i=ce(r,e.doc.direction);if(!i||i[0].level==0){var a=Math.max(n.ch,r.text.search(/\S/)),s=t.line==n.line&&t.ch<=a&&t.ch;return S(n.line,s?0:a,n.sticky)}return n}function pi(e,t,n){if(typeof t=="string"&&(t=Nn[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=jt}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function bu(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Yr(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Yr(t,e.options.extraKeys,n,e)||Yr(t,e.options.keyMap,n,e)}var wu=new Dt;function An(e,t,n,r){var i=e.state.keySeq;if(i){if(oo(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:wu.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),ho(e,i+" "+t,n,r))return!0}return ho(e,t,n,r)}function ho(e,t,n,r){var i=bu(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&He(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(qe(n),Xi(e)),!!i}function po(e,t){var n=uo(t,!0);return n?t.shiftKey&&!e.state.keySeq?An(e,"Shift-"+n,t,function(r){return pi(e,r,!0)})||An(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return pi(e,r)}):An(e,n,t,function(r){return pi(e,r)}):!1}function xu(e,t,n){return An(e,"'"+n+"'",t,function(r){return pi(e,r,!0)})}var ha=null;function vo(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=_e(mt(t)),!Se(t,e))){_&&b<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=po(t,e);B&&(ha=r?n:null,!r&&n==88&&!Un&&(Z?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),T&&!Z&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Cu(t)}}function Cu(e){var t=e.display.lineDiv;xe(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(je(t,"CodeMirror-crosshair"),$e(document,"keyup",n),$e(document,"mouseover",n))}ee(document,"keyup",n),ee(document,"mouseover",n)}function go(e){e.keyCode==16&&(this.doc.sel.shift=!1),Se(this,e)}function yo(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(Kt(t.display,e)||Se(t,e)||e.ctrlKey&&!e.altKey||Z&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(B&&n==ha){ha=null,qe(e);return}if(!(B&&(!e.which||e.which<10)&&po(t,e))){var i=String.fromCharCode(r??n);i!="\b"&&(xu(t,e,i)||t.display.input.onKeyPress(e))}}}var Su=400,da=function(e,t,n){this.time=e,this.pos=t,this.button=n};da.prototype.compare=function(e,t,n){return this.time+Su>e&&G(t,this.pos)==0&&n==this.button};var In,Rn;function ku(e,t){var n=+new Date;return Rn&&Rn.compare(n,e,t)?(In=Rn=null,"triple"):In&&In.compare(n,e,t)?(Rn=new da(n,e,t),In=null,"double"):(In=new da(n,e,t),Rn=null,"single")}function mo(e){var t=this,n=t.display;if(!(Se(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,Kt(n,e)){D||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!pa(t,e)){var r=mr(t,e),i=wt(e),a=r?ku(r,i):"single";ae(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Tu(t,i,r,a,e))&&(i==1?r?_u(t,r,a,e):an(e)==n.scroller&&qe(e):i==2?(r&&li(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(Ne?t.display.input.onContextMenu(e):Yi(t)))}}}function Tu(e,t,n,r,i){var a="Click";return r=="double"?a="Double"+a:r=="triple"&&(a="Triple"+a),a=(t==1?"Left":t==2?"Middle":"Right")+a,An(e,lo(a,i),i,function(s){if(typeof s=="string"&&(s=Nn[s]),!s)return!1;var o=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),o=s(e,n)!=jt}finally{e.state.suppressEdits=!1}return o})}function Lu(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var a=ie?n.shiftKey&&n.metaKey:n.altKey;i.unit=a?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=Z?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(Z?n.altKey:n.ctrlKey)),i}function _u(e,t,n,r){_?setTimeout(re(ms,e),0):e.curOp.focus=_e(mt(e));var i=Lu(e,n,r),a=e.doc.sel,s;e.options.dragDrop&&Li&&!e.isReadOnly()&&n=="single"&&(s=a.contains(t))>-1&&(G((s=a.ranges[s]).from(),t)<0||t.xRel>0)&&(G(s.to(),t)>0||t.xRel<0)?Du(e,r,t,i):Ou(e,r,t,i)}function Du(e,t,n,r){var i=e.display,a=!1,s=Fe(e,function(u){D&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Yi(e)),$e(i.wrapper.ownerDocument,"mouseup",s),$e(i.wrapper.ownerDocument,"mousemove",o),$e(i.scroller,"dragstart",l),$e(i.scroller,"drop",s),a||(qe(u),r.addNew||li(e.doc,n,null,null,r.extend),D&&!J||_&&b==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),o=function(u){a=a||Math.abs(t.clientX-u.clientX)+Math.abs(t.clientY-u.clientY)>=10},l=function(){return a=!0};D&&(i.scroller.draggable=!0),e.state.draggingText=s,s.copy=!r.moveOnDrag,ee(i.wrapper.ownerDocument,"mouseup",s),ee(i.wrapper.ownerDocument,"mousemove",o),ee(i.scroller,"dragstart",l),ee(i.scroller,"drop",s),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function bo(e,t,n){if(n=="char")return new pe(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new pe(S(t.line,0),ne(e.doc,S(t.line+1,0)));var r=n(e,t);return new pe(r.from,r.to)}function Ou(e,t,n,r){_&&Yi(e);var i=e.display,a=e.doc;qe(t);var s,o,l=a.sel,u=l.ranges;if(r.addNew&&!r.extend?(o=a.sel.contains(n),o>-1?s=u[o]:s=new pe(n,n)):(s=a.sel.primary(),o=a.sel.primIndex),r.unit=="rectangle")r.addNew||(s=new pe(n,n)),n=mr(e,t,!0,!0),o=-1;else{var d=bo(e,n,r.unit);r.extend?s=oa(s,d.anchor,d.head,r.extend):s=d}r.addNew?o==-1?(o=u.length,Xe(a,Lt(e,u.concat([s]),o),{scroll:!1,origin:"*mouse"})):u.length>1&&u[o].empty()&&r.unit=="char"&&!r.extend?(Xe(a,Lt(e,u.slice(0,o).concat(u.slice(o+1)),0),{scroll:!1,origin:"*mouse"}),l=a.sel):la(a,o,s,Ot):(o=0,Xe(a,new vt([s],0),Ot),l=a.sel);var v=n;function w(U){if(G(v,U)!=0)if(v=U,r.unit=="rectangle"){for(var q=[],te=e.options.tabSize,V=ve(j(a,n.line).text,n.ch,te),le=ve(j(a,U.line).text,U.ch,te),me=Math.min(V,le),ze=Math.max(V,le),we=Math.min(n.line,U.line),ft=Math.min(e.lastLine(),Math.max(n.line,U.line));we<=ft;we++){var at=j(a,we).text,Oe=Mt(at,me,te);me==ze?q.push(new pe(S(we,Oe),S(we,Oe))):at.length>Oe&&q.push(new pe(S(we,Oe),S(we,Mt(at,ze,te))))}q.length||q.push(new pe(n,n)),Xe(a,Lt(e,l.ranges.slice(0,o).concat(q),o),{origin:"*mouse",scroll:!1}),e.scrollIntoView(U)}else{var st=s,Ge=bo(e,U,r.unit),Ae=st.anchor,Me;G(Ge.anchor,Ae)>0?(Me=Ge.head,Ae=Rr(st.from(),Ge.anchor)):(Me=Ge.anchor,Ae=rt(st.to(),Ge.head));var Te=l.ranges.slice(0);Te[o]=Mu(e,new pe(ne(a,Ae),Me)),Xe(a,Lt(e,Te,o),Ot)}}var m=i.wrapper.getBoundingClientRect(),L=0;function A(U){var q=++L,te=mr(e,U,!0,r.unit=="rectangle");if(te)if(G(te,v)!=0){e.curOp.focus=_e(mt(e)),w(te);var V=ri(i,a);(te.line>=V.to||te.line<V.from)&&setTimeout(Fe(e,function(){L==q&&A(U)}),150)}else{var le=U.clientY<m.top?-20:U.clientY>m.bottom?20:0;le&&setTimeout(Fe(e,function(){L==q&&(i.scroller.scrollTop+=le,A(U))}),50)}}function F(U){e.state.selectingText=!1,L=1/0,U&&(qe(U),i.input.focus()),$e(i.wrapper.ownerDocument,"mousemove",z),$e(i.wrapper.ownerDocument,"mouseup",K),a.history.lastSelOrigin=null}var z=Fe(e,function(U){U.buttons===0||!wt(U)?F(U):A(U)}),K=Fe(e,F);e.state.selectingText=K,ee(i.wrapper.ownerDocument,"mousemove",z),ee(i.wrapper.ownerDocument,"mouseup",K)}function Mu(e,t){var n=t.anchor,r=t.head,i=j(e.doc,n.line);if(G(n,r)==0&&n.sticky==r.sticky)return t;var a=ce(i);if(!a)return t;var s=Zt(a,n.ch,n.sticky),o=a[s];if(o.from!=n.ch&&o.to!=n.ch)return t;var l=s+(o.from==n.ch==(o.level!=1)?0:1);if(l==0||l==a.length)return t;var u;if(r.line!=n.line)u=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var d=Zt(a,r.ch,r.sticky),v=d-s||(r.ch-n.ch)*(o.level==1?-1:1);d==l-1||d==l?u=v<0:u=v>0}var w=a[l+(u?-1:0)],m=u==(w.level==1),L=m?w.from:w.to,A=m?"after":"before";return n.ch==L&&n.sticky==A?t:new pe(new S(n.line,L,A),r)}function wo(e,t,n,r){var i,a;if(t.touches)i=t.touches[0].clientX,a=t.touches[0].clientY;else try{i=t.clientX,a=t.clientY}catch{return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&qe(t);var s=e.display,o=s.lineDiv.getBoundingClientRect();if(a>o.bottom||!lt(e,n))return tt(t);a-=o.top-s.viewOffset;for(var l=0;l<e.display.gutterSpecs.length;++l){var u=s.gutters.childNodes[l];if(u&&u.getBoundingClientRect().right>=i){var d=p(e.doc,a),v=e.display.gutterSpecs[l];return Ce(e,n,e,d,v.className,t),tt(t)}}}function pa(e,t){return wo(e,t,"gutterClick",!0)}function xo(e,t){Kt(e.display,t)||Nu(e,t)||Se(e,t,"contextmenu")||Ne||e.display.input.onContextMenu(t)}function Nu(e,t){return lt(e,"gutterContextMenu")?wo(e,t,"gutterContextMenu",!1):!1}function Co(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),pn(e)}var Jr={toString:function(){return"CodeMirror.Init"}},So={},vi={};function Au(e){var t=e.optionHandlers;function n(r,i,a,s){e.defaults[r]=i,a&&(t[r]=s?function(o,l,u){u!=Jr&&a(o,l,u)}:a)}e.defineOption=n,e.Init=Jr,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,ia(r)},!0),n("indentUnit",2,ia,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Cn(r),pn(r),nt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!!i){var a=[],s=r.doc.first;r.doc.iter(function(l){for(var u=0;;){var d=l.text.indexOf(i,u);if(d==-1)break;u=d+i.length,a.push(S(s,d))}s++});for(var o=a.length-1;o>=0;o--)qr(r.doc,i,a[o],S(a[o].line,a[o].ch+i.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,i,a){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),a!=Jr&&r.refresh()}),n("specialCharPlaceholder",ol,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",X?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!se),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Co(r),xn(r)},!0),n("keyMap","default",function(r,i,a){var s=di(i),o=a!=Jr&&di(a);o&&o.detach&&o.detach(r,s),s.attach&&s.attach(r,o||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ru,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=ra(i,r.options.lineNumbers),xn(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ki(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Ur(r)},!0),n("scrollbarStyle","native",function(r){ks(r),Ur(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=ra(r.options.gutters,i),xn(r)},!0),n("firstLineNumber",1,xn,!0),n("lineNumberFormatter",function(r){return r},xn,!0),n("showCursorWhenSelecting",!1,vn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Br(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Iu),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,vn,!0),n("singleCursorHeightPerLine",!0,vn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Cn,!0),n("addModeClass",!1,Cn,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,Cn,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Iu(e,t,n){var r=n&&n!=Jr;if(!t!=!r){var i=e.display.dragFunctions,a=t?ee:$e;a(e.display.scroller,"dragstart",i.start),a(e.display.scroller,"dragenter",i.enter),a(e.display.scroller,"dragover",i.over),a(e.display.scroller,"dragleave",i.leave),a(e.display.scroller,"drop",i.drop)}}function Ru(e){e.options.lineWrapping?(xe(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(je(e.display.wrapper,"CodeMirror-wrap"),Ri(e)),$i(e),nt(e),pn(e),setTimeout(function(){return Ur(e)},100)}function be(e,t){var n=this;if(!(this instanceof be))return new be(e,t);this.options=t=t?ue(t):{},ue(So,t,!1);var r=t.value;typeof r=="string"?r=new it(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new be.inputStyles[t.inputStyle](this),a=this.display=new Xl(e,r,i,t);a.wrapper.CodeMirror=this,Co(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),ks(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Dt,keySeq:null,specialChars:null},t.autofocus&&!X&&a.input.focus(),_&&b<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Eu(this),hu(),Cr(this),this.curOp.forceUpdate=!0,Rs(this,r),t.autofocus&&!X||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&ji(n)},20):Br(this);for(var s in vi)vi.hasOwnProperty(s)&&vi[s](this,t[s],Jr);_s(this),t.finishInit&&t.finishInit(this);for(var o=0;o<va.length;++o)va[o](this);Sr(this),D&&t.lineWrapping&&getComputedStyle(a.lineDiv).textRendering=="optimizelegibility"&&(a.lineDiv.style.textRendering="auto")}be.defaults=So,be.optionHandlers=vi;function Eu(e){var t=e.display;ee(t.scroller,"mousedown",Fe(e,mo)),_&&b<11?ee(t.scroller,"dblclick",Fe(e,function(l){if(!Se(e,l)){var u=mr(e,l);if(!(!u||pa(e,l)||Kt(e.display,l))){qe(l);var d=e.findWordAt(u);li(e.doc,d.anchor,d.head)}}})):ee(t.scroller,"dblclick",function(l){return Se(e,l)||qe(l)}),ee(t.scroller,"contextmenu",function(l){return xo(e,l)}),ee(t.input.getField(),"contextmenu",function(l){t.scroller.contains(l.target)||xo(e,l)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function a(l){if(l.touches.length!=1)return!1;var u=l.touches[0];return u.radiusX<=1&&u.radiusY<=1}function s(l,u){if(u.left==null)return!0;var d=u.left-l.left,v=u.top-l.top;return d*d+v*v>20*20}ee(t.scroller,"touchstart",function(l){if(!Se(e,l)&&!a(l)&&!pa(e,l)){t.input.ensurePolled(),clearTimeout(n);var u=+new Date;t.activeTouch={start:u,moved:!1,prev:u-r.end<=300?r:null},l.touches.length==1&&(t.activeTouch.left=l.touches[0].pageX,t.activeTouch.top=l.touches[0].pageY)}}),ee(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ee(t.scroller,"touchend",function(l){var u=t.activeTouch;if(u&&!Kt(t,l)&&u.left!=null&&!u.moved&&new Date-u.start<300){var d=e.coordsChar(t.activeTouch,"page"),v;!u.prev||s(u,u.prev)?v=new pe(d,d):!u.prev.prev||s(u,u.prev.prev)?v=e.findWordAt(d):v=new pe(S(d.line,0),ne(e.doc,S(d.line+1,0))),e.setSelection(v.anchor,v.head),e.focus(),qe(l)}i()}),ee(t.scroller,"touchcancel",i),ee(t.scroller,"scroll",function(){t.scroller.clientHeight&&(yn(e,t.scroller.scrollTop),wr(e,t.scroller.scrollLeft,!0),Ce(e,"scroll",e))}),ee(t.scroller,"mousewheel",function(l){return Ms(e,l)}),ee(t.scroller,"DOMMouseScroll",function(l){return Ms(e,l)}),ee(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(l){Se(e,l)||Vt(l)},over:function(l){Se(e,l)||(cu(e,l),Vt(l))},start:function(l){return fu(e,l)},drop:Fe(e,uu),leave:function(l){Se(e,l)||io(e)}};var o=t.input.getField();ee(o,"keyup",function(l){return go.call(e,l)}),ee(o,"keydown",Fe(e,vo)),ee(o,"keypress",Fe(e,yo)),ee(o,"focus",function(l){return ji(e,l)}),ee(o,"blur",function(l){return Br(e,l)})}var va=[];be.defineInitHook=function(e){return va.push(e)};function En(e,t,n,r){var i=e.doc,a;n==null&&(n="add"),n=="smart"&&(i.mode.indent?a=un(e,t).state:n="prev");var s=e.options.tabSize,o=j(i,t),l=ve(o.text,null,s);o.stateAfter&&(o.stateAfter=null);var u=o.text.match(/^\s*/)[0],d;if(!r&&!/\S/.test(o.text))d=0,n="not";else if(n=="smart"&&(d=i.mode.indent(a,o.text.slice(u.length),o.text),d==jt||d>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?d=ve(j(i,t-1).text,null,s):d=0:n=="add"?d=l+e.options.indentUnit:n=="subtract"?d=l-e.options.indentUnit:typeof n=="number"&&(d=l+n),d=Math.max(0,d);var v="",w=0;if(e.options.indentWithTabs)for(var m=Math.floor(d/s);m;--m)w+=s,v+=" ";if(w<d&&(v+=rn(d-w)),v!=u)return qr(i,v,S(t,0),S(t,u.length),"+input"),o.stateAfter=null,!0;for(var L=0;L<i.sel.ranges.length;L++){var A=i.sel.ranges[L];if(A.head.line==t&&A.head.ch<u.length){var F=S(t,u.length);la(i,L,new pe(F,F));break}}}var _t=null;function gi(e){_t=e}function ga(e,t,n,r,i){var a=e.doc;e.display.shift=!1,r||(r=a.sel);var s=+new Date-200,o=i=="paste"||e.state.pasteIncoming>s,l=yt(t),u=null;if(o&&r.ranges.length>1)if(_t&&_t.text.join(`
13
- `)==t){if(r.ranges.length%_t.text.length==0){u=[];for(var d=0;d<_t.text.length;d++)u.push(a.splitLines(_t.text[d]))}}else l.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(u=dr(l,function(z){return[z]}));for(var v=e.curOp.updateInput,w=r.ranges.length-1;w>=0;w--){var m=r.ranges[w],L=m.from(),A=m.to();m.empty()&&(n&&n>0?L=S(L.line,L.ch-n):e.state.overwrite&&!o?A=S(A.line,Math.min(j(a,A.line).text.length,A.ch+he(l).length)):o&&_t&&_t.lineWise&&_t.text.join(`
14
- `)==l.join(`
15
- `)&&(L=A=S(L.line,0)));var F={from:L,to:A,text:u?u[w%u.length]:l,origin:i||(o?"paste":e.state.cutIncoming>s?"cut":"+input")};$r(e.doc,F),He(e,"inputRead",e,F)}t&&!o&&To(e,t),zr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=v),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ko(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&ut(t,function(){return ga(t,n,0,null,"paste")}),!0}function To(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var a=e.getModeAt(i.head),s=!1;if(a.electricChars){for(var o=0;o<a.electricChars.length;o++)if(t.indexOf(a.electricChars.charAt(o))>-1){s=En(e,i.head.line,"smart");break}}else a.electricInput&&a.electricInput.test(j(e.doc,i.head.line).text.slice(0,i.head.ch))&&(s=En(e,i.head.line,"smart"));s&&He(e,"electricInput",e,i.head.line)}}}function Lo(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,a={anchor:S(i,0),head:S(i+1,0)};n.push(a),t.push(e.getRange(a.anchor,a.head))}return{text:t,ranges:n}}function ya(e,t,n,r){e.setAttribute("autocorrect",n?"on":"off"),e.setAttribute("autocapitalize",r?"on":"off"),e.setAttribute("spellcheck",!!t)}function _o(){var e=g("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=g("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return D?e.style.width="1000px":e.setAttribute("wrap","off"),k&&(e.style.border="1px solid black"),t}function Pu(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){ae(this).focus(),this.display.input.focus()},setOption:function(r,i){var a=this.options,s=a[r];a[r]==i&&r!="mode"||(a[r]=i,t.hasOwnProperty(r)&&Fe(this,t[r])(this,i,s),Ce(this,"optionChange",this,r))},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](di(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,a=0;a<i.length;++a)if(i[a]==r||i[a].name==r)return i.splice(a,1),!0},addOverlay:Ze(function(r,i){var a=r.token?r:e.getMode(this.options,r);if(a.startState)throw new Error("Overlays may not be stateful.");Si(this.state.overlays,{mode:a,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(s){return s.priority}),this.state.modeGen++,nt(this)}),removeOverlay:Ze(function(r){for(var i=this.state.overlays,a=0;a<i.length;++a){var s=i[a].modeSpec;if(s==r||typeof r=="string"&&s.name==r){i.splice(a,1),this.state.modeGen++,nt(this);return}}}),indentLine:Ze(function(r,i,a){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),M(this.doc,r)&&En(this,r,i,a)}),indentSelection:Ze(function(r){for(var i=this.doc.sel.ranges,a=-1,s=0;s<i.length;s++){var o=i[s];if(o.empty())o.head.line>a&&(En(this,o.head.line,r,!0),a=o.head.line,s==this.doc.sel.primIndex&&zr(this));else{var l=o.from(),u=o.to(),d=Math.max(a,l.line);a=Math.min(this.lastLine(),u.line-(u.ch?0:1))+1;for(var v=d;v<a;++v)En(this,v,r);var w=this.doc.sel.ranges;l.ch==0&&i.length==w.length&&w[s].from().ch>0&&la(this.doc,s,new pe(l,w[s].to()),ht)}}}),getTokenAt:function(r,i){return Pa(this,r,i)},getLineTokens:function(r,i){return Pa(this,S(r),i,!0)},getTokenTypeAt:function(r){r=ne(this.doc,r);var i=Ia(this,j(this.doc,r.line)),a=0,s=(i.length-1)/2,o=r.ch,l;if(o==0)l=i[2];else for(;;){var u=a+s>>1;if((u?i[u*2-1]:0)>=o)s=u;else if(i[u*2+1]<o)a=u+1;else{l=i[u*2+2];break}}var d=l?l.indexOf("overlay "):-1;return d<0?l:d==0?null:l.slice(0,d-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var a=[];if(!n.hasOwnProperty(i))return a;var s=n[i],o=this.getModeAt(r);if(typeof o[i]=="string")s[o[i]]&&a.push(s[o[i]]);else if(o[i])for(var l=0;l<o[i].length;l++){var u=s[o[i][l]];u&&a.push(u)}else o.helperType&&s[o.helperType]?a.push(s[o.helperType]):s[o.name]&&a.push(s[o.name]);for(var d=0;d<s._global.length;d++){var v=s._global[d];v.pred(o,this)&&oe(a,v.val)==-1&&a.push(v.val)}return a},getStateAfter:function(r,i){var a=this.doc;return r=Ma(a,r??a.first+a.size-1),un(this,r+1,i).state},cursorCoords:function(r,i){var a,s=this.doc.sel.primary();return r==null?a=s.head:typeof r=="object"?a=ne(this.doc,r):a=r?s.from():s.to(),Tt(this,a,i||"page")},charCoords:function(r,i){return Zn(this,ne(this.doc,r),i||"page")},coordsChar:function(r,i){return r=cs(this,r,i||"page"),zi(this,r.left,r.top)},lineAtHeight:function(r,i){return r=cs(this,{top:r,left:0},i||"page").top,p(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,a){var s=!1,o;if(typeof r=="number"){var l=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>l&&(r=l,s=!0),o=j(this.doc,r)}else o=r;return Qn(this,o,{top:0,left:0},i||"page",a||s).top+(s?this.doc.height-Gt(o):0)},defaultTextHeight:function(){return Hr(this.display)},defaultCharWidth:function(){return Fr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,a,s,o){var l=this.display;r=Tt(this,ne(this.doc,r));var u=r.bottom,d=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),l.sizer.appendChild(i),s=="over")u=r.top;else if(s=="above"||s=="near"){var v=Math.max(l.wrapper.clientHeight,this.doc.height),w=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);(s=="above"||r.bottom+i.offsetHeight>v)&&r.top>i.offsetHeight?u=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=v&&(u=r.bottom),d+i.offsetWidth>w&&(d=w-i.offsetWidth)}i.style.top=u+"px",i.style.left=i.style.right="",o=="right"?(d=l.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(o=="left"?d=0:o=="middle"&&(d=(l.sizer.clientWidth-i.offsetWidth)/2),i.style.left=d+"px"),a&&Il(this,{left:d,top:u,right:d+i.offsetWidth,bottom:u+i.offsetHeight})},triggerOnKeyDown:Ze(vo),triggerOnKeyPress:Ze(yo),triggerOnKeyUp:go,triggerOnMouseDown:Ze(mo),execCommand:function(r){if(Nn.hasOwnProperty(r))return Nn[r].call(null,this)},triggerElectric:Ze(function(r){To(this,r)}),findPosH:function(r,i,a,s){var o=1;i<0&&(o=-1,i=-i);for(var l=ne(this.doc,r),u=0;u<i&&(l=ma(this.doc,l,o,a,s),!l.hitSide);++u);return l},moveH:Ze(function(r,i){var a=this;this.extendSelectionsBy(function(s){return a.display.shift||a.doc.extend||s.empty()?ma(a.doc,s.head,r,i,a.options.rtlMoveVisually):r<0?s.from():s.to()},dt)}),deleteH:Ze(function(r,i){var a=this.doc.sel,s=this.doc;a.somethingSelected()?s.replaceSelection("",null,"+delete"):jr(this,function(o){var l=ma(s,o.head,r,i,!1);return r<0?{from:l,to:o.head}:{from:o.head,to:l}})}),findPosV:function(r,i,a,s){var o=1,l=s;i<0&&(o=-1,i=-i);for(var u=ne(this.doc,r),d=0;d<i;++d){var v=Tt(this,u,"div");if(l==null?l=v.left:v.left=l,u=Do(this,v,o,a),u.hitSide)break}return u},moveV:Ze(function(r,i){var a=this,s=this.doc,o=[],l=!this.display.shift&&!s.extend&&s.sel.somethingSelected();if(s.extendSelectionsBy(function(d){if(l)return r<0?d.from():d.to();var v=Tt(a,d.head,"div");d.goalColumn!=null&&(v.left=d.goalColumn),o.push(v.left);var w=Do(a,v,r,i);return i=="page"&&d==s.sel.primary()&&Qi(a,Zn(a,w,"div").top-v.top),w},dt),o.length)for(var u=0;u<s.sel.ranges.length;u++)s.sel.ranges[u].goalColumn=o[u]}),findWordAt:function(r){var i=this.doc,a=j(i,r.line).text,s=r.ch,o=r.ch;if(a){var l=this.getHelper(r,"wordChars");(r.sticky=="before"||o==a.length)&&s?--s:++o;for(var u=a.charAt(s),d=Ht(u,l)?function(v){return Ht(v,l)}:/\s/.test(u)?function(v){return/\s/.test(v)}:function(v){return!/\s/.test(v)&&!Ht(v)};s>0&&d(a.charAt(s-1));)--s;for(;o<a.length&&d(a.charAt(o));)++o}return new pe(S(r.line,s),S(r.line,o))},toggleOverwrite:function(r){r!=null&&r==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?xe(this.display.cursorDiv,"CodeMirror-overwrite"):je(this.display.cursorDiv,"CodeMirror-overwrite"),Ce(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==_e(mt(this))},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Ze(function(r,i){gn(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Rt(this)-this.display.barHeight,width:r.scrollWidth-Rt(this)-this.display.barWidth,clientHeight:Wi(this),clientWidth:gr(this)}},scrollIntoView:Ze(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:S(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Rl(this,r):ws(this,r.from,r.to,r.margin)}),setSize:Ze(function(r,i){var a=this,s=function(l){return typeof l=="number"||/^\d+$/.test(String(l))?l+"px":l};r!=null&&(this.display.wrapper.style.width=s(r)),i!=null&&(this.display.wrapper.style.height=s(i)),this.options.lineWrapping&&ls(this);var o=this.display.viewFrom;this.doc.iter(o,this.display.viewTo,function(l){if(l.widgets){for(var u=0;u<l.widgets.length;u++)if(l.widgets[u].noHScroll){ir(a,o,"widget");break}}++o}),this.curOp.forceUpdate=!0,Ce(this,"refresh",this)}),operation:function(r){return ut(this,r)},startOperation:function(){return Cr(this)},endOperation:function(){return Sr(this)},refresh:Ze(function(){var r=this.display.cachedTextHeight;nt(this),this.curOp.forceUpdate=!0,pn(this),gn(this,this.doc.scrollLeft,this.doc.scrollTop),ea(this.display),(r==null||Math.abs(r-Hr(this.display))>.5||this.options.lineWrapping)&&$i(this),Ce(this,"refresh",this)}),swapDoc:Ze(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Rs(this,r),pn(this),this.display.input.reset(),gn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,He(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},bt(e),e.registerHelper=function(r,i,a){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=a},e.registerGlobalHelper=function(r,i,a,s){e.registerHelper(r,i,s),n[r]._global.push({pred:a,val:s})}}function ma(e,t,n,r,i){var a=t,s=n,o=j(e,t.line),l=i&&e.direction=="rtl"?-n:n;function u(){var K=t.line+l;return K<e.first||K>=e.first+e.size?!1:(t=new S(K,t.ch,t.sticky),o=j(e,K))}function d(K){var U;if(r=="codepoint"){var q=o.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(q))U=null;else{var te=n>0?q>=55296&&q<56320:q>=56320&&q<57343;U=new S(t.line,Math.max(0,Math.min(o.text.length,t.ch+n*(te?2:1))),-n)}}else i?U=yu(e.cm,o,t,n):U=fa(o,t,n);if(U==null)if(!K&&u())t=ca(i,e.cm,o,t.line,l);else return!1;else t=U;return!0}if(r=="char"||r=="codepoint")d();else if(r=="column")d(!0);else if(r=="word"||r=="group")for(var v=null,w=r=="group",m=e.cm&&e.cm.getHelper(t,"wordChars"),L=!0;!(n<0&&!d(!L));L=!1){var A=o.text.charAt(t.ch)||`
16
- `,F=Ht(A,m)?"w":w&&A==`
17
- `?"n":!w||/\s/.test(A)?null:"p";if(w&&!L&&!F&&(F="s"),v&&v!=F){n<0&&(n=1,d(),t.sticky="after");break}if(F&&(v=F),n>0&&!d(!L))break}var z=fi(e,t,a,s,!0);return de(a,z)&&(z.hitSide=!0),z}function Do(e,t,n,r){var i=e.doc,a=t.left,s;if(r=="page"){var o=Math.min(e.display.wrapper.clientHeight,ae(e).innerHeight||i(e).documentElement.clientHeight),l=Math.max(o-.5*Hr(e.display),3);s=(n>0?t.bottom:t.top)+n*l}else r=="line"&&(s=n>0?t.bottom+3:t.top-3);for(var u;u=zi(e,a,s),!!u.outside;){if(n<0?s<=0:s>=i.height){u.hitSide=!0;break}s+=n*5}return u}var ge=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Dt,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};ge.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable=!0,ya(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function a(o){for(var l=o.target;l;l=l.parentNode){if(l==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(l.className))break}return!1}ee(i,"paste",function(o){!a(o)||Se(r,o)||ko(o,r)||b<=11&&setTimeout(Fe(r,function(){return t.updateFromDOM()}),20)}),ee(i,"compositionstart",function(o){t.composing={data:o.data,done:!1}}),ee(i,"compositionupdate",function(o){t.composing||(t.composing={data:o.data,done:!1})}),ee(i,"compositionend",function(o){t.composing&&(o.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ee(i,"touchstart",function(){return n.forceCompositionEnd()}),ee(i,"input",function(){t.composing||t.readFromDOMSoon()});function s(o){if(!(!a(o)||Se(r,o))){if(r.somethingSelected())gi({lineWise:!1,text:r.getSelections()}),o.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var l=Lo(r);gi({lineWise:!0,text:l.text}),o.type=="cut"&&r.operation(function(){r.setSelections(l.ranges,0,ht),r.replaceSelection("",null,"cut")})}else return;if(o.clipboardData){o.clipboardData.clearData();var u=_t.text.join(`
18
- `);if(o.clipboardData.setData("Text",u),o.clipboardData.getData("Text")==u){o.preventDefault();return}}var d=_o(),v=d.firstChild;ya(v),r.display.lineSpace.insertBefore(d,r.display.lineSpace.firstChild),v.value=_t.text.join(`
19
- `);var w=_e(Pe(i));hr(v),setTimeout(function(){r.display.lineSpace.removeChild(d),w.focus(),w==i&&n.showPrimarySelection()},50)}}ee(i,"copy",s),ee(i,"cut",s)},ge.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},ge.prototype.prepareSelection=function(){var e=ys(this.cm,!1);return e.focus=_e(Pe(this.div))==this.div,e},ge.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},ge.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},ge.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var a=yi(t,e.anchorNode,e.anchorOffset),s=yi(t,e.focusNode,e.focusOffset);if(!(a&&!a.bad&&s&&!s.bad&&G(Rr(a,s),r)==0&&G(rt(a,s),i)==0)){var o=t.display.view,l=r.line>=t.display.viewFrom&&Oo(t,r)||{node:o[0].measure.map[2],offset:0},u=i.line<t.display.viewTo&&Oo(t,i);if(!u){var d=o[o.length-1].measure,v=d.maps?d.maps[d.maps.length-1]:d.map;u={node:v[v.length-1],offset:v[v.length-2]-v[v.length-3]}}if(!l||!u){e.removeAllRanges();return}var w=e.rangeCount&&e.getRangeAt(0),m;try{m=Ke(l.node,l.offset,u.offset,u.node)}catch{}m&&(!T&&t.state.focused?(e.collapse(l.node,l.offset),m.collapsed||(e.removeAllRanges(),e.addRange(m))):(e.removeAllRanges(),e.addRange(m)),w&&e.anchorNode==null?e.addRange(w):T&&this.startGracePeriod()),this.rememberSelection()}},ge.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},ge.prototype.showMultipleSelections=function(e){$(this.cm.display.cursorDiv,e.cursors),$(this.cm.display.selectionDiv,e.selection)},ge.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},ge.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Re(this.div,t)},ge.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||_e(Pe(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},ge.prototype.blur=function(){this.div.blur()},ge.prototype.getField=function(){return this.div},ge.prototype.supportsTouch=function(){return!0},ge.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):ut(this.cm,function(){return t.cm.curOp.selectionChanged=!0});function n(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,n))}this.polling.set(this.cm.options.pollInterval,n)},ge.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},ge.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var e=this.getSelection(),t=this.cm;if(W&&N&&this.cm.display.gutterSpecs.length&&Wu(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var n=yi(t,e.anchorNode,e.anchorOffset),r=yi(t,e.focusNode,e.focusOffset);n&&r&&ut(t,function(){Xe(t.doc,sr(n,r),ht),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},ge.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=S(r.line-1,j(e.doc,r.line-1).length)),i.ch==j(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=S(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var a,s,o;r.line==t.viewFrom||(a=br(e,r.line))==0?(s=c(t.view[0].line),o=t.view[0].node):(s=c(t.view[a].line),o=t.view[a-1].node.nextSibling);var l=br(e,i.line),u,d;if(l==t.view.length-1?(u=t.viewTo-1,d=t.lineDiv.lastChild):(u=c(t.view[l+1].line)-1,d=t.view[l+1].node.previousSibling),!o)return!1;for(var v=e.doc.splitLines(Hu(e,o,d,s,u)),w=zt(e.doc,S(s,0),S(u,j(e.doc,u).text.length));v.length>1&&w.length>1;)if(he(v)==he(w))v.pop(),w.pop(),u--;else if(v[0]==w[0])v.shift(),w.shift(),s++;else break;for(var m=0,L=0,A=v[0],F=w[0],z=Math.min(A.length,F.length);m<z&&A.charCodeAt(m)==F.charCodeAt(m);)++m;for(var K=he(v),U=he(w),q=Math.min(K.length-(v.length==1?m:0),U.length-(w.length==1?m:0));L<q&&K.charCodeAt(K.length-L-1)==U.charCodeAt(U.length-L-1);)++L;if(v.length==1&&w.length==1&&s==r.line)for(;m&&m>r.ch&&K.charCodeAt(K.length-L-1)==U.charCodeAt(U.length-L-1);)m--,L++;v[v.length-1]=K.slice(0,K.length-L).replace(/^\u200b+/,""),v[0]=v[0].slice(m).replace(/\u200b+$/,"");var te=S(s,m),V=S(u,w.length?he(w).length-L:0);if(v.length>1||v[0]||G(te,V))return qr(e.doc,v,te,V,"+input"),!0},ge.prototype.ensurePolled=function(){this.forceCompositionEnd()},ge.prototype.reset=function(){this.forceCompositionEnd()},ge.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ge.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},ge.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&ut(this.cm,function(){return nt(e.cm)})},ge.prototype.setUneditable=function(e){e.contentEditable="false"},ge.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Fe(this.cm,ga)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},ge.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},ge.prototype.onContextMenu=function(){},ge.prototype.resetPosition=function(){},ge.prototype.needsContentAttribute=!0;function Oo(e,t){var n=Hi(e,t.line);if(!n||n.hidden)return null;var r=j(e.doc,t.line),i=ns(n,r,t.line),a=ce(r,e.doc.direction),s="left";if(a){var o=Zt(a,t.ch);s=o%2?"right":"left"}var l=ss(i.map,t.ch,s);return l.offset=l.collapse=="right"?l.end:l.start,l}function Wu(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Qr(e,t){return t&&(e.bad=!0),e}function Hu(e,t,n,r,i){var a="",s=!1,o=e.doc.lineSeparator(),l=!1;function u(m){return function(L){return L.id==m}}function d(){s&&(a+=o,l&&(a+=o),s=l=!1)}function v(m){m&&(d(),a+=m)}function w(m){if(m.nodeType==1){var L=m.getAttribute("cm-text");if(L){v(L);return}var A=m.getAttribute("cm-marker"),F;if(A){var z=e.findMarks(S(r,0),S(i+1,0),u(+A));z.length&&(F=z[0].find(0))&&v(zt(e.doc,F.from,F.to).join(o));return}if(m.getAttribute("contenteditable")=="false")return;var K=/^(pre|div|p|li|table|br)$/i.test(m.nodeName);if(!/^br$/i.test(m.nodeName)&&m.textContent.length==0)return;K&&d();for(var U=0;U<m.childNodes.length;U++)w(m.childNodes[U]);/^(pre|p)$/i.test(m.nodeName)&&(l=!0),K&&(s=!0)}else m.nodeType==3&&v(m.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;w(t),t!=n;)t=t.nextSibling,l=!1;return a}function yi(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Qr(e.clipPos(S(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var a=e.display.view[i];if(a.node==r)return Fu(a,t,n)}}function Fu(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!Re(r,t))return Qr(S(c(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var a=e.rest?he(e.rest):e.line;return Qr(S(c(a),a.text.length),i)}var s=t.nodeType==3?t:null,o=t;for(!s&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(s=t.firstChild,n&&(n=s.nodeValue.length));o.parentNode!=r;)o=o.parentNode;var l=e.measure,u=l.maps;function d(F,z,K){for(var U=-1;U<(u?u.length:0);U++)for(var q=U<0?l.map:u[U],te=0;te<q.length;te+=3){var V=q[te+2];if(V==F||V==z){var le=c(U<0?e.line:e.rest[U]),me=q[te]+K;return(K<0||V!=F)&&(me=q[te+(K?1:0)]),S(le,me)}}}var v=d(s,o,n);if(v)return Qr(v,i);for(var w=o.nextSibling,m=s?s.nodeValue.length-n:0;w;w=w.nextSibling){if(v=d(w,w.firstChild,0),v)return Qr(S(v.line,v.ch-m),i);m+=w.textContent.length}for(var L=o.previousSibling,A=n;L;L=L.previousSibling){if(v=d(L,L.firstChild,-1),v)return Qr(S(v.line,v.ch+A),i);A+=L.textContent.length}}var Le=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Dt,this.hasSelection=!1,this.composing=null,this.resetting=!1};Le.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),k&&(i.style.width="0px"),ee(i,"input",function(){_&&b>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),ee(i,"paste",function(s){Se(r,s)||ko(s,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())});function a(s){if(!Se(r,s)){if(r.somethingSelected())gi({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var o=Lo(r);gi({lineWise:!0,text:o.text}),s.type=="cut"?r.setSelections(o.ranges,null,ht):(n.prevInput="",i.value=o.text.join(`
20
- `),hr(i))}else return;s.type=="cut"&&(r.state.cutIncoming=+new Date)}}ee(i,"cut",a),ee(i,"copy",a),ee(e.scroller,"paste",function(s){if(!(Kt(e,s)||Se(r,s))){if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var o=new Event("paste");o.clipboardData=s.clipboardData,i.dispatchEvent(o)}}),ee(e.lineSpace,"selectstart",function(s){Kt(e,s)||qe(s)}),ee(i,"compositionstart",function(){var s=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:s,range:r.markText(s,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ee(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Le.prototype.createField=function(e){this.wrapper=_o(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;ya(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},Le.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Le.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=ys(e);if(e.options.moveInputWithCursor){var i=Tt(e,n.sel.primary().head,"div"),a=t.wrapper.getBoundingClientRect(),s=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+s.top-a.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+s.left-a.left))}return r},Le.prototype.showSelection=function(e){var t=this.cm,n=t.display;$(n.cursorDiv,e.cursors),$(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Le.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&hr(this.textarea),_&&b>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",_&&b>=9&&(this.hasSelection=null));this.resetting=!1}},Le.prototype.getField=function(){return this.textarea},Le.prototype.supportsTouch=function(){return!1},Le.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!X||_e(Pe(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},Le.prototype.blur=function(){this.textarea.blur()},Le.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Le.prototype.receivedFocus=function(){this.slowPoll()},Le.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Le.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Le.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||tr(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(_&&b>=9&&this.hasSelection===i||Z&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var a=i.charCodeAt(0);if(a==8203&&!r&&(r="​"),a==8666)return this.reset(),this.cm.execCommand("undo")}for(var s=0,o=Math.min(r.length,i.length);s<o&&r.charCodeAt(s)==i.charCodeAt(s);)++s;return ut(t,function(){ga(t,i.slice(s),r.length-s,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
21
- `)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Le.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Le.prototype.onKeyPress=function(){_&&b>=9&&(this.hasSelection=null),this.fastPoll()},Le.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var a=mr(n,e),s=r.scroller.scrollTop;if(!a||B)return;var o=n.options.resetSelectionOnContextMenu;o&&n.doc.sel.contains(a)==-1&&Fe(n,Xe)(n.doc,sr(a),ht);var l=i.style.cssText,u=t.wrapper.style.cssText,d=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
22
- top: `+(e.clientY-d.top-5)+"px; left: "+(e.clientX-d.left-5)+`px;
23
- z-index: 1000; background: `+(_?"rgba(255, 255, 255, .05)":"transparent")+`;
24
- outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var v;D&&(v=i.ownerDocument.defaultView.scrollY),r.input.focus(),D&&i.ownerDocument.defaultView.scrollTo(null,v),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=m,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function w(){if(i.selectionStart!=null){var A=n.somethingSelected(),F="​"+(A?i.value:"");i.value="⇚",i.value=F,t.prevInput=A?"":"​",i.selectionStart=1,i.selectionEnd=F.length,r.selForContextMenu=n.doc.sel}}function m(){if(t.contextMenuPending==m&&(t.contextMenuPending=!1,t.wrapper.style.cssText=u,i.style.cssText=l,_&&b<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=s),i.selectionStart!=null)){(!_||_&&b<9)&&w();var A=0,F=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="​"?Fe(n,Xs)(n):A++<10?r.detectingSelectAll=setTimeout(F,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(F,200)}}if(_&&b>=9&&w(),Ne){Vt(e);var L=function(){$e(window,"mouseup",L),setTimeout(m,20)};ee(window,"mouseup",L)}else setTimeout(m,50)},Le.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Le.prototype.setUneditable=function(){},Le.prototype.needsContentAttribute=!1;function Bu(e,t){if(t=t?ue(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=_e(Pe(e));t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=o.getValue()}var i;if(e.form&&(ee(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var a=e.form;i=a.submit;try{var s=a.submit=function(){r(),a.submit=i,a.submit(),a.submit=s}}catch{}}t.finishInit=function(l){l.save=r,l.getTextArea=function(){return e},l.toTextArea=function(){l.toTextArea=isNaN,r(),e.parentNode.removeChild(l.getWrapperElement()),e.style.display="",e.form&&($e(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var o=be(function(l){return e.parentNode.insertBefore(l,e.nextSibling)},t);return o}function zu(e){e.off=$e,e.on=ee,e.wheelEventPixels=Yl,e.Doc=it,e.splitLines=yt,e.countColumn=ve,e.findColumn=Mt,e.isWordChar=nn,e.Pass=jt,e.signal=Ce,e.Line=Er,e.changeEnd=or,e.scrollbarModel=Ss,e.Pos=S,e.cmpPos=G,e.modes=Or,e.mimeModes=Ct,e.resolveMode=Mr,e.getMode=Nr,e.modeExtensions=rr,e.extendMode=Ar,e.copyState=At,e.startState=Ir,e.innerMode=on,e.commands=Nn,e.keyMap=qt,e.keyName=uo,e.isModifierKey=oo,e.lookupKey=Yr,e.normalizeKeyMap=gu,e.StringStream=ke,e.SharedTextMarker=Dn,e.TextMarker=ur,e.LineWidget=_n,e.e_preventDefault=qe,e.e_stopPropagation=_r,e.e_stop=Vt,e.addClass=xe,e.contains=Re,e.rmClass=je,e.keyNames=fr}Au(be),Pu(be);var Uu="iter insert remove copy getEditor constructor".split(" ");for(var mi in it.prototype)it.prototype.hasOwnProperty(mi)&&oe(Uu,mi)<0&&(be.prototype[mi]=function(e){return function(){return e.apply(this.doc,arguments)}}(it.prototype[mi]));return bt(it),be.inputStyles={textarea:Le,contenteditable:ge},be.defineMode=function(e){!be.defaults.mode&&e!="null"&&(be.defaults.mode=e),St.apply(this,arguments)},be.defineMIME=vr,be.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),be.defineMIME("text/plain","null"),be.defineExtension=function(e,t){be.prototype[e]=t},be.defineDocExtension=function(e,t){it.prototype[e]=t},be.fromTextArea=Bu,zu(be),be.version="5.65.20",be})}(bi)),bi.exports}(function(y,f){(function(h){h(Yt())})(function(h){h.defineMode("javascript",function(P,T){var E=P.indentUnit,O=T.statementIndent,C=T.jsonld,_=T.json||C,b=T.trackScope!==!1,D=T.typescript,Q=T.wordCharacters||/[\w$\xa1-\uffff]/,N=function(){function c(We){return{type:We,style:"keyword"}}var p=c("keyword a"),M=c("keyword b"),H=c("keyword c"),S=c("keyword d"),G=c("operator"),de={type:"atom",style:"atom"};return{if:c("if"),while:p,with:p,else:M,do:M,try:M,finally:M,return:S,break:S,continue:S,new:c("new"),delete:H,void:H,throw:H,debugger:c("debugger"),var:c("var"),const:c("var"),let:c("var"),function:c("function"),catch:c("catch"),for:c("for"),switch:c("switch"),case:c("case"),default:c("default"),in:G,typeof:G,instanceof:G,true:de,false:de,null:de,undefined:de,NaN:de,Infinity:de,this:c("this"),class:c("class"),super:c("atom"),yield:H,export:c("export"),import:c("import"),extends:H,await:H}}(),Y=/[+\-*&%=<>!?|~^@]/,B=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function J(c){for(var p=!1,M,H=!1;(M=c.next())!=null;){if(!p){if(M=="/"&&!H)return;M=="["?H=!0:H&&M=="]"&&(H=!1)}p=!p&&M=="\\"}}var I,x;function k(c,p,M){return I=c,x=M,p}function W(c,p){var M=c.next();if(M=='"'||M=="'")return p.tokenize=X(M),p.tokenize(c,p);if(M=="."&&c.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return k("number","number");if(M=="."&&c.match(".."))return k("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(M))return k(M);if(M=="="&&c.eat(">"))return k("=>","operator");if(M=="0"&&c.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return k("number","number");if(/\d/.test(M))return c.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),k("number","number");if(M=="/")return c.eat("*")?(p.tokenize=Z,Z(c,p)):c.eat("/")?(c.skipToEnd(),k("comment","comment")):pt(c,p,1)?(J(c),c.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),k("regexp","string-2")):(c.eat("="),k("operator","operator",c.current()));if(M=="`")return p.tokenize=ie,ie(c,p);if(M=="#"&&c.peek()=="!")return c.skipToEnd(),k("meta","meta");if(M=="#"&&c.eatWhile(Q))return k("variable","property");if(M=="<"&&c.match("!--")||M=="-"&&c.match("->")&&!/\S/.test(c.string.slice(0,c.start)))return c.skipToEnd(),k("comment","comment");if(Y.test(M))return(M!=">"||!p.lexical||p.lexical.type!=">")&&(c.eat("=")?(M=="!"||M=="=")&&c.eat("="):/[<>*+\-|&?]/.test(M)&&(c.eat(M),M==">"&&c.eat(M))),M=="?"&&c.eat(".")?k("."):k("operator","operator",c.current());if(Q.test(M)){c.eatWhile(Q);var H=c.current();if(p.lastType!="."){if(N.propertyIsEnumerable(H)){var S=N[H];return k(S.type,S.style,H)}if(H=="async"&&c.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return k("async","keyword",H)}return k("variable","variable",H)}}function X(c){return function(p,M){var H=!1,S;if(C&&p.peek()=="@"&&p.match(B))return M.tokenize=W,k("jsonld-keyword","meta");for(;(S=p.next())!=null&&!(S==c&&!H);)H=!H&&S=="\\";return H||(M.tokenize=W),k("string","string")}}function Z(c,p){for(var M=!1,H;H=c.next();){if(H=="/"&&M){p.tokenize=W;break}M=H=="*"}return k("comment","comment")}function ie(c,p){for(var M=!1,H;(H=c.next())!=null;){if(!M&&(H=="`"||H=="$"&&c.eat("{"))){p.tokenize=W;break}M=!M&&H=="\\"}return k("quasi","string-2",c.current())}var se="([{}])";function fe(c,p){p.fatArrowAt&&(p.fatArrowAt=null);var M=c.string.indexOf("=>",c.start);if(!(M<0)){if(D){var H=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(c.string.slice(c.start,M));H&&(M=H.index)}for(var S=0,G=!1,de=M-1;de>=0;--de){var We=c.string.charAt(de),rt=se.indexOf(We);if(rt>=0&&rt<3){if(!S){++de;break}if(--S==0){We=="("&&(G=!0);break}}else if(rt>=3&&rt<6)++S;else if(Q.test(We))G=!0;else if(/["'\/`]/.test(We))for(;;--de){if(de==0)return;var Rr=c.string.charAt(de-1);if(Rr==We&&c.string.charAt(de-2)!="\\"){de--;break}}else if(G&&!S){++de;break}}G&&!S&&(p.fatArrowAt=de)}}var Ie={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function Ne(c,p,M,H,S,G){this.indented=c,this.column=p,this.type=M,this.prev=S,this.info=G,H!=null&&(this.align=H)}function ye(c,p){if(!b)return!1;for(var M=c.localVars;M;M=M.next)if(M.name==p)return!0;for(var H=c.context;H;H=H.prev)for(var M=H.vars;M;M=M.next)if(M.name==p)return!0}function je(c,p,M,H,S){var G=c.cc;for(R.state=c,R.stream=S,R.marked=null,R.cc=G,R.style=p,c.lexical.hasOwnProperty("align")||(c.lexical.align=!0);;){var de=G.length?G.pop():_?oe:ve;if(de(M,H)){for(;G.length&&G[G.length-1].lex;)G.pop()();return R.marked?R.marked:M=="variable"&&ye(c,H)?"variable-2":p}}}var R={state:null,marked:null,cc:null};function $(){for(var c=arguments.length-1;c>=0;c--)R.cc.push(arguments[c])}function g(){return $.apply(null,arguments),!0}function Je(c,p){for(var M=p;M;M=M.next)if(M.name==c)return!0;return!1}function Ke(c){var p=R.state;if(R.marked="def",!!b){if(p.context){if(p.lexical.info=="var"&&p.context&&p.context.block){var M=Re(c,p.context);if(M!=null){p.context=M;return}}else if(!Je(c,p.localVars)){p.localVars=new Ee(c,p.localVars);return}}T.globalVars&&!Je(c,p.globalVars)&&(p.globalVars=new Ee(c,p.globalVars))}}function Re(c,p){if(p)if(p.block){var M=Re(c,p.prev);return M?M==p.prev?p:new xe(M,p.vars,!0):null}else return Je(c,p.vars)?p:new xe(p.prev,new Ee(c,p.vars),!1);else return null}function _e(c){return c=="public"||c=="private"||c=="protected"||c=="abstract"||c=="readonly"}function xe(c,p,M){this.prev=c,this.vars=p,this.block=M}function Ee(c,p){this.name=c,this.next=p}var hr=new Ee("this",new Ee("arguments",null));function ct(){R.state.context=new xe(R.state.context,R.state.localVars,!1),R.state.localVars=hr}function mt(){R.state.context=new xe(R.state.context,R.state.localVars,!0),R.state.localVars=null}ct.lex=mt.lex=!0;function Pe(){R.state.localVars=R.state.context.vars,R.state.context=R.state.context.prev}Pe.lex=!0;function ae(c,p){var M=function(){var H=R.state,S=H.indented;if(H.lexical.type=="stat")S=H.lexical.indented;else for(var G=H.lexical;G&&G.type==")"&&G.align;G=G.prev)S=G.indented;H.lexical=new Ne(S,R.stream.column(),c,null,H.lexical,p)};return M.lex=!0,M}function re(){var c=R.state;c.lexical.prev&&(c.lexical.type==")"&&(c.indented=c.lexical.indented),c.lexical=c.lexical.prev)}re.lex=!0;function ue(c){function p(M){return M==c?g():c==";"||M=="}"||M==")"||M=="]"?$():g(p)}return p}function ve(c,p){return c=="var"?g(ae("vardef",p),_r,ue(";"),re):c=="keyword a"?g(ae("form"),jt,ve,re):c=="keyword b"?g(ae("form"),ve,re):c=="keyword d"?R.stream.match(/^\s*$/,!1)?g():g(ae("stat"),Ot,ue(";"),re):c=="debugger"?g(ue(";")):c=="{"?g(ae("}"),mt,Nt,re,Pe):c==";"?g():c=="if"?(R.state.lexical.info=="else"&&R.state.cc[R.state.cc.length-1]==re&&R.state.cc.pop()(),g(ae("form"),jt,ve,re,Dr)):c=="function"?g(yt):c=="for"?g(ae("form"),mt,zn,ve,Pe,re):c=="class"||D&&p=="interface"?(R.marked="keyword",g(ae("form",c=="class"?c:p),Or,re)):c=="variable"?D&&p=="declare"?(R.marked="keyword",g(ve)):D&&(p=="module"||p=="enum"||p=="type")&&R.stream.match(/^\s*\w/,!1)?(R.marked="keyword",p=="enum"?g(j):p=="type"?g(Un,ue("operator"),ce,ue(";")):g(ae("form"),tt,ue("{"),ae("}"),Nt,re,re)):D&&p=="namespace"?(R.marked="keyword",g(ae("form"),oe,ve,re)):D&&p=="abstract"?(R.marked="keyword",g(ve)):g(ae("stat"),ki):c=="switch"?g(ae("form"),jt,ue("{"),ae("}","switch"),mt,Nt,re,re,Pe):c=="case"?g(oe,ue(":")):c=="default"?g(ue(":")):c=="catch"?g(ae("form"),ct,Dt,ve,re,Pe):c=="export"?g(ae("stat"),Mr,re):c=="import"?g(ae("stat"),rr,re):c=="async"?g(ve):p=="@"?g(oe,ve):$(ae("stat"),oe,ue(";"),re)}function Dt(c){if(c=="(")return g(xt,ue(")"))}function oe(c,p){return ht(c,p,!1)}function Qe(c,p){return ht(c,p,!0)}function jt(c){return c!="("?$():g(ae(")"),Ot,ue(")"),re)}function ht(c,p,M){if(R.state.fatArrowAt==R.stream.start){var H=M?dr:he;if(c=="(")return g(ct,ae(")"),De(xt,")"),re,ue("=>"),H,Pe);if(c=="variable")return $(ct,tt,ue("=>"),H,Pe)}var S=M?Mt:dt;return Ie.hasOwnProperty(c)?g(S):c=="function"?g(yt,S):c=="class"||D&&p=="interface"?(R.marked="keyword",g(ae("form"),_i,re)):c=="keyword c"||c=="async"?g(M?Qe:oe):c=="("?g(ae(")"),Ot,ue(")"),re,S):c=="operator"||c=="spread"?g(M?Qe:oe):c=="["?g(ae("]"),ke,re,S):c=="{"?Jt(Ht,"}",null,S):c=="quasi"?$(Wt,S):c=="new"?g(Si(M)):g()}function Ot(c){return c.match(/[;\}\)\],]/)?$():$(oe)}function dt(c,p){return c==","?g(Ot):Mt(c,p,!1)}function Mt(c,p,M){var H=M==!1?dt:Mt,S=M==!1?oe:Qe;if(c=="=>")return g(ct,M?dr:he,Pe);if(c=="operator")return/\+\+|--/.test(p)||D&&p=="!"?g(H):D&&p=="<"&&R.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?g(ae(">"),De(ce,">"),re,H):p=="?"?g(oe,ue(":"),S):g(S);if(c=="quasi")return $(Wt,H);if(c!=";"){if(c=="(")return Jt(Qe,")","call",H);if(c==".")return g(nn,H);if(c=="[")return g(ae("]"),Ot,ue("]"),re,H);if(D&&p=="as")return R.marked="keyword",g(ce,H);if(c=="regexp")return R.state.lastType=R.marked="operator",R.stream.backUp(R.stream.pos-R.stream.start-1),g(S)}}function Wt(c,p){return c!="quasi"?$():p.slice(p.length-2)!="${"?g(Wt):g(Ot,rn)}function rn(c){if(c=="}")return R.marked="string-2",R.state.tokenize=ie,g(Wt)}function he(c){return fe(R.stream,R.state),$(c=="{"?ve:oe)}function dr(c){return fe(R.stream,R.state),$(c=="{"?ve:Qe)}function Si(c){return function(p){return p=="."?g(c?Hn:Wn):p=="variable"&&D?g(lt,c?Mt:dt):$(c?Qe:oe)}}function Wn(c,p){if(p=="target")return R.marked="keyword",g(dt)}function Hn(c,p){if(p=="target")return R.marked="keyword",g(Mt)}function ki(c){return c==":"?g(re,ve):$(dt,ue(";"),re)}function nn(c){if(c=="variable")return R.marked="property",g()}function Ht(c,p){if(c=="async")return R.marked="property",g(Ht);if(c=="variable"||R.style=="keyword"){if(R.marked="property",p=="get"||p=="set")return g(Fn);var M;return D&&R.state.fatArrowAt==R.stream.start&&(M=R.stream.match(/^\s*:\s*/,!1))&&(R.state.fatArrowAt=R.stream.pos+M[0].length),g(Ft)}else{if(c=="number"||c=="string")return R.marked=C?"property":R.style+" property",g(Ft);if(c=="jsonld-keyword")return g(Ft);if(D&&_e(p))return R.marked="keyword",g(Ht);if(c=="[")return g(oe,Qt,ue("]"),Ft);if(c=="spread")return g(Qe,Ft);if(p=="*")return R.marked="keyword",g(Ht);if(c==":")return $(Ft)}}function Fn(c){return c!="variable"?$(Ft):(R.marked="property",g(yt))}function Ft(c){if(c==":")return g(Qe);if(c=="(")return $(yt)}function De(c,p,M){function H(S,G){if(M?M.indexOf(S)>-1:S==","){var de=R.state.lexical;return de.info=="call"&&(de.pos=(de.pos||0)+1),g(function(We,rt){return We==p||rt==p?$():$(c)},H)}return S==p||G==p?g():M&&M.indexOf(";")>-1?$(c):g(ue(p))}return function(S,G){return S==p||G==p?g():$(c,H)}}function Jt(c,p,M){for(var H=3;H<arguments.length;H++)R.cc.push(arguments[H]);return g(ae(p,M),De(c,p),re)}function Nt(c){return c=="}"?g():$(ve,Nt)}function Qt(c,p){if(D){if(c==":")return g(ce);if(p=="?")return g(Qt)}}function pr(c,p){if(D&&(c==":"||p=="in"))return g(ce)}function Zt(c){if(D&&c==":")return R.stream.match(/^\s*\w+\s+is\b/,!1)?g(oe,Ti,ce):g(ce)}function Ti(c,p){if(p=="is")return R.marked="keyword",g()}function ce(c,p){if(p=="keyof"||p=="typeof"||p=="infer"||p=="readonly")return R.marked="keyword",g(p=="typeof"?Qe:ce);if(c=="variable"||p=="void")return R.marked="type",g(gt);if(p=="|"||p=="&")return g(ce);if(c=="string"||c=="number"||c=="atom")return g(gt);if(c=="[")return g(ae("]"),De(ce,"]",","),re,gt);if(c=="{")return g(ae("}"),ee,re,gt);if(c=="(")return g(De(Se,")"),Bn,gt);if(c=="<")return g(De(ce,">"),ce);if(c=="quasi")return $($e,gt)}function Bn(c){if(c=="=>")return g(ce)}function ee(c){return c.match(/[\}\)\]]/)?g():c==","||c==";"?g(ee):$(Bt,ee)}function Bt(c,p){if(c=="variable"||R.style=="keyword")return R.marked="property",g(Bt);if(p=="?"||c=="number"||c=="string")return g(Bt);if(c==":")return g(ce);if(c=="[")return g(ue("variable"),pr,ue("]"),Bt);if(c=="(")return $(tr,Bt);if(!c.match(/[;\}\)\],]/))return g()}function $e(c,p){return c!="quasi"?$():p.slice(p.length-2)!="${"?g($e):g(ce,Ce)}function Ce(c){if(c=="}")return R.marked="string-2",R.state.tokenize=ie,g($e)}function Se(c,p){return c=="variable"&&R.stream.match(/^\s*[?:]/,!1)||p=="?"?g(Se):c==":"?g(ce):c=="spread"?g(Se):$(ce)}function gt(c,p){if(p=="<")return g(ae(">"),De(ce,">"),re,gt);if(p=="|"||c=="."||p=="&")return g(ce);if(c=="[")return g(ce,ue("]"),gt);if(p=="extends"||p=="implements")return R.marked="keyword",g(ce);if(p=="?")return g(ce,ue(":"),ce)}function lt(c,p){if(p=="<")return g(ae(">"),De(ce,">"),re,gt)}function bt(){return $(ce,qe)}function qe(c,p){if(p=="=")return g(ce)}function _r(c,p){return p=="enum"?(R.marked="keyword",g(j)):$(tt,Qt,wt,Li)}function tt(c,p){if(D&&_e(p))return R.marked="keyword",g(tt);if(c=="variable")return Ke(p),g();if(c=="spread")return g(tt);if(c=="[")return Jt(an,"]");if(c=="{")return Jt(Vt,"}")}function Vt(c,p){return c=="variable"&&!R.stream.match(/^\s*:/,!1)?(Ke(p),g(wt)):(c=="variable"&&(R.marked="property"),c=="spread"?g(tt):c=="}"?$():c=="["?g(oe,ue("]"),ue(":"),Vt):g(ue(":"),tt,wt))}function an(){return $(tt,wt)}function wt(c,p){if(p=="=")return g(Qe)}function Li(c){if(c==",")return g(_r)}function Dr(c,p){if(c=="keyword b"&&p=="else")return g(ae("form","else"),ve,re)}function zn(c,p){if(p=="await")return g(zn);if(c=="(")return g(ae(")"),sn,re)}function sn(c){return c=="var"?g(_r,er):c=="variable"?g(er):$(er)}function er(c,p){return c==")"?g():c==";"?g(er):p=="in"||p=="of"?(R.marked="keyword",g(oe,er)):$(oe,er)}function yt(c,p){if(p=="*")return R.marked="keyword",g(yt);if(c=="variable")return Ke(p),g(yt);if(c=="(")return g(ct,ae(")"),De(xt,")"),re,Zt,ve,Pe);if(D&&p=="<")return g(ae(">"),De(bt,">"),re,yt)}function tr(c,p){if(p=="*")return R.marked="keyword",g(tr);if(c=="variable")return Ke(p),g(tr);if(c=="(")return g(ct,ae(")"),De(xt,")"),re,Zt,Pe);if(D&&p=="<")return g(ae(">"),De(bt,">"),re,tr)}function Un(c,p){if(c=="keyword"||c=="variable")return R.marked="type",g(Un);if(p=="<")return g(ae(">"),De(bt,">"),re)}function xt(c,p){return p=="@"&&g(oe,xt),c=="spread"?g(xt):D&&_e(p)?(R.marked="keyword",g(xt)):D&&c=="this"?g(Qt,wt):$(tt,Qt,wt)}function _i(c,p){return c=="variable"?Or(c,p):Ct(c,p)}function Or(c,p){if(c=="variable")return Ke(p),g(Ct)}function Ct(c,p){if(p=="<")return g(ae(">"),De(bt,">"),re,Ct);if(p=="extends"||p=="implements"||D&&c==",")return p=="implements"&&(R.marked="keyword"),g(D?ce:oe,Ct);if(c=="{")return g(ae("}"),St,re)}function St(c,p){if(c=="async"||c=="variable"&&(p=="static"||p=="get"||p=="set"||D&&_e(p))&&R.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return R.marked="keyword",g(St);if(c=="variable"||R.style=="keyword")return R.marked="property",g(vr,St);if(c=="number"||c=="string")return g(vr,St);if(c=="[")return g(oe,Qt,ue("]"),vr,St);if(p=="*")return R.marked="keyword",g(St);if(D&&c=="(")return $(tr,St);if(c==";"||c==",")return g(St);if(c=="}")return g();if(p=="@")return g(oe,St)}function vr(c,p){if(p=="!"||p=="?")return g(vr);if(c==":")return g(ce,wt);if(p=="=")return g(Qe);var M=R.state.lexical.prev,H=M&&M.info=="interface";return $(H?tr:yt)}function Mr(c,p){return p=="*"?(R.marked="keyword",g(Ir,ue(";"))):p=="default"?(R.marked="keyword",g(oe,ue(";"))):c=="{"?g(De(Nr,"}"),Ir,ue(";")):$(ve)}function Nr(c,p){if(p=="as")return R.marked="keyword",g(ue("variable"));if(c=="variable")return $(Qe,Nr)}function rr(c){return c=="string"?g():c=="("?$(oe):c=="."?$(dt):$(Ar,At,Ir)}function Ar(c,p){return c=="{"?Jt(Ar,"}"):(c=="variable"&&Ke(p),p=="*"&&(R.marked="keyword"),g(on))}function At(c){if(c==",")return g(Ar,At)}function on(c,p){if(p=="as")return R.marked="keyword",g(Ar)}function Ir(c,p){if(p=="from")return R.marked="keyword",g(oe)}function ke(c){return c=="]"?g():$(De(Qe,"]"))}function j(){return $(ae("form"),tt,ue("{"),ae("}"),De(zt,"}"),re,re)}function zt(){return $(tt,wt)}function ln(c,p){return c.lastType=="operator"||c.lastType==","||Y.test(p.charAt(0))||/[,.]/.test(p.charAt(0))}function pt(c,p,M){return p.tokenize==W&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(p.lastType)||p.lastType=="quasi"&&/\{\s*$/.test(c.string.slice(0,c.pos-(M||0)))}return{startState:function(c){var p={tokenize:W,lastType:"sof",cc:[],lexical:new Ne((c||0)-E,0,"block",!1),localVars:T.localVars,context:T.localVars&&new xe(null,null,!1),indented:c||0};return T.globalVars&&typeof T.globalVars=="object"&&(p.globalVars=T.globalVars),p},token:function(c,p){if(c.sol()&&(p.lexical.hasOwnProperty("align")||(p.lexical.align=!1),p.indented=c.indentation(),fe(c,p)),p.tokenize!=Z&&c.eatSpace())return null;var M=p.tokenize(c,p);return I=="comment"?M:(p.lastType=I=="operator"&&(x=="++"||x=="--")?"incdec":I,je(p,M,I,x,c))},indent:function(c,p){if(c.tokenize==Z||c.tokenize==ie)return h.Pass;if(c.tokenize!=W)return 0;var M=p&&p.charAt(0),H=c.lexical,S;if(!/^\s*else\b/.test(p))for(var G=c.cc.length-1;G>=0;--G){var de=c.cc[G];if(de==re)H=H.prev;else if(de!=Dr&&de!=Pe)break}for(;(H.type=="stat"||H.type=="form")&&(M=="}"||(S=c.cc[c.cc.length-1])&&(S==dt||S==Mt)&&!/^[,\.=+\-*:?[\(]/.test(p));)H=H.prev;O&&H.type==")"&&H.prev.type=="stat"&&(H=H.prev);var We=H.type,rt=M==We;return We=="vardef"?H.indented+(c.lastType=="operator"||c.lastType==","?H.info.length+1:0):We=="form"&&M=="{"?H.indented:We=="form"?H.indented+E:We=="stat"?H.indented+(ln(c,p)?O||E:0):H.info=="switch"&&!rt&&T.doubleIndentSwitch!=!1?H.indented+(/^(?:case|default)\b/.test(p)?E:2*E):H.align?H.column+(rt?0:1):H.indented+(rt?0:E)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:_?null:"/*",blockCommentEnd:_?null:"*/",blockCommentContinue:_?null:" * ",lineComment:_?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:_?"json":"javascript",jsonldMode:C,jsonMode:_,expressionAllowed:pt,skipExpression:function(c){je(c,"atom","atom","true",new h.StringStream("",2,null))}}}),h.registerHelper("wordChars","javascript",/[\w$]/),h.defineMIME("text/javascript","javascript"),h.defineMIME("text/ecmascript","javascript"),h.defineMIME("application/javascript","javascript"),h.defineMIME("application/x-javascript","javascript"),h.defineMIME("application/ecmascript","javascript"),h.defineMIME("application/json",{name:"javascript",json:!0}),h.defineMIME("application/x-json",{name:"javascript",json:!0}),h.defineMIME("application/manifest+json",{name:"javascript",json:!0}),h.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),h.defineMIME("text/typescript",{name:"javascript",typescript:!0}),h.defineMIME("application/typescript",{name:"javascript",typescript:!0})})})(),function(y,f){(function(h){h(Yt())})(function(h){var P={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},T=h.Pos;h.defineOption("autoCloseBrackets",!1,function(x,k,W){W&&W!=h.Init&&(x.removeKeyMap(O),x.state.closeBrackets=null),k&&(C(E(k,"pairs")),x.state.closeBrackets=k,x.addKeyMap(O))});function E(x,k){return k=="pairs"&&typeof x=="string"?x:typeof x=="object"&&x[k]!=null?x[k]:P[k]}var O={Backspace:D,Enter:Q};function C(x){for(var k=0;k<x.length;k++){var W=x.charAt(k),X="'"+W+"'";O[X]||(O[X]=_(W))}}C(P.pairs+"`");function _(x){return function(k){return B(k,x)}}function b(x){var k=x.state.closeBrackets;if(!k||k.override)return k;var W=x.getModeAt(x.getCursor());return W.closeBrackets||k}function D(x){var k=b(x);if(!k||x.getOption("disableInput"))return h.Pass;for(var W=E(k,"pairs"),X=x.listSelections(),Z=0;Z<X.length;Z++){if(!X[Z].empty())return h.Pass;var ie=J(x,X[Z].head);if(!ie||W.indexOf(ie)%2!=0)return h.Pass}for(var Z=X.length-1;Z>=0;Z--){var se=X[Z].head;x.replaceRange("",T(se.line,se.ch-1),T(se.line,se.ch+1),"+delete")}}function Q(x){var k=b(x),W=k&&E(k,"explode");if(!W||x.getOption("disableInput"))return h.Pass;for(var X=x.listSelections(),Z=0;Z<X.length;Z++){if(!X[Z].empty())return h.Pass;var ie=J(x,X[Z].head);if(!ie||W.indexOf(ie)%2!=0)return h.Pass}x.operation(function(){var se=x.lineSeparator()||`
25
- `;x.replaceSelection(se+se,null),N(x,-1),X=x.listSelections();for(var fe=0;fe<X.length;fe++){var Ie=X[fe].head.line;x.indentLine(Ie,null,!0),x.indentLine(Ie+1,null,!0)}})}function N(x,k){for(var W=[],X=x.listSelections(),Z=0,ie=0;ie<X.length;ie++){var se=X[ie];se.head==x.getCursor()&&(Z=ie);var fe=se.head.ch||k>0?{line:se.head.line,ch:se.head.ch+k}:{line:se.head.line-1};W.push({anchor:fe,head:fe})}x.setSelections(W,Z)}function Y(x){var k=h.cmpPos(x.anchor,x.head)>0;return{anchor:new T(x.anchor.line,x.anchor.ch+(k?-1:1)),head:new T(x.head.line,x.head.ch+(k?1:-1))}}function B(x,k){var W=b(x);if(!W||x.getOption("disableInput"))return h.Pass;var X=E(W,"pairs"),Z=X.indexOf(k);if(Z==-1)return h.Pass;for(var ie=E(W,"closeBefore"),se=E(W,"triples"),fe=X.charAt(Z+1)==k,Ie=x.listSelections(),Ne=Z%2==0,ye,je=0;je<Ie.length;je++){var R=Ie[je],$=R.head,g,Je=x.getRange($,T($.line,$.ch+1));if(Ne&&!R.empty())g="surround";else if((fe||!Ne)&&Je==k)fe&&I(x,$)?g="both":se.indexOf(k)>=0&&x.getRange($,T($.line,$.ch+3))==k+k+k?g="skipThree":g="skip";else if(fe&&$.ch>1&&se.indexOf(k)>=0&&x.getRange(T($.line,$.ch-2),$)==k+k){if($.ch>2&&/\bstring/.test(x.getTokenTypeAt(T($.line,$.ch-2))))return h.Pass;g="addFour"}else if(fe){var Ke=$.ch==0?" ":x.getRange(T($.line,$.ch-1),$);if(!h.isWordChar(Je)&&Ke!=k&&!h.isWordChar(Ke))g="both";else return h.Pass}else if(Ne&&(Je.length===0||/\s/.test(Je)||ie.indexOf(Je)>-1))g="both";else return h.Pass;if(!ye)ye=g;else if(ye!=g)return h.Pass}var Re=Z%2?X.charAt(Z-1):k,_e=Z%2?k:X.charAt(Z+1);x.operation(function(){if(ye=="skip")N(x,1);else if(ye=="skipThree")N(x,3);else if(ye=="surround"){for(var xe=x.getSelections(),Ee=0;Ee<xe.length;Ee++)xe[Ee]=Re+xe[Ee]+_e;x.replaceSelections(xe,"around"),xe=x.listSelections().slice();for(var Ee=0;Ee<xe.length;Ee++)xe[Ee]=Y(xe[Ee]);x.setSelections(xe)}else ye=="both"?(x.replaceSelection(Re+_e,null),x.triggerElectric(Re+_e),N(x,-1)):ye=="addFour"&&(x.replaceSelection(Re+Re+Re+Re,"before"),N(x,1))})}function J(x,k){var W=x.getRange(T(k.line,k.ch-1),T(k.line,k.ch+1));return W.length==2?W:null}function I(x,k){var W=x.getTokenAt(T(k.line,k.ch+1));return/\bstring/.test(W.type)&&W.start==k.ch&&(k.ch==0||!/\bstring/.test(x.getTokenTypeAt(k)))}})}(),function(y,f){(function(h){h(Yt())})(function(h){var P=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),T=h.Pos,E={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function O(N){return N&&N.bracketRegex||/[(){}[\]]/}function C(N,Y,B){var J=N.getLineHandle(Y.line),I=Y.ch-1,x=B&&B.afterCursor;x==null&&(x=/(^| )cm-fat-cursor($| )/.test(N.getWrapperElement().className));var k=O(B),W=!x&&I>=0&&k.test(J.text.charAt(I))&&E[J.text.charAt(I)]||k.test(J.text.charAt(I+1))&&E[J.text.charAt(++I)];if(!W)return null;var X=W.charAt(1)==">"?1:-1;if(B&&B.strict&&X>0!=(I==Y.ch))return null;var Z=N.getTokenTypeAt(T(Y.line,I+1)),ie=_(N,T(Y.line,I+(X>0?1:0)),X,Z,B);return ie==null?null:{from:T(Y.line,I),to:ie&&ie.pos,match:ie&&ie.ch==W.charAt(0),forward:X>0}}function _(N,Y,B,J,I){for(var x=I&&I.maxScanLineLength||1e4,k=I&&I.maxScanLines||1e3,W=[],X=O(I),Z=B>0?Math.min(Y.line+k,N.lastLine()+1):Math.max(N.firstLine()-1,Y.line-k),ie=Y.line;ie!=Z;ie+=B){var se=N.getLine(ie);if(se){var fe=B>0?0:se.length-1,Ie=B>0?se.length:-1;if(!(se.length>x))for(ie==Y.line&&(fe=Y.ch-(B<0?1:0));fe!=Ie;fe+=B){var Ne=se.charAt(fe);if(X.test(Ne)&&(J===void 0||(N.getTokenTypeAt(T(ie,fe+1))||"")==(J||""))){var ye=E[Ne];if(ye&&ye.charAt(1)==">"==B>0)W.push(Ne);else if(W.length)W.pop();else return{pos:T(ie,fe),ch:Ne}}}}}return ie-B==(B>0?N.lastLine():N.firstLine())?!1:null}function b(N,Y,B){for(var J=N.state.matchBrackets.maxHighlightLineLength||1e3,I=B&&B.highlightNonMatching,x=[],k=N.listSelections(),W=0;W<k.length;W++){var X=k[W].empty()&&C(N,k[W].head,B);if(X&&(X.match||I!==!1)&&N.getLine(X.from.line).length<=J){var Z=X.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";x.push(N.markText(X.from,T(X.from.line,X.from.ch+1),{className:Z})),X.to&&N.getLine(X.to.line).length<=J&&x.push(N.markText(X.to,T(X.to.line,X.to.ch+1),{className:Z}))}}if(x.length){P&&N.state.focused&&N.focus();var ie=function(){N.operation(function(){for(var se=0;se<x.length;se++)x[se].clear()})};if(Y)setTimeout(ie,800);else return ie}}function D(N){N.operation(function(){N.state.matchBrackets.currentlyHighlighted&&(N.state.matchBrackets.currentlyHighlighted(),N.state.matchBrackets.currentlyHighlighted=null),N.state.matchBrackets.currentlyHighlighted=b(N,!1,N.state.matchBrackets)})}function Q(N){N.state.matchBrackets&&N.state.matchBrackets.currentlyHighlighted&&(N.state.matchBrackets.currentlyHighlighted(),N.state.matchBrackets.currentlyHighlighted=null)}h.defineOption("matchBrackets",!1,function(N,Y,B){B&&B!=h.Init&&(N.off("cursorActivity",D),N.off("focus",D),N.off("blur",Q),Q(N)),Y&&(N.state.matchBrackets=typeof Y=="object"?Y:{},N.on("cursorActivity",D),N.on("focus",D),N.on("blur",Q))}),h.defineExtension("matchBrackets",function(){b(this,!0)}),h.defineExtension("findMatchingBracket",function(N,Y,B){return(B||typeof Y=="boolean")&&(B?(B.strict=Y,Y=B):Y=Y?{strict:!0}:null),C(this,N,Y)}),h.defineExtension("scanForBracket",function(N,Y,B,J){return _(this,N,Y,B,J)})})}();var No={exports:{}};(function(y,f){(function(h){h(Yt())})(function(h){function P(C,_,b,D){if(b&&b.call){var Q=b;b=null}else var Q=O(C,b,"rangeFinder");typeof _=="number"&&(_=h.Pos(_,0));var N=O(C,b,"minFoldSize");function Y(x){var k=Q(C,_);if(!k||k.to.line-k.from.line<N)return null;if(D==="fold")return k;for(var W=C.findMarksAt(k.from),X=0;X<W.length;++X)if(W[X].__isFold){if(!x)return null;k.cleared=!0,W[X].clear()}return k}var B=Y(!0);if(O(C,b,"scanUp"))for(;!B&&_.line>C.firstLine();)_=h.Pos(_.line-1,0),B=Y(!1);if(!(!B||B.cleared||D==="unfold")){var J=T(C,b,B);h.on(J,"mousedown",function(x){I.clear(),h.e_preventDefault(x)});var I=C.markText(B.from,B.to,{replacedWith:J,clearOnEnter:O(C,b,"clearOnEnter"),__isFold:!0});I.on("clear",function(x,k){h.signal(C,"unfold",C,x,k)}),h.signal(C,"fold",C,B.from,B.to)}}function T(C,_,b){var D=O(C,_,"widget");if(typeof D=="function"&&(D=D(b.from,b.to)),typeof D=="string"){var Q=document.createTextNode(D);D=document.createElement("span"),D.appendChild(Q),D.className="CodeMirror-foldmarker"}else D&&(D=D.cloneNode(!0));return D}h.newFoldFunction=function(C,_){return function(b,D){P(b,D,{rangeFinder:C,widget:_})}},h.defineExtension("foldCode",function(C,_,b){P(this,C,_,b)}),h.defineExtension("isFolded",function(C){for(var _=this.findMarksAt(C),b=0;b<_.length;++b)if(_[b].__isFold)return!0}),h.commands.toggleFold=function(C){C.foldCode(C.getCursor())},h.commands.fold=function(C){C.foldCode(C.getCursor(),null,"fold")},h.commands.unfold=function(C){C.foldCode(C.getCursor(),{scanUp:!1},"unfold")},h.commands.foldAll=function(C){C.operation(function(){for(var _=C.firstLine(),b=C.lastLine();_<=b;_++)C.foldCode(h.Pos(_,0),{scanUp:!1},"fold")})},h.commands.unfoldAll=function(C){C.operation(function(){for(var _=C.firstLine(),b=C.lastLine();_<=b;_++)C.foldCode(h.Pos(_,0),{scanUp:!1},"unfold")})},h.registerHelper("fold","combine",function(){var C=Array.prototype.slice.call(arguments,0);return function(_,b){for(var D=0;D<C.length;++D){var Q=C[D](_,b);if(Q)return Q}}}),h.registerHelper("fold","auto",function(C,_){for(var b=C.getHelpers(_,"fold"),D=0;D<b.length;D++){var Q=b[D](C,_);if(Q)return Q}});var E={rangeFinder:h.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};h.defineOption("foldOptions",null);function O(C,_,b){if(_&&_[b]!==void 0)return _[b];var D=C.options.foldOptions;return D&&D[b]!==void 0?D[b]:E[b]}h.defineExtension("foldOption",function(C,_){return O(this,C,_)})})})();var Ao=No.exports;(function(y,f){(function(h){h(Yt(),Ao)})(function(h){h.defineOption("foldGutter",!1,function(I,x,k){k&&k!=h.Init&&(I.clearGutter(I.state.foldGutter.options.gutter),I.state.foldGutter=null,I.off("gutterClick",Q),I.off("changes",Y),I.off("viewportChange",B),I.off("fold",J),I.off("unfold",J),I.off("swapDoc",Y),I.off("optionChange",N)),x&&(I.state.foldGutter=new T(E(x)),D(I),I.on("gutterClick",Q),I.on("changes",Y),I.on("viewportChange",B),I.on("fold",J),I.on("unfold",J),I.on("swapDoc",Y),I.on("optionChange",N))});var P=h.Pos;function T(I){this.options=I,this.from=this.to=0}function E(I){return I===!0&&(I={}),I.gutter==null&&(I.gutter="CodeMirror-foldgutter"),I.indicatorOpen==null&&(I.indicatorOpen="CodeMirror-foldgutter-open"),I.indicatorFolded==null&&(I.indicatorFolded="CodeMirror-foldgutter-folded"),I}function O(I,x){for(var k=I.findMarks(P(x,0),P(x+1,0)),W=0;W<k.length;++W)if(k[W].__isFold){var X=k[W].find(-1);if(X&&X.line===x)return k[W]}}function C(I){if(typeof I=="string"){var x=document.createElement("div");return x.className=I+" CodeMirror-guttermarker-subtle",x}else return I.cloneNode(!0)}function _(I,x,k){var W=I.state.foldGutter.options,X=x-1,Z=I.foldOption(W,"minFoldSize"),ie=I.foldOption(W,"rangeFinder"),se=typeof W.indicatorFolded=="string"&&b(W.indicatorFolded),fe=typeof W.indicatorOpen=="string"&&b(W.indicatorOpen);I.eachLine(x,k,function(Ie){++X;var Ne=null,ye=Ie.gutterMarkers;if(ye&&(ye=ye[W.gutter]),O(I,X)){if(se&&ye&&se.test(ye.className))return;Ne=C(W.indicatorFolded)}else{var je=P(X,0),R=ie&&ie(I,je);if(R&&R.to.line-R.from.line>=Z){if(fe&&ye&&fe.test(ye.className))return;Ne=C(W.indicatorOpen)}}!Ne&&!ye||I.setGutterMarker(Ie,W.gutter,Ne)})}function b(I){return new RegExp("(^|\\s)"+I+"(?:$|\\s)\\s*")}function D(I){var x=I.getViewport(),k=I.state.foldGutter;k&&(I.operation(function(){_(I,x.from,x.to)}),k.from=x.from,k.to=x.to)}function Q(I,x,k){var W=I.state.foldGutter;if(W){var X=W.options;if(k==X.gutter){var Z=O(I,x);Z?Z.clear():I.foldCode(P(x,0),X)}}}function N(I,x){x=="mode"&&Y(I)}function Y(I){var x=I.state.foldGutter;if(x){var k=x.options;x.from=x.to=0,clearTimeout(x.changeUpdate),x.changeUpdate=setTimeout(function(){D(I)},k.foldOnChangeTimeSpan||600)}}function B(I){var x=I.state.foldGutter;if(x){var k=x.options;clearTimeout(x.changeUpdate),x.changeUpdate=setTimeout(function(){var W=I.getViewport();x.from==x.to||W.from-x.to>20||x.from-W.to>20?D(I):I.operation(function(){W.from<x.from&&(_(I,W.from,x.from),x.from=W.from),W.to>x.to&&(_(I,x.to,W.to),x.to=W.to)})},k.updateViewportTimeSpan||400)}}function J(I,x){var k=I.state.foldGutter;if(k){var W=x.line;W>=k.from&&W<k.to&&_(I,W,W+1)}}})})(),function(y,f){(function(h){h(Yt())})(function(h){function P(T){return function(E,O){var C=O.line,_=E.getLine(C);function b(J){for(var I,x=O.ch,k=0;;){var W=x<=0?-1:_.lastIndexOf(J[0],x-1);if(W==-1){if(k==1)break;k=1,x=_.length;continue}if(k==1&&W<O.ch)break;if(I=E.getTokenTypeAt(h.Pos(C,W+1)),!/^(comment|string)/.test(I))return{ch:W+1,tokenType:I,pair:J};x=W-1}}function D(J){var I=1,x=E.lastLine(),k,W=J.ch,X;e:for(var Z=C;Z<=x;++Z)for(var ie=E.getLine(Z),se=Z==C?W:0;;){var fe=ie.indexOf(J.pair[0],se),Ie=ie.indexOf(J.pair[1],se);if(fe<0&&(fe=ie.length),Ie<0&&(Ie=ie.length),se=Math.min(fe,Ie),se==ie.length)break;if(E.getTokenTypeAt(h.Pos(Z,se+1))==J.tokenType){if(se==fe)++I;else if(!--I){k=Z,X=se;break e}}++se}return k==null||C==k?null:{from:h.Pos(C,W),to:h.Pos(k,X)}}for(var Q=[],N=0;N<T.length;N++){var Y=b(T[N]);Y&&Q.push(Y)}Q.sort(function(J,I){return J.ch-I.ch});for(var N=0;N<Q.length;N++){var B=D(Q[N]);if(B)return B}return null}}h.registerHelper("fold","brace",P([["{","}"],["[","]"]])),h.registerHelper("fold","brace-paren",P([["{","}"],["[","]"],["(",")"]])),h.registerHelper("fold","import",function(T,E){function O(N){if(N<T.firstLine()||N>T.lastLine())return null;var Y=T.getTokenAt(h.Pos(N,1));if(/\S/.test(Y.string)||(Y=T.getTokenAt(h.Pos(N,Y.end+1))),Y.type!="keyword"||Y.string!="import")return null;for(var B=N,J=Math.min(T.lastLine(),N+10);B<=J;++B){var I=T.getLine(B),x=I.indexOf(";");if(x!=-1)return{startCh:Y.end,end:h.Pos(B,x)}}}var C=E.line,_=O(C),b;if(!_||O(C-1)||(b=O(C-2))&&b.end.line==C-1)return null;for(var D=_.end;;){var Q=O(D.line+1);if(Q==null)break;D=Q.end}return{from:T.clipPos(h.Pos(C,_.startCh+1)),to:D}}),h.registerHelper("fold","include",function(T,E){function O(Q){if(Q<T.firstLine()||Q>T.lastLine())return null;var N=T.getTokenAt(h.Pos(Q,1));if(/\S/.test(N.string)||(N=T.getTokenAt(h.Pos(Q,N.end+1))),N.type=="meta"&&N.string.slice(0,8)=="#include")return N.start+8}var C=E.line,_=O(C);if(_==null||O(C-1)!=null)return null;for(var b=C;;){var D=O(b+1);if(D==null)break;++b}return{from:h.Pos(C,_+1),to:T.clipPos(h.Pos(b))}})})}(),function(y,f){(function(h){h(Yt())})(function(h){function P(T,E){var O=T.getLine(E),C=O.search(/\S/);return C==-1||/\bcomment\b/.test(T.getTokenTypeAt(h.Pos(E,C+1)))?-1:h.countColumn(O,null,T.getOption("tabSize"))}h.registerHelper("fold","indent",function(T,E){var O=P(T,E.line);if(!(O<0)){for(var C=null,_=E.line+1,b=T.lastLine();_<=b;++_){var D=P(T,_);if(D!=-1)if(D>O)C=_;else break}if(C)return{from:h.Pos(E.line,T.getLine(E.line).length),to:h.Pos(C,T.getLine(C).length)}}})})}();const Sa=en.defineStore("trace",{state:()=>({traces:[],currentTrace:null}),getters:{getTraces:y=>y.traces,getCurrentTrace:y=>y.currentTrace},actions:{setTraces(y){this.traces=y},setCurrentTrace(y){this.currentTrace=y}}});var ka={exports:{}};(function(y,f){(function(h,P){y.exports=P(Yt())})(xa,function(h){return function(P){function T(O){if(E[O])return E[O].exports;var C=E[O]={i:O,l:!1,exports:{}};return P[O].call(C.exports,C,C.exports,T),C.l=!0,C.exports}var E={};return T.m=P,T.c=E,T.i=function(O){return O},T.d=function(O,C,_){T.o(O,C)||Object.defineProperty(O,C,{configurable:!1,enumerable:!0,get:_})},T.n=function(O){var C=O&&O.__esModule?function(){return O.default}:function(){return O};return T.d(C,"a",C),C},T.o=function(O,C){return Object.prototype.hasOwnProperty.call(O,C)},T.p="/",T(T.s=3)}([function(P,T){P.exports=h},function(P,T,E){Object.defineProperty(T,"__esModule",{value:!0});var O=E(0),C=function(b){return b&&b.__esModule?b:{default:b}}(O),_=window.CodeMirror||C.default;typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(b,D){if(b==null)throw new TypeError("Cannot convert undefined or null to object");for(var Q=Object(b),N=1;N<arguments.length;N++){var Y=arguments[N];if(Y!=null)for(var B in Y)Object.prototype.hasOwnProperty.call(Y,B)&&(Q[B]=Y[B])}return Q},writable:!0,configurable:!0}),T.default={name:"codemirror",data:function(){return{content:"",codemirror:null,cminstance:null}},props:{code:String,value:String,marker:Function,unseenLines:Array,name:{type:String,default:"codemirror"},placeholder:{type:String,default:""},merge:{type:Boolean,default:!1},options:{type:Object,default:function(){return{}}},events:{type:Array,default:function(){return[]}},globalOptions:{type:Object,default:function(){return{}}},globalEvents:{type:Array,default:function(){return[]}}},watch:{options:{deep:!0,handler:function(b){for(var D in b)this.cminstance.setOption(D,b[D])}},merge:function(){this.$nextTick(this.switchMerge)},code:function(b){this.handerCodeChange(b)},value:function(b){this.handerCodeChange(b)}},methods:{initialize:function(){var b=this,D=Object.assign({},this.globalOptions,this.options);this.merge?(this.codemirror=_.MergeView(this.$refs.mergeview,D),this.cminstance=this.codemirror.edit):(this.codemirror=_.fromTextArea(this.$refs.textarea,D),this.cminstance=this.codemirror,this.cminstance.setValue(this.code||this.value||this.content)),this.cminstance.on("change",function(N){b.content=N.getValue(),b.$emit&&b.$emit("input",b.content)});var Q={};["scroll","changes","beforeChange","cursorActivity","keyHandled","inputRead","electricInput","beforeSelectionChange","viewportChange","swapDoc","gutterClick","gutterContextMenu","focus","blur","refresh","optionChange","scrollCursorIntoView","update"].concat(this.events).concat(this.globalEvents).filter(function(N){return!Q[N]&&(Q[N]=!0)}).forEach(function(N){b.cminstance.on(N,function(){for(var Y=arguments.length,B=Array(Y),J=0;J<Y;J++)B[J]=arguments[J];b.$emit.apply(b,[N].concat(B));var I=N.replace(/([A-Z])/g,"-$1").toLowerCase();I!==N&&b.$emit.apply(b,[I].concat(B))})}),this.$emit("ready",this.codemirror),this.unseenLineMarkers(),this.refresh()},refresh:function(){var b=this;this.$nextTick(function(){b.cminstance.refresh()})},destroy:function(){var b=this.cminstance.doc.cm.getWrapperElement();b&&b.remove&&b.remove()},handerCodeChange:function(b){if(b!==this.cminstance.getValue()){var D=this.cminstance.getScrollInfo();this.cminstance.setValue(b),this.content=b,this.cminstance.scrollTo(D.left,D.top)}this.unseenLineMarkers()},unseenLineMarkers:function(){var b=this;this.unseenLines!==void 0&&this.marker!==void 0&&this.unseenLines.forEach(function(D){var Q=b.cminstance.lineInfo(D);b.cminstance.setGutterMarker(D,"breakpoints",Q.gutterMarkers?null:b.marker())})},switchMerge:function(){var b=this.cminstance.doc.history,D=this.cminstance.doc.cleanGeneration;this.options.value=this.cminstance.getValue(),this.destroy(),this.initialize(),this.cminstance.doc.history=b,this.cminstance.doc.cleanGeneration=D}},mounted:function(){this.initialize()},beforeDestroy:function(){this.destroy()}}},function(P,T,E){Object.defineProperty(T,"__esModule",{value:!0});var O=E(1),C=E.n(O);for(var _ in O)["default","default"].indexOf(_)<0&&function(N){E.d(T,N,function(){return O[N]})}(_);var b=E(5),D=E(4),Q=D(C.a,b.a,!1,null,null,null);T.default=Q.exports},function(P,T,E){function O(B){return B&&B.__esModule?B:{default:B}}Object.defineProperty(T,"__esModule",{value:!0}),T.install=T.codemirror=T.CodeMirror=void 0;var C=E(0),_=O(C),b=E(2),D=O(b),Q=window.CodeMirror||_.default,N=function(B,J){J&&(J.options&&(D.default.props.globalOptions.default=function(){return J.options}),J.events&&(D.default.props.globalEvents.default=function(){return J.events})),B.component(D.default.name,D.default)},Y={CodeMirror:Q,codemirror:D.default,install:N};T.default=Y,T.CodeMirror=Q,T.codemirror=D.default,T.install=N},function(P,T){P.exports=function(E,O,C,_,b,D){var Q,N=E=E||{},Y=typeof E.default;Y!=="object"&&Y!=="function"||(Q=E,N=E.default);var B=typeof N=="function"?N.options:N;O&&(B.render=O.render,B.staticRenderFns=O.staticRenderFns,B._compiled=!0),C&&(B.functional=!0),b&&(B._scopeId=b);var J;if(D?(J=function(k){k=k||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,k||typeof __VUE_SSR_CONTEXT__>"u"||(k=__VUE_SSR_CONTEXT__),_&&_.call(this,k),k&&k._registeredComponents&&k._registeredComponents.add(D)},B._ssrRegister=J):_&&(J=_),J){var I=B.functional,x=I?B.render:B.beforeCreate;I?(B._injectStyles=J,B.render=function(k,W){return J.call(W),x(k,W)}):B.beforeCreate=x?[].concat(x,J):[J]}return{esModule:Q,exports:N,options:B}}},function(P,T,E){var O=function(){var b=this,D=b.$createElement,Q=b._self._c||D;return Q("div",{staticClass:"vue-codemirror",class:{merge:b.merge}},[b.merge?Q("div",{ref:"mergeview"}):Q("textarea",{ref:"textarea",attrs:{name:b.name,placeholder:b.placeholder}})])},C=[],_={render:O,staticRenderFns:C};T.a=_}])})})(ka);var Io=ka.exports;const Ro=()=>typeof __TRACE_API_BASE_URL__<"u"?__TRACE_API_BASE_URL__:typeof window<"u"&&window.__TRACE_API_BASE_URL__?window.__TRACE_API_BASE_URL__:typeof process<"u"&&process.env&&process.env.TRACE_API_BASE_URL?process.env.TRACE_API_BASE_URL:"/tracing",Pn=Mo.create({baseURL:Ro(),timeout:3e4}),Lr={getTraceList(y,f,h,P,T){const E={};return y&&(E.query=y),f&&(E.startTime=f),h&&(E.endTime=h),P&&(E.pageNo=P),T&&(E.pageSize=T),Pn.get("/v1/trace",{params:E}).then(O=>O.data)},getTraceDetail(y){return Pn.get(`/v1/trace/${y}`).then(f=>f.data)},getTraceSpans(y){return Pn.get(`/v1/trace/${y}/spans`).then(f=>f.data)},deleteTraces(y,f,h){const P={};return y&&(P.query=y),f&&(P.startTime=f),h&&(P.endTime=h),Pn.delete("/v1/trace",{params:P}).then(T=>T.data)}};function Ta(y,f,h,P,T,E,O,C){var _=typeof y=="function"?y.options:y;return f&&(_.render=f,_.staticRenderFns=h,_._compiled=!0),E&&(_._scopeId="data-v-"+E),{exports:y,options:_}}const Eo={name:"TraceSpanTree",props:{spans:{type:Array,default:()=>[]},selectedSpanId:{type:String,default:null},traceStartTime:{type:Number,default:0},traceEndTime:{type:Number,default:0}},data(){return{expandedNodes:new Set,treeData:[]}},watch:{spans:{immediate:!0,handler(){this.buildTree()}}},methods:{buildTree(){if(!this.spans||this.spans.length===0){this.treeData=[];return}const y=new Map,f=[];this.spans.forEach(h=>{y.set(h.span_id,{...h,children:[]})}),this.spans.forEach(h=>{const P=y.get(h.span_id);if(h.parent_span_id){const T=y.get(h.parent_span_id);T?T.children.push(P):f.push(P)}else f.push(P)}),f.forEach(h=>{this.sortChildren(h)}),this.treeData=f,this.treeData.length>0&&this.expandedNodes.add(this.treeData[0].span_id)},sortChildren(y){y.children&&y.children.length>0&&(y.children.sort((f,h)=>f.start_time_unix_nano-h.start_time_unix_nano),y.children.forEach(f=>this.sortChildren(f)))},handleNodeClick(y){this.$emit("span-select",y)},hasChildren(y){return y.children&&y.children.length>0},isExpanded(y){return this.expandedNodes.has(y.span_id)},toggleExpand(y){this.expandedNodes.has(y.span_id)?this.expandedNodes.delete(y.span_id):this.expandedNodes.add(y.span_id),this.$forceUpdate()},getNodeDepth(y){let f=0,h=y;for(;h.parent_span_id;){f++;const P=this.findNodeById(h.parent_span_id);if(!P)break;h=P}return f},findNodeById(y){const f=h=>{for(const P of h){if(P.span_id===y)return P;if(P.children&&P.children.length>0){const T=f(P.children);if(T)return T}}return null};return f(this.treeData)},getTimelineBarStyle(y){if(!this.traceStartTime||!this.traceEndTime||this.traceStartTime===this.traceEndTime)return{width:"100%"};const f=this.traceEndTime-this.traceStartTime,h=y.start_time_unix_nano-this.traceStartTime,P=y.duration_ns,T=h/f*100,E=P/f*100;return{left:`${T}%`,width:`${E}%`}},getTypeColor(y){return{SERVER:"primary",CHAT_MODEL:"success",LLM:"success",CHAIN:"warning",AGENT:"danger",TOOL:"info",JOB:"warning",FUNCTION:"info"}[y]||"info"},formatNanoDuration(y){if(!y)return"-";const f=y/1e6;return f<1e3?`${f.toFixed(2)}ms`:f<6e4?`${(f/1e3).toFixed(2)}s`:`${(f/6e4).toFixed(2)}min`},formatTime(y){if(!y)return"-";const f=y/1e6,h=new Date(f),P=h.getFullYear(),T=String(h.getMonth()+1).padStart(2,"0"),E=String(h.getDate()).padStart(2,"0"),O=String(h.getHours()).padStart(2,"0"),C=String(h.getMinutes()).padStart(2,"0"),_=String(h.getSeconds()).padStart(2,"0");return`${P}-${T}-${E} ${O}:${C}:${_}`}}};var Po=function(){var f=this,h=f._self._c;return h("div",{staticClass:"span-tree-container"},[f.treeData.length===0?h("div",{staticClass:"empty-state"},[h("el-empty",{attrs:{description:"暂无 Span 数据"}})],1):h("div",{staticClass:"timeline-wrapper"},[h("div",{staticClass:"timeline-header"},[h("div",{staticClass:"time-scale"},[h("span",{staticClass:"time-start"},[f._v(f._s(f.formatTime(f.traceStartTime)))]),h("span",{staticClass:"time-end"},[f._v(f._s(f.formatTime(f.traceEndTime)))])])]),h("div",{ref:"timelineContent",staticClass:"timeline-content"},f._l(f.treeData,function(P,T){return h("div",{key:P.span_id,staticClass:"timeline-node",class:{selected:f.selectedSpanId===P.span_id},on:{click:function(E){return f.handleNodeClick(P)}}},[h("div",{staticClass:"node-row"},[h("div",{staticClass:"node-info",style:{paddingLeft:`${f.getNodeDepth(P)*20}px`}},[f.hasChildren(P)?h("i",{staticClass:"expand-icon",class:f.isExpanded(P)?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:function(E){return E.stopPropagation(),f.toggleExpand(P)}}}):h("i",{staticClass:"expand-icon-placeholder"}),h("el-tag",{staticClass:"type-tag",attrs:{type:f.getTypeColor(P.type),size:"mini"}},[f._v(" "+f._s(P.type)+" ")]),h("span",{staticClass:"node-name",attrs:{title:P.name}},[f._v(f._s(P.name))])],1),h("div",{staticClass:"node-duration"},[f._v(" "+f._s(f.formatNanoDuration(P.duration_ns))+" ")])]),h("div",{staticClass:"timeline-bar-wrapper"},[h("div",{staticClass:"timeline-bar",class:{selected:f.selectedSpanId===P.span_id},style:f.getTimelineBarStyle(P)})]),f.isExpanded(P)&&f.hasChildren(P)?h("div",{staticClass:"children-nodes"},f._l(P.children,function(E){return h("div",{key:E.span_id,staticClass:"timeline-node child-node",class:{selected:f.selectedSpanId===E.span_id},on:{click:function(O){return O.stopPropagation(),f.handleNodeClick(E)}}},[h("div",{staticClass:"node-row"},[h("div",{staticClass:"node-info",style:{paddingLeft:`${f.getNodeDepth(E)*20}px`}},[f.hasChildren(E)?h("i",{staticClass:"expand-icon",class:f.isExpanded(E)?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:function(O){return O.stopPropagation(),f.toggleExpand(E)}}}):h("i",{staticClass:"expand-icon-placeholder"}),h("el-tag",{staticClass:"type-tag",attrs:{type:f.getTypeColor(E.type),size:"mini"}},[f._v(" "+f._s(E.type)+" ")]),h("span",{staticClass:"node-name",attrs:{title:E.name}},[f._v(f._s(E.name))])],1),h("div",{staticClass:"node-duration"},[f._v(" "+f._s(f.formatNanoDuration(E.duration_ns))+" ")])]),h("div",{staticClass:"timeline-bar-wrapper"},[h("div",{staticClass:"timeline-bar",class:{selected:f.selectedSpanId===E.span_id},style:f.getTimelineBarStyle(E)})]),f.isExpanded(E)&&f.hasChildren(E)?h("div",{staticClass:"children-nodes"},f._l(E.children,function(O){return h("div",{key:O.span_id,staticClass:"timeline-node child-node",class:{selected:f.selectedSpanId===O.span_id},on:{click:function(C){return C.stopPropagation(),f.handleNodeClick(O)}}},[h("div",{staticClass:"node-row"},[h("div",{staticClass:"node-info",style:{paddingLeft:`${f.getNodeDepth(O)*20}px`}},[h("i",{staticClass:"expand-icon-placeholder"}),h("el-tag",{staticClass:"type-tag",attrs:{type:f.getTypeColor(O.type),size:"mini"}},[f._v(" "+f._s(O.type)+" ")]),h("span",{staticClass:"node-name",attrs:{title:O.name}},[f._v(f._s(O.name))])],1),h("div",{staticClass:"node-duration"},[f._v(" "+f._s(f.formatNanoDuration(O.duration_ns))+" ")])]),h("div",{staticClass:"timeline-bar-wrapper"},[h("div",{staticClass:"timeline-bar",class:{selected:f.selectedSpanId===O.span_id},style:f.getTimelineBarStyle(O)})])])}),0):f._e()])}),0):f._e()])}),0)])])},Wo=[],Ho=Ta(Eo,Po,Wo,!1,null,"4f00ade1");const wi=Ho.exports,Fo={name:"Trace",components:{TraceSpanTree:wi,codemirror:Io.codemirror},data(){return{traceList:[],filteredTraceList:[],searchQuery:"",dateRange:null,loading:!1,deleteLoading:!1,showColumnDialog:!1,selectedColumns:["trace_id","timestamp_ms","status","execution_time_ms","trace_type","trace_name"],visibleColumns:{trace_id:!0,timestamp_ms:!0,status:!0,execution_time_ms:!0,trace_type:!0,trace_name:!0},drawerVisible:!1,currentTraceId:null,traceInfo:{},spans:[],filteredSpans:[],spanSearchQuery:"",selectedSpanId:null,selectedSpan:null,activeTab:"io",activeCollapse:["inputs","outputs"],messageCollapse:[],rawIoCollapse:["rawInputs","rawOutputs"],rawInputsKey:0,rawOutputsKey:0,pageNo:1,pageSize:10,total:0,pickerOptions:{shortcuts:[{text:"近7天",onClick(y){const f=new Date,h=new Date;h.setTime(h.getTime()-3600*1e3*24*7),y.$emit("pick",[h,f])}},{text:"近30天",onClick(y){const f=new Date,h=new Date;h.setTime(h.getTime()-3600*1e3*24*30),y.$emit("pick",[h,f])}},{text:"7天前",onClick(y){const f=new Date;f.setTime(f.getTime()-3600*1e3*24*7),f.setHours(23,59,59,999);const h=f.getTime();y.$emit("pick",[null,h])}},{text:"30天前",onClick(y){const f=new Date;f.setTime(f.getTime()-3600*1e3*24*30),f.setHours(23,59,59,999);const h=f.getTime();y.$emit("pick",[null,h])}}]},cmOptions:{tabSize:2,mode:{name:"javascript",json:!0},theme:"monokai",lineNumbers:!0,lineWrapping:!0,readOnly:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,autoCloseBrackets:!0,indentUnit:2,styleActiveLine:!0}}},computed:{drawerTitle(){return this.traceInfo.trace_id?`${this.$t("trace.traceDetail")}: ${this.traceInfo.trace_id}`:this.$t("trace.traceDetail")},traceStartTime(){return this.spans.length===0?0:Math.min(...this.spans.map(y=>y.start_time_unix_nano))},traceEndTime(){return this.spans.length===0?0:Math.max(...this.spans.map(y=>y.end_time_unix_nano))},hasInputs(){var y,f;return((f=(y=this.selectedSpan)==null?void 0:y.parsedContent)==null?void 0:f.inputs)!==void 0},hasOutputs(){var y,f;return((f=(y=this.selectedSpan)==null?void 0:y.parsedContent)==null?void 0:f.outputs)!==void 0},attributesData(){var y,f;return(f=(y=this.selectedSpan)==null?void 0:y.parsedContent)!=null&&f.attributes?Object.entries(this.selectedSpan.parsedContent.attributes).filter(([h])=>!h.startsWith("langsword.span")).map(([h,P])=>({key:h,value:typeof P=="string"?P:JSON.stringify(P,null,2)})):[]},rawInputs(){var y,f,h;return(h=(f=(y=this.selectedSpan)==null?void 0:y.parsedContent)==null?void 0:f.attributes)==null?void 0:h["langsword.spanInputs"]},rawOutputs(){var y,f,h;return(h=(f=(y=this.selectedSpan)==null?void 0:y.parsedContent)==null?void 0:f.attributes)==null?void 0:h["langsword.spanOutputs"]}},watch:{activeTab(y){y==="raw"&&this.$nextTick(()=>{this.rawInputsKey++,this.rawOutputsKey++})},selectedSpan(){this.activeTab==="raw"&&this.$nextTick(()=>{this.rawInputsKey++,this.rawOutputsKey++})}},mounted(){this.loadTraceList()},methods:{async loadTraceList(){this.loading=!0;try{let y=null,f=null;this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2?(this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""&&(y=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10)),this.dateRange[1]!==null&&this.dateRange[1]!==void 0&&this.dateRange[1]!==""&&(f=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(f=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10)));const h=await Lr.getTraceList(this.searchQuery,y,f,this.pageNo,this.pageSize),P=Array.isArray(h==null?void 0:h.list)?h.list:[];this.traceList=P,this.filteredTraceList=P,this.total=parseInt((h==null?void 0:h.total)||0,10)}catch(y){console.error("Failed to load trace list:",y),this.$message.error("加载 trace 列表失败"),this.traceList=[],this.filteredTraceList=[],this.total=0}finally{this.loading=!1}},refresh(){this.loadTraceList()},handleRowClick(y){this.viewDetail(y.trace_id)},viewDetail(y){this.currentTraceId=y,this.loadTraceDetail(y),this.drawerVisible=!0},async loadTraceDetail(y){var f,h;try{const[P,T]=await Promise.all([Lr.getTraceDetail(y),Lr.getTraceSpans(y)]);this.traceInfo=P||{},this.spans=T.map(E=>{let O={};try{if(O=JSON.parse(E.content),O.attributes){const C=O.attributes["langsword.spanInputs"],_=O.attributes["langsword.spanOutputs"];if(C)try{O.inputs=JSON.parse(C)}catch{try{const D=C.replace(/\\"/g,'"').replace(/^"|"$/g,"");O.inputs=JSON.parse(D)}catch{O.inputs=C}}if(_)try{O.outputs=JSON.parse(_)}catch{try{const D=_.replace(/\\"/g,'"').replace(/^"|"$/g,"");O.outputs=JSON.parse(D)}catch{O.outputs=_}}}}catch(C){console.error("Parse content error:",C)}return{...E,parsedContent:O}}),this.filteredSpans=this.spans,this.spans.length>0&&(this.selectedSpanId=this.spans[0].span_id,this.selectedSpan=this.spans[0],(h=(f=this.selectedSpan.parsedContent)==null?void 0:f.inputs)!=null&&h.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((E,O)=>`message-${O}`):this.messageCollapse=[])}catch(P){console.error("Failed to load trace detail:",P),this.$message.error("加载 trace 详情失败"),this.traceInfo={},this.spans=[],this.filteredSpans=[]}},handleSpanSearch(){if(!this.spanSearchQuery){this.filteredSpans=this.spans;return}const y=this.spanSearchQuery.toLowerCase();this.filteredSpans=this.spans.filter(f=>f.name.toLowerCase().includes(y)||f.type.toLowerCase().includes(y))},handleSpanSelect(y){var f,h;this.selectedSpanId=y.span_id,this.selectedSpan=y,this.activeTab="io",(h=(f=this.selectedSpan.parsedContent)==null?void 0:f.inputs)!=null&&h.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((P,T)=>`message-${T}`):this.messageCollapse=[]},handleDrawerClose(y){this.currentTraceId=null,this.traceInfo={},this.spans=[],this.filteredSpans=[],this.selectedSpanId=null,this.selectedSpan=null,this.spanSearchQuery="",y()},handleSearch(){this.pageNo=1,this.loadTraceList()},handleSearchClear(){this.searchQuery="",this.pageNo=1,this.loadTraceList()},handleDateRangeChange(y){this.pageNo=1,y&&Array.isArray(y)?y.length===2&&(y[0]===null||y[0]===void 0)?this.dateRange=[null,y[1]]:this.dateRange=y:this.dateRange=y,this.loadTraceList()},handleSizeChange(y){this.pageSize=y,this.pageNo=1,this.loadTraceList()},handleCurrentChange(y){this.pageNo=y,this.loadTraceList()},async handleBatchDelete(){var T,E;const y=this.searchQuery&&this.searchQuery.trim(),f=this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2&&this.dateRange[1]!==null||this.dateRange.length===1&&this.dateRange[0]!==null);let h="",P="warning";if(!y&&!f)h=this.$t("trace.deleteAllWarning"),P="error";else{if(h=this.$t("trace.deleteConfirmMessage")+`
26
- `,y&&(h+=`${this.$t("trace.searchCondition")}: ${this.searchQuery}
27
- `),f){const O=this.$i18n.locale==="zh-CN"?"zh-CN":"en-US";let C="";if(this.dateRange.length===2&&this.dateRange[1]!==null?C=new Date(this.dateRange[1]).toLocaleString(O):this.dateRange.length===1&&this.dateRange[0]!==null&&(C=new Date(this.dateRange[0]).toLocaleString(O)),this.dateRange.length===2&&this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""){const _=new Date(this.dateRange[0]).toLocaleString(O);h+=`${this.$t("trace.timeRange")}: ${_} ${this.$t("trace.to")} ${C}
28
- `}else this.$i18n.locale==="zh-CN"?h+=`${this.$t("trace.timeRange")}: ${this.$t("trace.before")} ${C} 之前
29
- `:h+=`${this.$t("trace.timeRange")}: ${this.$t("trace.before")} ${C}
30
- `}h+=this.$t("trace.deleteConfirmFooter")}try{await this.$confirm(h,this.$t("trace.confirmDelete"),{confirmButtonText:this.$t("trace.confirmDeleteButton"),cancelButtonText:this.$t("common.cancel"),type:P,dangerouslyUseHTMLString:!1}),this.deleteLoading=!0;let O=null,C=null;this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2?(this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""&&(O=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10)),this.dateRange[1]!==null&&this.dateRange[1]!==void 0&&this.dateRange[1]!==""&&(C=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(C=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10))),await Lr.deleteTraces(y?this.searchQuery:null,O,C),this.$message.success(this.$t("trace.deleteSuccess")),await this.loadTraceList()}catch(O){if(O!=="cancel"){console.error("Failed to delete traces:",O);const C=((E=(T=O.response)==null?void 0:T.data)==null?void 0:E.message)||O.message||this.$t("trace.unknownError");this.$message.error(`${this.$t("trace.deleteFailed")}: ${C}`)}}finally{this.deleteLoading=!1}},getStatusType(y){return{OK:"success",ERROR:"danger",IN_PROGRESS:"warning",UNSET:"info"}[y]||"info"},formatDateTime(y){if(!y)return"-";const f=typeof y=="string"?parseInt(y,10):y;if(isNaN(f))return"-";const h=new Date(f);if(isNaN(h.getTime()))return"-";const P=h.getFullYear(),T=String(h.getMonth()+1).padStart(2,"0"),E=String(h.getDate()).padStart(2,"0"),O=String(h.getHours()).padStart(2,"0"),C=String(h.getMinutes()).padStart(2,"0"),_=String(h.getSeconds()).padStart(2,"0");return`${P}-${T}-${E} ${O}:${C}:${_}`},formatTimeAgo(y){if(!y)return"-";const f=typeof y=="string"?parseInt(y,10):y;if(isNaN(f))return"-";const P=Date.now()-f,T=this.$i18n.locale==="zh-CN",E=Math.floor(P/(1e3*60*60*24));if(E>0)return T?`${E} 天前`:`${E} days ago`;const O=Math.floor(P/(1e3*60*60));if(O>0)return T?`${O} 小时前`:`${O} hours ago`;const C=Math.floor(P/(1e3*60));return C>0?T?`${C} 分钟前`:`${C} minutes ago`:T?"刚刚":"Just now"},formatTimestamp(y){if(!y)return"-";const f=typeof y=="string"?parseInt(y,10):y;if(isNaN(f))return"-";const h=new Date(f);return isNaN(h.getTime())?"-":h.toLocaleString("zh-CN")},formatDuration(y){return y?y<1e3?`${y}ms`:`${(y/1e3).toFixed(1)}s`:"-"},formatJson(y){return y?JSON.stringify(y,null,2):""},formatRawJson(y){if(!y)return"";if(typeof y=="string")try{const f=JSON.parse(y);return JSON.stringify(f,null,2)}catch{try{const h=y.replace(/\\"/g,'"').replace(/^"|"$/g,""),P=JSON.parse(h);return JSON.stringify(P,null,2)}catch{return y}}return JSON.stringify(y,null,2)},handleCodeMirrorReady(y){this.$nextTick(()=>{y&&y.refresh()})},formatMessageContent(y){return typeof y=="string"?y:JSON.stringify(y,null,2)},formatEventTime(y){if(y.time_unix_nano){const f=y.time_unix_nano/1e6;return new Date(f).toLocaleString("zh-CN")}return y.timestamp?new Date(y.timestamp).toLocaleString("zh-CN"):"-"},getMessageIcon(y){return{user:"el-icon-user",assistant:"el-icon-service",system:"el-icon-setting"}[y]||"el-icon-document"},tableRowClassName({row:y,rowIndex:f}){return"trace-row"},getIndex(y){return(this.pageNo-1)*this.pageSize+y+1},applyColumns(){const y={};this.selectedColumns.forEach(f=>{y[f]=!0}),Object.keys(this.visibleColumns).forEach(f=>{this.selectedColumns.includes(f)||(y[f]=!1)}),this.visibleColumns=y,this.showColumnDialog=!1}}};var Bo=function(){var P,T,E,O,C,_;var f=this,h=f._self._c;return h("div",{staticClass:"trace-list-container"},[h("el-card",[h("div",{staticClass:"trace-content-wrapper"},[h("div",{staticClass:"trace-toolbar"},[h("el-input",{staticClass:"toolbar-input",attrs:{placeholder:f.$t("trace.searchPlaceholder"),"prefix-icon":"el-icon-search",clearable:"",size:"mini"},on:{clear:f.handleSearchClear,input:f.handleSearch},model:{value:f.searchQuery,callback:function(b){f.searchQuery=b},expression:"searchQuery"}}),h("el-date-picker",{staticClass:"toolbar-date-picker",attrs:{type:"datetimerange","range-separator":f.$t("trace.to"),"start-placeholder":f.$t("trace.startTime"),"end-placeholder":f.$t("trace.endTime"),"value-format":"timestamp",format:"yyyy-MM-dd HH:mm:ss",size:"mini","picker-options":f.pickerOptions,clearable:""},on:{change:f.handleDateRangeChange},model:{value:f.dateRange,callback:function(b){f.dateRange=b},expression:"dateRange"}}),h("el-button",{attrs:{type:"danger",icon:"el-icon-delete",size:"mini",disabled:f.deleteLoading},on:{click:f.handleBatchDelete}},[f._v(" "+f._s(f.$t("trace.batchDelete"))+" ")]),h("el-button",{attrs:{icon:"el-icon-refresh",size:"mini",circle:"",title:f.$t("common.refresh")},on:{click:f.refresh}}),h("el-button",{attrs:{icon:"el-icon-setting",size:"mini"},on:{click:function(b){f.showColumnDialog=!0}}},[f._v(" "+f._s(f.$t("common.columns"))+" ")])],1),h("div",{staticClass:"trace-table-wrapper"},[h("el-table",{directives:[{name:"loading",rawName:"v-loading",value:f.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:f.filteredTraceList,size:"mini",stripe:"","row-class-name":f.tableRowClassName},on:{"row-click":f.handleRowClick}},[h("el-table-column",{attrs:{type:"index",label:"#",width:"60",index:f.getIndex}}),f.visibleColumns.trace_id?h("el-table-column",{attrs:{prop:"trace_id",label:f.$t("trace.requestId"),width:"280","show-overflow-tooltip":""},scopedSlots:f._u([{key:"default",fn:function(b){return[h("el-link",{attrs:{type:"primary"},on:{click:function(D){return D.stopPropagation(),f.viewDetail(b.row.trace_id)}}},[f._v(" "+f._s(b.row.trace_id)+" ")])]}}],null,!1,1400187371)}):f._e(),f.visibleColumns.trace_name?h("el-table-column",{attrs:{prop:"trace_name",label:f.$t("trace.traceName"),"min-width":"300","show-overflow-tooltip":""},scopedSlots:f._u([{key:"default",fn:function(b){return[h("span",[f._v(f._s(b.row.trace_name||"-"))])]}}],null,!1,3633653970)}):f._e(),f.visibleColumns.trace_type?h("el-table-column",{attrs:{prop:"trace_type",label:f.$t("trace.traceType"),width:"120"},scopedSlots:f._u([{key:"default",fn:function(b){return[h("el-tag",{attrs:{size:"mini",type:"info"}},[f._v(f._s(b.row.trace_type||"-"))])]}}],null,!1,1175446173)}):f._e(),f.visibleColumns.execution_time_ms?h("el-table-column",{attrs:{prop:"execution_time_ms",label:f.$t("trace.executionTime"),width:"120"},scopedSlots:f._u([{key:"default",fn:function(b){return[f._v(" "+f._s(f.formatDuration(b.row.execution_time_ms))+" ")]}}],null,!1,2586299640)}):f._e(),f.visibleColumns.status?h("el-table-column",{attrs:{prop:"status",label:f.$t("trace.status"),width:"100"},scopedSlots:f._u([{key:"default",fn:function(b){return[h("el-tag",{attrs:{type:f.getStatusType(b.row.status),size:"mini"}},[b.row.status==="OK"?h("i",{staticClass:"el-icon-success"}):f._e(),f._v(" "+f._s(b.row.status)+" ")])]}}],null,!1,3672547022)}):f._e(),f.visibleColumns.timestamp_ms?h("el-table-column",{attrs:{prop:"timestamp_ms",label:f.$t("trace.timeCreated"),width:"180"},scopedSlots:f._u([{key:"default",fn:function(b){return[f._v(" "+f._s(f.formatDateTime(b.row.timestamp_ms))+" ")]}}],null,!1,1082702673)}):f._e(),h("el-table-column",{attrs:{label:f.$t("common.operation"),width:"100",fixed:"right"},scopedSlots:f._u([{key:"default",fn:function(b){return[h("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(D){return D.stopPropagation(),f.viewDetail(b.row.trace_id)}}},[f._v(" "+f._s(f.$t("common.viewDetail"))+" ")])]}}])})],1)],1),h("div",{staticClass:"trace-pagination-wrapper"},[f.total>0?h("el-pagination",{staticClass:"trace-pagination",attrs:{"current-page":f.pageNo,"page-sizes":[10,20,50,100],"page-size":f.pageSize,size:"mini",layout:"total, prev, pager, next, sizes, jumper",total:f.total,background:""},on:{"size-change":f.handleSizeChange,"current-change":f.handleCurrentChange}}):f._e()],1)])]),h("el-dialog",{attrs:{title:f.$t("trace.selectColumns"),visible:f.showColumnDialog,width:"400px"},on:{"update:visible":function(b){f.showColumnDialog=b}}},[h("el-checkbox-group",{model:{value:f.selectedColumns,callback:function(b){f.selectedColumns=b},expression:"selectedColumns"}},[h("el-checkbox",{attrs:{label:"trace_id"}},[f._v(f._s(f.$t("trace.requestId")))]),h("el-checkbox",{attrs:{label:"timestamp_ms"}},[f._v(f._s(f.$t("trace.timeCreated")))]),h("el-checkbox",{attrs:{label:"status"}},[f._v(f._s(f.$t("trace.status")))]),h("el-checkbox",{attrs:{label:"execution_time_ms"}},[f._v(f._s(f.$t("trace.executionTime")))]),h("el-checkbox",{attrs:{label:"trace_type"}},[f._v(f._s(f.$t("trace.traceType")))]),h("el-checkbox",{attrs:{label:"trace_name"}},[f._v(f._s(f.$t("trace.traceName")))])],1),h("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[h("el-button",{attrs:{size:"mini"},on:{click:function(b){f.showColumnDialog=!1}}},[f._v(f._s(f.$t("common.cancel")))]),h("el-button",{attrs:{size:"mini",type:"primary"},on:{click:f.applyColumns}},[f._v(f._s(f.$t("common.confirm")))])],1)],1),h("el-drawer",{attrs:{visible:f.drawerVisible,"with-header":!0,title:f.drawerTitle,size:"90%",direction:"rtl","before-close":f.handleDrawerClose},on:{"update:visible":function(b){f.drawerVisible=b}}},[f.currentTraceId?h("div",{staticClass:"trace-detail-content"},[h("div",{staticClass:"trace-info-section"},[h("el-descriptions",{attrs:{column:3,border:""}},[h("el-descriptions-item",{attrs:{label:f.$t("trace.traceId")}},[f._v(f._s(f.traceInfo.trace_id))]),h("el-descriptions-item",{attrs:{label:f.$t("trace.status")}},[h("el-tag",{attrs:{type:f.getStatusType(f.traceInfo.status),size:"mini"}},[f._v(" "+f._s(f.traceInfo.status)+" ")])],1),h("el-descriptions-item",{attrs:{label:f.$t("trace.executionTime")}},[f._v(" "+f._s(f.formatDuration(f.traceInfo.execution_time_ms))+" ")]),h("el-descriptions-item",{attrs:{label:f.$t("trace.timeCreated")}},[f._v(" "+f._s(f.formatTimestamp(f.traceInfo.timestamp_ms))+" ")]),h("el-descriptions-item",{attrs:{label:f.$t("trace.experimentId")}},[f._v(f._s(f.traceInfo.experiment_id))]),h("el-descriptions-item",{attrs:{label:f.$t("trace.traceType")}},[h("el-tag",{attrs:{size:"mini",type:"info"}},[f._v(f._s(f.traceInfo.trace_type||"-"))])],1),h("el-descriptions-item",{attrs:{label:f.$t("trace.traceName"),span:2}},[f._v(" "+f._s(f.traceInfo.trace_name||"-")+" ")])],1)],1),h("el-divider"),h("el-row",{attrs:{gutter:20}},[h("el-col",{staticClass:"span-tree-col",attrs:{span:8}},[h("el-card",[h("div",{attrs:{slot:"header"},slot:"header"},[h("el-input",{attrs:{placeholder:f.$t("span.searchTree"),"prefix-icon":"el-icon-search",size:"small",clearable:""},on:{input:f.handleSpanSearch},model:{value:f.spanSearchQuery,callback:function(b){f.spanSearchQuery=b},expression:"spanSearchQuery"}})],1),h("TraceSpanTree",{attrs:{spans:f.filteredSpans,"selected-span-id":f.selectedSpanId,"trace-start-time":f.traceStartTime,"trace-end-time":f.traceEndTime},on:{"span-select":f.handleSpanSelect}})],1)],1),h("el-col",{staticClass:"span-detail-col",attrs:{span:16}},[h("el-card",[h("div",{attrs:{slot:"header"},slot:"header"},[h("span",[f._v(f._s(f.$t("trace.spanDetail")))])]),f.selectedSpan?h("div",{staticClass:"span-detail-content"},[h("el-tabs",{model:{value:f.activeTab,callback:function(b){f.activeTab=b},expression:"activeTab"}},[h("el-tab-pane",{attrs:{label:`${f.$t("trace.inputs")} / ${f.$t("trace.outputs")}`,name:"io"}},[h("div",{staticClass:"io-content"},[f.hasInputs?h("div",{staticClass:"io-section"},[h("el-collapse",{model:{value:f.activeCollapse,callback:function(b){f.activeCollapse=b},expression:"activeCollapse"}},[h("el-collapse-item",{attrs:{title:f.$t("trace.inputs"),name:"inputs"}},[(T=(P=f.selectedSpan.parsedContent)==null?void 0:P.inputs)!=null&&T.messages?h("div",{staticClass:"messages-section"},f._l(f.selectedSpan.parsedContent.inputs.messages,function(b,D){return h("div",{key:D,staticClass:"message-item"},[h("el-collapse",{model:{value:f.messageCollapse,callback:function(Q){f.messageCollapse=Q},expression:"messageCollapse"}},[h("el-collapse-item",{attrs:{name:`message-${D}`}},[h("template",{slot:"title"},[h("i",{staticClass:"message-icon",class:f.getMessageIcon(b.role)}),h("span",{staticClass:"message-role"},[f._v(f._s(b.role))])]),h("div",{staticClass:"message-content"},[h("pre",[f._v(f._s(f.formatMessageContent(b.content)))])])],2)],1)],1)}),0):(E=f.selectedSpan.parsedContent)!=null&&E.inputs?h("div",{staticClass:"json-content"},[h("pre",[f._v(f._s(f.formatJson(f.selectedSpan.parsedContent.inputs)))])]):h("div",{staticClass:"empty-content"},[h("el-empty",{attrs:{description:f.$t("trace.noInputs"),"image-size":80}})],1)])],1)],1):f._e(),f.hasOutputs?h("div",{staticClass:"io-section"},[h("el-collapse",{model:{value:f.activeCollapse,callback:function(b){f.activeCollapse=b},expression:"activeCollapse"}},[h("el-collapse-item",{attrs:{title:f.$t("trace.outputs"),name:"outputs"}},[(C=(O=f.selectedSpan.parsedContent)==null?void 0:O.outputs)!=null&&C.choices?h("div",{staticClass:"outputs-section"},f._l(f.selectedSpan.parsedContent.outputs.choices,function(b,D){return h("div",{key:D,staticClass:"choice-item"},[h("div",{staticClass:"choice-header"},[h("span",[f._v("Choice "+f._s(D))])]),h("div",{staticClass:"choice-content"},[b.message?h("div",[h("div",{staticClass:"message-header"},[h("i",{staticClass:"el-icon-user message-icon"}),h("span",[f._v(f._s(b.message.role))])]),h("pre",[f._v(f._s(f.formatMessageContent(b.message.content)))])]):h("div",[h("pre",[f._v(f._s(f.formatJson(b)))])])])])}),0):(_=f.selectedSpan.parsedContent)!=null&&_.outputs?h("div",{staticClass:"json-content"},[h("pre",[f._v(f._s(f.formatJson(f.selectedSpan.parsedContent.outputs)))])]):h("div",{staticClass:"empty-content"},[h("el-empty",{attrs:{description:f.$t("trace.noOutputs"),"image-size":80}})],1)])],1)],1):f._e(),!f.hasInputs&&!f.hasOutputs?h("div",{staticClass:"empty-io"},[h("el-empty",{attrs:{description:f.$t("trace.noIoData")}})],1):f._e()])]),h("el-tab-pane",{attrs:{label:f.$t("trace.attributes"),name:"attributes"}},[h("el-table",{attrs:{data:f.attributesData,border:"",stripe:""}},[h("el-table-column",{attrs:{prop:"key",label:f.$t("trace.key"),width:"250"}}),h("el-table-column",{attrs:{prop:"value",label:f.$t("trace.value"),"show-overflow-tooltip":""}})],1)],1),h("el-tab-pane",{attrs:{label:f.$t("trace.rawInputsOutputs"),name:"raw"}},[f.activeTab==="raw"?h("div",{staticClass:"raw-io-content"},[f.rawInputs?h("div",{staticClass:"raw-io-section"},[h("el-collapse",{model:{value:f.rawIoCollapse,callback:function(b){f.rawIoCollapse=b},expression:"rawIoCollapse"}},[h("el-collapse-item",{attrs:{title:f.$t("trace.rawInputs"),name:"rawInputs"}},[h("codemirror",{key:`raw-inputs-${f.selectedSpanId}-${f.rawInputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:f.formatRawJson(f.rawInputs),options:f.cmOptions}})],1)],1)],1):f._e(),f.rawOutputs?h("div",{staticClass:"raw-io-section"},[h("el-collapse",{model:{value:f.rawIoCollapse,callback:function(b){f.rawIoCollapse=b},expression:"rawIoCollapse"}},[h("el-collapse-item",{attrs:{title:f.$t("trace.rawOutputs"),name:"rawOutputs"}},[h("codemirror",{key:`raw-outputs-${f.selectedSpanId}-${f.rawOutputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:f.formatRawJson(f.rawOutputs),options:f.cmOptions}})],1)],1)],1):f._e(),!f.rawInputs&&!f.rawOutputs?h("div",{staticClass:"empty-raw-io"},[h("el-empty",{attrs:{description:f.$t("trace.noIoData")}})],1):f._e()]):f._e()])],1)],1):h("el-empty",{attrs:{description:f.$t("trace.selectSpan")}})],1)],1)],1)],1):f._e()])],1)},zo=[],Uo=Ta(Fo,Bo,zo,!1,null,"3f3363a5");const xi=Uo.exports,La={routes:[{path:"/trace",name:"trace",component:xi}],beforeEach:(y,f,h)=>{h()}},_a={common:{home:"首页",todos:"待办事项",trace:"追踪",login:"登录",logout:"退出",user:"用户",search:"搜索",refresh:"刷新",columns:"列设置",confirm:"确定",cancel:"取消",operation:"操作",viewDetail:"查看详情",language:"语言"},span:{searchTree:"Span名称/Span类型"},trace:{title:"追踪列表",searchPlaceholder:"追踪ID/追踪名称/追踪类型",requestId:"追踪ID",timeCreated:"创建时间",status:"状态",executionTime:"执行时长",traceType:"追踪类型",traceName:"追踪名称",traceDetail:"追踪详情",traceId:"追踪ID",clientRequestId:"客户端请求ID",experimentId:"应用ID",spanDetail:"Span 详情",inputs:"输入",outputs:"输出",attributes:"属性",rawInputsOutputs:"原始输入输出",rawInputs:"原始输入",rawOutputs:"原始输出",events:"事件",selectSpan:"请选择一个 Span 查看详情",noInputs:"暂无输入数据",noOutputs:"暂无输出数据",noIoData:"暂无输入输出数据",noEvents:"暂无事件数据",key:"键",value:"值",selectColumns:"选择列",batchDelete:"批量删除",startTime:"开始时间",endTime:"结束时间",to:"至",confirmDelete:"确认删除",confirmDeleteButton:"确定删除",deleteAllWarning:`警告:您没有设置任何查询条件,这将删除所有 trace 数据!
4
+ `,t);i==-1&&(i=e.length);var o=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),u=o.indexOf("\r");u!=-1?(n.push(o.slice(0,u)),t+=u+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Lr=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch{return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch{}return!t||t.parentElement()!=e?!1:t.compareEndPoints("StartToEnd",t)!=0},ta=function(){var e=T("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),Ut=null;function cs(e){if(Ut!=null)return Ut;var t=Y(e,T("span","x")),n=t.getBoundingClientRect(),r=st(t,0,1).getBoundingClientRect();return Ut=Math.abs(n.left-r.left)>1}var gn={},jt={};function qt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),gn[e]=t}function qr(e,t){jt[e]=t}function vn(e){if(typeof e=="string"&&jt.hasOwnProperty(e))e=jt[e];else if(e&&typeof e.name=="string"&&jt.hasOwnProperty(e.name)){var t=jt[e.name];typeof t=="string"&&(t={name:t}),e=Qi(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return vn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return vn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function mn(e,t){t=vn(t);var n=gn[t.name];if(!n)return mn(e,"text/plain");var r=n(e,t);if(_r.hasOwnProperty(t.name)){var i=_r[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var u in t.modeProps)r[u]=t.modeProps[u];return r}var _r={};function yn(e,t){var n=_r.hasOwnProperty(e)?_r[e]:_r[e]={};he(t,n)}function rr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function ni(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function bn(e,t,n){return e.startState?e.startState(t,n):!0}var He=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};He.prototype.eol=function(){return this.pos>=this.string.length},He.prototype.sol=function(){return this.pos==this.lineStart},He.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},He.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},He.prototype.eat=function(e){var t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)return++this.pos,t},He.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},He.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},He.prototype.skipToEnd=function(){this.pos=this.string.length},He.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},He.prototype.backUp=function(e){this.pos-=e},He.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=xe(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?xe(this.string,this.lineStart,this.tabSize):0)},He.prototype.indentation=function(){return xe(this.string,null,this.tabSize)-(this.lineStart?xe(this.string,this.lineStart,this.tabSize):0)},He.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(u){return n?u.toLowerCase():u},i=this.string.substr(this.pos,e.length);if(r(i)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var o=this.string.slice(this.pos).match(e);return o&&o.index>0?null:(o&&t!==!1&&(this.pos+=o[0].length),o)}},He.prototype.current=function(){return this.string.slice(this.start,this.pos)},He.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},He.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},He.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function V(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function hr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(o){var u=o.text;i==n.line&&(u=u.slice(0,n.ch)),i==t.line&&(u=u.slice(t.ch)),r.push(u),++i}),r}function ii(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Dt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function m(e){if(e.parent==null)return null;for(var t=e.parent,n=fe(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function S(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var u=0;u<e.lines.length;++u){var c=e.lines[u],d=c.height;if(t<d)break;t-=d}return n+u}function z(e,t){return t>=e.first&&t<e.first+e.size}function B(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function I(e,t,n){if(n===void 0&&(n=null),!(this instanceof I))return new I(e,t,n);this.line=e,this.ch=t,this.sticky=n}function X(e,t){return e.line-t.line||e.ch-t.ch}function ye(e,t){return e.sticky==t.sticky&&X(e,t)==0}function Je(e){return I(e.line,e.ch)}function mt(e,t){return X(e,t)<0?t:e}function wn(e,t){return X(e,t)<0?e:t}function Rl(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ae(e,t){if(t.line<e.first)return I(e.first,0);var n=e.first+e.size-1;return t.line>n?I(n,V(e,n).text.length):up(t,V(e,t.line).text.length)}function up(e,t){var n=e.ch;return n==null||n>t?I(e.line,t):n<0?I(e.line,0):e}function zl(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ae(e,t[r]);return n}var ra=function(e,t){this.state=e,this.lookAhead=t},nr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};nr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},nr.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},nr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},nr.fromSaved=function(e,t,n){return t instanceof ra?new nr(e,rr(e.mode,t.state),n,t.lookAhead):new nr(e,rr(e.mode,t),n)},nr.prototype.save=function(e){var t=e!==!1?rr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ra(t,this.maxLookAhead):t};function Pl(e,t,n,r){var i=[e.state.modeGen],o={};Ul(e,t.text,e.doc.mode,n,function(v,x){return i.push(v,x)},o,r);for(var u=n.state,c=function(v){n.baseTokens=i;var x=e.state.overlays[v],C=1,O=0;n.state=!0,Ul(e,t.text,x.mode,n,function(_,M){for(var F=C;O<_;){var U=i[C];U>_&&i.splice(C,1,_,i[C+1],U),C+=2,O=Math.min(_,U)}if(M)if(x.opaque)i.splice(F,C-F,_,"overlay "+M),C=F+2;else for(;F<C;F+=2){var j=i[F+1];i[F+1]=(j?j+" ":"")+"overlay "+M}},o),n.state=u,n.baseTokens=null,n.baseTokenPos=1},d=0;d<e.state.overlays.length;++d)c(d);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Fl(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=ai(e,m(t)),i=t.text.length>e.options.maxHighlightLength&&rr(e.doc.mode,r.state),o=Pl(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ai(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new nr(r,!0,t);var o=fp(e,t,n),u=o>r.first&&V(r,o-1).stateAfter,c=u?nr.fromSaved(r,u,o):new nr(r,bn(r.mode),o);return r.iter(o,t,function(d){hs(e,d.text,c);var v=c.line;d.stateAfter=v==t-1||v%5==0||v>=i.viewFrom&&v<i.viewTo?c.save():null,c.nextLine()}),n&&(r.modeFrontier=c.line),c}function hs(e,t,n,r){var i=e.doc.mode,o=new He(t,e.options.tabSize,n);for(o.start=o.pos=r||0,t==""&&Hl(i,n.state);!o.eol();)ds(i,o,n.state),o.start=o.pos}function Hl(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=ni(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}}function ds(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=ni(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}var Wl=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Bl(e,t,n,r){var i=e.doc,o=i.mode,u;t=ae(i,t);var c=V(i,t.line),d=ai(e,t.line,n),v=new He(c.text,e.options.tabSize,d),x;for(r&&(x=[]);(r||v.pos<t.ch)&&!v.eol();)v.start=v.pos,u=ds(o,v,d.state),r&&x.push(new Wl(v,u,rr(i.mode,d.state)));return r?x:new Wl(v,u,d.state)}function $l(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function Ul(e,t,n,r,i,o,u){var c=n.flattenSpans;c==null&&(c=e.options.flattenSpans);var d=0,v=null,x=new He(t,e.options.tabSize,r),C,O=e.options.addModeClass&&[null];for(t==""&&$l(Hl(n,r.state),o);!x.eol();){if(x.pos>e.options.maxHighlightLength?(c=!1,u&&hs(e,t,r,x.pos),x.pos=t.length,C=null):C=$l(ds(n,x,r.state,O),o),O){var _=O[0].name;_&&(C="m-"+(C?_+" "+C:_))}if(!c||v!=C){for(;d<x.start;)d=Math.min(x.start,d+5e3),i(d,v);v=C}x.start=x.pos}for(;d<x.pos;){var M=Math.min(x.pos,d+5e3);i(M,v),d=M}}function fp(e,t,n){for(var r,i,o=e.doc,u=n?-1:t-(e.doc.mode.innerMode?1e3:100),c=t;c>u;--c){if(c<=o.first)return o.first;var d=V(o,c-1),v=d.stateAfter;if(v&&(!n||c+(v instanceof ra?v.lookAhead:0)<=o.modeFrontier))return c;var x=xe(d.text,null,e.options.tabSize);(i==null||r>x)&&(i=c-1,r=x)}return i}function cp(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;r>n;r--){var i=V(e,r).stateAfter;if(i&&(!(i instanceof ra)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}var jl=!1,dr=!1;function hp(){jl=!0}function dp(){dr=!0}function na(e,t,n){this.marker=e,this.from=t,this.to=n}function si(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function pp(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function gp(e,t,n){var r=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));r&&e.markedSpans&&r.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],r&&r.add(e.markedSpans)),t.marker.attachLine(e)}function vp(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],u=o.marker,c=o.from==null||(u.inclusiveLeft?o.from<=t:o.from<t);if(c||o.from==t&&u.type=="bookmark"&&(!n||!o.marker.insertLeft)){var d=o.to==null||(u.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new na(u,o.from,d?null:o.to))}}return r}function mp(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],u=o.marker,c=o.to==null||(u.inclusiveRight?o.to>=t:o.to>t);if(c||o.from==t&&u.type=="bookmark"&&(!n||o.marker.insertLeft)){var d=o.from==null||(u.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new na(u,d?null:o.from-t,o.to==null?null:o.to-t))}}return r}function ps(e,t){if(t.full)return null;var n=z(e,t.from.line)&&V(e,t.from.line).markedSpans,r=z(e,t.to.line)&&V(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,u=X(t.from,t.to)==0,c=vp(n,i,u),d=mp(r,o,u),v=t.text.length==1,x=me(t.text).length+(v?i:0);if(c)for(var C=0;C<c.length;++C){var O=c[C];if(O.to==null){var _=si(d,O.marker);_?v&&(O.to=_.to==null?null:_.to+x):O.to=i}}if(d)for(var M=0;M<d.length;++M){var F=d[M];if(F.to!=null&&(F.to+=x),F.from==null){var U=si(c,F.marker);U||(F.from=x,v&&(c||(c=[])).push(F))}else F.from+=x,v&&(c||(c=[])).push(F)}c&&(c=ql(c)),d&&d!=c&&(d=ql(d));var j=[c];if(!v){var K=t.text.length-2,q;if(K>0&&c)for(var Q=0;Q<c.length;++Q)c[Q].to==null&&(q||(q=[])).push(new na(c[Q].marker,null,null));for(var re=0;re<K;++re)j.push(q);j.push(d)}return j}function ql(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function yp(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(_){if(_.markedSpans)for(var M=0;M<_.markedSpans.length;++M){var F=_.markedSpans[M].marker;F.readOnly&&(!r||fe(r,F)==-1)&&(r||(r=[])).push(F)}}),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var u=r[o],c=u.find(0),d=0;d<i.length;++d){var v=i[d];if(!(X(v.to,c.from)<0||X(v.from,c.to)>0)){var x=[d,1],C=X(v.from,c.from),O=X(v.to,c.to);(C<0||!u.inclusiveLeft&&!C)&&x.push({from:v.from,to:c.from}),(O>0||!u.inclusiveRight&&!O)&&x.push({from:c.to,to:v.to}),i.splice.apply(i,x),d+=x.length-3}}return i}function Gl(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function Xl(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function ia(e){return e.inclusiveLeft?-1:0}function aa(e){return e.inclusiveRight?1:0}function gs(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),o=X(r.from,i.from)||ia(e)-ia(t);if(o)return-o;var u=X(r.to,i.to)||aa(e)-aa(t);return u||t.id-e.id}function Kl(e,t){var n=dr&&e.markedSpans,r;if(n)for(var i=void 0,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||gs(r,i.marker)<0)&&(r=i.marker);return r}function Yl(e){return Kl(e,!0)}function sa(e){return Kl(e,!1)}function bp(e,t){var n=dr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var o=n[i];o.marker.collapsed&&(o.from==null||o.from<t)&&(o.to==null||o.to>t)&&(!r||gs(r,o.marker)<0)&&(r=o.marker)}return r}function Zl(e,t,n,r,i){var o=V(e,t),u=dr&&o.markedSpans;if(u)for(var c=0;c<u.length;++c){var d=u[c];if(d.marker.collapsed){var v=d.marker.find(0),x=X(v.from,n)||ia(d.marker)-ia(i),C=X(v.to,r)||aa(d.marker)-aa(i);if(!(x>=0&&C<=0||x<=0&&C>=0)&&(x<=0&&(d.marker.inclusiveRight&&i.inclusiveLeft?X(v.to,n)>=0:X(v.to,n)>0)||x>=0&&(d.marker.inclusiveRight&&i.inclusiveLeft?X(v.from,r)<=0:X(v.from,r)<0)))return!0}}}function Gt(e){for(var t;t=Yl(e);)e=t.find(-1,!0).line;return e}function wp(e){for(var t;t=sa(e);)e=t.find(1,!0).line;return e}function xp(e){for(var t,n;t=sa(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function vs(e,t){var n=V(e,t),r=Gt(n);return n==r?t:m(r)}function Ql(e,t){if(t>e.lastLine())return t;var n=V(e,t),r;if(!Ar(e,n))return t;for(;r=sa(n);)n=r.find(1,!0).line;return m(n)+1}function Ar(e,t){var n=dr&&t.markedSpans;if(n){for(var r=void 0,i=0;i<n.length;++i)if(r=n[i],!!r.marker.collapsed){if(r.from==null)return!0;if(!r.marker.widgetNode&&r.from==0&&r.marker.inclusiveLeft&&ms(e,t,r))return!0}}}function ms(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return ms(e,r.line,si(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&ms(e,t,i))return!0}function pr(e){e=Gt(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;n=o,o=n.parent)for(var u=0;u<o.children.length;++u){var c=o.children[u];if(c==n)break;t+=c.height}return t}function oa(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Yl(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=sa(r);){var o=n.find(0,!0);t-=r.text.length-o.from.ch,r=o.to.line,t+=r.text.length-o.to.ch}return t}function ys(e){var t=e.display,n=e.doc;t.maxLine=V(n,n.first),t.maxLineLength=oa(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=oa(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var xn=function(e,t,n){this.text=e,Xl(this,t),this.height=n?n(this):1};xn.prototype.lineNo=function(){return m(this)},Bt(xn);function kp(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Gl(e),Xl(e,n);var i=r?r(e):1;i!=e.height&&Dt(e,i)}function Sp(e){e.parent=null,Gl(e)}var Cp={},Tp={};function Vl(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Tp:Cp;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Jl(e,t){var n=ht("span",null,null,k?"padding-right: .1px":null),r={pre:ht("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,u=void 0;r.pos=0,r.addToken=_p,Tr(e.display.measure)&&(u=ge(o,e.doc.direction))&&(r.addToken=Op(r.addToken,u)),r.map=[];var c=t!=e.display.externalMeasured&&m(o);Ep(o,r,Fl(e,o,c)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=Qe(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=Qe(o.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ea(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(k){var d=r.content.lastChild;(/\bcm-tab\b/.test(d.className)||d.querySelector&&d.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Pe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Qe(r.pre.className,r.textClass||"")),r}function Lp(e){var t=T("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function _p(e,t,n,r,i,o,u){if(t){var c=e.splitSpaces?Ap(t,e.trailingSpace):t,d=e.cm.state.specialChars,v=!1,x;if(!d.test(t))e.col+=t.length,x=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,x),w&&b<9&&(v=!0),e.pos+=t.length;else{x=document.createDocumentFragment();for(var C=0;;){d.lastIndex=C;var O=d.exec(t),_=O?O.index-C:t.length-C;if(_){var M=document.createTextNode(c.slice(C,C+_));w&&b<9?x.appendChild(T("span",[M])):x.appendChild(M),e.map.push(e.pos,e.pos+_,M),e.col+=_,e.pos+=_}if(!O)break;C+=_+1;var F=void 0;if(O[0]==" "){var U=e.cm.options.tabSize,j=U-e.col%U;F=x.appendChild(T("span",Jn(j),"cm-tab")),F.setAttribute("role","presentation"),F.setAttribute("cm-text"," "),e.col+=j}else O[0]=="\r"||O[0]==`
5
+ `?(F=x.appendChild(T("span",O[0]=="\r"?"␍":"␤","cm-invalidchar")),F.setAttribute("cm-text",O[0]),e.col+=1):(F=e.cm.options.specialCharPlaceholder(O[0]),F.setAttribute("cm-text",O[0]),w&&b<9?x.appendChild(T("span",[F])):x.appendChild(F),e.col+=1);e.map.push(e.pos,e.pos+1,F),e.pos++}}if(e.trailingSpace=c.charCodeAt(t.length-1)==32,n||r||i||v||o||u){var K=n||"";r&&(K+=r),i&&(K+=i);var q=T("span",[x],K,o);if(u)for(var Q in u)u.hasOwnProperty(Q)&&Q!="style"&&Q!="class"&&q.setAttribute(Q,u[Q]);return e.content.appendChild(q)}e.content.appendChild(x)}}function Ap(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i);o==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(o=" "),r+=o,n=o==" "}return r}function Op(e,t){return function(n,r,i,o,u,c,d){i=i?i+" cm-force-border":"cm-force-border";for(var v=n.pos,x=v+r.length;;){for(var C=void 0,O=0;O<t.length&&(C=t[O],!(C.to>v&&C.from<=v));O++);if(C.to>=x)return e(n,r,i,o,u,c,d);e(n,r.slice(0,C.to-v),i,o,null,c,d),o=null,r=r.slice(C.to-v),v=C.to}}}function eu(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function Ep(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(!r){for(var u=1;u<n.length;u+=2)t.addToken(t,i.slice(o,o=n[u]),Vl(n[u+1],t.cm.options));return}for(var c=i.length,d=0,v=1,x="",C,O,_=0,M,F,U,j,K;;){if(_==d){M=F=U=O="",K=null,j=null,_=1/0;for(var q=[],Q=void 0,re=0;re<r.length;++re){var J=r[re],ce=J.marker;if(ce.type=="bookmark"&&J.from==d&&ce.widgetNode)q.push(ce);else if(J.from<=d&&(J.to==null||J.to>d||ce.collapsed&&J.to==d&&J.from==d)){if(J.to!=null&&J.to!=d&&_>J.to&&(_=J.to,F=""),ce.className&&(M+=" "+ce.className),ce.css&&(O=(O?O+";":"")+ce.css),ce.startStyle&&J.from==d&&(U+=" "+ce.startStyle),ce.endStyle&&J.to==_&&(Q||(Q=[])).push(ce.endStyle,J.to),ce.title&&((K||(K={})).title=ce.title),ce.attributes)for(var Le in ce.attributes)(K||(K={}))[Le]=ce.attributes[Le];ce.collapsed&&(!j||gs(j.marker,ce)<0)&&(j=J)}else J.from>d&&_>J.from&&(_=J.from)}if(Q)for(var nt=0;nt<Q.length;nt+=2)Q[nt+1]==_&&(F+=" "+Q[nt]);if(!j||j.from==d)for(var Me=0;Me<q.length;++Me)eu(t,0,q[Me]);if(j&&(j.from||0)==d){if(eu(t,(j.to==null?c+1:j.to)-d,j.marker,j.from==null),j.to==null)return;j.to==d&&(j=!1)}}if(d>=c)break;for(var Tt=Math.min(c,_);;){if(x){var wt=d+x.length;if(!j){var Xe=wt>Tt?x.slice(0,Tt-d):x;t.addToken(t,Xe,C?C+M:M,U,d+Xe.length==_?F:"",O,K)}if(wt>=Tt){x=x.slice(Tt-d),d=Tt;break}d=wt,U=""}x=i.slice(o,o=n[v++]),C=Vl(n[v++],t.cm.options)}}}function tu(e,t,n){this.line=t,this.rest=xp(t),this.size=this.rest?m(me(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Ar(e,t)}function la(e,t,n){for(var r=[],i,o=t;o<n;o=i){var u=new tu(e.doc,V(e.doc,o),o);i=o+u.size,r.push(u)}return r}var kn=null;function Dp(e){kn?kn.ops.push(e):e.ownsGroup=kn={ops:[e],delayedCallbacks:[]}}function Ip(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function Np(e,t){var n=e.ownsGroup;if(n)try{Ip(n)}finally{kn=null,t(n)}}var oi=null;function et(e,t){var n=cr(e,t);if(n.length){var r=Array.prototype.slice.call(arguments,2),i;kn?i=kn.delayedCallbacks:oi?i=oi:(i=oi=[],setTimeout(Mp,0));for(var o=function(c){i.push(function(){return n[c].apply(null,r)})},u=0;u<n.length;++u)o(u)}}function Mp(){var e=oi;oi=null;for(var t=0;t<e.length;++t)e[t]()}function ru(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];o=="text"?zp(e,t):o=="gutter"?iu(e,t,n,r):o=="class"?bs(e,t):o=="widget"&&Pp(e,t,r)}t.changes=null}function li(e){return e.node==e.text&&(e.node=T("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),w&&b<8&&(e.node.style.zIndex=2)),e.node}function Rp(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=li(t);t.background=r.insertBefore(T("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function nu(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Jl(e,t)}function zp(e,t){var n=t.text.className,r=nu(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,bs(e,t)):n&&(t.text.className=n)}function bs(e,t){Rp(e,t),t.line.wrapClass?li(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function iu(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=li(t);t.gutterBackground=T("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var u=li(t),c=t.gutter=T("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(c.setAttribute("aria-hidden","true"),e.display.input.setUneditable(c),u.insertBefore(c,t.text),t.line.gutterClass&&(c.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!o||!o["CodeMirror-linenumbers"])&&(t.lineNumber=c.appendChild(T("div",B(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var d=0;d<e.display.gutterSpecs.length;++d){var v=e.display.gutterSpecs[d].className,x=o.hasOwnProperty(v)&&o[v];x&&c.appendChild(T("div",[x],"CodeMirror-gutter-elt","left: "+r.gutterLeft[v]+"px; width: "+r.gutterWidth[v]+"px"))}}}function Pp(e,t,n){t.alignable&&(t.alignable=null);for(var r=Ce("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);au(e,t,n)}function Fp(e,t,n,r){var i=nu(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),bs(e,t),iu(e,t,n,r),au(e,t,r),t.node}function au(e,t,n){if(su(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)su(e,t.rest[r],t,n,!1)}function su(e,t,n,r,i){if(t.widgets)for(var o=li(n),u=0,c=t.widgets;u<c.length;++u){var d=c[u],v=T("div",[d.node],"CodeMirror-linewidget"+(d.className?" "+d.className:""));d.handleMouseEvents||v.setAttribute("cm-ignore-events","true"),Hp(d,v,n,r),e.display.input.setUneditable(v),i&&d.above?o.insertBefore(v,n.gutter||n.text):o.appendChild(v),et(d,"redraw")}}function Hp(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function ui(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Ze(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),Y(t.display.measure,T("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function gr(e,t){for(var n=ti(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function ua(e){return e.lineSpace.offsetTop}function ws(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function ou(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Y(e.measure,T("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function ir(e){return dt-e.display.nativeBarWidth}function Gr(e){return e.display.scroller.clientWidth-ir(e)-e.display.barWidth}function xs(e){return e.display.scroller.clientHeight-ir(e)-e.display.barHeight}function Wp(e,t,n){var r=e.options.lineWrapping,i=r&&Gr(e);if(!t.measure.heights||r&&t.measure.width!=i){var o=t.measure.heights=[];if(r){t.measure.width=i;for(var u=t.text.firstChild.getClientRects(),c=0;c<u.length-1;c++){var d=u[c],v=u[c+1];Math.abs(d.bottom-v.bottom)>2&&o.push((d.bottom+v.top)/2-n.top)}}o.push(n.bottom-n.top)}}function lu(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(m(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function Bp(e,t){t=Gt(t);var n=m(t),r=e.display.externalMeasured=new tu(e.doc,t,n);r.lineN=n;var i=r.built=Jl(e,r);return r.text=i.pre,Y(e.display.lineMeasure,i.pre),r}function uu(e,t,n,r){return ar(e,Sn(e,t),n,r)}function ks(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Yr(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function Sn(e,t){var n=m(t),r=ks(e,n);r&&!r.text?r=null:r&&r.changes&&(ru(e,r,n,_s(e)),e.curOp.forceUpdate=!0),r||(r=Bp(e,t));var i=lu(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function ar(e,t,n,r,i){t.before&&(n=-1);var o=n+(r||""),u;return t.cache.hasOwnProperty(o)?u=t.cache[o]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Wp(e,t.view,t.rect),t.hasHeights=!0),u=Up(e,t,n,r),u.bogus||(t.cache[o]=u)),{left:u.left,right:u.right,top:i?u.rtop:u.top,bottom:i?u.rbottom:u.bottom}}var fu={left:0,right:0,top:0,bottom:0};function cu(e,t,n){for(var r,i,o,u,c,d,v=0;v<e.length;v+=3)if(c=e[v],d=e[v+1],t<c?(i=0,o=1,u="left"):t<d?(i=t-c,o=i+1):(v==e.length-3||t==d&&e[v+3]>t)&&(o=d-c,i=o-1,t>=d&&(u="right")),i!=null){if(r=e[v+2],c==d&&n==(r.insertLeft?"left":"right")&&(u=n),n=="left"&&i==0)for(;v&&e[v-2]==e[v-3]&&e[v-1].insertLeft;)r=e[(v-=3)+2],u="left";if(n=="right"&&i==d-c)for(;v<e.length-3&&e[v+3]==e[v+4]&&!e[v+5].insertLeft;)r=e[(v+=3)+2],u="right";break}return{node:r,start:i,end:o,collapse:u,coverStart:c,coverEnd:d}}function $p(e,t){var n=fu;if(t=="left")for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;i>=0&&(n=e[i]).left==n.right;i--);return n}function Up(e,t,n,r){var i=cu(t.map,n,r),o=i.node,u=i.start,c=i.end,d=i.collapse,v;if(o.nodeType==3){for(var x=0;x<4;x++){for(;u&&Ge(t.line.text.charAt(i.coverStart+u));)--u;for(;i.coverStart+c<i.coverEnd&&Ge(t.line.text.charAt(i.coverStart+c));)++c;if(w&&b<9&&u==0&&c==i.coverEnd-i.coverStart?v=o.parentNode.getBoundingClientRect():v=$p(st(o,u,c).getClientRects(),r),v.left||v.right||u==0)break;c=u,u=u-1,d="right"}w&&b<11&&(v=jp(e.display.measure,v))}else{u>0&&(d=r="right");var C;e.options.lineWrapping&&(C=o.getClientRects()).length>1?v=C[r=="right"?C.length-1:0]:v=o.getBoundingClientRect()}if(w&&b<9&&!u&&(!v||!v.left&&!v.right)){var O=o.parentNode.getClientRects()[0];O?v={left:O.left,right:O.left+Tn(e.display),top:O.top,bottom:O.bottom}:v=fu}for(var _=v.top-t.rect.top,M=v.bottom-t.rect.top,F=(_+M)/2,U=t.view.measure.heights,j=0;j<U.length-1&&!(F<U[j]);j++);var K=j?U[j-1]:0,q=U[j],Q={left:(d=="right"?v.right:v.left)-t.rect.left,right:(d=="left"?v.left:v.right)-t.rect.left,top:K,bottom:q};return!v.left&&!v.right&&(Q.bogus=!0),e.options.singleCursorHeightPerLine||(Q.rtop=_,Q.rbottom=M),Q}function jp(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!cs(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function hu(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function du(e){e.display.externalMeasure=null,W(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)hu(e.display.view[t])}function fi(e){du(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function pu(e){return L&&R?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function gu(e){return L&&R?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function Ss(e){var t=Gt(e),n=t.widgets,r=0;if(n)for(var i=0;i<n.length;++i)n[i].above&&(r+=ui(n[i]));return r}function fa(e,t,n,r,i){if(!i){var o=Ss(t);n.top+=o,n.bottom+=o}if(r=="line")return n;r||(r="local");var u=pr(t);if(r=="local"?u+=ua(e.display):u-=e.display.viewOffset,r=="page"||r=="window"){var c=e.display.lineSpace.getBoundingClientRect();u+=c.top+(r=="window"?0:gu(At(e)));var d=c.left+(r=="window"?0:pu(At(e)));n.left+=d,n.right+=d}return n.top+=u,n.bottom+=u,n}function vu(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=pu(At(e)),i-=gu(At(e));else if(n=="local"||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var u=e.display.lineSpace.getBoundingClientRect();return{left:r-u.left,top:i-u.top}}function ca(e,t,n,r,i){return r||(r=V(e.doc,t.line)),fa(e,r,uu(e,r,t.ch,i),n)}function Xt(e,t,n,r,i,o){r=r||V(e.doc,t.line),i||(i=Sn(e,r));function u(M,F){var U=ar(e,i,M,F?"right":"left",o);return F?U.left=U.right:U.right=U.left,fa(e,r,U,n)}var c=ge(r,e.doc.direction),d=t.ch,v=t.sticky;if(d>=r.text.length?(d=r.text.length,v="before"):d<=0&&(d=0,v="after"),!c)return u(v=="before"?d-1:d,v=="before");function x(M,F,U){var j=c[F],K=j.level==1;return u(U?M-1:M,K!=U)}var C=Sr(c,d,v),O=jr,_=x(d,C,v=="before");return O!=null&&(_.other=x(d,O,v!="before")),_}function mu(e,t){var n=0;t=ae(e.doc,t),e.options.lineWrapping||(n=Tn(e.display)*t.ch);var r=V(e.doc,t.line),i=pr(r)+ua(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function Cs(e,t,n,r,i){var o=I(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Ts(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return Cs(r.first,0,null,-1,-1);var i=S(r,n),o=r.first+r.size-1;if(i>o)return Cs(r.first+r.size-1,V(r,o).text.length,null,1,1);t<0&&(t=0);for(var u=V(r,i);;){var c=qp(e,u,i,t,n),d=bp(u,c.ch+(c.xRel>0||c.outside>0?1:0));if(!d)return c;var v=d.find(1);if(v.line==i)return v;u=V(r,i=v.line)}}function yu(e,t,n,r){r-=Ss(t);var i=t.text.length,o=tr(function(u){return ar(e,n,u-1).bottom<=r},i,0);return i=tr(function(u){return ar(e,n,u).top>r},o,i),{begin:o,end:i}}function bu(e,t,n,r){n||(n=Sn(e,t));var i=fa(e,t,ar(e,n,r),"line").top;return yu(e,t,n,i)}function Ls(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function qp(e,t,n,r,i){i-=pr(t);var o=Sn(e,t),u=Ss(t),c=0,d=t.text.length,v=!0,x=ge(t,e.doc.direction);if(x){var C=(e.options.lineWrapping?Xp:Gp)(e,t,n,o,x,r,i);v=C.level!=1,c=v?C.from:C.to-1,d=v?C.to:C.from-1}var O=null,_=null,M=tr(function(re){var J=ar(e,o,re);return J.top+=u,J.bottom+=u,Ls(J,r,i,!1)?(J.top<=i&&J.left<=r&&(O=re,_=J),!0):!1},c,d),F,U,j=!1;if(_){var K=r-_.left<_.right-r,q=K==v;M=O+(q?0:1),U=q?"after":"before",F=K?_.left:_.right}else{!v&&(M==d||M==c)&&M++,U=M==0?"after":M==t.text.length?"before":ar(e,o,M-(v?1:0)).bottom+u<=i==v?"after":"before";var Q=Xt(e,I(n,M,U),"line",t,o);F=Q.left,j=i<Q.top?-1:i>=Q.bottom?1:0}return M=xr(t.text,M,1),Cs(n,M,U,j,r-F)}function Gp(e,t,n,r,i,o,u){var c=tr(function(C){var O=i[C],_=O.level!=1;return Ls(Xt(e,I(n,_?O.to:O.from,_?"before":"after"),"line",t,r),o,u,!0)},0,i.length-1),d=i[c];if(c>0){var v=d.level!=1,x=Xt(e,I(n,v?d.from:d.to,v?"after":"before"),"line",t,r);Ls(x,o,u,!0)&&x.top>u&&(d=i[c-1])}return d}function Xp(e,t,n,r,i,o,u){var c=yu(e,t,r,u),d=c.begin,v=c.end;/\s/.test(t.text.charAt(v-1))&&v--;for(var x=null,C=null,O=0;O<i.length;O++){var _=i[O];if(!(_.from>=v||_.to<=d)){var M=_.level!=1,F=ar(e,r,M?Math.min(v,_.to)-1:Math.max(d,_.from)).right,U=F<o?o-F+1e9:F-o;(!x||C>U)&&(x=_,C=U)}}return x||(x=i[i.length-1]),x.from<d&&(x={from:d,to:x.to,level:x.level}),x.to>v&&(x={from:x.from,to:v,level:x.level}),x}var Xr;function Cn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Xr==null){Xr=T("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Xr.appendChild(document.createTextNode("x")),Xr.appendChild(T("br"));Xr.appendChild(document.createTextNode("x"))}Y(e.measure,Xr);var n=Xr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),W(e.measure),n||1}function Tn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=T("span","xxxxxxxxxx"),n=T("pre",[t],"CodeMirror-line-like");Y(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function _s(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,u=0;o;o=o.nextSibling,++u){var c=e.display.gutterSpecs[u].className;n[c]=o.offsetLeft+o.clientLeft+i,r[c]=o.clientWidth}return{fixedPos:As(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function As(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function wu(e){var t=Cn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Tn(e.display)-3);return function(i){if(Ar(e.doc,i))return 0;var o=0;if(i.widgets)for(var u=0;u<i.widgets.length;u++)i.widgets[u].height&&(o+=i.widgets[u].height);return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function Os(e){var t=e.doc,n=wu(e);t.iter(function(r){var i=n(r);i!=r.height&&Dt(r,i)})}function Kr(e,t,n,r){var i=e.display;if(!n&&ti(t).getAttribute("cm-not-content")=="true")return null;var o,u,c=i.lineSpace.getBoundingClientRect();try{o=t.clientX-c.left,u=t.clientY-c.top}catch{return null}var d=Ts(e,o,u),v;if(r&&d.xRel>0&&(v=V(e.doc,d.line).text).length==d.ch){var x=xe(v,v.length,e.options.tabSize)-v.length;d=I(d.line,Math.max(0,Math.round((o-ou(e.display).left)/Tn(e.display))-x))}return d}function Yr(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function yt(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)dr&&vs(e.doc,t)<i.viewTo&&Er(e);else if(n<=i.viewFrom)dr&&Ql(e.doc,n+r)>i.viewFrom?Er(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Er(e);else if(t<=i.viewFrom){var o=ha(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):Er(e)}else if(n>=i.viewTo){var u=ha(e,t,t,-1);u?(i.view=i.view.slice(0,u.index),i.viewTo=u.lineN):Er(e)}else{var c=ha(e,t,t,-1),d=ha(e,n,n+r,1);c&&d?(i.view=i.view.slice(0,c.index).concat(la(e,c.lineN,d.lineN)).concat(i.view.slice(d.index)),i.viewTo+=r):Er(e)}var v=i.externalMeasured;v&&(n<v.lineN?v.lineN+=r:t<v.lineN+v.size&&(i.externalMeasured=null))}function Or(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[Yr(e,t)];if(o.node!=null){var u=o.changes||(o.changes=[]);fe(u,n)==-1&&u.push(n)}}}function Er(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ha(e,t,n,r){var i=Yr(e,t),o,u=e.display.view;if(!dr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var c=e.display.viewFrom,d=0;d<i;d++)c+=u[d].size;if(c!=t){if(r>0){if(i==u.length-1)return null;o=c+u[i].size-t,i++}else o=c-t;t+=o,n+=o}for(;vs(e.doc,n)!=n;){if(i==(r<0?0:u.length-1))return null;n+=r*u[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Kp(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=la(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=la(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Yr(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(la(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Yr(e,n)))),r.viewTo=n}function xu(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function ci(e){e.display.input.showSelection(e.display.input.prepareSelection())}function ku(e,t){t===void 0&&(t=!0);var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),u=e.options.$customCursor;u&&(t=!0);for(var c=0;c<n.sel.ranges.length;c++)if(!(!t&&c==n.sel.primIndex)){var d=n.sel.ranges[c];if(!(d.from().line>=e.display.viewTo||d.to().line<e.display.viewFrom)){var v=d.empty();if(u){var x=u(e,d);x&&Es(e,x,i)}else(v||e.options.showCursorWhenSelecting)&&Es(e,d.head,i);v||Yp(e,d,o)}}return r}function Es(e,t,n){var r=Xt(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(T("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var o=ca(e,t,"div",null,null),u=o.right-o.left;i.style.width=(u>0?u:e.defaultCharWidth())+"px"}if(r.other){var c=n.appendChild(T("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));c.style.display="",c.style.left=r.other.left+"px",c.style.top=r.other.top+"px",c.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function da(e,t){return e.top-t.top||e.left-t.left}function Yp(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),u=ou(e.display),c=u.left,d=Math.max(r.sizerWidth,Gr(e)-r.sizer.offsetLeft)-u.right,v=i.direction=="ltr";function x(q,Q,re,J){Q<0&&(Q=0),Q=Math.round(Q),J=Math.round(J),o.appendChild(T("div",null,"CodeMirror-selected","position: absolute; left: "+q+`px;
6
+ top: `+Q+"px; width: "+(re??d-q)+`px;
7
+ height: `+(J-Q)+"px"))}function C(q,Q,re){var J=V(i,q),ce=J.text.length,Le,nt;function Me(Xe,xt){return ca(e,I(q,Xe),"div",J,xt)}function Tt(Xe,xt,at){var Ye=bu(e,J,null,Xe),Ke=xt=="ltr"==(at=="after")?"left":"right",We=at=="after"?Ye.begin:Ye.end-(/\s/.test(J.text.charAt(Ye.end-1))?2:1);return Me(We,Ke)[Ke]}var wt=ge(J,i.direction);return kr(wt,Q||0,re??ce,function(Xe,xt,at,Ye){var Ke=at=="ltr",We=Me(Xe,Ke?"left":"right"),kt=Me(xt-1,Ke?"right":"left"),Fn=Q==null&&Xe==0,zr=re==null&&xt==ce,ft=Ye==0,sr=!wt||Ye==wt.length-1;if(kt.top-We.top<=3){var it=(v?Fn:zr)&&ft,no=(v?zr:Fn)&&sr,yr=it?c:(Ke?We:kt).left,en=no?d:(Ke?kt:We).right;x(yr,We.top,en-yr,We.bottom)}else{var tn,gt,Hn,io;Ke?(tn=v&&Fn&&ft?c:We.left,gt=v?d:Tt(Xe,at,"before"),Hn=v?c:Tt(xt,at,"after"),io=v&&zr&&sr?d:kt.right):(tn=v?Tt(Xe,at,"before"):c,gt=!v&&Fn&&ft?d:We.right,Hn=!v&&zr&&sr?c:kt.left,io=v?Tt(xt,at,"after"):d),x(tn,We.top,gt-tn,We.bottom),We.bottom<kt.top&&x(c,We.bottom,null,kt.top),x(Hn,kt.top,io-Hn,kt.bottom)}(!Le||da(We,Le)<0)&&(Le=We),da(kt,Le)<0&&(Le=kt),(!nt||da(We,nt)<0)&&(nt=We),da(kt,nt)<0&&(nt=kt)}),{start:Le,end:nt}}var O=t.from(),_=t.to();if(O.line==_.line)C(O.line,O.ch,_.ch);else{var M=V(i,O.line),F=V(i,_.line),U=Gt(M)==Gt(F),j=C(O.line,O.ch,U?M.text.length+1:null).end,K=C(_.line,U?0:null,_.ch).start;U&&(j.top<K.top-2?(x(j.right,j.top,null,j.bottom),x(c,K.top,K.left,K.bottom)):x(j.right,j.top,K.left-j.right,j.bottom)),j.bottom<K.top&&x(c,j.bottom,null,K.top)}n.appendChild(o)}function Ds(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Ln(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Su(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ns(e))}function Is(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Ln(e))},100)}function Ns(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Pe(e,"focus",e,t),e.state.focused=!0,ze(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),k&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ds(e))}function Ln(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Pe(e,"blur",e,t),e.state.focused=!1,ct(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function pa(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,o=0,u=0;u<t.view.length;u++){var c=t.view[u],d=e.options.lineWrapping,v=void 0,x=0;if(!c.hidden){if(i+=c.line.height,w&&b<8){var C=c.node.offsetTop+c.node.offsetHeight;v=C-n,n=C}else{var O=c.node.getBoundingClientRect();v=O.bottom-O.top,!d&&c.text.firstChild&&(x=c.text.firstChild.getBoundingClientRect().right-O.left-1)}var _=c.line.height-v;if((_>.005||_<-.005)&&(i<r&&(o-=_),Dt(c.line,v),Cu(c.line),c.rest))for(var M=0;M<c.rest.length;M++)Cu(c.rest[M]);if(x>e.display.sizerWidth){var F=Math.ceil(x/Tn(e.display));F>e.display.maxLineLength&&(e.display.maxLineLength=F,e.display.maxLine=c.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function Cu(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function ga(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-ua(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,o=S(t,r),u=S(t,i);if(n&&n.ensure){var c=n.ensure.from.line,d=n.ensure.to.line;c<o?(o=c,u=S(t,pr(V(t,c))+e.wrapper.clientHeight)):Math.min(d,t.lastLine())>=u&&(o=S(t,pr(V(t,d))-e.wrapper.clientHeight),u=d)}return{from:o,to:Math.max(u,o+1)}}function Zp(e,t){if(!Fe(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null,o=n.wrapper.ownerDocument;if(t.top+r.top<0?i=!0:t.bottom+r.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)&&(i=!1),i!=null&&!E){var u=T("div","​",null,`position: absolute;
8
+ top: `+(t.top-n.viewOffset-ua(e.display))+`px;
9
+ height: `+(t.bottom-t.top+ir(e)+n.barHeight)+`px;
10
+ left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(u),u.scrollIntoView(i),e.display.lineSpace.removeChild(u)}}}function Qp(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?I(t.line,t.ch+1,"before"):t,t=t.ch?I(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var u=!1,c=Xt(e,t),d=!n||n==t?c:Xt(e,n);i={left:Math.min(c.left,d.left),top:Math.min(c.top,d.top)-r,right:Math.max(c.left,d.left),bottom:Math.max(c.bottom,d.bottom)+r};var v=Ms(e,i),x=e.doc.scrollTop,C=e.doc.scrollLeft;if(v.scrollTop!=null&&(di(e,v.scrollTop),Math.abs(e.doc.scrollTop-x)>1&&(u=!0)),v.scrollLeft!=null&&(Zr(e,v.scrollLeft),Math.abs(e.doc.scrollLeft-C)>1&&(u=!0)),!u)break}return i}function Vp(e,t){var n=Ms(e,t);n.scrollTop!=null&&di(e,n.scrollTop),n.scrollLeft!=null&&Zr(e,n.scrollLeft)}function Ms(e,t){var n=e.display,r=Cn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,o=xs(e),u={};t.bottom-t.top>o&&(t.bottom=t.top+o);var c=e.doc.height+ws(n),d=t.top<r,v=t.bottom>c-r;if(t.top<i)u.scrollTop=d?0:t.top;else if(t.bottom>i+o){var x=Math.min(t.top,(v?c:t.bottom)-o);x!=i&&(u.scrollTop=x)}var C=e.options.fixedGutter?0:n.gutters.offsetWidth,O=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-C,_=Gr(e)-n.gutters.offsetWidth,M=t.right-t.left>_;return M&&(t.right=t.left+_),t.left<10?u.scrollLeft=0:t.left<O?u.scrollLeft=Math.max(0,t.left+C-(M?0:10)):t.right>_+O-3&&(u.scrollLeft=t.right+(M?0:10)-_),u}function Rs(e,t){t!=null&&(va(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function _n(e){va(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function hi(e,t,n){(t!=null||n!=null)&&va(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Jp(e,t){va(e),e.curOp.scrollToPos=t}function va(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=mu(e,t.from),r=mu(e,t.to);Tu(e,n,r,t.margin)}}function Tu(e,t,n,r){var i=Ms(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});hi(e,i.scrollLeft,i.scrollTop)}function di(e,t){Math.abs(e.doc.scrollTop-t)<2||(h||Ps(e,{top:t}),Lu(e,t,!0),h&&Ps(e),vi(e,100))}function Lu(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Zr(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Du(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function pi(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ws(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+ir(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Qr=function(e,t,n){this.cm=n;var r=this.vert=T("div",[T("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=T("div",[T("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),te(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),te(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,w&&b<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Qr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(r==0&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Qr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Qr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Qr.prototype.zeroWidthHack=function(){var e=Z&&!N?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new Vt,this.disableVert=new Vt},Qr.prototype.enableZeroWidthBar=function(e,t,n){e.style.visibility="";function r(){var i=e.getBoundingClientRect(),o=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},Qr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var gi=function(){};gi.prototype.update=function(){return{bottom:0,right:0}},gi.prototype.setScrollLeft=function(){},gi.prototype.setScrollTop=function(){},gi.prototype.clear=function(){};function An(e,t){t||(t=pi(e));var n=e.display.barWidth,r=e.display.barHeight;_u(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&pa(e),_u(e,pi(e)),n=e.display.barWidth,r=e.display.barHeight}function _u(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var Au={native:Qr,null:gi};function Ou(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&ct(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Au[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),te(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){n=="horizontal"?Zr(e,t):di(e,t)},e),e.display.scrollbars.addClass&&ze(e.display.wrapper,e.display.scrollbars.addClass)}var eg=0;function Vr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++eg,markArrays:null},Dp(e.curOp)}function Jr(e){var t=e.curOp;t&&Np(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;tg(n)})}function tg(e){for(var t=e.ops,n=0;n<t.length;n++)rg(t[n]);for(var r=0;r<t.length;r++)ng(t[r]);for(var i=0;i<t.length;i++)ig(t[i]);for(var o=0;o<t.length;o++)ag(t[o]);for(var u=0;u<t.length;u++)sg(t[u])}function rg(e){var t=e.cm,n=t.display;lg(t),e.updateMaxLine&&ys(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ma(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function ng(e){e.updatedDisplay=e.mustUpdate&&zs(e.cm,e.update)}function ig(e){var t=e.cm,n=t.display;e.updatedDisplay&&pa(t),e.barMeasure=pi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=uu(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+ir(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Gr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function ag(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Zr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==qe(Wt(t));e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&An(t,e.barMeasure),e.updatedDisplay&&Hs(t,e.barMeasure),e.selectionChanged&&Ds(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Su(e.cm)}function sg(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Eu(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&Lu(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Zr(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Qp(t,ae(r,e.scrollToPos.from),ae(r,e.scrollToPos.to),e.scrollToPos.margin);Zp(t,i)}var o=e.maybeHiddenMarkers,u=e.maybeUnhiddenMarkers;if(o)for(var c=0;c<o.length;++c)o[c].lines.length||Pe(o[c],"hide");if(u)for(var d=0;d<u.length;++d)u[d].lines.length&&Pe(u[d],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Pe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ct(e,t){if(e.curOp)return t();Vr(e);try{return t()}finally{Jr(e)}}function tt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Vr(e);try{return t.apply(e,arguments)}finally{Jr(e)}}}function pt(e){return function(){if(this.curOp)return e.apply(this,arguments);Vr(this);try{return e.apply(this,arguments)}finally{Jr(this)}}}function rt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Vr(t);try{return e.apply(this,arguments)}finally{Jr(t)}}}function vi(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,ie(og,e))}function og(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=ai(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var u=o.styles,c=o.text.length>e.options.maxHighlightLength?rr(t.mode,r.state):null,d=Pl(e,o,r,!0);c&&(r.state=c),o.styles=d.styles;var v=o.styleClasses,x=d.classes;x?o.styleClasses=x:v&&(o.styleClasses=null);for(var C=!u||u.length!=o.styles.length||v!=x&&(!v||!x||v.bgClass!=x.bgClass||v.textClass!=x.textClass),O=0;!C&&O<u.length;++O)C=u[O]!=o.styles[O];C&&i.push(r.line),o.stateAfter=r.save(),r.nextLine()}else o.text.length<=e.options.maxHighlightLength&&hs(e,o.text,r),o.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return vi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Ct(e,function(){for(var o=0;o<i.length;o++)Or(e,i[o],"text")})}}var ma=function(e,t,n){var r=e.display;this.viewport=t,this.visible=ga(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Gr(e),this.force=n,this.dims=_s(e),this.events=[]};ma.prototype.signal=function(e,t){St(e,t)&&this.events.push(arguments)},ma.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Pe.apply(null,this.events[e])};function lg(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=ir(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=ir(e)+"px",t.scrollbarsClipped=!0)}function ug(e){if(e.hasFocus())return null;var t=qe(Wt(e));if(!t||!Ze(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=oe(e).getSelection();r.anchorNode&&r.extend&&Ze(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function fg(e){if(!(!e||!e.activeElt||e.activeElt==qe(Ve(e.activeElt)))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&Ze(document.body,e.anchorNode)&&Ze(document.body,e.focusNode))){var t=e.activeElt.ownerDocument,n=t.defaultView.getSelection(),r=t.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),n.removeAllRanges(),n.addRange(r),n.extend(e.focusNode,e.focusOffset)}}function zs(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return Er(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&xu(e)==0)return!1;Iu(e)&&(Er(e),t.dims=_s(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),u=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>u&&n.viewTo-u<20&&(u=Math.min(i,n.viewTo)),dr&&(o=vs(e.doc,o),u=Ql(e.doc,u));var c=o!=n.viewFrom||u!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Kp(e,o,u),n.viewOffset=pr(V(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var d=xu(e);if(!c&&d==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var v=ug(e);return d>4&&(n.lineDiv.style.display="none"),cg(e,n.updateLineNumbers,t.dims),d>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,fg(v),W(n.cursorDiv),W(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,c&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,vi(e,400)),n.updateLineNumbers=null,!0}function Eu(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Gr(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ws(e.display)-xs(e),n.top)}),t.visible=ga(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ga(e.display,e.doc,n));if(!zs(e,t))break;pa(e);var i=pi(e);ci(e),An(e,i),Hs(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Ps(e,t){var n=new ma(e,t);if(zs(e,n)){pa(e),Eu(e,n);var r=pi(e);ci(e),An(e,r),Hs(e,r),n.finish()}}function cg(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,u=o.firstChild;function c(M){var F=M.nextSibling;return k&&Z&&e.display.currentWheelTarget==M?M.style.display="none":M.parentNode.removeChild(M),F}for(var d=r.view,v=r.viewFrom,x=0;x<d.length;x++){var C=d[x];if(!C.hidden)if(!C.node||C.node.parentNode!=o){var O=Fp(e,C,v,n);o.insertBefore(O,u)}else{for(;u!=C.node;)u=c(u);var _=i&&t!=null&&t<=v&&C.lineNumber;C.changes&&(fe(C.changes,"gutter")>-1&&(_=!1),ru(e,C,v,n)),_&&(W(C.lineNumber),C.lineNumber.appendChild(document.createTextNode(B(e.options,v)))),u=C.node.nextSibling}v+=C.size}for(;u;)u=c(u)}function Fs(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",et(e,"gutterChanged",e)}function Hs(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+ir(e)+"px"}function Du(e){var t=e.display,n=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=As(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",u=0;u<n.length;u++)if(!n[u].hidden){e.options.fixedGutter&&(n[u].gutter&&(n[u].gutter.style.left=o),n[u].gutterBackground&&(n[u].gutterBackground.style.left=o));var c=n[u].alignable;if(c)for(var d=0;d<c.length;d++)c[d].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function Iu(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=B(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(T("div",[T("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,u=i.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-u)+1,r.lineNumWidth=r.lineNumInnerWidth+u,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Fs(e.display),!0}return!1}function Ws(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var o=e[i],u=null;if(typeof o!="string"&&(u=o.style,o=o.className),o=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:o,style:u})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Nu(e){var t=e.gutters,n=e.gutterSpecs;W(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],o=i.className,u=i.style,c=t.appendChild(T("div",null,"CodeMirror-gutter "+o));u&&(c.style.cssText=u),o=="CodeMirror-linenumbers"&&(e.lineGutter=c,c.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Fs(e)}function mi(e){Nu(e.display),yt(e),Du(e)}function hg(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=T("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=T("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=ht("div",null,"CodeMirror-code"),i.selectionDiv=T("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=T("div",null,"CodeMirror-cursors"),i.measure=T("div",null,"CodeMirror-measure"),i.lineMeasure=T("div",null,"CodeMirror-measure"),i.lineSpace=ht("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var o=ht("div",[i.lineSpace],"CodeMirror-lines");i.mover=T("div",[o],null,"position: relative"),i.sizer=T("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=T("div",null,null,"position: absolute; height: "+dt+"px; width: 1px;"),i.gutters=T("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=T("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=T("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),L&&H===105&&(i.wrapper.style.clipPath="inset(0px)"),i.wrapper.setAttribute("translate","no"),w&&b<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!k&&!(h&&G)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=Ws(r.gutters,r.lineNumbers),Nu(i),n.init(i)}var ya=0,vr=null;w?vr=-.53:h?vr=15:L?vr=-.7:$&&(vr=-1/3);function Mu(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function dg(e){var t=Mu(e);return t.x*=vr,t.y*=vr,t}function Ru(e,t){L&&H==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var n=Mu(t),r=n.x,i=n.y,o=vr;t.deltaMode===0&&(r=t.deltaX,i=t.deltaY,o=1);var u=e.display,c=u.scroller,d=c.scrollWidth>c.clientWidth,v=c.scrollHeight>c.clientHeight;if(r&&d||i&&v){if(i&&Z&&k){e:for(var x=t.target,C=u.view;x!=c;x=x.parentNode)for(var O=0;O<C.length;O++)if(C[O].node==x){e.display.currentWheelTarget=x;break e}}if(r&&!h&&!P&&o!=null){i&&v&&di(e,Math.max(0,c.scrollTop+i*o)),Zr(e,Math.max(0,c.scrollLeft+r*o)),(!i||i&&v)&&lt(t),u.wheelStartX=null;return}if(i&&o!=null){var _=i*o,M=e.doc.scrollTop,F=M+u.wrapper.clientHeight;_<0?M=Math.max(0,M+_-50):F=Math.min(e.doc.height,F+_+50),Ps(e,{top:M,bottom:F})}ya<20&&t.deltaMode!==0&&(u.wheelStartX==null?(u.wheelStartX=c.scrollLeft,u.wheelStartY=c.scrollTop,u.wheelDX=r,u.wheelDY=i,setTimeout(function(){if(u.wheelStartX!=null){var U=c.scrollLeft-u.wheelStartX,j=c.scrollTop-u.wheelStartY,K=j&&u.wheelDY&&j/u.wheelDY||U&&u.wheelDX&&U/u.wheelDX;u.wheelStartX=u.wheelStartY=null,K&&(vr=(vr*ya+K)/(ya+1),++ya)}},200)):(u.wheelDX+=r,u.wheelDY+=i))}}var It=function(e,t){this.ranges=e,this.primIndex=t};It.prototype.primary=function(){return this.ranges[this.primIndex]},It.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!ye(n.anchor,r.anchor)||!ye(n.head,r.head))return!1}return!0},It.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new be(Je(this.ranges[t].anchor),Je(this.ranges[t].head));return new It(e,this.primIndex)},It.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},It.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(X(t,r.from())>=0&&X(e,r.to())<=0)return n}return-1};var be=function(e,t){this.anchor=e,this.head=t};be.prototype.from=function(){return wn(this.anchor,this.head)},be.prototype.to=function(){return mt(this.anchor,this.head)},be.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Kt(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(O,_){return X(O.from(),_.from())}),n=fe(t,i);for(var o=1;o<t.length;o++){var u=t[o],c=t[o-1],d=X(c.to(),u.from());if(r&&!u.empty()?d>0:d>=0){var v=wn(c.from(),u.from()),x=mt(c.to(),u.to()),C=c.empty()?u.from()==u.head:c.from()==c.head;o<=n&&--n,t.splice(--o,2,new be(C?x:v,C?v:x))}}return new It(t,n)}function Dr(e,t){return new It([new be(e,t||e)],0)}function Ir(e){return e.text?I(e.from.line+e.text.length-1,me(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function zu(e,t){if(X(e,t.from)<0)return e;if(X(e,t.to)<=0)return Ir(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Ir(t).ch-t.to.ch),I(n,r)}function Bs(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new be(zu(i.anchor,t),zu(i.head,t)))}return Kt(e.cm,n,e.sel.primIndex)}function Pu(e,t,n){return e.line==t.line?I(n.line,e.ch-t.ch+n.ch):I(n.line+(e.line-t.line),e.ch)}function pg(e,t,n){for(var r=[],i=I(e.first,0),o=i,u=0;u<t.length;u++){var c=t[u],d=Pu(c.from,i,o),v=Pu(Ir(c),i,o);if(i=c.to,o=v,n=="around"){var x=e.sel.ranges[u],C=X(x.head,x.anchor)<0;r[u]=new be(C?v:d,C?d:v)}else r[u]=new be(d,d)}return new It(r,e.sel.primIndex)}function $s(e){e.doc.mode=mn(e.options,e.doc.modeOption),yi(e)}function yi(e){e.doc.iter(function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,vi(e,100),e.state.modeGen++,e.curOp&&yt(e)}function Fu(e,t){return t.from.ch==0&&t.to.ch==0&&me(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Us(e,t,n,r){function i(K){return n?n[K]:null}function o(K,q,Q){kp(K,q,Q,r),et(K,"change",K,t)}function u(K,q){for(var Q=[],re=K;re<q;++re)Q.push(new xn(v[re],i(re),r));return Q}var c=t.from,d=t.to,v=t.text,x=V(e,c.line),C=V(e,d.line),O=me(v),_=i(v.length-1),M=d.line-c.line;if(t.full)e.insert(0,u(0,v.length)),e.remove(v.length,e.size-v.length);else if(Fu(e,t)){var F=u(0,v.length-1);o(C,C.text,_),M&&e.remove(c.line,M),F.length&&e.insert(c.line,F)}else if(x==C)if(v.length==1)o(x,x.text.slice(0,c.ch)+O+x.text.slice(d.ch),_);else{var U=u(1,v.length-1);U.push(new xn(O+x.text.slice(d.ch),_,r)),o(x,x.text.slice(0,c.ch)+v[0],i(0)),e.insert(c.line+1,U)}else if(v.length==1)o(x,x.text.slice(0,c.ch)+v[0]+C.text.slice(d.ch),i(0)),e.remove(c.line+1,M);else{o(x,x.text.slice(0,c.ch)+v[0],i(0)),o(C,O+C.text.slice(d.ch),_);var j=u(1,v.length-1);M>1&&e.remove(c.line+1,M-1),e.insert(c.line+1,j)}et(e,"change",e,t)}function Nr(e,t,n){function r(i,o,u){if(i.linked)for(var c=0;c<i.linked.length;++c){var d=i.linked[c];if(d.doc!=o){var v=u&&d.sharedHist;n&&!v||(t(d.doc,v),r(d.doc,i,v))}}}r(e,null,!0)}function Hu(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Os(e),$s(e),Wu(e),e.options.direction=t.direction,e.options.lineWrapping||ys(e),e.options.mode=t.modeOption,yt(e)}function Wu(e){(e.doc.direction=="rtl"?ze:ct)(e.display.lineDiv,"CodeMirror-rtl")}function gg(e){Ct(e,function(){Wu(e),yt(e)})}function ba(e){this.done=[],this.undone=[],this.undoDepth=e?e.undoDepth:1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e?e.maxGeneration:1}function js(e,t){var n={from:Je(t.from),to:Ir(t),text:hr(e,t.from,t.to)};return Uu(e,n,t.from.line,t.to.line+1),Nr(e,function(r){return Uu(r,n,t.from.line,t.to.line+1)},!0),n}function Bu(e){for(;e.length;){var t=me(e);if(t.ranges)e.pop();else break}}function vg(e,t){if(t)return Bu(e.done),me(e.done);if(e.done.length&&!me(e.done).ranges)return me(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),me(e.done)}function $u(e,t,n,r){var i=e.history;i.undone.length=0;var o=+new Date,u,c;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(u=vg(i,i.lastOp==r)))c=me(u.changes),X(t.from,t.to)==0&&X(t.from,c.to)==0?c.to=Ir(t):u.changes.push(js(e,t));else{var d=me(i.done);for((!d||!d.ranges)&&wa(e.sel,i.done),u={changes:[js(e,t)],generation:i.generation},i.done.push(u);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=o,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,c||Pe(e,"historyAdded")}function mg(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function yg(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||mg(e,o,me(i.done),t))?i.done[i.done.length-1]=t:wa(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&Bu(i.undone)}function wa(e,t){var n=me(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Uu(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(u){u.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=u.markedSpans),++o})}function bg(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function wg(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(bg(n[i]));return r}function ju(e,t){var n=wg(e,t),r=ps(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],u=r[i];if(o&&u)e:for(var c=0;c<u.length;++c){for(var d=u[c],v=0;v<o.length;++v)if(o[v].marker==d.marker)continue e;o.push(d)}else u&&(n[i]=u)}return n}function On(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges){r.push(n?It.prototype.deepCopy.call(o):o);continue}var u=o.changes,c=[];r.push({changes:c});for(var d=0;d<u.length;++d){var v=u[d],x=void 0;if(c.push({from:v.from,to:v.to,text:v.text}),t)for(var C in v)(x=C.match(/^spans_(\d+)$/))&&fe(t,Number(x[1]))>-1&&(me(c)[C]=v[C],delete v[C])}}return r}function qs(e,t,n,r){if(r){var i=e.anchor;if(n){var o=X(t,i)<0;o!=X(n,i)<0?(i=t,t=n):o!=X(t,n)<0&&(t=n)}return new be(i,t)}else return new be(n||t,t)}function xa(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),ut(e,new It([qs(e.sel.primary(),t,n,i)],0),r)}function qu(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)r[o]=qs(e.sel.ranges[o],t[o],null,i);var u=Kt(e.cm,r,e.sel.primIndex);ut(e,u,n)}function Gs(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,ut(e,Kt(e.cm,i,e.sel.primIndex),r)}function Gu(e,t,n,r){ut(e,Dr(t,n),r)}function xg(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var o=0;o<i.length;o++)this.ranges[o]=new be(ae(e,i[o].anchor),ae(e,i[o].head))},origin:n&&n.origin};return Pe(e,"beforeSelectionChange",e,r),e.cm&&Pe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Kt(e.cm,r.ranges,r.ranges.length-1):t}function Xu(e,t,n){var r=e.history.done,i=me(r);i&&i.ranges?(r[r.length-1]=t,ka(e,t,n)):ut(e,t,n)}function ut(e,t,n){ka(e,t,n),yg(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function ka(e,t,n){(St(e,"beforeSelectionChange")||e.cm&&St(e.cm,"beforeSelectionChange"))&&(t=xg(e,t,n));var r=n&&n.bias||(X(t.primary().head,e.sel.primary().head)<0?-1:1);Ku(e,Zu(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&e.cm.getOption("readOnly")!="nocursor"&&_n(e.cm)}function Ku(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,zt(e.cm)),et(e,"cursorActivity",e))}function Yu(e){Ku(e,Zu(e,e.sel,null,!1))}function Zu(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var u=t.ranges[o],c=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],d=Sa(e,u.anchor,c&&c.anchor,n,r),v=u.head==u.anchor?d:Sa(e,u.head,c&&c.head,n,r);(i||d!=u.anchor||v!=u.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new be(d,v))}return i?Kt(e.cm,i,t.primIndex):t}function En(e,t,n,r,i){var o=V(e,t.line);if(o.markedSpans)for(var u=0;u<o.markedSpans.length;++u){var c=o.markedSpans[u],d=c.marker,v="selectLeft"in d?!d.selectLeft:d.inclusiveLeft,x="selectRight"in d?!d.selectRight:d.inclusiveRight;if((c.from==null||(v?c.from<=t.ch:c.from<t.ch))&&(c.to==null||(x?c.to>=t.ch:c.to>t.ch))){if(i&&(Pe(d,"beforeCursorEnter"),d.explicitlyCleared))if(o.markedSpans){--u;continue}else break;if(!d.atomic)continue;if(n){var C=d.find(r<0?1:-1),O=void 0;if((r<0?x:v)&&(C=Qu(e,C,-r,C&&C.line==t.line?o:null)),C&&C.line==t.line&&(O=X(C,n))&&(r<0?O<0:O>0))return En(e,C,t,r,i)}var _=d.find(r<0?-1:1);return(r<0?v:x)&&(_=Qu(e,_,r,_.line==t.line?o:null)),_?En(e,_,t,r,i):null}}return t}function Sa(e,t,n,r,i){var o=r||1,u=En(e,t,n,o,i)||!i&&En(e,t,n,o,!0)||En(e,t,n,-o,i)||!i&&En(e,t,n,-o,!0);return u||(e.cantEdit=!0,I(e.first,0))}function Qu(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ae(e,I(t.line-1)):null:n>0&&t.ch==(r||V(e,t.line)).text.length?t.line<e.first+e.size-1?I(t.line+1,0):null:new I(t.line,t.ch+n)}function Vu(e){e.setSelection(I(e.firstLine(),0),I(e.lastLine()),Ot)}function Ju(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,o,u,c){i&&(r.from=ae(e,i)),o&&(r.to=ae(e,o)),u&&(r.text=u),c!==void 0&&(r.origin=c)}),Pe(e,"beforeChange",e,r),e.cm&&Pe(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Dn(e,t,n){if(e.cm){if(!e.cm.curOp)return tt(e.cm,Dn)(e,t,n);if(e.cm.state.suppressEdits)return}if(!((St(e,"beforeChange")||e.cm&&St(e.cm,"beforeChange"))&&(t=Ju(e,t,!0),!t))){var r=jl&&!n&&yp(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)ef(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else ef(e,t)}}function ef(e,t){if(!(t.text.length==1&&t.text[0]==""&&X(t.from,t.to)==0)){var n=Bs(e,t);$u(e,t,n,e.cm?e.cm.curOp.id:NaN),bi(e,t,n,ps(e,t));var r=[];Nr(e,function(i,o){!o&&fe(r,i.history)==-1&&(af(i.history,t),r.push(i.history)),bi(i,t,null,ps(i,t))})}}function Ca(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!n)){for(var i=e.history,o,u=e.sel,c=t=="undo"?i.done:i.undone,d=t=="undo"?i.undone:i.done,v=0;v<c.length&&(o=c[v],!(n?o.ranges&&!o.equals(e.sel):!o.ranges));v++);if(v!=c.length){for(i.lastOrigin=i.lastSelOrigin=null;;)if(o=c.pop(),o.ranges){if(wa(o,d),n&&!o.equals(e.sel)){ut(e,o,{clearRedo:!1});return}u=o}else if(r){c.push(o);return}else break;var x=[];wa(u,d),d.push({changes:x,generation:i.generation}),i.generation=o.generation||++i.maxGeneration;for(var C=St(e,"beforeChange")||e.cm&&St(e.cm,"beforeChange"),O=function(F){var U=o.changes[F];if(U.origin=t,C&&!Ju(e,U,!1))return c.length=0,{};x.push(js(e,U));var j=F?Bs(e,U):me(c);bi(e,U,j,ju(e,U)),!F&&e.cm&&e.cm.scrollIntoView({from:U.from,to:Ir(U)});var K=[];Nr(e,function(q,Q){!Q&&fe(K,q.history)==-1&&(af(q.history,U),K.push(q.history)),bi(q,U,null,ju(q,U))})},_=o.changes.length-1;_>=0;--_){var M=O(_);if(M)return M.v}}}}function tf(e,t){if(t!=0&&(e.first+=t,e.sel=new It(Ur(e.sel.ranges,function(i){return new be(I(i.anchor.line+t,i.anchor.ch),I(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){yt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Or(e.cm,r,"gutter")}}function bi(e,t,n,r){if(e.cm&&!e.cm.curOp)return tt(e.cm,bi)(e,t,n,r);if(t.to.line<e.first){tf(e,t.text.length-1-(t.to.line-t.from.line));return}if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);tf(e,i),t={from:I(e.first,0),to:I(t.to.line+i,t.to.ch),text:[me(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:I(o,V(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=hr(e,t.from,t.to),n||(n=Bs(e,t)),e.cm?kg(e.cm,t,r):Us(e,t,r),ka(e,n,Ot),e.cantEdit&&Sa(e,I(e.firstLine(),0))&&(e.cantEdit=!1)}}function kg(e,t,n){var r=e.doc,i=e.display,o=t.from,u=t.to,c=!1,d=o.line;e.options.lineWrapping||(d=m(Gt(V(r,o.line))),r.iter(d,u.line+1,function(_){if(_==i.maxLine)return c=!0,!0})),r.sel.contains(t.from,t.to)>-1&&zt(e),Us(r,t,n,wu(e)),e.options.lineWrapping||(r.iter(d,o.line+t.text.length,function(_){var M=oa(_);M>i.maxLineLength&&(i.maxLine=_,i.maxLineLength=M,i.maxLineChanged=!0,c=!1)}),c&&(e.curOp.updateMaxLine=!0)),cp(r,o.line),vi(e,400);var v=t.text.length-(u.line-o.line)-1;t.full?yt(e):o.line==u.line&&t.text.length==1&&!Fu(e.doc,t)?Or(e,o.line,"text"):yt(e,o.line,u.line+1,v);var x=St(e,"changes"),C=St(e,"change");if(C||x){var O={from:o,to:u,text:t.text,removed:t.removed,origin:t.origin};C&&et(e,"change",e,O),x&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(O)}e.display.selForContextMenu=null}function In(e,t,n,r,i){var o;r||(r=n),X(r,n)<0&&(o=[r,n],n=o[0],r=o[1]),typeof t=="string"&&(t=e.splitLines(t)),Dn(e,{from:n,to:r,text:t,origin:i})}function rf(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function nf(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],u=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var c=0;c<o.ranges.length;c++)rf(o.ranges[c].anchor,t,n,r),rf(o.ranges[c].head,t,n,r);continue}for(var d=0;d<o.changes.length;++d){var v=o.changes[d];if(n<v.from.line)v.from=I(v.from.line+r,v.from.ch),v.to=I(v.to.line+r,v.to.ch);else if(t<=v.to.line){u=!1;break}}u||(e.splice(0,i+1),i=0)}}function af(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;nf(e.done,n,r,i),nf(e.undone,n,r,i)}function wi(e,t,n,r){var i=t,o=t;return typeof t=="number"?o=V(e,Rl(e,t)):i=m(t),i==null?null:(r(o,i)&&e.cm&&Or(e.cm,i,n),o)}function xi(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}xi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,Sp(i),et(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function ki(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}ki.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var o=Math.min(t,i-e),u=r.height;if(r.removeInner(e,o),this.height-=u-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),(t-=o)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof xi))){var c=[];this.collapse(c),this.children=[new xi(c)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var u=i.lines.length%25+25,c=u;c<i.lines.length;){var d=new xi(i.lines.slice(c,c+=25));i.height-=d.height,this.children.splice(++r,0,d),d.parent=this}i.lines=i.lines.slice(0,u),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new ki(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=fe(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new ki(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize();if(e<o){var u=Math.min(t,o-e);if(i.iterN(e,u,n))return!0;if((t-=u)==0)break;e=0}else e-=o}}};var Si=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};Si.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=m(n);if(!(r==null||!t)){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var o=ui(this);Dt(n,Math.max(0,n.height-o)),e&&(Ct(e,function(){sf(e,n,-o),Or(e,r,"widget")}),et(e,"lineWidgetCleared",e,this,r))}},Si.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=ui(this)-t;i&&(Ar(this.doc,r)||Dt(r,r.height+i),n&&Ct(n,function(){n.curOp.forceUpdate=!0,sf(n,r,i),et(n,"lineWidgetChanged",n,e,m(r))}))},Bt(Si);function sf(e,t,n){pr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Rs(e,n)}function Sg(e,t,n,r){var i=new Si(e,n,r),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),wi(e,t,"widget",function(u){var c=u.widgets||(u.widgets=[]);if(i.insertAt==null?c.push(i):c.splice(Math.min(c.length,Math.max(0,i.insertAt)),0,i),i.line=u,o&&!Ar(e,u)){var d=pr(u)<e.scrollTop;Dt(u,u.height+ui(i)),d&&Rs(o,i.height),o.curOp.forceUpdate=!0}return!0}),o&&et(o,"lineWidgetAdded",o,i,typeof t=="number"?t:m(t)),i}var of=0,Mr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++of};Mr.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Vr(e),St(this,"clear")){var n=this.find();n&&et(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;o<this.lines.length;++o){var u=this.lines[o],c=si(u.markedSpans,this);e&&!this.collapsed?Or(e,m(u),"text"):e&&(c.to!=null&&(i=m(u)),c.from!=null&&(r=m(u))),u.markedSpans=pp(u.markedSpans,c),c.from==null&&this.collapsed&&!Ar(this.doc,u)&&e&&Dt(u,Cn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var d=0;d<this.lines.length;++d){var v=Gt(this.lines[d]),x=oa(v);x>e.display.maxLineLength&&(e.display.maxLine=v,e.display.maxLineLength=x,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&yt(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Yu(e.doc)),e&&et(e,"markerCleared",e,this,r,i),t&&Jr(e),this.parent&&this.parent.clear()}},Mr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var o=this.lines[i],u=si(o.markedSpans,this);if(u.from!=null&&(n=I(t?o:m(o),u.from),e==-1))return n;if(u.to!=null&&(r=I(t?o:m(o),u.to),e==1))return r}return n&&{from:n,to:r}},Mr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;!t||!r||Ct(r,function(){var i=t.line,o=m(t.line),u=ks(r,o);if(u&&(hu(u),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Ar(n.doc,i)&&n.height!=null){var c=n.height;n.height=null;var d=ui(n)-c;d&&Dt(i,i.height+d)}et(r,"markerChanged",r,e)})},Mr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||fe(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Mr.prototype.detachLine=function(e){if(this.lines.splice(fe(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Bt(Mr);function Nn(e,t,n,r,i){if(r&&r.shared)return Cg(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return tt(e.cm,Nn)(e,t,n,r,i);var o=new Mr(e,i),u=X(t,n);if(r&&he(r,o,!1),u>0||u==0&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=ht("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Zl(e,t.line,t,n,o)||t.line!=n.line&&Zl(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");dp()}o.addToHistory&&$u(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var c=t.line,d=e.cm,v;if(e.iter(c,n.line+1,function(C){d&&o.collapsed&&!d.options.lineWrapping&&Gt(C)==d.display.maxLine&&(v=!0),o.collapsed&&c!=t.line&&Dt(C,0),gp(C,new na(o,c==t.line?t.ch:null,c==n.line?n.ch:null),e.cm&&e.cm.curOp),++c}),o.collapsed&&e.iter(t.line,n.line+1,function(C){Ar(e,C)&&Dt(C,0)}),o.clearOnEnter&&te(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(hp(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++of,o.atomic=!0),d){if(v&&(d.curOp.updateMaxLine=!0),o.collapsed)yt(d,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var x=t.line;x<=n.line;x++)Or(d,x,"text");o.atomic&&Yu(d.doc),et(d,"markerAdded",d,o)}return o}var Ci=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Ci.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();et(this,"clear")}},Ci.prototype.find=function(e,t){return this.primary.find(e,t)},Bt(Ci);function Cg(e,t,n,r,i){r=he(r),r.shared=!1;var o=[Nn(e,t,n,r,i)],u=o[0],c=r.widgetNode;return Nr(e,function(d){c&&(r.widgetNode=c.cloneNode(!0)),o.push(Nn(d,ae(d,t),ae(d,n),r,i));for(var v=0;v<d.linked.length;++v)if(d.linked[v].isParent)return;u=me(o)}),new Ci(o,u)}function lf(e){return e.findMarks(I(e.first,0),e.clipPos(I(e.lastLine())),function(t){return t.parent})}function Tg(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),o=e.clipPos(i.from),u=e.clipPos(i.to);if(X(o,u)){var c=Nn(e,o,u,r.primary,r.primary.type);r.markers.push(c),c.parent=r}}}function Lg(e){for(var t=function(r){var i=e[r],o=[i.primary.doc];Nr(i.primary.doc,function(d){return o.push(d)});for(var u=0;u<i.markers.length;u++){var c=i.markers[u];fe(o,c.doc)==-1&&(c.parent=null,i.markers.splice(u--,1))}},n=0;n<e.length;n++)t(n)}var _g=0,bt=function(e,t,n,r,i){if(!(this instanceof bt))return new bt(e,t,n,r,i);n==null&&(n=0),ki.call(this,[new xi([new xn("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=I(n,0);this.sel=Dr(o),this.history=new ba(null),this.id=++_g,this.modeOption=t,this.lineSep=r,this.direction=i=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Us(this,{from:o,to:o,text:e}),ut(this,Dr(o),Ot)};bt.prototype=Qi(ki.prototype,{constructor:bt,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ii(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:rt(function(e){var t=I(this.first,0),n=this.first+this.size-1;Dn(this,{from:t,to:I(n,V(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&hi(this.cm,0,0),ut(this,Dr(t),Ot)}),replaceRange:function(e,t,n,r){t=ae(this,t),n=n?ae(this,n):t,In(this,e,t,n,r)},getRange:function(e,t,n){var r=hr(this,ae(this,e),ae(this,t));return n===!1?r:n===""?r.join(""):r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(z(this,e))return V(this,e)},getLineNumber:function(e){return m(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=V(this,e)),Gt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ae(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:rt(function(e,t,n){Gu(this,ae(this,typeof e=="number"?I(e,t||0):e),null,n)}),setSelection:rt(function(e,t,n){Gu(this,ae(this,e),ae(this,t||e),n)}),extendSelection:rt(function(e,t,n){xa(this,ae(this,e),t&&ae(this,t),n)}),extendSelections:rt(function(e,t){qu(this,zl(this,e),t)}),extendSelectionsBy:rt(function(e,t){var n=Ur(this.sel.ranges,e);qu(this,zl(this,n),t)}),setSelections:rt(function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new be(ae(this,e[i].anchor),ae(this,e[i].head||e[i].anchor));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),ut(this,Kt(this.cm,r,t),n)}}),addSelection:rt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new be(ae(this,e),ae(this,t||e))),ut(this,Kt(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=hr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=hr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:rt(function(e,t,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var u=i.ranges[o];r[o]={from:u.from(),to:u.to(),text:this.splitLines(e[o]),origin:n}}for(var c=t&&t!="end"&&pg(this,r,t),d=r.length-1;d>=0;d--)Dn(this,r[d]);c?Xu(this,c):this.cm&&_n(this.cm)}),undo:rt(function(){Ca(this,"undo")}),redo:rt(function(){Ca(this,"redo")}),undoSelection:rt(function(){Ca(this,"undo",!0)}),redoSelection:rt(function(){Ca(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new ba(this.history),Nr(this,function(t){return t.history=e.history},!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:On(this.history.done),undone:On(this.history.undone)}},setHistory:function(e){var t=this.history=new ba(this.history);t.done=On(e.done.slice(0),null,!0),t.undone=On(e.undone.slice(0),null,!0)},setGutterMarker:rt(function(e,t,n){return wi(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&Vi(i)&&(r.gutterMarkers=null),!0})}),clearGutter:rt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&wi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,Vi(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!z(this,e)||(t=e,e=V(this,e),!e))return null}else if(t=m(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:rt(function(e,t,n){return wi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(Ce(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:rt(function(e,t,n){return wi(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",o=r[i];if(o)if(n==null)r[i]=null;else{var u=o.match(Ce(n));if(!u)return!1;var c=u.index+u[0].length;r[i]=o.slice(0,u.index)+(!u.index||c==o.length?"":" ")+o.slice(c)||null}else return!1;return!0})}),addLineWidget:rt(function(e,t,n){return Sg(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Nn(this,ae(this,e),ae(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ae(this,e),Nn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ae(this,e);var t=[],n=V(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ae(this,e),t=ae(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var u=o.markedSpans;if(u)for(var c=0;c<u.length;c++){var d=u[c];!(d.to!=null&&i==e.line&&e.ch>=d.to||d.from==null&&i!=e.line||d.from!=null&&i==t.line&&d.from>=t.ch)&&(!n||n(d.marker))&&r.push(d.marker.parent||d.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var o=i.text.length+r;if(o>e)return t=e,!0;e-=o,++n}),ae(this,I(n,t))},indexFromPos:function(e){e=ae(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new bt(ii(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new bt(ii(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],Tg(r,lf(this)),r},unlinkDoc:function(e){if(e instanceof Ie&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),Lg(lf(this));break}}if(e.history==this.history){var r=[e.id];Nr(e,function(i){return r.push(i.id)},!0),e.history=new ba(null),e.history.done=On(this.history.done,r),e.history.undone=On(this.history.undone,r)}},iterLinkedDocs:function(e){Nr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Pt(e)},lineSeparator:function(){return this.lineSep||`
11
+ `},setDirection:rt(function(e){e!="rtl"&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&gg(this.cm))})}),bt.prototype.eachLine=bt.prototype.iter;var uf=0;function Ag(e){var t=this;if(ff(t),!(Fe(t,e)||gr(t.display,e))){lt(e),w&&(uf=+new Date);var n=Kr(t,e,!0),r=e.dataTransfer.files;if(!(!n||t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),u=0,c=function(){++u==i&&tt(t,function(){n=ae(t.doc,n);var _={from:n,to:n,text:t.doc.splitLines(o.filter(function(M){return M!=null}).join(t.doc.lineSeparator())),origin:"paste"};Dn(t.doc,_),Xu(t.doc,Dr(ae(t.doc,n),ae(t.doc,Ir(_))))})()},d=function(_,M){if(t.options.allowDropFileTypes&&fe(t.options.allowDropFileTypes,_.type)==-1){c();return}var F=new FileReader;F.onerror=function(){return c()},F.onload=function(){var U=F.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(U)){c();return}o[M]=U,c()},F.readAsText(_)},v=0;v<r.length;v++)d(r[v],v);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var x=e.dataTransfer.getData("Text");if(x){var C;if(t.state.draggingText&&!t.state.draggingText.copy&&(C=t.listSelections()),ka(t.doc,Dr(n,n)),C)for(var O=0;O<C.length;++O)In(t.doc,"",C[O].anchor,C[O].head,"drag");t.replaceSelection(x,"around","paste"),t.display.input.focus()}}catch{}}}}function Og(e,t){if(w&&(!e.state.draggingText||+new Date-uf<100)){Cr(t);return}if(!(Fe(e,t)||gr(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!$)){var n=T("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",P&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),P&&n.parentNode.removeChild(n)}}function Eg(e,t){var n=Kr(e,t);if(n){var r=document.createDocumentFragment();Es(e,n,r),e.display.dragCursor||(e.display.dragCursor=T("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Y(e.display.dragCursor,r)}}function ff(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function cf(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var o=0;o<n.length;o++)e(n[o])})}}var hf=!1;function Dg(){hf||(Ig(),hf=!0)}function Ig(){var e;te(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,cf(Ng)},100))}),te(window,"blur",function(){return cf(Ln)})}function Ng(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Rr={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Ti=0;Ti<10;Ti++)Rr[Ti+48]=Rr[Ti+96]=String(Ti);for(var Ta=65;Ta<=90;Ta++)Rr[Ta]=String.fromCharCode(Ta);for(var Li=1;Li<=12;Li++)Rr[Li+111]=Rr[Li+63235]="F"+Li;var mr={};mr.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},mr.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},mr.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},mr.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},mr.default=Z?mr.macDefault:mr.pcDefault;function Mg(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,o,u=0;u<t.length-1;u++){var c=t[u];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))n=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else throw new Error("Unrecognized modifier name: "+c)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),o&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Rg(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=Ur(n.split(" "),Mg),o=0;o<i.length;o++){var u=void 0,c=void 0;o==i.length-1?(c=i.join(" "),u=r):(c=i.slice(0,o+1).join(" "),u="...");var d=t[c];if(!d)t[c]=u;else if(d!=u)throw new Error("Inconsistent bindings for "+c)}delete e[n]}for(var v in t)e[v]=t[v];return e}function Mn(e,t,n,r){t=La(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return Mn(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var u=Mn(e,t.fallthrough[o],n,r);if(u)return u}}}function df(e){var t=typeof e=="string"?e:Rr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function pf(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(Ee?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(Ee?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function gf(e,t){if(P&&e.keyCode==34&&e.char)return!1;var n=Rr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),pf(n,e,t))}function La(e){return typeof e=="string"?mr[e]:e}function Rn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=t(n[i]);r.length&&X(o.from,me(r).to)<=0;){var u=r.pop();if(X(u.from,o.from)<0){o.from=u.from;break}}r.push(o)}Ct(e,function(){for(var c=r.length-1;c>=0;c--)In(e.doc,"",r[c].from,r[c].to,"+delete");_n(e)})}function Xs(e,t,n){var r=xr(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ks(e,t,n){var r=Xs(e,t.ch,n);return r==null?null:new I(t.line,r,n<0?"after":"before")}function Ys(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var o=ge(n,t.doc.direction);if(o){var u=i<0?me(o):o[0],c=i<0==(u.level==1),d=c?"after":"before",v;if(u.level>0||t.doc.direction=="rtl"){var x=Sn(t,n);v=i<0?n.text.length-1:0;var C=ar(t,x,v).top;v=tr(function(O){return ar(t,x,O).top==C},i<0==(u.level==1)?u.from:u.to-1,v),d=="before"&&(v=Xs(n,v,1))}else v=i<0?u.to:u.from;return new I(r,v,d)}}return new I(r,i<0?n.text.length:0,i<0?"before":"after")}function zg(e,t,n,r){var i=ge(t,e.doc.direction);if(!i)return Ks(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=Sr(i,n.ch,n.sticky),u=i[o];if(e.doc.direction=="ltr"&&u.level%2==0&&(r>0?u.to>n.ch:u.from<n.ch))return Ks(t,n,r);var c=function(j,K){return Xs(t,j instanceof I?j.ch:j,K)},d,v=function(j){return e.options.lineWrapping?(d=d||Sn(e,t),bu(e,t,d,j)):{begin:0,end:t.text.length}},x=v(n.sticky=="before"?c(n,-1):n.ch);if(e.doc.direction=="rtl"||u.level==1){var C=u.level==1==r<0,O=c(n,C?1:-1);if(O!=null&&(C?O<=u.to&&O<=x.end:O>=u.from&&O>=x.begin)){var _=C?"before":"after";return new I(n.line,O,_)}}var M=function(j,K,q){for(var Q=function(Le,nt){return nt?new I(n.line,c(Le,1),"before"):new I(n.line,Le,"after")};j>=0&&j<i.length;j+=K){var re=i[j],J=K>0==(re.level!=1),ce=J?q.begin:c(q.end,-1);if(re.from<=ce&&ce<re.to||(ce=J?re.from:c(re.to,-1),q.begin<=ce&&ce<q.end))return Q(ce,J)}},F=M(o+r,r,x);if(F)return F;var U=r>0?x.end:c(x.begin,-1);return U!=null&&!(r>0&&U==t.text.length)&&(F=M(r>0?0:i.length-1,r,v(U)),F)?F:null}var _i={selectAll:Vu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ot)},killLine:function(e){return Rn(e,function(t){if(t.empty()){var n=V(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:I(t.head.line+1,0)}:{from:t.head,to:I(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Rn(e,function(t){return{from:I(t.from().line,0),to:ae(e.doc,I(t.to().line+1,0))}})},delLineLeft:function(e){return Rn(e,function(t){return{from:I(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Rn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return Rn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(I(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(I(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return vf(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return mf(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Pg(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Et)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Et)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?mf(e,t.head):r},Et)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"codepoint")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),u=xe(e.getLine(o.line),o.ch,r);t.push(Jn(r-u%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Ct(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)if(t[r].empty()){var i=t[r].head,o=V(e.doc,i.line).text;if(o){if(i.ch==o.length&&(i=new I(i.line,i.ch-1)),i.ch>0)i=new I(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),I(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var u=V(e.doc,i.line-1).text;u&&(i=new I(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+u.charAt(u.length-1),I(i.line-1,u.length-1),i,"+transpose"))}}n.push(new be(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return Ct(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);_n(e)})},openLine:function(e){return e.replaceSelection(`
12
+ `,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function vf(e,t){var n=V(e.doc,t),r=Gt(n);return r!=n&&(t=m(r)),Ys(!0,e,r,t,1)}function Pg(e,t){var n=V(e.doc,t),r=wp(n);return r!=n&&(t=m(r)),Ys(!0,e,n,t,-1)}function mf(e,t){var n=vf(e,t.line),r=V(e.doc,n.line),i=ge(r,e.doc.direction);if(!i||i[0].level==0){var o=Math.max(n.ch,r.text.search(/\S/)),u=t.line==n.line&&t.ch<=o&&t.ch;return I(n.line,u?0:o,n.sticky)}return n}function _a(e,t,n){if(typeof t=="string"&&(t=_i[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=wr}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Fg(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Mn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&Mn(t,e.options.extraKeys,n,e)||Mn(t,e.options.keyMap,n,e)}var Hg=new Vt;function Ai(e,t,n,r){var i=e.state.keySeq;if(i){if(df(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Hg.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),yf(e,i+" "+t,n,r))return!0}return yf(e,t,n,r)}function yf(e,t,n,r){var i=Fg(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&et(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(lt(n),Ds(e)),!!i}function bf(e,t){var n=gf(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ai(e,"Shift-"+n,t,function(r){return _a(e,r,!0)})||Ai(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return _a(e,r)}):Ai(e,n,t,function(r){return _a(e,r)}):!1}function Wg(e,t,n){return Ai(e,"'"+n+"'",t,function(r){return _a(e,r,!0)})}var Zs=null;function wf(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=qe(Wt(t)),!Fe(t,e))){w&&b<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=bf(t,e);P&&(Zs=r?n:null,!r&&n==88&&!ta&&(Z?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),h&&!Z&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Bg(t)}}function Bg(e){var t=e.display.lineDiv;ze(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(ct(t,"CodeMirror-crosshair"),ot(document,"keyup",n),ot(document,"mouseover",n))}te(document,"keyup",n),te(document,"mouseover",n)}function xf(e){e.keyCode==16&&(this.doc.sel.shift=!1),Fe(this,e)}function kf(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(gr(t.display,e)||Fe(t,e)||e.ctrlKey&&!e.altKey||Z&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(P&&n==Zs){Zs=null,lt(e);return}if(!(P&&(!e.which||e.which<10)&&bf(t,e))){var i=String.fromCharCode(r??n);i!="\b"&&(Wg(t,e,i)||t.display.input.onKeyPress(e))}}}var $g=400,Qs=function(e,t,n){this.time=e,this.pos=t,this.button=n};Qs.prototype.compare=function(e,t,n){return this.time+$g>e&&X(t,this.pos)==0&&n==this.button};var Oi,Ei;function Ug(e,t){var n=+new Date;return Ei&&Ei.compare(n,e,t)?(Oi=Ei=null,"triple"):Oi&&Oi.compare(n,e,t)?(Ei=new Qs(n,e,t),Oi=null,"double"):(Oi=new Qs(n,e,t),Ei=null,"single")}function Sf(e){var t=this,n=t.display;if(!(Fe(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,gr(n,e)){k||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!Vs(t,e)){var r=Kr(t,e),i=$t(e),o=r?Ug(r,i):"single";oe(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&jg(t,i,r,o,e))&&(i==1?r?Gg(t,r,o,e):ti(e)==n.scroller&&lt(e):i==2?(r&&xa(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(ke?t.display.input.onContextMenu(e):Is(t)))}}}function jg(e,t,n,r,i){var o="Click";return r=="double"?o="Double"+o:r=="triple"&&(o="Triple"+o),o=(t==1?"Left":t==2?"Middle":"Right")+o,Ai(e,pf(o,i),i,function(u){if(typeof u=="string"&&(u=_i[u]),!u)return!1;var c=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),c=u(e,n)!=wr}finally{e.state.suppressEdits=!1}return c})}function qg(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var o=ee?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=Z?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(Z?n.altKey:n.ctrlKey)),i}function Gg(e,t,n,r){w?setTimeout(ie(Su,e),0):e.curOp.focus=qe(Wt(e));var i=qg(e,n,r),o=e.doc.sel,u;e.options.dragDrop&&fs&&!e.isReadOnly()&&n=="single"&&(u=o.contains(t))>-1&&(X((u=o.ranges[u]).from(),t)<0||t.xRel>0)&&(X(u.to(),t)>0||t.xRel<0)?Xg(e,r,t,i):Kg(e,r,t,i)}function Xg(e,t,n,r){var i=e.display,o=!1,u=tt(e,function(v){k&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Is(e)),ot(i.wrapper.ownerDocument,"mouseup",u),ot(i.wrapper.ownerDocument,"mousemove",c),ot(i.scroller,"dragstart",d),ot(i.scroller,"drop",u),o||(lt(v),r.addNew||xa(e.doc,n,null,null,r.extend),k&&!$||w&&b==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),c=function(v){o=o||Math.abs(t.clientX-v.clientX)+Math.abs(t.clientY-v.clientY)>=10},d=function(){return o=!0};k&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!r.moveOnDrag,te(i.wrapper.ownerDocument,"mouseup",u),te(i.wrapper.ownerDocument,"mousemove",c),te(i.scroller,"dragstart",d),te(i.scroller,"drop",u),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function Cf(e,t,n){if(n=="char")return new be(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new be(I(t.line,0),ae(e.doc,I(t.line+1,0)));var r=n(e,t);return new be(r.from,r.to)}function Kg(e,t,n,r){w&&Is(e);var i=e.display,o=e.doc;lt(t);var u,c,d=o.sel,v=d.ranges;if(r.addNew&&!r.extend?(c=o.sel.contains(n),c>-1?u=v[c]:u=new be(n,n)):(u=o.sel.primary(),c=o.sel.primIndex),r.unit=="rectangle")r.addNew||(u=new be(n,n)),n=Kr(e,t,!0,!0),c=-1;else{var x=Cf(e,n,r.unit);r.extend?u=qs(u,x.anchor,x.head,r.extend):u=x}r.addNew?c==-1?(c=v.length,ut(o,Kt(e,v.concat([u]),c),{scroll:!1,origin:"*mouse"})):v.length>1&&v[c].empty()&&r.unit=="char"&&!r.extend?(ut(o,Kt(e,v.slice(0,c).concat(v.slice(c+1)),0),{scroll:!1,origin:"*mouse"}),d=o.sel):Gs(o,c,u,Jt):(c=0,ut(o,new It([u],0),Jt),d=o.sel);var C=n;function O(q){if(X(C,q)!=0)if(C=q,r.unit=="rectangle"){for(var Q=[],re=e.options.tabSize,J=xe(V(o,n.line).text,n.ch,re),ce=xe(V(o,q.line).text,q.ch,re),Le=Math.min(J,ce),nt=Math.max(J,ce),Me=Math.min(n.line,q.line),Tt=Math.min(e.lastLine(),Math.max(n.line,q.line));Me<=Tt;Me++){var wt=V(o,Me).text,Xe=er(wt,Le,re);Le==nt?Q.push(new be(I(Me,Xe),I(Me,Xe))):wt.length>Xe&&Q.push(new be(I(Me,Xe),I(Me,er(wt,nt,re))))}Q.length||Q.push(new be(n,n)),ut(o,Kt(e,d.ranges.slice(0,c).concat(Q),c),{origin:"*mouse",scroll:!1}),e.scrollIntoView(q)}else{var xt=u,at=Cf(e,q,r.unit),Ye=xt.anchor,Ke;X(at.anchor,Ye)>0?(Ke=at.head,Ye=wn(xt.from(),at.anchor)):(Ke=at.anchor,Ye=mt(xt.to(),at.head));var We=d.ranges.slice(0);We[c]=Yg(e,new be(ae(o,Ye),Ke)),ut(o,Kt(e,We,c),Jt)}}var _=i.wrapper.getBoundingClientRect(),M=0;function F(q){var Q=++M,re=Kr(e,q,!0,r.unit=="rectangle");if(re)if(X(re,C)!=0){e.curOp.focus=qe(Wt(e)),O(re);var J=ga(i,o);(re.line>=J.to||re.line<J.from)&&setTimeout(tt(e,function(){M==Q&&F(q)}),150)}else{var ce=q.clientY<_.top?-20:q.clientY>_.bottom?20:0;ce&&setTimeout(tt(e,function(){M==Q&&(i.scroller.scrollTop+=ce,F(q))}),50)}}function U(q){e.state.selectingText=!1,M=1/0,q&&(lt(q),i.input.focus()),ot(i.wrapper.ownerDocument,"mousemove",j),ot(i.wrapper.ownerDocument,"mouseup",K),o.history.lastSelOrigin=null}var j=tt(e,function(q){q.buttons===0||!$t(q)?U(q):F(q)}),K=tt(e,U);e.state.selectingText=K,te(i.wrapper.ownerDocument,"mousemove",j),te(i.wrapper.ownerDocument,"mouseup",K)}function Yg(e,t){var n=t.anchor,r=t.head,i=V(e.doc,n.line);if(X(n,r)==0&&n.sticky==r.sticky)return t;var o=ge(i);if(!o)return t;var u=Sr(o,n.ch,n.sticky),c=o[u];if(c.from!=n.ch&&c.to!=n.ch)return t;var d=u+(c.from==n.ch==(c.level!=1)?0:1);if(d==0||d==o.length)return t;var v;if(r.line!=n.line)v=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var x=Sr(o,r.ch,r.sticky),C=x-u||(r.ch-n.ch)*(c.level==1?-1:1);x==d-1||x==d?v=C<0:v=C>0}var O=o[d+(v?-1:0)],_=v==(O.level==1),M=_?O.from:O.to,F=_?"after":"before";return n.ch==M&&n.sticky==F?t:new be(new I(n.line,M,F),r)}function Tf(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch{return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&lt(t);var u=e.display,c=u.lineDiv.getBoundingClientRect();if(o>c.bottom||!St(e,n))return vt(t);o-=c.top-u.viewOffset;for(var d=0;d<e.display.gutterSpecs.length;++d){var v=u.gutters.childNodes[d];if(v&&v.getBoundingClientRect().right>=i){var x=S(e.doc,o),C=e.display.gutterSpecs[d];return Pe(e,n,e,x,C.className,t),vt(t)}}}function Vs(e,t){return Tf(e,t,"gutterClick",!0)}function Lf(e,t){gr(e.display,t)||Zg(e,t)||Fe(e,t,"contextmenu")||ke||e.display.input.onContextMenu(t)}function Zg(e,t){return St(e,"gutterContextMenu")?Tf(e,t,"gutterContextMenu",!1):!1}function _f(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),fi(e)}var zn={toString:function(){return"CodeMirror.Init"}},Af={},Aa={};function Qg(e){var t=e.optionHandlers;function n(r,i,o,u){e.defaults[r]=i,o&&(t[r]=u?function(c,d,v){v!=zn&&o(c,d,v)}:o)}e.defineOption=n,e.Init=zn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,$s(r)},!0),n("indentUnit",2,$s,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){yi(r),fi(r),yt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!!i){var o=[],u=r.doc.first;r.doc.iter(function(d){for(var v=0;;){var x=d.text.indexOf(i,v);if(x==-1)break;v=x+i.length,o.push(I(u,x))}u++});for(var c=o.length-1;c>=0;c--)In(r.doc,i,o[c],I(o[c].line,o[c].ch+i.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,i,o){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),o!=zn&&r.refresh()}),n("specialCharPlaceholder",Lp,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",G?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!ne),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){_f(r),mi(r)},!0),n("keyMap","default",function(r,i,o){var u=La(i),c=o!=zn&&La(o);c&&c.detach&&c.detach(r,u),u.attach&&u.attach(r,c||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Jg,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=Ws(i,r.options.lineNumbers),mi(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?As(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return An(r)},!0),n("scrollbarStyle","native",function(r){Ou(r),An(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=Ws(r.options.gutters,i),mi(r)},!0),n("firstLineNumber",1,mi,!0),n("lineNumberFormatter",function(r){return r},mi,!0),n("showCursorWhenSelecting",!1,ci,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(Ln(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Vg),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,ci,!0),n("singleCursorHeightPerLine",!0,ci,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,yi,!0),n("addModeClass",!1,yi,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,yi,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Vg(e,t,n){var r=n&&n!=zn;if(!t!=!r){var i=e.display.dragFunctions,o=t?te:ot;o(e.display.scroller,"dragstart",i.start),o(e.display.scroller,"dragenter",i.enter),o(e.display.scroller,"dragover",i.over),o(e.display.scroller,"dragleave",i.leave),o(e.display.scroller,"drop",i.drop)}}function Jg(e){e.options.lineWrapping?(ze(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(ct(e.display.wrapper,"CodeMirror-wrap"),ys(e)),Os(e),yt(e),fi(e),setTimeout(function(){return An(e)},100)}function Ie(e,t){var n=this;if(!(this instanceof Ie))return new Ie(e,t);this.options=t=t?he(t):{},he(Af,t,!1);var r=t.value;typeof r=="string"?r=new bt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Ie.inputStyles[t.inputStyle](this),o=this.display=new hg(e,r,i,t);o.wrapper.CodeMirror=this,_f(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ou(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Vt,keySeq:null,specialChars:null},t.autofocus&&!G&&o.input.focus(),w&&b<11&&setTimeout(function(){return n.display.input.reset(!0)},20),ev(this),Dg(),Vr(this),this.curOp.forceUpdate=!0,Hu(this,r),t.autofocus&&!G||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ns(n)},20):Ln(this);for(var u in Aa)Aa.hasOwnProperty(u)&&Aa[u](this,t[u],zn);Iu(this),t.finishInit&&t.finishInit(this);for(var c=0;c<Js.length;++c)Js[c](this);Jr(this),k&&t.lineWrapping&&getComputedStyle(o.lineDiv).textRendering=="optimizelegibility"&&(o.lineDiv.style.textRendering="auto")}Ie.defaults=Af,Ie.optionHandlers=Aa;function ev(e){var t=e.display;te(t.scroller,"mousedown",tt(e,Sf)),w&&b<11?te(t.scroller,"dblclick",tt(e,function(d){if(!Fe(e,d)){var v=Kr(e,d);if(!(!v||Vs(e,d)||gr(e.display,d))){lt(d);var x=e.findWordAt(v);xa(e.doc,x.anchor,x.head)}}})):te(t.scroller,"dblclick",function(d){return Fe(e,d)||lt(d)}),te(t.scroller,"contextmenu",function(d){return Lf(e,d)}),te(t.input.getField(),"contextmenu",function(d){t.scroller.contains(d.target)||Lf(e,d)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function o(d){if(d.touches.length!=1)return!1;var v=d.touches[0];return v.radiusX<=1&&v.radiusY<=1}function u(d,v){if(v.left==null)return!0;var x=v.left-d.left,C=v.top-d.top;return x*x+C*C>20*20}te(t.scroller,"touchstart",function(d){if(!Fe(e,d)&&!o(d)&&!Vs(e,d)){t.input.ensurePolled(),clearTimeout(n);var v=+new Date;t.activeTouch={start:v,moved:!1,prev:v-r.end<=300?r:null},d.touches.length==1&&(t.activeTouch.left=d.touches[0].pageX,t.activeTouch.top=d.touches[0].pageY)}}),te(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),te(t.scroller,"touchend",function(d){var v=t.activeTouch;if(v&&!gr(t,d)&&v.left!=null&&!v.moved&&new Date-v.start<300){var x=e.coordsChar(t.activeTouch,"page"),C;!v.prev||u(v,v.prev)?C=new be(x,x):!v.prev.prev||u(v,v.prev.prev)?C=e.findWordAt(x):C=new be(I(x.line,0),ae(e.doc,I(x.line+1,0))),e.setSelection(C.anchor,C.head),e.focus(),lt(d)}i()}),te(t.scroller,"touchcancel",i),te(t.scroller,"scroll",function(){t.scroller.clientHeight&&(di(e,t.scroller.scrollTop),Zr(e,t.scroller.scrollLeft,!0),Pe(e,"scroll",e))}),te(t.scroller,"mousewheel",function(d){return Ru(e,d)}),te(t.scroller,"DOMMouseScroll",function(d){return Ru(e,d)}),te(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(d){Fe(e,d)||Cr(d)},over:function(d){Fe(e,d)||(Eg(e,d),Cr(d))},start:function(d){return Og(e,d)},drop:tt(e,Ag),leave:function(d){Fe(e,d)||ff(e)}};var c=t.input.getField();te(c,"keyup",function(d){return xf.call(e,d)}),te(c,"keydown",tt(e,wf)),te(c,"keypress",tt(e,kf)),te(c,"focus",function(d){return Ns(e,d)}),te(c,"blur",function(d){return Ln(e,d)})}var Js=[];Ie.defineInitHook=function(e){return Js.push(e)};function Di(e,t,n,r){var i=e.doc,o;n==null&&(n="add"),n=="smart"&&(i.mode.indent?o=ai(e,t).state:n="prev");var u=e.options.tabSize,c=V(i,t),d=xe(c.text,null,u);c.stateAfter&&(c.stateAfter=null);var v=c.text.match(/^\s*/)[0],x;if(!r&&!/\S/.test(c.text))x=0,n="not";else if(n=="smart"&&(x=i.mode.indent(o,c.text.slice(v.length),c.text),x==wr||x>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?x=xe(V(i,t-1).text,null,u):x=0:n=="add"?x=d+e.options.indentUnit:n=="subtract"?x=d-e.options.indentUnit:typeof n=="number"&&(x=d+n),x=Math.max(0,x);var C="",O=0;if(e.options.indentWithTabs)for(var _=Math.floor(x/u);_;--_)O+=u,C+=" ";if(O<x&&(C+=Jn(x-O)),C!=v)return In(i,C,I(t,0),I(t,v.length),"+input"),c.stateAfter=null,!0;for(var M=0;M<i.sel.ranges.length;M++){var F=i.sel.ranges[M];if(F.head.line==t&&F.head.ch<v.length){var U=I(t,v.length);Gs(i,M,new be(U,U));break}}}var Yt=null;function Oa(e){Yt=e}function eo(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r||(r=o.sel);var u=+new Date-200,c=i=="paste"||e.state.pasteIncoming>u,d=Pt(t),v=null;if(c&&r.ranges.length>1)if(Yt&&Yt.text.join(`
13
+ `)==t){if(r.ranges.length%Yt.text.length==0){v=[];for(var x=0;x<Yt.text.length;x++)v.push(o.splitLines(Yt.text[x]))}}else d.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(v=Ur(d,function(j){return[j]}));for(var C=e.curOp.updateInput,O=r.ranges.length-1;O>=0;O--){var _=r.ranges[O],M=_.from(),F=_.to();_.empty()&&(n&&n>0?M=I(M.line,M.ch-n):e.state.overwrite&&!c?F=I(F.line,Math.min(V(o,F.line).text.length,F.ch+me(d).length)):c&&Yt&&Yt.lineWise&&Yt.text.join(`
14
+ `)==d.join(`
15
+ `)&&(M=F=I(M.line,0)));var U={from:M,to:F,text:v?v[O%v.length]:d,origin:i||(c?"paste":e.state.cutIncoming>u?"cut":"+input")};Dn(e.doc,U),et(e,"inputRead",e,U)}t&&!c&&Ef(e,t),_n(e),e.curOp.updateInput<2&&(e.curOp.updateInput=C),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Of(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&Ct(t,function(){return eo(t,n,0,null,"paste")}),!0}function Ef(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),u=!1;if(o.electricChars){for(var c=0;c<o.electricChars.length;c++)if(t.indexOf(o.electricChars.charAt(c))>-1){u=Di(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(V(e.doc,i.head.line).text.slice(0,i.head.ch))&&(u=Di(e,i.head.line,"smart"));u&&et(e,"electricInput",e,i.head.line)}}}function Df(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,o={anchor:I(i,0),head:I(i+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function to(e,t,n,r){e.setAttribute("autocorrect",n?"on":"off"),e.setAttribute("autocapitalize",r?"on":"off"),e.setAttribute("spellcheck",!!t)}function If(){var e=T("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=T("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return k?e.style.width="1000px":e.setAttribute("wrap","off"),D&&(e.style.border="1px solid black"),t}function tv(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){oe(this).focus(),this.display.input.focus()},setOption:function(r,i){var o=this.options,u=o[r];o[r]==i&&r!="mode"||(o[r]=i,t.hasOwnProperty(r)&&tt(this,t[r])(this,i,u),Pe(this,"optionChange",this,r))},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](La(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,o=0;o<i.length;++o)if(i[o]==r||i[o].name==r)return i.splice(o,1),!0},addOverlay:pt(function(r,i){var o=r.token?r:e.getMode(this.options,r);if(o.startState)throw new Error("Overlays may not be stateful.");os(this.state.overlays,{mode:o,modeSpec:r,opaque:i&&i.opaque,priority:i&&i.priority||0},function(u){return u.priority}),this.state.modeGen++,yt(this)}),removeOverlay:pt(function(r){for(var i=this.state.overlays,o=0;o<i.length;++o){var u=i[o].modeSpec;if(u==r||typeof r=="string"&&u.name==r){i.splice(o,1),this.state.modeGen++,yt(this);return}}}),indentLine:pt(function(r,i,o){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),z(this.doc,r)&&Di(this,r,i,o)}),indentSelection:pt(function(r){for(var i=this.doc.sel.ranges,o=-1,u=0;u<i.length;u++){var c=i[u];if(c.empty())c.head.line>o&&(Di(this,c.head.line,r,!0),o=c.head.line,u==this.doc.sel.primIndex&&_n(this));else{var d=c.from(),v=c.to(),x=Math.max(o,d.line);o=Math.min(this.lastLine(),v.line-(v.ch?0:1))+1;for(var C=x;C<o;++C)Di(this,C,r);var O=this.doc.sel.ranges;d.ch==0&&i.length==O.length&&O[u].from().ch>0&&Gs(this.doc,u,new be(d,O[u].to()),Ot)}}}),getTokenAt:function(r,i){return Bl(this,r,i)},getLineTokens:function(r,i){return Bl(this,I(r),i,!0)},getTokenTypeAt:function(r){r=ae(this.doc,r);var i=Fl(this,V(this.doc,r.line)),o=0,u=(i.length-1)/2,c=r.ch,d;if(c==0)d=i[2];else for(;;){var v=o+u>>1;if((v?i[v*2-1]:0)>=c)u=v;else if(i[v*2+1]<c)o=v+1;else{d=i[v*2+2];break}}var x=d?d.indexOf("overlay "):-1;return x<0?d:x==0?null:d.slice(0,x-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var o=[];if(!n.hasOwnProperty(i))return o;var u=n[i],c=this.getModeAt(r);if(typeof c[i]=="string")u[c[i]]&&o.push(u[c[i]]);else if(c[i])for(var d=0;d<c[i].length;d++){var v=u[c[i][d]];v&&o.push(v)}else c.helperType&&u[c.helperType]?o.push(u[c.helperType]):u[c.name]&&o.push(u[c.name]);for(var x=0;x<u._global.length;x++){var C=u._global[x];C.pred(c,this)&&fe(o,C.val)==-1&&o.push(C.val)}return o},getStateAfter:function(r,i){var o=this.doc;return r=Rl(o,r??o.first+o.size-1),ai(this,r+1,i).state},cursorCoords:function(r,i){var o,u=this.doc.sel.primary();return r==null?o=u.head:typeof r=="object"?o=ae(this.doc,r):o=r?u.from():u.to(),Xt(this,o,i||"page")},charCoords:function(r,i){return ca(this,ae(this.doc,r),i||"page")},coordsChar:function(r,i){return r=vu(this,r,i||"page"),Ts(this,r.left,r.top)},lineAtHeight:function(r,i){return r=vu(this,{top:r,left:0},i||"page").top,S(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,o){var u=!1,c;if(typeof r=="number"){var d=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>d&&(r=d,u=!0),c=V(this.doc,r)}else c=r;return fa(this,c,{top:0,left:0},i||"page",o||u).top+(u?this.doc.height-pr(c):0)},defaultTextHeight:function(){return Cn(this.display)},defaultCharWidth:function(){return Tn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,o,u,c){var d=this.display;r=Xt(this,ae(this.doc,r));var v=r.bottom,x=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),d.sizer.appendChild(i),u=="over")v=r.top;else if(u=="above"||u=="near"){var C=Math.max(d.wrapper.clientHeight,this.doc.height),O=Math.max(d.sizer.clientWidth,d.lineSpace.clientWidth);(u=="above"||r.bottom+i.offsetHeight>C)&&r.top>i.offsetHeight?v=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=C&&(v=r.bottom),x+i.offsetWidth>O&&(x=O-i.offsetWidth)}i.style.top=v+"px",i.style.left=i.style.right="",c=="right"?(x=d.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(c=="left"?x=0:c=="middle"&&(x=(d.sizer.clientWidth-i.offsetWidth)/2),i.style.left=x+"px"),o&&Vp(this,{left:x,top:v,right:x+i.offsetWidth,bottom:v+i.offsetHeight})},triggerOnKeyDown:pt(wf),triggerOnKeyPress:pt(kf),triggerOnKeyUp:xf,triggerOnMouseDown:pt(Sf),execCommand:function(r){if(_i.hasOwnProperty(r))return _i[r].call(null,this)},triggerElectric:pt(function(r){Ef(this,r)}),findPosH:function(r,i,o,u){var c=1;i<0&&(c=-1,i=-i);for(var d=ae(this.doc,r),v=0;v<i&&(d=ro(this.doc,d,c,o,u),!d.hitSide);++v);return d},moveH:pt(function(r,i){var o=this;this.extendSelectionsBy(function(u){return o.display.shift||o.doc.extend||u.empty()?ro(o.doc,u.head,r,i,o.options.rtlMoveVisually):r<0?u.from():u.to()},Et)}),deleteH:pt(function(r,i){var o=this.doc.sel,u=this.doc;o.somethingSelected()?u.replaceSelection("",null,"+delete"):Rn(this,function(c){var d=ro(u,c.head,r,i,!1);return r<0?{from:d,to:c.head}:{from:c.head,to:d}})}),findPosV:function(r,i,o,u){var c=1,d=u;i<0&&(c=-1,i=-i);for(var v=ae(this.doc,r),x=0;x<i;++x){var C=Xt(this,v,"div");if(d==null?d=C.left:C.left=d,v=Nf(this,C,c,o),v.hitSide)break}return v},moveV:pt(function(r,i){var o=this,u=this.doc,c=[],d=!this.display.shift&&!u.extend&&u.sel.somethingSelected();if(u.extendSelectionsBy(function(x){if(d)return r<0?x.from():x.to();var C=Xt(o,x.head,"div");x.goalColumn!=null&&(C.left=x.goalColumn),c.push(C.left);var O=Nf(o,C,r,i);return i=="page"&&x==u.sel.primary()&&Rs(o,ca(o,O,"div").top-C.top),O},Et),c.length)for(var v=0;v<u.sel.ranges.length;v++)u.sel.ranges[v].goalColumn=c[v]}),findWordAt:function(r){var i=this.doc,o=V(i,r.line).text,u=r.ch,c=r.ch;if(o){var d=this.getHelper(r,"wordChars");(r.sticky=="before"||c==o.length)&&u?--u:++c;for(var v=o.charAt(u),x=ur(v,d)?function(C){return ur(C,d)}:/\s/.test(v)?function(C){return/\s/.test(C)}:function(C){return!/\s/.test(C)&&!ur(C)};u>0&&x(o.charAt(u-1));)--u;for(;c<o.length&&x(o.charAt(c));)++c}return new be(I(r.line,u),I(r.line,c))},toggleOverwrite:function(r){r!=null&&r==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?ze(this.display.cursorDiv,"CodeMirror-overwrite"):ct(this.display.cursorDiv,"CodeMirror-overwrite"),Pe(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==qe(Wt(this))},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:pt(function(r,i){hi(this,r,i)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-ir(this)-this.display.barHeight,width:r.scrollWidth-ir(this)-this.display.barWidth,clientHeight:xs(this),clientWidth:Gr(this)}},scrollIntoView:pt(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:I(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?Jp(this,r):Tu(this,r.from,r.to,r.margin)}),setSize:pt(function(r,i){var o=this,u=function(d){return typeof d=="number"||/^\d+$/.test(String(d))?d+"px":d};r!=null&&(this.display.wrapper.style.width=u(r)),i!=null&&(this.display.wrapper.style.height=u(i)),this.options.lineWrapping&&du(this);var c=this.display.viewFrom;this.doc.iter(c,this.display.viewTo,function(d){if(d.widgets){for(var v=0;v<d.widgets.length;v++)if(d.widgets[v].noHScroll){Or(o,c,"widget");break}}++c}),this.curOp.forceUpdate=!0,Pe(this,"refresh",this)}),operation:function(r){return Ct(this,r)},startOperation:function(){return Vr(this)},endOperation:function(){return Jr(this)},refresh:pt(function(){var r=this.display.cachedTextHeight;yt(this),this.curOp.forceUpdate=!0,fi(this),hi(this,this.doc.scrollLeft,this.doc.scrollTop),Fs(this.display),(r==null||Math.abs(r-Cn(this.display))>.5||this.options.lineWrapping)&&Os(this),Pe(this,"refresh",this)}),swapDoc:pt(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),Hu(this,r),fi(this),this.display.input.reset(),hi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,et(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Bt(e),e.registerHelper=function(r,i,o){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=o},e.registerGlobalHelper=function(r,i,o,u){e.registerHelper(r,i,u),n[r]._global.push({pred:o,val:u})}}function ro(e,t,n,r,i){var o=t,u=n,c=V(e,t.line),d=i&&e.direction=="rtl"?-n:n;function v(){var K=t.line+d;return K<e.first||K>=e.first+e.size?!1:(t=new I(K,t.ch,t.sticky),c=V(e,K))}function x(K){var q;if(r=="codepoint"){var Q=c.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(Q))q=null;else{var re=n>0?Q>=55296&&Q<56320:Q>=56320&&Q<57343;q=new I(t.line,Math.max(0,Math.min(c.text.length,t.ch+n*(re?2:1))),-n)}}else i?q=zg(e.cm,c,t,n):q=Ks(c,t,n);if(q==null)if(!K&&v())t=Ys(i,e.cm,c,t.line,d);else return!1;else t=q;return!0}if(r=="char"||r=="codepoint")x();else if(r=="column")x(!0);else if(r=="word"||r=="group")for(var C=null,O=r=="group",_=e.cm&&e.cm.getHelper(t,"wordChars"),M=!0;!(n<0&&!x(!M));M=!1){var F=c.text.charAt(t.ch)||`
16
+ `,U=ur(F,_)?"w":O&&F==`
17
+ `?"n":!O||/\s/.test(F)?null:"p";if(O&&!M&&!U&&(U="s"),C&&C!=U){n<0&&(n=1,x(),t.sticky="after");break}if(U&&(C=U),n>0&&!x(!M))break}var j=Sa(e,t,o,u,!0);return ye(o,j)&&(j.hitSide=!0),j}function Nf(e,t,n,r){var i=e.doc,o=t.left,u;if(r=="page"){var c=Math.min(e.display.wrapper.clientHeight,oe(e).innerHeight||i(e).documentElement.clientHeight),d=Math.max(c-.5*Cn(e.display),3);u=(n>0?t.bottom:t.top)+n*d}else r=="line"&&(u=n>0?t.bottom+3:t.top-3);for(var v;v=Ts(e,o,u),!!v.outside;){if(n<0?u<=0:u>=i.height){v.hitSide=!0;break}u+=n*5}return v}var Se=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Vt,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Se.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable=!0,to(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function o(c){for(var d=c.target;d;d=d.parentNode){if(d==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(d.className))break}return!1}te(i,"paste",function(c){!o(c)||Fe(r,c)||Of(c,r)||b<=11&&setTimeout(tt(r,function(){return t.updateFromDOM()}),20)}),te(i,"compositionstart",function(c){t.composing={data:c.data,done:!1}}),te(i,"compositionupdate",function(c){t.composing||(t.composing={data:c.data,done:!1})}),te(i,"compositionend",function(c){t.composing&&(c.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),te(i,"touchstart",function(){return n.forceCompositionEnd()}),te(i,"input",function(){t.composing||t.readFromDOMSoon()});function u(c){if(!(!o(c)||Fe(r,c))){if(r.somethingSelected())Oa({lineWise:!1,text:r.getSelections()}),c.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var d=Df(r);Oa({lineWise:!0,text:d.text}),c.type=="cut"&&r.operation(function(){r.setSelections(d.ranges,0,Ot),r.replaceSelection("",null,"cut")})}else return;if(c.clipboardData){c.clipboardData.clearData();var v=Yt.text.join(`
18
+ `);if(c.clipboardData.setData("Text",v),c.clipboardData.getData("Text")==v){c.preventDefault();return}}var x=If(),C=x.firstChild;to(C),r.display.lineSpace.insertBefore(x,r.display.lineSpace.firstChild),C.value=Yt.text.join(`
19
+ `);var O=qe(Ve(i));$r(C),setTimeout(function(){r.display.lineSpace.removeChild(x),O.focus(),O==i&&n.showPrimarySelection()},50)}}te(i,"copy",u),te(i,"cut",u)},Se.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Se.prototype.prepareSelection=function(){var e=ku(this.cm,!1);return e.focus=qe(Ve(this.div))==this.div,e},Se.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Se.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Se.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var o=Ea(t,e.anchorNode,e.anchorOffset),u=Ea(t,e.focusNode,e.focusOffset);if(!(o&&!o.bad&&u&&!u.bad&&X(wn(o,u),r)==0&&X(mt(o,u),i)==0)){var c=t.display.view,d=r.line>=t.display.viewFrom&&Mf(t,r)||{node:c[0].measure.map[2],offset:0},v=i.line<t.display.viewTo&&Mf(t,i);if(!v){var x=c[c.length-1].measure,C=x.maps?x.maps[x.maps.length-1]:x.map;v={node:C[C.length-1],offset:C[C.length-2]-C[C.length-3]}}if(!d||!v){e.removeAllRanges();return}var O=e.rangeCount&&e.getRangeAt(0),_;try{_=st(d.node,d.offset,v.offset,v.node)}catch{}_&&(!h&&t.state.focused?(e.collapse(d.node,d.offset),_.collapsed||(e.removeAllRanges(),e.addRange(_))):(e.removeAllRanges(),e.addRange(_)),O&&e.anchorNode==null?e.addRange(O):h&&this.startGracePeriod()),this.rememberSelection()}},Se.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Se.prototype.showMultipleSelections=function(e){Y(this.cm.display.cursorDiv,e.cursors),Y(this.cm.display.selectionDiv,e.selection)},Se.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Se.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Ze(this.div,t)},Se.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||qe(Ve(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Se.prototype.blur=function(){this.div.blur()},Se.prototype.getField=function(){return this.div},Se.prototype.supportsTouch=function(){return!0},Se.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):Ct(this.cm,function(){return t.cm.curOp.selectionChanged=!0});function n(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,n))}this.polling.set(this.cm.options.pollInterval,n)},Se.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Se.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var e=this.getSelection(),t=this.cm;if(R&&L&&this.cm.display.gutterSpecs.length&&rv(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var n=Ea(t,e.anchorNode,e.anchorOffset),r=Ea(t,e.focusNode,e.focusOffset);n&&r&&Ct(t,function(){ut(t.doc,Dr(n,r),Ot),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},Se.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=I(r.line-1,V(e.doc,r.line-1).length)),i.ch==V(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=I(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var o,u,c;r.line==t.viewFrom||(o=Yr(e,r.line))==0?(u=m(t.view[0].line),c=t.view[0].node):(u=m(t.view[o].line),c=t.view[o-1].node.nextSibling);var d=Yr(e,i.line),v,x;if(d==t.view.length-1?(v=t.viewTo-1,x=t.lineDiv.lastChild):(v=m(t.view[d+1].line)-1,x=t.view[d+1].node.previousSibling),!c)return!1;for(var C=e.doc.splitLines(nv(e,c,x,u,v)),O=hr(e.doc,I(u,0),I(v,V(e.doc,v).text.length));C.length>1&&O.length>1;)if(me(C)==me(O))C.pop(),O.pop(),v--;else if(C[0]==O[0])C.shift(),O.shift(),u++;else break;for(var _=0,M=0,F=C[0],U=O[0],j=Math.min(F.length,U.length);_<j&&F.charCodeAt(_)==U.charCodeAt(_);)++_;for(var K=me(C),q=me(O),Q=Math.min(K.length-(C.length==1?_:0),q.length-(O.length==1?_:0));M<Q&&K.charCodeAt(K.length-M-1)==q.charCodeAt(q.length-M-1);)++M;if(C.length==1&&O.length==1&&u==r.line)for(;_&&_>r.ch&&K.charCodeAt(K.length-M-1)==q.charCodeAt(q.length-M-1);)_--,M++;C[C.length-1]=K.slice(0,K.length-M).replace(/^\u200b+/,""),C[0]=C[0].slice(_).replace(/\u200b+$/,"");var re=I(u,_),J=I(v,O.length?me(O).length-M:0);if(C.length>1||C[0]||X(re,J))return In(e.doc,C,re,J,"+input"),!0},Se.prototype.ensurePolled=function(){this.forceCompositionEnd()},Se.prototype.reset=function(){this.forceCompositionEnd()},Se.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Se.prototype.readFromDOMSoon=function(){var e=this;this.readDOMTimeout==null&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing)if(e.composing.done)e.composing=null;else return;e.updateFromDOM()},80))},Se.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Ct(this.cm,function(){return yt(e.cm)})},Se.prototype.setUneditable=function(e){e.contentEditable="false"},Se.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tt(this.cm,eo)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Se.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Se.prototype.onContextMenu=function(){},Se.prototype.resetPosition=function(){},Se.prototype.needsContentAttribute=!0;function Mf(e,t){var n=ks(e,t.line);if(!n||n.hidden)return null;var r=V(e.doc,t.line),i=lu(n,r,t.line),o=ge(r,e.doc.direction),u="left";if(o){var c=Sr(o,t.ch);u=c%2?"right":"left"}var d=cu(i.map,t.ch,u);return d.offset=d.collapse=="right"?d.end:d.start,d}function rv(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Pn(e,t){return t&&(e.bad=!0),e}function nv(e,t,n,r,i){var o="",u=!1,c=e.doc.lineSeparator(),d=!1;function v(_){return function(M){return M.id==_}}function x(){u&&(o+=c,d&&(o+=c),u=d=!1)}function C(_){_&&(x(),o+=_)}function O(_){if(_.nodeType==1){var M=_.getAttribute("cm-text");if(M){C(M);return}var F=_.getAttribute("cm-marker"),U;if(F){var j=e.findMarks(I(r,0),I(i+1,0),v(+F));j.length&&(U=j[0].find(0))&&C(hr(e.doc,U.from,U.to).join(c));return}if(_.getAttribute("contenteditable")=="false")return;var K=/^(pre|div|p|li|table|br)$/i.test(_.nodeName);if(!/^br$/i.test(_.nodeName)&&_.textContent.length==0)return;K&&x();for(var q=0;q<_.childNodes.length;q++)O(_.childNodes[q]);/^(pre|p)$/i.test(_.nodeName)&&(d=!0),K&&(u=!0)}else _.nodeType==3&&C(_.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;O(t),t!=n;)t=t.nextSibling,d=!1;return o}function Ea(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return Pn(e.clipPos(I(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==r)return iv(o,t,n)}}function iv(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!Ze(r,t))return Pn(I(m(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var o=e.rest?me(e.rest):e.line;return Pn(I(m(o),o.text.length),i)}var u=t.nodeType==3?t:null,c=t;for(!u&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(u=t.firstChild,n&&(n=u.nodeValue.length));c.parentNode!=r;)c=c.parentNode;var d=e.measure,v=d.maps;function x(U,j,K){for(var q=-1;q<(v?v.length:0);q++)for(var Q=q<0?d.map:v[q],re=0;re<Q.length;re+=3){var J=Q[re+2];if(J==U||J==j){var ce=m(q<0?e.line:e.rest[q]),Le=Q[re]+K;return(K<0||J!=U)&&(Le=Q[re+(K?1:0)]),I(ce,Le)}}}var C=x(u,c,n);if(C)return Pn(C,i);for(var O=c.nextSibling,_=u?u.nodeValue.length-n:0;O;O=O.nextSibling){if(C=x(O,O.firstChild,0),C)return Pn(I(C.line,C.ch-_),i);_+=O.textContent.length}for(var M=c.previousSibling,F=n;M;M=M.previousSibling){if(C=x(M,M.firstChild,-1),C)return Pn(I(C.line,C.ch+F),i);F+=M.textContent.length}}var Ue=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new Vt,this.hasSelection=!1,this.composing=null,this.resetting=!1};Ue.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),D&&(i.style.width="0px"),te(i,"input",function(){w&&b>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),te(i,"paste",function(u){Fe(r,u)||Of(u,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())});function o(u){if(!Fe(r,u)){if(r.somethingSelected())Oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var c=Df(r);Oa({lineWise:!0,text:c.text}),u.type=="cut"?r.setSelections(c.ranges,null,Ot):(n.prevInput="",i.value=c.text.join(`
20
+ `),$r(i))}else return;u.type=="cut"&&(r.state.cutIncoming=+new Date)}}te(i,"cut",o),te(i,"copy",o),te(e.scroller,"paste",function(u){if(!(gr(e,u)||Fe(r,u))){if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var c=new Event("paste");c.clipboardData=u.clipboardData,i.dispatchEvent(c)}}),te(e.lineSpace,"selectstart",function(u){gr(e,u)||lt(u)}),te(i,"compositionstart",function(){var u=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:u,range:r.markText(u,r.getCursor("to"),{className:"CodeMirror-composing"})}}),te(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},Ue.prototype.createField=function(e){this.wrapper=If(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;to(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},Ue.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ue.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=ku(e);if(e.options.moveInputWithCursor){var i=Xt(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),u=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+u.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+u.left-o.left))}return r},Ue.prototype.showSelection=function(e){var t=this.cm,n=t.display;Y(n.cursorDiv,e.cursors),Y(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ue.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&$r(this.textarea),w&&b>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",w&&b>=9&&(this.hasSelection=null));this.resetting=!1}},Ue.prototype.getField=function(){return this.textarea},Ue.prototype.supportsTouch=function(){return!1},Ue.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!G||qe(Ve(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},Ue.prototype.blur=function(){this.textarea.blur()},Ue.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ue.prototype.receivedFocus=function(){this.slowPoll()},Ue.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ue.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},Ue.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Lr(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(w&&b>=9&&this.hasSelection===i||Z&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(o==8203&&!r&&(r="​"),o==8666)return this.reset(),this.cm.execCommand("undo")}for(var u=0,c=Math.min(r.length,i.length);u<c&&r.charCodeAt(u)==i.charCodeAt(u);)++u;return Ct(t,function(){eo(t,i.slice(u),r.length-u,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
21
+ `)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Ue.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ue.prototype.onKeyPress=function(){w&&b>=9&&(this.hasSelection=null),this.fastPoll()},Ue.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=Kr(n,e),u=r.scroller.scrollTop;if(!o||P)return;var c=n.options.resetSelectionOnContextMenu;c&&n.doc.sel.contains(o)==-1&&tt(n,ut)(n.doc,Dr(o),Ot);var d=i.style.cssText,v=t.wrapper.style.cssText,x=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
22
+ top: `+(e.clientY-x.top-5)+"px; left: "+(e.clientX-x.left-5)+`px;
23
+ z-index: 1000; background: `+(w?"rgba(255, 255, 255, .05)":"transparent")+`;
24
+ outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var C;k&&(C=i.ownerDocument.defaultView.scrollY),r.input.focus(),k&&i.ownerDocument.defaultView.scrollTo(null,C),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=_,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function O(){if(i.selectionStart!=null){var F=n.somethingSelected(),U="​"+(F?i.value:"");i.value="⇚",i.value=U,t.prevInput=F?"":"​",i.selectionStart=1,i.selectionEnd=U.length,r.selForContextMenu=n.doc.sel}}function _(){if(t.contextMenuPending==_&&(t.contextMenuPending=!1,t.wrapper.style.cssText=v,i.style.cssText=d,w&&b<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=u),i.selectionStart!=null)){(!w||w&&b<9)&&O();var F=0,U=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="​"?tt(n,Vu)(n):F++<10?r.detectingSelectAll=setTimeout(U,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(U,200)}}if(w&&b>=9&&O(),ke){Cr(e);var M=function(){ot(window,"mouseup",M),setTimeout(_,20)};te(window,"mouseup",M)}else setTimeout(_,50)},Ue.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},Ue.prototype.setUneditable=function(){},Ue.prototype.needsContentAttribute=!1;function av(e,t){if(t=t?he(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=qe(Ve(e));t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=c.getValue()}var i;if(e.form&&(te(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var u=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=u}}catch{}}t.finishInit=function(d){d.save=r,d.getTextArea=function(){return e},d.toTextArea=function(){d.toTextArea=isNaN,r(),e.parentNode.removeChild(d.getWrapperElement()),e.style.display="",e.form&&(ot(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var c=Ie(function(d){return e.parentNode.insertBefore(d,e.nextSibling)},t);return c}function sv(e){e.off=ot,e.on=te,e.wheelEventPixels=dg,e.Doc=bt,e.splitLines=Pt,e.countColumn=xe,e.findColumn=er,e.isWordChar=ei,e.Pass=wr,e.signal=Pe,e.Line=xn,e.changeEnd=Ir,e.scrollbarModel=Au,e.Pos=I,e.cmpPos=X,e.modes=gn,e.mimeModes=jt,e.resolveMode=vn,e.getMode=mn,e.modeExtensions=_r,e.extendMode=yn,e.copyState=rr,e.startState=bn,e.innerMode=ni,e.commands=_i,e.keyMap=mr,e.keyName=gf,e.isModifierKey=df,e.lookupKey=Mn,e.normalizeKeyMap=Rg,e.StringStream=He,e.SharedTextMarker=Ci,e.TextMarker=Mr,e.LineWidget=Si,e.e_preventDefault=lt,e.e_stopPropagation=dn,e.e_stop=Cr,e.addClass=ze,e.contains=Ze,e.rmClass=ct,e.keyNames=Rr}Qg(Ie),tv(Ie);var ov="iter insert remove copy getEditor constructor".split(" ");for(var Da in bt.prototype)bt.prototype.hasOwnProperty(Da)&&fe(ov,Da)<0&&(Ie.prototype[Da]=function(e){return function(){return e.apply(this.doc,arguments)}}(bt.prototype[Da]));return Bt(bt),Ie.inputStyles={textarea:Ue,contenteditable:Se},Ie.defineMode=function(e){!Ie.defaults.mode&&e!="null"&&(Ie.defaults.mode=e),qt.apply(this,arguments)},Ie.defineMIME=qr,Ie.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ie.defineMIME("text/plain","null"),Ie.defineExtension=function(e,t){Ie.prototype[e]=t},Ie.defineDocExtension=function(e,t){bt.prototype[e]=t},Ie.fromTextArea=av,sv(Ie),Ie.version="5.65.20",Ie})}(Na)),Na.exports}(function(f,a){(function(s){s(br())})(function(s){s.defineMode("javascript",function(l,h){var g=l.indentUnit,p=h.statementIndent,y=h.jsonld,w=h.json||y,b=h.trackScope!==!1,k=h.typescript,A=h.wordCharacters||/[\w$\xa1-\uffff]/,L=function(){function m(Je){return{type:Je,style:"keyword"}}var S=m("keyword a"),z=m("keyword b"),B=m("keyword c"),I=m("keyword d"),X=m("operator"),ye={type:"atom",style:"atom"};return{if:m("if"),while:S,with:S,else:z,do:z,try:z,finally:z,return:I,break:I,continue:I,new:m("new"),delete:B,void:B,throw:B,debugger:m("debugger"),var:m("var"),const:m("var"),let:m("var"),function:m("function"),catch:m("catch"),for:m("for"),switch:m("switch"),case:m("case"),default:m("default"),in:X,typeof:X,instanceof:X,true:ye,false:ye,null:ye,undefined:ye,NaN:ye,Infinity:ye,this:m("this"),class:m("class"),super:m("atom"),yield:B,export:m("export"),import:m("import"),extends:B,await:B}}(),H=/[+\-*&%=<>!?|~^@]/,P=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function $(m){for(var S=!1,z,B=!1;(z=m.next())!=null;){if(!S){if(z=="/"&&!B)return;z=="["?B=!0:B&&z=="]"&&(B=!1)}S=!S&&z=="\\"}}var N,E;function D(m,S,z){return N=m,E=z,S}function R(m,S){var z=m.next();if(z=='"'||z=="'")return S.tokenize=G(z),S.tokenize(m,S);if(z=="."&&m.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return D("number","number");if(z=="."&&m.match(".."))return D("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(z))return D(z);if(z=="="&&m.eat(">"))return D("=>","operator");if(z=="0"&&m.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return D("number","number");if(/\d/.test(z))return m.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),D("number","number");if(z=="/")return m.eat("*")?(S.tokenize=Z,Z(m,S)):m.eat("/")?(m.skipToEnd(),D("comment","comment")):Dt(m,S,1)?($(m),m.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),D("regexp","string-2")):(m.eat("="),D("operator","operator",m.current()));if(z=="`")return S.tokenize=ee,ee(m,S);if(z=="#"&&m.peek()=="!")return m.skipToEnd(),D("meta","meta");if(z=="#"&&m.eatWhile(A))return D("variable","property");if(z=="<"&&m.match("!--")||z=="-"&&m.match("->")&&!/\S/.test(m.string.slice(0,m.start)))return m.skipToEnd(),D("comment","comment");if(H.test(z))return(z!=">"||!S.lexical||S.lexical.type!=">")&&(m.eat("=")?(z=="!"||z=="=")&&m.eat("="):/[<>*+\-|&?]/.test(z)&&(m.eat(z),z==">"&&m.eat(z))),z=="?"&&m.eat(".")?D("."):D("operator","operator",m.current());if(A.test(z)){m.eatWhile(A);var B=m.current();if(S.lastType!="."){if(L.propertyIsEnumerable(B)){var I=L[B];return D(I.type,I.style,B)}if(B=="async"&&m.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return D("async","keyword",B)}return D("variable","variable",B)}}function G(m){return function(S,z){var B=!1,I;if(y&&S.peek()=="@"&&S.match(P))return z.tokenize=R,D("jsonld-keyword","meta");for(;(I=S.next())!=null&&!(I==m&&!B);)B=!B&&I=="\\";return B||(z.tokenize=R),D("string","string")}}function Z(m,S){for(var z=!1,B;B=m.next();){if(B=="/"&&z){S.tokenize=R;break}z=B=="*"}return D("comment","comment")}function ee(m,S){for(var z=!1,B;(B=m.next())!=null;){if(!z&&(B=="`"||B=="$"&&m.eat("{"))){S.tokenize=R;break}z=!z&&B=="\\"}return D("quasi","string-2",m.current())}var ne="([{}])";function ue(m,S){S.fatArrowAt&&(S.fatArrowAt=null);var z=m.string.indexOf("=>",m.start);if(!(z<0)){if(k){var B=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(m.string.slice(m.start,z));B&&(z=B.index)}for(var I=0,X=!1,ye=z-1;ye>=0;--ye){var Je=m.string.charAt(ye),mt=ne.indexOf(Je);if(mt>=0&&mt<3){if(!I){++ye;break}if(--I==0){Je=="("&&(X=!0);break}}else if(mt>=3&&mt<6)++I;else if(A.test(Je))X=!0;else if(/["'\/`]/.test(Je))for(;;--ye){if(ye==0)return;var wn=m.string.charAt(ye-1);if(wn==Je&&m.string.charAt(ye-2)!="\\"){ye--;break}}else if(X&&!I){++ye;break}}X&&!I&&(S.fatArrowAt=ye)}}var Ee={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function ke(m,S,z,B,I,X){this.indented=m,this.column=S,this.type=z,this.prev=I,this.info=X,B!=null&&(this.align=B)}function Ce(m,S){if(!b)return!1;for(var z=m.localVars;z;z=z.next)if(z.name==S)return!0;for(var B=m.context;B;B=B.prev)for(var z=B.vars;z;z=z.next)if(z.name==S)return!0}function ct(m,S,z,B,I){var X=m.cc;for(W.state=m,W.stream=I,W.marked=null,W.cc=X,W.style=S,m.lexical.hasOwnProperty("align")||(m.lexical.align=!0);;){var ye=X.length?X.pop():w?fe:xe;if(ye(z,B)){for(;X.length&&X[X.length-1].lex;)X.pop()();return W.marked?W.marked:z=="variable"&&Ce(m,B)?"variable-2":S}}}var W={state:null,marked:null,cc:null};function Y(){for(var m=arguments.length-1;m>=0;m--)W.cc.push(arguments[m])}function T(){return Y.apply(null,arguments),!0}function ht(m,S){for(var z=S;z;z=z.next)if(z.name==m)return!0;return!1}function st(m){var S=W.state;if(W.marked="def",!!b){if(S.context){if(S.lexical.info=="var"&&S.context&&S.context.block){var z=Ze(m,S.context);if(z!=null){S.context=z;return}}else if(!ht(m,S.localVars)){S.localVars=new Qe(m,S.localVars);return}}h.globalVars&&!ht(m,S.globalVars)&&(S.globalVars=new Qe(m,S.globalVars))}}function Ze(m,S){if(S)if(S.block){var z=Ze(m,S.prev);return z?z==S.prev?S:new ze(z,S.vars,!0):null}else return ht(m,S.vars)?S:new ze(S.prev,new Qe(m,S.vars),!1);else return null}function qe(m){return m=="public"||m=="private"||m=="protected"||m=="abstract"||m=="readonly"}function ze(m,S,z){this.prev=m,this.vars=S,this.block=z}function Qe(m,S){this.name=m,this.next=S}var $r=new Qe("this",new Qe("arguments",null));function At(){W.state.context=new ze(W.state.context,W.state.localVars,!1),W.state.localVars=$r}function Wt(){W.state.context=new ze(W.state.context,W.state.localVars,!0),W.state.localVars=null}At.lex=Wt.lex=!0;function Ve(){W.state.localVars=W.state.context.vars,W.state.context=W.state.context.prev}Ve.lex=!0;function oe(m,S){var z=function(){var B=W.state,I=B.indented;if(B.lexical.type=="stat")I=B.lexical.indented;else for(var X=B.lexical;X&&X.type==")"&&X.align;X=X.prev)I=X.indented;B.lexical=new ke(I,W.stream.column(),m,null,B.lexical,S)};return z.lex=!0,z}function ie(){var m=W.state;m.lexical.prev&&(m.lexical.type==")"&&(m.indented=m.lexical.indented),m.lexical=m.lexical.prev)}ie.lex=!0;function he(m){function S(z){return z==m?T():m==";"||z=="}"||z==")"||z=="]"?Y():T(S)}return S}function xe(m,S){return m=="var"?T(oe("vardef",S),dn,he(";"),ie):m=="keyword a"?T(oe("form"),wr,xe,ie):m=="keyword b"?T(oe("form"),xe,ie):m=="keyword d"?W.stream.match(/^\s*$/,!1)?T():T(oe("stat"),Jt,he(";"),ie):m=="debugger"?T(he(";")):m=="{"?T(oe("}"),Wt,tr,ie,Ve):m==";"?T():m=="if"?(W.state.lexical.info=="else"&&W.state.cc[W.state.cc.length-1]==ie&&W.state.cc.pop()(),T(oe("form"),wr,xe,ie,pn)):m=="function"?T(Pt):m=="for"?T(oe("form"),Wt,ea,xe,Ve,ie):m=="class"||k&&S=="interface"?(W.marked="keyword",T(oe("form",m=="class"?m:S),gn,ie)):m=="variable"?k&&S=="declare"?(W.marked="keyword",T(xe)):k&&(S=="module"||S=="enum"||S=="type")&&W.stream.match(/^\s*\w/,!1)?(W.marked="keyword",S=="enum"?T(V):S=="type"?T(ta,he("operator"),ge,he(";")):T(oe("form"),vt,he("{"),oe("}"),tr,ie,ie)):k&&S=="namespace"?(W.marked="keyword",T(oe("form"),fe,xe,ie)):k&&S=="abstract"?(W.marked="keyword",T(xe)):T(oe("stat"),ls):m=="switch"?T(oe("form"),wr,he("{"),oe("}","switch"),Wt,tr,ie,ie,Ve):m=="case"?T(fe,he(":")):m=="default"?T(he(":")):m=="catch"?T(oe("form"),At,Vt,xe,ie,Ve):m=="export"?T(oe("stat"),vn,ie):m=="import"?T(oe("stat"),_r,ie):m=="async"?T(xe):S=="@"?T(fe,xe):Y(oe("stat"),fe,he(";"),ie)}function Vt(m){if(m=="(")return T(Ut,he(")"))}function fe(m,S){return Ot(m,S,!1)}function dt(m,S){return Ot(m,S,!0)}function wr(m){return m!="("?Y():T(oe(")"),Jt,he(")"),ie)}function Ot(m,S,z){if(W.state.fatArrowAt==W.stream.start){var B=z?Ur:me;if(m=="(")return T(At,oe(")"),Ge(Ut,")"),ie,he("=>"),B,Ve);if(m=="variable")return Y(At,vt,he("=>"),B,Ve)}var I=z?er:Et;return Ee.hasOwnProperty(m)?T(I):m=="function"?T(Pt,I):m=="class"||k&&S=="interface"?(W.marked="keyword",T(oe("form"),cs,ie)):m=="keyword c"||m=="async"?T(z?dt:fe):m=="("?T(oe(")"),Jt,he(")"),ie,I):m=="operator"||m=="spread"?T(z?dt:fe):m=="["?T(oe("]"),He,ie,I):m=="{"?xr(ur,"}",null,I):m=="quasi"?Y(lr,I):m=="new"?T(os(z)):T()}function Jt(m){return m.match(/[;\}\)\],]/)?Y():Y(fe)}function Et(m,S){return m==","?T(Jt):er(m,S,!1)}function er(m,S,z){var B=z==!1?Et:er,I=z==!1?fe:dt;if(m=="=>")return T(At,z?Ur:me,Ve);if(m=="operator")return/\+\+|--/.test(S)||k&&S=="!"?T(B):k&&S=="<"&&W.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?T(oe(">"),Ge(ge,">"),ie,B):S=="?"?T(fe,he(":"),I):T(I);if(m=="quasi")return Y(lr,B);if(m!=";"){if(m=="(")return xr(dt,")","call",B);if(m==".")return T(ei,B);if(m=="[")return T(oe("]"),Jt,he("]"),ie,B);if(k&&S=="as")return W.marked="keyword",T(ge,B);if(m=="regexp")return W.state.lastType=W.marked="operator",W.stream.backUp(W.stream.pos-W.stream.start-1),T(I)}}function lr(m,S){return m!="quasi"?Y():S.slice(S.length-2)!="${"?T(lr):T(Jt,Jn)}function Jn(m){if(m=="}")return W.marked="string-2",W.state.tokenize=ee,T(lr)}function me(m){return ue(W.stream,W.state),Y(m=="{"?xe:fe)}function Ur(m){return ue(W.stream,W.state),Y(m=="{"?xe:dt)}function os(m){return function(S){return S=="."?T(m?Qi:Zi):S=="variable"&&k?T(St,m?er:Et):Y(m?dt:fe)}}function Zi(m,S){if(S=="target")return W.marked="keyword",T(Et)}function Qi(m,S){if(S=="target")return W.marked="keyword",T(er)}function ls(m){return m==":"?T(ie,xe):Y(Et,he(";"),ie)}function ei(m){if(m=="variable")return W.marked="property",T()}function ur(m,S){if(m=="async")return W.marked="property",T(ur);if(m=="variable"||W.style=="keyword"){if(W.marked="property",S=="get"||S=="set")return T(Vi);var z;return k&&W.state.fatArrowAt==W.stream.start&&(z=W.stream.match(/^\s*:\s*/,!1))&&(W.state.fatArrowAt=W.stream.pos+z[0].length),T(fr)}else{if(m=="number"||m=="string")return W.marked=y?"property":W.style+" property",T(fr);if(m=="jsonld-keyword")return T(fr);if(k&&qe(S))return W.marked="keyword",T(ur);if(m=="[")return T(fe,kr,he("]"),fr);if(m=="spread")return T(dt,fr);if(S=="*")return W.marked="keyword",T(ur);if(m==":")return Y(fr)}}function Vi(m){return m!="variable"?Y(fr):(W.marked="property",T(Pt))}function fr(m){if(m==":")return T(dt);if(m=="(")return Y(Pt)}function Ge(m,S,z){function B(I,X){if(z?z.indexOf(I)>-1:I==","){var ye=W.state.lexical;return ye.info=="call"&&(ye.pos=(ye.pos||0)+1),T(function(Je,mt){return Je==S||mt==S?Y():Y(m)},B)}return I==S||X==S?T():z&&z.indexOf(";")>-1?Y(m):T(he(S))}return function(I,X){return I==S||X==S?T():Y(m,B)}}function xr(m,S,z){for(var B=3;B<arguments.length;B++)W.cc.push(arguments[B]);return T(oe(S,z),Ge(m,S),ie)}function tr(m){return m=="}"?T():Y(xe,tr)}function kr(m,S){if(k){if(m==":")return T(ge);if(S=="?")return T(kr)}}function jr(m,S){if(k&&(m==":"||S=="in"))return T(ge)}function Sr(m){if(k&&m==":")return W.stream.match(/^\s*\w+\s+is\b/,!1)?T(fe,us,ge):T(ge)}function us(m,S){if(S=="is")return W.marked="keyword",T()}function ge(m,S){if(S=="keyof"||S=="typeof"||S=="infer"||S=="readonly")return W.marked="keyword",T(S=="typeof"?dt:ge);if(m=="variable"||S=="void")return W.marked="type",T(zt);if(S=="|"||S=="&")return T(ge);if(m=="string"||m=="number"||m=="atom")return T(zt);if(m=="[")return T(oe("]"),Ge(ge,"]",","),ie,zt);if(m=="{")return T(oe("}"),te,ie,zt);if(m=="(")return T(Ge(Fe,")"),Ji,zt);if(m=="<")return T(Ge(ge,">"),ge);if(m=="quasi")return Y(ot,zt)}function Ji(m){if(m=="=>")return T(ge)}function te(m){return m.match(/[\}\)\]]/)?T():m==","||m==";"?T(te):Y(cr,te)}function cr(m,S){if(m=="variable"||W.style=="keyword")return W.marked="property",T(cr);if(S=="?"||m=="number"||m=="string")return T(cr);if(m==":")return T(ge);if(m=="[")return T(he("variable"),jr,he("]"),cr);if(m=="(")return Y(Lr,cr);if(!m.match(/[;\}\)\],]/))return T()}function ot(m,S){return m!="quasi"?Y():S.slice(S.length-2)!="${"?T(ot):T(ge,Pe)}function Pe(m){if(m=="}")return W.marked="string-2",W.state.tokenize=ee,T(ot)}function Fe(m,S){return m=="variable"&&W.stream.match(/^\s*[?:]/,!1)||S=="?"?T(Fe):m==":"?T(ge):m=="spread"?T(Fe):Y(ge)}function zt(m,S){if(S=="<")return T(oe(">"),Ge(ge,">"),ie,zt);if(S=="|"||m=="."||S=="&")return T(ge);if(m=="[")return T(ge,he("]"),zt);if(S=="extends"||S=="implements")return W.marked="keyword",T(ge);if(S=="?")return T(ge,he(":"),ge)}function St(m,S){if(S=="<")return T(oe(">"),Ge(ge,">"),ie,zt)}function Bt(){return Y(ge,lt)}function lt(m,S){if(S=="=")return T(ge)}function dn(m,S){return S=="enum"?(W.marked="keyword",T(V)):Y(vt,kr,$t,fs)}function vt(m,S){if(k&&qe(S))return W.marked="keyword",T(vt);if(m=="variable")return st(S),T();if(m=="spread")return T(vt);if(m=="[")return xr(ti,"]");if(m=="{")return xr(Cr,"}")}function Cr(m,S){return m=="variable"&&!W.stream.match(/^\s*:/,!1)?(st(S),T($t)):(m=="variable"&&(W.marked="property"),m=="spread"?T(vt):m=="}"?Y():m=="["?T(fe,he("]"),he(":"),Cr):T(he(":"),vt,$t))}function ti(){return Y(vt,$t)}function $t(m,S){if(S=="=")return T(dt)}function fs(m){if(m==",")return T(dn)}function pn(m,S){if(m=="keyword b"&&S=="else")return T(oe("form","else"),xe,ie)}function ea(m,S){if(S=="await")return T(ea);if(m=="(")return T(oe(")"),ri,ie)}function ri(m){return m=="var"?T(dn,Tr):m=="variable"?T(Tr):Y(Tr)}function Tr(m,S){return m==")"?T():m==";"?T(Tr):S=="in"||S=="of"?(W.marked="keyword",T(fe,Tr)):Y(fe,Tr)}function Pt(m,S){if(S=="*")return W.marked="keyword",T(Pt);if(m=="variable")return st(S),T(Pt);if(m=="(")return T(At,oe(")"),Ge(Ut,")"),ie,Sr,xe,Ve);if(k&&S=="<")return T(oe(">"),Ge(Bt,">"),ie,Pt)}function Lr(m,S){if(S=="*")return W.marked="keyword",T(Lr);if(m=="variable")return st(S),T(Lr);if(m=="(")return T(At,oe(")"),Ge(Ut,")"),ie,Sr,Ve);if(k&&S=="<")return T(oe(">"),Ge(Bt,">"),ie,Lr)}function ta(m,S){if(m=="keyword"||m=="variable")return W.marked="type",T(ta);if(S=="<")return T(oe(">"),Ge(Bt,">"),ie)}function Ut(m,S){return S=="@"&&T(fe,Ut),m=="spread"?T(Ut):k&&qe(S)?(W.marked="keyword",T(Ut)):k&&m=="this"?T(kr,$t):Y(vt,kr,$t)}function cs(m,S){return m=="variable"?gn(m,S):jt(m,S)}function gn(m,S){if(m=="variable")return st(S),T(jt)}function jt(m,S){if(S=="<")return T(oe(">"),Ge(Bt,">"),ie,jt);if(S=="extends"||S=="implements"||k&&m==",")return S=="implements"&&(W.marked="keyword"),T(k?ge:fe,jt);if(m=="{")return T(oe("}"),qt,ie)}function qt(m,S){if(m=="async"||m=="variable"&&(S=="static"||S=="get"||S=="set"||k&&qe(S))&&W.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return W.marked="keyword",T(qt);if(m=="variable"||W.style=="keyword")return W.marked="property",T(qr,qt);if(m=="number"||m=="string")return T(qr,qt);if(m=="[")return T(fe,kr,he("]"),qr,qt);if(S=="*")return W.marked="keyword",T(qt);if(k&&m=="(")return Y(Lr,qt);if(m==";"||m==",")return T(qt);if(m=="}")return T();if(S=="@")return T(fe,qt)}function qr(m,S){if(S=="!"||S=="?")return T(qr);if(m==":")return T(ge,$t);if(S=="=")return T(dt);var z=W.state.lexical.prev,B=z&&z.info=="interface";return Y(B?Lr:Pt)}function vn(m,S){return S=="*"?(W.marked="keyword",T(bn,he(";"))):S=="default"?(W.marked="keyword",T(fe,he(";"))):m=="{"?T(Ge(mn,"}"),bn,he(";")):Y(xe)}function mn(m,S){if(S=="as")return W.marked="keyword",T(he("variable"));if(m=="variable")return Y(dt,mn)}function _r(m){return m=="string"?T():m=="("?Y(fe):m=="."?Y(Et):Y(yn,rr,bn)}function yn(m,S){return m=="{"?xr(yn,"}"):(m=="variable"&&st(S),S=="*"&&(W.marked="keyword"),T(ni))}function rr(m){if(m==",")return T(yn,rr)}function ni(m,S){if(S=="as")return W.marked="keyword",T(yn)}function bn(m,S){if(S=="from")return W.marked="keyword",T(fe)}function He(m){return m=="]"?T():Y(Ge(dt,"]"))}function V(){return Y(oe("form"),vt,he("{"),oe("}"),Ge(hr,"}"),ie,ie)}function hr(){return Y(vt,$t)}function ii(m,S){return m.lastType=="operator"||m.lastType==","||H.test(S.charAt(0))||/[,.]/.test(S.charAt(0))}function Dt(m,S,z){return S.tokenize==R&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(S.lastType)||S.lastType=="quasi"&&/\{\s*$/.test(m.string.slice(0,m.pos-(z||0)))}return{startState:function(m){var S={tokenize:R,lastType:"sof",cc:[],lexical:new ke((m||0)-g,0,"block",!1),localVars:h.localVars,context:h.localVars&&new ze(null,null,!1),indented:m||0};return h.globalVars&&typeof h.globalVars=="object"&&(S.globalVars=h.globalVars),S},token:function(m,S){if(m.sol()&&(S.lexical.hasOwnProperty("align")||(S.lexical.align=!1),S.indented=m.indentation(),ue(m,S)),S.tokenize!=Z&&m.eatSpace())return null;var z=S.tokenize(m,S);return N=="comment"?z:(S.lastType=N=="operator"&&(E=="++"||E=="--")?"incdec":N,ct(S,z,N,E,m))},indent:function(m,S){if(m.tokenize==Z||m.tokenize==ee)return s.Pass;if(m.tokenize!=R)return 0;var z=S&&S.charAt(0),B=m.lexical,I;if(!/^\s*else\b/.test(S))for(var X=m.cc.length-1;X>=0;--X){var ye=m.cc[X];if(ye==ie)B=B.prev;else if(ye!=pn&&ye!=Ve)break}for(;(B.type=="stat"||B.type=="form")&&(z=="}"||(I=m.cc[m.cc.length-1])&&(I==Et||I==er)&&!/^[,\.=+\-*:?[\(]/.test(S));)B=B.prev;p&&B.type==")"&&B.prev.type=="stat"&&(B=B.prev);var Je=B.type,mt=z==Je;return Je=="vardef"?B.indented+(m.lastType=="operator"||m.lastType==","?B.info.length+1:0):Je=="form"&&z=="{"?B.indented:Je=="form"?B.indented+g:Je=="stat"?B.indented+(ii(m,S)?p||g:0):B.info=="switch"&&!mt&&h.doubleIndentSwitch!=!1?B.indented+(/^(?:case|default)\b/.test(S)?g:2*g):B.align?B.column+(mt?0:1):B.indented+(mt?0:g)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:w?null:"/*",blockCommentEnd:w?null:"*/",blockCommentContinue:w?null:" * ",lineComment:w?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:w?"json":"javascript",jsonldMode:y,jsonMode:w,expressionAllowed:Dt,skipExpression:function(m){ct(m,"atom","atom","true",new s.StringStream("",2,null))}}}),s.registerHelper("wordChars","javascript",/[\w$]/),s.defineMIME("text/javascript","javascript"),s.defineMIME("text/ecmascript","javascript"),s.defineMIME("application/javascript","javascript"),s.defineMIME("application/x-javascript","javascript"),s.defineMIME("application/ecmascript","javascript"),s.defineMIME("application/json",{name:"javascript",json:!0}),s.defineMIME("application/x-json",{name:"javascript",json:!0}),s.defineMIME("application/manifest+json",{name:"javascript",json:!0}),s.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),s.defineMIME("text/typescript",{name:"javascript",typescript:!0}),s.defineMIME("application/typescript",{name:"javascript",typescript:!0})})})(),function(f,a){(function(s){s(br())})(function(s){var l={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},h=s.Pos;s.defineOption("autoCloseBrackets",!1,function(E,D,R){R&&R!=s.Init&&(E.removeKeyMap(p),E.state.closeBrackets=null),D&&(y(g(D,"pairs")),E.state.closeBrackets=D,E.addKeyMap(p))});function g(E,D){return D=="pairs"&&typeof E=="string"?E:typeof E=="object"&&E[D]!=null?E[D]:l[D]}var p={Backspace:k,Enter:A};function y(E){for(var D=0;D<E.length;D++){var R=E.charAt(D),G="'"+R+"'";p[G]||(p[G]=w(R))}}y(l.pairs+"`");function w(E){return function(D){return P(D,E)}}function b(E){var D=E.state.closeBrackets;if(!D||D.override)return D;var R=E.getModeAt(E.getCursor());return R.closeBrackets||D}function k(E){var D=b(E);if(!D||E.getOption("disableInput"))return s.Pass;for(var R=g(D,"pairs"),G=E.listSelections(),Z=0;Z<G.length;Z++){if(!G[Z].empty())return s.Pass;var ee=$(E,G[Z].head);if(!ee||R.indexOf(ee)%2!=0)return s.Pass}for(var Z=G.length-1;Z>=0;Z--){var ne=G[Z].head;E.replaceRange("",h(ne.line,ne.ch-1),h(ne.line,ne.ch+1),"+delete")}}function A(E){var D=b(E),R=D&&g(D,"explode");if(!R||E.getOption("disableInput"))return s.Pass;for(var G=E.listSelections(),Z=0;Z<G.length;Z++){if(!G[Z].empty())return s.Pass;var ee=$(E,G[Z].head);if(!ee||R.indexOf(ee)%2!=0)return s.Pass}E.operation(function(){var ne=E.lineSeparator()||`
25
+ `;E.replaceSelection(ne+ne,null),L(E,-1),G=E.listSelections();for(var ue=0;ue<G.length;ue++){var Ee=G[ue].head.line;E.indentLine(Ee,null,!0),E.indentLine(Ee+1,null,!0)}})}function L(E,D){for(var R=[],G=E.listSelections(),Z=0,ee=0;ee<G.length;ee++){var ne=G[ee];ne.head==E.getCursor()&&(Z=ee);var ue=ne.head.ch||D>0?{line:ne.head.line,ch:ne.head.ch+D}:{line:ne.head.line-1};R.push({anchor:ue,head:ue})}E.setSelections(R,Z)}function H(E){var D=s.cmpPos(E.anchor,E.head)>0;return{anchor:new h(E.anchor.line,E.anchor.ch+(D?-1:1)),head:new h(E.head.line,E.head.ch+(D?1:-1))}}function P(E,D){var R=b(E);if(!R||E.getOption("disableInput"))return s.Pass;var G=g(R,"pairs"),Z=G.indexOf(D);if(Z==-1)return s.Pass;for(var ee=g(R,"closeBefore"),ne=g(R,"triples"),ue=G.charAt(Z+1)==D,Ee=E.listSelections(),ke=Z%2==0,Ce,ct=0;ct<Ee.length;ct++){var W=Ee[ct],Y=W.head,T,ht=E.getRange(Y,h(Y.line,Y.ch+1));if(ke&&!W.empty())T="surround";else if((ue||!ke)&&ht==D)ue&&N(E,Y)?T="both":ne.indexOf(D)>=0&&E.getRange(Y,h(Y.line,Y.ch+3))==D+D+D?T="skipThree":T="skip";else if(ue&&Y.ch>1&&ne.indexOf(D)>=0&&E.getRange(h(Y.line,Y.ch-2),Y)==D+D){if(Y.ch>2&&/\bstring/.test(E.getTokenTypeAt(h(Y.line,Y.ch-2))))return s.Pass;T="addFour"}else if(ue){var st=Y.ch==0?" ":E.getRange(h(Y.line,Y.ch-1),Y);if(!s.isWordChar(ht)&&st!=D&&!s.isWordChar(st))T="both";else return s.Pass}else if(ke&&(ht.length===0||/\s/.test(ht)||ee.indexOf(ht)>-1))T="both";else return s.Pass;if(!Ce)Ce=T;else if(Ce!=T)return s.Pass}var Ze=Z%2?G.charAt(Z-1):D,qe=Z%2?D:G.charAt(Z+1);E.operation(function(){if(Ce=="skip")L(E,1);else if(Ce=="skipThree")L(E,3);else if(Ce=="surround"){for(var ze=E.getSelections(),Qe=0;Qe<ze.length;Qe++)ze[Qe]=Ze+ze[Qe]+qe;E.replaceSelections(ze,"around"),ze=E.listSelections().slice();for(var Qe=0;Qe<ze.length;Qe++)ze[Qe]=H(ze[Qe]);E.setSelections(ze)}else Ce=="both"?(E.replaceSelection(Ze+qe,null),E.triggerElectric(Ze+qe),L(E,-1)):Ce=="addFour"&&(E.replaceSelection(Ze+Ze+Ze+Ze,"before"),L(E,1))})}function $(E,D){var R=E.getRange(h(D.line,D.ch-1),h(D.line,D.ch+1));return R.length==2?R:null}function N(E,D){var R=E.getTokenAt(h(D.line,D.ch+1));return/\bstring/.test(R.type)&&R.start==D.ch&&(D.ch==0||!/\bstring/.test(E.getTokenTypeAt(D)))}})}(),function(f,a){(function(s){s(br())})(function(s){var l=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),h=s.Pos,g={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function p(L){return L&&L.bracketRegex||/[(){}[\]]/}function y(L,H,P){var $=L.getLineHandle(H.line),N=H.ch-1,E=P&&P.afterCursor;E==null&&(E=/(^| )cm-fat-cursor($| )/.test(L.getWrapperElement().className));var D=p(P),R=!E&&N>=0&&D.test($.text.charAt(N))&&g[$.text.charAt(N)]||D.test($.text.charAt(N+1))&&g[$.text.charAt(++N)];if(!R)return null;var G=R.charAt(1)==">"?1:-1;if(P&&P.strict&&G>0!=(N==H.ch))return null;var Z=L.getTokenTypeAt(h(H.line,N+1)),ee=w(L,h(H.line,N+(G>0?1:0)),G,Z,P);return ee==null?null:{from:h(H.line,N),to:ee&&ee.pos,match:ee&&ee.ch==R.charAt(0),forward:G>0}}function w(L,H,P,$,N){for(var E=N&&N.maxScanLineLength||1e4,D=N&&N.maxScanLines||1e3,R=[],G=p(N),Z=P>0?Math.min(H.line+D,L.lastLine()+1):Math.max(L.firstLine()-1,H.line-D),ee=H.line;ee!=Z;ee+=P){var ne=L.getLine(ee);if(ne){var ue=P>0?0:ne.length-1,Ee=P>0?ne.length:-1;if(!(ne.length>E))for(ee==H.line&&(ue=H.ch-(P<0?1:0));ue!=Ee;ue+=P){var ke=ne.charAt(ue);if(G.test(ke)&&($===void 0||(L.getTokenTypeAt(h(ee,ue+1))||"")==($||""))){var Ce=g[ke];if(Ce&&Ce.charAt(1)==">"==P>0)R.push(ke);else if(R.length)R.pop();else return{pos:h(ee,ue),ch:ke}}}}}return ee-P==(P>0?L.lastLine():L.firstLine())?!1:null}function b(L,H,P){for(var $=L.state.matchBrackets.maxHighlightLineLength||1e3,N=P&&P.highlightNonMatching,E=[],D=L.listSelections(),R=0;R<D.length;R++){var G=D[R].empty()&&y(L,D[R].head,P);if(G&&(G.match||N!==!1)&&L.getLine(G.from.line).length<=$){var Z=G.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";E.push(L.markText(G.from,h(G.from.line,G.from.ch+1),{className:Z})),G.to&&L.getLine(G.to.line).length<=$&&E.push(L.markText(G.to,h(G.to.line,G.to.ch+1),{className:Z}))}}if(E.length){l&&L.state.focused&&L.focus();var ee=function(){L.operation(function(){for(var ne=0;ne<E.length;ne++)E[ne].clear()})};if(H)setTimeout(ee,800);else return ee}}function k(L){L.operation(function(){L.state.matchBrackets.currentlyHighlighted&&(L.state.matchBrackets.currentlyHighlighted(),L.state.matchBrackets.currentlyHighlighted=null),L.state.matchBrackets.currentlyHighlighted=b(L,!1,L.state.matchBrackets)})}function A(L){L.state.matchBrackets&&L.state.matchBrackets.currentlyHighlighted&&(L.state.matchBrackets.currentlyHighlighted(),L.state.matchBrackets.currentlyHighlighted=null)}s.defineOption("matchBrackets",!1,function(L,H,P){P&&P!=s.Init&&(L.off("cursorActivity",k),L.off("focus",k),L.off("blur",A),A(L)),H&&(L.state.matchBrackets=typeof H=="object"?H:{},L.on("cursorActivity",k),L.on("focus",k),L.on("blur",A))}),s.defineExtension("matchBrackets",function(){b(this,!0)}),s.defineExtension("findMatchingBracket",function(L,H,P){return(P||typeof H=="boolean")&&(P?(P.strict=H,H=P):H=H?{strict:!0}:null),y(this,L,H)}),s.defineExtension("scanForBracket",function(L,H,P,$){return w(this,L,H,P,$)})})}();var lo={exports:{}},uo;function fo(){return uo||(uo=1,function(f,a){(function(s){s(br())})(function(s){function l(y,w,b,k){if(b&&b.call){var A=b;b=null}else var A=p(y,b,"rangeFinder");typeof w=="number"&&(w=s.Pos(w,0));var L=p(y,b,"minFoldSize");function H(E){var D=A(y,w);if(!D||D.to.line-D.from.line<L)return null;if(k==="fold")return D;for(var R=y.findMarksAt(D.from),G=0;G<R.length;++G)if(R[G].__isFold){if(!E)return null;D.cleared=!0,R[G].clear()}return D}var P=H(!0);if(p(y,b,"scanUp"))for(;!P&&w.line>y.firstLine();)w=s.Pos(w.line-1,0),P=H(!1);if(!(!P||P.cleared||k==="unfold")){var $=h(y,b,P);s.on($,"mousedown",function(E){N.clear(),s.e_preventDefault(E)});var N=y.markText(P.from,P.to,{replacedWith:$,clearOnEnter:p(y,b,"clearOnEnter"),__isFold:!0});N.on("clear",function(E,D){s.signal(y,"unfold",y,E,D)}),s.signal(y,"fold",y,P.from,P.to)}}function h(y,w,b){var k=p(y,w,"widget");if(typeof k=="function"&&(k=k(b.from,b.to)),typeof k=="string"){var A=document.createTextNode(k);k=document.createElement("span"),k.appendChild(A),k.className="CodeMirror-foldmarker"}else k&&(k=k.cloneNode(!0));return k}s.newFoldFunction=function(y,w){return function(b,k){l(b,k,{rangeFinder:y,widget:w})}},s.defineExtension("foldCode",function(y,w,b){l(this,y,w,b)}),s.defineExtension("isFolded",function(y){for(var w=this.findMarksAt(y),b=0;b<w.length;++b)if(w[b].__isFold)return!0}),s.commands.toggleFold=function(y){y.foldCode(y.getCursor())},s.commands.fold=function(y){y.foldCode(y.getCursor(),null,"fold")},s.commands.unfold=function(y){y.foldCode(y.getCursor(),{scanUp:!1},"unfold")},s.commands.foldAll=function(y){y.operation(function(){for(var w=y.firstLine(),b=y.lastLine();w<=b;w++)y.foldCode(s.Pos(w,0),{scanUp:!1},"fold")})},s.commands.unfoldAll=function(y){y.operation(function(){for(var w=y.firstLine(),b=y.lastLine();w<=b;w++)y.foldCode(s.Pos(w,0),{scanUp:!1},"unfold")})},s.registerHelper("fold","combine",function(){var y=Array.prototype.slice.call(arguments,0);return function(w,b){for(var k=0;k<y.length;++k){var A=y[k](w,b);if(A)return A}}}),s.registerHelper("fold","auto",function(y,w){for(var b=y.getHelpers(w,"fold"),k=0;k<b.length;k++){var A=b[k](y,w);if(A)return A}});var g={rangeFinder:s.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};s.defineOption("foldOptions",null);function p(y,w,b){if(w&&w[b]!==void 0)return w[b];var k=y.options.foldOptions;return k&&k[b]!==void 0?k[b]:g[b]}s.defineExtension("foldOption",function(y,w){return p(this,y,w)})})}()),lo.exports}fo(),function(f,a){(function(s){s(br(),fo())})(function(s){s.defineOption("foldGutter",!1,function(N,E,D){D&&D!=s.Init&&(N.clearGutter(N.state.foldGutter.options.gutter),N.state.foldGutter=null,N.off("gutterClick",A),N.off("changes",H),N.off("viewportChange",P),N.off("fold",$),N.off("unfold",$),N.off("swapDoc",H),N.off("optionChange",L)),E&&(N.state.foldGutter=new h(g(E)),k(N),N.on("gutterClick",A),N.on("changes",H),N.on("viewportChange",P),N.on("fold",$),N.on("unfold",$),N.on("swapDoc",H),N.on("optionChange",L))});var l=s.Pos;function h(N){this.options=N,this.from=this.to=0}function g(N){return N===!0&&(N={}),N.gutter==null&&(N.gutter="CodeMirror-foldgutter"),N.indicatorOpen==null&&(N.indicatorOpen="CodeMirror-foldgutter-open"),N.indicatorFolded==null&&(N.indicatorFolded="CodeMirror-foldgutter-folded"),N}function p(N,E){for(var D=N.findMarks(l(E,0),l(E+1,0)),R=0;R<D.length;++R)if(D[R].__isFold){var G=D[R].find(-1);if(G&&G.line===E)return D[R]}}function y(N){if(typeof N=="string"){var E=document.createElement("div");return E.className=N+" CodeMirror-guttermarker-subtle",E}else return N.cloneNode(!0)}function w(N,E,D){var R=N.state.foldGutter.options,G=E-1,Z=N.foldOption(R,"minFoldSize"),ee=N.foldOption(R,"rangeFinder"),ne=typeof R.indicatorFolded=="string"&&b(R.indicatorFolded),ue=typeof R.indicatorOpen=="string"&&b(R.indicatorOpen);N.eachLine(E,D,function(Ee){++G;var ke=null,Ce=Ee.gutterMarkers;if(Ce&&(Ce=Ce[R.gutter]),p(N,G)){if(ne&&Ce&&ne.test(Ce.className))return;ke=y(R.indicatorFolded)}else{var ct=l(G,0),W=ee&&ee(N,ct);if(W&&W.to.line-W.from.line>=Z){if(ue&&Ce&&ue.test(Ce.className))return;ke=y(R.indicatorOpen)}}!ke&&!Ce||N.setGutterMarker(Ee,R.gutter,ke)})}function b(N){return new RegExp("(^|\\s)"+N+"(?:$|\\s)\\s*")}function k(N){var E=N.getViewport(),D=N.state.foldGutter;D&&(N.operation(function(){w(N,E.from,E.to)}),D.from=E.from,D.to=E.to)}function A(N,E,D){var R=N.state.foldGutter;if(R){var G=R.options;if(D==G.gutter){var Z=p(N,E);Z?Z.clear():N.foldCode(l(E,0),G)}}}function L(N,E){E=="mode"&&H(N)}function H(N){var E=N.state.foldGutter;if(E){var D=E.options;E.from=E.to=0,clearTimeout(E.changeUpdate),E.changeUpdate=setTimeout(function(){k(N)},D.foldOnChangeTimeSpan||600)}}function P(N){var E=N.state.foldGutter;if(E){var D=E.options;clearTimeout(E.changeUpdate),E.changeUpdate=setTimeout(function(){var R=N.getViewport();E.from==E.to||R.from-E.to>20||E.from-R.to>20?k(N):N.operation(function(){R.from<E.from&&(w(N,R.from,E.from),E.from=R.from),R.to>E.to&&(w(N,E.to,R.to),E.to=R.to)})},D.updateViewportTimeSpan||400)}}function $(N,E){var D=N.state.foldGutter;if(D){var R=E.line;R>=D.from&&R<D.to&&w(N,R,R+1)}}})}(),function(f,a){(function(s){s(br())})(function(s){function l(h){return function(g,p){var y=p.line,w=g.getLine(y);function b($){for(var N,E=p.ch,D=0;;){var R=E<=0?-1:w.lastIndexOf($[0],E-1);if(R==-1){if(D==1)break;D=1,E=w.length;continue}if(D==1&&R<p.ch)break;if(N=g.getTokenTypeAt(s.Pos(y,R+1)),!/^(comment|string)/.test(N))return{ch:R+1,tokenType:N,pair:$};E=R-1}}function k($){var N=1,E=g.lastLine(),D,R=$.ch,G;e:for(var Z=y;Z<=E;++Z)for(var ee=g.getLine(Z),ne=Z==y?R:0;;){var ue=ee.indexOf($.pair[0],ne),Ee=ee.indexOf($.pair[1],ne);if(ue<0&&(ue=ee.length),Ee<0&&(Ee=ee.length),ne=Math.min(ue,Ee),ne==ee.length)break;if(g.getTokenTypeAt(s.Pos(Z,ne+1))==$.tokenType){if(ne==ue)++N;else if(!--N){D=Z,G=ne;break e}}++ne}return D==null||y==D?null:{from:s.Pos(y,R),to:s.Pos(D,G)}}for(var A=[],L=0;L<h.length;L++){var H=b(h[L]);H&&A.push(H)}A.sort(function($,N){return $.ch-N.ch});for(var L=0;L<A.length;L++){var P=k(A[L]);if(P)return P}return null}}s.registerHelper("fold","brace",l([["{","}"],["[","]"]])),s.registerHelper("fold","brace-paren",l([["{","}"],["[","]"],["(",")"]])),s.registerHelper("fold","import",function(h,g){function p(L){if(L<h.firstLine()||L>h.lastLine())return null;var H=h.getTokenAt(s.Pos(L,1));if(/\S/.test(H.string)||(H=h.getTokenAt(s.Pos(L,H.end+1))),H.type!="keyword"||H.string!="import")return null;for(var P=L,$=Math.min(h.lastLine(),L+10);P<=$;++P){var N=h.getLine(P),E=N.indexOf(";");if(E!=-1)return{startCh:H.end,end:s.Pos(P,E)}}}var y=g.line,w=p(y),b;if(!w||p(y-1)||(b=p(y-2))&&b.end.line==y-1)return null;for(var k=w.end;;){var A=p(k.line+1);if(A==null)break;k=A.end}return{from:h.clipPos(s.Pos(y,w.startCh+1)),to:k}}),s.registerHelper("fold","include",function(h,g){function p(A){if(A<h.firstLine()||A>h.lastLine())return null;var L=h.getTokenAt(s.Pos(A,1));if(/\S/.test(L.string)||(L=h.getTokenAt(s.Pos(A,L.end+1))),L.type=="meta"&&L.string.slice(0,8)=="#include")return L.start+8}var y=g.line,w=p(y);if(w==null||p(y-1)!=null)return null;for(var b=y;;){var k=p(b+1);if(k==null)break;++b}return{from:s.Pos(y,w+1),to:h.clipPos(s.Pos(b))}})})}(),function(f,a){(function(s){s(br())})(function(s){function l(h,g){var p=h.getLine(g),y=p.search(/\S/);return y==-1||/\bcomment\b/.test(h.getTokenTypeAt(s.Pos(g,y+1)))?-1:s.countColumn(p,null,h.getOption("tabSize"))}s.registerHelper("fold","indent",function(h,g){var p=l(h,g.line);if(!(p<0)){for(var y=null,w=g.line+1,b=h.lastLine();w<=b;++w){var k=l(h,w);if(k!=-1)if(k>p)y=w;else break}if(y)return{from:s.Pos(g.line,h.getLine(g.line).length),to:s.Pos(y,h.getLine(y).length)}}})})}();const co=Be.defineStore("trace",{state:()=>({traces:[],currentTrace:null}),getters:{getTraces:f=>f.traces,getCurrentTrace:f=>f.currentTrace},actions:{setTraces(f){this.traces=f},setCurrentTrace(f){this.currentTrace=f}}});var ho={exports:{}};(function(f,a){(function(s,l){f.exports=l(br())})(so,function(s){return function(l){function h(p){if(g[p])return g[p].exports;var y=g[p]={i:p,l:!1,exports:{}};return l[p].call(y.exports,y,y.exports,h),y.l=!0,y.exports}var g={};return h.m=l,h.c=g,h.i=function(p){return p},h.d=function(p,y,w){h.o(p,y)||Object.defineProperty(p,y,{configurable:!1,enumerable:!0,get:w})},h.n=function(p){var y=p&&p.__esModule?function(){return p.default}:function(){return p};return h.d(y,"a",y),y},h.o=function(p,y){return Object.prototype.hasOwnProperty.call(p,y)},h.p="/",h(h.s=3)}([function(l,h){l.exports=s},function(l,h,g){Object.defineProperty(h,"__esModule",{value:!0});var p=g(0),y=function(b){return b&&b.__esModule?b:{default:b}}(p),w=window.CodeMirror||y.default;typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(b,k){if(b==null)throw new TypeError("Cannot convert undefined or null to object");for(var A=Object(b),L=1;L<arguments.length;L++){var H=arguments[L];if(H!=null)for(var P in H)Object.prototype.hasOwnProperty.call(H,P)&&(A[P]=H[P])}return A},writable:!0,configurable:!0}),h.default={name:"codemirror",data:function(){return{content:"",codemirror:null,cminstance:null}},props:{code:String,value:String,marker:Function,unseenLines:Array,name:{type:String,default:"codemirror"},placeholder:{type:String,default:""},merge:{type:Boolean,default:!1},options:{type:Object,default:function(){return{}}},events:{type:Array,default:function(){return[]}},globalOptions:{type:Object,default:function(){return{}}},globalEvents:{type:Array,default:function(){return[]}}},watch:{options:{deep:!0,handler:function(b){for(var k in b)this.cminstance.setOption(k,b[k])}},merge:function(){this.$nextTick(this.switchMerge)},code:function(b){this.handerCodeChange(b)},value:function(b){this.handerCodeChange(b)}},methods:{initialize:function(){var b=this,k=Object.assign({},this.globalOptions,this.options);this.merge?(this.codemirror=w.MergeView(this.$refs.mergeview,k),this.cminstance=this.codemirror.edit):(this.codemirror=w.fromTextArea(this.$refs.textarea,k),this.cminstance=this.codemirror,this.cminstance.setValue(this.code||this.value||this.content)),this.cminstance.on("change",function(L){b.content=L.getValue(),b.$emit&&b.$emit("input",b.content)});var A={};["scroll","changes","beforeChange","cursorActivity","keyHandled","inputRead","electricInput","beforeSelectionChange","viewportChange","swapDoc","gutterClick","gutterContextMenu","focus","blur","refresh","optionChange","scrollCursorIntoView","update"].concat(this.events).concat(this.globalEvents).filter(function(L){return!A[L]&&(A[L]=!0)}).forEach(function(L){b.cminstance.on(L,function(){for(var H=arguments.length,P=Array(H),$=0;$<H;$++)P[$]=arguments[$];b.$emit.apply(b,[L].concat(P));var N=L.replace(/([A-Z])/g,"-$1").toLowerCase();N!==L&&b.$emit.apply(b,[N].concat(P))})}),this.$emit("ready",this.codemirror),this.unseenLineMarkers(),this.refresh()},refresh:function(){var b=this;this.$nextTick(function(){b.cminstance.refresh()})},destroy:function(){var b=this.cminstance.doc.cm.getWrapperElement();b&&b.remove&&b.remove()},handerCodeChange:function(b){if(b!==this.cminstance.getValue()){var k=this.cminstance.getScrollInfo();this.cminstance.setValue(b),this.content=b,this.cminstance.scrollTo(k.left,k.top)}this.unseenLineMarkers()},unseenLineMarkers:function(){var b=this;this.unseenLines!==void 0&&this.marker!==void 0&&this.unseenLines.forEach(function(k){var A=b.cminstance.lineInfo(k);b.cminstance.setGutterMarker(k,"breakpoints",A.gutterMarkers?null:b.marker())})},switchMerge:function(){var b=this.cminstance.doc.history,k=this.cminstance.doc.cleanGeneration;this.options.value=this.cminstance.getValue(),this.destroy(),this.initialize(),this.cminstance.doc.history=b,this.cminstance.doc.cleanGeneration=k}},mounted:function(){this.initialize()},beforeDestroy:function(){this.destroy()}}},function(l,h,g){Object.defineProperty(h,"__esModule",{value:!0});var p=g(1),y=g.n(p);for(var w in p)["default","default"].indexOf(w)<0&&function(L){g.d(h,L,function(){return p[L]})}(w);var b=g(5),k=g(4),A=k(y.a,b.a,!1,null,null,null);h.default=A.exports},function(l,h,g){function p(P){return P&&P.__esModule?P:{default:P}}Object.defineProperty(h,"__esModule",{value:!0}),h.install=h.codemirror=h.CodeMirror=void 0;var y=g(0),w=p(y),b=g(2),k=p(b),A=window.CodeMirror||w.default,L=function(P,$){$&&($.options&&(k.default.props.globalOptions.default=function(){return $.options}),$.events&&(k.default.props.globalEvents.default=function(){return $.events})),P.component(k.default.name,k.default)},H={CodeMirror:A,codemirror:k.default,install:L};h.default=H,h.CodeMirror=A,h.codemirror=k.default,h.install=L},function(l,h){l.exports=function(g,p,y,w,b,k){var A,L=g=g||{},H=typeof g.default;H!=="object"&&H!=="function"||(A=g,L=g.default);var P=typeof L=="function"?L.options:L;p&&(P.render=p.render,P.staticRenderFns=p.staticRenderFns,P._compiled=!0),y&&(P.functional=!0),b&&(P._scopeId=b);var $;if(k?($=function(D){D=D||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,D||typeof __VUE_SSR_CONTEXT__>"u"||(D=__VUE_SSR_CONTEXT__),w&&w.call(this,D),D&&D._registeredComponents&&D._registeredComponents.add(k)},P._ssrRegister=$):w&&($=w),$){var N=P.functional,E=N?P.render:P.beforeCreate;N?(P._injectStyles=$,P.render=function(D,R){return $.call(R),E(D,R)}):P.beforeCreate=E?[].concat(E,$):[$]}return{esModule:A,exports:L,options:P}}},function(l,h,g){var p=function(){var b=this,k=b.$createElement,A=b._self._c||k;return A("div",{staticClass:"vue-codemirror",class:{merge:b.merge}},[b.merge?A("div",{ref:"mergeview"}):A("textarea",{ref:"textarea",attrs:{name:b.name,placeholder:b.placeholder}})])},y=[],w={render:p,staticRenderFns:y};h.a=w}])})})(ho);var Hf=ho.exports;function Ma(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Pr=Ma();function po(f){Pr=f}const go=/[&<>"']/,Wf=new RegExp(go.source,"g"),vo=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Bf=new RegExp(vo.source,"g"),$f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},mo=f=>$f[f];function Lt(f,a){if(a){if(go.test(f))return f.replace(Wf,mo)}else if(vo.test(f))return f.replace(Bf,mo);return f}const Uf=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function jf(f){return f.replace(Uf,(a,s)=>(s=s.toLowerCase(),s==="colon"?":":s.charAt(0)==="#"?s.charAt(1)==="x"?String.fromCharCode(parseInt(s.substring(2),16)):String.fromCharCode(+s.substring(1)):""))}const qf=/(^|[^\[])\^/g;function Te(f,a){let s=typeof f=="string"?f:f.source;a=a||"";const l={replace:(h,g)=>{let p=typeof g=="string"?g:g.source;return p=p.replace(qf,"$1"),s=s.replace(h,p),l},getRegex:()=>new RegExp(s,a)};return l}function yo(f){try{f=encodeURI(f).replace(/%25/g,"%")}catch{return null}return f}const Wn={exec:()=>null};function bo(f,a){const s=f.replace(/\|/g,(g,p,y)=>{let w=!1,b=p;for(;--b>=0&&y[b]==="\\";)w=!w;return w?"|":" |"}),l=s.split(/ \|/);let h=0;if(l[0].trim()||l.shift(),l.length>0&&!l[l.length-1].trim()&&l.pop(),a)if(l.length>a)l.splice(a);else for(;l.length<a;)l.push("");for(;h<l.length;h++)l[h]=l[h].trim().replace(/\\\|/g,"|");return l}function Ii(f,a,s){const l=f.length;if(l===0)return"";let h=0;for(;h<l&&f.charAt(l-h-1)===a;)h++;return f.slice(0,l-h)}function Gf(f,a){if(f.indexOf(a[1])===-1)return-1;let s=0;for(let l=0;l<f.length;l++)if(f[l]==="\\")l++;else if(f[l]===a[0])s++;else if(f[l]===a[1]&&(s--,s<0))return l;return-1}function wo(f,a,s,l){const h=a.href,g=a.title?Lt(a.title):null,p=f[1].replace(/\\([\[\]])/g,"$1");if(f[0].charAt(0)!=="!"){l.state.inLink=!0;const y={type:"link",raw:s,href:h,title:g,text:p,tokens:l.inlineTokens(p)};return l.state.inLink=!1,y}return{type:"image",raw:s,href:h,title:g,text:Lt(p)}}function Xf(f,a){const s=f.match(/^(\s+)(?:```)/);if(s===null)return a;const l=s[1];return a.split(`
26
+ `).map(h=>{const g=h.match(/^\s+/);if(g===null)return h;const[p]=g;return p.length>=l.length?h.slice(l.length):h}).join(`
27
+ `)}class Ni{constructor(a){Ne(this,"options");Ne(this,"rules");Ne(this,"lexer");this.options=a||Pr}space(a){const s=this.rules.block.newline.exec(a);if(s&&s[0].length>0)return{type:"space",raw:s[0]}}code(a){const s=this.rules.block.code.exec(a);if(s){const l=s[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:s[0],codeBlockStyle:"indented",text:this.options.pedantic?l:Ii(l,`
28
+ `)}}}fences(a){const s=this.rules.block.fences.exec(a);if(s){const l=s[0],h=Xf(l,s[3]||"");return{type:"code",raw:l,lang:s[2]?s[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):s[2],text:h}}}heading(a){const s=this.rules.block.heading.exec(a);if(s){let l=s[2].trim();if(/#$/.test(l)){const h=Ii(l,"#");(this.options.pedantic||!h||/ $/.test(h))&&(l=h.trim())}return{type:"heading",raw:s[0],depth:s[1].length,text:l,tokens:this.lexer.inline(l)}}}hr(a){const s=this.rules.block.hr.exec(a);if(s)return{type:"hr",raw:s[0]}}blockquote(a){const s=this.rules.block.blockquote.exec(a);if(s){const l=Ii(s[0].replace(/^ *>[ \t]?/gm,""),`
29
+ `),h=this.lexer.state.top;this.lexer.state.top=!0;const g=this.lexer.blockTokens(l);return this.lexer.state.top=h,{type:"blockquote",raw:s[0],tokens:g,text:l}}}list(a){let s=this.rules.block.list.exec(a);if(s){let l=s[1].trim();const h=l.length>1,g={type:"list",raw:"",ordered:h,start:h?+l.slice(0,-1):"",loose:!1,items:[]};l=h?`\\d{1,9}\\${l.slice(-1)}`:`\\${l}`,this.options.pedantic&&(l=h?l:"[*+-]");const p=new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`);let y="",w="",b=!1;for(;a;){let k=!1;if(!(s=p.exec(a))||this.rules.block.hr.test(a))break;y=s[0],a=a.substring(y.length);let A=s[2].split(`
30
+ `,1)[0].replace(/^\t+/,E=>" ".repeat(3*E.length)),L=a.split(`
31
+ `,1)[0],H=0;this.options.pedantic?(H=2,w=A.trimStart()):(H=s[2].search(/[^ ]/),H=H>4?1:H,w=A.slice(H),H+=s[1].length);let P=!1;if(!A&&/^ *$/.test(L)&&(y+=L+`
32
+ `,a=a.substring(L.length+1),k=!0),!k){const E=new RegExp(`^ {0,${Math.min(3,H-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),D=new RegExp(`^ {0,${Math.min(3,H-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),R=new RegExp(`^ {0,${Math.min(3,H-1)}}(?:\`\`\`|~~~)`),G=new RegExp(`^ {0,${Math.min(3,H-1)}}#`);for(;a;){const Z=a.split(`
33
+ `,1)[0];if(L=Z,this.options.pedantic&&(L=L.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),R.test(L)||G.test(L)||E.test(L)||D.test(a))break;if(L.search(/[^ ]/)>=H||!L.trim())w+=`
34
+ `+L.slice(H);else{if(P||A.search(/[^ ]/)>=4||R.test(A)||G.test(A)||D.test(A))break;w+=`
35
+ `+L}!P&&!L.trim()&&(P=!0),y+=Z+`
36
+ `,a=a.substring(Z.length+1),A=L.slice(H)}}g.loose||(b?g.loose=!0:/\n *\n *$/.test(y)&&(b=!0));let $=null,N;this.options.gfm&&($=/^\[[ xX]\] /.exec(w),$&&(N=$[0]!=="[ ] ",w=w.replace(/^\[[ xX]\] +/,""))),g.items.push({type:"list_item",raw:y,task:!!$,checked:N,loose:!1,text:w,tokens:[]}),g.raw+=y}g.items[g.items.length-1].raw=y.trimEnd(),g.items[g.items.length-1].text=w.trimEnd(),g.raw=g.raw.trimEnd();for(let k=0;k<g.items.length;k++)if(this.lexer.state.top=!1,g.items[k].tokens=this.lexer.blockTokens(g.items[k].text,[]),!g.loose){const A=g.items[k].tokens.filter(H=>H.type==="space"),L=A.length>0&&A.some(H=>/\n.*\n/.test(H.raw));g.loose=L}if(g.loose)for(let k=0;k<g.items.length;k++)g.items[k].loose=!0;return g}}html(a){const s=this.rules.block.html.exec(a);if(s)return{type:"html",block:!0,raw:s[0],pre:s[1]==="pre"||s[1]==="script"||s[1]==="style",text:s[0]}}def(a){const s=this.rules.block.def.exec(a);if(s){const l=s[1].toLowerCase().replace(/\s+/g," "),h=s[2]?s[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",g=s[3]?s[3].substring(1,s[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):s[3];return{type:"def",tag:l,raw:s[0],href:h,title:g}}}table(a){const s=this.rules.block.table.exec(a);if(!s||!/[:|]/.test(s[2]))return;const l=bo(s[1]),h=s[2].replace(/^\||\| *$/g,"").split("|"),g=s[3]&&s[3].trim()?s[3].replace(/\n[ \t]*$/,"").split(`
37
+ `):[],p={type:"table",raw:s[0],header:[],align:[],rows:[]};if(l.length===h.length){for(const y of h)/^ *-+: *$/.test(y)?p.align.push("right"):/^ *:-+: *$/.test(y)?p.align.push("center"):/^ *:-+ *$/.test(y)?p.align.push("left"):p.align.push(null);for(const y of l)p.header.push({text:y,tokens:this.lexer.inline(y)});for(const y of g)p.rows.push(bo(y,p.header.length).map(w=>({text:w,tokens:this.lexer.inline(w)})));return p}}lheading(a){const s=this.rules.block.lheading.exec(a);if(s)return{type:"heading",raw:s[0],depth:s[2].charAt(0)==="="?1:2,text:s[1],tokens:this.lexer.inline(s[1])}}paragraph(a){const s=this.rules.block.paragraph.exec(a);if(s){const l=s[1].charAt(s[1].length-1)===`
38
+ `?s[1].slice(0,-1):s[1];return{type:"paragraph",raw:s[0],text:l,tokens:this.lexer.inline(l)}}}text(a){const s=this.rules.block.text.exec(a);if(s)return{type:"text",raw:s[0],text:s[0],tokens:this.lexer.inline(s[0])}}escape(a){const s=this.rules.inline.escape.exec(a);if(s)return{type:"escape",raw:s[0],text:Lt(s[1])}}tag(a){const s=this.rules.inline.tag.exec(a);if(s)return!this.lexer.state.inLink&&/^<a /i.test(s[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(s[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(s[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(s[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:s[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:s[0]}}link(a){const s=this.rules.inline.link.exec(a);if(s){const l=s[2].trim();if(!this.options.pedantic&&/^</.test(l)){if(!/>$/.test(l))return;const p=Ii(l.slice(0,-1),"\\");if((l.length-p.length)%2===0)return}else{const p=Gf(s[2],"()");if(p>-1){const w=(s[0].indexOf("!")===0?5:4)+s[1].length+p;s[2]=s[2].substring(0,p),s[0]=s[0].substring(0,w).trim(),s[3]=""}}let h=s[2],g="";if(this.options.pedantic){const p=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(h);p&&(h=p[1],g=p[3])}else g=s[3]?s[3].slice(1,-1):"";return h=h.trim(),/^</.test(h)&&(this.options.pedantic&&!/>$/.test(l)?h=h.slice(1):h=h.slice(1,-1)),wo(s,{href:h&&h.replace(this.rules.inline.anyPunctuation,"$1"),title:g&&g.replace(this.rules.inline.anyPunctuation,"$1")},s[0],this.lexer)}}reflink(a,s){let l;if((l=this.rules.inline.reflink.exec(a))||(l=this.rules.inline.nolink.exec(a))){const h=(l[2]||l[1]).replace(/\s+/g," "),g=s[h.toLowerCase()];if(!g){const p=l[0].charAt(0);return{type:"text",raw:p,text:p}}return wo(l,g,l[0],this.lexer)}}emStrong(a,s,l=""){let h=this.rules.inline.emStrongLDelim.exec(a);if(!h||h[3]&&l.match(/[\p{L}\p{N}]/u))return;if(!(h[1]||h[2]||"")||!l||this.rules.inline.punctuation.exec(l)){const p=[...h[0]].length-1;let y,w,b=p,k=0;const A=h[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(A.lastIndex=0,s=s.slice(-1*a.length+p);(h=A.exec(s))!=null;){if(y=h[1]||h[2]||h[3]||h[4]||h[5]||h[6],!y)continue;if(w=[...y].length,h[3]||h[4]){b+=w;continue}else if((h[5]||h[6])&&p%3&&!((p+w)%3)){k+=w;continue}if(b-=w,b>0)continue;w=Math.min(w,w+b+k);const L=[...h[0]][0].length,H=a.slice(0,p+h.index+L+w);if(Math.min(p,w)%2){const $=H.slice(1,-1);return{type:"em",raw:H,text:$,tokens:this.lexer.inlineTokens($)}}const P=H.slice(2,-2);return{type:"strong",raw:H,text:P,tokens:this.lexer.inlineTokens(P)}}}}codespan(a){const s=this.rules.inline.code.exec(a);if(s){let l=s[2].replace(/\n/g," ");const h=/[^ ]/.test(l),g=/^ /.test(l)&&/ $/.test(l);return h&&g&&(l=l.substring(1,l.length-1)),l=Lt(l,!0),{type:"codespan",raw:s[0],text:l}}}br(a){const s=this.rules.inline.br.exec(a);if(s)return{type:"br",raw:s[0]}}del(a){const s=this.rules.inline.del.exec(a);if(s)return{type:"del",raw:s[0],text:s[2],tokens:this.lexer.inlineTokens(s[2])}}autolink(a){const s=this.rules.inline.autolink.exec(a);if(s){let l,h;return s[2]==="@"?(l=Lt(s[1]),h="mailto:"+l):(l=Lt(s[1]),h=l),{type:"link",raw:s[0],text:l,href:h,tokens:[{type:"text",raw:l,text:l}]}}}url(a){var l;let s;if(s=this.rules.inline.url.exec(a)){let h,g;if(s[2]==="@")h=Lt(s[0]),g="mailto:"+h;else{let p;do p=s[0],s[0]=((l=this.rules.inline._backpedal.exec(s[0]))==null?void 0:l[0])??"";while(p!==s[0]);h=Lt(s[0]),s[1]==="www."?g="http://"+s[0]:g=s[0]}return{type:"link",raw:s[0],text:h,href:g,tokens:[{type:"text",raw:h,text:h}]}}}inlineText(a){const s=this.rules.inline.text.exec(a);if(s){let l;return this.lexer.state.inRawBlock?l=s[0]:l=Lt(s[0]),{type:"text",raw:s[0],text:l}}}}const Kf=/^(?: *(?:\n|$))+/,Yf=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Zf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Bn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Qf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,xo=/(?:[*+-]|\d{1,9}[.)])/,ko=Te(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,xo).getRegex(),Ra=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Vf=/^[^\n]+/,za=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Jf=Te(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",za).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ec=Te(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,xo).getRegex(),Mi="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Pa=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,tc=Te("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",Pa).replace("tag",Mi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),So=Te(Ra).replace("hr",Bn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mi).getRegex(),Fa={blockquote:Te(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",So).getRegex(),code:Yf,def:Jf,fences:Zf,heading:Qf,hr:Bn,html:tc,lheading:ko,list:ec,newline:Kf,paragraph:So,table:Wn,text:Vf},Co=Te("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Bn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mi).getRegex(),rc={...Fa,table:Co,paragraph:Te(Ra).replace("hr",Bn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Co).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Mi).getRegex()},nc={...Fa,html:Te(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Pa).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Wn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Te(Ra).replace("hr",Bn).replace("heading",` *#{1,6} *[^
39
+ ]`).replace("lheading",ko).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},To=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ic=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Lo=/^( {2,}|\\)\n(?!\s*$)/,ac=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,$n="\\p{P}$+<=>`^|~",sc=Te(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,$n).getRegex(),oc=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,lc=Te(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,$n).getRegex(),uc=Te("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,$n).getRegex(),fc=Te("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,$n).getRegex(),cc=Te(/\\([punct])/,"gu").replace(/punct/g,$n).getRegex(),hc=Te(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),dc=Te(Pa).replace("(?:-->|$)","-->").getRegex(),pc=Te("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",dc).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ri=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,gc=Te(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Ri).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_o=Te(/^!?\[(label)\]\[(ref)\]/).replace("label",Ri).replace("ref",za).getRegex(),Ao=Te(/^!?\[(ref)\](?:\[\])?/).replace("ref",za).getRegex(),vc=Te("reflink|nolink(?!\\()","g").replace("reflink",_o).replace("nolink",Ao).getRegex(),Ha={_backpedal:Wn,anyPunctuation:cc,autolink:hc,blockSkip:oc,br:Lo,code:ic,del:Wn,emStrongLDelim:lc,emStrongRDelimAst:uc,emStrongRDelimUnd:fc,escape:To,link:gc,nolink:Ao,punctuation:sc,reflink:_o,reflinkSearch:vc,tag:pc,text:ac,url:Wn},mc={...Ha,link:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",Ri).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ri).getRegex()},Wa={...Ha,escape:Te(To).replace("])","~|])").getRegex(),url:Te(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},yc={...Wa,br:Te(Lo).replace("{2,}","*").getRegex(),text:Te(Wa.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},zi={normal:Fa,gfm:rc,pedantic:nc},Un={normal:Ha,gfm:Wa,breaks:yc,pedantic:mc};class Zt{constructor(a){Ne(this,"tokens");Ne(this,"options");Ne(this,"state");Ne(this,"tokenizer");Ne(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=a||Pr,this.options.tokenizer=this.options.tokenizer||new Ni,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const s={block:zi.normal,inline:Un.normal};this.options.pedantic?(s.block=zi.pedantic,s.inline=Un.pedantic):this.options.gfm&&(s.block=zi.gfm,this.options.breaks?s.inline=Un.breaks:s.inline=Un.gfm),this.tokenizer.rules=s}static get rules(){return{block:zi,inline:Un}}static lex(a,s){return new Zt(s).lex(a)}static lexInline(a,s){return new Zt(s).inlineTokens(a)}lex(a){a=a.replace(/\r\n|\r/g,`
40
+ `),this.blockTokens(a,this.tokens);for(let s=0;s<this.inlineQueue.length;s++){const l=this.inlineQueue[s];this.inlineTokens(l.src,l.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(a,s=[]){this.options.pedantic?a=a.replace(/\t/g," ").replace(/^ +$/gm,""):a=a.replace(/^( *)(\t+)/gm,(y,w,b)=>w+" ".repeat(b.length));let l,h,g,p;for(;a;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(y=>(l=y.call({lexer:this},a,s))?(a=a.substring(l.raw.length),s.push(l),!0):!1))){if(l=this.tokenizer.space(a)){a=a.substring(l.raw.length),l.raw.length===1&&s.length>0?s[s.length-1].raw+=`
41
+ `:s.push(l);continue}if(l=this.tokenizer.code(a)){a=a.substring(l.raw.length),h=s[s.length-1],h&&(h.type==="paragraph"||h.type==="text")?(h.raw+=`
42
+ `+l.raw,h.text+=`
43
+ `+l.text,this.inlineQueue[this.inlineQueue.length-1].src=h.text):s.push(l);continue}if(l=this.tokenizer.fences(a)){a=a.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.heading(a)){a=a.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.hr(a)){a=a.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.blockquote(a)){a=a.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.list(a)){a=a.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.html(a)){a=a.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.def(a)){a=a.substring(l.raw.length),h=s[s.length-1],h&&(h.type==="paragraph"||h.type==="text")?(h.raw+=`
44
+ `+l.raw,h.text+=`
45
+ `+l.raw,this.inlineQueue[this.inlineQueue.length-1].src=h.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title});continue}if(l=this.tokenizer.table(a)){a=a.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.lheading(a)){a=a.substring(l.raw.length),s.push(l);continue}if(g=a,this.options.extensions&&this.options.extensions.startBlock){let y=1/0;const w=a.slice(1);let b;this.options.extensions.startBlock.forEach(k=>{b=k.call({lexer:this},w),typeof b=="number"&&b>=0&&(y=Math.min(y,b))}),y<1/0&&y>=0&&(g=a.substring(0,y+1))}if(this.state.top&&(l=this.tokenizer.paragraph(g))){h=s[s.length-1],p&&h.type==="paragraph"?(h.raw+=`
46
+ `+l.raw,h.text+=`
47
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=h.text):s.push(l),p=g.length!==a.length,a=a.substring(l.raw.length);continue}if(l=this.tokenizer.text(a)){a=a.substring(l.raw.length),h=s[s.length-1],h&&h.type==="text"?(h.raw+=`
48
+ `+l.raw,h.text+=`
49
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=h.text):s.push(l);continue}if(a){const y="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(y);break}else throw new Error(y)}}return this.state.top=!0,s}inline(a,s=[]){return this.inlineQueue.push({src:a,tokens:s}),s}inlineTokens(a,s=[]){let l,h,g,p=a,y,w,b;if(this.tokens.links){const k=Object.keys(this.tokens.links);if(k.length>0)for(;(y=this.tokenizer.rules.inline.reflinkSearch.exec(p))!=null;)k.includes(y[0].slice(y[0].lastIndexOf("[")+1,-1))&&(p=p.slice(0,y.index)+"["+"a".repeat(y[0].length-2)+"]"+p.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(y=this.tokenizer.rules.inline.blockSkip.exec(p))!=null;)p=p.slice(0,y.index)+"["+"a".repeat(y[0].length-2)+"]"+p.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(y=this.tokenizer.rules.inline.anyPunctuation.exec(p))!=null;)p=p.slice(0,y.index)+"++"+p.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;a;)if(w||(b=""),w=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(k=>(l=k.call({lexer:this},a,s))?(a=a.substring(l.raw.length),s.push(l),!0):!1))){if(l=this.tokenizer.escape(a)){a=a.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.tag(a)){a=a.substring(l.raw.length),h=s[s.length-1],h&&l.type==="text"&&h.type==="text"?(h.raw+=l.raw,h.text+=l.text):s.push(l);continue}if(l=this.tokenizer.link(a)){a=a.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.reflink(a,this.tokens.links)){a=a.substring(l.raw.length),h=s[s.length-1],h&&l.type==="text"&&h.type==="text"?(h.raw+=l.raw,h.text+=l.text):s.push(l);continue}if(l=this.tokenizer.emStrong(a,p,b)){a=a.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.codespan(a)){a=a.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.br(a)){a=a.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.del(a)){a=a.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.autolink(a)){a=a.substring(l.raw.length),s.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(a))){a=a.substring(l.raw.length),s.push(l);continue}if(g=a,this.options.extensions&&this.options.extensions.startInline){let k=1/0;const A=a.slice(1);let L;this.options.extensions.startInline.forEach(H=>{L=H.call({lexer:this},A),typeof L=="number"&&L>=0&&(k=Math.min(k,L))}),k<1/0&&k>=0&&(g=a.substring(0,k+1))}if(l=this.tokenizer.inlineText(g)){a=a.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(b=l.raw.slice(-1)),w=!0,h=s[s.length-1],h&&h.type==="text"?(h.raw+=l.raw,h.text+=l.text):s.push(l);continue}if(a){const k="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(k);break}else throw new Error(k)}}return s}}class Pi{constructor(a){Ne(this,"options");this.options=a||Pr}code(a,s,l){var g;const h=(g=(s||"").match(/^\S*/))==null?void 0:g[0];return a=a.replace(/\n$/,"")+`
50
+ `,h?'<pre><code class="language-'+Lt(h)+'">'+(l?a:Lt(a,!0))+`</code></pre>
51
+ `:"<pre><code>"+(l?a:Lt(a,!0))+`</code></pre>
52
+ `}blockquote(a){return`<blockquote>
53
+ ${a}</blockquote>
54
+ `}html(a,s){return a}heading(a,s,l){return`<h${s}>${a}</h${s}>
55
+ `}hr(){return`<hr>
56
+ `}list(a,s,l){const h=s?"ol":"ul",g=s&&l!==1?' start="'+l+'"':"";return"<"+h+g+`>
57
+ `+a+"</"+h+`>
58
+ `}listitem(a,s,l){return`<li>${a}</li>
59
+ `}checkbox(a){return"<input "+(a?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(a){return`<p>${a}</p>
60
+ `}table(a,s){return s&&(s=`<tbody>${s}</tbody>`),`<table>
61
+ <thead>
62
+ `+a+`</thead>
63
+ `+s+`</table>
64
+ `}tablerow(a){return`<tr>
65
+ ${a}</tr>
66
+ `}tablecell(a,s){const l=s.header?"th":"td";return(s.align?`<${l} align="${s.align}">`:`<${l}>`)+a+`</${l}>
67
+ `}strong(a){return`<strong>${a}</strong>`}em(a){return`<em>${a}</em>`}codespan(a){return`<code>${a}</code>`}br(){return"<br>"}del(a){return`<del>${a}</del>`}link(a,s,l){const h=yo(a);if(h===null)return l;a=h;let g='<a href="'+a+'"';return s&&(g+=' title="'+s+'"'),g+=">"+l+"</a>",g}image(a,s,l){const h=yo(a);if(h===null)return l;a=h;let g=`<img src="${a}" alt="${l}"`;return s&&(g+=` title="${s}"`),g+=">",g}text(a){return a}}class Ba{strong(a){return a}em(a){return a}codespan(a){return a}del(a){return a}html(a){return a}text(a){return a}link(a,s,l){return""+l}image(a,s,l){return""+l}br(){return""}}class Qt{constructor(a){Ne(this,"options");Ne(this,"renderer");Ne(this,"textRenderer");this.options=a||Pr,this.options.renderer=this.options.renderer||new Pi,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ba}static parse(a,s){return new Qt(s).parse(a)}static parseInline(a,s){return new Qt(s).parseInline(a)}parse(a,s=!0){let l="";for(let h=0;h<a.length;h++){const g=a[h];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[g.type]){const p=g,y=this.options.extensions.renderers[p.type].call({parser:this},p);if(y!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(p.type)){l+=y||"";continue}}switch(g.type){case"space":continue;case"hr":{l+=this.renderer.hr();continue}case"heading":{const p=g;l+=this.renderer.heading(this.parseInline(p.tokens),p.depth,jf(this.parseInline(p.tokens,this.textRenderer)));continue}case"code":{const p=g;l+=this.renderer.code(p.text,p.lang,!!p.escaped);continue}case"table":{const p=g;let y="",w="";for(let k=0;k<p.header.length;k++)w+=this.renderer.tablecell(this.parseInline(p.header[k].tokens),{header:!0,align:p.align[k]});y+=this.renderer.tablerow(w);let b="";for(let k=0;k<p.rows.length;k++){const A=p.rows[k];w="";for(let L=0;L<A.length;L++)w+=this.renderer.tablecell(this.parseInline(A[L].tokens),{header:!1,align:p.align[L]});b+=this.renderer.tablerow(w)}l+=this.renderer.table(y,b);continue}case"blockquote":{const p=g,y=this.parse(p.tokens);l+=this.renderer.blockquote(y);continue}case"list":{const p=g,y=p.ordered,w=p.start,b=p.loose;let k="";for(let A=0;A<p.items.length;A++){const L=p.items[A],H=L.checked,P=L.task;let $="";if(L.task){const N=this.renderer.checkbox(!!H);b?L.tokens.length>0&&L.tokens[0].type==="paragraph"?(L.tokens[0].text=N+" "+L.tokens[0].text,L.tokens[0].tokens&&L.tokens[0].tokens.length>0&&L.tokens[0].tokens[0].type==="text"&&(L.tokens[0].tokens[0].text=N+" "+L.tokens[0].tokens[0].text)):L.tokens.unshift({type:"text",text:N+" "}):$+=N+" "}$+=this.parse(L.tokens,b),k+=this.renderer.listitem($,P,!!H)}l+=this.renderer.list(k,y,w);continue}case"html":{const p=g;l+=this.renderer.html(p.text,p.block);continue}case"paragraph":{const p=g;l+=this.renderer.paragraph(this.parseInline(p.tokens));continue}case"text":{let p=g,y=p.tokens?this.parseInline(p.tokens):p.text;for(;h+1<a.length&&a[h+1].type==="text";)p=a[++h],y+=`
68
+ `+(p.tokens?this.parseInline(p.tokens):p.text);l+=s?this.renderer.paragraph(y):y;continue}default:{const p='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return l}parseInline(a,s){s=s||this.renderer;let l="";for(let h=0;h<a.length;h++){const g=a[h];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[g.type]){const p=this.options.extensions.renderers[g.type].call({parser:this},g);if(p!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(g.type)){l+=p||"";continue}}switch(g.type){case"escape":{const p=g;l+=s.text(p.text);break}case"html":{const p=g;l+=s.html(p.text);break}case"link":{const p=g;l+=s.link(p.href,p.title,this.parseInline(p.tokens,s));break}case"image":{const p=g;l+=s.image(p.href,p.title,p.text);break}case"strong":{const p=g;l+=s.strong(this.parseInline(p.tokens,s));break}case"em":{const p=g;l+=s.em(this.parseInline(p.tokens,s));break}case"codespan":{const p=g;l+=s.codespan(p.text);break}case"br":{l+=s.br();break}case"del":{const p=g;l+=s.del(this.parseInline(p.tokens,s));break}case"text":{const p=g;l+=s.text(p.text);break}default:{const p='Token with "'+g.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return l}}class jn{constructor(a){Ne(this,"options");this.options=a||Pr}preprocess(a){return a}postprocess(a){return a}processAllTokens(a){return a}}Ne(jn,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class bc{constructor(...a){zf(this,Br);Ne(this,"defaults",Ma());Ne(this,"options",this.setOptions);Ne(this,"parse",Ia(this,Br,ao).call(this,Zt.lex,Qt.parse));Ne(this,"parseInline",Ia(this,Br,ao).call(this,Zt.lexInline,Qt.parseInline));Ne(this,"Parser",Qt);Ne(this,"Renderer",Pi);Ne(this,"TextRenderer",Ba);Ne(this,"Lexer",Zt);Ne(this,"Tokenizer",Ni);Ne(this,"Hooks",jn);this.use(...a)}walkTokens(a,s){var h,g;let l=[];for(const p of a)switch(l=l.concat(s.call(this,p)),p.type){case"table":{const y=p;for(const w of y.header)l=l.concat(this.walkTokens(w.tokens,s));for(const w of y.rows)for(const b of w)l=l.concat(this.walkTokens(b.tokens,s));break}case"list":{const y=p;l=l.concat(this.walkTokens(y.items,s));break}default:{const y=p;(g=(h=this.defaults.extensions)==null?void 0:h.childTokens)!=null&&g[y.type]?this.defaults.extensions.childTokens[y.type].forEach(w=>{const b=y[w].flat(1/0);l=l.concat(this.walkTokens(b,s))}):y.tokens&&(l=l.concat(this.walkTokens(y.tokens,s)))}}return l}use(...a){const s=this.defaults.extensions||{renderers:{},childTokens:{}};return a.forEach(l=>{const h={...l};if(h.async=this.defaults.async||h.async||!1,l.extensions&&(l.extensions.forEach(g=>{if(!g.name)throw new Error("extension name required");if("renderer"in g){const p=s.renderers[g.name];p?s.renderers[g.name]=function(...y){let w=g.renderer.apply(this,y);return w===!1&&(w=p.apply(this,y)),w}:s.renderers[g.name]=g.renderer}if("tokenizer"in g){if(!g.level||g.level!=="block"&&g.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const p=s[g.level];p?p.unshift(g.tokenizer):s[g.level]=[g.tokenizer],g.start&&(g.level==="block"?s.startBlock?s.startBlock.push(g.start):s.startBlock=[g.start]:g.level==="inline"&&(s.startInline?s.startInline.push(g.start):s.startInline=[g.start]))}"childTokens"in g&&g.childTokens&&(s.childTokens[g.name]=g.childTokens)}),h.extensions=s),l.renderer){const g=this.defaults.renderer||new Pi(this.defaults);for(const p in l.renderer){if(!(p in g))throw new Error(`renderer '${p}' does not exist`);if(p==="options")continue;const y=p,w=l.renderer[y],b=g[y];g[y]=(...k)=>{let A=w.apply(g,k);return A===!1&&(A=b.apply(g,k)),A||""}}h.renderer=g}if(l.tokenizer){const g=this.defaults.tokenizer||new Ni(this.defaults);for(const p in l.tokenizer){if(!(p in g))throw new Error(`tokenizer '${p}' does not exist`);if(["options","rules","lexer"].includes(p))continue;const y=p,w=l.tokenizer[y],b=g[y];g[y]=(...k)=>{let A=w.apply(g,k);return A===!1&&(A=b.apply(g,k)),A}}h.tokenizer=g}if(l.hooks){const g=this.defaults.hooks||new jn;for(const p in l.hooks){if(!(p in g))throw new Error(`hook '${p}' does not exist`);if(p==="options")continue;const y=p,w=l.hooks[y],b=g[y];jn.passThroughHooks.has(p)?g[y]=k=>{if(this.defaults.async)return Promise.resolve(w.call(g,k)).then(L=>b.call(g,L));const A=w.call(g,k);return b.call(g,A)}:g[y]=(...k)=>{let A=w.apply(g,k);return A===!1&&(A=b.apply(g,k)),A}}h.hooks=g}if(l.walkTokens){const g=this.defaults.walkTokens,p=l.walkTokens;h.walkTokens=function(y){let w=[];return w.push(p.call(this,y)),g&&(w=w.concat(g.call(this,y))),w}}this.defaults={...this.defaults,...h}}),this}setOptions(a){return this.defaults={...this.defaults,...a},this}lexer(a,s){return Zt.lex(a,s??this.defaults)}parser(a,s){return Qt.parse(a,s??this.defaults)}}Br=new WeakSet,ao=function(a,s){return(l,h)=>{const g={...h},p={...this.defaults,...g};this.defaults.async===!0&&g.async===!1&&(p.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),p.async=!0);const y=Ia(this,Br,Pf).call(this,!!p.silent,!!p.async);if(typeof l>"u"||l===null)return y(new Error("marked(): input parameter is undefined or null"));if(typeof l!="string")return y(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(l)+", string expected"));if(p.hooks&&(p.hooks.options=p),p.async)return Promise.resolve(p.hooks?p.hooks.preprocess(l):l).then(w=>a(w,p)).then(w=>p.hooks?p.hooks.processAllTokens(w):w).then(w=>p.walkTokens?Promise.all(this.walkTokens(w,p.walkTokens)).then(()=>w):w).then(w=>s(w,p)).then(w=>p.hooks?p.hooks.postprocess(w):w).catch(y);try{p.hooks&&(l=p.hooks.preprocess(l));let w=a(l,p);p.hooks&&(w=p.hooks.processAllTokens(w)),p.walkTokens&&this.walkTokens(w,p.walkTokens);let b=s(w,p);return p.hooks&&(b=p.hooks.postprocess(b)),b}catch(w){return y(w)}}},Pf=function(a,s){return l=>{if(l.message+=`
69
+ Please report this to https://github.com/markedjs/marked.`,a){const h="<p>An error occurred:</p><pre>"+Lt(l.message+"",!0)+"</pre>";return s?Promise.resolve(h):h}if(s)return Promise.reject(l);throw l}};const Fr=new bc;function ve(f,a){return Fr.parse(f,a)}ve.options=ve.setOptions=function(f){return Fr.setOptions(f),ve.defaults=Fr.defaults,po(ve.defaults),ve},ve.getDefaults=Ma,ve.defaults=Pr,ve.use=function(...f){return Fr.use(...f),ve.defaults=Fr.defaults,po(ve.defaults),ve},ve.walkTokens=function(f,a){return Fr.walkTokens(f,a)},ve.parseInline=Fr.parseInline,ve.Parser=Qt,ve.parser=Qt.parse,ve.Renderer=Pi,ve.TextRenderer=Ba,ve.Lexer=Zt,ve.lexer=Zt.lex,ve.Tokenizer=Ni,ve.Hooks=jn,ve.parse=ve,ve.options,ve.setOptions,ve.use,ve.walkTokens,ve.parseInline,Qt.parse,Zt.lex;const wc=()=>typeof __TRACE_API_BASE_URL__<"u"?__TRACE_API_BASE_URL__:typeof window<"u"&&window.__TRACE_API_BASE_URL__?window.__TRACE_API_BASE_URL__:typeof process<"u"&&process.env&&process.env.TRACE_API_BASE_URL?process.env.TRACE_API_BASE_URL:"/tracing",Fi=Nt.create({baseURL:wc(),timeout:3e4}),rn={getTraceList(f,a,s,l,h){const g={};return f&&(g.query=f),a&&(g.startTime=a),s&&(g.endTime=s),l&&(g.pageNo=l),h&&(g.pageSize=h),Fi.get("/v1/trace",{params:g}).then(p=>p.data)},getTraceDetail(f){return Fi.get(`/v1/trace/${f}`).then(a=>a.data)},getTraceSpans(f){return Fi.get(`/v1/trace/${f}/spans`).then(a=>a.data)},deleteTraces(f,a,s){const l={};return f&&(l.query=f),a&&(l.startTime=a),s&&(l.endTime=s),Fi.delete("/v1/trace",{params:l}).then(h=>h.data)}};function Oo(f,a,s,l,h,g,p,y){var w=typeof f=="function"?f.options:f;return a&&(w.render=a,w.staticRenderFns=s,w._compiled=!0),g&&(w._scopeId="data-v-"+g),{exports:f,options:w}}const xc={name:"TraceSpanTree",props:{spans:{type:Array,default:()=>[]},selectedSpanId:{type:String,default:null},traceStartTime:{type:Number,default:0},traceEndTime:{type:Number,default:0}},data(){return{expandedNodes:new Set,treeData:[]}},watch:{spans:{immediate:!0,handler(){this.buildTree()}}},methods:{buildTree(){if(!this.spans||this.spans.length===0){this.treeData=[];return}const f=new Map,a=[];this.spans.forEach(s=>{f.set(s.span_id,{...s,children:[]})}),this.spans.forEach(s=>{const l=f.get(s.span_id);if(s.parent_span_id){const h=f.get(s.parent_span_id);h?h.children.push(l):a.push(l)}else a.push(l)}),a.forEach(s=>{this.sortChildren(s)}),this.treeData=a,this.treeData.length>0&&this.expandedNodes.add(this.treeData[0].span_id)},sortChildren(f){f.children&&f.children.length>0&&(f.children.sort((a,s)=>a.start_time_unix_nano-s.start_time_unix_nano),f.children.forEach(a=>this.sortChildren(a)))},handleNodeClick(f){this.$emit("span-select",f)},hasChildren(f){return f.children&&f.children.length>0},isExpanded(f){return this.expandedNodes.has(f.span_id)},toggleExpand(f){this.expandedNodes.has(f.span_id)?this.expandedNodes.delete(f.span_id):this.expandedNodes.add(f.span_id),this.$forceUpdate()},getNodeDepth(f){let a=0,s=f;for(;s.parent_span_id;){a++;const l=this.findNodeById(s.parent_span_id);if(!l)break;s=l}return a},findNodeById(f){const a=s=>{for(const l of s){if(l.span_id===f)return l;if(l.children&&l.children.length>0){const h=a(l.children);if(h)return h}}return null};return a(this.treeData)},getTimelineBarStyle(f){if(!this.traceStartTime||!this.traceEndTime||this.traceStartTime===this.traceEndTime)return{width:"100%"};const a=this.traceEndTime-this.traceStartTime,s=f.start_time_unix_nano-this.traceStartTime,l=f.duration_ns,h=s/a*100,g=l/a*100;return{left:`${h}%`,width:`${g}%`}},getTypeColor(f){return{SERVER:"primary",CHAT_MODEL:"success",LLM:"success",CHAIN:"warning",AGENT:"danger",TOOL:"info",JOB:"warning",FUNCTION:"info"}[f]||"info"},formatNanoDuration(f){if(!f)return"-";const a=f/1e6;return a<1e3?`${a.toFixed(2)}ms`:a<6e4?`${(a/1e3).toFixed(2)}s`:`${(a/6e4).toFixed(2)}min`},formatTime(f){if(!f)return"-";const a=f/1e6,s=new Date(a),l=s.getFullYear(),h=String(s.getMonth()+1).padStart(2,"0"),g=String(s.getDate()).padStart(2,"0"),p=String(s.getHours()).padStart(2,"0"),y=String(s.getMinutes()).padStart(2,"0"),w=String(s.getSeconds()).padStart(2,"0");return`${l}-${h}-${g} ${p}:${y}:${w}`}}};var kc=function(){var a=this,s=a._self._c;return s("div",{staticClass:"span-tree-container"},[a.treeData.length===0?s("div",{staticClass:"empty-state"},[s("el-empty",{attrs:{description:"暂无 Span 数据"}})],1):s("div",{staticClass:"timeline-wrapper"},[s("div",{staticClass:"timeline-header"},[s("div",{staticClass:"time-scale"},[s("span",{staticClass:"time-start"},[a._v(a._s(a.formatTime(a.traceStartTime)))]),s("span",{staticClass:"time-end"},[a._v(a._s(a.formatTime(a.traceEndTime)))])])]),s("div",{ref:"timelineContent",staticClass:"timeline-content"},a._l(a.treeData,function(l,h){return s("div",{key:l.span_id,staticClass:"timeline-node",class:{selected:a.selectedSpanId===l.span_id},on:{click:function(g){return a.handleNodeClick(l)}}},[s("div",{staticClass:"node-row"},[s("div",{staticClass:"node-info",style:{paddingLeft:`${a.getNodeDepth(l)*20}px`}},[a.hasChildren(l)?s("i",{staticClass:"expand-icon",class:a.isExpanded(l)?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:function(g){return g.stopPropagation(),a.toggleExpand(l)}}}):s("i",{staticClass:"expand-icon-placeholder"}),s("el-tag",{staticClass:"type-tag",attrs:{type:a.getTypeColor(l.type),size:"mini"}},[a._v(" "+a._s(l.type)+" ")]),s("span",{staticClass:"node-name",attrs:{title:l.name}},[a._v(a._s(l.name))])],1),s("div",{staticClass:"node-duration"},[a._v(" "+a._s(a.formatNanoDuration(l.duration_ns))+" ")])]),s("div",{staticClass:"timeline-bar-wrapper"},[s("div",{staticClass:"timeline-bar",class:{selected:a.selectedSpanId===l.span_id},style:a.getTimelineBarStyle(l)})]),a.isExpanded(l)&&a.hasChildren(l)?s("div",{staticClass:"children-nodes"},a._l(l.children,function(g){return s("div",{key:g.span_id,staticClass:"timeline-node child-node",class:{selected:a.selectedSpanId===g.span_id},on:{click:function(p){return p.stopPropagation(),a.handleNodeClick(g)}}},[s("div",{staticClass:"node-row"},[s("div",{staticClass:"node-info",style:{paddingLeft:`${a.getNodeDepth(g)*20}px`}},[a.hasChildren(g)?s("i",{staticClass:"expand-icon",class:a.isExpanded(g)?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:function(p){return p.stopPropagation(),a.toggleExpand(g)}}}):s("i",{staticClass:"expand-icon-placeholder"}),s("el-tag",{staticClass:"type-tag",attrs:{type:a.getTypeColor(g.type),size:"mini"}},[a._v(" "+a._s(g.type)+" ")]),s("span",{staticClass:"node-name",attrs:{title:g.name}},[a._v(a._s(g.name))])],1),s("div",{staticClass:"node-duration"},[a._v(" "+a._s(a.formatNanoDuration(g.duration_ns))+" ")])]),s("div",{staticClass:"timeline-bar-wrapper"},[s("div",{staticClass:"timeline-bar",class:{selected:a.selectedSpanId===g.span_id},style:a.getTimelineBarStyle(g)})]),a.isExpanded(g)&&a.hasChildren(g)?s("div",{staticClass:"children-nodes"},a._l(g.children,function(p){return s("div",{key:p.span_id,staticClass:"timeline-node child-node",class:{selected:a.selectedSpanId===p.span_id},on:{click:function(y){return y.stopPropagation(),a.handleNodeClick(p)}}},[s("div",{staticClass:"node-row"},[s("div",{staticClass:"node-info",style:{paddingLeft:`${a.getNodeDepth(p)*20}px`}},[s("i",{staticClass:"expand-icon-placeholder"}),s("el-tag",{staticClass:"type-tag",attrs:{type:a.getTypeColor(p.type),size:"mini"}},[a._v(" "+a._s(p.type)+" ")]),s("span",{staticClass:"node-name",attrs:{title:p.name}},[a._v(a._s(p.name))])],1),s("div",{staticClass:"node-duration"},[a._v(" "+a._s(a.formatNanoDuration(p.duration_ns))+" ")])]),s("div",{staticClass:"timeline-bar-wrapper"},[s("div",{staticClass:"timeline-bar",class:{selected:a.selectedSpanId===p.span_id},style:a.getTimelineBarStyle(p)})])])}),0):a._e()])}),0):a._e()])}),0)])])},Sc=[],Cc=Oo(xc,kc,Sc,!1,null,"4f00ade1");const $a=Cc.exports;/*!
70
+ * Viewer.js v1.11.7
71
+ * https://fengyuanchen.github.io/viewerjs
72
+ *
73
+ * Copyright 2015-present Chen Fengyuan
74
+ * Released under the MIT license
75
+ *
76
+ * Date: 2024-11-24T04:32:19.116Z
77
+ */function Tc(f,a){if(!(f instanceof a))throw new TypeError("Cannot call a class as a function")}function Eo(f,a){for(var s=0;s<a.length;s++){var l=a[s];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(f,Io(l.key),l)}}function Lc(f,a,s){return a&&Eo(f.prototype,a),s&&Eo(f,s),Object.defineProperty(f,"prototype",{writable:!1}),f}function _c(f,a,s){return(a=Io(a))in f?Object.defineProperty(f,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):f[a]=s,f}function Do(f,a){var s=Object.keys(f);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(f);a&&(l=l.filter(function(h){return Object.getOwnPropertyDescriptor(f,h).enumerable})),s.push.apply(s,l)}return s}function Ua(f){for(var a=1;a<arguments.length;a++){var s=arguments[a]!=null?arguments[a]:{};a%2?Do(Object(s),!0).forEach(function(l){_c(f,l,s[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(s)):Do(Object(s)).forEach(function(l){Object.defineProperty(f,l,Object.getOwnPropertyDescriptor(s,l))})}return f}function Ac(f,a){if(typeof f!="object"||!f)return f;var s=f[Symbol.toPrimitive];if(s!==void 0){var l=s.call(f,a);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(f)}function Io(f){var a=Ac(f,"string");return typeof a=="symbol"?a:a+""}function ja(f){"@babel/helpers - typeof";return ja=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},ja(f)}var No={backdrop:!0,button:!0,navbar:!0,title:!0,toolbar:!0,className:"",container:"body",filter:null,fullscreen:!0,inheritedAttributes:["crossOrigin","decoding","isMap","loading","referrerPolicy","sizes","srcset","useMap"],initialCoverage:.9,initialViewIndex:0,inline:!1,interval:5e3,keyboard:!0,focus:!0,loading:!0,loop:!0,minWidth:200,minHeight:100,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,slideOnTouch:!0,toggleOnDblclick:!0,tooltip:!0,transition:!0,zIndex:2015,zIndexInline:0,zoomRatio:.1,minZoomRatio:.01,maxZoomRatio:100,url:"src",ready:null,show:null,shown:null,hide:null,hidden:null,view:null,viewed:null,move:null,moved:null,rotate:null,rotated:null,scale:null,scaled:null,zoom:null,zoomed:null,play:null,stop:null},Oc='<div class="viewer-container" tabindex="-1" touch-action="none"><div class="viewer-canvas"></div><div class="viewer-footer"><div class="viewer-title"></div><div class="viewer-toolbar"></div><div class="viewer-navbar"><ul class="viewer-list" role="navigation"></ul></div></div><div class="viewer-tooltip" role="alert" aria-hidden="true"></div><div class="viewer-button" data-viewer-action="mix" role="button"></div><div class="viewer-player"></div></div>',Hi=typeof window<"u"&&typeof window.document<"u",or=Hi?window:{},nn=Hi&&or.document.documentElement?"ontouchstart"in or.document.documentElement:!1,qa=Hi?"PointerEvent"in or:!1,pe="viewer",Wi="move",Mo="switch",qn="zoom",Bi="".concat(pe,"-active"),Ec="".concat(pe,"-close"),$i="".concat(pe,"-fade"),Ga="".concat(pe,"-fixed"),Dc="".concat(pe,"-fullscreen"),Ro="".concat(pe,"-fullscreen-exit"),Hr="".concat(pe,"-hide"),Ic="".concat(pe,"-hide-md-down"),Nc="".concat(pe,"-hide-sm-down"),Mc="".concat(pe,"-hide-xs-down"),Mt="".concat(pe,"-in"),Gn="".concat(pe,"-invisible"),an="".concat(pe,"-loading"),Rc="".concat(pe,"-move"),zo="".concat(pe,"-open"),sn="".concat(pe,"-show"),$e="".concat(pe,"-transition"),on="click",Xa="dblclick",Po="dragstart",Fo="focusin",Ho="keydown",Rt="load",Wr="error",zc=nn?"touchend touchcancel":"mouseup",Pc=nn?"touchmove":"mousemove",Fc=nn?"touchstart":"mousedown",Wo=qa?"pointerdown":Fc,Bo=qa?"pointermove":Pc,$o=qa?"pointerup pointercancel":zc,Uo="resize",Ft="transitionend",jo="wheel",qo="ready",Go="show",Xo="shown",Ko="hide",Yo="hidden",Zo="view",Xn="viewed",Qo="move",Vo="moved",Jo="rotate",el="rotated",tl="scale",rl="scaled",nl="zoom",il="zoomed",al="play",sl="stop",Ui="".concat(pe,"Action"),Ka=/\s\s*/,ji=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function Kn(f){return typeof f=="string"}var Hc=Number.isNaN||or.isNaN;function Re(f){return typeof f=="number"&&!Hc(f)}function ln(f){return typeof f>"u"}function un(f){return ja(f)==="object"&&f!==null}var Wc=Object.prototype.hasOwnProperty;function fn(f){if(!un(f))return!1;try{var a=f.constructor,s=a.prototype;return a&&s&&Wc.call(s,"isPrototypeOf")}catch{return!1}}function _e(f){return typeof f=="function"}function Oe(f,a){if(f&&_e(a))if(Array.isArray(f)||Re(f.length)){var s=f.length,l;for(l=0;l<s&&a.call(f,f[l],l,f)!==!1;l+=1);}else un(f)&&Object.keys(f).forEach(function(h){a.call(f,f[h],h,f)});return f}var _t=Object.assign||function(a){for(var s=arguments.length,l=new Array(s>1?s-1:0),h=1;h<s;h++)l[h-1]=arguments[h];return un(a)&&l.length>0&&l.forEach(function(g){un(g)&&Object.keys(g).forEach(function(p){a[p]=g[p]})}),a},Bc=/^(?:width|height|left|top|marginLeft|marginTop)$/;function Ht(f,a){var s=f.style;Oe(a,function(l,h){Bc.test(h)&&Re(l)&&(l+="px"),s[h]=l})}function $c(f){return Kn(f)?f.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):f}function cn(f,a){return!f||!a?!1:f.classList?f.classList.contains(a):f.className.indexOf(a)>-1}function se(f,a){if(!(!f||!a)){if(Re(f.length)){Oe(f,function(l){se(l,a)});return}if(f.classList){f.classList.add(a);return}var s=f.className.trim();s?s.indexOf(a)<0&&(f.className="".concat(s," ").concat(a)):f.className=a}}function we(f,a){if(!(!f||!a)){if(Re(f.length)){Oe(f,function(s){we(s,a)});return}if(f.classList){f.classList.remove(a);return}f.className.indexOf(a)>=0&&(f.className=f.className.replace(a,""))}}function Yn(f,a,s){if(a){if(Re(f.length)){Oe(f,function(l){Yn(l,a,s)});return}s?se(f,a):we(f,a)}}var Uc=/([a-z\d])([A-Z])/g;function Ya(f){return f.replace(Uc,"$1-$2").toLowerCase()}function hn(f,a){return un(f[a])?f[a]:f.dataset?f.dataset[a]:f.getAttribute("data-".concat(Ya(a)))}function Za(f,a,s){un(s)?f[a]=s:f.dataset?f.dataset[a]=s:f.setAttribute("data-".concat(Ya(a)),s)}var ol=function(){var f=!1;if(Hi){var a=!1,s=function(){},l=Object.defineProperty({},"once",{get:function(){return f=!0,a},set:function(g){a=g}});or.addEventListener("test",s,l),or.removeEventListener("test",s,l)}return f}();function Ae(f,a,s){var l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},h=s;a.trim().split(Ka).forEach(function(g){if(!ol){var p=f.listeners;p&&p[g]&&p[g][s]&&(h=p[g][s],delete p[g][s],Object.keys(p[g]).length===0&&delete p[g],Object.keys(p).length===0&&delete f.listeners)}f.removeEventListener(g,h,l)})}function le(f,a,s){var l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},h=s;a.trim().split(Ka).forEach(function(g){if(l.once&&!ol){var p=f.listeners,y=p===void 0?{}:p;h=function(){delete y[g][s],f.removeEventListener(g,h,l);for(var b=arguments.length,k=new Array(b),A=0;A<b;A++)k[A]=arguments[A];s.apply(f,k)},y[g]||(y[g]={}),y[g][s]&&f.removeEventListener(g,y[g][s],l),y[g][s]=h,f.listeners=y}f.addEventListener(g,h,l)})}function je(f,a,s,l){var h;return _e(Event)&&_e(CustomEvent)?h=new CustomEvent(a,Ua({bubbles:!0,cancelable:!0,detail:s},l)):(h=document.createEvent("CustomEvent"),h.initCustomEvent(a,!0,!0,s)),f.dispatchEvent(h)}function jc(f){var a=f.getBoundingClientRect();return{left:a.left+(window.pageXOffset-document.documentElement.clientLeft),top:a.top+(window.pageYOffset-document.documentElement.clientTop)}}function qi(f){var a=f.rotate,s=f.scaleX,l=f.scaleY,h=f.translateX,g=f.translateY,p=[];Re(h)&&h!==0&&p.push("translateX(".concat(h,"px)")),Re(g)&&g!==0&&p.push("translateY(".concat(g,"px)")),Re(a)&&a!==0&&p.push("rotate(".concat(a,"deg)")),Re(s)&&s!==1&&p.push("scaleX(".concat(s,")")),Re(l)&&l!==1&&p.push("scaleY(".concat(l,")"));var y=p.length?p.join(" "):"none";return{WebkitTransform:y,msTransform:y,transform:y}}function qc(f){return Kn(f)?decodeURIComponent(f.replace(/^.*\//,"").replace(/[?&#].*$/,"")):""}var Qa=or.navigator&&/Version\/\d+(\.\d+)+?\s+Safari/i.test(or.navigator.userAgent);function ll(f,a,s){var l=document.createElement("img");if(f.naturalWidth&&!Qa)return s(f.naturalWidth,f.naturalHeight),l;var h=document.body||document.documentElement;return l.onload=function(){s(l.width,l.height),Qa||h.removeChild(l)},Oe(a.inheritedAttributes,function(g){var p=f.getAttribute(g);p!==null&&l.setAttribute(g,p)}),l.src=f.src,Qa||(l.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",h.appendChild(l)),l}function Gi(f){switch(f){case 2:return Mc;case 3:return Nc;case 4:return Ic;default:return""}}function Gc(f){var a=Ua({},f),s=[];return Oe(f,function(l,h){delete a[h],Oe(a,function(g){var p=Math.abs(l.startX-g.startX),y=Math.abs(l.startY-g.startY),w=Math.abs(l.endX-g.endX),b=Math.abs(l.endY-g.endY),k=Math.sqrt(p*p+y*y),A=Math.sqrt(w*w+b*b),L=(A-k)/k;s.push(L)})}),s.sort(function(l,h){return Math.abs(l)<Math.abs(h)}),s[0]}function Xi(f,a){var s=f.pageX,l=f.pageY,h={endX:s,endY:l};return a?h:Ua({timeStamp:Date.now(),startX:s,startY:l},h)}function Xc(f){var a=0,s=0,l=0;return Oe(f,function(h){var g=h.startX,p=h.startY;a+=g,s+=p,l+=1}),a/=l,s/=l,{pageX:a,pageY:s}}var Kc={render:function(){this.initContainer(),this.initViewer(),this.initList(),this.renderViewer()},initBody:function(){var a=this.element.ownerDocument,s=a.body||a.documentElement;this.body=s,this.scrollbarWidth=window.innerWidth-a.documentElement.clientWidth,this.initialBodyPaddingRight=s.style.paddingRight,this.initialBodyComputedPaddingRight=window.getComputedStyle(s).paddingRight},initContainer:function(){this.containerData={width:window.innerWidth,height:window.innerHeight}},initViewer:function(){var a=this.options,s=this.parent,l;a.inline&&(l={width:Math.max(s.offsetWidth,a.minWidth),height:Math.max(s.offsetHeight,a.minHeight)},this.parentData=l),(this.fulled||!l)&&(l=this.containerData),this.viewerData=_t({},l)},renderViewer:function(){this.options.inline&&!this.fulled&&Ht(this.viewer,this.viewerData)},initList:function(){var a=this,s=this.element,l=this.options,h=this.list,g=[];h.innerHTML="",Oe(this.images,function(p,y){var w=p.src,b=p.alt||qc(w),k=a.getImageURL(p);if(w||k){var A=document.createElement("li"),L=document.createElement("img");Oe(l.inheritedAttributes,function(H){var P=p.getAttribute(H);P!==null&&L.setAttribute(H,P)}),l.navbar&&(L.src=w||k),L.alt=b,L.setAttribute("data-original-url",k||w),A.setAttribute("data-index",y),A.setAttribute("data-viewer-action","view"),A.setAttribute("role","button"),l.keyboard&&A.setAttribute("tabindex",0),A.appendChild(L),h.appendChild(A),g.push(A)}}),this.items=g,Oe(g,function(p){var y=p.firstElementChild,w,b;Za(y,"filled",!0),l.loading&&se(p,an),le(y,Rt,w=function(A){Ae(y,Wr,b),l.loading&&we(p,an),a.loadImage(A)},{once:!0}),le(y,Wr,b=function(){Ae(y,Rt,w),l.loading&&we(p,an)},{once:!0})}),l.transition&&le(s,Xn,function(){se(h,$e)},{once:!0})},renderList:function(){var a=this.index,s=this.items[a];if(s){var l=s.nextElementSibling,h=parseInt(window.getComputedStyle(l||s).marginLeft,10),g=s.offsetWidth,p=g+h;Ht(this.list,_t({width:p*this.length-h},qi({translateX:(this.viewerData.width-g)/2-p*a})))}},resetList:function(){var a=this.list;a.innerHTML="",we(a,$e),Ht(a,qi({translateX:0}))},initImage:function(a){var s=this,l=this.options,h=this.image,g=this.viewerData,p=this.footer.offsetHeight,y=g.width,w=Math.max(g.height-p,p),b=this.imageData||{},k;this.imageInitializing={abort:function(){k.onload=null}},k=ll(h,l,function(A,L){var H=A/L,P=Math.max(0,Math.min(1,l.initialCoverage)),$=y,N=w;s.imageInitializing=!1,w*H>y?N=y/H:$=w*H,P=Re(P)?P:.9,$=Math.min($*P,A),N=Math.min(N*P,L);var E=(y-$)/2,D=(w-N)/2,R={left:E,top:D,x:E,y:D,width:$,height:N,oldRatio:1,ratio:$/A,aspectRatio:H,naturalWidth:A,naturalHeight:L},G=_t({},R);l.rotatable&&(R.rotate=b.rotate||0,G.rotate=0),l.scalable&&(R.scaleX=b.scaleX||1,R.scaleY=b.scaleY||1,G.scaleX=1,G.scaleY=1),s.imageData=R,s.initialImageData=G,a&&a()})},renderImage:function(a){var s=this,l=this.image,h=this.imageData;if(Ht(l,_t({width:h.width,height:h.height,marginLeft:h.x,marginTop:h.y},qi(h))),a)if((this.viewing||this.moving||this.rotating||this.scaling||this.zooming)&&this.options.transition&&cn(l,$e)){var g=function(){s.imageRendering=!1,a()};this.imageRendering={abort:function(){Ae(l,Ft,g)}},le(l,Ft,g,{once:!0})}else a()},resetImage:function(){var a=this.image;a&&(this.viewing&&this.viewing.abort(),a.parentNode.removeChild(a),this.image=null,this.title.innerHTML="")}},Yc={bind:function(){var a=this.options,s=this.viewer,l=this.canvas,h=this.element.ownerDocument;le(s,on,this.onClick=this.click.bind(this)),le(s,Po,this.onDragStart=this.dragstart.bind(this)),le(l,Wo,this.onPointerDown=this.pointerdown.bind(this)),le(h,Bo,this.onPointerMove=this.pointermove.bind(this)),le(h,$o,this.onPointerUp=this.pointerup.bind(this)),le(h,Ho,this.onKeyDown=this.keydown.bind(this)),le(window,Uo,this.onResize=this.resize.bind(this)),a.zoomable&&a.zoomOnWheel&&le(s,jo,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),a.toggleOnDblclick&&le(l,Xa,this.onDblclick=this.dblclick.bind(this))},unbind:function(){var a=this.options,s=this.viewer,l=this.canvas,h=this.element.ownerDocument;Ae(s,on,this.onClick),Ae(s,Po,this.onDragStart),Ae(l,Wo,this.onPointerDown),Ae(h,Bo,this.onPointerMove),Ae(h,$o,this.onPointerUp),Ae(h,Ho,this.onKeyDown),Ae(window,Uo,this.onResize),a.zoomable&&a.zoomOnWheel&&Ae(s,jo,this.onWheel,{passive:!1,capture:!0}),a.toggleOnDblclick&&Ae(l,Xa,this.onDblclick)}},Zc={click:function(a){var s=this.options,l=this.imageData,h=a.target,g=hn(h,Ui);switch(!g&&h.localName==="img"&&h.parentElement.localName==="li"&&(h=h.parentElement,g=hn(h,Ui)),nn&&a.isTrusted&&h===this.canvas&&clearTimeout(this.clickCanvasTimeout),g){case"mix":this.played?this.stop():s.inline?this.fulled?this.exit():this.full():this.hide();break;case"hide":this.pointerMoved||this.hide();break;case"view":this.view(hn(h,"index"));break;case"zoom-in":this.zoom(.1,!0);break;case"zoom-out":this.zoom(-.1,!0);break;case"one-to-one":this.toggle();break;case"reset":this.reset();break;case"prev":this.prev(s.loop);break;case"play":this.play(s.fullscreen);break;case"next":this.next(s.loop);break;case"rotate-left":this.rotate(-90);break;case"rotate-right":this.rotate(90);break;case"flip-horizontal":this.scaleX(-l.scaleX||-1);break;case"flip-vertical":this.scaleY(-l.scaleY||-1);break;default:this.played&&this.stop()}},dblclick:function(a){a.preventDefault(),this.viewed&&a.target===this.image&&(nn&&a.isTrusted&&clearTimeout(this.doubleClickImageTimeout),this.toggle(a.isTrusted?a:a.detail&&a.detail.originalEvent))},load:function(){var a=this;this.timeout&&(clearTimeout(this.timeout),this.timeout=!1);var s=this.element,l=this.options,h=this.image,g=this.index,p=this.viewerData;we(h,Gn),l.loading&&we(this.canvas,an),h.style.cssText="height:0;"+"margin-left:".concat(p.width/2,"px;")+"margin-top:".concat(p.height/2,"px;")+"max-width:none!important;position:relative;width:0;",this.initImage(function(){Yn(h,Rc,l.movable),Yn(h,$e,l.transition),a.renderImage(function(){a.viewed=!0,a.viewing=!1,_e(l.viewed)&&le(s,Xn,l.viewed,{once:!0}),je(s,Xn,{originalImage:a.images[g],index:g,image:h},{cancelable:!1})})})},loadImage:function(a){var s=a.target,l=s.parentNode,h=l.offsetWidth||30,g=l.offsetHeight||50,p=!!hn(s,"filled");ll(s,this.options,function(y,w){var b=y/w,k=h,A=g;g*b>h?p?k=g*b:A=h/b:p?A=h/b:k=g*b,Ht(s,_t({width:k,height:A},qi({translateX:(h-k)/2,translateY:(g-A)/2})))})},keydown:function(a){var s=this.options;if(s.keyboard){var l=a.keyCode||a.which||a.charCode;switch(l){case 13:this.viewer.contains(a.target)&&this.click(a);break}if(this.fulled)switch(l){case 27:this.played?this.stop():s.inline?this.fulled&&this.exit():this.hide();break;case 32:this.played&&this.stop();break;case 37:this.played&&this.playing?this.playing.prev():this.prev(s.loop);break;case 38:a.preventDefault(),this.zoom(s.zoomRatio,!0);break;case 39:this.played&&this.playing?this.playing.next():this.next(s.loop);break;case 40:a.preventDefault(),this.zoom(-s.zoomRatio,!0);break;case 48:case 49:a.ctrlKey&&(a.preventDefault(),this.toggle());break}}},dragstart:function(a){a.target.localName==="img"&&a.preventDefault()},pointerdown:function(a){var s=this.options,l=this.pointers,h=a.buttons,g=a.button;if(this.pointerMoved=!1,!(!this.viewed||this.showing||this.viewing||this.hiding||(a.type==="mousedown"||a.type==="pointerdown"&&a.pointerType==="mouse")&&(Re(h)&&h!==1||Re(g)&&g!==0||a.ctrlKey))){a.preventDefault(),a.changedTouches?Oe(a.changedTouches,function(y){l[y.identifier]=Xi(y)}):l[a.pointerId||0]=Xi(a);var p=s.movable?Wi:!1;s.zoomOnTouch&&s.zoomable&&Object.keys(l).length>1?p=qn:s.slideOnTouch&&(a.pointerType==="touch"||a.type==="touchstart")&&this.isSwitchable()&&(p=Mo),s.transition&&(p===Wi||p===qn)&&we(this.image,$e),this.action=p}},pointermove:function(a){var s=this.pointers,l=this.action;!this.viewed||!l||(a.preventDefault(),a.changedTouches?Oe(a.changedTouches,function(h){_t(s[h.identifier]||{},Xi(h,!0))}):_t(s[a.pointerId||0]||{},Xi(a,!0)),this.change(a))},pointerup:function(a){var s=this,l=this.options,h=this.action,g=this.pointers,p;a.changedTouches?Oe(a.changedTouches,function(y){p=g[y.identifier],delete g[y.identifier]}):(p=g[a.pointerId||0],delete g[a.pointerId||0]),h&&(a.preventDefault(),l.transition&&(h===Wi||h===qn)&&se(this.image,$e),this.action=!1,nn&&h!==qn&&p&&Date.now()-p.timeStamp<500&&(clearTimeout(this.clickCanvasTimeout),clearTimeout(this.doubleClickImageTimeout),l.toggleOnDblclick&&this.viewed&&a.target===this.image?this.imageClicked?(this.imageClicked=!1,this.doubleClickImageTimeout=setTimeout(function(){je(s.image,Xa,{originalEvent:a})},50)):(this.imageClicked=!0,this.doubleClickImageTimeout=setTimeout(function(){s.imageClicked=!1},500)):(this.imageClicked=!1,l.backdrop&&l.backdrop!=="static"&&a.target===this.canvas&&(this.clickCanvasTimeout=setTimeout(function(){je(s.canvas,on,{originalEvent:a})},50)))))},resize:function(){var a=this;if(!(!this.isShown||this.hiding)&&(this.fulled&&(this.close(),this.initBody(),this.open()),this.initContainer(),this.initViewer(),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){a.renderImage()}),this.played)){if(this.options.fullscreen&&this.fulled&&!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)){this.stop();return}Oe(this.player.getElementsByTagName("img"),function(s){le(s,Rt,a.loadImage.bind(a),{once:!0}),je(s,Rt)})}},wheel:function(a){var s=this;if(this.viewed&&(a.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){s.wheeling=!1},50);var l=Number(this.options.zoomRatio)||.1,h=1;a.deltaY?h=a.deltaY>0?1:-1:a.wheelDelta?h=-a.wheelDelta/120:a.detail&&(h=a.detail>0?1:-1),this.zoom(-h*l,!0,null,a)}}},Qc={show:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,s=this.element,l=this.options;if(l.inline||this.showing||this.isShown||this.showing)return this;if(!this.ready)return this.build(),this.ready&&this.show(a),this;if(_e(l.show)&&le(s,Go,l.show,{once:!0}),je(s,Go)===!1||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var h=this.viewer;if(we(h,Hr),h.setAttribute("role","dialog"),h.setAttribute("aria-labelledby",this.title.id),h.setAttribute("aria-modal",!0),h.removeAttribute("aria-hidden"),l.transition&&!a){var g=this.shown.bind(this);this.transitioning={abort:function(){Ae(h,Ft,g),we(h,Mt)}},se(h,$e),h.initialOffsetWidth=h.offsetWidth,le(h,Ft,g,{once:!0}),se(h,Mt)}else se(h,Mt),this.shown();return this},hide:function(){var a=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,l=this.element,h=this.options;if(h.inline||this.hiding||!(this.isShown||this.showing))return this;if(_e(h.hide)&&le(l,Ko,h.hide,{once:!0}),je(l,Ko)===!1)return this;this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort();var g=this.viewer,p=this.image,y=function(){we(g,Mt),a.hidden()};if(h.transition&&!s){var w=function(A){A&&A.target===g&&(Ae(g,Ft,w),a.hidden())},b=function(){cn(g,$e)?(le(g,Ft,w),we(g,Mt)):y()};this.transitioning={abort:function(){a.viewed&&cn(p,$e)?Ae(p,Ft,b):cn(g,$e)&&Ae(g,Ft,w)}},this.viewed&&cn(p,$e)?(le(p,Ft,b,{once:!0}),this.zoomTo(0,!1,null,null,!0)):b()}else y();return this},view:function(){var a=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.initialViewIndex;if(s=Number(s)||0,this.hiding||this.played||s<0||s>=this.length||this.viewed&&s===this.index)return this;if(!this.isShown)return this.index=s,this.show();this.viewing&&this.viewing.abort();var l=this.element,h=this.options,g=this.title,p=this.canvas,y=this.items[s],w=y.querySelector("img"),b=hn(w,"originalUrl"),k=w.getAttribute("alt"),A=document.createElement("img");if(Oe(h.inheritedAttributes,function(N){var E=w.getAttribute(N);E!==null&&A.setAttribute(N,E)}),A.src=b,A.alt=k,_e(h.view)&&le(l,Zo,h.view,{once:!0}),je(l,Zo,{originalImage:this.images[s],index:s,image:A})===!1||!this.isShown||this.hiding||this.played)return this;var L=this.items[this.index];L&&(we(L,Bi),L.removeAttribute("aria-selected")),se(y,Bi),y.setAttribute("aria-selected",!0),h.focus&&y.focus(),this.image=A,this.viewed=!1,this.index=s,this.imageData={},se(A,Gn),h.loading&&se(p,an),p.innerHTML="",p.appendChild(A),this.renderList(),g.innerHTML="";var H=function(){var E=a.imageData,D=Array.isArray(h.title)?h.title[1]:h.title;g.innerHTML=$c(_e(D)?D.call(a,A,E):"".concat(k," (").concat(E.naturalWidth," × ").concat(E.naturalHeight,")"))},P,$;return le(l,Xn,H,{once:!0}),this.viewing={abort:function(){Ae(l,Xn,H),A.complete?a.imageRendering?a.imageRendering.abort():a.imageInitializing&&a.imageInitializing.abort():(A.src="",Ae(A,Rt,P),a.timeout&&clearTimeout(a.timeout))}},A.complete?this.load():(le(A,Rt,P=function(){Ae(A,Wr,$),a.load()},{once:!0}),le(A,Wr,$=function(){Ae(A,Rt,P),a.timeout&&(clearTimeout(a.timeout),a.timeout=!1),we(A,Gn),h.loading&&we(a.canvas,an)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){we(A,Gn),a.timeout=!1},1e3)),this},prev:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,s=this.index-1;return s<0&&(s=a?this.length-1:0),this.view(s),this},next:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,s=this.length-1,l=this.index+1;return l>s&&(l=a?0:s),this.view(l),this},move:function(a){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:a,l=this.imageData;return this.moveTo(ln(a)?a:l.x+Number(a),ln(s)?s:l.y+Number(s)),this},moveTo:function(a){var s=this,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:a,h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,g=this.element,p=this.options,y=this.imageData;if(a=Number(a),l=Number(l),this.viewed&&!this.played&&p.movable){var w=y.x,b=y.y,k=!1;if(Re(a)?k=!0:a=w,Re(l)?k=!0:l=b,k){if(_e(p.move)&&le(g,Qo,p.move,{once:!0}),je(g,Qo,{x:a,y:l,oldX:w,oldY:b,originalEvent:h})===!1)return this;y.x=a,y.y=l,y.left=a,y.top=l,this.moving=!0,this.renderImage(function(){s.moving=!1,_e(p.moved)&&le(g,Vo,p.moved,{once:!0}),je(g,Vo,{x:a,y:l,oldX:w,oldY:b,originalEvent:h},{cancelable:!1})})}}return this},rotate:function(a){return this.rotateTo((this.imageData.rotate||0)+Number(a)),this},rotateTo:function(a){var s=this,l=this.element,h=this.options,g=this.imageData;if(a=Number(a),Re(a)&&this.viewed&&!this.played&&h.rotatable){var p=g.rotate;if(_e(h.rotate)&&le(l,Jo,h.rotate,{once:!0}),je(l,Jo,{degree:a,oldDegree:p})===!1)return this;g.rotate=a,this.rotating=!0,this.renderImage(function(){s.rotating=!1,_e(h.rotated)&&le(l,el,h.rotated,{once:!0}),je(l,el,{degree:a,oldDegree:p},{cancelable:!1})})}return this},scaleX:function(a){return this.scale(a,this.imageData.scaleY),this},scaleY:function(a){return this.scale(this.imageData.scaleX,a),this},scale:function(a){var s=this,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:a,h=this.element,g=this.options,p=this.imageData;if(a=Number(a),l=Number(l),this.viewed&&!this.played&&g.scalable){var y=p.scaleX,w=p.scaleY,b=!1;if(Re(a)?b=!0:a=y,Re(l)?b=!0:l=w,b){if(_e(g.scale)&&le(h,tl,g.scale,{once:!0}),je(h,tl,{scaleX:a,scaleY:l,oldScaleX:y,oldScaleY:w})===!1)return this;p.scaleX=a,p.scaleY=l,this.scaling=!0,this.renderImage(function(){s.scaling=!1,_e(g.scaled)&&le(h,rl,g.scaled,{once:!0}),je(h,rl,{scaleX:a,scaleY:l,oldScaleX:y,oldScaleY:w},{cancelable:!1})})}}return this},zoom:function(a){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,g=this.imageData;return a=Number(a),a<0?a=1/(1-a):a=1+a,this.zoomTo(g.width*a/g.naturalWidth,s,l,h),this},zoomTo:function(a){var s=this,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,p=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,y=this.element,w=this.options,b=this.pointers,k=this.imageData,A=k.x,L=k.y,H=k.width,P=k.height,$=k.naturalWidth,N=k.naturalHeight;if(a=Math.max(0,a),Re(a)&&this.viewed&&!this.played&&(p||w.zoomable)){if(!p){var E=Math.max(.01,w.minZoomRatio),D=Math.min(100,w.maxZoomRatio);a=Math.min(Math.max(a,E),D)}if(g)switch(g.type){case"wheel":w.zoomRatio>=.055&&a>.95&&a<1.05&&(a=1);break;case"pointermove":case"touchmove":case"mousemove":a>.99&&a<1.01&&(a=1);break}var R=$*a,G=N*a,Z=R-H,ee=G-P,ne=k.ratio;if(_e(w.zoom)&&le(y,nl,w.zoom,{once:!0}),je(y,nl,{ratio:a,oldRatio:ne,originalEvent:g})===!1)return this;if(this.zooming=!0,g){var ue=jc(this.viewer),Ee=b&&Object.keys(b).length>0?Xc(b):{pageX:g.pageX,pageY:g.pageY};k.x-=Z*((Ee.pageX-ue.left-A)/H),k.y-=ee*((Ee.pageY-ue.top-L)/P)}else fn(h)&&Re(h.x)&&Re(h.y)?(k.x-=Z*((h.x-A)/H),k.y-=ee*((h.y-L)/P)):(k.x-=Z/2,k.y-=ee/2);k.left=k.x,k.top=k.y,k.width=R,k.height=G,k.oldRatio=ne,k.ratio=a,this.renderImage(function(){s.zooming=!1,_e(w.zoomed)&&le(y,il,w.zoomed,{once:!0}),je(y,il,{ratio:a,oldRatio:ne,originalEvent:g},{cancelable:!1})}),l&&this.tooltip()}return this},play:function(){var a=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!this.isShown||this.played)return this;var l=this.element,h=this.options;if(_e(h.play)&&le(l,al,h.play,{once:!0}),je(l,al)===!1)return this;var g=this.player,p=this.loadImage.bind(this),y=[],w=0,b=0;if(this.played=!0,this.onLoadWhenPlay=p,s&&this.requestFullscreen(s),se(g,sn),Oe(this.items,function(L,H){var P=L.querySelector("img"),$=document.createElement("img");$.src=hn(P,"originalUrl"),$.alt=P.getAttribute("alt"),$.referrerPolicy=P.referrerPolicy,w+=1,se($,$i),Yn($,$e,h.transition),cn(L,Bi)&&(se($,Mt),b=H),y.push($),le($,Rt,p,{once:!0}),g.appendChild($)}),Re(h.interval)&&h.interval>0){var k=function(){clearTimeout(a.playing.timeout),we(y[b],Mt),b-=1,b=b>=0?b:w-1,se(y[b],Mt),a.playing.timeout=setTimeout(k,h.interval)},A=function(){clearTimeout(a.playing.timeout),we(y[b],Mt),b+=1,b=b<w?b:0,se(y[b],Mt),a.playing.timeout=setTimeout(A,h.interval)};w>1&&(this.playing={prev:k,next:A,timeout:setTimeout(A,h.interval)})}return this},stop:function(){var a=this;if(!this.played)return this;var s=this.element,l=this.options;if(_e(l.stop)&&le(s,sl,l.stop,{once:!0}),je(s,sl)===!1)return this;var h=this.player;return clearTimeout(this.playing.timeout),this.playing=!1,this.played=!1,Oe(h.getElementsByTagName("img"),function(g){Ae(g,Rt,a.onLoadWhenPlay)}),we(h,sn),h.innerHTML="",this.exitFullscreen(),this},full:function(){var a=this,s=this.options,l=this.viewer,h=this.image,g=this.list;return!this.isShown||this.played||this.fulled||!s.inline?this:(this.fulled=!0,this.open(),se(this.button,Ro),s.transition&&(we(g,$e),this.viewed&&we(h,$e)),se(l,Ga),l.setAttribute("role","dialog"),l.setAttribute("aria-labelledby",this.title.id),l.setAttribute("aria-modal",!0),l.removeAttribute("style"),Ht(l,{zIndex:s.zIndex}),s.focus&&this.enforceFocus(),this.initContainer(),this.viewerData=_t({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){a.renderImage(function(){s.transition&&setTimeout(function(){se(h,$e),se(g,$e)},0)})}),this)},exit:function(){var a=this,s=this.options,l=this.viewer,h=this.image,g=this.list;return!this.isShown||this.played||!this.fulled||!s.inline?this:(this.fulled=!1,this.close(),we(this.button,Ro),s.transition&&(we(g,$e),this.viewed&&we(h,$e)),s.focus&&this.clearEnforceFocus(),l.removeAttribute("role"),l.removeAttribute("aria-labelledby"),l.removeAttribute("aria-modal"),we(l,Ga),Ht(l,{zIndex:s.zIndexInline}),this.viewerData=_t({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){a.renderImage(function(){s.transition&&setTimeout(function(){se(h,$e),se(g,$e)},0)})}),this)},tooltip:function(){var a=this,s=this.options,l=this.tooltipBox,h=this.imageData;return!this.viewed||this.played||!s.tooltip?this:(l.textContent="".concat(Math.round(h.ratio*100),"%"),this.tooltipping?clearTimeout(this.tooltipping):s.transition?(this.fading&&je(l,Ft),se(l,sn),se(l,$i),se(l,$e),l.removeAttribute("aria-hidden"),l.initialOffsetWidth=l.offsetWidth,se(l,Mt)):(se(l,sn),l.removeAttribute("aria-hidden")),this.tooltipping=setTimeout(function(){s.transition?(le(l,Ft,function(){we(l,sn),we(l,$i),we(l,$e),l.setAttribute("aria-hidden",!0),a.fading=!1},{once:!0}),we(l,Mt),a.fading=!0):(we(l,sn),l.setAttribute("aria-hidden",!0)),a.tooltipping=!1},1e3),this)},toggle:function(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.imageData.ratio===1?this.zoomTo(this.imageData.oldRatio,!0,null,a):this.zoomTo(1,!0,null,a),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=_t({},this.initialImageData),this.renderImage()),this},update:function(){var a=this,s=this.element,l=this.options,h=this.isImg;if(h&&!s.parentNode)return this.destroy();var g=[];if(Oe(h?[s]:s.querySelectorAll("img"),function(b){_e(l.filter)?l.filter.call(a,b)&&g.push(b):a.getImageURL(b)&&g.push(b)}),!g.length)return this;if(this.images=g,this.length=g.length,this.ready){var p=[];if(Oe(this.items,function(b,k){var A=b.querySelector("img"),L=g[k];L&&A?(L.src!==A.src||L.alt!==A.alt)&&p.push(k):p.push(k)}),Ht(this.list,{width:"auto"}),this.initList(),this.isShown)if(this.length){if(this.viewed){var y=p.indexOf(this.index);if(y>=0)this.viewed=!1,this.view(Math.max(Math.min(this.index-y,this.length-1),0));else{var w=this.items[this.index];se(w,Bi),w.setAttribute("aria-selected",!0)}}}else this.image=null,this.viewed=!1,this.index=0,this.imageData={},this.canvas.innerHTML="",this.title.innerHTML=""}else this.build();return this},destroy:function(){var a=this.element,s=this.options;return a[pe]?(this.destroyed=!0,this.ready?(this.played&&this.stop(),s.inline?(this.fulled&&this.exit(),this.unbind()):this.isShown?(this.viewing&&(this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort()),this.hiding&&this.transitioning.abort(),this.hidden()):this.showing&&(this.transitioning.abort(),this.hidden()),this.ready=!1,this.viewer.parentNode.removeChild(this.viewer)):s.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),s.inline||Ae(a,on,this.onStart),a[pe]=void 0,this):this}},Vc={getImageURL:function(a){var s=this.options.url;return Kn(s)?s=a.getAttribute(s):_e(s)?s=s.call(this,a):s="",s},enforceFocus:function(){var a=this;this.clearEnforceFocus(),le(document,Fo,this.onFocusin=function(s){var l=a.viewer,h=s.target;if(!(h===document||h===l||l.contains(h))){for(;h;){if(h.getAttribute("tabindex")!==null||h.getAttribute("aria-modal")==="true")return;h=h.parentElement}l.focus()}})},clearEnforceFocus:function(){this.onFocusin&&(Ae(document,Fo,this.onFocusin),this.onFocusin=null)},open:function(){var a=this.body;se(a,zo),this.scrollbarWidth>0&&(a.style.paddingRight="".concat(this.scrollbarWidth+(parseFloat(this.initialBodyComputedPaddingRight)||0),"px"))},close:function(){var a=this.body;we(a,zo),this.scrollbarWidth>0&&(a.style.paddingRight=this.initialBodyPaddingRight)},shown:function(){var a=this.element,s=this.options,l=this.viewer;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,s.focus&&(l.focus(),this.enforceFocus()),_e(s.shown)&&le(a,Xo,s.shown,{once:!0}),je(a,Xo)!==!1&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var a=this.element,s=this.options,l=this.viewer;s.fucus&&this.clearEnforceFocus(),this.close(),this.unbind(),se(l,Hr),l.removeAttribute("role"),l.removeAttribute("aria-labelledby"),l.removeAttribute("aria-modal"),l.setAttribute("aria-hidden",!0),this.resetList(),this.resetImage(),this.fulled=!1,this.viewed=!1,this.isShown=!1,this.hiding=!1,this.destroyed||(_e(s.hidden)&&le(a,Yo,s.hidden,{once:!0}),je(a,Yo,null,{cancelable:!1}))},requestFullscreen:function(a){var s=this.element.ownerDocument;if(this.fulled&&!(s.fullscreenElement||s.webkitFullscreenElement||s.mozFullScreenElement||s.msFullscreenElement)){var l=s.documentElement;l.requestFullscreen?fn(a)?l.requestFullscreen(a):l.requestFullscreen():l.webkitRequestFullscreen?l.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):l.mozRequestFullScreen?l.mozRequestFullScreen():l.msRequestFullscreen&&l.msRequestFullscreen()}},exitFullscreen:function(){var a=this.element.ownerDocument;this.fulled&&(a.fullscreenElement||a.webkitFullscreenElement||a.mozFullScreenElement||a.msFullscreenElement)&&(a.exitFullscreen?a.exitFullscreen():a.webkitExitFullscreen?a.webkitExitFullscreen():a.mozCancelFullScreen?a.mozCancelFullScreen():a.msExitFullscreen&&a.msExitFullscreen())},change:function(a){var s=this.options,l=this.pointers,h=l[Object.keys(l)[0]];if(h){var g=h.endX-h.startX,p=h.endY-h.startY;switch(this.action){case Wi:(g!==0||p!==0)&&(this.pointerMoved=!0,this.move(g,p,a));break;case qn:this.zoom(Gc(l),!1,null,a);break;case Mo:{this.action="switched";var y=Math.abs(g);y>1&&y>Math.abs(p)&&(this.pointers={},g>1?this.prev(s.loop):g<-1&&this.next(s.loop));break}}Oe(l,function(w){w.startX=w.endX,w.startY=w.endY})}},isSwitchable:function(){var a=this.imageData,s=this.viewerData;return this.length>1&&a.x>=0&&a.y>=0&&a.width<=s.width&&a.height<=s.height}},Jc=or.Viewer,eh=function(f){return function(){return f+=1,f}}(-1),ul=function(){function f(a){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Tc(this,f),!a||a.nodeType!==1)throw new Error("The first argument is required and must be an element.");this.element=a,this.options=_t({},No,fn(s)&&s),this.action=!1,this.fading=!1,this.fulled=!1,this.hiding=!1,this.imageClicked=!1,this.imageData={},this.index=this.options.initialViewIndex,this.isImg=!1,this.isShown=!1,this.length=0,this.moving=!1,this.played=!1,this.playing=!1,this.pointers={},this.ready=!1,this.rotating=!1,this.scaling=!1,this.showing=!1,this.timeout=!1,this.tooltipping=!1,this.viewed=!1,this.viewing=!1,this.wheeling=!1,this.zooming=!1,this.pointerMoved=!1,this.id=eh(),this.init()}return Lc(f,[{key:"init",value:function(){var s=this,l=this.element,h=this.options;if(!l[pe]){l[pe]=this,h.focus&&!h.keyboard&&(h.focus=!1);var g=l.localName==="img",p=[];if(Oe(g?[l]:l.querySelectorAll("img"),function(b){_e(h.filter)?h.filter.call(s,b)&&p.push(b):s.getImageURL(b)&&p.push(b)}),this.isImg=g,this.length=p.length,this.images=p,this.initBody(),ln(document.createElement(pe).style.transition)&&(h.transition=!1),h.inline){var y=0,w=function(){if(y+=1,y===s.length){var k;s.initializing=!1,s.delaying={abort:function(){clearTimeout(k)}},k=setTimeout(function(){s.delaying=!1,s.build()},0)}};this.initializing={abort:function(){Oe(p,function(k){k.complete||(Ae(k,Rt,w),Ae(k,Wr,w))})}},Oe(p,function(b){if(b.complete)w();else{var k,A;le(b,Rt,k=function(){Ae(b,Wr,A),w()},{once:!0}),le(b,Wr,A=function(){Ae(b,Rt,k),w()},{once:!0})}})}else le(l,on,this.onStart=function(b){var k=b.target;k.localName==="img"&&(!_e(h.filter)||h.filter.call(s,k))&&s.view(s.images.indexOf(k))})}}},{key:"build",value:function(){if(!this.ready){var s=this.element,l=this.options,h=s.parentNode,g=document.createElement("div");g.innerHTML=Oc;var p=g.querySelector(".".concat(pe,"-container")),y=p.querySelector(".".concat(pe,"-title")),w=p.querySelector(".".concat(pe,"-toolbar")),b=p.querySelector(".".concat(pe,"-navbar")),k=p.querySelector(".".concat(pe,"-button")),A=p.querySelector(".".concat(pe,"-canvas"));if(this.parent=h,this.viewer=p,this.title=y,this.toolbar=w,this.navbar=b,this.button=k,this.canvas=A,this.footer=p.querySelector(".".concat(pe,"-footer")),this.tooltipBox=p.querySelector(".".concat(pe,"-tooltip")),this.player=p.querySelector(".".concat(pe,"-player")),this.list=p.querySelector(".".concat(pe,"-list")),p.id="".concat(pe).concat(this.id),y.id="".concat(pe,"Title").concat(this.id),se(y,l.title?Gi(Array.isArray(l.title)?l.title[0]:l.title):Hr),se(b,l.navbar?Gi(l.navbar):Hr),Yn(k,Hr,!l.button),l.keyboard&&k.setAttribute("tabindex",0),l.backdrop&&(se(p,"".concat(pe,"-backdrop")),!l.inline&&l.backdrop!=="static"&&Za(A,Ui,"hide")),Kn(l.className)&&l.className&&l.className.split(Ka).forEach(function(R){se(p,R)}),l.toolbar){var L=document.createElement("ul"),H=fn(l.toolbar),P=ji.slice(0,3),$=ji.slice(7,9),N=ji.slice(9);H||se(w,Gi(l.toolbar)),Oe(H?l.toolbar:ji,function(R,G){var Z=H&&fn(R),ee=H?Ya(G):R,ne=Z&&!ln(R.show)?R.show:R;if(!(!ne||!l.zoomable&&P.indexOf(ee)!==-1||!l.rotatable&&$.indexOf(ee)!==-1||!l.scalable&&N.indexOf(ee)!==-1)){var ue=Z&&!ln(R.size)?R.size:R,Ee=Z&&!ln(R.click)?R.click:R,ke=document.createElement("li");l.keyboard&&ke.setAttribute("tabindex",0),ke.setAttribute("role","button"),se(ke,"".concat(pe,"-").concat(ee)),_e(Ee)||Za(ke,Ui,ee),Re(ne)&&se(ke,Gi(ne)),["small","large"].indexOf(ue)!==-1?se(ke,"".concat(pe,"-").concat(ue)):ee==="play"&&se(ke,"".concat(pe,"-large")),_e(Ee)&&le(ke,on,Ee),L.appendChild(ke)}}),w.appendChild(L)}else se(w,Hr);if(!l.rotatable){var E=w.querySelectorAll('li[class*="rotate"]');se(E,Gn),Oe(E,function(R){w.appendChild(R)})}if(l.inline)se(k,Dc),Ht(p,{zIndex:l.zIndexInline}),window.getComputedStyle(h).position==="static"&&Ht(h,{position:"relative"}),h.insertBefore(p,s.nextSibling);else{se(k,Ec),se(p,Ga),se(p,$i),se(p,Hr),Ht(p,{zIndex:l.zIndex});var D=l.container;Kn(D)&&(D=s.ownerDocument.querySelector(D)),D||(D=this.body),D.appendChild(p)}if(l.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,_e(l.ready)&&le(s,qo,l.ready,{once:!0}),je(s,qo)===!1){this.ready=!1;return}this.ready&&l.inline&&this.view(this.index)}}}],[{key:"noConflict",value:function(){return window.Viewer=Jc,f}},{key:"setDefaults",value:function(s){_t(No,fn(s)&&s)}}])}();_t(ul.prototype,Kc,Yc,Zc,Qc,Vc);var th=typeof global=="object"&&global&&global.Object===Object&&global,fl=th,rh=typeof self=="object"&&self&&self.Object===Object&&self,nh=fl||rh||Function("return this")(),Va=nh,ih=Va.Symbol,Ki=ih,cl=Object.prototype,ah=cl.hasOwnProperty,sh=cl.toString,Zn=Ki?Ki.toStringTag:void 0;function oh(f){var a=ah.call(f,Zn),s=f[Zn];try{f[Zn]=void 0;var l=!0}catch{}var h=sh.call(f);return l&&(a?f[Zn]=s:delete f[Zn]),h}var lh=Object.prototype,uh=lh.toString;function fh(f){return uh.call(f)}var ch="[object Null]",hh="[object Undefined]",hl=Ki?Ki.toStringTag:void 0;function Ja(f){return f==null?f===void 0?hh:ch:hl&&hl in Object(f)?oh(f):fh(f)}function es(f){return f!=null&&typeof f=="object"}var dh=Array.isArray,ph=dh;function ts(f){var a=typeof f;return f!=null&&(a=="object"||a=="function")}function dl(f){return f}var gh="[object AsyncFunction]",vh="[object Function]",mh="[object GeneratorFunction]",yh="[object Proxy]";function pl(f){if(!ts(f))return!1;var a=Ja(f);return a==vh||a==mh||a==gh||a==yh}var bh=Va["__core-js_shared__"],rs=bh,gl=function(){var f=/[^.]+$/.exec(rs&&rs.keys&&rs.keys.IE_PROTO||"");return f?"Symbol(src)_1."+f:""}();function wh(f){return!!gl&&gl in f}var xh=Function.prototype,kh=xh.toString;function Sh(f){if(f!=null){try{return kh.call(f)}catch{}try{return f+""}catch{}}return""}var Ch=/[\\^$.*+?()[\]{}|]/g,Th=/^\[object .+?Constructor\]$/,Lh=Function.prototype,_h=Object.prototype,Ah=Lh.toString,Oh=_h.hasOwnProperty,Eh=RegExp("^"+Ah.call(Oh).replace(Ch,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Dh(f){if(!ts(f)||wh(f))return!1;var a=pl(f)?Eh:Th;return a.test(Sh(f))}function Ih(f,a){return f==null?void 0:f[a]}function Nh(f,a){var s=Ih(f,a);return Dh(s)?s:void 0}function Mh(f,a,s){switch(s.length){case 0:return f.call(a);case 1:return f.call(a,s[0]);case 2:return f.call(a,s[0],s[1]);case 3:return f.call(a,s[0],s[1],s[2])}return f.apply(a,s)}var Rh=800,zh=16,Ph=Date.now;function Fh(f){var a=0,s=0;return function(){var l=Ph(),h=zh-(l-s);if(s=l,h>0){if(++a>=Rh)return arguments[0]}else a=0;return f.apply(void 0,arguments)}}function Hh(f){return function(){return f}}var Wh=function(){try{var f=Nh(Object,"defineProperty");return f({},"",{}),f}catch{}}(),Yi=Wh,Bh=Yi?function(f,a){return Yi(f,"toString",{configurable:!0,enumerable:!1,value:Hh(a),writable:!0})}:dl,$h=Bh,Uh=Fh($h),jh=Uh,qh=9007199254740991,Gh=/^(?:0|[1-9]\d*)$/;function vl(f,a){var s=typeof f;return a=a??qh,!!a&&(s=="number"||s!="symbol"&&Gh.test(f))&&f>-1&&f%1==0&&f<a}function ml(f,a,s){a=="__proto__"&&Yi?Yi(f,a,{configurable:!0,enumerable:!0,value:s,writable:!0}):f[a]=s}function yl(f,a){return f===a||f!==f&&a!==a}var Xh=Object.prototype,Kh=Xh.hasOwnProperty;function bl(f,a,s){var l=f[a];(!(Kh.call(f,a)&&yl(l,s))||s===void 0&&!(a in f))&&ml(f,a,s)}function Yh(f,a,s,l){var h=!s;s||(s={});for(var g=-1,p=a.length;++g<p;){var y=a[g],w=void 0;w===void 0&&(w=f[y]),h?ml(s,y,w):bl(s,y,w)}return s}var wl=Math.max;function Zh(f,a,s){return a=wl(a===void 0?f.length-1:a,0),function(){for(var l=arguments,h=-1,g=wl(l.length-a,0),p=Array(g);++h<g;)p[h]=l[a+h];h=-1;for(var y=Array(a+1);++h<a;)y[h]=l[h];return y[a]=s(p),Mh(f,this,y)}}function Qh(f,a){return jh(Zh(f,a,dl),f+"")}var Vh=9007199254740991;function xl(f){return typeof f=="number"&&f>-1&&f%1==0&&f<=Vh}function ns(f){return f!=null&&xl(f.length)&&!pl(f)}function Jh(f,a,s){if(!ts(s))return!1;var l=typeof a;return(l=="number"?ns(s)&&vl(a,s.length):l=="string"&&a in s)?yl(s[a],f):!1}function ed(f){return Qh(function(a,s){var l=-1,h=s.length,g=h>1?s[h-1]:void 0,p=h>2?s[2]:void 0;for(g=f.length>3&&typeof g=="function"?(h--,g):void 0,p&&Jh(s[0],s[1],p)&&(g=h<3?void 0:g,h=1),a=Object(a);++l<h;){var y=s[l];y&&f(a,y,l,g)}return a})}var td=Object.prototype;function kl(f){var a=f&&f.constructor,s=typeof a=="function"&&a.prototype||td;return f===s}function rd(f,a){for(var s=-1,l=Array(f);++s<f;)l[s]=a(s);return l}var nd="[object Arguments]";function Sl(f){return es(f)&&Ja(f)==nd}var Cl=Object.prototype,id=Cl.hasOwnProperty,ad=Cl.propertyIsEnumerable,sd=Sl(function(){return arguments}())?Sl:function(f){return es(f)&&id.call(f,"callee")&&!ad.call(f,"callee")},od=sd;function ld(){return!1}var Tl=typeof de=="object"&&de&&!de.nodeType&&de,Ll=Tl&&typeof module=="object"&&module&&!module.nodeType&&module,ud=Ll&&Ll.exports===Tl,_l=ud?Va.Buffer:void 0,fd=_l?_l.isBuffer:void 0,cd=fd||ld,hd=cd,dd="[object Arguments]",pd="[object Array]",gd="[object Boolean]",vd="[object Date]",md="[object Error]",yd="[object Function]",bd="[object Map]",wd="[object Number]",xd="[object Object]",kd="[object RegExp]",Sd="[object Set]",Cd="[object String]",Td="[object WeakMap]",Ld="[object ArrayBuffer]",_d="[object DataView]",Ad="[object Float32Array]",Od="[object Float64Array]",Ed="[object Int8Array]",Dd="[object Int16Array]",Id="[object Int32Array]",Nd="[object Uint8Array]",Md="[object Uint8ClampedArray]",Rd="[object Uint16Array]",zd="[object Uint32Array]",De={};De[Ad]=De[Od]=De[Ed]=De[Dd]=De[Id]=De[Nd]=De[Md]=De[Rd]=De[zd]=!0,De[dd]=De[pd]=De[Ld]=De[gd]=De[_d]=De[vd]=De[md]=De[yd]=De[bd]=De[wd]=De[xd]=De[kd]=De[Sd]=De[Cd]=De[Td]=!1;function Pd(f){return es(f)&&xl(f.length)&&!!De[Ja(f)]}function Fd(f){return function(a){return f(a)}}var Al=typeof de=="object"&&de&&!de.nodeType&&de,Qn=Al&&typeof module=="object"&&module&&!module.nodeType&&module,Hd=Qn&&Qn.exports===Al,is=Hd&&fl.process,Wd=function(){try{var f=Qn&&Qn.require&&Qn.require("util").types;return f||is&&is.binding&&is.binding("util")}catch{}}(),Ol=Wd,El=Ol&&Ol.isTypedArray,Bd=El?Fd(El):Pd,$d=Bd,Ud=Object.prototype,jd=Ud.hasOwnProperty;function qd(f,a){var s=ph(f),l=!s&&od(f),h=!s&&!l&&hd(f),g=!s&&!l&&!h&&$d(f),p=s||l||h||g,y=p?rd(f.length,String):[],w=y.length;for(var b in f)jd.call(f,b)&&!(p&&(b=="length"||h&&(b=="offset"||b=="parent")||g&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||vl(b,w)))&&y.push(b);return y}function Gd(f,a){return function(s){return f(a(s))}}var Xd=Gd(Object.keys,Object),Kd=Xd,Yd=Object.prototype,Zd=Yd.hasOwnProperty;function Qd(f){if(!kl(f))return Kd(f);var a=[];for(var s in Object(f))Zd.call(f,s)&&s!="constructor"&&a.push(s);return a}function Vd(f){return ns(f)?qd(f):Qd(f)}var Jd=Object.prototype,ep=Jd.hasOwnProperty,tp=ed(function(f,a){if(kl(a)||ns(a)){Yh(a,Vd(a),f);return}for(var s in a)ep.call(a,s)&&bl(f,s,a[s])}),rp=tp;const np=({images:f=[],options:a={}}={})=>{a=rp(a,{inline:!1});const s=Ff.extend({render(p){return p("div",{style:{display:"none"},class:["__viewer-token"]},f.map(y=>p("img",{attrs:typeof y=="string"?{src:y}:y})))}}),l=new s;l.$mount(),document.body.appendChild(l.$el);const h=new ul(l.$el,a),g=h.destroy.bind(h);return h.destroy=function(){return g(),l.$destroy(),document.body.removeChild(l.$el),h},h.show(),l.$el.addEventListener("hidden",function(){this.viewer===h&&h.destroy()}),h},ip={name:"Trace",components:{TraceSpanTree:$a,codemirror:Hf.codemirror},data(){return{traceList:[],filteredTraceList:[],searchQuery:"",dateRange:null,loading:!1,deleteLoading:!1,showColumnDialog:!1,selectedColumns:["trace_id","timestamp_ms","status","execution_time_ms","trace_type","trace_name"],visibleColumns:{trace_id:!0,timestamp_ms:!0,status:!0,execution_time_ms:!0,trace_type:!0,trace_name:!0},drawerVisible:!1,currentTraceId:null,traceInfo:{},spans:[],filteredSpans:[],spanSearchQuery:"",selectedSpanId:null,selectedSpan:null,activeTab:"io",activeCollapse:["inputs","outputs"],messageCollapse:[],rawIoCollapse:["rawInputs","rawOutputs"],rawInputsKey:0,rawOutputsKey:0,pageNo:1,pageSize:10,total:0,pickerOptions:{shortcuts:[{text:"近7天",onClick(f){const a=new Date,s=new Date;s.setTime(s.getTime()-3600*1e3*24*7),f.$emit("pick",[s,a])}},{text:"近30天",onClick(f){const a=new Date,s=new Date;s.setTime(s.getTime()-3600*1e3*24*30),f.$emit("pick",[s,a])}},{text:"7天前",onClick(f){const a=new Date;a.setTime(a.getTime()-3600*1e3*24*7),a.setHours(23,59,59,999);const s=a.getTime();f.$emit("pick",[null,s])}},{text:"30天前",onClick(f){const a=new Date;a.setTime(a.getTime()-3600*1e3*24*30),a.setHours(23,59,59,999);const s=a.getTime();f.$emit("pick",[null,s])}}]},cmOptions:{tabSize:2,mode:{name:"javascript",json:!0},theme:"monokai",lineNumbers:!0,lineWrapping:!0,readOnly:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,autoCloseBrackets:!0,indentUnit:2,styleActiveLine:!0},viewerOptions:{toolbar:{zoomIn:1,zoomOut:1,oneToOne:1,reset:1,prev:0,play:0,next:0,rotateLeft:1,rotateRight:1,flipHorizontal:1,flipVertical:1},title:!1,navbar:!1,scalable:!0,rotatable:!0,zoomable:!0,movable:!0,keyboard:!0,transition:!0,fullscreen:!0,zIndex:9999}}},computed:{drawerTitle(){return this.traceInfo.trace_id?`${this.$t("trace.traceDetail")}: ${this.traceInfo.trace_id}`:this.$t("trace.traceDetail")},traceStartTime(){return this.spans.length===0?0:Math.min(...this.spans.map(f=>f.start_time_unix_nano))},traceEndTime(){return this.spans.length===0?0:Math.max(...this.spans.map(f=>f.end_time_unix_nano))},hasInputs(){var f,a;return((a=(f=this.selectedSpan)==null?void 0:f.parsedContent)==null?void 0:a.inputs)!==void 0},hasOutputs(){var f,a;return((a=(f=this.selectedSpan)==null?void 0:f.parsedContent)==null?void 0:a.outputs)!==void 0},attributesData(){var f,a;return(a=(f=this.selectedSpan)==null?void 0:f.parsedContent)!=null&&a.attributes?Object.entries(this.selectedSpan.parsedContent.attributes).filter(([s])=>!s.startsWith("langsword.span")).map(([s,l])=>({key:s,value:typeof l=="string"?l:JSON.stringify(l,null,2)})):[]},rawInputs(){var f,a,s;return(s=(a=(f=this.selectedSpan)==null?void 0:f.parsedContent)==null?void 0:a.attributes)==null?void 0:s["langsword.spanInputs"]},rawOutputs(){var f,a,s;return(s=(a=(f=this.selectedSpan)==null?void 0:f.parsedContent)==null?void 0:a.attributes)==null?void 0:s["langsword.spanOutputs"]}},watch:{activeTab(f){f==="raw"&&this.$nextTick(()=>{this.rawInputsKey++,this.rawOutputsKey++})},selectedSpan(){this.activeTab==="raw"&&this.$nextTick(()=>{this.rawInputsKey++,this.rawOutputsKey++})}},mounted(){ve.setOptions({breaks:!0,gfm:!0,headerIds:!1,mangle:!1}),this.loadTraceList()},methods:{async loadTraceList(){this.loading=!0;try{let f=null,a=null;this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2?(this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""&&(f=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10)),this.dateRange[1]!==null&&this.dateRange[1]!==void 0&&this.dateRange[1]!==""&&(a=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(a=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10)));const s=await rn.getTraceList(this.searchQuery,f,a,this.pageNo,this.pageSize),l=Array.isArray(s==null?void 0:s.list)?s.list:[];this.traceList=l,this.filteredTraceList=l,this.total=parseInt((s==null?void 0:s.total)||0,10)}catch(f){console.error("Failed to load trace list:",f),this.$message.error("加载 trace 列表失败"),this.traceList=[],this.filteredTraceList=[],this.total=0}finally{this.loading=!1}},refresh(){this.loadTraceList()},handleRowClick(f){this.viewDetail(f.trace_id)},viewDetail(f){this.currentTraceId=f,this.loadTraceDetail(f),this.drawerVisible=!0},async loadTraceDetail(f){var a,s;try{const[l,h]=await Promise.all([rn.getTraceDetail(f),rn.getTraceSpans(f)]);this.traceInfo=l||{},this.spans=h.map(g=>{let p={};try{if(p=JSON.parse(g.content),p.attributes){const y=p.attributes["langsword.spanInputs"],w=p.attributes["langsword.spanOutputs"];if(y)try{p.inputs=JSON.parse(y)}catch{try{const k=y.replace(/\\"/g,'"').replace(/^"|"$/g,"");p.inputs=JSON.parse(k)}catch{p.inputs=y}}if(w)try{p.outputs=JSON.parse(w)}catch{try{const k=w.replace(/\\"/g,'"').replace(/^"|"$/g,"");p.outputs=JSON.parse(k)}catch{p.outputs=w}}}}catch(y){console.error("Parse content error:",y)}return{...g,parsedContent:p}}),this.filteredSpans=this.spans,this.spans.length>0&&(this.selectedSpanId=this.spans[0].span_id,this.selectedSpan=this.spans[0],(s=(a=this.selectedSpan.parsedContent)==null?void 0:a.inputs)!=null&&s.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((g,p)=>`message-${p}`):this.messageCollapse=[])}catch(l){console.error("Failed to load trace detail:",l),this.$message.error("加载 trace 详情失败"),this.traceInfo={},this.spans=[],this.filteredSpans=[]}},handleSpanSearch(){if(!this.spanSearchQuery){this.filteredSpans=this.spans;return}const f=this.spanSearchQuery.toLowerCase();this.filteredSpans=this.spans.filter(a=>a.name.toLowerCase().includes(f)||a.type.toLowerCase().includes(f))},handleSpanSelect(f){var a,s;this.selectedSpanId=f.span_id,this.selectedSpan=f,this.activeTab="io",(s=(a=this.selectedSpan.parsedContent)==null?void 0:a.inputs)!=null&&s.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((l,h)=>`message-${h}`):this.messageCollapse=[]},handleDrawerClose(f){this.currentTraceId=null,this.traceInfo={},this.spans=[],this.filteredSpans=[],this.selectedSpanId=null,this.selectedSpan=null,this.spanSearchQuery="",f()},handleSearch(){this.pageNo=1,this.loadTraceList()},handleSearchClear(){this.searchQuery="",this.pageNo=1,this.loadTraceList()},handleDateRangeChange(f){this.pageNo=1,f&&Array.isArray(f)?f.length===2&&(f[0]===null||f[0]===void 0)?this.dateRange=[null,f[1]]:this.dateRange=f:this.dateRange=f,this.loadTraceList()},handleSizeChange(f){this.pageSize=f,this.pageNo=1,this.loadTraceList()},handleCurrentChange(f){this.pageNo=f,this.loadTraceList()},async handleBatchDelete(){var h,g;const f=this.searchQuery&&this.searchQuery.trim(),a=this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2&&this.dateRange[1]!==null||this.dateRange.length===1&&this.dateRange[0]!==null);let s="",l="warning";if(!f&&!a)s=this.$t("trace.deleteAllWarning"),l="error";else{if(s=this.$t("trace.deleteConfirmMessage")+`
78
+ `,f&&(s+=`${this.$t("trace.searchCondition")}: ${this.searchQuery}
79
+ `),a){const p=this.$i18n.locale==="zh-CN"?"zh-CN":"en-US";let y="";if(this.dateRange.length===2&&this.dateRange[1]!==null?y=new Date(this.dateRange[1]).toLocaleString(p):this.dateRange.length===1&&this.dateRange[0]!==null&&(y=new Date(this.dateRange[0]).toLocaleString(p)),this.dateRange.length===2&&this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""){const w=new Date(this.dateRange[0]).toLocaleString(p);s+=`${this.$t("trace.timeRange")}: ${w} ${this.$t("trace.to")} ${y}
80
+ `}else this.$i18n.locale==="zh-CN"?s+=`${this.$t("trace.timeRange")}: ${this.$t("trace.before")} ${y} 之前
81
+ `:s+=`${this.$t("trace.timeRange")}: ${this.$t("trace.before")} ${y}
82
+ `}s+=this.$t("trace.deleteConfirmFooter")}try{await this.$confirm(s,this.$t("trace.confirmDelete"),{confirmButtonText:this.$t("trace.confirmDeleteButton"),cancelButtonText:this.$t("common.cancel"),type:l,dangerouslyUseHTMLString:!1}),this.deleteLoading=!0;let p=null,y=null;this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2?(this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""&&(p=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10)),this.dateRange[1]!==null&&this.dateRange[1]!==void 0&&this.dateRange[1]!==""&&(y=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(y=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10))),await rn.deleteTraces(f?this.searchQuery:null,p,y),this.$message.success(this.$t("trace.deleteSuccess")),await this.loadTraceList()}catch(p){if(p!=="cancel"){console.error("Failed to delete traces:",p);const y=((g=(h=p.response)==null?void 0:h.data)==null?void 0:g.message)||p.message||this.$t("trace.unknownError");this.$message.error(`${this.$t("trace.deleteFailed")}: ${y}`)}}finally{this.deleteLoading=!1}},getStatusType(f){return{OK:"success",ERROR:"danger",IN_PROGRESS:"warning",UNSET:"info"}[f]||"info"},formatDateTime(f){if(!f)return"-";const a=typeof f=="string"?parseInt(f,10):f;if(isNaN(a))return"-";const s=new Date(a);if(isNaN(s.getTime()))return"-";const l=s.getFullYear(),h=String(s.getMonth()+1).padStart(2,"0"),g=String(s.getDate()).padStart(2,"0"),p=String(s.getHours()).padStart(2,"0"),y=String(s.getMinutes()).padStart(2,"0"),w=String(s.getSeconds()).padStart(2,"0");return`${l}-${h}-${g} ${p}:${y}:${w}`},formatTimeAgo(f){if(!f)return"-";const a=typeof f=="string"?parseInt(f,10):f;if(isNaN(a))return"-";const l=Date.now()-a,h=this.$i18n.locale==="zh-CN",g=Math.floor(l/(1e3*60*60*24));if(g>0)return h?`${g} 天前`:`${g} days ago`;const p=Math.floor(l/(1e3*60*60));if(p>0)return h?`${p} 小时前`:`${p} hours ago`;const y=Math.floor(l/(1e3*60));return y>0?h?`${y} 分钟前`:`${y} minutes ago`:h?"刚刚":"Just now"},formatTimestamp(f){if(!f)return"-";const a=typeof f=="string"?parseInt(f,10):f;if(isNaN(a))return"-";const s=new Date(a);return isNaN(s.getTime())?"-":s.toLocaleString("zh-CN")},formatDuration(f){return f?f<1e3?`${f}ms`:`${(f/1e3).toFixed(1)}s`:"-"},formatJson(f){return f?JSON.stringify(f,null,2):""},formatRawJson(f){if(!f)return"";if(typeof f=="string")try{const a=JSON.parse(f);return JSON.stringify(a,null,2)}catch{try{const s=f.replace(/\\"/g,'"').replace(/^"|"$/g,""),l=JSON.parse(s);return JSON.stringify(l,null,2)}catch{return f}}return JSON.stringify(f,null,2)},handleCodeMirrorReady(f){this.$nextTick(()=>{f&&f.refresh()})},formatMessageContent(f){return typeof f=="string"?f:JSON.stringify(f,null,2)},formatEventTime(f){if(f.time_unix_nano){const a=f.time_unix_nano/1e6;return new Date(a).toLocaleString("zh-CN")}return f.timestamp?new Date(f.timestamp).toLocaleString("zh-CN"):"-"},getMessageIcon(f){return{user:"el-icon-user",assistant:"el-icon-service",system:"el-icon-setting"}[f]||"el-icon-document"},tableRowClassName({row:f,rowIndex:a}){return"trace-row"},getIndex(f){return(this.pageNo-1)*this.pageSize+f+1},applyColumns(){const f={};this.selectedColumns.forEach(a=>{f[a]=!0}),Object.keys(this.visibleColumns).forEach(a=>{this.selectedColumns.includes(a)||(f[a]=!1)}),this.visibleColumns=f,this.showColumnDialog=!1},renderStructuredContent(f){const a=[];if(!f)return a;try{Array.isArray(f)?f.forEach((s,l)=>{var h;s&&typeof s=="object"?s.type==="text"&&s.text?a.push({type:"markdown",content:ve(s.text),key:`text-${l}`}):s.type==="image_url"&&((h=s.image_url)!=null&&h.url)?a.push({type:"image",url:s.image_url.url,key:`image-${l}`}):a.push({type:"markdown",content:ve("```json\n"+JSON.stringify(s,null,2)+"\n```"),key:`json-${l}`}):a.push({type:"markdown",content:ve(String(s)),key:`text-${l}`})}):typeof f=="string"?a.push({type:"markdown",content:ve(f),key:"text-0"}):typeof f=="object"?a.push({type:"markdown",content:ve("```json\n"+JSON.stringify(f,null,2)+"\n```"),key:"json-0"}):a.push({type:"markdown",content:ve(String(f)),key:"text-0"})}catch(s){console.error("Error rendering content:",s),a.push({type:"markdown",content:ve("Error rendering content"),key:"error-0"})}return a},handleImageClick(f){np({options:this.viewerOptions,images:[f]})}}};var ap=function(){var l,h,g,p,y,w;var a=this,s=a._self._c;return s("div",{staticClass:"trace-list-container"},[s("el-card",[s("div",{staticClass:"trace-content-wrapper"},[s("div",{staticClass:"trace-toolbar"},[s("el-input",{staticClass:"toolbar-input",attrs:{placeholder:a.$t("trace.searchPlaceholder"),"prefix-icon":"el-icon-search",clearable:"",size:"mini"},on:{clear:a.handleSearchClear,input:a.handleSearch},model:{value:a.searchQuery,callback:function(b){a.searchQuery=b},expression:"searchQuery"}}),s("el-date-picker",{staticClass:"toolbar-date-picker",attrs:{type:"datetimerange","range-separator":a.$t("trace.to"),"start-placeholder":a.$t("trace.startTime"),"end-placeholder":a.$t("trace.endTime"),"value-format":"timestamp",format:"yyyy-MM-dd HH:mm:ss",size:"mini","picker-options":a.pickerOptions,clearable:""},on:{change:a.handleDateRangeChange},model:{value:a.dateRange,callback:function(b){a.dateRange=b},expression:"dateRange"}}),s("el-button",{attrs:{type:"danger",icon:"el-icon-delete",size:"mini",disabled:a.deleteLoading},on:{click:a.handleBatchDelete}},[a._v(" "+a._s(a.$t("trace.batchDelete"))+" ")]),s("el-button",{attrs:{icon:"el-icon-refresh",size:"mini",circle:"",title:a.$t("common.refresh")},on:{click:a.refresh}}),s("el-button",{attrs:{icon:"el-icon-setting",size:"mini"},on:{click:function(b){a.showColumnDialog=!0}}},[a._v(" "+a._s(a.$t("common.columns"))+" ")])],1),s("div",{staticClass:"trace-table-wrapper"},[s("el-table",{directives:[{name:"loading",rawName:"v-loading",value:a.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:a.filteredTraceList,size:"mini",stripe:"","row-class-name":a.tableRowClassName},on:{"row-click":a.handleRowClick}},[s("el-table-column",{attrs:{type:"index",label:"#",width:"60",index:a.getIndex}}),a.visibleColumns.trace_id?s("el-table-column",{attrs:{prop:"trace_id",label:a.$t("trace.requestId"),width:"280","show-overflow-tooltip":""},scopedSlots:a._u([{key:"default",fn:function(b){return[s("el-link",{attrs:{type:"primary"},on:{click:function(k){return k.stopPropagation(),a.viewDetail(b.row.trace_id)}}},[a._v(" "+a._s(b.row.trace_id)+" ")])]}}],null,!1,1400187371)}):a._e(),a.visibleColumns.trace_name?s("el-table-column",{attrs:{prop:"trace_name",label:a.$t("trace.traceName"),"min-width":"300","show-overflow-tooltip":""},scopedSlots:a._u([{key:"default",fn:function(b){return[s("span",[a._v(a._s(b.row.trace_name||"-"))])]}}],null,!1,3633653970)}):a._e(),a.visibleColumns.trace_type?s("el-table-column",{attrs:{prop:"trace_type",label:a.$t("trace.traceType"),width:"120"},scopedSlots:a._u([{key:"default",fn:function(b){return[s("el-tag",{attrs:{size:"mini",type:"info"}},[a._v(a._s(b.row.trace_type||"-"))])]}}],null,!1,1175446173)}):a._e(),a.visibleColumns.execution_time_ms?s("el-table-column",{attrs:{prop:"execution_time_ms",label:a.$t("trace.executionTime"),width:"120"},scopedSlots:a._u([{key:"default",fn:function(b){return[a._v(" "+a._s(a.formatDuration(b.row.execution_time_ms))+" ")]}}],null,!1,2586299640)}):a._e(),a.visibleColumns.status?s("el-table-column",{attrs:{prop:"status",label:a.$t("trace.status"),width:"100"},scopedSlots:a._u([{key:"default",fn:function(b){return[s("el-tag",{attrs:{type:a.getStatusType(b.row.status),size:"mini"}},[b.row.status==="OK"?s("i",{staticClass:"el-icon-success"}):a._e(),a._v(" "+a._s(b.row.status)+" ")])]}}],null,!1,3672547022)}):a._e(),a.visibleColumns.timestamp_ms?s("el-table-column",{attrs:{prop:"timestamp_ms",label:a.$t("trace.timeCreated"),width:"180"},scopedSlots:a._u([{key:"default",fn:function(b){return[a._v(" "+a._s(a.formatDateTime(b.row.timestamp_ms))+" ")]}}],null,!1,1082702673)}):a._e(),s("el-table-column",{attrs:{label:a.$t("common.operation"),width:"100",fixed:"right"},scopedSlots:a._u([{key:"default",fn:function(b){return[s("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(k){return k.stopPropagation(),a.viewDetail(b.row.trace_id)}}},[a._v(" "+a._s(a.$t("common.viewDetail"))+" ")])]}}])})],1)],1),s("div",{staticClass:"trace-pagination-wrapper"},[a.total>0?s("el-pagination",{staticClass:"trace-pagination",attrs:{"current-page":a.pageNo,"page-sizes":[10,20,50,100],"page-size":a.pageSize,size:"mini",layout:"total, prev, pager, next, sizes, jumper",total:a.total,background:""},on:{"size-change":a.handleSizeChange,"current-change":a.handleCurrentChange}}):a._e()],1)])]),s("el-dialog",{attrs:{title:a.$t("trace.selectColumns"),visible:a.showColumnDialog,width:"400px"},on:{"update:visible":function(b){a.showColumnDialog=b}}},[s("el-checkbox-group",{model:{value:a.selectedColumns,callback:function(b){a.selectedColumns=b},expression:"selectedColumns"}},[s("el-checkbox",{attrs:{label:"trace_id"}},[a._v(a._s(a.$t("trace.requestId")))]),s("el-checkbox",{attrs:{label:"timestamp_ms"}},[a._v(a._s(a.$t("trace.timeCreated")))]),s("el-checkbox",{attrs:{label:"status"}},[a._v(a._s(a.$t("trace.status")))]),s("el-checkbox",{attrs:{label:"execution_time_ms"}},[a._v(a._s(a.$t("trace.executionTime")))]),s("el-checkbox",{attrs:{label:"trace_type"}},[a._v(a._s(a.$t("trace.traceType")))]),s("el-checkbox",{attrs:{label:"trace_name"}},[a._v(a._s(a.$t("trace.traceName")))])],1),s("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{attrs:{size:"mini"},on:{click:function(b){a.showColumnDialog=!1}}},[a._v(a._s(a.$t("common.cancel")))]),s("el-button",{attrs:{size:"mini",type:"primary"},on:{click:a.applyColumns}},[a._v(a._s(a.$t("common.confirm")))])],1)],1),s("el-drawer",{attrs:{visible:a.drawerVisible,"with-header":!0,title:a.drawerTitle,size:"90%",direction:"rtl","before-close":a.handleDrawerClose},on:{"update:visible":function(b){a.drawerVisible=b}}},[a.currentTraceId?s("div",{staticClass:"trace-detail-content"},[s("div",{staticClass:"trace-info-section"},[s("el-descriptions",{attrs:{column:3,border:""}},[s("el-descriptions-item",{attrs:{label:a.$t("trace.traceId")}},[a._v(a._s(a.traceInfo.trace_id))]),s("el-descriptions-item",{attrs:{label:a.$t("trace.status")}},[s("el-tag",{attrs:{type:a.getStatusType(a.traceInfo.status),size:"mini"}},[a._v(" "+a._s(a.traceInfo.status)+" ")])],1),s("el-descriptions-item",{attrs:{label:a.$t("trace.executionTime")}},[a._v(" "+a._s(a.formatDuration(a.traceInfo.execution_time_ms))+" ")]),s("el-descriptions-item",{attrs:{label:a.$t("trace.timeCreated")}},[a._v(" "+a._s(a.formatTimestamp(a.traceInfo.timestamp_ms))+" ")]),s("el-descriptions-item",{attrs:{label:a.$t("trace.experimentId")}},[a._v(a._s(a.traceInfo.experiment_id))]),s("el-descriptions-item",{attrs:{label:a.$t("trace.traceType")}},[s("el-tag",{attrs:{size:"mini",type:"info"}},[a._v(a._s(a.traceInfo.trace_type||"-"))])],1),s("el-descriptions-item",{attrs:{label:a.$t("trace.traceName"),span:2}},[a._v(" "+a._s(a.traceInfo.trace_name||"-")+" ")])],1)],1),s("el-divider"),s("el-row",{attrs:{gutter:20}},[s("el-col",{staticClass:"span-tree-col",attrs:{span:8}},[s("el-card",[s("div",{attrs:{slot:"header"},slot:"header"},[s("el-input",{attrs:{placeholder:a.$t("span.searchTree"),"prefix-icon":"el-icon-search",size:"small",clearable:""},on:{input:a.handleSpanSearch},model:{value:a.spanSearchQuery,callback:function(b){a.spanSearchQuery=b},expression:"spanSearchQuery"}})],1),s("TraceSpanTree",{attrs:{spans:a.filteredSpans,"selected-span-id":a.selectedSpanId,"trace-start-time":a.traceStartTime,"trace-end-time":a.traceEndTime},on:{"span-select":a.handleSpanSelect}})],1)],1),s("el-col",{staticClass:"span-detail-col",attrs:{span:16}},[s("el-card",[s("div",{attrs:{slot:"header"},slot:"header"},[s("span",[a._v(a._s(a.$t("trace.spanDetail")))])]),a.selectedSpan?s("div",{staticClass:"span-detail-content"},[s("el-tabs",{model:{value:a.activeTab,callback:function(b){a.activeTab=b},expression:"activeTab"}},[s("el-tab-pane",{attrs:{label:`${a.$t("trace.inputs")} / ${a.$t("trace.outputs")}`,name:"io"}},[s("div",{staticClass:"io-content"},[a.hasInputs?s("div",{staticClass:"io-section"},[s("el-collapse",{model:{value:a.activeCollapse,callback:function(b){a.activeCollapse=b},expression:"activeCollapse"}},[s("el-collapse-item",{attrs:{title:a.$t("trace.inputs"),name:"inputs"}},[(h=(l=a.selectedSpan.parsedContent)==null?void 0:l.inputs)!=null&&h.messages?s("div",{staticClass:"messages-section"},a._l(a.selectedSpan.parsedContent.inputs.messages,function(b,k){return s("div",{key:k,staticClass:"message-item"},[s("el-collapse",{model:{value:a.messageCollapse,callback:function(A){a.messageCollapse=A},expression:"messageCollapse"}},[s("el-collapse-item",{attrs:{name:`message-${k}`}},[s("template",{slot:"title"},[s("i",{staticClass:"message-icon",class:a.getMessageIcon(b.role)}),s("span",{staticClass:"message-role"},[a._v(a._s(b.role))])]),s("div",{staticClass:"message-content"},[s("div",{staticClass:"structured-content"},a._l(a.renderStructuredContent(b.content),function(A){return s("div",{key:A.key,staticClass:"content-element"},[A.type==="markdown"?s("div",{staticClass:"markdown-content",domProps:{innerHTML:a._s(A.content)}}):A.type==="image"?s("div",{staticClass:"image-content"},[s("img",{staticClass:"content-image",attrs:{src:A.url,alt:"content image"},on:{click:function(L){return a.handleImageClick(A.url)}}})]):a._e()])}),0)])],2)],1)],1)}),0):(g=a.selectedSpan.parsedContent)!=null&&g.inputs?s("div",{staticClass:"structured-content"},a._l(a.renderStructuredContent(a.selectedSpan.parsedContent.inputs),function(b){return s("div",{key:b.key,staticClass:"content-element"},[b.type==="markdown"?s("div",{staticClass:"markdown-content",domProps:{innerHTML:a._s(b.content)}}):b.type==="image"?s("div",{staticClass:"image-content"},[s("img",{staticClass:"content-image",attrs:{src:b.url,alt:"content image"},on:{click:function(k){return a.handleImageClick(b.url)}}})]):a._e()])}),0):s("div",{staticClass:"empty-content"},[s("el-empty",{attrs:{description:a.$t("trace.noInputs"),"image-size":80}})],1)])],1)],1):a._e(),a.hasOutputs?s("div",{staticClass:"io-section"},[s("el-collapse",{model:{value:a.activeCollapse,callback:function(b){a.activeCollapse=b},expression:"activeCollapse"}},[s("el-collapse-item",{attrs:{title:a.$t("trace.outputs"),name:"outputs"}},[(y=(p=a.selectedSpan.parsedContent)==null?void 0:p.outputs)!=null&&y.choices?s("div",{staticClass:"outputs-section"},a._l(a.selectedSpan.parsedContent.outputs.choices,function(b,k){return s("div",{key:k,staticClass:"choice-item"},[s("div",{staticClass:"choice-header"},[s("span",[a._v("Choice "+a._s(k))])]),s("div",{staticClass:"choice-content"},[b.message?s("div",[s("div",{staticClass:"message-header"},[s("i",{staticClass:"el-icon-user message-icon"}),s("span",[a._v(a._s(b.message.role))])]),s("div",{staticClass:"structured-content"},a._l(a.renderStructuredContent(b.message.content),function(A){return s("div",{key:A.key,staticClass:"content-element"},[A.type==="markdown"?s("div",{staticClass:"markdown-content",domProps:{innerHTML:a._s(A.content)}}):A.type==="image"?s("div",{staticClass:"image-content"},[s("img",{staticClass:"content-image",attrs:{src:A.url,alt:"content image"},on:{click:function(L){return a.handleImageClick(A.url)}}})]):a._e()])}),0)]):s("div",{staticClass:"structured-content"},a._l(a.renderStructuredContent(b),function(A){return s("div",{key:A.key,staticClass:"content-element"},[A.type==="markdown"?s("div",{staticClass:"markdown-content",domProps:{innerHTML:a._s(A.content)}}):A.type==="image"?s("div",{staticClass:"image-content"},[s("img",{staticClass:"content-image",attrs:{src:A.url,alt:"content image"},on:{click:function(L){return a.handleImageClick(A.url)}}})]):a._e()])}),0)])])}),0):(w=a.selectedSpan.parsedContent)!=null&&w.outputs?s("div",{staticClass:"structured-content"},a._l(a.renderStructuredContent(a.selectedSpan.parsedContent.outputs),function(b){return s("div",{key:b.key,staticClass:"content-element"},[b.type==="markdown"?s("div",{staticClass:"markdown-content",domProps:{innerHTML:a._s(b.content)}}):b.type==="image"?s("div",{staticClass:"image-content"},[s("img",{staticClass:"content-image",attrs:{src:b.url,alt:"content image"},on:{click:function(k){return a.handleImageClick(b.url)}}})]):a._e()])}),0):s("div",{staticClass:"empty-content"},[s("el-empty",{attrs:{description:a.$t("trace.noOutputs"),"image-size":80}})],1)])],1)],1):a._e(),!a.hasInputs&&!a.hasOutputs?s("div",{staticClass:"empty-io"},[s("el-empty",{attrs:{description:a.$t("trace.noIoData")}})],1):a._e()])]),s("el-tab-pane",{attrs:{label:a.$t("trace.attributes"),name:"attributes"}},[s("el-table",{attrs:{data:a.attributesData,border:"",stripe:""}},[s("el-table-column",{attrs:{prop:"key",label:a.$t("trace.key"),width:"250"}}),s("el-table-column",{attrs:{prop:"value",label:a.$t("trace.value"),"show-overflow-tooltip":""}})],1)],1),s("el-tab-pane",{attrs:{label:a.$t("trace.rawInputsOutputs"),name:"raw"}},[a.activeTab==="raw"?s("div",{staticClass:"raw-io-content"},[a.rawInputs?s("div",{staticClass:"raw-io-section"},[s("el-collapse",{model:{value:a.rawIoCollapse,callback:function(b){a.rawIoCollapse=b},expression:"rawIoCollapse"}},[s("el-collapse-item",{attrs:{title:a.$t("trace.rawInputs"),name:"rawInputs"}},[s("codemirror",{key:`raw-inputs-${a.selectedSpanId}-${a.rawInputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:a.formatRawJson(a.rawInputs),options:a.cmOptions}})],1)],1)],1):a._e(),a.rawOutputs?s("div",{staticClass:"raw-io-section"},[s("el-collapse",{model:{value:a.rawIoCollapse,callback:function(b){a.rawIoCollapse=b},expression:"rawIoCollapse"}},[s("el-collapse-item",{attrs:{title:a.$t("trace.rawOutputs"),name:"rawOutputs"}},[s("codemirror",{key:`raw-outputs-${a.selectedSpanId}-${a.rawOutputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:a.formatRawJson(a.rawOutputs),options:a.cmOptions}})],1)],1)],1):a._e(),!a.rawInputs&&!a.rawOutputs?s("div",{staticClass:"empty-raw-io"},[s("el-empty",{attrs:{description:a.$t("trace.noIoData")}})],1):a._e()]):a._e()])],1)],1):s("el-empty",{attrs:{description:a.$t("trace.selectSpan")}})],1)],1)],1)],1):a._e()])],1)},sp=[],op=Oo(ip,ap,sp,!1,null,"dfa16925");const as=op.exports,Dl={routes:[{path:"/trace",name:"trace",component:as}],beforeEach:(f,a,s)=>{s()}},Il={common:{home:"首页",todos:"待办事项",trace:"追踪",login:"登录",logout:"退出",user:"用户",search:"搜索",refresh:"刷新",columns:"列设置",confirm:"确定",cancel:"取消",operation:"操作",viewDetail:"查看详情",language:"语言"},span:{searchTree:"Span名称/Span类型"},trace:{title:"追踪列表",searchPlaceholder:"追踪ID/追踪名称/追踪类型",requestId:"追踪ID",timeCreated:"创建时间",status:"状态",executionTime:"执行时长",traceType:"追踪类型",traceName:"追踪名称",traceDetail:"追踪详情",traceId:"追踪ID",clientRequestId:"客户端请求ID",experimentId:"应用ID",spanDetail:"Span 详情",inputs:"输入",outputs:"输出",attributes:"属性",rawInputsOutputs:"原始输入输出",rawInputs:"原始输入",rawOutputs:"原始输出",events:"事件",selectSpan:"请选择一个 Span 查看详情",noInputs:"暂无输入数据",noOutputs:"暂无输出数据",noIoData:"暂无输入输出数据",noEvents:"暂无事件数据",key:"键",value:"值",selectColumns:"选择列",batchDelete:"批量删除",startTime:"开始时间",endTime:"结束时间",to:"至",confirmDelete:"确认删除",confirmDeleteButton:"确定删除",deleteAllWarning:`警告:您没有设置任何查询条件,这将删除所有 trace 数据!
31
83
 
32
84
  此操作不可恢复,请确认是否继续?`,deleteConfirmMessage:"确定要删除符合以下条件的 trace 吗?",searchCondition:"搜索条件",timeRange:"时间范围",before:"在",deleteConfirmFooter:`
33
- 此操作不可恢复,请确认是否继续?`,deleteSuccess:"删除成功",deleteFailed:"删除失败",unknownError:"未知错误"}},Da={common:{home:"Home",todos:"Todos",trace:"Trace",login:"Login",logout:"Logout",user:"User",search:"Search",refresh:"Refresh",columns:"Columns",confirm:"Confirm",cancel:"Cancel",operation:"Operation",viewDetail:"View Detail",language:"Language"},span:{searchTree:"Span Name/Span Type"},trace:{title:"Traces",searchPlaceholder:"Trace ID/Trace Name/Trace Type",requestId:"Trace ID",timeCreated:"Time created",status:"Status",executionTime:"Execution time",traceType:"Trace Type",traceName:"Trace Name",traceDetail:"Trace Detail",traceId:"Trace ID",clientRequestId:"Client Request ID",experimentId:"Application ID",spanDetail:"Span Detail",inputs:"Inputs",outputs:"Outputs",attributes:"Attributes",rawInputsOutputs:"Raw Inputs/Outputs",rawInputs:"Raw Inputs",rawOutputs:"Raw Outputs",events:"Events",selectSpan:"Please select a Span to view details",noInputs:"No input data",noOutputs:"No output data",noIoData:"No input/output data",noEvents:"No event data",key:"Key",value:"Value",selectColumns:"Select Columns",batchDelete:"Batch Delete",startTime:"Start Time",endTime:"End Time",to:"to",confirmDelete:"Confirm Delete",confirmDeleteButton:"Confirm Delete",deleteAllWarning:`Warning: You have not set any query conditions. This will delete all trace data!
85
+ 此操作不可恢复,请确认是否继续?`,deleteSuccess:"删除成功",deleteFailed:"删除失败",unknownError:"未知错误"}},Nl={common:{home:"Home",todos:"Todos",trace:"Trace",login:"Login",logout:"Logout",user:"User",search:"Search",refresh:"Refresh",columns:"Columns",confirm:"Confirm",cancel:"Cancel",operation:"Operation",viewDetail:"View Detail",language:"Language"},span:{searchTree:"Span Name/Span Type"},trace:{title:"Traces",searchPlaceholder:"Trace ID/Trace Name/Trace Type",requestId:"Trace ID",timeCreated:"Time created",status:"Status",executionTime:"Execution time",traceType:"Trace Type",traceName:"Trace Name",traceDetail:"Trace Detail",traceId:"Trace ID",clientRequestId:"Client Request ID",experimentId:"Application ID",spanDetail:"Span Detail",inputs:"Inputs",outputs:"Outputs",attributes:"Attributes",rawInputsOutputs:"Raw Inputs/Outputs",rawInputs:"Raw Inputs",rawOutputs:"Raw Outputs",events:"Events",selectSpan:"Please select a Span to view details",noInputs:"No input data",noOutputs:"No output data",noIoData:"No input/output data",noEvents:"No event data",key:"Key",value:"Value",selectColumns:"Select Columns",batchDelete:"Batch Delete",startTime:"Start Time",endTime:"End Time",to:"to",confirmDelete:"Confirm Delete",confirmDeleteButton:"Confirm Delete",deleteAllWarning:`Warning: You have not set any query conditions. This will delete all trace data!
34
86
 
35
87
  This operation cannot be undone. Are you sure you want to continue?`,deleteConfirmMessage:"Are you sure you want to delete traces matching the following conditions?",searchCondition:"Search Condition",timeRange:"Time Range",before:"before",deleteConfirmFooter:`
36
- This operation cannot be undone. Are you sure you want to continue?`,deleteSuccess:"Delete successful",deleteFailed:"Delete failed",unknownError:"Unknown error"}},tn={"zh-CN":_a,"en-US":Da};let Ci=!1;const Oa=y=>{!y||Ci||(y.mergeLocaleMessage?(Object.keys(tn).forEach(f=>{y.mergeLocaleMessage(f,tn[f])}),Ci=!0):y.messages&&(Object.keys(tn).forEach(f=>{y.messages[f]||(y.messages[f]={}),Object.assign(y.messages[f],tn[f])}),Ci=!0))},Go={store:Sa,router:La,components:{Trace:xi,TraceSpanTree:wi},api:Lr,locales:tn,setI18n(y){Oa(y)},registerLocales:Oa};et.Trace=xi,et.TraceSpanTree=wi,et.default=Go,et.enUS=Da,et.traceApi=Lr,et.traceRouter=La,et.traceStore=Sa,et.zhCN=_a,Object.defineProperties(et,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
88
+ This operation cannot be undone. Are you sure you want to continue?`,deleteSuccess:"Delete successful",deleteFailed:"Delete failed",unknownError:"Unknown error"}},Vn={"zh-CN":Il,"en-US":Nl};let ss=!1;const Ml=f=>{!f||ss||(f.mergeLocaleMessage?(Object.keys(Vn).forEach(a=>{f.mergeLocaleMessage(a,Vn[a])}),ss=!0):f.messages&&(Object.keys(Vn).forEach(a=>{f.messages[a]||(f.messages[a]={}),Object.assign(f.messages[a],Vn[a])}),ss=!0))},lp={store:co,router:Dl,components:{Trace:as,TraceSpanTree:$a},api:rn,locales:Vn,setI18n(f){Ml(f)},registerLocales:Ml};de.Trace=as,de.TraceSpanTree=$a,de.default=lp,de.enUS=Nl,de.traceApi=rn,de.traceRouter=Dl,de.traceStore=co,de.zhCN=Il,Object.defineProperties(de,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});