@langsword/trace 0.0.7 → 0.0.9

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,72 +1,72 @@
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,Rf){"use strict";var ov=Object.defineProperty;var Df=de=>{throw TypeError(de)};var lv=(de,Be,Nt)=>Be in de?ov(de,Be,{enumerable:!0,configurable:!0,writable:!0,value:Nt}):de[Be]=Nt;var Ne=(de,Be,Nt)=>lv(de,typeof Be!="symbol"?Be+"":Be,Nt),uv=(de,Be,Nt)=>Be.has(de)||Df("Cannot "+Nt);var Nf=(de,Be,Nt)=>Be.has(de)?Df("Cannot add the same private member more than once"):Be instanceof WeakSet?Be.add(de):Be.set(de,Nt);var Da=(de,Be,Nt)=>(uv(de,Be,"access private method"),Nt);var Br,ao,Mf;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,c=/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),I=$&&(/Mobile\/\w+/.test(s)||navigator.maxTouchPoints>2),R=/Android/.test(s),q=I||R||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(s),Z=I||/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=c||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 Ge(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 Ve(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()};I?$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 Qe(e.display.wrapper)}function Qe(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 h=e.indexOf(" ",o);if(h<0||h>=t)return u+(t-o);u+=h-o,u+=n-u%n,o=h+1}}var Qt=function(){this.id=null,this.f=null,this.time=0,this.handler=ie(this.onTimeout,this)};Qt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},Qt.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 Vi(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 Qi(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 qe(e){return e.charCodeAt(0)>=768&&fr.test(e)}function xr(e,t,n){for(;(n<0?t>0:t<e.length)&&qe(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]/,h=/[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,G=C;K<O;++K){var V=_[K];V=="1"&&G=="r"?_[K]="n":o.test(V)&&(G=V,V=="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(h.test(_[gt])){yr<gt&&(ft.splice(en,0,new d(1,yr,gt)),en+=tn);var Hn=gt;for(++gt;gt<it&&h.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=`
1
+ (function(ke,Qe){typeof exports=="object"&&typeof module<"u"?Qe(exports,require("pinia"),require("axios"),require("vue")):typeof define=="function"&&define.amd?define(["exports","pinia","axios","vue"],Qe):(ke=typeof globalThis<"u"?globalThis:ke||self,Qe(ke.LangswordTrace={},ke.Pinia,ke.axios,ke.Vue))})(this,function(ke,Qe,$t,Rf){"use strict";var ov=Object.defineProperty;var Df=ke=>{throw TypeError(ke)};var lv=(ke,Qe,$t)=>Qe in ke?ov(ke,Qe,{enumerable:!0,configurable:!0,writable:!0,value:$t}):ke[Qe]=$t;var qe=(ke,Qe,$t)=>lv(ke,typeof Qe!="symbol"?Qe+"":Qe,$t),uv=(ke,Qe,$t)=>Qe.has(ke)||Df("Cannot "+$t);var Nf=(ke,Qe,$t)=>Qe.has(ke)?Df("Cannot add the same private member more than once"):Qe instanceof WeakSet?Qe.add(ke):Qe.set(ke,$t);var Ma=(ke,Qe,$t)=>(uv(ke,Qe,"access private method"),$t);var Kr,ao,Mf;var so=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ra={exports:{}},oo;function vr(){return oo||(oo=1,function(f,i){(function(s,l){f.exports=l()})(so,function(){var s=navigator.userAgent,l=navigator.platform,c=/gecko\/\d/i.test(s),g=/MSIE \d/.test(s),p=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(s),w=/Edge\/(\d+)/.exec(s),b=g||p||w,y=b&&(g?document.documentMode||6:+(w||p)[1]),k=!w&&/WebKit\//.test(s),L=k&&/Qt\/\d+\.\d+/.test(s),_=!w&&/Chrome\/(\d+)/.exec(s),H=_&&+_[1],F=/Opera\//.test(s),U=/Apple Computer/.test(navigator.vendor),M=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(s),A=/PhantomJS/.test(s),D=U&&(/Mobile\/\w+/.test(s)||navigator.maxTouchPoints>2),P=/Android/.test(s),G=D||P||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(s),J=D||/Mac/.test(l),ne=/\bCrOS\b/.test(s),te=/win/i.test(l),fe=F&&s.match(/Version\/(\d*\.\d*)/);fe&&(fe=Number(fe[1])),fe&&fe>=15&&(F=!1,k=!0);var Me=J&&(L||F&&(fe==null||fe<12.11)),Ee=c||b&&y>=9;function Oe(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var Re=function(e,t){var n=e.className,r=Oe(t).exec(n);if(r){var a=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(a?r[1]+a:"")}};function $(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function V(e,t){return $(e).appendChild(t)}function T(e,t,n,r){var a=document.createElement(e);if(n&&(a.className=n),r&&(a.style.cssText=r),typeof t=="string")a.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)a.appendChild(t[o]);return a}function rt(e,t,n,r){var a=T(e,t,n,r);return a.setAttribute("role","presentation"),a}var st;document.createRange?st=function(e,t,n,r){var a=document.createRange();return a.setEnd(r||e,n),a.setStart(e,t),a}: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 I(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 N(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 K(e,t){var n=e.className;Oe(t).test(n)||(e.className+=(n?" ":"")+t)}function se(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!Oe(n[r]).test(t)&&(t+=" "+n[r]);return t}var Fe=function(e){e.select()};D?Fe=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:b&&(Fe=function(e){try{e.select()}catch{}});function ze(e){return e.display.wrapper.ownerDocument}function wt(e){return nt(e.display.wrapper)}function nt(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function pe(e){return ze(e).defaultView}function he(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function be(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 Ce(e,t,n,r,a){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var o=r||0,u=a||0;;){var h=e.indexOf(" ",o);if(h<0||h>=t)return u+(t-o);u+=h-o,u+=n-u%n,o=h+1}}var jt=function(){this.id=null,this.f=null,this.time=0,this.handler=he(this.onTimeout,this)};jt.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},jt.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 ye(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var pt=50,Qt={toString:function(){return"CodeMirror.Pass"}},St={scroll:!1},qt={origin:"*mouse"},Ct={origin:"+move"};function Ft(e,t,n){for(var r=0,a=0;;){var o=e.indexOf(" ",r);o==-1&&(o=e.length);var u=o-r;if(o==e.length||a+u>=t)return r+Math.min(u,t-a);if(a+=o-r,a+=n-a%n,r=o+1,a>=t)return r}}var Kt=[""];function Lr(e){for(;Kt.length<=e;)Kt.push(de(Kt)+" ");return Kt[e]}function de(e){return e[e.length-1]}function Jt(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function mn(e,t,n){for(var r=0,a=n(t);r<e.length&&n(e[r])<=a;)r++;e.splice(r,0,t)}function yn(){}function Gr(e,t){var n;return Object.create?n=Object.create(e):(yn.prototype=e,n=new yn),t&&be(t,n),n}var bn=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ue(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||bn.test(e))}function ce(e,t){return t?t.source.indexOf("\\w")>-1&&ue(e)?!0:t.test(e):ue(e)}function ie(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Te=/[\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 we(e){return e.charCodeAt(0)>=768&&Te.test(e)}function Dt(e,t,n){for(;(n<0?t>0:t<e.length)&&we(e.charAt(t));)t+=n;return t}function Gt(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var a=(t+n)/2,o=r<0?Math.ceil(a):Math.floor(a);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function _r(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var a=!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),a=!0)}a||r(t,n,"ltr")}var Xr=null;function Er(e,t,n){var r;Xr=null;for(var a=0;a<e.length;++a){var o=e[a];if(o.from<t&&o.to>t)return a;o.to==t&&(o.from!=o.to&&n=="before"?r=a:Xr=a),o.from==t&&(o.from!=o.to&&n!="before"?r=a:Xr=a)}return r??Xr}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]/,a=/[stwN]/,o=/[LRr]/,u=/[Lb1n]/,h=/[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,E=[],z=0;z<O;++z)E.push(n(v.charCodeAt(z)));for(var B=0,q=C;B<O;++B){var X=E[B];X=="m"?E[B]=q:q=X}for(var Q=0,Y=C;Q<O;++Q){var ee=E[Q];ee=="1"&&Y=="r"?E[Q]="n":o.test(ee)&&(Y=ee,ee=="r"&&(E[Q]="R"))}for(var le=1,ae=E[0];le<O-1;++le){var xe=E[le];xe=="+"&&ae=="1"&&E[le+1]=="1"?E[le]="1":xe==","&&ae==E[le+1]&&(ae=="1"||ae=="n")&&(E[le]=ae),ae=xe}for(var We=0;We<O;++We){var ht=E[We];if(ht==",")E[We]="N";else if(ht=="%"){var Ke=void 0;for(Ke=We+1;Ke<O&&E[Ke]=="%";++Ke);for(var Rt=We&&E[We-1]=="!"||Ke<O&&E[Ke]=="1"?"1":"N",Ot=We;Ot<Ke;++Ot)E[Ot]=Rt;We=Ke-1}}for(var it=0,At=C;it<O;++it){var gt=E[it];At=="L"&&gt=="1"?E[it]="L":o.test(gt)&&(At=gt)}for(var ot=0;ot<O;++ot)if(a.test(E[ot])){var at=void 0;for(at=ot+1;at<O&&a.test(E[at]);++at);for(var Ze=(ot?E[ot-1]:C)=="L",It=(at<O?E[at]:C)=="L",qn=Ze==It?Ze?"L":"R":C,$r=ot;$r<at;++$r)E[$r]=qn;ot=at-1}for(var bt=[],gr,dt=0;dt<O;)if(u.test(E[dt])){var no=dt;for(++dt;dt<O&&u.test(E[dt]);++dt);bt.push(new d(0,no,dt))}else{var Tr=dt,an=bt.length,sn=x=="rtl"?1:0;for(++dt;dt<O&&E[dt]!="L";++dt);for(var kt=Tr;kt<dt;)if(h.test(E[kt])){Tr<kt&&(bt.splice(an,0,new d(1,Tr,kt)),an+=sn);var Kn=kt;for(++kt;kt<dt&&h.test(E[kt]);++kt);bt.splice(an,0,new d(2,Kn,kt)),an+=sn,Tr=kt}else++kt;Tr<dt&&bt.splice(an,0,new d(1,Tr,dt))}return x=="ltr"&&(bt[0].level==1&&(gr=v.match(/^\s+/))&&(bt[0].from=gr[0].length,bt.unshift(new d(0,0,gr[0].length))),de(bt).level==1&&(gr=v.match(/\s+$/))&&(de(bt).to-=gr[0].length,bt.push(new d(0,O-gr[0].length,O)))),x=="rtl"?bt.reverse():bt}}();function Le(e,t){var n=e.order;return n==null&&(n=e.order=us(e.text,t)),n}var ta=[],oe=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]||ta).concat(n)}};function yr(e,t){return e._handlers&&e._handlers[t]||ta}function vt(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,a=r&&r[t];if(a){var o=ye(a,n);o>-1&&(r[t]=a.slice(0,o).concat(a.slice(o+1)))}}}function Xe(e,t){var n=yr(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),a=0;a<n.length;++a)n[a].apply(null,r)}function Ye(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Xe(e,n||t.type,e,t),Tt(t)||t.codemirrorIgnore}function Xt(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)ye(n,t[r])==-1&&n.push(t[r])}function Nt(e,t){return yr(e,t).length>0}function er(e){e.prototype.on=function(t,n){oe(this,t,n)},e.prototype.off=function(t,n){vt(this,t,n)}}function mt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function wn(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Tt(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Or(e){mt(e),wn(e)}function si(e){return e.target||e.srcElement}function tr(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),J&&e.ctrlKey&&t==1&&(t=3),t}var fs=function(){if(b&&y<9)return!1;var e=T("div");return"draggable"in e||"dragDrop"in e}(),xn;function ra(e){if(xn==null){var t=T("span","​");V(e,T("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(xn=t.offsetWidth<=1&&t.offsetHeight>2&&!(b&&y<8))}var n=xn?T("span","​"):T("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var oi;function Ar(e){if(oi!=null)return oi;var t=V(e,document.createTextNode("AخA")),n=st(t,0,1).getBoundingClientRect(),r=st(t,1,2).getBoundingClientRect();return $(e),!n||n.left==n.right?!1:oi=r.right-n.right<3}var Yt=`
2
2
 
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 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 Gt(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),gn[e]=t}function Gr(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=Vi(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 Q(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 It(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 h=e.lines[u],d=h.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 D(e,t,n){if(n===void 0&&(n=null),!(this instanceof D))return new D(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 D(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 Dl(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 D(e.first,0);var n=e.first+e.size-1;return t.line>n?D(n,Q(e,n).text.length):lp(t,Q(e,t.line).text.length)}function lp(e,t){var n=e.ch;return n==null||n>t?D(e.line,t):n<0?D(e.line,0):e}function Nl(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 Ml(e,t,n,r){var i=[e.state.modeGen],o={};Wl(e,t.text,e.doc.mode,n,function(v,x){return i.push(v,x)},o,r);for(var u=n.state,h=function(v){n.baseTokens=i;var x=e.state.overlays[v],C=1,O=0;n.state=!0,Wl(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)h(d);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Rl(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=Ml(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=up(e,t,n),u=o>r.first&&Q(r,o-1).stateAfter,h=u?nr.fromSaved(r,u,o):new nr(r,bn(r.mode),o);return r.iter(o,t,function(d){hs(e,d.text,h);var v=h.line;d.stateAfter=v==t-1||v%5==0||v>=i.viewFrom&&v<i.viewTo?h.save():null,h.nextLine()}),n&&(r.modeFrontier=h.line),h}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==""&&zl(i,n.state);!o.eol();)ds(i,o,n.state),o.start=o.pos}function zl(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 Pl=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Fl(e,t,n,r){var i=e.doc,o=i.mode,u;t=ae(i,t);var h=Q(i,t.line),d=ai(e,t.line,n),v=new He(h.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 Pl(v,u,rr(i.mode,d.state)));return r?x:new Pl(v,u,d.state)}function Hl(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 Wl(e,t,n,r,i,o,u){var h=n.flattenSpans;h==null&&(h=e.options.flattenSpans);var d=0,v=null,x=new He(t,e.options.tabSize,r),C,O=e.options.addModeClass&&[null];for(t==""&&Hl(zl(n,r.state),o);!x.eol();){if(x.pos>e.options.maxHighlightLength?(h=!1,u&&hs(e,t,r,x.pos),x.pos=t.length,C=null):C=Hl(ds(n,x,r.state,O),o),O){var _=O[0].name;_&&(C="m-"+(C?_+" "+C:_))}if(!h||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 up(e,t,n){for(var r,i,o=e.doc,u=n?-1:t-(e.doc.mode.innerMode?1e3:100),h=t;h>u;--h){if(h<=o.first)return o.first;var d=Q(o,h-1),v=d.stateAfter;if(v&&(!n||h+(v instanceof ra?v.lookAhead:0)<=o.modeFrontier))return h;var x=xe(d.text,null,e.options.tabSize);(i==null||r>x)&&(i=h-1,r=x)}return i}function fp(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=Q(e,r).stateAfter;if(i&&(!(i instanceof ra)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}var Bl=!1,dr=!1;function cp(){Bl=!0}function hp(){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 dp(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function pp(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 gp(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],u=o.marker,h=o.from==null||(u.inclusiveLeft?o.from<=t:o.from<t);if(h||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 vp(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],u=o.marker,h=o.to==null||(u.inclusiveRight?o.to>=t:o.to>t);if(h||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)&&Q(e,t.from.line).markedSpans,r=z(e,t.to.line)&&Q(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,h=gp(n,i,u),d=vp(r,o,u),v=t.text.length==1,x=me(t.text).length+(v?i:0);if(h)for(var C=0;C<h.length;++C){var O=h[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(h,F.marker);U||(F.from=x,v&&(h||(h=[])).push(F))}else F.from+=x,v&&(h||(h=[])).push(F)}h&&(h=$l(h)),d&&d!=h&&(d=$l(d));var j=[h];if(!v){var K=t.text.length-2,G;if(K>0&&h)for(var V=0;V<h.length;++V)h[V].to==null&&(G||(G=[])).push(new na(h[V].marker,null,null));for(var re=0;re<K;++re)j.push(G);j.push(d)}return j}function $l(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 mp(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],h=u.find(0),d=0;d<i.length;++d){var v=i[d];if(!(X(v.to,h.from)<0||X(v.from,h.to)>0)){var x=[d,1],C=X(v.from,h.from),O=X(v.to,h.to);(C<0||!u.inclusiveLeft&&!C)&&x.push({from:v.from,to:h.from}),(O>0||!u.inclusiveRight&&!O)&&x.push({from:h.to,to:v.to}),i.splice.apply(i,x),d+=x.length-3}}return i}function Ul(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function jl(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 Gl(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 ql(e){return Gl(e,!0)}function sa(e){return Gl(e,!1)}function yp(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 Xl(e,t,n,r,i){var o=Q(e,t),u=dr&&o.markedSpans;if(u)for(var h=0;h<u.length;++h){var d=u[h];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 qt(e){for(var t;t=ql(e);)e=t.find(-1,!0).line;return e}function bp(e){for(var t;t=sa(e);)e=t.find(1,!0).line;return e}function wp(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=Q(e,t),r=qt(n);return n==r?t:m(r)}function Kl(e,t){if(t>e.lastLine())return t;var n=Q(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=qt(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 h=o.children[u];if(h==n)break;t+=h.height}return t}function oa(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=ql(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=Q(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,jl(this,t),this.height=n?n(this):1};xn.prototype.lineNo=function(){return m(this)},Bt(xn);function xp(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Ul(e),jl(e,n);var i=r?r(e):1;i!=e.height&&It(e,i)}function kp(e){e.parent=null,Ul(e)}var Sp={},Cp={};function Yl(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Cp:Sp;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Zl(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=Lp,Tr(e.display.measure)&&(u=ge(o,e.doc.direction))&&(r.addToken=Ap(r.addToken,u)),r.map=[];var h=t!=e.display.externalMeasured&&m(o);Op(o,r,Rl(e,o,h)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=Ve(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=Ve(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=Ve(r.pre.className,r.textClass||"")),r}function Tp(e){var t=T("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Lp(e,t,n,r,i,o,u){if(t){var h=e.splitSpaces?_p(t,e.trailingSpace):t,d=e.cm.state.specialChars,v=!1,x;if(!d.test(t))e.col+=t.length,x=document.createTextNode(h),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(h.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=h.charCodeAt(t.length-1)==32,n||r||i||v||o||u){var K=n||"";r&&(K+=r),i&&(K+=i);var G=T("span",[x],K,o);if(u)for(var V in u)u.hasOwnProperty(V)&&V!="style"&&V!="class"&&G.setAttribute(V,u[V]);return e.content.appendChild(G)}e.content.appendChild(x)}}function _p(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 Ap(e,t){return function(n,r,i,o,u,h,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,h,d);e(n,r.slice(0,C.to-v),i,o,null,h,d),o=null,r=r.slice(C.to-v),v=C.to}}}function Vl(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 Op(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]),Yl(n[u+1],t.cm.options));return}for(var h=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 G=[],V=void 0,re=0;re<r.length;++re){var J=r[re],ce=J.marker;if(ce.type=="bookmark"&&J.from==d&&ce.widgetNode)G.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==_&&(V||(V=[])).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(V)for(var nt=0;nt<V.length;nt+=2)V[nt+1]==_&&(F+=" "+V[nt]);if(!j||j.from==d)for(var Me=0;Me<G.length;++Me)Vl(t,0,G[Me]);if(j&&(j.from||0)==d){if(Vl(t,(j.to==null?h+1:j.to)-d,j.marker,j.from==null),j.to==null)return;j.to==d&&(j=!1)}}if(d>=h)break;for(var Tt=Math.min(h,_);;){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=Yl(n[v++],t.cm.options)}}}function Ql(e,t,n){this.line=t,this.rest=wp(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 Ql(e.doc,Q(e.doc,o),o);i=o+u.size,r.push(u)}return r}var kn=null;function Ep(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 Dp(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(Np,0));for(var o=function(h){i.push(function(){return n[h].apply(null,r)})},u=0;u<n.length;++u)o(u)}}function Np(){var e=oi;oi=null;for(var t=0;t<e.length;++t)e[t]()}function Jl(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];o=="text"?Rp(e,t):o=="gutter"?tu(e,t,n,r):o=="class"?bs(e,t):o=="widget"&&zp(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 Mp(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 eu(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Zl(e,t)}function Rp(e,t){var n=t.text.className,r=eu(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){Mp(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 tu(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),h=t.gutter=T("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(h.setAttribute("aria-hidden","true"),e.display.input.setUneditable(h),u.insertBefore(h,t.text),t.line.gutterClass&&(h.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!o||!o["CodeMirror-linenumbers"])&&(t.lineNumber=h.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&&h.appendChild(T("div",[x],"CodeMirror-gutter-elt","left: "+r.gutterLeft[v]+"px; width: "+r.gutterWidth[v]+"px"))}}}function zp(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);ru(e,t,n)}function Pp(e,t,n,r){var i=eu(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),bs(e,t),tu(e,t,n,r),ru(e,t,r),t.node}function ru(e,t,n){if(nu(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)nu(e,t.rest[r],t,n,!1)}function nu(e,t,n,r,i){if(t.widgets)for(var o=li(n),u=0,h=t.widgets;u<h.length;++u){var d=h[u],v=T("div",[d.node],"CodeMirror-linewidget"+(d.className?" "+d.className:""));d.handleMouseEvents||v.setAttribute("cm-ignore-events","true"),Fp(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 Fp(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 iu(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 qr(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 Hp(e,t,n){var r=e.options.lineWrapping,i=r&&qr(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(),h=0;h<u.length-1;h++){var d=u[h],v=u[h+1];Math.abs(d.bottom-v.bottom)>2&&o.push((d.bottom+v.top)/2-n.top)}}o.push(n.bottom-n.top)}}function au(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 Wp(e,t){t=qt(t);var n=m(t),r=e.display.externalMeasured=new Ql(e.doc,t,n);r.lineN=n;var i=r.built=Zl(e,r);return r.text=i.pre,Y(e.display.lineMeasure,i.pre),r}function su(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&&(Jl(e,r,n,_s(e)),e.curOp.forceUpdate=!0),r||(r=Wp(e,t));var i=au(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||(Hp(e,t.view,t.rect),t.hasHeights=!0),u=$p(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 ou={left:0,right:0,top:0,bottom:0};function lu(e,t,n){for(var r,i,o,u,h,d,v=0;v<e.length;v+=3)if(h=e[v],d=e[v+1],t<h?(i=0,o=1,u="left"):t<d?(i=t-h,o=i+1):(v==e.length-3||t==d&&e[v+3]>t)&&(o=d-h,i=o-1,t>=d&&(u="right")),i!=null){if(r=e[v+2],h==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-h)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:h,coverEnd:d}}function Bp(e,t){var n=ou;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 $p(e,t,n,r){var i=lu(t.map,n,r),o=i.node,u=i.start,h=i.end,d=i.collapse,v;if(o.nodeType==3){for(var x=0;x<4;x++){for(;u&&qe(t.line.text.charAt(i.coverStart+u));)--u;for(;i.coverStart+h<i.coverEnd&&qe(t.line.text.charAt(i.coverStart+h));)++h;if(w&&b<9&&u==0&&h==i.coverEnd-i.coverStart?v=o.parentNode.getBoundingClientRect():v=Bp(st(o,u,h).getClientRects(),r),v.left||v.right||u==0)break;h=u,u=u-1,d="right"}w&&b<11&&(v=Up(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=ou}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,G=U[j],V={left:(d=="right"?v.right:v.left)-t.rect.left,right:(d=="left"?v.left:v.right)-t.rect.left,top:K,bottom:G};return!v.left&&!v.right&&(V.bogus=!0),e.options.singleCursorHeightPerLine||(V.rtop=_,V.rbottom=M),V}function Up(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 uu(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 fu(e){e.display.externalMeasure=null,W(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)uu(e.display.view[t])}function fi(e){fu(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function cu(e){return L&&R?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function hu(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=qt(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 h=e.display.lineSpace.getBoundingClientRect();u+=h.top+(r=="window"?0:hu(At(e)));var d=h.left+(r=="window"?0:cu(At(e)));n.left+=d,n.right+=d}return n.top+=u,n.bottom+=u,n}function du(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=cu(At(e)),i-=hu(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=Q(e.doc,t.line)),fa(e,r,su(e,r,t.ch,i),n)}function Xt(e,t,n,r,i,o){r=r||Q(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 h=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"),!h)return u(v=="before"?d-1:d,v=="before");function x(M,F,U){var j=h[F],K=j.level==1;return u(U?M-1:M,K!=U)}var C=Sr(h,d,v),O=jr,_=x(d,C,v=="before");return O!=null&&(_.other=x(d,O,v!="before")),_}function pu(e,t){var n=0;t=ae(e.doc,t),e.options.lineWrapping||(n=Tn(e.display)*t.ch);var r=Q(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=D(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,Q(r,o).text.length,null,1,1);t<0&&(t=0);for(var u=Q(r,i);;){var h=jp(e,u,i,t,n),d=yp(u,h.ch+(h.xRel>0||h.outside>0?1:0));if(!d)return h;var v=d.find(1);if(v.line==i)return v;u=Q(r,i=v.line)}}function gu(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 vu(e,t,n,r){n||(n=Sn(e,t));var i=fa(e,t,ar(e,n,r),"line").top;return gu(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 jp(e,t,n,r,i){i-=pr(t);var o=Sn(e,t),u=Ss(t),h=0,d=t.text.length,v=!0,x=ge(t,e.doc.direction);if(x){var C=(e.options.lineWrapping?qp:Gp)(e,t,n,o,x,r,i);v=C.level!=1,h=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},h,d),F,U,j=!1;if(_){var K=r-_.left<_.right-r,G=K==v;M=O+(G?0:1),U=G?"after":"before",F=K?_.left:_.right}else{!v&&(M==d||M==h)&&M++,U=M==0?"after":M==t.text.length?"before":ar(e,o,M-(v?1:0)).bottom+u<=i==v?"after":"before";var V=Xt(e,D(n,M,U),"line",t,o);F=V.left,j=i<V.top?-1:i>=V.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 h=tr(function(C){var O=i[C],_=O.level!=1;return Ls(Xt(e,D(n,_?O.to:O.from,_?"before":"after"),"line",t,r),o,u,!0)},0,i.length-1),d=i[h];if(h>0){var v=d.level!=1,x=Xt(e,D(n,v?d.from:d.to,v?"after":"before"),"line",t,r);Ls(x,o,u,!0)&&x.top>u&&(d=i[h-1])}return d}function qp(e,t,n,r,i,o,u){var h=gu(e,t,r,u),d=h.begin,v=h.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 h=e.display.gutterSpecs[u].className;n[h]=o.offsetLeft+o.clientLeft+i,r[h]=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 mu(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=mu(e);t.iter(function(r){var i=n(r);i!=r.height&&It(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,h=i.lineSpace.getBoundingClientRect();try{o=t.clientX-h.left,u=t.clientY-h.top}catch{return null}var d=Ts(e,o,u),v;if(r&&d.xRel>0&&(v=Q(e.doc,d.line).text).length==d.ch){var x=xe(v,v.length,e.options.tabSize)-v.length;d=D(d.line,Math.max(0,Math.round((o-iu(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&&Kl(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 h=ha(e,t,t,-1),d=ha(e,n,n+r,1);h&&d?(i.view=i.view.slice(0,h.index).concat(la(e,h.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 h=e.display.viewFrom,d=0;d<i;d++)h+=u[d].size;if(h!=t){if(r>0){if(i==u.length-1)return null;o=h+u[i].size-t,i++}else o=h-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 Xp(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 yu(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 bu(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 h=0;h<n.sel.ranges.length;h++)if(!(!t&&h==n.sel.primIndex)){var d=n.sel.ranges[h];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||Kp(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 h=n.appendChild(T("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));h.style.display="",h.style.left=r.other.left+"px",h.style.top=r.other.top+"px",h.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function da(e,t){return e.top-t.top||e.left-t.left}function Kp(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),u=iu(e.display),h=u.left,d=Math.max(r.sizerWidth,qr(e)-r.sizer.offsetLeft)-u.right,v=i.direction=="ltr";function x(G,V,re,J){V<0&&(V=0),V=Math.round(V),J=Math.round(J),o.appendChild(T("div",null,"CodeMirror-selected","position: absolute; left: "+G+`px;
6
- top: `+V+"px; width: "+(re??d-G)+`px;
7
- height: `+(J-V)+"px"))}function C(G,V,re){var J=Q(i,G),ce=J.text.length,Le,nt;function Me(Xe,xt){return ca(e,D(G,Xe),"div",J,xt)}function Tt(Xe,xt,at){var Ye=vu(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,V||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=V==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?h:(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?h:We.left,gt=v?d:Tt(Xe,at,"before"),Hn=v?h:Tt(xt,at,"after"),io=v&&zr&&sr?d:kt.right):(tn=v?Tt(Xe,at,"before"):h,gt=!v&&Fn&&ft?d:We.right,Hn=!v&&zr&&sr?h:kt.left,io=v?Tt(xt,at,"after"):d),x(tn,We.top,gt-tn,We.bottom),We.bottom<kt.top&&x(h,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=Q(i,O.line),F=Q(i,_.line),U=qt(M)==qt(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(h,K.top,K.left,K.bottom)):x(j.right,j.top,K.left-j.right,j.bottom)),j.bottom<K.top&&x(h,j.bottom,null,K.top)}n.appendChild(o)}function Is(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 wu(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ns(e))}function Ds(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()),Is(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 h=t.view[u],d=e.options.lineWrapping,v=void 0,x=0;if(!h.hidden){if(i+=h.line.height,w&&b<8){var C=h.node.offsetTop+h.node.offsetHeight;v=C-n,n=C}else{var O=h.node.getBoundingClientRect();v=O.bottom-O.top,!d&&h.text.firstChild&&(x=h.text.firstChild.getBoundingClientRect().right-O.left-1)}var _=h.line.height-v;if((_>.005||_<-.005)&&(i<r&&(o-=_),It(h.line,v),xu(h.line),h.rest))for(var M=0;M<h.rest.length;M++)xu(h.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=h.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function xu(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 h=n.ensure.from.line,d=n.ensure.to.line;h<o?(o=h,u=S(t,pr(Q(t,h))+e.wrapper.clientHeight)):Math.min(d,t.lastLine())>=u&&(o=S(t,pr(Q(t,d))-e.wrapper.clientHeight),u=d)}return{from:o,to:Math.max(u,o+1)}}function Yp(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 Zp(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?D(t.line,t.ch+1,"before"):t,t=t.ch?D(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var u=!1,h=Xt(e,t),d=!n||n==t?h:Xt(e,n);i={left:Math.min(h.left,d.left),top:Math.min(h.top,d.top)-r,right:Math.max(h.left,d.left),bottom:Math.max(h.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 h=e.doc.height+ws(n),d=t.top<r,v=t.bottom>h-r;if(t.top<i)u.scrollTop=d?0:t.top;else if(t.bottom>i+o){var x=Math.min(t.top,(v?h: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,_=qr(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 Qp(e,t){va(e),e.curOp.scrollToPos=t}function va(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=pu(e,t.from),r=pu(e,t.to);ku(e,n,r,t.margin)}}function ku(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||(c||Ps(e,{top:t}),Su(e,t,!0),c&&Ps(e),vi(e,100))}function Su(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,Au(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 Vr=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")};Vr.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}},Vr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Vr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Vr.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 Qt,this.disableVert=new Qt},Vr.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)},Vr.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;Cu(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),Cu(e,pi(e)),n=e.display.barWidth,r=e.display.barHeight}function Cu(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 Tu={native:Vr,null:gi};function Lu(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&ct(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Tu[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 Jp=0;function Qr(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:++Jp,markArrays:null},Ep(e.curOp)}function Jr(e){var t=e.curOp;t&&Dp(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;eg(n)})}function eg(e){for(var t=e.ops,n=0;n<t.length;n++)tg(t[n]);for(var r=0;r<t.length;r++)rg(t[r]);for(var i=0;i<t.length;i++)ng(t[i]);for(var o=0;o<t.length;o++)ig(t[o]);for(var u=0;u<t.length;u++)ag(t[u])}function tg(e){var t=e.cm,n=t.display;og(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 rg(e){e.updatedDisplay=e.mustUpdate&&zs(e.cm,e.update)}function ng(e){var t=e.cm,n=t.display;e.updatedDisplay&&pa(t),e.barMeasure=pi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=su(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-qr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function ig(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==Ge(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&&Is(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&wu(e.cm)}function ag(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&_u(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&Su(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Zr(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Zp(t,ae(r,e.scrollToPos.from),ae(r,e.scrollToPos.to),e.scrollToPos.margin);Yp(t,i)}var o=e.maybeHiddenMarkers,u=e.maybeUnhiddenMarkers;if(o)for(var h=0;h<o.length;++h)o[h].lines.length||Pe(o[h],"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();Qr(e);try{return t()}finally{Jr(e)}}function tt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Qr(e);try{return t.apply(e,arguments)}finally{Jr(e)}}}function pt(e){return function(){if(this.curOp)return e.apply(this,arguments);Qr(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);Qr(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(sg,e))}function sg(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,h=o.text.length>e.options.maxHighlightLength?rr(t.mode,r.state):null,d=Ml(e,o,r,!0);h&&(r.state=h),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=qr(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 og(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 lg(e){if(e.hasFocus())return null;var t=Ge(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 ug(e){if(!(!e||!e.activeElt||e.activeElt==Ge(Qe(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&&yu(e)==0)return!1;Ou(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=Kl(e.doc,u));var h=o!=n.viewFrom||u!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Xp(e,o,u),n.viewOffset=pr(Q(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var d=yu(e);if(!h&&d==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var v=lg(e);return d>4&&(n.lineDiv.style.display="none"),fg(e,n.updateLineNumbers,t.dims),d>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ug(v),W(n.cursorDiv),W(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,h&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,vi(e,400)),n.updateLineNumbers=null,!0}function _u(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==qr(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),_u(e,n);var r=pi(e);ci(e),An(e,r),Hs(e,r),n.finish()}}function fg(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,u=o.firstChild;function h(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=Pp(e,C,v,n);o.insertBefore(O,u)}else{for(;u!=C.node;)u=h(u);var _=i&&t!=null&&t<=v&&C.lineNumber;C.changes&&(fe(C.changes,"gutter")>-1&&(_=!1),Jl(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=h(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 Au(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 h=n[u].alignable;if(h)for(var d=0;d<h.length;d++)h[d].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function Ou(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 Eu(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,h=t.appendChild(T("div",null,"CodeMirror-gutter "+o));u&&(h.style.cssText=u),o=="CodeMirror-linenumbers"&&(e.lineGutter=h,h.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Fs(e)}function mi(e){Eu(e.display),yt(e),Au(e)}function cg(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&&!(c&&q)&&(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),Eu(i),n.init(i)}var ya=0,vr=null;w?vr=-.53:c?vr=15:L?vr=-.7:$&&(vr=-1/3);function Iu(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 hg(e){var t=Iu(e);return t.x*=vr,t.y*=vr,t}function Du(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=Iu(t),r=n.x,i=n.y,o=vr;t.deltaMode===0&&(r=t.deltaX,i=t.deltaY,o=1);var u=e.display,h=u.scroller,d=h.scrollWidth>h.clientWidth,v=h.scrollHeight>h.clientHeight;if(r&&d||i&&v){if(i&&Z&&k){e:for(var x=t.target,C=u.view;x!=h;x=x.parentNode)for(var O=0;O<C.length;O++)if(C[O].node==x){e.display.currentWheelTarget=x;break e}}if(r&&!c&&!P&&o!=null){i&&v&&di(e,Math.max(0,h.scrollTop+i*o)),Zr(e,Math.max(0,h.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=h.scrollLeft,u.wheelStartY=h.scrollTop,u.wheelDX=r,u.wheelDY=i,setTimeout(function(){if(u.wheelStartX!=null){var U=h.scrollLeft-u.wheelStartX,j=h.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 Dt=function(e,t){this.ranges=e,this.primIndex=t};Dt.prototype.primary=function(){return this.ranges[this.primIndex]},Dt.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},Dt.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 Dt(e,this.primIndex)},Dt.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Dt.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],h=t[o-1],d=X(h.to(),u.from());if(r&&!u.empty()?d>0:d>=0){var v=wn(h.from(),u.from()),x=mt(h.to(),u.to()),C=h.empty()?u.from()==u.head:h.from()==h.head;o<=n&&--n,t.splice(--o,2,new be(C?x:v,C?v:x))}}return new Dt(t,n)}function Ir(e,t){return new Dt([new be(e,t||e)],0)}function Dr(e){return e.text?D(e.from.line+e.text.length-1,me(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Nu(e,t){if(X(e,t.from)<0)return e;if(X(e,t.to)<=0)return Dr(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+=Dr(t).ch-t.to.ch),D(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(Nu(i.anchor,t),Nu(i.head,t)))}return Kt(e.cm,n,e.sel.primIndex)}function Mu(e,t,n){return e.line==t.line?D(n.line,e.ch-t.ch+n.ch):D(n.line+(e.line-t.line),e.ch)}function dg(e,t,n){for(var r=[],i=D(e.first,0),o=i,u=0;u<t.length;u++){var h=t[u],d=Mu(h.from,i,o),v=Mu(Dr(h),i,o);if(i=h.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 Dt(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 Ru(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,G,V){xp(K,G,V,r),et(K,"change",K,t)}function u(K,G){for(var V=[],re=K;re<G;++re)V.push(new xn(v[re],i(re),r));return V}var h=t.from,d=t.to,v=t.text,x=Q(e,h.line),C=Q(e,d.line),O=me(v),_=i(v.length-1),M=d.line-h.line;if(t.full)e.insert(0,u(0,v.length)),e.remove(v.length,e.size-v.length);else if(Ru(e,t)){var F=u(0,v.length-1);o(C,C.text,_),M&&e.remove(h.line,M),F.length&&e.insert(h.line,F)}else if(x==C)if(v.length==1)o(x,x.text.slice(0,h.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,h.ch)+v[0],i(0)),e.insert(h.line+1,U)}else if(v.length==1)o(x,x.text.slice(0,h.ch)+v[0]+C.text.slice(d.ch),i(0)),e.remove(h.line+1,M);else{o(x,x.text.slice(0,h.ch)+v[0],i(0)),o(C,O+C.text.slice(d.ch),_);var j=u(1,v.length-1);M>1&&e.remove(h.line+1,M-1),e.insert(h.line+1,j)}et(e,"change",e,t)}function Nr(e,t,n){function r(i,o,u){if(i.linked)for(var h=0;h<i.linked.length;++h){var d=i.linked[h];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 zu(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Os(e),$s(e),Pu(e),e.options.direction=t.direction,e.options.lineWrapping||ys(e),e.options.mode=t.modeOption,yt(e)}function Pu(e){(e.doc.direction=="rtl"?ze:ct)(e.display.lineDiv,"CodeMirror-rtl")}function pg(e){Ct(e,function(){Pu(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:Dr(t),text:hr(e,t.from,t.to)};return Wu(e,n,t.from.line,t.to.line+1),Nr(e,function(r){return Wu(r,n,t.from.line,t.to.line+1)},!0),n}function Fu(e){for(;e.length;){var t=me(e);if(t.ranges)e.pop();else break}}function gg(e,t){if(t)return Fu(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 Hu(e,t,n,r){var i=e.history;i.undone.length=0;var o=+new Date,u,h;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=gg(i,i.lastOp==r)))h=me(u.changes),X(t.from,t.to)==0&&X(t.from,h.to)==0?h.to=Dr(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,h||Pe(e,"historyAdded")}function vg(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 mg(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||vg(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&&Fu(i.undone)}function wa(e,t){var n=me(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Wu(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 yg(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 bg(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(yg(n[i]));return r}function Bu(e,t){var n=bg(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 h=0;h<u.length;++h){for(var d=u[h],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?Dt.prototype.deepCopy.call(o):o);continue}var u=o.changes,h=[];r.push({changes:h});for(var d=0;d<u.length;++d){var v=u[d],x=void 0;if(h.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(h)[C]=v[C],delete v[C])}}return r}function Gs(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 Dt([Gs(e.sel.primary(),t,n,i)],0),r)}function $u(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]=Gs(e.sel.ranges[o],t[o],null,i);var u=Kt(e.cm,r,e.sel.primIndex);ut(e,u,n)}function qs(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 Uu(e,t,n,r){ut(e,Ir(t,n),r)}function wg(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 ju(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),mg(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=wg(e,t,n));var r=n&&n.bias||(X(t.primary().head,e.sel.primary().head)<0?-1:1);Gu(e,Xu(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&e.cm.getOption("readOnly")!="nocursor"&&_n(e.cm)}function Gu(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 qu(e){Gu(e,Xu(e,e.sel,null,!1))}function Xu(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var u=t.ranges[o],h=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],d=Sa(e,u.anchor,h&&h.anchor,n,r),v=u.head==u.anchor?d:Sa(e,u.head,h&&h.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=Q(e,t.line);if(o.markedSpans)for(var u=0;u<o.markedSpans.length;++u){var h=o.markedSpans[u],d=h.marker,v="selectLeft"in d?!d.selectLeft:d.inclusiveLeft,x="selectRight"in d?!d.selectRight:d.inclusiveRight;if((h.from==null||(v?h.from<=t.ch:h.from<t.ch))&&(h.to==null||(x?h.to>=t.ch:h.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=Ku(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)&&(_=Ku(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,D(e.first,0))}function Ku(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ae(e,D(t.line-1)):null:n>0&&t.ch==(r||Q(e,t.line)).text.length?t.line<e.first+e.size-1?D(t.line+1,0):null:new D(t.line,t.ch+n)}function Yu(e){e.setSelection(D(e.firstLine(),0),D(e.lastLine()),Ot)}function Zu(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,h){i&&(r.from=ae(e,i)),o&&(r.to=ae(e,o)),u&&(r.text=u),h!==void 0&&(r.origin=h)}),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 In(e,t,n){if(e.cm){if(!e.cm.curOp)return tt(e.cm,In)(e,t,n);if(e.cm.state.suppressEdits)return}if(!((St(e,"beforeChange")||e.cm&&St(e.cm,"beforeChange"))&&(t=Zu(e,t,!0),!t))){var r=Bl&&!n&&mp(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Vu(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Vu(e,t)}}function Vu(e,t){if(!(t.text.length==1&&t.text[0]==""&&X(t.from,t.to)==0)){var n=Bs(e,t);Hu(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&&(tf(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,h=t=="undo"?i.done:i.undone,d=t=="undo"?i.undone:i.done,v=0;v<h.length&&(o=h[v],!(n?o.ranges&&!o.equals(e.sel):!o.ranges));v++);if(v!=h.length){for(i.lastOrigin=i.lastSelOrigin=null;;)if(o=h.pop(),o.ranges){if(wa(o,d),n&&!o.equals(e.sel)){ut(e,o,{clearRedo:!1});return}u=o}else if(r){h.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&&!Zu(e,U,!1))return h.length=0,{};x.push(js(e,U));var j=F?Bs(e,U):me(h);bi(e,U,j,Bu(e,U)),!F&&e.cm&&e.cm.scrollIntoView({from:U.from,to:Dr(U)});var K=[];Nr(e,function(G,V){!V&&fe(K,G.history)==-1&&(tf(G.history,U),K.push(G.history)),bi(G,U,null,Bu(G,U))})},_=o.changes.length-1;_>=0;--_){var M=O(_);if(M)return M.v}}}}function Qu(e,t){if(t!=0&&(e.first+=t,e.sel=new Dt(Ur(e.sel.ranges,function(i){return new be(D(i.anchor.line+t,i.anchor.ch),D(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){Qu(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);Qu(e,i),t={from:D(e.first,0),to:D(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:D(o,Q(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?xg(e.cm,t,r):Us(e,t,r),ka(e,n,Ot),e.cantEdit&&Sa(e,D(e.firstLine(),0))&&(e.cantEdit=!1)}}function xg(e,t,n){var r=e.doc,i=e.display,o=t.from,u=t.to,h=!1,d=o.line;e.options.lineWrapping||(d=m(qt(Q(r,o.line))),r.iter(d,u.line+1,function(_){if(_==i.maxLine)return h=!0,!0})),r.sel.contains(t.from,t.to)>-1&&zt(e),Us(r,t,n,mu(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,h=!1)}),h&&(e.curOp.updateMaxLine=!0)),fp(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&&!Ru(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 Dn(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)),In(e,{from:n,to:r,text:t,origin:i})}function Ju(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ef(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 h=0;h<o.ranges.length;h++)Ju(o.ranges[h].anchor,t,n,r),Ju(o.ranges[h].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=D(v.from.line+r,v.from.ch),v.to=D(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 tf(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;ef(e.done,n,r,i),ef(e.undone,n,r,i)}function wi(e,t,n,r){var i=t,o=t;return typeof t=="number"?o=Q(e,Dl(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,kp(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 h=[];this.collapse(h),this.children=[new xi(h)],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,h=u;h<i.lines.length;){var d=new xi(i.lines.slice(h,h+=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);It(n,Math.max(0,n.height-o)),e&&(Ct(e,function(){rf(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)||It(r,r.height+i),n&&Ct(n,function(){n.curOp.forceUpdate=!0,rf(n,r,i),et(n,"lineWidgetChanged",n,e,m(r))}))},Bt(Si);function rf(e,t,n){pr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Rs(e,n)}function kg(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 h=u.widgets||(u.widgets=[]);if(i.insertAt==null?h.push(i):h.splice(Math.min(h.length,Math.max(0,i.insertAt)),0,i),i.line=u,o&&!Ar(e,u)){var d=pr(u)<e.scrollTop;It(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 nf=0,Mr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++nf};Mr.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Qr(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],h=si(u.markedSpans,this);e&&!this.collapsed?Or(e,m(u),"text"):e&&(h.to!=null&&(i=m(u)),h.from!=null&&(r=m(u))),u.markedSpans=dp(u.markedSpans,h),h.from==null&&this.collapsed&&!Ar(this.doc,u)&&e&&It(u,Cn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var d=0;d<this.lines.length;++d){var v=qt(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&&qu(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=D(t?o:m(o),u.from),e==-1))return n;if(u.to!=null&&(r=D(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&&(uu(u),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Ar(n.doc,i)&&n.height!=null){var h=n.height;n.height=null;var d=ui(n)-h;d&&It(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 Sg(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(Xl(e,t.line,t,n,o)||t.line!=n.line&&Xl(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");hp()}o.addToHistory&&Hu(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var h=t.line,d=e.cm,v;if(e.iter(h,n.line+1,function(C){d&&o.collapsed&&!d.options.lineWrapping&&qt(C)==d.display.maxLine&&(v=!0),o.collapsed&&h!=t.line&&It(C,0),pp(C,new na(o,h==t.line?t.ch:null,h==n.line?n.ch:null),e.cm&&e.cm.curOp),++h}),o.collapsed&&e.iter(t.line,n.line+1,function(C){Ar(e,C)&&It(C,0)}),o.clearOnEnter&&te(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(cp(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++nf,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&&qu(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 Sg(e,t,n,r,i){r=he(r),r.shared=!1;var o=[Nn(e,t,n,r,i)],u=o[0],h=r.widgetNode;return Nr(e,function(d){h&&(r.widgetNode=h.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 af(e){return e.findMarks(D(e.first,0),e.clipPos(D(e.lastLine())),function(t){return t.parent})}function Cg(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 h=Nn(e,o,u,r.primary,r.primary.type);r.markers.push(h),h.parent=r}}}function Tg(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 h=i.markers[u];fe(o,h.doc)==-1&&(h.parent=null,i.markers.splice(u--,1))}},n=0;n<e.length;n++)t(n)}var Lg=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=D(n,0);this.sel=Ir(o),this.history=new ba(null),this.id=++Lg,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,Ir(o),Ot)};bt.prototype=Vi(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=D(this.first,0),n=this.first+this.size-1;In(this,{from:t,to:D(n,Q(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&hi(this.cm,0,0),ut(this,Ir(t),Ot)}),replaceRange:function(e,t,n,r){t=ae(this,t),n=n?ae(this,n):t,Dn(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 Q(this,e)},getLineNumber:function(e){return m(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=Q(this,e)),qt(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){Uu(this,ae(this,typeof e=="number"?D(e,t||0):e),null,n)}),setSelection:rt(function(e,t,n){Uu(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){$u(this,Nl(this,e),t)}),extendSelectionsBy:rt(function(e,t){var n=Ur(this.sel.ranges,e);$u(this,Nl(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 h=t&&t!="end"&&dg(this,r,t),d=r.length-1;d>=0;d--)In(this,r[d]);h?ju(this,h):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&&Qi(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,Qi(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!z(this,e)||(t=e,e=Q(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 h=u.index+u[0].length;r[i]=o.slice(0,u.index)+(!u.index||h==o.length?"":" ")+o.slice(h)||null}else return!1;return!0})}),addLineWidget:rt(function(e,t,n){return kg(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=Q(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 h=0;h<u.length;h++){var d=u[h];!(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,D(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}],Cg(r,af(this)),r},unlinkDoc:function(e){if(e instanceof De&&(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),Tg(af(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&&pg(this.cm))})}),bt.prototype.eachLine=bt.prototype.iter;var sf=0;function _g(e){var t=this;if(of(t),!(Fe(t,e)||gr(t.display,e))){lt(e),w&&(sf=+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,h=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"};In(t.doc,_),ju(t.doc,Ir(ae(t.doc,n),ae(t.doc,Dr(_))))})()},d=function(_,M){if(t.options.allowDropFileTypes&&fe(t.options.allowDropFileTypes,_.type)==-1){h();return}var F=new FileReader;F.onerror=function(){return h()},F.onload=function(){var U=F.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(U)){h();return}o[M]=U,h()},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,Ir(n,n)),C)for(var O=0;O<C.length;++O)Dn(t.doc,"",C[O].anchor,C[O].head,"drag");t.replaceSelection(x,"around","paste"),t.display.input.focus()}}catch{}}}}function Ag(e,t){if(w&&(!e.state.draggingText||+new Date-sf<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 Og(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 of(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function lf(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 uf=!1;function Eg(){uf||(Ig(),uf=!0)}function Ig(){var e;te(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,lf(Dg)},100))}),te(window,"blur",function(){return lf(Ln)})}function Dg(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 Ng(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,o,u=0;u<t.length-1;u++){var h=t[u];if(/^(cmd|meta|m)$/i.test(h))o=!0;else if(/^a(lt)?$/i.test(h))n=!0;else if(/^(c|ctrl|control)$/i.test(h))r=!0;else if(/^s(hift)?$/i.test(h))i=!0;else throw new Error("Unrecognized modifier name: "+h)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),o&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function Mg(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(" "),Ng),o=0;o<i.length;o++){var u=void 0,h=void 0;o==i.length-1?(h=i.join(" "),u=r):(h=i.slice(0,o+1).join(" "),u="...");var d=t[h];if(!d)t[h]=u;else if(d!=u)throw new Error("Inconsistent bindings for "+h)}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 ff(e){var t=typeof e=="string"?e:Rr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function cf(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 hf(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),cf(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 h=r.length-1;h>=0;h--)Dn(e.doc,"",r[h].from,r[h].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 D(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],h=i<0==(u.level==1),d=h?"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 D(r,v,d)}}return new D(r,i<0?n.text.length:0,i<0?"before":"after")}function Rg(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 h=function(j,K){return Xs(t,j instanceof D?j.ch:j,K)},d,v=function(j){return e.options.lineWrapping?(d=d||Sn(e,t),vu(e,t,d,j)):{begin:0,end:t.text.length}},x=v(n.sticky=="before"?h(n,-1):n.ch);if(e.doc.direction=="rtl"||u.level==1){var C=u.level==1==r<0,O=h(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 D(n.line,O,_)}}var M=function(j,K,G){for(var V=function(Le,nt){return nt?new D(n.line,h(Le,1),"before"):new D(n.line,Le,"after")};j>=0&&j<i.length;j+=K){var re=i[j],J=K>0==(re.level!=1),ce=J?G.begin:h(G.end,-1);if(re.from<=ce&&ce<re.to||(ce=J?re.from:h(re.to,-1),G.begin<=ce&&ce<G.end))return V(ce,J)}},F=M(o+r,r,x);if(F)return F;var U=r>0?x.end:h(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:Yu,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=Q(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:D(t.head.line+1,0)}:{from:t.head,to:D(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Rn(e,function(t){return{from:D(t.from().line,0),to:ae(e.doc,D(t.to().line+1,0))}})},delLineLeft:function(e){return Rn(e,function(t){return{from:D(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(D(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(D(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return df(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return pf(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return zg(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/)?pf(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=Q(e.doc,i.line).text;if(o){if(i.ch==o.length&&(i=new D(i.line,i.ch-1)),i.ch>0)i=new D(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),D(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var u=Q(e.doc,i.line-1).text;u&&(i=new D(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+u.charAt(u.length-1),D(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 df(e,t){var n=Q(e.doc,t),r=qt(n);return r!=n&&(t=m(r)),Ys(!0,e,r,t,1)}function zg(e,t){var n=Q(e.doc,t),r=bp(n);return r!=n&&(t=m(r)),Ys(!0,e,n,t,-1)}function pf(e,t){var n=df(e,t.line),r=Q(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 D(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 Pg(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 Fg=new Qt;function Ai(e,t,n,r){var i=e.state.keySeq;if(i){if(ff(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fg.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),gf(e,i+" "+t,n,r))return!0}return gf(e,t,n,r)}function gf(e,t,n,r){var i=Pg(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&et(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(lt(n),Is(e)),!!i}function vf(e,t){var n=hf(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 Hg(e,t,n){return Ai(e,"'"+n+"'",t,function(r){return _a(e,r,!0)})}var Zs=null;function mf(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=Ge(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=vf(t,e);P&&(Zs=r?n:null,!r&&n==88&&!ta&&(Z?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),c&&!Z&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Wg(t)}}function Wg(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 yf(e){e.keyCode==16&&(this.doc.sel.shift=!1),Fe(this,e)}function bf(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)&&vf(t,e))){var i=String.fromCharCode(r??n);i!="\b"&&(Hg(t,e,i)||t.display.input.onKeyPress(e))}}}var Bg=400,Vs=function(e,t,n){this.time=e,this.pos=t,this.button=n};Vs.prototype.compare=function(e,t,n){return this.time+Bg>e&&X(t,this.pos)==0&&n==this.button};var Oi,Ei;function $g(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 Vs(n,e,t),Oi=null,"double"):(Oi=new Vs(n,e,t),Ei=null,"single")}function wf(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(!Qs(t,e)){var r=Kr(t,e),i=$t(e),o=r?$g(r,i):"single";oe(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Ug(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):Ds(t)))}}}function Ug(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,cf(o,i),i,function(u){if(typeof u=="string"&&(u=_i[u]),!u)return!1;var h=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),h=u(e,n)!=wr}finally{e.state.suppressEdits=!1}return h})}function jg(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(wu,e),0):e.curOp.focus=Ge(Wt(e));var i=jg(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)?qg(e,r,t,i):Xg(e,r,t,i)}function qg(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:Ds(e)),ot(i.wrapper.ownerDocument,"mouseup",u),ot(i.wrapper.ownerDocument,"mousemove",h),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())}),h=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",h),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 xf(e,t,n){if(n=="char")return new be(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new be(D(t.line,0),ae(e.doc,D(t.line+1,0)));var r=n(e,t);return new be(r.from,r.to)}function Xg(e,t,n,r){w&&Ds(e);var i=e.display,o=e.doc;lt(t);var u,h,d=o.sel,v=d.ranges;if(r.addNew&&!r.extend?(h=o.sel.contains(n),h>-1?u=v[h]:u=new be(n,n)):(u=o.sel.primary(),h=o.sel.primIndex),r.unit=="rectangle")r.addNew||(u=new be(n,n)),n=Kr(e,t,!0,!0),h=-1;else{var x=xf(e,n,r.unit);r.extend?u=Gs(u,x.anchor,x.head,r.extend):u=x}r.addNew?h==-1?(h=v.length,ut(o,Kt(e,v.concat([u]),h),{scroll:!1,origin:"*mouse"})):v.length>1&&v[h].empty()&&r.unit=="char"&&!r.extend?(ut(o,Kt(e,v.slice(0,h).concat(v.slice(h+1)),0),{scroll:!1,origin:"*mouse"}),d=o.sel):qs(o,h,u,Jt):(h=0,ut(o,new Dt([u],0),Jt),d=o.sel);var C=n;function O(G){if(X(C,G)!=0)if(C=G,r.unit=="rectangle"){for(var V=[],re=e.options.tabSize,J=xe(Q(o,n.line).text,n.ch,re),ce=xe(Q(o,G.line).text,G.ch,re),Le=Math.min(J,ce),nt=Math.max(J,ce),Me=Math.min(n.line,G.line),Tt=Math.min(e.lastLine(),Math.max(n.line,G.line));Me<=Tt;Me++){var wt=Q(o,Me).text,Xe=er(wt,Le,re);Le==nt?V.push(new be(D(Me,Xe),D(Me,Xe))):wt.length>Xe&&V.push(new be(D(Me,Xe),D(Me,er(wt,nt,re))))}V.length||V.push(new be(n,n)),ut(o,Kt(e,d.ranges.slice(0,h).concat(V),h),{origin:"*mouse",scroll:!1}),e.scrollIntoView(G)}else{var xt=u,at=xf(e,G,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[h]=Kg(e,new be(ae(o,Ye),Ke)),ut(o,Kt(e,We,h),Jt)}}var _=i.wrapper.getBoundingClientRect(),M=0;function F(G){var V=++M,re=Kr(e,G,!0,r.unit=="rectangle");if(re)if(X(re,C)!=0){e.curOp.focus=Ge(Wt(e)),O(re);var J=ga(i,o);(re.line>=J.to||re.line<J.from)&&setTimeout(tt(e,function(){M==V&&F(G)}),150)}else{var ce=G.clientY<_.top?-20:G.clientY>_.bottom?20:0;ce&&setTimeout(tt(e,function(){M==V&&(i.scroller.scrollTop+=ce,F(G))}),50)}}function U(G){e.state.selectingText=!1,M=1/0,G&&(lt(G),i.input.focus()),ot(i.wrapper.ownerDocument,"mousemove",j),ot(i.wrapper.ownerDocument,"mouseup",K),o.history.lastSelOrigin=null}var j=tt(e,function(G){G.buttons===0||!$t(G)?U(G):F(G)}),K=tt(e,U);e.state.selectingText=K,te(i.wrapper.ownerDocument,"mousemove",j),te(i.wrapper.ownerDocument,"mouseup",K)}function Kg(e,t){var n=t.anchor,r=t.head,i=Q(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),h=o[u];if(h.from!=n.ch&&h.to!=n.ch)return t;var d=u+(h.from==n.ch==(h.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)*(h.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 D(n.line,M,F),r)}function kf(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,h=u.lineDiv.getBoundingClientRect();if(o>h.bottom||!St(e,n))return vt(t);o-=h.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 Qs(e,t){return kf(e,t,"gutterClick",!0)}function Sf(e,t){gr(e.display,t)||Yg(e,t)||Fe(e,t,"contextmenu")||ke||e.display.input.onContextMenu(t)}function Yg(e,t){return St(e,"gutterContextMenu")?kf(e,t,"gutterContextMenu",!1):!1}function Cf(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"}},Tf={},Aa={};function Zg(e){var t=e.optionHandlers;function n(r,i,o,u){e.defaults[r]=i,o&&(t[r]=u?function(h,d,v){v!=zn&&o(h,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(D(u,x))}u++});for(var h=o.length-1;h>=0;h--)Dn(r.doc,i,o[h],D(o[h].line,o[h].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",Tp,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",q?"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){Cf(r),mi(r)},!0),n("keyMap","default",function(r,i,o){var u=La(i),h=o!=zn&&La(o);h&&h.detach&&h.detach(r,u),u.attach&&u.attach(r,h||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Qg,!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){Lu(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 Qg(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 De(e,t){var n=this;if(!(this instanceof De))return new De(e,t);this.options=t=t?he(t):{},he(Tf,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 De.inputStyles[t.inputStyle](this),o=this.display=new cg(e,r,i,t);o.wrapper.CodeMirror=this,Cf(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Lu(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 Qt,keySeq:null,specialChars:null},t.autofocus&&!q&&o.input.focus(),w&&b<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Jg(this),Eg(),Qr(this),this.curOp.forceUpdate=!0,zu(this,r),t.autofocus&&!q||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);Ou(this),t.finishInit&&t.finishInit(this);for(var h=0;h<Js.length;++h)Js[h](this);Jr(this),k&&t.lineWrapping&&getComputedStyle(o.lineDiv).textRendering=="optimizelegibility"&&(o.lineDiv.style.textRendering="auto")}De.defaults=Tf,De.optionHandlers=Aa;function Jg(e){var t=e.display;te(t.scroller,"mousedown",tt(e,wf)),w&&b<11?te(t.scroller,"dblclick",tt(e,function(d){if(!Fe(e,d)){var v=Kr(e,d);if(!(!v||Qs(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 Sf(e,d)}),te(t.input.getField(),"contextmenu",function(d){t.scroller.contains(d.target)||Sf(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)&&!Qs(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(D(x.line,0),ae(e.doc,D(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 Du(e,d)}),te(t.scroller,"DOMMouseScroll",function(d){return Du(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)||(Og(e,d),Cr(d))},start:function(d){return Ag(e,d)},drop:tt(e,_g),leave:function(d){Fe(e,d)||of(e)}};var h=t.input.getField();te(h,"keyup",function(d){return yf.call(e,d)}),te(h,"keydown",tt(e,mf)),te(h,"keypress",tt(e,bf)),te(h,"focus",function(d){return Ns(e,d)}),te(h,"blur",function(d){return Ln(e,d)})}var Js=[];De.defineInitHook=function(e){return Js.push(e)};function Ii(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,h=Q(i,t),d=xe(h.text,null,u);h.stateAfter&&(h.stateAfter=null);var v=h.text.match(/^\s*/)[0],x;if(!r&&!/\S/.test(h.text))x=0,n="not";else if(n=="smart"&&(x=i.mode.indent(o,h.text.slice(v.length),h.text),x==wr||x>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?x=xe(Q(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 Dn(i,C,D(t,0),D(t,v.length),"+input"),h.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=D(t,v.length);qs(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,h=i=="paste"||e.state.pasteIncoming>u,d=Pt(t),v=null;if(h&&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=D(M.line,M.ch-n):e.state.overwrite&&!h?F=D(F.line,Math.min(Q(o,F.line).text.length,F.ch+me(d).length)):h&&Yt&&Yt.lineWise&&Yt.text.join(`
3
+ b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var a=e.indexOf(`
4
+ `,t);a==-1&&(a=e.length);var o=e.slice(t,e.charAt(a-1)=="\r"?a-1:a),u=o.indexOf("\r");u!=-1?(n.push(o.slice(0,u)),t+=u+1):(n.push(o),t=a+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Ir=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},na=function(){var e=T("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),rr=null;function cs(e){if(rr!=null)return rr;var t=V(e,T("span","x")),n=t.getBoundingClientRect(),r=st(t,0,1).getBoundingClientRect();return rr=Math.abs(n.left-r.left)>1}var kn={},nr={};function ir(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),kn[e]=t}function Yr(e,t){nr[e]=t}function Sn(e){if(typeof e=="string"&&nr.hasOwnProperty(e))e=nr[e];else if(e&&typeof e.name=="string"&&nr.hasOwnProperty(e.name)){var t=nr[e.name];typeof t=="string"&&(t={name:t}),e=Gr(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Sn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Sn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function Cn(e,t){t=Sn(t);var n=kn[t.name];if(!n)return Cn(e,"text/plain");var r=n(e,t);if(Dr.hasOwnProperty(t.name)){var a=Dr[t.name];for(var o in a)a.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=a[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 Dr={};function Tn(e,t){var n=Dr.hasOwnProperty(e)?Dr[e]:Dr[e]={};be(t,n)}function cr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var a=t[r];a instanceof Array&&(a=a.concat([])),n[r]=a}return n}function li(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 Ln(e,t,n){return e.startState?e.startState(t,n):!0}var Ve=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};Ve.prototype.eol=function(){return this.pos>=this.string.length},Ve.prototype.sol=function(){return this.pos==this.lineStart},Ve.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ve.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ve.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},Ve.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ve.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ve.prototype.skipToEnd=function(){this.pos=this.string.length},Ve.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ve.prototype.backUp=function(e){this.pos-=e},Ve.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Ce(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Ce(this.string,this.lineStart,this.tabSize):0)},Ve.prototype.indentation=function(){return Ce(this.string,null,this.tabSize)-(this.lineStart?Ce(this.string,this.lineStart,this.tabSize):0)},Ve.prototype.match=function(e,t,n){if(typeof e=="string"){var r=function(u){return n?u.toLowerCase():u},a=this.string.substr(this.pos,e.length);if(r(a)==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)}},Ve.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ve.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ve.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ve.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function re(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 a=n.children[r],o=a.chunkSize();if(t<o){n=a;break}t-=o}return n.lines[t]}function br(e,t,n){var r=[],a=t.line;return e.iter(t.line,n.line+1,function(o){var u=o.text;a==n.line&&(u=u.slice(0,n.ch)),a==t.line&&(u=u.slice(t.ch)),r.push(u),++a}),r}function ui(e,t,n){var r=[];return e.iter(t,n,function(a){r.push(a.text)}),r}function Wt(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=ye(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var a=0;r.children[a]!=t;++a)n+=r.children[a].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 a=e.children[r],o=a.height;if(t<o){e=a;continue e}t-=o,n+=a.chunkSize()}return n}while(!e.lines);for(var u=0;u<e.lines.length;++u){var h=e.lines[u],d=h.height;if(t<d)break;t-=d}return n+u}function W(e,t){return t>=e.first&&t<e.first+e.size}function j(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function R(e,t,n){if(n===void 0&&(n=null),!(this instanceof R))return new R(e,t,n);this.line=e,this.ch=t,this.sticky=n}function Z(e,t){return e.line-t.line||e.ch-t.ch}function Ae(e,t){return e.sticky==t.sticky&&Z(e,t)==0}function lt(e){return R(e.line,e.ch)}function Lt(e,t){return Z(e,t)<0?t:e}function _n(e,t){return Z(e,t)<0?e:t}function Dl(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ge(e,t){if(t.line<e.first)return R(e.first,0);var n=e.first+e.size-1;return t.line>n?R(n,re(e,n).text.length):lp(t,re(e,t.line).text.length)}function lp(e,t){var n=e.ch;return n==null||n>t?R(e.line,t):n<0?R(e.line,0):e}function Nl(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ge(e,t[r]);return n}var ia=function(e,t){this.state=e,this.lookAhead=t},hr=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};hr.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},hr.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}},hr.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},hr.fromSaved=function(e,t,n){return t instanceof ia?new hr(e,cr(e.mode,t.state),n,t.lookAhead):new hr(e,cr(e.mode,t),n)},hr.prototype.save=function(e){var t=e!==!1?cr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ia(t,this.maxLookAhead):t};function Ml(e,t,n,r){var a=[e.state.modeGen],o={};Hl(e,t.text,e.doc.mode,n,function(v,x){return a.push(v,x)},o,r);for(var u=n.state,h=function(v){n.baseTokens=a;var x=e.state.overlays[v],C=1,O=0;n.state=!0,Hl(e,t.text,x.mode,n,function(E,z){for(var B=C;O<E;){var q=a[C];q>E&&a.splice(C,1,E,a[C+1],q),C+=2,O=Math.min(E,q)}if(z)if(x.opaque)a.splice(B,C-B,E,"overlay "+z),C=B+2;else for(;B<C;B+=2){var X=a[B+1];a[B+1]=(X?X+" ":"")+"overlay "+z}},o),n.state=u,n.baseTokens=null,n.baseTokenPos=1},d=0;d<e.state.overlays.length;++d)h(d);return{styles:a,classes:o.bgClass||o.textClass?o:null}}function Rl(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=fi(e,m(t)),a=t.text.length>e.options.maxHighlightLength&&cr(e.doc.mode,r.state),o=Ml(e,t,r);a&&(r.state=a),t.stateAfter=r.save(!a),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 fi(e,t,n){var r=e.doc,a=e.display;if(!r.mode.startState)return new hr(r,!0,t);var o=up(e,t,n),u=o>r.first&&re(r,o-1).stateAfter,h=u?hr.fromSaved(r,u,o):new hr(r,Ln(r.mode),o);return r.iter(o,t,function(d){hs(e,d.text,h);var v=h.line;d.stateAfter=v==t-1||v%5==0||v>=a.viewFrom&&v<a.viewTo?h.save():null,h.nextLine()}),n&&(r.modeFrontier=h.line),h}function hs(e,t,n,r){var a=e.doc.mode,o=new Ve(t,e.options.tabSize,n);for(o.start=o.pos=r||0,t==""&&zl(a,n.state);!o.eol();)ds(a,o,n.state),o.start=o.pos}function zl(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=li(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}}function ds(e,t,n,r){for(var a=0;a<10;a++){r&&(r[0]=li(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 Pl=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function Fl(e,t,n,r){var a=e.doc,o=a.mode,u;t=ge(a,t);var h=re(a,t.line),d=fi(e,t.line,n),v=new Ve(h.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 Pl(v,u,cr(a.mode,d.state)));return r?x:new Pl(v,u,d.state)}function Wl(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 Hl(e,t,n,r,a,o,u){var h=n.flattenSpans;h==null&&(h=e.options.flattenSpans);var d=0,v=null,x=new Ve(t,e.options.tabSize,r),C,O=e.options.addModeClass&&[null];for(t==""&&Wl(zl(n,r.state),o);!x.eol();){if(x.pos>e.options.maxHighlightLength?(h=!1,u&&hs(e,t,r,x.pos),x.pos=t.length,C=null):C=Wl(ds(n,x,r.state,O),o),O){var E=O[0].name;E&&(C="m-"+(C?E+" "+C:E))}if(!h||v!=C){for(;d<x.start;)d=Math.min(x.start,d+5e3),a(d,v);v=C}x.start=x.pos}for(;d<x.pos;){var z=Math.min(x.pos,d+5e3);a(z,v),d=z}}function up(e,t,n){for(var r,a,o=e.doc,u=n?-1:t-(e.doc.mode.innerMode?1e3:100),h=t;h>u;--h){if(h<=o.first)return o.first;var d=re(o,h-1),v=d.stateAfter;if(v&&(!n||h+(v instanceof ia?v.lookAhead:0)<=o.modeFrontier))return h;var x=Ce(d.text,null,e.options.tabSize);(a==null||r>x)&&(a=h-1,r=x)}return a}function fp(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 a=re(e,r).stateAfter;if(a&&(!(a instanceof ia)||r+a.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}var $l=!1,wr=!1;function cp(){$l=!0}function hp(){wr=!0}function aa(e,t,n){this.marker=e,this.from=t,this.to=n}function ci(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function dp(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function pp(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 gp(e,t,n){var r;if(e)for(var a=0;a<e.length;++a){var o=e[a],u=o.marker,h=o.from==null||(u.inclusiveLeft?o.from<=t:o.from<t);if(h||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 aa(u,o.from,d?null:o.to))}}return r}function vp(e,t,n){var r;if(e)for(var a=0;a<e.length;++a){var o=e[a],u=o.marker,h=o.to==null||(u.inclusiveRight?o.to>=t:o.to>t);if(h||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 aa(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=W(e,t.from.line)&&re(e,t.from.line).markedSpans,r=W(e,t.to.line)&&re(e,t.to.line).markedSpans;if(!n&&!r)return null;var a=t.from.ch,o=t.to.ch,u=Z(t.from,t.to)==0,h=gp(n,a,u),d=vp(r,o,u),v=t.text.length==1,x=de(t.text).length+(v?a:0);if(h)for(var C=0;C<h.length;++C){var O=h[C];if(O.to==null){var E=ci(d,O.marker);E?v&&(O.to=E.to==null?null:E.to+x):O.to=a}}if(d)for(var z=0;z<d.length;++z){var B=d[z];if(B.to!=null&&(B.to+=x),B.from==null){var q=ci(h,B.marker);q||(B.from=x,v&&(h||(h=[])).push(B))}else B.from+=x,v&&(h||(h=[])).push(B)}h&&(h=Bl(h)),d&&d!=h&&(d=Bl(d));var X=[h];if(!v){var Q=t.text.length-2,Y;if(Q>0&&h)for(var ee=0;ee<h.length;++ee)h[ee].to==null&&(Y||(Y=[])).push(new aa(h[ee].marker,null,null));for(var le=0;le<Q;++le)X.push(Y);X.push(d)}return X}function Bl(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 mp(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(E){if(E.markedSpans)for(var z=0;z<E.markedSpans.length;++z){var B=E.markedSpans[z].marker;B.readOnly&&(!r||ye(r,B)==-1)&&(r||(r=[])).push(B)}}),!r)return null;for(var a=[{from:t,to:n}],o=0;o<r.length;++o)for(var u=r[o],h=u.find(0),d=0;d<a.length;++d){var v=a[d];if(!(Z(v.to,h.from)<0||Z(v.from,h.to)>0)){var x=[d,1],C=Z(v.from,h.from),O=Z(v.to,h.to);(C<0||!u.inclusiveLeft&&!C)&&x.push({from:v.from,to:h.from}),(O>0||!u.inclusiveRight&&!O)&&x.push({from:h.to,to:v.to}),a.splice.apply(a,x),d+=x.length-3}}return a}function Ul(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function jl(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function sa(e){return e.inclusiveLeft?-1:0}function oa(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(),a=t.find(),o=Z(r.from,a.from)||sa(e)-sa(t);if(o)return-o;var u=Z(r.to,a.to)||oa(e)-oa(t);return u||t.id-e.id}function ql(e,t){var n=wr&&e.markedSpans,r;if(n)for(var a=void 0,o=0;o<n.length;++o)a=n[o],a.marker.collapsed&&(t?a.from:a.to)==null&&(!r||gs(r,a.marker)<0)&&(r=a.marker);return r}function Kl(e){return ql(e,!0)}function la(e){return ql(e,!1)}function yp(e,t){var n=wr&&e.markedSpans,r;if(n)for(var a=0;a<n.length;++a){var o=n[a];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 Gl(e,t,n,r,a){var o=re(e,t),u=wr&&o.markedSpans;if(u)for(var h=0;h<u.length;++h){var d=u[h];if(d.marker.collapsed){var v=d.marker.find(0),x=Z(v.from,n)||sa(d.marker)-sa(a),C=Z(v.to,r)||oa(d.marker)-oa(a);if(!(x>=0&&C<=0||x<=0&&C>=0)&&(x<=0&&(d.marker.inclusiveRight&&a.inclusiveLeft?Z(v.to,n)>=0:Z(v.to,n)>0)||x>=0&&(d.marker.inclusiveRight&&a.inclusiveLeft?Z(v.from,r)<=0:Z(v.from,r)<0)))return!0}}}function ar(e){for(var t;t=Kl(e);)e=t.find(-1,!0).line;return e}function bp(e){for(var t;t=la(e);)e=t.find(1,!0).line;return e}function wp(e){for(var t,n;t=la(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function vs(e,t){var n=re(e,t),r=ar(n);return n==r?t:m(r)}function Xl(e,t){if(t>e.lastLine())return t;var n=re(e,t),r;if(!Nr(e,n))return t;for(;r=la(n);)n=r.find(1,!0).line;return m(n)+1}function Nr(e,t){var n=wr&&t.markedSpans;if(n){for(var r=void 0,a=0;a<n.length;++a)if(r=n[a],!!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,ci(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var a=void 0,o=0;o<t.markedSpans.length;++o)if(a=t.markedSpans[o],a.marker.collapsed&&!a.marker.widgetNode&&a.from==n.to&&(a.to==null||a.to!=n.from)&&(a.marker.inclusiveLeft||n.marker.inclusiveRight)&&ms(e,t,a))return!0}function xr(e){e=ar(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var a=n.lines[r];if(a==e)break;t+=a.height}for(var o=n.parent;o;n=o,o=n.parent)for(var u=0;u<o.children.length;++u){var h=o.children[u];if(h==n)break;t+=h.height}return t}function ua(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=Kl(r);){var a=n.find(0,!0);r=a.from.line,t+=a.from.ch-a.to.ch}for(r=e;n=la(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=re(n,n.first),t.maxLineLength=ua(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var a=ua(r);a>t.maxLineLength&&(t.maxLineLength=a,t.maxLine=r)})}var En=function(e,t,n){this.text=e,jl(this,t),this.height=n?n(this):1};En.prototype.lineNo=function(){return m(this)},er(En);function xp(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),Ul(e),jl(e,n);var a=r?r(e):1;a!=e.height&&Wt(e,a)}function kp(e){e.parent=null,Ul(e)}var Sp={},Cp={};function Yl(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Cp:Sp;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Vl(e,t){var n=rt("span",null,null,k?"padding-right: .1px":null),r={pre:rt("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var a=0;a<=(t.rest?t.rest.length:0);a++){var o=a?t.rest[a-1]:t.line,u=void 0;r.pos=0,r.addToken=Lp,Ar(e.display.measure)&&(u=Le(o,e.doc.direction))&&(r.addToken=Ep(r.addToken,u)),r.map=[];var h=t!=e.display.externalMeasured&&m(o);Op(o,r,Rl(e,o,h)),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=se(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=se(o.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ra(e.display.measure))),a==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 Xe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=se(r.pre.className,r.textClass||"")),r}function Tp(e){var t=T("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Lp(e,t,n,r,a,o,u){if(t){var h=e.splitSpaces?_p(t,e.trailingSpace):t,d=e.cm.state.specialChars,v=!1,x;if(!d.test(t))e.col+=t.length,x=document.createTextNode(h),e.map.push(e.pos,e.pos+t.length,x),b&&y<9&&(v=!0),e.pos+=t.length;else{x=document.createDocumentFragment();for(var C=0;;){d.lastIndex=C;var O=d.exec(t),E=O?O.index-C:t.length-C;if(E){var z=document.createTextNode(h.slice(C,C+E));b&&y<9?x.appendChild(T("span",[z])):x.appendChild(z),e.map.push(e.pos,e.pos+E,z),e.col+=E,e.pos+=E}if(!O)break;C+=E+1;var B=void 0;if(O[0]==" "){var q=e.cm.options.tabSize,X=q-e.col%q;B=x.appendChild(T("span",Lr(X),"cm-tab")),B.setAttribute("role","presentation"),B.setAttribute("cm-text"," "),e.col+=X}else O[0]=="\r"||O[0]==`
5
+ `?(B=x.appendChild(T("span",O[0]=="\r"?"␍":"␤","cm-invalidchar")),B.setAttribute("cm-text",O[0]),e.col+=1):(B=e.cm.options.specialCharPlaceholder(O[0]),B.setAttribute("cm-text",O[0]),b&&y<9?x.appendChild(T("span",[B])):x.appendChild(B),e.col+=1);e.map.push(e.pos,e.pos+1,B),e.pos++}}if(e.trailingSpace=h.charCodeAt(t.length-1)==32,n||r||a||v||o||u){var Q=n||"";r&&(Q+=r),a&&(Q+=a);var Y=T("span",[x],Q,o);if(u)for(var ee in u)u.hasOwnProperty(ee)&&ee!="style"&&ee!="class"&&Y.setAttribute(ee,u[ee]);return e.content.appendChild(Y)}e.content.appendChild(x)}}function _p(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",a=0;a<e.length;a++){var o=e.charAt(a);o==" "&&n&&(a==e.length-1||e.charCodeAt(a+1)==32)&&(o=" "),r+=o,n=o==" "}return r}function Ep(e,t){return function(n,r,a,o,u,h,d){a=a?a+" 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,a,o,u,h,d);e(n,r.slice(0,C.to-v),a,o,null,h,d),o=null,r=r.slice(C.to-v),v=C.to}}}function Zl(e,t,n,r){var a=!r&&n.widgetNode;a&&e.map.push(e.pos,e.pos+t,a),!r&&e.cm.display.input.needsContentAttribute&&(a||(a=e.content.appendChild(document.createElement("span"))),a.setAttribute("cm-marker",n.id)),a&&(e.cm.display.input.setUneditable(a),e.content.appendChild(a)),e.pos+=t,e.trailingSpace=!1}function Op(e,t,n){var r=e.markedSpans,a=e.text,o=0;if(!r){for(var u=1;u<n.length;u+=2)t.addToken(t,a.slice(o,o=n[u]),Yl(n[u+1],t.cm.options));return}for(var h=a.length,d=0,v=1,x="",C,O,E=0,z,B,q,X,Q;;){if(E==d){z=B=q=O="",Q=null,X=null,E=1/0;for(var Y=[],ee=void 0,le=0;le<r.length;++le){var ae=r[le],xe=ae.marker;if(xe.type=="bookmark"&&ae.from==d&&xe.widgetNode)Y.push(xe);else if(ae.from<=d&&(ae.to==null||ae.to>d||xe.collapsed&&ae.to==d&&ae.from==d)){if(ae.to!=null&&ae.to!=d&&E>ae.to&&(E=ae.to,B=""),xe.className&&(z+=" "+xe.className),xe.css&&(O=(O?O+";":"")+xe.css),xe.startStyle&&ae.from==d&&(q+=" "+xe.startStyle),xe.endStyle&&ae.to==E&&(ee||(ee=[])).push(xe.endStyle,ae.to),xe.title&&((Q||(Q={})).title=xe.title),xe.attributes)for(var We in xe.attributes)(Q||(Q={}))[We]=xe.attributes[We];xe.collapsed&&(!X||gs(X.marker,xe)<0)&&(X=ae)}else ae.from>d&&E>ae.from&&(E=ae.from)}if(ee)for(var ht=0;ht<ee.length;ht+=2)ee[ht+1]==E&&(B+=" "+ee[ht]);if(!X||X.from==d)for(var Ke=0;Ke<Y.length;++Ke)Zl(t,0,Y[Ke]);if(X&&(X.from||0)==d){if(Zl(t,(X.to==null?h+1:X.to)-d,X.marker,X.from==null),X.to==null)return;X.to==d&&(X=!1)}}if(d>=h)break;for(var Rt=Math.min(h,E);;){if(x){var Ot=d+x.length;if(!X){var it=Ot>Rt?x.slice(0,Rt-d):x;t.addToken(t,it,C?C+z:z,q,d+it.length==E?B:"",O,Q)}if(Ot>=Rt){x=x.slice(Rt-d),d=Rt;break}d=Ot,q=""}x=a.slice(o,o=n[v++]),C=Yl(n[v++],t.cm.options)}}}function Ql(e,t,n){this.line=t,this.rest=wp(t),this.size=this.rest?m(de(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Nr(e,t)}function fa(e,t,n){for(var r=[],a,o=t;o<n;o=a){var u=new Ql(e.doc,re(e.doc,o),o);a=o+u.size,r.push(u)}return r}var On=null;function Ap(e){On?On.ops.push(e):e.ownsGroup=On={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 a=e.ops[r];if(a.cursorActivityHandlers)for(;a.cursorActivityCalled<a.cursorActivityHandlers.length;)a.cursorActivityHandlers[a.cursorActivityCalled++].call(null,a.cm)}}while(n<t.length)}function Dp(e,t){var n=e.ownsGroup;if(n)try{Ip(n)}finally{On=null,t(n)}}var hi=null;function ut(e,t){var n=yr(e,t);if(n.length){var r=Array.prototype.slice.call(arguments,2),a;On?a=On.delayedCallbacks:hi?a=hi:(a=hi=[],setTimeout(Np,0));for(var o=function(h){a.push(function(){return n[h].apply(null,r)})},u=0;u<n.length;++u)o(u)}}function Np(){var e=hi;hi=null;for(var t=0;t<e.length;++t)e[t]()}function Jl(e,t,n,r){for(var a=0;a<t.changes.length;a++){var o=t.changes[a];o=="text"?Rp(e,t):o=="gutter"?tu(e,t,n,r):o=="class"?bs(e,t):o=="widget"&&zp(e,t,r)}t.changes=null}function di(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),b&&y<8&&(e.node.style.zIndex=2)),e.node}function Mp(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=di(t);t.background=r.insertBefore(T("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function eu(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Vl(e,t)}function Rp(e,t){var n=t.text.className,r=eu(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){Mp(e,t),t.line.wrapClass?di(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 tu(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 a=di(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),a.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var u=di(t),h=t.gutter=T("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(h.setAttribute("aria-hidden","true"),e.display.input.setUneditable(h),u.insertBefore(h,t.text),t.line.gutterClass&&(h.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!o||!o["CodeMirror-linenumbers"])&&(t.lineNumber=h.appendChild(T("div",j(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&&h.appendChild(T("div",[x],"CodeMirror-gutter-elt","left: "+r.gutterLeft[v]+"px; width: "+r.gutterWidth[v]+"px"))}}}function zp(e,t,n){t.alignable&&(t.alignable=null);for(var r=Oe("CodeMirror-linewidget"),a=t.node.firstChild,o=void 0;a;a=o)o=a.nextSibling,r.test(a.className)&&t.node.removeChild(a);ru(e,t,n)}function Pp(e,t,n,r){var a=eu(e,t);return t.text=t.node=a.pre,a.bgClass&&(t.bgClass=a.bgClass),a.textClass&&(t.textClass=a.textClass),bs(e,t),tu(e,t,n,r),ru(e,t,r),t.node}function ru(e,t,n){if(nu(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)nu(e,t.rest[r],t,n,!1)}function nu(e,t,n,r,a){if(t.widgets)for(var o=di(n),u=0,h=t.widgets;u<h.length;++u){var d=h[u],v=T("div",[d.node],"CodeMirror-linewidget"+(d.className?" "+d.className:""));d.handleMouseEvents||v.setAttribute("cm-ignore-events","true"),Fp(d,v,n,r),e.display.input.setUneditable(v),a&&d.above?o.insertBefore(v,n.gutter||n.text):o.appendChild(v),ut(d,"redraw")}}function Fp(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var a=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(a-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=a+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function pi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!I(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;"),V(t.display.measure,T("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function kr(e,t){for(var n=si(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 ca(e){return e.lineSpace.offsetTop}function ws(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function iu(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=V(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 dr(e){return pt-e.display.nativeBarWidth}function Vr(e){return e.display.scroller.clientWidth-dr(e)-e.display.barWidth}function xs(e){return e.display.scroller.clientHeight-dr(e)-e.display.barHeight}function Wp(e,t,n){var r=e.options.lineWrapping,a=r&&Vr(e);if(!t.measure.heights||r&&t.measure.width!=a){var o=t.measure.heights=[];if(r){t.measure.width=a;for(var u=t.text.firstChild.getClientRects(),h=0;h<u.length-1;h++){var d=u[h],v=u[h+1];Math.abs(d.bottom-v.bottom)>2&&o.push((d.bottom+v.top)/2-n.top)}}o.push(n.bottom-n.top)}}function au(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 a=0;a<e.rest.length;a++)if(m(e.rest[a])>n)return{map:e.measure.maps[a],cache:e.measure.caches[a],before:!0}}}function Hp(e,t){t=ar(t);var n=m(t),r=e.display.externalMeasured=new Ql(e.doc,t,n);r.lineN=n;var a=r.built=Vl(e,r);return r.text=a.pre,V(e.display.lineMeasure,a.pre),r}function su(e,t,n,r){return pr(e,An(e,t),n,r)}function ks(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Jr(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function An(e,t){var n=m(t),r=ks(e,n);r&&!r.text?r=null:r&&r.changes&&(Jl(e,r,n,_s(e)),e.curOp.forceUpdate=!0),r||(r=Hp(e,t));var a=au(r,t,n);return{line:t,view:r,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function pr(e,t,n,r,a){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=Bp(e,t,n,r),u.bogus||(t.cache[o]=u)),{left:u.left,right:u.right,top:a?u.rtop:u.top,bottom:a?u.rbottom:u.bottom}}var ou={left:0,right:0,top:0,bottom:0};function lu(e,t,n){for(var r,a,o,u,h,d,v=0;v<e.length;v+=3)if(h=e[v],d=e[v+1],t<h?(a=0,o=1,u="left"):t<d?(a=t-h,o=a+1):(v==e.length-3||t==d&&e[v+3]>t)&&(o=d-h,a=o-1,t>=d&&(u="right")),a!=null){if(r=e[v+2],h==d&&n==(r.insertLeft?"left":"right")&&(u=n),n=="left"&&a==0)for(;v&&e[v-2]==e[v-3]&&e[v-1].insertLeft;)r=e[(v-=3)+2],u="left";if(n=="right"&&a==d-h)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:a,end:o,collapse:u,coverStart:h,coverEnd:d}}function $p(e,t){var n=ou;if(t=="left")for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var a=e.length-1;a>=0&&(n=e[a]).left==n.right;a--);return n}function Bp(e,t,n,r){var a=lu(t.map,n,r),o=a.node,u=a.start,h=a.end,d=a.collapse,v;if(o.nodeType==3){for(var x=0;x<4;x++){for(;u&&we(t.line.text.charAt(a.coverStart+u));)--u;for(;a.coverStart+h<a.coverEnd&&we(t.line.text.charAt(a.coverStart+h));)++h;if(b&&y<9&&u==0&&h==a.coverEnd-a.coverStart?v=o.parentNode.getBoundingClientRect():v=$p(st(o,u,h).getClientRects(),r),v.left||v.right||u==0)break;h=u,u=u-1,d="right"}b&&y<11&&(v=Up(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(b&&y<9&&!u&&(!v||!v.left&&!v.right)){var O=o.parentNode.getClientRects()[0];O?v={left:O.left,right:O.left+Dn(e.display),top:O.top,bottom:O.bottom}:v=ou}for(var E=v.top-t.rect.top,z=v.bottom-t.rect.top,B=(E+z)/2,q=t.view.measure.heights,X=0;X<q.length-1&&!(B<q[X]);X++);var Q=X?q[X-1]:0,Y=q[X],ee={left:(d=="right"?v.right:v.left)-t.rect.left,right:(d=="left"?v.left:v.right)-t.rect.left,top:Q,bottom:Y};return!v.left&&!v.right&&(ee.bogus=!0),e.options.singleCursorHeightPerLine||(ee.rtop=E,ee.rbottom=z),ee}function Up(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 uu(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 fu(e){e.display.externalMeasure=null,$(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)uu(e.display.view[t])}function gi(e){fu(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function cu(e){return _&&P?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function hu(e){return _&&P?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function Ss(e){var t=ar(e),n=t.widgets,r=0;if(n)for(var a=0;a<n.length;++a)n[a].above&&(r+=pi(n[a]));return r}function ha(e,t,n,r,a){if(!a){var o=Ss(t);n.top+=o,n.bottom+=o}if(r=="line")return n;r||(r="local");var u=xr(t);if(r=="local"?u+=ca(e.display):u-=e.display.viewOffset,r=="page"||r=="window"){var h=e.display.lineSpace.getBoundingClientRect();u+=h.top+(r=="window"?0:hu(ze(e)));var d=h.left+(r=="window"?0:cu(ze(e)));n.left+=d,n.right+=d}return n.top+=u,n.bottom+=u,n}function du(e,t,n){if(n=="div")return t;var r=t.left,a=t.top;if(n=="page")r-=cu(ze(e)),a-=hu(ze(e));else if(n=="local"||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,a+=o.top}var u=e.display.lineSpace.getBoundingClientRect();return{left:r-u.left,top:a-u.top}}function da(e,t,n,r,a){return r||(r=re(e.doc,t.line)),ha(e,r,su(e,r,t.ch,a),n)}function sr(e,t,n,r,a,o){r=r||re(e.doc,t.line),a||(a=An(e,r));function u(z,B){var q=pr(e,a,z,B?"right":"left",o);return B?q.left=q.right:q.right=q.left,ha(e,r,q,n)}var h=Le(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"),!h)return u(v=="before"?d-1:d,v=="before");function x(z,B,q){var X=h[B],Q=X.level==1;return u(q?z-1:z,Q!=q)}var C=Er(h,d,v),O=Xr,E=x(d,C,v=="before");return O!=null&&(E.other=x(d,O,v!="before")),E}function pu(e,t){var n=0;t=ge(e.doc,t),e.options.lineWrapping||(n=Dn(e.display)*t.ch);var r=re(e.doc,t.line),a=xr(r)+ca(e.display);return{left:n,right:n,top:a,bottom:a+r.height}}function Cs(e,t,n,r,a){var o=R(e,t,n);return o.xRel=a,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 a=S(r,n),o=r.first+r.size-1;if(a>o)return Cs(r.first+r.size-1,re(r,o).text.length,null,1,1);t<0&&(t=0);for(var u=re(r,a);;){var h=jp(e,u,a,t,n),d=yp(u,h.ch+(h.xRel>0||h.outside>0?1:0));if(!d)return h;var v=d.find(1);if(v.line==a)return v;u=re(r,a=v.line)}}function gu(e,t,n,r){r-=Ss(t);var a=t.text.length,o=Gt(function(u){return pr(e,n,u-1).bottom<=r},a,0);return a=Gt(function(u){return pr(e,n,u).top>r},o,a),{begin:o,end:a}}function vu(e,t,n,r){n||(n=An(e,t));var a=ha(e,t,pr(e,n,r),"line").top;return gu(e,t,n,a)}function Ls(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function jp(e,t,n,r,a){a-=xr(t);var o=An(e,t),u=Ss(t),h=0,d=t.text.length,v=!0,x=Le(t,e.doc.direction);if(x){var C=(e.options.lineWrapping?Kp:qp)(e,t,n,o,x,r,a);v=C.level!=1,h=v?C.from:C.to-1,d=v?C.to:C.from-1}var O=null,E=null,z=Gt(function(le){var ae=pr(e,o,le);return ae.top+=u,ae.bottom+=u,Ls(ae,r,a,!1)?(ae.top<=a&&ae.left<=r&&(O=le,E=ae),!0):!1},h,d),B,q,X=!1;if(E){var Q=r-E.left<E.right-r,Y=Q==v;z=O+(Y?0:1),q=Y?"after":"before",B=Q?E.left:E.right}else{!v&&(z==d||z==h)&&z++,q=z==0?"after":z==t.text.length?"before":pr(e,o,z-(v?1:0)).bottom+u<=a==v?"after":"before";var ee=sr(e,R(n,z,q),"line",t,o);B=ee.left,X=a<ee.top?-1:a>=ee.bottom?1:0}return z=Dt(t.text,z,1),Cs(n,z,q,X,r-B)}function qp(e,t,n,r,a,o,u){var h=Gt(function(C){var O=a[C],E=O.level!=1;return Ls(sr(e,R(n,E?O.to:O.from,E?"before":"after"),"line",t,r),o,u,!0)},0,a.length-1),d=a[h];if(h>0){var v=d.level!=1,x=sr(e,R(n,v?d.from:d.to,v?"after":"before"),"line",t,r);Ls(x,o,u,!0)&&x.top>u&&(d=a[h-1])}return d}function Kp(e,t,n,r,a,o,u){var h=gu(e,t,r,u),d=h.begin,v=h.end;/\s/.test(t.text.charAt(v-1))&&v--;for(var x=null,C=null,O=0;O<a.length;O++){var E=a[O];if(!(E.from>=v||E.to<=d)){var z=E.level!=1,B=pr(e,r,z?Math.min(v,E.to)-1:Math.max(d,E.from)).right,q=B<o?o-B+1e9:B-o;(!x||C>q)&&(x=E,C=q)}}return x||(x=a[a.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 Zr;function In(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Zr==null){Zr=T("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Zr.appendChild(document.createTextNode("x")),Zr.appendChild(T("br"));Zr.appendChild(document.createTextNode("x"))}V(e.measure,Zr);var n=Zr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),$(e.measure),n||1}function Dn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=T("span","xxxxxxxxxx"),n=T("pre",[t],"CodeMirror-line-like");V(e.measure,n);var r=t.getBoundingClientRect(),a=(r.right-r.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function _s(e){for(var t=e.display,n={},r={},a=t.gutters.clientLeft,o=t.gutters.firstChild,u=0;o;o=o.nextSibling,++u){var h=e.display.gutterSpecs[u].className;n[h]=o.offsetLeft+o.clientLeft+a,r[h]=o.clientWidth}return{fixedPos:Es(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Es(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function mu(e){var t=In(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/Dn(e.display)-3);return function(a){if(Nr(e.doc,a))return 0;var o=0;if(a.widgets)for(var u=0;u<a.widgets.length;u++)a.widgets[u].height&&(o+=a.widgets[u].height);return n?o+(Math.ceil(a.text.length/r)||1)*t:o+t}}function Os(e){var t=e.doc,n=mu(e);t.iter(function(r){var a=n(r);a!=r.height&&Wt(r,a)})}function Qr(e,t,n,r){var a=e.display;if(!n&&si(t).getAttribute("cm-not-content")=="true")return null;var o,u,h=a.lineSpace.getBoundingClientRect();try{o=t.clientX-h.left,u=t.clientY-h.top}catch{return null}var d=Ts(e,o,u),v;if(r&&d.xRel>0&&(v=re(e.doc,d.line).text).length==d.ch){var x=Ce(v,v.length,e.options.tabSize)-v.length;d=R(d.line,Math.max(0,Math.round((o-iu(e.display).left)/Dn(e.display))-x))}return d}function Jr(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 _t(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var a=e.display;if(r&&n<a.viewTo&&(a.updateLineNumbers==null||a.updateLineNumbers>t)&&(a.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=a.viewTo)wr&&vs(e.doc,t)<a.viewTo&&Rr(e);else if(n<=a.viewFrom)wr&&Xl(e.doc,n+r)>a.viewFrom?Rr(e):(a.viewFrom+=r,a.viewTo+=r);else if(t<=a.viewFrom&&n>=a.viewTo)Rr(e);else if(t<=a.viewFrom){var o=pa(e,n,n+r,1);o?(a.view=a.view.slice(o.index),a.viewFrom=o.lineN,a.viewTo+=r):Rr(e)}else if(n>=a.viewTo){var u=pa(e,t,t,-1);u?(a.view=a.view.slice(0,u.index),a.viewTo=u.lineN):Rr(e)}else{var h=pa(e,t,t,-1),d=pa(e,n,n+r,1);h&&d?(a.view=a.view.slice(0,h.index).concat(fa(e,h.lineN,d.lineN)).concat(a.view.slice(d.index)),a.viewTo+=r):Rr(e)}var v=a.externalMeasured;v&&(n<v.lineN?v.lineN+=r:t<v.lineN+v.size&&(a.externalMeasured=null))}function Mr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,a=e.display.externalMeasured;if(a&&t>=a.lineN&&t<a.lineN+a.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[Jr(e,t)];if(o.node!=null){var u=o.changes||(o.changes=[]);ye(u,n)==-1&&u.push(n)}}}function Rr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function pa(e,t,n,r){var a=Jr(e,t),o,u=e.display.view;if(!wr||n==e.doc.first+e.doc.size)return{index:a,lineN:n};for(var h=e.display.viewFrom,d=0;d<a;d++)h+=u[d].size;if(h!=t){if(r>0){if(a==u.length-1)return null;o=h+u[a].size-t,a++}else o=h-t;t+=o,n+=o}for(;vs(e.doc,n)!=n;){if(a==(r<0?0:u.length-1))return null;n+=r*u[a-(r<0?1:0)].size,a+=r}return{index:a,lineN:n}}function Gp(e,t,n){var r=e.display,a=r.view;a.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=fa(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=fa(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Jr(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(fa(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Jr(e,n)))),r.viewTo=n}function yu(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var a=t[r];!a.hidden&&(!a.node||a.changes)&&++n}return n}function vi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function bu(e,t){t===void 0&&(t=!0);var n=e.doc,r={},a=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),u=e.options.$customCursor;u&&(t=!0);for(var h=0;h<n.sel.ranges.length;h++)if(!(!t&&h==n.sel.primIndex)){var d=n.sel.ranges[h];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&&As(e,x,a)}else(v||e.options.showCursorWhenSelecting)&&As(e,d.head,a);v||Xp(e,d,o)}}return r}function As(e,t,n){var r=sr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),a=n.appendChild(T("div"," ","CodeMirror-cursor"));if(a.style.left=r.left+"px",a.style.top=r.top+"px",a.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var o=da(e,t,"div",null,null),u=o.right-o.left;a.style.width=(u>0?u:e.defaultCharWidth())+"px"}if(r.other){var h=n.appendChild(T("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));h.style.display="",h.style.left=r.other.left+"px",h.style.top=r.other.top+"px",h.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function ga(e,t){return e.top-t.top||e.left-t.left}function Xp(e,t,n){var r=e.display,a=e.doc,o=document.createDocumentFragment(),u=iu(e.display),h=u.left,d=Math.max(r.sizerWidth,Vr(e)-r.sizer.offsetLeft)-u.right,v=a.direction=="ltr";function x(Y,ee,le,ae){ee<0&&(ee=0),ee=Math.round(ee),ae=Math.round(ae),o.appendChild(T("div",null,"CodeMirror-selected","position: absolute; left: "+Y+`px;
6
+ top: `+ee+"px; width: "+(le??d-Y)+`px;
7
+ height: `+(ae-ee)+"px"))}function C(Y,ee,le){var ae=re(a,Y),xe=ae.text.length,We,ht;function Ke(it,At){return da(e,R(Y,it),"div",ae,At)}function Rt(it,At,gt){var ot=vu(e,ae,null,it),at=At=="ltr"==(gt=="after")?"left":"right",Ze=gt=="after"?ot.begin:ot.end-(/\s/.test(ae.text.charAt(ot.end-1))?2:1);return Ke(Ze,at)[at]}var Ot=Le(ae,a.direction);return _r(Ot,ee||0,le??xe,function(it,At,gt,ot){var at=gt=="ltr",Ze=Ke(it,at?"left":"right"),It=Ke(At-1,at?"right":"left"),qn=ee==null&&it==0,$r=le==null&&At==xe,bt=ot==0,gr=!Ot||ot==Ot.length-1;if(It.top-Ze.top<=3){var dt=(v?qn:$r)&&bt,no=(v?$r:qn)&&gr,Tr=dt?h:(at?Ze:It).left,an=no?d:(at?It:Ze).right;x(Tr,Ze.top,an-Tr,Ze.bottom)}else{var sn,kt,Kn,io;at?(sn=v&&qn&&bt?h:Ze.left,kt=v?d:Rt(it,gt,"before"),Kn=v?h:Rt(At,gt,"after"),io=v&&$r&&gr?d:It.right):(sn=v?Rt(it,gt,"before"):h,kt=!v&&qn&&bt?d:Ze.right,Kn=!v&&$r&&gr?h:It.left,io=v?Rt(At,gt,"after"):d),x(sn,Ze.top,kt-sn,Ze.bottom),Ze.bottom<It.top&&x(h,Ze.bottom,null,It.top),x(Kn,It.top,io-Kn,It.bottom)}(!We||ga(Ze,We)<0)&&(We=Ze),ga(It,We)<0&&(We=It),(!ht||ga(Ze,ht)<0)&&(ht=Ze),ga(It,ht)<0&&(ht=It)}),{start:We,end:ht}}var O=t.from(),E=t.to();if(O.line==E.line)C(O.line,O.ch,E.ch);else{var z=re(a,O.line),B=re(a,E.line),q=ar(z)==ar(B),X=C(O.line,O.ch,q?z.text.length+1:null).end,Q=C(E.line,q?0:null,E.ch).start;q&&(X.top<Q.top-2?(x(X.right,X.top,null,X.bottom),x(h,Q.top,Q.left,Q.bottom)):x(X.right,X.top,Q.left-X.right,X.bottom)),X.bottom<Q.top&&x(h,X.bottom,null,Q.top)}n.appendChild(o)}function Is(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()||Nn(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function wu(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ns(e))}function Ds(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Nn(e))},100)}function Ns(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(Xe(e,"focus",e,t),e.state.focused=!0,K(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()),Is(e))}function Nn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Xe(e,"blur",e,t),e.state.focused=!1,Re(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function va(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),a=t.lineDiv.getBoundingClientRect().top,o=0,u=0;u<t.view.length;u++){var h=t.view[u],d=e.options.lineWrapping,v=void 0,x=0;if(!h.hidden){if(a+=h.line.height,b&&y<8){var C=h.node.offsetTop+h.node.offsetHeight;v=C-n,n=C}else{var O=h.node.getBoundingClientRect();v=O.bottom-O.top,!d&&h.text.firstChild&&(x=h.text.firstChild.getBoundingClientRect().right-O.left-1)}var E=h.line.height-v;if((E>.005||E<-.005)&&(a<r&&(o-=E),Wt(h.line,v),xu(h.line),h.rest))for(var z=0;z<h.rest.length;z++)xu(h.rest[z]);if(x>e.display.sizerWidth){var B=Math.ceil(x/Dn(e.display));B>e.display.maxLineLength&&(e.display.maxLineLength=B,e.display.maxLine=h.line,e.display.maxLineChanged=!0)}}}Math.abs(o)>2&&(t.scroller.scrollTop+=o)}function xu(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 ma(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-ca(e));var a=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,o=S(t,r),u=S(t,a);if(n&&n.ensure){var h=n.ensure.from.line,d=n.ensure.to.line;h<o?(o=h,u=S(t,xr(re(t,h))+e.wrapper.clientHeight)):Math.min(d,t.lastLine())>=u&&(o=S(t,xr(re(t,d))-e.wrapper.clientHeight),u=d)}return{from:o,to:Math.max(u,o+1)}}function Yp(e,t){if(!Ye(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),a=null,o=n.wrapper.ownerDocument;if(t.top+r.top<0?a=!0:t.bottom+r.top>(o.defaultView.innerHeight||o.documentElement.clientHeight)&&(a=!1),a!=null&&!A){var u=T("div","​",null,`position: absolute;
8
+ top: `+(t.top-n.viewOffset-ca(e.display))+`px;
9
+ height: `+(t.bottom-t.top+dr(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(a),e.display.lineSpace.removeChild(u)}}}function Vp(e,t,n,r){r==null&&(r=0);var a;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?R(t.line,t.ch+1,"before"):t,t=t.ch?R(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var o=0;o<5;o++){var u=!1,h=sr(e,t),d=!n||n==t?h:sr(e,n);a={left:Math.min(h.left,d.left),top:Math.min(h.top,d.top)-r,right:Math.max(h.left,d.left),bottom:Math.max(h.bottom,d.bottom)+r};var v=Ms(e,a),x=e.doc.scrollTop,C=e.doc.scrollLeft;if(v.scrollTop!=null&&(yi(e,v.scrollTop),Math.abs(e.doc.scrollTop-x)>1&&(u=!0)),v.scrollLeft!=null&&(en(e,v.scrollLeft),Math.abs(e.doc.scrollLeft-C)>1&&(u=!0)),!u)break}return a}function Zp(e,t){var n=Ms(e,t);n.scrollTop!=null&&yi(e,n.scrollTop),n.scrollLeft!=null&&en(e,n.scrollLeft)}function Ms(e,t){var n=e.display,r=In(e.display);t.top<0&&(t.top=0);var a=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 h=e.doc.height+ws(n),d=t.top<r,v=t.bottom>h-r;if(t.top<a)u.scrollTop=d?0:t.top;else if(t.bottom>a+o){var x=Math.min(t.top,(v?h:t.bottom)-o);x!=a&&(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,E=Vr(e)-n.gutters.offsetWidth,z=t.right-t.left>E;return z&&(t.right=t.left+E),t.left<10?u.scrollLeft=0:t.left<O?u.scrollLeft=Math.max(0,t.left+C-(z?0:10)):t.right>E+O-3&&(u.scrollLeft=t.right+(z?0:10)-E),u}function Rs(e,t){t!=null&&(ya(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Mn(e){ya(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function mi(e,t,n){(t!=null||n!=null)&&ya(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function Qp(e,t){ya(e),e.curOp.scrollToPos=t}function ya(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=pu(e,t.from),r=pu(e,t.to);ku(e,n,r,t.margin)}}function ku(e,t,n,r){var a=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});mi(e,a.scrollLeft,a.scrollTop)}function yi(e,t){Math.abs(e.doc.scrollTop-t)<2||(c||Ps(e,{top:t}),Su(e,t,!0),c&&Ps(e),xi(e,100))}function Su(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 en(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,Eu(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function bi(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+dr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var tn=function(e,t,n){this.cm=n;var r=this.vert=T("div",[T("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),a=this.horiz=T("div",[T("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=a.tabIndex=-1,e(r),e(a),oe(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),oe(a,"scroll",function(){a.clientWidth&&t(a.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,b&&y<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};tn.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 a=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+a)+"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}},tn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},tn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},tn.prototype.zeroWidthHack=function(){var e=J&&!M?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new jt,this.disableVert=new jt},tn.prototype.enableZeroWidthBar=function(e,t,n){e.style.visibility="";function r(){var a=e.getBoundingClientRect(),o=n=="vert"?document.elementFromPoint(a.right-1,(a.top+a.bottom)/2):document.elementFromPoint((a.right+a.left)/2,a.bottom-1);o!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},tn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var wi=function(){};wi.prototype.update=function(){return{bottom:0,right:0}},wi.prototype.setScrollLeft=function(){},wi.prototype.setScrollTop=function(){},wi.prototype.clear=function(){};function Rn(e,t){t||(t=bi(e));var n=e.display.barWidth,r=e.display.barHeight;Cu(e,t);for(var a=0;a<4&&n!=e.display.barWidth||r!=e.display.barHeight;a++)n!=e.display.barWidth&&e.options.lineWrapping&&va(e),Cu(e,bi(e)),n=e.display.barWidth,r=e.display.barHeight}function Cu(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 Tu={native:tn,null:wi};function Lu(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&Re(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Tu[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),oe(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"?en(e,t):yi(e,t)},e),e.display.scrollbars.addClass&&K(e.display.wrapper,e.display.scrollbars.addClass)}var Jp=0;function rn(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:++Jp,markArrays:null},Ap(e.curOp)}function nn(e){var t=e.curOp;t&&Dp(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;eg(n)})}function eg(e){for(var t=e.ops,n=0;n<t.length;n++)tg(t[n]);for(var r=0;r<t.length;r++)rg(t[r]);for(var a=0;a<t.length;a++)ng(t[a]);for(var o=0;o<t.length;o++)ig(t[o]);for(var u=0;u<t.length;u++)ag(t[u])}function tg(e){var t=e.cm,n=t.display;og(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 ba(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function rg(e){e.updatedDisplay=e.mustUpdate&&zs(e.cm,e.update)}function ng(e){var t=e.cm,n=t.display;e.updatedDisplay&&va(t),e.barMeasure=bi(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=su(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+dr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Vr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function ig(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&en(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==N(wt(t));e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Rn(t,e.barMeasure),e.updatedDisplay&&Ws(t,e.barMeasure),e.selectionChanged&&Is(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&wu(e.cm)}function ag(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&_u(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&Su(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&en(t,e.scrollLeft,!0,!0),e.scrollToPos){var a=Vp(t,ge(r,e.scrollToPos.from),ge(r,e.scrollToPos.to),e.scrollToPos.margin);Yp(t,a)}var o=e.maybeHiddenMarkers,u=e.maybeUnhiddenMarkers;if(o)for(var h=0;h<o.length;++h)o[h].lines.length||Xe(o[h],"hide");if(u)for(var d=0;d<u.length;++d)u[d].lines.length&&Xe(u[d],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Xe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Mt(e,t){if(e.curOp)return t();rn(e);try{return t()}finally{nn(e)}}function ft(e,t){return function(){if(e.curOp)return t.apply(e,arguments);rn(e);try{return t.apply(e,arguments)}finally{nn(e)}}}function xt(e){return function(){if(this.curOp)return e.apply(this,arguments);rn(this);try{return e.apply(this,arguments)}finally{nn(this)}}}function ct(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);rn(t);try{return e.apply(this,arguments)}finally{nn(t)}}}function xi(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,he(sg,e))}function sg(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=fi(e,t.highlightFrontier),a=[];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,h=o.text.length>e.options.maxHighlightLength?cr(t.mode,r.state):null,d=Ml(e,o,r,!0);h&&(r.state=h),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&&a.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 xi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),a.length&&Mt(e,function(){for(var o=0;o<a.length;o++)Mr(e,a[o],"text")})}}var ba=function(e,t,n){var r=e.display;this.viewport=t,this.visible=ma(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Vr(e),this.force=n,this.dims=_s(e),this.events=[]};ba.prototype.signal=function(e,t){Nt(e,t)&&this.events.push(arguments)},ba.prototype.finish=function(){for(var e=0;e<this.events.length;e++)Xe.apply(null,this.events[e])};function og(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=dr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=dr(e)+"px",t.scrollbarsClipped=!0)}function lg(e){if(e.hasFocus())return null;var t=N(wt(e));if(!t||!I(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=pe(e).getSelection();r.anchorNode&&r.extend&&I(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function ug(e){if(!(!e||!e.activeElt||e.activeElt==N(nt(e.activeElt)))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&I(document.body,e.anchorNode)&&I(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 Rr(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&&yu(e)==0)return!1;Ou(e)&&(Rr(e),t.dims=_s(e));var a=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),u=Math.min(a,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(a,n.viewTo)),wr&&(o=vs(e.doc,o),u=Xl(e.doc,u));var h=o!=n.viewFrom||u!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Gp(e,o,u),n.viewOffset=xr(re(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var d=yu(e);if(!h&&d==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var v=lg(e);return d>4&&(n.lineDiv.style.display="none"),fg(e,n.updateLineNumbers,t.dims),d>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,ug(v),$(n.cursorDiv),$(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,h&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,xi(e,400)),n.updateLineNumbers=null,!0}function _u(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Vr(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ws(e.display)-xs(e),n.top)}),t.visible=ma(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ma(e.display,e.doc,n));if(!zs(e,t))break;va(e);var a=bi(e);vi(e),Rn(e,a),Ws(e,a),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 ba(e,t);if(zs(e,n)){va(e),_u(e,n);var r=bi(e);vi(e),Rn(e,r),Ws(e,r),n.finish()}}function fg(e,t,n){var r=e.display,a=e.options.lineNumbers,o=r.lineDiv,u=o.firstChild;function h(z){var B=z.nextSibling;return k&&J&&e.display.currentWheelTarget==z?z.style.display="none":z.parentNode.removeChild(z),B}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=Pp(e,C,v,n);o.insertBefore(O,u)}else{for(;u!=C.node;)u=h(u);var E=a&&t!=null&&t<=v&&C.lineNumber;C.changes&&(ye(C.changes,"gutter")>-1&&(E=!1),Jl(e,C,v,n)),E&&($(C.lineNumber),C.lineNumber.appendChild(document.createTextNode(j(e.options,v)))),u=C.node.nextSibling}v+=C.size}for(;u;)u=h(u)}function Fs(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",ut(e,"gutterChanged",e)}function Ws(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+dr(e)+"px"}function Eu(e){var t=e.display,n=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Es(t)-t.scroller.scrollLeft+e.doc.scrollLeft,a=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 h=n[u].alignable;if(h)for(var d=0;d<h.length;d++)h[d].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+a+"px")}}function Ou(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=j(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var a=r.measure.appendChild(T("div",[T("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=a.firstChild.offsetWidth,u=a.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 Hs(e,t){for(var n=[],r=!1,a=0;a<e.length;a++){var o=e[a],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 Au(e){var t=e.gutters,n=e.gutterSpecs;$(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var a=n[r],o=a.className,u=a.style,h=t.appendChild(T("div",null,"CodeMirror-gutter "+o));u&&(h.style.cssText=u),o=="CodeMirror-linenumbers"&&(e.lineGutter=h,h.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Fs(e)}function ki(e){Au(e.display),_t(e),Eu(e)}function cg(e,t,n,r){var a=this;this.input=n,a.scrollbarFiller=T("div",null,"CodeMirror-scrollbar-filler"),a.scrollbarFiller.setAttribute("cm-not-content","true"),a.gutterFiller=T("div",null,"CodeMirror-gutter-filler"),a.gutterFiller.setAttribute("cm-not-content","true"),a.lineDiv=rt("div",null,"CodeMirror-code"),a.selectionDiv=T("div",null,null,"position: relative; z-index: 1"),a.cursorDiv=T("div",null,"CodeMirror-cursors"),a.measure=T("div",null,"CodeMirror-measure"),a.lineMeasure=T("div",null,"CodeMirror-measure"),a.lineSpace=rt("div",[a.measure,a.lineMeasure,a.selectionDiv,a.cursorDiv,a.lineDiv],null,"position: relative; outline: none");var o=rt("div",[a.lineSpace],"CodeMirror-lines");a.mover=T("div",[o],null,"position: relative"),a.sizer=T("div",[a.mover],"CodeMirror-sizer"),a.sizerWidth=null,a.heightForcer=T("div",null,null,"position: absolute; height: "+pt+"px; width: 1px;"),a.gutters=T("div",null,"CodeMirror-gutters"),a.lineGutter=null,a.scroller=T("div",[a.sizer,a.heightForcer,a.gutters],"CodeMirror-scroll"),a.scroller.setAttribute("tabIndex","-1"),a.wrapper=T("div",[a.scrollbarFiller,a.gutterFiller,a.scroller],"CodeMirror"),_&&H===105&&(a.wrapper.style.clipPath="inset(0px)"),a.wrapper.setAttribute("translate","no"),b&&y<8&&(a.gutters.style.zIndex=-1,a.scroller.style.paddingRight=0),!k&&!(c&&G)&&(a.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(a.wrapper):e(a.wrapper)),a.viewFrom=a.viewTo=t.first,a.reportedViewFrom=a.reportedViewTo=t.first,a.view=[],a.renderedView=null,a.externalMeasured=null,a.viewOffset=0,a.lastWrapHeight=a.lastWrapWidth=0,a.updateLineNumbers=null,a.nativeBarWidth=a.barHeight=a.barWidth=0,a.scrollbarsClipped=!1,a.lineNumWidth=a.lineNumInnerWidth=a.lineNumChars=null,a.alignWidgets=!1,a.cachedCharWidth=a.cachedTextHeight=a.cachedPaddingH=null,a.maxLine=null,a.maxLineLength=0,a.maxLineChanged=!1,a.wheelDX=a.wheelDY=a.wheelStartX=a.wheelStartY=null,a.shift=!1,a.selForContextMenu=null,a.activeTouch=null,a.gutterSpecs=Hs(r.gutters,r.lineNumbers),Au(a),n.init(a)}var wa=0,Sr=null;b?Sr=-.53:c?Sr=15:_?Sr=-.7:U&&(Sr=-1/3);function Iu(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 hg(e){var t=Iu(e);return t.x*=Sr,t.y*=Sr,t}function Du(e,t){_&&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=Iu(t),r=n.x,a=n.y,o=Sr;t.deltaMode===0&&(r=t.deltaX,a=t.deltaY,o=1);var u=e.display,h=u.scroller,d=h.scrollWidth>h.clientWidth,v=h.scrollHeight>h.clientHeight;if(r&&d||a&&v){if(a&&J&&k){e:for(var x=t.target,C=u.view;x!=h;x=x.parentNode)for(var O=0;O<C.length;O++)if(C[O].node==x){e.display.currentWheelTarget=x;break e}}if(r&&!c&&!F&&o!=null){a&&v&&yi(e,Math.max(0,h.scrollTop+a*o)),en(e,Math.max(0,h.scrollLeft+r*o)),(!a||a&&v)&&mt(t),u.wheelStartX=null;return}if(a&&o!=null){var E=a*o,z=e.doc.scrollTop,B=z+u.wrapper.clientHeight;E<0?z=Math.max(0,z+E-50):B=Math.min(e.doc.height,B+E+50),Ps(e,{top:z,bottom:B})}wa<20&&t.deltaMode!==0&&(u.wheelStartX==null?(u.wheelStartX=h.scrollLeft,u.wheelStartY=h.scrollTop,u.wheelDX=r,u.wheelDY=a,setTimeout(function(){if(u.wheelStartX!=null){var q=h.scrollLeft-u.wheelStartX,X=h.scrollTop-u.wheelStartY,Q=X&&u.wheelDY&&X/u.wheelDY||q&&u.wheelDX&&q/u.wheelDX;u.wheelStartX=u.wheelStartY=null,Q&&(Sr=(Sr*wa+Q)/(wa+1),++wa)}},200)):(u.wheelDX+=r,u.wheelDY+=a))}}var Ht=function(e,t){this.ranges=e,this.primIndex=t};Ht.prototype.primary=function(){return this.ranges[this.primIndex]},Ht.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(!Ae(n.anchor,r.anchor)||!Ae(n.head,r.head))return!1}return!0},Ht.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Ie(lt(this.ranges[t].anchor),lt(this.ranges[t].head));return new Ht(e,this.primIndex)},Ht.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Ht.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(Z(t,r.from())>=0&&Z(e,r.to())<=0)return n}return-1};var Ie=function(e,t){this.anchor=e,this.head=t};Ie.prototype.from=function(){return _n(this.anchor,this.head)},Ie.prototype.to=function(){return Lt(this.anchor,this.head)},Ie.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function or(e,t,n){var r=e&&e.options.selectionsMayTouch,a=t[n];t.sort(function(O,E){return Z(O.from(),E.from())}),n=ye(t,a);for(var o=1;o<t.length;o++){var u=t[o],h=t[o-1],d=Z(h.to(),u.from());if(r&&!u.empty()?d>0:d>=0){var v=_n(h.from(),u.from()),x=Lt(h.to(),u.to()),C=h.empty()?u.from()==u.head:h.from()==h.head;o<=n&&--n,t.splice(--o,2,new Ie(C?x:v,C?v:x))}}return new Ht(t,n)}function zr(e,t){return new Ht([new Ie(e,t||e)],0)}function Pr(e){return e.text?R(e.from.line+e.text.length-1,de(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Nu(e,t){if(Z(e,t.from)<0)return e;if(Z(e,t.to)<=0)return Pr(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+=Pr(t).ch-t.to.ch),R(n,r)}function $s(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var a=e.sel.ranges[r];n.push(new Ie(Nu(a.anchor,t),Nu(a.head,t)))}return or(e.cm,n,e.sel.primIndex)}function Mu(e,t,n){return e.line==t.line?R(n.line,e.ch-t.ch+n.ch):R(n.line+(e.line-t.line),e.ch)}function dg(e,t,n){for(var r=[],a=R(e.first,0),o=a,u=0;u<t.length;u++){var h=t[u],d=Mu(h.from,a,o),v=Mu(Pr(h),a,o);if(a=h.to,o=v,n=="around"){var x=e.sel.ranges[u],C=Z(x.head,x.anchor)<0;r[u]=new Ie(C?v:d,C?d:v)}else r[u]=new Ie(d,d)}return new Ht(r,e.sel.primIndex)}function Bs(e){e.doc.mode=Cn(e.options,e.doc.modeOption),Si(e)}function Si(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,xi(e,100),e.state.modeGen++,e.curOp&&_t(e)}function Ru(e,t){return t.from.ch==0&&t.to.ch==0&&de(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Us(e,t,n,r){function a(Q){return n?n[Q]:null}function o(Q,Y,ee){xp(Q,Y,ee,r),ut(Q,"change",Q,t)}function u(Q,Y){for(var ee=[],le=Q;le<Y;++le)ee.push(new En(v[le],a(le),r));return ee}var h=t.from,d=t.to,v=t.text,x=re(e,h.line),C=re(e,d.line),O=de(v),E=a(v.length-1),z=d.line-h.line;if(t.full)e.insert(0,u(0,v.length)),e.remove(v.length,e.size-v.length);else if(Ru(e,t)){var B=u(0,v.length-1);o(C,C.text,E),z&&e.remove(h.line,z),B.length&&e.insert(h.line,B)}else if(x==C)if(v.length==1)o(x,x.text.slice(0,h.ch)+O+x.text.slice(d.ch),E);else{var q=u(1,v.length-1);q.push(new En(O+x.text.slice(d.ch),E,r)),o(x,x.text.slice(0,h.ch)+v[0],a(0)),e.insert(h.line+1,q)}else if(v.length==1)o(x,x.text.slice(0,h.ch)+v[0]+C.text.slice(d.ch),a(0)),e.remove(h.line+1,z);else{o(x,x.text.slice(0,h.ch)+v[0],a(0)),o(C,O+C.text.slice(d.ch),E);var X=u(1,v.length-1);z>1&&e.remove(h.line+1,z-1),e.insert(h.line+1,X)}ut(e,"change",e,t)}function Fr(e,t,n){function r(a,o,u){if(a.linked)for(var h=0;h<a.linked.length;++h){var d=a.linked[h];if(d.doc!=o){var v=u&&d.sharedHist;n&&!v||(t(d.doc,v),r(d.doc,a,v))}}}r(e,null,!0)}function zu(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Os(e),Bs(e),Pu(e),e.options.direction=t.direction,e.options.lineWrapping||ys(e),e.options.mode=t.modeOption,_t(e)}function Pu(e){(e.doc.direction=="rtl"?K:Re)(e.display.lineDiv,"CodeMirror-rtl")}function pg(e){Mt(e,function(){Pu(e),_t(e)})}function xa(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:lt(t.from),to:Pr(t),text:br(e,t.from,t.to)};return Hu(e,n,t.from.line,t.to.line+1),Fr(e,function(r){return Hu(r,n,t.from.line,t.to.line+1)},!0),n}function Fu(e){for(;e.length;){var t=de(e);if(t.ranges)e.pop();else break}}function gg(e,t){if(t)return Fu(e.done),de(e.done);if(e.done.length&&!de(e.done).ranges)return de(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),de(e.done)}function Wu(e,t,n,r){var a=e.history;a.undone.length=0;var o=+new Date,u,h;if((a.lastOp==r||a.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&a.lastModTime>o-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(u=gg(a,a.lastOp==r)))h=de(u.changes),Z(t.from,t.to)==0&&Z(t.from,h.to)==0?h.to=Pr(t):u.changes.push(js(e,t));else{var d=de(a.done);for((!d||!d.ranges)&&ka(e.sel,a.done),u={changes:[js(e,t)],generation:a.generation},a.done.push(u);a.done.length>a.undoDepth;)a.done.shift(),a.done[0].ranges||a.done.shift()}a.done.push(n),a.generation=++a.maxGeneration,a.lastModTime=a.lastSelTime=o,a.lastOp=a.lastSelOp=r,a.lastOrigin=a.lastSelOrigin=t.origin,h||Xe(e,"historyAdded")}function vg(e,t,n,r){var a=t.charAt(0);return a=="*"||a=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function mg(e,t,n,r){var a=e.history,o=r&&r.origin;n==a.lastSelOp||o&&a.lastSelOrigin==o&&(a.lastModTime==a.lastSelTime&&a.lastOrigin==o||vg(e,o,de(a.done),t))?a.done[a.done.length-1]=t:ka(t,a.done),a.lastSelTime=+new Date,a.lastSelOrigin=o,a.lastSelOp=n,r&&r.clearRedo!==!1&&Fu(a.undone)}function ka(e,t){var n=de(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Hu(e,t,n,r){var a=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(u){u.markedSpans&&((a||(a=t["spans_"+e.id]={}))[o]=u.markedSpans),++o})}function yg(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 bg(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],a=0;a<t.text.length;++a)r.push(yg(n[a]));return r}function $u(e,t){var n=bg(e,t),r=ps(e,t);if(!n)return r;if(!r)return n;for(var a=0;a<n.length;++a){var o=n[a],u=r[a];if(o&&u)e:for(var h=0;h<u.length;++h){for(var d=u[h],v=0;v<o.length;++v)if(o[v].marker==d.marker)continue e;o.push(d)}else u&&(n[a]=u)}return n}function zn(e,t,n){for(var r=[],a=0;a<e.length;++a){var o=e[a];if(o.ranges){r.push(n?Ht.prototype.deepCopy.call(o):o);continue}var u=o.changes,h=[];r.push({changes:h});for(var d=0;d<u.length;++d){var v=u[d],x=void 0;if(h.push({from:v.from,to:v.to,text:v.text}),t)for(var C in v)(x=C.match(/^spans_(\d+)$/))&&ye(t,Number(x[1]))>-1&&(de(h)[C]=v[C],delete v[C])}}return r}function qs(e,t,n,r){if(r){var a=e.anchor;if(n){var o=Z(t,a)<0;o!=Z(n,a)<0?(a=t,t=n):o!=Z(t,n)<0&&(t=n)}return new Ie(a,t)}else return new Ie(n||t,t)}function Sa(e,t,n,r,a){a==null&&(a=e.cm&&(e.cm.display.shift||e.extend)),yt(e,new Ht([qs(e.sel.primary(),t,n,a)],0),r)}function Bu(e,t,n){for(var r=[],a=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,a);var u=or(e.cm,r,e.sel.primIndex);yt(e,u,n)}function Ks(e,t,n,r){var a=e.sel.ranges.slice(0);a[t]=n,yt(e,or(e.cm,a,e.sel.primIndex),r)}function Uu(e,t,n,r){yt(e,zr(t,n),r)}function wg(e,t,n){var r={ranges:t.ranges,update:function(a){this.ranges=[];for(var o=0;o<a.length;o++)this.ranges[o]=new Ie(ge(e,a[o].anchor),ge(e,a[o].head))},origin:n&&n.origin};return Xe(e,"beforeSelectionChange",e,r),e.cm&&Xe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?or(e.cm,r.ranges,r.ranges.length-1):t}function ju(e,t,n){var r=e.history.done,a=de(r);a&&a.ranges?(r[r.length-1]=t,Ca(e,t,n)):yt(e,t,n)}function yt(e,t,n){Ca(e,t,n),mg(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Ca(e,t,n){(Nt(e,"beforeSelectionChange")||e.cm&&Nt(e.cm,"beforeSelectionChange"))&&(t=wg(e,t,n));var r=n&&n.bias||(Z(t.primary().head,e.sel.primary().head)<0?-1:1);qu(e,Gu(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&e.cm.getOption("readOnly")!="nocursor"&&Mn(e.cm)}function qu(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Xt(e.cm)),ut(e,"cursorActivity",e))}function Ku(e){qu(e,Gu(e,e.sel,null,!1))}function Gu(e,t,n,r){for(var a,o=0;o<t.ranges.length;o++){var u=t.ranges[o],h=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],d=Ta(e,u.anchor,h&&h.anchor,n,r),v=u.head==u.anchor?d:Ta(e,u.head,h&&h.head,n,r);(a||d!=u.anchor||v!=u.head)&&(a||(a=t.ranges.slice(0,o)),a[o]=new Ie(d,v))}return a?or(e.cm,a,t.primIndex):t}function Pn(e,t,n,r,a){var o=re(e,t.line);if(o.markedSpans)for(var u=0;u<o.markedSpans.length;++u){var h=o.markedSpans[u],d=h.marker,v="selectLeft"in d?!d.selectLeft:d.inclusiveLeft,x="selectRight"in d?!d.selectRight:d.inclusiveRight;if((h.from==null||(v?h.from<=t.ch:h.from<t.ch))&&(h.to==null||(x?h.to>=t.ch:h.to>t.ch))){if(a&&(Xe(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=Xu(e,C,-r,C&&C.line==t.line?o:null)),C&&C.line==t.line&&(O=Z(C,n))&&(r<0?O<0:O>0))return Pn(e,C,t,r,a)}var E=d.find(r<0?-1:1);return(r<0?v:x)&&(E=Xu(e,E,r,E.line==t.line?o:null)),E?Pn(e,E,t,r,a):null}}return t}function Ta(e,t,n,r,a){var o=r||1,u=Pn(e,t,n,o,a)||!a&&Pn(e,t,n,o,!0)||Pn(e,t,n,-o,a)||!a&&Pn(e,t,n,-o,!0);return u||(e.cantEdit=!0,R(e.first,0))}function Xu(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ge(e,R(t.line-1)):null:n>0&&t.ch==(r||re(e,t.line)).text.length?t.line<e.first+e.size-1?R(t.line+1,0):null:new R(t.line,t.ch+n)}function Yu(e){e.setSelection(R(e.firstLine(),0),R(e.lastLine()),St)}function Vu(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(a,o,u,h){a&&(r.from=ge(e,a)),o&&(r.to=ge(e,o)),u&&(r.text=u),h!==void 0&&(r.origin=h)}),Xe(e,"beforeChange",e,r),e.cm&&Xe(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 Fn(e,t,n){if(e.cm){if(!e.cm.curOp)return ft(e.cm,Fn)(e,t,n);if(e.cm.state.suppressEdits)return}if(!((Nt(e,"beforeChange")||e.cm&&Nt(e.cm,"beforeChange"))&&(t=Vu(e,t,!0),!t))){var r=$l&&!n&&mp(e,t.from,t.to);if(r)for(var a=r.length-1;a>=0;--a)Zu(e,{from:r[a].from,to:r[a].to,text:a?[""]:t.text,origin:t.origin});else Zu(e,t)}}function Zu(e,t){if(!(t.text.length==1&&t.text[0]==""&&Z(t.from,t.to)==0)){var n=$s(e,t);Wu(e,t,n,e.cm?e.cm.curOp.id:NaN),Ci(e,t,n,ps(e,t));var r=[];Fr(e,function(a,o){!o&&ye(r,a.history)==-1&&(tf(a.history,t),r.push(a.history)),Ci(a,t,null,ps(a,t))})}}function La(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!n)){for(var a=e.history,o,u=e.sel,h=t=="undo"?a.done:a.undone,d=t=="undo"?a.undone:a.done,v=0;v<h.length&&(o=h[v],!(n?o.ranges&&!o.equals(e.sel):!o.ranges));v++);if(v!=h.length){for(a.lastOrigin=a.lastSelOrigin=null;;)if(o=h.pop(),o.ranges){if(ka(o,d),n&&!o.equals(e.sel)){yt(e,o,{clearRedo:!1});return}u=o}else if(r){h.push(o);return}else break;var x=[];ka(u,d),d.push({changes:x,generation:a.generation}),a.generation=o.generation||++a.maxGeneration;for(var C=Nt(e,"beforeChange")||e.cm&&Nt(e.cm,"beforeChange"),O=function(B){var q=o.changes[B];if(q.origin=t,C&&!Vu(e,q,!1))return h.length=0,{};x.push(js(e,q));var X=B?$s(e,q):de(h);Ci(e,q,X,$u(e,q)),!B&&e.cm&&e.cm.scrollIntoView({from:q.from,to:Pr(q)});var Q=[];Fr(e,function(Y,ee){!ee&&ye(Q,Y.history)==-1&&(tf(Y.history,q),Q.push(Y.history)),Ci(Y,q,null,$u(Y,q))})},E=o.changes.length-1;E>=0;--E){var z=O(E);if(z)return z.v}}}}function Qu(e,t){if(t!=0&&(e.first+=t,e.sel=new Ht(Jt(e.sel.ranges,function(a){return new Ie(R(a.anchor.line+t,a.anchor.ch),R(a.head.line+t,a.head.ch))}),e.sel.primIndex),e.cm)){_t(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)Mr(e.cm,r,"gutter")}}function Ci(e,t,n,r){if(e.cm&&!e.cm.curOp)return ft(e.cm,Ci)(e,t,n,r);if(t.to.line<e.first){Qu(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 a=t.text.length-1-(e.first-t.from.line);Qu(e,a),t={from:R(e.first,0),to:R(t.to.line+a,t.to.ch),text:[de(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:R(o,re(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=br(e,t.from,t.to),n||(n=$s(e,t)),e.cm?xg(e.cm,t,r):Us(e,t,r),Ca(e,n,St),e.cantEdit&&Ta(e,R(e.firstLine(),0))&&(e.cantEdit=!1)}}function xg(e,t,n){var r=e.doc,a=e.display,o=t.from,u=t.to,h=!1,d=o.line;e.options.lineWrapping||(d=m(ar(re(r,o.line))),r.iter(d,u.line+1,function(E){if(E==a.maxLine)return h=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Xt(e),Us(r,t,n,mu(e)),e.options.lineWrapping||(r.iter(d,o.line+t.text.length,function(E){var z=ua(E);z>a.maxLineLength&&(a.maxLine=E,a.maxLineLength=z,a.maxLineChanged=!0,h=!1)}),h&&(e.curOp.updateMaxLine=!0)),fp(r,o.line),xi(e,400);var v=t.text.length-(u.line-o.line)-1;t.full?_t(e):o.line==u.line&&t.text.length==1&&!Ru(e.doc,t)?Mr(e,o.line,"text"):_t(e,o.line,u.line+1,v);var x=Nt(e,"changes"),C=Nt(e,"change");if(C||x){var O={from:o,to:u,text:t.text,removed:t.removed,origin:t.origin};C&&ut(e,"change",e,O),x&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(O)}e.display.selForContextMenu=null}function Wn(e,t,n,r,a){var o;r||(r=n),Z(r,n)<0&&(o=[r,n],n=o[0],r=o[1]),typeof t=="string"&&(t=e.splitLines(t)),Fn(e,{from:n,to:r,text:t,origin:a})}function Ju(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function ef(e,t,n,r){for(var a=0;a<e.length;++a){var o=e[a],u=!0;if(o.ranges){o.copied||(o=e[a]=o.deepCopy(),o.copied=!0);for(var h=0;h<o.ranges.length;h++)Ju(o.ranges[h].anchor,t,n,r),Ju(o.ranges[h].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=R(v.from.line+r,v.from.ch),v.to=R(v.to.line+r,v.to.ch);else if(t<=v.to.line){u=!1;break}}u||(e.splice(0,a+1),a=0)}}function tf(e,t){var n=t.from.line,r=t.to.line,a=t.text.length-(r-n)-1;ef(e.done,n,r,a),ef(e.undone,n,r,a)}function Ti(e,t,n,r){var a=t,o=t;return typeof t=="number"?o=re(e,Dl(e,t)):a=m(t),a==null?null:(r(o,a)&&e.cm&&Mr(e.cm,a,n),o)}function Li(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}Li.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var a=this.lines[n];this.height-=a.height,kp(a),ut(a,"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 _i(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var a=e[r];t+=a.chunkSize(),n+=a.height,a.parent=this}this.size=t,this.height=n,this.parent=null}_i.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],a=r.chunkSize();if(e<a){var o=Math.min(t,a-e),u=r.height;if(r.removeInner(e,o),this.height-=u-r.height,a==o&&(this.children.splice(n--,1),r.parent=null),(t-=o)==0)break;e=0}else e-=a}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Li))){var h=[];this.collapse(h),this.children=[new Li(h)],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 a=this.children[r],o=a.chunkSize();if(e<=o){if(a.insertInner(e,t,n),a.lines&&a.lines.length>50){for(var u=a.lines.length%25+25,h=u;h<a.lines.length;){var d=new Li(a.lines.slice(h,h+=25));a.height-=d.height,this.children.splice(++r,0,d),d.parent=this}a.lines=a.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 _i(t);if(e.parent){e.size-=n.size,e.height-=n.height;var a=ye(e.parent.children,e);e.parent.children.splice(a+1,0,n)}else{var r=new _i(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 a=this.children[r],o=a.chunkSize();if(e<o){var u=Math.min(t,o-e);if(a.iterN(e,u,n))return!0;if((t-=u)==0)break;e=0}else e-=o}}};var Ei=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};Ei.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=m(n);if(!(r==null||!t)){for(var a=0;a<t.length;++a)t[a]==this&&t.splice(a--,1);t.length||(n.widgets=null);var o=pi(this);Wt(n,Math.max(0,n.height-o)),e&&(Mt(e,function(){rf(e,n,-o),Mr(e,r,"widget")}),ut(e,"lineWidgetCleared",e,this,r))}},Ei.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var a=pi(this)-t;a&&(Nr(this.doc,r)||Wt(r,r.height+a),n&&Mt(n,function(){n.curOp.forceUpdate=!0,rf(n,r,a),ut(n,"lineWidgetChanged",n,e,m(r))}))},er(Ei);function rf(e,t,n){xr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Rs(e,n)}function kg(e,t,n,r){var a=new Ei(e,n,r),o=e.cm;return o&&a.noHScroll&&(o.display.alignWidgets=!0),Ti(e,t,"widget",function(u){var h=u.widgets||(u.widgets=[]);if(a.insertAt==null?h.push(a):h.splice(Math.min(h.length,Math.max(0,a.insertAt)),0,a),a.line=u,o&&!Nr(e,u)){var d=xr(u)<e.scrollTop;Wt(u,u.height+pi(a)),d&&Rs(o,a.height),o.curOp.forceUpdate=!0}return!0}),o&&ut(o,"lineWidgetAdded",o,a,typeof t=="number"?t:m(t)),a}var nf=0,Wr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++nf};Wr.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&rn(e),Nt(this,"clear")){var n=this.find();n&&ut(this,"clear",n.from,n.to)}for(var r=null,a=null,o=0;o<this.lines.length;++o){var u=this.lines[o],h=ci(u.markedSpans,this);e&&!this.collapsed?Mr(e,m(u),"text"):e&&(h.to!=null&&(a=m(u)),h.from!=null&&(r=m(u))),u.markedSpans=dp(u.markedSpans,h),h.from==null&&this.collapsed&&!Nr(this.doc,u)&&e&&Wt(u,In(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var d=0;d<this.lines.length;++d){var v=ar(this.lines[d]),x=ua(v);x>e.display.maxLineLength&&(e.display.maxLine=v,e.display.maxLineLength=x,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&_t(e,r,a+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ku(e.doc)),e&&ut(e,"markerCleared",e,this,r,a),t&&nn(e),this.parent&&this.parent.clear()}},Wr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,a=0;a<this.lines.length;++a){var o=this.lines[a],u=ci(o.markedSpans,this);if(u.from!=null&&(n=R(t?o:m(o),u.from),e==-1))return n;if(u.to!=null&&(r=R(t?o:m(o),u.to),e==1))return r}return n&&{from:n,to:r}},Wr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;!t||!r||Mt(r,function(){var a=t.line,o=m(t.line),u=ks(r,o);if(u&&(uu(u),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!Nr(n.doc,a)&&n.height!=null){var h=n.height;n.height=null;var d=pi(n)-h;d&&Wt(a,a.height+d)}ut(r,"markerChanged",r,e)})},Wr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ye(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Wr.prototype.detachLine=function(e){if(this.lines.splice(ye(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},er(Wr);function Hn(e,t,n,r,a){if(r&&r.shared)return Sg(e,t,n,r,a);if(e.cm&&!e.cm.curOp)return ft(e.cm,Hn)(e,t,n,r,a);var o=new Wr(e,a),u=Z(t,n);if(r&&be(r,o,!1),u>0||u==0&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=rt("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Gl(e,t.line,t,n,o)||t.line!=n.line&&Gl(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");hp()}o.addToHistory&&Wu(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var h=t.line,d=e.cm,v;if(e.iter(h,n.line+1,function(C){d&&o.collapsed&&!d.options.lineWrapping&&ar(C)==d.display.maxLine&&(v=!0),o.collapsed&&h!=t.line&&Wt(C,0),pp(C,new aa(o,h==t.line?t.ch:null,h==n.line?n.ch:null),e.cm&&e.cm.curOp),++h}),o.collapsed&&e.iter(t.line,n.line+1,function(C){Nr(e,C)&&Wt(C,0)}),o.clearOnEnter&&oe(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(cp(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++nf,o.atomic=!0),d){if(v&&(d.curOp.updateMaxLine=!0),o.collapsed)_t(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++)Mr(d,x,"text");o.atomic&&Ku(d.doc),ut(d,"markerAdded",d,o)}return o}var Oi=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};Oi.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();ut(this,"clear")}},Oi.prototype.find=function(e,t){return this.primary.find(e,t)},er(Oi);function Sg(e,t,n,r,a){r=be(r),r.shared=!1;var o=[Hn(e,t,n,r,a)],u=o[0],h=r.widgetNode;return Fr(e,function(d){h&&(r.widgetNode=h.cloneNode(!0)),o.push(Hn(d,ge(d,t),ge(d,n),r,a));for(var v=0;v<d.linked.length;++v)if(d.linked[v].isParent)return;u=de(o)}),new Oi(o,u)}function af(e){return e.findMarks(R(e.first,0),e.clipPos(R(e.lastLine())),function(t){return t.parent})}function Cg(e,t){for(var n=0;n<t.length;n++){var r=t[n],a=r.find(),o=e.clipPos(a.from),u=e.clipPos(a.to);if(Z(o,u)){var h=Hn(e,o,u,r.primary,r.primary.type);r.markers.push(h),h.parent=r}}}function Tg(e){for(var t=function(r){var a=e[r],o=[a.primary.doc];Fr(a.primary.doc,function(d){return o.push(d)});for(var u=0;u<a.markers.length;u++){var h=a.markers[u];ye(o,h.doc)==-1&&(h.parent=null,a.markers.splice(u--,1))}},n=0;n<e.length;n++)t(n)}var Lg=0,Et=function(e,t,n,r,a){if(!(this instanceof Et))return new Et(e,t,n,r,a);n==null&&(n=0),_i.call(this,[new Li([new En("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=R(n,0);this.sel=zr(o),this.history=new xa(null),this.id=++Lg,this.modeOption=t,this.lineSep=r,this.direction=a=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Us(this,{from:o,to:o,text:e}),yt(this,zr(o),St)};Et.prototype=Gr(_i.prototype,{constructor:Et,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=ui(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:ct(function(e){var t=R(this.first,0),n=this.first+this.size-1;Fn(this,{from:t,to:R(n,re(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&mi(this.cm,0,0),yt(this,zr(t),St)}),replaceRange:function(e,t,n,r){t=ge(this,t),n=n?ge(this,n):t,Wn(this,e,t,n,r)},getRange:function(e,t,n){var r=br(this,ge(this,e),ge(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(W(this,e))return re(this,e)},getLineNumber:function(e){return m(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=re(this,e)),ar(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ge(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:ct(function(e,t,n){Uu(this,ge(this,typeof e=="number"?R(e,t||0):e),null,n)}),setSelection:ct(function(e,t,n){Uu(this,ge(this,e),ge(this,t||e),n)}),extendSelection:ct(function(e,t,n){Sa(this,ge(this,e),t&&ge(this,t),n)}),extendSelections:ct(function(e,t){Bu(this,Nl(this,e),t)}),extendSelectionsBy:ct(function(e,t){var n=Jt(this.sel.ranges,e);Bu(this,Nl(this,n),t)}),setSelections:ct(function(e,t,n){if(e.length){for(var r=[],a=0;a<e.length;a++)r[a]=new Ie(ge(this,e[a].anchor),ge(this,e[a].head||e[a].anchor));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),yt(this,or(this.cm,r,t),n)}}),addSelection:ct(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Ie(ge(this,e),ge(this,t||e))),yt(this,or(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var a=br(this,t[r].from(),t[r].to());n=n?n.concat(a):a}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 a=br(this,n[r].from(),n[r].to());e!==!1&&(a=a.join(e||this.lineSeparator())),t[r]=a}return t},replaceSelection:function(e,t,n){for(var r=[],a=0;a<this.sel.ranges.length;a++)r[a]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:ct(function(e,t,n){for(var r=[],a=this.sel,o=0;o<a.ranges.length;o++){var u=a.ranges[o];r[o]={from:u.from(),to:u.to(),text:this.splitLines(e[o]),origin:n}}for(var h=t&&t!="end"&&dg(this,r,t),d=r.length-1;d>=0;d--)Fn(this,r[d]);h?ju(this,h):this.cm&&Mn(this.cm)}),undo:ct(function(){La(this,"undo")}),redo:ct(function(){La(this,"redo")}),undoSelection:ct(function(){La(this,"undo",!0)}),redoSelection:ct(function(){La(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 a=0;a<e.undone.length;a++)e.undone[a].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new xa(this.history),Fr(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:zn(this.history.done),undone:zn(this.history.undone)}},setHistory:function(e){var t=this.history=new xa(this.history);t.done=zn(e.done.slice(0),null,!0),t.undone=zn(e.undone.slice(0),null,!0)},setGutterMarker:ct(function(e,t,n){return Ti(this,e,"gutter",function(r){var a=r.gutterMarkers||(r.gutterMarkers={});return a[t]=n,!n&&ie(a)&&(r.gutterMarkers=null),!0})}),clearGutter:ct(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Ti(t,n,"gutter",function(){return n.gutterMarkers[e]=null,ie(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!W(this,e)||(t=e,e=re(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:ct(function(e,t,n){return Ti(this,e,t=="gutter"?"gutter":"class",function(r){var a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[a])r[a]=n;else{if(Oe(n).test(r[a]))return!1;r[a]+=" "+n}return!0})}),removeLineClass:ct(function(e,t,n){return Ti(this,e,t=="gutter"?"gutter":"class",function(r){var a=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",o=r[a];if(o)if(n==null)r[a]=null;else{var u=o.match(Oe(n));if(!u)return!1;var h=u.index+u[0].length;r[a]=o.slice(0,u.index)+(!u.index||h==o.length?"":" ")+o.slice(h)||null}else return!1;return!0})}),addLineWidget:ct(function(e,t,n){return kg(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Hn(this,ge(this,e),ge(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=ge(this,e),Hn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ge(this,e);var t=[],n=re(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var a=n[r];(a.from==null||a.from<=e.ch)&&(a.to==null||a.to>=e.ch)&&t.push(a.marker.parent||a.marker)}return t},findMarks:function(e,t,n){e=ge(this,e),t=ge(this,t);var r=[],a=e.line;return this.iter(e.line,t.line+1,function(o){var u=o.markedSpans;if(u)for(var h=0;h<u.length;h++){var d=u[h];!(d.to!=null&&a==e.line&&e.ch>=d.to||d.from==null&&a!=e.line||d.from!=null&&a==t.line&&d.from>=t.ch)&&(!n||n(d.marker))&&r.push(d.marker.parent||d.marker)}++a}),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(a){var o=a.text.length+r;if(o>e)return t=e,!0;e-=o,++n}),ge(this,R(n,t))},indexFromPos:function(e){e=ge(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 Et(ui(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 Et(ui(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}],Cg(r,af(this)),r},unlinkDoc:function(e){if(e instanceof je&&(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),Tg(af(this));break}}if(e.history==this.history){var r=[e.id];Fr(e,function(a){return r.push(a.id)},!0),e.history=new xa(null),e.history.done=zn(this.history.done,r),e.history.undone=zn(this.history.undone,r)}},iterLinkedDocs:function(e){Fr(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:ct(function(e){e!="rtl"&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&pg(this.cm))})}),Et.prototype.eachLine=Et.prototype.iter;var sf=0;function _g(e){var t=this;if(of(t),!(Ye(t,e)||kr(t.display,e))){mt(e),b&&(sf=+new Date);var n=Qr(t,e,!0),r=e.dataTransfer.files;if(!(!n||t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File)for(var a=r.length,o=Array(a),u=0,h=function(){++u==a&&ft(t,function(){n=ge(t.doc,n);var E={from:n,to:n,text:t.doc.splitLines(o.filter(function(z){return z!=null}).join(t.doc.lineSeparator())),origin:"paste"};Fn(t.doc,E),ju(t.doc,zr(ge(t.doc,n),ge(t.doc,Pr(E))))})()},d=function(E,z){if(t.options.allowDropFileTypes&&ye(t.options.allowDropFileTypes,E.type)==-1){h();return}var B=new FileReader;B.onerror=function(){return h()},B.onload=function(){var q=B.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(q)){h();return}o[z]=q,h()},B.readAsText(E)},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()),Ca(t.doc,zr(n,n)),C)for(var O=0;O<C.length;++O)Wn(t.doc,"",C[O].anchor,C[O].head,"drag");t.replaceSelection(x,"around","paste"),t.display.input.focus()}}catch{}}}}function Eg(e,t){if(b&&(!e.state.draggingText||+new Date-sf<100)){Or(t);return}if(!(Ye(e,t)||kr(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!U)){var n=T("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",F&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),F&&n.parentNode.removeChild(n)}}function Og(e,t){var n=Qr(e,t);if(n){var r=document.createDocumentFragment();As(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)),V(e.display.dragCursor,r)}}function of(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function lf(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var a=t[r].CodeMirror;a&&n.push(a)}n.length&&n[0].operation(function(){for(var o=0;o<n.length;o++)e(n[o])})}}var uf=!1;function Ag(){uf||(Ig(),uf=!0)}function Ig(){var e;oe(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,lf(Dg)},100))}),oe(window,"blur",function(){return lf(Nn)})}function Dg(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Hr={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"},Ai=0;Ai<10;Ai++)Hr[Ai+48]=Hr[Ai+96]=String(Ai);for(var _a=65;_a<=90;_a++)Hr[_a]=String.fromCharCode(_a);for(var Ii=1;Ii<=12;Ii++)Hr[Ii+111]=Hr[Ii+63235]="F"+Ii;var Cr={};Cr.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"},Cr.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"},Cr.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"},Cr.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"]},Cr.default=J?Cr.macDefault:Cr.pcDefault;function Ng(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,a,o,u=0;u<t.length-1;u++){var h=t[u];if(/^(cmd|meta|m)$/i.test(h))o=!0;else if(/^a(lt)?$/i.test(h))n=!0;else if(/^(c|ctrl|control)$/i.test(h))r=!0;else if(/^s(hift)?$/i.test(h))a=!0;else throw new Error("Unrecognized modifier name: "+h)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),o&&(e="Cmd-"+e),a&&(e="Shift-"+e),e}function Mg(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 a=Jt(n.split(" "),Ng),o=0;o<a.length;o++){var u=void 0,h=void 0;o==a.length-1?(h=a.join(" "),u=r):(h=a.slice(0,o+1).join(" "),u="...");var d=t[h];if(!d)t[h]=u;else if(d!=u)throw new Error("Inconsistent bindings for "+h)}delete e[n]}for(var v in t)e[v]=t[v];return e}function $n(e,t,n,r){t=Ea(t);var a=t.call?t.call(e,r):t[e];if(a===!1)return"nothing";if(a==="...")return"multi";if(a!=null&&n(a))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return $n(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var u=$n(e,t.fallthrough[o],n,r);if(u)return u}}}function ff(e){var t=typeof e=="string"?e:Hr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function cf(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(Me?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(Me?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function hf(e,t){if(F&&e.keyCode==34&&e.char)return!1;var n=Hr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),cf(n,e,t))}function Ea(e){return typeof e=="string"?Cr[e]:e}function Bn(e,t){for(var n=e.doc.sel.ranges,r=[],a=0;a<n.length;a++){for(var o=t(n[a]);r.length&&Z(o.from,de(r).to)<=0;){var u=r.pop();if(Z(u.from,o.from)<0){o.from=u.from;break}}r.push(o)}Mt(e,function(){for(var h=r.length-1;h>=0;h--)Wn(e.doc,"",r[h].from,r[h].to,"+delete");Mn(e)})}function Gs(e,t,n){var r=Dt(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Xs(e,t,n){var r=Gs(e,t.ch,n);return r==null?null:new R(t.line,r,n<0?"after":"before")}function Ys(e,t,n,r,a){if(e){t.doc.direction=="rtl"&&(a=-a);var o=Le(n,t.doc.direction);if(o){var u=a<0?de(o):o[0],h=a<0==(u.level==1),d=h?"after":"before",v;if(u.level>0||t.doc.direction=="rtl"){var x=An(t,n);v=a<0?n.text.length-1:0;var C=pr(t,x,v).top;v=Gt(function(O){return pr(t,x,O).top==C},a<0==(u.level==1)?u.from:u.to-1,v),d=="before"&&(v=Gs(n,v,1))}else v=a<0?u.to:u.from;return new R(r,v,d)}}return new R(r,a<0?n.text.length:0,a<0?"before":"after")}function Rg(e,t,n,r){var a=Le(t,e.doc.direction);if(!a)return Xs(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=Er(a,n.ch,n.sticky),u=a[o];if(e.doc.direction=="ltr"&&u.level%2==0&&(r>0?u.to>n.ch:u.from<n.ch))return Xs(t,n,r);var h=function(X,Q){return Gs(t,X instanceof R?X.ch:X,Q)},d,v=function(X){return e.options.lineWrapping?(d=d||An(e,t),vu(e,t,d,X)):{begin:0,end:t.text.length}},x=v(n.sticky=="before"?h(n,-1):n.ch);if(e.doc.direction=="rtl"||u.level==1){var C=u.level==1==r<0,O=h(n,C?1:-1);if(O!=null&&(C?O<=u.to&&O<=x.end:O>=u.from&&O>=x.begin)){var E=C?"before":"after";return new R(n.line,O,E)}}var z=function(X,Q,Y){for(var ee=function(We,ht){return ht?new R(n.line,h(We,1),"before"):new R(n.line,We,"after")};X>=0&&X<a.length;X+=Q){var le=a[X],ae=Q>0==(le.level!=1),xe=ae?Y.begin:h(Y.end,-1);if(le.from<=xe&&xe<le.to||(xe=ae?le.from:h(le.to,-1),Y.begin<=xe&&xe<Y.end))return ee(xe,ae)}},B=z(o+r,r,x);if(B)return B;var q=r>0?x.end:h(x.begin,-1);return q!=null&&!(r>0&&q==t.text.length)&&(B=z(r>0?0:a.length-1,r,v(q)),B)?B:null}var Di={selectAll:Yu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),St)},killLine:function(e){return Bn(e,function(t){if(t.empty()){var n=re(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:R(t.head.line+1,0)}:{from:t.head,to:R(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Bn(e,function(t){return{from:R(t.from().line,0),to:ge(e.doc,R(t.to().line+1,0))}})},delLineLeft:function(e){return Bn(e,function(t){return{from:R(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return Bn(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 Bn(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(R(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(R(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return df(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return pf(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return zg(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")},Ct)},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")},Ct)},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/)?pf(e,t.head):r},Ct)},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,a=0;a<n.length;a++){var o=n[a].from(),u=Ce(e.getLine(o.line),o.ch,r);t.push(Lr(r-u%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Mt(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)if(t[r].empty()){var a=t[r].head,o=re(e.doc,a.line).text;if(o){if(a.ch==o.length&&(a=new R(a.line,a.ch-1)),a.ch>0)a=new R(a.line,a.ch+1),e.replaceRange(o.charAt(a.ch-1)+o.charAt(a.ch-2),R(a.line,a.ch-2),a,"+transpose");else if(a.line>e.doc.first){var u=re(e.doc,a.line-1).text;u&&(a=new R(a.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+u.charAt(u.length-1),R(a.line-1,u.length-1),a,"+transpose"))}}n.push(new Ie(a,a))}e.setSelections(n)})},newlineAndIndent:function(e){return Mt(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);Mn(e)})},openLine:function(e){return e.replaceSelection(`
12
+ `,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function df(e,t){var n=re(e.doc,t),r=ar(n);return r!=n&&(t=m(r)),Ys(!0,e,r,t,1)}function zg(e,t){var n=re(e.doc,t),r=bp(n);return r!=n&&(t=m(r)),Ys(!0,e,n,t,-1)}function pf(e,t){var n=df(e,t.line),r=re(e.doc,n.line),a=Le(r,e.doc.direction);if(!a||a[0].level==0){var o=Math.max(n.ch,r.text.search(/\S/)),u=t.line==n.line&&t.ch<=o&&t.ch;return R(n.line,u?0:o,n.sticky)}return n}function Oa(e,t,n){if(typeof t=="string"&&(t=Di[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,a=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),a=t(e)!=Qt}finally{e.display.shift=r,e.state.suppressEdits=!1}return a}function Pg(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var a=$n(t,e.state.keyMaps[r],n,e);if(a)return a}return e.options.extraKeys&&$n(t,e.options.extraKeys,n,e)||$n(t,e.options.keyMap,n,e)}var Fg=new jt;function Ni(e,t,n,r){var a=e.state.keySeq;if(a){if(ff(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fg.set(50,function(){e.state.keySeq==a&&(e.state.keySeq=null,e.display.input.reset())}),gf(e,a+" "+t,n,r))return!0}return gf(e,t,n,r)}function gf(e,t,n,r){var a=Pg(e,t,r);return a=="multi"&&(e.state.keySeq=t),a=="handled"&&ut(e,"keyHandled",e,t,n),(a=="handled"||a=="multi")&&(mt(n),Is(e)),!!a}function vf(e,t){var n=hf(t,!0);return n?t.shiftKey&&!e.state.keySeq?Ni(e,"Shift-"+n,t,function(r){return Oa(e,r,!0)})||Ni(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Oa(e,r)}):Ni(e,n,t,function(r){return Oa(e,r)}):!1}function Wg(e,t,n){return Ni(e,"'"+n+"'",t,function(r){return Oa(e,r,!0)})}var Vs=null;function mf(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=N(wt(t)),!Ye(t,e))){b&&y<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=vf(t,e);F&&(Vs=r?n:null,!r&&n==88&&!na&&(J?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),c&&!J&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Hg(t)}}function Hg(e){var t=e.display.lineDiv;K(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(Re(t,"CodeMirror-crosshair"),vt(document,"keyup",n),vt(document,"mouseover",n))}oe(document,"keyup",n),oe(document,"mouseover",n)}function yf(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ye(this,e)}function bf(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(kr(t.display,e)||Ye(t,e)||e.ctrlKey&&!e.altKey||J&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(F&&n==Vs){Vs=null,mt(e);return}if(!(F&&(!e.which||e.which<10)&&vf(t,e))){var a=String.fromCharCode(r??n);a!="\b"&&(Wg(t,e,a)||t.display.input.onKeyPress(e))}}}var $g=400,Zs=function(e,t,n){this.time=e,this.pos=t,this.button=n};Zs.prototype.compare=function(e,t,n){return this.time+$g>e&&Z(t,this.pos)==0&&n==this.button};var Mi,Ri;function Bg(e,t){var n=+new Date;return Ri&&Ri.compare(n,e,t)?(Mi=Ri=null,"triple"):Mi&&Mi.compare(n,e,t)?(Ri=new Zs(n,e,t),Mi=null,"double"):(Mi=new Zs(n,e,t),Ri=null,"single")}function wf(e){var t=this,n=t.display;if(!(Ye(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,kr(n,e)){k||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!Qs(t,e)){var r=Qr(t,e),a=tr(e),o=r?Bg(r,a):"single";pe(t).focus(),a==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Ug(t,a,r,o,e))&&(a==1?r?qg(t,r,o,e):si(e)==n.scroller&&mt(e):a==2?(r&&Sa(t.doc,r),setTimeout(function(){return n.input.focus()},20)):a==3&&(Ee?t.display.input.onContextMenu(e):Ds(t)))}}}function Ug(e,t,n,r,a){var o="Click";return r=="double"?o="Double"+o:r=="triple"&&(o="Triple"+o),o=(t==1?"Left":t==2?"Middle":"Right")+o,Ni(e,cf(o,a),a,function(u){if(typeof u=="string"&&(u=Di[u]),!u)return!1;var h=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),h=u(e,n)!=Qt}finally{e.state.suppressEdits=!1}return h})}function jg(e,t,n){var r=e.getOption("configureMouse"),a=r?r(e,t,n):{};if(a.unit==null){var o=ne?n.shiftKey&&n.metaKey:n.altKey;a.unit=o?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(a.extend==null||e.doc.extend)&&(a.extend=e.doc.extend||n.shiftKey),a.addNew==null&&(a.addNew=J?n.metaKey:n.ctrlKey),a.moveOnDrag==null&&(a.moveOnDrag=!(J?n.altKey:n.ctrlKey)),a}function qg(e,t,n,r){b?setTimeout(he(wu,e),0):e.curOp.focus=N(wt(e));var a=jg(e,n,r),o=e.doc.sel,u;e.options.dragDrop&&fs&&!e.isReadOnly()&&n=="single"&&(u=o.contains(t))>-1&&(Z((u=o.ranges[u]).from(),t)<0||t.xRel>0)&&(Z(u.to(),t)>0||t.xRel<0)?Kg(e,r,t,a):Gg(e,r,t,a)}function Kg(e,t,n,r){var a=e.display,o=!1,u=ft(e,function(v){k&&(a.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ds(e)),vt(a.wrapper.ownerDocument,"mouseup",u),vt(a.wrapper.ownerDocument,"mousemove",h),vt(a.scroller,"dragstart",d),vt(a.scroller,"drop",u),o||(mt(v),r.addNew||Sa(e.doc,n,null,null,r.extend),k&&!U||b&&y==9?setTimeout(function(){a.wrapper.ownerDocument.body.focus({preventScroll:!0}),a.input.focus()},20):a.input.focus())}),h=function(v){o=o||Math.abs(t.clientX-v.clientX)+Math.abs(t.clientY-v.clientY)>=10},d=function(){return o=!0};k&&(a.scroller.draggable=!0),e.state.draggingText=u,u.copy=!r.moveOnDrag,oe(a.wrapper.ownerDocument,"mouseup",u),oe(a.wrapper.ownerDocument,"mousemove",h),oe(a.scroller,"dragstart",d),oe(a.scroller,"drop",u),e.state.delayingBlurEvent=!0,setTimeout(function(){return a.input.focus()},20),a.scroller.dragDrop&&a.scroller.dragDrop()}function xf(e,t,n){if(n=="char")return new Ie(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Ie(R(t.line,0),ge(e.doc,R(t.line+1,0)));var r=n(e,t);return new Ie(r.from,r.to)}function Gg(e,t,n,r){b&&Ds(e);var a=e.display,o=e.doc;mt(t);var u,h,d=o.sel,v=d.ranges;if(r.addNew&&!r.extend?(h=o.sel.contains(n),h>-1?u=v[h]:u=new Ie(n,n)):(u=o.sel.primary(),h=o.sel.primIndex),r.unit=="rectangle")r.addNew||(u=new Ie(n,n)),n=Qr(e,t,!0,!0),h=-1;else{var x=xf(e,n,r.unit);r.extend?u=qs(u,x.anchor,x.head,r.extend):u=x}r.addNew?h==-1?(h=v.length,yt(o,or(e,v.concat([u]),h),{scroll:!1,origin:"*mouse"})):v.length>1&&v[h].empty()&&r.unit=="char"&&!r.extend?(yt(o,or(e,v.slice(0,h).concat(v.slice(h+1)),0),{scroll:!1,origin:"*mouse"}),d=o.sel):Ks(o,h,u,qt):(h=0,yt(o,new Ht([u],0),qt),d=o.sel);var C=n;function O(Y){if(Z(C,Y)!=0)if(C=Y,r.unit=="rectangle"){for(var ee=[],le=e.options.tabSize,ae=Ce(re(o,n.line).text,n.ch,le),xe=Ce(re(o,Y.line).text,Y.ch,le),We=Math.min(ae,xe),ht=Math.max(ae,xe),Ke=Math.min(n.line,Y.line),Rt=Math.min(e.lastLine(),Math.max(n.line,Y.line));Ke<=Rt;Ke++){var Ot=re(o,Ke).text,it=Ft(Ot,We,le);We==ht?ee.push(new Ie(R(Ke,it),R(Ke,it))):Ot.length>it&&ee.push(new Ie(R(Ke,it),R(Ke,Ft(Ot,ht,le))))}ee.length||ee.push(new Ie(n,n)),yt(o,or(e,d.ranges.slice(0,h).concat(ee),h),{origin:"*mouse",scroll:!1}),e.scrollIntoView(Y)}else{var At=u,gt=xf(e,Y,r.unit),ot=At.anchor,at;Z(gt.anchor,ot)>0?(at=gt.head,ot=_n(At.from(),gt.anchor)):(at=gt.anchor,ot=Lt(At.to(),gt.head));var Ze=d.ranges.slice(0);Ze[h]=Xg(e,new Ie(ge(o,ot),at)),yt(o,or(e,Ze,h),qt)}}var E=a.wrapper.getBoundingClientRect(),z=0;function B(Y){var ee=++z,le=Qr(e,Y,!0,r.unit=="rectangle");if(le)if(Z(le,C)!=0){e.curOp.focus=N(wt(e)),O(le);var ae=ma(a,o);(le.line>=ae.to||le.line<ae.from)&&setTimeout(ft(e,function(){z==ee&&B(Y)}),150)}else{var xe=Y.clientY<E.top?-20:Y.clientY>E.bottom?20:0;xe&&setTimeout(ft(e,function(){z==ee&&(a.scroller.scrollTop+=xe,B(Y))}),50)}}function q(Y){e.state.selectingText=!1,z=1/0,Y&&(mt(Y),a.input.focus()),vt(a.wrapper.ownerDocument,"mousemove",X),vt(a.wrapper.ownerDocument,"mouseup",Q),o.history.lastSelOrigin=null}var X=ft(e,function(Y){Y.buttons===0||!tr(Y)?q(Y):B(Y)}),Q=ft(e,q);e.state.selectingText=Q,oe(a.wrapper.ownerDocument,"mousemove",X),oe(a.wrapper.ownerDocument,"mouseup",Q)}function Xg(e,t){var n=t.anchor,r=t.head,a=re(e.doc,n.line);if(Z(n,r)==0&&n.sticky==r.sticky)return t;var o=Le(a);if(!o)return t;var u=Er(o,n.ch,n.sticky),h=o[u];if(h.from!=n.ch&&h.to!=n.ch)return t;var d=u+(h.from==n.ch==(h.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=Er(o,r.ch,r.sticky),C=x-u||(r.ch-n.ch)*(h.level==1?-1:1);x==d-1||x==d?v=C<0:v=C>0}var O=o[d+(v?-1:0)],E=v==(O.level==1),z=E?O.from:O.to,B=E?"after":"before";return n.ch==z&&n.sticky==B?t:new Ie(new R(n.line,z,B),r)}function kf(e,t,n,r){var a,o;if(t.touches)a=t.touches[0].clientX,o=t.touches[0].clientY;else try{a=t.clientX,o=t.clientY}catch{return!1}if(a>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&mt(t);var u=e.display,h=u.lineDiv.getBoundingClientRect();if(o>h.bottom||!Nt(e,n))return Tt(t);o-=h.top-u.viewOffset;for(var d=0;d<e.display.gutterSpecs.length;++d){var v=u.gutters.childNodes[d];if(v&&v.getBoundingClientRect().right>=a){var x=S(e.doc,o),C=e.display.gutterSpecs[d];return Xe(e,n,e,x,C.className,t),Tt(t)}}}function Qs(e,t){return kf(e,t,"gutterClick",!0)}function Sf(e,t){kr(e.display,t)||Yg(e,t)||Ye(e,t,"contextmenu")||Ee||e.display.input.onContextMenu(t)}function Yg(e,t){return Nt(e,"gutterContextMenu")?kf(e,t,"gutterContextMenu",!1):!1}function Cf(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),gi(e)}var Un={toString:function(){return"CodeMirror.Init"}},Tf={},Aa={};function Vg(e){var t=e.optionHandlers;function n(r,a,o,u){e.defaults[r]=a,o&&(t[r]=u?function(h,d,v){v!=Un&&o(h,d,v)}:o)}e.defineOption=n,e.Init=Un,n("value","",function(r,a){return r.setValue(a)},!0),n("mode",null,function(r,a){r.doc.modeOption=a,Bs(r)},!0),n("indentUnit",2,Bs,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Si(r),gi(r),_t(r)},!0),n("lineSeparator",null,function(r,a){if(r.doc.lineSep=a,!!a){var o=[],u=r.doc.first;r.doc.iter(function(d){for(var v=0;;){var x=d.text.indexOf(a,v);if(x==-1)break;v=x+a.length,o.push(R(u,x))}u++});for(var h=o.length-1;h>=0;h--)Wn(r.doc,a,o[h],R(o[h].line,o[h].ch+a.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,a,o){r.state.specialChars=new RegExp(a.source+(a.test(" ")?"":"| "),"g"),o!=Un&&r.refresh()}),n("specialCharPlaceholder",Tp,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,a){return r.getInputField().spellcheck=a},!0),n("autocorrect",!1,function(r,a){return r.getInputField().autocorrect=a},!0),n("autocapitalize",!1,function(r,a){return r.getInputField().autocapitalize=a},!0),n("rtlMoveVisually",!te),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){Cf(r),ki(r)},!0),n("keyMap","default",function(r,a,o){var u=Ea(a),h=o!=Un&&Ea(o);h&&h.detach&&h.detach(r,u),u.attach&&u.attach(r,h||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Qg,!0),n("gutters",[],function(r,a){r.display.gutterSpecs=Hs(a,r.options.lineNumbers),ki(r)},!0),n("fixedGutter",!0,function(r,a){r.display.gutters.style.left=a?Es(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return Rn(r)},!0),n("scrollbarStyle","native",function(r){Lu(r),Rn(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,a){r.display.gutterSpecs=Hs(r.options.gutters,a),ki(r)},!0),n("firstLineNumber",1,ki,!0),n("lineNumberFormatter",function(r){return r},ki,!0),n("showCursorWhenSelecting",!1,vi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,a){a=="nocursor"&&(Nn(r),r.display.input.blur()),r.display.input.readOnlyChanged(a)}),n("screenReaderLabel",null,function(r,a){a=a===""?null:a,r.display.input.screenReaderLabelChanged(a)}),n("disableInput",!1,function(r,a){a||r.display.input.reset()},!0),n("dragDrop",!0,Zg),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,vi,!0),n("singleCursorHeightPerLine",!0,vi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Si,!0),n("addModeClass",!1,Si,!0),n("pollInterval",100),n("undoDepth",200,function(r,a){return r.doc.history.undoDepth=a}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,Si,!0),n("moveInputWithCursor",!0,function(r,a){a||r.display.input.resetPosition()}),n("tabindex",null,function(r,a){return r.display.input.getField().tabIndex=a||""}),n("autofocus",null),n("direction","ltr",function(r,a){return r.doc.setDirection(a)},!0),n("phrases",null)}function Zg(e,t,n){var r=n&&n!=Un;if(!t!=!r){var a=e.display.dragFunctions,o=t?oe:vt;o(e.display.scroller,"dragstart",a.start),o(e.display.scroller,"dragenter",a.enter),o(e.display.scroller,"dragover",a.over),o(e.display.scroller,"dragleave",a.leave),o(e.display.scroller,"drop",a.drop)}}function Qg(e){e.options.lineWrapping?(K(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Re(e.display.wrapper,"CodeMirror-wrap"),ys(e)),Os(e),_t(e),gi(e),setTimeout(function(){return Rn(e)},100)}function je(e,t){var n=this;if(!(this instanceof je))return new je(e,t);this.options=t=t?be(t):{},be(Tf,t,!1);var r=t.value;typeof r=="string"?r=new Et(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var a=new je.inputStyles[t.inputStyle](this),o=this.display=new cg(e,r,a,t);o.wrapper.CodeMirror=this,Cf(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Lu(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 jt,keySeq:null,specialChars:null},t.autofocus&&!G&&o.input.focus(),b&&y<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Jg(this),Ag(),rn(this),this.curOp.forceUpdate=!0,zu(this,r),t.autofocus&&!G||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ns(n)},20):Nn(this);for(var u in Aa)Aa.hasOwnProperty(u)&&Aa[u](this,t[u],Un);Ou(this),t.finishInit&&t.finishInit(this);for(var h=0;h<Js.length;++h)Js[h](this);nn(this),k&&t.lineWrapping&&getComputedStyle(o.lineDiv).textRendering=="optimizelegibility"&&(o.lineDiv.style.textRendering="auto")}je.defaults=Tf,je.optionHandlers=Aa;function Jg(e){var t=e.display;oe(t.scroller,"mousedown",ft(e,wf)),b&&y<11?oe(t.scroller,"dblclick",ft(e,function(d){if(!Ye(e,d)){var v=Qr(e,d);if(!(!v||Qs(e,d)||kr(e.display,d))){mt(d);var x=e.findWordAt(v);Sa(e.doc,x.anchor,x.head)}}})):oe(t.scroller,"dblclick",function(d){return Ye(e,d)||mt(d)}),oe(t.scroller,"contextmenu",function(d){return Sf(e,d)}),oe(t.input.getField(),"contextmenu",function(d){t.scroller.contains(d.target)||Sf(e,d)});var n,r={end:0};function a(){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}oe(t.scroller,"touchstart",function(d){if(!Ye(e,d)&&!o(d)&&!Qs(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)}}),oe(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),oe(t.scroller,"touchend",function(d){var v=t.activeTouch;if(v&&!kr(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 Ie(x,x):!v.prev.prev||u(v,v.prev.prev)?C=e.findWordAt(x):C=new Ie(R(x.line,0),ge(e.doc,R(x.line+1,0))),e.setSelection(C.anchor,C.head),e.focus(),mt(d)}a()}),oe(t.scroller,"touchcancel",a),oe(t.scroller,"scroll",function(){t.scroller.clientHeight&&(yi(e,t.scroller.scrollTop),en(e,t.scroller.scrollLeft,!0),Xe(e,"scroll",e))}),oe(t.scroller,"mousewheel",function(d){return Du(e,d)}),oe(t.scroller,"DOMMouseScroll",function(d){return Du(e,d)}),oe(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(d){Ye(e,d)||Or(d)},over:function(d){Ye(e,d)||(Og(e,d),Or(d))},start:function(d){return Eg(e,d)},drop:ft(e,_g),leave:function(d){Ye(e,d)||of(e)}};var h=t.input.getField();oe(h,"keyup",function(d){return yf.call(e,d)}),oe(h,"keydown",ft(e,mf)),oe(h,"keypress",ft(e,bf)),oe(h,"focus",function(d){return Ns(e,d)}),oe(h,"blur",function(d){return Nn(e,d)})}var Js=[];je.defineInitHook=function(e){return Js.push(e)};function zi(e,t,n,r){var a=e.doc,o;n==null&&(n="add"),n=="smart"&&(a.mode.indent?o=fi(e,t).state:n="prev");var u=e.options.tabSize,h=re(a,t),d=Ce(h.text,null,u);h.stateAfter&&(h.stateAfter=null);var v=h.text.match(/^\s*/)[0],x;if(!r&&!/\S/.test(h.text))x=0,n="not";else if(n=="smart"&&(x=a.mode.indent(o,h.text.slice(v.length),h.text),x==Qt||x>150)){if(!r)return;n="prev"}n=="prev"?t>a.first?x=Ce(re(a,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 E=Math.floor(x/u);E;--E)O+=u,C+=" ";if(O<x&&(C+=Lr(x-O)),C!=v)return Wn(a,C,R(t,0),R(t,v.length),"+input"),h.stateAfter=null,!0;for(var z=0;z<a.sel.ranges.length;z++){var B=a.sel.ranges[z];if(B.head.line==t&&B.head.ch<v.length){var q=R(t,v.length);Ks(a,z,new Ie(q,q));break}}}var lr=null;function Ia(e){lr=e}function eo(e,t,n,r,a){var o=e.doc;e.display.shift=!1,r||(r=o.sel);var u=+new Date-200,h=a=="paste"||e.state.pasteIncoming>u,d=Yt(t),v=null;if(h&&r.ranges.length>1)if(lr&&lr.text.join(`
13
+ `)==t){if(r.ranges.length%lr.text.length==0){v=[];for(var x=0;x<lr.text.length;x++)v.push(o.splitLines(lr.text[x]))}}else d.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(v=Jt(d,function(X){return[X]}));for(var C=e.curOp.updateInput,O=r.ranges.length-1;O>=0;O--){var E=r.ranges[O],z=E.from(),B=E.to();E.empty()&&(n&&n>0?z=R(z.line,z.ch-n):e.state.overwrite&&!h?B=R(B.line,Math.min(re(o,B.line).text.length,B.ch+de(d).length)):h&&lr&&lr.lineWise&&lr.text.join(`
14
14
  `)==d.join(`
15
- `)&&(M=F=D(M.line,0)));var U={from:M,to:F,text:v?v[O%v.length]:d,origin:i||(h?"paste":e.state.cutIncoming>u?"cut":"+input")};In(e.doc,U),et(e,"inputRead",e,U)}t&&!h&&_f(e,t),_n(e),e.curOp.updateInput<2&&(e.curOp.updateInput=C),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Lf(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 _f(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 h=0;h<o.electricChars.length;h++)if(t.indexOf(o.electricChars.charAt(h))>-1){u=Ii(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Q(e.doc,i.head.line).text.slice(0,i.head.ch))&&(u=Ii(e,i.head.line,"smart"));u&&et(e,"electricInput",e,i.head.line)}}}function Af(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:D(i,0),head:D(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 Of(){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"),I&&(e.style.border="1px solid black"),t}function ev(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)&&Ii(this,r,i,o)}),indentSelection:pt(function(r){for(var i=this.doc.sel.ranges,o=-1,u=0;u<i.length;u++){var h=i[u];if(h.empty())h.head.line>o&&(Ii(this,h.head.line,r,!0),o=h.head.line,u==this.doc.sel.primIndex&&_n(this));else{var d=h.from(),v=h.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)Ii(this,C,r);var O=this.doc.sel.ranges;d.ch==0&&i.length==O.length&&O[u].from().ch>0&&qs(this.doc,u,new be(d,O[u].to()),Ot)}}}),getTokenAt:function(r,i){return Fl(this,r,i)},getLineTokens:function(r,i){return Fl(this,D(r),i,!0)},getTokenTypeAt:function(r){r=ae(this.doc,r);var i=Rl(this,Q(this.doc,r.line)),o=0,u=(i.length-1)/2,h=r.ch,d;if(h==0)d=i[2];else for(;;){var v=o+u>>1;if((v?i[v*2-1]:0)>=h)u=v;else if(i[v*2+1]<h)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],h=this.getModeAt(r);if(typeof h[i]=="string")u[h[i]]&&o.push(u[h[i]]);else if(h[i])for(var d=0;d<h[i].length;d++){var v=u[h[i][d]];v&&o.push(v)}else h.helperType&&u[h.helperType]?o.push(u[h.helperType]):u[h.name]&&o.push(u[h.name]);for(var x=0;x<u._global.length;x++){var C=u._global[x];C.pred(h,this)&&fe(o,C.val)==-1&&o.push(C.val)}return o},getStateAfter:function(r,i){var o=this.doc;return r=Dl(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=du(this,r,i||"page"),Ts(this,r.left,r.top)},lineAtHeight:function(r,i){return r=du(this,{top:r,left:0},i||"page").top,S(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,o){var u=!1,h;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),h=Q(this.doc,r)}else h=r;return fa(this,h,{top:0,left:0},i||"page",o||u).top+(u?this.doc.height-pr(h):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,h){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="",h=="right"?(x=d.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(h=="left"?x=0:h=="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(mf),triggerOnKeyPress:pt(bf),triggerOnKeyUp:yf,triggerOnMouseDown:pt(wf),execCommand:function(r){if(_i.hasOwnProperty(r))return _i[r].call(null,this)},triggerElectric:pt(function(r){_f(this,r)}),findPosH:function(r,i,o,u){var h=1;i<0&&(h=-1,i=-i);for(var d=ae(this.doc,r),v=0;v<i&&(d=ro(this.doc,d,h,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(h){var d=ro(u,h.head,r,i,!1);return r<0?{from:d,to:h.head}:{from:h.head,to:d}})}),findPosV:function(r,i,o,u){var h=1,d=u;i<0&&(h=-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=Ef(this,C,h,o),v.hitSide)break}return v},moveV:pt(function(r,i){var o=this,u=this.doc,h=[],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),h.push(C.left);var O=Ef(o,C,r,i);return i=="page"&&x==u.sel.primary()&&Rs(o,ca(o,O,"div").top-C.top),O},Et),h.length)for(var v=0;v<u.sel.ranges.length;v++)u.sel.ranges[v].goalColumn=h[v]}),findWordAt:function(r){var i=this.doc,o=Q(i,r.line).text,u=r.ch,h=r.ch;if(o){var d=this.getHelper(r,"wordChars");(r.sticky=="before"||h==o.length)&&u?--u:++h;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(;h<o.length&&x(o.charAt(h));)++h}return new be(D(r.line,u),D(r.line,h))},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()==Ge(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:qr(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:D(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?Qp(this,r):ku(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&&fu(this);var h=this.display.viewFrom;this.doc.iter(h,this.display.viewTo,function(d){if(d.widgets){for(var v=0;v<d.widgets.length;v++)if(d.widgets[v].noHScroll){Or(o,h,"widget");break}}++h}),this.curOp.forceUpdate=!0,Pe(this,"refresh",this)}),operation:function(r){return Ct(this,r)},startOperation:function(){return Qr(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(),zu(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,h=Q(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 D(K,t.ch,t.sticky),h=Q(e,K))}function x(K){var G;if(r=="codepoint"){var V=h.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(V))G=null;else{var re=n>0?V>=55296&&V<56320:V>=56320&&V<57343;G=new D(t.line,Math.max(0,Math.min(h.text.length,t.ch+n*(re?2:1))),-n)}}else i?G=Rg(e.cm,h,t,n):G=Ks(h,t,n);if(G==null)if(!K&&v())t=Ys(i,e.cm,h,t.line,d);else return!1;else t=G;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=h.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 Ef(e,t,n,r){var i=e.doc,o=t.left,u;if(r=="page"){var h=Math.min(e.display.wrapper.clientHeight,oe(e).innerHeight||i(e).documentElement.clientHeight),d=Math.max(h-.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 Qt,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(h){for(var d=h.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(h){!o(h)||Fe(r,h)||Lf(h,r)||b<=11&&setTimeout(tt(r,function(){return t.updateFromDOM()}),20)}),te(i,"compositionstart",function(h){t.composing={data:h.data,done:!1}}),te(i,"compositionupdate",function(h){t.composing||(t.composing={data:h.data,done:!1})}),te(i,"compositionend",function(h){t.composing&&(h.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(h){if(!(!o(h)||Fe(r,h))){if(r.somethingSelected())Oa({lineWise:!1,text:r.getSelections()}),h.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var d=Af(r);Oa({lineWise:!0,text:d.text}),h.type=="cut"&&r.operation(function(){r.setSelections(d.ranges,0,Ot),r.replaceSelection("",null,"cut")})}else return;if(h.clipboardData){h.clipboardData.clearData();var v=Yt.text.join(`
18
- `);if(h.clipboardData.setData("Text",v),h.clipboardData.getData("Text")==v){h.preventDefault();return}}var x=Of(),C=x.firstChild;to(C),r.display.lineSpace.insertBefore(x,r.display.lineSpace.firstChild),C.value=Yt.text.join(`
19
- `);var O=Ge(Qe(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=bu(this.cm,!1);return e.focus=Ge(Qe(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 h=t.display.view,d=r.line>=t.display.viewFrom&&If(t,r)||{node:h[0].measure.map[2],offset:0},v=i.line<t.display.viewTo&&If(t,i);if(!v){var x=h[h.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{}_&&(!c&&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):c&&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()||Ge(Qe(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&&tv(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,Ir(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=D(r.line-1,Q(e.doc,r.line-1).length)),i.ch==Q(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=D(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var o,u,h;r.line==t.viewFrom||(o=Yr(e,r.line))==0?(u=m(t.view[0].line),h=t.view[0].node):(u=m(t.view[o].line),h=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),!h)return!1;for(var C=e.doc.splitLines(rv(e,h,x,u,v)),O=hr(e.doc,D(u,0),D(v,Q(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),G=me(O),V=Math.min(K.length-(C.length==1?_:0),G.length-(O.length==1?_:0));M<V&&K.charCodeAt(K.length-M-1)==G.charCodeAt(G.length-M-1);)++M;if(C.length==1&&O.length==1&&u==r.line)for(;_&&_>r.ch&&K.charCodeAt(K.length-M-1)==G.charCodeAt(G.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=D(u,_),J=D(v,O.length?me(O).length-M:0);if(C.length>1||C[0]||X(re,J))return Dn(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 If(e,t){var n=ks(e,t.line);if(!n||n.hidden)return null;var r=Q(e.doc,t.line),i=au(n,r,t.line),o=ge(r,e.doc.direction),u="left";if(o){var h=Sr(o,t.ch);u=h%2?"right":"left"}var d=lu(i.map,t.ch,u);return d.offset=d.collapse=="right"?d.end:d.start,d}function tv(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 rv(e,t,n,r,i){var o="",u=!1,h=e.doc.lineSeparator(),d=!1;function v(_){return function(M){return M.id==_}}function x(){u&&(o+=h,d&&(o+=h),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(D(r,0),D(i+1,0),v(+F));j.length&&(U=j[0].find(0))&&C(hr(e.doc,U.from,U.to).join(h));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 G=0;G<_.childNodes.length;G++)O(_.childNodes[G]);/^(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(D(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 nv(o,t,n)}}function nv(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!Ze(r,t))return Pn(D(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(D(m(o),o.text.length),i)}var u=t.nodeType==3?t:null,h=t;for(!u&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(u=t.firstChild,n&&(n=u.nodeValue.length));h.parentNode!=r;)h=h.parentNode;var d=e.measure,v=d.maps;function x(U,j,K){for(var G=-1;G<(v?v.length:0);G++)for(var V=G<0?d.map:v[G],re=0;re<V.length;re+=3){var J=V[re+2];if(J==U||J==j){var ce=m(G<0?e.line:e.rest[G]),Le=V[re]+K;return(K<0||J!=U)&&(Le=V[re+(K?1:0)]),D(ce,Le)}}}var C=x(u,h,n);if(C)return Pn(C,i);for(var O=h.nextSibling,_=u?u.nodeValue.length-n:0;O;O=O.nextSibling){if(C=x(O,O.firstChild,0),C)return Pn(D(C.line,C.ch-_),i);_+=O.textContent.length}for(var M=h.previousSibling,F=n;M;M=M.previousSibling){if(C=x(M,M.firstChild,-1),C)return Pn(D(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 Qt,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),I&&(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)||Lf(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 h=Af(r);Oa({lineWise:!0,text:h.text}),u.type=="cut"?r.setSelections(h.ranges,null,Ot):(n.prevInput="",i.value=h.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 h=new Event("paste");h.clipboardData=u.clipboardData,i.dispatchEvent(h)}}),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=Of(),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=bu(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"&&(!q||Ge(Qe(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,h=Math.min(r.length,i.length);u<h&&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 h=n.options.resetSelectionOnContextMenu;h&&n.doc.sel.contains(o)==-1&&tt(n,ut)(n.doc,Ir(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;
15
+ `)&&(z=B=R(z.line,0)));var q={from:z,to:B,text:v?v[O%v.length]:d,origin:a||(h?"paste":e.state.cutIncoming>u?"cut":"+input")};Fn(e.doc,q),ut(e,"inputRead",e,q)}t&&!h&&_f(e,t),Mn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=C),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Lf(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&Mt(t,function(){return eo(t,n,0,null,"paste")}),!0}function _f(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var a=n.ranges[r];if(!(a.head.ch>100||r&&n.ranges[r-1].head.line==a.head.line)){var o=e.getModeAt(a.head),u=!1;if(o.electricChars){for(var h=0;h<o.electricChars.length;h++)if(t.indexOf(o.electricChars.charAt(h))>-1){u=zi(e,a.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(re(e.doc,a.head.line).text.slice(0,a.head.ch))&&(u=zi(e,a.head.line,"smart"));u&&ut(e,"electricInput",e,a.head.line)}}}function Ef(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var a=e.doc.sel.ranges[r].head.line,o={anchor:R(a,0),head:R(a+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 Of(){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 ev(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){pe(this).focus(),this.display.input.focus()},setOption:function(r,a){var o=this.options,u=o[r];o[r]==a&&r!="mode"||(o[r]=a,t.hasOwnProperty(r)&&ft(this,t[r])(this,a,u),Xe(this,"optionChange",this,r))},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,a){this.state.keyMaps[a?"push":"unshift"](Ea(r))},removeKeyMap:function(r){for(var a=this.state.keyMaps,o=0;o<a.length;++o)if(a[o]==r||a[o].name==r)return a.splice(o,1),!0},addOverlay:xt(function(r,a){var o=r.token?r:e.getMode(this.options,r);if(o.startState)throw new Error("Overlays may not be stateful.");mn(this.state.overlays,{mode:o,modeSpec:r,opaque:a&&a.opaque,priority:a&&a.priority||0},function(u){return u.priority}),this.state.modeGen++,_t(this)}),removeOverlay:xt(function(r){for(var a=this.state.overlays,o=0;o<a.length;++o){var u=a[o].modeSpec;if(u==r||typeof r=="string"&&u.name==r){a.splice(o,1),this.state.modeGen++,_t(this);return}}}),indentLine:xt(function(r,a,o){typeof a!="string"&&typeof a!="number"&&(a==null?a=this.options.smartIndent?"smart":"prev":a=a?"add":"subtract"),W(this.doc,r)&&zi(this,r,a,o)}),indentSelection:xt(function(r){for(var a=this.doc.sel.ranges,o=-1,u=0;u<a.length;u++){var h=a[u];if(h.empty())h.head.line>o&&(zi(this,h.head.line,r,!0),o=h.head.line,u==this.doc.sel.primIndex&&Mn(this));else{var d=h.from(),v=h.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)zi(this,C,r);var O=this.doc.sel.ranges;d.ch==0&&a.length==O.length&&O[u].from().ch>0&&Ks(this.doc,u,new Ie(d,O[u].to()),St)}}}),getTokenAt:function(r,a){return Fl(this,r,a)},getLineTokens:function(r,a){return Fl(this,R(r),a,!0)},getTokenTypeAt:function(r){r=ge(this.doc,r);var a=Rl(this,re(this.doc,r.line)),o=0,u=(a.length-1)/2,h=r.ch,d;if(h==0)d=a[2];else for(;;){var v=o+u>>1;if((v?a[v*2-1]:0)>=h)u=v;else if(a[v*2+1]<h)o=v+1;else{d=a[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 a=this.doc.mode;return a.innerMode?e.innerMode(a,this.getTokenAt(r).state).mode:a},getHelper:function(r,a){return this.getHelpers(r,a)[0]},getHelpers:function(r,a){var o=[];if(!n.hasOwnProperty(a))return o;var u=n[a],h=this.getModeAt(r);if(typeof h[a]=="string")u[h[a]]&&o.push(u[h[a]]);else if(h[a])for(var d=0;d<h[a].length;d++){var v=u[h[a][d]];v&&o.push(v)}else h.helperType&&u[h.helperType]?o.push(u[h.helperType]):u[h.name]&&o.push(u[h.name]);for(var x=0;x<u._global.length;x++){var C=u._global[x];C.pred(h,this)&&ye(o,C.val)==-1&&o.push(C.val)}return o},getStateAfter:function(r,a){var o=this.doc;return r=Dl(o,r??o.first+o.size-1),fi(this,r+1,a).state},cursorCoords:function(r,a){var o,u=this.doc.sel.primary();return r==null?o=u.head:typeof r=="object"?o=ge(this.doc,r):o=r?u.from():u.to(),sr(this,o,a||"page")},charCoords:function(r,a){return da(this,ge(this.doc,r),a||"page")},coordsChar:function(r,a){return r=du(this,r,a||"page"),Ts(this,r.left,r.top)},lineAtHeight:function(r,a){return r=du(this,{top:r,left:0},a||"page").top,S(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,a,o){var u=!1,h;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),h=re(this.doc,r)}else h=r;return ha(this,h,{top:0,left:0},a||"page",o||u).top+(u?this.doc.height-xr(h):0)},defaultTextHeight:function(){return In(this.display)},defaultCharWidth:function(){return Dn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,a,o,u,h){var d=this.display;r=sr(this,ge(this.doc,r));var v=r.bottom,x=r.left;if(a.style.position="absolute",a.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(a),d.sizer.appendChild(a),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+a.offsetHeight>C)&&r.top>a.offsetHeight?v=r.top-a.offsetHeight:r.bottom+a.offsetHeight<=C&&(v=r.bottom),x+a.offsetWidth>O&&(x=O-a.offsetWidth)}a.style.top=v+"px",a.style.left=a.style.right="",h=="right"?(x=d.sizer.clientWidth-a.offsetWidth,a.style.right="0px"):(h=="left"?x=0:h=="middle"&&(x=(d.sizer.clientWidth-a.offsetWidth)/2),a.style.left=x+"px"),o&&Zp(this,{left:x,top:v,right:x+a.offsetWidth,bottom:v+a.offsetHeight})},triggerOnKeyDown:xt(mf),triggerOnKeyPress:xt(bf),triggerOnKeyUp:yf,triggerOnMouseDown:xt(wf),execCommand:function(r){if(Di.hasOwnProperty(r))return Di[r].call(null,this)},triggerElectric:xt(function(r){_f(this,r)}),findPosH:function(r,a,o,u){var h=1;a<0&&(h=-1,a=-a);for(var d=ge(this.doc,r),v=0;v<a&&(d=ro(this.doc,d,h,o,u),!d.hitSide);++v);return d},moveH:xt(function(r,a){var o=this;this.extendSelectionsBy(function(u){return o.display.shift||o.doc.extend||u.empty()?ro(o.doc,u.head,r,a,o.options.rtlMoveVisually):r<0?u.from():u.to()},Ct)}),deleteH:xt(function(r,a){var o=this.doc.sel,u=this.doc;o.somethingSelected()?u.replaceSelection("",null,"+delete"):Bn(this,function(h){var d=ro(u,h.head,r,a,!1);return r<0?{from:d,to:h.head}:{from:h.head,to:d}})}),findPosV:function(r,a,o,u){var h=1,d=u;a<0&&(h=-1,a=-a);for(var v=ge(this.doc,r),x=0;x<a;++x){var C=sr(this,v,"div");if(d==null?d=C.left:C.left=d,v=Af(this,C,h,o),v.hitSide)break}return v},moveV:xt(function(r,a){var o=this,u=this.doc,h=[],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=sr(o,x.head,"div");x.goalColumn!=null&&(C.left=x.goalColumn),h.push(C.left);var O=Af(o,C,r,a);return a=="page"&&x==u.sel.primary()&&Rs(o,da(o,O,"div").top-C.top),O},Ct),h.length)for(var v=0;v<u.sel.ranges.length;v++)u.sel.ranges[v].goalColumn=h[v]}),findWordAt:function(r){var a=this.doc,o=re(a,r.line).text,u=r.ch,h=r.ch;if(o){var d=this.getHelper(r,"wordChars");(r.sticky=="before"||h==o.length)&&u?--u:++h;for(var v=o.charAt(u),x=ce(v,d)?function(C){return ce(C,d)}:/\s/.test(v)?function(C){return/\s/.test(C)}:function(C){return!/\s/.test(C)&&!ce(C)};u>0&&x(o.charAt(u-1));)--u;for(;h<o.length&&x(o.charAt(h));)++h}return new Ie(R(r.line,u),R(r.line,h))},toggleOverwrite:function(r){r!=null&&r==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?K(this.display.cursorDiv,"CodeMirror-overwrite"):Re(this.display.cursorDiv,"CodeMirror-overwrite"),Xe(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==N(wt(this))},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:xt(function(r,a){mi(this,r,a)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-dr(this)-this.display.barHeight,width:r.scrollWidth-dr(this)-this.display.barWidth,clientHeight:xs(this),clientWidth:Vr(this)}},scrollIntoView:xt(function(r,a){r==null?(r={from:this.doc.sel.primary().head,to:null},a==null&&(a=this.options.cursorScrollMargin)):typeof r=="number"?r={from:R(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=a||0,r.from.line!=null?Qp(this,r):ku(this,r.from,r.to,r.margin)}),setSize:xt(function(r,a){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)),a!=null&&(this.display.wrapper.style.height=u(a)),this.options.lineWrapping&&fu(this);var h=this.display.viewFrom;this.doc.iter(h,this.display.viewTo,function(d){if(d.widgets){for(var v=0;v<d.widgets.length;v++)if(d.widgets[v].noHScroll){Mr(o,h,"widget");break}}++h}),this.curOp.forceUpdate=!0,Xe(this,"refresh",this)}),operation:function(r){return Mt(this,r)},startOperation:function(){return rn(this)},endOperation:function(){return nn(this)},refresh:xt(function(){var r=this.display.cachedTextHeight;_t(this),this.curOp.forceUpdate=!0,gi(this),mi(this,this.doc.scrollLeft,this.doc.scrollTop),Fs(this.display),(r==null||Math.abs(r-In(this.display))>.5||this.options.lineWrapping)&&Os(this),Xe(this,"refresh",this)}),swapDoc:xt(function(r){var a=this.doc;return a.cm=null,this.state.selectingText&&this.state.selectingText(),zu(this,r),gi(this),this.display.input.reset(),mi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,ut(this,"swapDoc",this,a),a}),phrase:function(r){var a=this.options.phrases;return a&&Object.prototype.hasOwnProperty.call(a,r)?a[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}},er(e),e.registerHelper=function(r,a,o){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][a]=o},e.registerGlobalHelper=function(r,a,o,u){e.registerHelper(r,a,u),n[r]._global.push({pred:o,val:u})}}function ro(e,t,n,r,a){var o=t,u=n,h=re(e,t.line),d=a&&e.direction=="rtl"?-n:n;function v(){var Q=t.line+d;return Q<e.first||Q>=e.first+e.size?!1:(t=new R(Q,t.ch,t.sticky),h=re(e,Q))}function x(Q){var Y;if(r=="codepoint"){var ee=h.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(ee))Y=null;else{var le=n>0?ee>=55296&&ee<56320:ee>=56320&&ee<57343;Y=new R(t.line,Math.max(0,Math.min(h.text.length,t.ch+n*(le?2:1))),-n)}}else a?Y=Rg(e.cm,h,t,n):Y=Xs(h,t,n);if(Y==null)if(!Q&&v())t=Ys(a,e.cm,h,t.line,d);else return!1;else t=Y;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=e.cm&&e.cm.getHelper(t,"wordChars"),z=!0;!(n<0&&!x(!z));z=!1){var B=h.text.charAt(t.ch)||`
16
+ `,q=ce(B,E)?"w":O&&B==`
17
+ `?"n":!O||/\s/.test(B)?null:"p";if(O&&!z&&!q&&(q="s"),C&&C!=q){n<0&&(n=1,x(),t.sticky="after");break}if(q&&(C=q),n>0&&!x(!z))break}var X=Ta(e,t,o,u,!0);return Ae(o,X)&&(X.hitSide=!0),X}function Af(e,t,n,r){var a=e.doc,o=t.left,u;if(r=="page"){var h=Math.min(e.display.wrapper.clientHeight,pe(e).innerHeight||a(e).documentElement.clientHeight),d=Math.max(h-.5*In(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>=a.height){v.hitSide=!0;break}u+=n*5}return v}var Ne=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new jt,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Ne.prototype.init=function(e){var t=this,n=this,r=n.cm,a=n.div=e.lineDiv;a.contentEditable=!0,to(a,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function o(h){for(var d=h.target;d;d=d.parentNode){if(d==a)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(d.className))break}return!1}oe(a,"paste",function(h){!o(h)||Ye(r,h)||Lf(h,r)||y<=11&&setTimeout(ft(r,function(){return t.updateFromDOM()}),20)}),oe(a,"compositionstart",function(h){t.composing={data:h.data,done:!1}}),oe(a,"compositionupdate",function(h){t.composing||(t.composing={data:h.data,done:!1})}),oe(a,"compositionend",function(h){t.composing&&(h.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),oe(a,"touchstart",function(){return n.forceCompositionEnd()}),oe(a,"input",function(){t.composing||t.readFromDOMSoon()});function u(h){if(!(!o(h)||Ye(r,h))){if(r.somethingSelected())Ia({lineWise:!1,text:r.getSelections()}),h.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var d=Ef(r);Ia({lineWise:!0,text:d.text}),h.type=="cut"&&r.operation(function(){r.setSelections(d.ranges,0,St),r.replaceSelection("",null,"cut")})}else return;if(h.clipboardData){h.clipboardData.clearData();var v=lr.text.join(`
18
+ `);if(h.clipboardData.setData("Text",v),h.clipboardData.getData("Text")==v){h.preventDefault();return}}var x=Of(),C=x.firstChild;to(C),r.display.lineSpace.insertBefore(x,r.display.lineSpace.firstChild),C.value=lr.text.join(`
19
+ `);var O=N(nt(a));Fe(C),setTimeout(function(){r.display.lineSpace.removeChild(x),O.focus(),O==a&&n.showPrimarySelection()},50)}}oe(a,"copy",u),oe(a,"cut",u)},Ne.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Ne.prototype.prepareSelection=function(){var e=bu(this.cm,!1);return e.focus=N(nt(this.div))==this.div,e},Ne.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Ne.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ne.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),a=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||a.line<t.display.viewFrom){e.removeAllRanges();return}var o=Da(t,e.anchorNode,e.anchorOffset),u=Da(t,e.focusNode,e.focusOffset);if(!(o&&!o.bad&&u&&!u.bad&&Z(_n(o,u),r)==0&&Z(Lt(o,u),a)==0)){var h=t.display.view,d=r.line>=t.display.viewFrom&&If(t,r)||{node:h[0].measure.map[2],offset:0},v=a.line<t.display.viewTo&&If(t,a);if(!v){var x=h[h.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),E;try{E=st(d.node,d.offset,v.offset,v.node)}catch{}E&&(!c&&t.state.focused?(e.collapse(d.node,d.offset),E.collapsed||(e.removeAllRanges(),e.addRange(E))):(e.removeAllRanges(),e.addRange(E)),O&&e.anchorNode==null?e.addRange(O):c&&this.startGracePeriod()),this.rememberSelection()}},Ne.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)},Ne.prototype.showMultipleSelections=function(e){V(this.cm.display.cursorDiv,e.cursors),V(this.cm.display.selectionDiv,e.selection)},Ne.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Ne.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return I(this.div,t)},Ne.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||N(nt(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ne.prototype.blur=function(){this.div.blur()},Ne.prototype.getField=function(){return this.div},Ne.prototype.supportsTouch=function(){return!0},Ne.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):Mt(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)},Ne.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Ne.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var e=this.getSelection(),t=this.cm;if(P&&_&&this.cm.display.gutterSpecs.length&&tv(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var n=Da(t,e.anchorNode,e.anchorOffset),r=Da(t,e.focusNode,e.focusOffset);n&&r&&Mt(t,function(){yt(t.doc,zr(n,r),St),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},Ne.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(),a=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=R(r.line-1,re(e.doc,r.line-1).length)),a.ch==re(e.doc,a.line).text.length&&a.line<e.lastLine()&&(a=R(a.line+1,0)),r.line<t.viewFrom||a.line>t.viewTo-1)return!1;var o,u,h;r.line==t.viewFrom||(o=Jr(e,r.line))==0?(u=m(t.view[0].line),h=t.view[0].node):(u=m(t.view[o].line),h=t.view[o-1].node.nextSibling);var d=Jr(e,a.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),!h)return!1;for(var C=e.doc.splitLines(rv(e,h,x,u,v)),O=br(e.doc,R(u,0),R(v,re(e.doc,v).text.length));C.length>1&&O.length>1;)if(de(C)==de(O))C.pop(),O.pop(),v--;else if(C[0]==O[0])C.shift(),O.shift(),u++;else break;for(var E=0,z=0,B=C[0],q=O[0],X=Math.min(B.length,q.length);E<X&&B.charCodeAt(E)==q.charCodeAt(E);)++E;for(var Q=de(C),Y=de(O),ee=Math.min(Q.length-(C.length==1?E:0),Y.length-(O.length==1?E:0));z<ee&&Q.charCodeAt(Q.length-z-1)==Y.charCodeAt(Y.length-z-1);)++z;if(C.length==1&&O.length==1&&u==r.line)for(;E&&E>r.ch&&Q.charCodeAt(Q.length-z-1)==Y.charCodeAt(Y.length-z-1);)E--,z++;C[C.length-1]=Q.slice(0,Q.length-z).replace(/^\u200b+/,""),C[0]=C[0].slice(E).replace(/\u200b+$/,"");var le=R(u,E),ae=R(v,O.length?de(O).length-z:0);if(C.length>1||C[0]||Z(le,ae))return Wn(e.doc,C,le,ae,"+input"),!0},Ne.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ne.prototype.reset=function(){this.forceCompositionEnd()},Ne.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Ne.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))},Ne.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Mt(this.cm,function(){return _t(e.cm)})},Ne.prototype.setUneditable=function(e){e.contentEditable="false"},Ne.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ft(this.cm,eo)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Ne.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Ne.prototype.onContextMenu=function(){},Ne.prototype.resetPosition=function(){},Ne.prototype.needsContentAttribute=!0;function If(e,t){var n=ks(e,t.line);if(!n||n.hidden)return null;var r=re(e.doc,t.line),a=au(n,r,t.line),o=Le(r,e.doc.direction),u="left";if(o){var h=Er(o,t.ch);u=h%2?"right":"left"}var d=lu(a.map,t.ch,u);return d.offset=d.collapse=="right"?d.end:d.start,d}function tv(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function jn(e,t){return t&&(e.bad=!0),e}function rv(e,t,n,r,a){var o="",u=!1,h=e.doc.lineSeparator(),d=!1;function v(E){return function(z){return z.id==E}}function x(){u&&(o+=h,d&&(o+=h),u=d=!1)}function C(E){E&&(x(),o+=E)}function O(E){if(E.nodeType==1){var z=E.getAttribute("cm-text");if(z){C(z);return}var B=E.getAttribute("cm-marker"),q;if(B){var X=e.findMarks(R(r,0),R(a+1,0),v(+B));X.length&&(q=X[0].find(0))&&C(br(e.doc,q.from,q.to).join(h));return}if(E.getAttribute("contenteditable")=="false")return;var Q=/^(pre|div|p|li|table|br)$/i.test(E.nodeName);if(!/^br$/i.test(E.nodeName)&&E.textContent.length==0)return;Q&&x();for(var Y=0;Y<E.childNodes.length;Y++)O(E.childNodes[Y]);/^(pre|p)$/i.test(E.nodeName)&&(d=!0),Q&&(u=!0)}else E.nodeType==3&&C(E.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;O(t),t!=n;)t=t.nextSibling,d=!1;return o}function Da(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return jn(e.clipPos(R(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 a=0;a<e.display.view.length;a++){var o=e.display.view[a];if(o.node==r)return nv(o,t,n)}}function nv(e,t,n){var r=e.text.firstChild,a=!1;if(!t||!I(r,t))return jn(R(m(e.line),0),!0);if(t==r&&(a=!0,t=r.childNodes[n],n=0,!t)){var o=e.rest?de(e.rest):e.line;return jn(R(m(o),o.text.length),a)}var u=t.nodeType==3?t:null,h=t;for(!u&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(u=t.firstChild,n&&(n=u.nodeValue.length));h.parentNode!=r;)h=h.parentNode;var d=e.measure,v=d.maps;function x(q,X,Q){for(var Y=-1;Y<(v?v.length:0);Y++)for(var ee=Y<0?d.map:v[Y],le=0;le<ee.length;le+=3){var ae=ee[le+2];if(ae==q||ae==X){var xe=m(Y<0?e.line:e.rest[Y]),We=ee[le]+Q;return(Q<0||ae!=q)&&(We=ee[le+(Q?1:0)]),R(xe,We)}}}var C=x(u,h,n);if(C)return jn(C,a);for(var O=h.nextSibling,E=u?u.nodeValue.length-n:0;O;O=O.nextSibling){if(C=x(O,O.firstChild,0),C)return jn(R(C.line,C.ch-E),a);E+=O.textContent.length}for(var z=h.previousSibling,B=n;z;z=z.previousSibling){if(C=x(z,z.firstChild,-1),C)return jn(R(C.line,C.ch+B),a);B+=z.textContent.length}}var et=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new jt,this.hasSelection=!1,this.composing=null,this.resetting=!1};et.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var a=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),D&&(a.style.width="0px"),oe(a,"input",function(){b&&y>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),oe(a,"paste",function(u){Ye(r,u)||Lf(u,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())});function o(u){if(!Ye(r,u)){if(r.somethingSelected())Ia({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var h=Ef(r);Ia({lineWise:!0,text:h.text}),u.type=="cut"?r.setSelections(h.ranges,null,St):(n.prevInput="",a.value=h.text.join(`
20
+ `),Fe(a))}else return;u.type=="cut"&&(r.state.cutIncoming=+new Date)}}oe(a,"cut",o),oe(a,"copy",o),oe(e.scroller,"paste",function(u){if(!(kr(e,u)||Ye(r,u))){if(!a.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var h=new Event("paste");h.clipboardData=u.clipboardData,a.dispatchEvent(h)}}),oe(e.lineSpace,"selectstart",function(u){kr(e,u)||mt(u)}),oe(a,"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"})}}),oe(a,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},et.prototype.createField=function(e){this.wrapper=Of(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;to(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},et.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},et.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=bu(e);if(e.options.moveInputWithCursor){var a=sr(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,a.top+u.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,a.left+u.left-o.left))}return r},et.prototype.showSelection=function(e){var t=this.cm,n=t.display;V(n.cursorDiv,e.cursors),V(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},et.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&&Fe(this.textarea),b&&y>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",b&&y>=9&&(this.hasSelection=null));this.resetting=!1}},et.prototype.getField=function(){return this.textarea},et.prototype.supportsTouch=function(){return!1},et.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!G||N(nt(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},et.prototype.blur=function(){this.textarea.blur()},et.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},et.prototype.receivedFocus=function(){this.slowPoll()},et.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},et.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)},et.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Ir(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var a=n.value;if(a==r&&!t.somethingSelected())return!1;if(b&&y>=9&&this.hasSelection===a||J&&/[\uf700-\uf7ff]/.test(a))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=a.charCodeAt(0);if(o==8203&&!r&&(r="​"),o==8666)return this.reset(),this.cm.execCommand("undo")}for(var u=0,h=Math.min(r.length,a.length);u<h&&r.charCodeAt(u)==a.charCodeAt(u);)++u;return Mt(t,function(){eo(t,a.slice(u),r.length-u,null,e.composing?"*compose":null),a.length>1e3||a.indexOf(`
21
+ `)>-1?n.value=e.prevInput="":e.prevInput=a,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},et.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},et.prototype.onKeyPress=function(){b&&y>=9&&(this.hasSelection=null),this.fastPoll()},et.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,a=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=Qr(n,e),u=r.scroller.scrollTop;if(!o||F)return;var h=n.options.resetSelectionOnContextMenu;h&&n.doc.sel.contains(o)==-1&&ft(n,yt)(n.doc,zr(o),St);var d=a.style.cssText,v=t.wrapper.style.cssText,x=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",a.style.cssText=`position: absolute; width: 30px; height: 30px;
22
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,Yu)(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 iv(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=Ge(Qe(e));t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=h.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 h=De(function(d){return e.parentNode.insertBefore(d,e.nextSibling)},t);return h}function av(e){e.off=ot,e.on=te,e.wheelEventPixels=hg,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=Dr,e.scrollbarModel=Tu,e.Pos=D,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=hf,e.isModifierKey=ff,e.lookupKey=Mn,e.normalizeKeyMap=Mg,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}Zg(De),ev(De);var sv="iter insert remove copy getEditor constructor".split(" ");for(var Ia in bt.prototype)bt.prototype.hasOwnProperty(Ia)&&fe(sv,Ia)<0&&(De.prototype[Ia]=function(e){return function(){return e.apply(this.doc,arguments)}}(bt.prototype[Ia]));return Bt(bt),De.inputStyles={textarea:Ue,contenteditable:Se},De.defineMode=function(e){!De.defaults.mode&&e!="null"&&(De.defaults.mode=e),Gt.apply(this,arguments)},De.defineMIME=Gr,De.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),De.defineMIME("text/plain","null"),De.defineExtension=function(e,t){De.prototype[e]=t},De.defineDocExtension=function(e,t){bt.prototype[e]=t},De.fromTextArea=iv,av(De),De.version="5.65.20",De})}(Na)),Na.exports}(function(f,a){(function(s){s(br())})(function(s){s.defineMode("javascript",function(l,c){var g=l.indentUnit,p=c.statementIndent,y=c.jsonld,w=c.json||y,b=c.trackScope!==!1,k=c.typescript,A=c.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"),D=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:D,break:D,continue:D,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 I(m,S,z){return N=m,E=z,S}function R(m,S){var z=m.next();if(z=='"'||z=="'")return S.tokenize=q(z),S.tokenize(m,S);if(z=="."&&m.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return I("number","number");if(z=="."&&m.match(".."))return I("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(z))return I(z);if(z=="="&&m.eat(">"))return I("=>","operator");if(z=="0"&&m.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return I("number","number");if(/\d/.test(z))return m.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),I("number","number");if(z=="/")return m.eat("*")?(S.tokenize=Z,Z(m,S)):m.eat("/")?(m.skipToEnd(),I("comment","comment")):It(m,S,1)?($(m),m.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),I("regexp","string-2")):(m.eat("="),I("operator","operator",m.current()));if(z=="`")return S.tokenize=ee,ee(m,S);if(z=="#"&&m.peek()=="!")return m.skipToEnd(),I("meta","meta");if(z=="#"&&m.eatWhile(A))return I("variable","property");if(z=="<"&&m.match("!--")||z=="-"&&m.match("->")&&!/\S/.test(m.string.slice(0,m.start)))return m.skipToEnd(),I("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(".")?I("."):I("operator","operator",m.current());if(A.test(z)){m.eatWhile(A);var B=m.current();if(S.lastType!="."){if(L.propertyIsEnumerable(B)){var D=L[B];return I(D.type,D.style,B)}if(B=="async"&&m.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return I("async","keyword",B)}return I("variable","variable",B)}}function q(m){return function(S,z){var B=!1,D;if(y&&S.peek()=="@"&&S.match(P))return z.tokenize=R,I("jsonld-keyword","meta");for(;(D=S.next())!=null&&!(D==m&&!B);)B=!B&&D=="\\";return B||(z.tokenize=R),I("string","string")}}function Z(m,S){for(var z=!1,B;B=m.next();){if(B=="/"&&z){S.tokenize=R;break}z=B=="*"}return I("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 I("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 D=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(!D){++ye;break}if(--D==0){Je=="("&&(X=!0);break}}else if(mt>=3&&mt<6)++D;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&&!D){++ye;break}}X&&!D&&(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,D,X){this.indented=m,this.column=S,this.type=z,this.prev=D,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,D){var X=m.cc;for(W.state=m,W.stream=D,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 Ve(m,S.localVars);return}}c.globalVars&&!ht(m,S.globalVars)&&(S.globalVars=new Ve(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 Ve(m,S.vars),!1);else return null}function Ge(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 Ve(m,S){this.name=m,this.next=S}var $r=new Ve("this",new Ve("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 Qe(){W.state.localVars=W.state.context.vars,W.state.context=W.state.context.prev}Qe.lex=!0;function oe(m,S){var z=function(){var B=W.state,D=B.indented;if(B.lexical.type=="stat")D=B.lexical.indented;else for(var X=B.lexical;X&&X.type==")"&&X.align;X=X.prev)D=X.indented;B.lexical=new ke(D,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,Qe):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,Qe,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(Q):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,Qe):m=="case"?T(fe,he(":")):m=="default"?T(he(":")):m=="catch"?T(oe("form"),At,Qt,xe,ie,Qe):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 Qt(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(")"),qe(Ut,")"),ie,he("=>"),B,Qe);if(m=="variable")return Y(At,vt,he("=>"),B,Qe)}var D=z?er:Et;return Ee.hasOwnProperty(m)?T(D):m=="function"?T(Pt,D):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,D):m=="operator"||m=="spread"?T(z?dt:fe):m=="["?T(oe("]"),He,ie,D):m=="{"?xr(ur,"}",null,D):m=="quasi"?Y(lr,D):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,D=z==!1?fe:dt;if(m=="=>")return T(At,z?Ur:me,Qe);if(m=="operator")return/\+\+|--/.test(S)||k&&S=="!"?T(B):k&&S=="<"&&W.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?T(oe(">"),qe(ge,">"),ie,B):S=="?"?T(fe,he(":"),D):T(D);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(D)}}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?Vi: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 Vi(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(Qi);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&&Ge(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 Qi(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 qe(m,S,z){function B(D,X){if(z?z.indexOf(D)>-1:D==","){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 D==S||X==S?T():z&&z.indexOf(";")>-1?Y(m):T(he(S))}return function(D,X){return D==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),qe(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("]"),qe(ge,"]",","),ie,zt);if(m=="{")return T(oe("}"),te,ie,zt);if(m=="(")return T(qe(Fe,")"),Ji,zt);if(m=="<")return T(qe(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(">"),qe(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(">"),qe(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(Q)):Y(vt,kr,$t,fs)}function vt(m,S){if(k&&Ge(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(")"),qe(Ut,")"),ie,Sr,xe,Qe);if(k&&S=="<")return T(oe(">"),qe(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(")"),qe(Ut,")"),ie,Sr,Qe);if(k&&S=="<")return T(oe(">"),qe(Bt,">"),ie,Lr)}function ta(m,S){if(m=="keyword"||m=="variable")return W.marked="type",T(ta);if(S=="<")return T(oe(">"),qe(Bt,">"),ie)}function Ut(m,S){return S=="@"&&T(fe,Ut),m=="spread"?T(Ut):k&&Ge(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(">"),qe(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("}"),Gt,ie)}function Gt(m,S){if(m=="async"||m=="variable"&&(S=="static"||S=="get"||S=="set"||k&&Ge(S))&&W.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return W.marked="keyword",T(Gt);if(m=="variable"||W.style=="keyword")return W.marked="property",T(Gr,Gt);if(m=="number"||m=="string")return T(Gr,Gt);if(m=="[")return T(fe,kr,he("]"),Gr,Gt);if(S=="*")return W.marked="keyword",T(Gt);if(k&&m=="(")return Y(Lr,Gt);if(m==";"||m==",")return T(Gt);if(m=="}")return T();if(S=="@")return T(fe,Gt)}function Gr(m,S){if(S=="!"||S=="?")return T(Gr);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(qe(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(qe(dt,"]"))}function Q(){return Y(oe("form"),vt,he("{"),oe("}"),qe(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 It(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:c.localVars,context:c.localVars&&new ze(null,null,!1),indented:m||0};return c.globalVars&&typeof c.globalVars=="object"&&(S.globalVars=c.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,D;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!=Qe)break}for(;(B.type=="stat"||B.type=="form")&&(z=="}"||(D=m.cc[m.cc.length-1])&&(D==Et||D==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&&c.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:It,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:"[]{}"},c=s.Pos;s.defineOption("autoCloseBrackets",!1,function(E,I,R){R&&R!=s.Init&&(E.removeKeyMap(p),E.state.closeBrackets=null),I&&(y(g(I,"pairs")),E.state.closeBrackets=I,E.addKeyMap(p))});function g(E,I){return I=="pairs"&&typeof E=="string"?E:typeof E=="object"&&E[I]!=null?E[I]:l[I]}var p={Backspace:k,Enter:A};function y(E){for(var I=0;I<E.length;I++){var R=E.charAt(I),q="'"+R+"'";p[q]||(p[q]=w(R))}}y(l.pairs+"`");function w(E){return function(I){return P(I,E)}}function b(E){var I=E.state.closeBrackets;if(!I||I.override)return I;var R=E.getModeAt(E.getCursor());return R.closeBrackets||I}function k(E){var I=b(E);if(!I||E.getOption("disableInput"))return s.Pass;for(var R=g(I,"pairs"),q=E.listSelections(),Z=0;Z<q.length;Z++){if(!q[Z].empty())return s.Pass;var ee=$(E,q[Z].head);if(!ee||R.indexOf(ee)%2!=0)return s.Pass}for(var Z=q.length-1;Z>=0;Z--){var ne=q[Z].head;E.replaceRange("",c(ne.line,ne.ch-1),c(ne.line,ne.ch+1),"+delete")}}function A(E){var I=b(E),R=I&&g(I,"explode");if(!R||E.getOption("disableInput"))return s.Pass;for(var q=E.listSelections(),Z=0;Z<q.length;Z++){if(!q[Z].empty())return s.Pass;var ee=$(E,q[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),q=E.listSelections();for(var ue=0;ue<q.length;ue++){var Ee=q[ue].head.line;E.indentLine(Ee,null,!0),E.indentLine(Ee+1,null,!0)}})}function L(E,I){for(var R=[],q=E.listSelections(),Z=0,ee=0;ee<q.length;ee++){var ne=q[ee];ne.head==E.getCursor()&&(Z=ee);var ue=ne.head.ch||I>0?{line:ne.head.line,ch:ne.head.ch+I}:{line:ne.head.line-1};R.push({anchor:ue,head:ue})}E.setSelections(R,Z)}function H(E){var I=s.cmpPos(E.anchor,E.head)>0;return{anchor:new c(E.anchor.line,E.anchor.ch+(I?-1:1)),head:new c(E.head.line,E.head.ch+(I?1:-1))}}function P(E,I){var R=b(E);if(!R||E.getOption("disableInput"))return s.Pass;var q=g(R,"pairs"),Z=q.indexOf(I);if(Z==-1)return s.Pass;for(var ee=g(R,"closeBefore"),ne=g(R,"triples"),ue=q.charAt(Z+1)==I,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,c(Y.line,Y.ch+1));if(ke&&!W.empty())T="surround";else if((ue||!ke)&&ht==I)ue&&N(E,Y)?T="both":ne.indexOf(I)>=0&&E.getRange(Y,c(Y.line,Y.ch+3))==I+I+I?T="skipThree":T="skip";else if(ue&&Y.ch>1&&ne.indexOf(I)>=0&&E.getRange(c(Y.line,Y.ch-2),Y)==I+I){if(Y.ch>2&&/\bstring/.test(E.getTokenTypeAt(c(Y.line,Y.ch-2))))return s.Pass;T="addFour"}else if(ue){var st=Y.ch==0?" ":E.getRange(c(Y.line,Y.ch-1),Y);if(!s.isWordChar(ht)&&st!=I&&!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?q.charAt(Z-1):I,Ge=Z%2?I:q.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(),Ve=0;Ve<ze.length;Ve++)ze[Ve]=Ze+ze[Ve]+Ge;E.replaceSelections(ze,"around"),ze=E.listSelections().slice();for(var Ve=0;Ve<ze.length;Ve++)ze[Ve]=H(ze[Ve]);E.setSelections(ze)}else Ce=="both"?(E.replaceSelection(Ze+Ge,null),E.triggerElectric(Ze+Ge),L(E,-1)):Ce=="addFour"&&(E.replaceSelection(Ze+Ze+Ze+Ze,"before"),L(E,1))})}function $(E,I){var R=E.getRange(c(I.line,I.ch-1),c(I.line,I.ch+1));return R.length==2?R:null}function N(E,I){var R=E.getTokenAt(c(I.line,I.ch+1));return/\bstring/.test(R.type)&&R.start==I.ch&&(I.ch==0||!/\bstring/.test(E.getTokenTypeAt(I)))}})}(),function(f,a){(function(s){s(br())})(function(s){var l=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),c=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 I=p(P),R=!E&&N>=0&&I.test($.text.charAt(N))&&g[$.text.charAt(N)]||I.test($.text.charAt(N+1))&&g[$.text.charAt(++N)];if(!R)return null;var q=R.charAt(1)==">"?1:-1;if(P&&P.strict&&q>0!=(N==H.ch))return null;var Z=L.getTokenTypeAt(c(H.line,N+1)),ee=w(L,c(H.line,N+(q>0?1:0)),q,Z,P);return ee==null?null:{from:c(H.line,N),to:ee&&ee.pos,match:ee&&ee.ch==R.charAt(0),forward:q>0}}function w(L,H,P,$,N){for(var E=N&&N.maxScanLineLength||1e4,I=N&&N.maxScanLines||1e3,R=[],q=p(N),Z=P>0?Math.min(H.line+I,L.lastLine()+1):Math.max(L.firstLine()-1,H.line-I),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(q.test(ke)&&($===void 0||(L.getTokenTypeAt(c(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:c(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=[],I=L.listSelections(),R=0;R<I.length;R++){var q=I[R].empty()&&y(L,I[R].head,P);if(q&&(q.match||N!==!1)&&L.getLine(q.from.line).length<=$){var Z=q.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";E.push(L.markText(q.from,c(q.from.line,q.from.ch+1),{className:Z})),q.to&&L.getLine(q.to.line).length<=$&&E.push(L.markText(q.to,c(q.to.line,q.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 zf={exports:{}};(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 I=A(y,w);if(!I||I.to.line-I.from.line<L)return null;if(k==="fold")return I;for(var R=y.findMarksAt(I.from),q=0;q<R.length;++q)if(R[q].__isFold){if(!E)return null;I.cleared=!0,R[q].clear()}return I}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 $=c(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,I){s.signal(y,"unfold",y,E,I)}),s.signal(y,"fold",y,P.from,P.to)}}function c(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)})})})();var Pf=zf.exports;(function(f,a){(function(s){s(br(),Pf)})(function(s){s.defineOption("foldGutter",!1,function(N,E,I){I&&I!=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 c(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 c(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 I=N.findMarks(l(E,0),l(E+1,0)),R=0;R<I.length;++R)if(I[R].__isFold){var q=I[R].find(-1);if(q&&q.line===E)return I[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,I){var R=N.state.foldGutter.options,q=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,I,function(Ee){++q;var ke=null,Ce=Ee.gutterMarkers;if(Ce&&(Ce=Ce[R.gutter]),p(N,q)){if(ne&&Ce&&ne.test(Ce.className))return;ke=y(R.indicatorFolded)}else{var ct=l(q,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(),I=N.state.foldGutter;I&&(N.operation(function(){w(N,E.from,E.to)}),I.from=E.from,I.to=E.to)}function A(N,E,I){var R=N.state.foldGutter;if(R){var q=R.options;if(I==q.gutter){var Z=p(N,E);Z?Z.clear():N.foldCode(l(E,0),q)}}}function L(N,E){E=="mode"&&H(N)}function H(N){var E=N.state.foldGutter;if(E){var I=E.options;E.from=E.to=0,clearTimeout(E.changeUpdate),E.changeUpdate=setTimeout(function(){k(N)},I.foldOnChangeTimeSpan||600)}}function P(N){var E=N.state.foldGutter;if(E){var I=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)})},I.updateViewportTimeSpan||400)}}function $(N,E){var I=N.state.foldGutter;if(I){var R=E.line;R>=I.from&&R<I.to&&w(N,R,R+1)}}})})(),function(f,a){(function(s){s(br())})(function(s){function l(c){return function(g,p){var y=p.line,w=g.getLine(y);function b($){for(var N,E=p.ch,I=0;;){var R=E<=0?-1:w.lastIndexOf($[0],E-1);if(R==-1){if(I==1)break;I=1,E=w.length;continue}if(I==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(),I,R=$.ch,q;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){I=Z,q=ne;break e}}++ne}return I==null||y==I?null:{from:s.Pos(y,R),to:s.Pos(I,q)}}for(var A=[],L=0;L<c.length;L++){var H=b(c[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(c,g){function p(L){if(L<c.firstLine()||L>c.lastLine())return null;var H=c.getTokenAt(s.Pos(L,1));if(/\S/.test(H.string)||(H=c.getTokenAt(s.Pos(L,H.end+1))),H.type!="keyword"||H.string!="import")return null;for(var P=L,$=Math.min(c.lastLine(),L+10);P<=$;++P){var N=c.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:c.clipPos(s.Pos(y,w.startCh+1)),to:k}}),s.registerHelper("fold","include",function(c,g){function p(A){if(A<c.firstLine()||A>c.lastLine())return null;var L=c.getTokenAt(s.Pos(A,1));if(/\S/.test(L.string)||(L=c.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:c.clipPos(s.Pos(b))}})})}(),function(f,a){(function(s){s(br())})(function(s){function l(c,g){var p=c.getLine(g),y=p.search(/\S/);return y==-1||/\bcomment\b/.test(c.getTokenTypeAt(s.Pos(g,y+1)))?-1:s.countColumn(p,null,c.getOption("tabSize"))}s.registerHelper("fold","indent",function(c,g){var p=l(c,g.line);if(!(p<0)){for(var y=null,w=g.line+1,b=c.lastLine();w<=b;++w){var k=l(c,w);if(k!=-1)if(k>p)y=w;else break}if(y)return{from:s.Pos(g.line,c.getLine(g.line).length),to:s.Pos(y,c.getLine(y).length)}}})})}();const lo=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 uo={exports:{}};(function(f,a){(function(s,l){f.exports=l(br())})(so,function(s){return function(l){function c(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,c),y.l=!0,y.exports}var g={};return c.m=l,c.c=g,c.i=function(p){return p},c.d=function(p,y,w){c.o(p,y)||Object.defineProperty(p,y,{configurable:!1,enumerable:!0,get:w})},c.n=function(p){var y=p&&p.__esModule?function(){return p.default}:function(){return p};return c.d(y,"a",y),y},c.o=function(p,y){return Object.prototype.hasOwnProperty.call(p,y)},c.p="/",c(c.s=3)}([function(l,c){l.exports=s},function(l,c,g){Object.defineProperty(c,"__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}),c.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,c,g){Object.defineProperty(c,"__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(c,L,function(){return p[L]})}(w);var b=g(5),k=g(4),A=k(y.a,b.a,!1,null,null,null);c.default=A.exports},function(l,c,g){function p(P){return P&&P.__esModule?P:{default:P}}Object.defineProperty(c,"__esModule",{value:!0}),c.install=c.codemirror=c.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};c.default=H,c.CodeMirror=A,c.codemirror=k.default,c.install=L},function(l,c){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(I){I=I||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,I||typeof __VUE_SSR_CONTEXT__>"u"||(I=__VUE_SSR_CONTEXT__),w&&w.call(this,I),I&&I._registeredComponents&&I._registeredComponents.add(k)},P._ssrRegister=$):w&&($=w),$){var N=P.functional,E=N?P.render:P.beforeCreate;N?(P._injectStyles=$,P.render=function(I,R){return $.call(R),E(I,R)}):P.beforeCreate=E?[].concat(E,$):[$]}return{esModule:A,exports:L,options:P}}},function(l,c,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};c.a=w}])})})(uo);var Ff=uo.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 fo(f){Pr=f}const co=/[&<>"']/,Hf=new RegExp(co.source,"g"),ho=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Wf=new RegExp(ho.source,"g"),Bf={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},po=f=>Bf[f];function Lt(f,a){if(a){if(co.test(f))return f.replace(Hf,po)}else if(ho.test(f))return f.replace(Wf,po);return f}const $f=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Uf(f){return f.replace($f,(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 jf=/(^|[^\[])\^/g;function Te(f,a){let s=typeof f=="string"?f:f.source;a=a||"";const l={replace:(c,g)=>{let p=typeof g=="string"?g:g.source;return p=p.replace(jf,"$1"),s=s.replace(c,p),l},getRegex:()=>new RegExp(s,a)};return l}function go(f){try{f=encodeURI(f).replace(/%25/g,"%")}catch{return null}return f}const Wn={exec:()=>null};function vo(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 c=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(;c<l.length;c++)l[c]=l[c].trim().replace(/\\\|/g,"|");return l}function Di(f,a,s){const l=f.length;if(l===0)return"";let c=0;for(;c<l&&f.charAt(l-c-1)===a;)c++;return f.slice(0,l-c)}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 mo(f,a,s,l){const c=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:c,title:g,text:p,tokens:l.inlineTokens(p)};return l.state.inLink=!1,y}return{type:"image",raw:s,href:c,title:g,text:Lt(p)}}function qf(f,a){const s=f.match(/^(\s+)(?:```)/);if(s===null)return a;const l=s[1];return a.split(`
23
+ z-index: 1000; background: `+(b?"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=a.ownerDocument.defaultView.scrollY),r.input.focus(),k&&a.ownerDocument.defaultView.scrollTo(null,C),r.input.reset(),n.somethingSelected()||(a.value=t.prevInput=" "),t.contextMenuPending=E,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function O(){if(a.selectionStart!=null){var B=n.somethingSelected(),q="​"+(B?a.value:"");a.value="⇚",a.value=q,t.prevInput=B?"":"​",a.selectionStart=1,a.selectionEnd=q.length,r.selForContextMenu=n.doc.sel}}function E(){if(t.contextMenuPending==E&&(t.contextMenuPending=!1,t.wrapper.style.cssText=v,a.style.cssText=d,b&&y<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=u),a.selectionStart!=null)){(!b||b&&y<9)&&O();var B=0,q=function(){r.selForContextMenu==n.doc.sel&&a.selectionStart==0&&a.selectionEnd>0&&t.prevInput=="​"?ft(n,Yu)(n):B++<10?r.detectingSelectAll=setTimeout(q,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(q,200)}}if(b&&y>=9&&O(),Ee){Or(e);var z=function(){vt(window,"mouseup",z),setTimeout(E,20)};oe(window,"mouseup",z)}else setTimeout(E,50)},et.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},et.prototype.setUneditable=function(){},et.prototype.needsContentAttribute=!1;function iv(e,t){if(t=t?be(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=N(nt(e));t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=h.getValue()}var a;if(e.form&&(oe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;a=o.submit;try{var u=o.submit=function(){r(),o.submit=a,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&&(vt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=a))}},e.style.display="none";var h=je(function(d){return e.parentNode.insertBefore(d,e.nextSibling)},t);return h}function av(e){e.off=vt,e.on=oe,e.wheelEventPixels=hg,e.Doc=Et,e.splitLines=Yt,e.countColumn=Ce,e.findColumn=Ft,e.isWordChar=ue,e.Pass=Qt,e.signal=Xe,e.Line=En,e.changeEnd=Pr,e.scrollbarModel=Tu,e.Pos=R,e.cmpPos=Z,e.modes=kn,e.mimeModes=nr,e.resolveMode=Sn,e.getMode=Cn,e.modeExtensions=Dr,e.extendMode=Tn,e.copyState=cr,e.startState=Ln,e.innerMode=li,e.commands=Di,e.keyMap=Cr,e.keyName=hf,e.isModifierKey=ff,e.lookupKey=$n,e.normalizeKeyMap=Mg,e.StringStream=Ve,e.SharedTextMarker=Oi,e.TextMarker=Wr,e.LineWidget=Ei,e.e_preventDefault=mt,e.e_stopPropagation=wn,e.e_stop=Or,e.addClass=K,e.contains=I,e.rmClass=Re,e.keyNames=Hr}Vg(je),ev(je);var sv="iter insert remove copy getEditor constructor".split(" ");for(var Na in Et.prototype)Et.prototype.hasOwnProperty(Na)&&ye(sv,Na)<0&&(je.prototype[Na]=function(e){return function(){return e.apply(this.doc,arguments)}}(Et.prototype[Na]));return er(Et),je.inputStyles={textarea:et,contenteditable:Ne},je.defineMode=function(e){!je.defaults.mode&&e!="null"&&(je.defaults.mode=e),ir.apply(this,arguments)},je.defineMIME=Yr,je.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),je.defineMIME("text/plain","null"),je.defineExtension=function(e,t){je.prototype[e]=t},je.defineDocExtension=function(e,t){Et.prototype[e]=t},je.fromTextArea=iv,av(je),je.version="5.65.20",je})}(Ra)),Ra.exports}(function(f,i){(function(s){s(vr())})(function(s){s.defineMode("javascript",function(l,c){var g=l.indentUnit,p=c.statementIndent,w=c.jsonld,b=c.json||w,y=c.trackScope!==!1,k=c.typescript,L=c.wordCharacters||/[\w$\xa1-\uffff]/,_=function(){function m(lt){return{type:lt,style:"keyword"}}var S=m("keyword a"),W=m("keyword b"),j=m("keyword c"),R=m("keyword d"),Z=m("operator"),Ae={type:"atom",style:"atom"};return{if:m("if"),while:S,with:S,else:W,do:W,try:W,finally:W,return:R,break:R,continue:R,new:m("new"),delete:j,void:j,throw:j,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:Z,typeof:Z,instanceof:Z,true:Ae,false:Ae,null:Ae,undefined:Ae,NaN:Ae,Infinity:Ae,this:m("this"),class:m("class"),super:m("atom"),yield:j,export:m("export"),import:m("import"),extends:j,await:j}}(),H=/[+\-*&%=<>!?|~^@]/,F=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function U(m){for(var S=!1,W,j=!1;(W=m.next())!=null;){if(!S){if(W=="/"&&!j)return;W=="["?j=!0:j&&W=="]"&&(j=!1)}S=!S&&W=="\\"}}var M,A;function D(m,S,W){return M=m,A=W,S}function P(m,S){var W=m.next();if(W=='"'||W=="'")return S.tokenize=G(W),S.tokenize(m,S);if(W=="."&&m.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return D("number","number");if(W=="."&&m.match(".."))return D("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(W))return D(W);if(W=="="&&m.eat(">"))return D("=>","operator");if(W=="0"&&m.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return D("number","number");if(/\d/.test(W))return m.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),D("number","number");if(W=="/")return m.eat("*")?(S.tokenize=J,J(m,S)):m.eat("/")?(m.skipToEnd(),D("comment","comment")):Wt(m,S,1)?(U(m),m.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),D("regexp","string-2")):(m.eat("="),D("operator","operator",m.current()));if(W=="`")return S.tokenize=ne,ne(m,S);if(W=="#"&&m.peek()=="!")return m.skipToEnd(),D("meta","meta");if(W=="#"&&m.eatWhile(L))return D("variable","property");if(W=="<"&&m.match("!--")||W=="-"&&m.match("->")&&!/\S/.test(m.string.slice(0,m.start)))return m.skipToEnd(),D("comment","comment");if(H.test(W))return(W!=">"||!S.lexical||S.lexical.type!=">")&&(m.eat("=")?(W=="!"||W=="=")&&m.eat("="):/[<>*+\-|&?]/.test(W)&&(m.eat(W),W==">"&&m.eat(W))),W=="?"&&m.eat(".")?D("."):D("operator","operator",m.current());if(L.test(W)){m.eatWhile(L);var j=m.current();if(S.lastType!="."){if(_.propertyIsEnumerable(j)){var R=_[j];return D(R.type,R.style,j)}if(j=="async"&&m.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return D("async","keyword",j)}return D("variable","variable",j)}}function G(m){return function(S,W){var j=!1,R;if(w&&S.peek()=="@"&&S.match(F))return W.tokenize=P,D("jsonld-keyword","meta");for(;(R=S.next())!=null&&!(R==m&&!j);)j=!j&&R=="\\";return j||(W.tokenize=P),D("string","string")}}function J(m,S){for(var W=!1,j;j=m.next();){if(j=="/"&&W){S.tokenize=P;break}W=j=="*"}return D("comment","comment")}function ne(m,S){for(var W=!1,j;(j=m.next())!=null;){if(!W&&(j=="`"||j=="$"&&m.eat("{"))){S.tokenize=P;break}W=!W&&j=="\\"}return D("quasi","string-2",m.current())}var te="([{}])";function fe(m,S){S.fatArrowAt&&(S.fatArrowAt=null);var W=m.string.indexOf("=>",m.start);if(!(W<0)){if(k){var j=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(m.string.slice(m.start,W));j&&(W=j.index)}for(var R=0,Z=!1,Ae=W-1;Ae>=0;--Ae){var lt=m.string.charAt(Ae),Lt=te.indexOf(lt);if(Lt>=0&&Lt<3){if(!R){++Ae;break}if(--R==0){lt=="("&&(Z=!0);break}}else if(Lt>=3&&Lt<6)++R;else if(L.test(lt))Z=!0;else if(/["'\/`]/.test(lt))for(;;--Ae){if(Ae==0)return;var _n=m.string.charAt(Ae-1);if(_n==lt&&m.string.charAt(Ae-2)!="\\"){Ae--;break}}else if(Z&&!R){++Ae;break}}Z&&!R&&(S.fatArrowAt=Ae)}}var Me={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function Ee(m,S,W,j,R,Z){this.indented=m,this.column=S,this.type=W,this.prev=R,this.info=Z,j!=null&&(this.align=j)}function Oe(m,S){if(!y)return!1;for(var W=m.localVars;W;W=W.next)if(W.name==S)return!0;for(var j=m.context;j;j=j.prev)for(var W=j.vars;W;W=W.next)if(W.name==S)return!0}function Re(m,S,W,j,R){var Z=m.cc;for($.state=m,$.stream=R,$.marked=null,$.cc=Z,$.style=S,m.lexical.hasOwnProperty("align")||(m.lexical.align=!0);;){var Ae=Z.length?Z.pop():b?ye:Ce;if(Ae(W,j)){for(;Z.length&&Z[Z.length-1].lex;)Z.pop()();return $.marked?$.marked:W=="variable"&&Oe(m,j)?"variable-2":S}}}var $={state:null,marked:null,cc:null};function V(){for(var m=arguments.length-1;m>=0;m--)$.cc.push(arguments[m])}function T(){return V.apply(null,arguments),!0}function rt(m,S){for(var W=S;W;W=W.next)if(W.name==m)return!0;return!1}function st(m){var S=$.state;if($.marked="def",!!y){if(S.context){if(S.lexical.info=="var"&&S.context&&S.context.block){var W=I(m,S.context);if(W!=null){S.context=W;return}}else if(!rt(m,S.localVars)){S.localVars=new se(m,S.localVars);return}}c.globalVars&&!rt(m,S.globalVars)&&(S.globalVars=new se(m,S.globalVars))}}function I(m,S){if(S)if(S.block){var W=I(m,S.prev);return W?W==S.prev?S:new K(W,S.vars,!0):null}else return rt(m,S.vars)?S:new K(S.prev,new se(m,S.vars),!1);else return null}function N(m){return m=="public"||m=="private"||m=="protected"||m=="abstract"||m=="readonly"}function K(m,S,W){this.prev=m,this.vars=S,this.block=W}function se(m,S){this.name=m,this.next=S}var Fe=new se("this",new se("arguments",null));function ze(){$.state.context=new K($.state.context,$.state.localVars,!1),$.state.localVars=Fe}function wt(){$.state.context=new K($.state.context,$.state.localVars,!0),$.state.localVars=null}ze.lex=wt.lex=!0;function nt(){$.state.localVars=$.state.context.vars,$.state.context=$.state.context.prev}nt.lex=!0;function pe(m,S){var W=function(){var j=$.state,R=j.indented;if(j.lexical.type=="stat")R=j.lexical.indented;else for(var Z=j.lexical;Z&&Z.type==")"&&Z.align;Z=Z.prev)R=Z.indented;j.lexical=new Ee(R,$.stream.column(),m,null,j.lexical,S)};return W.lex=!0,W}function he(){var m=$.state;m.lexical.prev&&(m.lexical.type==")"&&(m.indented=m.lexical.indented),m.lexical=m.lexical.prev)}he.lex=!0;function be(m){function S(W){return W==m?T():m==";"||W=="}"||W==")"||W=="]"?V():T(S)}return S}function Ce(m,S){return m=="var"?T(pe("vardef",S),wn,be(";"),he):m=="keyword a"?T(pe("form"),Qt,Ce,he):m=="keyword b"?T(pe("form"),Ce,he):m=="keyword d"?$.stream.match(/^\s*$/,!1)?T():T(pe("stat"),qt,be(";"),he):m=="debugger"?T(be(";")):m=="{"?T(pe("}"),wt,Gt,he,nt):m==";"?T():m=="if"?($.state.lexical.info=="else"&&$.state.cc[$.state.cc.length-1]==he&&$.state.cc.pop()(),T(pe("form"),Qt,Ce,he,xn)):m=="function"?T(Yt):m=="for"?T(pe("form"),wt,ra,Ce,nt,he):m=="class"||k&&S=="interface"?($.marked="keyword",T(pe("form",m=="class"?m:S),kn,he)):m=="variable"?k&&S=="declare"?($.marked="keyword",T(Ce)):k&&(S=="module"||S=="enum"||S=="type")&&$.stream.match(/^\s*\w/,!1)?($.marked="keyword",S=="enum"?T(re):S=="type"?T(na,be("operator"),Le,be(";")):T(pe("form"),Tt,be("{"),pe("}"),Gt,he,he)):k&&S=="namespace"?($.marked="keyword",T(pe("form"),ye,Ce,he)):k&&S=="abstract"?($.marked="keyword",T(Ce)):T(pe("stat"),bn):m=="switch"?T(pe("form"),Qt,be("{"),pe("}","switch"),wt,Gt,he,he,nt):m=="case"?T(ye,be(":")):m=="default"?T(be(":")):m=="catch"?T(pe("form"),ze,jt,Ce,he,nt):m=="export"?T(pe("stat"),Sn,he):m=="import"?T(pe("stat"),Dr,he):m=="async"?T(Ce):S=="@"?T(ye,Ce):V(pe("stat"),ye,be(";"),he)}function jt(m){if(m=="(")return T(rr,be(")"))}function ye(m,S){return St(m,S,!1)}function pt(m,S){return St(m,S,!0)}function Qt(m){return m!="("?V():T(pe(")"),qt,be(")"),he)}function St(m,S,W){if($.state.fatArrowAt==$.stream.start){var j=W?Jt:de;if(m=="(")return T(ze,pe(")"),we(rr,")"),he,be("=>"),j,nt);if(m=="variable")return V(ze,Tt,be("=>"),j,nt)}var R=W?Ft:Ct;return Me.hasOwnProperty(m)?T(R):m=="function"?T(Yt,R):m=="class"||k&&S=="interface"?($.marked="keyword",T(pe("form"),cs,he)):m=="keyword c"||m=="async"?T(W?pt:ye):m=="("?T(pe(")"),qt,be(")"),he,R):m=="operator"||m=="spread"?T(W?pt:ye):m=="["?T(pe("]"),Ve,he,R):m=="{"?Dt(ce,"}",null,R):m=="quasi"?V(Kt,R):m=="new"?T(mn(W)):T()}function qt(m){return m.match(/[;\}\)\],]/)?V():V(ye)}function Ct(m,S){return m==","?T(qt):Ft(m,S,!1)}function Ft(m,S,W){var j=W==!1?Ct:Ft,R=W==!1?ye:pt;if(m=="=>")return T(ze,W?Jt:de,nt);if(m=="operator")return/\+\+|--/.test(S)||k&&S=="!"?T(j):k&&S=="<"&&$.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?T(pe(">"),we(Le,">"),he,j):S=="?"?T(ye,be(":"),R):T(R);if(m=="quasi")return V(Kt,j);if(m!=";"){if(m=="(")return Dt(pt,")","call",j);if(m==".")return T(ue,j);if(m=="[")return T(pe("]"),qt,be("]"),he,j);if(k&&S=="as")return $.marked="keyword",T(Le,j);if(m=="regexp")return $.state.lastType=$.marked="operator",$.stream.backUp($.stream.pos-$.stream.start-1),T(R)}}function Kt(m,S){return m!="quasi"?V():S.slice(S.length-2)!="${"?T(Kt):T(qt,Lr)}function Lr(m){if(m=="}")return $.marked="string-2",$.state.tokenize=ne,T(Kt)}function de(m){return fe($.stream,$.state),V(m=="{"?Ce:ye)}function Jt(m){return fe($.stream,$.state),V(m=="{"?Ce:pt)}function mn(m){return function(S){return S=="."?T(m?Gr:yn):S=="variable"&&k?T(Nt,m?Ft:Ct):V(m?pt:ye)}}function yn(m,S){if(S=="target")return $.marked="keyword",T(Ct)}function Gr(m,S){if(S=="target")return $.marked="keyword",T(Ft)}function bn(m){return m==":"?T(he,Ce):V(Ct,be(";"),he)}function ue(m){if(m=="variable")return $.marked="property",T()}function ce(m,S){if(m=="async")return $.marked="property",T(ce);if(m=="variable"||$.style=="keyword"){if($.marked="property",S=="get"||S=="set")return T(ie);var W;return k&&$.state.fatArrowAt==$.stream.start&&(W=$.stream.match(/^\s*:\s*/,!1))&&($.state.fatArrowAt=$.stream.pos+W[0].length),T(Te)}else{if(m=="number"||m=="string")return $.marked=w?"property":$.style+" property",T(Te);if(m=="jsonld-keyword")return T(Te);if(k&&N(S))return $.marked="keyword",T(ce);if(m=="[")return T(ye,_r,be("]"),Te);if(m=="spread")return T(pt,Te);if(S=="*")return $.marked="keyword",T(ce);if(m==":")return V(Te)}}function ie(m){return m!="variable"?V(Te):($.marked="property",T(Yt))}function Te(m){if(m==":")return T(pt);if(m=="(")return V(Yt)}function we(m,S,W){function j(R,Z){if(W?W.indexOf(R)>-1:R==","){var Ae=$.state.lexical;return Ae.info=="call"&&(Ae.pos=(Ae.pos||0)+1),T(function(lt,Lt){return lt==S||Lt==S?V():V(m)},j)}return R==S||Z==S?T():W&&W.indexOf(";")>-1?V(m):T(be(S))}return function(R,Z){return R==S||Z==S?T():V(m,j)}}function Dt(m,S,W){for(var j=3;j<arguments.length;j++)$.cc.push(arguments[j]);return T(pe(S,W),we(m,S),he)}function Gt(m){return m=="}"?T():V(Ce,Gt)}function _r(m,S){if(k){if(m==":")return T(Le);if(S=="?")return T(_r)}}function Xr(m,S){if(k&&(m==":"||S=="in"))return T(Le)}function Er(m){if(k&&m==":")return $.stream.match(/^\s*\w+\s+is\b/,!1)?T(ye,us,Le):T(Le)}function us(m,S){if(S=="is")return $.marked="keyword",T()}function Le(m,S){if(S=="keyof"||S=="typeof"||S=="infer"||S=="readonly")return $.marked="keyword",T(S=="typeof"?pt:Le);if(m=="variable"||S=="void")return $.marked="type",T(Xt);if(S=="|"||S=="&")return T(Le);if(m=="string"||m=="number"||m=="atom")return T(Xt);if(m=="[")return T(pe("]"),we(Le,"]",","),he,Xt);if(m=="{")return T(pe("}"),oe,he,Xt);if(m=="(")return T(we(Ye,")"),ta,Xt);if(m=="<")return T(we(Le,">"),Le);if(m=="quasi")return V(vt,Xt)}function ta(m){if(m=="=>")return T(Le)}function oe(m){return m.match(/[\}\)\]]/)?T():m==","||m==";"?T(oe):V(yr,oe)}function yr(m,S){if(m=="variable"||$.style=="keyword")return $.marked="property",T(yr);if(S=="?"||m=="number"||m=="string")return T(yr);if(m==":")return T(Le);if(m=="[")return T(be("variable"),Xr,be("]"),yr);if(m=="(")return V(Ir,yr);if(!m.match(/[;\}\)\],]/))return T()}function vt(m,S){return m!="quasi"?V():S.slice(S.length-2)!="${"?T(vt):T(Le,Xe)}function Xe(m){if(m=="}")return $.marked="string-2",$.state.tokenize=ne,T(vt)}function Ye(m,S){return m=="variable"&&$.stream.match(/^\s*[?:]/,!1)||S=="?"?T(Ye):m==":"?T(Le):m=="spread"?T(Ye):V(Le)}function Xt(m,S){if(S=="<")return T(pe(">"),we(Le,">"),he,Xt);if(S=="|"||m=="."||S=="&")return T(Le);if(m=="[")return T(Le,be("]"),Xt);if(S=="extends"||S=="implements")return $.marked="keyword",T(Le);if(S=="?")return T(Le,be(":"),Le)}function Nt(m,S){if(S=="<")return T(pe(">"),we(Le,">"),he,Xt)}function er(){return V(Le,mt)}function mt(m,S){if(S=="=")return T(Le)}function wn(m,S){return S=="enum"?($.marked="keyword",T(re)):V(Tt,_r,tr,fs)}function Tt(m,S){if(k&&N(S))return $.marked="keyword",T(Tt);if(m=="variable")return st(S),T();if(m=="spread")return T(Tt);if(m=="[")return Dt(si,"]");if(m=="{")return Dt(Or,"}")}function Or(m,S){return m=="variable"&&!$.stream.match(/^\s*:/,!1)?(st(S),T(tr)):(m=="variable"&&($.marked="property"),m=="spread"?T(Tt):m=="}"?V():m=="["?T(ye,be("]"),be(":"),Or):T(be(":"),Tt,tr))}function si(){return V(Tt,tr)}function tr(m,S){if(S=="=")return T(pt)}function fs(m){if(m==",")return T(wn)}function xn(m,S){if(m=="keyword b"&&S=="else")return T(pe("form","else"),Ce,he)}function ra(m,S){if(S=="await")return T(ra);if(m=="(")return T(pe(")"),oi,he)}function oi(m){return m=="var"?T(wn,Ar):m=="variable"?T(Ar):V(Ar)}function Ar(m,S){return m==")"?T():m==";"?T(Ar):S=="in"||S=="of"?($.marked="keyword",T(ye,Ar)):V(ye,Ar)}function Yt(m,S){if(S=="*")return $.marked="keyword",T(Yt);if(m=="variable")return st(S),T(Yt);if(m=="(")return T(ze,pe(")"),we(rr,")"),he,Er,Ce,nt);if(k&&S=="<")return T(pe(">"),we(er,">"),he,Yt)}function Ir(m,S){if(S=="*")return $.marked="keyword",T(Ir);if(m=="variable")return st(S),T(Ir);if(m=="(")return T(ze,pe(")"),we(rr,")"),he,Er,nt);if(k&&S=="<")return T(pe(">"),we(er,">"),he,Ir)}function na(m,S){if(m=="keyword"||m=="variable")return $.marked="type",T(na);if(S=="<")return T(pe(">"),we(er,">"),he)}function rr(m,S){return S=="@"&&T(ye,rr),m=="spread"?T(rr):k&&N(S)?($.marked="keyword",T(rr)):k&&m=="this"?T(_r,tr):V(Tt,_r,tr)}function cs(m,S){return m=="variable"?kn(m,S):nr(m,S)}function kn(m,S){if(m=="variable")return st(S),T(nr)}function nr(m,S){if(S=="<")return T(pe(">"),we(er,">"),he,nr);if(S=="extends"||S=="implements"||k&&m==",")return S=="implements"&&($.marked="keyword"),T(k?Le:ye,nr);if(m=="{")return T(pe("}"),ir,he)}function ir(m,S){if(m=="async"||m=="variable"&&(S=="static"||S=="get"||S=="set"||k&&N(S))&&$.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return $.marked="keyword",T(ir);if(m=="variable"||$.style=="keyword")return $.marked="property",T(Yr,ir);if(m=="number"||m=="string")return T(Yr,ir);if(m=="[")return T(ye,_r,be("]"),Yr,ir);if(S=="*")return $.marked="keyword",T(ir);if(k&&m=="(")return V(Ir,ir);if(m==";"||m==",")return T(ir);if(m=="}")return T();if(S=="@")return T(ye,ir)}function Yr(m,S){if(S=="!"||S=="?")return T(Yr);if(m==":")return T(Le,tr);if(S=="=")return T(pt);var W=$.state.lexical.prev,j=W&&W.info=="interface";return V(j?Ir:Yt)}function Sn(m,S){return S=="*"?($.marked="keyword",T(Ln,be(";"))):S=="default"?($.marked="keyword",T(ye,be(";"))):m=="{"?T(we(Cn,"}"),Ln,be(";")):V(Ce)}function Cn(m,S){if(S=="as")return $.marked="keyword",T(be("variable"));if(m=="variable")return V(pt,Cn)}function Dr(m){return m=="string"?T():m=="("?V(ye):m=="."?V(Ct):V(Tn,cr,Ln)}function Tn(m,S){return m=="{"?Dt(Tn,"}"):(m=="variable"&&st(S),S=="*"&&($.marked="keyword"),T(li))}function cr(m){if(m==",")return T(Tn,cr)}function li(m,S){if(S=="as")return $.marked="keyword",T(Tn)}function Ln(m,S){if(S=="from")return $.marked="keyword",T(ye)}function Ve(m){return m=="]"?T():V(we(pt,"]"))}function re(){return V(pe("form"),Tt,be("{"),pe("}"),we(br,"}"),he,he)}function br(){return V(Tt,tr)}function ui(m,S){return m.lastType=="operator"||m.lastType==","||H.test(S.charAt(0))||/[,.]/.test(S.charAt(0))}function Wt(m,S,W){return S.tokenize==P&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(S.lastType)||S.lastType=="quasi"&&/\{\s*$/.test(m.string.slice(0,m.pos-(W||0)))}return{startState:function(m){var S={tokenize:P,lastType:"sof",cc:[],lexical:new Ee((m||0)-g,0,"block",!1),localVars:c.localVars,context:c.localVars&&new K(null,null,!1),indented:m||0};return c.globalVars&&typeof c.globalVars=="object"&&(S.globalVars=c.globalVars),S},token:function(m,S){if(m.sol()&&(S.lexical.hasOwnProperty("align")||(S.lexical.align=!1),S.indented=m.indentation(),fe(m,S)),S.tokenize!=J&&m.eatSpace())return null;var W=S.tokenize(m,S);return M=="comment"?W:(S.lastType=M=="operator"&&(A=="++"||A=="--")?"incdec":M,Re(S,W,M,A,m))},indent:function(m,S){if(m.tokenize==J||m.tokenize==ne)return s.Pass;if(m.tokenize!=P)return 0;var W=S&&S.charAt(0),j=m.lexical,R;if(!/^\s*else\b/.test(S))for(var Z=m.cc.length-1;Z>=0;--Z){var Ae=m.cc[Z];if(Ae==he)j=j.prev;else if(Ae!=xn&&Ae!=nt)break}for(;(j.type=="stat"||j.type=="form")&&(W=="}"||(R=m.cc[m.cc.length-1])&&(R==Ct||R==Ft)&&!/^[,\.=+\-*:?[\(]/.test(S));)j=j.prev;p&&j.type==")"&&j.prev.type=="stat"&&(j=j.prev);var lt=j.type,Lt=W==lt;return lt=="vardef"?j.indented+(m.lastType=="operator"||m.lastType==","?j.info.length+1:0):lt=="form"&&W=="{"?j.indented:lt=="form"?j.indented+g:lt=="stat"?j.indented+(ui(m,S)?p||g:0):j.info=="switch"&&!Lt&&c.doubleIndentSwitch!=!1?j.indented+(/^(?:case|default)\b/.test(S)?g:2*g):j.align?j.column+(Lt?0:1):j.indented+(Lt?0:g)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:b?null:"/*",blockCommentEnd:b?null:"*/",blockCommentContinue:b?null:" * ",lineComment:b?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:b?"json":"javascript",jsonldMode:w,jsonMode:b,expressionAllowed:Wt,skipExpression:function(m){Re(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,i){(function(s){s(vr())})(function(s){var l={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},c=s.Pos;s.defineOption("autoCloseBrackets",!1,function(A,D,P){P&&P!=s.Init&&(A.removeKeyMap(p),A.state.closeBrackets=null),D&&(w(g(D,"pairs")),A.state.closeBrackets=D,A.addKeyMap(p))});function g(A,D){return D=="pairs"&&typeof A=="string"?A:typeof A=="object"&&A[D]!=null?A[D]:l[D]}var p={Backspace:k,Enter:L};function w(A){for(var D=0;D<A.length;D++){var P=A.charAt(D),G="'"+P+"'";p[G]||(p[G]=b(P))}}w(l.pairs+"`");function b(A){return function(D){return F(D,A)}}function y(A){var D=A.state.closeBrackets;if(!D||D.override)return D;var P=A.getModeAt(A.getCursor());return P.closeBrackets||D}function k(A){var D=y(A);if(!D||A.getOption("disableInput"))return s.Pass;for(var P=g(D,"pairs"),G=A.listSelections(),J=0;J<G.length;J++){if(!G[J].empty())return s.Pass;var ne=U(A,G[J].head);if(!ne||P.indexOf(ne)%2!=0)return s.Pass}for(var J=G.length-1;J>=0;J--){var te=G[J].head;A.replaceRange("",c(te.line,te.ch-1),c(te.line,te.ch+1),"+delete")}}function L(A){var D=y(A),P=D&&g(D,"explode");if(!P||A.getOption("disableInput"))return s.Pass;for(var G=A.listSelections(),J=0;J<G.length;J++){if(!G[J].empty())return s.Pass;var ne=U(A,G[J].head);if(!ne||P.indexOf(ne)%2!=0)return s.Pass}A.operation(function(){var te=A.lineSeparator()||`
25
+ `;A.replaceSelection(te+te,null),_(A,-1),G=A.listSelections();for(var fe=0;fe<G.length;fe++){var Me=G[fe].head.line;A.indentLine(Me,null,!0),A.indentLine(Me+1,null,!0)}})}function _(A,D){for(var P=[],G=A.listSelections(),J=0,ne=0;ne<G.length;ne++){var te=G[ne];te.head==A.getCursor()&&(J=ne);var fe=te.head.ch||D>0?{line:te.head.line,ch:te.head.ch+D}:{line:te.head.line-1};P.push({anchor:fe,head:fe})}A.setSelections(P,J)}function H(A){var D=s.cmpPos(A.anchor,A.head)>0;return{anchor:new c(A.anchor.line,A.anchor.ch+(D?-1:1)),head:new c(A.head.line,A.head.ch+(D?1:-1))}}function F(A,D){var P=y(A);if(!P||A.getOption("disableInput"))return s.Pass;var G=g(P,"pairs"),J=G.indexOf(D);if(J==-1)return s.Pass;for(var ne=g(P,"closeBefore"),te=g(P,"triples"),fe=G.charAt(J+1)==D,Me=A.listSelections(),Ee=J%2==0,Oe,Re=0;Re<Me.length;Re++){var $=Me[Re],V=$.head,T,rt=A.getRange(V,c(V.line,V.ch+1));if(Ee&&!$.empty())T="surround";else if((fe||!Ee)&&rt==D)fe&&M(A,V)?T="both":te.indexOf(D)>=0&&A.getRange(V,c(V.line,V.ch+3))==D+D+D?T="skipThree":T="skip";else if(fe&&V.ch>1&&te.indexOf(D)>=0&&A.getRange(c(V.line,V.ch-2),V)==D+D){if(V.ch>2&&/\bstring/.test(A.getTokenTypeAt(c(V.line,V.ch-2))))return s.Pass;T="addFour"}else if(fe){var st=V.ch==0?" ":A.getRange(c(V.line,V.ch-1),V);if(!s.isWordChar(rt)&&st!=D&&!s.isWordChar(st))T="both";else return s.Pass}else if(Ee&&(rt.length===0||/\s/.test(rt)||ne.indexOf(rt)>-1))T="both";else return s.Pass;if(!Oe)Oe=T;else if(Oe!=T)return s.Pass}var I=J%2?G.charAt(J-1):D,N=J%2?D:G.charAt(J+1);A.operation(function(){if(Oe=="skip")_(A,1);else if(Oe=="skipThree")_(A,3);else if(Oe=="surround"){for(var K=A.getSelections(),se=0;se<K.length;se++)K[se]=I+K[se]+N;A.replaceSelections(K,"around"),K=A.listSelections().slice();for(var se=0;se<K.length;se++)K[se]=H(K[se]);A.setSelections(K)}else Oe=="both"?(A.replaceSelection(I+N,null),A.triggerElectric(I+N),_(A,-1)):Oe=="addFour"&&(A.replaceSelection(I+I+I+I,"before"),_(A,1))})}function U(A,D){var P=A.getRange(c(D.line,D.ch-1),c(D.line,D.ch+1));return P.length==2?P:null}function M(A,D){var P=A.getTokenAt(c(D.line,D.ch+1));return/\bstring/.test(P.type)&&P.start==D.ch&&(D.ch==0||!/\bstring/.test(A.getTokenTypeAt(D)))}})}(),function(f,i){(function(s){s(vr())})(function(s){var l=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),c=s.Pos,g={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function p(_){return _&&_.bracketRegex||/[(){}[\]]/}function w(_,H,F){var U=_.getLineHandle(H.line),M=H.ch-1,A=F&&F.afterCursor;A==null&&(A=/(^| )cm-fat-cursor($| )/.test(_.getWrapperElement().className));var D=p(F),P=!A&&M>=0&&D.test(U.text.charAt(M))&&g[U.text.charAt(M)]||D.test(U.text.charAt(M+1))&&g[U.text.charAt(++M)];if(!P)return null;var G=P.charAt(1)==">"?1:-1;if(F&&F.strict&&G>0!=(M==H.ch))return null;var J=_.getTokenTypeAt(c(H.line,M+1)),ne=b(_,c(H.line,M+(G>0?1:0)),G,J,F);return ne==null?null:{from:c(H.line,M),to:ne&&ne.pos,match:ne&&ne.ch==P.charAt(0),forward:G>0}}function b(_,H,F,U,M){for(var A=M&&M.maxScanLineLength||1e4,D=M&&M.maxScanLines||1e3,P=[],G=p(M),J=F>0?Math.min(H.line+D,_.lastLine()+1):Math.max(_.firstLine()-1,H.line-D),ne=H.line;ne!=J;ne+=F){var te=_.getLine(ne);if(te){var fe=F>0?0:te.length-1,Me=F>0?te.length:-1;if(!(te.length>A))for(ne==H.line&&(fe=H.ch-(F<0?1:0));fe!=Me;fe+=F){var Ee=te.charAt(fe);if(G.test(Ee)&&(U===void 0||(_.getTokenTypeAt(c(ne,fe+1))||"")==(U||""))){var Oe=g[Ee];if(Oe&&Oe.charAt(1)==">"==F>0)P.push(Ee);else if(P.length)P.pop();else return{pos:c(ne,fe),ch:Ee}}}}}return ne-F==(F>0?_.lastLine():_.firstLine())?!1:null}function y(_,H,F){for(var U=_.state.matchBrackets.maxHighlightLineLength||1e3,M=F&&F.highlightNonMatching,A=[],D=_.listSelections(),P=0;P<D.length;P++){var G=D[P].empty()&&w(_,D[P].head,F);if(G&&(G.match||M!==!1)&&_.getLine(G.from.line).length<=U){var J=G.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";A.push(_.markText(G.from,c(G.from.line,G.from.ch+1),{className:J})),G.to&&_.getLine(G.to.line).length<=U&&A.push(_.markText(G.to,c(G.to.line,G.to.ch+1),{className:J}))}}if(A.length){l&&_.state.focused&&_.focus();var ne=function(){_.operation(function(){for(var te=0;te<A.length;te++)A[te].clear()})};if(H)setTimeout(ne,800);else return ne}}function k(_){_.operation(function(){_.state.matchBrackets.currentlyHighlighted&&(_.state.matchBrackets.currentlyHighlighted(),_.state.matchBrackets.currentlyHighlighted=null),_.state.matchBrackets.currentlyHighlighted=y(_,!1,_.state.matchBrackets)})}function L(_){_.state.matchBrackets&&_.state.matchBrackets.currentlyHighlighted&&(_.state.matchBrackets.currentlyHighlighted(),_.state.matchBrackets.currentlyHighlighted=null)}s.defineOption("matchBrackets",!1,function(_,H,F){F&&F!=s.Init&&(_.off("cursorActivity",k),_.off("focus",k),_.off("blur",L),L(_)),H&&(_.state.matchBrackets=typeof H=="object"?H:{},_.on("cursorActivity",k),_.on("focus",k),_.on("blur",L))}),s.defineExtension("matchBrackets",function(){y(this,!0)}),s.defineExtension("findMatchingBracket",function(_,H,F){return(F||typeof H=="boolean")&&(F?(F.strict=H,H=F):H=H?{strict:!0}:null),w(this,_,H)}),s.defineExtension("scanForBracket",function(_,H,F,U){return b(this,_,H,F,U)})})}();var zf={exports:{}};(function(f,i){(function(s){s(vr())})(function(s){function l(w,b,y,k){if(y&&y.call){var L=y;y=null}else var L=p(w,y,"rangeFinder");typeof b=="number"&&(b=s.Pos(b,0));var _=p(w,y,"minFoldSize");function H(A){var D=L(w,b);if(!D||D.to.line-D.from.line<_)return null;if(k==="fold")return D;for(var P=w.findMarksAt(D.from),G=0;G<P.length;++G)if(P[G].__isFold){if(!A)return null;D.cleared=!0,P[G].clear()}return D}var F=H(!0);if(p(w,y,"scanUp"))for(;!F&&b.line>w.firstLine();)b=s.Pos(b.line-1,0),F=H(!1);if(!(!F||F.cleared||k==="unfold")){var U=c(w,y,F);s.on(U,"mousedown",function(A){M.clear(),s.e_preventDefault(A)});var M=w.markText(F.from,F.to,{replacedWith:U,clearOnEnter:p(w,y,"clearOnEnter"),__isFold:!0});M.on("clear",function(A,D){s.signal(w,"unfold",w,A,D)}),s.signal(w,"fold",w,F.from,F.to)}}function c(w,b,y){var k=p(w,b,"widget");if(typeof k=="function"&&(k=k(y.from,y.to)),typeof k=="string"){var L=document.createTextNode(k);k=document.createElement("span"),k.appendChild(L),k.className="CodeMirror-foldmarker"}else k&&(k=k.cloneNode(!0));return k}s.newFoldFunction=function(w,b){return function(y,k){l(y,k,{rangeFinder:w,widget:b})}},s.defineExtension("foldCode",function(w,b,y){l(this,w,b,y)}),s.defineExtension("isFolded",function(w){for(var b=this.findMarksAt(w),y=0;y<b.length;++y)if(b[y].__isFold)return!0}),s.commands.toggleFold=function(w){w.foldCode(w.getCursor())},s.commands.fold=function(w){w.foldCode(w.getCursor(),null,"fold")},s.commands.unfold=function(w){w.foldCode(w.getCursor(),{scanUp:!1},"unfold")},s.commands.foldAll=function(w){w.operation(function(){for(var b=w.firstLine(),y=w.lastLine();b<=y;b++)w.foldCode(s.Pos(b,0),{scanUp:!1},"fold")})},s.commands.unfoldAll=function(w){w.operation(function(){for(var b=w.firstLine(),y=w.lastLine();b<=y;b++)w.foldCode(s.Pos(b,0),{scanUp:!1},"unfold")})},s.registerHelper("fold","combine",function(){var w=Array.prototype.slice.call(arguments,0);return function(b,y){for(var k=0;k<w.length;++k){var L=w[k](b,y);if(L)return L}}}),s.registerHelper("fold","auto",function(w,b){for(var y=w.getHelpers(b,"fold"),k=0;k<y.length;k++){var L=y[k](w,b);if(L)return L}});var g={rangeFinder:s.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};s.defineOption("foldOptions",null);function p(w,b,y){if(b&&b[y]!==void 0)return b[y];var k=w.options.foldOptions;return k&&k[y]!==void 0?k[y]:g[y]}s.defineExtension("foldOption",function(w,b){return p(this,w,b)})})})();var Pf=zf.exports;(function(f,i){(function(s){s(vr(),Pf)})(function(s){s.defineOption("foldGutter",!1,function(M,A,D){D&&D!=s.Init&&(M.clearGutter(M.state.foldGutter.options.gutter),M.state.foldGutter=null,M.off("gutterClick",L),M.off("changes",H),M.off("viewportChange",F),M.off("fold",U),M.off("unfold",U),M.off("swapDoc",H),M.off("optionChange",_)),A&&(M.state.foldGutter=new c(g(A)),k(M),M.on("gutterClick",L),M.on("changes",H),M.on("viewportChange",F),M.on("fold",U),M.on("unfold",U),M.on("swapDoc",H),M.on("optionChange",_))});var l=s.Pos;function c(M){this.options=M,this.from=this.to=0}function g(M){return M===!0&&(M={}),M.gutter==null&&(M.gutter="CodeMirror-foldgutter"),M.indicatorOpen==null&&(M.indicatorOpen="CodeMirror-foldgutter-open"),M.indicatorFolded==null&&(M.indicatorFolded="CodeMirror-foldgutter-folded"),M}function p(M,A){for(var D=M.findMarks(l(A,0),l(A+1,0)),P=0;P<D.length;++P)if(D[P].__isFold){var G=D[P].find(-1);if(G&&G.line===A)return D[P]}}function w(M){if(typeof M=="string"){var A=document.createElement("div");return A.className=M+" CodeMirror-guttermarker-subtle",A}else return M.cloneNode(!0)}function b(M,A,D){var P=M.state.foldGutter.options,G=A-1,J=M.foldOption(P,"minFoldSize"),ne=M.foldOption(P,"rangeFinder"),te=typeof P.indicatorFolded=="string"&&y(P.indicatorFolded),fe=typeof P.indicatorOpen=="string"&&y(P.indicatorOpen);M.eachLine(A,D,function(Me){++G;var Ee=null,Oe=Me.gutterMarkers;if(Oe&&(Oe=Oe[P.gutter]),p(M,G)){if(te&&Oe&&te.test(Oe.className))return;Ee=w(P.indicatorFolded)}else{var Re=l(G,0),$=ne&&ne(M,Re);if($&&$.to.line-$.from.line>=J){if(fe&&Oe&&fe.test(Oe.className))return;Ee=w(P.indicatorOpen)}}!Ee&&!Oe||M.setGutterMarker(Me,P.gutter,Ee)})}function y(M){return new RegExp("(^|\\s)"+M+"(?:$|\\s)\\s*")}function k(M){var A=M.getViewport(),D=M.state.foldGutter;D&&(M.operation(function(){b(M,A.from,A.to)}),D.from=A.from,D.to=A.to)}function L(M,A,D){var P=M.state.foldGutter;if(P){var G=P.options;if(D==G.gutter){var J=p(M,A);J?J.clear():M.foldCode(l(A,0),G)}}}function _(M,A){A=="mode"&&H(M)}function H(M){var A=M.state.foldGutter;if(A){var D=A.options;A.from=A.to=0,clearTimeout(A.changeUpdate),A.changeUpdate=setTimeout(function(){k(M)},D.foldOnChangeTimeSpan||600)}}function F(M){var A=M.state.foldGutter;if(A){var D=A.options;clearTimeout(A.changeUpdate),A.changeUpdate=setTimeout(function(){var P=M.getViewport();A.from==A.to||P.from-A.to>20||A.from-P.to>20?k(M):M.operation(function(){P.from<A.from&&(b(M,P.from,A.from),A.from=P.from),P.to>A.to&&(b(M,A.to,P.to),A.to=P.to)})},D.updateViewportTimeSpan||400)}}function U(M,A){var D=M.state.foldGutter;if(D){var P=A.line;P>=D.from&&P<D.to&&b(M,P,P+1)}}})})(),function(f,i){(function(s){s(vr())})(function(s){function l(c){return function(g,p){var w=p.line,b=g.getLine(w);function y(U){for(var M,A=p.ch,D=0;;){var P=A<=0?-1:b.lastIndexOf(U[0],A-1);if(P==-1){if(D==1)break;D=1,A=b.length;continue}if(D==1&&P<p.ch)break;if(M=g.getTokenTypeAt(s.Pos(w,P+1)),!/^(comment|string)/.test(M))return{ch:P+1,tokenType:M,pair:U};A=P-1}}function k(U){var M=1,A=g.lastLine(),D,P=U.ch,G;e:for(var J=w;J<=A;++J)for(var ne=g.getLine(J),te=J==w?P:0;;){var fe=ne.indexOf(U.pair[0],te),Me=ne.indexOf(U.pair[1],te);if(fe<0&&(fe=ne.length),Me<0&&(Me=ne.length),te=Math.min(fe,Me),te==ne.length)break;if(g.getTokenTypeAt(s.Pos(J,te+1))==U.tokenType){if(te==fe)++M;else if(!--M){D=J,G=te;break e}}++te}return D==null||w==D?null:{from:s.Pos(w,P),to:s.Pos(D,G)}}for(var L=[],_=0;_<c.length;_++){var H=y(c[_]);H&&L.push(H)}L.sort(function(U,M){return U.ch-M.ch});for(var _=0;_<L.length;_++){var F=k(L[_]);if(F)return F}return null}}s.registerHelper("fold","brace",l([["{","}"],["[","]"]])),s.registerHelper("fold","brace-paren",l([["{","}"],["[","]"],["(",")"]])),s.registerHelper("fold","import",function(c,g){function p(_){if(_<c.firstLine()||_>c.lastLine())return null;var H=c.getTokenAt(s.Pos(_,1));if(/\S/.test(H.string)||(H=c.getTokenAt(s.Pos(_,H.end+1))),H.type!="keyword"||H.string!="import")return null;for(var F=_,U=Math.min(c.lastLine(),_+10);F<=U;++F){var M=c.getLine(F),A=M.indexOf(";");if(A!=-1)return{startCh:H.end,end:s.Pos(F,A)}}}var w=g.line,b=p(w),y;if(!b||p(w-1)||(y=p(w-2))&&y.end.line==w-1)return null;for(var k=b.end;;){var L=p(k.line+1);if(L==null)break;k=L.end}return{from:c.clipPos(s.Pos(w,b.startCh+1)),to:k}}),s.registerHelper("fold","include",function(c,g){function p(L){if(L<c.firstLine()||L>c.lastLine())return null;var _=c.getTokenAt(s.Pos(L,1));if(/\S/.test(_.string)||(_=c.getTokenAt(s.Pos(L,_.end+1))),_.type=="meta"&&_.string.slice(0,8)=="#include")return _.start+8}var w=g.line,b=p(w);if(b==null||p(w-1)!=null)return null;for(var y=w;;){var k=p(y+1);if(k==null)break;++y}return{from:s.Pos(w,b+1),to:c.clipPos(s.Pos(y))}})})}(),function(f,i){(function(s){s(vr())})(function(s){function l(c,g){var p=c.getLine(g),w=p.search(/\S/);return w==-1||/\bcomment\b/.test(c.getTokenTypeAt(s.Pos(g,w+1)))?-1:s.countColumn(p,null,c.getOption("tabSize"))}s.registerHelper("fold","indent",function(c,g){var p=l(c,g.line);if(!(p<0)){for(var w=null,b=g.line+1,y=c.lastLine();b<=y;++b){var k=l(c,b);if(k!=-1)if(k>p)w=b;else break}if(w)return{from:s.Pos(g.line,c.getLine(g.line).length),to:s.Pos(w,c.getLine(w).length)}}})})}();const lo=Qe.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 uo={exports:{}};(function(f,i){(function(s,l){f.exports=l(vr())})(so,function(s){return function(l){function c(p){if(g[p])return g[p].exports;var w=g[p]={i:p,l:!1,exports:{}};return l[p].call(w.exports,w,w.exports,c),w.l=!0,w.exports}var g={};return c.m=l,c.c=g,c.i=function(p){return p},c.d=function(p,w,b){c.o(p,w)||Object.defineProperty(p,w,{configurable:!1,enumerable:!0,get:b})},c.n=function(p){var w=p&&p.__esModule?function(){return p.default}:function(){return p};return c.d(w,"a",w),w},c.o=function(p,w){return Object.prototype.hasOwnProperty.call(p,w)},c.p="/",c(c.s=3)}([function(l,c){l.exports=s},function(l,c,g){Object.defineProperty(c,"__esModule",{value:!0});var p=g(0),w=function(y){return y&&y.__esModule?y:{default:y}}(p),b=window.CodeMirror||w.default;typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(y,k){if(y==null)throw new TypeError("Cannot convert undefined or null to object");for(var L=Object(y),_=1;_<arguments.length;_++){var H=arguments[_];if(H!=null)for(var F in H)Object.prototype.hasOwnProperty.call(H,F)&&(L[F]=H[F])}return L},writable:!0,configurable:!0}),c.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(y){for(var k in y)this.cminstance.setOption(k,y[k])}},merge:function(){this.$nextTick(this.switchMerge)},code:function(y){this.handerCodeChange(y)},value:function(y){this.handerCodeChange(y)}},methods:{initialize:function(){var y=this,k=Object.assign({},this.globalOptions,this.options);this.merge?(this.codemirror=b.MergeView(this.$refs.mergeview,k),this.cminstance=this.codemirror.edit):(this.codemirror=b.fromTextArea(this.$refs.textarea,k),this.cminstance=this.codemirror,this.cminstance.setValue(this.code||this.value||this.content)),this.cminstance.on("change",function(_){y.content=_.getValue(),y.$emit&&y.$emit("input",y.content)});var L={};["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(_){return!L[_]&&(L[_]=!0)}).forEach(function(_){y.cminstance.on(_,function(){for(var H=arguments.length,F=Array(H),U=0;U<H;U++)F[U]=arguments[U];y.$emit.apply(y,[_].concat(F));var M=_.replace(/([A-Z])/g,"-$1").toLowerCase();M!==_&&y.$emit.apply(y,[M].concat(F))})}),this.$emit("ready",this.codemirror),this.unseenLineMarkers(),this.refresh()},refresh:function(){var y=this;this.$nextTick(function(){y.cminstance.refresh()})},destroy:function(){var y=this.cminstance.doc.cm.getWrapperElement();y&&y.remove&&y.remove()},handerCodeChange:function(y){if(y!==this.cminstance.getValue()){var k=this.cminstance.getScrollInfo();this.cminstance.setValue(y),this.content=y,this.cminstance.scrollTo(k.left,k.top)}this.unseenLineMarkers()},unseenLineMarkers:function(){var y=this;this.unseenLines!==void 0&&this.marker!==void 0&&this.unseenLines.forEach(function(k){var L=y.cminstance.lineInfo(k);y.cminstance.setGutterMarker(k,"breakpoints",L.gutterMarkers?null:y.marker())})},switchMerge:function(){var y=this.cminstance.doc.history,k=this.cminstance.doc.cleanGeneration;this.options.value=this.cminstance.getValue(),this.destroy(),this.initialize(),this.cminstance.doc.history=y,this.cminstance.doc.cleanGeneration=k}},mounted:function(){this.initialize()},beforeDestroy:function(){this.destroy()}}},function(l,c,g){Object.defineProperty(c,"__esModule",{value:!0});var p=g(1),w=g.n(p);for(var b in p)["default","default"].indexOf(b)<0&&function(_){g.d(c,_,function(){return p[_]})}(b);var y=g(5),k=g(4),L=k(w.a,y.a,!1,null,null,null);c.default=L.exports},function(l,c,g){function p(F){return F&&F.__esModule?F:{default:F}}Object.defineProperty(c,"__esModule",{value:!0}),c.install=c.codemirror=c.CodeMirror=void 0;var w=g(0),b=p(w),y=g(2),k=p(y),L=window.CodeMirror||b.default,_=function(F,U){U&&(U.options&&(k.default.props.globalOptions.default=function(){return U.options}),U.events&&(k.default.props.globalEvents.default=function(){return U.events})),F.component(k.default.name,k.default)},H={CodeMirror:L,codemirror:k.default,install:_};c.default=H,c.CodeMirror=L,c.codemirror=k.default,c.install=_},function(l,c){l.exports=function(g,p,w,b,y,k){var L,_=g=g||{},H=typeof g.default;H!=="object"&&H!=="function"||(L=g,_=g.default);var F=typeof _=="function"?_.options:_;p&&(F.render=p.render,F.staticRenderFns=p.staticRenderFns,F._compiled=!0),w&&(F.functional=!0),y&&(F._scopeId=y);var U;if(k?(U=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__),b&&b.call(this,D),D&&D._registeredComponents&&D._registeredComponents.add(k)},F._ssrRegister=U):b&&(U=b),U){var M=F.functional,A=M?F.render:F.beforeCreate;M?(F._injectStyles=U,F.render=function(D,P){return U.call(P),A(D,P)}):F.beforeCreate=A?[].concat(A,U):[U]}return{esModule:L,exports:_,options:F}}},function(l,c,g){var p=function(){var y=this,k=y.$createElement,L=y._self._c||k;return L("div",{staticClass:"vue-codemirror",class:{merge:y.merge}},[y.merge?L("div",{ref:"mergeview"}):L("textarea",{ref:"textarea",attrs:{name:y.name,placeholder:y.placeholder}})])},w=[],b={render:p,staticRenderFns:w};c.a=b}])})})(uo);var Ff=uo.exports;function za(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Br=za();function fo(f){Br=f}const co=/[&<>"']/,Wf=new RegExp(co.source,"g"),ho=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Hf=new RegExp(ho.source,"g"),$f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},po=f=>$f[f];function zt(f,i){if(i){if(co.test(f))return f.replace(Wf,po)}else if(ho.test(f))return f.replace(Hf,po);return f}const Bf=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Uf(f){return f.replace(Bf,(i,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 jf=/(^|[^\[])\^/g;function Pe(f,i){let s=typeof f=="string"?f:f.source;i=i||"";const l={replace:(c,g)=>{let p=typeof g=="string"?g:g.source;return p=p.replace(jf,"$1"),s=s.replace(c,p),l},getRegex:()=>new RegExp(s,i)};return l}function go(f){try{f=encodeURI(f).replace(/%25/g,"%")}catch{return null}return f}const Gn={exec:()=>null};function vo(f,i){const s=f.replace(/\|/g,(g,p,w)=>{let b=!1,y=p;for(;--y>=0&&w[y]==="\\";)b=!b;return b?"|":" |"}),l=s.split(/ \|/);let c=0;if(l[0].trim()||l.shift(),l.length>0&&!l[l.length-1].trim()&&l.pop(),i)if(l.length>i)l.splice(i);else for(;l.length<i;)l.push("");for(;c<l.length;c++)l[c]=l[c].trim().replace(/\\\|/g,"|");return l}function Pi(f,i,s){const l=f.length;if(l===0)return"";let c=0;for(;c<l&&f.charAt(l-c-1)===i;)c++;return f.slice(0,l-c)}function qf(f,i){if(f.indexOf(i[1])===-1)return-1;let s=0;for(let l=0;l<f.length;l++)if(f[l]==="\\")l++;else if(f[l]===i[0])s++;else if(f[l]===i[1]&&(s--,s<0))return l;return-1}function mo(f,i,s,l){const c=i.href,g=i.title?zt(i.title):null,p=f[1].replace(/\\([\[\]])/g,"$1");if(f[0].charAt(0)!=="!"){l.state.inLink=!0;const w={type:"link",raw:s,href:c,title:g,text:p,tokens:l.inlineTokens(p)};return l.state.inLink=!1,w}return{type:"image",raw:s,href:c,title:g,text:zt(p)}}function Kf(f,i){const s=f.match(/^(\s+)(?:```)/);if(s===null)return i;const l=s[1];return i.split(`
26
26
  `).map(c=>{const g=c.match(/^\s+/);if(g===null)return c;const[p]=g;return p.length>=l.length?c.slice(l.length):c}).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:Di(l,`
28
- `)}}}fences(a){const s=this.rules.block.fences.exec(a);if(s){const l=s[0],c=qf(l,s[3]||"");return{type:"code",raw:l,lang:s[2]?s[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):s[2],text:c}}}heading(a){const s=this.rules.block.heading.exec(a);if(s){let l=s[2].trim();if(/#$/.test(l)){const c=Di(l,"#");(this.options.pedantic||!c||/ $/.test(c))&&(l=c.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=Di(s[0].replace(/^ *>[ \t]?/gm,""),`
29
- `),c=this.lexer.state.top;this.lexer.state.top=!0;const g=this.lexer.blockTokens(l);return this.lexer.state.top=c,{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 c=l.length>1,g={type:"list",raw:"",ordered:c,start:c?+l.slice(0,-1):"",loose:!1,items:[]};l=c?`\\d{1,9}\\${l.slice(-1)}`:`\\${l}`,this.options.pedantic&&(l=c?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|$))`),I=new RegExp(`^ {0,${Math.min(3,H-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),R=new RegExp(`^ {0,${Math.min(3,H-1)}}(?:\`\`\`|~~~)`),q=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)||q.test(L)||E.test(L)||I.test(a))break;if(L.search(/[^ ]/)>=H||!L.trim())w+=`
34
- `+L.slice(H);else{if(P||A.search(/[^ ]/)>=4||R.test(A)||q.test(A)||I.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," "),c=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:c,title:g}}}table(a){const s=this.rules.block.table.exec(a);if(!s||!/[:|]/.test(s[2]))return;const l=vo(s[1]),c=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===c.length){for(const y of c)/^ *-+: *$/.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(vo(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=Di(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 c=s[2],g="";if(this.options.pedantic){const p=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(c);p&&(c=p[1],g=p[3])}else g=s[3]?s[3].slice(1,-1):"";return c=c.trim(),/^</.test(c)&&(this.options.pedantic&&!/>$/.test(l)?c=c.slice(1):c=c.slice(1,-1)),mo(s,{href:c&&c.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 c=(l[2]||l[1]).replace(/\s+/g," "),g=s[c.toLowerCase()];if(!g){const p=l[0].charAt(0);return{type:"text",raw:p,text:p}}return mo(l,g,l[0],this.lexer)}}emStrong(a,s,l=""){let c=this.rules.inline.emStrongLDelim.exec(a);if(!c||c[3]&&l.match(/[\p{L}\p{N}]/u))return;if(!(c[1]||c[2]||"")||!l||this.rules.inline.punctuation.exec(l)){const p=[...c[0]].length-1;let y,w,b=p,k=0;const A=c[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(A.lastIndex=0,s=s.slice(-1*a.length+p);(c=A.exec(s))!=null;){if(y=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!y)continue;if(w=[...y].length,c[3]||c[4]){b+=w;continue}else if((c[5]||c[6])&&p%3&&!((p+w)%3)){k+=w;continue}if(b-=w,b>0)continue;w=Math.min(w,w+b+k);const L=[...c[0]][0].length,H=a.slice(0,p+c.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 c=/[^ ]/.test(l),g=/^ /.test(l)&&/ $/.test(l);return c&&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,c;return s[2]==="@"?(l=Lt(s[1]),c="mailto:"+l):(l=Lt(s[1]),c=l),{type:"link",raw:s[0],text:l,href:c,tokens:[{type:"text",raw:l,text:l}]}}}url(a){var l;let s;if(s=this.rules.inline.url.exec(a)){let c,g;if(s[2]==="@")c=Lt(s[0]),g="mailto:"+c;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]);c=Lt(s[0]),s[1]==="www."?g="http://"+s[0]:g=s[0]}return{type:"link",raw:s[0],text:c,href:g,tokens:[{type:"text",raw:c,text:c}]}}}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 Xf=/^(?: *(?:\n|$))+/,Kf=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Yf=/^ {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+|$)/,Zf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,yo=/(?:[*+-]|\d{1,9}[.)])/,bo=Te(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,yo).getRegex(),Ra=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Vf=/^[^\n]+/,za=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Qf=Te(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",za).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Jf=Te(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,yo).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]*?(?:-->|$)/,ec=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(),wo=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",wo).getRegex(),code:Kf,def:Qf,fences:Yf,heading:Zf,hr:Bn,html:ec,lheading:bo,list:Jf,newline:Xf,paragraph:wo,table:Wn,text:Vf},xo=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(),tc={...Fa,table:xo,paragraph:Te(Ra).replace("hr",Bn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",xo).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()},rc={...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",bo).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ko=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,nc=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,So=/^( {2,}|\\)\n(?!\s*$)/,ic=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,$n="\\p{P}$+<=>`^|~",ac=Te(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,$n).getRegex(),sc=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,oc=Te(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,$n).getRegex(),lc=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(),uc=Te("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,$n).getRegex(),fc=Te(/\\([punct])/,"gu").replace(/punct/g,$n).getRegex(),cc=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(),hc=Te(Pa).replace("(?:-->|$)","-->").getRegex(),dc=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",hc).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ri=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,pc=Te(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Ri).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Co=Te(/^!?\[(label)\]\[(ref)\]/).replace("label",Ri).replace("ref",za).getRegex(),To=Te(/^!?\[(ref)\](?:\[\])?/).replace("ref",za).getRegex(),gc=Te("reflink|nolink(?!\\()","g").replace("reflink",Co).replace("nolink",To).getRegex(),Ha={_backpedal:Wn,anyPunctuation:fc,autolink:cc,blockSkip:sc,br:So,code:nc,del:Wn,emStrongLDelim:oc,emStrongRDelimAst:lc,emStrongRDelimUnd:uc,escape:ko,link:pc,nolink:To,punctuation:ac,reflink:Co,reflinkSearch:gc,tag:dc,text:ic,url:Wn},vc={...Ha,link:Te(/^!?\[(label)\]\((.*?)\)/).replace("label",Ri).getRegex(),reflink:Te(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ri).getRegex()},Wa={...Ha,escape:Te(ko).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.!#$%&'*+\/=?_`{\|}~-]+@)))/},mc={...Wa,br:Te(So).replace("{2,}","*").getRegex(),text:Te(Wa.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},zi={normal:Fa,gfm:tc,pedantic:rc},Un={normal:Ha,gfm:Wa,breaks:mc,pedantic:vc};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,c,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),c=s[s.length-1],c&&(c.type==="paragraph"||c.type==="text")?(c.raw+=`
27
+ `)}class Fi{constructor(i){qe(this,"options");qe(this,"rules");qe(this,"lexer");this.options=i||Br}space(i){const s=this.rules.block.newline.exec(i);if(s&&s[0].length>0)return{type:"space",raw:s[0]}}code(i){const s=this.rules.block.code.exec(i);if(s){const l=s[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:s[0],codeBlockStyle:"indented",text:this.options.pedantic?l:Pi(l,`
28
+ `)}}}fences(i){const s=this.rules.block.fences.exec(i);if(s){const l=s[0],c=Kf(l,s[3]||"");return{type:"code",raw:l,lang:s[2]?s[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):s[2],text:c}}}heading(i){const s=this.rules.block.heading.exec(i);if(s){let l=s[2].trim();if(/#$/.test(l)){const c=Pi(l,"#");(this.options.pedantic||!c||/ $/.test(c))&&(l=c.trim())}return{type:"heading",raw:s[0],depth:s[1].length,text:l,tokens:this.lexer.inline(l)}}}hr(i){const s=this.rules.block.hr.exec(i);if(s)return{type:"hr",raw:s[0]}}blockquote(i){const s=this.rules.block.blockquote.exec(i);if(s){const l=Pi(s[0].replace(/^ *>[ \t]?/gm,""),`
29
+ `),c=this.lexer.state.top;this.lexer.state.top=!0;const g=this.lexer.blockTokens(l);return this.lexer.state.top=c,{type:"blockquote",raw:s[0],tokens:g,text:l}}}list(i){let s=this.rules.block.list.exec(i);if(s){let l=s[1].trim();const c=l.length>1,g={type:"list",raw:"",ordered:c,start:c?+l.slice(0,-1):"",loose:!1,items:[]};l=c?`\\d{1,9}\\${l.slice(-1)}`:`\\${l}`,this.options.pedantic&&(l=c?l:"[*+-]");const p=new RegExp(`^( {0,3}${l})((?:[ ][^\\n]*)?(?:\\n|$))`);let w="",b="",y=!1;for(;i;){let k=!1;if(!(s=p.exec(i))||this.rules.block.hr.test(i))break;w=s[0],i=i.substring(w.length);let L=s[2].split(`
30
+ `,1)[0].replace(/^\t+/,A=>" ".repeat(3*A.length)),_=i.split(`
31
+ `,1)[0],H=0;this.options.pedantic?(H=2,b=L.trimStart()):(H=s[2].search(/[^ ]/),H=H>4?1:H,b=L.slice(H),H+=s[1].length);let F=!1;if(!L&&/^ *$/.test(_)&&(w+=_+`
32
+ `,i=i.substring(_.length+1),k=!0),!k){const A=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+|$)`),P=new RegExp(`^ {0,${Math.min(3,H-1)}}(?:\`\`\`|~~~)`),G=new RegExp(`^ {0,${Math.min(3,H-1)}}#`);for(;i;){const J=i.split(`
33
+ `,1)[0];if(_=J,this.options.pedantic&&(_=_.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),P.test(_)||G.test(_)||A.test(_)||D.test(i))break;if(_.search(/[^ ]/)>=H||!_.trim())b+=`
34
+ `+_.slice(H);else{if(F||L.search(/[^ ]/)>=4||P.test(L)||G.test(L)||D.test(L))break;b+=`
35
+ `+_}!F&&!_.trim()&&(F=!0),w+=J+`
36
+ `,i=i.substring(J.length+1),L=_.slice(H)}}g.loose||(y?g.loose=!0:/\n *\n *$/.test(w)&&(y=!0));let U=null,M;this.options.gfm&&(U=/^\[[ xX]\] /.exec(b),U&&(M=U[0]!=="[ ] ",b=b.replace(/^\[[ xX]\] +/,""))),g.items.push({type:"list_item",raw:w,task:!!U,checked:M,loose:!1,text:b,tokens:[]}),g.raw+=w}g.items[g.items.length-1].raw=w.trimEnd(),g.items[g.items.length-1].text=b.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 L=g.items[k].tokens.filter(H=>H.type==="space"),_=L.length>0&&L.some(H=>/\n.*\n/.test(H.raw));g.loose=_}if(g.loose)for(let k=0;k<g.items.length;k++)g.items[k].loose=!0;return g}}html(i){const s=this.rules.block.html.exec(i);if(s)return{type:"html",block:!0,raw:s[0],pre:s[1]==="pre"||s[1]==="script"||s[1]==="style",text:s[0]}}def(i){const s=this.rules.block.def.exec(i);if(s){const l=s[1].toLowerCase().replace(/\s+/g," "),c=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:c,title:g}}}table(i){const s=this.rules.block.table.exec(i);if(!s||!/[:|]/.test(s[2]))return;const l=vo(s[1]),c=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===c.length){for(const w of c)/^ *-+: *$/.test(w)?p.align.push("right"):/^ *:-+: *$/.test(w)?p.align.push("center"):/^ *:-+ *$/.test(w)?p.align.push("left"):p.align.push(null);for(const w of l)p.header.push({text:w,tokens:this.lexer.inline(w)});for(const w of g)p.rows.push(vo(w,p.header.length).map(b=>({text:b,tokens:this.lexer.inline(b)})));return p}}lheading(i){const s=this.rules.block.lheading.exec(i);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(i){const s=this.rules.block.paragraph.exec(i);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(i){const s=this.rules.block.text.exec(i);if(s)return{type:"text",raw:s[0],text:s[0],tokens:this.lexer.inline(s[0])}}escape(i){const s=this.rules.inline.escape.exec(i);if(s)return{type:"escape",raw:s[0],text:zt(s[1])}}tag(i){const s=this.rules.inline.tag.exec(i);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(i){const s=this.rules.inline.link.exec(i);if(s){const l=s[2].trim();if(!this.options.pedantic&&/^</.test(l)){if(!/>$/.test(l))return;const p=Pi(l.slice(0,-1),"\\");if((l.length-p.length)%2===0)return}else{const p=qf(s[2],"()");if(p>-1){const b=(s[0].indexOf("!")===0?5:4)+s[1].length+p;s[2]=s[2].substring(0,p),s[0]=s[0].substring(0,b).trim(),s[3]=""}}let c=s[2],g="";if(this.options.pedantic){const p=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(c);p&&(c=p[1],g=p[3])}else g=s[3]?s[3].slice(1,-1):"";return c=c.trim(),/^</.test(c)&&(this.options.pedantic&&!/>$/.test(l)?c=c.slice(1):c=c.slice(1,-1)),mo(s,{href:c&&c.replace(this.rules.inline.anyPunctuation,"$1"),title:g&&g.replace(this.rules.inline.anyPunctuation,"$1")},s[0],this.lexer)}}reflink(i,s){let l;if((l=this.rules.inline.reflink.exec(i))||(l=this.rules.inline.nolink.exec(i))){const c=(l[2]||l[1]).replace(/\s+/g," "),g=s[c.toLowerCase()];if(!g){const p=l[0].charAt(0);return{type:"text",raw:p,text:p}}return mo(l,g,l[0],this.lexer)}}emStrong(i,s,l=""){let c=this.rules.inline.emStrongLDelim.exec(i);if(!c||c[3]&&l.match(/[\p{L}\p{N}]/u))return;if(!(c[1]||c[2]||"")||!l||this.rules.inline.punctuation.exec(l)){const p=[...c[0]].length-1;let w,b,y=p,k=0;const L=c[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(L.lastIndex=0,s=s.slice(-1*i.length+p);(c=L.exec(s))!=null;){if(w=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!w)continue;if(b=[...w].length,c[3]||c[4]){y+=b;continue}else if((c[5]||c[6])&&p%3&&!((p+b)%3)){k+=b;continue}if(y-=b,y>0)continue;b=Math.min(b,b+y+k);const _=[...c[0]][0].length,H=i.slice(0,p+c.index+_+b);if(Math.min(p,b)%2){const U=H.slice(1,-1);return{type:"em",raw:H,text:U,tokens:this.lexer.inlineTokens(U)}}const F=H.slice(2,-2);return{type:"strong",raw:H,text:F,tokens:this.lexer.inlineTokens(F)}}}}codespan(i){const s=this.rules.inline.code.exec(i);if(s){let l=s[2].replace(/\n/g," ");const c=/[^ ]/.test(l),g=/^ /.test(l)&&/ $/.test(l);return c&&g&&(l=l.substring(1,l.length-1)),l=zt(l,!0),{type:"codespan",raw:s[0],text:l}}}br(i){const s=this.rules.inline.br.exec(i);if(s)return{type:"br",raw:s[0]}}del(i){const s=this.rules.inline.del.exec(i);if(s)return{type:"del",raw:s[0],text:s[2],tokens:this.lexer.inlineTokens(s[2])}}autolink(i){const s=this.rules.inline.autolink.exec(i);if(s){let l,c;return s[2]==="@"?(l=zt(s[1]),c="mailto:"+l):(l=zt(s[1]),c=l),{type:"link",raw:s[0],text:l,href:c,tokens:[{type:"text",raw:l,text:l}]}}}url(i){var l;let s;if(s=this.rules.inline.url.exec(i)){let c,g;if(s[2]==="@")c=zt(s[0]),g="mailto:"+c;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]);c=zt(s[0]),s[1]==="www."?g="http://"+s[0]:g=s[0]}return{type:"link",raw:s[0],text:c,href:g,tokens:[{type:"text",raw:c,text:c}]}}}inlineText(i){const s=this.rules.inline.text.exec(i);if(s){let l;return this.lexer.state.inRawBlock?l=s[0]:l=zt(s[0]),{type:"text",raw:s[0],text:l}}}}const Gf=/^(?: *(?:\n|$))+/,Xf=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,Yf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Xn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Vf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,yo=/(?:[*+-]|\d{1,9}[.)])/,bo=Pe(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,yo).getRegex(),Pa=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Zf=/^[^\n]+/,Fa=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Qf=Pe(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",Fa).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Jf=Pe(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,yo).getRegex(),Wi="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",Wa=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,ec=Pe("^ {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",Wa).replace("tag",Wi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),wo=Pe(Pa).replace("hr",Xn).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",Wi).getRegex(),Ha={blockquote:Pe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",wo).getRegex(),code:Xf,def:Qf,fences:Yf,heading:Vf,hr:Xn,html:ec,lheading:bo,list:Jf,newline:Gf,paragraph:wo,table:Gn,text:Zf},xo=Pe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Xn).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",Wi).getRegex(),tc={...Ha,table:xo,paragraph:Pe(Pa).replace("hr",Xn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",xo).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",Wi).getRegex()},rc={...Ha,html:Pe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Wa).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:Gn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Pe(Pa).replace("hr",Xn).replace("heading",` *#{1,6} *[^
39
+ ]`).replace("lheading",bo).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ko=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,nc=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,So=/^( {2,}|\\)\n(?!\s*$)/,ic=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Yn="\\p{P}$+<=>`^|~",ac=Pe(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Yn).getRegex(),sc=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,oc=Pe(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Yn).getRegex(),lc=Pe("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Yn).getRegex(),uc=Pe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Yn).getRegex(),fc=Pe(/\\([punct])/,"gu").replace(/punct/g,Yn).getRegex(),cc=Pe(/^<(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(),hc=Pe(Wa).replace("(?:-->|$)","-->").getRegex(),dc=Pe("^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",hc).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Hi=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,pc=Pe(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Hi).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Co=Pe(/^!?\[(label)\]\[(ref)\]/).replace("label",Hi).replace("ref",Fa).getRegex(),To=Pe(/^!?\[(ref)\](?:\[\])?/).replace("ref",Fa).getRegex(),gc=Pe("reflink|nolink(?!\\()","g").replace("reflink",Co).replace("nolink",To).getRegex(),$a={_backpedal:Gn,anyPunctuation:fc,autolink:cc,blockSkip:sc,br:So,code:nc,del:Gn,emStrongLDelim:oc,emStrongRDelimAst:lc,emStrongRDelimUnd:uc,escape:ko,link:pc,nolink:To,punctuation:ac,reflink:Co,reflinkSearch:gc,tag:dc,text:ic,url:Gn},vc={...$a,link:Pe(/^!?\[(label)\]\((.*?)\)/).replace("label",Hi).getRegex(),reflink:Pe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Hi).getRegex()},Ba={...$a,escape:Pe(ko).replace("])","~|])").getRegex(),url:Pe(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},mc={...Ba,br:Pe(So).replace("{2,}","*").getRegex(),text:Pe(Ba.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},$i={normal:Ha,gfm:tc,pedantic:rc},Vn={normal:$a,gfm:Ba,breaks:mc,pedantic:vc};class ur{constructor(i){qe(this,"tokens");qe(this,"options");qe(this,"state");qe(this,"tokenizer");qe(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=i||Br,this.options.tokenizer=this.options.tokenizer||new Fi,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:$i.normal,inline:Vn.normal};this.options.pedantic?(s.block=$i.pedantic,s.inline=Vn.pedantic):this.options.gfm&&(s.block=$i.gfm,this.options.breaks?s.inline=Vn.breaks:s.inline=Vn.gfm),this.tokenizer.rules=s}static get rules(){return{block:$i,inline:Vn}}static lex(i,s){return new ur(s).lex(i)}static lexInline(i,s){return new ur(s).inlineTokens(i)}lex(i){i=i.replace(/\r\n|\r/g,`
40
+ `),this.blockTokens(i,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(i,s=[]){this.options.pedantic?i=i.replace(/\t/g," ").replace(/^ +$/gm,""):i=i.replace(/^( *)(\t+)/gm,(w,b,y)=>b+" ".repeat(y.length));let l,c,g,p;for(;i;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(w=>(l=w.call({lexer:this},i,s))?(i=i.substring(l.raw.length),s.push(l),!0):!1))){if(l=this.tokenizer.space(i)){i=i.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(i)){i=i.substring(l.raw.length),c=s[s.length-1],c&&(c.type==="paragraph"||c.type==="text")?(c.raw+=`
42
42
  `+l.raw,c.text+=`
43
- `+l.text,this.inlineQueue[this.inlineQueue.length-1].src=c.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),c=s[s.length-1],c&&(c.type==="paragraph"||c.type==="text")?(c.raw+=`
43
+ `+l.text,this.inlineQueue[this.inlineQueue.length-1].src=c.text):s.push(l);continue}if(l=this.tokenizer.fences(i)){i=i.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.heading(i)){i=i.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.hr(i)){i=i.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.blockquote(i)){i=i.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.list(i)){i=i.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.html(i)){i=i.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.def(i)){i=i.substring(l.raw.length),c=s[s.length-1],c&&(c.type==="paragraph"||c.type==="text")?(c.raw+=`
44
44
  `+l.raw,c.text+=`
45
- `+l.raw,this.inlineQueue[this.inlineQueue.length-1].src=c.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))){c=s[s.length-1],p&&c.type==="paragraph"?(c.raw+=`
45
+ `+l.raw,this.inlineQueue[this.inlineQueue.length-1].src=c.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title});continue}if(l=this.tokenizer.table(i)){i=i.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.lheading(i)){i=i.substring(l.raw.length),s.push(l);continue}if(g=i,this.options.extensions&&this.options.extensions.startBlock){let w=1/0;const b=i.slice(1);let y;this.options.extensions.startBlock.forEach(k=>{y=k.call({lexer:this},b),typeof y=="number"&&y>=0&&(w=Math.min(w,y))}),w<1/0&&w>=0&&(g=i.substring(0,w+1))}if(this.state.top&&(l=this.tokenizer.paragraph(g))){c=s[s.length-1],p&&c.type==="paragraph"?(c.raw+=`
46
46
  `+l.raw,c.text+=`
47
- `+l.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=c.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),c=s[s.length-1],c&&c.type==="text"?(c.raw+=`
47
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=c.text):s.push(l),p=g.length!==i.length,i=i.substring(l.raw.length);continue}if(l=this.tokenizer.text(i)){i=i.substring(l.raw.length),c=s[s.length-1],c&&c.type==="text"?(c.raw+=`
48
48
  `+l.raw,c.text+=`
49
- `+l.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=c.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,c,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),c=s[s.length-1],c&&l.type==="text"&&c.type==="text"?(c.raw+=l.raw,c.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),c=s[s.length-1],c&&l.type==="text"&&c.type==="text"?(c.raw+=l.raw,c.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,c=s[s.length-1],c&&c.type==="text"?(c.raw+=l.raw,c.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 c=(g=(s||"").match(/^\S*/))==null?void 0:g[0];return a=a.replace(/\n$/,"")+`
50
- `,c?'<pre><code class="language-'+Lt(c)+'">'+(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}>
49
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=c.text):s.push(l);continue}if(i){const w="Infinite loop on byte: "+i.charCodeAt(0);if(this.options.silent){console.error(w);break}else throw new Error(w)}}return this.state.top=!0,s}inline(i,s=[]){return this.inlineQueue.push({src:i,tokens:s}),s}inlineTokens(i,s=[]){let l,c,g,p=i,w,b,y;if(this.tokens.links){const k=Object.keys(this.tokens.links);if(k.length>0)for(;(w=this.tokenizer.rules.inline.reflinkSearch.exec(p))!=null;)k.includes(w[0].slice(w[0].lastIndexOf("[")+1,-1))&&(p=p.slice(0,w.index)+"["+"a".repeat(w[0].length-2)+"]"+p.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(w=this.tokenizer.rules.inline.blockSkip.exec(p))!=null;)p=p.slice(0,w.index)+"["+"a".repeat(w[0].length-2)+"]"+p.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(w=this.tokenizer.rules.inline.anyPunctuation.exec(p))!=null;)p=p.slice(0,w.index)+"++"+p.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;i;)if(b||(y=""),b=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(k=>(l=k.call({lexer:this},i,s))?(i=i.substring(l.raw.length),s.push(l),!0):!1))){if(l=this.tokenizer.escape(i)){i=i.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.tag(i)){i=i.substring(l.raw.length),c=s[s.length-1],c&&l.type==="text"&&c.type==="text"?(c.raw+=l.raw,c.text+=l.text):s.push(l);continue}if(l=this.tokenizer.link(i)){i=i.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.reflink(i,this.tokens.links)){i=i.substring(l.raw.length),c=s[s.length-1],c&&l.type==="text"&&c.type==="text"?(c.raw+=l.raw,c.text+=l.text):s.push(l);continue}if(l=this.tokenizer.emStrong(i,p,y)){i=i.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.codespan(i)){i=i.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.br(i)){i=i.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.del(i)){i=i.substring(l.raw.length),s.push(l);continue}if(l=this.tokenizer.autolink(i)){i=i.substring(l.raw.length),s.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(i))){i=i.substring(l.raw.length),s.push(l);continue}if(g=i,this.options.extensions&&this.options.extensions.startInline){let k=1/0;const L=i.slice(1);let _;this.options.extensions.startInline.forEach(H=>{_=H.call({lexer:this},L),typeof _=="number"&&_>=0&&(k=Math.min(k,_))}),k<1/0&&k>=0&&(g=i.substring(0,k+1))}if(l=this.tokenizer.inlineText(g)){i=i.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(y=l.raw.slice(-1)),b=!0,c=s[s.length-1],c&&c.type==="text"?(c.raw+=l.raw,c.text+=l.text):s.push(l);continue}if(i){const k="Infinite loop on byte: "+i.charCodeAt(0);if(this.options.silent){console.error(k);break}else throw new Error(k)}}return s}}class Bi{constructor(i){qe(this,"options");this.options=i||Br}code(i,s,l){var g;const c=(g=(s||"").match(/^\S*/))==null?void 0:g[0];return i=i.replace(/\n$/,"")+`
50
+ `,c?'<pre><code class="language-'+zt(c)+'">'+(l?i:zt(i,!0))+`</code></pre>
51
+ `:"<pre><code>"+(l?i:zt(i,!0))+`</code></pre>
52
+ `}blockquote(i){return`<blockquote>
53
+ ${i}</blockquote>
54
+ `}html(i,s){return i}heading(i,s,l){return`<h${s}>${i}</h${s}>
55
55
  `}hr(){return`<hr>
56
- `}list(a,s,l){const c=s?"ol":"ul",g=s&&l!==1?' start="'+l+'"':"";return"<"+c+g+`>
57
- `+a+"</"+c+`>
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>
56
+ `}list(i,s,l){const c=s?"ol":"ul",g=s&&l!==1?' start="'+l+'"':"";return"<"+c+g+`>
57
+ `+i+"</"+c+`>
58
+ `}listitem(i,s,l){return`<li>${i}</li>
59
+ `}checkbox(i){return"<input "+(i?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(i){return`<p>${i}</p>
60
+ `}table(i,s){return s&&(s=`<tbody>${s}</tbody>`),`<table>
61
61
  <thead>
62
- `+a+`</thead>
62
+ `+i+`</thead>
63
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 c=go(a);if(c===null)return l;a=c;let g='<a href="'+a+'"';return s&&(g+=' title="'+s+'"'),g+=">"+l+"</a>",g}image(a,s,l){const c=go(a);if(c===null)return l;a=c;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 Vt{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 Vt(s).parse(a)}static parseInline(a,s){return new Vt(s).parseInline(a)}parse(a,s=!0){let l="";for(let c=0;c<a.length;c++){const g=a[c];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,Uf(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(;c+1<a.length&&a[c+1].type==="text";)p=a[++c],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 c=0;c<a.length;c++){const g=a[c];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 yc{constructor(...a){Nf(this,Br);Ne(this,"defaults",Ma());Ne(this,"options",this.setOptions);Ne(this,"parse",Da(this,Br,ao).call(this,Zt.lex,Vt.parse));Ne(this,"parseInline",Da(this,Br,ao).call(this,Zt.lexInline,Vt.parseInline));Ne(this,"Parser",Vt);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 c,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=(c=this.defaults.extensions)==null?void 0:c.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 c={...l};if(c.async=this.defaults.async||c.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)}),c.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||""}}c.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}}c.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}}c.hooks=g}if(l.walkTokens){const g=this.defaults.walkTokens,p=l.walkTokens;c.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,...c}}),this}setOptions(a){return this.defaults={...this.defaults,...a},this}lexer(a,s){return Zt.lex(a,s??this.defaults)}parser(a,s){return Vt.parse(a,s??this.defaults)}}Br=new WeakSet,ao=function(a,s){return(l,c)=>{const g={...c},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=Da(this,Br,Mf).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)}}},Mf=function(a,s){return l=>{if(l.message+=`
69
- Please report this to https://github.com/markedjs/marked.`,a){const c="<p>An error occurred:</p><pre>"+Lt(l.message+"",!0)+"</pre>";return s?Promise.resolve(c):c}if(s)return Promise.reject(l);throw l}};const Fr=new yc;function ve(f,a){return Fr.parse(f,a)}ve.options=ve.setOptions=function(f){return Fr.setOptions(f),ve.defaults=Fr.defaults,fo(ve.defaults),ve},ve.getDefaults=Ma,ve.defaults=Pr,ve.use=function(...f){return Fr.use(...f),ve.defaults=Fr.defaults,fo(ve.defaults),ve},ve.walkTokens=function(f,a){return Fr.walkTokens(f,a)},ve.parseInline=Fr.parseInline,ve.Parser=Vt,ve.parser=Vt.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,Vt.parse,Zt.lex;const bc=()=>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:bc(),timeout:36e5}),rn={getTraceList(f,a,s,l,c){const g={};return f&&(g.query=f),a&&(g.startTime=a),s&&(g.endTime=s),l&&(g.pageNo=l),c&&(g.pageSize=c),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(c=>c.data)}};function Lo(f,a,s,l,c,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 wc={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 c=f.get(s.parent_span_id);c?c.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 c=a(l.children);if(c)return c}}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,c=s/a*100,g=l/a*100;return{left:`${c}%`,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(),c=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}-${c}-${g} ${p}:${y}:${w}`}}};var xc=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,c){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)])])},kc=[],Sc=Lo(wc,xc,kc,!1,null,"4f00ade1");const $a=Sc.exports;/*!
64
+ `}tablerow(i){return`<tr>
65
+ ${i}</tr>
66
+ `}tablecell(i,s){const l=s.header?"th":"td";return(s.align?`<${l} align="${s.align}">`:`<${l}>`)+i+`</${l}>
67
+ `}strong(i){return`<strong>${i}</strong>`}em(i){return`<em>${i}</em>`}codespan(i){return`<code>${i}</code>`}br(){return"<br>"}del(i){return`<del>${i}</del>`}link(i,s,l){const c=go(i);if(c===null)return l;i=c;let g='<a href="'+i+'"';return s&&(g+=' title="'+s+'"'),g+=">"+l+"</a>",g}image(i,s,l){const c=go(i);if(c===null)return l;i=c;let g=`<img src="${i}" alt="${l}"`;return s&&(g+=` title="${s}"`),g+=">",g}text(i){return i}}class Ua{strong(i){return i}em(i){return i}codespan(i){return i}del(i){return i}html(i){return i}text(i){return i}link(i,s,l){return""+l}image(i,s,l){return""+l}br(){return""}}class fr{constructor(i){qe(this,"options");qe(this,"renderer");qe(this,"textRenderer");this.options=i||Br,this.options.renderer=this.options.renderer||new Bi,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Ua}static parse(i,s){return new fr(s).parse(i)}static parseInline(i,s){return new fr(s).parseInline(i)}parse(i,s=!0){let l="";for(let c=0;c<i.length;c++){const g=i[c];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[g.type]){const p=g,w=this.options.extensions.renderers[p.type].call({parser:this},p);if(w!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(p.type)){l+=w||"";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,Uf(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 w="",b="";for(let k=0;k<p.header.length;k++)b+=this.renderer.tablecell(this.parseInline(p.header[k].tokens),{header:!0,align:p.align[k]});w+=this.renderer.tablerow(b);let y="";for(let k=0;k<p.rows.length;k++){const L=p.rows[k];b="";for(let _=0;_<L.length;_++)b+=this.renderer.tablecell(this.parseInline(L[_].tokens),{header:!1,align:p.align[_]});y+=this.renderer.tablerow(b)}l+=this.renderer.table(w,y);continue}case"blockquote":{const p=g,w=this.parse(p.tokens);l+=this.renderer.blockquote(w);continue}case"list":{const p=g,w=p.ordered,b=p.start,y=p.loose;let k="";for(let L=0;L<p.items.length;L++){const _=p.items[L],H=_.checked,F=_.task;let U="";if(_.task){const M=this.renderer.checkbox(!!H);y?_.tokens.length>0&&_.tokens[0].type==="paragraph"?(_.tokens[0].text=M+" "+_.tokens[0].text,_.tokens[0].tokens&&_.tokens[0].tokens.length>0&&_.tokens[0].tokens[0].type==="text"&&(_.tokens[0].tokens[0].text=M+" "+_.tokens[0].tokens[0].text)):_.tokens.unshift({type:"text",text:M+" "}):U+=M+" "}U+=this.parse(_.tokens,y),k+=this.renderer.listitem(U,F,!!H)}l+=this.renderer.list(k,w,b);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,w=p.tokens?this.parseInline(p.tokens):p.text;for(;c+1<i.length&&i[c+1].type==="text";)p=i[++c],w+=`
68
+ `+(p.tokens?this.parseInline(p.tokens):p.text);l+=s?this.renderer.paragraph(w):w;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(i,s){s=s||this.renderer;let l="";for(let c=0;c<i.length;c++){const g=i[c];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 Zn{constructor(i){qe(this,"options");this.options=i||Br}preprocess(i){return i}postprocess(i){return i}processAllTokens(i){return i}}qe(Zn,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class yc{constructor(...i){Nf(this,Kr);qe(this,"defaults",za());qe(this,"options",this.setOptions);qe(this,"parse",Ma(this,Kr,ao).call(this,ur.lex,fr.parse));qe(this,"parseInline",Ma(this,Kr,ao).call(this,ur.lexInline,fr.parseInline));qe(this,"Parser",fr);qe(this,"Renderer",Bi);qe(this,"TextRenderer",Ua);qe(this,"Lexer",ur);qe(this,"Tokenizer",Fi);qe(this,"Hooks",Zn);this.use(...i)}walkTokens(i,s){var c,g;let l=[];for(const p of i)switch(l=l.concat(s.call(this,p)),p.type){case"table":{const w=p;for(const b of w.header)l=l.concat(this.walkTokens(b.tokens,s));for(const b of w.rows)for(const y of b)l=l.concat(this.walkTokens(y.tokens,s));break}case"list":{const w=p;l=l.concat(this.walkTokens(w.items,s));break}default:{const w=p;(g=(c=this.defaults.extensions)==null?void 0:c.childTokens)!=null&&g[w.type]?this.defaults.extensions.childTokens[w.type].forEach(b=>{const y=w[b].flat(1/0);l=l.concat(this.walkTokens(y,s))}):w.tokens&&(l=l.concat(this.walkTokens(w.tokens,s)))}}return l}use(...i){const s=this.defaults.extensions||{renderers:{},childTokens:{}};return i.forEach(l=>{const c={...l};if(c.async=this.defaults.async||c.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(...w){let b=g.renderer.apply(this,w);return b===!1&&(b=p.apply(this,w)),b}: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)}),c.extensions=s),l.renderer){const g=this.defaults.renderer||new Bi(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 w=p,b=l.renderer[w],y=g[w];g[w]=(...k)=>{let L=b.apply(g,k);return L===!1&&(L=y.apply(g,k)),L||""}}c.renderer=g}if(l.tokenizer){const g=this.defaults.tokenizer||new Fi(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 w=p,b=l.tokenizer[w],y=g[w];g[w]=(...k)=>{let L=b.apply(g,k);return L===!1&&(L=y.apply(g,k)),L}}c.tokenizer=g}if(l.hooks){const g=this.defaults.hooks||new Zn;for(const p in l.hooks){if(!(p in g))throw new Error(`hook '${p}' does not exist`);if(p==="options")continue;const w=p,b=l.hooks[w],y=g[w];Zn.passThroughHooks.has(p)?g[w]=k=>{if(this.defaults.async)return Promise.resolve(b.call(g,k)).then(_=>y.call(g,_));const L=b.call(g,k);return y.call(g,L)}:g[w]=(...k)=>{let L=b.apply(g,k);return L===!1&&(L=y.apply(g,k)),L}}c.hooks=g}if(l.walkTokens){const g=this.defaults.walkTokens,p=l.walkTokens;c.walkTokens=function(w){let b=[];return b.push(p.call(this,w)),g&&(b=b.concat(g.call(this,w))),b}}this.defaults={...this.defaults,...c}}),this}setOptions(i){return this.defaults={...this.defaults,...i},this}lexer(i,s){return ur.lex(i,s??this.defaults)}parser(i,s){return fr.parse(i,s??this.defaults)}}Kr=new WeakSet,ao=function(i,s){return(l,c)=>{const g={...c},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 w=Ma(this,Kr,Mf).call(this,!!p.silent,!!p.async);if(typeof l>"u"||l===null)return w(new Error("marked(): input parameter is undefined or null"));if(typeof l!="string")return w(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(b=>i(b,p)).then(b=>p.hooks?p.hooks.processAllTokens(b):b).then(b=>p.walkTokens?Promise.all(this.walkTokens(b,p.walkTokens)).then(()=>b):b).then(b=>s(b,p)).then(b=>p.hooks?p.hooks.postprocess(b):b).catch(w);try{p.hooks&&(l=p.hooks.preprocess(l));let b=i(l,p);p.hooks&&(b=p.hooks.processAllTokens(b)),p.walkTokens&&this.walkTokens(b,p.walkTokens);let y=s(b,p);return p.hooks&&(y=p.hooks.postprocess(y)),y}catch(b){return w(b)}}},Mf=function(i,s){return l=>{if(l.message+=`
69
+ Please report this to https://github.com/markedjs/marked.`,i){const c="<p>An error occurred:</p><pre>"+zt(l.message+"",!0)+"</pre>";return s?Promise.resolve(c):c}if(s)return Promise.reject(l);throw l}};const Ur=new yc;function _e(f,i){return Ur.parse(f,i)}_e.options=_e.setOptions=function(f){return Ur.setOptions(f),_e.defaults=Ur.defaults,fo(_e.defaults),_e},_e.getDefaults=za,_e.defaults=Br,_e.use=function(...f){return Ur.use(...f),_e.defaults=Ur.defaults,fo(_e.defaults),_e},_e.walkTokens=function(f,i){return Ur.walkTokens(f,i)},_e.parseInline=Ur.parseInline,_e.Parser=fr,_e.parser=fr.parse,_e.Renderer=Bi,_e.TextRenderer=Ua,_e.Lexer=ur,_e.lexer=ur.lex,_e.Tokenizer=Fi,_e.Hooks=Zn,_e.parse=_e,_e.options,_e.setOptions,_e.use,_e.walkTokens,_e.parseInline,fr.parse,ur.lex;const bc=()=>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",Ui=$t.create({baseURL:bc(),timeout:36e5}),on={getTraceList(f,i,s,l,c){const g={};return f&&(g.query=f),i&&(g.startTime=i),s&&(g.endTime=s),l&&(g.pageNo=l),c&&(g.pageSize=c),Ui.get("/v1/trace",{params:g}).then(p=>p.data)},getTraceDetail(f){return Ui.get(`/v1/trace/${f}`).then(i=>i.data)},getTraceSpans(f){return Ui.get(`/v1/trace/${f}/spans`).then(i=>i.data)},deleteTraces(f,i,s){const l={};return f&&(l.query=f),i&&(l.startTime=i),s&&(l.endTime=s),Ui.delete("/v1/trace",{params:l}).then(c=>c.data)}};function Lo(f,i,s,l,c,g,p,w){var b=typeof f=="function"?f.options:f;return i&&(b.render=i,b.staticRenderFns=s,b._compiled=!0),g&&(b._scopeId="data-v-"+g),{exports:f,options:b}}const wc={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:{getStatusDescription(f){var i;try{if(f.content){const s=typeof f.content=="string"?JSON.parse(f.content):f.content;return((i=s==null?void 0:s.status)==null?void 0:i.description)||""}return""}catch{return""}},buildTree(){if(!this.spans||this.spans.length===0){this.treeData=[];return}const f=new Map,i=[];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 c=f.get(s.parent_span_id);c?c.children.push(l):i.push(l)}else i.push(l)}),i.forEach(s=>{this.sortChildren(s)}),this.treeData=i,this.treeData.length>0&&this.expandedNodes.add(this.treeData[0].span_id)},sortChildren(f){f.children&&f.children.length>0&&(f.children.sort((i,s)=>i.start_time_unix_nano-s.start_time_unix_nano),f.children.forEach(i=>this.sortChildren(i)))},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 i=0,s=f;for(;s.parent_span_id;){i++;const l=this.findNodeById(s.parent_span_id);if(!l)break;s=l}return i},findNodeById(f){const i=s=>{for(const l of s){if(l.span_id===f)return l;if(l.children&&l.children.length>0){const c=i(l.children);if(c)return c}}return null};return i(this.treeData)},getTimelineBarStyle(f){if(!this.traceStartTime||!this.traceEndTime||this.traceStartTime===this.traceEndTime)return{width:"100%"};const i=this.traceEndTime-this.traceStartTime,s=f.start_time_unix_nano-this.traceStartTime,l=f.duration_ns,c=s/i*100,g=l/i*100;return{left:`${c}%`,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 i=f/1e6;return i<1e3?`${i.toFixed(2)}ms`:i<6e4?`${(i/1e3).toFixed(2)}s`:`${(i/6e4).toFixed(2)}min`},formatTime(f){if(!f)return"-";const i=f/1e6,s=new Date(i),l=s.getFullYear(),c=String(s.getMonth()+1).padStart(2,"0"),g=String(s.getDate()).padStart(2,"0"),p=String(s.getHours()).padStart(2,"0"),w=String(s.getMinutes()).padStart(2,"0"),b=String(s.getSeconds()).padStart(2,"0");return`${l}-${c}-${g} ${p}:${w}:${b}`}}};var xc=function(){var i=this,s=i._self._c;return s("div",{staticClass:"span-tree-container"},[i.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"},[i._v(i._s(i.formatTime(i.traceStartTime)))]),s("span",{staticClass:"time-end"},[i._v(i._s(i.formatTime(i.traceEndTime)))])])]),s("div",{ref:"timelineContent",staticClass:"timeline-content"},i._l(i.treeData,function(l,c){return s("div",{key:l.span_id},[s("div",{staticClass:"timeline-node",class:{selected:i.selectedSpanId===l.span_id,error:l.status==="ERROR"},on:{click:function(g){return i.handleNodeClick(l)}}},[s("div",{staticClass:"node-row"},[s("div",{staticClass:"node-info",style:{paddingLeft:`${i.getNodeDepth(l)*20}px`}},[i.hasChildren(l)?s("i",{staticClass:"expand-icon",class:i.isExpanded(l)?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:function(g){return g.stopPropagation(),i.toggleExpand(l)}}}):s("i",{staticClass:"expand-icon-placeholder"}),s("el-tag",{staticClass:"type-tag",attrs:{type:i.getTypeColor(l.type),size:"mini"}},[i._v(" "+i._s(l.type)+" ")]),s("el-tooltip",{attrs:{content:l.name,placement:"top","open-delay":300}},[s("span",{staticClass:"node-name"},[i._v(i._s(l.name))])])],1),s("div",{staticClass:"node-duration"},[i._v(" "+i._s(i.formatNanoDuration(l.duration_ns))+" ")])]),s("el-tooltip",{attrs:{content:i.getStatusDescription(l),disabled:!i.getStatusDescription(l),placement:"top","popper-class":"span-status-tooltip"}},[s("div",{staticClass:"timeline-bar-wrapper"},[s("div",{staticClass:"timeline-bar",class:{selected:i.selectedSpanId===l.span_id,error:l.status==="ERROR"},style:i.getTimelineBarStyle(l)})])])],1),i.isExpanded(l)&&i.hasChildren(l)?s("div",{staticClass:"children-nodes"},i._l(l.children,function(g){return s("div",{key:g.span_id},[s("div",{staticClass:"timeline-node child-node",class:{selected:i.selectedSpanId===g.span_id,error:g.status==="ERROR"},on:{click:function(p){return p.stopPropagation(),i.handleNodeClick(g)}}},[s("div",{staticClass:"node-row"},[s("div",{staticClass:"node-info",style:{paddingLeft:`${i.getNodeDepth(g)*20}px`}},[i.hasChildren(g)?s("i",{staticClass:"expand-icon",class:i.isExpanded(g)?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:function(p){return p.stopPropagation(),i.toggleExpand(g)}}}):s("i",{staticClass:"expand-icon-placeholder"}),s("el-tag",{staticClass:"type-tag",attrs:{type:i.getTypeColor(g.type),size:"mini"}},[i._v(" "+i._s(g.type)+" ")]),s("el-tooltip",{attrs:{content:g.name,placement:"top","open-delay":300}},[s("span",{staticClass:"node-name"},[i._v(i._s(g.name))])])],1),s("div",{staticClass:"node-duration"},[i._v(" "+i._s(i.formatNanoDuration(g.duration_ns))+" ")])]),s("el-tooltip",{attrs:{content:i.getStatusDescription(g),disabled:!i.getStatusDescription(g),placement:"top","popper-class":"span-status-tooltip"}},[s("div",{staticClass:"timeline-bar-wrapper"},[s("div",{staticClass:"timeline-bar",class:{selected:i.selectedSpanId===g.span_id,error:g.status==="ERROR"},style:i.getTimelineBarStyle(g)})])])],1),i.isExpanded(g)&&i.hasChildren(g)?s("div",{staticClass:"children-nodes"},i._l(g.children,function(p){return s("div",{key:p.span_id,staticClass:"timeline-node child-node",class:{selected:i.selectedSpanId===p.span_id,error:p.status==="ERROR"},on:{click:function(w){return w.stopPropagation(),i.handleNodeClick(p)}}},[s("div",{staticClass:"node-row"},[s("div",{staticClass:"node-info",style:{paddingLeft:`${i.getNodeDepth(p)*20}px`}},[s("i",{staticClass:"expand-icon-placeholder"}),s("el-tag",{staticClass:"type-tag",attrs:{type:i.getTypeColor(p.type),size:"mini"}},[i._v(" "+i._s(p.type)+" ")]),s("el-tooltip",{attrs:{content:p.name,placement:"top","open-delay":300}},[s("span",{staticClass:"node-name"},[i._v(i._s(p.name))])])],1),s("div",{staticClass:"node-duration"},[i._v(" "+i._s(i.formatNanoDuration(p.duration_ns))+" ")])]),s("el-tooltip",{attrs:{content:i.getStatusDescription(p),disabled:!i.getStatusDescription(p),placement:"top","popper-class":"span-status-tooltip"}},[s("div",{staticClass:"timeline-bar-wrapper"},[s("div",{staticClass:"timeline-bar",class:{selected:i.selectedSpanId===p.span_id,error:p.status==="ERROR"},style:i.getTimelineBarStyle(p)})])])],1)}),0):i._e()])}),0):i._e()])}),0)])])},kc=[],Sc=Lo(wc,xc,kc,!1,null,"326eec66");const ja=Sc.exports;/*!
70
70
  * Viewer.js v1.11.7
71
71
  * https://fengyuanchen.github.io/viewerjs
72
72
  *
@@ -74,15 +74,15 @@ Please report this to https://github.com/markedjs/marked.`,a){const c="<p>An err
74
74
  * Released under the MIT license
75
75
  *
76
76
  * Date: 2024-11-24T04:32:19.116Z
77
- */function Cc(f,a){if(!(f instanceof a))throw new TypeError("Cannot call a class as a function")}function _o(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,Oo(l.key),l)}}function Tc(f,a,s){return a&&_o(f.prototype,a),s&&_o(f,s),Object.defineProperty(f,"prototype",{writable:!1}),f}function Lc(f,a,s){return(a=Oo(a))in f?Object.defineProperty(f,a,{value:s,enumerable:!0,configurable:!0,writable:!0}):f[a]=s,f}function Ao(f,a){var s=Object.keys(f);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(f);a&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(f,c).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?Ao(Object(s),!0).forEach(function(l){Lc(f,l,s[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(s)):Ao(Object(s)).forEach(function(l){Object.defineProperty(f,l,Object.getOwnPropertyDescriptor(s,l))})}return f}function _c(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 Oo(f){var a=_c(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 Eo={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},Ac='<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,Ga=Hi?"PointerEvent"in or:!1,pe="viewer",Wi="move",Io="switch",Gn="zoom",Bi="".concat(pe,"-active"),Oc="".concat(pe,"-close"),$i="".concat(pe,"-fade"),qa="".concat(pe,"-fixed"),Ec="".concat(pe,"-fullscreen"),Do="".concat(pe,"-fullscreen-exit"),Hr="".concat(pe,"-hide"),Ic="".concat(pe,"-hide-md-down"),Dc="".concat(pe,"-hide-sm-down"),Nc="".concat(pe,"-hide-xs-down"),Mt="".concat(pe,"-in"),qn="".concat(pe,"-invisible"),an="".concat(pe,"-loading"),Mc="".concat(pe,"-move"),No="".concat(pe,"-open"),sn="".concat(pe,"-show"),$e="".concat(pe,"-transition"),on="click",Xa="dblclick",Mo="dragstart",Ro="focusin",zo="keydown",Rt="load",Wr="error",Rc=nn?"touchend touchcancel":"mouseup",zc=nn?"touchmove":"mousemove",Pc=nn?"touchstart":"mousedown",Po=Ga?"pointerdown":Pc,Fo=Ga?"pointermove":zc,Ho=Ga?"pointerup pointercancel":Rc,Wo="resize",Ft="transitionend",Bo="wheel",$o="ready",Uo="show",jo="shown",Go="hide",qo="hidden",Xo="view",Xn="viewed",Ko="move",Yo="moved",Zo="rotate",Vo="rotated",Qo="scale",Jo="scaled",el="zoom",tl="zoomed",rl="play",nl="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 Fc=Number.isNaN||or.isNaN;function Re(f){return typeof f=="number"&&!Fc(f)}function ln(f){return typeof f>"u"}function un(f){return ja(f)==="object"&&f!==null}var Hc=Object.prototype.hasOwnProperty;function fn(f){if(!un(f))return!1;try{var a=f.constructor,s=a.prototype;return a&&s&&Hc.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(c){a.call(f,f[c],c,f)});return f}var _t=Object.assign||function(a){for(var s=arguments.length,l=new Array(s>1?s-1:0),c=1;c<s;c++)l[c-1]=arguments[c];return un(a)&&l.length>0&&l.forEach(function(g){un(g)&&Object.keys(g).forEach(function(p){a[p]=g[p]})}),a},Wc=/^(?:width|height|left|top|marginLeft|marginTop)$/;function Ht(f,a){var s=f.style;Oe(a,function(l,c){Wc.test(c)&&Re(l)&&(l+="px"),s[c]=l})}function Bc(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 $c=/([a-z\d])([A-Z])/g;function Ya(f){return f.replace($c,"$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 il=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]:{},c=s;a.trim().split(Ka).forEach(function(g){if(!il){var p=f.listeners;p&&p[g]&&p[g][s]&&(c=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,c,l)})}function le(f,a,s){var l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},c=s;a.trim().split(Ka).forEach(function(g){if(l.once&&!il){var p=f.listeners,y=p===void 0?{}:p;c=function(){delete y[g][s],f.removeEventListener(g,c,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]=c,f.listeners=y}f.addEventListener(g,c,l)})}function je(f,a,s,l){var c;return _e(Event)&&_e(CustomEvent)?c=new CustomEvent(a,Ua({bubbles:!0,cancelable:!0,detail:s},l)):(c=document.createEvent("CustomEvent"),c.initCustomEvent(a,!0,!0,s)),f.dispatchEvent(c)}function Uc(f){var a=f.getBoundingClientRect();return{left:a.left+(window.pageXOffset-document.documentElement.clientLeft),top:a.top+(window.pageYOffset-document.documentElement.clientTop)}}function Gi(f){var a=f.rotate,s=f.scaleX,l=f.scaleY,c=f.translateX,g=f.translateY,p=[];Re(c)&&c!==0&&p.push("translateX(".concat(c,"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 jc(f){return Kn(f)?decodeURIComponent(f.replace(/^.*\//,"").replace(/[?&#].*$/,"")):""}var Va=or.navigator&&/Version\/\d+(\.\d+)+?\s+Safari/i.test(or.navigator.userAgent);function al(f,a,s){var l=document.createElement("img");if(f.naturalWidth&&!Va)return s(f.naturalWidth,f.naturalHeight),l;var c=document.body||document.documentElement;return l.onload=function(){s(l.width,l.height),Va||c.removeChild(l)},Oe(a.inheritedAttributes,function(g){var p=f.getAttribute(g);p!==null&&l.setAttribute(g,p)}),l.src=f.src,Va||(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;",c.appendChild(l)),l}function qi(f){switch(f){case 2:return Nc;case 3:return Dc;case 4:return Ic;default:return""}}function Gc(f){var a=Ua({},f),s=[];return Oe(f,function(l,c){delete a[c],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,c){return Math.abs(l)<Math.abs(c)}),s[0]}function Xi(f,a){var s=f.pageX,l=f.pageY,c={endX:s,endY:l};return a?c:Ua({timeStamp:Date.now(),startX:s,startY:l},c)}function qc(f){var a=0,s=0,l=0;return Oe(f,function(c){var g=c.startX,p=c.startY;a+=g,s+=p,l+=1}),a/=l,s/=l,{pageX:a,pageY:s}}var Xc={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,c=this.list,g=[];c.innerHTML="",Oe(this.images,function(p,y){var w=p.src,b=p.alt||jc(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),c.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(c,$e)},{once:!0})},renderList:function(){var a=this.index,s=this.items[a];if(s){var l=s.nextElementSibling,c=parseInt(window.getComputedStyle(l||s).marginLeft,10),g=s.offsetWidth,p=g+c;Ht(this.list,_t({width:p*this.length-c},Gi({translateX:(this.viewerData.width-g)/2-p*a})))}},resetList:function(){var a=this.list;a.innerHTML="",we(a,$e),Ht(a,Gi({translateX:0}))},initImage:function(a){var s=this,l=this.options,c=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=al(c,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,I=(w-N)/2,R={left:E,top:I,x:E,y:I,width:$,height:N,oldRatio:1,ratio:$/A,aspectRatio:H,naturalWidth:A,naturalHeight:L},q=_t({},R);l.rotatable&&(R.rotate=b.rotate||0,q.rotate=0),l.scalable&&(R.scaleX=b.scaleX||1,R.scaleY=b.scaleY||1,q.scaleX=1,q.scaleY=1),s.imageData=R,s.initialImageData=q,a&&a()})},renderImage:function(a){var s=this,l=this.image,c=this.imageData;if(Ht(l,_t({width:c.width,height:c.height,marginLeft:c.x,marginTop:c.y},Gi(c))),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="")}},Kc={bind:function(){var a=this.options,s=this.viewer,l=this.canvas,c=this.element.ownerDocument;le(s,on,this.onClick=this.click.bind(this)),le(s,Mo,this.onDragStart=this.dragstart.bind(this)),le(l,Po,this.onPointerDown=this.pointerdown.bind(this)),le(c,Fo,this.onPointerMove=this.pointermove.bind(this)),le(c,Ho,this.onPointerUp=this.pointerup.bind(this)),le(c,zo,this.onKeyDown=this.keydown.bind(this)),le(window,Wo,this.onResize=this.resize.bind(this)),a.zoomable&&a.zoomOnWheel&&le(s,Bo,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,c=this.element.ownerDocument;Ae(s,on,this.onClick),Ae(s,Mo,this.onDragStart),Ae(l,Po,this.onPointerDown),Ae(c,Fo,this.onPointerMove),Ae(c,Ho,this.onPointerUp),Ae(c,zo,this.onKeyDown),Ae(window,Wo,this.onResize),a.zoomable&&a.zoomOnWheel&&Ae(s,Bo,this.onWheel,{passive:!1,capture:!0}),a.toggleOnDblclick&&Ae(l,Xa,this.onDblclick)}},Yc={click:function(a){var s=this.options,l=this.imageData,c=a.target,g=hn(c,Ui);switch(!g&&c.localName==="img"&&c.parentElement.localName==="li"&&(c=c.parentElement,g=hn(c,Ui)),nn&&a.isTrusted&&c===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(c,"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,c=this.image,g=this.index,p=this.viewerData;we(c,qn),l.loading&&we(this.canvas,an),c.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(c,Mc,l.movable),Yn(c,$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:c},{cancelable:!1})})})},loadImage:function(a){var s=a.target,l=s.parentNode,c=l.offsetWidth||30,g=l.offsetHeight||50,p=!!hn(s,"filled");al(s,this.options,function(y,w){var b=y/w,k=c,A=g;g*b>c?p?k=g*b:A=c/b:p?A=c/b:k=g*b,Ht(s,_t({width:k,height:A},Gi({translateX:(c-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,c=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(c)&&c!==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=Gn:s.slideOnTouch&&(a.pointerType==="touch"||a.type==="touchstart")&&this.isSwitchable()&&(p=Io),s.transition&&(p===Wi||p===Gn)&&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(c){_t(s[c.identifier]||{},Xi(c,!0))}):_t(s[a.pointerId||0]||{},Xi(a,!0)),this.change(a))},pointerup:function(a){var s=this,l=this.options,c=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]),c&&(a.preventDefault(),l.transition&&(c===Wi||c===Gn)&&se(this.image,$e),this.action=!1,nn&&c!==Gn&&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,c=1;a.deltaY?c=a.deltaY>0?1:-1:a.wheelDelta?c=-a.wheelDelta/120:a.detail&&(c=a.detail>0?1:-1),this.zoom(-c*l,!0,null,a)}}},Zc={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,Uo,l.show,{once:!0}),je(s,Uo)===!1||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var c=this.viewer;if(we(c,Hr),c.setAttribute("role","dialog"),c.setAttribute("aria-labelledby",this.title.id),c.setAttribute("aria-modal",!0),c.removeAttribute("aria-hidden"),l.transition&&!a){var g=this.shown.bind(this);this.transitioning={abort:function(){Ae(c,Ft,g),we(c,Mt)}},se(c,$e),c.initialOffsetWidth=c.offsetWidth,le(c,Ft,g,{once:!0}),se(c,Mt)}else se(c,Mt),this.shown();return this},hide:function(){var a=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,l=this.element,c=this.options;if(c.inline||this.hiding||!(this.isShown||this.showing))return this;if(_e(c.hide)&&le(l,Go,c.hide,{once:!0}),je(l,Go)===!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(c.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,c=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(c.inheritedAttributes,function(N){var E=w.getAttribute(N);E!==null&&A.setAttribute(N,E)}),A.src=b,A.alt=k,_e(c.view)&&le(l,Xo,c.view,{once:!0}),je(l,Xo,{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),c.focus&&y.focus(),this.image=A,this.viewed=!1,this.index=s,this.imageData={},se(A,qn),c.loading&&se(p,an),p.innerHTML="",p.appendChild(A),this.renderList(),g.innerHTML="";var H=function(){var E=a.imageData,I=Array.isArray(c.title)?c.title[1]:c.title;g.innerHTML=Bc(_e(I)?I.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,qn),c.loading&&we(a.canvas,an)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){we(A,qn),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,c=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,Ko,p.move,{once:!0}),je(g,Ko,{x:a,y:l,oldX:w,oldY:b,originalEvent:c})===!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,Yo,p.moved,{once:!0}),je(g,Yo,{x:a,y:l,oldX:w,oldY:b,originalEvent:c},{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,c=this.options,g=this.imageData;if(a=Number(a),Re(a)&&this.viewed&&!this.played&&c.rotatable){var p=g.rotate;if(_e(c.rotate)&&le(l,Zo,c.rotate,{once:!0}),je(l,Zo,{degree:a,oldDegree:p})===!1)return this;g.rotate=a,this.rotating=!0,this.renderImage(function(){s.rotating=!1,_e(c.rotated)&&le(l,Vo,c.rotated,{once:!0}),je(l,Vo,{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,c=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(c,Qo,g.scale,{once:!0}),je(c,Qo,{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(c,Jo,g.scaled,{once:!0}),je(c,Jo,{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,c=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,c),this},zoomTo:function(a){var s=this,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,c=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),I=Math.min(100,w.maxZoomRatio);a=Math.min(Math.max(a,E),I)}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,q=N*a,Z=R-H,ee=q-P,ne=k.ratio;if(_e(w.zoom)&&le(y,el,w.zoom,{once:!0}),je(y,el,{ratio:a,oldRatio:ne,originalEvent:g})===!1)return this;if(this.zooming=!0,g){var ue=Uc(this.viewer),Ee=b&&Object.keys(b).length>0?qc(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(c)&&Re(c.x)&&Re(c.y)?(k.x-=Z*((c.x-A)/H),k.y-=ee*((c.y-L)/P)):(k.x-=Z/2,k.y-=ee/2);k.left=k.x,k.top=k.y,k.width=R,k.height=q,k.oldRatio=ne,k.ratio=a,this.renderImage(function(){s.zooming=!1,_e(w.zoomed)&&le(y,tl,w.zoomed,{once:!0}),je(y,tl,{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,c=this.options;if(_e(c.play)&&le(l,rl,c.play,{once:!0}),je(l,rl)===!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,c.transition),cn(L,Bi)&&(se($,Mt),b=H),y.push($),le($,Rt,p,{once:!0}),g.appendChild($)}),Re(c.interval)&&c.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,c.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,c.interval)};w>1&&(this.playing={prev:k,next:A,timeout:setTimeout(A,c.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,nl,l.stop,{once:!0}),je(s,nl)===!1)return this;var c=this.player;return clearTimeout(this.playing.timeout),this.playing=!1,this.played=!1,Oe(c.getElementsByTagName("img"),function(g){Ae(g,Rt,a.onLoadWhenPlay)}),we(c,sn),c.innerHTML="",this.exitFullscreen(),this},full:function(){var a=this,s=this.options,l=this.viewer,c=this.image,g=this.list;return!this.isShown||this.played||this.fulled||!s.inline?this:(this.fulled=!0,this.open(),se(this.button,Do),s.transition&&(we(g,$e),this.viewed&&we(c,$e)),se(l,qa),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(c,$e),se(g,$e)},0)})}),this)},exit:function(){var a=this,s=this.options,l=this.viewer,c=this.image,g=this.list;return!this.isShown||this.played||!this.fulled||!s.inline?this:(this.fulled=!1,this.close(),we(this.button,Do),s.transition&&(we(g,$e),this.viewed&&we(c,$e)),s.focus&&this.clearEnforceFocus(),l.removeAttribute("role"),l.removeAttribute("aria-labelledby"),l.removeAttribute("aria-modal"),we(l,qa),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(c,$e),se(g,$e)},0)})}),this)},tooltip:function(){var a=this,s=this.options,l=this.tooltipBox,c=this.imageData;return!this.viewed||this.played||!s.tooltip?this:(l.textContent="".concat(Math.round(c.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,c=this.isImg;if(c&&!s.parentNode)return this.destroy();var g=[];if(Oe(c?[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,Ro,this.onFocusin=function(s){var l=a.viewer,c=s.target;if(!(c===document||c===l||l.contains(c))){for(;c;){if(c.getAttribute("tabindex")!==null||c.getAttribute("aria-modal")==="true")return;c=c.parentElement}l.focus()}})},clearEnforceFocus:function(){this.onFocusin&&(Ae(document,Ro,this.onFocusin),this.onFocusin=null)},open:function(){var a=this.body;se(a,No),this.scrollbarWidth>0&&(a.style.paddingRight="".concat(this.scrollbarWidth+(parseFloat(this.initialBodyComputedPaddingRight)||0),"px"))},close:function(){var a=this.body;we(a,No),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,jo,s.shown,{once:!0}),je(a,jo)!==!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,qo,s.hidden,{once:!0}),je(a,qo,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,c=l[Object.keys(l)[0]];if(c){var g=c.endX-c.startX,p=c.endY-c.startY;switch(this.action){case Wi:(g!==0||p!==0)&&(this.pointerMoved=!0,this.move(g,p,a));break;case Gn:this.zoom(Gc(l),!1,null,a);break;case Io:{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}},Qc=or.Viewer,Jc=function(f){return function(){return f+=1,f}}(-1),sl=function(){function f(a){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Cc(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({},Eo,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=Jc(),this.init()}return Tc(f,[{key:"init",value:function(){var s=this,l=this.element,c=this.options;if(!l[pe]){l[pe]=this,c.focus&&!c.keyboard&&(c.focus=!1);var g=l.localName==="img",p=[];if(Oe(g?[l]:l.querySelectorAll("img"),function(b){_e(c.filter)?c.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)&&(c.transition=!1),c.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(c.filter)||c.filter.call(s,k))&&s.view(s.images.indexOf(k))})}}},{key:"build",value:function(){if(!this.ready){var s=this.element,l=this.options,c=s.parentNode,g=document.createElement("div");g.innerHTML=Ac;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=c,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?qi(Array.isArray(l.title)?l.title[0]:l.title):Hr),se(b,l.navbar?qi(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,qi(l.toolbar)),Oe(H?l.toolbar:ji,function(R,q){var Z=H&&fn(R),ee=H?Ya(q):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,qi(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,qn),Oe(E,function(R){w.appendChild(R)})}if(l.inline)se(k,Ec),Ht(p,{zIndex:l.zIndexInline}),window.getComputedStyle(c).position==="static"&&Ht(c,{position:"relative"}),c.insertBefore(p,s.nextSibling);else{se(k,Oc),se(p,qa),se(p,$i),se(p,Hr),Ht(p,{zIndex:l.zIndex});var I=l.container;Kn(I)&&(I=s.ownerDocument.querySelector(I)),I||(I=this.body),I.appendChild(p)}if(l.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,_e(l.ready)&&le(s,$o,l.ready,{once:!0}),je(s,$o)===!1){this.ready=!1;return}this.ready&&l.inline&&this.view(this.index)}}}],[{key:"noConflict",value:function(){return window.Viewer=Qc,f}},{key:"setDefaults",value:function(s){_t(Eo,fn(s)&&s)}}])}();_t(sl.prototype,Xc,Kc,Yc,Zc,Vc);var eh=typeof global=="object"&&global&&global.Object===Object&&global,ol=eh,th=typeof self=="object"&&self&&self.Object===Object&&self,rh=ol||th||Function("return this")(),Qa=rh,nh=Qa.Symbol,Ki=nh,ll=Object.prototype,ih=ll.hasOwnProperty,ah=ll.toString,Zn=Ki?Ki.toStringTag:void 0;function sh(f){var a=ih.call(f,Zn),s=f[Zn];try{f[Zn]=void 0;var l=!0}catch{}var c=ah.call(f);return l&&(a?f[Zn]=s:delete f[Zn]),c}var oh=Object.prototype,lh=oh.toString;function uh(f){return lh.call(f)}var fh="[object Null]",ch="[object Undefined]",ul=Ki?Ki.toStringTag:void 0;function Ja(f){return f==null?f===void 0?ch:fh:ul&&ul in Object(f)?sh(f):uh(f)}function es(f){return f!=null&&typeof f=="object"}var hh=Array.isArray,dh=hh;function ts(f){var a=typeof f;return f!=null&&(a=="object"||a=="function")}function fl(f){return f}var ph="[object AsyncFunction]",gh="[object Function]",vh="[object GeneratorFunction]",mh="[object Proxy]";function cl(f){if(!ts(f))return!1;var a=Ja(f);return a==gh||a==vh||a==ph||a==mh}var yh=Qa["__core-js_shared__"],rs=yh,hl=function(){var f=/[^.]+$/.exec(rs&&rs.keys&&rs.keys.IE_PROTO||"");return f?"Symbol(src)_1."+f:""}();function bh(f){return!!hl&&hl in f}var wh=Function.prototype,xh=wh.toString;function kh(f){if(f!=null){try{return xh.call(f)}catch{}try{return f+""}catch{}}return""}var Sh=/[\\^$.*+?()[\]{}|]/g,Ch=/^\[object .+?Constructor\]$/,Th=Function.prototype,Lh=Object.prototype,_h=Th.toString,Ah=Lh.hasOwnProperty,Oh=RegExp("^"+_h.call(Ah).replace(Sh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Eh(f){if(!ts(f)||bh(f))return!1;var a=cl(f)?Oh:Ch;return a.test(kh(f))}function Ih(f,a){return f==null?void 0:f[a]}function Dh(f,a){var s=Ih(f,a);return Eh(s)?s:void 0}function Nh(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 Mh=800,Rh=16,zh=Date.now;function Ph(f){var a=0,s=0;return function(){var l=zh(),c=Rh-(l-s);if(s=l,c>0){if(++a>=Mh)return arguments[0]}else a=0;return f.apply(void 0,arguments)}}function Fh(f){return function(){return f}}var Hh=function(){try{var f=Dh(Object,"defineProperty");return f({},"",{}),f}catch{}}(),Yi=Hh,Wh=Yi?function(f,a){return Yi(f,"toString",{configurable:!0,enumerable:!1,value:Fh(a),writable:!0})}:fl,Bh=Wh,$h=Ph(Bh),Uh=$h,jh=9007199254740991,Gh=/^(?:0|[1-9]\d*)$/;function dl(f,a){var s=typeof f;return a=a??jh,!!a&&(s=="number"||s!="symbol"&&Gh.test(f))&&f>-1&&f%1==0&&f<a}function pl(f,a,s){a=="__proto__"&&Yi?Yi(f,a,{configurable:!0,enumerable:!0,value:s,writable:!0}):f[a]=s}function gl(f,a){return f===a||f!==f&&a!==a}var qh=Object.prototype,Xh=qh.hasOwnProperty;function vl(f,a,s){var l=f[a];(!(Xh.call(f,a)&&gl(l,s))||s===void 0&&!(a in f))&&pl(f,a,s)}function Kh(f,a,s,l){var c=!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]),c?pl(s,y,w):vl(s,y,w)}return s}var ml=Math.max;function Yh(f,a,s){return a=ml(a===void 0?f.length-1:a,0),function(){for(var l=arguments,c=-1,g=ml(l.length-a,0),p=Array(g);++c<g;)p[c]=l[a+c];c=-1;for(var y=Array(a+1);++c<a;)y[c]=l[c];return y[a]=s(p),Nh(f,this,y)}}function Zh(f,a){return Uh(Yh(f,a,fl),f+"")}var Vh=9007199254740991;function yl(f){return typeof f=="number"&&f>-1&&f%1==0&&f<=Vh}function ns(f){return f!=null&&yl(f.length)&&!cl(f)}function Qh(f,a,s){if(!ts(s))return!1;var l=typeof a;return(l=="number"?ns(s)&&dl(a,s.length):l=="string"&&a in s)?gl(s[a],f):!1}function Jh(f){return Zh(function(a,s){var l=-1,c=s.length,g=c>1?s[c-1]:void 0,p=c>2?s[2]:void 0;for(g=f.length>3&&typeof g=="function"?(c--,g):void 0,p&&Qh(s[0],s[1],p)&&(g=c<3?void 0:g,c=1),a=Object(a);++l<c;){var y=s[l];y&&f(a,y,l,g)}return a})}var ed=Object.prototype;function bl(f){var a=f&&f.constructor,s=typeof a=="function"&&a.prototype||ed;return f===s}function td(f,a){for(var s=-1,l=Array(f);++s<f;)l[s]=a(s);return l}var rd="[object Arguments]";function wl(f){return es(f)&&Ja(f)==rd}var xl=Object.prototype,nd=xl.hasOwnProperty,id=xl.propertyIsEnumerable,ad=wl(function(){return arguments}())?wl:function(f){return es(f)&&nd.call(f,"callee")&&!id.call(f,"callee")},sd=ad;function od(){return!1}var kl=typeof de=="object"&&de&&!de.nodeType&&de,Sl=kl&&typeof module=="object"&&module&&!module.nodeType&&module,ld=Sl&&Sl.exports===kl,Cl=ld?Qa.Buffer:void 0,ud=Cl?Cl.isBuffer:void 0,fd=ud||od,cd=fd,hd="[object Arguments]",dd="[object Array]",pd="[object Boolean]",gd="[object Date]",vd="[object Error]",md="[object Function]",yd="[object Map]",bd="[object Number]",wd="[object Object]",xd="[object RegExp]",kd="[object Set]",Sd="[object String]",Cd="[object WeakMap]",Td="[object ArrayBuffer]",Ld="[object DataView]",_d="[object Float32Array]",Ad="[object Float64Array]",Od="[object Int8Array]",Ed="[object Int16Array]",Id="[object Int32Array]",Dd="[object Uint8Array]",Nd="[object Uint8ClampedArray]",Md="[object Uint16Array]",Rd="[object Uint32Array]",Ie={};Ie[_d]=Ie[Ad]=Ie[Od]=Ie[Ed]=Ie[Id]=Ie[Dd]=Ie[Nd]=Ie[Md]=Ie[Rd]=!0,Ie[hd]=Ie[dd]=Ie[Td]=Ie[pd]=Ie[Ld]=Ie[gd]=Ie[vd]=Ie[md]=Ie[yd]=Ie[bd]=Ie[wd]=Ie[xd]=Ie[kd]=Ie[Sd]=Ie[Cd]=!1;function zd(f){return es(f)&&yl(f.length)&&!!Ie[Ja(f)]}function Pd(f){return function(a){return f(a)}}var Tl=typeof de=="object"&&de&&!de.nodeType&&de,Vn=Tl&&typeof module=="object"&&module&&!module.nodeType&&module,Fd=Vn&&Vn.exports===Tl,is=Fd&&ol.process,Hd=function(){try{var f=Vn&&Vn.require&&Vn.require("util").types;return f||is&&is.binding&&is.binding("util")}catch{}}(),Ll=Hd,_l=Ll&&Ll.isTypedArray,Wd=_l?Pd(_l):zd,Bd=Wd,$d=Object.prototype,Ud=$d.hasOwnProperty;function jd(f,a){var s=dh(f),l=!s&&sd(f),c=!s&&!l&&cd(f),g=!s&&!l&&!c&&Bd(f),p=s||l||c||g,y=p?td(f.length,String):[],w=y.length;for(var b in f)Ud.call(f,b)&&!(p&&(b=="length"||c&&(b=="offset"||b=="parent")||g&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||dl(b,w)))&&y.push(b);return y}function Gd(f,a){return function(s){return f(a(s))}}var qd=Gd(Object.keys,Object),Xd=qd,Kd=Object.prototype,Yd=Kd.hasOwnProperty;function Zd(f){if(!bl(f))return Xd(f);var a=[];for(var s in Object(f))Yd.call(f,s)&&s!="constructor"&&a.push(s);return a}function Vd(f){return ns(f)?jd(f):Zd(f)}var Qd=Object.prototype,Jd=Qd.hasOwnProperty,ep=Jh(function(f,a){if(bl(a)||ns(a)){Kh(a,Vd(a),f);return}for(var s in a)Jd.call(a,s)&&vl(f,s,a[s])}),tp=ep;const rp=({images:f=[],options:a={}}={})=>{a=tp(a,{inline:!1});const s=Rf.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 c=new sl(l.$el,a),g=c.destroy.bind(c);return c.destroy=function(){return g(),l.$destroy(),document.body.removeChild(l.$el),c},c.show(),l.$el.addEventListener("hidden",function(){this.viewer===c&&c.destroy()}),c},np={name:"Trace",components:{TraceSpanTree:$a,codemirror:Ff.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_name}`: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,c]=await Promise.all([rn.getTraceDetail(f),rn.getTraceSpans(f)]);this.traceInfo=l||{},this.spans=c.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],this.activeTab=this.spans[0].type==="CLIENT"||this.spans[0].type==="CHAT_MODEL"?"io":"attributes",(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=f.type==="CLIENT"||f.type==="CHAT_MODEL"?"io":"attributes",(s=(a=this.selectedSpan.parsedContent)==null?void 0:a.inputs)!=null&&s.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((l,c)=>`message-${c}`):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 c,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")+`
77
+ */function Cc(f,i){if(!(f instanceof i))throw new TypeError("Cannot call a class as a function")}function _o(f,i){for(var s=0;s<i.length;s++){var l=i[s];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(f,Oo(l.key),l)}}function Tc(f,i,s){return i&&_o(f.prototype,i),s&&_o(f,s),Object.defineProperty(f,"prototype",{writable:!1}),f}function Lc(f,i,s){return(i=Oo(i))in f?Object.defineProperty(f,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):f[i]=s,f}function Eo(f,i){var s=Object.keys(f);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(f);i&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(f,c).enumerable})),s.push.apply(s,l)}return s}function qa(f){for(var i=1;i<arguments.length;i++){var s=arguments[i]!=null?arguments[i]:{};i%2?Eo(Object(s),!0).forEach(function(l){Lc(f,l,s[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(f,Object.getOwnPropertyDescriptors(s)):Eo(Object(s)).forEach(function(l){Object.defineProperty(f,l,Object.getOwnPropertyDescriptor(s,l))})}return f}function _c(f,i){if(typeof f!="object"||!f)return f;var s=f[Symbol.toPrimitive];if(s!==void 0){var l=s.call(f,i);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(f)}function Oo(f){var i=_c(f,"string");return typeof i=="symbol"?i:i+""}function Ka(f){"@babel/helpers - typeof";return Ka=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i},Ka(f)}var Ao={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},Ec='<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>',ji=typeof window<"u"&&typeof window.document<"u",mr=ji?window:{},ln=ji&&mr.document.documentElement?"ontouchstart"in mr.document.documentElement:!1,Ga=ji?"PointerEvent"in mr:!1,Se="viewer",qi="move",Io="switch",Qn="zoom",Ki="".concat(Se,"-active"),Oc="".concat(Se,"-close"),Gi="".concat(Se,"-fade"),Xa="".concat(Se,"-fixed"),Ac="".concat(Se,"-fullscreen"),Do="".concat(Se,"-fullscreen-exit"),jr="".concat(Se,"-hide"),Ic="".concat(Se,"-hide-md-down"),Dc="".concat(Se,"-hide-sm-down"),Nc="".concat(Se,"-hide-xs-down"),Bt="".concat(Se,"-in"),Jn="".concat(Se,"-invisible"),un="".concat(Se,"-loading"),Mc="".concat(Se,"-move"),No="".concat(Se,"-open"),fn="".concat(Se,"-show"),Je="".concat(Se,"-transition"),cn="click",Ya="dblclick",Mo="dragstart",Ro="focusin",zo="keydown",Ut="load",qr="error",Rc=ln?"touchend touchcancel":"mouseup",zc=ln?"touchmove":"mousemove",Pc=ln?"touchstart":"mousedown",Po=Ga?"pointerdown":Pc,Fo=Ga?"pointermove":zc,Wo=Ga?"pointerup pointercancel":Rc,Ho="resize",Vt="transitionend",$o="wheel",Bo="ready",Uo="show",jo="shown",qo="hide",Ko="hidden",Go="view",ei="viewed",Xo="move",Yo="moved",Vo="rotate",Zo="rotated",Qo="scale",Jo="scaled",el="zoom",tl="zoomed",rl="play",nl="stop",Xi="".concat(Se,"Action"),Va=/\s\s*/,Yi=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function ti(f){return typeof f=="string"}var Fc=Number.isNaN||mr.isNaN;function Ge(f){return typeof f=="number"&&!Fc(f)}function hn(f){return typeof f>"u"}function dn(f){return Ka(f)==="object"&&f!==null}var Wc=Object.prototype.hasOwnProperty;function pn(f){if(!dn(f))return!1;try{var i=f.constructor,s=i.prototype;return i&&s&&Wc.call(s,"isPrototypeOf")}catch{return!1}}function He(f){return typeof f=="function"}function Be(f,i){if(f&&He(i))if(Array.isArray(f)||Ge(f.length)){var s=f.length,l;for(l=0;l<s&&i.call(f,f[l],l,f)!==!1;l+=1);}else dn(f)&&Object.keys(f).forEach(function(c){i.call(f,f[c],c,f)});return f}var Pt=Object.assign||function(i){for(var s=arguments.length,l=new Array(s>1?s-1:0),c=1;c<s;c++)l[c-1]=arguments[c];return dn(i)&&l.length>0&&l.forEach(function(g){dn(g)&&Object.keys(g).forEach(function(p){i[p]=g[p]})}),i},Hc=/^(?:width|height|left|top|marginLeft|marginTop)$/;function Zt(f,i){var s=f.style;Be(i,function(l,c){Hc.test(c)&&Ge(l)&&(l+="px"),s[c]=l})}function $c(f){return ti(f)?f.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):f}function gn(f,i){return!f||!i?!1:f.classList?f.classList.contains(i):f.className.indexOf(i)>-1}function ve(f,i){if(!(!f||!i)){if(Ge(f.length)){Be(f,function(l){ve(l,i)});return}if(f.classList){f.classList.add(i);return}var s=f.className.trim();s?s.indexOf(i)<0&&(f.className="".concat(s," ").concat(i)):f.className=i}}function De(f,i){if(!(!f||!i)){if(Ge(f.length)){Be(f,function(s){De(s,i)});return}if(f.classList){f.classList.remove(i);return}f.className.indexOf(i)>=0&&(f.className=f.className.replace(i,""))}}function ri(f,i,s){if(i){if(Ge(f.length)){Be(f,function(l){ri(l,i,s)});return}s?ve(f,i):De(f,i)}}var Bc=/([a-z\d])([A-Z])/g;function Za(f){return f.replace(Bc,"$1-$2").toLowerCase()}function vn(f,i){return dn(f[i])?f[i]:f.dataset?f.dataset[i]:f.getAttribute("data-".concat(Za(i)))}function Qa(f,i,s){dn(s)?f[i]=s:f.dataset?f.dataset[i]=s:f.setAttribute("data-".concat(Za(i)),s)}var il=function(){var f=!1;if(ji){var i=!1,s=function(){},l=Object.defineProperty({},"once",{get:function(){return f=!0,i},set:function(g){i=g}});mr.addEventListener("test",s,l),mr.removeEventListener("test",s,l)}return f}();function $e(f,i,s){var l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},c=s;i.trim().split(Va).forEach(function(g){if(!il){var p=f.listeners;p&&p[g]&&p[g][s]&&(c=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,c,l)})}function me(f,i,s){var l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},c=s;i.trim().split(Va).forEach(function(g){if(l.once&&!il){var p=f.listeners,w=p===void 0?{}:p;c=function(){delete w[g][s],f.removeEventListener(g,c,l);for(var y=arguments.length,k=new Array(y),L=0;L<y;L++)k[L]=arguments[L];s.apply(f,k)},w[g]||(w[g]={}),w[g][s]&&f.removeEventListener(g,w[g][s],l),w[g][s]=c,f.listeners=w}f.addEventListener(g,c,l)})}function tt(f,i,s,l){var c;return He(Event)&&He(CustomEvent)?c=new CustomEvent(i,qa({bubbles:!0,cancelable:!0,detail:s},l)):(c=document.createEvent("CustomEvent"),c.initCustomEvent(i,!0,!0,s)),f.dispatchEvent(c)}function Uc(f){var i=f.getBoundingClientRect();return{left:i.left+(window.pageXOffset-document.documentElement.clientLeft),top:i.top+(window.pageYOffset-document.documentElement.clientTop)}}function Vi(f){var i=f.rotate,s=f.scaleX,l=f.scaleY,c=f.translateX,g=f.translateY,p=[];Ge(c)&&c!==0&&p.push("translateX(".concat(c,"px)")),Ge(g)&&g!==0&&p.push("translateY(".concat(g,"px)")),Ge(i)&&i!==0&&p.push("rotate(".concat(i,"deg)")),Ge(s)&&s!==1&&p.push("scaleX(".concat(s,")")),Ge(l)&&l!==1&&p.push("scaleY(".concat(l,")"));var w=p.length?p.join(" "):"none";return{WebkitTransform:w,msTransform:w,transform:w}}function jc(f){return ti(f)?decodeURIComponent(f.replace(/^.*\//,"").replace(/[?&#].*$/,"")):""}var Ja=mr.navigator&&/Version\/\d+(\.\d+)+?\s+Safari/i.test(mr.navigator.userAgent);function al(f,i,s){var l=document.createElement("img");if(f.naturalWidth&&!Ja)return s(f.naturalWidth,f.naturalHeight),l;var c=document.body||document.documentElement;return l.onload=function(){s(l.width,l.height),Ja||c.removeChild(l)},Be(i.inheritedAttributes,function(g){var p=f.getAttribute(g);p!==null&&l.setAttribute(g,p)}),l.src=f.src,Ja||(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;",c.appendChild(l)),l}function Zi(f){switch(f){case 2:return Nc;case 3:return Dc;case 4:return Ic;default:return""}}function qc(f){var i=qa({},f),s=[];return Be(f,function(l,c){delete i[c],Be(i,function(g){var p=Math.abs(l.startX-g.startX),w=Math.abs(l.startY-g.startY),b=Math.abs(l.endX-g.endX),y=Math.abs(l.endY-g.endY),k=Math.sqrt(p*p+w*w),L=Math.sqrt(b*b+y*y),_=(L-k)/k;s.push(_)})}),s.sort(function(l,c){return Math.abs(l)<Math.abs(c)}),s[0]}function Qi(f,i){var s=f.pageX,l=f.pageY,c={endX:s,endY:l};return i?c:qa({timeStamp:Date.now(),startX:s,startY:l},c)}function Kc(f){var i=0,s=0,l=0;return Be(f,function(c){var g=c.startX,p=c.startY;i+=g,s+=p,l+=1}),i/=l,s/=l,{pageX:i,pageY:s}}var Gc={render:function(){this.initContainer(),this.initViewer(),this.initList(),this.renderViewer()},initBody:function(){var i=this.element.ownerDocument,s=i.body||i.documentElement;this.body=s,this.scrollbarWidth=window.innerWidth-i.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 i=this.options,s=this.parent,l;i.inline&&(l={width:Math.max(s.offsetWidth,i.minWidth),height:Math.max(s.offsetHeight,i.minHeight)},this.parentData=l),(this.fulled||!l)&&(l=this.containerData),this.viewerData=Pt({},l)},renderViewer:function(){this.options.inline&&!this.fulled&&Zt(this.viewer,this.viewerData)},initList:function(){var i=this,s=this.element,l=this.options,c=this.list,g=[];c.innerHTML="",Be(this.images,function(p,w){var b=p.src,y=p.alt||jc(b),k=i.getImageURL(p);if(b||k){var L=document.createElement("li"),_=document.createElement("img");Be(l.inheritedAttributes,function(H){var F=p.getAttribute(H);F!==null&&_.setAttribute(H,F)}),l.navbar&&(_.src=b||k),_.alt=y,_.setAttribute("data-original-url",k||b),L.setAttribute("data-index",w),L.setAttribute("data-viewer-action","view"),L.setAttribute("role","button"),l.keyboard&&L.setAttribute("tabindex",0),L.appendChild(_),c.appendChild(L),g.push(L)}}),this.items=g,Be(g,function(p){var w=p.firstElementChild,b,y;Qa(w,"filled",!0),l.loading&&ve(p,un),me(w,Ut,b=function(L){$e(w,qr,y),l.loading&&De(p,un),i.loadImage(L)},{once:!0}),me(w,qr,y=function(){$e(w,Ut,b),l.loading&&De(p,un)},{once:!0})}),l.transition&&me(s,ei,function(){ve(c,Je)},{once:!0})},renderList:function(){var i=this.index,s=this.items[i];if(s){var l=s.nextElementSibling,c=parseInt(window.getComputedStyle(l||s).marginLeft,10),g=s.offsetWidth,p=g+c;Zt(this.list,Pt({width:p*this.length-c},Vi({translateX:(this.viewerData.width-g)/2-p*i})))}},resetList:function(){var i=this.list;i.innerHTML="",De(i,Je),Zt(i,Vi({translateX:0}))},initImage:function(i){var s=this,l=this.options,c=this.image,g=this.viewerData,p=this.footer.offsetHeight,w=g.width,b=Math.max(g.height-p,p),y=this.imageData||{},k;this.imageInitializing={abort:function(){k.onload=null}},k=al(c,l,function(L,_){var H=L/_,F=Math.max(0,Math.min(1,l.initialCoverage)),U=w,M=b;s.imageInitializing=!1,b*H>w?M=w/H:U=b*H,F=Ge(F)?F:.9,U=Math.min(U*F,L),M=Math.min(M*F,_);var A=(w-U)/2,D=(b-M)/2,P={left:A,top:D,x:A,y:D,width:U,height:M,oldRatio:1,ratio:U/L,aspectRatio:H,naturalWidth:L,naturalHeight:_},G=Pt({},P);l.rotatable&&(P.rotate=y.rotate||0,G.rotate=0),l.scalable&&(P.scaleX=y.scaleX||1,P.scaleY=y.scaleY||1,G.scaleX=1,G.scaleY=1),s.imageData=P,s.initialImageData=G,i&&i()})},renderImage:function(i){var s=this,l=this.image,c=this.imageData;if(Zt(l,Pt({width:c.width,height:c.height,marginLeft:c.x,marginTop:c.y},Vi(c))),i)if((this.viewing||this.moving||this.rotating||this.scaling||this.zooming)&&this.options.transition&&gn(l,Je)){var g=function(){s.imageRendering=!1,i()};this.imageRendering={abort:function(){$e(l,Vt,g)}},me(l,Vt,g,{once:!0})}else i()},resetImage:function(){var i=this.image;i&&(this.viewing&&this.viewing.abort(),i.parentNode.removeChild(i),this.image=null,this.title.innerHTML="")}},Xc={bind:function(){var i=this.options,s=this.viewer,l=this.canvas,c=this.element.ownerDocument;me(s,cn,this.onClick=this.click.bind(this)),me(s,Mo,this.onDragStart=this.dragstart.bind(this)),me(l,Po,this.onPointerDown=this.pointerdown.bind(this)),me(c,Fo,this.onPointerMove=this.pointermove.bind(this)),me(c,Wo,this.onPointerUp=this.pointerup.bind(this)),me(c,zo,this.onKeyDown=this.keydown.bind(this)),me(window,Ho,this.onResize=this.resize.bind(this)),i.zoomable&&i.zoomOnWheel&&me(s,$o,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),i.toggleOnDblclick&&me(l,Ya,this.onDblclick=this.dblclick.bind(this))},unbind:function(){var i=this.options,s=this.viewer,l=this.canvas,c=this.element.ownerDocument;$e(s,cn,this.onClick),$e(s,Mo,this.onDragStart),$e(l,Po,this.onPointerDown),$e(c,Fo,this.onPointerMove),$e(c,Wo,this.onPointerUp),$e(c,zo,this.onKeyDown),$e(window,Ho,this.onResize),i.zoomable&&i.zoomOnWheel&&$e(s,$o,this.onWheel,{passive:!1,capture:!0}),i.toggleOnDblclick&&$e(l,Ya,this.onDblclick)}},Yc={click:function(i){var s=this.options,l=this.imageData,c=i.target,g=vn(c,Xi);switch(!g&&c.localName==="img"&&c.parentElement.localName==="li"&&(c=c.parentElement,g=vn(c,Xi)),ln&&i.isTrusted&&c===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(vn(c,"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(i){i.preventDefault(),this.viewed&&i.target===this.image&&(ln&&i.isTrusted&&clearTimeout(this.doubleClickImageTimeout),this.toggle(i.isTrusted?i:i.detail&&i.detail.originalEvent))},load:function(){var i=this;this.timeout&&(clearTimeout(this.timeout),this.timeout=!1);var s=this.element,l=this.options,c=this.image,g=this.index,p=this.viewerData;De(c,Jn),l.loading&&De(this.canvas,un),c.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(){ri(c,Mc,l.movable),ri(c,Je,l.transition),i.renderImage(function(){i.viewed=!0,i.viewing=!1,He(l.viewed)&&me(s,ei,l.viewed,{once:!0}),tt(s,ei,{originalImage:i.images[g],index:g,image:c},{cancelable:!1})})})},loadImage:function(i){var s=i.target,l=s.parentNode,c=l.offsetWidth||30,g=l.offsetHeight||50,p=!!vn(s,"filled");al(s,this.options,function(w,b){var y=w/b,k=c,L=g;g*y>c?p?k=g*y:L=c/y:p?L=c/y:k=g*y,Zt(s,Pt({width:k,height:L},Vi({translateX:(c-k)/2,translateY:(g-L)/2})))})},keydown:function(i){var s=this.options;if(s.keyboard){var l=i.keyCode||i.which||i.charCode;switch(l){case 13:this.viewer.contains(i.target)&&this.click(i);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:i.preventDefault(),this.zoom(s.zoomRatio,!0);break;case 39:this.played&&this.playing?this.playing.next():this.next(s.loop);break;case 40:i.preventDefault(),this.zoom(-s.zoomRatio,!0);break;case 48:case 49:i.ctrlKey&&(i.preventDefault(),this.toggle());break}}},dragstart:function(i){i.target.localName==="img"&&i.preventDefault()},pointerdown:function(i){var s=this.options,l=this.pointers,c=i.buttons,g=i.button;if(this.pointerMoved=!1,!(!this.viewed||this.showing||this.viewing||this.hiding||(i.type==="mousedown"||i.type==="pointerdown"&&i.pointerType==="mouse")&&(Ge(c)&&c!==1||Ge(g)&&g!==0||i.ctrlKey))){i.preventDefault(),i.changedTouches?Be(i.changedTouches,function(w){l[w.identifier]=Qi(w)}):l[i.pointerId||0]=Qi(i);var p=s.movable?qi:!1;s.zoomOnTouch&&s.zoomable&&Object.keys(l).length>1?p=Qn:s.slideOnTouch&&(i.pointerType==="touch"||i.type==="touchstart")&&this.isSwitchable()&&(p=Io),s.transition&&(p===qi||p===Qn)&&De(this.image,Je),this.action=p}},pointermove:function(i){var s=this.pointers,l=this.action;!this.viewed||!l||(i.preventDefault(),i.changedTouches?Be(i.changedTouches,function(c){Pt(s[c.identifier]||{},Qi(c,!0))}):Pt(s[i.pointerId||0]||{},Qi(i,!0)),this.change(i))},pointerup:function(i){var s=this,l=this.options,c=this.action,g=this.pointers,p;i.changedTouches?Be(i.changedTouches,function(w){p=g[w.identifier],delete g[w.identifier]}):(p=g[i.pointerId||0],delete g[i.pointerId||0]),c&&(i.preventDefault(),l.transition&&(c===qi||c===Qn)&&ve(this.image,Je),this.action=!1,ln&&c!==Qn&&p&&Date.now()-p.timeStamp<500&&(clearTimeout(this.clickCanvasTimeout),clearTimeout(this.doubleClickImageTimeout),l.toggleOnDblclick&&this.viewed&&i.target===this.image?this.imageClicked?(this.imageClicked=!1,this.doubleClickImageTimeout=setTimeout(function(){tt(s.image,Ya,{originalEvent:i})},50)):(this.imageClicked=!0,this.doubleClickImageTimeout=setTimeout(function(){s.imageClicked=!1},500)):(this.imageClicked=!1,l.backdrop&&l.backdrop!=="static"&&i.target===this.canvas&&(this.clickCanvasTimeout=setTimeout(function(){tt(s.canvas,cn,{originalEvent:i})},50)))))},resize:function(){var i=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(){i.renderImage()}),this.played)){if(this.options.fullscreen&&this.fulled&&!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)){this.stop();return}Be(this.player.getElementsByTagName("img"),function(s){me(s,Ut,i.loadImage.bind(i),{once:!0}),tt(s,Ut)})}},wheel:function(i){var s=this;if(this.viewed&&(i.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){s.wheeling=!1},50);var l=Number(this.options.zoomRatio)||.1,c=1;i.deltaY?c=i.deltaY>0?1:-1:i.wheelDelta?c=-i.wheelDelta/120:i.detail&&(c=i.detail>0?1:-1),this.zoom(-c*l,!0,null,i)}}},Vc={show:function(){var i=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(i),this;if(He(l.show)&&me(s,Uo,l.show,{once:!0}),tt(s,Uo)===!1||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var c=this.viewer;if(De(c,jr),c.setAttribute("role","dialog"),c.setAttribute("aria-labelledby",this.title.id),c.setAttribute("aria-modal",!0),c.removeAttribute("aria-hidden"),l.transition&&!i){var g=this.shown.bind(this);this.transitioning={abort:function(){$e(c,Vt,g),De(c,Bt)}},ve(c,Je),c.initialOffsetWidth=c.offsetWidth,me(c,Vt,g,{once:!0}),ve(c,Bt)}else ve(c,Bt),this.shown();return this},hide:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,l=this.element,c=this.options;if(c.inline||this.hiding||!(this.isShown||this.showing))return this;if(He(c.hide)&&me(l,qo,c.hide,{once:!0}),tt(l,qo)===!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,w=function(){De(g,Bt),i.hidden()};if(c.transition&&!s){var b=function(L){L&&L.target===g&&($e(g,Vt,b),i.hidden())},y=function(){gn(g,Je)?(me(g,Vt,b),De(g,Bt)):w()};this.transitioning={abort:function(){i.viewed&&gn(p,Je)?$e(p,Vt,y):gn(g,Je)&&$e(g,Vt,b)}},this.viewed&&gn(p,Je)?(me(p,Vt,y,{once:!0}),this.zoomTo(0,!1,null,null,!0)):y()}else w();return this},view:function(){var i=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,c=this.options,g=this.title,p=this.canvas,w=this.items[s],b=w.querySelector("img"),y=vn(b,"originalUrl"),k=b.getAttribute("alt"),L=document.createElement("img");if(Be(c.inheritedAttributes,function(M){var A=b.getAttribute(M);A!==null&&L.setAttribute(M,A)}),L.src=y,L.alt=k,He(c.view)&&me(l,Go,c.view,{once:!0}),tt(l,Go,{originalImage:this.images[s],index:s,image:L})===!1||!this.isShown||this.hiding||this.played)return this;var _=this.items[this.index];_&&(De(_,Ki),_.removeAttribute("aria-selected")),ve(w,Ki),w.setAttribute("aria-selected",!0),c.focus&&w.focus(),this.image=L,this.viewed=!1,this.index=s,this.imageData={},ve(L,Jn),c.loading&&ve(p,un),p.innerHTML="",p.appendChild(L),this.renderList(),g.innerHTML="";var H=function(){var A=i.imageData,D=Array.isArray(c.title)?c.title[1]:c.title;g.innerHTML=$c(He(D)?D.call(i,L,A):"".concat(k," (").concat(A.naturalWidth," × ").concat(A.naturalHeight,")"))},F,U;return me(l,ei,H,{once:!0}),this.viewing={abort:function(){$e(l,ei,H),L.complete?i.imageRendering?i.imageRendering.abort():i.imageInitializing&&i.imageInitializing.abort():(L.src="",$e(L,Ut,F),i.timeout&&clearTimeout(i.timeout))}},L.complete?this.load():(me(L,Ut,F=function(){$e(L,qr,U),i.load()},{once:!0}),me(L,qr,U=function(){$e(L,Ut,F),i.timeout&&(clearTimeout(i.timeout),i.timeout=!1),De(L,Jn),c.loading&&De(i.canvas,un)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){De(L,Jn),i.timeout=!1},1e3)),this},prev:function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,s=this.index-1;return s<0&&(s=i?this.length-1:0),this.view(s),this},next:function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,s=this.length-1,l=this.index+1;return l>s&&(l=i?0:s),this.view(l),this},move:function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i,l=this.imageData;return this.moveTo(hn(i)?i:l.x+Number(i),hn(s)?s:l.y+Number(s)),this},moveTo:function(i){var s=this,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,g=this.element,p=this.options,w=this.imageData;if(i=Number(i),l=Number(l),this.viewed&&!this.played&&p.movable){var b=w.x,y=w.y,k=!1;if(Ge(i)?k=!0:i=b,Ge(l)?k=!0:l=y,k){if(He(p.move)&&me(g,Xo,p.move,{once:!0}),tt(g,Xo,{x:i,y:l,oldX:b,oldY:y,originalEvent:c})===!1)return this;w.x=i,w.y=l,w.left=i,w.top=l,this.moving=!0,this.renderImage(function(){s.moving=!1,He(p.moved)&&me(g,Yo,p.moved,{once:!0}),tt(g,Yo,{x:i,y:l,oldX:b,oldY:y,originalEvent:c},{cancelable:!1})})}}return this},rotate:function(i){return this.rotateTo((this.imageData.rotate||0)+Number(i)),this},rotateTo:function(i){var s=this,l=this.element,c=this.options,g=this.imageData;if(i=Number(i),Ge(i)&&this.viewed&&!this.played&&c.rotatable){var p=g.rotate;if(He(c.rotate)&&me(l,Vo,c.rotate,{once:!0}),tt(l,Vo,{degree:i,oldDegree:p})===!1)return this;g.rotate=i,this.rotating=!0,this.renderImage(function(){s.rotating=!1,He(c.rotated)&&me(l,Zo,c.rotated,{once:!0}),tt(l,Zo,{degree:i,oldDegree:p},{cancelable:!1})})}return this},scaleX:function(i){return this.scale(i,this.imageData.scaleY),this},scaleY:function(i){return this.scale(this.imageData.scaleX,i),this},scale:function(i){var s=this,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:i,c=this.element,g=this.options,p=this.imageData;if(i=Number(i),l=Number(l),this.viewed&&!this.played&&g.scalable){var w=p.scaleX,b=p.scaleY,y=!1;if(Ge(i)?y=!0:i=w,Ge(l)?y=!0:l=b,y){if(He(g.scale)&&me(c,Qo,g.scale,{once:!0}),tt(c,Qo,{scaleX:i,scaleY:l,oldScaleX:w,oldScaleY:b})===!1)return this;p.scaleX=i,p.scaleY=l,this.scaling=!0,this.renderImage(function(){s.scaling=!1,He(g.scaled)&&me(c,Jo,g.scaled,{once:!0}),tt(c,Jo,{scaleX:i,scaleY:l,oldScaleX:w,oldScaleY:b},{cancelable:!1})})}}return this},zoom:function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,g=this.imageData;return i=Number(i),i<0?i=1/(1-i):i=1+i,this.zoomTo(g.width*i/g.naturalWidth,s,l,c),this},zoomTo:function(i){var s=this,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,c=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,w=this.element,b=this.options,y=this.pointers,k=this.imageData,L=k.x,_=k.y,H=k.width,F=k.height,U=k.naturalWidth,M=k.naturalHeight;if(i=Math.max(0,i),Ge(i)&&this.viewed&&!this.played&&(p||b.zoomable)){if(!p){var A=Math.max(.01,b.minZoomRatio),D=Math.min(100,b.maxZoomRatio);i=Math.min(Math.max(i,A),D)}if(g)switch(g.type){case"wheel":b.zoomRatio>=.055&&i>.95&&i<1.05&&(i=1);break;case"pointermove":case"touchmove":case"mousemove":i>.99&&i<1.01&&(i=1);break}var P=U*i,G=M*i,J=P-H,ne=G-F,te=k.ratio;if(He(b.zoom)&&me(w,el,b.zoom,{once:!0}),tt(w,el,{ratio:i,oldRatio:te,originalEvent:g})===!1)return this;if(this.zooming=!0,g){var fe=Uc(this.viewer),Me=y&&Object.keys(y).length>0?Kc(y):{pageX:g.pageX,pageY:g.pageY};k.x-=J*((Me.pageX-fe.left-L)/H),k.y-=ne*((Me.pageY-fe.top-_)/F)}else pn(c)&&Ge(c.x)&&Ge(c.y)?(k.x-=J*((c.x-L)/H),k.y-=ne*((c.y-_)/F)):(k.x-=J/2,k.y-=ne/2);k.left=k.x,k.top=k.y,k.width=P,k.height=G,k.oldRatio=te,k.ratio=i,this.renderImage(function(){s.zooming=!1,He(b.zoomed)&&me(w,tl,b.zoomed,{once:!0}),tt(w,tl,{ratio:i,oldRatio:te,originalEvent:g},{cancelable:!1})}),l&&this.tooltip()}return this},play:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!this.isShown||this.played)return this;var l=this.element,c=this.options;if(He(c.play)&&me(l,rl,c.play,{once:!0}),tt(l,rl)===!1)return this;var g=this.player,p=this.loadImage.bind(this),w=[],b=0,y=0;if(this.played=!0,this.onLoadWhenPlay=p,s&&this.requestFullscreen(s),ve(g,fn),Be(this.items,function(_,H){var F=_.querySelector("img"),U=document.createElement("img");U.src=vn(F,"originalUrl"),U.alt=F.getAttribute("alt"),U.referrerPolicy=F.referrerPolicy,b+=1,ve(U,Gi),ri(U,Je,c.transition),gn(_,Ki)&&(ve(U,Bt),y=H),w.push(U),me(U,Ut,p,{once:!0}),g.appendChild(U)}),Ge(c.interval)&&c.interval>0){var k=function(){clearTimeout(i.playing.timeout),De(w[y],Bt),y-=1,y=y>=0?y:b-1,ve(w[y],Bt),i.playing.timeout=setTimeout(k,c.interval)},L=function(){clearTimeout(i.playing.timeout),De(w[y],Bt),y+=1,y=y<b?y:0,ve(w[y],Bt),i.playing.timeout=setTimeout(L,c.interval)};b>1&&(this.playing={prev:k,next:L,timeout:setTimeout(L,c.interval)})}return this},stop:function(){var i=this;if(!this.played)return this;var s=this.element,l=this.options;if(He(l.stop)&&me(s,nl,l.stop,{once:!0}),tt(s,nl)===!1)return this;var c=this.player;return clearTimeout(this.playing.timeout),this.playing=!1,this.played=!1,Be(c.getElementsByTagName("img"),function(g){$e(g,Ut,i.onLoadWhenPlay)}),De(c,fn),c.innerHTML="",this.exitFullscreen(),this},full:function(){var i=this,s=this.options,l=this.viewer,c=this.image,g=this.list;return!this.isShown||this.played||this.fulled||!s.inline?this:(this.fulled=!0,this.open(),ve(this.button,Do),s.transition&&(De(g,Je),this.viewed&&De(c,Je)),ve(l,Xa),l.setAttribute("role","dialog"),l.setAttribute("aria-labelledby",this.title.id),l.setAttribute("aria-modal",!0),l.removeAttribute("style"),Zt(l,{zIndex:s.zIndex}),s.focus&&this.enforceFocus(),this.initContainer(),this.viewerData=Pt({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){i.renderImage(function(){s.transition&&setTimeout(function(){ve(c,Je),ve(g,Je)},0)})}),this)},exit:function(){var i=this,s=this.options,l=this.viewer,c=this.image,g=this.list;return!this.isShown||this.played||!this.fulled||!s.inline?this:(this.fulled=!1,this.close(),De(this.button,Do),s.transition&&(De(g,Je),this.viewed&&De(c,Je)),s.focus&&this.clearEnforceFocus(),l.removeAttribute("role"),l.removeAttribute("aria-labelledby"),l.removeAttribute("aria-modal"),De(l,Xa),Zt(l,{zIndex:s.zIndexInline}),this.viewerData=Pt({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){i.renderImage(function(){s.transition&&setTimeout(function(){ve(c,Je),ve(g,Je)},0)})}),this)},tooltip:function(){var i=this,s=this.options,l=this.tooltipBox,c=this.imageData;return!this.viewed||this.played||!s.tooltip?this:(l.textContent="".concat(Math.round(c.ratio*100),"%"),this.tooltipping?clearTimeout(this.tooltipping):s.transition?(this.fading&&tt(l,Vt),ve(l,fn),ve(l,Gi),ve(l,Je),l.removeAttribute("aria-hidden"),l.initialOffsetWidth=l.offsetWidth,ve(l,Bt)):(ve(l,fn),l.removeAttribute("aria-hidden")),this.tooltipping=setTimeout(function(){s.transition?(me(l,Vt,function(){De(l,fn),De(l,Gi),De(l,Je),l.setAttribute("aria-hidden",!0),i.fading=!1},{once:!0}),De(l,Bt),i.fading=!0):(De(l,fn),l.setAttribute("aria-hidden",!0)),i.tooltipping=!1},1e3),this)},toggle:function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.imageData.ratio===1?this.zoomTo(this.imageData.oldRatio,!0,null,i):this.zoomTo(1,!0,null,i),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=Pt({},this.initialImageData),this.renderImage()),this},update:function(){var i=this,s=this.element,l=this.options,c=this.isImg;if(c&&!s.parentNode)return this.destroy();var g=[];if(Be(c?[s]:s.querySelectorAll("img"),function(y){He(l.filter)?l.filter.call(i,y)&&g.push(y):i.getImageURL(y)&&g.push(y)}),!g.length)return this;if(this.images=g,this.length=g.length,this.ready){var p=[];if(Be(this.items,function(y,k){var L=y.querySelector("img"),_=g[k];_&&L?(_.src!==L.src||_.alt!==L.alt)&&p.push(k):p.push(k)}),Zt(this.list,{width:"auto"}),this.initList(),this.isShown)if(this.length){if(this.viewed){var w=p.indexOf(this.index);if(w>=0)this.viewed=!1,this.view(Math.max(Math.min(this.index-w,this.length-1),0));else{var b=this.items[this.index];ve(b,Ki),b.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 i=this.element,s=this.options;return i[Se]?(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||$e(i,cn,this.onStart),i[Se]=void 0,this):this}},Zc={getImageURL:function(i){var s=this.options.url;return ti(s)?s=i.getAttribute(s):He(s)?s=s.call(this,i):s="",s},enforceFocus:function(){var i=this;this.clearEnforceFocus(),me(document,Ro,this.onFocusin=function(s){var l=i.viewer,c=s.target;if(!(c===document||c===l||l.contains(c))){for(;c;){if(c.getAttribute("tabindex")!==null||c.getAttribute("aria-modal")==="true")return;c=c.parentElement}l.focus()}})},clearEnforceFocus:function(){this.onFocusin&&($e(document,Ro,this.onFocusin),this.onFocusin=null)},open:function(){var i=this.body;ve(i,No),this.scrollbarWidth>0&&(i.style.paddingRight="".concat(this.scrollbarWidth+(parseFloat(this.initialBodyComputedPaddingRight)||0),"px"))},close:function(){var i=this.body;De(i,No),this.scrollbarWidth>0&&(i.style.paddingRight=this.initialBodyPaddingRight)},shown:function(){var i=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()),He(s.shown)&&me(i,jo,s.shown,{once:!0}),tt(i,jo)!==!1&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var i=this.element,s=this.options,l=this.viewer;s.fucus&&this.clearEnforceFocus(),this.close(),this.unbind(),ve(l,jr),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||(He(s.hidden)&&me(i,Ko,s.hidden,{once:!0}),tt(i,Ko,null,{cancelable:!1}))},requestFullscreen:function(i){var s=this.element.ownerDocument;if(this.fulled&&!(s.fullscreenElement||s.webkitFullscreenElement||s.mozFullScreenElement||s.msFullscreenElement)){var l=s.documentElement;l.requestFullscreen?pn(i)?l.requestFullscreen(i):l.requestFullscreen():l.webkitRequestFullscreen?l.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):l.mozRequestFullScreen?l.mozRequestFullScreen():l.msRequestFullscreen&&l.msRequestFullscreen()}},exitFullscreen:function(){var i=this.element.ownerDocument;this.fulled&&(i.fullscreenElement||i.webkitFullscreenElement||i.mozFullScreenElement||i.msFullscreenElement)&&(i.exitFullscreen?i.exitFullscreen():i.webkitExitFullscreen?i.webkitExitFullscreen():i.mozCancelFullScreen?i.mozCancelFullScreen():i.msExitFullscreen&&i.msExitFullscreen())},change:function(i){var s=this.options,l=this.pointers,c=l[Object.keys(l)[0]];if(c){var g=c.endX-c.startX,p=c.endY-c.startY;switch(this.action){case qi:(g!==0||p!==0)&&(this.pointerMoved=!0,this.move(g,p,i));break;case Qn:this.zoom(qc(l),!1,null,i);break;case Io:{this.action="switched";var w=Math.abs(g);w>1&&w>Math.abs(p)&&(this.pointers={},g>1?this.prev(s.loop):g<-1&&this.next(s.loop));break}}Be(l,function(b){b.startX=b.endX,b.startY=b.endY})}},isSwitchable:function(){var i=this.imageData,s=this.viewerData;return this.length>1&&i.x>=0&&i.y>=0&&i.width<=s.width&&i.height<=s.height}},Qc=mr.Viewer,Jc=function(f){return function(){return f+=1,f}}(-1),sl=function(){function f(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(Cc(this,f),!i||i.nodeType!==1)throw new Error("The first argument is required and must be an element.");this.element=i,this.options=Pt({},Ao,pn(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=Jc(),this.init()}return Tc(f,[{key:"init",value:function(){var s=this,l=this.element,c=this.options;if(!l[Se]){l[Se]=this,c.focus&&!c.keyboard&&(c.focus=!1);var g=l.localName==="img",p=[];if(Be(g?[l]:l.querySelectorAll("img"),function(y){He(c.filter)?c.filter.call(s,y)&&p.push(y):s.getImageURL(y)&&p.push(y)}),this.isImg=g,this.length=p.length,this.images=p,this.initBody(),hn(document.createElement(Se).style.transition)&&(c.transition=!1),c.inline){var w=0,b=function(){if(w+=1,w===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(){Be(p,function(k){k.complete||($e(k,Ut,b),$e(k,qr,b))})}},Be(p,function(y){if(y.complete)b();else{var k,L;me(y,Ut,k=function(){$e(y,qr,L),b()},{once:!0}),me(y,qr,L=function(){$e(y,Ut,k),b()},{once:!0})}})}else me(l,cn,this.onStart=function(y){var k=y.target;k.localName==="img"&&(!He(c.filter)||c.filter.call(s,k))&&s.view(s.images.indexOf(k))})}}},{key:"build",value:function(){if(!this.ready){var s=this.element,l=this.options,c=s.parentNode,g=document.createElement("div");g.innerHTML=Ec;var p=g.querySelector(".".concat(Se,"-container")),w=p.querySelector(".".concat(Se,"-title")),b=p.querySelector(".".concat(Se,"-toolbar")),y=p.querySelector(".".concat(Se,"-navbar")),k=p.querySelector(".".concat(Se,"-button")),L=p.querySelector(".".concat(Se,"-canvas"));if(this.parent=c,this.viewer=p,this.title=w,this.toolbar=b,this.navbar=y,this.button=k,this.canvas=L,this.footer=p.querySelector(".".concat(Se,"-footer")),this.tooltipBox=p.querySelector(".".concat(Se,"-tooltip")),this.player=p.querySelector(".".concat(Se,"-player")),this.list=p.querySelector(".".concat(Se,"-list")),p.id="".concat(Se).concat(this.id),w.id="".concat(Se,"Title").concat(this.id),ve(w,l.title?Zi(Array.isArray(l.title)?l.title[0]:l.title):jr),ve(y,l.navbar?Zi(l.navbar):jr),ri(k,jr,!l.button),l.keyboard&&k.setAttribute("tabindex",0),l.backdrop&&(ve(p,"".concat(Se,"-backdrop")),!l.inline&&l.backdrop!=="static"&&Qa(L,Xi,"hide")),ti(l.className)&&l.className&&l.className.split(Va).forEach(function(P){ve(p,P)}),l.toolbar){var _=document.createElement("ul"),H=pn(l.toolbar),F=Yi.slice(0,3),U=Yi.slice(7,9),M=Yi.slice(9);H||ve(b,Zi(l.toolbar)),Be(H?l.toolbar:Yi,function(P,G){var J=H&&pn(P),ne=H?Za(G):P,te=J&&!hn(P.show)?P.show:P;if(!(!te||!l.zoomable&&F.indexOf(ne)!==-1||!l.rotatable&&U.indexOf(ne)!==-1||!l.scalable&&M.indexOf(ne)!==-1)){var fe=J&&!hn(P.size)?P.size:P,Me=J&&!hn(P.click)?P.click:P,Ee=document.createElement("li");l.keyboard&&Ee.setAttribute("tabindex",0),Ee.setAttribute("role","button"),ve(Ee,"".concat(Se,"-").concat(ne)),He(Me)||Qa(Ee,Xi,ne),Ge(te)&&ve(Ee,Zi(te)),["small","large"].indexOf(fe)!==-1?ve(Ee,"".concat(Se,"-").concat(fe)):ne==="play"&&ve(Ee,"".concat(Se,"-large")),He(Me)&&me(Ee,cn,Me),_.appendChild(Ee)}}),b.appendChild(_)}else ve(b,jr);if(!l.rotatable){var A=b.querySelectorAll('li[class*="rotate"]');ve(A,Jn),Be(A,function(P){b.appendChild(P)})}if(l.inline)ve(k,Ac),Zt(p,{zIndex:l.zIndexInline}),window.getComputedStyle(c).position==="static"&&Zt(c,{position:"relative"}),c.insertBefore(p,s.nextSibling);else{ve(k,Oc),ve(p,Xa),ve(p,Gi),ve(p,jr),Zt(p,{zIndex:l.zIndex});var D=l.container;ti(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,He(l.ready)&&me(s,Bo,l.ready,{once:!0}),tt(s,Bo)===!1){this.ready=!1;return}this.ready&&l.inline&&this.view(this.index)}}}],[{key:"noConflict",value:function(){return window.Viewer=Qc,f}},{key:"setDefaults",value:function(s){Pt(Ao,pn(s)&&s)}}])}();Pt(sl.prototype,Gc,Xc,Yc,Vc,Zc);var eh=typeof global=="object"&&global&&global.Object===Object&&global,ol=eh,th=typeof self=="object"&&self&&self.Object===Object&&self,rh=ol||th||Function("return this")(),es=rh,nh=es.Symbol,Ji=nh,ll=Object.prototype,ih=ll.hasOwnProperty,ah=ll.toString,ni=Ji?Ji.toStringTag:void 0;function sh(f){var i=ih.call(f,ni),s=f[ni];try{f[ni]=void 0;var l=!0}catch{}var c=ah.call(f);return l&&(i?f[ni]=s:delete f[ni]),c}var oh=Object.prototype,lh=oh.toString;function uh(f){return lh.call(f)}var fh="[object Null]",ch="[object Undefined]",ul=Ji?Ji.toStringTag:void 0;function ts(f){return f==null?f===void 0?ch:fh:ul&&ul in Object(f)?sh(f):uh(f)}function rs(f){return f!=null&&typeof f=="object"}var hh=Array.isArray,dh=hh;function ns(f){var i=typeof f;return f!=null&&(i=="object"||i=="function")}function fl(f){return f}var ph="[object AsyncFunction]",gh="[object Function]",vh="[object GeneratorFunction]",mh="[object Proxy]";function cl(f){if(!ns(f))return!1;var i=ts(f);return i==gh||i==vh||i==ph||i==mh}var yh=es["__core-js_shared__"],is=yh,hl=function(){var f=/[^.]+$/.exec(is&&is.keys&&is.keys.IE_PROTO||"");return f?"Symbol(src)_1."+f:""}();function bh(f){return!!hl&&hl in f}var wh=Function.prototype,xh=wh.toString;function kh(f){if(f!=null){try{return xh.call(f)}catch{}try{return f+""}catch{}}return""}var Sh=/[\\^$.*+?()[\]{}|]/g,Ch=/^\[object .+?Constructor\]$/,Th=Function.prototype,Lh=Object.prototype,_h=Th.toString,Eh=Lh.hasOwnProperty,Oh=RegExp("^"+_h.call(Eh).replace(Sh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Ah(f){if(!ns(f)||bh(f))return!1;var i=cl(f)?Oh:Ch;return i.test(kh(f))}function Ih(f,i){return f==null?void 0:f[i]}function Dh(f,i){var s=Ih(f,i);return Ah(s)?s:void 0}function Nh(f,i,s){switch(s.length){case 0:return f.call(i);case 1:return f.call(i,s[0]);case 2:return f.call(i,s[0],s[1]);case 3:return f.call(i,s[0],s[1],s[2])}return f.apply(i,s)}var Mh=800,Rh=16,zh=Date.now;function Ph(f){var i=0,s=0;return function(){var l=zh(),c=Rh-(l-s);if(s=l,c>0){if(++i>=Mh)return arguments[0]}else i=0;return f.apply(void 0,arguments)}}function Fh(f){return function(){return f}}var Wh=function(){try{var f=Dh(Object,"defineProperty");return f({},"",{}),f}catch{}}(),ea=Wh,Hh=ea?function(f,i){return ea(f,"toString",{configurable:!0,enumerable:!1,value:Fh(i),writable:!0})}:fl,$h=Hh,Bh=Ph($h),Uh=Bh,jh=9007199254740991,qh=/^(?:0|[1-9]\d*)$/;function dl(f,i){var s=typeof f;return i=i??jh,!!i&&(s=="number"||s!="symbol"&&qh.test(f))&&f>-1&&f%1==0&&f<i}function pl(f,i,s){i=="__proto__"&&ea?ea(f,i,{configurable:!0,enumerable:!0,value:s,writable:!0}):f[i]=s}function gl(f,i){return f===i||f!==f&&i!==i}var Kh=Object.prototype,Gh=Kh.hasOwnProperty;function vl(f,i,s){var l=f[i];(!(Gh.call(f,i)&&gl(l,s))||s===void 0&&!(i in f))&&pl(f,i,s)}function Xh(f,i,s,l){var c=!s;s||(s={});for(var g=-1,p=i.length;++g<p;){var w=i[g],b=void 0;b===void 0&&(b=f[w]),c?pl(s,w,b):vl(s,w,b)}return s}var ml=Math.max;function Yh(f,i,s){return i=ml(i===void 0?f.length-1:i,0),function(){for(var l=arguments,c=-1,g=ml(l.length-i,0),p=Array(g);++c<g;)p[c]=l[i+c];c=-1;for(var w=Array(i+1);++c<i;)w[c]=l[c];return w[i]=s(p),Nh(f,this,w)}}function Vh(f,i){return Uh(Yh(f,i,fl),f+"")}var Zh=9007199254740991;function yl(f){return typeof f=="number"&&f>-1&&f%1==0&&f<=Zh}function as(f){return f!=null&&yl(f.length)&&!cl(f)}function Qh(f,i,s){if(!ns(s))return!1;var l=typeof i;return(l=="number"?as(s)&&dl(i,s.length):l=="string"&&i in s)?gl(s[i],f):!1}function Jh(f){return Vh(function(i,s){var l=-1,c=s.length,g=c>1?s[c-1]:void 0,p=c>2?s[2]:void 0;for(g=f.length>3&&typeof g=="function"?(c--,g):void 0,p&&Qh(s[0],s[1],p)&&(g=c<3?void 0:g,c=1),i=Object(i);++l<c;){var w=s[l];w&&f(i,w,l,g)}return i})}var ed=Object.prototype;function bl(f){var i=f&&f.constructor,s=typeof i=="function"&&i.prototype||ed;return f===s}function td(f,i){for(var s=-1,l=Array(f);++s<f;)l[s]=i(s);return l}var rd="[object Arguments]";function wl(f){return rs(f)&&ts(f)==rd}var xl=Object.prototype,nd=xl.hasOwnProperty,id=xl.propertyIsEnumerable,ad=wl(function(){return arguments}())?wl:function(f){return rs(f)&&nd.call(f,"callee")&&!id.call(f,"callee")},sd=ad;function od(){return!1}var kl=typeof ke=="object"&&ke&&!ke.nodeType&&ke,Sl=kl&&typeof module=="object"&&module&&!module.nodeType&&module,ld=Sl&&Sl.exports===kl,Cl=ld?es.Buffer:void 0,ud=Cl?Cl.isBuffer:void 0,fd=ud||od,cd=fd,hd="[object Arguments]",dd="[object Array]",pd="[object Boolean]",gd="[object Date]",vd="[object Error]",md="[object Function]",yd="[object Map]",bd="[object Number]",wd="[object Object]",xd="[object RegExp]",kd="[object Set]",Sd="[object String]",Cd="[object WeakMap]",Td="[object ArrayBuffer]",Ld="[object DataView]",_d="[object Float32Array]",Ed="[object Float64Array]",Od="[object Int8Array]",Ad="[object Int16Array]",Id="[object Int32Array]",Dd="[object Uint8Array]",Nd="[object Uint8ClampedArray]",Md="[object Uint16Array]",Rd="[object Uint32Array]",Ue={};Ue[_d]=Ue[Ed]=Ue[Od]=Ue[Ad]=Ue[Id]=Ue[Dd]=Ue[Nd]=Ue[Md]=Ue[Rd]=!0,Ue[hd]=Ue[dd]=Ue[Td]=Ue[pd]=Ue[Ld]=Ue[gd]=Ue[vd]=Ue[md]=Ue[yd]=Ue[bd]=Ue[wd]=Ue[xd]=Ue[kd]=Ue[Sd]=Ue[Cd]=!1;function zd(f){return rs(f)&&yl(f.length)&&!!Ue[ts(f)]}function Pd(f){return function(i){return f(i)}}var Tl=typeof ke=="object"&&ke&&!ke.nodeType&&ke,ii=Tl&&typeof module=="object"&&module&&!module.nodeType&&module,Fd=ii&&ii.exports===Tl,ss=Fd&&ol.process,Wd=function(){try{var f=ii&&ii.require&&ii.require("util").types;return f||ss&&ss.binding&&ss.binding("util")}catch{}}(),Ll=Wd,_l=Ll&&Ll.isTypedArray,Hd=_l?Pd(_l):zd,$d=Hd,Bd=Object.prototype,Ud=Bd.hasOwnProperty;function jd(f,i){var s=dh(f),l=!s&&sd(f),c=!s&&!l&&cd(f),g=!s&&!l&&!c&&$d(f),p=s||l||c||g,w=p?td(f.length,String):[],b=w.length;for(var y in f)Ud.call(f,y)&&!(p&&(y=="length"||c&&(y=="offset"||y=="parent")||g&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||dl(y,b)))&&w.push(y);return w}function qd(f,i){return function(s){return f(i(s))}}var Kd=qd(Object.keys,Object),Gd=Kd,Xd=Object.prototype,Yd=Xd.hasOwnProperty;function Vd(f){if(!bl(f))return Gd(f);var i=[];for(var s in Object(f))Yd.call(f,s)&&s!="constructor"&&i.push(s);return i}function Zd(f){return as(f)?jd(f):Vd(f)}var Qd=Object.prototype,Jd=Qd.hasOwnProperty,ep=Jh(function(f,i){if(bl(i)||as(i)){Xh(i,Zd(i),f);return}for(var s in i)Jd.call(i,s)&&vl(f,s,i[s])}),tp=ep;const rp=({images:f=[],options:i={}}={})=>{i=tp(i,{inline:!1});const s=Rf.extend({render(p){return p("div",{style:{display:"none"},class:["__viewer-token"]},f.map(w=>p("img",{attrs:typeof w=="string"?{src:w}:w})))}}),l=new s;l.$mount(),document.body.appendChild(l.$el);const c=new sl(l.$el,i),g=c.destroy.bind(c);return c.destroy=function(){return g(),l.$destroy(),document.body.removeChild(l.$el),c},c.show(),l.$el.addEventListener("hidden",function(){this.viewer===c&&c.destroy()}),c};(function(f,i){(function(s){s(vr())})(function(s){function l(I,N,K,se,Fe,ze){this.indented=I,this.column=N,this.type=K,this.info=se,this.align=Fe,this.prev=ze}function c(I,N,K,se){var Fe=I.indented;return I.context&&I.context.type=="statement"&&K!="statement"&&(Fe=I.context.indented),I.context=new l(Fe,N,K,se,null,I.context)}function g(I){var N=I.context.type;return(N==")"||N=="]"||N=="}")&&(I.indented=I.context.indented),I.context=I.context.prev}function p(I,N,K){if(N.prevToken=="variable"||N.prevToken=="type"||/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(I.string.slice(0,K))||N.typeAtEndOfLine&&I.column()==I.indentation())return!0}function w(I){for(;;){if(!I||I.type=="top")return!0;if(I.type=="}"&&I.prev.info!="namespace")return!1;I=I.prev}}s.defineMode("clike",function(I,N){var K=I.indentUnit,se=N.statementIndentUnit||K,Fe=N.dontAlignCalls,ze=N.keywords||{},wt=N.types||{},nt=N.builtin||{},pe=N.blockKeywords||{},he=N.defKeywords||{},be=N.atoms||{},Ce=N.hooks||{},jt=N.multiLineStrings,ye=N.indentStatements!==!1,pt=N.indentSwitch!==!1,Qt=N.namespaceSeparator,St=N.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,qt=N.numberStart||/[\d\.]/,Ct=N.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,Ft=N.isOperatorChar||/[+\-*&%=<>!?|\/]/,Kt=N.isIdentifierChar||/[\w\$_\xa1-\uffff]/,Lr=N.isReservedIdentifier||!1,de,Jt;function mn(ue,ce){var ie=ue.next();if(Ce[ie]){var Te=Ce[ie](ue,ce);if(Te!==!1)return Te}if(ie=='"'||ie=="'")return ce.tokenize=yn(ie),ce.tokenize(ue,ce);if(qt.test(ie)){if(ue.backUp(1),ue.match(Ct))return"number";ue.next()}if(St.test(ie))return de=ie,null;if(ie=="/"){if(ue.eat("*"))return ce.tokenize=Gr,Gr(ue,ce);if(ue.eat("/"))return ue.skipToEnd(),"comment"}if(Ft.test(ie)){for(;!ue.match(/^\/[\/*]/,!1)&&ue.eat(Ft););return"operator"}if(ue.eatWhile(Kt),Qt)for(;ue.match(Qt);)ue.eatWhile(Kt);var we=ue.current();return y(ze,we)?(y(pe,we)&&(de="newstatement"),y(he,we)&&(Jt=!0),"keyword"):y(wt,we)?"type":y(nt,we)||Lr&&Lr(we)?(y(pe,we)&&(de="newstatement"),"builtin"):y(be,we)?"atom":"variable"}function yn(ue){return function(ce,ie){for(var Te=!1,we,Dt=!1;(we=ce.next())!=null;){if(we==ue&&!Te){Dt=!0;break}Te=!Te&&we=="\\"}return(Dt||!(Te||jt))&&(ie.tokenize=null),"string"}}function Gr(ue,ce){for(var ie=!1,Te;Te=ue.next();){if(Te=="/"&&ie){ce.tokenize=null;break}ie=Te=="*"}return"comment"}function bn(ue,ce){N.typeFirstDefinitions&&ue.eol()&&w(ce.context)&&(ce.typeAtEndOfLine=p(ue,ce,ue.pos))}return{startState:function(ue){return{tokenize:null,context:new l((ue||0)-K,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(ue,ce){var ie=ce.context;if(ue.sol()&&(ie.align==null&&(ie.align=!1),ce.indented=ue.indentation(),ce.startOfLine=!0),ue.eatSpace())return bn(ue,ce),null;de=Jt=null;var Te=(ce.tokenize||mn)(ue,ce);if(Te=="comment"||Te=="meta")return Te;if(ie.align==null&&(ie.align=!0),de==";"||de==":"||de==","&&ue.match(/^\s*(?:\/\/.*)?$/,!1))for(;ce.context.type=="statement";)g(ce);else if(de=="{")c(ce,ue.column(),"}");else if(de=="[")c(ce,ue.column(),"]");else if(de=="(")c(ce,ue.column(),")");else if(de=="}"){for(;ie.type=="statement";)ie=g(ce);for(ie.type=="}"&&(ie=g(ce));ie.type=="statement";)ie=g(ce)}else de==ie.type?g(ce):ye&&((ie.type=="}"||ie.type=="top")&&de!=";"||ie.type=="statement"&&de=="newstatement")&&c(ce,ue.column(),"statement",ue.current());if(Te=="variable"&&(ce.prevToken=="def"||N.typeFirstDefinitions&&p(ue,ce,ue.start)&&w(ce.context)&&ue.match(/^\s*\(/,!1))&&(Te="def"),Ce.token){var we=Ce.token(ue,ce,Te);we!==void 0&&(Te=we)}return Te=="def"&&N.styleDefs===!1&&(Te="variable"),ce.startOfLine=!1,ce.prevToken=Jt?"def":Te||de,bn(ue,ce),Te},indent:function(ue,ce){if(ue.tokenize!=mn&&ue.tokenize!=null||ue.typeAtEndOfLine&&w(ue.context))return s.Pass;var ie=ue.context,Te=ce&&ce.charAt(0),we=Te==ie.type;if(ie.type=="statement"&&Te=="}"&&(ie=ie.prev),N.dontIndentStatements)for(;ie.type=="statement"&&N.dontIndentStatements.test(ie.info);)ie=ie.prev;if(Ce.indent){var Dt=Ce.indent(ue,ie,ce,K);if(typeof Dt=="number")return Dt}var Gt=ie.prev&&ie.prev.info=="switch";if(N.allmanIndentation&&/[{(]/.test(Te)){for(;ie.type!="top"&&ie.type!="}";)ie=ie.prev;return ie.indented}return ie.type=="statement"?ie.indented+(Te=="{"?0:se):ie.align&&(!Fe||ie.type!=")")?ie.column+(we?0:1):ie.type==")"&&!we?ie.indented+se:ie.indented+(we?0:K)+(!we&&Gt&&!/^(?:case|default)\b/.test(ce)?K:0)},electricInput:pt?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});function b(I){for(var N={},K=I.split(" "),se=0;se<K.length;++se)N[K[se]]=!0;return N}function y(I,N){return typeof I=="function"?I(N):I.propertyIsEnumerable(N)}var k="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile inline restrict asm fortran",L="alignas alignof and and_eq audit axiom bitand bitor catch class compl concept constexpr const_cast decltype delete dynamic_cast explicit export final friend import module mutable namespace new noexcept not not_eq operator or or_eq override private protected public reinterpret_cast requires static_assert static_cast template this thread_local throw try typeid typename using virtual xor xor_eq",_="bycopy byref in inout oneway out self super atomic nonatomic retain copy readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd @interface @implementation @end @protocol @encode @property @synthesize @dynamic @class @public @package @private @protected @required @optional @try @catch @finally @import @selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available",H="FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION NS_RETURNS_RETAINEDNS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT",F=b("int long char short double float unsigned signed void bool"),U=b("SEL instancetype id Class Protocol BOOL");function M(I){return y(F,I)||/.+_t$/.test(I)}function A(I){return M(I)||y(U,I)}var D="case do else for if switch while struct enum union",P="struct enum union";function G(I,N){if(!N.startOfLine)return!1;for(var K,se=null;K=I.peek();){if(K=="\\"&&I.match(/^.$/)){se=G;break}else if(K=="/"&&I.match(/^\/[\/\*]/,!1))break;I.next()}return N.tokenize=se,"meta"}function J(I,N){return N.prevToken=="type"?"type":!1}function ne(I){return!I||I.length<2||I[0]!="_"?!1:I[1]=="_"||I[1]!==I[1].toLowerCase()}function te(I){return I.eatWhile(/[\w\.']/),"number"}function fe(I,N){if(I.backUp(1),I.match(/^(?:R|u8R|uR|UR|LR)/)){var K=I.match(/^"([^\s\\()]{0,16})\(/);return K?(N.cpp11RawStringDelim=K[1],N.tokenize=Oe,Oe(I,N)):!1}return I.match(/^(?:u8|u|U|L)/)?I.match(/^["']/,!1)?"string":!1:(I.next(),!1)}function Me(I){var N=/(\w+)::~?(\w+)$/.exec(I);return N&&N[1]==N[2]}function Ee(I,N){for(var K;(K=I.next())!=null;)if(K=='"'&&!I.eat('"')){N.tokenize=null;break}return"string"}function Oe(I,N){var K=N.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&"),se=I.match(new RegExp(".*?\\)"+K+'"'));return se?N.tokenize=null:I.skipToEnd(),"string"}function Re(I,N){typeof I=="string"&&(I=[I]);var K=[];function se(ze){if(ze)for(var wt in ze)ze.hasOwnProperty(wt)&&K.push(wt)}se(N.keywords),se(N.types),se(N.builtin),se(N.atoms),K.length&&(N.helperType=I[0],s.registerHelper("hintWords",I[0],K));for(var Fe=0;Fe<I.length;++Fe)s.defineMIME(I[Fe],N)}Re(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:b(k),types:M,blockKeywords:b(D),defKeywords:b(P),typeFirstDefinitions:!0,atoms:b("NULL true false"),isReservedIdentifier:ne,hooks:{"#":G,"*":J},modeProps:{fold:["brace","include"]}}),Re(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:b(k+" "+L),types:M,blockKeywords:b(D+" class try catch"),defKeywords:b(P+" class namespace"),typeFirstDefinitions:!0,atoms:b("true false NULL nullptr"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,isReservedIdentifier:ne,hooks:{"#":G,"*":J,u:fe,U:fe,L:fe,R:fe,0:te,1:te,2:te,3:te,4:te,5:te,6:te,7:te,8:te,9:te,token:function(I,N,K){if(K=="variable"&&I.peek()=="("&&(N.prevToken==";"||N.prevToken==null||N.prevToken=="}")&&Me(I.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),Re("text/x-java",{name:"clike",keywords:b("abstract assert break case catch class const continue default do else enum extends final finally for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:b("var byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:b("catch class do else finally for if switch try while"),defKeywords:b("class interface enum @interface"),typeFirstDefinitions:!0,atoms:b("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(I){return I.match("interface",!1)?!1:(I.eatWhile(/[\w\$_]/),"meta")},'"':function(I,N){return I.match(/""$/)?(N.tokenize=$,N.tokenize(I,N)):!1}},modeProps:{fold:["brace","import"]}}),Re("text/x-csharp",{name:"clike",keywords:b("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in init interface internal is lock namespace new operator out override params private protected public readonly record ref required return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:b("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:b("catch class do else finally for foreach if struct switch try while"),defKeywords:b("class interface namespace record struct var"),typeFirstDefinitions:!0,atoms:b("true false null"),hooks:{"@":function(I,N){return I.eat('"')?(N.tokenize=Ee,Ee(I,N)):(I.eatWhile(/[\w\$_]/),"meta")}}});function $(I,N){for(var K=!1;!I.eol();){if(!K&&I.match('"""')){N.tokenize=null;break}K=I.next()=="\\"&&!K}return"string"}function V(I){return function(N,K){for(var se;se=N.next();)if(se=="*"&&N.eat("/"))if(I==1){K.tokenize=null;break}else return K.tokenize=V(I-1),K.tokenize(N,K);else if(se=="/"&&N.eat("*"))return K.tokenize=V(I+1),K.tokenize(N,K);return"comment"}}Re("text/x-scala",{name:"clike",keywords:b("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:b("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:b("catch class enum do else finally for forSome if match switch try while"),defKeywords:b("class enum def object package trait type val var"),atoms:b("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(I){return I.eatWhile(/[\w\$_]/),"meta"},'"':function(I,N){return I.match('""')?(N.tokenize=$,N.tokenize(I,N)):!1},"'":function(I){return I.match(/^(\\[^'\s]+|[^\\'])'/)?"string-2":(I.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},"=":function(I,N){var K=N.context;return K.type=="}"&&K.align&&I.eat(">")?(N.context=new l(K.indented,K.column,K.type,K.info,null,K.prev),"operator"):!1},"/":function(I,N){return I.eat("*")?(N.tokenize=V(1),N.tokenize(I,N)):!1}},modeProps:{closeBrackets:{pairs:'()[]{}""',triples:'"'}}});function T(I){return function(N,K){for(var se=!1,Fe,ze=!1;!N.eol();){if(!I&&!se&&N.match('"')){ze=!0;break}if(I&&N.match('"""')){ze=!0;break}Fe=N.next(),!se&&Fe=="$"&&N.match("{")&&N.skipTo("}"),se=!se&&Fe=="\\"&&!I}return(ze||!I)&&(K.tokenize=null),"string"}}Re("text/x-kotlin",{name:"clike",keywords:b("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam value"),types:b("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:b("catch class do else finally for if where try while enum"),defKeywords:b("class val var object interface fun"),atoms:b("true false null this"),hooks:{"@":function(I){return I.eatWhile(/[\w\$_]/),"meta"},"*":function(I,N){return N.prevToken=="."?"variable":"operator"},'"':function(I,N){return N.tokenize=T(I.match('""')),N.tokenize(I,N)},"/":function(I,N){return I.eat("*")?(N.tokenize=V(1),N.tokenize(I,N)):!1},indent:function(I,N,K,se){var Fe=K&&K.charAt(0);if((I.prevToken=="}"||I.prevToken==")")&&K=="")return I.indented;if(I.prevToken=="operator"&&K!="}"&&I.context.type!="}"||I.prevToken=="variable"&&Fe=="."||(I.prevToken=="}"||I.prevToken==")")&&Fe==".")return se*2+N.indented;if(N.align&&N.type=="}")return N.indented+(I.context.type==(K||"").charAt(0)?0:se)}},modeProps:{closeBrackets:{triples:'"'}}}),Re(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:b("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:b("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:b("for while do if else struct"),builtin:b("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:b("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":G},modeProps:{fold:["brace","include"]}}),Re("text/x-nesc",{name:"clike",keywords:b(k+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:M,blockKeywords:b(D),atoms:b("null true false"),hooks:{"#":G},modeProps:{fold:["brace","include"]}}),Re("text/x-objectivec",{name:"clike",keywords:b(k+" "+_),types:A,builtin:b(H),blockKeywords:b(D+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:b(P+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:b("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:ne,hooks:{"#":G,"*":J},modeProps:{fold:["brace","include"]}}),Re("text/x-objectivec++",{name:"clike",keywords:b(k+" "+_+" "+L),types:A,builtin:b(H),blockKeywords:b(D+" @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),defKeywords:b(P+" @interface @implementation @protocol @class class namespace"),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:b("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:ne,hooks:{"#":G,"*":J,u:fe,U:fe,L:fe,R:fe,0:te,1:te,2:te,3:te,4:te,5:te,6:te,7:te,8:te,9:te,token:function(I,N,K){if(K=="variable"&&I.peek()=="("&&(N.prevToken==";"||N.prevToken==null||N.prevToken=="}")&&Me(I.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),Re("text/x-squirrel",{name:"clike",keywords:b("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:M,blockKeywords:b("case catch class else for foreach if switch try while"),defKeywords:b("function local class"),typeFirstDefinitions:!0,atoms:b("true false null"),hooks:{"#":G},modeProps:{fold:["brace","include"]}});var rt=null;function st(I){return function(N,K){for(var se=!1,Fe,ze=!1;!N.eol();){if(!se&&N.match('"')&&(I=="single"||N.match('""'))){ze=!0;break}if(!se&&N.match("``")){rt=st(I),ze=!0;break}Fe=N.next(),se=I=="single"&&!se&&Fe=="\\"}return ze&&(K.tokenize=null),"string"}}Re("text/x-ceylon",{name:"clike",keywords:b("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(I){var N=I.charAt(0);return N===N.toUpperCase()&&N!==N.toLowerCase()},blockKeywords:b("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:b("class dynamic function interface module object package value"),builtin:b("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:b("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(I){return I.eatWhile(/[\w\$_]/),"meta"},'"':function(I,N){return N.tokenize=st(I.match('""')?"triple":"single"),N.tokenize(I,N)},"`":function(I,N){return!rt||!I.match("`")?!1:(N.tokenize=rt,rt=null,N.tokenize(I,N))},"'":function(I){return I.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(I,N,K){if((K=="variable"||K=="type")&&N.prevToken==".")return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})})})();const np={name:"Trace",components:{TraceSpanTree:ja,codemirror:Ff.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,eventsCollapse:[],eventsKey:0,pageNo:1,pageSize:10,total:0,pickerOptions:{shortcuts:[{text:"近7天",onClick(f){const i=new Date,s=new Date;s.setTime(s.getTime()-3600*1e3*24*7),f.$emit("pick",[s,i])}},{text:"近30天",onClick(f){const i=new Date,s=new Date;s.setTime(s.getTime()-3600*1e3*24*30),f.$emit("pick",[s,i])}},{text:"7天前",onClick(f){const i=new Date;i.setTime(i.getTime()-3600*1e3*24*7),i.setHours(23,59,59,999);const s=i.getTime();f.$emit("pick",[null,s])}},{text:"30天前",onClick(f){const i=new Date;i.setTime(i.getTime()-3600*1e3*24*30),i.setHours(23,59,59,999);const s=i.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},cmOptionsJava:{tabSize:4,mode:"text/x-java",theme:"monokai",lineNumbers:!0,lineWrapping:!0,readOnly:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,indentUnit:4,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(){let f=this.traceInfo.trace_name;return f||(f=this.traceInfo.trace_id),f?this.$t("trace.traceDetail")+": "+f: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,i;return((i=(f=this.selectedSpan)==null?void 0:f.parsedContent)==null?void 0:i.inputs)!==void 0},hasOutputs(){var f,i;return((i=(f=this.selectedSpan)==null?void 0:f.parsedContent)==null?void 0:i.outputs)!==void 0},attributesData(){var f,i;return(i=(f=this.selectedSpan)==null?void 0:f.parsedContent)!=null&&i.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,i,s;return(s=(i=(f=this.selectedSpan)==null?void 0:f.parsedContent)==null?void 0:i.attributes)==null?void 0:s["langsword.spanInputs"]},rawOutputs(){var f,i,s;return(s=(i=(f=this.selectedSpan)==null?void 0:f.parsedContent)==null?void 0:i.attributes)==null?void 0:s["langsword.spanOutputs"]},hasEvents(){var i,s;const f=(s=(i=this.selectedSpan)==null?void 0:i.parsedContent)==null?void 0:s.events;return f&&Array.isArray(f)&&f.length>0},spanEvents(){var i,s;const f=(s=(i=this.selectedSpan)==null?void 0:i.parsedContent)==null?void 0:s.events;return!f||!Array.isArray(f)?[]:f}},watch:{activeTab(f){f==="raw"&&this.$nextTick(()=>{this.rawInputsKey++,this.rawOutputsKey++}),f==="events"&&this.$nextTick(()=>{this.eventsKey++})},selectedSpan(){this.activeTab==="raw"&&this.$nextTick(()=>{this.rawInputsKey++,this.rawOutputsKey++}),this.activeTab==="events"&&this.$nextTick(()=>{this.eventsKey++,this.spanEvents.length>0&&(this.eventsCollapse=this.spanEvents.map((f,i)=>`event-${i}`))})}},mounted(){_e.setOptions({breaks:!0,gfm:!0,headerIds:!1,mangle:!1}),this.loadTraceList()},methods:{async loadTraceList(){this.loading=!0;try{let f=null,i=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]!==""&&(i=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(i=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10)));const s=await on.getTraceList(this.searchQuery,f,i,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 i,s,l;try{const[c,g]=await Promise.all([on.getTraceDetail(f),on.getTraceSpans(f)]);if(this.traceInfo=c||{},this.spans=g.map(p=>{let w={};try{if(w=JSON.parse(p.content),w.attributes){const b=w.attributes["langsword.spanInputs"],y=w.attributes["langsword.spanOutputs"];if(b)try{w.inputs=JSON.parse(b)}catch{try{const L=b.replace(/\\"/g,'"').replace(/^"|"$/g,"");w.inputs=JSON.parse(L)}catch{w.inputs=b}}if(y)try{w.outputs=JSON.parse(y)}catch{try{const L=y.replace(/\\"/g,'"').replace(/^"|"$/g,"");w.outputs=JSON.parse(L)}catch{w.outputs=y}}}}catch(b){console.error("Parse content error:",b)}return{...p,parsedContent:w}}),this.filteredSpans=this.spans,this.spans.length>0){this.selectedSpanId=this.spans[0].span_id,this.selectedSpan=this.spans[0],this.activeTab=this.spans[0].type==="CLIENT"||this.spans[0].type==="CHAT_MODEL"?"io":"attributes",(s=(i=this.selectedSpan.parsedContent)==null?void 0:i.inputs)!=null&&s.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((w,b)=>`message-${b}`):this.messageCollapse=[];const p=(l=this.selectedSpan.parsedContent)==null?void 0:l.events;p&&Array.isArray(p)&&p.length>0?this.eventsCollapse=p.map((w,b)=>`event-${b}`):this.eventsCollapse=[]}}catch(c){console.error("Failed to load trace detail:",c),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(i=>i.name.toLowerCase().includes(f)||i.type.toLowerCase().includes(f))},handleSpanSelect(f){var s,l,c;this.selectedSpanId=f.span_id,this.selectedSpan=f,this.activeTab=f.type==="CLIENT"||f.type==="CHAT_MODEL"?"io":"attributes",(l=(s=this.selectedSpan.parsedContent)==null?void 0:s.inputs)!=null&&l.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((g,p)=>`message-${p}`):this.messageCollapse=[];const i=(c=f.parsedContent)==null?void 0:c.events;i&&Array.isArray(i)&&i.length>0?this.eventsCollapse=i.map((g,p)=>`event-${p}`):this.eventsCollapse=[]},handleDrawerClose(f){this.currentTraceId=null,this.traceInfo={},this.spans=[],this.filteredSpans=[],this.selectedSpanId=null,this.selectedSpan=null,this.spanSearchQuery="",this.eventsCollapse=[],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 c,g;const f=this.searchQuery&&this.searchQuery.trim(),i=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&&!i)s=this.$t("trace.deleteAllWarning"),l="error";else{if(s=this.$t("trace.deleteConfirmMessage")+`
78
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=(c=p.response)==null?void 0:c.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(),c=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}-${c}-${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,c=this.$i18n.locale==="zh-CN",g=Math.floor(l/(1e3*60*60*24));if(g>0)return c?`${g} 天前`:`${g} days ago`;const p=Math.floor(l/(1e3*60*60));if(p>0)return c?`${p} 小时前`:`${p} hours ago`;const y=Math.floor(l/(1e3*60));return y>0?c?`${y} 分钟前`:`${y} minutes ago`:c?"刚刚":"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")},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`},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},extractImagesFromObject(f,a=[],s=""){if(!(!f||typeof f!="object")){for(const[l,c]of Object.entries(f)){const g=s?`${s}.${l}`:l;typeof c=="string"&&c.trim()!==""?(c.startsWith("data:image/")||c.startsWith("/9j/")||c.startsWith("iVBOR")||c.startsWith("R0lGOD"))&&(a.push({path:g,value:c,label:l==="content"&&s?`${s.split(".").pop()}: ${l}`:l}),f[l]="[IMAGE_DATA]"):c&&typeof c=="object"&&!Array.isArray(c)?this.extractImagesFromObject(c,a,g):Array.isArray(c)&&c.forEach((p,y)=>{p&&typeof p=="object"&&this.extractImagesFromObject(p,a,`${g}[${y}]`)})}return a}},renderStructuredContent(f){const a=[];if(!f)return a;try{if(Array.isArray(f))f.forEach((s,l)=>{var c;s&&typeof s=="object"?s.type==="text"&&s.text?a.push({type:"markdown",content:ve(s.text),key:`text-${l}`}):s.type==="image_url"&&((c=s.image_url)!=null&&c.url)?a.push({type:"image",url:s.image_url.url,key:`image-${l}`}):s.image_base64&&s.image_base64.trim()!==""?a.push({type:"image",url:this.formatBase64Image(s.image_base64),key:`base64-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}`})});else if(typeof f=="string")a.push({type:"markdown",content:ve(f),key:"text-0"});else if(typeof f=="object")if(f.data&&Array.isArray(f.data.result)){const s=JSON.parse(JSON.stringify(f)),l=[];s.data&&s.data.result&&s.data.result.forEach((c,g)=>{c.image_base64&&c.image_base64.trim()!==""&&(l.push({type:"page",image_base64:c.image_base64,page_num:c.page_num,label:c.page_num!==void 0?`Page ${c.page_num}`:`Result ${g}`}),c.image_base64="[BASE64_IMAGE_DATA]"),c.seals&&Array.isArray(c.seals)&&c.seals.forEach((p,y)=>{p.image_base64&&p.image_base64.trim()!==""&&(l.push({type:"seal",image_base64:p.image_base64,page_num:c.page_num,seal_index:y,seal_value:p.value,label:`Seal: ${p.value||y}`}),p.image_base64="[BASE64_IMAGE_DATA]")})}),a.push({type:"markdown",content:ve("```json\n"+JSON.stringify(s,null,2)+"\n```"),key:"json-0"}),l.forEach((c,g)=>{a.push({type:"image",url:this.formatBase64Image(c.image_base64),key:`result-image-${g}`,label:c.label})})}else{const s=JSON.parse(JSON.stringify(f)),l=[];this.extractImagesFromObject(s,l),a.push({type:"markdown",content:ve("```json\n"+JSON.stringify(s,null,2)+"\n```"),key:"json-0"}),l.forEach((c,g)=>{a.push({type:"image",url:this.formatBase64Image(c.value),key:`extracted-image-${g}`,label:c.label})})}else 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},formatBase64Image(f){return f?f.startsWith("data:image")?f:f.startsWith("/9j/")?`data:image/jpeg;base64,${f}`:f.startsWith("iVBOR")?`data:image/png;base64,${f}`:f.startsWith("R0lGOD")?`data:image/gif;base64,${f}`:`data:image/jpeg;base64,${f}`:""},handleImageClick(f){rp({options:this.viewerOptions,images:[f]})}}};var ip=function(){var l,c,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.formatNanoDuration(b.row.execution_time_ms))+" ")]}}],null,!1,1733254102)}):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.formatNanoDuration(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",[a.selectedSpan?s("div",{staticClass:"span-detail-content"},[s("el-tabs",{model:{value:a.activeTab,callback:function(b){a.activeTab=b},expression:"activeTab"}},[a.selectedSpan.type==="CLIENT"||a.selectedSpan.type==="CHAT_MODEL"?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"}},[(c=(l=a.selectedSpan.parsedContent)==null?void 0:l.inputs)!=null&&c.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"},[A.label?s("div",{staticClass:"image-label"},[a._v(a._s(A.label))]):a._e(),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"},[b.label?s("div",{staticClass:"image-label"},[a._v(a._s(b.label))]):a._e(),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"},[A.label?s("div",{staticClass:"image-label"},[a._v(a._s(A.label))]):a._e(),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"},[A.label?s("div",{staticClass:"image-label"},[a._v(a._s(A.label))]):a._e(),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"},[b.label?s("div",{staticClass:"image-label"},[a._v(a._s(b.label))]):a._e(),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()])]):a._e(),s("el-tab-pane",{attrs:{label:a.$t("trace.attributes"),name:"attributes"}},[s("el-table",{staticClass:"attributes-table",attrs:{data:a.attributesData,border:"",stripe:""}},[s("el-table-column",{attrs:{prop:"key",label:a.$t("trace.key"),width:"250"},scopedSlots:a._u([{key:"default",fn:function(b){return[s("el-tooltip",{attrs:{content:b.row.key,placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[s("span",{staticClass:"attribute-key"},[a._v(a._s(b.row.key))])])]}}],null,!1,688878823)}),s("el-table-column",{attrs:{prop:"value",label:a.$t("trace.value")},scopedSlots:a._u([{key:"default",fn:function(b){return[s("el-tooltip",{attrs:{placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[s("div",{staticClass:"attribute-tooltip-content",attrs:{slot:"content"},slot:"content"},[a._v(a._s(b.row.value))]),s("div",{staticClass:"attribute-value"},[a._v(a._s(b.row.value))])])]}}],null,!1,4281519148)})],1)],1),a.selectedSpan.type==="CLIENT"||a.selectedSpan.type==="CHAT_MODEL"?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()]):a._e()],1)],1):s("el-empty",{attrs:{description:a.$t("trace.selectSpan")}})],1)],1)],1)],1):a._e()])],1)},ap=[],sp=Lo(np,ip,ap,!1,null,"a6ec0c9f");const as=sp.exports,Al={routes:[{path:"/trace",name:"trace",component:as}],beforeEach:(f,a,s)=>{s()}},Ol={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 数据!
79
+ `),i){const p=this.$i18n.locale==="zh-CN"?"zh-CN":"en-US";let w="";if(this.dateRange.length===2&&this.dateRange[1]!==null?w=new Date(this.dateRange[1]).toLocaleString(p):this.dateRange.length===1&&this.dateRange[0]!==null&&(w=new Date(this.dateRange[0]).toLocaleString(p)),this.dateRange.length===2&&this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""){const b=new Date(this.dateRange[0]).toLocaleString(p);s+=`${this.$t("trace.timeRange")}: ${b} ${this.$t("trace.to")} ${w}
80
+ `}else this.$i18n.locale==="zh-CN"?s+=`${this.$t("trace.timeRange")}: ${this.$t("trace.before")} ${w} 之前
81
+ `:s+=`${this.$t("trace.timeRange")}: ${this.$t("trace.before")} ${w}
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,w=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]!==""&&(w=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(w=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10))),await on.deleteTraces(f?this.searchQuery:null,p,w),this.$message.success(this.$t("trace.deleteSuccess")),await this.loadTraceList()}catch(p){if(p!=="cancel"){console.error("Failed to delete traces:",p);const w=((g=(c=p.response)==null?void 0:c.data)==null?void 0:g.message)||p.message||this.$t("trace.unknownError");this.$message.error(`${this.$t("trace.deleteFailed")}: ${w}`)}}finally{this.deleteLoading=!1}},getStatusType(f){return{OK:"success",ERROR:"danger",IN_PROGRESS:"warning",UNSET:"info"}[f]||"info"},formatDateTime(f){if(!f)return"-";const i=typeof f=="string"?parseInt(f,10):f;if(isNaN(i))return"-";const s=new Date(i);if(isNaN(s.getTime()))return"-";const l=s.getFullYear(),c=String(s.getMonth()+1).padStart(2,"0"),g=String(s.getDate()).padStart(2,"0"),p=String(s.getHours()).padStart(2,"0"),w=String(s.getMinutes()).padStart(2,"0"),b=String(s.getSeconds()).padStart(2,"0");return`${l}-${c}-${g} ${p}:${w}:${b}`},formatTimeAgo(f){if(!f)return"-";const i=typeof f=="string"?parseInt(f,10):f;if(isNaN(i))return"-";const l=Date.now()-i,c=this.$i18n.locale==="zh-CN",g=Math.floor(l/(1e3*60*60*24));if(g>0)return c?`${g} 天前`:`${g} days ago`;const p=Math.floor(l/(1e3*60*60));if(p>0)return c?`${p} 小时前`:`${p} hours ago`;const w=Math.floor(l/(1e3*60));return w>0?c?`${w} 分钟前`:`${w} minutes ago`:c?"刚刚":"Just now"},formatTimestamp(f){if(!f)return"-";const i=typeof f=="string"?parseInt(f,10):f;if(isNaN(i))return"-";const s=new Date(i);return isNaN(s.getTime())?"-":s.toLocaleString("zh-CN")},formatEventTimestamp(f){if(!f)return"-";const i=f/1e6,s=new Date(i);return isNaN(s.getTime())?"-":s.toLocaleString("zh-CN")},getEventAttributesData(f){return!f||!f.attributes?[]:Object.entries(f.attributes).map(([i,s])=>({key:i,value:typeof s=="string"?s:JSON.stringify(s,null,2)}))},getOtherEventAttributes(f){if(!f||!f.attributes)return[];const i=["exception.type","exception.message","exception.stacktrace"];return Object.entries(f.attributes).filter(([s])=>!i.includes(s)).map(([s,l])=>({key:s,value:typeof l=="string"?l:JSON.stringify(l,null,2)}))},formatNanoDuration(f){if(!f)return"-";const i=f/1e6;return i<1e3?`${i.toFixed(2)}ms`:i<6e4?`${(i/1e3).toFixed(2)}s`:`${(i/6e4).toFixed(2)}min`},formatJson(f){return f?JSON.stringify(f,null,2):""},formatRawJson(f){if(!f)return"";if(typeof f=="string")try{const i=JSON.parse(f);return JSON.stringify(i,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 i=f.time_unix_nano/1e6;return new Date(i).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:i}){return"trace-row"},getIndex(f){return(this.pageNo-1)*this.pageSize+f+1},applyColumns(){const f={};this.selectedColumns.forEach(i=>{f[i]=!0}),Object.keys(this.visibleColumns).forEach(i=>{this.selectedColumns.includes(i)||(f[i]=!1)}),this.visibleColumns=f,this.showColumnDialog=!1},extractImagesFromObject(f,i=[],s=""){if(!(!f||typeof f!="object")){for(const[l,c]of Object.entries(f)){const g=s?`${s}.${l}`:l;typeof c=="string"&&c.trim()!==""?(c.startsWith("data:image/")||c.startsWith("/9j/")||c.startsWith("iVBOR")||c.startsWith("R0lGOD"))&&(i.push({path:g,value:c,label:l==="content"&&s?`${s.split(".").pop()}: ${l}`:l}),f[l]="[IMAGE_DATA]"):c&&typeof c=="object"&&!Array.isArray(c)?this.extractImagesFromObject(c,i,g):Array.isArray(c)&&c.forEach((p,w)=>{p&&typeof p=="object"&&this.extractImagesFromObject(p,i,`${g}[${w}]`)})}return i}},renderStructuredContent(f){const i=[];if(!f)return i;try{if(Array.isArray(f))f.forEach((s,l)=>{var c;s&&typeof s=="object"?s.type==="text"&&s.text?i.push({type:"markdown",content:_e(s.text),key:`text-${l}`}):s.type==="image_url"&&((c=s.image_url)!=null&&c.url)?i.push({type:"image",url:s.image_url.url,key:`image-${l}`}):s.image_base64&&s.image_base64.trim()!==""?i.push({type:"image",url:this.formatBase64Image(s.image_base64),key:`base64-image-${l}`}):i.push({type:"markdown",content:_e("```json\n"+JSON.stringify(s,null,2)+"\n```"),key:`json-${l}`}):i.push({type:"markdown",content:_e(String(s)),key:`text-${l}`})});else if(typeof f=="string")i.push({type:"markdown",content:_e(f),key:"text-0"});else if(typeof f=="object")if(f.data&&Array.isArray(f.data.result)){const s=JSON.parse(JSON.stringify(f)),l=[];s.data&&s.data.result&&s.data.result.forEach((c,g)=>{c.image_base64&&c.image_base64.trim()!==""&&(l.push({type:"page",image_base64:c.image_base64,page_num:c.page_num,label:c.page_num!==void 0?`Page ${c.page_num}`:`Result ${g}`}),c.image_base64="[BASE64_IMAGE_DATA]"),c.seals&&Array.isArray(c.seals)&&c.seals.forEach((p,w)=>{p.image_base64&&p.image_base64.trim()!==""&&(l.push({type:"seal",image_base64:p.image_base64,page_num:c.page_num,seal_index:w,seal_value:p.value,label:`Seal: ${p.value||w}`}),p.image_base64="[BASE64_IMAGE_DATA]")})}),i.push({type:"markdown",content:_e("```json\n"+JSON.stringify(s,null,2)+"\n```"),key:"json-0"}),l.forEach((c,g)=>{i.push({type:"image",url:this.formatBase64Image(c.image_base64),key:`result-image-${g}`,label:c.label})})}else{const s=JSON.parse(JSON.stringify(f)),l=[];this.extractImagesFromObject(s,l),i.push({type:"markdown",content:_e("```json\n"+JSON.stringify(s,null,2)+"\n```"),key:"json-0"}),l.forEach((c,g)=>{i.push({type:"image",url:this.formatBase64Image(c.value),key:`extracted-image-${g}`,label:c.label})})}else i.push({type:"markdown",content:_e(String(f)),key:"text-0"})}catch(s){console.error("Error rendering content:",s),i.push({type:"markdown",content:_e("Error rendering content"),key:"error-0"})}return i},formatBase64Image(f){return f?f.startsWith("data:image")?f:f.startsWith("/9j/")?`data:image/jpeg;base64,${f}`:f.startsWith("iVBOR")?`data:image/png;base64,${f}`:f.startsWith("R0lGOD")?`data:image/gif;base64,${f}`:`data:image/jpeg;base64,${f}`:""},handleImageClick(f){rp({options:this.viewerOptions,images:[f]})}}};var ip=function(){var l,c,g,p,w,b;var i=this,s=i._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:i.$t("trace.searchPlaceholder"),"prefix-icon":"el-icon-search",clearable:"",size:"mini"},on:{clear:i.handleSearchClear,input:i.handleSearch},model:{value:i.searchQuery,callback:function(y){i.searchQuery=y},expression:"searchQuery"}}),s("el-date-picker",{staticClass:"toolbar-date-picker",attrs:{type:"datetimerange","range-separator":i.$t("trace.to"),"start-placeholder":i.$t("trace.startTime"),"end-placeholder":i.$t("trace.endTime"),"value-format":"timestamp",format:"yyyy-MM-dd HH:mm:ss",size:"mini","picker-options":i.pickerOptions,clearable:""},on:{change:i.handleDateRangeChange},model:{value:i.dateRange,callback:function(y){i.dateRange=y},expression:"dateRange"}}),s("el-button",{attrs:{type:"danger",icon:"el-icon-delete",size:"mini",disabled:i.deleteLoading},on:{click:i.handleBatchDelete}},[i._v(" "+i._s(i.$t("trace.batchDelete"))+" ")]),s("el-button",{attrs:{icon:"el-icon-refresh",size:"mini",circle:"",title:i.$t("common.refresh")},on:{click:i.refresh}}),s("el-button",{attrs:{icon:"el-icon-setting",size:"mini"},on:{click:function(y){i.showColumnDialog=!0}}},[i._v(" "+i._s(i.$t("common.columns"))+" ")])],1),s("div",{staticClass:"trace-table-wrapper"},[s("el-table",{directives:[{name:"loading",rawName:"v-loading",value:i.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:i.filteredTraceList,size:"mini",stripe:"","row-class-name":i.tableRowClassName},on:{"row-click":i.handleRowClick}},[s("el-table-column",{attrs:{type:"index",label:"#",width:"60",index:i.getIndex}}),i.visibleColumns.trace_id?s("el-table-column",{attrs:{prop:"trace_id",label:i.$t("trace.requestId"),width:"280","show-overflow-tooltip":""},scopedSlots:i._u([{key:"default",fn:function(y){return[s("el-link",{attrs:{type:"primary"},on:{click:function(k){return k.stopPropagation(),i.viewDetail(y.row.trace_id)}}},[i._v(" "+i._s(y.row.trace_id)+" ")])]}}],null,!1,1400187371)}):i._e(),i.visibleColumns.trace_name?s("el-table-column",{attrs:{prop:"trace_name",label:i.$t("trace.traceName"),"min-width":"300","show-overflow-tooltip":""},scopedSlots:i._u([{key:"default",fn:function(y){return[s("span",[i._v(i._s(y.row.trace_name||"-"))])]}}],null,!1,3633653970)}):i._e(),i.visibleColumns.trace_type?s("el-table-column",{attrs:{prop:"trace_type",label:i.$t("trace.traceType"),width:"120"},scopedSlots:i._u([{key:"default",fn:function(y){return[s("el-tag",{attrs:{size:"mini",type:"info"}},[i._v(i._s(y.row.trace_type||"-"))])]}}],null,!1,1175446173)}):i._e(),i.visibleColumns.execution_time_ms?s("el-table-column",{attrs:{prop:"execution_time_ms",label:i.$t("trace.executionTime"),width:"120"},scopedSlots:i._u([{key:"default",fn:function(y){return[i._v(" "+i._s(i.formatNanoDuration(y.row.execution_time_ms))+" ")]}}],null,!1,1733254102)}):i._e(),i.visibleColumns.status?s("el-table-column",{attrs:{prop:"status",label:i.$t("trace.status"),width:"100"},scopedSlots:i._u([{key:"default",fn:function(y){return[s("el-tag",{attrs:{type:i.getStatusType(y.row.status),size:"mini"}},[y.row.status==="OK"?s("i",{staticClass:"el-icon-success"}):i._e(),i._v(" "+i._s(y.row.status)+" ")])]}}],null,!1,3672547022)}):i._e(),i.visibleColumns.timestamp_ms?s("el-table-column",{attrs:{prop:"timestamp_ms",label:i.$t("trace.timeCreated"),width:"180"},scopedSlots:i._u([{key:"default",fn:function(y){return[i._v(" "+i._s(i.formatDateTime(y.row.timestamp_ms))+" ")]}}],null,!1,1082702673)}):i._e(),s("el-table-column",{attrs:{label:i.$t("common.operation"),width:"100",fixed:"right"},scopedSlots:i._u([{key:"default",fn:function(y){return[s("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(k){return k.stopPropagation(),i.viewDetail(y.row.trace_id)}}},[i._v(" "+i._s(i.$t("common.viewDetail"))+" ")])]}}])})],1)],1),s("div",{staticClass:"trace-pagination-wrapper"},[i.total>0?s("el-pagination",{staticClass:"trace-pagination",attrs:{"current-page":i.pageNo,"page-sizes":[10,20,50,100],"page-size":i.pageSize,size:"mini",layout:"total, prev, pager, next, sizes, jumper",total:i.total,background:""},on:{"size-change":i.handleSizeChange,"current-change":i.handleCurrentChange}}):i._e()],1)])]),s("el-dialog",{attrs:{title:i.$t("trace.selectColumns"),visible:i.showColumnDialog,width:"400px"},on:{"update:visible":function(y){i.showColumnDialog=y}}},[s("el-checkbox-group",{model:{value:i.selectedColumns,callback:function(y){i.selectedColumns=y},expression:"selectedColumns"}},[s("el-checkbox",{attrs:{label:"trace_id"}},[i._v(i._s(i.$t("trace.requestId")))]),s("el-checkbox",{attrs:{label:"timestamp_ms"}},[i._v(i._s(i.$t("trace.timeCreated")))]),s("el-checkbox",{attrs:{label:"status"}},[i._v(i._s(i.$t("trace.status")))]),s("el-checkbox",{attrs:{label:"execution_time_ms"}},[i._v(i._s(i.$t("trace.executionTime")))]),s("el-checkbox",{attrs:{label:"trace_type"}},[i._v(i._s(i.$t("trace.traceType")))]),s("el-checkbox",{attrs:{label:"trace_name"}},[i._v(i._s(i.$t("trace.traceName")))])],1),s("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[s("el-button",{attrs:{size:"mini"},on:{click:function(y){i.showColumnDialog=!1}}},[i._v(i._s(i.$t("common.cancel")))]),s("el-button",{attrs:{size:"mini",type:"primary"},on:{click:i.applyColumns}},[i._v(i._s(i.$t("common.confirm")))])],1)],1),s("el-drawer",{attrs:{visible:i.drawerVisible,"with-header":!0,title:i.drawerTitle,size:"90%",direction:"rtl","before-close":i.handleDrawerClose},on:{"update:visible":function(y){i.drawerVisible=y}}},[i.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:i.$t("trace.traceId")}},[i._v(i._s(i.traceInfo.trace_id))]),s("el-descriptions-item",{attrs:{label:i.$t("trace.status")}},[s("el-tag",{attrs:{type:i.getStatusType(i.traceInfo.status),size:"mini"}},[i._v(" "+i._s(i.traceInfo.status)+" ")])],1),s("el-descriptions-item",{attrs:{label:i.$t("trace.executionTime")}},[i._v(" "+i._s(i.formatNanoDuration(i.traceInfo.execution_time_ms))+" ")]),s("el-descriptions-item",{attrs:{label:i.$t("trace.timeCreated")}},[i._v(" "+i._s(i.formatTimestamp(i.traceInfo.timestamp_ms))+" ")]),s("el-descriptions-item",{attrs:{label:i.$t("trace.experimentId")}},[i._v(i._s(i.traceInfo.experiment_id))]),s("el-descriptions-item",{attrs:{label:i.$t("trace.traceType")}},[s("el-tag",{attrs:{size:"mini",type:"info"}},[i._v(i._s(i.traceInfo.trace_type||"-"))])],1),s("el-descriptions-item",{attrs:{label:i.$t("trace.traceName"),span:2}},[i._v(" "+i._s(i.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:i.$t("span.searchTree"),"prefix-icon":"el-icon-search",size:"small",clearable:""},on:{input:i.handleSpanSearch},model:{value:i.spanSearchQuery,callback:function(y){i.spanSearchQuery=y},expression:"spanSearchQuery"}})],1),s("TraceSpanTree",{attrs:{spans:i.filteredSpans,"selected-span-id":i.selectedSpanId,"trace-start-time":i.traceStartTime,"trace-end-time":i.traceEndTime},on:{"span-select":i.handleSpanSelect}})],1)],1),s("el-col",{staticClass:"span-detail-col",attrs:{span:16}},[s("el-card",[i.selectedSpan?s("div",{staticClass:"span-detail-content"},[s("el-tabs",{model:{value:i.activeTab,callback:function(y){i.activeTab=y},expression:"activeTab"}},[i.selectedSpan.type==="CLIENT"||i.selectedSpan.type==="CHAT_MODEL"?s("el-tab-pane",{attrs:{label:`${i.$t("trace.inputs")} / ${i.$t("trace.outputs")}`,name:"io"}},[s("div",{staticClass:"io-content"},[i.hasInputs?s("div",{staticClass:"io-section"},[s("el-collapse",{model:{value:i.activeCollapse,callback:function(y){i.activeCollapse=y},expression:"activeCollapse"}},[s("el-collapse-item",{attrs:{title:i.$t("trace.inputs"),name:"inputs"}},[(c=(l=i.selectedSpan.parsedContent)==null?void 0:l.inputs)!=null&&c.messages?s("div",{staticClass:"messages-section"},i._l(i.selectedSpan.parsedContent.inputs.messages,function(y,k){return s("div",{key:k,staticClass:"message-item"},[s("el-collapse",{model:{value:i.messageCollapse,callback:function(L){i.messageCollapse=L},expression:"messageCollapse"}},[s("el-collapse-item",{attrs:{name:`message-${k}`}},[s("template",{slot:"title"},[s("i",{staticClass:"message-icon",class:i.getMessageIcon(y.role)}),s("span",{staticClass:"message-role"},[i._v(i._s(y.role))])]),s("div",{staticClass:"message-content"},[s("div",{staticClass:"structured-content"},i._l(i.renderStructuredContent(y.content),function(L){return s("div",{key:L.key,staticClass:"content-element"},[L.type==="markdown"?s("div",{staticClass:"markdown-content",domProps:{innerHTML:i._s(L.content)}}):L.type==="image"?s("div",{staticClass:"image-content"},[L.label?s("div",{staticClass:"image-label"},[i._v(i._s(L.label))]):i._e(),s("img",{staticClass:"content-image",attrs:{src:L.url,alt:"content image"},on:{click:function(_){return i.handleImageClick(L.url)}}})]):i._e()])}),0)])],2)],1)],1)}),0):(g=i.selectedSpan.parsedContent)!=null&&g.inputs?s("div",{staticClass:"structured-content"},i._l(i.renderStructuredContent(i.selectedSpan.parsedContent.inputs),function(y){return s("div",{key:y.key,staticClass:"content-element"},[y.type==="markdown"?s("div",{staticClass:"markdown-content",domProps:{innerHTML:i._s(y.content)}}):y.type==="image"?s("div",{staticClass:"image-content"},[y.label?s("div",{staticClass:"image-label"},[i._v(i._s(y.label))]):i._e(),s("img",{staticClass:"content-image",attrs:{src:y.url,alt:"content image"},on:{click:function(k){return i.handleImageClick(y.url)}}})]):i._e()])}),0):s("div",{staticClass:"empty-content"},[s("el-empty",{attrs:{description:i.$t("trace.noInputs"),"image-size":80}})],1)])],1)],1):i._e(),i.hasOutputs?s("div",{staticClass:"io-section"},[s("el-collapse",{model:{value:i.activeCollapse,callback:function(y){i.activeCollapse=y},expression:"activeCollapse"}},[s("el-collapse-item",{attrs:{title:i.$t("trace.outputs"),name:"outputs"}},[(w=(p=i.selectedSpan.parsedContent)==null?void 0:p.outputs)!=null&&w.choices?s("div",{staticClass:"outputs-section"},i._l(i.selectedSpan.parsedContent.outputs.choices,function(y,k){return s("div",{key:k,staticClass:"choice-item"},[s("div",{staticClass:"choice-header"},[s("span",[i._v("Choice "+i._s(k))])]),s("div",{staticClass:"choice-content"},[y.message?s("div",[s("div",{staticClass:"message-header"},[s("i",{staticClass:"el-icon-user message-icon"}),s("span",[i._v(i._s(y.message.role))])]),s("div",{staticClass:"structured-content"},i._l(i.renderStructuredContent(y.message.content),function(L){return s("div",{key:L.key,staticClass:"content-element"},[L.type==="markdown"?s("div",{staticClass:"markdown-content",domProps:{innerHTML:i._s(L.content)}}):L.type==="image"?s("div",{staticClass:"image-content"},[L.label?s("div",{staticClass:"image-label"},[i._v(i._s(L.label))]):i._e(),s("img",{staticClass:"content-image",attrs:{src:L.url,alt:"content image"},on:{click:function(_){return i.handleImageClick(L.url)}}})]):i._e()])}),0)]):s("div",{staticClass:"structured-content"},i._l(i.renderStructuredContent(y),function(L){return s("div",{key:L.key,staticClass:"content-element"},[L.type==="markdown"?s("div",{staticClass:"markdown-content",domProps:{innerHTML:i._s(L.content)}}):L.type==="image"?s("div",{staticClass:"image-content"},[L.label?s("div",{staticClass:"image-label"},[i._v(i._s(L.label))]):i._e(),s("img",{staticClass:"content-image",attrs:{src:L.url,alt:"content image"},on:{click:function(_){return i.handleImageClick(L.url)}}})]):i._e()])}),0)])])}),0):(b=i.selectedSpan.parsedContent)!=null&&b.outputs?s("div",{staticClass:"structured-content"},i._l(i.renderStructuredContent(i.selectedSpan.parsedContent.outputs),function(y){return s("div",{key:y.key,staticClass:"content-element"},[y.type==="markdown"?s("div",{staticClass:"markdown-content",domProps:{innerHTML:i._s(y.content)}}):y.type==="image"?s("div",{staticClass:"image-content"},[y.label?s("div",{staticClass:"image-label"},[i._v(i._s(y.label))]):i._e(),s("img",{staticClass:"content-image",attrs:{src:y.url,alt:"content image"},on:{click:function(k){return i.handleImageClick(y.url)}}})]):i._e()])}),0):s("div",{staticClass:"empty-content"},[s("el-empty",{attrs:{description:i.$t("trace.noOutputs"),"image-size":80}})],1)])],1)],1):i._e(),!i.hasInputs&&!i.hasOutputs?s("div",{staticClass:"empty-io"},[s("el-empty",{attrs:{description:i.$t("trace.noIoData")}})],1):i._e()])]):i._e(),s("el-tab-pane",{attrs:{label:i.$t("trace.attributes"),name:"attributes"}},[s("el-table",{staticClass:"attributes-table",attrs:{data:i.attributesData,border:"",stripe:""}},[s("el-table-column",{attrs:{prop:"key",label:i.$t("trace.key"),width:"250"},scopedSlots:i._u([{key:"default",fn:function(y){return[s("el-tooltip",{attrs:{content:y.row.key,placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[s("span",{staticClass:"attribute-key"},[i._v(i._s(y.row.key))])])]}}],null,!1,688878823)}),s("el-table-column",{attrs:{prop:"value",label:i.$t("trace.value")},scopedSlots:i._u([{key:"default",fn:function(y){return[s("el-tooltip",{attrs:{placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[s("div",{staticClass:"attribute-tooltip-content",attrs:{slot:"content"},slot:"content"},[i._v(i._s(y.row.value))]),s("div",{staticClass:"attribute-value"},[i._v(i._s(y.row.value))])])]}}],null,!1,4281519148)})],1)],1),i.selectedSpan.type==="CLIENT"||i.selectedSpan.type==="CHAT_MODEL"?s("el-tab-pane",{attrs:{label:i.$t("trace.rawInputsOutputs"),name:"raw"}},[i.activeTab==="raw"?s("div",{staticClass:"raw-io-content"},[i.rawInputs?s("div",{staticClass:"raw-io-section"},[s("el-collapse",{model:{value:i.rawIoCollapse,callback:function(y){i.rawIoCollapse=y},expression:"rawIoCollapse"}},[s("el-collapse-item",{attrs:{title:i.$t("trace.rawInputs"),name:"rawInputs"}},[s("codemirror",{key:`raw-inputs-${i.selectedSpanId}-${i.rawInputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:i.formatRawJson(i.rawInputs),options:i.cmOptions}})],1)],1)],1):i._e(),i.rawOutputs?s("div",{staticClass:"raw-io-section"},[s("el-collapse",{model:{value:i.rawIoCollapse,callback:function(y){i.rawIoCollapse=y},expression:"rawIoCollapse"}},[s("el-collapse-item",{attrs:{title:i.$t("trace.rawOutputs"),name:"rawOutputs"}},[s("codemirror",{key:`raw-outputs-${i.selectedSpanId}-${i.rawOutputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:i.formatRawJson(i.rawOutputs),options:i.cmOptions}})],1)],1)],1):i._e(),!i.rawInputs&&!i.rawOutputs?s("div",{staticClass:"empty-raw-io"},[s("el-empty",{attrs:{description:i.$t("trace.noIoData")}})],1):i._e()]):i._e()]):i._e(),i.hasEvents?s("el-tab-pane",{attrs:{label:i.$t("trace.events"),name:"events"}},[i.activeTab==="events"?s("div",{staticClass:"events-content"},[s("el-collapse",{model:{value:i.eventsCollapse,callback:function(y){i.eventsCollapse=y},expression:"eventsCollapse"}},i._l(i.spanEvents,function(y,k){return s("el-collapse-item",{key:`event-${k}`,attrs:{name:`event-${k}`}},[s("template",{slot:"title"},[s("div",{staticClass:"event-header"},[s("el-tag",{staticClass:"event-name-tag",attrs:{type:y.name==="exception"?"danger":"info",size:"mini"}},[i._v(" "+i._s(y.name)+" ")]),s("span",{staticClass:"event-time"},[i._v(i._s(i.formatEventTimestamp(y.timestamp)))])],1)]),s("div",{staticClass:"event-detail"},[y.name==="exception"?s("div",{staticClass:"exception-content"},[y.attributes["exception.type"]?s("div",{staticClass:"exception-field"},[s("div",{staticClass:"field-label"},[i._v(i._s(i.$t("trace.exceptionType")))]),s("div",{staticClass:"field-value exception-type"},[i._v(i._s(y.attributes["exception.type"]))])]):i._e(),y.attributes["exception.message"]?s("div",{staticClass:"exception-field"},[s("div",{staticClass:"field-label"},[i._v(i._s(i.$t("trace.exceptionMessage")))]),s("div",{staticClass:"field-value exception-message"},[i._v(i._s(y.attributes["exception.message"]))])]):i._e(),y.attributes["exception.stacktrace"]?s("div",{staticClass:"exception-field"},[s("div",{staticClass:"field-label"},[i._v(i._s(i.$t("trace.exceptionStacktrace")))]),s("codemirror",{key:`stacktrace-${i.selectedSpanId}-${k}-${i.eventsKey}`,staticClass:"code-editor-wrapper stacktrace-editor",attrs:{value:y.attributes["exception.stacktrace"],options:i.cmOptionsJava}})],1):i._e(),i.getOtherEventAttributes(y).length>0?s("div",{staticClass:"exception-field"},[s("div",{staticClass:"field-label"},[i._v(i._s(i.$t("trace.otherAttributes")))]),s("el-table",{attrs:{data:i.getOtherEventAttributes(y),border:"",stripe:"",size:"mini"}},[s("el-table-column",{attrs:{prop:"key",label:i.$t("trace.key"),width:"200"}}),s("el-table-column",{attrs:{prop:"value",label:i.$t("trace.value")}})],1)],1):i._e()]):s("div",{staticClass:"general-event-content"},[s("el-table",{attrs:{data:i.getEventAttributesData(y),border:"",stripe:"",size:"mini"}},[s("el-table-column",{attrs:{prop:"key",label:i.$t("trace.key"),width:"200"},scopedSlots:i._u([{key:"default",fn:function(L){return[s("el-tooltip",{attrs:{content:L.row.key,placement:"top","open-delay":500}},[s("span",{staticClass:"attribute-key"},[i._v(i._s(L.row.key))])])]}}],null,!0)}),s("el-table-column",{attrs:{prop:"value",label:i.$t("trace.value")},scopedSlots:i._u([{key:"default",fn:function(L){return[s("el-tooltip",{attrs:{placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[s("div",{staticClass:"attribute-tooltip-content",attrs:{slot:"content"},slot:"content"},[i._v(i._s(L.row.value))]),s("div",{staticClass:"attribute-value"},[i._v(i._s(L.row.value))])])]}}],null,!0)})],1)],1)])],2)}),1),i.spanEvents.length===0?s("div",{staticClass:"empty-events"},[s("el-empty",{attrs:{description:i.$t("trace.noEvents")}})],1):i._e()],1):i._e()]):i._e()],1)],1):s("el-empty",{attrs:{description:i.$t("trace.selectSpan")}})],1)],1)],1)],1):i._e()])],1)},ap=[],sp=Lo(np,ip,ap,!1,null,"0ada0d21");const os=sp.exports,El={routes:[{path:"/trace",name:"trace",component:os}],beforeEach:(f,i,s)=>{s()}},Ol={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:"暂无事件数据",exceptionType:"异常类型",exceptionMessage:"异常消息",exceptionStacktrace:"异常堆栈",otherAttributes:"其他属性",key:"键",value:"值",selectColumns:"选择列",batchDelete:"批量删除",startTime:"开始时间",endTime:"结束时间",to:"至",confirmDelete:"确认删除",confirmDeleteButton:"确定删除",deleteAllWarning:`警告:您没有设置任何查询条件,这将删除所有 trace 数据!
83
83
 
84
84
  此操作不可恢复,请确认是否继续?`,deleteConfirmMessage:"确定要删除符合以下条件的 trace 吗?",searchCondition:"搜索条件",timeRange:"时间范围",before:"在",deleteConfirmFooter:`
85
- 此操作不可恢复,请确认是否继续?`,deleteSuccess:"删除成功",deleteFailed:"删除失败",unknownError:"未知错误"}},El={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:"未知错误"}},Al={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",exceptionType:"Exception Type",exceptionMessage:"Exception Message",exceptionStacktrace:"Exception Stacktrace",otherAttributes:"Other Attributes",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!
86
86
 
87
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:`
88
- This operation cannot be undone. Are you sure you want to continue?`,deleteSuccess:"Delete successful",deleteFailed:"Delete failed",unknownError:"Unknown error"}},Qn={"zh-CN":Ol,"en-US":El};let ss=!1;const Il=f=>{!f||ss||(f.mergeLocaleMessage?(Object.keys(Qn).forEach(a=>{f.mergeLocaleMessage(a,Qn[a])}),ss=!0):f.messages&&(Object.keys(Qn).forEach(a=>{f.messages[a]||(f.messages[a]={}),Object.assign(f.messages[a],Qn[a])}),ss=!0))},op={store:lo,router:Al,components:{Trace:as,TraceSpanTree:$a},api:rn,locales:Qn,setI18n(f){Il(f)},registerLocales:Il};de.Trace=as,de.TraceSpanTree=$a,de.default=op,de.enUS=El,de.traceApi=rn,de.traceRouter=Al,de.traceStore=lo,de.zhCN=Ol,Object.defineProperties(de,{__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"}},ai={"zh-CN":Ol,"en-US":Al};let ls=!1;const Il=f=>{!f||ls||(f.mergeLocaleMessage?(Object.keys(ai).forEach(i=>{f.mergeLocaleMessage(i,ai[i])}),ls=!0):f.messages&&(Object.keys(ai).forEach(i=>{f.messages[i]||(f.messages[i]={}),Object.assign(f.messages[i],ai[i])}),ls=!0))},op={store:lo,router:El,components:{Trace:os,TraceSpanTree:ja},api:on,locales:ai,setI18n(f){Il(f)},registerLocales:Il};ke.Trace=os,ke.TraceSpanTree=ja,ke.default=op,ke.enUS=Al,ke.traceApi=on,ke.traceRouter=El,ke.traceStore=lo,ke.zhCN=Ol,Object.defineProperties(ke,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});