@langsword/trace 0.1.7 → 0.1.8

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,60 +1,60 @@
1
- (function(Ie,it){typeof exports=="object"&&typeof module<"u"?it(exports,require("pinia"),require("axios"),require("vue")):typeof define=="function"&&define.amd?define(["exports","pinia","axios","vue"],it):(Ie=typeof globalThis<"u"?globalThis:Ie||self,it(Ie.LangswordTrace={},Ie.Pinia,Ie.axios,Ie.Vue))})(this,function(Ie,it,Yt,Xf){"use strict";var Ym=Object.defineProperty;var Uf=Ie=>{throw TypeError(Ie)};var Vm=(Ie,it,Yt)=>it in Ie?Ym(Ie,it,{enumerable:!0,configurable:!0,writable:!0,value:Yt}):Ie[it]=Yt;var Je=(Ie,it,Yt)=>Vm(Ie,typeof it!="symbol"?it+"":it,Yt),Jm=(Ie,it,Yt)=>it.has(Ie)||Uf("Cannot "+Yt);var Gf=(Ie,it,Yt)=>it.has(Ie)?Uf("Cannot add the same private member more than once"):it instanceof WeakSet?it.add(Ie):it.set(Ie,Yt);var Ra=(Ie,it,Yt)=>(Jm(Ie,it,"access private method"),Yt);var Qn,so,Kf;var oo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Fa={exports:{}},lo;function Wt(){return lo||(lo=1,function(l,n){(function(a,o){l.exports=o()})(oo,function(){var a=navigator.userAgent,o=navigator.platform,f=/gecko\/\d/i.test(a),d=/MSIE \d/.test(a),p=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(a),y=/Edge\/(\d+)/.exec(a),m=d||p||y,x=m&&(d?document.documentMode||6:+(y||p)[1]),S=!y&&/WebKit\//.test(a),A=S&&/Qt\/\d+\.\d+/.test(a),E=!y&&/Chrome\/(\d+)/.exec(a),H=E&&+E[1],B=/Opera\//.test(a),U=/Apple Computer/.test(navigator.vendor),F=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(a),N=/PhantomJS/.test(a),O=U&&(/Mobile\/\w+/.test(a)||navigator.maxTouchPoints>2),$=/Android/.test(a),X=O||$||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(a),ne=O||/Mac/.test(o),ue=/\bCrOS\b/.test(a),se=/win/i.test(o),he=B&&a.match(/Version\/(\d*\.\d*)/);he&&(he=Number(he[1])),he&&he>=15&&(B=!1,S=!0);var Oe=ne&&(A||B&&(he==null||he<12.11)),Re=f||m&&x>=9;function ie(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var ze=function(e,t){var i=e.className,r=ie(t).exec(i);if(r){var s=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(s?r[1]+s:"")}};function W(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Q(e,t){return W(e).appendChild(t)}function k(e,t,i,r){var s=document.createElement(e);if(i&&(s.className=i),r&&(s.style.cssText=r),typeof t=="string")s.appendChild(document.createTextNode(t));else if(t)for(var u=0;u<t.length;++u)s.appendChild(t[u]);return s}function J(e,t,i,r){var s=k(e,t,i,r);return s.setAttribute("role","presentation"),s}var G;document.createRange?G=function(e,t,i,r){var s=document.createRange();return s.setEnd(r||e,i),s.setStart(e,t),s}:G=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function D(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 R(e){var t=e.ownerDocument||e,i;try{i=e.activeElement}catch{i=t.body||null}for(;i&&i.shadowRoot&&i.shadowRoot.activeElement;)i=i.shadowRoot.activeElement;return i}function K(e,t){var i=e.className;ie(t).test(i)||(e.className+=(i?" ":"")+t)}function de(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!ie(i[r]).test(t)&&(t+=" "+i[r]);return t}var L=function(e){e.select()};O?L=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:m&&(L=function(e){try{e.select()}catch{}});function w(e){return e.display.wrapper.ownerDocument}function oe(e){return Te(e.display.wrapper)}function Te(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function Z(e){return w(e).defaultView}function ce(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function ke(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function _e(e,t,i,r,s){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var u=r||0,c=s||0;;){var h=e.indexOf(" ",u);if(h<0||h>=t)return c+(t-u);c+=h-u,c+=i-c%i,u=h+1}}var ft=function(){this.id=null,this.f=null,this.time=0,this.handler=ce(this.onTimeout,this)};ft.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ft.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function we(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var Me=50,Ke={toString:function(){return"CodeMirror.Pass"}},ct={scroll:!1},Pt={origin:"*mouse"},ht={origin:"+move"};function dt(e,t,i){for(var r=0,s=0;;){var u=e.indexOf(" ",r);u==-1&&(u=e.length);var c=u-r;if(u==e.length||s+c>=t)return r+Math.min(c,t-s);if(s+=u-r,s+=i-s%i,r=u+1,s>=t)return r}}var gt=[""];function Ut(e){for(;gt.length<=e;)gt.push(be(gt)+" ");return gt[e]}function be(e){return e[e.length-1]}function kt(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function Gt(e,t,i){for(var r=0,s=i(t);r<e.length&&i(e[r])<=s;)r++;e.splice(r,0,t)}function On(){}function Zn(e,t){var i;return Object.create?i=Object.create(e):(On.prototype=e,i=new On),t&&ke(t,i),i}var wr=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ye(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||wr.test(e))}function xe(e,t){return t?t.source.indexOf("\\w")>-1&&ye(e)?!0:t.test(e):ye(e)}function pe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function De(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function zt(e,t,i){for(;(i<0?t>0:t<e.length)&&De(e.charAt(t));)t+=i;return t}function Zt(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var s=(t+i)/2,u=r<0?Math.ceil(s):Math.floor(s);if(u==t)return e(u)?t:i;e(u)?i=u:t=u+r}}function Nn(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var s=!1,u=0;u<e.length;++u){var c=e[u];(c.from<i&&c.to>t||t==i&&c.to==t)&&(r(Math.max(c.from,t),Math.min(c.to,i),c.level==1?"rtl":"ltr",u),s=!0)}s||r(t,i,"ltr")}var er=null;function Mn(e,t,i){var r;er=null;for(var s=0;s<e.length;++s){var u=e[s];if(u.from<t&&u.to>t)return s;u.to==t&&(u.from!=u.to&&i=="before"?r=s:er=s),u.from==t&&(u.from!=u.to&&i!="before"?r=s:er=s)}return r??er}var fs=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(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]/,s=/[stwN]/,u=/[LRr]/,c=/[Lb1n]/,h=/[1n]/;function g(v,C,_){this.level=v,this.from=C,this.to=_}return function(v,C){var _=C=="ltr"?"L":"R";if(v.length==0||C=="ltr"&&!r.test(v))return!1;for(var M=v.length,I=[],z=0;z<M;++z)I.push(i(v.charCodeAt(z)));for(var q=0,V=_;q<M;++q){var ee=I[q];ee=="m"?I[q]=V:V=ee}for(var ae=0,te=_;ae<M;++ae){var le=I[ae];le=="1"&&te=="r"?I[ae]="n":u.test(le)&&(te=le,le=="r"&&(I[ae]="R"))}for(var ve=1,ge=I[0];ve<M-1;++ve){var Ae=I[ve];Ae=="+"&&ge=="1"&&I[ve+1]=="1"?I[ve]="1":Ae==","&&ge==I[ve+1]&&(ge=="1"||ge=="n")&&(I[ve]=ge),ge=Ae}for(var qe=0;qe<M;++qe){var xt=I[qe];if(xt==",")I[qe]="N";else if(xt=="%"){var Qe=void 0;for(Qe=qe+1;Qe<M&&I[Qe]=="%";++Qe);for(var Ht=qe&&I[qe-1]=="!"||Qe<M&&I[Qe]=="1"?"1":"N",Mt=qe;Mt<Qe;++Mt)I[Mt]=Ht;qe=Qe-1}}for(var lt=0,Rt=_;lt<M;++lt){var St=I[lt];Rt=="L"&&St=="1"?I[lt]="L":u.test(St)&&(Rt=St)}for(var pt=0;pt<M;++pt)if(s.test(I[pt])){var ut=void 0;for(ut=pt+1;ut<M&&s.test(I[ut]);++ut);for(var rt=(pt?I[pt-1]:_)=="L",Ft=(ut<M?I[ut]:_)=="L",Kr=rt==Ft?rt?"L":"R":_,Kn=pt;Kn<ut;++Kn)I[Kn]=Kr;pt=ut-1}for(var Lt=[],xn,wt=0;wt<M;)if(c.test(I[wt])){var io=wt;for(++wt;wt<M&&c.test(I[wt]);++wt);Lt.push(new g(0,io,wt))}else{var Dn=wt,fr=Lt.length,cr=C=="rtl"?1:0;for(++wt;wt<M&&I[wt]!="L";++wt);for(var Dt=Dn;Dt<wt;)if(h.test(I[Dt])){Dn<Dt&&(Lt.splice(fr,0,new g(1,Dn,Dt)),fr+=cr);var Xr=Dt;for(++Dt;Dt<wt&&h.test(I[Dt]);++Dt);Lt.splice(fr,0,new g(2,Xr,Dt)),fr+=cr,Dn=Dt}else++Dt;Dn<wt&&Lt.splice(fr,0,new g(1,Dn,wt))}return C=="ltr"&&(Lt[0].level==1&&(xn=v.match(/^\s+/))&&(Lt[0].from=xn[0].length,Lt.unshift(new g(0,0,xn[0].length))),be(Lt).level==1&&(xn=v.match(/\s+$/))&&(be(Lt).to-=xn[0].length,Lt.push(new g(0,M-xn[0].length,M)))),C=="rtl"?Lt.reverse():Lt}}();function Pe(e,t){var i=e.order;return i==null&&(i=e.order=fs(e.text,t)),i}var na=[],me=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||na).concat(i)}};function kn(e,t){return e._handlers&&e._handlers[t]||na}function Ct(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,s=r&&r[t];if(s){var u=we(s,i);u>-1&&(r[t]=s.slice(0,u).concat(s.slice(u+1)))}}}function et(e,t){var i=kn(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),s=0;s<i.length;++s)i[s].apply(null,r)}function tt(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),et(e,i||t.type,e,t),At(t)||t.codemirrorIgnore}function en(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)we(i,t[r])==-1&&i.push(t[r])}function $t(e,t){return kn(e,t).length>0}function an(e){e.prototype.on=function(t,i){me(this,t,i)},e.prototype.off=function(t,i){Ct(this,t,i)}}function Tt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function kr(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function At(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Rn(e){Tt(e),kr(e)}function li(e){return e.target||e.srcElement}function sn(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),ne&&e.ctrlKey&&t==1&&(t=3),t}var cs=function(){if(m&&x<9)return!1;var e=k("div");return"draggable"in e||"dragDrop"in e}(),Sr;function ra(e){if(Sr==null){var t=k("span","​");Q(e,k("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Sr=t.offsetWidth<=1&&t.offsetHeight>2&&!(m&&x<8))}var i=Sr?k("span","​"):k("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ui;function Fn(e){if(ui!=null)return ui;var t=Q(e,document.createTextNode("AخA")),i=G(t,0,1).getBoundingClientRect(),r=G(t,1,2).getBoundingClientRect();return W(e),!i||i.left==i.right?!1:ui=r.right-i.right<3}var tn=`
1
+ (function(Ie,it){typeof exports=="object"&&typeof module<"u"?it(exports,require("pinia"),require("axios"),require("vue")):typeof define=="function"&&define.amd?define(["exports","pinia","axios","vue"],it):(Ie=typeof globalThis<"u"?globalThis:Ie||self,it(Ie.LangswordTrace={},Ie.Pinia,Ie.axios,Ie.Vue))})(this,function(Ie,it,Yt,Kc){"use strict";var Ym=Object.defineProperty;var qc=Ie=>{throw TypeError(Ie)};var Vm=(Ie,it,Yt)=>it in Ie?Ym(Ie,it,{enumerable:!0,configurable:!0,writable:!0,value:Yt}):Ie[it]=Yt;var Je=(Ie,it,Yt)=>Vm(Ie,typeof it!="symbol"?it+"":it,Yt),Jm=(Ie,it,Yt)=>it.has(Ie)||qc("Cannot "+Yt);var Uc=(Ie,it,Yt)=>it.has(Ie)?qc("Cannot add the same private member more than once"):it instanceof WeakSet?it.add(Ie):it.set(Ie,Yt);var Ma=(Ie,it,Yt)=>(Jm(Ie,it,"access private method"),Yt);var Qn,so,Gc;var oo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Fa={exports:{}},lo;function Wt(){return lo||(lo=1,function(l,n){(function(a,o){l.exports=o()})(oo,function(){var a=navigator.userAgent,o=navigator.platform,c=/gecko\/\d/i.test(a),d=/MSIE \d/.test(a),p=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(a),y=/Edge\/(\d+)/.exec(a),m=d||p||y,w=m&&(d?document.documentMode||6:+(y||p)[1]),S=!y&&/WebKit\//.test(a),M=S&&/Qt\/\d+\.\d+/.test(a),E=!y&&/Chrome\/(\d+)/.exec(a),A=E&&+E[1],z=/Opera\//.test(a),B=/Apple Computer/.test(navigator.vendor),P=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(a),N=/PhantomJS/.test(a),O=B&&(/Mobile\/\w+/.test(a)||navigator.maxTouchPoints>2),W=/Android/.test(a),X=O||W||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(a),ne=O||/Mac/.test(o),ue=/\bCrOS\b/.test(a),se=/win/i.test(o),he=z&&a.match(/Version\/(\d*\.\d*)/);he&&(he=Number(he[1])),he&&he>=15&&(z=!1,S=!0);var Oe=ne&&(M||z&&(he==null||he<12.11)),Me=c||m&&w>=9;function ie(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var $e=function(e,t){var i=e.className,r=ie(t).exec(i);if(r){var s=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(s?r[1]+s:"")}};function j(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Q(e,t){return j(e).appendChild(t)}function k(e,t,i,r){var s=document.createElement(e);if(i&&(s.className=i),r&&(s.style.cssText=r),typeof t=="string")s.appendChild(document.createTextNode(t));else if(t)for(var u=0;u<t.length;++u)s.appendChild(t[u]);return s}function J(e,t,i,r){var s=k(e,t,i,r);return s.setAttribute("role","presentation"),s}var G;document.createRange?G=function(e,t,i,r){var s=document.createRange();return s.setEnd(r||e,i),s.setStart(e,t),s}:G=function(e,t,i){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r};function D(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 F(e){var t=e.ownerDocument||e,i;try{i=e.activeElement}catch{i=t.body||null}for(;i&&i.shadowRoot&&i.shadowRoot.activeElement;)i=i.shadowRoot.activeElement;return i}function K(e,t){var i=e.className;ie(t).test(i)||(e.className+=(i?" ":"")+t)}function de(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!ie(i[r]).test(t)&&(t+=" "+i[r]);return t}var L=function(e){e.select()};O?L=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:m&&(L=function(e){try{e.select()}catch{}});function x(e){return e.display.wrapper.ownerDocument}function oe(e){return Te(e.display.wrapper)}function Te(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function Z(e){return x(e).defaultView}function fe(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function we(e,t,i){t||(t={});for(var r in e)e.hasOwnProperty(r)&&(i!==!1||!t.hasOwnProperty(r))&&(t[r]=e[r]);return t}function _e(e,t,i,r,s){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var u=r||0,f=s||0;;){var h=e.indexOf(" ",u);if(h<0||h>=t)return f+(t-u);f+=h-u,f+=i-f%i,u=h+1}}var ct=function(){this.id=null,this.f=null,this.time=0,this.handler=fe(this.onTimeout,this)};ct.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ct.prototype.set=function(e,t){this.f=t;var i=+new Date+e;(!this.id||i<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=i)};function ke(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var Re=50,Ke={toString:function(){return"CodeMirror.Pass"}},ft={scroll:!1},Pt={origin:"*mouse"},ht={origin:"+move"};function dt(e,t,i){for(var r=0,s=0;;){var u=e.indexOf(" ",r);u==-1&&(u=e.length);var f=u-r;if(u==e.length||s+f>=t)return r+Math.min(f,t-s);if(s+=u-r,s+=i-s%i,r=u+1,s>=t)return r}}var gt=[""];function Ut(e){for(;gt.length<=e;)gt.push(be(gt)+" ");return gt[e]}function be(e){return e[e.length-1]}function wt(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function Gt(e,t,i){for(var r=0,s=i(t);r<e.length&&i(e[r])<=s;)r++;e.splice(r,0,t)}function On(){}function Zn(e,t){var i;return Object.create?i=Object.create(e):(On.prototype=e,i=new On),t&&we(t,i),i}var kr=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ye(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||kr.test(e))}function xe(e,t){return t?t.source.indexOf("\\w")>-1&&ye(e)?!0:t.test(e):ye(e)}function pe(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Fe=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function De(e){return e.charCodeAt(0)>=768&&Fe.test(e)}function $t(e,t,i){for(;(i<0?t>0:t<e.length)&&De(e.charAt(t));)t+=i;return t}function Zt(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var s=(t+i)/2,u=r<0?Math.ceil(s):Math.floor(s);if(u==t)return e(u)?t:i;e(u)?i=u:t=u+r}}function Nn(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var s=!1,u=0;u<e.length;++u){var f=e[u];(f.from<i&&f.to>t||t==i&&f.to==t)&&(r(Math.max(f.from,t),Math.min(f.to,i),f.level==1?"rtl":"ltr",u),s=!0)}s||r(t,i,"ltr")}var er=null;function Rn(e,t,i){var r;er=null;for(var s=0;s<e.length;++s){var u=e[s];if(u.from<t&&u.to>t)return s;u.to==t&&(u.from!=u.to&&i=="before"?r=s:er=s),u.from==t&&(u.from!=u.to&&i!="before"?r=s:er=s)}return r??er}var cs=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(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]/,s=/[stwN]/,u=/[LRr]/,f=/[Lb1n]/,h=/[1n]/;function g(v,C,_){this.level=v,this.from=C,this.to=_}return function(v,C){var _=C=="ltr"?"L":"R";if(v.length==0||C=="ltr"&&!r.test(v))return!1;for(var R=v.length,I=[],H=0;H<R;++H)I.push(i(v.charCodeAt(H)));for(var U=0,V=_;U<R;++U){var ee=I[U];ee=="m"?I[U]=V:V=ee}for(var ae=0,te=_;ae<R;++ae){var le=I[ae];le=="1"&&te=="r"?I[ae]="n":u.test(le)&&(te=le,le=="r"&&(I[ae]="R"))}for(var ve=1,ge=I[0];ve<R-1;++ve){var Ae=I[ve];Ae=="+"&&ge=="1"&&I[ve+1]=="1"?I[ve]="1":Ae==","&&ge==I[ve+1]&&(ge=="1"||ge=="n")&&(I[ve]=ge),ge=Ae}for(var qe=0;qe<R;++qe){var xt=I[qe];if(xt==",")I[qe]="N";else if(xt=="%"){var Qe=void 0;for(Qe=qe+1;Qe<R&&I[Qe]=="%";++Qe);for(var Ht=qe&&I[qe-1]=="!"||Qe<R&&I[Qe]=="1"?"1":"N",Rt=qe;Rt<Qe;++Rt)I[Rt]=Ht;qe=Qe-1}}for(var lt=0,Mt=_;lt<R;++lt){var St=I[lt];Mt=="L"&&St=="1"?I[lt]="L":u.test(St)&&(Mt=St)}for(var pt=0;pt<R;++pt)if(s.test(I[pt])){var ut=void 0;for(ut=pt+1;ut<R&&s.test(I[ut]);++ut);for(var rt=(pt?I[pt-1]:_)=="L",Ft=(ut<R?I[ut]:_)=="L",Kr=rt==Ft?rt?"L":"R":_,Kn=pt;Kn<ut;++Kn)I[Kn]=Kr;pt=ut-1}for(var Lt=[],xn,kt=0;kt<R;)if(f.test(I[kt])){var io=kt;for(++kt;kt<R&&f.test(I[kt]);++kt);Lt.push(new g(0,io,kt))}else{var An=kt,cr=Lt.length,fr=C=="rtl"?1:0;for(++kt;kt<R&&I[kt]!="L";++kt);for(var Dt=An;Dt<kt;)if(h.test(I[Dt])){An<Dt&&(Lt.splice(cr,0,new g(1,An,Dt)),cr+=fr);var Xr=Dt;for(++Dt;Dt<kt&&h.test(I[Dt]);++Dt);Lt.splice(cr,0,new g(2,Xr,Dt)),cr+=fr,An=Dt}else++Dt;An<kt&&Lt.splice(cr,0,new g(1,An,kt))}return C=="ltr"&&(Lt[0].level==1&&(xn=v.match(/^\s+/))&&(Lt[0].from=xn[0].length,Lt.unshift(new g(0,0,xn[0].length))),be(Lt).level==1&&(xn=v.match(/\s+$/))&&(be(Lt).to-=xn[0].length,Lt.push(new g(0,R-xn[0].length,R)))),C=="rtl"?Lt.reverse():Lt}}();function Pe(e,t){var i=e.order;return i==null&&(i=e.order=cs(e.text,t)),i}var na=[],me=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||na).concat(i)}};function Sn(e,t){return e._handlers&&e._handlers[t]||na}function Ct(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers,s=r&&r[t];if(s){var u=ke(s,i);u>-1&&(r[t]=s.slice(0,u).concat(s.slice(u+1)))}}}function et(e,t){var i=Sn(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),s=0;s<i.length;++s)i[s].apply(null,r)}function tt(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),et(e,i||t.type,e,t),At(t)||t.codemirrorIgnore}function en(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)ke(i,t[r])==-1&&i.push(t[r])}function zt(e,t){return Sn(e,t).length>0}function an(e){e.prototype.on=function(t,i){me(this,t,i)},e.prototype.off=function(t,i){Ct(this,t,i)}}function Tt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function wr(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function At(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Mn(e){Tt(e),wr(e)}function li(e){return e.target||e.srcElement}function sn(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),ne&&e.ctrlKey&&t==1&&(t=3),t}var fs=function(){if(m&&w<9)return!1;var e=k("div");return"draggable"in e||"dragDrop"in e}(),Sr;function ra(e){if(Sr==null){var t=k("span","​");Q(e,k("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Sr=t.offsetWidth<=1&&t.offsetHeight>2&&!(m&&w<8))}var i=Sr?k("span","​"):k("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ui;function Fn(e){if(ui!=null)return ui;var t=Q(e,document.createTextNode("AخA")),i=G(t,0,1).getBoundingClientRect(),r=G(t,1,2).getBoundingClientRect();return j(e),!i||i.left==i.right?!1:ui=r.right-i.right<3}var tn=`
2
2
 
3
3
  b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var s=e.indexOf(`
4
- `,t);s==-1&&(s=e.length);var u=e.slice(t,e.charAt(s-1)=="\r"?s-1:s),c=u.indexOf("\r");c!=-1?(i.push(u.slice(0,c)),t+=c+1):(i.push(u),t=s+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Pn=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},ia=function(){var e=k("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),on=null;function hs(e){if(on!=null)return on;var t=Q(e,k("span","x")),i=t.getBoundingClientRect(),r=G(t,0,1).getBoundingClientRect();return on=Math.abs(i.left-r.left)>1}var Cr={},ln={};function un(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Cr[e]=t}function tr(e,t){ln[e]=t}function Tr(e){if(typeof e=="string"&&ln.hasOwnProperty(e))e=ln[e];else if(e&&typeof e.name=="string"&&ln.hasOwnProperty(e.name)){var t=ln[e.name];typeof t=="string"&&(t={name:t}),e=Zn(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Tr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Tr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function _r(e,t){t=Tr(t);var i=Cr[t.name];if(!i)return _r(e,"text/plain");var r=i(e,t);if(zn.hasOwnProperty(t.name)){var s=zn[t.name];for(var u in s)s.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=s[u])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var c in t.modeProps)r[c]=t.modeProps[c];return r}var zn={};function Lr(e,t){var i=zn.hasOwnProperty(e)?zn[e]:zn[e]={};ke(t,i)}function mn(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var s=t[r];s instanceof Array&&(s=s.concat([])),i[r]=s}return i}function fi(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Er(e,t,i){return e.startState?e.startState(t,i):!0}var nt=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};nt.prototype.eol=function(){return this.pos>=this.string.length},nt.prototype.sol=function(){return this.pos==this.lineStart},nt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},nt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},nt.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},nt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},nt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},nt.prototype.skipToEnd=function(){this.pos=this.string.length},nt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},nt.prototype.backUp=function(e){this.pos-=e},nt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=_e(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?_e(this.string,this.lineStart,this.tabSize):0)},nt.prototype.indentation=function(){return _e(this.string,null,this.tabSize)-(this.lineStart?_e(this.string,this.lineStart,this.tabSize):0)},nt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(c){return i?c.toLowerCase():c},s=this.string.substr(this.pos,e.length);if(r(s)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var u=this.string.slice(this.pos).match(e);return u&&u.index>0?null:(u&&t!==!1&&(this.pos+=u[0].length),u)}},nt.prototype.current=function(){return this.string.slice(this.start,this.pos)},nt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},nt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},nt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function fe(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 i=e;!i.lines;)for(var r=0;;++r){var s=i.children[r],u=s.chunkSize();if(t<u){i=s;break}t-=u}return i.lines[t]}function Sn(e,t,i){var r=[],s=t.line;return e.iter(t.line,i.line+1,function(u){var c=u.text;s==i.line&&(c=c.slice(0,i.ch)),s==t.line&&(c=c.slice(t.ch)),r.push(c),++s}),r}function ci(e,t,i){var r=[];return e.iter(t,i,function(s){r.push(s.text)}),r}function Kt(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function b(e){if(e.parent==null)return null;for(var t=e.parent,i=we(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var s=0;r.children[s]!=t;++s)i+=r.children[s].chunkSize();return i+t.first}function T(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var s=e.children[r],u=s.height;if(t<u){e=s;continue e}t-=u,i+=s.chunkSize()}return i}while(!e.lines);for(var c=0;c<e.lines.length;++c){var h=e.lines[c],g=h.height;if(t<g)break;t-=g}return i+c}function j(e,t){return t>=e.first&&t<e.first+e.size}function Y(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function P(e,t,i){if(i===void 0&&(i=null),!(this instanceof P))return new P(e,t,i);this.line=e,this.ch=t,this.sticky=i}function re(e,t){return e.line-t.line||e.ch-t.ch}function $e(e,t){return e.sticky==t.sticky&&re(e,t)==0}function mt(e){return P(e.line,e.ch)}function It(e,t){return re(e,t)<0?t:e}function Dr(e,t){return re(e,t)<0?e:t}function Ul(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Se(e,t){if(t.line<e.first)return P(e.first,0);var i=e.first+e.size-1;return t.line>i?P(i,fe(e,i).text.length):Vp(t,fe(e,t.line).text.length)}function Vp(e,t){var i=e.ch;return i==null||i>t?P(e.line,t):i<0?P(e.line,0):e}function Gl(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=Se(e,t[r]);return i}var aa=function(e,t){this.state=e,this.lookAhead=t},vn=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};vn.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},vn.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}},vn.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},vn.fromSaved=function(e,t,i){return t instanceof aa?new vn(e,mn(e.mode,t.state),i,t.lookAhead):new vn(e,mn(e.mode,t),i)},vn.prototype.save=function(e){var t=e!==!1?mn(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new aa(t,this.maxLookAhead):t};function Kl(e,t,i,r){var s=[e.state.modeGen],u={};Zl(e,t.text,e.doc.mode,i,function(v,C){return s.push(v,C)},u,r);for(var c=i.state,h=function(v){i.baseTokens=s;var C=e.state.overlays[v],_=1,M=0;i.state=!0,Zl(e,t.text,C.mode,i,function(I,z){for(var q=_;M<I;){var V=s[_];V>I&&s.splice(_,1,I,s[_+1],V),_+=2,M=Math.min(I,V)}if(z)if(C.opaque)s.splice(q,_-q,I,"overlay "+z),_=q+2;else for(;q<_;q+=2){var ee=s[q+1];s[q+1]=(ee?ee+" ":"")+"overlay "+z}},u),i.state=c,i.baseTokens=null,i.baseTokenPos=1},g=0;g<e.state.overlays.length;++g)h(g);return{styles:s,classes:u.bgClass||u.textClass?u:null}}function Xl(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=hi(e,b(t)),s=t.text.length>e.options.maxHighlightLength&&mn(e.doc.mode,r.state),u=Kl(e,t,r);s&&(r.state=s),t.stateAfter=r.save(!s),t.styles=u.styles,u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function hi(e,t,i){var r=e.doc,s=e.display;if(!r.mode.startState)return new vn(r,!0,t);var u=Jp(e,t,i),c=u>r.first&&fe(r,u-1).stateAfter,h=c?vn.fromSaved(r,c,u):new vn(r,Er(r.mode),u);return r.iter(u,t,function(g){ds(e,g.text,h);var v=h.line;g.stateAfter=v==t-1||v%5==0||v>=s.viewFrom&&v<s.viewTo?h.save():null,h.nextLine()}),i&&(r.modeFrontier=h.line),h}function ds(e,t,i,r){var s=e.doc.mode,u=new nt(t,e.options.tabSize,i);for(u.start=u.pos=r||0,t==""&&Yl(s,i.state);!u.eol();)ps(s,u,i.state),u.start=u.pos}function Yl(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var i=fi(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}}function ps(e,t,i,r){for(var s=0;s<10;s++){r&&(r[0]=fi(e,i).mode);var u=e.token(t,i);if(t.pos>t.start)return u}throw new Error("Mode "+e.name+" failed to advance stream.")}var Vl=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Jl(e,t,i,r){var s=e.doc,u=s.mode,c;t=Se(s,t);var h=fe(s,t.line),g=hi(e,t.line,i),v=new nt(h.text,e.options.tabSize,g),C;for(r&&(C=[]);(r||v.pos<t.ch)&&!v.eol();)v.start=v.pos,c=ps(u,v,g.state),r&&C.push(new Vl(v,c,mn(s.mode,g.state)));return r?C:new Vl(v,c,g.state)}function Ql(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function Zl(e,t,i,r,s,u,c){var h=i.flattenSpans;h==null&&(h=e.options.flattenSpans);var g=0,v=null,C=new nt(t,e.options.tabSize,r),_,M=e.options.addModeClass&&[null];for(t==""&&Ql(Yl(i,r.state),u);!C.eol();){if(C.pos>e.options.maxHighlightLength?(h=!1,c&&ds(e,t,r,C.pos),C.pos=t.length,_=null):_=Ql(ps(i,C,r.state,M),u),M){var I=M[0].name;I&&(_="m-"+(_?I+" "+_:I))}if(!h||v!=_){for(;g<C.start;)g=Math.min(C.start,g+5e3),s(g,v);v=_}C.start=C.pos}for(;g<C.pos;){var z=Math.min(C.pos,g+5e3);s(z,v),g=z}}function Jp(e,t,i){for(var r,s,u=e.doc,c=i?-1:t-(e.doc.mode.innerMode?1e3:100),h=t;h>c;--h){if(h<=u.first)return u.first;var g=fe(u,h-1),v=g.stateAfter;if(v&&(!i||h+(v instanceof aa?v.lookAhead:0)<=u.modeFrontier))return h;var C=_e(g.text,null,e.options.tabSize);(s==null||r>C)&&(s=h-1,r=C)}return s}function Qp(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var i=e.first,r=t-1;r>i;r--){var s=fe(e,r).stateAfter;if(s&&(!(s instanceof aa)||r+s.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}}var eu=!1,Cn=!1;function Zp(){eu=!0}function eg(){Cn=!0}function sa(e,t,i){this.marker=e,this.from=t,this.to=i}function di(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function tg(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function ng(e,t,i){var r=i&&window.WeakSet&&(i.markedSpans||(i.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 rg(e,t,i){var r;if(e)for(var s=0;s<e.length;++s){var u=e[s],c=u.marker,h=u.from==null||(c.inclusiveLeft?u.from<=t:u.from<t);if(h||u.from==t&&c.type=="bookmark"&&(!i||!u.marker.insertLeft)){var g=u.to==null||(c.inclusiveRight?u.to>=t:u.to>t);(r||(r=[])).push(new sa(c,u.from,g?null:u.to))}}return r}function ig(e,t,i){var r;if(e)for(var s=0;s<e.length;++s){var u=e[s],c=u.marker,h=u.to==null||(c.inclusiveRight?u.to>=t:u.to>t);if(h||u.from==t&&c.type=="bookmark"&&(!i||u.marker.insertLeft)){var g=u.from==null||(c.inclusiveLeft?u.from<=t:u.from<t);(r||(r=[])).push(new sa(c,g?null:u.from-t,u.to==null?null:u.to-t))}}return r}function gs(e,t){if(t.full)return null;var i=j(e,t.from.line)&&fe(e,t.from.line).markedSpans,r=j(e,t.to.line)&&fe(e,t.to.line).markedSpans;if(!i&&!r)return null;var s=t.from.ch,u=t.to.ch,c=re(t.from,t.to)==0,h=rg(i,s,c),g=ig(r,u,c),v=t.text.length==1,C=be(t.text).length+(v?s:0);if(h)for(var _=0;_<h.length;++_){var M=h[_];if(M.to==null){var I=di(g,M.marker);I?v&&(M.to=I.to==null?null:I.to+C):M.to=s}}if(g)for(var z=0;z<g.length;++z){var q=g[z];if(q.to!=null&&(q.to+=C),q.from==null){var V=di(h,q.marker);V||(q.from=C,v&&(h||(h=[])).push(q))}else q.from+=C,v&&(h||(h=[])).push(q)}h&&(h=tu(h)),g&&g!=h&&(g=tu(g));var ee=[h];if(!v){var ae=t.text.length-2,te;if(ae>0&&h)for(var le=0;le<h.length;++le)h[le].to==null&&(te||(te=[])).push(new sa(h[le].marker,null,null));for(var ve=0;ve<ae;++ve)ee.push(te);ee.push(g)}return ee}function tu(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function ag(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(I){if(I.markedSpans)for(var z=0;z<I.markedSpans.length;++z){var q=I.markedSpans[z].marker;q.readOnly&&(!r||we(r,q)==-1)&&(r||(r=[])).push(q)}}),!r)return null;for(var s=[{from:t,to:i}],u=0;u<r.length;++u)for(var c=r[u],h=c.find(0),g=0;g<s.length;++g){var v=s[g];if(!(re(v.to,h.from)<0||re(v.from,h.to)>0)){var C=[g,1],_=re(v.from,h.from),M=re(v.to,h.to);(_<0||!c.inclusiveLeft&&!_)&&C.push({from:v.from,to:h.from}),(M>0||!c.inclusiveRight&&!M)&&C.push({from:h.to,to:v.to}),s.splice.apply(s,C),g+=C.length-3}}return s}function nu(e){var t=e.markedSpans;if(t){for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}}function ru(e,t){if(t){for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}}function oa(e){return e.inclusiveLeft?-1:0}function la(e){return e.inclusiveRight?1:0}function ms(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),s=t.find(),u=re(r.from,s.from)||oa(e)-oa(t);if(u)return-u;var c=re(r.to,s.to)||la(e)-la(t);return c||t.id-e.id}function iu(e,t){var i=Cn&&e.markedSpans,r;if(i)for(var s=void 0,u=0;u<i.length;++u)s=i[u],s.marker.collapsed&&(t?s.from:s.to)==null&&(!r||ms(r,s.marker)<0)&&(r=s.marker);return r}function au(e){return iu(e,!0)}function ua(e){return iu(e,!1)}function sg(e,t){var i=Cn&&e.markedSpans,r;if(i)for(var s=0;s<i.length;++s){var u=i[s];u.marker.collapsed&&(u.from==null||u.from<t)&&(u.to==null||u.to>t)&&(!r||ms(r,u.marker)<0)&&(r=u.marker)}return r}function su(e,t,i,r,s){var u=fe(e,t),c=Cn&&u.markedSpans;if(c)for(var h=0;h<c.length;++h){var g=c[h];if(g.marker.collapsed){var v=g.marker.find(0),C=re(v.from,i)||oa(g.marker)-oa(s),_=re(v.to,r)||la(g.marker)-la(s);if(!(C>=0&&_<=0||C<=0&&_>=0)&&(C<=0&&(g.marker.inclusiveRight&&s.inclusiveLeft?re(v.to,i)>=0:re(v.to,i)>0)||C>=0&&(g.marker.inclusiveRight&&s.inclusiveLeft?re(v.from,r)<=0:re(v.from,r)<0)))return!0}}}function fn(e){for(var t;t=au(e);)e=t.find(-1,!0).line;return e}function og(e){for(var t;t=ua(e);)e=t.find(1,!0).line;return e}function lg(e){for(var t,i;t=ua(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function vs(e,t){var i=fe(e,t),r=fn(i);return i==r?t:b(r)}function ou(e,t){if(t>e.lastLine())return t;var i=fe(e,t),r;if(!$n(e,i))return t;for(;r=ua(i);)i=r.find(1,!0).line;return b(i)+1}function $n(e,t){var i=Cn&&t.markedSpans;if(i){for(var r=void 0,s=0;s<i.length;++s)if(r=i[s],!!r.marker.collapsed){if(r.from==null)return!0;if(!r.marker.widgetNode&&r.from==0&&r.marker.inclusiveLeft&&ys(e,t,r))return!0}}}function ys(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return ys(e,r.line,di(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var s=void 0,u=0;u<t.markedSpans.length;++u)if(s=t.markedSpans[u],s.marker.collapsed&&!s.marker.widgetNode&&s.from==i.to&&(s.to==null||s.to!=i.from)&&(s.marker.inclusiveLeft||i.marker.inclusiveRight)&&ys(e,t,s))return!0}function Tn(e){e=fn(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var s=i.lines[r];if(s==e)break;t+=s.height}for(var u=i.parent;u;i=u,u=i.parent)for(var c=0;c<u.children.length;++c){var h=u.children[c];if(h==i)break;t+=h.height}return t}function fa(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=au(r);){var s=i.find(0,!0);r=s.from.line,t+=s.from.ch-s.to.ch}for(r=e;i=ua(r);){var u=i.find(0,!0);t-=r.text.length-u.from.ch,r=u.to.line,t+=r.text.length-u.to.ch}return t}function bs(e){var t=e.display,i=e.doc;t.maxLine=fe(i,i.first),t.maxLineLength=fa(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var s=fa(r);s>t.maxLineLength&&(t.maxLineLength=s,t.maxLine=r)})}var Ar=function(e,t,i){this.text=e,ru(this,t),this.height=i?i(this):1};Ar.prototype.lineNo=function(){return b(this)},an(Ar);function ug(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),nu(e),ru(e,i);var s=r?r(e):1;s!=e.height&&Kt(e,s)}function fg(e){e.parent=null,nu(e)}var cg={},hg={};function lu(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?hg:cg;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function uu(e,t){var i=J("span",null,null,S?"padding-right: .1px":null),r={pre:J("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var s=0;s<=(t.rest?t.rest.length:0);s++){var u=s?t.rest[s-1]:t.line,c=void 0;r.pos=0,r.addToken=pg,Fn(e.display.measure)&&(c=Pe(u,e.doc.direction))&&(r.addToken=mg(r.addToken,c)),r.map=[];var h=t!=e.display.externalMeasured&&b(u);vg(u,r,Xl(e,u,h)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=de(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=de(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ra(e.display.measure))),s==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(S){var g=r.content.lastChild;(/\bcm-tab\b/.test(g.className)||g.querySelector&&g.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return et(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=de(r.pre.className,r.textClass||"")),r}function dg(e){var t=k("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function pg(e,t,i,r,s,u,c){if(t){var h=e.splitSpaces?gg(t,e.trailingSpace):t,g=e.cm.state.specialChars,v=!1,C;if(!g.test(t))e.col+=t.length,C=document.createTextNode(h),e.map.push(e.pos,e.pos+t.length,C),m&&x<9&&(v=!0),e.pos+=t.length;else{C=document.createDocumentFragment();for(var _=0;;){g.lastIndex=_;var M=g.exec(t),I=M?M.index-_:t.length-_;if(I){var z=document.createTextNode(h.slice(_,_+I));m&&x<9?C.appendChild(k("span",[z])):C.appendChild(z),e.map.push(e.pos,e.pos+I,z),e.col+=I,e.pos+=I}if(!M)break;_+=I+1;var q=void 0;if(M[0]==" "){var V=e.cm.options.tabSize,ee=V-e.col%V;q=C.appendChild(k("span",Ut(ee),"cm-tab")),q.setAttribute("role","presentation"),q.setAttribute("cm-text"," "),e.col+=ee}else M[0]=="\r"||M[0]==`
5
- `?(q=C.appendChild(k("span",M[0]=="\r"?"␍":"␤","cm-invalidchar")),q.setAttribute("cm-text",M[0]),e.col+=1):(q=e.cm.options.specialCharPlaceholder(M[0]),q.setAttribute("cm-text",M[0]),m&&x<9?C.appendChild(k("span",[q])):C.appendChild(q),e.col+=1);e.map.push(e.pos,e.pos+1,q),e.pos++}}if(e.trailingSpace=h.charCodeAt(t.length-1)==32,i||r||s||v||u||c){var ae=i||"";r&&(ae+=r),s&&(ae+=s);var te=k("span",[C],ae,u);if(c)for(var le in c)c.hasOwnProperty(le)&&le!="style"&&le!="class"&&te.setAttribute(le,c[le]);return e.content.appendChild(te)}e.content.appendChild(C)}}function gg(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",s=0;s<e.length;s++){var u=e.charAt(s);u==" "&&i&&(s==e.length-1||e.charCodeAt(s+1)==32)&&(u=" "),r+=u,i=u==" "}return r}function mg(e,t){return function(i,r,s,u,c,h,g){s=s?s+" cm-force-border":"cm-force-border";for(var v=i.pos,C=v+r.length;;){for(var _=void 0,M=0;M<t.length&&(_=t[M],!(_.to>v&&_.from<=v));M++);if(_.to>=C)return e(i,r,s,u,c,h,g);e(i,r.slice(0,_.to-v),s,u,null,h,g),u=null,r=r.slice(_.to-v),v=_.to}}}function fu(e,t,i,r){var s=!r&&i.widgetNode;s&&e.map.push(e.pos,e.pos+t,s),!r&&e.cm.display.input.needsContentAttribute&&(s||(s=e.content.appendChild(document.createElement("span"))),s.setAttribute("cm-marker",i.id)),s&&(e.cm.display.input.setUneditable(s),e.content.appendChild(s)),e.pos+=t,e.trailingSpace=!1}function vg(e,t,i){var r=e.markedSpans,s=e.text,u=0;if(!r){for(var c=1;c<i.length;c+=2)t.addToken(t,s.slice(u,u=i[c]),lu(i[c+1],t.cm.options));return}for(var h=s.length,g=0,v=1,C="",_,M,I=0,z,q,V,ee,ae;;){if(I==g){z=q=V=M="",ae=null,ee=null,I=1/0;for(var te=[],le=void 0,ve=0;ve<r.length;++ve){var ge=r[ve],Ae=ge.marker;if(Ae.type=="bookmark"&&ge.from==g&&Ae.widgetNode)te.push(Ae);else if(ge.from<=g&&(ge.to==null||ge.to>g||Ae.collapsed&&ge.to==g&&ge.from==g)){if(ge.to!=null&&ge.to!=g&&I>ge.to&&(I=ge.to,q=""),Ae.className&&(z+=" "+Ae.className),Ae.css&&(M=(M?M+";":"")+Ae.css),Ae.startStyle&&ge.from==g&&(V+=" "+Ae.startStyle),Ae.endStyle&&ge.to==I&&(le||(le=[])).push(Ae.endStyle,ge.to),Ae.title&&((ae||(ae={})).title=Ae.title),Ae.attributes)for(var qe in Ae.attributes)(ae||(ae={}))[qe]=Ae.attributes[qe];Ae.collapsed&&(!ee||ms(ee.marker,Ae)<0)&&(ee=ge)}else ge.from>g&&I>ge.from&&(I=ge.from)}if(le)for(var xt=0;xt<le.length;xt+=2)le[xt+1]==I&&(q+=" "+le[xt]);if(!ee||ee.from==g)for(var Qe=0;Qe<te.length;++Qe)fu(t,0,te[Qe]);if(ee&&(ee.from||0)==g){if(fu(t,(ee.to==null?h+1:ee.to)-g,ee.marker,ee.from==null),ee.to==null)return;ee.to==g&&(ee=!1)}}if(g>=h)break;for(var Ht=Math.min(h,I);;){if(C){var Mt=g+C.length;if(!ee){var lt=Mt>Ht?C.slice(0,Ht-g):C;t.addToken(t,lt,_?_+z:z,V,g+lt.length==I?q:"",M,ae)}if(Mt>=Ht){C=C.slice(Ht-g),g=Ht;break}g=Mt,V=""}C=s.slice(u,u=i[v++]),_=lu(i[v++],t.cm.options)}}}function cu(e,t,i){this.line=t,this.rest=lg(t),this.size=this.rest?b(be(this.rest))-i+1:1,this.node=this.text=null,this.hidden=$n(e,t)}function ca(e,t,i){for(var r=[],s,u=t;u<i;u=s){var c=new cu(e.doc,fe(e.doc,u),u);s=u+c.size,r.push(c)}return r}var Ir=null;function yg(e){Ir?Ir.ops.push(e):e.ownsGroup=Ir={ops:[e],delayedCallbacks:[]}}function bg(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var s=e.ops[r];if(s.cursorActivityHandlers)for(;s.cursorActivityCalled<s.cursorActivityHandlers.length;)s.cursorActivityHandlers[s.cursorActivityCalled++].call(null,s.cm)}}while(i<t.length)}function xg(e,t){var i=e.ownsGroup;if(i)try{bg(i)}finally{Ir=null,t(i)}}var pi=null;function vt(e,t){var i=kn(e,t);if(i.length){var r=Array.prototype.slice.call(arguments,2),s;Ir?s=Ir.delayedCallbacks:pi?s=pi:(s=pi=[],setTimeout(wg,0));for(var u=function(h){s.push(function(){return i[h].apply(null,r)})},c=0;c<i.length;++c)u(c)}}function wg(){var e=pi;pi=null;for(var t=0;t<e.length;++t)e[t]()}function hu(e,t,i,r){for(var s=0;s<t.changes.length;s++){var u=t.changes[s];u=="text"?Sg(e,t):u=="gutter"?pu(e,t,i,r):u=="class"?xs(e,t):u=="widget"&&Cg(e,t,r)}t.changes=null}function gi(e){return e.node==e.text&&(e.node=k("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),m&&x<8&&(e.node.style.zIndex=2)),e.node}function kg(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=gi(t);t.background=r.insertBefore(k("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function du(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):uu(e,t)}function Sg(e,t){var i=t.text.className,r=du(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,xs(e,t)):i&&(t.text.className=i)}function xs(e,t){kg(e,t),t.line.wrapClass?gi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function pu(e,t,i,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 s=gi(t);t.gutterBackground=k("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),s.insertBefore(t.gutterBackground,t.text)}var u=t.line.gutterMarkers;if(e.options.lineNumbers||u){var c=gi(t),h=t.gutter=k("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),c.insertBefore(h,t.text),t.line.gutterClass&&(h.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!u||!u["CodeMirror-linenumbers"])&&(t.lineNumber=h.appendChild(k("div",Y(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),u)for(var g=0;g<e.display.gutterSpecs.length;++g){var v=e.display.gutterSpecs[g].className,C=u.hasOwnProperty(v)&&u[v];C&&h.appendChild(k("div",[C],"CodeMirror-gutter-elt","left: "+r.gutterLeft[v]+"px; width: "+r.gutterWidth[v]+"px"))}}}function Cg(e,t,i){t.alignable&&(t.alignable=null);for(var r=ie("CodeMirror-linewidget"),s=t.node.firstChild,u=void 0;s;s=u)u=s.nextSibling,r.test(s.className)&&t.node.removeChild(s);gu(e,t,i)}function Tg(e,t,i,r){var s=du(e,t);return t.text=t.node=s.pre,s.bgClass&&(t.bgClass=s.bgClass),s.textClass&&(t.textClass=s.textClass),xs(e,t),pu(e,t,i,r),gu(e,t,r),t.node}function gu(e,t,i){if(mu(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)mu(e,t.rest[r],t,i,!1)}function mu(e,t,i,r,s){if(t.widgets)for(var u=gi(i),c=0,h=t.widgets;c<h.length;++c){var g=h[c],v=k("div",[g.node],"CodeMirror-linewidget"+(g.className?" "+g.className:""));g.handleMouseEvents||v.setAttribute("cm-ignore-events","true"),_g(g,v,i,r),e.display.input.setUneditable(v),s&&g.above?u.insertBefore(v,i.gutter||i.text):u.appendChild(v),vt(g,"redraw")}}function _g(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var s=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(s-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=s+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function mi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),Q(t.display.measure,k("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function _n(e,t){for(var i=li(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function ha(e){return e.lineSpace.offsetTop}function ws(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function vu(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Q(e.measure,k("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function yn(e){return Me-e.display.nativeBarWidth}function nr(e){return e.display.scroller.clientWidth-yn(e)-e.display.barWidth}function ks(e){return e.display.scroller.clientHeight-yn(e)-e.display.barHeight}function Lg(e,t,i){var r=e.options.lineWrapping,s=r&&nr(e);if(!t.measure.heights||r&&t.measure.width!=s){var u=t.measure.heights=[];if(r){t.measure.width=s;for(var c=t.text.firstChild.getClientRects(),h=0;h<c.length-1;h++){var g=c[h],v=c[h+1];Math.abs(g.bottom-v.bottom)>2&&u.push((g.bottom+v.top)/2-i.top)}}u.push(i.bottom-i.top)}}function yu(e,t,i){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 s=0;s<e.rest.length;s++)if(b(e.rest[s])>i)return{map:e.measure.maps[s],cache:e.measure.caches[s],before:!0}}}function Eg(e,t){t=fn(t);var i=b(t),r=e.display.externalMeasured=new cu(e.doc,t,i);r.lineN=i;var s=r.built=uu(e,r);return r.text=s.pre,Q(e.display.lineMeasure,s.pre),r}function bu(e,t,i,r){return bn(e,Or(e,t),i,r)}function Ss(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ar(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Or(e,t){var i=b(t),r=Ss(e,i);r&&!r.text?r=null:r&&r.changes&&(hu(e,r,i,Es(e)),e.curOp.forceUpdate=!0),r||(r=Eg(e,t));var s=yu(r,t,i);return{line:t,view:r,rect:null,map:s.map,cache:s.cache,before:s.before,hasHeights:!1}}function bn(e,t,i,r,s){t.before&&(i=-1);var u=i+(r||""),c;return t.cache.hasOwnProperty(u)?c=t.cache[u]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Lg(e,t.view,t.rect),t.hasHeights=!0),c=Ag(e,t,i,r),c.bogus||(t.cache[u]=c)),{left:c.left,right:c.right,top:s?c.rtop:c.top,bottom:s?c.rbottom:c.bottom}}var xu={left:0,right:0,top:0,bottom:0};function wu(e,t,i){for(var r,s,u,c,h,g,v=0;v<e.length;v+=3)if(h=e[v],g=e[v+1],t<h?(s=0,u=1,c="left"):t<g?(s=t-h,u=s+1):(v==e.length-3||t==g&&e[v+3]>t)&&(u=g-h,s=u-1,t>=g&&(c="right")),s!=null){if(r=e[v+2],h==g&&i==(r.insertLeft?"left":"right")&&(c=i),i=="left"&&s==0)for(;v&&e[v-2]==e[v-3]&&e[v-1].insertLeft;)r=e[(v-=3)+2],c="left";if(i=="right"&&s==g-h)for(;v<e.length-3&&e[v+3]==e[v+4]&&!e[v+5].insertLeft;)r=e[(v+=3)+2],c="right";break}return{node:r,start:s,end:u,collapse:c,coverStart:h,coverEnd:g}}function Dg(e,t){var i=xu;if(t=="left")for(var r=0;r<e.length&&(i=e[r]).left==i.right;r++);else for(var s=e.length-1;s>=0&&(i=e[s]).left==i.right;s--);return i}function Ag(e,t,i,r){var s=wu(t.map,i,r),u=s.node,c=s.start,h=s.end,g=s.collapse,v;if(u.nodeType==3){for(var C=0;C<4;C++){for(;c&&De(t.line.text.charAt(s.coverStart+c));)--c;for(;s.coverStart+h<s.coverEnd&&De(t.line.text.charAt(s.coverStart+h));)++h;if(m&&x<9&&c==0&&h==s.coverEnd-s.coverStart?v=u.parentNode.getBoundingClientRect():v=Dg(G(u,c,h).getClientRects(),r),v.left||v.right||c==0)break;h=c,c=c-1,g="right"}m&&x<11&&(v=Ig(e.display.measure,v))}else{c>0&&(g=r="right");var _;e.options.lineWrapping&&(_=u.getClientRects()).length>1?v=_[r=="right"?_.length-1:0]:v=u.getBoundingClientRect()}if(m&&x<9&&!c&&(!v||!v.left&&!v.right)){var M=u.parentNode.getClientRects()[0];M?v={left:M.left,right:M.left+Mr(e.display),top:M.top,bottom:M.bottom}:v=xu}for(var I=v.top-t.rect.top,z=v.bottom-t.rect.top,q=(I+z)/2,V=t.view.measure.heights,ee=0;ee<V.length-1&&!(q<V[ee]);ee++);var ae=ee?V[ee-1]:0,te=V[ee],le={left:(g=="right"?v.right:v.left)-t.rect.left,right:(g=="left"?v.left:v.right)-t.rect.left,top:ae,bottom:te};return!v.left&&!v.right&&(le.bogus=!0),e.options.singleCursorHeightPerLine||(le.rtop=I,le.rbottom=z),le}function Ig(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!hs(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function ku(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 Su(e){e.display.externalMeasure=null,W(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)ku(e.display.view[t])}function vi(e){Su(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 E&&$?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function Tu(e){return E&&$?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function Cs(e){var t=fn(e),i=t.widgets,r=0;if(i)for(var s=0;s<i.length;++s)i[s].above&&(r+=mi(i[s]));return r}function da(e,t,i,r,s){if(!s){var u=Cs(t);i.top+=u,i.bottom+=u}if(r=="line")return i;r||(r="local");var c=Tn(t);if(r=="local"?c+=ha(e.display):c-=e.display.viewOffset,r=="page"||r=="window"){var h=e.display.lineSpace.getBoundingClientRect();c+=h.top+(r=="window"?0:Tu(w(e)));var g=h.left+(r=="window"?0:Cu(w(e)));i.left+=g,i.right+=g}return i.top+=c,i.bottom+=c,i}function _u(e,t,i){if(i=="div")return t;var r=t.left,s=t.top;if(i=="page")r-=Cu(w(e)),s-=Tu(w(e));else if(i=="local"||!i){var u=e.display.sizer.getBoundingClientRect();r+=u.left,s+=u.top}var c=e.display.lineSpace.getBoundingClientRect();return{left:r-c.left,top:s-c.top}}function pa(e,t,i,r,s){return r||(r=fe(e.doc,t.line)),da(e,r,bu(e,r,t.ch,s),i)}function cn(e,t,i,r,s,u){r=r||fe(e.doc,t.line),s||(s=Or(e,r));function c(z,q){var V=bn(e,s,z,q?"right":"left",u);return q?V.left=V.right:V.right=V.left,da(e,r,V,i)}var h=Pe(r,e.doc.direction),g=t.ch,v=t.sticky;if(g>=r.text.length?(g=r.text.length,v="before"):g<=0&&(g=0,v="after"),!h)return c(v=="before"?g-1:g,v=="before");function C(z,q,V){var ee=h[q],ae=ee.level==1;return c(V?z-1:z,ae!=V)}var _=Mn(h,g,v),M=er,I=C(g,_,v=="before");return M!=null&&(I.other=C(g,M,v!="before")),I}function Lu(e,t){var i=0;t=Se(e.doc,t),e.options.lineWrapping||(i=Mr(e.display)*t.ch);var r=fe(e.doc,t.line),s=Tn(r)+ha(e.display);return{left:i,right:i,top:s,bottom:s+r.height}}function Ts(e,t,i,r,s){var u=P(e,t,i);return u.xRel=s,r&&(u.outside=r),u}function _s(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Ts(r.first,0,null,-1,-1);var s=T(r,i),u=r.first+r.size-1;if(s>u)return Ts(r.first+r.size-1,fe(r,u).text.length,null,1,1);t<0&&(t=0);for(var c=fe(r,s);;){var h=Og(e,c,s,t,i),g=sg(c,h.ch+(h.xRel>0||h.outside>0?1:0));if(!g)return h;var v=g.find(1);if(v.line==s)return v;c=fe(r,s=v.line)}}function Eu(e,t,i,r){r-=Cs(t);var s=t.text.length,u=Zt(function(c){return bn(e,i,c-1).bottom<=r},s,0);return s=Zt(function(c){return bn(e,i,c).top>r},u,s),{begin:u,end:s}}function Du(e,t,i,r){i||(i=Or(e,t));var s=da(e,t,bn(e,i,r),"line").top;return Eu(e,t,i,s)}function Ls(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Og(e,t,i,r,s){s-=Tn(t);var u=Or(e,t),c=Cs(t),h=0,g=t.text.length,v=!0,C=Pe(t,e.doc.direction);if(C){var _=(e.options.lineWrapping?Mg:Ng)(e,t,i,u,C,r,s);v=_.level!=1,h=v?_.from:_.to-1,g=v?_.to:_.from-1}var M=null,I=null,z=Zt(function(ve){var ge=bn(e,u,ve);return ge.top+=c,ge.bottom+=c,Ls(ge,r,s,!1)?(ge.top<=s&&ge.left<=r&&(M=ve,I=ge),!0):!1},h,g),q,V,ee=!1;if(I){var ae=r-I.left<I.right-r,te=ae==v;z=M+(te?0:1),V=te?"after":"before",q=ae?I.left:I.right}else{!v&&(z==g||z==h)&&z++,V=z==0?"after":z==t.text.length?"before":bn(e,u,z-(v?1:0)).bottom+c<=s==v?"after":"before";var le=cn(e,P(i,z,V),"line",t,u);q=le.left,ee=s<le.top?-1:s>=le.bottom?1:0}return z=zt(t.text,z,1),Ts(i,z,V,ee,r-q)}function Ng(e,t,i,r,s,u,c){var h=Zt(function(_){var M=s[_],I=M.level!=1;return Ls(cn(e,P(i,I?M.to:M.from,I?"before":"after"),"line",t,r),u,c,!0)},0,s.length-1),g=s[h];if(h>0){var v=g.level!=1,C=cn(e,P(i,v?g.from:g.to,v?"after":"before"),"line",t,r);Ls(C,u,c,!0)&&C.top>c&&(g=s[h-1])}return g}function Mg(e,t,i,r,s,u,c){var h=Eu(e,t,r,c),g=h.begin,v=h.end;/\s/.test(t.text.charAt(v-1))&&v--;for(var C=null,_=null,M=0;M<s.length;M++){var I=s[M];if(!(I.from>=v||I.to<=g)){var z=I.level!=1,q=bn(e,r,z?Math.min(v,I.to)-1:Math.max(g,I.from)).right,V=q<u?u-q+1e9:q-u;(!C||_>V)&&(C=I,_=V)}}return C||(C=s[s.length-1]),C.from<g&&(C={from:g,to:C.to,level:C.level}),C.to>v&&(C={from:C.from,to:v,level:C.level}),C}var rr;function Nr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(rr==null){rr=k("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)rr.appendChild(document.createTextNode("x")),rr.appendChild(k("br"));rr.appendChild(document.createTextNode("x"))}Q(e.measure,rr);var i=rr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),W(e.measure),i||1}function Mr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=k("span","xxxxxxxxxx"),i=k("pre",[t],"CodeMirror-line-like");Q(e.measure,i);var r=t.getBoundingClientRect(),s=(r.right-r.left)/10;return s>2&&(e.cachedCharWidth=s),s||10}function Es(e){for(var t=e.display,i={},r={},s=t.gutters.clientLeft,u=t.gutters.firstChild,c=0;u;u=u.nextSibling,++c){var h=e.display.gutterSpecs[c].className;i[h]=u.offsetLeft+u.clientLeft+s,r[h]=u.clientWidth}return{fixedPos:Ds(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ds(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Au(e){var t=Nr(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Mr(e.display)-3);return function(s){if($n(e.doc,s))return 0;var u=0;if(s.widgets)for(var c=0;c<s.widgets.length;c++)s.widgets[c].height&&(u+=s.widgets[c].height);return i?u+(Math.ceil(s.text.length/r)||1)*t:u+t}}function As(e){var t=e.doc,i=Au(e);t.iter(function(r){var s=i(r);s!=r.height&&Kt(r,s)})}function ir(e,t,i,r){var s=e.display;if(!i&&li(t).getAttribute("cm-not-content")=="true")return null;var u,c,h=s.lineSpace.getBoundingClientRect();try{u=t.clientX-h.left,c=t.clientY-h.top}catch{return null}var g=_s(e,u,c),v;if(r&&g.xRel>0&&(v=fe(e.doc,g.line).text).length==g.ch){var C=_e(v,v.length,e.options.tabSize)-v.length;g=P(g.line,Math.max(0,Math.round((u-vu(e.display).left)/Mr(e.display))-C))}return g}function ar(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function Ot(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var s=e.display;if(r&&i<s.viewTo&&(s.updateLineNumbers==null||s.updateLineNumbers>t)&&(s.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=s.viewTo)Cn&&vs(e.doc,t)<s.viewTo&&Hn(e);else if(i<=s.viewFrom)Cn&&ou(e.doc,i+r)>s.viewFrom?Hn(e):(s.viewFrom+=r,s.viewTo+=r);else if(t<=s.viewFrom&&i>=s.viewTo)Hn(e);else if(t<=s.viewFrom){var u=ga(e,i,i+r,1);u?(s.view=s.view.slice(u.index),s.viewFrom=u.lineN,s.viewTo+=r):Hn(e)}else if(i>=s.viewTo){var c=ga(e,t,t,-1);c?(s.view=s.view.slice(0,c.index),s.viewTo=c.lineN):Hn(e)}else{var h=ga(e,t,t,-1),g=ga(e,i,i+r,1);h&&g?(s.view=s.view.slice(0,h.index).concat(ca(e,h.lineN,g.lineN)).concat(s.view.slice(g.index)),s.viewTo+=r):Hn(e)}var v=s.externalMeasured;v&&(i<v.lineN?v.lineN+=r:t<v.lineN+v.size&&(s.externalMeasured=null))}function Bn(e,t,i){e.curOp.viewChanged=!0;var r=e.display,s=e.display.externalMeasured;if(s&&t>=s.lineN&&t<s.lineN+s.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var u=r.view[ar(e,t)];if(u.node!=null){var c=u.changes||(u.changes=[]);we(c,i)==-1&&c.push(i)}}}function Hn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ga(e,t,i,r){var s=ar(e,t),u,c=e.display.view;if(!Cn||i==e.doc.first+e.doc.size)return{index:s,lineN:i};for(var h=e.display.viewFrom,g=0;g<s;g++)h+=c[g].size;if(h!=t){if(r>0){if(s==c.length-1)return null;u=h+c[s].size-t,s++}else u=h-t;t+=u,i+=u}for(;vs(e.doc,i)!=i;){if(s==(r<0?0:c.length-1))return null;i+=r*c[s-(r<0?1:0)].size,s+=r}return{index:s,lineN:i}}function Rg(e,t,i){var r=e.display,s=r.view;s.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=ca(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=ca(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(ar(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(ca(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,ar(e,i)))),r.viewTo=i}function Iu(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var s=t[r];!s.hidden&&(!s.node||s.changes)&&++i}return i}function yi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Ou(e,t){t===void 0&&(t=!0);var i=e.doc,r={},s=r.cursors=document.createDocumentFragment(),u=r.selection=document.createDocumentFragment(),c=e.options.$customCursor;c&&(t=!0);for(var h=0;h<i.sel.ranges.length;h++)if(!(!t&&h==i.sel.primIndex)){var g=i.sel.ranges[h];if(!(g.from().line>=e.display.viewTo||g.to().line<e.display.viewFrom)){var v=g.empty();if(c){var C=c(e,g);C&&Is(e,C,s)}else(v||e.options.showCursorWhenSelecting)&&Is(e,g.head,s);v||Fg(e,g,u)}}return r}function Is(e,t,i){var r=cn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),s=i.appendChild(k("div"," ","CodeMirror-cursor"));if(s.style.left=r.left+"px",s.style.top=r.top+"px",s.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var u=pa(e,t,"div",null,null),c=u.right-u.left;s.style.width=(c>0?c:e.defaultCharWidth())+"px"}if(r.other){var h=i.appendChild(k("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 ma(e,t){return e.top-t.top||e.left-t.left}function Fg(e,t,i){var r=e.display,s=e.doc,u=document.createDocumentFragment(),c=vu(e.display),h=c.left,g=Math.max(r.sizerWidth,nr(e)-r.sizer.offsetLeft)-c.right,v=s.direction=="ltr";function C(te,le,ve,ge){le<0&&(le=0),le=Math.round(le),ge=Math.round(ge),u.appendChild(k("div",null,"CodeMirror-selected","position: absolute; left: "+te+`px;
4
+ `,t);s==-1&&(s=e.length);var u=e.slice(t,e.charAt(s-1)=="\r"?s-1:s),f=u.indexOf("\r");f!=-1?(i.push(u.slice(0,f)),t+=f+1):(i.push(u),t=s+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Pn=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},ia=function(){var e=k("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),on=null;function hs(e){if(on!=null)return on;var t=Q(e,k("span","x")),i=t.getBoundingClientRect(),r=G(t,0,1).getBoundingClientRect();return on=Math.abs(i.left-r.left)>1}var Cr={},ln={};function un(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Cr[e]=t}function tr(e,t){ln[e]=t}function Tr(e){if(typeof e=="string"&&ln.hasOwnProperty(e))e=ln[e];else if(e&&typeof e.name=="string"&&ln.hasOwnProperty(e.name)){var t=ln[e.name];typeof t=="string"&&(t={name:t}),e=Zn(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Tr("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Tr("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function _r(e,t){t=Tr(t);var i=Cr[t.name];if(!i)return _r(e,"text/plain");var r=i(e,t);if($n.hasOwnProperty(t.name)){var s=$n[t.name];for(var u in s)s.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=s[u])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var f in t.modeProps)r[f]=t.modeProps[f];return r}var $n={};function Lr(e,t){var i=$n.hasOwnProperty(e)?$n[e]:$n[e]={};we(t,i)}function mn(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var s=t[r];s instanceof Array&&(s=s.concat([])),i[r]=s}return i}function ci(e,t){for(var i;e.innerMode&&(i=e.innerMode(t),!(!i||i.mode==e));)t=i.state,e=i.mode;return i||{mode:e,state:t}}function Er(e,t,i){return e.startState?e.startState(t,i):!0}var nt=function(e,t,i){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=i};nt.prototype.eol=function(){return this.pos>=this.string.length},nt.prototype.sol=function(){return this.pos==this.lineStart},nt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},nt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},nt.prototype.eat=function(e){var t=this.string.charAt(this.pos),i;if(typeof e=="string"?i=t==e:i=t&&(e.test?e.test(t):e(t)),i)return++this.pos,t},nt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},nt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},nt.prototype.skipToEnd=function(){this.pos=this.string.length},nt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},nt.prototype.backUp=function(e){this.pos-=e},nt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=_e(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?_e(this.string,this.lineStart,this.tabSize):0)},nt.prototype.indentation=function(){return _e(this.string,null,this.tabSize)-(this.lineStart?_e(this.string,this.lineStart,this.tabSize):0)},nt.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(f){return i?f.toLowerCase():f},s=this.string.substr(this.pos,e.length);if(r(s)==r(e))return t!==!1&&(this.pos+=e.length),!0}else{var u=this.string.slice(this.pos).match(e);return u&&u.index>0?null:(u&&t!==!1&&(this.pos+=u[0].length),u)}},nt.prototype.current=function(){return this.string.slice(this.start,this.pos)},nt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},nt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},nt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ce(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 i=e;!i.lines;)for(var r=0;;++r){var s=i.children[r],u=s.chunkSize();if(t<u){i=s;break}t-=u}return i.lines[t]}function Cn(e,t,i){var r=[],s=t.line;return e.iter(t.line,i.line+1,function(u){var f=u.text;s==i.line&&(f=f.slice(0,i.ch)),s==t.line&&(f=f.slice(t.ch)),r.push(f),++s}),r}function fi(e,t,i){var r=[];return e.iter(t,i,function(s){r.push(s.text)}),r}function Kt(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function b(e){if(e.parent==null)return null;for(var t=e.parent,i=ke(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var s=0;r.children[s]!=t;++s)i+=r.children[s].chunkSize();return i+t.first}function T(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var s=e.children[r],u=s.height;if(t<u){e=s;continue e}t-=u,i+=s.chunkSize()}return i}while(!e.lines);for(var f=0;f<e.lines.length;++f){var h=e.lines[f],g=h.height;if(t<g)break;t-=g}return i+f}function q(e,t){return t>=e.first&&t<e.first+e.size}function Y(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function $(e,t,i){if(i===void 0&&(i=null),!(this instanceof $))return new $(e,t,i);this.line=e,this.ch=t,this.sticky=i}function re(e,t){return e.line-t.line||e.ch-t.ch}function ze(e,t){return e.sticky==t.sticky&&re(e,t)==0}function mt(e){return $(e.line,e.ch)}function It(e,t){return re(e,t)<0?t:e}function Dr(e,t){return re(e,t)<0?e:t}function Ul(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Se(e,t){if(t.line<e.first)return $(e.first,0);var i=e.first+e.size-1;return t.line>i?$(i,ce(e,i).text.length):Vp(t,ce(e,t.line).text.length)}function Vp(e,t){var i=e.ch;return i==null||i>t?$(e.line,t):i<0?$(e.line,0):e}function Gl(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=Se(e,t[r]);return i}var aa=function(e,t){this.state=e,this.lookAhead=t},vn=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};vn.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},vn.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}},vn.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},vn.fromSaved=function(e,t,i){return t instanceof aa?new vn(e,mn(e.mode,t.state),i,t.lookAhead):new vn(e,mn(e.mode,t),i)},vn.prototype.save=function(e){var t=e!==!1?mn(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new aa(t,this.maxLookAhead):t};function Kl(e,t,i,r){var s=[e.state.modeGen],u={};Zl(e,t.text,e.doc.mode,i,function(v,C){return s.push(v,C)},u,r);for(var f=i.state,h=function(v){i.baseTokens=s;var C=e.state.overlays[v],_=1,R=0;i.state=!0,Zl(e,t.text,C.mode,i,function(I,H){for(var U=_;R<I;){var V=s[_];V>I&&s.splice(_,1,I,s[_+1],V),_+=2,R=Math.min(I,V)}if(H)if(C.opaque)s.splice(U,_-U,I,"overlay "+H),_=U+2;else for(;U<_;U+=2){var ee=s[U+1];s[U+1]=(ee?ee+" ":"")+"overlay "+H}},u),i.state=f,i.baseTokens=null,i.baseTokenPos=1},g=0;g<e.state.overlays.length;++g)h(g);return{styles:s,classes:u.bgClass||u.textClass?u:null}}function Xl(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=hi(e,b(t)),s=t.text.length>e.options.maxHighlightLength&&mn(e.doc.mode,r.state),u=Kl(e,t,r);s&&(r.state=s),t.stateAfter=r.save(!s),t.styles=u.styles,u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null),i===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function hi(e,t,i){var r=e.doc,s=e.display;if(!r.mode.startState)return new vn(r,!0,t);var u=Jp(e,t,i),f=u>r.first&&ce(r,u-1).stateAfter,h=f?vn.fromSaved(r,f,u):new vn(r,Er(r.mode),u);return r.iter(u,t,function(g){ds(e,g.text,h);var v=h.line;g.stateAfter=v==t-1||v%5==0||v>=s.viewFrom&&v<s.viewTo?h.save():null,h.nextLine()}),i&&(r.modeFrontier=h.line),h}function ds(e,t,i,r){var s=e.doc.mode,u=new nt(t,e.options.tabSize,i);for(u.start=u.pos=r||0,t==""&&Yl(s,i.state);!u.eol();)ps(s,u,i.state),u.start=u.pos}function Yl(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var i=ci(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}}function ps(e,t,i,r){for(var s=0;s<10;s++){r&&(r[0]=ci(e,i).mode);var u=e.token(t,i);if(t.pos>t.start)return u}throw new Error("Mode "+e.name+" failed to advance stream.")}var Vl=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function Jl(e,t,i,r){var s=e.doc,u=s.mode,f;t=Se(s,t);var h=ce(s,t.line),g=hi(e,t.line,i),v=new nt(h.text,e.options.tabSize,g),C;for(r&&(C=[]);(r||v.pos<t.ch)&&!v.eol();)v.start=v.pos,f=ps(u,v,g.state),r&&C.push(new Vl(v,f,mn(s.mode,g.state)));return r?C:new Vl(v,f,g.state)}function Ql(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";t[r]==null?t[r]=i[2]:new RegExp("(?:^|\\s)"+i[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+i[2])}return e}function Zl(e,t,i,r,s,u,f){var h=i.flattenSpans;h==null&&(h=e.options.flattenSpans);var g=0,v=null,C=new nt(t,e.options.tabSize,r),_,R=e.options.addModeClass&&[null];for(t==""&&Ql(Yl(i,r.state),u);!C.eol();){if(C.pos>e.options.maxHighlightLength?(h=!1,f&&ds(e,t,r,C.pos),C.pos=t.length,_=null):_=Ql(ps(i,C,r.state,R),u),R){var I=R[0].name;I&&(_="m-"+(_?I+" "+_:I))}if(!h||v!=_){for(;g<C.start;)g=Math.min(C.start,g+5e3),s(g,v);v=_}C.start=C.pos}for(;g<C.pos;){var H=Math.min(C.pos,g+5e3);s(H,v),g=H}}function Jp(e,t,i){for(var r,s,u=e.doc,f=i?-1:t-(e.doc.mode.innerMode?1e3:100),h=t;h>f;--h){if(h<=u.first)return u.first;var g=ce(u,h-1),v=g.stateAfter;if(v&&(!i||h+(v instanceof aa?v.lookAhead:0)<=u.modeFrontier))return h;var C=_e(g.text,null,e.options.tabSize);(s==null||r>C)&&(s=h-1,r=C)}return s}function Qp(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var i=e.first,r=t-1;r>i;r--){var s=ce(e,r).stateAfter;if(s&&(!(s instanceof aa)||r+s.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}}var eu=!1,Tn=!1;function Zp(){eu=!0}function eg(){Tn=!0}function sa(e,t,i){this.marker=e,this.from=t,this.to=i}function di(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function tg(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function ng(e,t,i){var r=i&&window.WeakSet&&(i.markedSpans||(i.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 rg(e,t,i){var r;if(e)for(var s=0;s<e.length;++s){var u=e[s],f=u.marker,h=u.from==null||(f.inclusiveLeft?u.from<=t:u.from<t);if(h||u.from==t&&f.type=="bookmark"&&(!i||!u.marker.insertLeft)){var g=u.to==null||(f.inclusiveRight?u.to>=t:u.to>t);(r||(r=[])).push(new sa(f,u.from,g?null:u.to))}}return r}function ig(e,t,i){var r;if(e)for(var s=0;s<e.length;++s){var u=e[s],f=u.marker,h=u.to==null||(f.inclusiveRight?u.to>=t:u.to>t);if(h||u.from==t&&f.type=="bookmark"&&(!i||u.marker.insertLeft)){var g=u.from==null||(f.inclusiveLeft?u.from<=t:u.from<t);(r||(r=[])).push(new sa(f,g?null:u.from-t,u.to==null?null:u.to-t))}}return r}function gs(e,t){if(t.full)return null;var i=q(e,t.from.line)&&ce(e,t.from.line).markedSpans,r=q(e,t.to.line)&&ce(e,t.to.line).markedSpans;if(!i&&!r)return null;var s=t.from.ch,u=t.to.ch,f=re(t.from,t.to)==0,h=rg(i,s,f),g=ig(r,u,f),v=t.text.length==1,C=be(t.text).length+(v?s:0);if(h)for(var _=0;_<h.length;++_){var R=h[_];if(R.to==null){var I=di(g,R.marker);I?v&&(R.to=I.to==null?null:I.to+C):R.to=s}}if(g)for(var H=0;H<g.length;++H){var U=g[H];if(U.to!=null&&(U.to+=C),U.from==null){var V=di(h,U.marker);V||(U.from=C,v&&(h||(h=[])).push(U))}else U.from+=C,v&&(h||(h=[])).push(U)}h&&(h=tu(h)),g&&g!=h&&(g=tu(g));var ee=[h];if(!v){var ae=t.text.length-2,te;if(ae>0&&h)for(var le=0;le<h.length;++le)h[le].to==null&&(te||(te=[])).push(new sa(h[le].marker,null,null));for(var ve=0;ve<ae;++ve)ee.push(te);ee.push(g)}return ee}function tu(e){for(var t=0;t<e.length;++t){var i=e[t];i.from!=null&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function ag(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(I){if(I.markedSpans)for(var H=0;H<I.markedSpans.length;++H){var U=I.markedSpans[H].marker;U.readOnly&&(!r||ke(r,U)==-1)&&(r||(r=[])).push(U)}}),!r)return null;for(var s=[{from:t,to:i}],u=0;u<r.length;++u)for(var f=r[u],h=f.find(0),g=0;g<s.length;++g){var v=s[g];if(!(re(v.to,h.from)<0||re(v.from,h.to)>0)){var C=[g,1],_=re(v.from,h.from),R=re(v.to,h.to);(_<0||!f.inclusiveLeft&&!_)&&C.push({from:v.from,to:h.from}),(R>0||!f.inclusiveRight&&!R)&&C.push({from:h.to,to:v.to}),s.splice.apply(s,C),g+=C.length-3}}return s}function nu(e){var t=e.markedSpans;if(t){for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}}function ru(e,t){if(t){for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}}function oa(e){return e.inclusiveLeft?-1:0}function la(e){return e.inclusiveRight?1:0}function ms(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),s=t.find(),u=re(r.from,s.from)||oa(e)-oa(t);if(u)return-u;var f=re(r.to,s.to)||la(e)-la(t);return f||t.id-e.id}function iu(e,t){var i=Tn&&e.markedSpans,r;if(i)for(var s=void 0,u=0;u<i.length;++u)s=i[u],s.marker.collapsed&&(t?s.from:s.to)==null&&(!r||ms(r,s.marker)<0)&&(r=s.marker);return r}function au(e){return iu(e,!0)}function ua(e){return iu(e,!1)}function sg(e,t){var i=Tn&&e.markedSpans,r;if(i)for(var s=0;s<i.length;++s){var u=i[s];u.marker.collapsed&&(u.from==null||u.from<t)&&(u.to==null||u.to>t)&&(!r||ms(r,u.marker)<0)&&(r=u.marker)}return r}function su(e,t,i,r,s){var u=ce(e,t),f=Tn&&u.markedSpans;if(f)for(var h=0;h<f.length;++h){var g=f[h];if(g.marker.collapsed){var v=g.marker.find(0),C=re(v.from,i)||oa(g.marker)-oa(s),_=re(v.to,r)||la(g.marker)-la(s);if(!(C>=0&&_<=0||C<=0&&_>=0)&&(C<=0&&(g.marker.inclusiveRight&&s.inclusiveLeft?re(v.to,i)>=0:re(v.to,i)>0)||C>=0&&(g.marker.inclusiveRight&&s.inclusiveLeft?re(v.from,r)<=0:re(v.from,r)<0)))return!0}}}function cn(e){for(var t;t=au(e);)e=t.find(-1,!0).line;return e}function og(e){for(var t;t=ua(e);)e=t.find(1,!0).line;return e}function lg(e){for(var t,i;t=ua(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function vs(e,t){var i=ce(e,t),r=cn(i);return i==r?t:b(r)}function ou(e,t){if(t>e.lastLine())return t;var i=ce(e,t),r;if(!zn(e,i))return t;for(;r=ua(i);)i=r.find(1,!0).line;return b(i)+1}function zn(e,t){var i=Tn&&t.markedSpans;if(i){for(var r=void 0,s=0;s<i.length;++s)if(r=i[s],!!r.marker.collapsed){if(r.from==null)return!0;if(!r.marker.widgetNode&&r.from==0&&r.marker.inclusiveLeft&&ys(e,t,r))return!0}}}function ys(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return ys(e,r.line,di(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var s=void 0,u=0;u<t.markedSpans.length;++u)if(s=t.markedSpans[u],s.marker.collapsed&&!s.marker.widgetNode&&s.from==i.to&&(s.to==null||s.to!=i.from)&&(s.marker.inclusiveLeft||i.marker.inclusiveRight)&&ys(e,t,s))return!0}function _n(e){e=cn(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var s=i.lines[r];if(s==e)break;t+=s.height}for(var u=i.parent;u;i=u,u=i.parent)for(var f=0;f<u.children.length;++f){var h=u.children[f];if(h==i)break;t+=h.height}return t}function ca(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=au(r);){var s=i.find(0,!0);r=s.from.line,t+=s.from.ch-s.to.ch}for(r=e;i=ua(r);){var u=i.find(0,!0);t-=r.text.length-u.from.ch,r=u.to.line,t+=r.text.length-u.to.ch}return t}function bs(e){var t=e.display,i=e.doc;t.maxLine=ce(i,i.first),t.maxLineLength=ca(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var s=ca(r);s>t.maxLineLength&&(t.maxLineLength=s,t.maxLine=r)})}var Ar=function(e,t,i){this.text=e,ru(this,t),this.height=i?i(this):1};Ar.prototype.lineNo=function(){return b(this)},an(Ar);function ug(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),nu(e),ru(e,i);var s=r?r(e):1;s!=e.height&&Kt(e,s)}function cg(e){e.parent=null,nu(e)}var fg={},hg={};function lu(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?hg:fg;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function uu(e,t){var i=J("span",null,null,S?"padding-right: .1px":null),r={pre:J("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var s=0;s<=(t.rest?t.rest.length:0);s++){var u=s?t.rest[s-1]:t.line,f=void 0;r.pos=0,r.addToken=pg,Fn(e.display.measure)&&(f=Pe(u,e.doc.direction))&&(r.addToken=mg(r.addToken,f)),r.map=[];var h=t!=e.display.externalMeasured&&b(u);vg(u,r,Xl(e,u,h)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=de(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=de(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(ra(e.display.measure))),s==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(S){var g=r.content.lastChild;(/\bcm-tab\b/.test(g.className)||g.querySelector&&g.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return et(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=de(r.pre.className,r.textClass||"")),r}function dg(e){var t=k("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function pg(e,t,i,r,s,u,f){if(t){var h=e.splitSpaces?gg(t,e.trailingSpace):t,g=e.cm.state.specialChars,v=!1,C;if(!g.test(t))e.col+=t.length,C=document.createTextNode(h),e.map.push(e.pos,e.pos+t.length,C),m&&w<9&&(v=!0),e.pos+=t.length;else{C=document.createDocumentFragment();for(var _=0;;){g.lastIndex=_;var R=g.exec(t),I=R?R.index-_:t.length-_;if(I){var H=document.createTextNode(h.slice(_,_+I));m&&w<9?C.appendChild(k("span",[H])):C.appendChild(H),e.map.push(e.pos,e.pos+I,H),e.col+=I,e.pos+=I}if(!R)break;_+=I+1;var U=void 0;if(R[0]==" "){var V=e.cm.options.tabSize,ee=V-e.col%V;U=C.appendChild(k("span",Ut(ee),"cm-tab")),U.setAttribute("role","presentation"),U.setAttribute("cm-text"," "),e.col+=ee}else R[0]=="\r"||R[0]==`
5
+ `?(U=C.appendChild(k("span",R[0]=="\r"?"␍":"␤","cm-invalidchar")),U.setAttribute("cm-text",R[0]),e.col+=1):(U=e.cm.options.specialCharPlaceholder(R[0]),U.setAttribute("cm-text",R[0]),m&&w<9?C.appendChild(k("span",[U])):C.appendChild(U),e.col+=1);e.map.push(e.pos,e.pos+1,U),e.pos++}}if(e.trailingSpace=h.charCodeAt(t.length-1)==32,i||r||s||v||u||f){var ae=i||"";r&&(ae+=r),s&&(ae+=s);var te=k("span",[C],ae,u);if(f)for(var le in f)f.hasOwnProperty(le)&&le!="style"&&le!="class"&&te.setAttribute(le,f[le]);return e.content.appendChild(te)}e.content.appendChild(C)}}function gg(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",s=0;s<e.length;s++){var u=e.charAt(s);u==" "&&i&&(s==e.length-1||e.charCodeAt(s+1)==32)&&(u=" "),r+=u,i=u==" "}return r}function mg(e,t){return function(i,r,s,u,f,h,g){s=s?s+" cm-force-border":"cm-force-border";for(var v=i.pos,C=v+r.length;;){for(var _=void 0,R=0;R<t.length&&(_=t[R],!(_.to>v&&_.from<=v));R++);if(_.to>=C)return e(i,r,s,u,f,h,g);e(i,r.slice(0,_.to-v),s,u,null,h,g),u=null,r=r.slice(_.to-v),v=_.to}}}function cu(e,t,i,r){var s=!r&&i.widgetNode;s&&e.map.push(e.pos,e.pos+t,s),!r&&e.cm.display.input.needsContentAttribute&&(s||(s=e.content.appendChild(document.createElement("span"))),s.setAttribute("cm-marker",i.id)),s&&(e.cm.display.input.setUneditable(s),e.content.appendChild(s)),e.pos+=t,e.trailingSpace=!1}function vg(e,t,i){var r=e.markedSpans,s=e.text,u=0;if(!r){for(var f=1;f<i.length;f+=2)t.addToken(t,s.slice(u,u=i[f]),lu(i[f+1],t.cm.options));return}for(var h=s.length,g=0,v=1,C="",_,R,I=0,H,U,V,ee,ae;;){if(I==g){H=U=V=R="",ae=null,ee=null,I=1/0;for(var te=[],le=void 0,ve=0;ve<r.length;++ve){var ge=r[ve],Ae=ge.marker;if(Ae.type=="bookmark"&&ge.from==g&&Ae.widgetNode)te.push(Ae);else if(ge.from<=g&&(ge.to==null||ge.to>g||Ae.collapsed&&ge.to==g&&ge.from==g)){if(ge.to!=null&&ge.to!=g&&I>ge.to&&(I=ge.to,U=""),Ae.className&&(H+=" "+Ae.className),Ae.css&&(R=(R?R+";":"")+Ae.css),Ae.startStyle&&ge.from==g&&(V+=" "+Ae.startStyle),Ae.endStyle&&ge.to==I&&(le||(le=[])).push(Ae.endStyle,ge.to),Ae.title&&((ae||(ae={})).title=Ae.title),Ae.attributes)for(var qe in Ae.attributes)(ae||(ae={}))[qe]=Ae.attributes[qe];Ae.collapsed&&(!ee||ms(ee.marker,Ae)<0)&&(ee=ge)}else ge.from>g&&I>ge.from&&(I=ge.from)}if(le)for(var xt=0;xt<le.length;xt+=2)le[xt+1]==I&&(U+=" "+le[xt]);if(!ee||ee.from==g)for(var Qe=0;Qe<te.length;++Qe)cu(t,0,te[Qe]);if(ee&&(ee.from||0)==g){if(cu(t,(ee.to==null?h+1:ee.to)-g,ee.marker,ee.from==null),ee.to==null)return;ee.to==g&&(ee=!1)}}if(g>=h)break;for(var Ht=Math.min(h,I);;){if(C){var Rt=g+C.length;if(!ee){var lt=Rt>Ht?C.slice(0,Ht-g):C;t.addToken(t,lt,_?_+H:H,V,g+lt.length==I?U:"",R,ae)}if(Rt>=Ht){C=C.slice(Ht-g),g=Ht;break}g=Rt,V=""}C=s.slice(u,u=i[v++]),_=lu(i[v++],t.cm.options)}}}function fu(e,t,i){this.line=t,this.rest=lg(t),this.size=this.rest?b(be(this.rest))-i+1:1,this.node=this.text=null,this.hidden=zn(e,t)}function fa(e,t,i){for(var r=[],s,u=t;u<i;u=s){var f=new fu(e.doc,ce(e.doc,u),u);s=u+f.size,r.push(f)}return r}var Ir=null;function yg(e){Ir?Ir.ops.push(e):e.ownsGroup=Ir={ops:[e],delayedCallbacks:[]}}function bg(e){var t=e.delayedCallbacks,i=0;do{for(;i<t.length;i++)t[i].call(null);for(var r=0;r<e.ops.length;r++){var s=e.ops[r];if(s.cursorActivityHandlers)for(;s.cursorActivityCalled<s.cursorActivityHandlers.length;)s.cursorActivityHandlers[s.cursorActivityCalled++].call(null,s.cm)}}while(i<t.length)}function xg(e,t){var i=e.ownsGroup;if(i)try{bg(i)}finally{Ir=null,t(i)}}var pi=null;function vt(e,t){var i=Sn(e,t);if(i.length){var r=Array.prototype.slice.call(arguments,2),s;Ir?s=Ir.delayedCallbacks:pi?s=pi:(s=pi=[],setTimeout(kg,0));for(var u=function(h){s.push(function(){return i[h].apply(null,r)})},f=0;f<i.length;++f)u(f)}}function kg(){var e=pi;pi=null;for(var t=0;t<e.length;++t)e[t]()}function hu(e,t,i,r){for(var s=0;s<t.changes.length;s++){var u=t.changes[s];u=="text"?Sg(e,t):u=="gutter"?pu(e,t,i,r):u=="class"?xs(e,t):u=="widget"&&Cg(e,t,r)}t.changes=null}function gi(e){return e.node==e.text&&(e.node=k("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),m&&w<8&&(e.node.style.zIndex=2)),e.node}function wg(e,t){var i=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(i&&(i+=" CodeMirror-linebackground"),t.background)i?t.background.className=i:(t.background.parentNode.removeChild(t.background),t.background=null);else if(i){var r=gi(t);t.background=r.insertBefore(k("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function du(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):uu(e,t)}function Sg(e,t){var i=t.text.className,r=du(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,xs(e,t)):i&&(t.text.className=i)}function xs(e,t){wg(e,t),t.line.wrapClass?gi(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var i=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=i||""}function pu(e,t,i,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 s=gi(t);t.gutterBackground=k("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),s.insertBefore(t.gutterBackground,t.text)}var u=t.line.gutterMarkers;if(e.options.lineNumbers||u){var f=gi(t),h=t.gutter=k("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),f.insertBefore(h,t.text),t.line.gutterClass&&(h.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!u||!u["CodeMirror-linenumbers"])&&(t.lineNumber=h.appendChild(k("div",Y(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),u)for(var g=0;g<e.display.gutterSpecs.length;++g){var v=e.display.gutterSpecs[g].className,C=u.hasOwnProperty(v)&&u[v];C&&h.appendChild(k("div",[C],"CodeMirror-gutter-elt","left: "+r.gutterLeft[v]+"px; width: "+r.gutterWidth[v]+"px"))}}}function Cg(e,t,i){t.alignable&&(t.alignable=null);for(var r=ie("CodeMirror-linewidget"),s=t.node.firstChild,u=void 0;s;s=u)u=s.nextSibling,r.test(s.className)&&t.node.removeChild(s);gu(e,t,i)}function Tg(e,t,i,r){var s=du(e,t);return t.text=t.node=s.pre,s.bgClass&&(t.bgClass=s.bgClass),s.textClass&&(t.textClass=s.textClass),xs(e,t),pu(e,t,i,r),gu(e,t,r),t.node}function gu(e,t,i){if(mu(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)mu(e,t.rest[r],t,i,!1)}function mu(e,t,i,r,s){if(t.widgets)for(var u=gi(i),f=0,h=t.widgets;f<h.length;++f){var g=h[f],v=k("div",[g.node],"CodeMirror-linewidget"+(g.className?" "+g.className:""));g.handleMouseEvents||v.setAttribute("cm-ignore-events","true"),_g(g,v,i,r),e.display.input.setUneditable(v),s&&g.above?u.insertBefore(v,i.gutter||i.text):u.appendChild(v),vt(g,"redraw")}}function _g(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var s=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(s-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=s+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function mi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),Q(t.display.measure,k("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function Ln(e,t){for(var i=li(t);i!=e.wrapper;i=i.parentNode)if(!i||i.nodeType==1&&i.getAttribute("cm-ignore-events")=="true"||i.parentNode==e.sizer&&i!=e.mover)return!0}function ha(e){return e.lineSpace.offsetTop}function ks(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function vu(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Q(e.measure,k("pre","x","CodeMirror-line-like")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function yn(e){return Re-e.display.nativeBarWidth}function nr(e){return e.display.scroller.clientWidth-yn(e)-e.display.barWidth}function ws(e){return e.display.scroller.clientHeight-yn(e)-e.display.barHeight}function Lg(e,t,i){var r=e.options.lineWrapping,s=r&&nr(e);if(!t.measure.heights||r&&t.measure.width!=s){var u=t.measure.heights=[];if(r){t.measure.width=s;for(var f=t.text.firstChild.getClientRects(),h=0;h<f.length-1;h++){var g=f[h],v=f[h+1];Math.abs(g.bottom-v.bottom)>2&&u.push((g.bottom+v.top)/2-i.top)}}u.push(i.bottom-i.top)}}function yu(e,t,i){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 s=0;s<e.rest.length;s++)if(b(e.rest[s])>i)return{map:e.measure.maps[s],cache:e.measure.caches[s],before:!0}}}function Eg(e,t){t=cn(t);var i=b(t),r=e.display.externalMeasured=new fu(e.doc,t,i);r.lineN=i;var s=r.built=uu(e,r);return r.text=s.pre,Q(e.display.lineMeasure,s.pre),r}function bu(e,t,i,r){return bn(e,Or(e,t),i,r)}function Ss(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ar(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function Or(e,t){var i=b(t),r=Ss(e,i);r&&!r.text?r=null:r&&r.changes&&(hu(e,r,i,Es(e)),e.curOp.forceUpdate=!0),r||(r=Eg(e,t));var s=yu(r,t,i);return{line:t,view:r,rect:null,map:s.map,cache:s.cache,before:s.before,hasHeights:!1}}function bn(e,t,i,r,s){t.before&&(i=-1);var u=i+(r||""),f;return t.cache.hasOwnProperty(u)?f=t.cache[u]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Lg(e,t.view,t.rect),t.hasHeights=!0),f=Ag(e,t,i,r),f.bogus||(t.cache[u]=f)),{left:f.left,right:f.right,top:s?f.rtop:f.top,bottom:s?f.rbottom:f.bottom}}var xu={left:0,right:0,top:0,bottom:0};function ku(e,t,i){for(var r,s,u,f,h,g,v=0;v<e.length;v+=3)if(h=e[v],g=e[v+1],t<h?(s=0,u=1,f="left"):t<g?(s=t-h,u=s+1):(v==e.length-3||t==g&&e[v+3]>t)&&(u=g-h,s=u-1,t>=g&&(f="right")),s!=null){if(r=e[v+2],h==g&&i==(r.insertLeft?"left":"right")&&(f=i),i=="left"&&s==0)for(;v&&e[v-2]==e[v-3]&&e[v-1].insertLeft;)r=e[(v-=3)+2],f="left";if(i=="right"&&s==g-h)for(;v<e.length-3&&e[v+3]==e[v+4]&&!e[v+5].insertLeft;)r=e[(v+=3)+2],f="right";break}return{node:r,start:s,end:u,collapse:f,coverStart:h,coverEnd:g}}function Dg(e,t){var i=xu;if(t=="left")for(var r=0;r<e.length&&(i=e[r]).left==i.right;r++);else for(var s=e.length-1;s>=0&&(i=e[s]).left==i.right;s--);return i}function Ag(e,t,i,r){var s=ku(t.map,i,r),u=s.node,f=s.start,h=s.end,g=s.collapse,v;if(u.nodeType==3){for(var C=0;C<4;C++){for(;f&&De(t.line.text.charAt(s.coverStart+f));)--f;for(;s.coverStart+h<s.coverEnd&&De(t.line.text.charAt(s.coverStart+h));)++h;if(m&&w<9&&f==0&&h==s.coverEnd-s.coverStart?v=u.parentNode.getBoundingClientRect():v=Dg(G(u,f,h).getClientRects(),r),v.left||v.right||f==0)break;h=f,f=f-1,g="right"}m&&w<11&&(v=Ig(e.display.measure,v))}else{f>0&&(g=r="right");var _;e.options.lineWrapping&&(_=u.getClientRects()).length>1?v=_[r=="right"?_.length-1:0]:v=u.getBoundingClientRect()}if(m&&w<9&&!f&&(!v||!v.left&&!v.right)){var R=u.parentNode.getClientRects()[0];R?v={left:R.left,right:R.left+Rr(e.display),top:R.top,bottom:R.bottom}:v=xu}for(var I=v.top-t.rect.top,H=v.bottom-t.rect.top,U=(I+H)/2,V=t.view.measure.heights,ee=0;ee<V.length-1&&!(U<V[ee]);ee++);var ae=ee?V[ee-1]:0,te=V[ee],le={left:(g=="right"?v.right:v.left)-t.rect.left,right:(g=="left"?v.left:v.right)-t.rect.left,top:ae,bottom:te};return!v.left&&!v.right&&(le.bogus=!0),e.options.singleCursorHeightPerLine||(le.rtop=I,le.rbottom=H),le}function Ig(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!hs(e))return t;var i=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*i,right:t.right*i,top:t.top*r,bottom:t.bottom*r}}function wu(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 Su(e){e.display.externalMeasure=null,j(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)wu(e.display.view[t])}function vi(e){Su(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 E&&W?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function Tu(e){return E&&W?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function Cs(e){var t=cn(e),i=t.widgets,r=0;if(i)for(var s=0;s<i.length;++s)i[s].above&&(r+=mi(i[s]));return r}function da(e,t,i,r,s){if(!s){var u=Cs(t);i.top+=u,i.bottom+=u}if(r=="line")return i;r||(r="local");var f=_n(t);if(r=="local"?f+=ha(e.display):f-=e.display.viewOffset,r=="page"||r=="window"){var h=e.display.lineSpace.getBoundingClientRect();f+=h.top+(r=="window"?0:Tu(x(e)));var g=h.left+(r=="window"?0:Cu(x(e)));i.left+=g,i.right+=g}return i.top+=f,i.bottom+=f,i}function _u(e,t,i){if(i=="div")return t;var r=t.left,s=t.top;if(i=="page")r-=Cu(x(e)),s-=Tu(x(e));else if(i=="local"||!i){var u=e.display.sizer.getBoundingClientRect();r+=u.left,s+=u.top}var f=e.display.lineSpace.getBoundingClientRect();return{left:r-f.left,top:s-f.top}}function pa(e,t,i,r,s){return r||(r=ce(e.doc,t.line)),da(e,r,bu(e,r,t.ch,s),i)}function fn(e,t,i,r,s,u){r=r||ce(e.doc,t.line),s||(s=Or(e,r));function f(H,U){var V=bn(e,s,H,U?"right":"left",u);return U?V.left=V.right:V.right=V.left,da(e,r,V,i)}var h=Pe(r,e.doc.direction),g=t.ch,v=t.sticky;if(g>=r.text.length?(g=r.text.length,v="before"):g<=0&&(g=0,v="after"),!h)return f(v=="before"?g-1:g,v=="before");function C(H,U,V){var ee=h[U],ae=ee.level==1;return f(V?H-1:H,ae!=V)}var _=Rn(h,g,v),R=er,I=C(g,_,v=="before");return R!=null&&(I.other=C(g,R,v!="before")),I}function Lu(e,t){var i=0;t=Se(e.doc,t),e.options.lineWrapping||(i=Rr(e.display)*t.ch);var r=ce(e.doc,t.line),s=_n(r)+ha(e.display);return{left:i,right:i,top:s,bottom:s+r.height}}function Ts(e,t,i,r,s){var u=$(e,t,i);return u.xRel=s,r&&(u.outside=r),u}function _s(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Ts(r.first,0,null,-1,-1);var s=T(r,i),u=r.first+r.size-1;if(s>u)return Ts(r.first+r.size-1,ce(r,u).text.length,null,1,1);t<0&&(t=0);for(var f=ce(r,s);;){var h=Og(e,f,s,t,i),g=sg(f,h.ch+(h.xRel>0||h.outside>0?1:0));if(!g)return h;var v=g.find(1);if(v.line==s)return v;f=ce(r,s=v.line)}}function Eu(e,t,i,r){r-=Cs(t);var s=t.text.length,u=Zt(function(f){return bn(e,i,f-1).bottom<=r},s,0);return s=Zt(function(f){return bn(e,i,f).top>r},u,s),{begin:u,end:s}}function Du(e,t,i,r){i||(i=Or(e,t));var s=da(e,t,bn(e,i,r),"line").top;return Eu(e,t,i,s)}function Ls(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function Og(e,t,i,r,s){s-=_n(t);var u=Or(e,t),f=Cs(t),h=0,g=t.text.length,v=!0,C=Pe(t,e.doc.direction);if(C){var _=(e.options.lineWrapping?Rg:Ng)(e,t,i,u,C,r,s);v=_.level!=1,h=v?_.from:_.to-1,g=v?_.to:_.from-1}var R=null,I=null,H=Zt(function(ve){var ge=bn(e,u,ve);return ge.top+=f,ge.bottom+=f,Ls(ge,r,s,!1)?(ge.top<=s&&ge.left<=r&&(R=ve,I=ge),!0):!1},h,g),U,V,ee=!1;if(I){var ae=r-I.left<I.right-r,te=ae==v;H=R+(te?0:1),V=te?"after":"before",U=ae?I.left:I.right}else{!v&&(H==g||H==h)&&H++,V=H==0?"after":H==t.text.length?"before":bn(e,u,H-(v?1:0)).bottom+f<=s==v?"after":"before";var le=fn(e,$(i,H,V),"line",t,u);U=le.left,ee=s<le.top?-1:s>=le.bottom?1:0}return H=$t(t.text,H,1),Ts(i,H,V,ee,r-U)}function Ng(e,t,i,r,s,u,f){var h=Zt(function(_){var R=s[_],I=R.level!=1;return Ls(fn(e,$(i,I?R.to:R.from,I?"before":"after"),"line",t,r),u,f,!0)},0,s.length-1),g=s[h];if(h>0){var v=g.level!=1,C=fn(e,$(i,v?g.from:g.to,v?"after":"before"),"line",t,r);Ls(C,u,f,!0)&&C.top>f&&(g=s[h-1])}return g}function Rg(e,t,i,r,s,u,f){var h=Eu(e,t,r,f),g=h.begin,v=h.end;/\s/.test(t.text.charAt(v-1))&&v--;for(var C=null,_=null,R=0;R<s.length;R++){var I=s[R];if(!(I.from>=v||I.to<=g)){var H=I.level!=1,U=bn(e,r,H?Math.min(v,I.to)-1:Math.max(g,I.from)).right,V=U<u?u-U+1e9:U-u;(!C||_>V)&&(C=I,_=V)}}return C||(C=s[s.length-1]),C.from<g&&(C={from:g,to:C.to,level:C.level}),C.to>v&&(C={from:C.from,to:v,level:C.level}),C}var rr;function Nr(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(rr==null){rr=k("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)rr.appendChild(document.createTextNode("x")),rr.appendChild(k("br"));rr.appendChild(document.createTextNode("x"))}Q(e.measure,rr);var i=rr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),j(e.measure),i||1}function Rr(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=k("span","xxxxxxxxxx"),i=k("pre",[t],"CodeMirror-line-like");Q(e.measure,i);var r=t.getBoundingClientRect(),s=(r.right-r.left)/10;return s>2&&(e.cachedCharWidth=s),s||10}function Es(e){for(var t=e.display,i={},r={},s=t.gutters.clientLeft,u=t.gutters.firstChild,f=0;u;u=u.nextSibling,++f){var h=e.display.gutterSpecs[f].className;i[h]=u.offsetLeft+u.clientLeft+s,r[h]=u.clientWidth}return{fixedPos:Ds(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ds(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Au(e){var t=Nr(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Rr(e.display)-3);return function(s){if(zn(e.doc,s))return 0;var u=0;if(s.widgets)for(var f=0;f<s.widgets.length;f++)s.widgets[f].height&&(u+=s.widgets[f].height);return i?u+(Math.ceil(s.text.length/r)||1)*t:u+t}}function As(e){var t=e.doc,i=Au(e);t.iter(function(r){var s=i(r);s!=r.height&&Kt(r,s)})}function ir(e,t,i,r){var s=e.display;if(!i&&li(t).getAttribute("cm-not-content")=="true")return null;var u,f,h=s.lineSpace.getBoundingClientRect();try{u=t.clientX-h.left,f=t.clientY-h.top}catch{return null}var g=_s(e,u,f),v;if(r&&g.xRel>0&&(v=ce(e.doc,g.line).text).length==g.ch){var C=_e(v,v.length,e.options.tabSize)-v.length;g=$(g.line,Math.max(0,Math.round((u-vu(e.display).left)/Rr(e.display))-C))}return g}function ar(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,t<0)return r}function Ot(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var s=e.display;if(r&&i<s.viewTo&&(s.updateLineNumbers==null||s.updateLineNumbers>t)&&(s.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=s.viewTo)Tn&&vs(e.doc,t)<s.viewTo&&Hn(e);else if(i<=s.viewFrom)Tn&&ou(e.doc,i+r)>s.viewFrom?Hn(e):(s.viewFrom+=r,s.viewTo+=r);else if(t<=s.viewFrom&&i>=s.viewTo)Hn(e);else if(t<=s.viewFrom){var u=ga(e,i,i+r,1);u?(s.view=s.view.slice(u.index),s.viewFrom=u.lineN,s.viewTo+=r):Hn(e)}else if(i>=s.viewTo){var f=ga(e,t,t,-1);f?(s.view=s.view.slice(0,f.index),s.viewTo=f.lineN):Hn(e)}else{var h=ga(e,t,t,-1),g=ga(e,i,i+r,1);h&&g?(s.view=s.view.slice(0,h.index).concat(fa(e,h.lineN,g.lineN)).concat(s.view.slice(g.index)),s.viewTo+=r):Hn(e)}var v=s.externalMeasured;v&&(i<v.lineN?v.lineN+=r:t<v.lineN+v.size&&(s.externalMeasured=null))}function Bn(e,t,i){e.curOp.viewChanged=!0;var r=e.display,s=e.display.externalMeasured;if(s&&t>=s.lineN&&t<s.lineN+s.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var u=r.view[ar(e,t)];if(u.node!=null){var f=u.changes||(u.changes=[]);ke(f,i)==-1&&f.push(i)}}}function Hn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function ga(e,t,i,r){var s=ar(e,t),u,f=e.display.view;if(!Tn||i==e.doc.first+e.doc.size)return{index:s,lineN:i};for(var h=e.display.viewFrom,g=0;g<s;g++)h+=f[g].size;if(h!=t){if(r>0){if(s==f.length-1)return null;u=h+f[s].size-t,s++}else u=h-t;t+=u,i+=u}for(;vs(e.doc,i)!=i;){if(s==(r<0?0:f.length-1))return null;i+=r*f[s-(r<0?1:0)].size,s+=r}return{index:s,lineN:i}}function Mg(e,t,i){var r=e.display,s=r.view;s.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=fa(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=fa(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(ar(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(fa(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,ar(e,i)))),r.viewTo=i}function Iu(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var s=t[r];!s.hidden&&(!s.node||s.changes)&&++i}return i}function yi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Ou(e,t){t===void 0&&(t=!0);var i=e.doc,r={},s=r.cursors=document.createDocumentFragment(),u=r.selection=document.createDocumentFragment(),f=e.options.$customCursor;f&&(t=!0);for(var h=0;h<i.sel.ranges.length;h++)if(!(!t&&h==i.sel.primIndex)){var g=i.sel.ranges[h];if(!(g.from().line>=e.display.viewTo||g.to().line<e.display.viewFrom)){var v=g.empty();if(f){var C=f(e,g);C&&Is(e,C,s)}else(v||e.options.showCursorWhenSelecting)&&Is(e,g.head,s);v||Fg(e,g,u)}}return r}function Is(e,t,i){var r=fn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),s=i.appendChild(k("div"," ","CodeMirror-cursor"));if(s.style.left=r.left+"px",s.style.top=r.top+"px",s.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var u=pa(e,t,"div",null,null),f=u.right-u.left;s.style.width=(f>0?f:e.defaultCharWidth())+"px"}if(r.other){var h=i.appendChild(k("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 ma(e,t){return e.top-t.top||e.left-t.left}function Fg(e,t,i){var r=e.display,s=e.doc,u=document.createDocumentFragment(),f=vu(e.display),h=f.left,g=Math.max(r.sizerWidth,nr(e)-r.sizer.offsetLeft)-f.right,v=s.direction=="ltr";function C(te,le,ve,ge){le<0&&(le=0),le=Math.round(le),ge=Math.round(ge),u.appendChild(k("div",null,"CodeMirror-selected","position: absolute; left: "+te+`px;
6
6
  top: `+le+"px; width: "+(ve??g-te)+`px;
7
- height: `+(ge-le)+"px"))}function _(te,le,ve){var ge=fe(s,te),Ae=ge.text.length,qe,xt;function Qe(lt,Rt){return pa(e,P(te,lt),"div",ge,Rt)}function Ht(lt,Rt,St){var pt=Du(e,ge,null,lt),ut=Rt=="ltr"==(St=="after")?"left":"right",rt=St=="after"?pt.begin:pt.end-(/\s/.test(ge.text.charAt(pt.end-1))?2:1);return Qe(rt,ut)[ut]}var Mt=Pe(ge,s.direction);return Nn(Mt,le||0,ve??Ae,function(lt,Rt,St,pt){var ut=St=="ltr",rt=Qe(lt,ut?"left":"right"),Ft=Qe(Rt-1,ut?"right":"left"),Kr=le==null&&lt==0,Kn=ve==null&&Rt==Ae,Lt=pt==0,xn=!Mt||pt==Mt.length-1;if(Ft.top-rt.top<=3){var wt=(v?Kr:Kn)&&Lt,io=(v?Kn:Kr)&&xn,Dn=wt?h:(ut?rt:Ft).left,fr=io?g:(ut?Ft:rt).right;C(Dn,rt.top,fr-Dn,rt.bottom)}else{var cr,Dt,Xr,ao;ut?(cr=v&&Kr&&Lt?h:rt.left,Dt=v?g:Ht(lt,St,"before"),Xr=v?h:Ht(Rt,St,"after"),ao=v&&Kn&&xn?g:Ft.right):(cr=v?Ht(lt,St,"before"):h,Dt=!v&&Kr&&Lt?g:rt.right,Xr=!v&&Kn&&xn?h:Ft.left,ao=v?Ht(Rt,St,"after"):g),C(cr,rt.top,Dt-cr,rt.bottom),rt.bottom<Ft.top&&C(h,rt.bottom,null,Ft.top),C(Xr,Ft.top,ao-Xr,Ft.bottom)}(!qe||ma(rt,qe)<0)&&(qe=rt),ma(Ft,qe)<0&&(qe=Ft),(!xt||ma(rt,xt)<0)&&(xt=rt),ma(Ft,xt)<0&&(xt=Ft)}),{start:qe,end:xt}}var M=t.from(),I=t.to();if(M.line==I.line)_(M.line,M.ch,I.ch);else{var z=fe(s,M.line),q=fe(s,I.line),V=fn(z)==fn(q),ee=_(M.line,M.ch,V?z.text.length+1:null).end,ae=_(I.line,V?0:null,I.ch).start;V&&(ee.top<ae.top-2?(C(ee.right,ee.top,null,ee.bottom),C(h,ae.top,ae.left,ae.bottom)):C(ee.right,ee.top,ae.left-ee.right,ee.bottom)),ee.bottom<ae.top&&C(h,ee.bottom,null,ae.top)}i.appendChild(u)}function Os(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Rr(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Nu(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ms(e))}function Ns(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Rr(e))},100)}function Ms(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(et(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(),S&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Os(e))}function Rr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(et(e,"blur",e,t),e.state.focused=!1,ze(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,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),s=t.lineDiv.getBoundingClientRect().top,u=0,c=0;c<t.view.length;c++){var h=t.view[c],g=e.options.lineWrapping,v=void 0,C=0;if(!h.hidden){if(s+=h.line.height,m&&x<8){var _=h.node.offsetTop+h.node.offsetHeight;v=_-i,i=_}else{var M=h.node.getBoundingClientRect();v=M.bottom-M.top,!g&&h.text.firstChild&&(C=h.text.firstChild.getBoundingClientRect().right-M.left-1)}var I=h.line.height-v;if((I>.005||I<-.005)&&(s<r&&(u-=I),Kt(h.line,v),Mu(h.line),h.rest))for(var z=0;z<h.rest.length;z++)Mu(h.rest[z]);if(C>e.display.sizerWidth){var q=Math.ceil(C/Mr(e.display));q>e.display.maxLineLength&&(e.display.maxLineLength=q,e.display.maxLine=h.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function Mu(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function ya(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-ha(e));var s=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,u=T(t,r),c=T(t,s);if(i&&i.ensure){var h=i.ensure.from.line,g=i.ensure.to.line;h<u?(u=h,c=T(t,Tn(fe(t,h))+e.wrapper.clientHeight)):Math.min(g,t.lastLine())>=c&&(u=T(t,Tn(fe(t,g))-e.wrapper.clientHeight),c=g)}return{from:u,to:Math.max(c,u+1)}}function Pg(e,t){if(!tt(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),s=null,u=i.wrapper.ownerDocument;if(t.top+r.top<0?s=!0:t.bottom+r.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(s=!1),s!=null&&!N){var c=k("div","​",null,`position: absolute;
7
+ height: `+(ge-le)+"px"))}function _(te,le,ve){var ge=ce(s,te),Ae=ge.text.length,qe,xt;function Qe(lt,Mt){return pa(e,$(te,lt),"div",ge,Mt)}function Ht(lt,Mt,St){var pt=Du(e,ge,null,lt),ut=Mt=="ltr"==(St=="after")?"left":"right",rt=St=="after"?pt.begin:pt.end-(/\s/.test(ge.text.charAt(pt.end-1))?2:1);return Qe(rt,ut)[ut]}var Rt=Pe(ge,s.direction);return Nn(Rt,le||0,ve??Ae,function(lt,Mt,St,pt){var ut=St=="ltr",rt=Qe(lt,ut?"left":"right"),Ft=Qe(Mt-1,ut?"right":"left"),Kr=le==null&&lt==0,Kn=ve==null&&Mt==Ae,Lt=pt==0,xn=!Rt||pt==Rt.length-1;if(Ft.top-rt.top<=3){var kt=(v?Kr:Kn)&&Lt,io=(v?Kn:Kr)&&xn,An=kt?h:(ut?rt:Ft).left,cr=io?g:(ut?Ft:rt).right;C(An,rt.top,cr-An,rt.bottom)}else{var fr,Dt,Xr,ao;ut?(fr=v&&Kr&&Lt?h:rt.left,Dt=v?g:Ht(lt,St,"before"),Xr=v?h:Ht(Mt,St,"after"),ao=v&&Kn&&xn?g:Ft.right):(fr=v?Ht(lt,St,"before"):h,Dt=!v&&Kr&&Lt?g:rt.right,Xr=!v&&Kn&&xn?h:Ft.left,ao=v?Ht(Mt,St,"after"):g),C(fr,rt.top,Dt-fr,rt.bottom),rt.bottom<Ft.top&&C(h,rt.bottom,null,Ft.top),C(Xr,Ft.top,ao-Xr,Ft.bottom)}(!qe||ma(rt,qe)<0)&&(qe=rt),ma(Ft,qe)<0&&(qe=Ft),(!xt||ma(rt,xt)<0)&&(xt=rt),ma(Ft,xt)<0&&(xt=Ft)}),{start:qe,end:xt}}var R=t.from(),I=t.to();if(R.line==I.line)_(R.line,R.ch,I.ch);else{var H=ce(s,R.line),U=ce(s,I.line),V=cn(H)==cn(U),ee=_(R.line,R.ch,V?H.text.length+1:null).end,ae=_(I.line,V?0:null,I.ch).start;V&&(ee.top<ae.top-2?(C(ee.right,ee.top,null,ee.bottom),C(h,ae.top,ae.left,ae.bottom)):C(ee.right,ee.top,ae.left-ee.right,ee.bottom)),ee.bottom<ae.top&&C(h,ee.bottom,null,ae.top)}i.appendChild(u)}function Os(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||Mr(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Nu(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Rs(e))}function Ns(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&Mr(e))},100)}function Rs(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(et(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(),S&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Os(e))}function Mr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(et(e,"blur",e,t),e.state.focused=!1,$e(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,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),s=t.lineDiv.getBoundingClientRect().top,u=0,f=0;f<t.view.length;f++){var h=t.view[f],g=e.options.lineWrapping,v=void 0,C=0;if(!h.hidden){if(s+=h.line.height,m&&w<8){var _=h.node.offsetTop+h.node.offsetHeight;v=_-i,i=_}else{var R=h.node.getBoundingClientRect();v=R.bottom-R.top,!g&&h.text.firstChild&&(C=h.text.firstChild.getBoundingClientRect().right-R.left-1)}var I=h.line.height-v;if((I>.005||I<-.005)&&(s<r&&(u-=I),Kt(h.line,v),Ru(h.line),h.rest))for(var H=0;H<h.rest.length;H++)Ru(h.rest[H]);if(C>e.display.sizerWidth){var U=Math.ceil(C/Rr(e.display));U>e.display.maxLineLength&&(e.display.maxLineLength=U,e.display.maxLine=h.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function Ru(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var i=e.widgets[t],r=i.node.parentNode;r&&(i.height=r.offsetHeight)}}function ya(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-ha(e));var s=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,u=T(t,r),f=T(t,s);if(i&&i.ensure){var h=i.ensure.from.line,g=i.ensure.to.line;h<u?(u=h,f=T(t,_n(ce(t,h))+e.wrapper.clientHeight)):Math.min(g,t.lastLine())>=f&&(u=T(t,_n(ce(t,g))-e.wrapper.clientHeight),f=g)}return{from:u,to:Math.max(f,u+1)}}function Pg(e,t){if(!tt(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),s=null,u=i.wrapper.ownerDocument;if(t.top+r.top<0?s=!0:t.bottom+r.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(s=!1),s!=null&&!N){var f=k("div","​",null,`position: absolute;
8
8
  top: `+(t.top-i.viewOffset-ha(e.display))+`px;
9
9
  height: `+(t.bottom-t.top+yn(e)+i.barHeight)+`px;
10
- left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(c),c.scrollIntoView(s),e.display.lineSpace.removeChild(c)}}}function zg(e,t,i,r){r==null&&(r=0);var s;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?P(t.line,t.ch+1,"before"):t,t=t.ch?P(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var c=!1,h=cn(e,t),g=!i||i==t?h:cn(e,i);s={left:Math.min(h.left,g.left),top:Math.min(h.top,g.top)-r,right:Math.max(h.left,g.left),bottom:Math.max(h.bottom,g.bottom)+r};var v=Rs(e,s),C=e.doc.scrollTop,_=e.doc.scrollLeft;if(v.scrollTop!=null&&(xi(e,v.scrollTop),Math.abs(e.doc.scrollTop-C)>1&&(c=!0)),v.scrollLeft!=null&&(sr(e,v.scrollLeft),Math.abs(e.doc.scrollLeft-_)>1&&(c=!0)),!c)break}return s}function $g(e,t){var i=Rs(e,t);i.scrollTop!=null&&xi(e,i.scrollTop),i.scrollLeft!=null&&sr(e,i.scrollLeft)}function Rs(e,t){var i=e.display,r=Nr(e.display);t.top<0&&(t.top=0);var s=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,u=ks(e),c={};t.bottom-t.top>u&&(t.bottom=t.top+u);var h=e.doc.height+ws(i),g=t.top<r,v=t.bottom>h-r;if(t.top<s)c.scrollTop=g?0:t.top;else if(t.bottom>s+u){var C=Math.min(t.top,(v?h:t.bottom)-u);C!=s&&(c.scrollTop=C)}var _=e.options.fixedGutter?0:i.gutters.offsetWidth,M=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-_,I=nr(e)-i.gutters.offsetWidth,z=t.right-t.left>I;return z&&(t.right=t.left+I),t.left<10?c.scrollLeft=0:t.left<M?c.scrollLeft=Math.max(0,t.left+_-(z?0:10)):t.right>I+M-3&&(c.scrollLeft=t.right+(z?0:10)-I),c}function Fs(e,t){t!=null&&(ba(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Fr(e){ba(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bi(e,t,i){(t!=null||i!=null)&&ba(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Bg(e,t){ba(e),e.curOp.scrollToPos=t}function ba(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=Lu(e,t.from),r=Lu(e,t.to);Ru(e,i,r,t.margin)}}function Ru(e,t,i,r){var s=Rs(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});bi(e,s.scrollLeft,s.scrollTop)}function xi(e,t){Math.abs(e.doc.scrollTop-t)<2||(f||zs(e,{top:t}),Fu(e,t,!0),f&&zs(e),Si(e,100))}function Fu(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function sr(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Hu(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function wi(e){var t=e.display,i=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?i:0,docHeight:r,scrollHeight:r+yn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var or=function(e,t,i){this.cm=i;var r=this.vert=k("div",[k("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),s=this.horiz=k("div",[k("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=s.tabIndex=-1,e(r),e(s),me(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),me(s,"scroll",function(){s.clientWidth&&t(s.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,m&&x<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};or.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var s=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+s)+"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=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var u=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+u)+"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:i?r:0,bottom:t?r:0}},or.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},or.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},or.prototype.zeroWidthHack=function(){var e=ne&&!F?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new ft,this.disableVert=new ft},or.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var s=e.getBoundingClientRect(),u=i=="vert"?document.elementFromPoint(s.right-1,(s.top+s.bottom)/2):document.elementFromPoint((s.right+s.left)/2,s.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},or.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ki=function(){};ki.prototype.update=function(){return{bottom:0,right:0}},ki.prototype.setScrollLeft=function(){},ki.prototype.setScrollTop=function(){},ki.prototype.clear=function(){};function Pr(e,t){t||(t=wi(e));var i=e.display.barWidth,r=e.display.barHeight;Pu(e,t);for(var s=0;s<4&&i!=e.display.barWidth||r!=e.display.barHeight;s++)i!=e.display.barWidth&&e.options.lineWrapping&&va(e),Pu(e,wi(e)),i=e.display.barWidth,r=e.display.barHeight}function Pu(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var zu={native:or,null:ki};function $u(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&ze(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new zu[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),me(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?sr(e,t):xi(e,t)},e),e.display.scrollbars.addClass&&K(e.display.wrapper,e.display.scrollbars.addClass)}var Hg=0;function lr(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:++Hg,markArrays:null},yg(e.curOp)}function ur(e){var t=e.curOp;t&&xg(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;Wg(i)})}function Wg(e){for(var t=e.ops,i=0;i<t.length;i++)jg(t[i]);for(var r=0;r<t.length;r++)qg(t[r]);for(var s=0;s<t.length;s++)Ug(t[s]);for(var u=0;u<t.length;u++)Gg(t[u]);for(var c=0;c<t.length;c++)Kg(t[c])}function jg(e){var t=e.cm,i=t.display;Yg(t),e.updateMaxLine&&bs(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new xa(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function qg(e){e.updatedDisplay=e.mustUpdate&&Ps(e.cm,e.update)}function Ug(e){var t=e.cm,i=t.display;e.updatedDisplay&&va(t),e.barMeasure=wi(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=bu(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+yn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-nr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function Gg(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&sr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==R(oe(t));e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Pr(t,e.barMeasure),e.updatedDisplay&&Bs(t,e.barMeasure),e.selectionChanged&&Os(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&Nu(e.cm)}function Kg(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&Bu(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&Fu(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&sr(t,e.scrollLeft,!0,!0),e.scrollToPos){var s=zg(t,Se(r,e.scrollToPos.from),Se(r,e.scrollToPos.to),e.scrollToPos.margin);Pg(t,s)}var u=e.maybeHiddenMarkers,c=e.maybeUnhiddenMarkers;if(u)for(var h=0;h<u.length;++h)u[h].lines.length||et(u[h],"hide");if(c)for(var g=0;g<c.length;++g)c[g].lines.length&&et(c[g],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&et(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Bt(e,t){if(e.curOp)return t();lr(e);try{return t()}finally{ur(e)}}function yt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);lr(e);try{return t.apply(e,arguments)}finally{ur(e)}}}function Et(e){return function(){if(this.curOp)return e.apply(this,arguments);lr(this);try{return e.apply(this,arguments)}finally{ur(this)}}}function bt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);lr(t);try{return e.apply(this,arguments)}finally{ur(t)}}}function Si(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,ce(Xg,e))}function Xg(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var i=+new Date+e.options.workTime,r=hi(e,t.highlightFrontier),s=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(r.line>=e.display.viewFrom){var c=u.styles,h=u.text.length>e.options.maxHighlightLength?mn(t.mode,r.state):null,g=Kl(e,u,r,!0);h&&(r.state=h),u.styles=g.styles;var v=u.styleClasses,C=g.classes;C?u.styleClasses=C:v&&(u.styleClasses=null);for(var _=!c||c.length!=u.styles.length||v!=C&&(!v||!C||v.bgClass!=C.bgClass||v.textClass!=C.textClass),M=0;!_&&M<c.length;++M)_=c[M]!=u.styles[M];_&&s.push(r.line),u.stateAfter=r.save(),r.nextLine()}else u.text.length<=e.options.maxHighlightLength&&ds(e,u.text,r),u.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Si(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),s.length&&Bt(e,function(){for(var u=0;u<s.length;u++)Bn(e,s[u],"text")})}}var xa=function(e,t,i){var r=e.display;this.viewport=t,this.visible=ya(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=nr(e),this.force=i,this.dims=Es(e),this.events=[]};xa.prototype.signal=function(e,t){$t(e,t)&&this.events.push(arguments)},xa.prototype.finish=function(){for(var e=0;e<this.events.length;e++)et.apply(null,this.events[e])};function Yg(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=yn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=yn(e)+"px",t.scrollbarsClipped=!0)}function Vg(e){if(e.hasFocus())return null;var t=R(oe(e));if(!t||!D(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=Z(e).getSelection();r.anchorNode&&r.extend&&D(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function Jg(e){if(!(!e||!e.activeElt||e.activeElt==R(Te(e.activeElt)))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode))){var t=e.activeElt.ownerDocument,i=t.defaultView.getSelection(),r=t.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),i.removeAllRanges(),i.addRange(r),i.extend(e.focusNode,e.focusOffset)}}function Ps(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Hn(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&Iu(e)==0)return!1;Wu(e)&&(Hn(e),t.dims=Es(e));var s=r.first+r.size,u=Math.max(t.visible.from-e.options.viewportMargin,r.first),c=Math.min(s,t.visible.to+e.options.viewportMargin);i.viewFrom<u&&u-i.viewFrom<20&&(u=Math.max(r.first,i.viewFrom)),i.viewTo>c&&i.viewTo-c<20&&(c=Math.min(s,i.viewTo)),Cn&&(u=vs(e.doc,u),c=ou(e.doc,c));var h=u!=i.viewFrom||c!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Rg(e,u,c),i.viewOffset=Tn(fe(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var g=Iu(e);if(!h&&g==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var v=Vg(e);return g>4&&(i.lineDiv.style.display="none"),Qg(e,i.updateLineNumbers,t.dims),g>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,Jg(v),W(i.cursorDiv),W(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,h&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Si(e,400)),i.updateLineNumbers=null,!0}function Bu(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==nr(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ws(e.display)-ks(e),i.top)}),t.visible=ya(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ya(e.display,e.doc,i));if(!Ps(e,t))break;va(e);var s=wi(e);yi(e),Pr(e,s),Bs(e,s),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 zs(e,t){var i=new xa(e,t);if(Ps(e,i)){va(e),Bu(e,i);var r=wi(e);yi(e),Pr(e,r),Bs(e,r),i.finish()}}function Qg(e,t,i){var r=e.display,s=e.options.lineNumbers,u=r.lineDiv,c=u.firstChild;function h(z){var q=z.nextSibling;return S&&ne&&e.display.currentWheelTarget==z?z.style.display="none":z.parentNode.removeChild(z),q}for(var g=r.view,v=r.viewFrom,C=0;C<g.length;C++){var _=g[C];if(!_.hidden)if(!_.node||_.node.parentNode!=u){var M=Tg(e,_,v,i);u.insertBefore(M,c)}else{for(;c!=_.node;)c=h(c);var I=s&&t!=null&&t<=v&&_.lineNumber;_.changes&&(we(_.changes,"gutter")>-1&&(I=!1),hu(e,_,v,i)),I&&(W(_.lineNumber),_.lineNumber.appendChild(document.createTextNode(Y(e.options,v)))),c=_.node.nextSibling}v+=_.size}for(;c;)c=h(c)}function $s(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",vt(e,"gutterChanged",e)}function Bs(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+yn(e)+"px"}function Hu(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Ds(t)-t.scroller.scrollLeft+e.doc.scrollLeft,s=t.gutters.offsetWidth,u=r+"px",c=0;c<i.length;c++)if(!i[c].hidden){e.options.fixedGutter&&(i[c].gutter&&(i[c].gutter.style.left=u),i[c].gutterBackground&&(i[c].gutterBackground.style.left=u));var h=i[c].alignable;if(h)for(var g=0;g<h.length;g++)h[g].style.left=u}e.options.fixedGutter&&(t.gutters.style.left=r+s+"px")}}function Wu(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=Y(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var s=r.measure.appendChild(k("div",[k("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),u=s.firstChild.offsetWidth,c=s.offsetWidth-u;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(u,r.lineGutter.offsetWidth-c)+1,r.lineNumWidth=r.lineNumInnerWidth+c,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",$s(e.display),!0}return!1}function Hs(e,t){for(var i=[],r=!1,s=0;s<e.length;s++){var u=e[s],c=null;if(typeof u!="string"&&(c=u.style,u=u.className),u=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:u,style:c})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function ju(e){var t=e.gutters,i=e.gutterSpecs;W(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var s=i[r],u=s.className,c=s.style,h=t.appendChild(k("div",null,"CodeMirror-gutter "+u));c&&(h.style.cssText=c),u=="CodeMirror-linenumbers"&&(e.lineGutter=h,h.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",$s(e)}function Ci(e){ju(e.display),Ot(e),Hu(e)}function Zg(e,t,i,r){var s=this;this.input=i,s.scrollbarFiller=k("div",null,"CodeMirror-scrollbar-filler"),s.scrollbarFiller.setAttribute("cm-not-content","true"),s.gutterFiller=k("div",null,"CodeMirror-gutter-filler"),s.gutterFiller.setAttribute("cm-not-content","true"),s.lineDiv=J("div",null,"CodeMirror-code"),s.selectionDiv=k("div",null,null,"position: relative; z-index: 1"),s.cursorDiv=k("div",null,"CodeMirror-cursors"),s.measure=k("div",null,"CodeMirror-measure"),s.lineMeasure=k("div",null,"CodeMirror-measure"),s.lineSpace=J("div",[s.measure,s.lineMeasure,s.selectionDiv,s.cursorDiv,s.lineDiv],null,"position: relative; outline: none");var u=J("div",[s.lineSpace],"CodeMirror-lines");s.mover=k("div",[u],null,"position: relative"),s.sizer=k("div",[s.mover],"CodeMirror-sizer"),s.sizerWidth=null,s.heightForcer=k("div",null,null,"position: absolute; height: "+Me+"px; width: 1px;"),s.gutters=k("div",null,"CodeMirror-gutters"),s.lineGutter=null,s.scroller=k("div",[s.sizer,s.heightForcer,s.gutters],"CodeMirror-scroll"),s.scroller.setAttribute("tabIndex","-1"),s.wrapper=k("div",[s.scrollbarFiller,s.gutterFiller,s.scroller],"CodeMirror"),E&&H===105&&(s.wrapper.style.clipPath="inset(0px)"),s.wrapper.setAttribute("translate","no"),m&&x<8&&(s.gutters.style.zIndex=-1,s.scroller.style.paddingRight=0),!S&&!(f&&X)&&(s.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(s.wrapper):e(s.wrapper)),s.viewFrom=s.viewTo=t.first,s.reportedViewFrom=s.reportedViewTo=t.first,s.view=[],s.renderedView=null,s.externalMeasured=null,s.viewOffset=0,s.lastWrapHeight=s.lastWrapWidth=0,s.updateLineNumbers=null,s.nativeBarWidth=s.barHeight=s.barWidth=0,s.scrollbarsClipped=!1,s.lineNumWidth=s.lineNumInnerWidth=s.lineNumChars=null,s.alignWidgets=!1,s.cachedCharWidth=s.cachedTextHeight=s.cachedPaddingH=null,s.maxLine=null,s.maxLineLength=0,s.maxLineChanged=!1,s.wheelDX=s.wheelDY=s.wheelStartX=s.wheelStartY=null,s.shift=!1,s.selForContextMenu=null,s.activeTouch=null,s.gutterSpecs=Hs(r.gutters,r.lineNumbers),ju(s),i.init(s)}var wa=0,Ln=null;m?Ln=-.53:f?Ln=15:E?Ln=-.7:U&&(Ln=-1/3);function qu(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function em(e){var t=qu(e);return t.x*=Ln,t.y*=Ln,t}function Uu(e,t){E&&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 i=qu(t),r=i.x,s=i.y,u=Ln;t.deltaMode===0&&(r=t.deltaX,s=t.deltaY,u=1);var c=e.display,h=c.scroller,g=h.scrollWidth>h.clientWidth,v=h.scrollHeight>h.clientHeight;if(r&&g||s&&v){if(s&&ne&&S){e:for(var C=t.target,_=c.view;C!=h;C=C.parentNode)for(var M=0;M<_.length;M++)if(_[M].node==C){e.display.currentWheelTarget=C;break e}}if(r&&!f&&!B&&u!=null){s&&v&&xi(e,Math.max(0,h.scrollTop+s*u)),sr(e,Math.max(0,h.scrollLeft+r*u)),(!s||s&&v)&&Tt(t),c.wheelStartX=null;return}if(s&&u!=null){var I=s*u,z=e.doc.scrollTop,q=z+c.wrapper.clientHeight;I<0?z=Math.max(0,z+I-50):q=Math.min(e.doc.height,q+I+50),zs(e,{top:z,bottom:q})}wa<20&&t.deltaMode!==0&&(c.wheelStartX==null?(c.wheelStartX=h.scrollLeft,c.wheelStartY=h.scrollTop,c.wheelDX=r,c.wheelDY=s,setTimeout(function(){if(c.wheelStartX!=null){var V=h.scrollLeft-c.wheelStartX,ee=h.scrollTop-c.wheelStartY,ae=ee&&c.wheelDY&&ee/c.wheelDY||V&&c.wheelDX&&V/c.wheelDX;c.wheelStartX=c.wheelStartY=null,ae&&(Ln=(Ln*wa+ae)/(wa+1),++wa)}},200)):(c.wheelDX+=r,c.wheelDY+=s))}}var Xt=function(e,t){this.ranges=e,this.primIndex=t};Xt.prototype.primary=function(){return this.ranges[this.primIndex]},Xt.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 i=this.ranges[t],r=e.ranges[t];if(!$e(i.anchor,r.anchor)||!$e(i.head,r.head))return!1}return!0},Xt.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Be(mt(this.ranges[t].anchor),mt(this.ranges[t].head));return new Xt(e,this.primIndex)},Xt.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Xt.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(re(t,r.from())>=0&&re(e,r.to())<=0)return i}return-1};var Be=function(e,t){this.anchor=e,this.head=t};Be.prototype.from=function(){return Dr(this.anchor,this.head)},Be.prototype.to=function(){return It(this.anchor,this.head)},Be.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function hn(e,t,i){var r=e&&e.options.selectionsMayTouch,s=t[i];t.sort(function(M,I){return re(M.from(),I.from())}),i=we(t,s);for(var u=1;u<t.length;u++){var c=t[u],h=t[u-1],g=re(h.to(),c.from());if(r&&!c.empty()?g>0:g>=0){var v=Dr(h.from(),c.from()),C=It(h.to(),c.to()),_=h.empty()?c.from()==c.head:h.from()==h.head;u<=i&&--i,t.splice(--u,2,new Be(_?C:v,_?v:C))}}return new Xt(t,i)}function Wn(e,t){return new Xt([new Be(e,t||e)],0)}function jn(e){return e.text?P(e.from.line+e.text.length-1,be(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Gu(e,t){if(re(e,t.from)<0)return e;if(re(e,t.to)<=0)return jn(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=jn(t).ch-t.to.ch),P(i,r)}function Ws(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var s=e.sel.ranges[r];i.push(new Be(Gu(s.anchor,t),Gu(s.head,t)))}return hn(e.cm,i,e.sel.primIndex)}function Ku(e,t,i){return e.line==t.line?P(i.line,e.ch-t.ch+i.ch):P(i.line+(e.line-t.line),e.ch)}function tm(e,t,i){for(var r=[],s=P(e.first,0),u=s,c=0;c<t.length;c++){var h=t[c],g=Ku(h.from,s,u),v=Ku(jn(h),s,u);if(s=h.to,u=v,i=="around"){var C=e.sel.ranges[c],_=re(C.head,C.anchor)<0;r[c]=new Be(_?v:g,_?g:v)}else r[c]=new Be(g,g)}return new Xt(r,e.sel.primIndex)}function js(e){e.doc.mode=_r(e.options,e.doc.modeOption),Ti(e)}function Ti(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,Si(e,100),e.state.modeGen++,e.curOp&&Ot(e)}function Xu(e,t){return t.from.ch==0&&t.to.ch==0&&be(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function qs(e,t,i,r){function s(ae){return i?i[ae]:null}function u(ae,te,le){ug(ae,te,le,r),vt(ae,"change",ae,t)}function c(ae,te){for(var le=[],ve=ae;ve<te;++ve)le.push(new Ar(v[ve],s(ve),r));return le}var h=t.from,g=t.to,v=t.text,C=fe(e,h.line),_=fe(e,g.line),M=be(v),I=s(v.length-1),z=g.line-h.line;if(t.full)e.insert(0,c(0,v.length)),e.remove(v.length,e.size-v.length);else if(Xu(e,t)){var q=c(0,v.length-1);u(_,_.text,I),z&&e.remove(h.line,z),q.length&&e.insert(h.line,q)}else if(C==_)if(v.length==1)u(C,C.text.slice(0,h.ch)+M+C.text.slice(g.ch),I);else{var V=c(1,v.length-1);V.push(new Ar(M+C.text.slice(g.ch),I,r)),u(C,C.text.slice(0,h.ch)+v[0],s(0)),e.insert(h.line+1,V)}else if(v.length==1)u(C,C.text.slice(0,h.ch)+v[0]+_.text.slice(g.ch),s(0)),e.remove(h.line+1,z);else{u(C,C.text.slice(0,h.ch)+v[0],s(0)),u(_,M+_.text.slice(g.ch),I);var ee=c(1,v.length-1);z>1&&e.remove(h.line+1,z-1),e.insert(h.line+1,ee)}vt(e,"change",e,t)}function qn(e,t,i){function r(s,u,c){if(s.linked)for(var h=0;h<s.linked.length;++h){var g=s.linked[h];if(g.doc!=u){var v=c&&g.sharedHist;i&&!v||(t(g.doc,v),r(g.doc,s,v))}}}r(e,null,!0)}function Yu(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,As(e),js(e),Vu(e),e.options.direction=t.direction,e.options.lineWrapping||bs(e),e.options.mode=t.modeOption,Ot(e)}function Vu(e){(e.doc.direction=="rtl"?K:ze)(e.display.lineDiv,"CodeMirror-rtl")}function nm(e){Bt(e,function(){Vu(e),Ot(e)})}function ka(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 Us(e,t){var i={from:mt(t.from),to:jn(t),text:Sn(e,t.from,t.to)};return Zu(e,i,t.from.line,t.to.line+1),qn(e,function(r){return Zu(r,i,t.from.line,t.to.line+1)},!0),i}function Ju(e){for(;e.length;){var t=be(e);if(t.ranges)e.pop();else break}}function rm(e,t){if(t)return Ju(e.done),be(e.done);if(e.done.length&&!be(e.done).ranges)return be(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),be(e.done)}function Qu(e,t,i,r){var s=e.history;s.undone.length=0;var u=+new Date,c,h;if((s.lastOp==r||s.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&s.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(c=rm(s,s.lastOp==r)))h=be(c.changes),re(t.from,t.to)==0&&re(t.from,h.to)==0?h.to=jn(t):c.changes.push(Us(e,t));else{var g=be(s.done);for((!g||!g.ranges)&&Sa(e.sel,s.done),c={changes:[Us(e,t)],generation:s.generation},s.done.push(c);s.done.length>s.undoDepth;)s.done.shift(),s.done[0].ranges||s.done.shift()}s.done.push(i),s.generation=++s.maxGeneration,s.lastModTime=s.lastSelTime=u,s.lastOp=s.lastSelOp=r,s.lastOrigin=s.lastSelOrigin=t.origin,h||et(e,"historyAdded")}function im(e,t,i,r){var s=t.charAt(0);return s=="*"||s=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function am(e,t,i,r){var s=e.history,u=r&&r.origin;i==s.lastSelOp||u&&s.lastSelOrigin==u&&(s.lastModTime==s.lastSelTime&&s.lastOrigin==u||im(e,u,be(s.done),t))?s.done[s.done.length-1]=t:Sa(t,s.done),s.lastSelTime=+new Date,s.lastSelOrigin=u,s.lastSelOp=i,r&&r.clearRedo!==!1&&Ju(s.undone)}function Sa(e,t){var i=be(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Zu(e,t,i,r){var s=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(c){c.markedSpans&&((s||(s=t["spans_"+e.id]={}))[u]=c.markedSpans),++u})}function sm(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function om(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],s=0;s<t.text.length;++s)r.push(sm(i[s]));return r}function ef(e,t){var i=om(e,t),r=gs(e,t);if(!i)return r;if(!r)return i;for(var s=0;s<i.length;++s){var u=i[s],c=r[s];if(u&&c)e:for(var h=0;h<c.length;++h){for(var g=c[h],v=0;v<u.length;++v)if(u[v].marker==g.marker)continue e;u.push(g)}else c&&(i[s]=c)}return i}function zr(e,t,i){for(var r=[],s=0;s<e.length;++s){var u=e[s];if(u.ranges){r.push(i?Xt.prototype.deepCopy.call(u):u);continue}var c=u.changes,h=[];r.push({changes:h});for(var g=0;g<c.length;++g){var v=c[g],C=void 0;if(h.push({from:v.from,to:v.to,text:v.text}),t)for(var _ in v)(C=_.match(/^spans_(\d+)$/))&&we(t,Number(C[1]))>-1&&(be(h)[_]=v[_],delete v[_])}}return r}function Gs(e,t,i,r){if(r){var s=e.anchor;if(i){var u=re(t,s)<0;u!=re(i,s)<0?(s=t,t=i):u!=re(t,i)<0&&(t=i)}return new Be(s,t)}else return new Be(i||t,t)}function Ca(e,t,i,r,s){s==null&&(s=e.cm&&(e.cm.display.shift||e.extend)),_t(e,new Xt([Gs(e.sel.primary(),t,i,s)],0),r)}function tf(e,t,i){for(var r=[],s=e.cm&&(e.cm.display.shift||e.extend),u=0;u<e.sel.ranges.length;u++)r[u]=Gs(e.sel.ranges[u],t[u],null,s);var c=hn(e.cm,r,e.sel.primIndex);_t(e,c,i)}function Ks(e,t,i,r){var s=e.sel.ranges.slice(0);s[t]=i,_t(e,hn(e.cm,s,e.sel.primIndex),r)}function nf(e,t,i,r){_t(e,Wn(t,i),r)}function lm(e,t,i){var r={ranges:t.ranges,update:function(s){this.ranges=[];for(var u=0;u<s.length;u++)this.ranges[u]=new Be(Se(e,s[u].anchor),Se(e,s[u].head))},origin:i&&i.origin};return et(e,"beforeSelectionChange",e,r),e.cm&&et(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?hn(e.cm,r.ranges,r.ranges.length-1):t}function rf(e,t,i){var r=e.history.done,s=be(r);s&&s.ranges?(r[r.length-1]=t,Ta(e,t,i)):_t(e,t,i)}function _t(e,t,i){Ta(e,t,i),am(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function Ta(e,t,i){($t(e,"beforeSelectionChange")||e.cm&&$t(e.cm,"beforeSelectionChange"))&&(t=lm(e,t,i));var r=i&&i.bias||(re(t.primary().head,e.sel.primary().head)<0?-1:1);af(e,of(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&e.cm.getOption("readOnly")!="nocursor"&&Fr(e.cm)}function af(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,en(e.cm)),vt(e,"cursorActivity",e))}function sf(e){af(e,of(e,e.sel,null,!1))}function of(e,t,i,r){for(var s,u=0;u<t.ranges.length;u++){var c=t.ranges[u],h=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[u],g=_a(e,c.anchor,h&&h.anchor,i,r),v=c.head==c.anchor?g:_a(e,c.head,h&&h.head,i,r);(s||g!=c.anchor||v!=c.head)&&(s||(s=t.ranges.slice(0,u)),s[u]=new Be(g,v))}return s?hn(e.cm,s,t.primIndex):t}function $r(e,t,i,r,s){var u=fe(e,t.line);if(u.markedSpans)for(var c=0;c<u.markedSpans.length;++c){var h=u.markedSpans[c],g=h.marker,v="selectLeft"in g?!g.selectLeft:g.inclusiveLeft,C="selectRight"in g?!g.selectRight:g.inclusiveRight;if((h.from==null||(v?h.from<=t.ch:h.from<t.ch))&&(h.to==null||(C?h.to>=t.ch:h.to>t.ch))){if(s&&(et(g,"beforeCursorEnter"),g.explicitlyCleared))if(u.markedSpans){--c;continue}else break;if(!g.atomic)continue;if(i){var _=g.find(r<0?1:-1),M=void 0;if((r<0?C:v)&&(_=lf(e,_,-r,_&&_.line==t.line?u:null)),_&&_.line==t.line&&(M=re(_,i))&&(r<0?M<0:M>0))return $r(e,_,t,r,s)}var I=g.find(r<0?-1:1);return(r<0?v:C)&&(I=lf(e,I,r,I.line==t.line?u:null)),I?$r(e,I,t,r,s):null}}return t}function _a(e,t,i,r,s){var u=r||1,c=$r(e,t,i,u,s)||!s&&$r(e,t,i,u,!0)||$r(e,t,i,-u,s)||!s&&$r(e,t,i,-u,!0);return c||(e.cantEdit=!0,P(e.first,0))}function lf(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?Se(e,P(t.line-1)):null:i>0&&t.ch==(r||fe(e,t.line)).text.length?t.line<e.first+e.size-1?P(t.line+1,0):null:new P(t.line,t.ch+i)}function uf(e){e.setSelection(P(e.firstLine(),0),P(e.lastLine()),ct)}function ff(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(s,u,c,h){s&&(r.from=Se(e,s)),u&&(r.to=Se(e,u)),c&&(r.text=c),h!==void 0&&(r.origin=h)}),et(e,"beforeChange",e,r),e.cm&&et(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 Br(e,t,i){if(e.cm){if(!e.cm.curOp)return yt(e.cm,Br)(e,t,i);if(e.cm.state.suppressEdits)return}if(!(($t(e,"beforeChange")||e.cm&&$t(e.cm,"beforeChange"))&&(t=ff(e,t,!0),!t))){var r=eu&&!i&&ag(e,t.from,t.to);if(r)for(var s=r.length-1;s>=0;--s)cf(e,{from:r[s].from,to:r[s].to,text:s?[""]:t.text,origin:t.origin});else cf(e,t)}}function cf(e,t){if(!(t.text.length==1&&t.text[0]==""&&re(t.from,t.to)==0)){var i=Ws(e,t);Qu(e,t,i,e.cm?e.cm.curOp.id:NaN),_i(e,t,i,gs(e,t));var r=[];qn(e,function(s,u){!u&&we(r,s.history)==-1&&(gf(s.history,t),r.push(s.history)),_i(s,t,null,gs(s,t))})}}function La(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var s=e.history,u,c=e.sel,h=t=="undo"?s.done:s.undone,g=t=="undo"?s.undone:s.done,v=0;v<h.length&&(u=h[v],!(i?u.ranges&&!u.equals(e.sel):!u.ranges));v++);if(v!=h.length){for(s.lastOrigin=s.lastSelOrigin=null;;)if(u=h.pop(),u.ranges){if(Sa(u,g),i&&!u.equals(e.sel)){_t(e,u,{clearRedo:!1});return}c=u}else if(r){h.push(u);return}else break;var C=[];Sa(c,g),g.push({changes:C,generation:s.generation}),s.generation=u.generation||++s.maxGeneration;for(var _=$t(e,"beforeChange")||e.cm&&$t(e.cm,"beforeChange"),M=function(q){var V=u.changes[q];if(V.origin=t,_&&!ff(e,V,!1))return h.length=0,{};C.push(Us(e,V));var ee=q?Ws(e,V):be(h);_i(e,V,ee,ef(e,V)),!q&&e.cm&&e.cm.scrollIntoView({from:V.from,to:jn(V)});var ae=[];qn(e,function(te,le){!le&&we(ae,te.history)==-1&&(gf(te.history,V),ae.push(te.history)),_i(te,V,null,ef(te,V))})},I=u.changes.length-1;I>=0;--I){var z=M(I);if(z)return z.v}}}}function hf(e,t){if(t!=0&&(e.first+=t,e.sel=new Xt(kt(e.sel.ranges,function(s){return new Be(P(s.anchor.line+t,s.anchor.ch),P(s.head.line+t,s.head.ch))}),e.sel.primIndex),e.cm)){Ot(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Bn(e.cm,r,"gutter")}}function _i(e,t,i,r){if(e.cm&&!e.cm.curOp)return yt(e.cm,_i)(e,t,i,r);if(t.to.line<e.first){hf(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 s=t.text.length-1-(e.first-t.from.line);hf(e,s),t={from:P(e.first,0),to:P(t.to.line+s,t.to.ch),text:[be(t.text)],origin:t.origin}}var u=e.lastLine();t.to.line>u&&(t={from:t.from,to:P(u,fe(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Sn(e,t.from,t.to),i||(i=Ws(e,t)),e.cm?um(e.cm,t,r):qs(e,t,r),Ta(e,i,ct),e.cantEdit&&_a(e,P(e.firstLine(),0))&&(e.cantEdit=!1)}}function um(e,t,i){var r=e.doc,s=e.display,u=t.from,c=t.to,h=!1,g=u.line;e.options.lineWrapping||(g=b(fn(fe(r,u.line))),r.iter(g,c.line+1,function(I){if(I==s.maxLine)return h=!0,!0})),r.sel.contains(t.from,t.to)>-1&&en(e),qs(r,t,i,Au(e)),e.options.lineWrapping||(r.iter(g,u.line+t.text.length,function(I){var z=fa(I);z>s.maxLineLength&&(s.maxLine=I,s.maxLineLength=z,s.maxLineChanged=!0,h=!1)}),h&&(e.curOp.updateMaxLine=!0)),Qp(r,u.line),Si(e,400);var v=t.text.length-(c.line-u.line)-1;t.full?Ot(e):u.line==c.line&&t.text.length==1&&!Xu(e.doc,t)?Bn(e,u.line,"text"):Ot(e,u.line,c.line+1,v);var C=$t(e,"changes"),_=$t(e,"change");if(_||C){var M={from:u,to:c,text:t.text,removed:t.removed,origin:t.origin};_&&vt(e,"change",e,M),C&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(M)}e.display.selForContextMenu=null}function Hr(e,t,i,r,s){var u;r||(r=i),re(r,i)<0&&(u=[r,i],i=u[0],r=u[1]),typeof t=="string"&&(t=e.splitLines(t)),Br(e,{from:i,to:r,text:t,origin:s})}function df(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function pf(e,t,i,r){for(var s=0;s<e.length;++s){var u=e[s],c=!0;if(u.ranges){u.copied||(u=e[s]=u.deepCopy(),u.copied=!0);for(var h=0;h<u.ranges.length;h++)df(u.ranges[h].anchor,t,i,r),df(u.ranges[h].head,t,i,r);continue}for(var g=0;g<u.changes.length;++g){var v=u.changes[g];if(i<v.from.line)v.from=P(v.from.line+r,v.from.ch),v.to=P(v.to.line+r,v.to.ch);else if(t<=v.to.line){c=!1;break}}c||(e.splice(0,s+1),s=0)}}function gf(e,t){var i=t.from.line,r=t.to.line,s=t.text.length-(r-i)-1;pf(e.done,i,r,s),pf(e.undone,i,r,s)}function Li(e,t,i,r){var s=t,u=t;return typeof t=="number"?u=fe(e,Ul(e,t)):s=b(t),s==null?null:(r(u,s)&&e.cm&&Bn(e.cm,s,i),u)}function Ei(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}Ei.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var s=this.lines[i];this.height-=s.height,fg(s),vt(s,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,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,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function Di(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var s=e[r];t+=s.chunkSize(),i+=s.height,s.parent=this}this.size=t,this.height=i,this.parent=null}Di.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],s=r.chunkSize();if(e<s){var u=Math.min(t,s-e),c=r.height;if(r.removeInner(e,u),this.height-=c-r.height,s==u&&(this.children.splice(i--,1),r.parent=null),(t-=u)==0)break;e=0}else e-=s}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ei))){var h=[];this.collapse(h),this.children=[new Ei(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,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var s=this.children[r],u=s.chunkSize();if(e<=u){if(s.insertInner(e,t,i),s.lines&&s.lines.length>50){for(var c=s.lines.length%25+25,h=c;h<s.lines.length;){var g=new Ei(s.lines.slice(h,h+=25));s.height-=g.height,this.children.splice(++r,0,g),g.parent=this}s.lines=s.lines.slice(0,c),this.maybeSpill()}break}e-=u}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Di(t);if(e.parent){e.size-=i.size,e.height-=i.height;var s=we(e.parent.children,e);e.parent.children.splice(s+1,0,i)}else{var r=new Di(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var s=this.children[r],u=s.chunkSize();if(e<u){var c=Math.min(t,u-e);if(s.iterN(e,c,i))return!0;if((t-=c)==0)break;e=0}else e-=u}}};var Ai=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};Ai.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=b(i);if(!(r==null||!t)){for(var s=0;s<t.length;++s)t[s]==this&&t.splice(s--,1);t.length||(i.widgets=null);var u=mi(this);Kt(i,Math.max(0,i.height-u)),e&&(Bt(e,function(){mf(e,i,-u),Bn(e,r,"widget")}),vt(e,"lineWidgetCleared",e,this,r))}},Ai.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var s=mi(this)-t;s&&($n(this.doc,r)||Kt(r,r.height+s),i&&Bt(i,function(){i.curOp.forceUpdate=!0,mf(i,r,s),vt(i,"lineWidgetChanged",i,e,b(r))}))},an(Ai);function mf(e,t,i){Tn(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Fs(e,i)}function fm(e,t,i,r){var s=new Ai(e,i,r),u=e.cm;return u&&s.noHScroll&&(u.display.alignWidgets=!0),Li(e,t,"widget",function(c){var h=c.widgets||(c.widgets=[]);if(s.insertAt==null?h.push(s):h.splice(Math.min(h.length,Math.max(0,s.insertAt)),0,s),s.line=c,u&&!$n(e,c)){var g=Tn(c)<e.scrollTop;Kt(c,c.height+mi(s)),g&&Fs(u,s.height),u.curOp.forceUpdate=!0}return!0}),u&&vt(u,"lineWidgetAdded",u,s,typeof t=="number"?t:b(t)),s}var vf=0,Un=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++vf};Un.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&lr(e),$t(this,"clear")){var i=this.find();i&&vt(this,"clear",i.from,i.to)}for(var r=null,s=null,u=0;u<this.lines.length;++u){var c=this.lines[u],h=di(c.markedSpans,this);e&&!this.collapsed?Bn(e,b(c),"text"):e&&(h.to!=null&&(s=b(c)),h.from!=null&&(r=b(c))),c.markedSpans=tg(c.markedSpans,h),h.from==null&&this.collapsed&&!$n(this.doc,c)&&e&&Kt(c,Nr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var g=0;g<this.lines.length;++g){var v=fn(this.lines[g]),C=fa(v);C>e.display.maxLineLength&&(e.display.maxLine=v,e.display.maxLineLength=C,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Ot(e,r,s+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&sf(e.doc)),e&&vt(e,"markerCleared",e,this,r,s),t&&ur(e),this.parent&&this.parent.clear()}},Un.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,s=0;s<this.lines.length;++s){var u=this.lines[s],c=di(u.markedSpans,this);if(c.from!=null&&(i=P(t?u:b(u),c.from),e==-1))return i;if(c.to!=null&&(r=P(t?u:b(u),c.to),e==1))return r}return i&&{from:i,to:r}},Un.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;!t||!r||Bt(r,function(){var s=t.line,u=b(t.line),c=Ss(r,u);if(c&&(ku(c),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!$n(i.doc,s)&&i.height!=null){var h=i.height;i.height=null;var g=mi(i)-h;g&&Kt(s,s.height+g)}vt(r,"markerChanged",r,e)})},Un.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||we(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Un.prototype.detachLine=function(e){if(this.lines.splice(we(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},an(Un);function Wr(e,t,i,r,s){if(r&&r.shared)return cm(e,t,i,r,s);if(e.cm&&!e.cm.curOp)return yt(e.cm,Wr)(e,t,i,r,s);var u=new Un(e,s),c=re(t,i);if(r&&ke(r,u,!1),c>0||c==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=J("span",[u.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(su(e,t.line,t,i,u)||t.line!=i.line&&su(e,i.line,t,i,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");eg()}u.addToHistory&&Qu(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var h=t.line,g=e.cm,v;if(e.iter(h,i.line+1,function(_){g&&u.collapsed&&!g.options.lineWrapping&&fn(_)==g.display.maxLine&&(v=!0),u.collapsed&&h!=t.line&&Kt(_,0),ng(_,new sa(u,h==t.line?t.ch:null,h==i.line?i.ch:null),e.cm&&e.cm.curOp),++h}),u.collapsed&&e.iter(t.line,i.line+1,function(_){$n(e,_)&&Kt(_,0)}),u.clearOnEnter&&me(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(Zp(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++vf,u.atomic=!0),g){if(v&&(g.curOp.updateMaxLine=!0),u.collapsed)Ot(g,t.line,i.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(var C=t.line;C<=i.line;C++)Bn(g,C,"text");u.atomic&&sf(g.doc),vt(g,"markerAdded",g,u)}return u}var Ii=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};Ii.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();vt(this,"clear")}},Ii.prototype.find=function(e,t){return this.primary.find(e,t)},an(Ii);function cm(e,t,i,r,s){r=ke(r),r.shared=!1;var u=[Wr(e,t,i,r,s)],c=u[0],h=r.widgetNode;return qn(e,function(g){h&&(r.widgetNode=h.cloneNode(!0)),u.push(Wr(g,Se(g,t),Se(g,i),r,s));for(var v=0;v<g.linked.length;++v)if(g.linked[v].isParent)return;c=be(u)}),new Ii(u,c)}function yf(e){return e.findMarks(P(e.first,0),e.clipPos(P(e.lastLine())),function(t){return t.parent})}function hm(e,t){for(var i=0;i<t.length;i++){var r=t[i],s=r.find(),u=e.clipPos(s.from),c=e.clipPos(s.to);if(re(u,c)){var h=Wr(e,u,c,r.primary,r.primary.type);r.markers.push(h),h.parent=r}}}function dm(e){for(var t=function(r){var s=e[r],u=[s.primary.doc];qn(s.primary.doc,function(g){return u.push(g)});for(var c=0;c<s.markers.length;c++){var h=s.markers[c];we(u,h.doc)==-1&&(h.parent=null,s.markers.splice(c--,1))}},i=0;i<e.length;i++)t(i)}var pm=0,Nt=function(e,t,i,r,s){if(!(this instanceof Nt))return new Nt(e,t,i,r,s);i==null&&(i=0),Di.call(this,[new Ei([new Ar("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var u=P(i,0);this.sel=Wn(u),this.history=new ka(null),this.id=++pm,this.modeOption=t,this.lineSep=r,this.direction=s=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),qs(this,{from:u,to:u,text:e}),_t(this,Wn(u),ct)};Nt.prototype=Zn(Di.prototype,{constructor:Nt,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ci(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:bt(function(e){var t=P(this.first,0),i=this.first+this.size-1;Br(this,{from:t,to:P(i,fe(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bi(this.cm,0,0),_t(this,Wn(t),ct)}),replaceRange:function(e,t,i,r){t=Se(this,t),i=i?Se(this,i):t,Hr(this,e,t,i,r)},getRange:function(e,t,i){var r=Sn(this,Se(this,e),Se(this,t));return i===!1?r:i===""?r.join(""):r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(j(this,e))return fe(this,e)},getLineNumber:function(e){return b(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=fe(this,e)),fn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Se(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:bt(function(e,t,i){nf(this,Se(this,typeof e=="number"?P(e,t||0):e),null,i)}),setSelection:bt(function(e,t,i){nf(this,Se(this,e),Se(this,t||e),i)}),extendSelection:bt(function(e,t,i){Ca(this,Se(this,e),t&&Se(this,t),i)}),extendSelections:bt(function(e,t){tf(this,Gl(this,e),t)}),extendSelectionsBy:bt(function(e,t){var i=kt(this.sel.ranges,e);tf(this,Gl(this,i),t)}),setSelections:bt(function(e,t,i){if(e.length){for(var r=[],s=0;s<e.length;s++)r[s]=new Be(Se(this,e[s].anchor),Se(this,e[s].head||e[s].anchor));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),_t(this,hn(this.cm,r,t),i)}}),addSelection:bt(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new Be(Se(this,e),Se(this,t||e))),_t(this,hn(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var s=Sn(this,t[r].from(),t[r].to());i=i?i.concat(s):s}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var s=Sn(this,i[r].from(),i[r].to());e!==!1&&(s=s.join(e||this.lineSeparator())),t[r]=s}return t},replaceSelection:function(e,t,i){for(var r=[],s=0;s<this.sel.ranges.length;s++)r[s]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:bt(function(e,t,i){for(var r=[],s=this.sel,u=0;u<s.ranges.length;u++){var c=s.ranges[u];r[u]={from:c.from(),to:c.to(),text:this.splitLines(e[u]),origin:i}}for(var h=t&&t!="end"&&tm(this,r,t),g=r.length-1;g>=0;g--)Br(this,r[g]);h?rf(this,h):this.cm&&Fr(this.cm)}),undo:bt(function(){La(this,"undo")}),redo:bt(function(){La(this,"redo")}),undoSelection:bt(function(){La(this,"undo",!0)}),redoSelection:bt(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,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var s=0;s<e.undone.length;s++)e.undone[s].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new ka(this.history),qn(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:zr(this.history.done),undone:zr(this.history.undone)}},setHistory:function(e){var t=this.history=new ka(this.history);t.done=zr(e.done.slice(0),null,!0),t.undone=zr(e.undone.slice(0),null,!0)},setGutterMarker:bt(function(e,t,i){return Li(this,e,"gutter",function(r){var s=r.gutterMarkers||(r.gutterMarkers={});return s[t]=i,!i&&pe(s)&&(r.gutterMarkers=null),!0})}),clearGutter:bt(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Li(t,i,"gutter",function(){return i.gutterMarkers[e]=null,pe(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!j(this,e)||(t=e,e=fe(this,e),!e))return null}else if(t=b(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:bt(function(e,t,i){return Li(this,e,t=="gutter"?"gutter":"class",function(r){var s=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[s])r[s]=i;else{if(ie(i).test(r[s]))return!1;r[s]+=" "+i}return!0})}),removeLineClass:bt(function(e,t,i){return Li(this,e,t=="gutter"?"gutter":"class",function(r){var s=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",u=r[s];if(u)if(i==null)r[s]=null;else{var c=u.match(ie(i));if(!c)return!1;var h=c.index+c[0].length;r[s]=u.slice(0,c.index)+(!c.index||h==u.length?"":" ")+u.slice(h)||null}else return!1;return!0})}),addLineWidget:bt(function(e,t,i){return fm(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return Wr(this,Se(this,e),Se(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=Se(this,e),Wr(this,e,e,i,"bookmark")},findMarksAt:function(e){e=Se(this,e);var t=[],i=fe(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var s=i[r];(s.from==null||s.from<=e.ch)&&(s.to==null||s.to>=e.ch)&&t.push(s.marker.parent||s.marker)}return t},findMarks:function(e,t,i){e=Se(this,e),t=Se(this,t);var r=[],s=e.line;return this.iter(e.line,t.line+1,function(u){var c=u.markedSpans;if(c)for(var h=0;h<c.length;h++){var g=c[h];!(g.to!=null&&s==e.line&&e.ch>=g.to||g.from==null&&s!=e.line||g.from!=null&&s==t.line&&g.from>=t.ch)&&(!i||i(g.marker))&&r.push(g.marker.parent||g.marker)}++s}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(s){var u=s.text.length+r;if(u>e)return t=e,!0;e-=u,++i}),Se(this,P(i,t))},indexFromPos:function(e){e=Se(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new Nt(ci(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,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new Nt(ci(this,t,i),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}],hm(r,yf(this)),r},unlinkDoc:function(e){if(e instanceof Ve&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),dm(yf(this));break}}if(e.history==this.history){var r=[e.id];qn(e,function(s){return r.push(s.id)},!0),e.history=new ka(null),e.history.done=zr(this.history.done,r),e.history.undone=zr(this.history.undone,r)}},iterLinkedDocs:function(e){qn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):tn(e)},lineSeparator:function(){return this.lineSep||`
11
- `},setDirection:bt(function(e){e!="rtl"&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&nm(this.cm))})}),Nt.prototype.eachLine=Nt.prototype.iter;var bf=0;function gm(e){var t=this;if(xf(t),!(tt(t,e)||_n(t.display,e))){Tt(e),m&&(bf=+new Date);var i=ir(t,e,!0),r=e.dataTransfer.files;if(!(!i||t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File)for(var s=r.length,u=Array(s),c=0,h=function(){++c==s&&yt(t,function(){i=Se(t.doc,i);var I={from:i,to:i,text:t.doc.splitLines(u.filter(function(z){return z!=null}).join(t.doc.lineSeparator())),origin:"paste"};Br(t.doc,I),rf(t.doc,Wn(Se(t.doc,i),Se(t.doc,jn(I))))})()},g=function(I,z){if(t.options.allowDropFileTypes&&we(t.options.allowDropFileTypes,I.type)==-1){h();return}var q=new FileReader;q.onerror=function(){return h()},q.onload=function(){var V=q.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(V)){h();return}u[z]=V,h()},q.readAsText(I)},v=0;v<r.length;v++)g(r[v],v);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var C=e.dataTransfer.getData("Text");if(C){var _;if(t.state.draggingText&&!t.state.draggingText.copy&&(_=t.listSelections()),Ta(t.doc,Wn(i,i)),_)for(var M=0;M<_.length;++M)Hr(t.doc,"",_[M].anchor,_[M].head,"drag");t.replaceSelection(C,"around","paste"),t.display.input.focus()}}catch{}}}}function mm(e,t){if(m&&(!e.state.draggingText||+new Date-bf<100)){Rn(t);return}if(!(tt(e,t)||_n(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!U)){var i=k("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",B&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),B&&i.parentNode.removeChild(i)}}function vm(e,t){var i=ir(e,t);if(i){var r=document.createDocumentFragment();Is(e,i,r),e.display.dragCursor||(e.display.dragCursor=k("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Q(e.display.dragCursor,r)}}function xf(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function wf(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var s=t[r].CodeMirror;s&&i.push(s)}i.length&&i[0].operation(function(){for(var u=0;u<i.length;u++)e(i[u])})}}var kf=!1;function ym(){kf||(bm(),kf=!0)}function bm(){var e;me(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,wf(xm)},100))}),me(window,"blur",function(){return wf(Rr)})}function xm(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Gn={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"},Oi=0;Oi<10;Oi++)Gn[Oi+48]=Gn[Oi+96]=String(Oi);for(var Ea=65;Ea<=90;Ea++)Gn[Ea]=String.fromCharCode(Ea);for(var Ni=1;Ni<=12;Ni++)Gn[Ni+111]=Gn[Ni+63235]="F"+Ni;var En={};En.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"},En.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"},En.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"},En.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"]},En.default=ne?En.macDefault:En.pcDefault;function wm(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,s,u,c=0;c<t.length-1;c++){var h=t[c];if(/^(cmd|meta|m)$/i.test(h))u=!0;else if(/^a(lt)?$/i.test(h))i=!0;else if(/^(c|ctrl|control)$/i.test(h))r=!0;else if(/^s(hift)?$/i.test(h))s=!0;else throw new Error("Unrecognized modifier name: "+h)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),u&&(e="Cmd-"+e),s&&(e="Shift-"+e),e}function km(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var s=kt(i.split(" "),wm),u=0;u<s.length;u++){var c=void 0,h=void 0;u==s.length-1?(h=s.join(" "),c=r):(h=s.slice(0,u+1).join(" "),c="...");var g=t[h];if(!g)t[h]=c;else if(g!=c)throw new Error("Inconsistent bindings for "+h)}delete e[i]}for(var v in t)e[v]=t[v];return e}function jr(e,t,i,r){t=Da(t);var s=t.call?t.call(e,r):t[e];if(s===!1)return"nothing";if(s==="...")return"multi";if(s!=null&&i(s))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return jr(e,t.fallthrough,i,r);for(var u=0;u<t.fallthrough.length;u++){var c=jr(e,t.fallthrough[u],i,r);if(c)return c}}}function Sf(e){var t=typeof e=="string"?e:Gn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Cf(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(Oe?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(Oe?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function Tf(e,t){if(B&&e.keyCode==34&&e.char)return!1;var i=Gn[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),Cf(i,e,t))}function Da(e){return typeof e=="string"?En[e]:e}function qr(e,t){for(var i=e.doc.sel.ranges,r=[],s=0;s<i.length;s++){for(var u=t(i[s]);r.length&&re(u.from,be(r).to)<=0;){var c=r.pop();if(re(c.from,u.from)<0){u.from=c.from;break}}r.push(u)}Bt(e,function(){for(var h=r.length-1;h>=0;h--)Hr(e.doc,"",r[h].from,r[h].to,"+delete");Fr(e)})}function Xs(e,t,i){var r=zt(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ys(e,t,i){var r=Xs(e,t.ch,i);return r==null?null:new P(t.line,r,i<0?"after":"before")}function Vs(e,t,i,r,s){if(e){t.doc.direction=="rtl"&&(s=-s);var u=Pe(i,t.doc.direction);if(u){var c=s<0?be(u):u[0],h=s<0==(c.level==1),g=h?"after":"before",v;if(c.level>0||t.doc.direction=="rtl"){var C=Or(t,i);v=s<0?i.text.length-1:0;var _=bn(t,C,v).top;v=Zt(function(M){return bn(t,C,M).top==_},s<0==(c.level==1)?c.from:c.to-1,v),g=="before"&&(v=Xs(i,v,1))}else v=s<0?c.to:c.from;return new P(r,v,g)}}return new P(r,s<0?i.text.length:0,s<0?"before":"after")}function Sm(e,t,i,r){var s=Pe(t,e.doc.direction);if(!s)return Ys(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var u=Mn(s,i.ch,i.sticky),c=s[u];if(e.doc.direction=="ltr"&&c.level%2==0&&(r>0?c.to>i.ch:c.from<i.ch))return Ys(t,i,r);var h=function(ee,ae){return Xs(t,ee instanceof P?ee.ch:ee,ae)},g,v=function(ee){return e.options.lineWrapping?(g=g||Or(e,t),Du(e,t,g,ee)):{begin:0,end:t.text.length}},C=v(i.sticky=="before"?h(i,-1):i.ch);if(e.doc.direction=="rtl"||c.level==1){var _=c.level==1==r<0,M=h(i,_?1:-1);if(M!=null&&(_?M<=c.to&&M<=C.end:M>=c.from&&M>=C.begin)){var I=_?"before":"after";return new P(i.line,M,I)}}var z=function(ee,ae,te){for(var le=function(qe,xt){return xt?new P(i.line,h(qe,1),"before"):new P(i.line,qe,"after")};ee>=0&&ee<s.length;ee+=ae){var ve=s[ee],ge=ae>0==(ve.level!=1),Ae=ge?te.begin:h(te.end,-1);if(ve.from<=Ae&&Ae<ve.to||(Ae=ge?ve.from:h(ve.to,-1),te.begin<=Ae&&Ae<te.end))return le(Ae,ge)}},q=z(u+r,r,C);if(q)return q;var V=r>0?C.end:h(C.begin,-1);return V!=null&&!(r>0&&V==t.text.length)&&(q=z(r>0?0:s.length-1,r,v(V)),q)?q:null}var Mi={selectAll:uf,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ct)},killLine:function(e){return qr(e,function(t){if(t.empty()){var i=fe(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:P(t.head.line+1,0)}:{from:t.head,to:P(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return qr(e,function(t){return{from:P(t.from().line,0),to:Se(e.doc,P(t.to().line+1,0))}})},delLineLeft:function(e){return qr(e,function(t){return{from:P(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return qr(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return qr(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"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(P(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(P(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return _f(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Lf(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Cm(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},ht)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},ht)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?Lf(e,t.head):r},ht)},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=[],i=e.listSelections(),r=e.options.tabSize,s=0;s<i.length;s++){var u=i[s].from(),c=_e(e.getLine(u.line),u.ch,r);t.push(Ut(r-c%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Bt(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++)if(t[r].empty()){var s=t[r].head,u=fe(e.doc,s.line).text;if(u){if(s.ch==u.length&&(s=new P(s.line,s.ch-1)),s.ch>0)s=new P(s.line,s.ch+1),e.replaceRange(u.charAt(s.ch-1)+u.charAt(s.ch-2),P(s.line,s.ch-2),s,"+transpose");else if(s.line>e.doc.first){var c=fe(e.doc,s.line-1).text;c&&(s=new P(s.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+c.charAt(c.length-1),P(s.line-1,c.length-1),s,"+transpose"))}}i.push(new Be(s,s))}e.setSelections(i)})},newlineAndIndent:function(e){return Bt(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Fr(e)})},openLine:function(e){return e.replaceSelection(`
12
- `,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function _f(e,t){var i=fe(e.doc,t),r=fn(i);return r!=i&&(t=b(r)),Vs(!0,e,r,t,1)}function Cm(e,t){var i=fe(e.doc,t),r=og(i);return r!=i&&(t=b(r)),Vs(!0,e,i,t,-1)}function Lf(e,t){var i=_f(e,t.line),r=fe(e.doc,i.line),s=Pe(r,e.doc.direction);if(!s||s[0].level==0){var u=Math.max(i.ch,r.text.search(/\S/)),c=t.line==i.line&&t.ch<=u&&t.ch;return P(i.line,c?0:u,i.sticky)}return i}function Aa(e,t,i){if(typeof t=="string"&&(t=Mi[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,s=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),s=t(e)!=Ke}finally{e.display.shift=r,e.state.suppressEdits=!1}return s}function Tm(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var s=jr(t,e.state.keyMaps[r],i,e);if(s)return s}return e.options.extraKeys&&jr(t,e.options.extraKeys,i,e)||jr(t,e.options.keyMap,i,e)}var _m=new ft;function Ri(e,t,i,r){var s=e.state.keySeq;if(s){if(Sf(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:_m.set(50,function(){e.state.keySeq==s&&(e.state.keySeq=null,e.display.input.reset())}),Ef(e,s+" "+t,i,r))return!0}return Ef(e,t,i,r)}function Ef(e,t,i,r){var s=Tm(e,t,r);return s=="multi"&&(e.state.keySeq=t),s=="handled"&&vt(e,"keyHandled",e,t,i),(s=="handled"||s=="multi")&&(Tt(i),Os(e)),!!s}function Df(e,t){var i=Tf(t,!0);return i?t.shiftKey&&!e.state.keySeq?Ri(e,"Shift-"+i,t,function(r){return Aa(e,r,!0)})||Ri(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Aa(e,r)}):Ri(e,i,t,function(r){return Aa(e,r)}):!1}function Lm(e,t,i){return Ri(e,"'"+i+"'",t,function(r){return Aa(e,r,!0)})}var Js=null;function Af(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=R(oe(t)),!tt(t,e))){m&&x<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=Df(t,e);B&&(Js=r?i:null,!r&&i==88&&!ia&&(ne?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),f&&!ne&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Em(t)}}function Em(e){var t=e.display.lineDiv;K(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(ze(t,"CodeMirror-crosshair"),Ct(document,"keyup",i),Ct(document,"mouseover",i))}me(document,"keyup",i),me(document,"mouseover",i)}function If(e){e.keyCode==16&&(this.doc.sel.shift=!1),tt(this,e)}function Of(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(_n(t.display,e)||tt(t,e)||e.ctrlKey&&!e.altKey||ne&&e.metaKey)){var i=e.keyCode,r=e.charCode;if(B&&i==Js){Js=null,Tt(e);return}if(!(B&&(!e.which||e.which<10)&&Df(t,e))){var s=String.fromCharCode(r??i);s!="\b"&&(Lm(t,e,s)||t.display.input.onKeyPress(e))}}}var Dm=400,Qs=function(e,t,i){this.time=e,this.pos=t,this.button=i};Qs.prototype.compare=function(e,t,i){return this.time+Dm>e&&re(t,this.pos)==0&&i==this.button};var Fi,Pi;function Am(e,t){var i=+new Date;return Pi&&Pi.compare(i,e,t)?(Fi=Pi=null,"triple"):Fi&&Fi.compare(i,e,t)?(Pi=new Qs(i,e,t),Fi=null,"double"):(Fi=new Qs(i,e,t),Pi=null,"single")}function Nf(e){var t=this,i=t.display;if(!(tt(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,_n(i,e)){S||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Zs(t,e)){var r=ir(t,e),s=sn(e),u=r?Am(r,s):"single";Z(t).focus(),s==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Im(t,s,r,u,e))&&(s==1?r?Nm(t,r,u,e):li(e)==i.scroller&&Tt(e):s==2?(r&&Ca(t.doc,r),setTimeout(function(){return i.input.focus()},20)):s==3&&(Re?t.display.input.onContextMenu(e):Ns(t)))}}}function Im(e,t,i,r,s){var u="Click";return r=="double"?u="Double"+u:r=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,Ri(e,Cf(u,s),s,function(c){if(typeof c=="string"&&(c=Mi[c]),!c)return!1;var h=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),h=c(e,i)!=Ke}finally{e.state.suppressEdits=!1}return h})}function Om(e,t,i){var r=e.getOption("configureMouse"),s=r?r(e,t,i):{};if(s.unit==null){var u=ue?i.shiftKey&&i.metaKey:i.altKey;s.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(s.extend==null||e.doc.extend)&&(s.extend=e.doc.extend||i.shiftKey),s.addNew==null&&(s.addNew=ne?i.metaKey:i.ctrlKey),s.moveOnDrag==null&&(s.moveOnDrag=!(ne?i.altKey:i.ctrlKey)),s}function Nm(e,t,i,r){m?setTimeout(ce(Nu,e),0):e.curOp.focus=R(oe(e));var s=Om(e,i,r),u=e.doc.sel,c;e.options.dragDrop&&cs&&!e.isReadOnly()&&i=="single"&&(c=u.contains(t))>-1&&(re((c=u.ranges[c]).from(),t)<0||t.xRel>0)&&(re(c.to(),t)>0||t.xRel<0)?Mm(e,r,t,s):Rm(e,r,t,s)}function Mm(e,t,i,r){var s=e.display,u=!1,c=yt(e,function(v){S&&(s.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ns(e)),Ct(s.wrapper.ownerDocument,"mouseup",c),Ct(s.wrapper.ownerDocument,"mousemove",h),Ct(s.scroller,"dragstart",g),Ct(s.scroller,"drop",c),u||(Tt(v),r.addNew||Ca(e.doc,i,null,null,r.extend),S&&!U||m&&x==9?setTimeout(function(){s.wrapper.ownerDocument.body.focus({preventScroll:!0}),s.input.focus()},20):s.input.focus())}),h=function(v){u=u||Math.abs(t.clientX-v.clientX)+Math.abs(t.clientY-v.clientY)>=10},g=function(){return u=!0};S&&(s.scroller.draggable=!0),e.state.draggingText=c,c.copy=!r.moveOnDrag,me(s.wrapper.ownerDocument,"mouseup",c),me(s.wrapper.ownerDocument,"mousemove",h),me(s.scroller,"dragstart",g),me(s.scroller,"drop",c),e.state.delayingBlurEvent=!0,setTimeout(function(){return s.input.focus()},20),s.scroller.dragDrop&&s.scroller.dragDrop()}function Mf(e,t,i){if(i=="char")return new Be(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Be(P(t.line,0),Se(e.doc,P(t.line+1,0)));var r=i(e,t);return new Be(r.from,r.to)}function Rm(e,t,i,r){m&&Ns(e);var s=e.display,u=e.doc;Tt(t);var c,h,g=u.sel,v=g.ranges;if(r.addNew&&!r.extend?(h=u.sel.contains(i),h>-1?c=v[h]:c=new Be(i,i)):(c=u.sel.primary(),h=u.sel.primIndex),r.unit=="rectangle")r.addNew||(c=new Be(i,i)),i=ir(e,t,!0,!0),h=-1;else{var C=Mf(e,i,r.unit);r.extend?c=Gs(c,C.anchor,C.head,r.extend):c=C}r.addNew?h==-1?(h=v.length,_t(u,hn(e,v.concat([c]),h),{scroll:!1,origin:"*mouse"})):v.length>1&&v[h].empty()&&r.unit=="char"&&!r.extend?(_t(u,hn(e,v.slice(0,h).concat(v.slice(h+1)),0),{scroll:!1,origin:"*mouse"}),g=u.sel):Ks(u,h,c,Pt):(h=0,_t(u,new Xt([c],0),Pt),g=u.sel);var _=i;function M(te){if(re(_,te)!=0)if(_=te,r.unit=="rectangle"){for(var le=[],ve=e.options.tabSize,ge=_e(fe(u,i.line).text,i.ch,ve),Ae=_e(fe(u,te.line).text,te.ch,ve),qe=Math.min(ge,Ae),xt=Math.max(ge,Ae),Qe=Math.min(i.line,te.line),Ht=Math.min(e.lastLine(),Math.max(i.line,te.line));Qe<=Ht;Qe++){var Mt=fe(u,Qe).text,lt=dt(Mt,qe,ve);qe==xt?le.push(new Be(P(Qe,lt),P(Qe,lt))):Mt.length>lt&&le.push(new Be(P(Qe,lt),P(Qe,dt(Mt,xt,ve))))}le.length||le.push(new Be(i,i)),_t(u,hn(e,g.ranges.slice(0,h).concat(le),h),{origin:"*mouse",scroll:!1}),e.scrollIntoView(te)}else{var Rt=c,St=Mf(e,te,r.unit),pt=Rt.anchor,ut;re(St.anchor,pt)>0?(ut=St.head,pt=Dr(Rt.from(),St.anchor)):(ut=St.anchor,pt=It(Rt.to(),St.head));var rt=g.ranges.slice(0);rt[h]=Fm(e,new Be(Se(u,pt),ut)),_t(u,hn(e,rt,h),Pt)}}var I=s.wrapper.getBoundingClientRect(),z=0;function q(te){var le=++z,ve=ir(e,te,!0,r.unit=="rectangle");if(ve)if(re(ve,_)!=0){e.curOp.focus=R(oe(e)),M(ve);var ge=ya(s,u);(ve.line>=ge.to||ve.line<ge.from)&&setTimeout(yt(e,function(){z==le&&q(te)}),150)}else{var Ae=te.clientY<I.top?-20:te.clientY>I.bottom?20:0;Ae&&setTimeout(yt(e,function(){z==le&&(s.scroller.scrollTop+=Ae,q(te))}),50)}}function V(te){e.state.selectingText=!1,z=1/0,te&&(Tt(te),s.input.focus()),Ct(s.wrapper.ownerDocument,"mousemove",ee),Ct(s.wrapper.ownerDocument,"mouseup",ae),u.history.lastSelOrigin=null}var ee=yt(e,function(te){te.buttons===0||!sn(te)?V(te):q(te)}),ae=yt(e,V);e.state.selectingText=ae,me(s.wrapper.ownerDocument,"mousemove",ee),me(s.wrapper.ownerDocument,"mouseup",ae)}function Fm(e,t){var i=t.anchor,r=t.head,s=fe(e.doc,i.line);if(re(i,r)==0&&i.sticky==r.sticky)return t;var u=Pe(s);if(!u)return t;var c=Mn(u,i.ch,i.sticky),h=u[c];if(h.from!=i.ch&&h.to!=i.ch)return t;var g=c+(h.from==i.ch==(h.level!=1)?0:1);if(g==0||g==u.length)return t;var v;if(r.line!=i.line)v=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var C=Mn(u,r.ch,r.sticky),_=C-c||(r.ch-i.ch)*(h.level==1?-1:1);C==g-1||C==g?v=_<0:v=_>0}var M=u[g+(v?-1:0)],I=v==(M.level==1),z=I?M.from:M.to,q=I?"after":"before";return i.ch==z&&i.sticky==q?t:new Be(new P(i.line,z,q),r)}function Rf(e,t,i,r){var s,u;if(t.touches)s=t.touches[0].clientX,u=t.touches[0].clientY;else try{s=t.clientX,u=t.clientY}catch{return!1}if(s>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Tt(t);var c=e.display,h=c.lineDiv.getBoundingClientRect();if(u>h.bottom||!$t(e,i))return At(t);u-=h.top-c.viewOffset;for(var g=0;g<e.display.gutterSpecs.length;++g){var v=c.gutters.childNodes[g];if(v&&v.getBoundingClientRect().right>=s){var C=T(e.doc,u),_=e.display.gutterSpecs[g];return et(e,i,e,C,_.className,t),At(t)}}}function Zs(e,t){return Rf(e,t,"gutterClick",!0)}function Ff(e,t){_n(e.display,t)||Pm(e,t)||tt(e,t,"contextmenu")||Re||e.display.input.onContextMenu(t)}function Pm(e,t){return $t(e,"gutterContextMenu")?Rf(e,t,"gutterContextMenu",!1):!1}function Pf(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vi(e)}var Ur={toString:function(){return"CodeMirror.Init"}},zf={},Ia={};function zm(e){var t=e.optionHandlers;function i(r,s,u,c){e.defaults[r]=s,u&&(t[r]=c?function(h,g,v){v!=Ur&&u(h,g,v)}:u)}e.defineOption=i,e.Init=Ur,i("value","",function(r,s){return r.setValue(s)},!0),i("mode",null,function(r,s){r.doc.modeOption=s,js(r)},!0),i("indentUnit",2,js,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Ti(r),vi(r),Ot(r)},!0),i("lineSeparator",null,function(r,s){if(r.doc.lineSep=s,!!s){var u=[],c=r.doc.first;r.doc.iter(function(g){for(var v=0;;){var C=g.text.indexOf(s,v);if(C==-1)break;v=C+s.length,u.push(P(c,C))}c++});for(var h=u.length-1;h>=0;h--)Hr(r.doc,s,u[h],P(u[h].line,u[h].ch+s.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,s,u){r.state.specialChars=new RegExp(s.source+(s.test(" ")?"":"| "),"g"),u!=Ur&&r.refresh()}),i("specialCharPlaceholder",dg,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",X?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,s){return r.getInputField().spellcheck=s},!0),i("autocorrect",!1,function(r,s){return r.getInputField().autocorrect=s},!0),i("autocapitalize",!1,function(r,s){return r.getInputField().autocapitalize=s},!0),i("rtlMoveVisually",!se),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Pf(r),Ci(r)},!0),i("keyMap","default",function(r,s,u){var c=Da(s),h=u!=Ur&&Da(u);h&&h.detach&&h.detach(r,c),c.attach&&c.attach(r,h||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Bm,!0),i("gutters",[],function(r,s){r.display.gutterSpecs=Hs(s,r.options.lineNumbers),Ci(r)},!0),i("fixedGutter",!0,function(r,s){r.display.gutters.style.left=s?Ds(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Pr(r)},!0),i("scrollbarStyle","native",function(r){$u(r),Pr(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,s){r.display.gutterSpecs=Hs(r.options.gutters,s),Ci(r)},!0),i("firstLineNumber",1,Ci,!0),i("lineNumberFormatter",function(r){return r},Ci,!0),i("showCursorWhenSelecting",!1,yi,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,s){s=="nocursor"&&(Rr(r),r.display.input.blur()),r.display.input.readOnlyChanged(s)}),i("screenReaderLabel",null,function(r,s){s=s===""?null:s,r.display.input.screenReaderLabelChanged(s)}),i("disableInput",!1,function(r,s){s||r.display.input.reset()},!0),i("dragDrop",!0,$m),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,yi,!0),i("singleCursorHeightPerLine",!0,yi,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Ti,!0),i("addModeClass",!1,Ti,!0),i("pollInterval",100),i("undoDepth",200,function(r,s){return r.doc.history.undoDepth=s}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Ti,!0),i("moveInputWithCursor",!0,function(r,s){s||r.display.input.resetPosition()}),i("tabindex",null,function(r,s){return r.display.input.getField().tabIndex=s||""}),i("autofocus",null),i("direction","ltr",function(r,s){return r.doc.setDirection(s)},!0),i("phrases",null)}function $m(e,t,i){var r=i&&i!=Ur;if(!t!=!r){var s=e.display.dragFunctions,u=t?me:Ct;u(e.display.scroller,"dragstart",s.start),u(e.display.scroller,"dragenter",s.enter),u(e.display.scroller,"dragover",s.over),u(e.display.scroller,"dragleave",s.leave),u(e.display.scroller,"drop",s.drop)}}function Bm(e){e.options.lineWrapping?(K(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(ze(e.display.wrapper,"CodeMirror-wrap"),bs(e)),As(e),Ot(e),vi(e),setTimeout(function(){return Pr(e)},100)}function Ve(e,t){var i=this;if(!(this instanceof Ve))return new Ve(e,t);this.options=t=t?ke(t):{},ke(zf,t,!1);var r=t.value;typeof r=="string"?r=new Nt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var s=new Ve.inputStyles[t.inputStyle](this),u=this.display=new Zg(e,r,s,t);u.wrapper.CodeMirror=this,Pf(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),$u(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 ft,keySeq:null,specialChars:null},t.autofocus&&!X&&u.input.focus(),m&&x<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Hm(this),ym(),lr(this),this.curOp.forceUpdate=!0,Yu(this,r),t.autofocus&&!X||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ms(i)},20):Rr(this);for(var c in Ia)Ia.hasOwnProperty(c)&&Ia[c](this,t[c],Ur);Wu(this),t.finishInit&&t.finishInit(this);for(var h=0;h<eo.length;++h)eo[h](this);ur(this),S&&t.lineWrapping&&getComputedStyle(u.lineDiv).textRendering=="optimizelegibility"&&(u.lineDiv.style.textRendering="auto")}Ve.defaults=zf,Ve.optionHandlers=Ia;function Hm(e){var t=e.display;me(t.scroller,"mousedown",yt(e,Nf)),m&&x<11?me(t.scroller,"dblclick",yt(e,function(g){if(!tt(e,g)){var v=ir(e,g);if(!(!v||Zs(e,g)||_n(e.display,g))){Tt(g);var C=e.findWordAt(v);Ca(e.doc,C.anchor,C.head)}}})):me(t.scroller,"dblclick",function(g){return tt(e,g)||Tt(g)}),me(t.scroller,"contextmenu",function(g){return Ff(e,g)}),me(t.input.getField(),"contextmenu",function(g){t.scroller.contains(g.target)||Ff(e,g)});var i,r={end:0};function s(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function u(g){if(g.touches.length!=1)return!1;var v=g.touches[0];return v.radiusX<=1&&v.radiusY<=1}function c(g,v){if(v.left==null)return!0;var C=v.left-g.left,_=v.top-g.top;return C*C+_*_>20*20}me(t.scroller,"touchstart",function(g){if(!tt(e,g)&&!u(g)&&!Zs(e,g)){t.input.ensurePolled(),clearTimeout(i);var v=+new Date;t.activeTouch={start:v,moved:!1,prev:v-r.end<=300?r:null},g.touches.length==1&&(t.activeTouch.left=g.touches[0].pageX,t.activeTouch.top=g.touches[0].pageY)}}),me(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),me(t.scroller,"touchend",function(g){var v=t.activeTouch;if(v&&!_n(t,g)&&v.left!=null&&!v.moved&&new Date-v.start<300){var C=e.coordsChar(t.activeTouch,"page"),_;!v.prev||c(v,v.prev)?_=new Be(C,C):!v.prev.prev||c(v,v.prev.prev)?_=e.findWordAt(C):_=new Be(P(C.line,0),Se(e.doc,P(C.line+1,0))),e.setSelection(_.anchor,_.head),e.focus(),Tt(g)}s()}),me(t.scroller,"touchcancel",s),me(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xi(e,t.scroller.scrollTop),sr(e,t.scroller.scrollLeft,!0),et(e,"scroll",e))}),me(t.scroller,"mousewheel",function(g){return Uu(e,g)}),me(t.scroller,"DOMMouseScroll",function(g){return Uu(e,g)}),me(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(g){tt(e,g)||Rn(g)},over:function(g){tt(e,g)||(vm(e,g),Rn(g))},start:function(g){return mm(e,g)},drop:yt(e,gm),leave:function(g){tt(e,g)||xf(e)}};var h=t.input.getField();me(h,"keyup",function(g){return If.call(e,g)}),me(h,"keydown",yt(e,Af)),me(h,"keypress",yt(e,Of)),me(h,"focus",function(g){return Ms(e,g)}),me(h,"blur",function(g){return Rr(e,g)})}var eo=[];Ve.defineInitHook=function(e){return eo.push(e)};function zi(e,t,i,r){var s=e.doc,u;i==null&&(i="add"),i=="smart"&&(s.mode.indent?u=hi(e,t).state:i="prev");var c=e.options.tabSize,h=fe(s,t),g=_e(h.text,null,c);h.stateAfter&&(h.stateAfter=null);var v=h.text.match(/^\s*/)[0],C;if(!r&&!/\S/.test(h.text))C=0,i="not";else if(i=="smart"&&(C=s.mode.indent(u,h.text.slice(v.length),h.text),C==Ke||C>150)){if(!r)return;i="prev"}i=="prev"?t>s.first?C=_e(fe(s,t-1).text,null,c):C=0:i=="add"?C=g+e.options.indentUnit:i=="subtract"?C=g-e.options.indentUnit:typeof i=="number"&&(C=g+i),C=Math.max(0,C);var _="",M=0;if(e.options.indentWithTabs)for(var I=Math.floor(C/c);I;--I)M+=c,_+=" ";if(M<C&&(_+=Ut(C-M)),_!=v)return Hr(s,_,P(t,0),P(t,v.length),"+input"),h.stateAfter=null,!0;for(var z=0;z<s.sel.ranges.length;z++){var q=s.sel.ranges[z];if(q.head.line==t&&q.head.ch<v.length){var V=P(t,v.length);Ks(s,z,new Be(V,V));break}}}var dn=null;function Oa(e){dn=e}function to(e,t,i,r,s){var u=e.doc;e.display.shift=!1,r||(r=u.sel);var c=+new Date-200,h=s=="paste"||e.state.pasteIncoming>c,g=tn(t),v=null;if(h&&r.ranges.length>1)if(dn&&dn.text.join(`
13
- `)==t){if(r.ranges.length%dn.text.length==0){v=[];for(var C=0;C<dn.text.length;C++)v.push(u.splitLines(dn.text[C]))}}else g.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(v=kt(g,function(ee){return[ee]}));for(var _=e.curOp.updateInput,M=r.ranges.length-1;M>=0;M--){var I=r.ranges[M],z=I.from(),q=I.to();I.empty()&&(i&&i>0?z=P(z.line,z.ch-i):e.state.overwrite&&!h?q=P(q.line,Math.min(fe(u,q.line).text.length,q.ch+be(g).length)):h&&dn&&dn.lineWise&&dn.text.join(`
10
+ left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(f),f.scrollIntoView(s),e.display.lineSpace.removeChild(f)}}}function $g(e,t,i,r){r==null&&(r=0);var s;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?$(t.line,t.ch+1,"before"):t,t=t.ch?$(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var f=!1,h=fn(e,t),g=!i||i==t?h:fn(e,i);s={left:Math.min(h.left,g.left),top:Math.min(h.top,g.top)-r,right:Math.max(h.left,g.left),bottom:Math.max(h.bottom,g.bottom)+r};var v=Ms(e,s),C=e.doc.scrollTop,_=e.doc.scrollLeft;if(v.scrollTop!=null&&(xi(e,v.scrollTop),Math.abs(e.doc.scrollTop-C)>1&&(f=!0)),v.scrollLeft!=null&&(sr(e,v.scrollLeft),Math.abs(e.doc.scrollLeft-_)>1&&(f=!0)),!f)break}return s}function zg(e,t){var i=Ms(e,t);i.scrollTop!=null&&xi(e,i.scrollTop),i.scrollLeft!=null&&sr(e,i.scrollLeft)}function Ms(e,t){var i=e.display,r=Nr(e.display);t.top<0&&(t.top=0);var s=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,u=ws(e),f={};t.bottom-t.top>u&&(t.bottom=t.top+u);var h=e.doc.height+ks(i),g=t.top<r,v=t.bottom>h-r;if(t.top<s)f.scrollTop=g?0:t.top;else if(t.bottom>s+u){var C=Math.min(t.top,(v?h:t.bottom)-u);C!=s&&(f.scrollTop=C)}var _=e.options.fixedGutter?0:i.gutters.offsetWidth,R=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-_,I=nr(e)-i.gutters.offsetWidth,H=t.right-t.left>I;return H&&(t.right=t.left+I),t.left<10?f.scrollLeft=0:t.left<R?f.scrollLeft=Math.max(0,t.left+_-(H?0:10)):t.right>I+R-3&&(f.scrollLeft=t.right+(H?0:10)-I),f}function Fs(e,t){t!=null&&(ba(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Fr(e){ba(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function bi(e,t,i){(t!=null||i!=null)&&ba(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Bg(e,t){ba(e),e.curOp.scrollToPos=t}function ba(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=Lu(e,t.from),r=Lu(e,t.to);Mu(e,i,r,t.margin)}}function Mu(e,t,i,r){var s=Ms(e,{left:Math.min(t.left,i.left),top:Math.min(t.top,i.top)-r,right:Math.max(t.right,i.right),bottom:Math.max(t.bottom,i.bottom)+r});bi(e,s.scrollLeft,s.scrollTop)}function xi(e,t){Math.abs(e.doc.scrollTop-t)<2||(c||$s(e,{top:t}),Fu(e,t,!0),c&&$s(e),Si(e,100))}function Fu(e,t,i){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!i)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function sr(e,t,i,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Hu(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function ki(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ks(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?i:0,docHeight:r,scrollHeight:r+yn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var or=function(e,t,i){this.cm=i;var r=this.vert=k("div",[k("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),s=this.horiz=k("div",[k("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=s.tabIndex=-1,e(r),e(s),me(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),me(s,"scroll",function(){s.clientWidth&&t(s.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,m&&w<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};or.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(i){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var s=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+s)+"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=i?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var u=e.viewWidth-e.barLeft-(i?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+u)+"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:i?r:0,bottom:t?r:0}},or.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},or.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},or.prototype.zeroWidthHack=function(){var e=ne&&!P?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new ct,this.disableVert=new ct},or.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var s=e.getBoundingClientRect(),u=i=="vert"?document.elementFromPoint(s.right-1,(s.top+s.bottom)/2):document.elementFromPoint((s.right+s.left)/2,s.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},or.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 Pr(e,t){t||(t=ki(e));var i=e.display.barWidth,r=e.display.barHeight;Pu(e,t);for(var s=0;s<4&&i!=e.display.barWidth||r!=e.display.barHeight;s++)i!=e.display.barWidth&&e.options.lineWrapping&&va(e),Pu(e,ki(e)),i=e.display.barWidth,r=e.display.barHeight}function Pu(e,t){var i=e.display,r=i.scrollbars.update(t);i.sizer.style.paddingRight=(i.barWidth=r.right)+"px",i.sizer.style.paddingBottom=(i.barHeight=r.bottom)+"px",i.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=r.bottom+"px",i.scrollbarFiller.style.width=r.right+"px"):i.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=r.bottom+"px",i.gutterFiller.style.width=t.gutterWidth+"px"):i.gutterFiller.style.display=""}var $u={native:or,null:wi};function zu(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&$e(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new $u[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),me(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,i){i=="horizontal"?sr(e,t):xi(e,t)},e),e.display.scrollbars.addClass&&K(e.display.wrapper,e.display.scrollbars.addClass)}var Hg=0;function lr(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:++Hg,markArrays:null},yg(e.curOp)}function ur(e){var t=e.curOp;t&&xg(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;Wg(i)})}function Wg(e){for(var t=e.ops,i=0;i<t.length;i++)jg(t[i]);for(var r=0;r<t.length;r++)qg(t[r]);for(var s=0;s<t.length;s++)Ug(t[s]);for(var u=0;u<t.length;u++)Gg(t[u]);for(var f=0;f<t.length;f++)Kg(t[f])}function jg(e){var t=e.cm,i=t.display;Yg(t),e.updateMaxLine&&bs(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new xa(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function qg(e){e.updatedDisplay=e.mustUpdate&&Ps(e.cm,e.update)}function Ug(e){var t=e.cm,i=t.display;e.updatedDisplay&&va(t),e.barMeasure=ki(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=bu(t,i.maxLine,i.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(i.scroller.clientWidth,i.sizer.offsetLeft+e.adjustWidthTo+yn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-nr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function Gg(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&sr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==F(oe(t));e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Pr(t,e.barMeasure),e.updatedDisplay&&Bs(t,e.barMeasure),e.selectionChanged&&Os(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&Nu(e.cm)}function Kg(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&Bu(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&Fu(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&sr(t,e.scrollLeft,!0,!0),e.scrollToPos){var s=$g(t,Se(r,e.scrollToPos.from),Se(r,e.scrollToPos.to),e.scrollToPos.margin);Pg(t,s)}var u=e.maybeHiddenMarkers,f=e.maybeUnhiddenMarkers;if(u)for(var h=0;h<u.length;++h)u[h].lines.length||et(u[h],"hide");if(f)for(var g=0;g<f.length;++g)f[g].lines.length&&et(f[g],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&et(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Bt(e,t){if(e.curOp)return t();lr(e);try{return t()}finally{ur(e)}}function yt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);lr(e);try{return t.apply(e,arguments)}finally{ur(e)}}}function Et(e){return function(){if(this.curOp)return e.apply(this,arguments);lr(this);try{return e.apply(this,arguments)}finally{ur(this)}}}function bt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);lr(t);try{return e.apply(this,arguments)}finally{ur(t)}}}function Si(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,fe(Xg,e))}function Xg(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var i=+new Date+e.options.workTime,r=hi(e,t.highlightFrontier),s=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(r.line>=e.display.viewFrom){var f=u.styles,h=u.text.length>e.options.maxHighlightLength?mn(t.mode,r.state):null,g=Kl(e,u,r,!0);h&&(r.state=h),u.styles=g.styles;var v=u.styleClasses,C=g.classes;C?u.styleClasses=C:v&&(u.styleClasses=null);for(var _=!f||f.length!=u.styles.length||v!=C&&(!v||!C||v.bgClass!=C.bgClass||v.textClass!=C.textClass),R=0;!_&&R<f.length;++R)_=f[R]!=u.styles[R];_&&s.push(r.line),u.stateAfter=r.save(),r.nextLine()}else u.text.length<=e.options.maxHighlightLength&&ds(e,u.text,r),u.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Si(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),s.length&&Bt(e,function(){for(var u=0;u<s.length;u++)Bn(e,s[u],"text")})}}var xa=function(e,t,i){var r=e.display;this.viewport=t,this.visible=ya(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=nr(e),this.force=i,this.dims=Es(e),this.events=[]};xa.prototype.signal=function(e,t){zt(e,t)&&this.events.push(arguments)},xa.prototype.finish=function(){for(var e=0;e<this.events.length;e++)et.apply(null,this.events[e])};function Yg(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=yn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=yn(e)+"px",t.scrollbarsClipped=!0)}function Vg(e){if(e.hasFocus())return null;var t=F(oe(e));if(!t||!D(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=Z(e).getSelection();r.anchorNode&&r.extend&&D(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function Jg(e){if(!(!e||!e.activeElt||e.activeElt==F(Te(e.activeElt)))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode))){var t=e.activeElt.ownerDocument,i=t.defaultView.getSelection(),r=t.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),i.removeAllRanges(),i.addRange(r),i.extend(e.focusNode,e.focusOffset)}}function Ps(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return Hn(e),!1;if(!t.force&&t.visible.from>=i.viewFrom&&t.visible.to<=i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo)&&i.renderedView==i.view&&Iu(e)==0)return!1;Wu(e)&&(Hn(e),t.dims=Es(e));var s=r.first+r.size,u=Math.max(t.visible.from-e.options.viewportMargin,r.first),f=Math.min(s,t.visible.to+e.options.viewportMargin);i.viewFrom<u&&u-i.viewFrom<20&&(u=Math.max(r.first,i.viewFrom)),i.viewTo>f&&i.viewTo-f<20&&(f=Math.min(s,i.viewTo)),Tn&&(u=vs(e.doc,u),f=ou(e.doc,f));var h=u!=i.viewFrom||f!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Mg(e,u,f),i.viewOffset=_n(ce(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var g=Iu(e);if(!h&&g==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var v=Vg(e);return g>4&&(i.lineDiv.style.display="none"),Qg(e,i.updateLineNumbers,t.dims),g>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,Jg(v),j(i.cursorDiv),j(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,h&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Si(e,400)),i.updateLineNumbers=null,!0}function Bu(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==nr(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ks(e.display)-ws(e),i.top)}),t.visible=ya(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=ya(e.display,e.doc,i));if(!Ps(e,t))break;va(e);var s=ki(e);yi(e),Pr(e,s),Bs(e,s),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 $s(e,t){var i=new xa(e,t);if(Ps(e,i)){va(e),Bu(e,i);var r=ki(e);yi(e),Pr(e,r),Bs(e,r),i.finish()}}function Qg(e,t,i){var r=e.display,s=e.options.lineNumbers,u=r.lineDiv,f=u.firstChild;function h(H){var U=H.nextSibling;return S&&ne&&e.display.currentWheelTarget==H?H.style.display="none":H.parentNode.removeChild(H),U}for(var g=r.view,v=r.viewFrom,C=0;C<g.length;C++){var _=g[C];if(!_.hidden)if(!_.node||_.node.parentNode!=u){var R=Tg(e,_,v,i);u.insertBefore(R,f)}else{for(;f!=_.node;)f=h(f);var I=s&&t!=null&&t<=v&&_.lineNumber;_.changes&&(ke(_.changes,"gutter")>-1&&(I=!1),hu(e,_,v,i)),I&&(j(_.lineNumber),_.lineNumber.appendChild(document.createTextNode(Y(e.options,v)))),f=_.node.nextSibling}v+=_.size}for(;f;)f=h(f)}function zs(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",vt(e,"gutterChanged",e)}function Bs(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+yn(e)+"px"}function Hu(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Ds(t)-t.scroller.scrollLeft+e.doc.scrollLeft,s=t.gutters.offsetWidth,u=r+"px",f=0;f<i.length;f++)if(!i[f].hidden){e.options.fixedGutter&&(i[f].gutter&&(i[f].gutter.style.left=u),i[f].gutterBackground&&(i[f].gutterBackground.style.left=u));var h=i[f].alignable;if(h)for(var g=0;g<h.length;g++)h[g].style.left=u}e.options.fixedGutter&&(t.gutters.style.left=r+s+"px")}}function Wu(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=Y(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var s=r.measure.appendChild(k("div",[k("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),u=s.firstChild.offsetWidth,f=s.offsetWidth-u;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(u,r.lineGutter.offsetWidth-f)+1,r.lineNumWidth=r.lineNumInnerWidth+f,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",zs(e.display),!0}return!1}function Hs(e,t){for(var i=[],r=!1,s=0;s<e.length;s++){var u=e[s],f=null;if(typeof u!="string"&&(f=u.style,u=u.className),u=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:u,style:f})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function ju(e){var t=e.gutters,i=e.gutterSpecs;j(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var s=i[r],u=s.className,f=s.style,h=t.appendChild(k("div",null,"CodeMirror-gutter "+u));f&&(h.style.cssText=f),u=="CodeMirror-linenumbers"&&(e.lineGutter=h,h.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",zs(e)}function Ci(e){ju(e.display),Ot(e),Hu(e)}function Zg(e,t,i,r){var s=this;this.input=i,s.scrollbarFiller=k("div",null,"CodeMirror-scrollbar-filler"),s.scrollbarFiller.setAttribute("cm-not-content","true"),s.gutterFiller=k("div",null,"CodeMirror-gutter-filler"),s.gutterFiller.setAttribute("cm-not-content","true"),s.lineDiv=J("div",null,"CodeMirror-code"),s.selectionDiv=k("div",null,null,"position: relative; z-index: 1"),s.cursorDiv=k("div",null,"CodeMirror-cursors"),s.measure=k("div",null,"CodeMirror-measure"),s.lineMeasure=k("div",null,"CodeMirror-measure"),s.lineSpace=J("div",[s.measure,s.lineMeasure,s.selectionDiv,s.cursorDiv,s.lineDiv],null,"position: relative; outline: none");var u=J("div",[s.lineSpace],"CodeMirror-lines");s.mover=k("div",[u],null,"position: relative"),s.sizer=k("div",[s.mover],"CodeMirror-sizer"),s.sizerWidth=null,s.heightForcer=k("div",null,null,"position: absolute; height: "+Re+"px; width: 1px;"),s.gutters=k("div",null,"CodeMirror-gutters"),s.lineGutter=null,s.scroller=k("div",[s.sizer,s.heightForcer,s.gutters],"CodeMirror-scroll"),s.scroller.setAttribute("tabIndex","-1"),s.wrapper=k("div",[s.scrollbarFiller,s.gutterFiller,s.scroller],"CodeMirror"),E&&A===105&&(s.wrapper.style.clipPath="inset(0px)"),s.wrapper.setAttribute("translate","no"),m&&w<8&&(s.gutters.style.zIndex=-1,s.scroller.style.paddingRight=0),!S&&!(c&&X)&&(s.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(s.wrapper):e(s.wrapper)),s.viewFrom=s.viewTo=t.first,s.reportedViewFrom=s.reportedViewTo=t.first,s.view=[],s.renderedView=null,s.externalMeasured=null,s.viewOffset=0,s.lastWrapHeight=s.lastWrapWidth=0,s.updateLineNumbers=null,s.nativeBarWidth=s.barHeight=s.barWidth=0,s.scrollbarsClipped=!1,s.lineNumWidth=s.lineNumInnerWidth=s.lineNumChars=null,s.alignWidgets=!1,s.cachedCharWidth=s.cachedTextHeight=s.cachedPaddingH=null,s.maxLine=null,s.maxLineLength=0,s.maxLineChanged=!1,s.wheelDX=s.wheelDY=s.wheelStartX=s.wheelStartY=null,s.shift=!1,s.selForContextMenu=null,s.activeTouch=null,s.gutterSpecs=Hs(r.gutters,r.lineNumbers),ju(s),i.init(s)}var ka=0,En=null;m?En=-.53:c?En=15:E?En=-.7:B&&(En=-1/3);function qu(e){var t=e.wheelDeltaX,i=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),i==null&&e.detail&&e.axis==e.VERTICAL_AXIS?i=e.detail:i==null&&(i=e.wheelDelta),{x:t,y:i}}function em(e){var t=qu(e);return t.x*=En,t.y*=En,t}function Uu(e,t){E&&A==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 i=qu(t),r=i.x,s=i.y,u=En;t.deltaMode===0&&(r=t.deltaX,s=t.deltaY,u=1);var f=e.display,h=f.scroller,g=h.scrollWidth>h.clientWidth,v=h.scrollHeight>h.clientHeight;if(r&&g||s&&v){if(s&&ne&&S){e:for(var C=t.target,_=f.view;C!=h;C=C.parentNode)for(var R=0;R<_.length;R++)if(_[R].node==C){e.display.currentWheelTarget=C;break e}}if(r&&!c&&!z&&u!=null){s&&v&&xi(e,Math.max(0,h.scrollTop+s*u)),sr(e,Math.max(0,h.scrollLeft+r*u)),(!s||s&&v)&&Tt(t),f.wheelStartX=null;return}if(s&&u!=null){var I=s*u,H=e.doc.scrollTop,U=H+f.wrapper.clientHeight;I<0?H=Math.max(0,H+I-50):U=Math.min(e.doc.height,U+I+50),$s(e,{top:H,bottom:U})}ka<20&&t.deltaMode!==0&&(f.wheelStartX==null?(f.wheelStartX=h.scrollLeft,f.wheelStartY=h.scrollTop,f.wheelDX=r,f.wheelDY=s,setTimeout(function(){if(f.wheelStartX!=null){var V=h.scrollLeft-f.wheelStartX,ee=h.scrollTop-f.wheelStartY,ae=ee&&f.wheelDY&&ee/f.wheelDY||V&&f.wheelDX&&V/f.wheelDX;f.wheelStartX=f.wheelStartY=null,ae&&(En=(En*ka+ae)/(ka+1),++ka)}},200)):(f.wheelDX+=r,f.wheelDY+=s))}}var Xt=function(e,t){this.ranges=e,this.primIndex=t};Xt.prototype.primary=function(){return this.ranges[this.primIndex]},Xt.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 i=this.ranges[t],r=e.ranges[t];if(!ze(i.anchor,r.anchor)||!ze(i.head,r.head))return!1}return!0},Xt.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Be(mt(this.ranges[t].anchor),mt(this.ranges[t].head));return new Xt(e,this.primIndex)},Xt.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Xt.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(re(t,r.from())>=0&&re(e,r.to())<=0)return i}return-1};var Be=function(e,t){this.anchor=e,this.head=t};Be.prototype.from=function(){return Dr(this.anchor,this.head)},Be.prototype.to=function(){return It(this.anchor,this.head)},Be.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function hn(e,t,i){var r=e&&e.options.selectionsMayTouch,s=t[i];t.sort(function(R,I){return re(R.from(),I.from())}),i=ke(t,s);for(var u=1;u<t.length;u++){var f=t[u],h=t[u-1],g=re(h.to(),f.from());if(r&&!f.empty()?g>0:g>=0){var v=Dr(h.from(),f.from()),C=It(h.to(),f.to()),_=h.empty()?f.from()==f.head:h.from()==h.head;u<=i&&--i,t.splice(--u,2,new Be(_?C:v,_?v:C))}}return new Xt(t,i)}function Wn(e,t){return new Xt([new Be(e,t||e)],0)}function jn(e){return e.text?$(e.from.line+e.text.length-1,be(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Gu(e,t){if(re(e,t.from)<0)return e;if(re(e,t.to)<=0)return jn(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=jn(t).ch-t.to.ch),$(i,r)}function Ws(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var s=e.sel.ranges[r];i.push(new Be(Gu(s.anchor,t),Gu(s.head,t)))}return hn(e.cm,i,e.sel.primIndex)}function Ku(e,t,i){return e.line==t.line?$(i.line,e.ch-t.ch+i.ch):$(i.line+(e.line-t.line),e.ch)}function tm(e,t,i){for(var r=[],s=$(e.first,0),u=s,f=0;f<t.length;f++){var h=t[f],g=Ku(h.from,s,u),v=Ku(jn(h),s,u);if(s=h.to,u=v,i=="around"){var C=e.sel.ranges[f],_=re(C.head,C.anchor)<0;r[f]=new Be(_?v:g,_?g:v)}else r[f]=new Be(g,g)}return new Xt(r,e.sel.primIndex)}function js(e){e.doc.mode=_r(e.options,e.doc.modeOption),Ti(e)}function Ti(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,Si(e,100),e.state.modeGen++,e.curOp&&Ot(e)}function Xu(e,t){return t.from.ch==0&&t.to.ch==0&&be(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function qs(e,t,i,r){function s(ae){return i?i[ae]:null}function u(ae,te,le){ug(ae,te,le,r),vt(ae,"change",ae,t)}function f(ae,te){for(var le=[],ve=ae;ve<te;++ve)le.push(new Ar(v[ve],s(ve),r));return le}var h=t.from,g=t.to,v=t.text,C=ce(e,h.line),_=ce(e,g.line),R=be(v),I=s(v.length-1),H=g.line-h.line;if(t.full)e.insert(0,f(0,v.length)),e.remove(v.length,e.size-v.length);else if(Xu(e,t)){var U=f(0,v.length-1);u(_,_.text,I),H&&e.remove(h.line,H),U.length&&e.insert(h.line,U)}else if(C==_)if(v.length==1)u(C,C.text.slice(0,h.ch)+R+C.text.slice(g.ch),I);else{var V=f(1,v.length-1);V.push(new Ar(R+C.text.slice(g.ch),I,r)),u(C,C.text.slice(0,h.ch)+v[0],s(0)),e.insert(h.line+1,V)}else if(v.length==1)u(C,C.text.slice(0,h.ch)+v[0]+_.text.slice(g.ch),s(0)),e.remove(h.line+1,H);else{u(C,C.text.slice(0,h.ch)+v[0],s(0)),u(_,R+_.text.slice(g.ch),I);var ee=f(1,v.length-1);H>1&&e.remove(h.line+1,H-1),e.insert(h.line+1,ee)}vt(e,"change",e,t)}function qn(e,t,i){function r(s,u,f){if(s.linked)for(var h=0;h<s.linked.length;++h){var g=s.linked[h];if(g.doc!=u){var v=f&&g.sharedHist;i&&!v||(t(g.doc,v),r(g.doc,s,v))}}}r(e,null,!0)}function Yu(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,As(e),js(e),Vu(e),e.options.direction=t.direction,e.options.lineWrapping||bs(e),e.options.mode=t.modeOption,Ot(e)}function Vu(e){(e.doc.direction=="rtl"?K:$e)(e.display.lineDiv,"CodeMirror-rtl")}function nm(e){Bt(e,function(){Vu(e),Ot(e)})}function wa(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 Us(e,t){var i={from:mt(t.from),to:jn(t),text:Cn(e,t.from,t.to)};return Zu(e,i,t.from.line,t.to.line+1),qn(e,function(r){return Zu(r,i,t.from.line,t.to.line+1)},!0),i}function Ju(e){for(;e.length;){var t=be(e);if(t.ranges)e.pop();else break}}function rm(e,t){if(t)return Ju(e.done),be(e.done);if(e.done.length&&!be(e.done).ranges)return be(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),be(e.done)}function Qu(e,t,i,r){var s=e.history;s.undone.length=0;var u=+new Date,f,h;if((s.lastOp==r||s.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&s.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(f=rm(s,s.lastOp==r)))h=be(f.changes),re(t.from,t.to)==0&&re(t.from,h.to)==0?h.to=jn(t):f.changes.push(Us(e,t));else{var g=be(s.done);for((!g||!g.ranges)&&Sa(e.sel,s.done),f={changes:[Us(e,t)],generation:s.generation},s.done.push(f);s.done.length>s.undoDepth;)s.done.shift(),s.done[0].ranges||s.done.shift()}s.done.push(i),s.generation=++s.maxGeneration,s.lastModTime=s.lastSelTime=u,s.lastOp=s.lastSelOp=r,s.lastOrigin=s.lastSelOrigin=t.origin,h||et(e,"historyAdded")}function im(e,t,i,r){var s=t.charAt(0);return s=="*"||s=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function am(e,t,i,r){var s=e.history,u=r&&r.origin;i==s.lastSelOp||u&&s.lastSelOrigin==u&&(s.lastModTime==s.lastSelTime&&s.lastOrigin==u||im(e,u,be(s.done),t))?s.done[s.done.length-1]=t:Sa(t,s.done),s.lastSelTime=+new Date,s.lastSelOrigin=u,s.lastSelOp=i,r&&r.clearRedo!==!1&&Ju(s.undone)}function Sa(e,t){var i=be(t);i&&i.ranges&&i.equals(e)||t.push(e)}function Zu(e,t,i,r){var s=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(f){f.markedSpans&&((s||(s=t["spans_"+e.id]={}))[u]=f.markedSpans),++u})}function sm(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function om(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],s=0;s<t.text.length;++s)r.push(sm(i[s]));return r}function ec(e,t){var i=om(e,t),r=gs(e,t);if(!i)return r;if(!r)return i;for(var s=0;s<i.length;++s){var u=i[s],f=r[s];if(u&&f)e:for(var h=0;h<f.length;++h){for(var g=f[h],v=0;v<u.length;++v)if(u[v].marker==g.marker)continue e;u.push(g)}else f&&(i[s]=f)}return i}function $r(e,t,i){for(var r=[],s=0;s<e.length;++s){var u=e[s];if(u.ranges){r.push(i?Xt.prototype.deepCopy.call(u):u);continue}var f=u.changes,h=[];r.push({changes:h});for(var g=0;g<f.length;++g){var v=f[g],C=void 0;if(h.push({from:v.from,to:v.to,text:v.text}),t)for(var _ in v)(C=_.match(/^spans_(\d+)$/))&&ke(t,Number(C[1]))>-1&&(be(h)[_]=v[_],delete v[_])}}return r}function Gs(e,t,i,r){if(r){var s=e.anchor;if(i){var u=re(t,s)<0;u!=re(i,s)<0?(s=t,t=i):u!=re(t,i)<0&&(t=i)}return new Be(s,t)}else return new Be(i||t,t)}function Ca(e,t,i,r,s){s==null&&(s=e.cm&&(e.cm.display.shift||e.extend)),_t(e,new Xt([Gs(e.sel.primary(),t,i,s)],0),r)}function tc(e,t,i){for(var r=[],s=e.cm&&(e.cm.display.shift||e.extend),u=0;u<e.sel.ranges.length;u++)r[u]=Gs(e.sel.ranges[u],t[u],null,s);var f=hn(e.cm,r,e.sel.primIndex);_t(e,f,i)}function Ks(e,t,i,r){var s=e.sel.ranges.slice(0);s[t]=i,_t(e,hn(e.cm,s,e.sel.primIndex),r)}function nc(e,t,i,r){_t(e,Wn(t,i),r)}function lm(e,t,i){var r={ranges:t.ranges,update:function(s){this.ranges=[];for(var u=0;u<s.length;u++)this.ranges[u]=new Be(Se(e,s[u].anchor),Se(e,s[u].head))},origin:i&&i.origin};return et(e,"beforeSelectionChange",e,r),e.cm&&et(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?hn(e.cm,r.ranges,r.ranges.length-1):t}function rc(e,t,i){var r=e.history.done,s=be(r);s&&s.ranges?(r[r.length-1]=t,Ta(e,t,i)):_t(e,t,i)}function _t(e,t,i){Ta(e,t,i),am(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function Ta(e,t,i){(zt(e,"beforeSelectionChange")||e.cm&&zt(e.cm,"beforeSelectionChange"))&&(t=lm(e,t,i));var r=i&&i.bias||(re(t.primary().head,e.sel.primary().head)<0?-1:1);ic(e,sc(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&e.cm.getOption("readOnly")!="nocursor"&&Fr(e.cm)}function ic(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,en(e.cm)),vt(e,"cursorActivity",e))}function ac(e){ic(e,sc(e,e.sel,null,!1))}function sc(e,t,i,r){for(var s,u=0;u<t.ranges.length;u++){var f=t.ranges[u],h=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[u],g=_a(e,f.anchor,h&&h.anchor,i,r),v=f.head==f.anchor?g:_a(e,f.head,h&&h.head,i,r);(s||g!=f.anchor||v!=f.head)&&(s||(s=t.ranges.slice(0,u)),s[u]=new Be(g,v))}return s?hn(e.cm,s,t.primIndex):t}function zr(e,t,i,r,s){var u=ce(e,t.line);if(u.markedSpans)for(var f=0;f<u.markedSpans.length;++f){var h=u.markedSpans[f],g=h.marker,v="selectLeft"in g?!g.selectLeft:g.inclusiveLeft,C="selectRight"in g?!g.selectRight:g.inclusiveRight;if((h.from==null||(v?h.from<=t.ch:h.from<t.ch))&&(h.to==null||(C?h.to>=t.ch:h.to>t.ch))){if(s&&(et(g,"beforeCursorEnter"),g.explicitlyCleared))if(u.markedSpans){--f;continue}else break;if(!g.atomic)continue;if(i){var _=g.find(r<0?1:-1),R=void 0;if((r<0?C:v)&&(_=oc(e,_,-r,_&&_.line==t.line?u:null)),_&&_.line==t.line&&(R=re(_,i))&&(r<0?R<0:R>0))return zr(e,_,t,r,s)}var I=g.find(r<0?-1:1);return(r<0?v:C)&&(I=oc(e,I,r,I.line==t.line?u:null)),I?zr(e,I,t,r,s):null}}return t}function _a(e,t,i,r,s){var u=r||1,f=zr(e,t,i,u,s)||!s&&zr(e,t,i,u,!0)||zr(e,t,i,-u,s)||!s&&zr(e,t,i,-u,!0);return f||(e.cantEdit=!0,$(e.first,0))}function oc(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?Se(e,$(t.line-1)):null:i>0&&t.ch==(r||ce(e,t.line)).text.length?t.line<e.first+e.size-1?$(t.line+1,0):null:new $(t.line,t.ch+i)}function lc(e){e.setSelection($(e.firstLine(),0),$(e.lastLine()),ft)}function uc(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return i&&(r.update=function(s,u,f,h){s&&(r.from=Se(e,s)),u&&(r.to=Se(e,u)),f&&(r.text=f),h!==void 0&&(r.origin=h)}),et(e,"beforeChange",e,r),e.cm&&et(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 Br(e,t,i){if(e.cm){if(!e.cm.curOp)return yt(e.cm,Br)(e,t,i);if(e.cm.state.suppressEdits)return}if(!((zt(e,"beforeChange")||e.cm&&zt(e.cm,"beforeChange"))&&(t=uc(e,t,!0),!t))){var r=eu&&!i&&ag(e,t.from,t.to);if(r)for(var s=r.length-1;s>=0;--s)cc(e,{from:r[s].from,to:r[s].to,text:s?[""]:t.text,origin:t.origin});else cc(e,t)}}function cc(e,t){if(!(t.text.length==1&&t.text[0]==""&&re(t.from,t.to)==0)){var i=Ws(e,t);Qu(e,t,i,e.cm?e.cm.curOp.id:NaN),_i(e,t,i,gs(e,t));var r=[];qn(e,function(s,u){!u&&ke(r,s.history)==-1&&(pc(s.history,t),r.push(s.history)),_i(s,t,null,gs(s,t))})}}function La(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var s=e.history,u,f=e.sel,h=t=="undo"?s.done:s.undone,g=t=="undo"?s.undone:s.done,v=0;v<h.length&&(u=h[v],!(i?u.ranges&&!u.equals(e.sel):!u.ranges));v++);if(v!=h.length){for(s.lastOrigin=s.lastSelOrigin=null;;)if(u=h.pop(),u.ranges){if(Sa(u,g),i&&!u.equals(e.sel)){_t(e,u,{clearRedo:!1});return}f=u}else if(r){h.push(u);return}else break;var C=[];Sa(f,g),g.push({changes:C,generation:s.generation}),s.generation=u.generation||++s.maxGeneration;for(var _=zt(e,"beforeChange")||e.cm&&zt(e.cm,"beforeChange"),R=function(U){var V=u.changes[U];if(V.origin=t,_&&!uc(e,V,!1))return h.length=0,{};C.push(Us(e,V));var ee=U?Ws(e,V):be(h);_i(e,V,ee,ec(e,V)),!U&&e.cm&&e.cm.scrollIntoView({from:V.from,to:jn(V)});var ae=[];qn(e,function(te,le){!le&&ke(ae,te.history)==-1&&(pc(te.history,V),ae.push(te.history)),_i(te,V,null,ec(te,V))})},I=u.changes.length-1;I>=0;--I){var H=R(I);if(H)return H.v}}}}function fc(e,t){if(t!=0&&(e.first+=t,e.sel=new Xt(wt(e.sel.ranges,function(s){return new Be($(s.anchor.line+t,s.anchor.ch),$(s.head.line+t,s.head.ch))}),e.sel.primIndex),e.cm)){Ot(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)Bn(e.cm,r,"gutter")}}function _i(e,t,i,r){if(e.cm&&!e.cm.curOp)return yt(e.cm,_i)(e,t,i,r);if(t.to.line<e.first){fc(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 s=t.text.length-1-(e.first-t.from.line);fc(e,s),t={from:$(e.first,0),to:$(t.to.line+s,t.to.ch),text:[be(t.text)],origin:t.origin}}var u=e.lastLine();t.to.line>u&&(t={from:t.from,to:$(u,ce(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Cn(e,t.from,t.to),i||(i=Ws(e,t)),e.cm?um(e.cm,t,r):qs(e,t,r),Ta(e,i,ft),e.cantEdit&&_a(e,$(e.firstLine(),0))&&(e.cantEdit=!1)}}function um(e,t,i){var r=e.doc,s=e.display,u=t.from,f=t.to,h=!1,g=u.line;e.options.lineWrapping||(g=b(cn(ce(r,u.line))),r.iter(g,f.line+1,function(I){if(I==s.maxLine)return h=!0,!0})),r.sel.contains(t.from,t.to)>-1&&en(e),qs(r,t,i,Au(e)),e.options.lineWrapping||(r.iter(g,u.line+t.text.length,function(I){var H=ca(I);H>s.maxLineLength&&(s.maxLine=I,s.maxLineLength=H,s.maxLineChanged=!0,h=!1)}),h&&(e.curOp.updateMaxLine=!0)),Qp(r,u.line),Si(e,400);var v=t.text.length-(f.line-u.line)-1;t.full?Ot(e):u.line==f.line&&t.text.length==1&&!Xu(e.doc,t)?Bn(e,u.line,"text"):Ot(e,u.line,f.line+1,v);var C=zt(e,"changes"),_=zt(e,"change");if(_||C){var R={from:u,to:f,text:t.text,removed:t.removed,origin:t.origin};_&&vt(e,"change",e,R),C&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(R)}e.display.selForContextMenu=null}function Hr(e,t,i,r,s){var u;r||(r=i),re(r,i)<0&&(u=[r,i],i=u[0],r=u[1]),typeof t=="string"&&(t=e.splitLines(t)),Br(e,{from:i,to:r,text:t,origin:s})}function hc(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function dc(e,t,i,r){for(var s=0;s<e.length;++s){var u=e[s],f=!0;if(u.ranges){u.copied||(u=e[s]=u.deepCopy(),u.copied=!0);for(var h=0;h<u.ranges.length;h++)hc(u.ranges[h].anchor,t,i,r),hc(u.ranges[h].head,t,i,r);continue}for(var g=0;g<u.changes.length;++g){var v=u.changes[g];if(i<v.from.line)v.from=$(v.from.line+r,v.from.ch),v.to=$(v.to.line+r,v.to.ch);else if(t<=v.to.line){f=!1;break}}f||(e.splice(0,s+1),s=0)}}function pc(e,t){var i=t.from.line,r=t.to.line,s=t.text.length-(r-i)-1;dc(e.done,i,r,s),dc(e.undone,i,r,s)}function Li(e,t,i,r){var s=t,u=t;return typeof t=="number"?u=ce(e,Ul(e,t)):s=b(t),s==null?null:(r(u,s)&&e.cm&&Bn(e.cm,s,i),u)}function Ei(e){this.lines=e,this.parent=null;for(var t=0,i=0;i<e.length;++i)e[i].parent=this,t+=e[i].height;this.height=t}Ei.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var s=this.lines[i];this.height-=s.height,cg(s),vt(s,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,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,i){for(var r=e+t;e<r;++e)if(i(this.lines[e]))return!0}};function Di(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var s=e[r];t+=s.chunkSize(),i+=s.height,s.parent=this}this.size=t,this.height=i,this.parent=null}Di.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],s=r.chunkSize();if(e<s){var u=Math.min(t,s-e),f=r.height;if(r.removeInner(e,u),this.height-=f-r.height,s==u&&(this.children.splice(i--,1),r.parent=null),(t-=u)==0)break;e=0}else e-=s}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ei))){var h=[];this.collapse(h),this.children=[new Ei(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,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var s=this.children[r],u=s.chunkSize();if(e<=u){if(s.insertInner(e,t,i),s.lines&&s.lines.length>50){for(var f=s.lines.length%25+25,h=f;h<s.lines.length;){var g=new Ei(s.lines.slice(h,h+=25));s.height-=g.height,this.children.splice(++r,0,g),g.parent=this}s.lines=s.lines.slice(0,f),this.maybeSpill()}break}e-=u}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new Di(t);if(e.parent){e.size-=i.size,e.height-=i.height;var s=ke(e.parent.children,e);e.parent.children.splice(s+1,0,i)}else{var r=new Di(e.children);r.parent=e,e.children=[r,i],e=r}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var s=this.children[r],u=s.chunkSize();if(e<u){var f=Math.min(t,u-e);if(s.iterN(e,f,i))return!0;if((t-=f)==0)break;e=0}else e-=u}}};var Ai=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};Ai.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=b(i);if(!(r==null||!t)){for(var s=0;s<t.length;++s)t[s]==this&&t.splice(s--,1);t.length||(i.widgets=null);var u=mi(this);Kt(i,Math.max(0,i.height-u)),e&&(Bt(e,function(){gc(e,i,-u),Bn(e,r,"widget")}),vt(e,"lineWidgetCleared",e,this,r))}},Ai.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var s=mi(this)-t;s&&(zn(this.doc,r)||Kt(r,r.height+s),i&&Bt(i,function(){i.curOp.forceUpdate=!0,gc(i,r,s),vt(i,"lineWidgetChanged",i,e,b(r))}))},an(Ai);function gc(e,t,i){_n(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Fs(e,i)}function cm(e,t,i,r){var s=new Ai(e,i,r),u=e.cm;return u&&s.noHScroll&&(u.display.alignWidgets=!0),Li(e,t,"widget",function(f){var h=f.widgets||(f.widgets=[]);if(s.insertAt==null?h.push(s):h.splice(Math.min(h.length,Math.max(0,s.insertAt)),0,s),s.line=f,u&&!zn(e,f)){var g=_n(f)<e.scrollTop;Kt(f,f.height+mi(s)),g&&Fs(u,s.height),u.curOp.forceUpdate=!0}return!0}),u&&vt(u,"lineWidgetAdded",u,s,typeof t=="number"?t:b(t)),s}var mc=0,Un=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++mc};Un.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&lr(e),zt(this,"clear")){var i=this.find();i&&vt(this,"clear",i.from,i.to)}for(var r=null,s=null,u=0;u<this.lines.length;++u){var f=this.lines[u],h=di(f.markedSpans,this);e&&!this.collapsed?Bn(e,b(f),"text"):e&&(h.to!=null&&(s=b(f)),h.from!=null&&(r=b(f))),f.markedSpans=tg(f.markedSpans,h),h.from==null&&this.collapsed&&!zn(this.doc,f)&&e&&Kt(f,Nr(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var g=0;g<this.lines.length;++g){var v=cn(this.lines[g]),C=ca(v);C>e.display.maxLineLength&&(e.display.maxLine=v,e.display.maxLineLength=C,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&Ot(e,r,s+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&ac(e.doc)),e&&vt(e,"markerCleared",e,this,r,s),t&&ur(e),this.parent&&this.parent.clear()}},Un.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,s=0;s<this.lines.length;++s){var u=this.lines[s],f=di(u.markedSpans,this);if(f.from!=null&&(i=$(t?u:b(u),f.from),e==-1))return i;if(f.to!=null&&(r=$(t?u:b(u),f.to),e==1))return r}return i&&{from:i,to:r}},Un.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;!t||!r||Bt(r,function(){var s=t.line,u=b(t.line),f=Ss(r,u);if(f&&(wu(f),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!zn(i.doc,s)&&i.height!=null){var h=i.height;i.height=null;var g=mi(i)-h;g&&Kt(s,s.height+g)}vt(r,"markerChanged",r,e)})},Un.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ke(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Un.prototype.detachLine=function(e){if(this.lines.splice(ke(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},an(Un);function Wr(e,t,i,r,s){if(r&&r.shared)return fm(e,t,i,r,s);if(e.cm&&!e.cm.curOp)return yt(e.cm,Wr)(e,t,i,r,s);var u=new Un(e,s),f=re(t,i);if(r&&we(r,u,!1),f>0||f==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=J("span",[u.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(su(e,t.line,t,i,u)||t.line!=i.line&&su(e,i.line,t,i,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");eg()}u.addToHistory&&Qu(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var h=t.line,g=e.cm,v;if(e.iter(h,i.line+1,function(_){g&&u.collapsed&&!g.options.lineWrapping&&cn(_)==g.display.maxLine&&(v=!0),u.collapsed&&h!=t.line&&Kt(_,0),ng(_,new sa(u,h==t.line?t.ch:null,h==i.line?i.ch:null),e.cm&&e.cm.curOp),++h}),u.collapsed&&e.iter(t.line,i.line+1,function(_){zn(e,_)&&Kt(_,0)}),u.clearOnEnter&&me(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(Zp(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++mc,u.atomic=!0),g){if(v&&(g.curOp.updateMaxLine=!0),u.collapsed)Ot(g,t.line,i.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(var C=t.line;C<=i.line;C++)Bn(g,C,"text");u.atomic&&ac(g.doc),vt(g,"markerAdded",g,u)}return u}var Ii=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};Ii.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();vt(this,"clear")}},Ii.prototype.find=function(e,t){return this.primary.find(e,t)},an(Ii);function fm(e,t,i,r,s){r=we(r),r.shared=!1;var u=[Wr(e,t,i,r,s)],f=u[0],h=r.widgetNode;return qn(e,function(g){h&&(r.widgetNode=h.cloneNode(!0)),u.push(Wr(g,Se(g,t),Se(g,i),r,s));for(var v=0;v<g.linked.length;++v)if(g.linked[v].isParent)return;f=be(u)}),new Ii(u,f)}function vc(e){return e.findMarks($(e.first,0),e.clipPos($(e.lastLine())),function(t){return t.parent})}function hm(e,t){for(var i=0;i<t.length;i++){var r=t[i],s=r.find(),u=e.clipPos(s.from),f=e.clipPos(s.to);if(re(u,f)){var h=Wr(e,u,f,r.primary,r.primary.type);r.markers.push(h),h.parent=r}}}function dm(e){for(var t=function(r){var s=e[r],u=[s.primary.doc];qn(s.primary.doc,function(g){return u.push(g)});for(var f=0;f<s.markers.length;f++){var h=s.markers[f];ke(u,h.doc)==-1&&(h.parent=null,s.markers.splice(f--,1))}},i=0;i<e.length;i++)t(i)}var pm=0,Nt=function(e,t,i,r,s){if(!(this instanceof Nt))return new Nt(e,t,i,r,s);i==null&&(i=0),Di.call(this,[new Ei([new Ar("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var u=$(i,0);this.sel=Wn(u),this.history=new wa(null),this.id=++pm,this.modeOption=t,this.lineSep=r,this.direction=s=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),qs(this,{from:u,to:u,text:e}),_t(this,Wn(u),ft)};Nt.prototype=Zn(Di.prototype,{constructor:Nt,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=fi(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:bt(function(e){var t=$(this.first,0),i=this.first+this.size-1;Br(this,{from:t,to:$(i,ce(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&bi(this.cm,0,0),_t(this,Wn(t),ft)}),replaceRange:function(e,t,i,r){t=Se(this,t),i=i?Se(this,i):t,Hr(this,e,t,i,r)},getRange:function(e,t,i){var r=Cn(this,Se(this,e),Se(this,t));return i===!1?r:i===""?r.join(""):r.join(i||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(q(this,e))return ce(this,e)},getLineNumber:function(e){return b(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ce(this,e)),cn(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Se(this,e)},getCursor:function(e){var t=this.sel.primary(),i;return e==null||e=="head"?i=t.head:e=="anchor"?i=t.anchor:e=="end"||e=="to"||e===!1?i=t.to():i=t.from(),i},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:bt(function(e,t,i){nc(this,Se(this,typeof e=="number"?$(e,t||0):e),null,i)}),setSelection:bt(function(e,t,i){nc(this,Se(this,e),Se(this,t||e),i)}),extendSelection:bt(function(e,t,i){Ca(this,Se(this,e),t&&Se(this,t),i)}),extendSelections:bt(function(e,t){tc(this,Gl(this,e),t)}),extendSelectionsBy:bt(function(e,t){var i=wt(this.sel.ranges,e);tc(this,Gl(this,i),t)}),setSelections:bt(function(e,t,i){if(e.length){for(var r=[],s=0;s<e.length;s++)r[s]=new Be(Se(this,e[s].anchor),Se(this,e[s].head||e[s].anchor));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),_t(this,hn(this.cm,r,t),i)}}),addSelection:bt(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new Be(Se(this,e),Se(this,t||e))),_t(this,hn(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var s=Cn(this,t[r].from(),t[r].to());i=i?i.concat(s):s}return e===!1?i:i.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var s=Cn(this,i[r].from(),i[r].to());e!==!1&&(s=s.join(e||this.lineSeparator())),t[r]=s}return t},replaceSelection:function(e,t,i){for(var r=[],s=0;s<this.sel.ranges.length;s++)r[s]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:bt(function(e,t,i){for(var r=[],s=this.sel,u=0;u<s.ranges.length;u++){var f=s.ranges[u];r[u]={from:f.from(),to:f.to(),text:this.splitLines(e[u]),origin:i}}for(var h=t&&t!="end"&&tm(this,r,t),g=r.length-1;g>=0;g--)Br(this,r[g]);h?rc(this,h):this.cm&&Fr(this.cm)}),undo:bt(function(){La(this,"undo")}),redo:bt(function(){La(this,"redo")}),undoSelection:bt(function(){La(this,"undo",!0)}),redoSelection:bt(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,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var s=0;s<e.undone.length;s++)e.undone[s].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new wa(this.history),qn(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:$r(this.history.done),undone:$r(this.history.undone)}},setHistory:function(e){var t=this.history=new wa(this.history);t.done=$r(e.done.slice(0),null,!0),t.undone=$r(e.undone.slice(0),null,!0)},setGutterMarker:bt(function(e,t,i){return Li(this,e,"gutter",function(r){var s=r.gutterMarkers||(r.gutterMarkers={});return s[t]=i,!i&&pe(s)&&(r.gutterMarkers=null),!0})}),clearGutter:bt(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Li(t,i,"gutter",function(){return i.gutterMarkers[e]=null,pe(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!q(this,e)||(t=e,e=ce(this,e),!e))return null}else if(t=b(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:bt(function(e,t,i){return Li(this,e,t=="gutter"?"gutter":"class",function(r){var s=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[s])r[s]=i;else{if(ie(i).test(r[s]))return!1;r[s]+=" "+i}return!0})}),removeLineClass:bt(function(e,t,i){return Li(this,e,t=="gutter"?"gutter":"class",function(r){var s=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",u=r[s];if(u)if(i==null)r[s]=null;else{var f=u.match(ie(i));if(!f)return!1;var h=f.index+f[0].length;r[s]=u.slice(0,f.index)+(!f.index||h==u.length?"":" ")+u.slice(h)||null}else return!1;return!0})}),addLineWidget:bt(function(e,t,i){return cm(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return Wr(this,Se(this,e),Se(this,t),i,i&&i.type||"range")},setBookmark:function(e,t){var i={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=Se(this,e),Wr(this,e,e,i,"bookmark")},findMarksAt:function(e){e=Se(this,e);var t=[],i=ce(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var s=i[r];(s.from==null||s.from<=e.ch)&&(s.to==null||s.to>=e.ch)&&t.push(s.marker.parent||s.marker)}return t},findMarks:function(e,t,i){e=Se(this,e),t=Se(this,t);var r=[],s=e.line;return this.iter(e.line,t.line+1,function(u){var f=u.markedSpans;if(f)for(var h=0;h<f.length;h++){var g=f[h];!(g.to!=null&&s==e.line&&e.ch>=g.to||g.from==null&&s!=e.line||g.from!=null&&s==t.line&&g.from>=t.ch)&&(!i||i(g.marker))&&r.push(g.marker.parent||g.marker)}++s}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)i[r].from!=null&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first,r=this.lineSeparator().length;return this.iter(function(s){var u=s.text.length+r;if(u>e)return t=e,!0;e-=u,++i}),Se(this,$(i,t))},indexFromPos:function(e){e=Se(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var i=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+i}),t},copy:function(e){var t=new Nt(fi(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,i=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<i&&(i=e.to);var r=new Nt(fi(this,t,i),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}],hm(r,vc(this)),r},unlinkDoc:function(e){if(e instanceof Ve&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var i=this.linked[t];if(i.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),dm(vc(this));break}}if(e.history==this.history){var r=[e.id];qn(e,function(s){return r.push(s.id)},!0),e.history=new wa(null),e.history.done=$r(this.history.done,r),e.history.undone=$r(this.history.undone,r)}},iterLinkedDocs:function(e){qn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):tn(e)},lineSeparator:function(){return this.lineSep||`
11
+ `},setDirection:bt(function(e){e!="rtl"&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&nm(this.cm))})}),Nt.prototype.eachLine=Nt.prototype.iter;var yc=0;function gm(e){var t=this;if(bc(t),!(tt(t,e)||Ln(t.display,e))){Tt(e),m&&(yc=+new Date);var i=ir(t,e,!0),r=e.dataTransfer.files;if(!(!i||t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File)for(var s=r.length,u=Array(s),f=0,h=function(){++f==s&&yt(t,function(){i=Se(t.doc,i);var I={from:i,to:i,text:t.doc.splitLines(u.filter(function(H){return H!=null}).join(t.doc.lineSeparator())),origin:"paste"};Br(t.doc,I),rc(t.doc,Wn(Se(t.doc,i),Se(t.doc,jn(I))))})()},g=function(I,H){if(t.options.allowDropFileTypes&&ke(t.options.allowDropFileTypes,I.type)==-1){h();return}var U=new FileReader;U.onerror=function(){return h()},U.onload=function(){var V=U.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(V)){h();return}u[H]=V,h()},U.readAsText(I)},v=0;v<r.length;v++)g(r[v],v);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var C=e.dataTransfer.getData("Text");if(C){var _;if(t.state.draggingText&&!t.state.draggingText.copy&&(_=t.listSelections()),Ta(t.doc,Wn(i,i)),_)for(var R=0;R<_.length;++R)Hr(t.doc,"",_[R].anchor,_[R].head,"drag");t.replaceSelection(C,"around","paste"),t.display.input.focus()}}catch{}}}}function mm(e,t){if(m&&(!e.state.draggingText||+new Date-yc<100)){Mn(t);return}if(!(tt(e,t)||Ln(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!B)){var i=k("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",z&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),z&&i.parentNode.removeChild(i)}}function vm(e,t){var i=ir(e,t);if(i){var r=document.createDocumentFragment();Is(e,i,r),e.display.dragCursor||(e.display.dragCursor=k("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Q(e.display.dragCursor,r)}}function bc(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function xc(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var s=t[r].CodeMirror;s&&i.push(s)}i.length&&i[0].operation(function(){for(var u=0;u<i.length;u++)e(i[u])})}}var kc=!1;function ym(){kc||(bm(),kc=!0)}function bm(){var e;me(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,xc(xm)},100))}),me(window,"blur",function(){return xc(Mr)})}function xm(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Gn={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"},Oi=0;Oi<10;Oi++)Gn[Oi+48]=Gn[Oi+96]=String(Oi);for(var Ea=65;Ea<=90;Ea++)Gn[Ea]=String.fromCharCode(Ea);for(var Ni=1;Ni<=12;Ni++)Gn[Ni+111]=Gn[Ni+63235]="F"+Ni;var Dn={};Dn.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"},Dn.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"},Dn.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"},Dn.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"]},Dn.default=ne?Dn.macDefault:Dn.pcDefault;function km(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,s,u,f=0;f<t.length-1;f++){var h=t[f];if(/^(cmd|meta|m)$/i.test(h))u=!0;else if(/^a(lt)?$/i.test(h))i=!0;else if(/^(c|ctrl|control)$/i.test(h))r=!0;else if(/^s(hift)?$/i.test(h))s=!0;else throw new Error("Unrecognized modifier name: "+h)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),u&&(e="Cmd-"+e),s&&(e="Shift-"+e),e}function wm(e){var t={};for(var i in e)if(e.hasOwnProperty(i)){var r=e[i];if(/^(name|fallthrough|(de|at)tach)$/.test(i))continue;if(r=="..."){delete e[i];continue}for(var s=wt(i.split(" "),km),u=0;u<s.length;u++){var f=void 0,h=void 0;u==s.length-1?(h=s.join(" "),f=r):(h=s.slice(0,u+1).join(" "),f="...");var g=t[h];if(!g)t[h]=f;else if(g!=f)throw new Error("Inconsistent bindings for "+h)}delete e[i]}for(var v in t)e[v]=t[v];return e}function jr(e,t,i,r){t=Da(t);var s=t.call?t.call(e,r):t[e];if(s===!1)return"nothing";if(s==="...")return"multi";if(s!=null&&i(s))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return jr(e,t.fallthrough,i,r);for(var u=0;u<t.fallthrough.length;u++){var f=jr(e,t.fallthrough[u],i,r);if(f)return f}}}function wc(e){var t=typeof e=="string"?e:Gn[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Sc(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(Oe?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(Oe?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function Cc(e,t){if(z&&e.keyCode==34&&e.char)return!1;var i=Gn[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),Sc(i,e,t))}function Da(e){return typeof e=="string"?Dn[e]:e}function qr(e,t){for(var i=e.doc.sel.ranges,r=[],s=0;s<i.length;s++){for(var u=t(i[s]);r.length&&re(u.from,be(r).to)<=0;){var f=r.pop();if(re(f.from,u.from)<0){u.from=f.from;break}}r.push(u)}Bt(e,function(){for(var h=r.length-1;h>=0;h--)Hr(e.doc,"",r[h].from,r[h].to,"+delete");Fr(e)})}function Xs(e,t,i){var r=$t(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ys(e,t,i){var r=Xs(e,t.ch,i);return r==null?null:new $(t.line,r,i<0?"after":"before")}function Vs(e,t,i,r,s){if(e){t.doc.direction=="rtl"&&(s=-s);var u=Pe(i,t.doc.direction);if(u){var f=s<0?be(u):u[0],h=s<0==(f.level==1),g=h?"after":"before",v;if(f.level>0||t.doc.direction=="rtl"){var C=Or(t,i);v=s<0?i.text.length-1:0;var _=bn(t,C,v).top;v=Zt(function(R){return bn(t,C,R).top==_},s<0==(f.level==1)?f.from:f.to-1,v),g=="before"&&(v=Xs(i,v,1))}else v=s<0?f.to:f.from;return new $(r,v,g)}}return new $(r,s<0?i.text.length:0,s<0?"before":"after")}function Sm(e,t,i,r){var s=Pe(t,e.doc.direction);if(!s)return Ys(t,i,r);i.ch>=t.text.length?(i.ch=t.text.length,i.sticky="before"):i.ch<=0&&(i.ch=0,i.sticky="after");var u=Rn(s,i.ch,i.sticky),f=s[u];if(e.doc.direction=="ltr"&&f.level%2==0&&(r>0?f.to>i.ch:f.from<i.ch))return Ys(t,i,r);var h=function(ee,ae){return Xs(t,ee instanceof $?ee.ch:ee,ae)},g,v=function(ee){return e.options.lineWrapping?(g=g||Or(e,t),Du(e,t,g,ee)):{begin:0,end:t.text.length}},C=v(i.sticky=="before"?h(i,-1):i.ch);if(e.doc.direction=="rtl"||f.level==1){var _=f.level==1==r<0,R=h(i,_?1:-1);if(R!=null&&(_?R<=f.to&&R<=C.end:R>=f.from&&R>=C.begin)){var I=_?"before":"after";return new $(i.line,R,I)}}var H=function(ee,ae,te){for(var le=function(qe,xt){return xt?new $(i.line,h(qe,1),"before"):new $(i.line,qe,"after")};ee>=0&&ee<s.length;ee+=ae){var ve=s[ee],ge=ae>0==(ve.level!=1),Ae=ge?te.begin:h(te.end,-1);if(ve.from<=Ae&&Ae<ve.to||(Ae=ge?ve.from:h(ve.to,-1),te.begin<=Ae&&Ae<te.end))return le(Ae,ge)}},U=H(u+r,r,C);if(U)return U;var V=r>0?C.end:h(C.begin,-1);return V!=null&&!(r>0&&V==t.text.length)&&(U=H(r>0?0:s.length-1,r,v(V)),U)?U:null}var Ri={selectAll:lc,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ft)},killLine:function(e){return qr(e,function(t){if(t.empty()){var i=ce(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:$(t.head.line+1,0)}:{from:t.head,to:$(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return qr(e,function(t){return{from:$(t.from().line,0),to:Se(e.doc,$(t.to().line+1,0))}})},delLineLeft:function(e){return qr(e,function(t){return{from:$(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return qr(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return qr(e,function(t){var i=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"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($(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection($(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Tc(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return _c(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Cm(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},ht)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},ht)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var i=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:i},"div");return r.ch<e.getLine(r.line).search(/\S/)?_c(e,t.head):r},ht)},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=[],i=e.listSelections(),r=e.options.tabSize,s=0;s<i.length;s++){var u=i[s].from(),f=_e(e.getLine(u.line),u.ch,r);t.push(Ut(r-f%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Bt(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++)if(t[r].empty()){var s=t[r].head,u=ce(e.doc,s.line).text;if(u){if(s.ch==u.length&&(s=new $(s.line,s.ch-1)),s.ch>0)s=new $(s.line,s.ch+1),e.replaceRange(u.charAt(s.ch-1)+u.charAt(s.ch-2),$(s.line,s.ch-2),s,"+transpose");else if(s.line>e.doc.first){var f=ce(e.doc,s.line-1).text;f&&(s=new $(s.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+f.charAt(f.length-1),$(s.line-1,f.length-1),s,"+transpose"))}}i.push(new Be(s,s))}e.setSelections(i)})},newlineAndIndent:function(e){return Bt(e,function(){for(var t=e.listSelections(),i=t.length-1;i>=0;i--)e.replaceRange(e.doc.lineSeparator(),t[i].anchor,t[i].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);Fr(e)})},openLine:function(e){return e.replaceSelection(`
12
+ `,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Tc(e,t){var i=ce(e.doc,t),r=cn(i);return r!=i&&(t=b(r)),Vs(!0,e,r,t,1)}function Cm(e,t){var i=ce(e.doc,t),r=og(i);return r!=i&&(t=b(r)),Vs(!0,e,i,t,-1)}function _c(e,t){var i=Tc(e,t.line),r=ce(e.doc,i.line),s=Pe(r,e.doc.direction);if(!s||s[0].level==0){var u=Math.max(i.ch,r.text.search(/\S/)),f=t.line==i.line&&t.ch<=u&&t.ch;return $(i.line,f?0:u,i.sticky)}return i}function Aa(e,t,i){if(typeof t=="string"&&(t=Ri[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,s=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),s=t(e)!=Ke}finally{e.display.shift=r,e.state.suppressEdits=!1}return s}function Tm(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var s=jr(t,e.state.keyMaps[r],i,e);if(s)return s}return e.options.extraKeys&&jr(t,e.options.extraKeys,i,e)||jr(t,e.options.keyMap,i,e)}var _m=new ct;function Mi(e,t,i,r){var s=e.state.keySeq;if(s){if(wc(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:_m.set(50,function(){e.state.keySeq==s&&(e.state.keySeq=null,e.display.input.reset())}),Lc(e,s+" "+t,i,r))return!0}return Lc(e,t,i,r)}function Lc(e,t,i,r){var s=Tm(e,t,r);return s=="multi"&&(e.state.keySeq=t),s=="handled"&&vt(e,"keyHandled",e,t,i),(s=="handled"||s=="multi")&&(Tt(i),Os(e)),!!s}function Ec(e,t){var i=Cc(t,!0);return i?t.shiftKey&&!e.state.keySeq?Mi(e,"Shift-"+i,t,function(r){return Aa(e,r,!0)})||Mi(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Aa(e,r)}):Mi(e,i,t,function(r){return Aa(e,r)}):!1}function Lm(e,t,i){return Mi(e,"'"+i+"'",t,function(r){return Aa(e,r,!0)})}var Js=null;function Dc(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=F(oe(t)),!tt(t,e))){m&&w<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=Ec(t,e);z&&(Js=r?i:null,!r&&i==88&&!ia&&(ne?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),c&&!ne&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Em(t)}}function Em(e){var t=e.display.lineDiv;K(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&($e(t,"CodeMirror-crosshair"),Ct(document,"keyup",i),Ct(document,"mouseover",i))}me(document,"keyup",i),me(document,"mouseover",i)}function Ac(e){e.keyCode==16&&(this.doc.sel.shift=!1),tt(this,e)}function Ic(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(Ln(t.display,e)||tt(t,e)||e.ctrlKey&&!e.altKey||ne&&e.metaKey)){var i=e.keyCode,r=e.charCode;if(z&&i==Js){Js=null,Tt(e);return}if(!(z&&(!e.which||e.which<10)&&Ec(t,e))){var s=String.fromCharCode(r??i);s!="\b"&&(Lm(t,e,s)||t.display.input.onKeyPress(e))}}}var Dm=400,Qs=function(e,t,i){this.time=e,this.pos=t,this.button=i};Qs.prototype.compare=function(e,t,i){return this.time+Dm>e&&re(t,this.pos)==0&&i==this.button};var Fi,Pi;function Am(e,t){var i=+new Date;return Pi&&Pi.compare(i,e,t)?(Fi=Pi=null,"triple"):Fi&&Fi.compare(i,e,t)?(Pi=new Qs(i,e,t),Fi=null,"double"):(Fi=new Qs(i,e,t),Pi=null,"single")}function Oc(e){var t=this,i=t.display;if(!(tt(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,Ln(i,e)){S||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Zs(t,e)){var r=ir(t,e),s=sn(e),u=r?Am(r,s):"single";Z(t).focus(),s==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Im(t,s,r,u,e))&&(s==1?r?Nm(t,r,u,e):li(e)==i.scroller&&Tt(e):s==2?(r&&Ca(t.doc,r),setTimeout(function(){return i.input.focus()},20)):s==3&&(Me?t.display.input.onContextMenu(e):Ns(t)))}}}function Im(e,t,i,r,s){var u="Click";return r=="double"?u="Double"+u:r=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,Mi(e,Sc(u,s),s,function(f){if(typeof f=="string"&&(f=Ri[f]),!f)return!1;var h=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),h=f(e,i)!=Ke}finally{e.state.suppressEdits=!1}return h})}function Om(e,t,i){var r=e.getOption("configureMouse"),s=r?r(e,t,i):{};if(s.unit==null){var u=ue?i.shiftKey&&i.metaKey:i.altKey;s.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(s.extend==null||e.doc.extend)&&(s.extend=e.doc.extend||i.shiftKey),s.addNew==null&&(s.addNew=ne?i.metaKey:i.ctrlKey),s.moveOnDrag==null&&(s.moveOnDrag=!(ne?i.altKey:i.ctrlKey)),s}function Nm(e,t,i,r){m?setTimeout(fe(Nu,e),0):e.curOp.focus=F(oe(e));var s=Om(e,i,r),u=e.doc.sel,f;e.options.dragDrop&&fs&&!e.isReadOnly()&&i=="single"&&(f=u.contains(t))>-1&&(re((f=u.ranges[f]).from(),t)<0||t.xRel>0)&&(re(f.to(),t)>0||t.xRel<0)?Rm(e,r,t,s):Mm(e,r,t,s)}function Rm(e,t,i,r){var s=e.display,u=!1,f=yt(e,function(v){S&&(s.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ns(e)),Ct(s.wrapper.ownerDocument,"mouseup",f),Ct(s.wrapper.ownerDocument,"mousemove",h),Ct(s.scroller,"dragstart",g),Ct(s.scroller,"drop",f),u||(Tt(v),r.addNew||Ca(e.doc,i,null,null,r.extend),S&&!B||m&&w==9?setTimeout(function(){s.wrapper.ownerDocument.body.focus({preventScroll:!0}),s.input.focus()},20):s.input.focus())}),h=function(v){u=u||Math.abs(t.clientX-v.clientX)+Math.abs(t.clientY-v.clientY)>=10},g=function(){return u=!0};S&&(s.scroller.draggable=!0),e.state.draggingText=f,f.copy=!r.moveOnDrag,me(s.wrapper.ownerDocument,"mouseup",f),me(s.wrapper.ownerDocument,"mousemove",h),me(s.scroller,"dragstart",g),me(s.scroller,"drop",f),e.state.delayingBlurEvent=!0,setTimeout(function(){return s.input.focus()},20),s.scroller.dragDrop&&s.scroller.dragDrop()}function Nc(e,t,i){if(i=="char")return new Be(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Be($(t.line,0),Se(e.doc,$(t.line+1,0)));var r=i(e,t);return new Be(r.from,r.to)}function Mm(e,t,i,r){m&&Ns(e);var s=e.display,u=e.doc;Tt(t);var f,h,g=u.sel,v=g.ranges;if(r.addNew&&!r.extend?(h=u.sel.contains(i),h>-1?f=v[h]:f=new Be(i,i)):(f=u.sel.primary(),h=u.sel.primIndex),r.unit=="rectangle")r.addNew||(f=new Be(i,i)),i=ir(e,t,!0,!0),h=-1;else{var C=Nc(e,i,r.unit);r.extend?f=Gs(f,C.anchor,C.head,r.extend):f=C}r.addNew?h==-1?(h=v.length,_t(u,hn(e,v.concat([f]),h),{scroll:!1,origin:"*mouse"})):v.length>1&&v[h].empty()&&r.unit=="char"&&!r.extend?(_t(u,hn(e,v.slice(0,h).concat(v.slice(h+1)),0),{scroll:!1,origin:"*mouse"}),g=u.sel):Ks(u,h,f,Pt):(h=0,_t(u,new Xt([f],0),Pt),g=u.sel);var _=i;function R(te){if(re(_,te)!=0)if(_=te,r.unit=="rectangle"){for(var le=[],ve=e.options.tabSize,ge=_e(ce(u,i.line).text,i.ch,ve),Ae=_e(ce(u,te.line).text,te.ch,ve),qe=Math.min(ge,Ae),xt=Math.max(ge,Ae),Qe=Math.min(i.line,te.line),Ht=Math.min(e.lastLine(),Math.max(i.line,te.line));Qe<=Ht;Qe++){var Rt=ce(u,Qe).text,lt=dt(Rt,qe,ve);qe==xt?le.push(new Be($(Qe,lt),$(Qe,lt))):Rt.length>lt&&le.push(new Be($(Qe,lt),$(Qe,dt(Rt,xt,ve))))}le.length||le.push(new Be(i,i)),_t(u,hn(e,g.ranges.slice(0,h).concat(le),h),{origin:"*mouse",scroll:!1}),e.scrollIntoView(te)}else{var Mt=f,St=Nc(e,te,r.unit),pt=Mt.anchor,ut;re(St.anchor,pt)>0?(ut=St.head,pt=Dr(Mt.from(),St.anchor)):(ut=St.anchor,pt=It(Mt.to(),St.head));var rt=g.ranges.slice(0);rt[h]=Fm(e,new Be(Se(u,pt),ut)),_t(u,hn(e,rt,h),Pt)}}var I=s.wrapper.getBoundingClientRect(),H=0;function U(te){var le=++H,ve=ir(e,te,!0,r.unit=="rectangle");if(ve)if(re(ve,_)!=0){e.curOp.focus=F(oe(e)),R(ve);var ge=ya(s,u);(ve.line>=ge.to||ve.line<ge.from)&&setTimeout(yt(e,function(){H==le&&U(te)}),150)}else{var Ae=te.clientY<I.top?-20:te.clientY>I.bottom?20:0;Ae&&setTimeout(yt(e,function(){H==le&&(s.scroller.scrollTop+=Ae,U(te))}),50)}}function V(te){e.state.selectingText=!1,H=1/0,te&&(Tt(te),s.input.focus()),Ct(s.wrapper.ownerDocument,"mousemove",ee),Ct(s.wrapper.ownerDocument,"mouseup",ae),u.history.lastSelOrigin=null}var ee=yt(e,function(te){te.buttons===0||!sn(te)?V(te):U(te)}),ae=yt(e,V);e.state.selectingText=ae,me(s.wrapper.ownerDocument,"mousemove",ee),me(s.wrapper.ownerDocument,"mouseup",ae)}function Fm(e,t){var i=t.anchor,r=t.head,s=ce(e.doc,i.line);if(re(i,r)==0&&i.sticky==r.sticky)return t;var u=Pe(s);if(!u)return t;var f=Rn(u,i.ch,i.sticky),h=u[f];if(h.from!=i.ch&&h.to!=i.ch)return t;var g=f+(h.from==i.ch==(h.level!=1)?0:1);if(g==0||g==u.length)return t;var v;if(r.line!=i.line)v=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var C=Rn(u,r.ch,r.sticky),_=C-f||(r.ch-i.ch)*(h.level==1?-1:1);C==g-1||C==g?v=_<0:v=_>0}var R=u[g+(v?-1:0)],I=v==(R.level==1),H=I?R.from:R.to,U=I?"after":"before";return i.ch==H&&i.sticky==U?t:new Be(new $(i.line,H,U),r)}function Rc(e,t,i,r){var s,u;if(t.touches)s=t.touches[0].clientX,u=t.touches[0].clientY;else try{s=t.clientX,u=t.clientY}catch{return!1}if(s>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Tt(t);var f=e.display,h=f.lineDiv.getBoundingClientRect();if(u>h.bottom||!zt(e,i))return At(t);u-=h.top-f.viewOffset;for(var g=0;g<e.display.gutterSpecs.length;++g){var v=f.gutters.childNodes[g];if(v&&v.getBoundingClientRect().right>=s){var C=T(e.doc,u),_=e.display.gutterSpecs[g];return et(e,i,e,C,_.className,t),At(t)}}}function Zs(e,t){return Rc(e,t,"gutterClick",!0)}function Mc(e,t){Ln(e.display,t)||Pm(e,t)||tt(e,t,"contextmenu")||Me||e.display.input.onContextMenu(t)}function Pm(e,t){return zt(e,"gutterContextMenu")?Rc(e,t,"gutterContextMenu",!1):!1}function Fc(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),vi(e)}var Ur={toString:function(){return"CodeMirror.Init"}},Pc={},Ia={};function $m(e){var t=e.optionHandlers;function i(r,s,u,f){e.defaults[r]=s,u&&(t[r]=f?function(h,g,v){v!=Ur&&u(h,g,v)}:u)}e.defineOption=i,e.Init=Ur,i("value","",function(r,s){return r.setValue(s)},!0),i("mode",null,function(r,s){r.doc.modeOption=s,js(r)},!0),i("indentUnit",2,js,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Ti(r),vi(r),Ot(r)},!0),i("lineSeparator",null,function(r,s){if(r.doc.lineSep=s,!!s){var u=[],f=r.doc.first;r.doc.iter(function(g){for(var v=0;;){var C=g.text.indexOf(s,v);if(C==-1)break;v=C+s.length,u.push($(f,C))}f++});for(var h=u.length-1;h>=0;h--)Hr(r.doc,s,u[h],$(u[h].line,u[h].ch+s.length))}}),i("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,s,u){r.state.specialChars=new RegExp(s.source+(s.test(" ")?"":"| "),"g"),u!=Ur&&r.refresh()}),i("specialCharPlaceholder",dg,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",X?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,s){return r.getInputField().spellcheck=s},!0),i("autocorrect",!1,function(r,s){return r.getInputField().autocorrect=s},!0),i("autocapitalize",!1,function(r,s){return r.getInputField().autocapitalize=s},!0),i("rtlMoveVisually",!se),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Fc(r),Ci(r)},!0),i("keyMap","default",function(r,s,u){var f=Da(s),h=u!=Ur&&Da(u);h&&h.detach&&h.detach(r,f),f.attach&&f.attach(r,h||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Bm,!0),i("gutters",[],function(r,s){r.display.gutterSpecs=Hs(s,r.options.lineNumbers),Ci(r)},!0),i("fixedGutter",!0,function(r,s){r.display.gutters.style.left=s?Ds(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return Pr(r)},!0),i("scrollbarStyle","native",function(r){zu(r),Pr(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,s){r.display.gutterSpecs=Hs(r.options.gutters,s),Ci(r)},!0),i("firstLineNumber",1,Ci,!0),i("lineNumberFormatter",function(r){return r},Ci,!0),i("showCursorWhenSelecting",!1,yi,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,s){s=="nocursor"&&(Mr(r),r.display.input.blur()),r.display.input.readOnlyChanged(s)}),i("screenReaderLabel",null,function(r,s){s=s===""?null:s,r.display.input.screenReaderLabelChanged(s)}),i("disableInput",!1,function(r,s){s||r.display.input.reset()},!0),i("dragDrop",!0,zm),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,yi,!0),i("singleCursorHeightPerLine",!0,yi,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Ti,!0),i("addModeClass",!1,Ti,!0),i("pollInterval",100),i("undoDepth",200,function(r,s){return r.doc.history.undoDepth=s}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Ti,!0),i("moveInputWithCursor",!0,function(r,s){s||r.display.input.resetPosition()}),i("tabindex",null,function(r,s){return r.display.input.getField().tabIndex=s||""}),i("autofocus",null),i("direction","ltr",function(r,s){return r.doc.setDirection(s)},!0),i("phrases",null)}function zm(e,t,i){var r=i&&i!=Ur;if(!t!=!r){var s=e.display.dragFunctions,u=t?me:Ct;u(e.display.scroller,"dragstart",s.start),u(e.display.scroller,"dragenter",s.enter),u(e.display.scroller,"dragover",s.over),u(e.display.scroller,"dragleave",s.leave),u(e.display.scroller,"drop",s.drop)}}function Bm(e){e.options.lineWrapping?(K(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):($e(e.display.wrapper,"CodeMirror-wrap"),bs(e)),As(e),Ot(e),vi(e),setTimeout(function(){return Pr(e)},100)}function Ve(e,t){var i=this;if(!(this instanceof Ve))return new Ve(e,t);this.options=t=t?we(t):{},we(Pc,t,!1);var r=t.value;typeof r=="string"?r=new Nt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var s=new Ve.inputStyles[t.inputStyle](this),u=this.display=new Zg(e,r,s,t);u.wrapper.CodeMirror=this,Fc(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),zu(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 ct,keySeq:null,specialChars:null},t.autofocus&&!X&&u.input.focus(),m&&w<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Hm(this),ym(),lr(this),this.curOp.forceUpdate=!0,Yu(this,r),t.autofocus&&!X||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Rs(i)},20):Mr(this);for(var f in Ia)Ia.hasOwnProperty(f)&&Ia[f](this,t[f],Ur);Wu(this),t.finishInit&&t.finishInit(this);for(var h=0;h<eo.length;++h)eo[h](this);ur(this),S&&t.lineWrapping&&getComputedStyle(u.lineDiv).textRendering=="optimizelegibility"&&(u.lineDiv.style.textRendering="auto")}Ve.defaults=Pc,Ve.optionHandlers=Ia;function Hm(e){var t=e.display;me(t.scroller,"mousedown",yt(e,Oc)),m&&w<11?me(t.scroller,"dblclick",yt(e,function(g){if(!tt(e,g)){var v=ir(e,g);if(!(!v||Zs(e,g)||Ln(e.display,g))){Tt(g);var C=e.findWordAt(v);Ca(e.doc,C.anchor,C.head)}}})):me(t.scroller,"dblclick",function(g){return tt(e,g)||Tt(g)}),me(t.scroller,"contextmenu",function(g){return Mc(e,g)}),me(t.input.getField(),"contextmenu",function(g){t.scroller.contains(g.target)||Mc(e,g)});var i,r={end:0};function s(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function u(g){if(g.touches.length!=1)return!1;var v=g.touches[0];return v.radiusX<=1&&v.radiusY<=1}function f(g,v){if(v.left==null)return!0;var C=v.left-g.left,_=v.top-g.top;return C*C+_*_>20*20}me(t.scroller,"touchstart",function(g){if(!tt(e,g)&&!u(g)&&!Zs(e,g)){t.input.ensurePolled(),clearTimeout(i);var v=+new Date;t.activeTouch={start:v,moved:!1,prev:v-r.end<=300?r:null},g.touches.length==1&&(t.activeTouch.left=g.touches[0].pageX,t.activeTouch.top=g.touches[0].pageY)}}),me(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),me(t.scroller,"touchend",function(g){var v=t.activeTouch;if(v&&!Ln(t,g)&&v.left!=null&&!v.moved&&new Date-v.start<300){var C=e.coordsChar(t.activeTouch,"page"),_;!v.prev||f(v,v.prev)?_=new Be(C,C):!v.prev.prev||f(v,v.prev.prev)?_=e.findWordAt(C):_=new Be($(C.line,0),Se(e.doc,$(C.line+1,0))),e.setSelection(_.anchor,_.head),e.focus(),Tt(g)}s()}),me(t.scroller,"touchcancel",s),me(t.scroller,"scroll",function(){t.scroller.clientHeight&&(xi(e,t.scroller.scrollTop),sr(e,t.scroller.scrollLeft,!0),et(e,"scroll",e))}),me(t.scroller,"mousewheel",function(g){return Uu(e,g)}),me(t.scroller,"DOMMouseScroll",function(g){return Uu(e,g)}),me(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(g){tt(e,g)||Mn(g)},over:function(g){tt(e,g)||(vm(e,g),Mn(g))},start:function(g){return mm(e,g)},drop:yt(e,gm),leave:function(g){tt(e,g)||bc(e)}};var h=t.input.getField();me(h,"keyup",function(g){return Ac.call(e,g)}),me(h,"keydown",yt(e,Dc)),me(h,"keypress",yt(e,Ic)),me(h,"focus",function(g){return Rs(e,g)}),me(h,"blur",function(g){return Mr(e,g)})}var eo=[];Ve.defineInitHook=function(e){return eo.push(e)};function $i(e,t,i,r){var s=e.doc,u;i==null&&(i="add"),i=="smart"&&(s.mode.indent?u=hi(e,t).state:i="prev");var f=e.options.tabSize,h=ce(s,t),g=_e(h.text,null,f);h.stateAfter&&(h.stateAfter=null);var v=h.text.match(/^\s*/)[0],C;if(!r&&!/\S/.test(h.text))C=0,i="not";else if(i=="smart"&&(C=s.mode.indent(u,h.text.slice(v.length),h.text),C==Ke||C>150)){if(!r)return;i="prev"}i=="prev"?t>s.first?C=_e(ce(s,t-1).text,null,f):C=0:i=="add"?C=g+e.options.indentUnit:i=="subtract"?C=g-e.options.indentUnit:typeof i=="number"&&(C=g+i),C=Math.max(0,C);var _="",R=0;if(e.options.indentWithTabs)for(var I=Math.floor(C/f);I;--I)R+=f,_+=" ";if(R<C&&(_+=Ut(C-R)),_!=v)return Hr(s,_,$(t,0),$(t,v.length),"+input"),h.stateAfter=null,!0;for(var H=0;H<s.sel.ranges.length;H++){var U=s.sel.ranges[H];if(U.head.line==t&&U.head.ch<v.length){var V=$(t,v.length);Ks(s,H,new Be(V,V));break}}}var dn=null;function Oa(e){dn=e}function to(e,t,i,r,s){var u=e.doc;e.display.shift=!1,r||(r=u.sel);var f=+new Date-200,h=s=="paste"||e.state.pasteIncoming>f,g=tn(t),v=null;if(h&&r.ranges.length>1)if(dn&&dn.text.join(`
13
+ `)==t){if(r.ranges.length%dn.text.length==0){v=[];for(var C=0;C<dn.text.length;C++)v.push(u.splitLines(dn.text[C]))}}else g.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(v=wt(g,function(ee){return[ee]}));for(var _=e.curOp.updateInput,R=r.ranges.length-1;R>=0;R--){var I=r.ranges[R],H=I.from(),U=I.to();I.empty()&&(i&&i>0?H=$(H.line,H.ch-i):e.state.overwrite&&!h?U=$(U.line,Math.min(ce(u,U.line).text.length,U.ch+be(g).length)):h&&dn&&dn.lineWise&&dn.text.join(`
14
14
  `)==g.join(`
15
- `)&&(z=q=P(z.line,0)));var V={from:z,to:q,text:v?v[M%v.length]:g,origin:s||(h?"paste":e.state.cutIncoming>c?"cut":"+input")};Br(e.doc,V),vt(e,"inputRead",e,V)}t&&!h&&Bf(e,t),Fr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=_),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function $f(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&Bt(t,function(){return to(t,i,0,null,"paste")}),!0}function Bf(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var s=i.ranges[r];if(!(s.head.ch>100||r&&i.ranges[r-1].head.line==s.head.line)){var u=e.getModeAt(s.head),c=!1;if(u.electricChars){for(var h=0;h<u.electricChars.length;h++)if(t.indexOf(u.electricChars.charAt(h))>-1){c=zi(e,s.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(fe(e.doc,s.head.line).text.slice(0,s.head.ch))&&(c=zi(e,s.head.line,"smart"));c&&vt(e,"electricInput",e,s.head.line)}}}function Hf(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var s=e.doc.sel.ranges[r].head.line,u={anchor:P(s,0),head:P(s+1,0)};i.push(u),t.push(e.getRange(u.anchor,u.head))}return{text:t,ranges:i}}function no(e,t,i,r){e.setAttribute("autocorrect",i?"on":"off"),e.setAttribute("autocapitalize",r?"on":"off"),e.setAttribute("spellcheck",!!t)}function Wf(){var e=k("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=k("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return S?e.style.width="1000px":e.setAttribute("wrap","off"),O&&(e.style.border="1px solid black"),t}function Wm(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){Z(this).focus(),this.display.input.focus()},setOption:function(r,s){var u=this.options,c=u[r];u[r]==s&&r!="mode"||(u[r]=s,t.hasOwnProperty(r)&&yt(this,t[r])(this,s,c),et(this,"optionChange",this,r))},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,s){this.state.keyMaps[s?"push":"unshift"](Da(r))},removeKeyMap:function(r){for(var s=this.state.keyMaps,u=0;u<s.length;++u)if(s[u]==r||s[u].name==r)return s.splice(u,1),!0},addOverlay:Et(function(r,s){var u=r.token?r:e.getMode(this.options,r);if(u.startState)throw new Error("Overlays may not be stateful.");Gt(this.state.overlays,{mode:u,modeSpec:r,opaque:s&&s.opaque,priority:s&&s.priority||0},function(c){return c.priority}),this.state.modeGen++,Ot(this)}),removeOverlay:Et(function(r){for(var s=this.state.overlays,u=0;u<s.length;++u){var c=s[u].modeSpec;if(c==r||typeof r=="string"&&c.name==r){s.splice(u,1),this.state.modeGen++,Ot(this);return}}}),indentLine:Et(function(r,s,u){typeof s!="string"&&typeof s!="number"&&(s==null?s=this.options.smartIndent?"smart":"prev":s=s?"add":"subtract"),j(this.doc,r)&&zi(this,r,s,u)}),indentSelection:Et(function(r){for(var s=this.doc.sel.ranges,u=-1,c=0;c<s.length;c++){var h=s[c];if(h.empty())h.head.line>u&&(zi(this,h.head.line,r,!0),u=h.head.line,c==this.doc.sel.primIndex&&Fr(this));else{var g=h.from(),v=h.to(),C=Math.max(u,g.line);u=Math.min(this.lastLine(),v.line-(v.ch?0:1))+1;for(var _=C;_<u;++_)zi(this,_,r);var M=this.doc.sel.ranges;g.ch==0&&s.length==M.length&&M[c].from().ch>0&&Ks(this.doc,c,new Be(g,M[c].to()),ct)}}}),getTokenAt:function(r,s){return Jl(this,r,s)},getLineTokens:function(r,s){return Jl(this,P(r),s,!0)},getTokenTypeAt:function(r){r=Se(this.doc,r);var s=Xl(this,fe(this.doc,r.line)),u=0,c=(s.length-1)/2,h=r.ch,g;if(h==0)g=s[2];else for(;;){var v=u+c>>1;if((v?s[v*2-1]:0)>=h)c=v;else if(s[v*2+1]<h)u=v+1;else{g=s[v*2+2];break}}var C=g?g.indexOf("overlay "):-1;return C<0?g:C==0?null:g.slice(0,C-1)},getModeAt:function(r){var s=this.doc.mode;return s.innerMode?e.innerMode(s,this.getTokenAt(r).state).mode:s},getHelper:function(r,s){return this.getHelpers(r,s)[0]},getHelpers:function(r,s){var u=[];if(!i.hasOwnProperty(s))return u;var c=i[s],h=this.getModeAt(r);if(typeof h[s]=="string")c[h[s]]&&u.push(c[h[s]]);else if(h[s])for(var g=0;g<h[s].length;g++){var v=c[h[s][g]];v&&u.push(v)}else h.helperType&&c[h.helperType]?u.push(c[h.helperType]):c[h.name]&&u.push(c[h.name]);for(var C=0;C<c._global.length;C++){var _=c._global[C];_.pred(h,this)&&we(u,_.val)==-1&&u.push(_.val)}return u},getStateAfter:function(r,s){var u=this.doc;return r=Ul(u,r??u.first+u.size-1),hi(this,r+1,s).state},cursorCoords:function(r,s){var u,c=this.doc.sel.primary();return r==null?u=c.head:typeof r=="object"?u=Se(this.doc,r):u=r?c.from():c.to(),cn(this,u,s||"page")},charCoords:function(r,s){return pa(this,Se(this.doc,r),s||"page")},coordsChar:function(r,s){return r=_u(this,r,s||"page"),_s(this,r.left,r.top)},lineAtHeight:function(r,s){return r=_u(this,{top:r,left:0},s||"page").top,T(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,s,u){var c=!1,h;if(typeof r=="number"){var g=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>g&&(r=g,c=!0),h=fe(this.doc,r)}else h=r;return da(this,h,{top:0,left:0},s||"page",u||c).top+(c?this.doc.height-Tn(h):0)},defaultTextHeight:function(){return Nr(this.display)},defaultCharWidth:function(){return Mr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,s,u,c,h){var g=this.display;r=cn(this,Se(this.doc,r));var v=r.bottom,C=r.left;if(s.style.position="absolute",s.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(s),g.sizer.appendChild(s),c=="over")v=r.top;else if(c=="above"||c=="near"){var _=Math.max(g.wrapper.clientHeight,this.doc.height),M=Math.max(g.sizer.clientWidth,g.lineSpace.clientWidth);(c=="above"||r.bottom+s.offsetHeight>_)&&r.top>s.offsetHeight?v=r.top-s.offsetHeight:r.bottom+s.offsetHeight<=_&&(v=r.bottom),C+s.offsetWidth>M&&(C=M-s.offsetWidth)}s.style.top=v+"px",s.style.left=s.style.right="",h=="right"?(C=g.sizer.clientWidth-s.offsetWidth,s.style.right="0px"):(h=="left"?C=0:h=="middle"&&(C=(g.sizer.clientWidth-s.offsetWidth)/2),s.style.left=C+"px"),u&&$g(this,{left:C,top:v,right:C+s.offsetWidth,bottom:v+s.offsetHeight})},triggerOnKeyDown:Et(Af),triggerOnKeyPress:Et(Of),triggerOnKeyUp:If,triggerOnMouseDown:Et(Nf),execCommand:function(r){if(Mi.hasOwnProperty(r))return Mi[r].call(null,this)},triggerElectric:Et(function(r){Bf(this,r)}),findPosH:function(r,s,u,c){var h=1;s<0&&(h=-1,s=-s);for(var g=Se(this.doc,r),v=0;v<s&&(g=ro(this.doc,g,h,u,c),!g.hitSide);++v);return g},moveH:Et(function(r,s){var u=this;this.extendSelectionsBy(function(c){return u.display.shift||u.doc.extend||c.empty()?ro(u.doc,c.head,r,s,u.options.rtlMoveVisually):r<0?c.from():c.to()},ht)}),deleteH:Et(function(r,s){var u=this.doc.sel,c=this.doc;u.somethingSelected()?c.replaceSelection("",null,"+delete"):qr(this,function(h){var g=ro(c,h.head,r,s,!1);return r<0?{from:g,to:h.head}:{from:h.head,to:g}})}),findPosV:function(r,s,u,c){var h=1,g=c;s<0&&(h=-1,s=-s);for(var v=Se(this.doc,r),C=0;C<s;++C){var _=cn(this,v,"div");if(g==null?g=_.left:_.left=g,v=jf(this,_,h,u),v.hitSide)break}return v},moveV:Et(function(r,s){var u=this,c=this.doc,h=[],g=!this.display.shift&&!c.extend&&c.sel.somethingSelected();if(c.extendSelectionsBy(function(C){if(g)return r<0?C.from():C.to();var _=cn(u,C.head,"div");C.goalColumn!=null&&(_.left=C.goalColumn),h.push(_.left);var M=jf(u,_,r,s);return s=="page"&&C==c.sel.primary()&&Fs(u,pa(u,M,"div").top-_.top),M},ht),h.length)for(var v=0;v<c.sel.ranges.length;v++)c.sel.ranges[v].goalColumn=h[v]}),findWordAt:function(r){var s=this.doc,u=fe(s,r.line).text,c=r.ch,h=r.ch;if(u){var g=this.getHelper(r,"wordChars");(r.sticky=="before"||h==u.length)&&c?--c:++h;for(var v=u.charAt(c),C=xe(v,g)?function(_){return xe(_,g)}:/\s/.test(v)?function(_){return/\s/.test(_)}:function(_){return!/\s/.test(_)&&!xe(_)};c>0&&C(u.charAt(c-1));)--c;for(;h<u.length&&C(u.charAt(h));)++h}return new Be(P(r.line,c),P(r.line,h))},toggleOverwrite:function(r){r!=null&&r==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?K(this.display.cursorDiv,"CodeMirror-overwrite"):ze(this.display.cursorDiv,"CodeMirror-overwrite"),et(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==R(oe(this))},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Et(function(r,s){bi(this,r,s)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-yn(this)-this.display.barHeight,width:r.scrollWidth-yn(this)-this.display.barWidth,clientHeight:ks(this),clientWidth:nr(this)}},scrollIntoView:Et(function(r,s){r==null?(r={from:this.doc.sel.primary().head,to:null},s==null&&(s=this.options.cursorScrollMargin)):typeof r=="number"?r={from:P(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=s||0,r.from.line!=null?Bg(this,r):Ru(this,r.from,r.to,r.margin)}),setSize:Et(function(r,s){var u=this,c=function(g){return typeof g=="number"||/^\d+$/.test(String(g))?g+"px":g};r!=null&&(this.display.wrapper.style.width=c(r)),s!=null&&(this.display.wrapper.style.height=c(s)),this.options.lineWrapping&&Su(this);var h=this.display.viewFrom;this.doc.iter(h,this.display.viewTo,function(g){if(g.widgets){for(var v=0;v<g.widgets.length;v++)if(g.widgets[v].noHScroll){Bn(u,h,"widget");break}}++h}),this.curOp.forceUpdate=!0,et(this,"refresh",this)}),operation:function(r){return Bt(this,r)},startOperation:function(){return lr(this)},endOperation:function(){return ur(this)},refresh:Et(function(){var r=this.display.cachedTextHeight;Ot(this),this.curOp.forceUpdate=!0,vi(this),bi(this,this.doc.scrollLeft,this.doc.scrollTop),$s(this.display),(r==null||Math.abs(r-Nr(this.display))>.5||this.options.lineWrapping)&&As(this),et(this,"refresh",this)}),swapDoc:Et(function(r){var s=this.doc;return s.cm=null,this.state.selectingText&&this.state.selectingText(),Yu(this,r),vi(this),this.display.input.reset(),bi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,vt(this,"swapDoc",this,s),s}),phrase:function(r){var s=this.options.phrases;return s&&Object.prototype.hasOwnProperty.call(s,r)?s[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}},an(e),e.registerHelper=function(r,s,u){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][s]=u},e.registerGlobalHelper=function(r,s,u,c){e.registerHelper(r,s,c),i[r]._global.push({pred:u,val:c})}}function ro(e,t,i,r,s){var u=t,c=i,h=fe(e,t.line),g=s&&e.direction=="rtl"?-i:i;function v(){var ae=t.line+g;return ae<e.first||ae>=e.first+e.size?!1:(t=new P(ae,t.ch,t.sticky),h=fe(e,ae))}function C(ae){var te;if(r=="codepoint"){var le=h.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(le))te=null;else{var ve=i>0?le>=55296&&le<56320:le>=56320&&le<57343;te=new P(t.line,Math.max(0,Math.min(h.text.length,t.ch+i*(ve?2:1))),-i)}}else s?te=Sm(e.cm,h,t,i):te=Ys(h,t,i);if(te==null)if(!ae&&v())t=Vs(s,e.cm,h,t.line,g);else return!1;else t=te;return!0}if(r=="char"||r=="codepoint")C();else if(r=="column")C(!0);else if(r=="word"||r=="group")for(var _=null,M=r=="group",I=e.cm&&e.cm.getHelper(t,"wordChars"),z=!0;!(i<0&&!C(!z));z=!1){var q=h.text.charAt(t.ch)||`
16
- `,V=xe(q,I)?"w":M&&q==`
17
- `?"n":!M||/\s/.test(q)?null:"p";if(M&&!z&&!V&&(V="s"),_&&_!=V){i<0&&(i=1,C(),t.sticky="after");break}if(V&&(_=V),i>0&&!C(!z))break}var ee=_a(e,t,u,c,!0);return $e(u,ee)&&(ee.hitSide=!0),ee}function jf(e,t,i,r){var s=e.doc,u=t.left,c;if(r=="page"){var h=Math.min(e.display.wrapper.clientHeight,Z(e).innerHeight||s(e).documentElement.clientHeight),g=Math.max(h-.5*Nr(e.display),3);c=(i>0?t.bottom:t.top)+i*g}else r=="line"&&(c=i>0?t.bottom+3:t.top-3);for(var v;v=_s(e,u,c),!!v.outside;){if(i<0?c<=0:c>=s.height){v.hitSide=!0;break}c+=i*5}return v}var We=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ft,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};We.prototype.init=function(e){var t=this,i=this,r=i.cm,s=i.div=e.lineDiv;s.contentEditable=!0,no(s,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function u(h){for(var g=h.target;g;g=g.parentNode){if(g==s)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(g.className))break}return!1}me(s,"paste",function(h){!u(h)||tt(r,h)||$f(h,r)||x<=11&&setTimeout(yt(r,function(){return t.updateFromDOM()}),20)}),me(s,"compositionstart",function(h){t.composing={data:h.data,done:!1}}),me(s,"compositionupdate",function(h){t.composing||(t.composing={data:h.data,done:!1})}),me(s,"compositionend",function(h){t.composing&&(h.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),me(s,"touchstart",function(){return i.forceCompositionEnd()}),me(s,"input",function(){t.composing||t.readFromDOMSoon()});function c(h){if(!(!u(h)||tt(r,h))){if(r.somethingSelected())Oa({lineWise:!1,text:r.getSelections()}),h.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var g=Hf(r);Oa({lineWise:!0,text:g.text}),h.type=="cut"&&r.operation(function(){r.setSelections(g.ranges,0,ct),r.replaceSelection("",null,"cut")})}else return;if(h.clipboardData){h.clipboardData.clearData();var v=dn.text.join(`
18
- `);if(h.clipboardData.setData("Text",v),h.clipboardData.getData("Text")==v){h.preventDefault();return}}var C=Wf(),_=C.firstChild;no(_),r.display.lineSpace.insertBefore(C,r.display.lineSpace.firstChild),_.value=dn.text.join(`
19
- `);var M=R(Te(s));L(_),setTimeout(function(){r.display.lineSpace.removeChild(C),M.focus(),M==s&&i.showPrimarySelection()},50)}}me(s,"copy",c),me(s,"cut",c)},We.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},We.prototype.prepareSelection=function(){var e=Ou(this.cm,!1);return e.focus=R(Te(this.div))==this.div,e},We.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},We.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},We.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),s=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||s.line<t.display.viewFrom){e.removeAllRanges();return}var u=Na(t,e.anchorNode,e.anchorOffset),c=Na(t,e.focusNode,e.focusOffset);if(!(u&&!u.bad&&c&&!c.bad&&re(Dr(u,c),r)==0&&re(It(u,c),s)==0)){var h=t.display.view,g=r.line>=t.display.viewFrom&&qf(t,r)||{node:h[0].measure.map[2],offset:0},v=s.line<t.display.viewTo&&qf(t,s);if(!v){var C=h[h.length-1].measure,_=C.maps?C.maps[C.maps.length-1]:C.map;v={node:_[_.length-1],offset:_[_.length-2]-_[_.length-3]}}if(!g||!v){e.removeAllRanges();return}var M=e.rangeCount&&e.getRangeAt(0),I;try{I=G(g.node,g.offset,v.offset,v.node)}catch{}I&&(!f&&t.state.focused?(e.collapse(g.node,g.offset),I.collapsed||(e.removeAllRanges(),e.addRange(I))):(e.removeAllRanges(),e.addRange(I)),M&&e.anchorNode==null?e.addRange(M):f&&this.startGracePeriod()),this.rememberSelection()}},We.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)},We.prototype.showMultipleSelections=function(e){Q(this.cm.display.cursorDiv,e.cursors),Q(this.cm.display.selectionDiv,e.selection)},We.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},We.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},We.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||R(Te(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},We.prototype.blur=function(){this.div.blur()},We.prototype.getField=function(){return this.div},We.prototype.supportsTouch=function(){return!0},We.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):Bt(this.cm,function(){return t.cm.curOp.selectionChanged=!0});function i(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,i))}this.polling.set(this.cm.options.pollInterval,i)},We.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},We.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var e=this.getSelection(),t=this.cm;if($&&E&&this.cm.display.gutterSpecs.length&&jm(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var i=Na(t,e.anchorNode,e.anchorOffset),r=Na(t,e.focusNode,e.focusOffset);i&&r&&Bt(t,function(){_t(t.doc,Wn(i,r),ct),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},We.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),s=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=P(r.line-1,fe(e.doc,r.line-1).length)),s.ch==fe(e.doc,s.line).text.length&&s.line<e.lastLine()&&(s=P(s.line+1,0)),r.line<t.viewFrom||s.line>t.viewTo-1)return!1;var u,c,h;r.line==t.viewFrom||(u=ar(e,r.line))==0?(c=b(t.view[0].line),h=t.view[0].node):(c=b(t.view[u].line),h=t.view[u-1].node.nextSibling);var g=ar(e,s.line),v,C;if(g==t.view.length-1?(v=t.viewTo-1,C=t.lineDiv.lastChild):(v=b(t.view[g+1].line)-1,C=t.view[g+1].node.previousSibling),!h)return!1;for(var _=e.doc.splitLines(qm(e,h,C,c,v)),M=Sn(e.doc,P(c,0),P(v,fe(e.doc,v).text.length));_.length>1&&M.length>1;)if(be(_)==be(M))_.pop(),M.pop(),v--;else if(_[0]==M[0])_.shift(),M.shift(),c++;else break;for(var I=0,z=0,q=_[0],V=M[0],ee=Math.min(q.length,V.length);I<ee&&q.charCodeAt(I)==V.charCodeAt(I);)++I;for(var ae=be(_),te=be(M),le=Math.min(ae.length-(_.length==1?I:0),te.length-(M.length==1?I:0));z<le&&ae.charCodeAt(ae.length-z-1)==te.charCodeAt(te.length-z-1);)++z;if(_.length==1&&M.length==1&&c==r.line)for(;I&&I>r.ch&&ae.charCodeAt(ae.length-z-1)==te.charCodeAt(te.length-z-1);)I--,z++;_[_.length-1]=ae.slice(0,ae.length-z).replace(/^\u200b+/,""),_[0]=_[0].slice(I).replace(/\u200b+$/,"");var ve=P(c,I),ge=P(v,M.length?be(M).length-z:0);if(_.length>1||_[0]||re(ve,ge))return Hr(e.doc,_,ve,ge,"+input"),!0},We.prototype.ensurePolled=function(){this.forceCompositionEnd()},We.prototype.reset=function(){this.forceCompositionEnd()},We.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},We.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))},We.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Bt(this.cm,function(){return Ot(e.cm)})},We.prototype.setUneditable=function(e){e.contentEditable="false"},We.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||yt(this.cm,to)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},We.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},We.prototype.onContextMenu=function(){},We.prototype.resetPosition=function(){},We.prototype.needsContentAttribute=!0;function qf(e,t){var i=Ss(e,t.line);if(!i||i.hidden)return null;var r=fe(e.doc,t.line),s=yu(i,r,t.line),u=Pe(r,e.doc.direction),c="left";if(u){var h=Mn(u,t.ch);c=h%2?"right":"left"}var g=wu(s.map,t.ch,c);return g.offset=g.collapse=="right"?g.end:g.start,g}function jm(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Gr(e,t){return t&&(e.bad=!0),e}function qm(e,t,i,r,s){var u="",c=!1,h=e.doc.lineSeparator(),g=!1;function v(I){return function(z){return z.id==I}}function C(){c&&(u+=h,g&&(u+=h),c=g=!1)}function _(I){I&&(C(),u+=I)}function M(I){if(I.nodeType==1){var z=I.getAttribute("cm-text");if(z){_(z);return}var q=I.getAttribute("cm-marker"),V;if(q){var ee=e.findMarks(P(r,0),P(s+1,0),v(+q));ee.length&&(V=ee[0].find(0))&&_(Sn(e.doc,V.from,V.to).join(h));return}if(I.getAttribute("contenteditable")=="false")return;var ae=/^(pre|div|p|li|table|br)$/i.test(I.nodeName);if(!/^br$/i.test(I.nodeName)&&I.textContent.length==0)return;ae&&C();for(var te=0;te<I.childNodes.length;te++)M(I.childNodes[te]);/^(pre|p)$/i.test(I.nodeName)&&(g=!0),ae&&(c=!0)}else I.nodeType==3&&_(I.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;M(t),t!=i;)t=t.nextSibling,g=!1;return u}function Na(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return Gr(e.clipPos(P(e.display.viewTo-1)),!0);t=null,i=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 s=0;s<e.display.view.length;s++){var u=e.display.view[s];if(u.node==r)return Um(u,t,i)}}function Um(e,t,i){var r=e.text.firstChild,s=!1;if(!t||!D(r,t))return Gr(P(b(e.line),0),!0);if(t==r&&(s=!0,t=r.childNodes[i],i=0,!t)){var u=e.rest?be(e.rest):e.line;return Gr(P(b(u),u.text.length),s)}var c=t.nodeType==3?t:null,h=t;for(!c&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(c=t.firstChild,i&&(i=c.nodeValue.length));h.parentNode!=r;)h=h.parentNode;var g=e.measure,v=g.maps;function C(V,ee,ae){for(var te=-1;te<(v?v.length:0);te++)for(var le=te<0?g.map:v[te],ve=0;ve<le.length;ve+=3){var ge=le[ve+2];if(ge==V||ge==ee){var Ae=b(te<0?e.line:e.rest[te]),qe=le[ve]+ae;return(ae<0||ge!=V)&&(qe=le[ve+(ae?1:0)]),P(Ae,qe)}}}var _=C(c,h,i);if(_)return Gr(_,s);for(var M=h.nextSibling,I=c?c.nodeValue.length-i:0;M;M=M.nextSibling){if(_=C(M,M.firstChild,0),_)return Gr(P(_.line,_.ch-I),s);I+=M.textContent.length}for(var z=h.previousSibling,q=i;z;z=z.previousSibling){if(_=C(z,z.firstChild,-1),_)return Gr(P(_.line,_.ch+q),s);q+=z.textContent.length}}var st=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ft,this.hasSelection=!1,this.composing=null,this.resetting=!1};st.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var s=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),O&&(s.style.width="0px"),me(s,"input",function(){m&&x>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),me(s,"paste",function(c){tt(r,c)||$f(c,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function u(c){if(!tt(r,c)){if(r.somethingSelected())Oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var h=Hf(r);Oa({lineWise:!0,text:h.text}),c.type=="cut"?r.setSelections(h.ranges,null,ct):(i.prevInput="",s.value=h.text.join(`
20
- `),L(s))}else return;c.type=="cut"&&(r.state.cutIncoming=+new Date)}}me(s,"cut",u),me(s,"copy",u),me(e.scroller,"paste",function(c){if(!(_n(e,c)||tt(r,c))){if(!s.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var h=new Event("paste");h.clipboardData=c.clipboardData,s.dispatchEvent(h)}}),me(e.lineSpace,"selectstart",function(c){_n(e,c)||Tt(c)}),me(s,"compositionstart",function(){var c=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:c,range:r.markText(c,r.getCursor("to"),{className:"CodeMirror-composing"})}}),me(s,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},st.prototype.createField=function(e){this.wrapper=Wf(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;no(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},st.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},st.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=Ou(e);if(e.options.moveInputWithCursor){var s=cn(e,i.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),c=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,s.top+c.top-u.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,s.left+c.left-u.left))}return r},st.prototype.showSelection=function(e){var t=this.cm,i=t.display;Q(i.cursorDiv,e.cursors),Q(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},st.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&L(this.textarea),m&&x>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",m&&x>=9&&(this.hasSelection=null));this.resetting=!1}},st.prototype.getField=function(){return this.textarea},st.prototype.supportsTouch=function(){return!1},st.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!X||R(Te(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},st.prototype.blur=function(){this.textarea.blur()},st.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},st.prototype.receivedFocus=function(){this.slowPoll()},st.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},st.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},st.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Pn(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var s=i.value;if(s==r&&!t.somethingSelected())return!1;if(m&&x>=9&&this.hasSelection===s||ne&&/[\uf700-\uf7ff]/.test(s))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var u=s.charCodeAt(0);if(u==8203&&!r&&(r="​"),u==8666)return this.reset(),this.cm.execCommand("undo")}for(var c=0,h=Math.min(r.length,s.length);c<h&&r.charCodeAt(c)==s.charCodeAt(c);)++c;return Bt(t,function(){to(t,s.slice(c),r.length-c,null,e.composing?"*compose":null),s.length>1e3||s.indexOf(`
21
- `)>-1?i.value=e.prevInput="":e.prevInput=s,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},st.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},st.prototype.onKeyPress=function(){m&&x>=9&&(this.hasSelection=null),this.fastPoll()},st.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,s=t.textarea;t.contextMenuPending&&t.contextMenuPending();var u=ir(i,e),c=r.scroller.scrollTop;if(!u||B)return;var h=i.options.resetSelectionOnContextMenu;h&&i.doc.sel.contains(u)==-1&&yt(i,_t)(i.doc,Wn(u),ct);var g=s.style.cssText,v=t.wrapper.style.cssText,C=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",s.style.cssText=`position: absolute; width: 30px; height: 30px;
15
+ `)&&(H=U=$(H.line,0)));var V={from:H,to:U,text:v?v[R%v.length]:g,origin:s||(h?"paste":e.state.cutIncoming>f?"cut":"+input")};Br(e.doc,V),vt(e,"inputRead",e,V)}t&&!h&&zc(e,t),Fr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=_),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function $c(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&Bt(t,function(){return to(t,i,0,null,"paste")}),!0}function zc(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var s=i.ranges[r];if(!(s.head.ch>100||r&&i.ranges[r-1].head.line==s.head.line)){var u=e.getModeAt(s.head),f=!1;if(u.electricChars){for(var h=0;h<u.electricChars.length;h++)if(t.indexOf(u.electricChars.charAt(h))>-1){f=$i(e,s.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(ce(e.doc,s.head.line).text.slice(0,s.head.ch))&&(f=$i(e,s.head.line,"smart"));f&&vt(e,"electricInput",e,s.head.line)}}}function Bc(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var s=e.doc.sel.ranges[r].head.line,u={anchor:$(s,0),head:$(s+1,0)};i.push(u),t.push(e.getRange(u.anchor,u.head))}return{text:t,ranges:i}}function no(e,t,i,r){e.setAttribute("autocorrect",i?"on":"off"),e.setAttribute("autocapitalize",r?"on":"off"),e.setAttribute("spellcheck",!!t)}function Hc(){var e=k("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=k("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return S?e.style.width="1000px":e.setAttribute("wrap","off"),O&&(e.style.border="1px solid black"),t}function Wm(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){Z(this).focus(),this.display.input.focus()},setOption:function(r,s){var u=this.options,f=u[r];u[r]==s&&r!="mode"||(u[r]=s,t.hasOwnProperty(r)&&yt(this,t[r])(this,s,f),et(this,"optionChange",this,r))},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,s){this.state.keyMaps[s?"push":"unshift"](Da(r))},removeKeyMap:function(r){for(var s=this.state.keyMaps,u=0;u<s.length;++u)if(s[u]==r||s[u].name==r)return s.splice(u,1),!0},addOverlay:Et(function(r,s){var u=r.token?r:e.getMode(this.options,r);if(u.startState)throw new Error("Overlays may not be stateful.");Gt(this.state.overlays,{mode:u,modeSpec:r,opaque:s&&s.opaque,priority:s&&s.priority||0},function(f){return f.priority}),this.state.modeGen++,Ot(this)}),removeOverlay:Et(function(r){for(var s=this.state.overlays,u=0;u<s.length;++u){var f=s[u].modeSpec;if(f==r||typeof r=="string"&&f.name==r){s.splice(u,1),this.state.modeGen++,Ot(this);return}}}),indentLine:Et(function(r,s,u){typeof s!="string"&&typeof s!="number"&&(s==null?s=this.options.smartIndent?"smart":"prev":s=s?"add":"subtract"),q(this.doc,r)&&$i(this,r,s,u)}),indentSelection:Et(function(r){for(var s=this.doc.sel.ranges,u=-1,f=0;f<s.length;f++){var h=s[f];if(h.empty())h.head.line>u&&($i(this,h.head.line,r,!0),u=h.head.line,f==this.doc.sel.primIndex&&Fr(this));else{var g=h.from(),v=h.to(),C=Math.max(u,g.line);u=Math.min(this.lastLine(),v.line-(v.ch?0:1))+1;for(var _=C;_<u;++_)$i(this,_,r);var R=this.doc.sel.ranges;g.ch==0&&s.length==R.length&&R[f].from().ch>0&&Ks(this.doc,f,new Be(g,R[f].to()),ft)}}}),getTokenAt:function(r,s){return Jl(this,r,s)},getLineTokens:function(r,s){return Jl(this,$(r),s,!0)},getTokenTypeAt:function(r){r=Se(this.doc,r);var s=Xl(this,ce(this.doc,r.line)),u=0,f=(s.length-1)/2,h=r.ch,g;if(h==0)g=s[2];else for(;;){var v=u+f>>1;if((v?s[v*2-1]:0)>=h)f=v;else if(s[v*2+1]<h)u=v+1;else{g=s[v*2+2];break}}var C=g?g.indexOf("overlay "):-1;return C<0?g:C==0?null:g.slice(0,C-1)},getModeAt:function(r){var s=this.doc.mode;return s.innerMode?e.innerMode(s,this.getTokenAt(r).state).mode:s},getHelper:function(r,s){return this.getHelpers(r,s)[0]},getHelpers:function(r,s){var u=[];if(!i.hasOwnProperty(s))return u;var f=i[s],h=this.getModeAt(r);if(typeof h[s]=="string")f[h[s]]&&u.push(f[h[s]]);else if(h[s])for(var g=0;g<h[s].length;g++){var v=f[h[s][g]];v&&u.push(v)}else h.helperType&&f[h.helperType]?u.push(f[h.helperType]):f[h.name]&&u.push(f[h.name]);for(var C=0;C<f._global.length;C++){var _=f._global[C];_.pred(h,this)&&ke(u,_.val)==-1&&u.push(_.val)}return u},getStateAfter:function(r,s){var u=this.doc;return r=Ul(u,r??u.first+u.size-1),hi(this,r+1,s).state},cursorCoords:function(r,s){var u,f=this.doc.sel.primary();return r==null?u=f.head:typeof r=="object"?u=Se(this.doc,r):u=r?f.from():f.to(),fn(this,u,s||"page")},charCoords:function(r,s){return pa(this,Se(this.doc,r),s||"page")},coordsChar:function(r,s){return r=_u(this,r,s||"page"),_s(this,r.left,r.top)},lineAtHeight:function(r,s){return r=_u(this,{top:r,left:0},s||"page").top,T(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,s,u){var f=!1,h;if(typeof r=="number"){var g=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>g&&(r=g,f=!0),h=ce(this.doc,r)}else h=r;return da(this,h,{top:0,left:0},s||"page",u||f).top+(f?this.doc.height-_n(h):0)},defaultTextHeight:function(){return Nr(this.display)},defaultCharWidth:function(){return Rr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,s,u,f,h){var g=this.display;r=fn(this,Se(this.doc,r));var v=r.bottom,C=r.left;if(s.style.position="absolute",s.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(s),g.sizer.appendChild(s),f=="over")v=r.top;else if(f=="above"||f=="near"){var _=Math.max(g.wrapper.clientHeight,this.doc.height),R=Math.max(g.sizer.clientWidth,g.lineSpace.clientWidth);(f=="above"||r.bottom+s.offsetHeight>_)&&r.top>s.offsetHeight?v=r.top-s.offsetHeight:r.bottom+s.offsetHeight<=_&&(v=r.bottom),C+s.offsetWidth>R&&(C=R-s.offsetWidth)}s.style.top=v+"px",s.style.left=s.style.right="",h=="right"?(C=g.sizer.clientWidth-s.offsetWidth,s.style.right="0px"):(h=="left"?C=0:h=="middle"&&(C=(g.sizer.clientWidth-s.offsetWidth)/2),s.style.left=C+"px"),u&&zg(this,{left:C,top:v,right:C+s.offsetWidth,bottom:v+s.offsetHeight})},triggerOnKeyDown:Et(Dc),triggerOnKeyPress:Et(Ic),triggerOnKeyUp:Ac,triggerOnMouseDown:Et(Oc),execCommand:function(r){if(Ri.hasOwnProperty(r))return Ri[r].call(null,this)},triggerElectric:Et(function(r){zc(this,r)}),findPosH:function(r,s,u,f){var h=1;s<0&&(h=-1,s=-s);for(var g=Se(this.doc,r),v=0;v<s&&(g=ro(this.doc,g,h,u,f),!g.hitSide);++v);return g},moveH:Et(function(r,s){var u=this;this.extendSelectionsBy(function(f){return u.display.shift||u.doc.extend||f.empty()?ro(u.doc,f.head,r,s,u.options.rtlMoveVisually):r<0?f.from():f.to()},ht)}),deleteH:Et(function(r,s){var u=this.doc.sel,f=this.doc;u.somethingSelected()?f.replaceSelection("",null,"+delete"):qr(this,function(h){var g=ro(f,h.head,r,s,!1);return r<0?{from:g,to:h.head}:{from:h.head,to:g}})}),findPosV:function(r,s,u,f){var h=1,g=f;s<0&&(h=-1,s=-s);for(var v=Se(this.doc,r),C=0;C<s;++C){var _=fn(this,v,"div");if(g==null?g=_.left:_.left=g,v=Wc(this,_,h,u),v.hitSide)break}return v},moveV:Et(function(r,s){var u=this,f=this.doc,h=[],g=!this.display.shift&&!f.extend&&f.sel.somethingSelected();if(f.extendSelectionsBy(function(C){if(g)return r<0?C.from():C.to();var _=fn(u,C.head,"div");C.goalColumn!=null&&(_.left=C.goalColumn),h.push(_.left);var R=Wc(u,_,r,s);return s=="page"&&C==f.sel.primary()&&Fs(u,pa(u,R,"div").top-_.top),R},ht),h.length)for(var v=0;v<f.sel.ranges.length;v++)f.sel.ranges[v].goalColumn=h[v]}),findWordAt:function(r){var s=this.doc,u=ce(s,r.line).text,f=r.ch,h=r.ch;if(u){var g=this.getHelper(r,"wordChars");(r.sticky=="before"||h==u.length)&&f?--f:++h;for(var v=u.charAt(f),C=xe(v,g)?function(_){return xe(_,g)}:/\s/.test(v)?function(_){return/\s/.test(_)}:function(_){return!/\s/.test(_)&&!xe(_)};f>0&&C(u.charAt(f-1));)--f;for(;h<u.length&&C(u.charAt(h));)++h}return new Be($(r.line,f),$(r.line,h))},toggleOverwrite:function(r){r!=null&&r==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?K(this.display.cursorDiv,"CodeMirror-overwrite"):$e(this.display.cursorDiv,"CodeMirror-overwrite"),et(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==F(oe(this))},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:Et(function(r,s){bi(this,r,s)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-yn(this)-this.display.barHeight,width:r.scrollWidth-yn(this)-this.display.barWidth,clientHeight:ws(this),clientWidth:nr(this)}},scrollIntoView:Et(function(r,s){r==null?(r={from:this.doc.sel.primary().head,to:null},s==null&&(s=this.options.cursorScrollMargin)):typeof r=="number"?r={from:$(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=s||0,r.from.line!=null?Bg(this,r):Mu(this,r.from,r.to,r.margin)}),setSize:Et(function(r,s){var u=this,f=function(g){return typeof g=="number"||/^\d+$/.test(String(g))?g+"px":g};r!=null&&(this.display.wrapper.style.width=f(r)),s!=null&&(this.display.wrapper.style.height=f(s)),this.options.lineWrapping&&Su(this);var h=this.display.viewFrom;this.doc.iter(h,this.display.viewTo,function(g){if(g.widgets){for(var v=0;v<g.widgets.length;v++)if(g.widgets[v].noHScroll){Bn(u,h,"widget");break}}++h}),this.curOp.forceUpdate=!0,et(this,"refresh",this)}),operation:function(r){return Bt(this,r)},startOperation:function(){return lr(this)},endOperation:function(){return ur(this)},refresh:Et(function(){var r=this.display.cachedTextHeight;Ot(this),this.curOp.forceUpdate=!0,vi(this),bi(this,this.doc.scrollLeft,this.doc.scrollTop),zs(this.display),(r==null||Math.abs(r-Nr(this.display))>.5||this.options.lineWrapping)&&As(this),et(this,"refresh",this)}),swapDoc:Et(function(r){var s=this.doc;return s.cm=null,this.state.selectingText&&this.state.selectingText(),Yu(this,r),vi(this),this.display.input.reset(),bi(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,vt(this,"swapDoc",this,s),s}),phrase:function(r){var s=this.options.phrases;return s&&Object.prototype.hasOwnProperty.call(s,r)?s[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}},an(e),e.registerHelper=function(r,s,u){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][s]=u},e.registerGlobalHelper=function(r,s,u,f){e.registerHelper(r,s,f),i[r]._global.push({pred:u,val:f})}}function ro(e,t,i,r,s){var u=t,f=i,h=ce(e,t.line),g=s&&e.direction=="rtl"?-i:i;function v(){var ae=t.line+g;return ae<e.first||ae>=e.first+e.size?!1:(t=new $(ae,t.ch,t.sticky),h=ce(e,ae))}function C(ae){var te;if(r=="codepoint"){var le=h.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(le))te=null;else{var ve=i>0?le>=55296&&le<56320:le>=56320&&le<57343;te=new $(t.line,Math.max(0,Math.min(h.text.length,t.ch+i*(ve?2:1))),-i)}}else s?te=Sm(e.cm,h,t,i):te=Ys(h,t,i);if(te==null)if(!ae&&v())t=Vs(s,e.cm,h,t.line,g);else return!1;else t=te;return!0}if(r=="char"||r=="codepoint")C();else if(r=="column")C(!0);else if(r=="word"||r=="group")for(var _=null,R=r=="group",I=e.cm&&e.cm.getHelper(t,"wordChars"),H=!0;!(i<0&&!C(!H));H=!1){var U=h.text.charAt(t.ch)||`
16
+ `,V=xe(U,I)?"w":R&&U==`
17
+ `?"n":!R||/\s/.test(U)?null:"p";if(R&&!H&&!V&&(V="s"),_&&_!=V){i<0&&(i=1,C(),t.sticky="after");break}if(V&&(_=V),i>0&&!C(!H))break}var ee=_a(e,t,u,f,!0);return ze(u,ee)&&(ee.hitSide=!0),ee}function Wc(e,t,i,r){var s=e.doc,u=t.left,f;if(r=="page"){var h=Math.min(e.display.wrapper.clientHeight,Z(e).innerHeight||s(e).documentElement.clientHeight),g=Math.max(h-.5*Nr(e.display),3);f=(i>0?t.bottom:t.top)+i*g}else r=="line"&&(f=i>0?t.bottom+3:t.top-3);for(var v;v=_s(e,u,f),!!v.outside;){if(i<0?f<=0:f>=s.height){v.hitSide=!0;break}f+=i*5}return v}var We=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ct,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};We.prototype.init=function(e){var t=this,i=this,r=i.cm,s=i.div=e.lineDiv;s.contentEditable=!0,no(s,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function u(h){for(var g=h.target;g;g=g.parentNode){if(g==s)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(g.className))break}return!1}me(s,"paste",function(h){!u(h)||tt(r,h)||$c(h,r)||w<=11&&setTimeout(yt(r,function(){return t.updateFromDOM()}),20)}),me(s,"compositionstart",function(h){t.composing={data:h.data,done:!1}}),me(s,"compositionupdate",function(h){t.composing||(t.composing={data:h.data,done:!1})}),me(s,"compositionend",function(h){t.composing&&(h.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),me(s,"touchstart",function(){return i.forceCompositionEnd()}),me(s,"input",function(){t.composing||t.readFromDOMSoon()});function f(h){if(!(!u(h)||tt(r,h))){if(r.somethingSelected())Oa({lineWise:!1,text:r.getSelections()}),h.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var g=Bc(r);Oa({lineWise:!0,text:g.text}),h.type=="cut"&&r.operation(function(){r.setSelections(g.ranges,0,ft),r.replaceSelection("",null,"cut")})}else return;if(h.clipboardData){h.clipboardData.clearData();var v=dn.text.join(`
18
+ `);if(h.clipboardData.setData("Text",v),h.clipboardData.getData("Text")==v){h.preventDefault();return}}var C=Hc(),_=C.firstChild;no(_),r.display.lineSpace.insertBefore(C,r.display.lineSpace.firstChild),_.value=dn.text.join(`
19
+ `);var R=F(Te(s));L(_),setTimeout(function(){r.display.lineSpace.removeChild(C),R.focus(),R==s&&i.showPrimarySelection()},50)}}me(s,"copy",f),me(s,"cut",f)},We.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},We.prototype.prepareSelection=function(){var e=Ou(this.cm,!1);return e.focus=F(Te(this.div))==this.div,e},We.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},We.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},We.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),s=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||s.line<t.display.viewFrom){e.removeAllRanges();return}var u=Na(t,e.anchorNode,e.anchorOffset),f=Na(t,e.focusNode,e.focusOffset);if(!(u&&!u.bad&&f&&!f.bad&&re(Dr(u,f),r)==0&&re(It(u,f),s)==0)){var h=t.display.view,g=r.line>=t.display.viewFrom&&jc(t,r)||{node:h[0].measure.map[2],offset:0},v=s.line<t.display.viewTo&&jc(t,s);if(!v){var C=h[h.length-1].measure,_=C.maps?C.maps[C.maps.length-1]:C.map;v={node:_[_.length-1],offset:_[_.length-2]-_[_.length-3]}}if(!g||!v){e.removeAllRanges();return}var R=e.rangeCount&&e.getRangeAt(0),I;try{I=G(g.node,g.offset,v.offset,v.node)}catch{}I&&(!c&&t.state.focused?(e.collapse(g.node,g.offset),I.collapsed||(e.removeAllRanges(),e.addRange(I))):(e.removeAllRanges(),e.addRange(I)),R&&e.anchorNode==null?e.addRange(R):c&&this.startGracePeriod()),this.rememberSelection()}},We.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)},We.prototype.showMultipleSelections=function(e){Q(this.cm.display.cursorDiv,e.cursors),Q(this.cm.display.selectionDiv,e.selection)},We.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},We.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},We.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||F(Te(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},We.prototype.blur=function(){this.div.blur()},We.prototype.getField=function(){return this.div},We.prototype.supportsTouch=function(){return!0},We.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):Bt(this.cm,function(){return t.cm.curOp.selectionChanged=!0});function i(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,i))}this.polling.set(this.cm.options.pollInterval,i)},We.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},We.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var e=this.getSelection(),t=this.cm;if(W&&E&&this.cm.display.gutterSpecs.length&&jm(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var i=Na(t,e.anchorNode,e.anchorOffset),r=Na(t,e.focusNode,e.focusOffset);i&&r&&Bt(t,function(){_t(t.doc,Wn(i,r),ft),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},We.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,i=e.doc.sel.primary(),r=i.from(),s=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=$(r.line-1,ce(e.doc,r.line-1).length)),s.ch==ce(e.doc,s.line).text.length&&s.line<e.lastLine()&&(s=$(s.line+1,0)),r.line<t.viewFrom||s.line>t.viewTo-1)return!1;var u,f,h;r.line==t.viewFrom||(u=ar(e,r.line))==0?(f=b(t.view[0].line),h=t.view[0].node):(f=b(t.view[u].line),h=t.view[u-1].node.nextSibling);var g=ar(e,s.line),v,C;if(g==t.view.length-1?(v=t.viewTo-1,C=t.lineDiv.lastChild):(v=b(t.view[g+1].line)-1,C=t.view[g+1].node.previousSibling),!h)return!1;for(var _=e.doc.splitLines(qm(e,h,C,f,v)),R=Cn(e.doc,$(f,0),$(v,ce(e.doc,v).text.length));_.length>1&&R.length>1;)if(be(_)==be(R))_.pop(),R.pop(),v--;else if(_[0]==R[0])_.shift(),R.shift(),f++;else break;for(var I=0,H=0,U=_[0],V=R[0],ee=Math.min(U.length,V.length);I<ee&&U.charCodeAt(I)==V.charCodeAt(I);)++I;for(var ae=be(_),te=be(R),le=Math.min(ae.length-(_.length==1?I:0),te.length-(R.length==1?I:0));H<le&&ae.charCodeAt(ae.length-H-1)==te.charCodeAt(te.length-H-1);)++H;if(_.length==1&&R.length==1&&f==r.line)for(;I&&I>r.ch&&ae.charCodeAt(ae.length-H-1)==te.charCodeAt(te.length-H-1);)I--,H++;_[_.length-1]=ae.slice(0,ae.length-H).replace(/^\u200b+/,""),_[0]=_[0].slice(I).replace(/\u200b+$/,"");var ve=$(f,I),ge=$(v,R.length?be(R).length-H:0);if(_.length>1||_[0]||re(ve,ge))return Hr(e.doc,_,ve,ge,"+input"),!0},We.prototype.ensurePolled=function(){this.forceCompositionEnd()},We.prototype.reset=function(){this.forceCompositionEnd()},We.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},We.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))},We.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&Bt(this.cm,function(){return Ot(e.cm)})},We.prototype.setUneditable=function(e){e.contentEditable="false"},We.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||yt(this.cm,to)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},We.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},We.prototype.onContextMenu=function(){},We.prototype.resetPosition=function(){},We.prototype.needsContentAttribute=!0;function jc(e,t){var i=Ss(e,t.line);if(!i||i.hidden)return null;var r=ce(e.doc,t.line),s=yu(i,r,t.line),u=Pe(r,e.doc.direction),f="left";if(u){var h=Rn(u,t.ch);f=h%2?"right":"left"}var g=ku(s.map,t.ch,f);return g.offset=g.collapse=="right"?g.end:g.start,g}function jm(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function Gr(e,t){return t&&(e.bad=!0),e}function qm(e,t,i,r,s){var u="",f=!1,h=e.doc.lineSeparator(),g=!1;function v(I){return function(H){return H.id==I}}function C(){f&&(u+=h,g&&(u+=h),f=g=!1)}function _(I){I&&(C(),u+=I)}function R(I){if(I.nodeType==1){var H=I.getAttribute("cm-text");if(H){_(H);return}var U=I.getAttribute("cm-marker"),V;if(U){var ee=e.findMarks($(r,0),$(s+1,0),v(+U));ee.length&&(V=ee[0].find(0))&&_(Cn(e.doc,V.from,V.to).join(h));return}if(I.getAttribute("contenteditable")=="false")return;var ae=/^(pre|div|p|li|table|br)$/i.test(I.nodeName);if(!/^br$/i.test(I.nodeName)&&I.textContent.length==0)return;ae&&C();for(var te=0;te<I.childNodes.length;te++)R(I.childNodes[te]);/^(pre|p)$/i.test(I.nodeName)&&(g=!0),ae&&(f=!0)}else I.nodeType==3&&_(I.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;R(t),t!=i;)t=t.nextSibling,g=!1;return u}function Na(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return Gr(e.clipPos($(e.display.viewTo-1)),!0);t=null,i=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 s=0;s<e.display.view.length;s++){var u=e.display.view[s];if(u.node==r)return Um(u,t,i)}}function Um(e,t,i){var r=e.text.firstChild,s=!1;if(!t||!D(r,t))return Gr($(b(e.line),0),!0);if(t==r&&(s=!0,t=r.childNodes[i],i=0,!t)){var u=e.rest?be(e.rest):e.line;return Gr($(b(u),u.text.length),s)}var f=t.nodeType==3?t:null,h=t;for(!f&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(f=t.firstChild,i&&(i=f.nodeValue.length));h.parentNode!=r;)h=h.parentNode;var g=e.measure,v=g.maps;function C(V,ee,ae){for(var te=-1;te<(v?v.length:0);te++)for(var le=te<0?g.map:v[te],ve=0;ve<le.length;ve+=3){var ge=le[ve+2];if(ge==V||ge==ee){var Ae=b(te<0?e.line:e.rest[te]),qe=le[ve]+ae;return(ae<0||ge!=V)&&(qe=le[ve+(ae?1:0)]),$(Ae,qe)}}}var _=C(f,h,i);if(_)return Gr(_,s);for(var R=h.nextSibling,I=f?f.nodeValue.length-i:0;R;R=R.nextSibling){if(_=C(R,R.firstChild,0),_)return Gr($(_.line,_.ch-I),s);I+=R.textContent.length}for(var H=h.previousSibling,U=i;H;H=H.previousSibling){if(_=C(H,H.firstChild,-1),_)return Gr($(_.line,_.ch+U),s);U+=H.textContent.length}}var st=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ct,this.hasSelection=!1,this.composing=null,this.resetting=!1};st.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var s=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),O&&(s.style.width="0px"),me(s,"input",function(){m&&w>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),me(s,"paste",function(f){tt(r,f)||$c(f,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function u(f){if(!tt(r,f)){if(r.somethingSelected())Oa({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var h=Bc(r);Oa({lineWise:!0,text:h.text}),f.type=="cut"?r.setSelections(h.ranges,null,ft):(i.prevInput="",s.value=h.text.join(`
20
+ `),L(s))}else return;f.type=="cut"&&(r.state.cutIncoming=+new Date)}}me(s,"cut",u),me(s,"copy",u),me(e.scroller,"paste",function(f){if(!(Ln(e,f)||tt(r,f))){if(!s.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var h=new Event("paste");h.clipboardData=f.clipboardData,s.dispatchEvent(h)}}),me(e.lineSpace,"selectstart",function(f){Ln(e,f)||Tt(f)}),me(s,"compositionstart",function(){var f=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:f,range:r.markText(f,r.getCursor("to"),{className:"CodeMirror-composing"})}}),me(s,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},st.prototype.createField=function(e){this.wrapper=Hc(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;no(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},st.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},st.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=Ou(e);if(e.options.moveInputWithCursor){var s=fn(e,i.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),f=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,s.top+f.top-u.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,s.left+f.left-u.left))}return r},st.prototype.showSelection=function(e){var t=this.cm,i=t.display;Q(i.cursorDiv,e.cursors),Q(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},st.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var i=t.getSelection();this.textarea.value=i,t.state.focused&&L(this.textarea),m&&w>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",m&&w>=9&&(this.hasSelection=null));this.resetting=!1}},st.prototype.getField=function(){return this.textarea},st.prototype.supportsTouch=function(){return!1},st.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!X||F(Te(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},st.prototype.blur=function(){this.textarea.blur()},st.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},st.prototype.receivedFocus=function(){this.slowPoll()},st.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},st.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function i(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,i)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,i)},st.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Pn(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var s=i.value;if(s==r&&!t.somethingSelected())return!1;if(m&&w>=9&&this.hasSelection===s||ne&&/[\uf700-\uf7ff]/.test(s))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var u=s.charCodeAt(0);if(u==8203&&!r&&(r="​"),u==8666)return this.reset(),this.cm.execCommand("undo")}for(var f=0,h=Math.min(r.length,s.length);f<h&&r.charCodeAt(f)==s.charCodeAt(f);)++f;return Bt(t,function(){to(t,s.slice(f),r.length-f,null,e.composing?"*compose":null),s.length>1e3||s.indexOf(`
21
+ `)>-1?i.value=e.prevInput="":e.prevInput=s,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},st.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},st.prototype.onKeyPress=function(){m&&w>=9&&(this.hasSelection=null),this.fastPoll()},st.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,s=t.textarea;t.contextMenuPending&&t.contextMenuPending();var u=ir(i,e),f=r.scroller.scrollTop;if(!u||z)return;var h=i.options.resetSelectionOnContextMenu;h&&i.doc.sel.contains(u)==-1&&yt(i,_t)(i.doc,Wn(u),ft);var g=s.style.cssText,v=t.wrapper.style.cssText,C=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",s.style.cssText=`position: absolute; width: 30px; height: 30px;
22
22
  top: `+(e.clientY-C.top-5)+"px; left: "+(e.clientX-C.left-5)+`px;
23
23
  z-index: 1000; background: `+(m?"rgba(255, 255, 255, .05)":"transparent")+`;
24
- outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var _;S&&(_=s.ownerDocument.defaultView.scrollY),r.input.focus(),S&&s.ownerDocument.defaultView.scrollTo(null,_),r.input.reset(),i.somethingSelected()||(s.value=t.prevInput=" "),t.contextMenuPending=I,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function M(){if(s.selectionStart!=null){var q=i.somethingSelected(),V="​"+(q?s.value:"");s.value="⇚",s.value=V,t.prevInput=q?"":"​",s.selectionStart=1,s.selectionEnd=V.length,r.selForContextMenu=i.doc.sel}}function I(){if(t.contextMenuPending==I&&(t.contextMenuPending=!1,t.wrapper.style.cssText=v,s.style.cssText=g,m&&x<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=c),s.selectionStart!=null)){(!m||m&&x<9)&&M();var q=0,V=function(){r.selForContextMenu==i.doc.sel&&s.selectionStart==0&&s.selectionEnd>0&&t.prevInput=="​"?yt(i,uf)(i):q++<10?r.detectingSelectAll=setTimeout(V,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(V,200)}}if(m&&x>=9&&M(),Re){Rn(e);var z=function(){Ct(window,"mouseup",z),setTimeout(I,20)};me(window,"mouseup",z)}else setTimeout(I,50)},st.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},st.prototype.setUneditable=function(){},st.prototype.needsContentAttribute=!1;function Gm(e,t){if(t=t?ke(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 i=R(Te(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=h.getValue()}var s;if(e.form&&(me(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var u=e.form;s=u.submit;try{var c=u.submit=function(){r(),u.submit=s,u.submit(),u.submit=c}}catch{}}t.finishInit=function(g){g.save=r,g.getTextArea=function(){return e},g.toTextArea=function(){g.toTextArea=isNaN,r(),e.parentNode.removeChild(g.getWrapperElement()),e.style.display="",e.form&&(Ct(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=s))}},e.style.display="none";var h=Ve(function(g){return e.parentNode.insertBefore(g,e.nextSibling)},t);return h}function Km(e){e.off=Ct,e.on=me,e.wheelEventPixels=em,e.Doc=Nt,e.splitLines=tn,e.countColumn=_e,e.findColumn=dt,e.isWordChar=ye,e.Pass=Ke,e.signal=et,e.Line=Ar,e.changeEnd=jn,e.scrollbarModel=zu,e.Pos=P,e.cmpPos=re,e.modes=Cr,e.mimeModes=ln,e.resolveMode=Tr,e.getMode=_r,e.modeExtensions=zn,e.extendMode=Lr,e.copyState=mn,e.startState=Er,e.innerMode=fi,e.commands=Mi,e.keyMap=En,e.keyName=Tf,e.isModifierKey=Sf,e.lookupKey=jr,e.normalizeKeyMap=km,e.StringStream=nt,e.SharedTextMarker=Ii,e.TextMarker=Un,e.LineWidget=Ai,e.e_preventDefault=Tt,e.e_stopPropagation=kr,e.e_stop=Rn,e.addClass=K,e.contains=D,e.rmClass=ze,e.keyNames=Gn}zm(Ve),Wm(Ve);var Xm="iter insert remove copy getEditor constructor".split(" ");for(var Ma in Nt.prototype)Nt.prototype.hasOwnProperty(Ma)&&we(Xm,Ma)<0&&(Ve.prototype[Ma]=function(e){return function(){return e.apply(this.doc,arguments)}}(Nt.prototype[Ma]));return an(Nt),Ve.inputStyles={textarea:st,contenteditable:We},Ve.defineMode=function(e){!Ve.defaults.mode&&e!="null"&&(Ve.defaults.mode=e),un.apply(this,arguments)},Ve.defineMIME=tr,Ve.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ve.defineMIME("text/plain","null"),Ve.defineExtension=function(e,t){Ve.prototype[e]=t},Ve.defineDocExtension=function(e,t){Nt.prototype[e]=t},Ve.fromTextArea=Gm,Km(Ve),Ve.version="5.65.20",Ve})}(Fa)),Fa.exports}(function(l,n){(function(a){a(Wt())})(function(a){a.defineMode("javascript",function(o,f){var d=o.indentUnit,p=f.statementIndent,y=f.jsonld,m=f.json||y,x=f.trackScope!==!1,S=f.typescript,A=f.wordCharacters||/[\w$\xa1-\uffff]/,E=function(){function b(mt){return{type:mt,style:"keyword"}}var T=b("keyword a"),j=b("keyword b"),Y=b("keyword c"),P=b("keyword d"),re=b("operator"),$e={type:"atom",style:"atom"};return{if:b("if"),while:T,with:T,else:j,do:j,try:j,finally:j,return:P,break:P,continue:P,new:b("new"),delete:Y,void:Y,throw:Y,debugger:b("debugger"),var:b("var"),const:b("var"),let:b("var"),function:b("function"),catch:b("catch"),for:b("for"),switch:b("switch"),case:b("case"),default:b("default"),in:re,typeof:re,instanceof:re,true:$e,false:$e,null:$e,undefined:$e,NaN:$e,Infinity:$e,this:b("this"),class:b("class"),super:b("atom"),yield:Y,export:b("export"),import:b("import"),extends:Y,await:Y}}(),H=/[+\-*&%=<>!?|~^@]/,B=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function U(b){for(var T=!1,j,Y=!1;(j=b.next())!=null;){if(!T){if(j=="/"&&!Y)return;j=="["?Y=!0:Y&&j=="]"&&(Y=!1)}T=!T&&j=="\\"}}var F,N;function O(b,T,j){return F=b,N=j,T}function $(b,T){var j=b.next();if(j=='"'||j=="'")return T.tokenize=X(j),T.tokenize(b,T);if(j=="."&&b.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return O("number","number");if(j=="."&&b.match(".."))return O("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(j))return O(j);if(j=="="&&b.eat(">"))return O("=>","operator");if(j=="0"&&b.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return O("number","number");if(/\d/.test(j))return b.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),O("number","number");if(j=="/")return b.eat("*")?(T.tokenize=ne,ne(b,T)):b.eat("/")?(b.skipToEnd(),O("comment","comment")):Kt(b,T,1)?(U(b),b.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),O("regexp","string-2")):(b.eat("="),O("operator","operator",b.current()));if(j=="`")return T.tokenize=ue,ue(b,T);if(j=="#"&&b.peek()=="!")return b.skipToEnd(),O("meta","meta");if(j=="#"&&b.eatWhile(A))return O("variable","property");if(j=="<"&&b.match("!--")||j=="-"&&b.match("->")&&!/\S/.test(b.string.slice(0,b.start)))return b.skipToEnd(),O("comment","comment");if(H.test(j))return(j!=">"||!T.lexical||T.lexical.type!=">")&&(b.eat("=")?(j=="!"||j=="=")&&b.eat("="):/[<>*+\-|&?]/.test(j)&&(b.eat(j),j==">"&&b.eat(j))),j=="?"&&b.eat(".")?O("."):O("operator","operator",b.current());if(A.test(j)){b.eatWhile(A);var Y=b.current();if(T.lastType!="."){if(E.propertyIsEnumerable(Y)){var P=E[Y];return O(P.type,P.style,Y)}if(Y=="async"&&b.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return O("async","keyword",Y)}return O("variable","variable",Y)}}function X(b){return function(T,j){var Y=!1,P;if(y&&T.peek()=="@"&&T.match(B))return j.tokenize=$,O("jsonld-keyword","meta");for(;(P=T.next())!=null&&!(P==b&&!Y);)Y=!Y&&P=="\\";return Y||(j.tokenize=$),O("string","string")}}function ne(b,T){for(var j=!1,Y;Y=b.next();){if(Y=="/"&&j){T.tokenize=$;break}j=Y=="*"}return O("comment","comment")}function ue(b,T){for(var j=!1,Y;(Y=b.next())!=null;){if(!j&&(Y=="`"||Y=="$"&&b.eat("{"))){T.tokenize=$;break}j=!j&&Y=="\\"}return O("quasi","string-2",b.current())}var se="([{}])";function he(b,T){T.fatArrowAt&&(T.fatArrowAt=null);var j=b.string.indexOf("=>",b.start);if(!(j<0)){if(S){var Y=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(b.string.slice(b.start,j));Y&&(j=Y.index)}for(var P=0,re=!1,$e=j-1;$e>=0;--$e){var mt=b.string.charAt($e),It=se.indexOf(mt);if(It>=0&&It<3){if(!P){++$e;break}if(--P==0){mt=="("&&(re=!0);break}}else if(It>=3&&It<6)++P;else if(A.test(mt))re=!0;else if(/["'\/`]/.test(mt))for(;;--$e){if($e==0)return;var Dr=b.string.charAt($e-1);if(Dr==mt&&b.string.charAt($e-2)!="\\"){$e--;break}}else if(re&&!P){++$e;break}}re&&!P&&(T.fatArrowAt=$e)}}var Oe={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function Re(b,T,j,Y,P,re){this.indented=b,this.column=T,this.type=j,this.prev=P,this.info=re,Y!=null&&(this.align=Y)}function ie(b,T){if(!x)return!1;for(var j=b.localVars;j;j=j.next)if(j.name==T)return!0;for(var Y=b.context;Y;Y=Y.prev)for(var j=Y.vars;j;j=j.next)if(j.name==T)return!0}function ze(b,T,j,Y,P){var re=b.cc;for(W.state=b,W.stream=P,W.marked=null,W.cc=re,W.style=T,b.lexical.hasOwnProperty("align")||(b.lexical.align=!0);;){var $e=re.length?re.pop():m?we:_e;if($e(j,Y)){for(;re.length&&re[re.length-1].lex;)re.pop()();return W.marked?W.marked:j=="variable"&&ie(b,Y)?"variable-2":T}}}var W={state:null,marked:null,cc:null};function Q(){for(var b=arguments.length-1;b>=0;b--)W.cc.push(arguments[b])}function k(){return Q.apply(null,arguments),!0}function J(b,T){for(var j=T;j;j=j.next)if(j.name==b)return!0;return!1}function G(b){var T=W.state;if(W.marked="def",!!x){if(T.context){if(T.lexical.info=="var"&&T.context&&T.context.block){var j=D(b,T.context);if(j!=null){T.context=j;return}}else if(!J(b,T.localVars)){T.localVars=new de(b,T.localVars);return}}f.globalVars&&!J(b,T.globalVars)&&(T.globalVars=new de(b,T.globalVars))}}function D(b,T){if(T)if(T.block){var j=D(b,T.prev);return j?j==T.prev?T:new K(j,T.vars,!0):null}else return J(b,T.vars)?T:new K(T.prev,new de(b,T.vars),!1);else return null}function R(b){return b=="public"||b=="private"||b=="protected"||b=="abstract"||b=="readonly"}function K(b,T,j){this.prev=b,this.vars=T,this.block=j}function de(b,T){this.name=b,this.next=T}var L=new de("this",new de("arguments",null));function w(){W.state.context=new K(W.state.context,W.state.localVars,!1),W.state.localVars=L}function oe(){W.state.context=new K(W.state.context,W.state.localVars,!0),W.state.localVars=null}w.lex=oe.lex=!0;function Te(){W.state.localVars=W.state.context.vars,W.state.context=W.state.context.prev}Te.lex=!0;function Z(b,T){var j=function(){var Y=W.state,P=Y.indented;if(Y.lexical.type=="stat")P=Y.lexical.indented;else for(var re=Y.lexical;re&&re.type==")"&&re.align;re=re.prev)P=re.indented;Y.lexical=new Re(P,W.stream.column(),b,null,Y.lexical,T)};return j.lex=!0,j}function ce(){var b=W.state;b.lexical.prev&&(b.lexical.type==")"&&(b.indented=b.lexical.indented),b.lexical=b.lexical.prev)}ce.lex=!0;function ke(b){function T(j){return j==b?k():b==";"||j=="}"||j==")"||j=="]"?Q():k(T)}return T}function _e(b,T){return b=="var"?k(Z("vardef",T),kr,ke(";"),ce):b=="keyword a"?k(Z("form"),Ke,_e,ce):b=="keyword b"?k(Z("form"),_e,ce):b=="keyword d"?W.stream.match(/^\s*$/,!1)?k():k(Z("stat"),Pt,ke(";"),ce):b=="debugger"?k(ke(";")):b=="{"?k(Z("}"),oe,Zt,ce,Te):b==";"?k():b=="if"?(W.state.lexical.info=="else"&&W.state.cc[W.state.cc.length-1]==ce&&W.state.cc.pop()(),k(Z("form"),Ke,_e,ce,Sr)):b=="function"?k(tn):b=="for"?k(Z("form"),oe,ra,_e,Te,ce):b=="class"||S&&T=="interface"?(W.marked="keyword",k(Z("form",b=="class"?b:T),Cr,ce)):b=="variable"?S&&T=="declare"?(W.marked="keyword",k(_e)):S&&(T=="module"||T=="enum"||T=="type")&&W.stream.match(/^\s*\w/,!1)?(W.marked="keyword",T=="enum"?k(fe):T=="type"?k(ia,ke("operator"),Pe,ke(";")):k(Z("form"),At,ke("{"),Z("}"),Zt,ce,ce)):S&&T=="namespace"?(W.marked="keyword",k(Z("form"),we,_e,ce)):S&&T=="abstract"?(W.marked="keyword",k(_e)):k(Z("stat"),wr):b=="switch"?k(Z("form"),Ke,ke("{"),Z("}","switch"),oe,Zt,ce,ce,Te):b=="case"?k(we,ke(":")):b=="default"?k(ke(":")):b=="catch"?k(Z("form"),w,ft,_e,ce,Te):b=="export"?k(Z("stat"),Tr,ce):b=="import"?k(Z("stat"),zn,ce):b=="async"?k(_e):T=="@"?k(we,_e):Q(Z("stat"),we,ke(";"),ce)}function ft(b){if(b=="(")return k(on,ke(")"))}function we(b,T){return ct(b,T,!1)}function Me(b,T){return ct(b,T,!0)}function Ke(b){return b!="("?Q():k(Z(")"),Pt,ke(")"),ce)}function ct(b,T,j){if(W.state.fatArrowAt==W.stream.start){var Y=j?kt:be;if(b=="(")return k(w,Z(")"),De(on,")"),ce,ke("=>"),Y,Te);if(b=="variable")return Q(w,At,ke("=>"),Y,Te)}var P=j?dt:ht;return Oe.hasOwnProperty(b)?k(P):b=="function"?k(tn,P):b=="class"||S&&T=="interface"?(W.marked="keyword",k(Z("form"),hs,ce)):b=="keyword c"||b=="async"?k(j?Me:we):b=="("?k(Z(")"),Pt,ke(")"),ce,P):b=="operator"||b=="spread"?k(j?Me:we):b=="["?k(Z("]"),nt,ce,P):b=="{"?zt(xe,"}",null,P):b=="quasi"?Q(gt,P):b=="new"?k(Gt(j)):k()}function Pt(b){return b.match(/[;\}\)\],]/)?Q():Q(we)}function ht(b,T){return b==","?k(Pt):dt(b,T,!1)}function dt(b,T,j){var Y=j==!1?ht:dt,P=j==!1?we:Me;if(b=="=>")return k(w,j?kt:be,Te);if(b=="operator")return/\+\+|--/.test(T)||S&&T=="!"?k(Y):S&&T=="<"&&W.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?k(Z(">"),De(Pe,">"),ce,Y):T=="?"?k(we,ke(":"),P):k(P);if(b=="quasi")return Q(gt,Y);if(b!=";"){if(b=="(")return zt(Me,")","call",Y);if(b==".")return k(ye,Y);if(b=="[")return k(Z("]"),Pt,ke("]"),ce,Y);if(S&&T=="as")return W.marked="keyword",k(Pe,Y);if(b=="regexp")return W.state.lastType=W.marked="operator",W.stream.backUp(W.stream.pos-W.stream.start-1),k(P)}}function gt(b,T){return b!="quasi"?Q():T.slice(T.length-2)!="${"?k(gt):k(Pt,Ut)}function Ut(b){if(b=="}")return W.marked="string-2",W.state.tokenize=ue,k(gt)}function be(b){return he(W.stream,W.state),Q(b=="{"?_e:we)}function kt(b){return he(W.stream,W.state),Q(b=="{"?_e:Me)}function Gt(b){return function(T){return T=="."?k(b?Zn:On):T=="variable"&&S?k($t,b?dt:ht):Q(b?Me:we)}}function On(b,T){if(T=="target")return W.marked="keyword",k(ht)}function Zn(b,T){if(T=="target")return W.marked="keyword",k(dt)}function wr(b){return b==":"?k(ce,_e):Q(ht,ke(";"),ce)}function ye(b){if(b=="variable")return W.marked="property",k()}function xe(b,T){if(b=="async")return W.marked="property",k(xe);if(b=="variable"||W.style=="keyword"){if(W.marked="property",T=="get"||T=="set")return k(pe);var j;return S&&W.state.fatArrowAt==W.stream.start&&(j=W.stream.match(/^\s*:\s*/,!1))&&(W.state.fatArrowAt=W.stream.pos+j[0].length),k(Fe)}else{if(b=="number"||b=="string")return W.marked=y?"property":W.style+" property",k(Fe);if(b=="jsonld-keyword")return k(Fe);if(S&&R(T))return W.marked="keyword",k(xe);if(b=="[")return k(we,Nn,ke("]"),Fe);if(b=="spread")return k(Me,Fe);if(T=="*")return W.marked="keyword",k(xe);if(b==":")return Q(Fe)}}function pe(b){return b!="variable"?Q(Fe):(W.marked="property",k(tn))}function Fe(b){if(b==":")return k(Me);if(b=="(")return Q(tn)}function De(b,T,j){function Y(P,re){if(j?j.indexOf(P)>-1:P==","){var $e=W.state.lexical;return $e.info=="call"&&($e.pos=($e.pos||0)+1),k(function(mt,It){return mt==T||It==T?Q():Q(b)},Y)}return P==T||re==T?k():j&&j.indexOf(";")>-1?Q(b):k(ke(T))}return function(P,re){return P==T||re==T?k():Q(b,Y)}}function zt(b,T,j){for(var Y=3;Y<arguments.length;Y++)W.cc.push(arguments[Y]);return k(Z(T,j),De(b,T),ce)}function Zt(b){return b=="}"?k():Q(_e,Zt)}function Nn(b,T){if(S){if(b==":")return k(Pe);if(T=="?")return k(Nn)}}function er(b,T){if(S&&(b==":"||T=="in"))return k(Pe)}function Mn(b){if(S&&b==":")return W.stream.match(/^\s*\w+\s+is\b/,!1)?k(we,fs,Pe):k(Pe)}function fs(b,T){if(T=="is")return W.marked="keyword",k()}function Pe(b,T){if(T=="keyof"||T=="typeof"||T=="infer"||T=="readonly")return W.marked="keyword",k(T=="typeof"?Me:Pe);if(b=="variable"||T=="void")return W.marked="type",k(en);if(T=="|"||T=="&")return k(Pe);if(b=="string"||b=="number"||b=="atom")return k(en);if(b=="[")return k(Z("]"),De(Pe,"]",","),ce,en);if(b=="{")return k(Z("}"),me,ce,en);if(b=="(")return k(De(tt,")"),na,en);if(b=="<")return k(De(Pe,">"),Pe);if(b=="quasi")return Q(Ct,en)}function na(b){if(b=="=>")return k(Pe)}function me(b){return b.match(/[\}\)\]]/)?k():b==","||b==";"?k(me):Q(kn,me)}function kn(b,T){if(b=="variable"||W.style=="keyword")return W.marked="property",k(kn);if(T=="?"||b=="number"||b=="string")return k(kn);if(b==":")return k(Pe);if(b=="[")return k(ke("variable"),er,ke("]"),kn);if(b=="(")return Q(Pn,kn);if(!b.match(/[;\}\)\],]/))return k()}function Ct(b,T){return b!="quasi"?Q():T.slice(T.length-2)!="${"?k(Ct):k(Pe,et)}function et(b){if(b=="}")return W.marked="string-2",W.state.tokenize=ue,k(Ct)}function tt(b,T){return b=="variable"&&W.stream.match(/^\s*[?:]/,!1)||T=="?"?k(tt):b==":"?k(Pe):b=="spread"?k(tt):Q(Pe)}function en(b,T){if(T=="<")return k(Z(">"),De(Pe,">"),ce,en);if(T=="|"||b=="."||T=="&")return k(Pe);if(b=="[")return k(Pe,ke("]"),en);if(T=="extends"||T=="implements")return W.marked="keyword",k(Pe);if(T=="?")return k(Pe,ke(":"),Pe)}function $t(b,T){if(T=="<")return k(Z(">"),De(Pe,">"),ce,en)}function an(){return Q(Pe,Tt)}function Tt(b,T){if(T=="=")return k(Pe)}function kr(b,T){return T=="enum"?(W.marked="keyword",k(fe)):Q(At,Nn,sn,cs)}function At(b,T){if(S&&R(T))return W.marked="keyword",k(At);if(b=="variable")return G(T),k();if(b=="spread")return k(At);if(b=="[")return zt(li,"]");if(b=="{")return zt(Rn,"}")}function Rn(b,T){return b=="variable"&&!W.stream.match(/^\s*:/,!1)?(G(T),k(sn)):(b=="variable"&&(W.marked="property"),b=="spread"?k(At):b=="}"?Q():b=="["?k(we,ke("]"),ke(":"),Rn):k(ke(":"),At,sn))}function li(){return Q(At,sn)}function sn(b,T){if(T=="=")return k(Me)}function cs(b){if(b==",")return k(kr)}function Sr(b,T){if(b=="keyword b"&&T=="else")return k(Z("form","else"),_e,ce)}function ra(b,T){if(T=="await")return k(ra);if(b=="(")return k(Z(")"),ui,ce)}function ui(b){return b=="var"?k(kr,Fn):b=="variable"?k(Fn):Q(Fn)}function Fn(b,T){return b==")"?k():b==";"?k(Fn):T=="in"||T=="of"?(W.marked="keyword",k(we,Fn)):Q(we,Fn)}function tn(b,T){if(T=="*")return W.marked="keyword",k(tn);if(b=="variable")return G(T),k(tn);if(b=="(")return k(w,Z(")"),De(on,")"),ce,Mn,_e,Te);if(S&&T=="<")return k(Z(">"),De(an,">"),ce,tn)}function Pn(b,T){if(T=="*")return W.marked="keyword",k(Pn);if(b=="variable")return G(T),k(Pn);if(b=="(")return k(w,Z(")"),De(on,")"),ce,Mn,Te);if(S&&T=="<")return k(Z(">"),De(an,">"),ce,Pn)}function ia(b,T){if(b=="keyword"||b=="variable")return W.marked="type",k(ia);if(T=="<")return k(Z(">"),De(an,">"),ce)}function on(b,T){return T=="@"&&k(we,on),b=="spread"?k(on):S&&R(T)?(W.marked="keyword",k(on)):S&&b=="this"?k(Nn,sn):Q(At,Nn,sn)}function hs(b,T){return b=="variable"?Cr(b,T):ln(b,T)}function Cr(b,T){if(b=="variable")return G(T),k(ln)}function ln(b,T){if(T=="<")return k(Z(">"),De(an,">"),ce,ln);if(T=="extends"||T=="implements"||S&&b==",")return T=="implements"&&(W.marked="keyword"),k(S?Pe:we,ln);if(b=="{")return k(Z("}"),un,ce)}function un(b,T){if(b=="async"||b=="variable"&&(T=="static"||T=="get"||T=="set"||S&&R(T))&&W.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return W.marked="keyword",k(un);if(b=="variable"||W.style=="keyword")return W.marked="property",k(tr,un);if(b=="number"||b=="string")return k(tr,un);if(b=="[")return k(we,Nn,ke("]"),tr,un);if(T=="*")return W.marked="keyword",k(un);if(S&&b=="(")return Q(Pn,un);if(b==";"||b==",")return k(un);if(b=="}")return k();if(T=="@")return k(we,un)}function tr(b,T){if(T=="!"||T=="?")return k(tr);if(b==":")return k(Pe,sn);if(T=="=")return k(Me);var j=W.state.lexical.prev,Y=j&&j.info=="interface";return Q(Y?Pn:tn)}function Tr(b,T){return T=="*"?(W.marked="keyword",k(Er,ke(";"))):T=="default"?(W.marked="keyword",k(we,ke(";"))):b=="{"?k(De(_r,"}"),Er,ke(";")):Q(_e)}function _r(b,T){if(T=="as")return W.marked="keyword",k(ke("variable"));if(b=="variable")return Q(Me,_r)}function zn(b){return b=="string"?k():b=="("?Q(we):b=="."?Q(ht):Q(Lr,mn,Er)}function Lr(b,T){return b=="{"?zt(Lr,"}"):(b=="variable"&&G(T),T=="*"&&(W.marked="keyword"),k(fi))}function mn(b){if(b==",")return k(Lr,mn)}function fi(b,T){if(T=="as")return W.marked="keyword",k(Lr)}function Er(b,T){if(T=="from")return W.marked="keyword",k(we)}function nt(b){return b=="]"?k():Q(De(Me,"]"))}function fe(){return Q(Z("form"),At,ke("{"),Z("}"),De(Sn,"}"),ce,ce)}function Sn(){return Q(At,sn)}function ci(b,T){return b.lastType=="operator"||b.lastType==","||H.test(T.charAt(0))||/[,.]/.test(T.charAt(0))}function Kt(b,T,j){return T.tokenize==$&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(T.lastType)||T.lastType=="quasi"&&/\{\s*$/.test(b.string.slice(0,b.pos-(j||0)))}return{startState:function(b){var T={tokenize:$,lastType:"sof",cc:[],lexical:new Re((b||0)-d,0,"block",!1),localVars:f.localVars,context:f.localVars&&new K(null,null,!1),indented:b||0};return f.globalVars&&typeof f.globalVars=="object"&&(T.globalVars=f.globalVars),T},token:function(b,T){if(b.sol()&&(T.lexical.hasOwnProperty("align")||(T.lexical.align=!1),T.indented=b.indentation(),he(b,T)),T.tokenize!=ne&&b.eatSpace())return null;var j=T.tokenize(b,T);return F=="comment"?j:(T.lastType=F=="operator"&&(N=="++"||N=="--")?"incdec":F,ze(T,j,F,N,b))},indent:function(b,T){if(b.tokenize==ne||b.tokenize==ue)return a.Pass;if(b.tokenize!=$)return 0;var j=T&&T.charAt(0),Y=b.lexical,P;if(!/^\s*else\b/.test(T))for(var re=b.cc.length-1;re>=0;--re){var $e=b.cc[re];if($e==ce)Y=Y.prev;else if($e!=Sr&&$e!=Te)break}for(;(Y.type=="stat"||Y.type=="form")&&(j=="}"||(P=b.cc[b.cc.length-1])&&(P==ht||P==dt)&&!/^[,\.=+\-*:?[\(]/.test(T));)Y=Y.prev;p&&Y.type==")"&&Y.prev.type=="stat"&&(Y=Y.prev);var mt=Y.type,It=j==mt;return mt=="vardef"?Y.indented+(b.lastType=="operator"||b.lastType==","?Y.info.length+1:0):mt=="form"&&j=="{"?Y.indented:mt=="form"?Y.indented+d:mt=="stat"?Y.indented+(ci(b,T)?p||d:0):Y.info=="switch"&&!It&&f.doubleIndentSwitch!=!1?Y.indented+(/^(?:case|default)\b/.test(T)?d:2*d):Y.align?Y.column+(It?0:1):Y.indented+(It?0:d)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:m?null:"/*",blockCommentEnd:m?null:"*/",blockCommentContinue:m?null:" * ",lineComment:m?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:m?"json":"javascript",jsonldMode:y,jsonMode:m,expressionAllowed:Kt,skipExpression:function(b){ze(b,"atom","atom","true",new a.StringStream("",2,null))}}}),a.registerHelper("wordChars","javascript",/[\w$]/),a.defineMIME("text/javascript","javascript"),a.defineMIME("text/ecmascript","javascript"),a.defineMIME("application/javascript","javascript"),a.defineMIME("application/x-javascript","javascript"),a.defineMIME("application/ecmascript","javascript"),a.defineMIME("application/json",{name:"javascript",json:!0}),a.defineMIME("application/x-json",{name:"javascript",json:!0}),a.defineMIME("application/manifest+json",{name:"javascript",json:!0}),a.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),a.defineMIME("text/typescript",{name:"javascript",typescript:!0}),a.defineMIME("application/typescript",{name:"javascript",typescript:!0})})})(),function(l,n){(function(a){a(Wt())})(function(a){var o={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},f=a.Pos;a.defineOption("autoCloseBrackets",!1,function(N,O,$){$&&$!=a.Init&&(N.removeKeyMap(p),N.state.closeBrackets=null),O&&(y(d(O,"pairs")),N.state.closeBrackets=O,N.addKeyMap(p))});function d(N,O){return O=="pairs"&&typeof N=="string"?N:typeof N=="object"&&N[O]!=null?N[O]:o[O]}var p={Backspace:S,Enter:A};function y(N){for(var O=0;O<N.length;O++){var $=N.charAt(O),X="'"+$+"'";p[X]||(p[X]=m($))}}y(o.pairs+"`");function m(N){return function(O){return B(O,N)}}function x(N){var O=N.state.closeBrackets;if(!O||O.override)return O;var $=N.getModeAt(N.getCursor());return $.closeBrackets||O}function S(N){var O=x(N);if(!O||N.getOption("disableInput"))return a.Pass;for(var $=d(O,"pairs"),X=N.listSelections(),ne=0;ne<X.length;ne++){if(!X[ne].empty())return a.Pass;var ue=U(N,X[ne].head);if(!ue||$.indexOf(ue)%2!=0)return a.Pass}for(var ne=X.length-1;ne>=0;ne--){var se=X[ne].head;N.replaceRange("",f(se.line,se.ch-1),f(se.line,se.ch+1),"+delete")}}function A(N){var O=x(N),$=O&&d(O,"explode");if(!$||N.getOption("disableInput"))return a.Pass;for(var X=N.listSelections(),ne=0;ne<X.length;ne++){if(!X[ne].empty())return a.Pass;var ue=U(N,X[ne].head);if(!ue||$.indexOf(ue)%2!=0)return a.Pass}N.operation(function(){var se=N.lineSeparator()||`
25
- `;N.replaceSelection(se+se,null),E(N,-1),X=N.listSelections();for(var he=0;he<X.length;he++){var Oe=X[he].head.line;N.indentLine(Oe,null,!0),N.indentLine(Oe+1,null,!0)}})}function E(N,O){for(var $=[],X=N.listSelections(),ne=0,ue=0;ue<X.length;ue++){var se=X[ue];se.head==N.getCursor()&&(ne=ue);var he=se.head.ch||O>0?{line:se.head.line,ch:se.head.ch+O}:{line:se.head.line-1};$.push({anchor:he,head:he})}N.setSelections($,ne)}function H(N){var O=a.cmpPos(N.anchor,N.head)>0;return{anchor:new f(N.anchor.line,N.anchor.ch+(O?-1:1)),head:new f(N.head.line,N.head.ch+(O?1:-1))}}function B(N,O){var $=x(N);if(!$||N.getOption("disableInput"))return a.Pass;var X=d($,"pairs"),ne=X.indexOf(O);if(ne==-1)return a.Pass;for(var ue=d($,"closeBefore"),se=d($,"triples"),he=X.charAt(ne+1)==O,Oe=N.listSelections(),Re=ne%2==0,ie,ze=0;ze<Oe.length;ze++){var W=Oe[ze],Q=W.head,k,J=N.getRange(Q,f(Q.line,Q.ch+1));if(Re&&!W.empty())k="surround";else if((he||!Re)&&J==O)he&&F(N,Q)?k="both":se.indexOf(O)>=0&&N.getRange(Q,f(Q.line,Q.ch+3))==O+O+O?k="skipThree":k="skip";else if(he&&Q.ch>1&&se.indexOf(O)>=0&&N.getRange(f(Q.line,Q.ch-2),Q)==O+O){if(Q.ch>2&&/\bstring/.test(N.getTokenTypeAt(f(Q.line,Q.ch-2))))return a.Pass;k="addFour"}else if(he){var G=Q.ch==0?" ":N.getRange(f(Q.line,Q.ch-1),Q);if(!a.isWordChar(J)&&G!=O&&!a.isWordChar(G))k="both";else return a.Pass}else if(Re&&(J.length===0||/\s/.test(J)||ue.indexOf(J)>-1))k="both";else return a.Pass;if(!ie)ie=k;else if(ie!=k)return a.Pass}var D=ne%2?X.charAt(ne-1):O,R=ne%2?O:X.charAt(ne+1);N.operation(function(){if(ie=="skip")E(N,1);else if(ie=="skipThree")E(N,3);else if(ie=="surround"){for(var K=N.getSelections(),de=0;de<K.length;de++)K[de]=D+K[de]+R;N.replaceSelections(K,"around"),K=N.listSelections().slice();for(var de=0;de<K.length;de++)K[de]=H(K[de]);N.setSelections(K)}else ie=="both"?(N.replaceSelection(D+R,null),N.triggerElectric(D+R),E(N,-1)):ie=="addFour"&&(N.replaceSelection(D+D+D+D,"before"),E(N,1))})}function U(N,O){var $=N.getRange(f(O.line,O.ch-1),f(O.line,O.ch+1));return $.length==2?$:null}function F(N,O){var $=N.getTokenAt(f(O.line,O.ch+1));return/\bstring/.test($.type)&&$.start==O.ch&&(O.ch==0||!/\bstring/.test(N.getTokenTypeAt(O)))}})}(),function(l,n){(function(a){a(Wt())})(function(a){var o=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),f=a.Pos,d={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function p(E){return E&&E.bracketRegex||/[(){}[\]]/}function y(E,H,B){var U=E.getLineHandle(H.line),F=H.ch-1,N=B&&B.afterCursor;N==null&&(N=/(^| )cm-fat-cursor($| )/.test(E.getWrapperElement().className));var O=p(B),$=!N&&F>=0&&O.test(U.text.charAt(F))&&d[U.text.charAt(F)]||O.test(U.text.charAt(F+1))&&d[U.text.charAt(++F)];if(!$)return null;var X=$.charAt(1)==">"?1:-1;if(B&&B.strict&&X>0!=(F==H.ch))return null;var ne=E.getTokenTypeAt(f(H.line,F+1)),ue=m(E,f(H.line,F+(X>0?1:0)),X,ne,B);return ue==null?null:{from:f(H.line,F),to:ue&&ue.pos,match:ue&&ue.ch==$.charAt(0),forward:X>0}}function m(E,H,B,U,F){for(var N=F&&F.maxScanLineLength||1e4,O=F&&F.maxScanLines||1e3,$=[],X=p(F),ne=B>0?Math.min(H.line+O,E.lastLine()+1):Math.max(E.firstLine()-1,H.line-O),ue=H.line;ue!=ne;ue+=B){var se=E.getLine(ue);if(se){var he=B>0?0:se.length-1,Oe=B>0?se.length:-1;if(!(se.length>N))for(ue==H.line&&(he=H.ch-(B<0?1:0));he!=Oe;he+=B){var Re=se.charAt(he);if(X.test(Re)&&(U===void 0||(E.getTokenTypeAt(f(ue,he+1))||"")==(U||""))){var ie=d[Re];if(ie&&ie.charAt(1)==">"==B>0)$.push(Re);else if($.length)$.pop();else return{pos:f(ue,he),ch:Re}}}}}return ue-B==(B>0?E.lastLine():E.firstLine())?!1:null}function x(E,H,B){for(var U=E.state.matchBrackets.maxHighlightLineLength||1e3,F=B&&B.highlightNonMatching,N=[],O=E.listSelections(),$=0;$<O.length;$++){var X=O[$].empty()&&y(E,O[$].head,B);if(X&&(X.match||F!==!1)&&E.getLine(X.from.line).length<=U){var ne=X.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";N.push(E.markText(X.from,f(X.from.line,X.from.ch+1),{className:ne})),X.to&&E.getLine(X.to.line).length<=U&&N.push(E.markText(X.to,f(X.to.line,X.to.ch+1),{className:ne}))}}if(N.length){o&&E.state.focused&&E.focus();var ue=function(){E.operation(function(){for(var se=0;se<N.length;se++)N[se].clear()})};if(H)setTimeout(ue,800);else return ue}}function S(E){E.operation(function(){E.state.matchBrackets.currentlyHighlighted&&(E.state.matchBrackets.currentlyHighlighted(),E.state.matchBrackets.currentlyHighlighted=null),E.state.matchBrackets.currentlyHighlighted=x(E,!1,E.state.matchBrackets)})}function A(E){E.state.matchBrackets&&E.state.matchBrackets.currentlyHighlighted&&(E.state.matchBrackets.currentlyHighlighted(),E.state.matchBrackets.currentlyHighlighted=null)}a.defineOption("matchBrackets",!1,function(E,H,B){B&&B!=a.Init&&(E.off("cursorActivity",S),E.off("focus",S),E.off("blur",A),A(E)),H&&(E.state.matchBrackets=typeof H=="object"?H:{},E.on("cursorActivity",S),E.on("focus",S),E.on("blur",A))}),a.defineExtension("matchBrackets",function(){x(this,!0)}),a.defineExtension("findMatchingBracket",function(E,H,B){return(B||typeof H=="boolean")&&(B?(B.strict=H,H=B):H=H?{strict:!0}:null),y(this,E,H)}),a.defineExtension("scanForBracket",function(E,H,B,U){return m(this,E,H,B,U)})})}();var Yf={exports:{}};(function(l,n){(function(a){a(Wt())})(function(a){function o(y,m,x,S){if(x&&x.call){var A=x;x=null}else var A=p(y,x,"rangeFinder");typeof m=="number"&&(m=a.Pos(m,0));var E=p(y,x,"minFoldSize");function H(N){var O=A(y,m);if(!O||O.to.line-O.from.line<E)return null;if(S==="fold")return O;for(var $=y.findMarksAt(O.from),X=0;X<$.length;++X)if($[X].__isFold){if(!N)return null;O.cleared=!0,$[X].clear()}return O}var B=H(!0);if(p(y,x,"scanUp"))for(;!B&&m.line>y.firstLine();)m=a.Pos(m.line-1,0),B=H(!1);if(!(!B||B.cleared||S==="unfold")){var U=f(y,x,B);a.on(U,"mousedown",function(N){F.clear(),a.e_preventDefault(N)});var F=y.markText(B.from,B.to,{replacedWith:U,clearOnEnter:p(y,x,"clearOnEnter"),__isFold:!0});F.on("clear",function(N,O){a.signal(y,"unfold",y,N,O)}),a.signal(y,"fold",y,B.from,B.to)}}function f(y,m,x){var S=p(y,m,"widget");if(typeof S=="function"&&(S=S(x.from,x.to)),typeof S=="string"){var A=document.createTextNode(S);S=document.createElement("span"),S.appendChild(A),S.className="CodeMirror-foldmarker"}else S&&(S=S.cloneNode(!0));return S}a.newFoldFunction=function(y,m){return function(x,S){o(x,S,{rangeFinder:y,widget:m})}},a.defineExtension("foldCode",function(y,m,x){o(this,y,m,x)}),a.defineExtension("isFolded",function(y){for(var m=this.findMarksAt(y),x=0;x<m.length;++x)if(m[x].__isFold)return!0}),a.commands.toggleFold=function(y){y.foldCode(y.getCursor())},a.commands.fold=function(y){y.foldCode(y.getCursor(),null,"fold")},a.commands.unfold=function(y){y.foldCode(y.getCursor(),{scanUp:!1},"unfold")},a.commands.foldAll=function(y){y.operation(function(){for(var m=y.firstLine(),x=y.lastLine();m<=x;m++)y.foldCode(a.Pos(m,0),{scanUp:!1},"fold")})},a.commands.unfoldAll=function(y){y.operation(function(){for(var m=y.firstLine(),x=y.lastLine();m<=x;m++)y.foldCode(a.Pos(m,0),{scanUp:!1},"unfold")})},a.registerHelper("fold","combine",function(){var y=Array.prototype.slice.call(arguments,0);return function(m,x){for(var S=0;S<y.length;++S){var A=y[S](m,x);if(A)return A}}}),a.registerHelper("fold","auto",function(y,m){for(var x=y.getHelpers(m,"fold"),S=0;S<x.length;S++){var A=x[S](y,m);if(A)return A}});var d={rangeFinder:a.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};a.defineOption("foldOptions",null);function p(y,m,x){if(m&&m[x]!==void 0)return m[x];var S=y.options.foldOptions;return S&&S[x]!==void 0?S[x]:d[x]}a.defineExtension("foldOption",function(y,m){return p(this,y,m)})})})();var Vf=Yf.exports;(function(l,n){(function(a){a(Wt(),Vf)})(function(a){a.defineOption("foldGutter",!1,function(F,N,O){O&&O!=a.Init&&(F.clearGutter(F.state.foldGutter.options.gutter),F.state.foldGutter=null,F.off("gutterClick",A),F.off("changes",H),F.off("viewportChange",B),F.off("fold",U),F.off("unfold",U),F.off("swapDoc",H),F.off("optionChange",E)),N&&(F.state.foldGutter=new f(d(N)),S(F),F.on("gutterClick",A),F.on("changes",H),F.on("viewportChange",B),F.on("fold",U),F.on("unfold",U),F.on("swapDoc",H),F.on("optionChange",E))});var o=a.Pos;function f(F){this.options=F,this.from=this.to=0}function d(F){return F===!0&&(F={}),F.gutter==null&&(F.gutter="CodeMirror-foldgutter"),F.indicatorOpen==null&&(F.indicatorOpen="CodeMirror-foldgutter-open"),F.indicatorFolded==null&&(F.indicatorFolded="CodeMirror-foldgutter-folded"),F}function p(F,N){for(var O=F.findMarks(o(N,0),o(N+1,0)),$=0;$<O.length;++$)if(O[$].__isFold){var X=O[$].find(-1);if(X&&X.line===N)return O[$]}}function y(F){if(typeof F=="string"){var N=document.createElement("div");return N.className=F+" CodeMirror-guttermarker-subtle",N}else return F.cloneNode(!0)}function m(F,N,O){var $=F.state.foldGutter.options,X=N-1,ne=F.foldOption($,"minFoldSize"),ue=F.foldOption($,"rangeFinder"),se=typeof $.indicatorFolded=="string"&&x($.indicatorFolded),he=typeof $.indicatorOpen=="string"&&x($.indicatorOpen);F.eachLine(N,O,function(Oe){++X;var Re=null,ie=Oe.gutterMarkers;if(ie&&(ie=ie[$.gutter]),p(F,X)){if(se&&ie&&se.test(ie.className))return;Re=y($.indicatorFolded)}else{var ze=o(X,0),W=ue&&ue(F,ze);if(W&&W.to.line-W.from.line>=ne){if(he&&ie&&he.test(ie.className))return;Re=y($.indicatorOpen)}}!Re&&!ie||F.setGutterMarker(Oe,$.gutter,Re)})}function x(F){return new RegExp("(^|\\s)"+F+"(?:$|\\s)\\s*")}function S(F){var N=F.getViewport(),O=F.state.foldGutter;O&&(F.operation(function(){m(F,N.from,N.to)}),O.from=N.from,O.to=N.to)}function A(F,N,O){var $=F.state.foldGutter;if($){var X=$.options;if(O==X.gutter){var ne=p(F,N);ne?ne.clear():F.foldCode(o(N,0),X)}}}function E(F,N){N=="mode"&&H(F)}function H(F){var N=F.state.foldGutter;if(N){var O=N.options;N.from=N.to=0,clearTimeout(N.changeUpdate),N.changeUpdate=setTimeout(function(){S(F)},O.foldOnChangeTimeSpan||600)}}function B(F){var N=F.state.foldGutter;if(N){var O=N.options;clearTimeout(N.changeUpdate),N.changeUpdate=setTimeout(function(){var $=F.getViewport();N.from==N.to||$.from-N.to>20||N.from-$.to>20?S(F):F.operation(function(){$.from<N.from&&(m(F,$.from,N.from),N.from=$.from),$.to>N.to&&(m(F,N.to,$.to),N.to=$.to)})},O.updateViewportTimeSpan||400)}}function U(F,N){var O=F.state.foldGutter;if(O){var $=N.line;$>=O.from&&$<O.to&&m(F,$,$+1)}}})})(),function(l,n){(function(a){a(Wt())})(function(a){function o(f){return function(d,p){var y=p.line,m=d.getLine(y);function x(U){for(var F,N=p.ch,O=0;;){var $=N<=0?-1:m.lastIndexOf(U[0],N-1);if($==-1){if(O==1)break;O=1,N=m.length;continue}if(O==1&&$<p.ch)break;if(F=d.getTokenTypeAt(a.Pos(y,$+1)),!/^(comment|string)/.test(F))return{ch:$+1,tokenType:F,pair:U};N=$-1}}function S(U){var F=1,N=d.lastLine(),O,$=U.ch,X;e:for(var ne=y;ne<=N;++ne)for(var ue=d.getLine(ne),se=ne==y?$:0;;){var he=ue.indexOf(U.pair[0],se),Oe=ue.indexOf(U.pair[1],se);if(he<0&&(he=ue.length),Oe<0&&(Oe=ue.length),se=Math.min(he,Oe),se==ue.length)break;if(d.getTokenTypeAt(a.Pos(ne,se+1))==U.tokenType){if(se==he)++F;else if(!--F){O=ne,X=se;break e}}++se}return O==null||y==O?null:{from:a.Pos(y,$),to:a.Pos(O,X)}}for(var A=[],E=0;E<f.length;E++){var H=x(f[E]);H&&A.push(H)}A.sort(function(U,F){return U.ch-F.ch});for(var E=0;E<A.length;E++){var B=S(A[E]);if(B)return B}return null}}a.registerHelper("fold","brace",o([["{","}"],["[","]"]])),a.registerHelper("fold","brace-paren",o([["{","}"],["[","]"],["(",")"]])),a.registerHelper("fold","import",function(f,d){function p(E){if(E<f.firstLine()||E>f.lastLine())return null;var H=f.getTokenAt(a.Pos(E,1));if(/\S/.test(H.string)||(H=f.getTokenAt(a.Pos(E,H.end+1))),H.type!="keyword"||H.string!="import")return null;for(var B=E,U=Math.min(f.lastLine(),E+10);B<=U;++B){var F=f.getLine(B),N=F.indexOf(";");if(N!=-1)return{startCh:H.end,end:a.Pos(B,N)}}}var y=d.line,m=p(y),x;if(!m||p(y-1)||(x=p(y-2))&&x.end.line==y-1)return null;for(var S=m.end;;){var A=p(S.line+1);if(A==null)break;S=A.end}return{from:f.clipPos(a.Pos(y,m.startCh+1)),to:S}}),a.registerHelper("fold","include",function(f,d){function p(A){if(A<f.firstLine()||A>f.lastLine())return null;var E=f.getTokenAt(a.Pos(A,1));if(/\S/.test(E.string)||(E=f.getTokenAt(a.Pos(A,E.end+1))),E.type=="meta"&&E.string.slice(0,8)=="#include")return E.start+8}var y=d.line,m=p(y);if(m==null||p(y-1)!=null)return null;for(var x=y;;){var S=p(x+1);if(S==null)break;++x}return{from:a.Pos(y,m+1),to:f.clipPos(a.Pos(x))}})})}(),function(l,n){(function(a){a(Wt())})(function(a){function o(f,d){var p=f.getLine(d),y=p.search(/\S/);return y==-1||/\bcomment\b/.test(f.getTokenTypeAt(a.Pos(d,y+1)))?-1:a.countColumn(p,null,f.getOption("tabSize"))}a.registerHelper("fold","indent",function(f,d){var p=o(f,d.line);if(!(p<0)){for(var y=null,m=d.line+1,x=f.lastLine();m<=x;++m){var S=o(f,m);if(S!=-1)if(S>p)y=m;else break}if(y)return{from:a.Pos(d.line,f.getLine(d.line).length),to:a.Pos(y,f.getLine(y).length)}}})})}(),function(l,n){(function(a){a(Wt())})(function(a){a.defineOption("autoRefresh",!1,function(d,p){d.state.autoRefresh&&(f(d,d.state.autoRefresh),d.state.autoRefresh=null),p&&d.display.wrapper.offsetHeight==0&&o(d,d.state.autoRefresh={delay:p.delay||250})});function o(d,p){function y(){d.display.wrapper.offsetHeight?(f(d,p),d.display.lastWrapHeight!=d.display.wrapper.clientHeight&&d.refresh()):p.timeout=setTimeout(y,p.delay)}p.timeout=setTimeout(y,p.delay),p.hurry=function(){clearTimeout(p.timeout),p.timeout=setTimeout(y,50)},a.on(window,"mouseup",p.hurry),a.on(window,"keyup",p.hurry)}function f(d,p){clearTimeout(p.timeout),a.off(window,"mouseup",p.hurry),a.off(window,"keyup",p.hurry)}})}();const uo=it.defineStore("trace",{state:()=>({traces:[],currentTrace:null}),getters:{getTraces:l=>l.traces,getCurrentTrace:l=>l.currentTrace},actions:{setTraces(l){this.traces=l},setCurrentTrace(l){this.currentTrace=l}}}),Jf=()=>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",An=Yt.create({baseURL:Jf(),timeout:36e5}),Vt={getExperiments(){return An.post("/experiments/search").then(l=>l.data)},getTraceStatus(){return An.get("/v1/dict/traceStatus").then(l=>l.data)},getTraceList(l,n,a,o,f,d,p){const y={};return l&&(y.query=l),n&&(y.startTime=n),a&&(y.endTime=a),o&&(y.pageNum=o),f&&(y.pageSize=f),d&&(y.experimentId=d),p&&(y.status=p),An.get("/v1/trace",{params:y}).then(m=>m.data)},getTraceDetail(l){return An.get(`/v1/trace/${l}`).then(n=>n.data)},getTraceSpans(l,n={}){const{query:a="",has_events:o,page_num:f=1,page_size:d=100}=n,p={query:a||"",page_num:f,page_size:d};return o===!0&&(p.has_events=!0),An.post(`/v1/trace/${l}/spans`,p).then(y=>y.data)},getSpanContent(l,n){return An.get(`/v1/trace/${l}/span/${n}/content`).then(a=>a.data)},deleteTraces(l,n,a,o,f){const d={};return l&&(d.query=l),n&&(d.startTime=n),a&&(d.endTime=a),o&&(d.experimentId=o),f&&(d.status=f),An.delete("/v1/trace",{params:d}).then(p=>p.data)},debugTrace(l,n={}){return An.post("/debug",l,{headers:n}).then(a=>a.data)}};var fo={exports:{}};(function(l,n){(function(a,o){l.exports=o(Wt())})(oo,function(a){return function(o){function f(p){if(d[p])return d[p].exports;var y=d[p]={i:p,l:!1,exports:{}};return o[p].call(y.exports,y,y.exports,f),y.l=!0,y.exports}var d={};return f.m=o,f.c=d,f.i=function(p){return p},f.d=function(p,y,m){f.o(p,y)||Object.defineProperty(p,y,{configurable:!1,enumerable:!0,get:m})},f.n=function(p){var y=p&&p.__esModule?function(){return p.default}:function(){return p};return f.d(y,"a",y),y},f.o=function(p,y){return Object.prototype.hasOwnProperty.call(p,y)},f.p="/",f(f.s=3)}([function(o,f){o.exports=a},function(o,f,d){Object.defineProperty(f,"__esModule",{value:!0});var p=d(0),y=function(x){return x&&x.__esModule?x:{default:x}}(p),m=window.CodeMirror||y.default;typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(x,S){if(x==null)throw new TypeError("Cannot convert undefined or null to object");for(var A=Object(x),E=1;E<arguments.length;E++){var H=arguments[E];if(H!=null)for(var B in H)Object.prototype.hasOwnProperty.call(H,B)&&(A[B]=H[B])}return A},writable:!0,configurable:!0}),f.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(x){for(var S in x)this.cminstance.setOption(S,x[S])}},merge:function(){this.$nextTick(this.switchMerge)},code:function(x){this.handerCodeChange(x)},value:function(x){this.handerCodeChange(x)}},methods:{initialize:function(){var x=this,S=Object.assign({},this.globalOptions,this.options);this.merge?(this.codemirror=m.MergeView(this.$refs.mergeview,S),this.cminstance=this.codemirror.edit):(this.codemirror=m.fromTextArea(this.$refs.textarea,S),this.cminstance=this.codemirror,this.cminstance.setValue(this.code||this.value||this.content)),this.cminstance.on("change",function(E){x.content=E.getValue(),x.$emit&&x.$emit("input",x.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(E){return!A[E]&&(A[E]=!0)}).forEach(function(E){x.cminstance.on(E,function(){for(var H=arguments.length,B=Array(H),U=0;U<H;U++)B[U]=arguments[U];x.$emit.apply(x,[E].concat(B));var F=E.replace(/([A-Z])/g,"-$1").toLowerCase();F!==E&&x.$emit.apply(x,[F].concat(B))})}),this.$emit("ready",this.codemirror),this.unseenLineMarkers(),this.refresh()},refresh:function(){var x=this;this.$nextTick(function(){x.cminstance.refresh()})},destroy:function(){var x=this.cminstance.doc.cm.getWrapperElement();x&&x.remove&&x.remove()},handerCodeChange:function(x){if(x!==this.cminstance.getValue()){var S=this.cminstance.getScrollInfo();this.cminstance.setValue(x),this.content=x,this.cminstance.scrollTo(S.left,S.top)}this.unseenLineMarkers()},unseenLineMarkers:function(){var x=this;this.unseenLines!==void 0&&this.marker!==void 0&&this.unseenLines.forEach(function(S){var A=x.cminstance.lineInfo(S);x.cminstance.setGutterMarker(S,"breakpoints",A.gutterMarkers?null:x.marker())})},switchMerge:function(){var x=this.cminstance.doc.history,S=this.cminstance.doc.cleanGeneration;this.options.value=this.cminstance.getValue(),this.destroy(),this.initialize(),this.cminstance.doc.history=x,this.cminstance.doc.cleanGeneration=S}},mounted:function(){this.initialize()},beforeDestroy:function(){this.destroy()}}},function(o,f,d){Object.defineProperty(f,"__esModule",{value:!0});var p=d(1),y=d.n(p);for(var m in p)["default","default"].indexOf(m)<0&&function(E){d.d(f,E,function(){return p[E]})}(m);var x=d(5),S=d(4),A=S(y.a,x.a,!1,null,null,null);f.default=A.exports},function(o,f,d){function p(B){return B&&B.__esModule?B:{default:B}}Object.defineProperty(f,"__esModule",{value:!0}),f.install=f.codemirror=f.CodeMirror=void 0;var y=d(0),m=p(y),x=d(2),S=p(x),A=window.CodeMirror||m.default,E=function(B,U){U&&(U.options&&(S.default.props.globalOptions.default=function(){return U.options}),U.events&&(S.default.props.globalEvents.default=function(){return U.events})),B.component(S.default.name,S.default)},H={CodeMirror:A,codemirror:S.default,install:E};f.default=H,f.CodeMirror=A,f.codemirror=S.default,f.install=E},function(o,f){o.exports=function(d,p,y,m,x,S){var A,E=d=d||{},H=typeof d.default;H!=="object"&&H!=="function"||(A=d,E=d.default);var B=typeof E=="function"?E.options:E;p&&(B.render=p.render,B.staticRenderFns=p.staticRenderFns,B._compiled=!0),y&&(B.functional=!0),x&&(B._scopeId=x);var U;if(S?(U=function(O){O=O||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,O||typeof __VUE_SSR_CONTEXT__>"u"||(O=__VUE_SSR_CONTEXT__),m&&m.call(this,O),O&&O._registeredComponents&&O._registeredComponents.add(S)},B._ssrRegister=U):m&&(U=m),U){var F=B.functional,N=F?B.render:B.beforeCreate;F?(B._injectStyles=U,B.render=function(O,$){return U.call($),N(O,$)}):B.beforeCreate=N?[].concat(N,U):[U]}return{esModule:A,exports:E,options:B}}},function(o,f,d){var p=function(){var x=this,S=x.$createElement,A=x._self._c||S;return A("div",{staticClass:"vue-codemirror",class:{merge:x.merge}},[x.merge?A("div",{ref:"mergeview"}):A("textarea",{ref:"textarea",attrs:{name:x.name,placeholder:x.placeholder}})])},y=[],m={render:p,staticRenderFns:y};f.a=m}])})})(fo);var co=fo.exports;function Pa(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Xn=Pa();function ho(l){Xn=l}const po=/[&<>"']/,Qf=new RegExp(po.source,"g"),go=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Zf=new RegExp(go.source,"g"),ec={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},mo=l=>ec[l];function jt(l,n){if(n){if(po.test(l))return l.replace(Qf,mo)}else if(go.test(l))return l.replace(Zf,mo);return l}const tc=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function nc(l){return l.replace(tc,(n,a)=>(a=a.toLowerCase(),a==="colon"?":":a.charAt(0)==="#"?a.charAt(1)==="x"?String.fromCharCode(parseInt(a.substring(2),16)):String.fromCharCode(+a.substring(1)):""))}const rc=/(^|[^\[])\^/g;function je(l,n){let a=typeof l=="string"?l:l.source;n=n||"";const o={replace:(f,d)=>{let p=typeof d=="string"?d:d.source;return p=p.replace(rc,"$1"),a=a.replace(f,p),o},getRegex:()=>new RegExp(a,n)};return o}function vo(l){try{l=encodeURI(l).replace(/%25/g,"%")}catch{return null}return l}const Yr={exec:()=>null};function yo(l,n){const a=l.replace(/\|/g,(d,p,y)=>{let m=!1,x=p;for(;--x>=0&&y[x]==="\\";)m=!m;return m?"|":" |"}),o=a.split(/ \|/);let f=0;if(o[0].trim()||o.shift(),o.length>0&&!o[o.length-1].trim()&&o.pop(),n)if(o.length>n)o.splice(n);else for(;o.length<n;)o.push("");for(;f<o.length;f++)o[f]=o[f].trim().replace(/\\\|/g,"|");return o}function $i(l,n,a){const o=l.length;if(o===0)return"";let f=0;for(;f<o&&l.charAt(o-f-1)===n;)f++;return l.slice(0,o-f)}function ic(l,n){if(l.indexOf(n[1])===-1)return-1;let a=0;for(let o=0;o<l.length;o++)if(l[o]==="\\")o++;else if(l[o]===n[0])a++;else if(l[o]===n[1]&&(a--,a<0))return o;return-1}function bo(l,n,a,o){const f=n.href,d=n.title?jt(n.title):null,p=l[1].replace(/\\([\[\]])/g,"$1");if(l[0].charAt(0)!=="!"){o.state.inLink=!0;const y={type:"link",raw:a,href:f,title:d,text:p,tokens:o.inlineTokens(p)};return o.state.inLink=!1,y}return{type:"image",raw:a,href:f,title:d,text:jt(p)}}function ac(l,n){const a=l.match(/^(\s+)(?:```)/);if(a===null)return n;const o=a[1];return n.split(`
26
- `).map(f=>{const d=f.match(/^\s+/);if(d===null)return f;const[p]=d;return p.length>=o.length?f.slice(o.length):f}).join(`
27
- `)}class Bi{constructor(n){Je(this,"options");Je(this,"rules");Je(this,"lexer");this.options=n||Xn}space(n){const a=this.rules.block.newline.exec(n);if(a&&a[0].length>0)return{type:"space",raw:a[0]}}code(n){const a=this.rules.block.code.exec(n);if(a){const o=a[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:a[0],codeBlockStyle:"indented",text:this.options.pedantic?o:$i(o,`
28
- `)}}}fences(n){const a=this.rules.block.fences.exec(n);if(a){const o=a[0],f=ac(o,a[3]||"");return{type:"code",raw:o,lang:a[2]?a[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):a[2],text:f}}}heading(n){const a=this.rules.block.heading.exec(n);if(a){let o=a[2].trim();if(/#$/.test(o)){const f=$i(o,"#");(this.options.pedantic||!f||/ $/.test(f))&&(o=f.trim())}return{type:"heading",raw:a[0],depth:a[1].length,text:o,tokens:this.lexer.inline(o)}}}hr(n){const a=this.rules.block.hr.exec(n);if(a)return{type:"hr",raw:a[0]}}blockquote(n){const a=this.rules.block.blockquote.exec(n);if(a){const o=$i(a[0].replace(/^ *>[ \t]?/gm,""),`
29
- `),f=this.lexer.state.top;this.lexer.state.top=!0;const d=this.lexer.blockTokens(o);return this.lexer.state.top=f,{type:"blockquote",raw:a[0],tokens:d,text:o}}}list(n){let a=this.rules.block.list.exec(n);if(a){let o=a[1].trim();const f=o.length>1,d={type:"list",raw:"",ordered:f,start:f?+o.slice(0,-1):"",loose:!1,items:[]};o=f?`\\d{1,9}\\${o.slice(-1)}`:`\\${o}`,this.options.pedantic&&(o=f?o:"[*+-]");const p=new RegExp(`^( {0,3}${o})((?:[ ][^\\n]*)?(?:\\n|$))`);let y="",m="",x=!1;for(;n;){let S=!1;if(!(a=p.exec(n))||this.rules.block.hr.test(n))break;y=a[0],n=n.substring(y.length);let A=a[2].split(`
24
+ outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var _;S&&(_=s.ownerDocument.defaultView.scrollY),r.input.focus(),S&&s.ownerDocument.defaultView.scrollTo(null,_),r.input.reset(),i.somethingSelected()||(s.value=t.prevInput=" "),t.contextMenuPending=I,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function R(){if(s.selectionStart!=null){var U=i.somethingSelected(),V="​"+(U?s.value:"");s.value="⇚",s.value=V,t.prevInput=U?"":"​",s.selectionStart=1,s.selectionEnd=V.length,r.selForContextMenu=i.doc.sel}}function I(){if(t.contextMenuPending==I&&(t.contextMenuPending=!1,t.wrapper.style.cssText=v,s.style.cssText=g,m&&w<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=f),s.selectionStart!=null)){(!m||m&&w<9)&&R();var U=0,V=function(){r.selForContextMenu==i.doc.sel&&s.selectionStart==0&&s.selectionEnd>0&&t.prevInput=="​"?yt(i,lc)(i):U++<10?r.detectingSelectAll=setTimeout(V,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(V,200)}}if(m&&w>=9&&R(),Me){Mn(e);var H=function(){Ct(window,"mouseup",H),setTimeout(I,20)};me(window,"mouseup",H)}else setTimeout(I,50)},st.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},st.prototype.setUneditable=function(){},st.prototype.needsContentAttribute=!1;function Gm(e,t){if(t=t?we(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 i=F(Te(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=h.getValue()}var s;if(e.form&&(me(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var u=e.form;s=u.submit;try{var f=u.submit=function(){r(),u.submit=s,u.submit(),u.submit=f}}catch{}}t.finishInit=function(g){g.save=r,g.getTextArea=function(){return e},g.toTextArea=function(){g.toTextArea=isNaN,r(),e.parentNode.removeChild(g.getWrapperElement()),e.style.display="",e.form&&(Ct(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=s))}},e.style.display="none";var h=Ve(function(g){return e.parentNode.insertBefore(g,e.nextSibling)},t);return h}function Km(e){e.off=Ct,e.on=me,e.wheelEventPixels=em,e.Doc=Nt,e.splitLines=tn,e.countColumn=_e,e.findColumn=dt,e.isWordChar=ye,e.Pass=Ke,e.signal=et,e.Line=Ar,e.changeEnd=jn,e.scrollbarModel=$u,e.Pos=$,e.cmpPos=re,e.modes=Cr,e.mimeModes=ln,e.resolveMode=Tr,e.getMode=_r,e.modeExtensions=$n,e.extendMode=Lr,e.copyState=mn,e.startState=Er,e.innerMode=ci,e.commands=Ri,e.keyMap=Dn,e.keyName=Cc,e.isModifierKey=wc,e.lookupKey=jr,e.normalizeKeyMap=wm,e.StringStream=nt,e.SharedTextMarker=Ii,e.TextMarker=Un,e.LineWidget=Ai,e.e_preventDefault=Tt,e.e_stopPropagation=wr,e.e_stop=Mn,e.addClass=K,e.contains=D,e.rmClass=$e,e.keyNames=Gn}$m(Ve),Wm(Ve);var Xm="iter insert remove copy getEditor constructor".split(" ");for(var Ra in Nt.prototype)Nt.prototype.hasOwnProperty(Ra)&&ke(Xm,Ra)<0&&(Ve.prototype[Ra]=function(e){return function(){return e.apply(this.doc,arguments)}}(Nt.prototype[Ra]));return an(Nt),Ve.inputStyles={textarea:st,contenteditable:We},Ve.defineMode=function(e){!Ve.defaults.mode&&e!="null"&&(Ve.defaults.mode=e),un.apply(this,arguments)},Ve.defineMIME=tr,Ve.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ve.defineMIME("text/plain","null"),Ve.defineExtension=function(e,t){Ve.prototype[e]=t},Ve.defineDocExtension=function(e,t){Nt.prototype[e]=t},Ve.fromTextArea=Gm,Km(Ve),Ve.version="5.65.20",Ve})}(Fa)),Fa.exports}(function(l,n){(function(a){a(Wt())})(function(a){a.defineMode("javascript",function(o,c){var d=o.indentUnit,p=c.statementIndent,y=c.jsonld,m=c.json||y,w=c.trackScope!==!1,S=c.typescript,M=c.wordCharacters||/[\w$\xa1-\uffff]/,E=function(){function b(mt){return{type:mt,style:"keyword"}}var T=b("keyword a"),q=b("keyword b"),Y=b("keyword c"),$=b("keyword d"),re=b("operator"),ze={type:"atom",style:"atom"};return{if:b("if"),while:T,with:T,else:q,do:q,try:q,finally:q,return:$,break:$,continue:$,new:b("new"),delete:Y,void:Y,throw:Y,debugger:b("debugger"),var:b("var"),const:b("var"),let:b("var"),function:b("function"),catch:b("catch"),for:b("for"),switch:b("switch"),case:b("case"),default:b("default"),in:re,typeof:re,instanceof:re,true:ze,false:ze,null:ze,undefined:ze,NaN:ze,Infinity:ze,this:b("this"),class:b("class"),super:b("atom"),yield:Y,export:b("export"),import:b("import"),extends:Y,await:Y}}(),A=/[+\-*&%=<>!?|~^@]/,z=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function B(b){for(var T=!1,q,Y=!1;(q=b.next())!=null;){if(!T){if(q=="/"&&!Y)return;q=="["?Y=!0:Y&&q=="]"&&(Y=!1)}T=!T&&q=="\\"}}var P,N;function O(b,T,q){return P=b,N=q,T}function W(b,T){var q=b.next();if(q=='"'||q=="'")return T.tokenize=X(q),T.tokenize(b,T);if(q=="."&&b.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return O("number","number");if(q=="."&&b.match(".."))return O("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(q))return O(q);if(q=="="&&b.eat(">"))return O("=>","operator");if(q=="0"&&b.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return O("number","number");if(/\d/.test(q))return b.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),O("number","number");if(q=="/")return b.eat("*")?(T.tokenize=ne,ne(b,T)):b.eat("/")?(b.skipToEnd(),O("comment","comment")):Kt(b,T,1)?(B(b),b.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),O("regexp","string-2")):(b.eat("="),O("operator","operator",b.current()));if(q=="`")return T.tokenize=ue,ue(b,T);if(q=="#"&&b.peek()=="!")return b.skipToEnd(),O("meta","meta");if(q=="#"&&b.eatWhile(M))return O("variable","property");if(q=="<"&&b.match("!--")||q=="-"&&b.match("->")&&!/\S/.test(b.string.slice(0,b.start)))return b.skipToEnd(),O("comment","comment");if(A.test(q))return(q!=">"||!T.lexical||T.lexical.type!=">")&&(b.eat("=")?(q=="!"||q=="=")&&b.eat("="):/[<>*+\-|&?]/.test(q)&&(b.eat(q),q==">"&&b.eat(q))),q=="?"&&b.eat(".")?O("."):O("operator","operator",b.current());if(M.test(q)){b.eatWhile(M);var Y=b.current();if(T.lastType!="."){if(E.propertyIsEnumerable(Y)){var $=E[Y];return O($.type,$.style,Y)}if(Y=="async"&&b.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return O("async","keyword",Y)}return O("variable","variable",Y)}}function X(b){return function(T,q){var Y=!1,$;if(y&&T.peek()=="@"&&T.match(z))return q.tokenize=W,O("jsonld-keyword","meta");for(;($=T.next())!=null&&!($==b&&!Y);)Y=!Y&&$=="\\";return Y||(q.tokenize=W),O("string","string")}}function ne(b,T){for(var q=!1,Y;Y=b.next();){if(Y=="/"&&q){T.tokenize=W;break}q=Y=="*"}return O("comment","comment")}function ue(b,T){for(var q=!1,Y;(Y=b.next())!=null;){if(!q&&(Y=="`"||Y=="$"&&b.eat("{"))){T.tokenize=W;break}q=!q&&Y=="\\"}return O("quasi","string-2",b.current())}var se="([{}])";function he(b,T){T.fatArrowAt&&(T.fatArrowAt=null);var q=b.string.indexOf("=>",b.start);if(!(q<0)){if(S){var Y=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(b.string.slice(b.start,q));Y&&(q=Y.index)}for(var $=0,re=!1,ze=q-1;ze>=0;--ze){var mt=b.string.charAt(ze),It=se.indexOf(mt);if(It>=0&&It<3){if(!$){++ze;break}if(--$==0){mt=="("&&(re=!0);break}}else if(It>=3&&It<6)++$;else if(M.test(mt))re=!0;else if(/["'\/`]/.test(mt))for(;;--ze){if(ze==0)return;var Dr=b.string.charAt(ze-1);if(Dr==mt&&b.string.charAt(ze-2)!="\\"){ze--;break}}else if(re&&!$){++ze;break}}re&&!$&&(T.fatArrowAt=ze)}}var Oe={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};function Me(b,T,q,Y,$,re){this.indented=b,this.column=T,this.type=q,this.prev=$,this.info=re,Y!=null&&(this.align=Y)}function ie(b,T){if(!w)return!1;for(var q=b.localVars;q;q=q.next)if(q.name==T)return!0;for(var Y=b.context;Y;Y=Y.prev)for(var q=Y.vars;q;q=q.next)if(q.name==T)return!0}function $e(b,T,q,Y,$){var re=b.cc;for(j.state=b,j.stream=$,j.marked=null,j.cc=re,j.style=T,b.lexical.hasOwnProperty("align")||(b.lexical.align=!0);;){var ze=re.length?re.pop():m?ke:_e;if(ze(q,Y)){for(;re.length&&re[re.length-1].lex;)re.pop()();return j.marked?j.marked:q=="variable"&&ie(b,Y)?"variable-2":T}}}var j={state:null,marked:null,cc:null};function Q(){for(var b=arguments.length-1;b>=0;b--)j.cc.push(arguments[b])}function k(){return Q.apply(null,arguments),!0}function J(b,T){for(var q=T;q;q=q.next)if(q.name==b)return!0;return!1}function G(b){var T=j.state;if(j.marked="def",!!w){if(T.context){if(T.lexical.info=="var"&&T.context&&T.context.block){var q=D(b,T.context);if(q!=null){T.context=q;return}}else if(!J(b,T.localVars)){T.localVars=new de(b,T.localVars);return}}c.globalVars&&!J(b,T.globalVars)&&(T.globalVars=new de(b,T.globalVars))}}function D(b,T){if(T)if(T.block){var q=D(b,T.prev);return q?q==T.prev?T:new K(q,T.vars,!0):null}else return J(b,T.vars)?T:new K(T.prev,new de(b,T.vars),!1);else return null}function F(b){return b=="public"||b=="private"||b=="protected"||b=="abstract"||b=="readonly"}function K(b,T,q){this.prev=b,this.vars=T,this.block=q}function de(b,T){this.name=b,this.next=T}var L=new de("this",new de("arguments",null));function x(){j.state.context=new K(j.state.context,j.state.localVars,!1),j.state.localVars=L}function oe(){j.state.context=new K(j.state.context,j.state.localVars,!0),j.state.localVars=null}x.lex=oe.lex=!0;function Te(){j.state.localVars=j.state.context.vars,j.state.context=j.state.context.prev}Te.lex=!0;function Z(b,T){var q=function(){var Y=j.state,$=Y.indented;if(Y.lexical.type=="stat")$=Y.lexical.indented;else for(var re=Y.lexical;re&&re.type==")"&&re.align;re=re.prev)$=re.indented;Y.lexical=new Me($,j.stream.column(),b,null,Y.lexical,T)};return q.lex=!0,q}function fe(){var b=j.state;b.lexical.prev&&(b.lexical.type==")"&&(b.indented=b.lexical.indented),b.lexical=b.lexical.prev)}fe.lex=!0;function we(b){function T(q){return q==b?k():b==";"||q=="}"||q==")"||q=="]"?Q():k(T)}return T}function _e(b,T){return b=="var"?k(Z("vardef",T),wr,we(";"),fe):b=="keyword a"?k(Z("form"),Ke,_e,fe):b=="keyword b"?k(Z("form"),_e,fe):b=="keyword d"?j.stream.match(/^\s*$/,!1)?k():k(Z("stat"),Pt,we(";"),fe):b=="debugger"?k(we(";")):b=="{"?k(Z("}"),oe,Zt,fe,Te):b==";"?k():b=="if"?(j.state.lexical.info=="else"&&j.state.cc[j.state.cc.length-1]==fe&&j.state.cc.pop()(),k(Z("form"),Ke,_e,fe,Sr)):b=="function"?k(tn):b=="for"?k(Z("form"),oe,ra,_e,Te,fe):b=="class"||S&&T=="interface"?(j.marked="keyword",k(Z("form",b=="class"?b:T),Cr,fe)):b=="variable"?S&&T=="declare"?(j.marked="keyword",k(_e)):S&&(T=="module"||T=="enum"||T=="type")&&j.stream.match(/^\s*\w/,!1)?(j.marked="keyword",T=="enum"?k(ce):T=="type"?k(ia,we("operator"),Pe,we(";")):k(Z("form"),At,we("{"),Z("}"),Zt,fe,fe)):S&&T=="namespace"?(j.marked="keyword",k(Z("form"),ke,_e,fe)):S&&T=="abstract"?(j.marked="keyword",k(_e)):k(Z("stat"),kr):b=="switch"?k(Z("form"),Ke,we("{"),Z("}","switch"),oe,Zt,fe,fe,Te):b=="case"?k(ke,we(":")):b=="default"?k(we(":")):b=="catch"?k(Z("form"),x,ct,_e,fe,Te):b=="export"?k(Z("stat"),Tr,fe):b=="import"?k(Z("stat"),$n,fe):b=="async"?k(_e):T=="@"?k(ke,_e):Q(Z("stat"),ke,we(";"),fe)}function ct(b){if(b=="(")return k(on,we(")"))}function ke(b,T){return ft(b,T,!1)}function Re(b,T){return ft(b,T,!0)}function Ke(b){return b!="("?Q():k(Z(")"),Pt,we(")"),fe)}function ft(b,T,q){if(j.state.fatArrowAt==j.stream.start){var Y=q?wt:be;if(b=="(")return k(x,Z(")"),De(on,")"),fe,we("=>"),Y,Te);if(b=="variable")return Q(x,At,we("=>"),Y,Te)}var $=q?dt:ht;return Oe.hasOwnProperty(b)?k($):b=="function"?k(tn,$):b=="class"||S&&T=="interface"?(j.marked="keyword",k(Z("form"),hs,fe)):b=="keyword c"||b=="async"?k(q?Re:ke):b=="("?k(Z(")"),Pt,we(")"),fe,$):b=="operator"||b=="spread"?k(q?Re:ke):b=="["?k(Z("]"),nt,fe,$):b=="{"?$t(xe,"}",null,$):b=="quasi"?Q(gt,$):b=="new"?k(Gt(q)):k()}function Pt(b){return b.match(/[;\}\)\],]/)?Q():Q(ke)}function ht(b,T){return b==","?k(Pt):dt(b,T,!1)}function dt(b,T,q){var Y=q==!1?ht:dt,$=q==!1?ke:Re;if(b=="=>")return k(x,q?wt:be,Te);if(b=="operator")return/\+\+|--/.test(T)||S&&T=="!"?k(Y):S&&T=="<"&&j.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?k(Z(">"),De(Pe,">"),fe,Y):T=="?"?k(ke,we(":"),$):k($);if(b=="quasi")return Q(gt,Y);if(b!=";"){if(b=="(")return $t(Re,")","call",Y);if(b==".")return k(ye,Y);if(b=="[")return k(Z("]"),Pt,we("]"),fe,Y);if(S&&T=="as")return j.marked="keyword",k(Pe,Y);if(b=="regexp")return j.state.lastType=j.marked="operator",j.stream.backUp(j.stream.pos-j.stream.start-1),k($)}}function gt(b,T){return b!="quasi"?Q():T.slice(T.length-2)!="${"?k(gt):k(Pt,Ut)}function Ut(b){if(b=="}")return j.marked="string-2",j.state.tokenize=ue,k(gt)}function be(b){return he(j.stream,j.state),Q(b=="{"?_e:ke)}function wt(b){return he(j.stream,j.state),Q(b=="{"?_e:Re)}function Gt(b){return function(T){return T=="."?k(b?Zn:On):T=="variable"&&S?k(zt,b?dt:ht):Q(b?Re:ke)}}function On(b,T){if(T=="target")return j.marked="keyword",k(ht)}function Zn(b,T){if(T=="target")return j.marked="keyword",k(dt)}function kr(b){return b==":"?k(fe,_e):Q(ht,we(";"),fe)}function ye(b){if(b=="variable")return j.marked="property",k()}function xe(b,T){if(b=="async")return j.marked="property",k(xe);if(b=="variable"||j.style=="keyword"){if(j.marked="property",T=="get"||T=="set")return k(pe);var q;return S&&j.state.fatArrowAt==j.stream.start&&(q=j.stream.match(/^\s*:\s*/,!1))&&(j.state.fatArrowAt=j.stream.pos+q[0].length),k(Fe)}else{if(b=="number"||b=="string")return j.marked=y?"property":j.style+" property",k(Fe);if(b=="jsonld-keyword")return k(Fe);if(S&&F(T))return j.marked="keyword",k(xe);if(b=="[")return k(ke,Nn,we("]"),Fe);if(b=="spread")return k(Re,Fe);if(T=="*")return j.marked="keyword",k(xe);if(b==":")return Q(Fe)}}function pe(b){return b!="variable"?Q(Fe):(j.marked="property",k(tn))}function Fe(b){if(b==":")return k(Re);if(b=="(")return Q(tn)}function De(b,T,q){function Y($,re){if(q?q.indexOf($)>-1:$==","){var ze=j.state.lexical;return ze.info=="call"&&(ze.pos=(ze.pos||0)+1),k(function(mt,It){return mt==T||It==T?Q():Q(b)},Y)}return $==T||re==T?k():q&&q.indexOf(";")>-1?Q(b):k(we(T))}return function($,re){return $==T||re==T?k():Q(b,Y)}}function $t(b,T,q){for(var Y=3;Y<arguments.length;Y++)j.cc.push(arguments[Y]);return k(Z(T,q),De(b,T),fe)}function Zt(b){return b=="}"?k():Q(_e,Zt)}function Nn(b,T){if(S){if(b==":")return k(Pe);if(T=="?")return k(Nn)}}function er(b,T){if(S&&(b==":"||T=="in"))return k(Pe)}function Rn(b){if(S&&b==":")return j.stream.match(/^\s*\w+\s+is\b/,!1)?k(ke,cs,Pe):k(Pe)}function cs(b,T){if(T=="is")return j.marked="keyword",k()}function Pe(b,T){if(T=="keyof"||T=="typeof"||T=="infer"||T=="readonly")return j.marked="keyword",k(T=="typeof"?Re:Pe);if(b=="variable"||T=="void")return j.marked="type",k(en);if(T=="|"||T=="&")return k(Pe);if(b=="string"||b=="number"||b=="atom")return k(en);if(b=="[")return k(Z("]"),De(Pe,"]",","),fe,en);if(b=="{")return k(Z("}"),me,fe,en);if(b=="(")return k(De(tt,")"),na,en);if(b=="<")return k(De(Pe,">"),Pe);if(b=="quasi")return Q(Ct,en)}function na(b){if(b=="=>")return k(Pe)}function me(b){return b.match(/[\}\)\]]/)?k():b==","||b==";"?k(me):Q(Sn,me)}function Sn(b,T){if(b=="variable"||j.style=="keyword")return j.marked="property",k(Sn);if(T=="?"||b=="number"||b=="string")return k(Sn);if(b==":")return k(Pe);if(b=="[")return k(we("variable"),er,we("]"),Sn);if(b=="(")return Q(Pn,Sn);if(!b.match(/[;\}\)\],]/))return k()}function Ct(b,T){return b!="quasi"?Q():T.slice(T.length-2)!="${"?k(Ct):k(Pe,et)}function et(b){if(b=="}")return j.marked="string-2",j.state.tokenize=ue,k(Ct)}function tt(b,T){return b=="variable"&&j.stream.match(/^\s*[?:]/,!1)||T=="?"?k(tt):b==":"?k(Pe):b=="spread"?k(tt):Q(Pe)}function en(b,T){if(T=="<")return k(Z(">"),De(Pe,">"),fe,en);if(T=="|"||b=="."||T=="&")return k(Pe);if(b=="[")return k(Pe,we("]"),en);if(T=="extends"||T=="implements")return j.marked="keyword",k(Pe);if(T=="?")return k(Pe,we(":"),Pe)}function zt(b,T){if(T=="<")return k(Z(">"),De(Pe,">"),fe,en)}function an(){return Q(Pe,Tt)}function Tt(b,T){if(T=="=")return k(Pe)}function wr(b,T){return T=="enum"?(j.marked="keyword",k(ce)):Q(At,Nn,sn,fs)}function At(b,T){if(S&&F(T))return j.marked="keyword",k(At);if(b=="variable")return G(T),k();if(b=="spread")return k(At);if(b=="[")return $t(li,"]");if(b=="{")return $t(Mn,"}")}function Mn(b,T){return b=="variable"&&!j.stream.match(/^\s*:/,!1)?(G(T),k(sn)):(b=="variable"&&(j.marked="property"),b=="spread"?k(At):b=="}"?Q():b=="["?k(ke,we("]"),we(":"),Mn):k(we(":"),At,sn))}function li(){return Q(At,sn)}function sn(b,T){if(T=="=")return k(Re)}function fs(b){if(b==",")return k(wr)}function Sr(b,T){if(b=="keyword b"&&T=="else")return k(Z("form","else"),_e,fe)}function ra(b,T){if(T=="await")return k(ra);if(b=="(")return k(Z(")"),ui,fe)}function ui(b){return b=="var"?k(wr,Fn):b=="variable"?k(Fn):Q(Fn)}function Fn(b,T){return b==")"?k():b==";"?k(Fn):T=="in"||T=="of"?(j.marked="keyword",k(ke,Fn)):Q(ke,Fn)}function tn(b,T){if(T=="*")return j.marked="keyword",k(tn);if(b=="variable")return G(T),k(tn);if(b=="(")return k(x,Z(")"),De(on,")"),fe,Rn,_e,Te);if(S&&T=="<")return k(Z(">"),De(an,">"),fe,tn)}function Pn(b,T){if(T=="*")return j.marked="keyword",k(Pn);if(b=="variable")return G(T),k(Pn);if(b=="(")return k(x,Z(")"),De(on,")"),fe,Rn,Te);if(S&&T=="<")return k(Z(">"),De(an,">"),fe,Pn)}function ia(b,T){if(b=="keyword"||b=="variable")return j.marked="type",k(ia);if(T=="<")return k(Z(">"),De(an,">"),fe)}function on(b,T){return T=="@"&&k(ke,on),b=="spread"?k(on):S&&F(T)?(j.marked="keyword",k(on)):S&&b=="this"?k(Nn,sn):Q(At,Nn,sn)}function hs(b,T){return b=="variable"?Cr(b,T):ln(b,T)}function Cr(b,T){if(b=="variable")return G(T),k(ln)}function ln(b,T){if(T=="<")return k(Z(">"),De(an,">"),fe,ln);if(T=="extends"||T=="implements"||S&&b==",")return T=="implements"&&(j.marked="keyword"),k(S?Pe:ke,ln);if(b=="{")return k(Z("}"),un,fe)}function un(b,T){if(b=="async"||b=="variable"&&(T=="static"||T=="get"||T=="set"||S&&F(T))&&j.stream.match(/^\s+#?[\w$\xa1-\uffff]/,!1))return j.marked="keyword",k(un);if(b=="variable"||j.style=="keyword")return j.marked="property",k(tr,un);if(b=="number"||b=="string")return k(tr,un);if(b=="[")return k(ke,Nn,we("]"),tr,un);if(T=="*")return j.marked="keyword",k(un);if(S&&b=="(")return Q(Pn,un);if(b==";"||b==",")return k(un);if(b=="}")return k();if(T=="@")return k(ke,un)}function tr(b,T){if(T=="!"||T=="?")return k(tr);if(b==":")return k(Pe,sn);if(T=="=")return k(Re);var q=j.state.lexical.prev,Y=q&&q.info=="interface";return Q(Y?Pn:tn)}function Tr(b,T){return T=="*"?(j.marked="keyword",k(Er,we(";"))):T=="default"?(j.marked="keyword",k(ke,we(";"))):b=="{"?k(De(_r,"}"),Er,we(";")):Q(_e)}function _r(b,T){if(T=="as")return j.marked="keyword",k(we("variable"));if(b=="variable")return Q(Re,_r)}function $n(b){return b=="string"?k():b=="("?Q(ke):b=="."?Q(ht):Q(Lr,mn,Er)}function Lr(b,T){return b=="{"?$t(Lr,"}"):(b=="variable"&&G(T),T=="*"&&(j.marked="keyword"),k(ci))}function mn(b){if(b==",")return k(Lr,mn)}function ci(b,T){if(T=="as")return j.marked="keyword",k(Lr)}function Er(b,T){if(T=="from")return j.marked="keyword",k(ke)}function nt(b){return b=="]"?k():Q(De(Re,"]"))}function ce(){return Q(Z("form"),At,we("{"),Z("}"),De(Cn,"}"),fe,fe)}function Cn(){return Q(At,sn)}function fi(b,T){return b.lastType=="operator"||b.lastType==","||A.test(T.charAt(0))||/[,.]/.test(T.charAt(0))}function Kt(b,T,q){return T.tokenize==W&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(T.lastType)||T.lastType=="quasi"&&/\{\s*$/.test(b.string.slice(0,b.pos-(q||0)))}return{startState:function(b){var T={tokenize:W,lastType:"sof",cc:[],lexical:new Me((b||0)-d,0,"block",!1),localVars:c.localVars,context:c.localVars&&new K(null,null,!1),indented:b||0};return c.globalVars&&typeof c.globalVars=="object"&&(T.globalVars=c.globalVars),T},token:function(b,T){if(b.sol()&&(T.lexical.hasOwnProperty("align")||(T.lexical.align=!1),T.indented=b.indentation(),he(b,T)),T.tokenize!=ne&&b.eatSpace())return null;var q=T.tokenize(b,T);return P=="comment"?q:(T.lastType=P=="operator"&&(N=="++"||N=="--")?"incdec":P,$e(T,q,P,N,b))},indent:function(b,T){if(b.tokenize==ne||b.tokenize==ue)return a.Pass;if(b.tokenize!=W)return 0;var q=T&&T.charAt(0),Y=b.lexical,$;if(!/^\s*else\b/.test(T))for(var re=b.cc.length-1;re>=0;--re){var ze=b.cc[re];if(ze==fe)Y=Y.prev;else if(ze!=Sr&&ze!=Te)break}for(;(Y.type=="stat"||Y.type=="form")&&(q=="}"||($=b.cc[b.cc.length-1])&&($==ht||$==dt)&&!/^[,\.=+\-*:?[\(]/.test(T));)Y=Y.prev;p&&Y.type==")"&&Y.prev.type=="stat"&&(Y=Y.prev);var mt=Y.type,It=q==mt;return mt=="vardef"?Y.indented+(b.lastType=="operator"||b.lastType==","?Y.info.length+1:0):mt=="form"&&q=="{"?Y.indented:mt=="form"?Y.indented+d:mt=="stat"?Y.indented+(fi(b,T)?p||d:0):Y.info=="switch"&&!It&&c.doubleIndentSwitch!=!1?Y.indented+(/^(?:case|default)\b/.test(T)?d:2*d):Y.align?Y.column+(It?0:1):Y.indented+(It?0:d)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:m?null:"/*",blockCommentEnd:m?null:"*/",blockCommentContinue:m?null:" * ",lineComment:m?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:m?"json":"javascript",jsonldMode:y,jsonMode:m,expressionAllowed:Kt,skipExpression:function(b){$e(b,"atom","atom","true",new a.StringStream("",2,null))}}}),a.registerHelper("wordChars","javascript",/[\w$]/),a.defineMIME("text/javascript","javascript"),a.defineMIME("text/ecmascript","javascript"),a.defineMIME("application/javascript","javascript"),a.defineMIME("application/x-javascript","javascript"),a.defineMIME("application/ecmascript","javascript"),a.defineMIME("application/json",{name:"javascript",json:!0}),a.defineMIME("application/x-json",{name:"javascript",json:!0}),a.defineMIME("application/manifest+json",{name:"javascript",json:!0}),a.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),a.defineMIME("text/typescript",{name:"javascript",typescript:!0}),a.defineMIME("application/typescript",{name:"javascript",typescript:!0})})})(),function(l,n){(function(a){a(Wt())})(function(a){var o={pairs:`()[]{}''""`,closeBefore:`)]}'":;>`,triples:"",explode:"[]{}"},c=a.Pos;a.defineOption("autoCloseBrackets",!1,function(N,O,W){W&&W!=a.Init&&(N.removeKeyMap(p),N.state.closeBrackets=null),O&&(y(d(O,"pairs")),N.state.closeBrackets=O,N.addKeyMap(p))});function d(N,O){return O=="pairs"&&typeof N=="string"?N:typeof N=="object"&&N[O]!=null?N[O]:o[O]}var p={Backspace:S,Enter:M};function y(N){for(var O=0;O<N.length;O++){var W=N.charAt(O),X="'"+W+"'";p[X]||(p[X]=m(W))}}y(o.pairs+"`");function m(N){return function(O){return z(O,N)}}function w(N){var O=N.state.closeBrackets;if(!O||O.override)return O;var W=N.getModeAt(N.getCursor());return W.closeBrackets||O}function S(N){var O=w(N);if(!O||N.getOption("disableInput"))return a.Pass;for(var W=d(O,"pairs"),X=N.listSelections(),ne=0;ne<X.length;ne++){if(!X[ne].empty())return a.Pass;var ue=B(N,X[ne].head);if(!ue||W.indexOf(ue)%2!=0)return a.Pass}for(var ne=X.length-1;ne>=0;ne--){var se=X[ne].head;N.replaceRange("",c(se.line,se.ch-1),c(se.line,se.ch+1),"+delete")}}function M(N){var O=w(N),W=O&&d(O,"explode");if(!W||N.getOption("disableInput"))return a.Pass;for(var X=N.listSelections(),ne=0;ne<X.length;ne++){if(!X[ne].empty())return a.Pass;var ue=B(N,X[ne].head);if(!ue||W.indexOf(ue)%2!=0)return a.Pass}N.operation(function(){var se=N.lineSeparator()||`
25
+ `;N.replaceSelection(se+se,null),E(N,-1),X=N.listSelections();for(var he=0;he<X.length;he++){var Oe=X[he].head.line;N.indentLine(Oe,null,!0),N.indentLine(Oe+1,null,!0)}})}function E(N,O){for(var W=[],X=N.listSelections(),ne=0,ue=0;ue<X.length;ue++){var se=X[ue];se.head==N.getCursor()&&(ne=ue);var he=se.head.ch||O>0?{line:se.head.line,ch:se.head.ch+O}:{line:se.head.line-1};W.push({anchor:he,head:he})}N.setSelections(W,ne)}function A(N){var O=a.cmpPos(N.anchor,N.head)>0;return{anchor:new c(N.anchor.line,N.anchor.ch+(O?-1:1)),head:new c(N.head.line,N.head.ch+(O?1:-1))}}function z(N,O){var W=w(N);if(!W||N.getOption("disableInput"))return a.Pass;var X=d(W,"pairs"),ne=X.indexOf(O);if(ne==-1)return a.Pass;for(var ue=d(W,"closeBefore"),se=d(W,"triples"),he=X.charAt(ne+1)==O,Oe=N.listSelections(),Me=ne%2==0,ie,$e=0;$e<Oe.length;$e++){var j=Oe[$e],Q=j.head,k,J=N.getRange(Q,c(Q.line,Q.ch+1));if(Me&&!j.empty())k="surround";else if((he||!Me)&&J==O)he&&P(N,Q)?k="both":se.indexOf(O)>=0&&N.getRange(Q,c(Q.line,Q.ch+3))==O+O+O?k="skipThree":k="skip";else if(he&&Q.ch>1&&se.indexOf(O)>=0&&N.getRange(c(Q.line,Q.ch-2),Q)==O+O){if(Q.ch>2&&/\bstring/.test(N.getTokenTypeAt(c(Q.line,Q.ch-2))))return a.Pass;k="addFour"}else if(he){var G=Q.ch==0?" ":N.getRange(c(Q.line,Q.ch-1),Q);if(!a.isWordChar(J)&&G!=O&&!a.isWordChar(G))k="both";else return a.Pass}else if(Me&&(J.length===0||/\s/.test(J)||ue.indexOf(J)>-1))k="both";else return a.Pass;if(!ie)ie=k;else if(ie!=k)return a.Pass}var D=ne%2?X.charAt(ne-1):O,F=ne%2?O:X.charAt(ne+1);N.operation(function(){if(ie=="skip")E(N,1);else if(ie=="skipThree")E(N,3);else if(ie=="surround"){for(var K=N.getSelections(),de=0;de<K.length;de++)K[de]=D+K[de]+F;N.replaceSelections(K,"around"),K=N.listSelections().slice();for(var de=0;de<K.length;de++)K[de]=A(K[de]);N.setSelections(K)}else ie=="both"?(N.replaceSelection(D+F,null),N.triggerElectric(D+F),E(N,-1)):ie=="addFour"&&(N.replaceSelection(D+D+D+D,"before"),E(N,1))})}function B(N,O){var W=N.getRange(c(O.line,O.ch-1),c(O.line,O.ch+1));return W.length==2?W:null}function P(N,O){var W=N.getTokenAt(c(O.line,O.ch+1));return/\bstring/.test(W.type)&&W.start==O.ch&&(O.ch==0||!/\bstring/.test(N.getTokenTypeAt(O)))}})}(),function(l,n){(function(a){a(Wt())})(function(a){var o=/MSIE \d/.test(navigator.userAgent)&&(document.documentMode==null||document.documentMode<8),c=a.Pos,d={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function p(E){return E&&E.bracketRegex||/[(){}[\]]/}function y(E,A,z){var B=E.getLineHandle(A.line),P=A.ch-1,N=z&&z.afterCursor;N==null&&(N=/(^| )cm-fat-cursor($| )/.test(E.getWrapperElement().className));var O=p(z),W=!N&&P>=0&&O.test(B.text.charAt(P))&&d[B.text.charAt(P)]||O.test(B.text.charAt(P+1))&&d[B.text.charAt(++P)];if(!W)return null;var X=W.charAt(1)==">"?1:-1;if(z&&z.strict&&X>0!=(P==A.ch))return null;var ne=E.getTokenTypeAt(c(A.line,P+1)),ue=m(E,c(A.line,P+(X>0?1:0)),X,ne,z);return ue==null?null:{from:c(A.line,P),to:ue&&ue.pos,match:ue&&ue.ch==W.charAt(0),forward:X>0}}function m(E,A,z,B,P){for(var N=P&&P.maxScanLineLength||1e4,O=P&&P.maxScanLines||1e3,W=[],X=p(P),ne=z>0?Math.min(A.line+O,E.lastLine()+1):Math.max(E.firstLine()-1,A.line-O),ue=A.line;ue!=ne;ue+=z){var se=E.getLine(ue);if(se){var he=z>0?0:se.length-1,Oe=z>0?se.length:-1;if(!(se.length>N))for(ue==A.line&&(he=A.ch-(z<0?1:0));he!=Oe;he+=z){var Me=se.charAt(he);if(X.test(Me)&&(B===void 0||(E.getTokenTypeAt(c(ue,he+1))||"")==(B||""))){var ie=d[Me];if(ie&&ie.charAt(1)==">"==z>0)W.push(Me);else if(W.length)W.pop();else return{pos:c(ue,he),ch:Me}}}}}return ue-z==(z>0?E.lastLine():E.firstLine())?!1:null}function w(E,A,z){for(var B=E.state.matchBrackets.maxHighlightLineLength||1e3,P=z&&z.highlightNonMatching,N=[],O=E.listSelections(),W=0;W<O.length;W++){var X=O[W].empty()&&y(E,O[W].head,z);if(X&&(X.match||P!==!1)&&E.getLine(X.from.line).length<=B){var ne=X.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";N.push(E.markText(X.from,c(X.from.line,X.from.ch+1),{className:ne})),X.to&&E.getLine(X.to.line).length<=B&&N.push(E.markText(X.to,c(X.to.line,X.to.ch+1),{className:ne}))}}if(N.length){o&&E.state.focused&&E.focus();var ue=function(){E.operation(function(){for(var se=0;se<N.length;se++)N[se].clear()})};if(A)setTimeout(ue,800);else return ue}}function S(E){E.operation(function(){E.state.matchBrackets.currentlyHighlighted&&(E.state.matchBrackets.currentlyHighlighted(),E.state.matchBrackets.currentlyHighlighted=null),E.state.matchBrackets.currentlyHighlighted=w(E,!1,E.state.matchBrackets)})}function M(E){E.state.matchBrackets&&E.state.matchBrackets.currentlyHighlighted&&(E.state.matchBrackets.currentlyHighlighted(),E.state.matchBrackets.currentlyHighlighted=null)}a.defineOption("matchBrackets",!1,function(E,A,z){z&&z!=a.Init&&(E.off("cursorActivity",S),E.off("focus",S),E.off("blur",M),M(E)),A&&(E.state.matchBrackets=typeof A=="object"?A:{},E.on("cursorActivity",S),E.on("focus",S),E.on("blur",M))}),a.defineExtension("matchBrackets",function(){w(this,!0)}),a.defineExtension("findMatchingBracket",function(E,A,z){return(z||typeof A=="boolean")&&(z?(z.strict=A,A=z):A=A?{strict:!0}:null),y(this,E,A)}),a.defineExtension("scanForBracket",function(E,A,z,B){return m(this,E,A,z,B)})})}();var Xc={exports:{}};(function(l,n){(function(a){a(Wt())})(function(a){function o(y,m,w,S){if(w&&w.call){var M=w;w=null}else var M=p(y,w,"rangeFinder");typeof m=="number"&&(m=a.Pos(m,0));var E=p(y,w,"minFoldSize");function A(N){var O=M(y,m);if(!O||O.to.line-O.from.line<E)return null;if(S==="fold")return O;for(var W=y.findMarksAt(O.from),X=0;X<W.length;++X)if(W[X].__isFold){if(!N)return null;O.cleared=!0,W[X].clear()}return O}var z=A(!0);if(p(y,w,"scanUp"))for(;!z&&m.line>y.firstLine();)m=a.Pos(m.line-1,0),z=A(!1);if(!(!z||z.cleared||S==="unfold")){var B=c(y,w,z);a.on(B,"mousedown",function(N){P.clear(),a.e_preventDefault(N)});var P=y.markText(z.from,z.to,{replacedWith:B,clearOnEnter:p(y,w,"clearOnEnter"),__isFold:!0});P.on("clear",function(N,O){a.signal(y,"unfold",y,N,O)}),a.signal(y,"fold",y,z.from,z.to)}}function c(y,m,w){var S=p(y,m,"widget");if(typeof S=="function"&&(S=S(w.from,w.to)),typeof S=="string"){var M=document.createTextNode(S);S=document.createElement("span"),S.appendChild(M),S.className="CodeMirror-foldmarker"}else S&&(S=S.cloneNode(!0));return S}a.newFoldFunction=function(y,m){return function(w,S){o(w,S,{rangeFinder:y,widget:m})}},a.defineExtension("foldCode",function(y,m,w){o(this,y,m,w)}),a.defineExtension("isFolded",function(y){for(var m=this.findMarksAt(y),w=0;w<m.length;++w)if(m[w].__isFold)return!0}),a.commands.toggleFold=function(y){y.foldCode(y.getCursor())},a.commands.fold=function(y){y.foldCode(y.getCursor(),null,"fold")},a.commands.unfold=function(y){y.foldCode(y.getCursor(),{scanUp:!1},"unfold")},a.commands.foldAll=function(y){y.operation(function(){for(var m=y.firstLine(),w=y.lastLine();m<=w;m++)y.foldCode(a.Pos(m,0),{scanUp:!1},"fold")})},a.commands.unfoldAll=function(y){y.operation(function(){for(var m=y.firstLine(),w=y.lastLine();m<=w;m++)y.foldCode(a.Pos(m,0),{scanUp:!1},"unfold")})},a.registerHelper("fold","combine",function(){var y=Array.prototype.slice.call(arguments,0);return function(m,w){for(var S=0;S<y.length;++S){var M=y[S](m,w);if(M)return M}}}),a.registerHelper("fold","auto",function(y,m){for(var w=y.getHelpers(m,"fold"),S=0;S<w.length;S++){var M=w[S](y,m);if(M)return M}});var d={rangeFinder:a.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};a.defineOption("foldOptions",null);function p(y,m,w){if(m&&m[w]!==void 0)return m[w];var S=y.options.foldOptions;return S&&S[w]!==void 0?S[w]:d[w]}a.defineExtension("foldOption",function(y,m){return p(this,y,m)})})})();var Yc=Xc.exports;(function(l,n){(function(a){a(Wt(),Yc)})(function(a){a.defineOption("foldGutter",!1,function(P,N,O){O&&O!=a.Init&&(P.clearGutter(P.state.foldGutter.options.gutter),P.state.foldGutter=null,P.off("gutterClick",M),P.off("changes",A),P.off("viewportChange",z),P.off("fold",B),P.off("unfold",B),P.off("swapDoc",A),P.off("optionChange",E)),N&&(P.state.foldGutter=new c(d(N)),S(P),P.on("gutterClick",M),P.on("changes",A),P.on("viewportChange",z),P.on("fold",B),P.on("unfold",B),P.on("swapDoc",A),P.on("optionChange",E))});var o=a.Pos;function c(P){this.options=P,this.from=this.to=0}function d(P){return P===!0&&(P={}),P.gutter==null&&(P.gutter="CodeMirror-foldgutter"),P.indicatorOpen==null&&(P.indicatorOpen="CodeMirror-foldgutter-open"),P.indicatorFolded==null&&(P.indicatorFolded="CodeMirror-foldgutter-folded"),P}function p(P,N){for(var O=P.findMarks(o(N,0),o(N+1,0)),W=0;W<O.length;++W)if(O[W].__isFold){var X=O[W].find(-1);if(X&&X.line===N)return O[W]}}function y(P){if(typeof P=="string"){var N=document.createElement("div");return N.className=P+" CodeMirror-guttermarker-subtle",N}else return P.cloneNode(!0)}function m(P,N,O){var W=P.state.foldGutter.options,X=N-1,ne=P.foldOption(W,"minFoldSize"),ue=P.foldOption(W,"rangeFinder"),se=typeof W.indicatorFolded=="string"&&w(W.indicatorFolded),he=typeof W.indicatorOpen=="string"&&w(W.indicatorOpen);P.eachLine(N,O,function(Oe){++X;var Me=null,ie=Oe.gutterMarkers;if(ie&&(ie=ie[W.gutter]),p(P,X)){if(se&&ie&&se.test(ie.className))return;Me=y(W.indicatorFolded)}else{var $e=o(X,0),j=ue&&ue(P,$e);if(j&&j.to.line-j.from.line>=ne){if(he&&ie&&he.test(ie.className))return;Me=y(W.indicatorOpen)}}!Me&&!ie||P.setGutterMarker(Oe,W.gutter,Me)})}function w(P){return new RegExp("(^|\\s)"+P+"(?:$|\\s)\\s*")}function S(P){var N=P.getViewport(),O=P.state.foldGutter;O&&(P.operation(function(){m(P,N.from,N.to)}),O.from=N.from,O.to=N.to)}function M(P,N,O){var W=P.state.foldGutter;if(W){var X=W.options;if(O==X.gutter){var ne=p(P,N);ne?ne.clear():P.foldCode(o(N,0),X)}}}function E(P,N){N=="mode"&&A(P)}function A(P){var N=P.state.foldGutter;if(N){var O=N.options;N.from=N.to=0,clearTimeout(N.changeUpdate),N.changeUpdate=setTimeout(function(){S(P)},O.foldOnChangeTimeSpan||600)}}function z(P){var N=P.state.foldGutter;if(N){var O=N.options;clearTimeout(N.changeUpdate),N.changeUpdate=setTimeout(function(){var W=P.getViewport();N.from==N.to||W.from-N.to>20||N.from-W.to>20?S(P):P.operation(function(){W.from<N.from&&(m(P,W.from,N.from),N.from=W.from),W.to>N.to&&(m(P,N.to,W.to),N.to=W.to)})},O.updateViewportTimeSpan||400)}}function B(P,N){var O=P.state.foldGutter;if(O){var W=N.line;W>=O.from&&W<O.to&&m(P,W,W+1)}}})})(),function(l,n){(function(a){a(Wt())})(function(a){function o(c){return function(d,p){var y=p.line,m=d.getLine(y);function w(B){for(var P,N=p.ch,O=0;;){var W=N<=0?-1:m.lastIndexOf(B[0],N-1);if(W==-1){if(O==1)break;O=1,N=m.length;continue}if(O==1&&W<p.ch)break;if(P=d.getTokenTypeAt(a.Pos(y,W+1)),!/^(comment|string)/.test(P))return{ch:W+1,tokenType:P,pair:B};N=W-1}}function S(B){var P=1,N=d.lastLine(),O,W=B.ch,X;e:for(var ne=y;ne<=N;++ne)for(var ue=d.getLine(ne),se=ne==y?W:0;;){var he=ue.indexOf(B.pair[0],se),Oe=ue.indexOf(B.pair[1],se);if(he<0&&(he=ue.length),Oe<0&&(Oe=ue.length),se=Math.min(he,Oe),se==ue.length)break;if(d.getTokenTypeAt(a.Pos(ne,se+1))==B.tokenType){if(se==he)++P;else if(!--P){O=ne,X=se;break e}}++se}return O==null||y==O?null:{from:a.Pos(y,W),to:a.Pos(O,X)}}for(var M=[],E=0;E<c.length;E++){var A=w(c[E]);A&&M.push(A)}M.sort(function(B,P){return B.ch-P.ch});for(var E=0;E<M.length;E++){var z=S(M[E]);if(z)return z}return null}}a.registerHelper("fold","brace",o([["{","}"],["[","]"]])),a.registerHelper("fold","brace-paren",o([["{","}"],["[","]"],["(",")"]])),a.registerHelper("fold","import",function(c,d){function p(E){if(E<c.firstLine()||E>c.lastLine())return null;var A=c.getTokenAt(a.Pos(E,1));if(/\S/.test(A.string)||(A=c.getTokenAt(a.Pos(E,A.end+1))),A.type!="keyword"||A.string!="import")return null;for(var z=E,B=Math.min(c.lastLine(),E+10);z<=B;++z){var P=c.getLine(z),N=P.indexOf(";");if(N!=-1)return{startCh:A.end,end:a.Pos(z,N)}}}var y=d.line,m=p(y),w;if(!m||p(y-1)||(w=p(y-2))&&w.end.line==y-1)return null;for(var S=m.end;;){var M=p(S.line+1);if(M==null)break;S=M.end}return{from:c.clipPos(a.Pos(y,m.startCh+1)),to:S}}),a.registerHelper("fold","include",function(c,d){function p(M){if(M<c.firstLine()||M>c.lastLine())return null;var E=c.getTokenAt(a.Pos(M,1));if(/\S/.test(E.string)||(E=c.getTokenAt(a.Pos(M,E.end+1))),E.type=="meta"&&E.string.slice(0,8)=="#include")return E.start+8}var y=d.line,m=p(y);if(m==null||p(y-1)!=null)return null;for(var w=y;;){var S=p(w+1);if(S==null)break;++w}return{from:a.Pos(y,m+1),to:c.clipPos(a.Pos(w))}})})}(),function(l,n){(function(a){a(Wt())})(function(a){function o(c,d){var p=c.getLine(d),y=p.search(/\S/);return y==-1||/\bcomment\b/.test(c.getTokenTypeAt(a.Pos(d,y+1)))?-1:a.countColumn(p,null,c.getOption("tabSize"))}a.registerHelper("fold","indent",function(c,d){var p=o(c,d.line);if(!(p<0)){for(var y=null,m=d.line+1,w=c.lastLine();m<=w;++m){var S=o(c,m);if(S!=-1)if(S>p)y=m;else break}if(y)return{from:a.Pos(d.line,c.getLine(d.line).length),to:a.Pos(y,c.getLine(y).length)}}})})}(),function(l,n){(function(a){a(Wt())})(function(a){a.defineOption("autoRefresh",!1,function(d,p){d.state.autoRefresh&&(c(d,d.state.autoRefresh),d.state.autoRefresh=null),p&&d.display.wrapper.offsetHeight==0&&o(d,d.state.autoRefresh={delay:p.delay||250})});function o(d,p){function y(){d.display.wrapper.offsetHeight?(c(d,p),d.display.lastWrapHeight!=d.display.wrapper.clientHeight&&d.refresh()):p.timeout=setTimeout(y,p.delay)}p.timeout=setTimeout(y,p.delay),p.hurry=function(){clearTimeout(p.timeout),p.timeout=setTimeout(y,50)},a.on(window,"mouseup",p.hurry),a.on(window,"keyup",p.hurry)}function c(d,p){clearTimeout(p.timeout),a.off(window,"mouseup",p.hurry),a.off(window,"keyup",p.hurry)}})}();const uo=it.defineStore("trace",{state:()=>({traces:[],currentTrace:null}),getters:{getTraces:l=>l.traces,getCurrentTrace:l=>l.currentTrace},actions:{setTraces(l){this.traces=l},setCurrentTrace(l){this.currentTrace=l}}}),Vc=()=>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",kn=Yt.create({baseURL:Vc(),timeout:36e5}),Vt={getExperiments(){return kn.post("/experiments/search").then(l=>l.data)},getTraceStatus(){return kn.get("/v1/dict/traceStatus").then(l=>l.data)},getTraceList(l,n,a,o,c,d,p){const y={};return l&&(y.query=l),n&&(y.startTime=n),a&&(y.endTime=a),o&&(y.pageNum=o),c&&(y.pageSize=c),d&&(y.experimentId=d),p&&(y.status=p),kn.get("/v1/trace",{params:y}).then(m=>m.data)},getTraceDetail(l){return kn.get(`/v1/trace/${l}`).then(n=>n.data)},getTraceSpans(l,n={}){const{query:a="",has_events:o,page_num:c=1,page_size:d=100}=n,p={query:a||"",page_num:c,page_size:d};return o===!0&&(p.has_events=!0),kn.post(`/v1/trace/${l}/spans`,p).then(y=>y.data)},getSpanContent(l,n){return kn.get(`/v1/trace/${l}/span/${n}/content`).then(a=>a.data)},deleteTraces(l,n,a,o,c){const d={};return l&&(d.query=l),n&&(d.startTime=n),a&&(d.endTime=a),o&&(d.experimentId=o),c&&(d.status=c),kn.delete("/v1/trace",{params:d}).then(p=>p.data)},debugTrace(l,n={}){return kn.post("/debug",l,{headers:n}).then(a=>a.data)},getPromptTokens(l){return kn.post("/v1/trace/getPromptTokens",l).then(n=>n.data)}};var co={exports:{}};(function(l,n){(function(a,o){l.exports=o(Wt())})(oo,function(a){return function(o){function c(p){if(d[p])return d[p].exports;var y=d[p]={i:p,l:!1,exports:{}};return o[p].call(y.exports,y,y.exports,c),y.l=!0,y.exports}var d={};return c.m=o,c.c=d,c.i=function(p){return p},c.d=function(p,y,m){c.o(p,y)||Object.defineProperty(p,y,{configurable:!1,enumerable:!0,get:m})},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(o,c){o.exports=a},function(o,c,d){Object.defineProperty(c,"__esModule",{value:!0});var p=d(0),y=function(w){return w&&w.__esModule?w:{default:w}}(p),m=window.CodeMirror||y.default;typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(w,S){if(w==null)throw new TypeError("Cannot convert undefined or null to object");for(var M=Object(w),E=1;E<arguments.length;E++){var A=arguments[E];if(A!=null)for(var z in A)Object.prototype.hasOwnProperty.call(A,z)&&(M[z]=A[z])}return M},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(w){for(var S in w)this.cminstance.setOption(S,w[S])}},merge:function(){this.$nextTick(this.switchMerge)},code:function(w){this.handerCodeChange(w)},value:function(w){this.handerCodeChange(w)}},methods:{initialize:function(){var w=this,S=Object.assign({},this.globalOptions,this.options);this.merge?(this.codemirror=m.MergeView(this.$refs.mergeview,S),this.cminstance=this.codemirror.edit):(this.codemirror=m.fromTextArea(this.$refs.textarea,S),this.cminstance=this.codemirror,this.cminstance.setValue(this.code||this.value||this.content)),this.cminstance.on("change",function(E){w.content=E.getValue(),w.$emit&&w.$emit("input",w.content)});var M={};["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(E){return!M[E]&&(M[E]=!0)}).forEach(function(E){w.cminstance.on(E,function(){for(var A=arguments.length,z=Array(A),B=0;B<A;B++)z[B]=arguments[B];w.$emit.apply(w,[E].concat(z));var P=E.replace(/([A-Z])/g,"-$1").toLowerCase();P!==E&&w.$emit.apply(w,[P].concat(z))})}),this.$emit("ready",this.codemirror),this.unseenLineMarkers(),this.refresh()},refresh:function(){var w=this;this.$nextTick(function(){w.cminstance.refresh()})},destroy:function(){var w=this.cminstance.doc.cm.getWrapperElement();w&&w.remove&&w.remove()},handerCodeChange:function(w){if(w!==this.cminstance.getValue()){var S=this.cminstance.getScrollInfo();this.cminstance.setValue(w),this.content=w,this.cminstance.scrollTo(S.left,S.top)}this.unseenLineMarkers()},unseenLineMarkers:function(){var w=this;this.unseenLines!==void 0&&this.marker!==void 0&&this.unseenLines.forEach(function(S){var M=w.cminstance.lineInfo(S);w.cminstance.setGutterMarker(S,"breakpoints",M.gutterMarkers?null:w.marker())})},switchMerge:function(){var w=this.cminstance.doc.history,S=this.cminstance.doc.cleanGeneration;this.options.value=this.cminstance.getValue(),this.destroy(),this.initialize(),this.cminstance.doc.history=w,this.cminstance.doc.cleanGeneration=S}},mounted:function(){this.initialize()},beforeDestroy:function(){this.destroy()}}},function(o,c,d){Object.defineProperty(c,"__esModule",{value:!0});var p=d(1),y=d.n(p);for(var m in p)["default","default"].indexOf(m)<0&&function(E){d.d(c,E,function(){return p[E]})}(m);var w=d(5),S=d(4),M=S(y.a,w.a,!1,null,null,null);c.default=M.exports},function(o,c,d){function p(z){return z&&z.__esModule?z:{default:z}}Object.defineProperty(c,"__esModule",{value:!0}),c.install=c.codemirror=c.CodeMirror=void 0;var y=d(0),m=p(y),w=d(2),S=p(w),M=window.CodeMirror||m.default,E=function(z,B){B&&(B.options&&(S.default.props.globalOptions.default=function(){return B.options}),B.events&&(S.default.props.globalEvents.default=function(){return B.events})),z.component(S.default.name,S.default)},A={CodeMirror:M,codemirror:S.default,install:E};c.default=A,c.CodeMirror=M,c.codemirror=S.default,c.install=E},function(o,c){o.exports=function(d,p,y,m,w,S){var M,E=d=d||{},A=typeof d.default;A!=="object"&&A!=="function"||(M=d,E=d.default);var z=typeof E=="function"?E.options:E;p&&(z.render=p.render,z.staticRenderFns=p.staticRenderFns,z._compiled=!0),y&&(z.functional=!0),w&&(z._scopeId=w);var B;if(S?(B=function(O){O=O||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,O||typeof __VUE_SSR_CONTEXT__>"u"||(O=__VUE_SSR_CONTEXT__),m&&m.call(this,O),O&&O._registeredComponents&&O._registeredComponents.add(S)},z._ssrRegister=B):m&&(B=m),B){var P=z.functional,N=P?z.render:z.beforeCreate;P?(z._injectStyles=B,z.render=function(O,W){return B.call(W),N(O,W)}):z.beforeCreate=N?[].concat(N,B):[B]}return{esModule:M,exports:E,options:z}}},function(o,c,d){var p=function(){var w=this,S=w.$createElement,M=w._self._c||S;return M("div",{staticClass:"vue-codemirror",class:{merge:w.merge}},[w.merge?M("div",{ref:"mergeview"}):M("textarea",{ref:"textarea",attrs:{name:w.name,placeholder:w.placeholder}})])},y=[],m={render:p,staticRenderFns:y};c.a=m}])})})(co);var fo=co.exports;function Pa(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Xn=Pa();function ho(l){Xn=l}const po=/[&<>"']/,Jc=new RegExp(po.source,"g"),go=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Qc=new RegExp(go.source,"g"),Zc={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},mo=l=>Zc[l];function jt(l,n){if(n){if(po.test(l))return l.replace(Jc,mo)}else if(go.test(l))return l.replace(Qc,mo);return l}const ef=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function tf(l){return l.replace(ef,(n,a)=>(a=a.toLowerCase(),a==="colon"?":":a.charAt(0)==="#"?a.charAt(1)==="x"?String.fromCharCode(parseInt(a.substring(2),16)):String.fromCharCode(+a.substring(1)):""))}const nf=/(^|[^\[])\^/g;function je(l,n){let a=typeof l=="string"?l:l.source;n=n||"";const o={replace:(c,d)=>{let p=typeof d=="string"?d:d.source;return p=p.replace(nf,"$1"),a=a.replace(c,p),o},getRegex:()=>new RegExp(a,n)};return o}function vo(l){try{l=encodeURI(l).replace(/%25/g,"%")}catch{return null}return l}const Yr={exec:()=>null};function yo(l,n){const a=l.replace(/\|/g,(d,p,y)=>{let m=!1,w=p;for(;--w>=0&&y[w]==="\\";)m=!m;return m?"|":" |"}),o=a.split(/ \|/);let c=0;if(o[0].trim()||o.shift(),o.length>0&&!o[o.length-1].trim()&&o.pop(),n)if(o.length>n)o.splice(n);else for(;o.length<n;)o.push("");for(;c<o.length;c++)o[c]=o[c].trim().replace(/\\\|/g,"|");return o}function zi(l,n,a){const o=l.length;if(o===0)return"";let c=0;for(;c<o&&l.charAt(o-c-1)===n;)c++;return l.slice(0,o-c)}function rf(l,n){if(l.indexOf(n[1])===-1)return-1;let a=0;for(let o=0;o<l.length;o++)if(l[o]==="\\")o++;else if(l[o]===n[0])a++;else if(l[o]===n[1]&&(a--,a<0))return o;return-1}function bo(l,n,a,o){const c=n.href,d=n.title?jt(n.title):null,p=l[1].replace(/\\([\[\]])/g,"$1");if(l[0].charAt(0)!=="!"){o.state.inLink=!0;const y={type:"link",raw:a,href:c,title:d,text:p,tokens:o.inlineTokens(p)};return o.state.inLink=!1,y}return{type:"image",raw:a,href:c,title:d,text:jt(p)}}function af(l,n){const a=l.match(/^(\s+)(?:```)/);if(a===null)return n;const o=a[1];return n.split(`
26
+ `).map(c=>{const d=c.match(/^\s+/);if(d===null)return c;const[p]=d;return p.length>=o.length?c.slice(o.length):c}).join(`
27
+ `)}class Bi{constructor(n){Je(this,"options");Je(this,"rules");Je(this,"lexer");this.options=n||Xn}space(n){const a=this.rules.block.newline.exec(n);if(a&&a[0].length>0)return{type:"space",raw:a[0]}}code(n){const a=this.rules.block.code.exec(n);if(a){const o=a[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:a[0],codeBlockStyle:"indented",text:this.options.pedantic?o:zi(o,`
28
+ `)}}}fences(n){const a=this.rules.block.fences.exec(n);if(a){const o=a[0],c=af(o,a[3]||"");return{type:"code",raw:o,lang:a[2]?a[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):a[2],text:c}}}heading(n){const a=this.rules.block.heading.exec(n);if(a){let o=a[2].trim();if(/#$/.test(o)){const c=zi(o,"#");(this.options.pedantic||!c||/ $/.test(c))&&(o=c.trim())}return{type:"heading",raw:a[0],depth:a[1].length,text:o,tokens:this.lexer.inline(o)}}}hr(n){const a=this.rules.block.hr.exec(n);if(a)return{type:"hr",raw:a[0]}}blockquote(n){const a=this.rules.block.blockquote.exec(n);if(a){const o=zi(a[0].replace(/^ *>[ \t]?/gm,""),`
29
+ `),c=this.lexer.state.top;this.lexer.state.top=!0;const d=this.lexer.blockTokens(o);return this.lexer.state.top=c,{type:"blockquote",raw:a[0],tokens:d,text:o}}}list(n){let a=this.rules.block.list.exec(n);if(a){let o=a[1].trim();const c=o.length>1,d={type:"list",raw:"",ordered:c,start:c?+o.slice(0,-1):"",loose:!1,items:[]};o=c?`\\d{1,9}\\${o.slice(-1)}`:`\\${o}`,this.options.pedantic&&(o=c?o:"[*+-]");const p=new RegExp(`^( {0,3}${o})((?:[ ][^\\n]*)?(?:\\n|$))`);let y="",m="",w=!1;for(;n;){let S=!1;if(!(a=p.exec(n))||this.rules.block.hr.test(n))break;y=a[0],n=n.substring(y.length);let M=a[2].split(`
30
30
  `,1)[0].replace(/^\t+/,N=>" ".repeat(3*N.length)),E=n.split(`
31
- `,1)[0],H=0;this.options.pedantic?(H=2,m=A.trimStart()):(H=a[2].search(/[^ ]/),H=H>4?1:H,m=A.slice(H),H+=a[1].length);let B=!1;if(!A&&/^ *$/.test(E)&&(y+=E+`
32
- `,n=n.substring(E.length+1),S=!0),!S){const N=new RegExp(`^ {0,${Math.min(3,H-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),O=new RegExp(`^ {0,${Math.min(3,H-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),$=new RegExp(`^ {0,${Math.min(3,H-1)}}(?:\`\`\`|~~~)`),X=new RegExp(`^ {0,${Math.min(3,H-1)}}#`);for(;n;){const ne=n.split(`
33
- `,1)[0];if(E=ne,this.options.pedantic&&(E=E.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),$.test(E)||X.test(E)||N.test(E)||O.test(n))break;if(E.search(/[^ ]/)>=H||!E.trim())m+=`
34
- `+E.slice(H);else{if(B||A.search(/[^ ]/)>=4||$.test(A)||X.test(A)||O.test(A))break;m+=`
35
- `+E}!B&&!E.trim()&&(B=!0),y+=ne+`
36
- `,n=n.substring(ne.length+1),A=E.slice(H)}}d.loose||(x?d.loose=!0:/\n *\n *$/.test(y)&&(x=!0));let U=null,F;this.options.gfm&&(U=/^\[[ xX]\] /.exec(m),U&&(F=U[0]!=="[ ] ",m=m.replace(/^\[[ xX]\] +/,""))),d.items.push({type:"list_item",raw:y,task:!!U,checked:F,loose:!1,text:m,tokens:[]}),d.raw+=y}d.items[d.items.length-1].raw=y.trimEnd(),d.items[d.items.length-1].text=m.trimEnd(),d.raw=d.raw.trimEnd();for(let S=0;S<d.items.length;S++)if(this.lexer.state.top=!1,d.items[S].tokens=this.lexer.blockTokens(d.items[S].text,[]),!d.loose){const A=d.items[S].tokens.filter(H=>H.type==="space"),E=A.length>0&&A.some(H=>/\n.*\n/.test(H.raw));d.loose=E}if(d.loose)for(let S=0;S<d.items.length;S++)d.items[S].loose=!0;return d}}html(n){const a=this.rules.block.html.exec(n);if(a)return{type:"html",block:!0,raw:a[0],pre:a[1]==="pre"||a[1]==="script"||a[1]==="style",text:a[0]}}def(n){const a=this.rules.block.def.exec(n);if(a){const o=a[1].toLowerCase().replace(/\s+/g," "),f=a[2]?a[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",d=a[3]?a[3].substring(1,a[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):a[3];return{type:"def",tag:o,raw:a[0],href:f,title:d}}}table(n){const a=this.rules.block.table.exec(n);if(!a||!/[:|]/.test(a[2]))return;const o=yo(a[1]),f=a[2].replace(/^\||\| *$/g,"").split("|"),d=a[3]&&a[3].trim()?a[3].replace(/\n[ \t]*$/,"").split(`
37
- `):[],p={type:"table",raw:a[0],header:[],align:[],rows:[]};if(o.length===f.length){for(const y of f)/^ *-+: *$/.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 o)p.header.push({text:y,tokens:this.lexer.inline(y)});for(const y of d)p.rows.push(yo(y,p.header.length).map(m=>({text:m,tokens:this.lexer.inline(m)})));return p}}lheading(n){const a=this.rules.block.lheading.exec(n);if(a)return{type:"heading",raw:a[0],depth:a[2].charAt(0)==="="?1:2,text:a[1],tokens:this.lexer.inline(a[1])}}paragraph(n){const a=this.rules.block.paragraph.exec(n);if(a){const o=a[1].charAt(a[1].length-1)===`
38
- `?a[1].slice(0,-1):a[1];return{type:"paragraph",raw:a[0],text:o,tokens:this.lexer.inline(o)}}}text(n){const a=this.rules.block.text.exec(n);if(a)return{type:"text",raw:a[0],text:a[0],tokens:this.lexer.inline(a[0])}}escape(n){const a=this.rules.inline.escape.exec(n);if(a)return{type:"escape",raw:a[0],text:jt(a[1])}}tag(n){const a=this.rules.inline.tag.exec(n);if(a)return!this.lexer.state.inLink&&/^<a /i.test(a[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(a[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(a[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(a[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:a[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:a[0]}}link(n){const a=this.rules.inline.link.exec(n);if(a){const o=a[2].trim();if(!this.options.pedantic&&/^</.test(o)){if(!/>$/.test(o))return;const p=$i(o.slice(0,-1),"\\");if((o.length-p.length)%2===0)return}else{const p=ic(a[2],"()");if(p>-1){const m=(a[0].indexOf("!")===0?5:4)+a[1].length+p;a[2]=a[2].substring(0,p),a[0]=a[0].substring(0,m).trim(),a[3]=""}}let f=a[2],d="";if(this.options.pedantic){const p=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(f);p&&(f=p[1],d=p[3])}else d=a[3]?a[3].slice(1,-1):"";return f=f.trim(),/^</.test(f)&&(this.options.pedantic&&!/>$/.test(o)?f=f.slice(1):f=f.slice(1,-1)),bo(a,{href:f&&f.replace(this.rules.inline.anyPunctuation,"$1"),title:d&&d.replace(this.rules.inline.anyPunctuation,"$1")},a[0],this.lexer)}}reflink(n,a){let o;if((o=this.rules.inline.reflink.exec(n))||(o=this.rules.inline.nolink.exec(n))){const f=(o[2]||o[1]).replace(/\s+/g," "),d=a[f.toLowerCase()];if(!d){const p=o[0].charAt(0);return{type:"text",raw:p,text:p}}return bo(o,d,o[0],this.lexer)}}emStrong(n,a,o=""){let f=this.rules.inline.emStrongLDelim.exec(n);if(!f||f[3]&&o.match(/[\p{L}\p{N}]/u))return;if(!(f[1]||f[2]||"")||!o||this.rules.inline.punctuation.exec(o)){const p=[...f[0]].length-1;let y,m,x=p,S=0;const A=f[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(A.lastIndex=0,a=a.slice(-1*n.length+p);(f=A.exec(a))!=null;){if(y=f[1]||f[2]||f[3]||f[4]||f[5]||f[6],!y)continue;if(m=[...y].length,f[3]||f[4]){x+=m;continue}else if((f[5]||f[6])&&p%3&&!((p+m)%3)){S+=m;continue}if(x-=m,x>0)continue;m=Math.min(m,m+x+S);const E=[...f[0]][0].length,H=n.slice(0,p+f.index+E+m);if(Math.min(p,m)%2){const U=H.slice(1,-1);return{type:"em",raw:H,text:U,tokens:this.lexer.inlineTokens(U)}}const B=H.slice(2,-2);return{type:"strong",raw:H,text:B,tokens:this.lexer.inlineTokens(B)}}}}codespan(n){const a=this.rules.inline.code.exec(n);if(a){let o=a[2].replace(/\n/g," ");const f=/[^ ]/.test(o),d=/^ /.test(o)&&/ $/.test(o);return f&&d&&(o=o.substring(1,o.length-1)),o=jt(o,!0),{type:"codespan",raw:a[0],text:o}}}br(n){const a=this.rules.inline.br.exec(n);if(a)return{type:"br",raw:a[0]}}del(n){const a=this.rules.inline.del.exec(n);if(a)return{type:"del",raw:a[0],text:a[2],tokens:this.lexer.inlineTokens(a[2])}}autolink(n){const a=this.rules.inline.autolink.exec(n);if(a){let o,f;return a[2]==="@"?(o=jt(a[1]),f="mailto:"+o):(o=jt(a[1]),f=o),{type:"link",raw:a[0],text:o,href:f,tokens:[{type:"text",raw:o,text:o}]}}}url(n){var o;let a;if(a=this.rules.inline.url.exec(n)){let f,d;if(a[2]==="@")f=jt(a[0]),d="mailto:"+f;else{let p;do p=a[0],a[0]=((o=this.rules.inline._backpedal.exec(a[0]))==null?void 0:o[0])??"";while(p!==a[0]);f=jt(a[0]),a[1]==="www."?d="http://"+a[0]:d=a[0]}return{type:"link",raw:a[0],text:f,href:d,tokens:[{type:"text",raw:f,text:f}]}}}inlineText(n){const a=this.rules.inline.text.exec(n);if(a){let o;return this.lexer.state.inRawBlock?o=a[0]:o=jt(a[0]),{type:"text",raw:a[0],text:o}}}}const sc=/^(?: *(?:\n|$))+/,oc=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,lc=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Vr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,uc=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,xo=/(?:[*+-]|\d{1,9}[.)])/,wo=je(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,xo).getRegex(),za=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,fc=/^[^\n]+/,$a=/(?!\s*\])(?:\\.|[^\[\]\\])+/,cc=je(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",$a).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),hc=je(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,xo).getRegex(),Hi="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",Ba=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,dc=je("^ {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",Ba).replace("tag",Hi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ko=je(za).replace("hr",Vr).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",Hi).getRegex(),Ha={blockquote:je(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ko).getRegex(),code:oc,def:cc,fences:lc,heading:uc,hr:Vr,html:dc,lheading:wo,list:hc,newline:sc,paragraph:ko,table:Yr,text:fc},So=je("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Vr).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",Hi).getRegex(),pc={...Ha,table:So,paragraph:je(za).replace("hr",Vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",So).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",Hi).getRegex()},gc={...Ha,html:je(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ba).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:Yr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:je(za).replace("hr",Vr).replace("heading",` *#{1,6} *[^
39
- ]`).replace("lheading",wo).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Co=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,mc=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,To=/^( {2,}|\\)\n(?!\s*$)/,vc=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Jr="\\p{P}$+<=>`^|~",yc=je(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Jr).getRegex(),bc=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,xc=je(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Jr).getRegex(),wc=je("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Jr).getRegex(),kc=je("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Jr).getRegex(),Sc=je(/\\([punct])/,"gu").replace(/punct/g,Jr).getRegex(),Cc=je(/^<(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(),Tc=je(Ba).replace("(?:-->|$)","-->").getRegex(),_c=je("^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",Tc).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Wi=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Lc=je(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Wi).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_o=je(/^!?\[(label)\]\[(ref)\]/).replace("label",Wi).replace("ref",$a).getRegex(),Lo=je(/^!?\[(ref)\](?:\[\])?/).replace("ref",$a).getRegex(),Ec=je("reflink|nolink(?!\\()","g").replace("reflink",_o).replace("nolink",Lo).getRegex(),Wa={_backpedal:Yr,anyPunctuation:Sc,autolink:Cc,blockSkip:bc,br:To,code:mc,del:Yr,emStrongLDelim:xc,emStrongRDelimAst:wc,emStrongRDelimUnd:kc,escape:Co,link:Lc,nolink:Lo,punctuation:yc,reflink:_o,reflinkSearch:Ec,tag:_c,text:vc,url:Yr},Dc={...Wa,link:je(/^!?\[(label)\]\((.*?)\)/).replace("label",Wi).getRegex(),reflink:je(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Wi).getRegex()},ja={...Wa,escape:je(Co).replace("])","~|])").getRegex(),url:je(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Ac={...ja,br:je(To).replace("{2,}","*").getRegex(),text:je(ja.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ji={normal:Ha,gfm:pc,pedantic:gc},Qr={normal:Wa,gfm:ja,breaks:Ac,pedantic:Dc};class pn{constructor(n){Je(this,"tokens");Je(this,"options");Je(this,"state");Je(this,"tokenizer");Je(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Xn,this.options.tokenizer=this.options.tokenizer||new Bi,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 a={block:ji.normal,inline:Qr.normal};this.options.pedantic?(a.block=ji.pedantic,a.inline=Qr.pedantic):this.options.gfm&&(a.block=ji.gfm,this.options.breaks?a.inline=Qr.breaks:a.inline=Qr.gfm),this.tokenizer.rules=a}static get rules(){return{block:ji,inline:Qr}}static lex(n,a){return new pn(a).lex(n)}static lexInline(n,a){return new pn(a).inlineTokens(n)}lex(n){n=n.replace(/\r\n|\r/g,`
40
- `),this.blockTokens(n,this.tokens);for(let a=0;a<this.inlineQueue.length;a++){const o=this.inlineQueue[a];this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,a=[]){this.options.pedantic?n=n.replace(/\t/g," ").replace(/^ +$/gm,""):n=n.replace(/^( *)(\t+)/gm,(y,m,x)=>m+" ".repeat(x.length));let o,f,d,p;for(;n;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(y=>(o=y.call({lexer:this},n,a))?(n=n.substring(o.raw.length),a.push(o),!0):!1))){if(o=this.tokenizer.space(n)){n=n.substring(o.raw.length),o.raw.length===1&&a.length>0?a[a.length-1].raw+=`
41
- `:a.push(o);continue}if(o=this.tokenizer.code(n)){n=n.substring(o.raw.length),f=a[a.length-1],f&&(f.type==="paragraph"||f.type==="text")?(f.raw+=`
42
- `+o.raw,f.text+=`
43
- `+o.text,this.inlineQueue[this.inlineQueue.length-1].src=f.text):a.push(o);continue}if(o=this.tokenizer.fences(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.heading(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.hr(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.blockquote(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.list(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.html(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.def(n)){n=n.substring(o.raw.length),f=a[a.length-1],f&&(f.type==="paragraph"||f.type==="text")?(f.raw+=`
44
- `+o.raw,f.text+=`
45
- `+o.raw,this.inlineQueue[this.inlineQueue.length-1].src=f.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.lheading(n)){n=n.substring(o.raw.length),a.push(o);continue}if(d=n,this.options.extensions&&this.options.extensions.startBlock){let y=1/0;const m=n.slice(1);let x;this.options.extensions.startBlock.forEach(S=>{x=S.call({lexer:this},m),typeof x=="number"&&x>=0&&(y=Math.min(y,x))}),y<1/0&&y>=0&&(d=n.substring(0,y+1))}if(this.state.top&&(o=this.tokenizer.paragraph(d))){f=a[a.length-1],p&&f.type==="paragraph"?(f.raw+=`
46
- `+o.raw,f.text+=`
47
- `+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=f.text):a.push(o),p=d.length!==n.length,n=n.substring(o.raw.length);continue}if(o=this.tokenizer.text(n)){n=n.substring(o.raw.length),f=a[a.length-1],f&&f.type==="text"?(f.raw+=`
48
- `+o.raw,f.text+=`
49
- `+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=f.text):a.push(o);continue}if(n){const y="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(y);break}else throw new Error(y)}}return this.state.top=!0,a}inline(n,a=[]){return this.inlineQueue.push({src:n,tokens:a}),a}inlineTokens(n,a=[]){let o,f,d,p=n,y,m,x;if(this.tokens.links){const S=Object.keys(this.tokens.links);if(S.length>0)for(;(y=this.tokenizer.rules.inline.reflinkSearch.exec(p))!=null;)S.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(;n;)if(m||(x=""),m=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(S=>(o=S.call({lexer:this},n,a))?(n=n.substring(o.raw.length),a.push(o),!0):!1))){if(o=this.tokenizer.escape(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.tag(n)){n=n.substring(o.raw.length),f=a[a.length-1],f&&o.type==="text"&&f.type==="text"?(f.raw+=o.raw,f.text+=o.text):a.push(o);continue}if(o=this.tokenizer.link(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(o.raw.length),f=a[a.length-1],f&&o.type==="text"&&f.type==="text"?(f.raw+=o.raw,f.text+=o.text):a.push(o);continue}if(o=this.tokenizer.emStrong(n,p,x)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.codespan(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.br(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.del(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.autolink(n)){n=n.substring(o.raw.length),a.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(n))){n=n.substring(o.raw.length),a.push(o);continue}if(d=n,this.options.extensions&&this.options.extensions.startInline){let S=1/0;const A=n.slice(1);let E;this.options.extensions.startInline.forEach(H=>{E=H.call({lexer:this},A),typeof E=="number"&&E>=0&&(S=Math.min(S,E))}),S<1/0&&S>=0&&(d=n.substring(0,S+1))}if(o=this.tokenizer.inlineText(d)){n=n.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(x=o.raw.slice(-1)),m=!0,f=a[a.length-1],f&&f.type==="text"?(f.raw+=o.raw,f.text+=o.text):a.push(o);continue}if(n){const S="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(S);break}else throw new Error(S)}}return a}}class qi{constructor(n){Je(this,"options");this.options=n||Xn}code(n,a,o){var d;const f=(d=(a||"").match(/^\S*/))==null?void 0:d[0];return n=n.replace(/\n$/,"")+`
50
- `,f?'<pre><code class="language-'+jt(f)+'">'+(o?n:jt(n,!0))+`</code></pre>
31
+ `,1)[0],A=0;this.options.pedantic?(A=2,m=M.trimStart()):(A=a[2].search(/[^ ]/),A=A>4?1:A,m=M.slice(A),A+=a[1].length);let z=!1;if(!M&&/^ *$/.test(E)&&(y+=E+`
32
+ `,n=n.substring(E.length+1),S=!0),!S){const N=new RegExp(`^ {0,${Math.min(3,A-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),O=new RegExp(`^ {0,${Math.min(3,A-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),W=new RegExp(`^ {0,${Math.min(3,A-1)}}(?:\`\`\`|~~~)`),X=new RegExp(`^ {0,${Math.min(3,A-1)}}#`);for(;n;){const ne=n.split(`
33
+ `,1)[0];if(E=ne,this.options.pedantic&&(E=E.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),W.test(E)||X.test(E)||N.test(E)||O.test(n))break;if(E.search(/[^ ]/)>=A||!E.trim())m+=`
34
+ `+E.slice(A);else{if(z||M.search(/[^ ]/)>=4||W.test(M)||X.test(M)||O.test(M))break;m+=`
35
+ `+E}!z&&!E.trim()&&(z=!0),y+=ne+`
36
+ `,n=n.substring(ne.length+1),M=E.slice(A)}}d.loose||(w?d.loose=!0:/\n *\n *$/.test(y)&&(w=!0));let B=null,P;this.options.gfm&&(B=/^\[[ xX]\] /.exec(m),B&&(P=B[0]!=="[ ] ",m=m.replace(/^\[[ xX]\] +/,""))),d.items.push({type:"list_item",raw:y,task:!!B,checked:P,loose:!1,text:m,tokens:[]}),d.raw+=y}d.items[d.items.length-1].raw=y.trimEnd(),d.items[d.items.length-1].text=m.trimEnd(),d.raw=d.raw.trimEnd();for(let S=0;S<d.items.length;S++)if(this.lexer.state.top=!1,d.items[S].tokens=this.lexer.blockTokens(d.items[S].text,[]),!d.loose){const M=d.items[S].tokens.filter(A=>A.type==="space"),E=M.length>0&&M.some(A=>/\n.*\n/.test(A.raw));d.loose=E}if(d.loose)for(let S=0;S<d.items.length;S++)d.items[S].loose=!0;return d}}html(n){const a=this.rules.block.html.exec(n);if(a)return{type:"html",block:!0,raw:a[0],pre:a[1]==="pre"||a[1]==="script"||a[1]==="style",text:a[0]}}def(n){const a=this.rules.block.def.exec(n);if(a){const o=a[1].toLowerCase().replace(/\s+/g," "),c=a[2]?a[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",d=a[3]?a[3].substring(1,a[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):a[3];return{type:"def",tag:o,raw:a[0],href:c,title:d}}}table(n){const a=this.rules.block.table.exec(n);if(!a||!/[:|]/.test(a[2]))return;const o=yo(a[1]),c=a[2].replace(/^\||\| *$/g,"").split("|"),d=a[3]&&a[3].trim()?a[3].replace(/\n[ \t]*$/,"").split(`
37
+ `):[],p={type:"table",raw:a[0],header:[],align:[],rows:[]};if(o.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 o)p.header.push({text:y,tokens:this.lexer.inline(y)});for(const y of d)p.rows.push(yo(y,p.header.length).map(m=>({text:m,tokens:this.lexer.inline(m)})));return p}}lheading(n){const a=this.rules.block.lheading.exec(n);if(a)return{type:"heading",raw:a[0],depth:a[2].charAt(0)==="="?1:2,text:a[1],tokens:this.lexer.inline(a[1])}}paragraph(n){const a=this.rules.block.paragraph.exec(n);if(a){const o=a[1].charAt(a[1].length-1)===`
38
+ `?a[1].slice(0,-1):a[1];return{type:"paragraph",raw:a[0],text:o,tokens:this.lexer.inline(o)}}}text(n){const a=this.rules.block.text.exec(n);if(a)return{type:"text",raw:a[0],text:a[0],tokens:this.lexer.inline(a[0])}}escape(n){const a=this.rules.inline.escape.exec(n);if(a)return{type:"escape",raw:a[0],text:jt(a[1])}}tag(n){const a=this.rules.inline.tag.exec(n);if(a)return!this.lexer.state.inLink&&/^<a /i.test(a[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(a[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(a[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(a[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:a[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:a[0]}}link(n){const a=this.rules.inline.link.exec(n);if(a){const o=a[2].trim();if(!this.options.pedantic&&/^</.test(o)){if(!/>$/.test(o))return;const p=zi(o.slice(0,-1),"\\");if((o.length-p.length)%2===0)return}else{const p=rf(a[2],"()");if(p>-1){const m=(a[0].indexOf("!")===0?5:4)+a[1].length+p;a[2]=a[2].substring(0,p),a[0]=a[0].substring(0,m).trim(),a[3]=""}}let c=a[2],d="";if(this.options.pedantic){const p=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(c);p&&(c=p[1],d=p[3])}else d=a[3]?a[3].slice(1,-1):"";return c=c.trim(),/^</.test(c)&&(this.options.pedantic&&!/>$/.test(o)?c=c.slice(1):c=c.slice(1,-1)),bo(a,{href:c&&c.replace(this.rules.inline.anyPunctuation,"$1"),title:d&&d.replace(this.rules.inline.anyPunctuation,"$1")},a[0],this.lexer)}}reflink(n,a){let o;if((o=this.rules.inline.reflink.exec(n))||(o=this.rules.inline.nolink.exec(n))){const c=(o[2]||o[1]).replace(/\s+/g," "),d=a[c.toLowerCase()];if(!d){const p=o[0].charAt(0);return{type:"text",raw:p,text:p}}return bo(o,d,o[0],this.lexer)}}emStrong(n,a,o=""){let c=this.rules.inline.emStrongLDelim.exec(n);if(!c||c[3]&&o.match(/[\p{L}\p{N}]/u))return;if(!(c[1]||c[2]||"")||!o||this.rules.inline.punctuation.exec(o)){const p=[...c[0]].length-1;let y,m,w=p,S=0;const M=c[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(M.lastIndex=0,a=a.slice(-1*n.length+p);(c=M.exec(a))!=null;){if(y=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!y)continue;if(m=[...y].length,c[3]||c[4]){w+=m;continue}else if((c[5]||c[6])&&p%3&&!((p+m)%3)){S+=m;continue}if(w-=m,w>0)continue;m=Math.min(m,m+w+S);const E=[...c[0]][0].length,A=n.slice(0,p+c.index+E+m);if(Math.min(p,m)%2){const B=A.slice(1,-1);return{type:"em",raw:A,text:B,tokens:this.lexer.inlineTokens(B)}}const z=A.slice(2,-2);return{type:"strong",raw:A,text:z,tokens:this.lexer.inlineTokens(z)}}}}codespan(n){const a=this.rules.inline.code.exec(n);if(a){let o=a[2].replace(/\n/g," ");const c=/[^ ]/.test(o),d=/^ /.test(o)&&/ $/.test(o);return c&&d&&(o=o.substring(1,o.length-1)),o=jt(o,!0),{type:"codespan",raw:a[0],text:o}}}br(n){const a=this.rules.inline.br.exec(n);if(a)return{type:"br",raw:a[0]}}del(n){const a=this.rules.inline.del.exec(n);if(a)return{type:"del",raw:a[0],text:a[2],tokens:this.lexer.inlineTokens(a[2])}}autolink(n){const a=this.rules.inline.autolink.exec(n);if(a){let o,c;return a[2]==="@"?(o=jt(a[1]),c="mailto:"+o):(o=jt(a[1]),c=o),{type:"link",raw:a[0],text:o,href:c,tokens:[{type:"text",raw:o,text:o}]}}}url(n){var o;let a;if(a=this.rules.inline.url.exec(n)){let c,d;if(a[2]==="@")c=jt(a[0]),d="mailto:"+c;else{let p;do p=a[0],a[0]=((o=this.rules.inline._backpedal.exec(a[0]))==null?void 0:o[0])??"";while(p!==a[0]);c=jt(a[0]),a[1]==="www."?d="http://"+a[0]:d=a[0]}return{type:"link",raw:a[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}}inlineText(n){const a=this.rules.inline.text.exec(n);if(a){let o;return this.lexer.state.inRawBlock?o=a[0]:o=jt(a[0]),{type:"text",raw:a[0],text:o}}}}const sf=/^(?: *(?:\n|$))+/,of=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,lf=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Vr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,uf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,xo=/(?:[*+-]|\d{1,9}[.)])/,ko=je(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,xo).getRegex(),$a=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,cf=/^[^\n]+/,za=/(?!\s*\])(?:\\.|[^\[\]\\])+/,ff=je(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",za).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),hf=je(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,xo).getRegex(),Hi="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",Ba=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,df=je("^ {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",Ba).replace("tag",Hi).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),wo=je($a).replace("hr",Vr).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",Hi).getRegex(),Ha={blockquote:je(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",wo).getRegex(),code:of,def:ff,fences:lf,heading:uf,hr:Vr,html:df,lheading:ko,list:hf,newline:sf,paragraph:wo,table:Yr,text:cf},So=je("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Vr).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",Hi).getRegex(),pf={...Ha,table:So,paragraph:je($a).replace("hr",Vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",So).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",Hi).getRegex()},gf={...Ha,html:je(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ba).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:Yr,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:je($a).replace("hr",Vr).replace("heading",` *#{1,6} *[^
39
+ ]`).replace("lheading",ko).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Co=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,mf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,To=/^( {2,}|\\)\n(?!\s*$)/,vf=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Jr="\\p{P}$+<=>`^|~",yf=je(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Jr).getRegex(),bf=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,xf=je(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Jr).getRegex(),kf=je("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Jr).getRegex(),wf=je("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Jr).getRegex(),Sf=je(/\\([punct])/,"gu").replace(/punct/g,Jr).getRegex(),Cf=je(/^<(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(),Tf=je(Ba).replace("(?:-->|$)","-->").getRegex(),_f=je("^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",Tf).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Wi=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Lf=je(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Wi).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),_o=je(/^!?\[(label)\]\[(ref)\]/).replace("label",Wi).replace("ref",za).getRegex(),Lo=je(/^!?\[(ref)\](?:\[\])?/).replace("ref",za).getRegex(),Ef=je("reflink|nolink(?!\\()","g").replace("reflink",_o).replace("nolink",Lo).getRegex(),Wa={_backpedal:Yr,anyPunctuation:Sf,autolink:Cf,blockSkip:bf,br:To,code:mf,del:Yr,emStrongLDelim:xf,emStrongRDelimAst:kf,emStrongRDelimUnd:wf,escape:Co,link:Lf,nolink:Lo,punctuation:yf,reflink:_o,reflinkSearch:Ef,tag:_f,text:vf,url:Yr},Df={...Wa,link:je(/^!?\[(label)\]\((.*?)\)/).replace("label",Wi).getRegex(),reflink:je(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Wi).getRegex()},ja={...Wa,escape:je(Co).replace("])","~|])").getRegex(),url:je(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},Af={...ja,br:je(To).replace("{2,}","*").getRegex(),text:je(ja.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ji={normal:Ha,gfm:pf,pedantic:gf},Qr={normal:Wa,gfm:ja,breaks:Af,pedantic:Df};class pn{constructor(n){Je(this,"tokens");Je(this,"options");Je(this,"state");Je(this,"tokenizer");Je(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Xn,this.options.tokenizer=this.options.tokenizer||new Bi,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 a={block:ji.normal,inline:Qr.normal};this.options.pedantic?(a.block=ji.pedantic,a.inline=Qr.pedantic):this.options.gfm&&(a.block=ji.gfm,this.options.breaks?a.inline=Qr.breaks:a.inline=Qr.gfm),this.tokenizer.rules=a}static get rules(){return{block:ji,inline:Qr}}static lex(n,a){return new pn(a).lex(n)}static lexInline(n,a){return new pn(a).inlineTokens(n)}lex(n){n=n.replace(/\r\n|\r/g,`
40
+ `),this.blockTokens(n,this.tokens);for(let a=0;a<this.inlineQueue.length;a++){const o=this.inlineQueue[a];this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,a=[]){this.options.pedantic?n=n.replace(/\t/g," ").replace(/^ +$/gm,""):n=n.replace(/^( *)(\t+)/gm,(y,m,w)=>m+" ".repeat(w.length));let o,c,d,p;for(;n;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(y=>(o=y.call({lexer:this},n,a))?(n=n.substring(o.raw.length),a.push(o),!0):!1))){if(o=this.tokenizer.space(n)){n=n.substring(o.raw.length),o.raw.length===1&&a.length>0?a[a.length-1].raw+=`
41
+ `:a.push(o);continue}if(o=this.tokenizer.code(n)){n=n.substring(o.raw.length),c=a[a.length-1],c&&(c.type==="paragraph"||c.type==="text")?(c.raw+=`
42
+ `+o.raw,c.text+=`
43
+ `+o.text,this.inlineQueue[this.inlineQueue.length-1].src=c.text):a.push(o);continue}if(o=this.tokenizer.fences(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.heading(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.hr(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.blockquote(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.list(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.html(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.def(n)){n=n.substring(o.raw.length),c=a[a.length-1],c&&(c.type==="paragraph"||c.type==="text")?(c.raw+=`
44
+ `+o.raw,c.text+=`
45
+ `+o.raw,this.inlineQueue[this.inlineQueue.length-1].src=c.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title});continue}if(o=this.tokenizer.table(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.lheading(n)){n=n.substring(o.raw.length),a.push(o);continue}if(d=n,this.options.extensions&&this.options.extensions.startBlock){let y=1/0;const m=n.slice(1);let w;this.options.extensions.startBlock.forEach(S=>{w=S.call({lexer:this},m),typeof w=="number"&&w>=0&&(y=Math.min(y,w))}),y<1/0&&y>=0&&(d=n.substring(0,y+1))}if(this.state.top&&(o=this.tokenizer.paragraph(d))){c=a[a.length-1],p&&c.type==="paragraph"?(c.raw+=`
46
+ `+o.raw,c.text+=`
47
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=c.text):a.push(o),p=d.length!==n.length,n=n.substring(o.raw.length);continue}if(o=this.tokenizer.text(n)){n=n.substring(o.raw.length),c=a[a.length-1],c&&c.type==="text"?(c.raw+=`
48
+ `+o.raw,c.text+=`
49
+ `+o.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=c.text):a.push(o);continue}if(n){const y="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(y);break}else throw new Error(y)}}return this.state.top=!0,a}inline(n,a=[]){return this.inlineQueue.push({src:n,tokens:a}),a}inlineTokens(n,a=[]){let o,c,d,p=n,y,m,w;if(this.tokens.links){const S=Object.keys(this.tokens.links);if(S.length>0)for(;(y=this.tokenizer.rules.inline.reflinkSearch.exec(p))!=null;)S.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(;n;)if(m||(w=""),m=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(S=>(o=S.call({lexer:this},n,a))?(n=n.substring(o.raw.length),a.push(o),!0):!1))){if(o=this.tokenizer.escape(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.tag(n)){n=n.substring(o.raw.length),c=a[a.length-1],c&&o.type==="text"&&c.type==="text"?(c.raw+=o.raw,c.text+=o.text):a.push(o);continue}if(o=this.tokenizer.link(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(o.raw.length),c=a[a.length-1],c&&o.type==="text"&&c.type==="text"?(c.raw+=o.raw,c.text+=o.text):a.push(o);continue}if(o=this.tokenizer.emStrong(n,p,w)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.codespan(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.br(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.del(n)){n=n.substring(o.raw.length),a.push(o);continue}if(o=this.tokenizer.autolink(n)){n=n.substring(o.raw.length),a.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(n))){n=n.substring(o.raw.length),a.push(o);continue}if(d=n,this.options.extensions&&this.options.extensions.startInline){let S=1/0;const M=n.slice(1);let E;this.options.extensions.startInline.forEach(A=>{E=A.call({lexer:this},M),typeof E=="number"&&E>=0&&(S=Math.min(S,E))}),S<1/0&&S>=0&&(d=n.substring(0,S+1))}if(o=this.tokenizer.inlineText(d)){n=n.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(w=o.raw.slice(-1)),m=!0,c=a[a.length-1],c&&c.type==="text"?(c.raw+=o.raw,c.text+=o.text):a.push(o);continue}if(n){const S="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(S);break}else throw new Error(S)}}return a}}class qi{constructor(n){Je(this,"options");this.options=n||Xn}code(n,a,o){var d;const c=(d=(a||"").match(/^\S*/))==null?void 0:d[0];return n=n.replace(/\n$/,"")+`
50
+ `,c?'<pre><code class="language-'+jt(c)+'">'+(o?n:jt(n,!0))+`</code></pre>
51
51
  `:"<pre><code>"+(o?n:jt(n,!0))+`</code></pre>
52
52
  `}blockquote(n){return`<blockquote>
53
53
  ${n}</blockquote>
54
54
  `}html(n,a){return n}heading(n,a,o){return`<h${a}>${n}</h${a}>
55
55
  `}hr(){return`<hr>
56
- `}list(n,a,o){const f=a?"ol":"ul",d=a&&o!==1?' start="'+o+'"':"";return"<"+f+d+`>
57
- `+n+"</"+f+`>
56
+ `}list(n,a,o){const c=a?"ol":"ul",d=a&&o!==1?' start="'+o+'"':"";return"<"+c+d+`>
57
+ `+n+"</"+c+`>
58
58
  `}listitem(n,a,o){return`<li>${n}</li>
59
59
  `}checkbox(n){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(n){return`<p>${n}</p>
60
60
  `}table(n,a){return a&&(a=`<tbody>${a}</tbody>`),`<table>
@@ -64,9 +64,9 @@ ${n}</blockquote>
64
64
  `}tablerow(n){return`<tr>
65
65
  ${n}</tr>
66
66
  `}tablecell(n,a){const o=a.header?"th":"td";return(a.align?`<${o} align="${a.align}">`:`<${o}>`)+n+`</${o}>
67
- `}strong(n){return`<strong>${n}</strong>`}em(n){return`<em>${n}</em>`}codespan(n){return`<code>${n}</code>`}br(){return"<br>"}del(n){return`<del>${n}</del>`}link(n,a,o){const f=vo(n);if(f===null)return o;n=f;let d='<a href="'+n+'"';return a&&(d+=' title="'+a+'"'),d+=">"+o+"</a>",d}image(n,a,o){const f=vo(n);if(f===null)return o;n=f;let d=`<img src="${n}" alt="${o}"`;return a&&(d+=` title="${a}"`),d+=">",d}text(n){return n}}class qa{strong(n){return n}em(n){return n}codespan(n){return n}del(n){return n}html(n){return n}text(n){return n}link(n,a,o){return""+o}image(n,a,o){return""+o}br(){return""}}class gn{constructor(n){Je(this,"options");Je(this,"renderer");Je(this,"textRenderer");this.options=n||Xn,this.options.renderer=this.options.renderer||new qi,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new qa}static parse(n,a){return new gn(a).parse(n)}static parseInline(n,a){return new gn(a).parseInline(n)}parse(n,a=!0){let o="";for(let f=0;f<n.length;f++){const d=n[f];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[d.type]){const p=d,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)){o+=y||"";continue}}switch(d.type){case"space":continue;case"hr":{o+=this.renderer.hr();continue}case"heading":{const p=d;o+=this.renderer.heading(this.parseInline(p.tokens),p.depth,nc(this.parseInline(p.tokens,this.textRenderer)));continue}case"code":{const p=d;o+=this.renderer.code(p.text,p.lang,!!p.escaped);continue}case"table":{const p=d;let y="",m="";for(let S=0;S<p.header.length;S++)m+=this.renderer.tablecell(this.parseInline(p.header[S].tokens),{header:!0,align:p.align[S]});y+=this.renderer.tablerow(m);let x="";for(let S=0;S<p.rows.length;S++){const A=p.rows[S];m="";for(let E=0;E<A.length;E++)m+=this.renderer.tablecell(this.parseInline(A[E].tokens),{header:!1,align:p.align[E]});x+=this.renderer.tablerow(m)}o+=this.renderer.table(y,x);continue}case"blockquote":{const p=d,y=this.parse(p.tokens);o+=this.renderer.blockquote(y);continue}case"list":{const p=d,y=p.ordered,m=p.start,x=p.loose;let S="";for(let A=0;A<p.items.length;A++){const E=p.items[A],H=E.checked,B=E.task;let U="";if(E.task){const F=this.renderer.checkbox(!!H);x?E.tokens.length>0&&E.tokens[0].type==="paragraph"?(E.tokens[0].text=F+" "+E.tokens[0].text,E.tokens[0].tokens&&E.tokens[0].tokens.length>0&&E.tokens[0].tokens[0].type==="text"&&(E.tokens[0].tokens[0].text=F+" "+E.tokens[0].tokens[0].text)):E.tokens.unshift({type:"text",text:F+" "}):U+=F+" "}U+=this.parse(E.tokens,x),S+=this.renderer.listitem(U,B,!!H)}o+=this.renderer.list(S,y,m);continue}case"html":{const p=d;o+=this.renderer.html(p.text,p.block);continue}case"paragraph":{const p=d;o+=this.renderer.paragraph(this.parseInline(p.tokens));continue}case"text":{let p=d,y=p.tokens?this.parseInline(p.tokens):p.text;for(;f+1<n.length&&n[f+1].type==="text";)p=n[++f],y+=`
68
- `+(p.tokens?this.parseInline(p.tokens):p.text);o+=a?this.renderer.paragraph(y):y;continue}default:{const p='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return o}parseInline(n,a){a=a||this.renderer;let o="";for(let f=0;f<n.length;f++){const d=n[f];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[d.type]){const p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(d.type)){o+=p||"";continue}}switch(d.type){case"escape":{const p=d;o+=a.text(p.text);break}case"html":{const p=d;o+=a.html(p.text);break}case"link":{const p=d;o+=a.link(p.href,p.title,this.parseInline(p.tokens,a));break}case"image":{const p=d;o+=a.image(p.href,p.title,p.text);break}case"strong":{const p=d;o+=a.strong(this.parseInline(p.tokens,a));break}case"em":{const p=d;o+=a.em(this.parseInline(p.tokens,a));break}case"codespan":{const p=d;o+=a.codespan(p.text);break}case"br":{o+=a.br();break}case"del":{const p=d;o+=a.del(this.parseInline(p.tokens,a));break}case"text":{const p=d;o+=a.text(p.text);break}default:{const p='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return o}}class Zr{constructor(n){Je(this,"options");this.options=n||Xn}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}}Je(Zr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Ic{constructor(...n){Gf(this,Qn);Je(this,"defaults",Pa());Je(this,"options",this.setOptions);Je(this,"parse",Ra(this,Qn,so).call(this,pn.lex,gn.parse));Je(this,"parseInline",Ra(this,Qn,so).call(this,pn.lexInline,gn.parseInline));Je(this,"Parser",gn);Je(this,"Renderer",qi);Je(this,"TextRenderer",qa);Je(this,"Lexer",pn);Je(this,"Tokenizer",Bi);Je(this,"Hooks",Zr);this.use(...n)}walkTokens(n,a){var f,d;let o=[];for(const p of n)switch(o=o.concat(a.call(this,p)),p.type){case"table":{const y=p;for(const m of y.header)o=o.concat(this.walkTokens(m.tokens,a));for(const m of y.rows)for(const x of m)o=o.concat(this.walkTokens(x.tokens,a));break}case"list":{const y=p;o=o.concat(this.walkTokens(y.items,a));break}default:{const y=p;(d=(f=this.defaults.extensions)==null?void 0:f.childTokens)!=null&&d[y.type]?this.defaults.extensions.childTokens[y.type].forEach(m=>{const x=y[m].flat(1/0);o=o.concat(this.walkTokens(x,a))}):y.tokens&&(o=o.concat(this.walkTokens(y.tokens,a)))}}return o}use(...n){const a=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(o=>{const f={...o};if(f.async=this.defaults.async||f.async||!1,o.extensions&&(o.extensions.forEach(d=>{if(!d.name)throw new Error("extension name required");if("renderer"in d){const p=a.renderers[d.name];p?a.renderers[d.name]=function(...y){let m=d.renderer.apply(this,y);return m===!1&&(m=p.apply(this,y)),m}:a.renderers[d.name]=d.renderer}if("tokenizer"in d){if(!d.level||d.level!=="block"&&d.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const p=a[d.level];p?p.unshift(d.tokenizer):a[d.level]=[d.tokenizer],d.start&&(d.level==="block"?a.startBlock?a.startBlock.push(d.start):a.startBlock=[d.start]:d.level==="inline"&&(a.startInline?a.startInline.push(d.start):a.startInline=[d.start]))}"childTokens"in d&&d.childTokens&&(a.childTokens[d.name]=d.childTokens)}),f.extensions=a),o.renderer){const d=this.defaults.renderer||new qi(this.defaults);for(const p in o.renderer){if(!(p in d))throw new Error(`renderer '${p}' does not exist`);if(p==="options")continue;const y=p,m=o.renderer[y],x=d[y];d[y]=(...S)=>{let A=m.apply(d,S);return A===!1&&(A=x.apply(d,S)),A||""}}f.renderer=d}if(o.tokenizer){const d=this.defaults.tokenizer||new Bi(this.defaults);for(const p in o.tokenizer){if(!(p in d))throw new Error(`tokenizer '${p}' does not exist`);if(["options","rules","lexer"].includes(p))continue;const y=p,m=o.tokenizer[y],x=d[y];d[y]=(...S)=>{let A=m.apply(d,S);return A===!1&&(A=x.apply(d,S)),A}}f.tokenizer=d}if(o.hooks){const d=this.defaults.hooks||new Zr;for(const p in o.hooks){if(!(p in d))throw new Error(`hook '${p}' does not exist`);if(p==="options")continue;const y=p,m=o.hooks[y],x=d[y];Zr.passThroughHooks.has(p)?d[y]=S=>{if(this.defaults.async)return Promise.resolve(m.call(d,S)).then(E=>x.call(d,E));const A=m.call(d,S);return x.call(d,A)}:d[y]=(...S)=>{let A=m.apply(d,S);return A===!1&&(A=x.apply(d,S)),A}}f.hooks=d}if(o.walkTokens){const d=this.defaults.walkTokens,p=o.walkTokens;f.walkTokens=function(y){let m=[];return m.push(p.call(this,y)),d&&(m=m.concat(d.call(this,y))),m}}this.defaults={...this.defaults,...f}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,a){return pn.lex(n,a??this.defaults)}parser(n,a){return gn.parse(n,a??this.defaults)}}Qn=new WeakSet,so=function(n,a){return(o,f)=>{const d={...f},p={...this.defaults,...d};this.defaults.async===!0&&d.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=Ra(this,Qn,Kf).call(this,!!p.silent,!!p.async);if(typeof o>"u"||o===null)return y(new Error("marked(): input parameter is undefined or null"));if(typeof o!="string")return y(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(o)+", string expected"));if(p.hooks&&(p.hooks.options=p),p.async)return Promise.resolve(p.hooks?p.hooks.preprocess(o):o).then(m=>n(m,p)).then(m=>p.hooks?p.hooks.processAllTokens(m):m).then(m=>p.walkTokens?Promise.all(this.walkTokens(m,p.walkTokens)).then(()=>m):m).then(m=>a(m,p)).then(m=>p.hooks?p.hooks.postprocess(m):m).catch(y);try{p.hooks&&(o=p.hooks.preprocess(o));let m=n(o,p);p.hooks&&(m=p.hooks.processAllTokens(m)),p.walkTokens&&this.walkTokens(m,p.walkTokens);let x=a(m,p);return p.hooks&&(x=p.hooks.postprocess(x)),x}catch(m){return y(m)}}},Kf=function(n,a){return o=>{if(o.message+=`
69
- Please report this to https://github.com/markedjs/marked.`,n){const f="<p>An error occurred:</p><pre>"+jt(o.message+"",!0)+"</pre>";return a?Promise.resolve(f):f}if(a)return Promise.reject(o);throw o}};const Yn=new Ic;function Le(l,n){return Yn.parse(l,n)}Le.options=Le.setOptions=function(l){return Yn.setOptions(l),Le.defaults=Yn.defaults,ho(Le.defaults),Le},Le.getDefaults=Pa,Le.defaults=Xn,Le.use=function(...l){return Yn.use(...l),Le.defaults=Yn.defaults,ho(Le.defaults),Le},Le.walkTokens=function(l,n){return Yn.walkTokens(l,n)},Le.parseInline=Yn.parseInline,Le.Parser=gn,Le.parser=gn.parse,Le.Renderer=qi,Le.TextRenderer=qa,Le.Lexer=pn,Le.lexer=pn.lex,Le.Tokenizer=Bi,Le.Hooks=Zr,Le.parse=Le,Le.options,Le.setOptions,Le.use,Le.walkTokens,Le.parseInline,gn.parse,pn.lex;function In(l,n,a,o,f,d,p,y){var m=typeof l=="function"?l.options:l;return n&&(m.render=n,m.staticRenderFns=a,m._compiled=!0),d&&(m._scopeId="data-v-"+d),{exports:l,options:m}}const Oc={name:"TimelineHeader",props:{timeRange:{type:String,default:"-"},allExpanded:{type:Boolean,default:!1},viewMode:{type:String,default:"list"}},methods:{handleToggleExpand(){this.$emit("toggle-expand")},handleToggleView(){this.$emit("toggle-view")}}};var Nc=function(){var n=this,a=n._self._c;return a("div",{staticClass:"timeline-header"},[a("div",{staticClass:"time-scale"},[a("span",{staticClass:"time-range"},[n._v(n._s(n.timeRange))])]),a("div",{staticClass:"header-actions"},[n.viewMode==="tree"?a("el-tooltip",{attrs:{content:n.allExpanded?"合上所有节点":"展开所有节点",placement:"top"}},[a("i",{staticClass:"action-icon",class:n.allExpanded?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:n.handleToggleExpand}})]):n._e(),a("el-tooltip",{attrs:{content:n.viewMode==="list"?"切换到树形视图":"切换到列表视图",placement:"top"}},[a("i",{staticClass:"action-icon",class:n.viewMode==="list"?"el-icon-menu":"el-icon-s-operation",on:{click:n.handleToggleView}})])],1)])},Mc=[],Rc=In(Oc,Nc,Mc,!1,null,"a6b357e5");const Fc=Rc.exports,Pc={name:"TimelineBar",props:{barStyle:{type:Object,required:!0},statusDescription:{type:String,default:""},selected:{type:Boolean,default:!1},error:{type:Boolean,default:!1},hasEvents:{type:Boolean,default:!1}}};var zc=function(){var n=this,a=n._self._c;return a("el-tooltip",{attrs:{content:n.statusDescription,disabled:!n.statusDescription,placement:"top","popper-class":"span-status-tooltip"}},[a("div",{staticClass:"timeline-bar-wrapper"},[a("div",{staticClass:"timeline-bar",class:{selected:n.selected,error:n.error,"has-events":n.hasEvents},style:n.barStyle})])])},$c=[],Bc=In(Pc,zc,$c,!1,null,"52995efa");const Eo=Bc.exports;function Do(l){if(!l)return"-";const n=l/1e6;return n<1e3?`${n.toFixed(2)}ms`:n<6e4?`${(n/1e3).toFixed(2)}s`:`${(n/6e4).toFixed(2)}min`}function Ao(l){if(!l)return"-";const n=l/1e6,a=new Date(n),o=a.getFullYear(),f=String(a.getMonth()+1).padStart(2,"0"),d=String(a.getDate()).padStart(2,"0"),p=String(a.getHours()).padStart(2,"0"),y=String(a.getMinutes()).padStart(2,"0"),m=String(a.getSeconds()).padStart(2,"0");return`${o}/${f}/${d} ${p}:${y}:${m}`}function Hc(l,n,a="-"){return!l||!n?"-":`${Ao(l)} ${a} ${Ao(n)}`}function Io(l){const n={SERVER:"primary",CHAT_MODEL:"success",LLM:"success",CLIENT:"",INTERNAL:"info",EMBEDDING:"",CHAIN:"warning",AGENT:"danger",TOOL:"info",JOB:"warning",FUNCTION:"info"};return n[l]!==void 0?n[l]:"info"}function Oo(l){return{CLIENT:"rgb(141 252 245)",EMBEDDING:"rgb(248 246 130)"}[l]||void 0}function No(l){return l.status_description?l.status_description:""}function Mo(l,n,a){if(!n||!a||n===a)return{width:"100%"};const o=a-n,f=l.start_time_unix_nano-n,d=l.duration_ns,p=f/o*100,y=d/o*100;return{left:`${p}%`,width:`${y}%`}}const Wc={name:"SpanTreeNode",components:{TimelineBar:Eo},props:{node:{type:Object,required:!0},selected:{type:Boolean,default:!1},selectedSpanId:{type:String,default:null},expandedNodes:{type:Set,required:!0},depth:{type:Number,default:0},traceStartTime:{type:Number,default:0},traceEndTime:{type:Number,default:0}},computed:{hasChildren(){return this.node.children&&this.node.children.length>0},isRootNode(){return this.depth===0},isExpanded(){return this.isRootNode?!0:this.expandedNodes.has(this.node.span_id)},shouldShowChildren(){return this.isRootNode?!0:this.isExpanded},duration(){return Do(this.node.duration_ns)},typeColor(){return Io(this.node.type)},typeCustomColor(){return Oo(this.node.type)},statusDescription(){return No(this.node)},barStyle(){return Mo(this.node,this.traceStartTime,this.traceEndTime)},error(){return this.node.status==="ERROR"},hasEvents(){return this.node.has_events===!0},isChild(){return this.depth>0}},methods:{handleClick(){this.$emit("node-click",this.node)},handleToggleExpand(){this.isRootNode||this.$emit("toggle-expand",this.node)}}};var jc=function(){var n=this,a=n._self._c;return a("div",[a("div",{staticClass:"timeline-node",class:{selected:n.selected,error:n.error,"child-node":n.isChild},on:{click:n.handleClick}},[a("div",{staticClass:"node-row"},[a("div",{staticClass:"node-info"},[n.hasChildren&&!n.isRootNode?a("i",{staticClass:"expand-icon",class:n.isExpanded?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:function(o){return o.stopPropagation(),n.handleToggleExpand.apply(null,arguments)}}}):n._e(),a("el-tag",{staticClass:"type-tag",attrs:{type:n.typeColor,color:n.typeCustomColor,size:"mini"}},[n._v(" "+n._s(n.node.type)+" ")]),a("el-tooltip",{attrs:{content:n.node.name,placement:"top","open-delay":300}},[a("span",{staticClass:"node-name"},[n._v(n._s(n.node.name))])])],1),a("div",{staticClass:"node-duration"},[n._v(" "+n._s(n.duration)+" ")])]),a("TimelineBar",{attrs:{"bar-style":n.barStyle,"status-description":n.statusDescription,selected:n.selected,error:n.error,"has-events":n.hasEvents}})],1),n.shouldShowChildren&&n.hasChildren?a("div",{staticClass:"children-nodes"},n._l(n.node.children,function(o){return a("SpanTreeNode",{key:o.span_id,attrs:{node:o,selected:o.span_id===n.selectedSpanId,"selected-span-id":n.selectedSpanId,"expanded-nodes":n.expandedNodes,depth:n.depth+1,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"node-click":function(f){return n.$emit("node-click",f)},"toggle-expand":function(f){return n.$emit("toggle-expand",f)}}})}),1):n._e()])},qc=[],Uc=In(Wc,jc,qc,!1,null,"f1d06a11");const Gc=Uc.exports,Kc={name:"SpanListNode",components:{TimelineBar:Eo},props:{node:{type:Object,required:!0},selected:{type:Boolean,default:!1},traceStartTime:{type:Number,default:0},traceEndTime:{type:Number,default:0}},computed:{duration(){return Do(this.node.duration_ns)},typeColor(){return Io(this.node.type)},typeCustomColor(){return Oo(this.node.type)},statusDescription(){return No(this.node)},barStyle(){return Mo(this.node,this.traceStartTime,this.traceEndTime)},error(){return this.node.status==="ERROR"},hasEvents(){return this.node.has_events===!0}},methods:{handleClick(){this.$emit("node-click",this.node)}}};var Xc=function(){var n=this,a=n._self._c;return a("div",{staticClass:"timeline-node",class:{selected:n.selected,error:n.error},on:{click:n.handleClick}},[a("div",{staticClass:"node-row"},[a("div",{staticClass:"node-info"},[a("el-tag",{staticClass:"type-tag",attrs:{type:n.typeColor,color:n.typeCustomColor,size:"mini"}},[n._v(" "+n._s(n.node.type)+" ")]),a("el-tooltip",{attrs:{content:n.node.name,placement:"top","open-delay":300}},[a("span",{staticClass:"node-name"},[n._v(n._s(n.node.name))])])],1),a("div",{staticClass:"node-duration"},[n._v(" "+n._s(n.duration)+" ")])]),a("TimelineBar",{attrs:{"bar-style":n.barStyle,"status-description":n.statusDescription,selected:n.selected,error:n.error,"has-events":n.hasEvents}})],1)},Yc=[],Vc=In(Kc,Xc,Yc,!1,null,"87a70c40");const Jc=Vc.exports,Qc={name:"TraceSpanTree",components:{TimelineHeader:Fc,SpanTreeNode:Gc,SpanListNode:Jc},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:[],allExpanded:!1,viewMode:"list"}},computed:{flatListData(){const l=[],n=a=>{a.forEach(o=>{l.push(o),o.children&&o.children.length>0&&n(o.children)})};return n(this.treeData),l},timeRange(){const l=this.$t?this.$t("trace.to"):"-";return Hc(this.traceStartTime,this.traceEndTime,l)}},watch:{spans:{immediate:!0,handler(){this.buildTree()}}},methods:{buildTree(){if(!this.spans||this.spans.length===0){this.treeData=[];return}const l=new Map,n=[];this.spans.forEach(a=>{l.set(a.span_id,{...a,children:[]})}),this.spans.forEach(a=>{const o=l.get(a.span_id);if(a.parent_span_id){const f=l.get(a.parent_span_id);f?f.children.push(o):n.push(o)}else n.push(o)}),n.forEach(a=>{this.sortChildren(a)}),this.treeData=n,this.expandAllNodes()},expandAllNodes(){const l=new Set,n=a=>{a.forEach(o=>{o.children&&o.children.length>0&&o.children.forEach(f=>{this.hasChildren(f)&&l.add(f.span_id),f.children&&f.children.length>0&&n([f])})})};n(this.treeData),this.expandedNodes=l,this.allExpanded=!0,this.$forceUpdate()},collapseAllNodes(){const l=new Set;this.expandedNodes=l,this.allExpanded=!1,this.$forceUpdate()},toggleAllExpand(){this.allExpanded?this.collapseAllNodes():this.expandAllNodes()},toggleViewMode(){this.viewMode=this.viewMode==="list"?"tree":"list"},sortChildren(l){l.children&&l.children.length>0&&(l.children.sort((n,a)=>n.start_time_unix_nano-a.start_time_unix_nano),l.children.forEach(n=>this.sortChildren(n)))},handleNodeClick(l){this.$emit("span-select",l)},hasChildren(l){return l.children&&l.children.length>0},toggleExpand(l){if(this.treeData.some(o=>o.span_id===l.span_id))return;const a=new Set(this.expandedNodes);a.has(l.span_id)?a.delete(l.span_id):a.add(l.span_id),this.expandedNodes=a,this.updateAllExpandedState(),this.$forceUpdate()},updateAllExpandedState(){const l=(a,o=!1)=>{for(const f of a)if(this.hasChildren(f)&&(!o&&!this.expandedNodes.has(f.span_id)||f.children&&f.children.length>0&&!l(f.children,!1)))return!1;return!0};if(!this.treeData.some(a=>a.children&&a.children.some(o=>this.hasChildren(o)))){this.allExpanded=!1;return}this.allExpanded=l(this.treeData,!0)}}};var Zc=function(){var n=this,a=n._self._c;return a("div",{staticClass:"span-tree-container"},[n.treeData.length===0?a("div",{staticClass:"empty-state"},[a("el-empty",{attrs:{description:"暂无 Span 数据"}})],1):a("div",{staticClass:"timeline-wrapper"},[a("TimelineHeader",{attrs:{"time-range":n.timeRange,"all-expanded":n.allExpanded,"view-mode":n.viewMode},on:{"toggle-expand":n.toggleAllExpand,"toggle-view":n.toggleViewMode}}),a("div",{ref:"timelineContent",staticClass:"timeline-content"},[n.viewMode==="tree"?n._l(n.treeData,function(o){return a("SpanTreeNode",{key:o.span_id,attrs:{node:o,selected:n.selectedSpanId===o.span_id,"selected-span-id":n.selectedSpanId,"expanded-nodes":n.expandedNodes,depth:0,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"node-click":n.handleNodeClick,"toggle-expand":n.toggleExpand}})}):n._l(n.flatListData,function(o){return a("SpanListNode",{key:o.span_id,attrs:{node:o,selected:n.selectedSpanId===o.span_id,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"node-click":n.handleNodeClick}})})],2)],1)])},eh=[],th=In(Qc,Zc,eh,!1,null,"1eff9f3c");const Ua=th.exports;/*!
67
+ `}strong(n){return`<strong>${n}</strong>`}em(n){return`<em>${n}</em>`}codespan(n){return`<code>${n}</code>`}br(){return"<br>"}del(n){return`<del>${n}</del>`}link(n,a,o){const c=vo(n);if(c===null)return o;n=c;let d='<a href="'+n+'"';return a&&(d+=' title="'+a+'"'),d+=">"+o+"</a>",d}image(n,a,o){const c=vo(n);if(c===null)return o;n=c;let d=`<img src="${n}" alt="${o}"`;return a&&(d+=` title="${a}"`),d+=">",d}text(n){return n}}class qa{strong(n){return n}em(n){return n}codespan(n){return n}del(n){return n}html(n){return n}text(n){return n}link(n,a,o){return""+o}image(n,a,o){return""+o}br(){return""}}class gn{constructor(n){Je(this,"options");Je(this,"renderer");Je(this,"textRenderer");this.options=n||Xn,this.options.renderer=this.options.renderer||new qi,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new qa}static parse(n,a){return new gn(a).parse(n)}static parseInline(n,a){return new gn(a).parseInline(n)}parse(n,a=!0){let o="";for(let c=0;c<n.length;c++){const d=n[c];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[d.type]){const p=d,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)){o+=y||"";continue}}switch(d.type){case"space":continue;case"hr":{o+=this.renderer.hr();continue}case"heading":{const p=d;o+=this.renderer.heading(this.parseInline(p.tokens),p.depth,tf(this.parseInline(p.tokens,this.textRenderer)));continue}case"code":{const p=d;o+=this.renderer.code(p.text,p.lang,!!p.escaped);continue}case"table":{const p=d;let y="",m="";for(let S=0;S<p.header.length;S++)m+=this.renderer.tablecell(this.parseInline(p.header[S].tokens),{header:!0,align:p.align[S]});y+=this.renderer.tablerow(m);let w="";for(let S=0;S<p.rows.length;S++){const M=p.rows[S];m="";for(let E=0;E<M.length;E++)m+=this.renderer.tablecell(this.parseInline(M[E].tokens),{header:!1,align:p.align[E]});w+=this.renderer.tablerow(m)}o+=this.renderer.table(y,w);continue}case"blockquote":{const p=d,y=this.parse(p.tokens);o+=this.renderer.blockquote(y);continue}case"list":{const p=d,y=p.ordered,m=p.start,w=p.loose;let S="";for(let M=0;M<p.items.length;M++){const E=p.items[M],A=E.checked,z=E.task;let B="";if(E.task){const P=this.renderer.checkbox(!!A);w?E.tokens.length>0&&E.tokens[0].type==="paragraph"?(E.tokens[0].text=P+" "+E.tokens[0].text,E.tokens[0].tokens&&E.tokens[0].tokens.length>0&&E.tokens[0].tokens[0].type==="text"&&(E.tokens[0].tokens[0].text=P+" "+E.tokens[0].tokens[0].text)):E.tokens.unshift({type:"text",text:P+" "}):B+=P+" "}B+=this.parse(E.tokens,w),S+=this.renderer.listitem(B,z,!!A)}o+=this.renderer.list(S,y,m);continue}case"html":{const p=d;o+=this.renderer.html(p.text,p.block);continue}case"paragraph":{const p=d;o+=this.renderer.paragraph(this.parseInline(p.tokens));continue}case"text":{let p=d,y=p.tokens?this.parseInline(p.tokens):p.text;for(;c+1<n.length&&n[c+1].type==="text";)p=n[++c],y+=`
68
+ `+(p.tokens?this.parseInline(p.tokens):p.text);o+=a?this.renderer.paragraph(y):y;continue}default:{const p='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return o}parseInline(n,a){a=a||this.renderer;let o="";for(let c=0;c<n.length;c++){const d=n[c];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[d.type]){const p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(d.type)){o+=p||"";continue}}switch(d.type){case"escape":{const p=d;o+=a.text(p.text);break}case"html":{const p=d;o+=a.html(p.text);break}case"link":{const p=d;o+=a.link(p.href,p.title,this.parseInline(p.tokens,a));break}case"image":{const p=d;o+=a.image(p.href,p.title,p.text);break}case"strong":{const p=d;o+=a.strong(this.parseInline(p.tokens,a));break}case"em":{const p=d;o+=a.em(this.parseInline(p.tokens,a));break}case"codespan":{const p=d;o+=a.codespan(p.text);break}case"br":{o+=a.br();break}case"del":{const p=d;o+=a.del(this.parseInline(p.tokens,a));break}case"text":{const p=d;o+=a.text(p.text);break}default:{const p='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return o}}class Zr{constructor(n){Je(this,"options");this.options=n||Xn}preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}}Je(Zr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class If{constructor(...n){Uc(this,Qn);Je(this,"defaults",Pa());Je(this,"options",this.setOptions);Je(this,"parse",Ma(this,Qn,so).call(this,pn.lex,gn.parse));Je(this,"parseInline",Ma(this,Qn,so).call(this,pn.lexInline,gn.parseInline));Je(this,"Parser",gn);Je(this,"Renderer",qi);Je(this,"TextRenderer",qa);Je(this,"Lexer",pn);Je(this,"Tokenizer",Bi);Je(this,"Hooks",Zr);this.use(...n)}walkTokens(n,a){var c,d;let o=[];for(const p of n)switch(o=o.concat(a.call(this,p)),p.type){case"table":{const y=p;for(const m of y.header)o=o.concat(this.walkTokens(m.tokens,a));for(const m of y.rows)for(const w of m)o=o.concat(this.walkTokens(w.tokens,a));break}case"list":{const y=p;o=o.concat(this.walkTokens(y.items,a));break}default:{const y=p;(d=(c=this.defaults.extensions)==null?void 0:c.childTokens)!=null&&d[y.type]?this.defaults.extensions.childTokens[y.type].forEach(m=>{const w=y[m].flat(1/0);o=o.concat(this.walkTokens(w,a))}):y.tokens&&(o=o.concat(this.walkTokens(y.tokens,a)))}}return o}use(...n){const a=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(o=>{const c={...o};if(c.async=this.defaults.async||c.async||!1,o.extensions&&(o.extensions.forEach(d=>{if(!d.name)throw new Error("extension name required");if("renderer"in d){const p=a.renderers[d.name];p?a.renderers[d.name]=function(...y){let m=d.renderer.apply(this,y);return m===!1&&(m=p.apply(this,y)),m}:a.renderers[d.name]=d.renderer}if("tokenizer"in d){if(!d.level||d.level!=="block"&&d.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const p=a[d.level];p?p.unshift(d.tokenizer):a[d.level]=[d.tokenizer],d.start&&(d.level==="block"?a.startBlock?a.startBlock.push(d.start):a.startBlock=[d.start]:d.level==="inline"&&(a.startInline?a.startInline.push(d.start):a.startInline=[d.start]))}"childTokens"in d&&d.childTokens&&(a.childTokens[d.name]=d.childTokens)}),c.extensions=a),o.renderer){const d=this.defaults.renderer||new qi(this.defaults);for(const p in o.renderer){if(!(p in d))throw new Error(`renderer '${p}' does not exist`);if(p==="options")continue;const y=p,m=o.renderer[y],w=d[y];d[y]=(...S)=>{let M=m.apply(d,S);return M===!1&&(M=w.apply(d,S)),M||""}}c.renderer=d}if(o.tokenizer){const d=this.defaults.tokenizer||new Bi(this.defaults);for(const p in o.tokenizer){if(!(p in d))throw new Error(`tokenizer '${p}' does not exist`);if(["options","rules","lexer"].includes(p))continue;const y=p,m=o.tokenizer[y],w=d[y];d[y]=(...S)=>{let M=m.apply(d,S);return M===!1&&(M=w.apply(d,S)),M}}c.tokenizer=d}if(o.hooks){const d=this.defaults.hooks||new Zr;for(const p in o.hooks){if(!(p in d))throw new Error(`hook '${p}' does not exist`);if(p==="options")continue;const y=p,m=o.hooks[y],w=d[y];Zr.passThroughHooks.has(p)?d[y]=S=>{if(this.defaults.async)return Promise.resolve(m.call(d,S)).then(E=>w.call(d,E));const M=m.call(d,S);return w.call(d,M)}:d[y]=(...S)=>{let M=m.apply(d,S);return M===!1&&(M=w.apply(d,S)),M}}c.hooks=d}if(o.walkTokens){const d=this.defaults.walkTokens,p=o.walkTokens;c.walkTokens=function(y){let m=[];return m.push(p.call(this,y)),d&&(m=m.concat(d.call(this,y))),m}}this.defaults={...this.defaults,...c}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,a){return pn.lex(n,a??this.defaults)}parser(n,a){return gn.parse(n,a??this.defaults)}}Qn=new WeakSet,so=function(n,a){return(o,c)=>{const d={...c},p={...this.defaults,...d};this.defaults.async===!0&&d.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=Ma(this,Qn,Gc).call(this,!!p.silent,!!p.async);if(typeof o>"u"||o===null)return y(new Error("marked(): input parameter is undefined or null"));if(typeof o!="string")return y(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(o)+", string expected"));if(p.hooks&&(p.hooks.options=p),p.async)return Promise.resolve(p.hooks?p.hooks.preprocess(o):o).then(m=>n(m,p)).then(m=>p.hooks?p.hooks.processAllTokens(m):m).then(m=>p.walkTokens?Promise.all(this.walkTokens(m,p.walkTokens)).then(()=>m):m).then(m=>a(m,p)).then(m=>p.hooks?p.hooks.postprocess(m):m).catch(y);try{p.hooks&&(o=p.hooks.preprocess(o));let m=n(o,p);p.hooks&&(m=p.hooks.processAllTokens(m)),p.walkTokens&&this.walkTokens(m,p.walkTokens);let w=a(m,p);return p.hooks&&(w=p.hooks.postprocess(w)),w}catch(m){return y(m)}}},Gc=function(n,a){return o=>{if(o.message+=`
69
+ Please report this to https://github.com/markedjs/marked.`,n){const c="<p>An error occurred:</p><pre>"+jt(o.message+"",!0)+"</pre>";return a?Promise.resolve(c):c}if(a)return Promise.reject(o);throw o}};const Yn=new If;function Le(l,n){return Yn.parse(l,n)}Le.options=Le.setOptions=function(l){return Yn.setOptions(l),Le.defaults=Yn.defaults,ho(Le.defaults),Le},Le.getDefaults=Pa,Le.defaults=Xn,Le.use=function(...l){return Yn.use(...l),Le.defaults=Yn.defaults,ho(Le.defaults),Le},Le.walkTokens=function(l,n){return Yn.walkTokens(l,n)},Le.parseInline=Yn.parseInline,Le.Parser=gn,Le.parser=gn.parse,Le.Renderer=qi,Le.TextRenderer=qa,Le.Lexer=pn,Le.lexer=pn.lex,Le.Tokenizer=Bi,Le.Hooks=Zr,Le.parse=Le,Le.options,Le.setOptions,Le.use,Le.walkTokens,Le.parseInline,gn.parse,pn.lex;function In(l,n,a,o,c,d,p,y){var m=typeof l=="function"?l.options:l;return n&&(m.render=n,m.staticRenderFns=a,m._compiled=!0),d&&(m._scopeId="data-v-"+d),{exports:l,options:m}}const Of={name:"TimelineHeader",props:{timeRange:{type:String,default:"-"},allExpanded:{type:Boolean,default:!1},viewMode:{type:String,default:"list"}},methods:{handleToggleExpand(){this.$emit("toggle-expand")},handleToggleView(){this.$emit("toggle-view")}}};var Nf=function(){var n=this,a=n._self._c;return a("div",{staticClass:"timeline-header"},[a("div",{staticClass:"time-scale"},[a("span",{staticClass:"time-range"},[n._v(n._s(n.timeRange))])]),a("div",{staticClass:"header-actions"},[n.viewMode==="tree"?a("el-tooltip",{attrs:{content:n.allExpanded?"合上所有节点":"展开所有节点",placement:"top"}},[a("i",{staticClass:"action-icon",class:n.allExpanded?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:n.handleToggleExpand}})]):n._e(),a("el-tooltip",{attrs:{content:n.viewMode==="list"?"切换到树形视图":"切换到列表视图",placement:"top"}},[a("i",{staticClass:"action-icon",class:n.viewMode==="list"?"el-icon-menu":"el-icon-s-operation",on:{click:n.handleToggleView}})])],1)])},Rf=[],Mf=In(Of,Nf,Rf,!1,null,"a6b357e5");const Ff=Mf.exports,Pf={name:"TimelineBar",props:{barStyle:{type:Object,required:!0},statusDescription:{type:String,default:""},selected:{type:Boolean,default:!1},error:{type:Boolean,default:!1},hasEvents:{type:Boolean,default:!1}}};var $f=function(){var n=this,a=n._self._c;return a("el-tooltip",{attrs:{content:n.statusDescription,disabled:!n.statusDescription,placement:"top","popper-class":"span-status-tooltip"}},[a("div",{staticClass:"timeline-bar-wrapper"},[a("div",{staticClass:"timeline-bar",class:{selected:n.selected,error:n.error,"has-events":n.hasEvents},style:n.barStyle})])])},zf=[],Bf=In(Pf,$f,zf,!1,null,"52995efa");const Eo=Bf.exports;function Do(l){if(!l)return"-";const n=l/1e6;return n<1e3?`${n.toFixed(2)}ms`:n<6e4?`${(n/1e3).toFixed(2)}s`:`${(n/6e4).toFixed(2)}min`}function Ao(l){if(!l)return"-";const n=l/1e6,a=new Date(n),o=a.getFullYear(),c=String(a.getMonth()+1).padStart(2,"0"),d=String(a.getDate()).padStart(2,"0"),p=String(a.getHours()).padStart(2,"0"),y=String(a.getMinutes()).padStart(2,"0"),m=String(a.getSeconds()).padStart(2,"0");return`${o}/${c}/${d} ${p}:${y}:${m}`}function Hf(l,n,a="-"){return!l||!n?"-":`${Ao(l)} ${a} ${Ao(n)}`}function Io(l){const n={SERVER:"primary",CHAT_MODEL:"success",LLM:"success",CLIENT:"",INTERNAL:"info",EMBEDDING:"",CHAIN:"warning",AGENT:"danger",TOOL:"info",JOB:"warning",FUNCTION:"info"};return n[l]!==void 0?n[l]:"info"}function Oo(l){return{CLIENT:"rgb(141 252 245)",EMBEDDING:"rgb(248 246 130)"}[l]||void 0}function No(l){return l.status_description?l.status_description:""}function Ro(l,n,a){if(!n||!a||n===a)return{width:"100%"};const o=a-n,c=l.start_time_unix_nano-n,d=l.duration_ns,p=c/o*100,y=d/o*100;return{left:`${p}%`,width:`${y}%`}}const Wf={name:"SpanTreeNode",components:{TimelineBar:Eo},props:{node:{type:Object,required:!0},selected:{type:Boolean,default:!1},selectedSpanId:{type:String,default:null},expandedNodes:{type:Set,required:!0},depth:{type:Number,default:0},traceStartTime:{type:Number,default:0},traceEndTime:{type:Number,default:0}},computed:{hasChildren(){return this.node.children&&this.node.children.length>0},isRootNode(){return this.depth===0},isExpanded(){return this.isRootNode?!0:this.expandedNodes.has(this.node.span_id)},shouldShowChildren(){return this.isRootNode?!0:this.isExpanded},duration(){return Do(this.node.duration_ns)},typeColor(){return Io(this.node.type)},typeCustomColor(){return Oo(this.node.type)},statusDescription(){return No(this.node)},barStyle(){return Ro(this.node,this.traceStartTime,this.traceEndTime)},error(){return this.node.status==="ERROR"},hasEvents(){return this.node.has_events===!0},isChild(){return this.depth>0}},methods:{handleClick(){this.$emit("node-click",this.node)},handleToggleExpand(){this.isRootNode||this.$emit("toggle-expand",this.node)}}};var jf=function(){var n=this,a=n._self._c;return a("div",[a("div",{staticClass:"timeline-node",class:{selected:n.selected,error:n.error,"child-node":n.isChild},on:{click:n.handleClick}},[a("div",{staticClass:"node-row"},[a("div",{staticClass:"node-info"},[n.hasChildren&&!n.isRootNode?a("i",{staticClass:"expand-icon",class:n.isExpanded?"el-icon-arrow-down":"el-icon-arrow-right",on:{click:function(o){return o.stopPropagation(),n.handleToggleExpand.apply(null,arguments)}}}):n._e(),a("el-tag",{staticClass:"type-tag",attrs:{type:n.typeColor,color:n.typeCustomColor,size:"mini"}},[n._v(" "+n._s(n.node.type)+" ")]),a("el-tooltip",{attrs:{content:n.node.name,placement:"top","open-delay":300}},[a("span",{staticClass:"node-name"},[n._v(n._s(n.node.name))])])],1),a("div",{staticClass:"node-duration"},[n._v(" "+n._s(n.duration)+" ")])]),a("TimelineBar",{attrs:{"bar-style":n.barStyle,"status-description":n.statusDescription,selected:n.selected,error:n.error,"has-events":n.hasEvents}})],1),n.shouldShowChildren&&n.hasChildren?a("div",{staticClass:"children-nodes"},n._l(n.node.children,function(o){return a("SpanTreeNode",{key:o.span_id,attrs:{node:o,selected:o.span_id===n.selectedSpanId,"selected-span-id":n.selectedSpanId,"expanded-nodes":n.expandedNodes,depth:n.depth+1,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"node-click":function(c){return n.$emit("node-click",c)},"toggle-expand":function(c){return n.$emit("toggle-expand",c)}}})}),1):n._e()])},qf=[],Uf=In(Wf,jf,qf,!1,null,"f1d06a11");const Gf=Uf.exports,Kf={name:"SpanListNode",components:{TimelineBar:Eo},props:{node:{type:Object,required:!0},selected:{type:Boolean,default:!1},traceStartTime:{type:Number,default:0},traceEndTime:{type:Number,default:0}},computed:{duration(){return Do(this.node.duration_ns)},typeColor(){return Io(this.node.type)},typeCustomColor(){return Oo(this.node.type)},statusDescription(){return No(this.node)},barStyle(){return Ro(this.node,this.traceStartTime,this.traceEndTime)},error(){return this.node.status==="ERROR"},hasEvents(){return this.node.has_events===!0}},methods:{handleClick(){this.$emit("node-click",this.node)}}};var Xf=function(){var n=this,a=n._self._c;return a("div",{staticClass:"timeline-node",class:{selected:n.selected,error:n.error},on:{click:n.handleClick}},[a("div",{staticClass:"node-row"},[a("div",{staticClass:"node-info"},[a("el-tag",{staticClass:"type-tag",attrs:{type:n.typeColor,color:n.typeCustomColor,size:"mini"}},[n._v(" "+n._s(n.node.type)+" ")]),a("el-tooltip",{attrs:{content:n.node.name,placement:"top","open-delay":300}},[a("span",{staticClass:"node-name"},[n._v(n._s(n.node.name))])])],1),a("div",{staticClass:"node-duration"},[n._v(" "+n._s(n.duration)+" ")])]),a("TimelineBar",{attrs:{"bar-style":n.barStyle,"status-description":n.statusDescription,selected:n.selected,error:n.error,"has-events":n.hasEvents}})],1)},Yf=[],Vf=In(Kf,Xf,Yf,!1,null,"87a70c40");const Jf=Vf.exports,Qf={name:"TraceSpanTree",components:{TimelineHeader:Ff,SpanTreeNode:Gf,SpanListNode:Jf},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:[],allExpanded:!1,viewMode:"list"}},computed:{flatListData(){const l=[],n=a=>{a.forEach(o=>{l.push(o),o.children&&o.children.length>0&&n(o.children)})};return n(this.treeData),l},timeRange(){const l=this.$t?this.$t("trace.to"):"-";return Hf(this.traceStartTime,this.traceEndTime,l)}},watch:{spans:{immediate:!0,handler(){this.buildTree()}}},methods:{buildTree(){if(!this.spans||this.spans.length===0){this.treeData=[];return}const l=new Map,n=[];this.spans.forEach(a=>{l.set(a.span_id,{...a,children:[]})}),this.spans.forEach(a=>{const o=l.get(a.span_id);if(a.parent_span_id){const c=l.get(a.parent_span_id);c?c.children.push(o):n.push(o)}else n.push(o)}),n.forEach(a=>{this.sortChildren(a)}),this.treeData=n,this.expandAllNodes()},expandAllNodes(){const l=new Set,n=a=>{a.forEach(o=>{o.children&&o.children.length>0&&o.children.forEach(c=>{this.hasChildren(c)&&l.add(c.span_id),c.children&&c.children.length>0&&n([c])})})};n(this.treeData),this.expandedNodes=l,this.allExpanded=!0,this.$forceUpdate()},collapseAllNodes(){const l=new Set;this.expandedNodes=l,this.allExpanded=!1,this.$forceUpdate()},toggleAllExpand(){this.allExpanded?this.collapseAllNodes():this.expandAllNodes()},toggleViewMode(){this.viewMode=this.viewMode==="list"?"tree":"list"},sortChildren(l){l.children&&l.children.length>0&&(l.children.sort((n,a)=>n.start_time_unix_nano-a.start_time_unix_nano),l.children.forEach(n=>this.sortChildren(n)))},handleNodeClick(l){this.$emit("span-select",l)},hasChildren(l){return l.children&&l.children.length>0},toggleExpand(l){if(this.treeData.some(o=>o.span_id===l.span_id))return;const a=new Set(this.expandedNodes);a.has(l.span_id)?a.delete(l.span_id):a.add(l.span_id),this.expandedNodes=a,this.updateAllExpandedState(),this.$forceUpdate()},updateAllExpandedState(){const l=(a,o=!1)=>{for(const c of a)if(this.hasChildren(c)&&(!o&&!this.expandedNodes.has(c.span_id)||c.children&&c.children.length>0&&!l(c.children,!1)))return!1;return!0};if(!this.treeData.some(a=>a.children&&a.children.some(o=>this.hasChildren(o)))){this.allExpanded=!1;return}this.allExpanded=l(this.treeData,!0)}}};var Zf=function(){var n=this,a=n._self._c;return a("div",{staticClass:"span-tree-container"},[n.treeData.length===0?a("div",{staticClass:"empty-state"},[a("el-empty",{attrs:{description:"暂无 Span 数据"}})],1):a("div",{staticClass:"timeline-wrapper"},[a("TimelineHeader",{attrs:{"time-range":n.timeRange,"all-expanded":n.allExpanded,"view-mode":n.viewMode},on:{"toggle-expand":n.toggleAllExpand,"toggle-view":n.toggleViewMode}}),a("div",{ref:"timelineContent",staticClass:"timeline-content"},[n.viewMode==="tree"?n._l(n.treeData,function(o){return a("SpanTreeNode",{key:o.span_id,attrs:{node:o,selected:n.selectedSpanId===o.span_id,"selected-span-id":n.selectedSpanId,"expanded-nodes":n.expandedNodes,depth:0,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"node-click":n.handleNodeClick,"toggle-expand":n.toggleExpand}})}):n._l(n.flatListData,function(o){return a("SpanListNode",{key:o.span_id,attrs:{node:o,selected:n.selectedSpanId===o.span_id,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"node-click":n.handleNodeClick}})})],2)],1)])},eh=[],th=In(Qf,Zf,eh,!1,null,"1eff9f3c");const Ua=th.exports;/*!
70
70
  * Viewer.js v1.11.7
71
71
  * https://fengyuanchen.github.io/viewerjs
72
72
  *
@@ -74,18 +74,20 @@ Please report this to https://github.com/markedjs/marked.`,n){const f="<p>An err
74
74
  * Released under the MIT license
75
75
  *
76
76
  * Date: 2024-11-24T04:32:19.116Z
77
- */function nh(l,n){if(!(l instanceof n))throw new TypeError("Cannot call a class as a function")}function Ro(l,n){for(var a=0;a<n.length;a++){var o=n[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(l,Po(o.key),o)}}function rh(l,n,a){return n&&Ro(l.prototype,n),a&&Ro(l,a),Object.defineProperty(l,"prototype",{writable:!1}),l}function ih(l,n,a){return(n=Po(n))in l?Object.defineProperty(l,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):l[n]=a,l}function Fo(l,n){var a=Object.keys(l);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(l);n&&(o=o.filter(function(f){return Object.getOwnPropertyDescriptor(l,f).enumerable})),a.push.apply(a,o)}return a}function Ga(l){for(var n=1;n<arguments.length;n++){var a=arguments[n]!=null?arguments[n]:{};n%2?Fo(Object(a),!0).forEach(function(o){ih(l,o,a[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(a)):Fo(Object(a)).forEach(function(o){Object.defineProperty(l,o,Object.getOwnPropertyDescriptor(a,o))})}return l}function ah(l,n){if(typeof l!="object"||!l)return l;var a=l[Symbol.toPrimitive];if(a!==void 0){var o=a.call(l,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(l)}function Po(l){var n=ah(l,"string");return typeof n=="symbol"?n:n+""}function Ka(l){"@babel/helpers - typeof";return Ka=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Ka(l)}var zo={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},sh='<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>',Ui=typeof window<"u"&&typeof window.document<"u",wn=Ui?window:{},hr=Ui&&wn.document.documentElement?"ontouchstart"in wn.document.documentElement:!1,Xa=Ui?"PointerEvent"in wn:!1,Ne="viewer",Gi="move",$o="switch",ei="zoom",Ki="".concat(Ne,"-active"),oh="".concat(Ne,"-close"),Xi="".concat(Ne,"-fade"),Ya="".concat(Ne,"-fixed"),lh="".concat(Ne,"-fullscreen"),Bo="".concat(Ne,"-fullscreen-exit"),Vn="".concat(Ne,"-hide"),uh="".concat(Ne,"-hide-md-down"),fh="".concat(Ne,"-hide-sm-down"),ch="".concat(Ne,"-hide-xs-down"),Jt="".concat(Ne,"-in"),ti="".concat(Ne,"-invisible"),dr="".concat(Ne,"-loading"),hh="".concat(Ne,"-move"),Ho="".concat(Ne,"-open"),pr="".concat(Ne,"-show"),at="".concat(Ne,"-transition"),gr="click",Va="dblclick",Wo="dragstart",jo="focusin",qo="keydown",Qt="load",Jn="error",dh=hr?"touchend touchcancel":"mouseup",ph=hr?"touchmove":"mousemove",gh=hr?"touchstart":"mousedown",Uo=Xa?"pointerdown":gh,Go=Xa?"pointermove":ph,Ko=Xa?"pointerup pointercancel":dh,Xo="resize",nn="transitionend",Yo="wheel",Vo="ready",Jo="show",Qo="shown",Zo="hide",el="hidden",tl="view",ni="viewed",nl="move",rl="moved",il="rotate",al="rotated",sl="scale",ol="scaled",ll="zoom",ul="zoomed",fl="play",cl="stop",Yi="".concat(Ne,"Action"),Ja=/\s\s*/,Vi=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function ri(l){return typeof l=="string"}var mh=Number.isNaN||wn.isNaN;function Ze(l){return typeof l=="number"&&!mh(l)}function mr(l){return typeof l>"u"}function vr(l){return Ka(l)==="object"&&l!==null}var vh=Object.prototype.hasOwnProperty;function yr(l){if(!vr(l))return!1;try{var n=l.constructor,a=n.prototype;return n&&a&&vh.call(a,"isPrototypeOf")}catch{return!1}}function Ue(l){return typeof l=="function"}function Xe(l,n){if(l&&Ue(n))if(Array.isArray(l)||Ze(l.length)){var a=l.length,o;for(o=0;o<a&&n.call(l,l[o],o,l)!==!1;o+=1);}else vr(l)&&Object.keys(l).forEach(function(f){n.call(l,l[f],f,l)});return l}var qt=Object.assign||function(n){for(var a=arguments.length,o=new Array(a>1?a-1:0),f=1;f<a;f++)o[f-1]=arguments[f];return vr(n)&&o.length>0&&o.forEach(function(d){vr(d)&&Object.keys(d).forEach(function(p){n[p]=d[p]})}),n},yh=/^(?:width|height|left|top|marginLeft|marginTop)$/;function rn(l,n){var a=l.style;Xe(n,function(o,f){yh.test(f)&&Ze(o)&&(o+="px"),a[f]=o})}function bh(l){return ri(l)?l.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):l}function br(l,n){return!l||!n?!1:l.classList?l.classList.contains(n):l.className.indexOf(n)>-1}function Ce(l,n){if(!(!l||!n)){if(Ze(l.length)){Xe(l,function(o){Ce(o,n)});return}if(l.classList){l.classList.add(n);return}var a=l.className.trim();a?a.indexOf(n)<0&&(l.className="".concat(a," ").concat(n)):l.className=n}}function He(l,n){if(!(!l||!n)){if(Ze(l.length)){Xe(l,function(a){He(a,n)});return}if(l.classList){l.classList.remove(n);return}l.className.indexOf(n)>=0&&(l.className=l.className.replace(n,""))}}function ii(l,n,a){if(n){if(Ze(l.length)){Xe(l,function(o){ii(o,n,a)});return}a?Ce(l,n):He(l,n)}}var xh=/([a-z\d])([A-Z])/g;function Qa(l){return l.replace(xh,"$1-$2").toLowerCase()}function xr(l,n){return vr(l[n])?l[n]:l.dataset?l.dataset[n]:l.getAttribute("data-".concat(Qa(n)))}function Za(l,n,a){vr(a)?l[n]=a:l.dataset?l.dataset[n]=a:l.setAttribute("data-".concat(Qa(n)),a)}var hl=function(){var l=!1;if(Ui){var n=!1,a=function(){},o=Object.defineProperty({},"once",{get:function(){return l=!0,n},set:function(d){n=d}});wn.addEventListener("test",a,o),wn.removeEventListener("test",a,o)}return l}();function Ge(l,n,a){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},f=a;n.trim().split(Ja).forEach(function(d){if(!hl){var p=l.listeners;p&&p[d]&&p[d][a]&&(f=p[d][a],delete p[d][a],Object.keys(p[d]).length===0&&delete p[d],Object.keys(p).length===0&&delete l.listeners)}l.removeEventListener(d,f,o)})}function Ee(l,n,a){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},f=a;n.trim().split(Ja).forEach(function(d){if(o.once&&!hl){var p=l.listeners,y=p===void 0?{}:p;f=function(){delete y[d][a],l.removeEventListener(d,f,o);for(var x=arguments.length,S=new Array(x),A=0;A<x;A++)S[A]=arguments[A];a.apply(l,S)},y[d]||(y[d]={}),y[d][a]&&l.removeEventListener(d,y[d][a],o),y[d][a]=f,l.listeners=y}l.addEventListener(d,f,o)})}function ot(l,n,a,o){var f;return Ue(Event)&&Ue(CustomEvent)?f=new CustomEvent(n,Ga({bubbles:!0,cancelable:!0,detail:a},o)):(f=document.createEvent("CustomEvent"),f.initCustomEvent(n,!0,!0,a)),l.dispatchEvent(f)}function wh(l){var n=l.getBoundingClientRect();return{left:n.left+(window.pageXOffset-document.documentElement.clientLeft),top:n.top+(window.pageYOffset-document.documentElement.clientTop)}}function Ji(l){var n=l.rotate,a=l.scaleX,o=l.scaleY,f=l.translateX,d=l.translateY,p=[];Ze(f)&&f!==0&&p.push("translateX(".concat(f,"px)")),Ze(d)&&d!==0&&p.push("translateY(".concat(d,"px)")),Ze(n)&&n!==0&&p.push("rotate(".concat(n,"deg)")),Ze(a)&&a!==1&&p.push("scaleX(".concat(a,")")),Ze(o)&&o!==1&&p.push("scaleY(".concat(o,")"));var y=p.length?p.join(" "):"none";return{WebkitTransform:y,msTransform:y,transform:y}}function kh(l){return ri(l)?decodeURIComponent(l.replace(/^.*\//,"").replace(/[?&#].*$/,"")):""}var es=wn.navigator&&/Version\/\d+(\.\d+)+?\s+Safari/i.test(wn.navigator.userAgent);function dl(l,n,a){var o=document.createElement("img");if(l.naturalWidth&&!es)return a(l.naturalWidth,l.naturalHeight),o;var f=document.body||document.documentElement;return o.onload=function(){a(o.width,o.height),es||f.removeChild(o)},Xe(n.inheritedAttributes,function(d){var p=l.getAttribute(d);p!==null&&o.setAttribute(d,p)}),o.src=l.src,es||(o.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;",f.appendChild(o)),o}function Qi(l){switch(l){case 2:return ch;case 3:return fh;case 4:return uh;default:return""}}function Sh(l){var n=Ga({},l),a=[];return Xe(l,function(o,f){delete n[f],Xe(n,function(d){var p=Math.abs(o.startX-d.startX),y=Math.abs(o.startY-d.startY),m=Math.abs(o.endX-d.endX),x=Math.abs(o.endY-d.endY),S=Math.sqrt(p*p+y*y),A=Math.sqrt(m*m+x*x),E=(A-S)/S;a.push(E)})}),a.sort(function(o,f){return Math.abs(o)<Math.abs(f)}),a[0]}function Zi(l,n){var a=l.pageX,o=l.pageY,f={endX:a,endY:o};return n?f:Ga({timeStamp:Date.now(),startX:a,startY:o},f)}function Ch(l){var n=0,a=0,o=0;return Xe(l,function(f){var d=f.startX,p=f.startY;n+=d,a+=p,o+=1}),n/=o,a/=o,{pageX:n,pageY:a}}var Th={render:function(){this.initContainer(),this.initViewer(),this.initList(),this.renderViewer()},initBody:function(){var n=this.element.ownerDocument,a=n.body||n.documentElement;this.body=a,this.scrollbarWidth=window.innerWidth-n.documentElement.clientWidth,this.initialBodyPaddingRight=a.style.paddingRight,this.initialBodyComputedPaddingRight=window.getComputedStyle(a).paddingRight},initContainer:function(){this.containerData={width:window.innerWidth,height:window.innerHeight}},initViewer:function(){var n=this.options,a=this.parent,o;n.inline&&(o={width:Math.max(a.offsetWidth,n.minWidth),height:Math.max(a.offsetHeight,n.minHeight)},this.parentData=o),(this.fulled||!o)&&(o=this.containerData),this.viewerData=qt({},o)},renderViewer:function(){this.options.inline&&!this.fulled&&rn(this.viewer,this.viewerData)},initList:function(){var n=this,a=this.element,o=this.options,f=this.list,d=[];f.innerHTML="",Xe(this.images,function(p,y){var m=p.src,x=p.alt||kh(m),S=n.getImageURL(p);if(m||S){var A=document.createElement("li"),E=document.createElement("img");Xe(o.inheritedAttributes,function(H){var B=p.getAttribute(H);B!==null&&E.setAttribute(H,B)}),o.navbar&&(E.src=m||S),E.alt=x,E.setAttribute("data-original-url",S||m),A.setAttribute("data-index",y),A.setAttribute("data-viewer-action","view"),A.setAttribute("role","button"),o.keyboard&&A.setAttribute("tabindex",0),A.appendChild(E),f.appendChild(A),d.push(A)}}),this.items=d,Xe(d,function(p){var y=p.firstElementChild,m,x;Za(y,"filled",!0),o.loading&&Ce(p,dr),Ee(y,Qt,m=function(A){Ge(y,Jn,x),o.loading&&He(p,dr),n.loadImage(A)},{once:!0}),Ee(y,Jn,x=function(){Ge(y,Qt,m),o.loading&&He(p,dr)},{once:!0})}),o.transition&&Ee(a,ni,function(){Ce(f,at)},{once:!0})},renderList:function(){var n=this.index,a=this.items[n];if(a){var o=a.nextElementSibling,f=parseInt(window.getComputedStyle(o||a).marginLeft,10),d=a.offsetWidth,p=d+f;rn(this.list,qt({width:p*this.length-f},Ji({translateX:(this.viewerData.width-d)/2-p*n})))}},resetList:function(){var n=this.list;n.innerHTML="",He(n,at),rn(n,Ji({translateX:0}))},initImage:function(n){var a=this,o=this.options,f=this.image,d=this.viewerData,p=this.footer.offsetHeight,y=d.width,m=Math.max(d.height-p,p),x=this.imageData||{},S;this.imageInitializing={abort:function(){S.onload=null}},S=dl(f,o,function(A,E){var H=A/E,B=Math.max(0,Math.min(1,o.initialCoverage)),U=y,F=m;a.imageInitializing=!1,m*H>y?F=y/H:U=m*H,B=Ze(B)?B:.9,U=Math.min(U*B,A),F=Math.min(F*B,E);var N=(y-U)/2,O=(m-F)/2,$={left:N,top:O,x:N,y:O,width:U,height:F,oldRatio:1,ratio:U/A,aspectRatio:H,naturalWidth:A,naturalHeight:E},X=qt({},$);o.rotatable&&($.rotate=x.rotate||0,X.rotate=0),o.scalable&&($.scaleX=x.scaleX||1,$.scaleY=x.scaleY||1,X.scaleX=1,X.scaleY=1),a.imageData=$,a.initialImageData=X,n&&n()})},renderImage:function(n){var a=this,o=this.image,f=this.imageData;if(rn(o,qt({width:f.width,height:f.height,marginLeft:f.x,marginTop:f.y},Ji(f))),n)if((this.viewing||this.moving||this.rotating||this.scaling||this.zooming)&&this.options.transition&&br(o,at)){var d=function(){a.imageRendering=!1,n()};this.imageRendering={abort:function(){Ge(o,nn,d)}},Ee(o,nn,d,{once:!0})}else n()},resetImage:function(){var n=this.image;n&&(this.viewing&&this.viewing.abort(),n.parentNode.removeChild(n),this.image=null,this.title.innerHTML="")}},_h={bind:function(){var n=this.options,a=this.viewer,o=this.canvas,f=this.element.ownerDocument;Ee(a,gr,this.onClick=this.click.bind(this)),Ee(a,Wo,this.onDragStart=this.dragstart.bind(this)),Ee(o,Uo,this.onPointerDown=this.pointerdown.bind(this)),Ee(f,Go,this.onPointerMove=this.pointermove.bind(this)),Ee(f,Ko,this.onPointerUp=this.pointerup.bind(this)),Ee(f,qo,this.onKeyDown=this.keydown.bind(this)),Ee(window,Xo,this.onResize=this.resize.bind(this)),n.zoomable&&n.zoomOnWheel&&Ee(a,Yo,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),n.toggleOnDblclick&&Ee(o,Va,this.onDblclick=this.dblclick.bind(this))},unbind:function(){var n=this.options,a=this.viewer,o=this.canvas,f=this.element.ownerDocument;Ge(a,gr,this.onClick),Ge(a,Wo,this.onDragStart),Ge(o,Uo,this.onPointerDown),Ge(f,Go,this.onPointerMove),Ge(f,Ko,this.onPointerUp),Ge(f,qo,this.onKeyDown),Ge(window,Xo,this.onResize),n.zoomable&&n.zoomOnWheel&&Ge(a,Yo,this.onWheel,{passive:!1,capture:!0}),n.toggleOnDblclick&&Ge(o,Va,this.onDblclick)}},Lh={click:function(n){var a=this.options,o=this.imageData,f=n.target,d=xr(f,Yi);switch(!d&&f.localName==="img"&&f.parentElement.localName==="li"&&(f=f.parentElement,d=xr(f,Yi)),hr&&n.isTrusted&&f===this.canvas&&clearTimeout(this.clickCanvasTimeout),d){case"mix":this.played?this.stop():a.inline?this.fulled?this.exit():this.full():this.hide();break;case"hide":this.pointerMoved||this.hide();break;case"view":this.view(xr(f,"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(a.loop);break;case"play":this.play(a.fullscreen);break;case"next":this.next(a.loop);break;case"rotate-left":this.rotate(-90);break;case"rotate-right":this.rotate(90);break;case"flip-horizontal":this.scaleX(-o.scaleX||-1);break;case"flip-vertical":this.scaleY(-o.scaleY||-1);break;default:this.played&&this.stop()}},dblclick:function(n){n.preventDefault(),this.viewed&&n.target===this.image&&(hr&&n.isTrusted&&clearTimeout(this.doubleClickImageTimeout),this.toggle(n.isTrusted?n:n.detail&&n.detail.originalEvent))},load:function(){var n=this;this.timeout&&(clearTimeout(this.timeout),this.timeout=!1);var a=this.element,o=this.options,f=this.image,d=this.index,p=this.viewerData;He(f,ti),o.loading&&He(this.canvas,dr),f.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(){ii(f,hh,o.movable),ii(f,at,o.transition),n.renderImage(function(){n.viewed=!0,n.viewing=!1,Ue(o.viewed)&&Ee(a,ni,o.viewed,{once:!0}),ot(a,ni,{originalImage:n.images[d],index:d,image:f},{cancelable:!1})})})},loadImage:function(n){var a=n.target,o=a.parentNode,f=o.offsetWidth||30,d=o.offsetHeight||50,p=!!xr(a,"filled");dl(a,this.options,function(y,m){var x=y/m,S=f,A=d;d*x>f?p?S=d*x:A=f/x:p?A=f/x:S=d*x,rn(a,qt({width:S,height:A},Ji({translateX:(f-S)/2,translateY:(d-A)/2})))})},keydown:function(n){var a=this.options;if(a.keyboard){var o=n.keyCode||n.which||n.charCode;switch(o){case 13:this.viewer.contains(n.target)&&this.click(n);break}if(this.fulled)switch(o){case 27:this.played?this.stop():a.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(a.loop);break;case 38:n.preventDefault(),this.zoom(a.zoomRatio,!0);break;case 39:this.played&&this.playing?this.playing.next():this.next(a.loop);break;case 40:n.preventDefault(),this.zoom(-a.zoomRatio,!0);break;case 48:case 49:n.ctrlKey&&(n.preventDefault(),this.toggle());break}}},dragstart:function(n){n.target.localName==="img"&&n.preventDefault()},pointerdown:function(n){var a=this.options,o=this.pointers,f=n.buttons,d=n.button;if(this.pointerMoved=!1,!(!this.viewed||this.showing||this.viewing||this.hiding||(n.type==="mousedown"||n.type==="pointerdown"&&n.pointerType==="mouse")&&(Ze(f)&&f!==1||Ze(d)&&d!==0||n.ctrlKey))){n.preventDefault(),n.changedTouches?Xe(n.changedTouches,function(y){o[y.identifier]=Zi(y)}):o[n.pointerId||0]=Zi(n);var p=a.movable?Gi:!1;a.zoomOnTouch&&a.zoomable&&Object.keys(o).length>1?p=ei:a.slideOnTouch&&(n.pointerType==="touch"||n.type==="touchstart")&&this.isSwitchable()&&(p=$o),a.transition&&(p===Gi||p===ei)&&He(this.image,at),this.action=p}},pointermove:function(n){var a=this.pointers,o=this.action;!this.viewed||!o||(n.preventDefault(),n.changedTouches?Xe(n.changedTouches,function(f){qt(a[f.identifier]||{},Zi(f,!0))}):qt(a[n.pointerId||0]||{},Zi(n,!0)),this.change(n))},pointerup:function(n){var a=this,o=this.options,f=this.action,d=this.pointers,p;n.changedTouches?Xe(n.changedTouches,function(y){p=d[y.identifier],delete d[y.identifier]}):(p=d[n.pointerId||0],delete d[n.pointerId||0]),f&&(n.preventDefault(),o.transition&&(f===Gi||f===ei)&&Ce(this.image,at),this.action=!1,hr&&f!==ei&&p&&Date.now()-p.timeStamp<500&&(clearTimeout(this.clickCanvasTimeout),clearTimeout(this.doubleClickImageTimeout),o.toggleOnDblclick&&this.viewed&&n.target===this.image?this.imageClicked?(this.imageClicked=!1,this.doubleClickImageTimeout=setTimeout(function(){ot(a.image,Va,{originalEvent:n})},50)):(this.imageClicked=!0,this.doubleClickImageTimeout=setTimeout(function(){a.imageClicked=!1},500)):(this.imageClicked=!1,o.backdrop&&o.backdrop!=="static"&&n.target===this.canvas&&(this.clickCanvasTimeout=setTimeout(function(){ot(a.canvas,gr,{originalEvent:n})},50)))))},resize:function(){var n=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(){n.renderImage()}),this.played)){if(this.options.fullscreen&&this.fulled&&!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)){this.stop();return}Xe(this.player.getElementsByTagName("img"),function(a){Ee(a,Qt,n.loadImage.bind(n),{once:!0}),ot(a,Qt)})}},wheel:function(n){var a=this;if(this.viewed&&(n.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){a.wheeling=!1},50);var o=Number(this.options.zoomRatio)||.1,f=1;n.deltaY?f=n.deltaY>0?1:-1:n.wheelDelta?f=-n.wheelDelta/120:n.detail&&(f=n.detail>0?1:-1),this.zoom(-f*o,!0,null,n)}}},Eh={show:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.element,o=this.options;if(o.inline||this.showing||this.isShown||this.showing)return this;if(!this.ready)return this.build(),this.ready&&this.show(n),this;if(Ue(o.show)&&Ee(a,Jo,o.show,{once:!0}),ot(a,Jo)===!1||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var f=this.viewer;if(He(f,Vn),f.setAttribute("role","dialog"),f.setAttribute("aria-labelledby",this.title.id),f.setAttribute("aria-modal",!0),f.removeAttribute("aria-hidden"),o.transition&&!n){var d=this.shown.bind(this);this.transitioning={abort:function(){Ge(f,nn,d),He(f,Jt)}},Ce(f,at),f.initialOffsetWidth=f.offsetWidth,Ee(f,nn,d,{once:!0}),Ce(f,Jt)}else Ce(f,Jt),this.shown();return this},hide:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,o=this.element,f=this.options;if(f.inline||this.hiding||!(this.isShown||this.showing))return this;if(Ue(f.hide)&&Ee(o,Zo,f.hide,{once:!0}),ot(o,Zo)===!1)return this;this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort();var d=this.viewer,p=this.image,y=function(){He(d,Jt),n.hidden()};if(f.transition&&!a){var m=function(A){A&&A.target===d&&(Ge(d,nn,m),n.hidden())},x=function(){br(d,at)?(Ee(d,nn,m),He(d,Jt)):y()};this.transitioning={abort:function(){n.viewed&&br(p,at)?Ge(p,nn,x):br(d,at)&&Ge(d,nn,m)}},this.viewed&&br(p,at)?(Ee(p,nn,x,{once:!0}),this.zoomTo(0,!1,null,null,!0)):x()}else y();return this},view:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.initialViewIndex;if(a=Number(a)||0,this.hiding||this.played||a<0||a>=this.length||this.viewed&&a===this.index)return this;if(!this.isShown)return this.index=a,this.show();this.viewing&&this.viewing.abort();var o=this.element,f=this.options,d=this.title,p=this.canvas,y=this.items[a],m=y.querySelector("img"),x=xr(m,"originalUrl"),S=m.getAttribute("alt"),A=document.createElement("img");if(Xe(f.inheritedAttributes,function(F){var N=m.getAttribute(F);N!==null&&A.setAttribute(F,N)}),A.src=x,A.alt=S,Ue(f.view)&&Ee(o,tl,f.view,{once:!0}),ot(o,tl,{originalImage:this.images[a],index:a,image:A})===!1||!this.isShown||this.hiding||this.played)return this;var E=this.items[this.index];E&&(He(E,Ki),E.removeAttribute("aria-selected")),Ce(y,Ki),y.setAttribute("aria-selected",!0),f.focus&&y.focus(),this.image=A,this.viewed=!1,this.index=a,this.imageData={},Ce(A,ti),f.loading&&Ce(p,dr),p.innerHTML="",p.appendChild(A),this.renderList(),d.innerHTML="";var H=function(){var N=n.imageData,O=Array.isArray(f.title)?f.title[1]:f.title;d.innerHTML=bh(Ue(O)?O.call(n,A,N):"".concat(S," (").concat(N.naturalWidth," × ").concat(N.naturalHeight,")"))},B,U;return Ee(o,ni,H,{once:!0}),this.viewing={abort:function(){Ge(o,ni,H),A.complete?n.imageRendering?n.imageRendering.abort():n.imageInitializing&&n.imageInitializing.abort():(A.src="",Ge(A,Qt,B),n.timeout&&clearTimeout(n.timeout))}},A.complete?this.load():(Ee(A,Qt,B=function(){Ge(A,Jn,U),n.load()},{once:!0}),Ee(A,Jn,U=function(){Ge(A,Qt,B),n.timeout&&(clearTimeout(n.timeout),n.timeout=!1),He(A,ti),f.loading&&He(n.canvas,dr)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){He(A,ti),n.timeout=!1},1e3)),this},prev:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.index-1;return a<0&&(a=n?this.length-1:0),this.view(a),this},next:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.length-1,o=this.index+1;return o>a&&(o=n?0:a),this.view(o),this},move:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,o=this.imageData;return this.moveTo(mr(n)?n:o.x+Number(n),mr(a)?a:o.y+Number(a)),this},moveTo:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,d=this.element,p=this.options,y=this.imageData;if(n=Number(n),o=Number(o),this.viewed&&!this.played&&p.movable){var m=y.x,x=y.y,S=!1;if(Ze(n)?S=!0:n=m,Ze(o)?S=!0:o=x,S){if(Ue(p.move)&&Ee(d,nl,p.move,{once:!0}),ot(d,nl,{x:n,y:o,oldX:m,oldY:x,originalEvent:f})===!1)return this;y.x=n,y.y=o,y.left=n,y.top=o,this.moving=!0,this.renderImage(function(){a.moving=!1,Ue(p.moved)&&Ee(d,rl,p.moved,{once:!0}),ot(d,rl,{x:n,y:o,oldX:m,oldY:x,originalEvent:f},{cancelable:!1})})}}return this},rotate:function(n){return this.rotateTo((this.imageData.rotate||0)+Number(n)),this},rotateTo:function(n){var a=this,o=this.element,f=this.options,d=this.imageData;if(n=Number(n),Ze(n)&&this.viewed&&!this.played&&f.rotatable){var p=d.rotate;if(Ue(f.rotate)&&Ee(o,il,f.rotate,{once:!0}),ot(o,il,{degree:n,oldDegree:p})===!1)return this;d.rotate=n,this.rotating=!0,this.renderImage(function(){a.rotating=!1,Ue(f.rotated)&&Ee(o,al,f.rotated,{once:!0}),ot(o,al,{degree:n,oldDegree:p},{cancelable:!1})})}return this},scaleX:function(n){return this.scale(n,this.imageData.scaleY),this},scaleY:function(n){return this.scale(this.imageData.scaleX,n),this},scale:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,f=this.element,d=this.options,p=this.imageData;if(n=Number(n),o=Number(o),this.viewed&&!this.played&&d.scalable){var y=p.scaleX,m=p.scaleY,x=!1;if(Ze(n)?x=!0:n=y,Ze(o)?x=!0:o=m,x){if(Ue(d.scale)&&Ee(f,sl,d.scale,{once:!0}),ot(f,sl,{scaleX:n,scaleY:o,oldScaleX:y,oldScaleY:m})===!1)return this;p.scaleX=n,p.scaleY=o,this.scaling=!0,this.renderImage(function(){a.scaling=!1,Ue(d.scaled)&&Ee(f,ol,d.scaled,{once:!0}),ot(f,ol,{scaleX:n,scaleY:o,oldScaleX:y,oldScaleY:m},{cancelable:!1})})}}return this},zoom:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,d=this.imageData;return n=Number(n),n<0?n=1/(1-n):n=1+n,this.zoomTo(d.width*n/d.naturalWidth,a,o,f),this},zoomTo:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,p=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,y=this.element,m=this.options,x=this.pointers,S=this.imageData,A=S.x,E=S.y,H=S.width,B=S.height,U=S.naturalWidth,F=S.naturalHeight;if(n=Math.max(0,n),Ze(n)&&this.viewed&&!this.played&&(p||m.zoomable)){if(!p){var N=Math.max(.01,m.minZoomRatio),O=Math.min(100,m.maxZoomRatio);n=Math.min(Math.max(n,N),O)}if(d)switch(d.type){case"wheel":m.zoomRatio>=.055&&n>.95&&n<1.05&&(n=1);break;case"pointermove":case"touchmove":case"mousemove":n>.99&&n<1.01&&(n=1);break}var $=U*n,X=F*n,ne=$-H,ue=X-B,se=S.ratio;if(Ue(m.zoom)&&Ee(y,ll,m.zoom,{once:!0}),ot(y,ll,{ratio:n,oldRatio:se,originalEvent:d})===!1)return this;if(this.zooming=!0,d){var he=wh(this.viewer),Oe=x&&Object.keys(x).length>0?Ch(x):{pageX:d.pageX,pageY:d.pageY};S.x-=ne*((Oe.pageX-he.left-A)/H),S.y-=ue*((Oe.pageY-he.top-E)/B)}else yr(f)&&Ze(f.x)&&Ze(f.y)?(S.x-=ne*((f.x-A)/H),S.y-=ue*((f.y-E)/B)):(S.x-=ne/2,S.y-=ue/2);S.left=S.x,S.top=S.y,S.width=$,S.height=X,S.oldRatio=se,S.ratio=n,this.renderImage(function(){a.zooming=!1,Ue(m.zoomed)&&Ee(y,ul,m.zoomed,{once:!0}),ot(y,ul,{ratio:n,oldRatio:se,originalEvent:d},{cancelable:!1})}),o&&this.tooltip()}return this},play:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!this.isShown||this.played)return this;var o=this.element,f=this.options;if(Ue(f.play)&&Ee(o,fl,f.play,{once:!0}),ot(o,fl)===!1)return this;var d=this.player,p=this.loadImage.bind(this),y=[],m=0,x=0;if(this.played=!0,this.onLoadWhenPlay=p,a&&this.requestFullscreen(a),Ce(d,pr),Xe(this.items,function(E,H){var B=E.querySelector("img"),U=document.createElement("img");U.src=xr(B,"originalUrl"),U.alt=B.getAttribute("alt"),U.referrerPolicy=B.referrerPolicy,m+=1,Ce(U,Xi),ii(U,at,f.transition),br(E,Ki)&&(Ce(U,Jt),x=H),y.push(U),Ee(U,Qt,p,{once:!0}),d.appendChild(U)}),Ze(f.interval)&&f.interval>0){var S=function(){clearTimeout(n.playing.timeout),He(y[x],Jt),x-=1,x=x>=0?x:m-1,Ce(y[x],Jt),n.playing.timeout=setTimeout(S,f.interval)},A=function(){clearTimeout(n.playing.timeout),He(y[x],Jt),x+=1,x=x<m?x:0,Ce(y[x],Jt),n.playing.timeout=setTimeout(A,f.interval)};m>1&&(this.playing={prev:S,next:A,timeout:setTimeout(A,f.interval)})}return this},stop:function(){var n=this;if(!this.played)return this;var a=this.element,o=this.options;if(Ue(o.stop)&&Ee(a,cl,o.stop,{once:!0}),ot(a,cl)===!1)return this;var f=this.player;return clearTimeout(this.playing.timeout),this.playing=!1,this.played=!1,Xe(f.getElementsByTagName("img"),function(d){Ge(d,Qt,n.onLoadWhenPlay)}),He(f,pr),f.innerHTML="",this.exitFullscreen(),this},full:function(){var n=this,a=this.options,o=this.viewer,f=this.image,d=this.list;return!this.isShown||this.played||this.fulled||!a.inline?this:(this.fulled=!0,this.open(),Ce(this.button,Bo),a.transition&&(He(d,at),this.viewed&&He(f,at)),Ce(o,Ya),o.setAttribute("role","dialog"),o.setAttribute("aria-labelledby",this.title.id),o.setAttribute("aria-modal",!0),o.removeAttribute("style"),rn(o,{zIndex:a.zIndex}),a.focus&&this.enforceFocus(),this.initContainer(),this.viewerData=qt({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){n.renderImage(function(){a.transition&&setTimeout(function(){Ce(f,at),Ce(d,at)},0)})}),this)},exit:function(){var n=this,a=this.options,o=this.viewer,f=this.image,d=this.list;return!this.isShown||this.played||!this.fulled||!a.inline?this:(this.fulled=!1,this.close(),He(this.button,Bo),a.transition&&(He(d,at),this.viewed&&He(f,at)),a.focus&&this.clearEnforceFocus(),o.removeAttribute("role"),o.removeAttribute("aria-labelledby"),o.removeAttribute("aria-modal"),He(o,Ya),rn(o,{zIndex:a.zIndexInline}),this.viewerData=qt({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){n.renderImage(function(){a.transition&&setTimeout(function(){Ce(f,at),Ce(d,at)},0)})}),this)},tooltip:function(){var n=this,a=this.options,o=this.tooltipBox,f=this.imageData;return!this.viewed||this.played||!a.tooltip?this:(o.textContent="".concat(Math.round(f.ratio*100),"%"),this.tooltipping?clearTimeout(this.tooltipping):a.transition?(this.fading&&ot(o,nn),Ce(o,pr),Ce(o,Xi),Ce(o,at),o.removeAttribute("aria-hidden"),o.initialOffsetWidth=o.offsetWidth,Ce(o,Jt)):(Ce(o,pr),o.removeAttribute("aria-hidden")),this.tooltipping=setTimeout(function(){a.transition?(Ee(o,nn,function(){He(o,pr),He(o,Xi),He(o,at),o.setAttribute("aria-hidden",!0),n.fading=!1},{once:!0}),He(o,Jt),n.fading=!0):(He(o,pr),o.setAttribute("aria-hidden",!0)),n.tooltipping=!1},1e3),this)},toggle:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.imageData.ratio===1?this.zoomTo(this.imageData.oldRatio,!0,null,n):this.zoomTo(1,!0,null,n),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=qt({},this.initialImageData),this.renderImage()),this},update:function(){var n=this,a=this.element,o=this.options,f=this.isImg;if(f&&!a.parentNode)return this.destroy();var d=[];if(Xe(f?[a]:a.querySelectorAll("img"),function(x){Ue(o.filter)?o.filter.call(n,x)&&d.push(x):n.getImageURL(x)&&d.push(x)}),!d.length)return this;if(this.images=d,this.length=d.length,this.ready){var p=[];if(Xe(this.items,function(x,S){var A=x.querySelector("img"),E=d[S];E&&A?(E.src!==A.src||E.alt!==A.alt)&&p.push(S):p.push(S)}),rn(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 m=this.items[this.index];Ce(m,Ki),m.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 n=this.element,a=this.options;return n[Ne]?(this.destroyed=!0,this.ready?(this.played&&this.stop(),a.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)):a.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),a.inline||Ge(n,gr,this.onStart),n[Ne]=void 0,this):this}},Dh={getImageURL:function(n){var a=this.options.url;return ri(a)?a=n.getAttribute(a):Ue(a)?a=a.call(this,n):a="",a},enforceFocus:function(){var n=this;this.clearEnforceFocus(),Ee(document,jo,this.onFocusin=function(a){var o=n.viewer,f=a.target;if(!(f===document||f===o||o.contains(f))){for(;f;){if(f.getAttribute("tabindex")!==null||f.getAttribute("aria-modal")==="true")return;f=f.parentElement}o.focus()}})},clearEnforceFocus:function(){this.onFocusin&&(Ge(document,jo,this.onFocusin),this.onFocusin=null)},open:function(){var n=this.body;Ce(n,Ho),this.scrollbarWidth>0&&(n.style.paddingRight="".concat(this.scrollbarWidth+(parseFloat(this.initialBodyComputedPaddingRight)||0),"px"))},close:function(){var n=this.body;He(n,Ho),this.scrollbarWidth>0&&(n.style.paddingRight=this.initialBodyPaddingRight)},shown:function(){var n=this.element,a=this.options,o=this.viewer;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,a.focus&&(o.focus(),this.enforceFocus()),Ue(a.shown)&&Ee(n,Qo,a.shown,{once:!0}),ot(n,Qo)!==!1&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var n=this.element,a=this.options,o=this.viewer;a.fucus&&this.clearEnforceFocus(),this.close(),this.unbind(),Ce(o,Vn),o.removeAttribute("role"),o.removeAttribute("aria-labelledby"),o.removeAttribute("aria-modal"),o.setAttribute("aria-hidden",!0),this.resetList(),this.resetImage(),this.fulled=!1,this.viewed=!1,this.isShown=!1,this.hiding=!1,this.destroyed||(Ue(a.hidden)&&Ee(n,el,a.hidden,{once:!0}),ot(n,el,null,{cancelable:!1}))},requestFullscreen:function(n){var a=this.element.ownerDocument;if(this.fulled&&!(a.fullscreenElement||a.webkitFullscreenElement||a.mozFullScreenElement||a.msFullscreenElement)){var o=a.documentElement;o.requestFullscreen?yr(n)?o.requestFullscreen(n):o.requestFullscreen():o.webkitRequestFullscreen?o.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):o.mozRequestFullScreen?o.mozRequestFullScreen():o.msRequestFullscreen&&o.msRequestFullscreen()}},exitFullscreen:function(){var n=this.element.ownerDocument;this.fulled&&(n.fullscreenElement||n.webkitFullscreenElement||n.mozFullScreenElement||n.msFullscreenElement)&&(n.exitFullscreen?n.exitFullscreen():n.webkitExitFullscreen?n.webkitExitFullscreen():n.mozCancelFullScreen?n.mozCancelFullScreen():n.msExitFullscreen&&n.msExitFullscreen())},change:function(n){var a=this.options,o=this.pointers,f=o[Object.keys(o)[0]];if(f){var d=f.endX-f.startX,p=f.endY-f.startY;switch(this.action){case Gi:(d!==0||p!==0)&&(this.pointerMoved=!0,this.move(d,p,n));break;case ei:this.zoom(Sh(o),!1,null,n);break;case $o:{this.action="switched";var y=Math.abs(d);y>1&&y>Math.abs(p)&&(this.pointers={},d>1?this.prev(a.loop):d<-1&&this.next(a.loop));break}}Xe(o,function(m){m.startX=m.endX,m.startY=m.endY})}},isSwitchable:function(){var n=this.imageData,a=this.viewerData;return this.length>1&&n.x>=0&&n.y>=0&&n.width<=a.width&&n.height<=a.height}},Ah=wn.Viewer,Ih=function(l){return function(){return l+=1,l}}(-1),pl=function(){function l(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(nh(this,l),!n||n.nodeType!==1)throw new Error("The first argument is required and must be an element.");this.element=n,this.options=qt({},zo,yr(a)&&a),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=Ih(),this.init()}return rh(l,[{key:"init",value:function(){var a=this,o=this.element,f=this.options;if(!o[Ne]){o[Ne]=this,f.focus&&!f.keyboard&&(f.focus=!1);var d=o.localName==="img",p=[];if(Xe(d?[o]:o.querySelectorAll("img"),function(x){Ue(f.filter)?f.filter.call(a,x)&&p.push(x):a.getImageURL(x)&&p.push(x)}),this.isImg=d,this.length=p.length,this.images=p,this.initBody(),mr(document.createElement(Ne).style.transition)&&(f.transition=!1),f.inline){var y=0,m=function(){if(y+=1,y===a.length){var S;a.initializing=!1,a.delaying={abort:function(){clearTimeout(S)}},S=setTimeout(function(){a.delaying=!1,a.build()},0)}};this.initializing={abort:function(){Xe(p,function(S){S.complete||(Ge(S,Qt,m),Ge(S,Jn,m))})}},Xe(p,function(x){if(x.complete)m();else{var S,A;Ee(x,Qt,S=function(){Ge(x,Jn,A),m()},{once:!0}),Ee(x,Jn,A=function(){Ge(x,Qt,S),m()},{once:!0})}})}else Ee(o,gr,this.onStart=function(x){var S=x.target;S.localName==="img"&&(!Ue(f.filter)||f.filter.call(a,S))&&a.view(a.images.indexOf(S))})}}},{key:"build",value:function(){if(!this.ready){var a=this.element,o=this.options,f=a.parentNode,d=document.createElement("div");d.innerHTML=sh;var p=d.querySelector(".".concat(Ne,"-container")),y=p.querySelector(".".concat(Ne,"-title")),m=p.querySelector(".".concat(Ne,"-toolbar")),x=p.querySelector(".".concat(Ne,"-navbar")),S=p.querySelector(".".concat(Ne,"-button")),A=p.querySelector(".".concat(Ne,"-canvas"));if(this.parent=f,this.viewer=p,this.title=y,this.toolbar=m,this.navbar=x,this.button=S,this.canvas=A,this.footer=p.querySelector(".".concat(Ne,"-footer")),this.tooltipBox=p.querySelector(".".concat(Ne,"-tooltip")),this.player=p.querySelector(".".concat(Ne,"-player")),this.list=p.querySelector(".".concat(Ne,"-list")),p.id="".concat(Ne).concat(this.id),y.id="".concat(Ne,"Title").concat(this.id),Ce(y,o.title?Qi(Array.isArray(o.title)?o.title[0]:o.title):Vn),Ce(x,o.navbar?Qi(o.navbar):Vn),ii(S,Vn,!o.button),o.keyboard&&S.setAttribute("tabindex",0),o.backdrop&&(Ce(p,"".concat(Ne,"-backdrop")),!o.inline&&o.backdrop!=="static"&&Za(A,Yi,"hide")),ri(o.className)&&o.className&&o.className.split(Ja).forEach(function($){Ce(p,$)}),o.toolbar){var E=document.createElement("ul"),H=yr(o.toolbar),B=Vi.slice(0,3),U=Vi.slice(7,9),F=Vi.slice(9);H||Ce(m,Qi(o.toolbar)),Xe(H?o.toolbar:Vi,function($,X){var ne=H&&yr($),ue=H?Qa(X):$,se=ne&&!mr($.show)?$.show:$;if(!(!se||!o.zoomable&&B.indexOf(ue)!==-1||!o.rotatable&&U.indexOf(ue)!==-1||!o.scalable&&F.indexOf(ue)!==-1)){var he=ne&&!mr($.size)?$.size:$,Oe=ne&&!mr($.click)?$.click:$,Re=document.createElement("li");o.keyboard&&Re.setAttribute("tabindex",0),Re.setAttribute("role","button"),Ce(Re,"".concat(Ne,"-").concat(ue)),Ue(Oe)||Za(Re,Yi,ue),Ze(se)&&Ce(Re,Qi(se)),["small","large"].indexOf(he)!==-1?Ce(Re,"".concat(Ne,"-").concat(he)):ue==="play"&&Ce(Re,"".concat(Ne,"-large")),Ue(Oe)&&Ee(Re,gr,Oe),E.appendChild(Re)}}),m.appendChild(E)}else Ce(m,Vn);if(!o.rotatable){var N=m.querySelectorAll('li[class*="rotate"]');Ce(N,ti),Xe(N,function($){m.appendChild($)})}if(o.inline)Ce(S,lh),rn(p,{zIndex:o.zIndexInline}),window.getComputedStyle(f).position==="static"&&rn(f,{position:"relative"}),f.insertBefore(p,a.nextSibling);else{Ce(S,oh),Ce(p,Ya),Ce(p,Xi),Ce(p,Vn),rn(p,{zIndex:o.zIndex});var O=o.container;ri(O)&&(O=a.ownerDocument.querySelector(O)),O||(O=this.body),O.appendChild(p)}if(o.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,Ue(o.ready)&&Ee(a,Vo,o.ready,{once:!0}),ot(a,Vo)===!1){this.ready=!1;return}this.ready&&o.inline&&this.view(this.index)}}}],[{key:"noConflict",value:function(){return window.Viewer=Ah,l}},{key:"setDefaults",value:function(a){qt(zo,yr(a)&&a)}}])}();qt(pl.prototype,Th,_h,Lh,Eh,Dh);var Oh=typeof global=="object"&&global&&global.Object===Object&&global,gl=Oh,Nh=typeof self=="object"&&self&&self.Object===Object&&self,Mh=gl||Nh||Function("return this")(),ts=Mh,Rh=ts.Symbol,ea=Rh,ml=Object.prototype,Fh=ml.hasOwnProperty,Ph=ml.toString,ai=ea?ea.toStringTag:void 0;function zh(l){var n=Fh.call(l,ai),a=l[ai];try{l[ai]=void 0;var o=!0}catch{}var f=Ph.call(l);return o&&(n?l[ai]=a:delete l[ai]),f}var $h=Object.prototype,Bh=$h.toString;function Hh(l){return Bh.call(l)}var Wh="[object Null]",jh="[object Undefined]",vl=ea?ea.toStringTag:void 0;function ns(l){return l==null?l===void 0?jh:Wh:vl&&vl in Object(l)?zh(l):Hh(l)}function rs(l){return l!=null&&typeof l=="object"}var qh=Array.isArray,Uh=qh;function is(l){var n=typeof l;return l!=null&&(n=="object"||n=="function")}function yl(l){return l}var Gh="[object AsyncFunction]",Kh="[object Function]",Xh="[object GeneratorFunction]",Yh="[object Proxy]";function bl(l){if(!is(l))return!1;var n=ns(l);return n==Kh||n==Xh||n==Gh||n==Yh}var Vh=ts["__core-js_shared__"],as=Vh,xl=function(){var l=/[^.]+$/.exec(as&&as.keys&&as.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""}();function Jh(l){return!!xl&&xl in l}var Qh=Function.prototype,Zh=Qh.toString;function ed(l){if(l!=null){try{return Zh.call(l)}catch{}try{return l+""}catch{}}return""}var td=/[\\^$.*+?()[\]{}|]/g,nd=/^\[object .+?Constructor\]$/,rd=Function.prototype,id=Object.prototype,ad=rd.toString,sd=id.hasOwnProperty,od=RegExp("^"+ad.call(sd).replace(td,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ld(l){if(!is(l)||Jh(l))return!1;var n=bl(l)?od:nd;return n.test(ed(l))}function ud(l,n){return l==null?void 0:l[n]}function fd(l,n){var a=ud(l,n);return ld(a)?a:void 0}function cd(l,n,a){switch(a.length){case 0:return l.call(n);case 1:return l.call(n,a[0]);case 2:return l.call(n,a[0],a[1]);case 3:return l.call(n,a[0],a[1],a[2])}return l.apply(n,a)}var hd=800,dd=16,pd=Date.now;function gd(l){var n=0,a=0;return function(){var o=pd(),f=dd-(o-a);if(a=o,f>0){if(++n>=hd)return arguments[0]}else n=0;return l.apply(void 0,arguments)}}function md(l){return function(){return l}}var vd=function(){try{var l=fd(Object,"defineProperty");return l({},"",{}),l}catch{}}(),ta=vd,yd=ta?function(l,n){return ta(l,"toString",{configurable:!0,enumerable:!1,value:md(n),writable:!0})}:yl,bd=yd,xd=gd(bd),wd=xd,kd=9007199254740991,Sd=/^(?:0|[1-9]\d*)$/;function wl(l,n){var a=typeof l;return n=n??kd,!!n&&(a=="number"||a!="symbol"&&Sd.test(l))&&l>-1&&l%1==0&&l<n}function kl(l,n,a){n=="__proto__"&&ta?ta(l,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):l[n]=a}function Sl(l,n){return l===n||l!==l&&n!==n}var Cd=Object.prototype,Td=Cd.hasOwnProperty;function Cl(l,n,a){var o=l[n];(!(Td.call(l,n)&&Sl(o,a))||a===void 0&&!(n in l))&&kl(l,n,a)}function _d(l,n,a,o){var f=!a;a||(a={});for(var d=-1,p=n.length;++d<p;){var y=n[d],m=void 0;m===void 0&&(m=l[y]),f?kl(a,y,m):Cl(a,y,m)}return a}var Tl=Math.max;function Ld(l,n,a){return n=Tl(n===void 0?l.length-1:n,0),function(){for(var o=arguments,f=-1,d=Tl(o.length-n,0),p=Array(d);++f<d;)p[f]=o[n+f];f=-1;for(var y=Array(n+1);++f<n;)y[f]=o[f];return y[n]=a(p),cd(l,this,y)}}function Ed(l,n){return wd(Ld(l,n,yl),l+"")}var Dd=9007199254740991;function _l(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=Dd}function ss(l){return l!=null&&_l(l.length)&&!bl(l)}function Ad(l,n,a){if(!is(a))return!1;var o=typeof n;return(o=="number"?ss(a)&&wl(n,a.length):o=="string"&&n in a)?Sl(a[n],l):!1}function Id(l){return Ed(function(n,a){var o=-1,f=a.length,d=f>1?a[f-1]:void 0,p=f>2?a[2]:void 0;for(d=l.length>3&&typeof d=="function"?(f--,d):void 0,p&&Ad(a[0],a[1],p)&&(d=f<3?void 0:d,f=1),n=Object(n);++o<f;){var y=a[o];y&&l(n,y,o,d)}return n})}var Od=Object.prototype;function Ll(l){var n=l&&l.constructor,a=typeof n=="function"&&n.prototype||Od;return l===a}function Nd(l,n){for(var a=-1,o=Array(l);++a<l;)o[a]=n(a);return o}var Md="[object Arguments]";function El(l){return rs(l)&&ns(l)==Md}var Dl=Object.prototype,Rd=Dl.hasOwnProperty,Fd=Dl.propertyIsEnumerable,Pd=El(function(){return arguments}())?El:function(l){return rs(l)&&Rd.call(l,"callee")&&!Fd.call(l,"callee")},zd=Pd;function $d(){return!1}var Al=typeof Ie=="object"&&Ie&&!Ie.nodeType&&Ie,Il=Al&&typeof module=="object"&&module&&!module.nodeType&&module,Bd=Il&&Il.exports===Al,Ol=Bd?ts.Buffer:void 0,Hd=Ol?Ol.isBuffer:void 0,Wd=Hd||$d,jd=Wd,qd="[object Arguments]",Ud="[object Array]",Gd="[object Boolean]",Kd="[object Date]",Xd="[object Error]",Yd="[object Function]",Vd="[object Map]",Jd="[object Number]",Qd="[object Object]",Zd="[object RegExp]",ep="[object Set]",tp="[object String]",np="[object WeakMap]",rp="[object ArrayBuffer]",ip="[object DataView]",ap="[object Float32Array]",sp="[object Float64Array]",op="[object Int8Array]",lp="[object Int16Array]",up="[object Int32Array]",fp="[object Uint8Array]",cp="[object Uint8ClampedArray]",hp="[object Uint16Array]",dp="[object Uint32Array]",Ye={};Ye[ap]=Ye[sp]=Ye[op]=Ye[lp]=Ye[up]=Ye[fp]=Ye[cp]=Ye[hp]=Ye[dp]=!0,Ye[qd]=Ye[Ud]=Ye[rp]=Ye[Gd]=Ye[ip]=Ye[Kd]=Ye[Xd]=Ye[Yd]=Ye[Vd]=Ye[Jd]=Ye[Qd]=Ye[Zd]=Ye[ep]=Ye[tp]=Ye[np]=!1;function pp(l){return rs(l)&&_l(l.length)&&!!Ye[ns(l)]}function gp(l){return function(n){return l(n)}}var Nl=typeof Ie=="object"&&Ie&&!Ie.nodeType&&Ie,si=Nl&&typeof module=="object"&&module&&!module.nodeType&&module,mp=si&&si.exports===Nl,os=mp&&gl.process,vp=function(){try{var l=si&&si.require&&si.require("util").types;return l||os&&os.binding&&os.binding("util")}catch{}}(),Ml=vp,Rl=Ml&&Ml.isTypedArray,yp=Rl?gp(Rl):pp,bp=yp,xp=Object.prototype,wp=xp.hasOwnProperty;function kp(l,n){var a=Uh(l),o=!a&&zd(l),f=!a&&!o&&jd(l),d=!a&&!o&&!f&&bp(l),p=a||o||f||d,y=p?Nd(l.length,String):[],m=y.length;for(var x in l)wp.call(l,x)&&!(p&&(x=="length"||f&&(x=="offset"||x=="parent")||d&&(x=="buffer"||x=="byteLength"||x=="byteOffset")||wl(x,m)))&&y.push(x);return y}function Sp(l,n){return function(a){return l(n(a))}}var Cp=Sp(Object.keys,Object),Tp=Cp,_p=Object.prototype,Lp=_p.hasOwnProperty;function Ep(l){if(!Ll(l))return Tp(l);var n=[];for(var a in Object(l))Lp.call(l,a)&&a!="constructor"&&n.push(a);return n}function Dp(l){return ss(l)?kp(l):Ep(l)}var Ap=Object.prototype,Ip=Ap.hasOwnProperty,Op=Id(function(l,n){if(Ll(n)||ss(n)){_d(n,Dp(n),l);return}for(var a in n)Ip.call(n,a)&&Cl(l,a,n[a])}),Np=Op;const Fl=({images:l=[],options:n={}}={})=>{n=Np(n,{inline:!1});const a=Xf.extend({render(p){return p("div",{style:{display:"none"},class:["__viewer-token"]},l.map(y=>p("img",{attrs:typeof y=="string"?{src:y}:y})))}}),o=new a;o.$mount(),document.body.appendChild(o.$el);const f=new pl(o.$el,n),d=f.destroy.bind(f);return f.destroy=function(){return d(),o.$destroy(),document.body.removeChild(o.$el),f},f.show(),o.$el.addEventListener("hidden",function(){this.viewer===f&&f.destroy()}),f};var Pl={exports:{}},zl;function Mp(){return zl||(zl=1,function(l,n){(function(a){a(Wt())})(function(a){var o={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},f={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};a.defineMode("xml",function(d,p){var y=d.indentUnit,m={},x=p.htmlMode?o:f;for(var S in x)m[S]=x[S];for(var S in p)m[S]=p[S];var A,E;function H(k,J){function G(K){return J.tokenize=K,K(k,J)}var D=k.next();if(D=="<")return k.eat("!")?k.eat("[")?k.match("CDATA[")?G(F("atom","]]>")):null:k.match("--")?G(F("comment","-->")):k.match("DOCTYPE",!0,!0)?(k.eatWhile(/[\w\._\-]/),G(N(1))):null:k.eat("?")?(k.eatWhile(/[\w\._\-]/),J.tokenize=F("meta","?>"),"meta"):(A=k.eat("/")?"closeTag":"openTag",J.tokenize=B,"tag bracket");if(D=="&"){var R;return k.eat("#")?k.eat("x")?R=k.eatWhile(/[a-fA-F\d]/)&&k.eat(";"):R=k.eatWhile(/[\d]/)&&k.eat(";"):R=k.eatWhile(/[\w\.\-:]/)&&k.eat(";"),R?"atom":"error"}else return k.eatWhile(/[^&<]/),null}H.isInText=!0;function B(k,J){var G=k.next();if(G==">"||G=="/"&&k.eat(">"))return J.tokenize=H,A=G==">"?"endTag":"selfcloseTag","tag bracket";if(G=="=")return A="equals",null;if(G=="<"){J.tokenize=H,J.state=ue,J.tagName=J.tagStart=null;var D=J.tokenize(k,J);return D?D+" tag error":"tag error"}else return/[\'\"]/.test(G)?(J.tokenize=U(G),J.stringStartCol=k.column(),J.tokenize(k,J)):(k.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function U(k){var J=function(G,D){for(;!G.eol();)if(G.next()==k){D.tokenize=B;break}return"string"};return J.isInAttribute=!0,J}function F(k,J){return function(G,D){for(;!G.eol();){if(G.match(J)){D.tokenize=H;break}G.next()}return k}}function N(k){return function(J,G){for(var D;(D=J.next())!=null;){if(D=="<")return G.tokenize=N(k+1),G.tokenize(J,G);if(D==">")if(k==1){G.tokenize=H;break}else return G.tokenize=N(k-1),G.tokenize(J,G)}return"meta"}}function O(k){return k&&k.toLowerCase()}function $(k,J,G){this.prev=k.context,this.tagName=J||"",this.indent=k.indented,this.startOfLine=G,(m.doNotIndent.hasOwnProperty(J)||k.context&&k.context.noIndent)&&(this.noIndent=!0)}function X(k){k.context&&(k.context=k.context.prev)}function ne(k,J){for(var G;;){if(!k.context||(G=k.context.tagName,!m.contextGrabbers.hasOwnProperty(O(G))||!m.contextGrabbers[O(G)].hasOwnProperty(O(J))))return;X(k)}}function ue(k,J,G){return k=="openTag"?(G.tagStart=J.column(),se):k=="closeTag"?he:ue}function se(k,J,G){return k=="word"?(G.tagName=J.current(),E="tag",ie):m.allowMissingTagName&&k=="endTag"?(E="tag bracket",ie(k,J,G)):(E="error",se)}function he(k,J,G){if(k=="word"){var D=J.current();return G.context&&G.context.tagName!=D&&m.implicitlyClosed.hasOwnProperty(O(G.context.tagName))&&X(G),G.context&&G.context.tagName==D||m.matchClosing===!1?(E="tag",Oe):(E="tag error",Re)}else return m.allowMissingTagName&&k=="endTag"?(E="tag bracket",Oe(k,J,G)):(E="error",Re)}function Oe(k,J,G){return k!="endTag"?(E="error",Oe):(X(G),ue)}function Re(k,J,G){return E="error",Oe(k,J,G)}function ie(k,J,G){if(k=="word")return E="attribute",ze;if(k=="endTag"||k=="selfcloseTag"){var D=G.tagName,R=G.tagStart;return G.tagName=G.tagStart=null,k=="selfcloseTag"||m.autoSelfClosers.hasOwnProperty(O(D))?ne(G,D):(ne(G,D),G.context=new $(G,D,R==G.indented)),ue}return E="error",ie}function ze(k,J,G){return k=="equals"?W:(m.allowMissing||(E="error"),ie(k,J,G))}function W(k,J,G){return k=="string"?Q:k=="word"&&m.allowUnquoted?(E="string",ie):(E="error",ie(k,J,G))}function Q(k,J,G){return k=="string"?Q:ie(k,J,G)}return{startState:function(k){var J={tokenize:H,state:ue,indented:k||0,tagName:null,tagStart:null,context:null};return k!=null&&(J.baseIndent=k),J},token:function(k,J){if(!J.tagName&&k.sol()&&(J.indented=k.indentation()),k.eatSpace())return null;A=null;var G=J.tokenize(k,J);return(G||A)&&G!="comment"&&(E=null,J.state=J.state(A||G,k,J),E&&(G=E=="error"?G+" error":E)),G},indent:function(k,J,G){var D=k.context;if(k.tokenize.isInAttribute)return k.tagStart==k.indented?k.stringStartCol+1:k.indented+y;if(D&&D.noIndent)return a.Pass;if(k.tokenize!=B&&k.tokenize!=H)return G?G.match(/^(\s*)/)[0].length:0;if(k.tagName)return m.multilineTagIndentPastTag!==!1?k.tagStart+k.tagName.length+2:k.tagStart+y*(m.multilineTagIndentFactor||1);if(m.alignCDATA&&/<!\[CDATA\[/.test(J))return 0;var R=J&&/^<(\/)?([\w_:\.-]*)/.exec(J);if(R&&R[1])for(;D;)if(D.tagName==R[2]){D=D.prev;break}else if(m.implicitlyClosed.hasOwnProperty(O(D.tagName)))D=D.prev;else break;else if(R)for(;D;){var K=m.contextGrabbers[O(D.tagName)];if(K&&K.hasOwnProperty(O(R[2])))D=D.prev;else break}for(;D&&D.prev&&!D.startOfLine;)D=D.prev;return D?D.indent+y:k.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:m.htmlMode?"html":"xml",helperType:m.htmlMode?"html":"xml",skipAttribute:function(k){k.state==W&&(k.state=ie)},xmlCurrentTag:function(k){return k.tagName?{name:k.tagName,close:k.type=="closeTag"}:null},xmlCurrentContext:function(k){for(var J=[],G=k.context;G;G=G.prev)J.push(G.tagName);return J.reverse()}}}),a.defineMIME("text/xml","xml"),a.defineMIME("application/xml","xml"),a.mimeModes.hasOwnProperty("text/html")||a.defineMIME("text/html",{name:"xml",htmlMode:!0})})}()),Pl.exports}var $l={exports:{}},Bl;function Rp(){return Bl||(Bl=1,function(l,n){(function(a){a(Wt())})(function(a){a.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var o=0;o<a.modeInfo.length;o++){var f=a.modeInfo[o];f.mimes&&(f.mime=f.mimes[0])}a.findModeByMIME=function(d){d=d.toLowerCase();for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.mime==d)return y;if(y.mimes){for(var m=0;m<y.mimes.length;m++)if(y.mimes[m]==d)return y}}if(/\+xml$/.test(d))return a.findModeByMIME("application/xml");if(/\+json$/.test(d))return a.findModeByMIME("application/json")},a.findModeByExtension=function(d){d=d.toLowerCase();for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.ext){for(var m=0;m<y.ext.length;m++)if(y.ext[m]==d)return y}}},a.findModeByFileName=function(d){for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.file&&y.file.test(d))return y}var m=d.lastIndexOf("."),x=m>-1&&d.substring(m+1,d.length);if(x)return a.findModeByExtension(x)},a.findModeByName=function(d){d=d.toLowerCase();for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.name.toLowerCase()==d)return y;if(y.alias){for(var m=0;m<y.alias.length;m++)if(y.alias[m].toLowerCase()==d)return y}}}})}()),$l.exports}(function(l,n){(function(a){a(Wt(),Mp(),Rp())})(function(a){a.defineMode("markdown",function(o,f){var d=a.getMode(o,"text/html"),p=d.name=="null";function y(L){if(a.findModeByName){var w=a.findModeByName(L);w&&(L=w.mime||w.mimes[0])}var oe=a.getMode(o,L);return oe.name=="null"?null:oe}f.highlightFormatting===void 0&&(f.highlightFormatting=!1),f.maxBlockquoteDepth===void 0&&(f.maxBlockquoteDepth=0),f.taskLists===void 0&&(f.taskLists=!1),f.strikethrough===void 0&&(f.strikethrough=!1),f.emoji===void 0&&(f.emoji=!1),f.fencedCodeBlockHighlighting===void 0&&(f.fencedCodeBlockHighlighting=!0),f.fencedCodeBlockDefaultMode===void 0&&(f.fencedCodeBlockDefaultMode="text/plain"),f.xml===void 0&&(f.xml=!0),f.tokenTypeOverrides===void 0&&(f.tokenTypeOverrides={});var m={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var x in m)m.hasOwnProperty(x)&&f.tokenTypeOverrides[x]&&(m[x]=f.tokenTypeOverrides[x]);var S=/^([*\-_])(?:\s*\1){2,}\s*$/,A=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,H=f.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,B=/^ {0,3}(?:\={1,}|-{2,})\s*$/,U=/^[^#!\[\]*_\\<>` "'(~:]+/,F=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,N=/^\s*\[[^\]]+?\]:.*$/,O=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,$=" ";function X(L,w,oe){return w.f=w.inline=oe,oe(L,w)}function ne(L,w,oe){return w.f=w.block=oe,oe(L,w)}function ue(L){return!L||!/\S/.test(L.string)}function se(L){if(L.linkTitle=!1,L.linkHref=!1,L.linkText=!1,L.em=!1,L.strong=!1,L.strikethrough=!1,L.quote=0,L.indentedCode=!1,L.f==Oe){var w=p;if(!w){var oe=a.innerMode(d,L.htmlState);w=oe.mode.name=="xml"&&oe.state.tagStart===null&&!oe.state.context&&oe.state.tokenize.isInText}w&&(L.f=W,L.block=he,L.htmlState=null)}return L.trailingSpace=0,L.trailingSpaceNewLine=!1,L.prevLine=L.thisLine,L.thisLine={stream:null},null}function he(L,w){var oe=L.column()===w.indentation,Te=ue(w.prevLine.stream),Z=w.indentedCode,ce=w.prevLine.hr,ke=w.list!==!1,_e=(w.listStack[w.listStack.length-1]||0)+3;w.indentedCode=!1;var ft=w.indentation;if(w.indentationDiff===null&&(w.indentationDiff=w.indentation,ke)){for(w.list=null;ft<w.listStack[w.listStack.length-1];)w.listStack.pop(),w.listStack.length?w.indentation=w.listStack[w.listStack.length-1]:w.list=!1;w.list!==!1&&(w.indentationDiff=ft-w.listStack[w.listStack.length-1])}var we=!Te&&!ce&&!w.prevLine.header&&(!ke||!Z)&&!w.prevLine.fencedCodeEnd,Me=(w.list===!1||ce||Te)&&w.indentation<=_e&&L.match(S),Ke=null;if(w.indentationDiff>=4&&(Z||w.prevLine.fencedCodeEnd||w.prevLine.header||Te))return L.skipToEnd(),w.indentedCode=!0,m.code;if(L.eatSpace())return null;if(oe&&w.indentation<=_e&&(Ke=L.match(H))&&Ke[1].length<=6)return w.quote=0,w.header=Ke[1].length,w.thisLine.header=!0,f.highlightFormatting&&(w.formatting="header"),w.f=w.inline,ie(w);if(w.indentation<=_e&&L.eat(">"))return w.quote=oe?1:w.quote+1,f.highlightFormatting&&(w.formatting="quote"),L.eatSpace(),ie(w);if(!Me&&!w.setext&&oe&&w.indentation<=_e&&(Ke=L.match(A))){var ct=Ke[1]?"ol":"ul";return w.indentation=ft+L.current().length,w.list=!0,w.quote=0,w.listStack.push(w.indentation),w.em=!1,w.strong=!1,w.code=!1,w.strikethrough=!1,f.taskLists&&L.match(E,!1)&&(w.taskList=!0),w.f=w.inline,f.highlightFormatting&&(w.formatting=["list","list-"+ct]),ie(w)}else{if(oe&&w.indentation<=_e&&(Ke=L.match(F,!0)))return w.quote=0,w.fencedEndRE=new RegExp(Ke[1]+"+ *$"),w.localMode=f.fencedCodeBlockHighlighting&&y(Ke[2]||f.fencedCodeBlockDefaultMode),w.localMode&&(w.localState=a.startState(w.localMode)),w.f=w.block=Re,f.highlightFormatting&&(w.formatting="code-block"),w.code=-1,ie(w);if(w.setext||(!we||!ke)&&!w.quote&&w.list===!1&&!w.code&&!Me&&!N.test(L.string)&&(Ke=L.lookAhead(1))&&(Ke=Ke.match(B)))return w.setext?(w.header=w.setext,w.setext=0,L.skipToEnd(),f.highlightFormatting&&(w.formatting="header")):(w.header=Ke[0].charAt(0)=="="?1:2,w.setext=w.header),w.thisLine.header=!0,w.f=w.inline,ie(w);if(Me)return L.skipToEnd(),w.hr=!0,w.thisLine.hr=!0,m.hr;if(L.peek()==="[")return X(L,w,D)}return X(L,w,w.inline)}function Oe(L,w){var oe=d.token(L,w.htmlState);if(!p){var Te=a.innerMode(d,w.htmlState);(Te.mode.name=="xml"&&Te.state.tagStart===null&&!Te.state.context&&Te.state.tokenize.isInText||w.md_inside&&L.current().indexOf(">")>-1)&&(w.f=W,w.block=he,w.htmlState=null)}return oe}function Re(L,w){var oe=w.listStack[w.listStack.length-1]||0,Te=w.indentation<oe,Z=oe+3;if(w.fencedEndRE&&w.indentation<=Z&&(Te||L.match(w.fencedEndRE))){f.highlightFormatting&&(w.formatting="code-block");var ce;return Te||(ce=ie(w)),w.localMode=w.localState=null,w.block=he,w.f=W,w.fencedEndRE=null,w.code=0,w.thisLine.fencedCodeEnd=!0,Te?ne(L,w,w.block):ce}else return w.localMode?w.localMode.token(L,w.localState):(L.skipToEnd(),m.code)}function ie(L){var w=[];if(L.formatting){w.push(m.formatting),typeof L.formatting=="string"&&(L.formatting=[L.formatting]);for(var oe=0;oe<L.formatting.length;oe++)w.push(m.formatting+"-"+L.formatting[oe]),L.formatting[oe]==="header"&&w.push(m.formatting+"-"+L.formatting[oe]+"-"+L.header),L.formatting[oe]==="quote"&&(!f.maxBlockquoteDepth||f.maxBlockquoteDepth>=L.quote?w.push(m.formatting+"-"+L.formatting[oe]+"-"+L.quote):w.push("error"))}if(L.taskOpen)return w.push("meta"),w.length?w.join(" "):null;if(L.taskClosed)return w.push("property"),w.length?w.join(" "):null;if(L.linkHref?w.push(m.linkHref,"url"):(L.strong&&w.push(m.strong),L.em&&w.push(m.em),L.strikethrough&&w.push(m.strikethrough),L.emoji&&w.push(m.emoji),L.linkText&&w.push(m.linkText),L.code&&w.push(m.code),L.image&&w.push(m.image),L.imageAltText&&w.push(m.imageAltText,"link"),L.imageMarker&&w.push(m.imageMarker)),L.header&&w.push(m.header,m.header+"-"+L.header),L.quote&&(w.push(m.quote),!f.maxBlockquoteDepth||f.maxBlockquoteDepth>=L.quote?w.push(m.quote+"-"+L.quote):w.push(m.quote+"-"+f.maxBlockquoteDepth)),L.list!==!1){var Te=(L.listStack.length-1)%3;Te?Te===1?w.push(m.list2):w.push(m.list3):w.push(m.list1)}return L.trailingSpaceNewLine?w.push("trailing-space-new-line"):L.trailingSpace&&w.push("trailing-space-"+(L.trailingSpace%2?"a":"b")),w.length?w.join(" "):null}function ze(L,w){if(L.match(U,!0))return ie(w)}function W(L,w){var oe=w.text(L,w);if(typeof oe<"u")return oe;if(w.list)return w.list=null,ie(w);if(w.taskList){var Te=L.match(E,!0)[1]===" ";return Te?w.taskOpen=!0:w.taskClosed=!0,f.highlightFormatting&&(w.formatting="task"),w.taskList=!1,ie(w)}if(w.taskOpen=!1,w.taskClosed=!1,w.header&&L.match(/^#+$/,!0))return f.highlightFormatting&&(w.formatting="header"),ie(w);var Z=L.next();if(w.linkTitle){w.linkTitle=!1;var ce=Z;Z==="("&&(ce=")"),ce=(ce+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var ke="^\\s*(?:[^"+ce+"\\\\]+|\\\\\\\\|\\\\.)"+ce;if(L.match(new RegExp(ke),!0))return m.linkHref}if(Z==="`"){var _e=w.formatting;f.highlightFormatting&&(w.formatting="code"),L.eatWhile("`");var ft=L.current().length;if(w.code==0&&(!w.quote||ft==1))return w.code=ft,ie(w);if(ft==w.code){var we=ie(w);return w.code=0,we}else return w.formatting=_e,ie(w)}else if(w.code)return ie(w);if(Z==="\\"&&(L.next(),f.highlightFormatting)){var Me=ie(w),Ke=m.formatting+"-escape";return Me?Me+" "+Ke:Ke}if(Z==="!"&&L.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return w.imageMarker=!0,w.image=!0,f.highlightFormatting&&(w.formatting="image"),ie(w);if(Z==="["&&w.imageMarker&&L.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return w.imageMarker=!1,w.imageAltText=!0,f.highlightFormatting&&(w.formatting="image"),ie(w);if(Z==="]"&&w.imageAltText){f.highlightFormatting&&(w.formatting="image");var Me=ie(w);return w.imageAltText=!1,w.image=!1,w.inline=w.f=k,Me}if(Z==="["&&!w.image)return w.linkText&&L.match(/^.*?\]/)||(w.linkText=!0,f.highlightFormatting&&(w.formatting="link")),ie(w);if(Z==="]"&&w.linkText){f.highlightFormatting&&(w.formatting="link");var Me=ie(w);return w.linkText=!1,w.inline=w.f=L.match(/\(.*?\)| ?\[.*?\]/,!1)?k:W,Me}if(Z==="<"&&L.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Q,f.highlightFormatting&&(w.formatting="link");var Me=ie(w);return Me?Me+=" ":Me="",Me+m.linkInline}if(Z==="<"&&L.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Q,f.highlightFormatting&&(w.formatting="link");var Me=ie(w);return Me?Me+=" ":Me="",Me+m.linkEmail}if(f.xml&&Z==="<"&&L.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ct=L.string.indexOf(">",L.pos);if(ct!=-1){var Pt=L.string.substring(L.start,ct);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Pt)&&(w.md_inside=!0)}return L.backUp(1),w.htmlState=a.startState(d),ne(L,w,Oe)}if(f.xml&&Z==="<"&&L.match(/^\/\w*?>/))return w.md_inside=!1,"tag";if(Z==="*"||Z==="_"){for(var ht=1,dt=L.pos==1?" ":L.string.charAt(L.pos-2);ht<3&&L.eat(Z);)ht++;var gt=L.peek()||" ",Ut=!/\s/.test(gt)&&(!O.test(gt)||/\s/.test(dt)||O.test(dt)),be=!/\s/.test(dt)&&(!O.test(dt)||/\s/.test(gt)||O.test(gt)),kt=null,Gt=null;if(ht%2&&(!w.em&&Ut&&(Z==="*"||!be||O.test(dt))?kt=!0:w.em==Z&&be&&(Z==="*"||!Ut||O.test(gt))&&(kt=!1)),ht>1&&(!w.strong&&Ut&&(Z==="*"||!be||O.test(dt))?Gt=!0:w.strong==Z&&be&&(Z==="*"||!Ut||O.test(gt))&&(Gt=!1)),Gt!=null||kt!=null){f.highlightFormatting&&(w.formatting=kt==null?"strong":Gt==null?"em":"strong em"),kt===!0&&(w.em=Z),Gt===!0&&(w.strong=Z);var we=ie(w);return kt===!1&&(w.em=!1),Gt===!1&&(w.strong=!1),we}}else if(Z===" "&&(L.eat("*")||L.eat("_"))){if(L.peek()===" ")return ie(w);L.backUp(1)}if(f.strikethrough){if(Z==="~"&&L.eatWhile(Z)){if(w.strikethrough){f.highlightFormatting&&(w.formatting="strikethrough");var we=ie(w);return w.strikethrough=!1,we}else if(L.match(/^[^\s]/,!1))return w.strikethrough=!0,f.highlightFormatting&&(w.formatting="strikethrough"),ie(w)}else if(Z===" "&&L.match("~~",!0)){if(L.peek()===" ")return ie(w);L.backUp(2)}}if(f.emoji&&Z===":"&&L.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){w.emoji=!0,f.highlightFormatting&&(w.formatting="emoji");var On=ie(w);return w.emoji=!1,On}return Z===" "&&(L.match(/^ +$/,!1)?w.trailingSpace++:w.trailingSpace&&(w.trailingSpaceNewLine=!0)),ie(w)}function Q(L,w){var oe=L.next();if(oe===">"){w.f=w.inline=W,f.highlightFormatting&&(w.formatting="link");var Te=ie(w);return Te?Te+=" ":Te="",Te+m.linkInline}return L.match(/^[^>]+/,!0),m.linkInline}function k(L,w){if(L.eatSpace())return null;var oe=L.next();return oe==="("||oe==="["?(w.f=w.inline=G(oe==="("?")":"]"),f.highlightFormatting&&(w.formatting="link-string"),w.linkHref=!0,ie(w)):"error"}var J={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function G(L){return function(w,oe){var Te=w.next();if(Te===L){oe.f=oe.inline=W,f.highlightFormatting&&(oe.formatting="link-string");var Z=ie(oe);return oe.linkHref=!1,Z}return w.match(J[L]),oe.linkHref=!0,ie(oe)}}function D(L,w){return L.match(/^([^\]\\]|\\.)*\]:/,!1)?(w.f=R,L.next(),f.highlightFormatting&&(w.formatting="link"),w.linkText=!0,ie(w)):X(L,w,W)}function R(L,w){if(L.match("]:",!0)){w.f=w.inline=K,f.highlightFormatting&&(w.formatting="link");var oe=ie(w);return w.linkText=!1,oe}return L.match(/^([^\]\\]|\\.)+/,!0),m.linkText}function K(L,w){return L.eatSpace()?null:(L.match(/^[^\s]+/,!0),L.peek()===void 0?w.linkTitle=!0:L.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),w.f=w.inline=W,m.linkHref+" url")}var de={startState:function(){return{f:he,prevLine:{stream:null},thisLine:{stream:null},block:he,htmlState:null,indentation:0,inline:W,text:ze,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(L){return{f:L.f,prevLine:L.prevLine,thisLine:L.thisLine,block:L.block,htmlState:L.htmlState&&a.copyState(d,L.htmlState),indentation:L.indentation,localMode:L.localMode,localState:L.localMode?a.copyState(L.localMode,L.localState):null,inline:L.inline,text:L.text,formatting:!1,linkText:L.linkText,linkTitle:L.linkTitle,linkHref:L.linkHref,code:L.code,em:L.em,strong:L.strong,strikethrough:L.strikethrough,emoji:L.emoji,header:L.header,setext:L.setext,hr:L.hr,taskList:L.taskList,list:L.list,listStack:L.listStack.slice(0),quote:L.quote,indentedCode:L.indentedCode,trailingSpace:L.trailingSpace,trailingSpaceNewLine:L.trailingSpaceNewLine,md_inside:L.md_inside,fencedEndRE:L.fencedEndRE}},token:function(L,w){if(w.formatting=!1,L!=w.thisLine.stream){if(w.header=0,w.hr=!1,L.match(/^\s*$/,!0))return se(w),null;if(w.prevLine=w.thisLine,w.thisLine={stream:L},w.taskList=!1,w.trailingSpace=0,w.trailingSpaceNewLine=!1,!w.localState&&(w.f=w.block,w.f!=Oe)){var oe=L.match(/^\s*/,!0)[0].replace(/\t/g,$).length;if(w.indentation=oe,w.indentationDiff=null,oe>0)return null}}return w.f(L,w)},innerMode:function(L){return L.block==Oe?{state:L.htmlState,mode:d}:L.localState?{state:L.localState,mode:L.localMode}:{state:L,mode:de}},indent:function(L,w,oe){return L.block==Oe&&d.indent?d.indent(L.htmlState,w,oe):L.localState&&L.localMode.indent?L.localMode.indent(L.localState,w,oe):a.Pass},blankLine:se,getType:ie,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return de},"xml"),a.defineMIME("text/markdown","markdown"),a.defineMIME("text/x-markdown","markdown")})})();const Fp={name:"DebugTab",components:{codemirror:co.codemirror},props:{selectedSpan:{type:Object,required:!0},selectedSpanId:{type:String,required:!0}},data(){return{debugForm:{params:[],systemContent:"",userContent:""},debugSubmitting:!1,debugResponse:null,showDebugRawResponse:!1,debugResponseKey:0,debugMarkdownKey:0,originalInputs:null,hasImageUrl:!1,submitImage:!0,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,autoRefresh:!0},cmOptionsMarkdown:{tabSize:2,mode:"markdown",theme:"monokai",lineNumbers:!0,lineWrapping:!0,readOnly:!1,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,autoCloseBrackets:!0,indentUnit:2,styleActiveLine:!0,autoRefresh:!0},viewerOptions:{inline:!1,button:!0,navbar:!0,title:!0,toolbar:!0,tooltip:!0,movable:!0,zoomable:!0,rotatable:!0,scalable:!0,transition:!0,fullscreen:!0,keyboard:!0,zIndex:9999}}},computed:{rawInputs(){var l,n,a;return(a=(n=(l=this.selectedSpan)==null?void 0:l.parsedContent)==null?void 0:n.attributes)==null?void 0:a["langsword.spanInputs"]},targetUrl(){var n,a;const l=(a=(n=this.selectedSpan)==null?void 0:n.parsedContent)==null?void 0:a.attributes;return l&&l["url.full"]?l["url.full"]:null}},watch:{selectedSpanId:{immediate:!0,handler(l,n){l&&l!==n&&this.$nextTick(()=>{this.initDebugForm()})}},"selectedSpan.parsedContent":{deep:!0,handler(){this.selectedSpan&&this.selectedSpanId&&this.$nextTick(()=>{this.initDebugForm()})}}},mounted(){this.selectedSpan&&this.selectedSpanId&&this.$nextTick(()=>{this.initDebugForm()})},methods:{initDebugForm(){var n,a;if(!this.selectedSpan)return;let l=(a=(n=this.selectedSpan)==null?void 0:n.parsedContent)==null?void 0:a.inputs;if(!l&&this.rawInputs)try{l=typeof this.rawInputs=="string"?JSON.parse(this.rawInputs):this.rawInputs}catch(o){console.error("Failed to parse rawInputs:",o);return}if(!l){console.warn("No inputs found for span:",this.selectedSpanId);return}if(this.originalInputs=JSON.parse(JSON.stringify(l)),this.selectedSpan.type==="CLIENT"||this.selectedSpan.type==="EMBEDDING")this.debugForm.params=[],this.debugForm.systemContent="",this.debugForm.userContent="",Object.keys(l).forEach(o=>{if(o!=="file"){const f=l[o];let d="";typeof f=="string"?d=f:typeof f=="boolean"||typeof f=="number"?d=String(f):d=JSON.stringify(f),this.debugForm.params.push({key:o,value:d})}});else if(this.selectedSpan.type==="CHAT_MODEL")if(this.debugForm.params=[],this.hasImageUrl=!1,this.submitImage=!0,Object.keys(l).forEach(o=>{if(o!=="messages"){const f=l[o];let d="";typeof f=="string"?d=f:typeof f=="boolean"||typeof f=="number"?d=String(f):d=JSON.stringify(f),this.debugForm.params.push({key:o,value:d})}}),l.messages&&Array.isArray(l.messages)){const o=l.messages.find(d=>d.role==="system"),f=l.messages.find(d=>d.role==="user");if(o&&o.content?this.debugForm.systemContent=typeof o.content=="string"?o.content:"":this.debugForm.systemContent="",f&&f.content)if(Array.isArray(f.content)){const d=f.content.filter(y=>y.type==="text"&&y.text).map(y=>y.text);this.debugForm.userContent=d.join(`
78
- `);const p=f.content.some(y=>y.type==="image_url");this.hasImageUrl=p}else typeof f.content=="string"?this.debugForm.userContent=f.content:this.debugForm.userContent="";else this.debugForm.userContent=""}else this.debugForm.systemContent="",this.debugForm.userContent="";this.debugResponse=null,this.showDebugRawResponse=!1,this.$nextTick(()=>{this.$refs.systemContentEditor&&this.$refs.systemContentEditor.codemirror&&this.$refs.systemContentEditor.codemirror.setValue(this.debugForm.systemContent||""),this.$refs.userContentEditor&&this.$refs.userContentEditor.codemirror&&this.$refs.userContentEditor.codemirror.setValue(this.debugForm.userContent||"")})},addDebugParam(){this.debugForm.params.push({key:"",value:""})},removeDebugParam(l){this.debugForm.params.splice(l,1)},handleDebugParamChange(){},resetDebugForm(){this.initDebugForm()},parseParamValue(l){if(l==="true"||l==="false")return l==="true";if(l==="")return"";{const n=Number(l);if(!isNaN(n)&&isFinite(n)&&l!=="")return n;try{return JSON.parse(l)}catch{return l}}},buildRequestHeaders(l){const n={};let a=null;const o=Object.keys(l).find(f=>f.toLowerCase()==="x-target-url");return o?(a=l[o],delete l[o]):this.targetUrl&&(a=this.targetUrl),a&&(n["X-Target-Url"]=a),n},handleDebugResponse(l){this.debugResponse=l,this.showDebugRawResponse=!1,this.$nextTick(()=>{this.debugResponseKey++})},handleDebugError(l){console.error("Debug request failed:",l);let n="未知错误";if(l.response&&l.response.data){const a=l.response.data;typeof a=="object"&&a!==null&&a.message?n=a.message:l.message&&(n=l.message)}else l.message&&(n=l.message);this.$message.error("调试请求失败: "+n)},async submitDebugRequest(l){const n=this.buildRequestHeaders(l),a=await Vt.debugTrace(l,n);this.handleDebugResponse(a)},async submitDebugClient(){if(!(!this.selectedSpan||!this.originalInputs)){this.debugSubmitting=!0;try{const l={};this.originalInputs.file&&(l.file=this.originalInputs.file),this.debugForm.params.forEach(n=>{if(n.key&&n.key.trim()){const a=n.value?n.value.trim():"";l[n.key]=this.parseParamValue(a)}}),await this.submitDebugRequest(l)}catch(l){this.handleDebugError(l)}finally{this.debugSubmitting=!1}}},async submitDebugChatModel(){if(!(!this.selectedSpan||!this.originalInputs)){this.debugSubmitting=!0;try{const l=JSON.parse(JSON.stringify(this.originalInputs));if(this.debugForm.params.forEach(n=>{if(n.key&&n.key.trim()){const a=n.value?n.value.trim():"";l[n.key]=this.parseParamValue(a)}}),l.messages&&Array.isArray(l.messages)){const n=l.messages.find(o=>o.role==="system");n&&(n.content=this.debugForm.systemContent||"");const a=l.messages.find(o=>o.role==="user");if(a){const o=this.originalInputs.messages.find(d=>d.role==="user");if(o&&Array.isArray(o.content)){const d=[];this.submitImage&&Array.isArray(a.content)&&a.content.forEach(p=>{p.type==="image_url"&&d.push(p)}),this.debugForm.userContent&&this.debugForm.userContent.trim()&&d.push({type:"text",text:this.debugForm.userContent}),a.content=d.length>0?d:this.debugForm.userContent||""}else a.content=this.debugForm.userContent||""}}await this.submitDebugRequest(l)}catch(l){this.handleDebugError(l)}finally{this.debugSubmitting=!1}}},toggleDebugResponseView(){this.showDebugRawResponse=!this.showDebugRawResponse,this.$nextTick(()=>{this.debugResponseKey++})},formatRawJson(l){if(!l)return"";if(typeof l=="string")try{const n=JSON.parse(l);return JSON.stringify(n,null,2)}catch{return l}return JSON.stringify(l,null,2)},extractImagesFromObject(l,n=[],a=""){if(!(!l||typeof l!="object")){for(const[o,f]of Object.entries(l)){const d=a?`${a}.${o}`:o;typeof f=="string"&&f.trim()!==""?(f.startsWith("data:image/")||f.startsWith("/9j/")||f.startsWith("iVBOR")||f.startsWith("R0lGOD"))&&(n.push({path:d,value:f,label:o==="content"&&a?`${a.split(".").pop()}: ${o}`:o}),l[o]="[IMAGE_DATA]"):f&&typeof f=="object"&&!Array.isArray(f)?this.extractImagesFromObject(f,n,d):Array.isArray(f)&&f.forEach((p,y)=>{p&&typeof p=="object"&&this.extractImagesFromObject(p,n,`${d}[${y}]`)})}return n}},renderStructuredContent(l){const n=[];if(!l)return n;try{if(Array.isArray(l))l.forEach((a,o)=>{var f;a&&typeof a=="object"?a.type==="text"&&a.text?n.push({type:"markdown",content:Le(a.text),key:`text-${o}`}):a.type==="image_url"&&((f=a.image_url)!=null&&f.url)?n.push({type:"image",url:a.image_url.url,key:`image-${o}`}):a.image_base64&&a.image_base64.trim()!==""?n.push({type:"image",url:this.formatBase64Image(a.image_base64),key:`base64-image-${o}`}):n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:`json-${o}`}):n.push({type:"markdown",content:Le(String(a)),key:`text-${o}`})});else if(typeof l=="string")n.push({type:"markdown",content:Le(l),key:"text-0"});else if(typeof l=="object")if(l.data&&Array.isArray(l.data.result)){const a=JSON.parse(JSON.stringify(l)),o=[];a.data&&a.data.result&&a.data.result.forEach((f,d)=>{f.image_base64&&f.image_base64.trim()!==""&&(o.push({type:"page",image_base64:f.image_base64,page_num:f.page_num,label:f.page_num!==void 0?`Page ${f.page_num}`:`Result ${d}`}),f.image_base64="[BASE64_IMAGE_DATA]"),f.seals&&Array.isArray(f.seals)&&f.seals.forEach((p,y)=>{p.image_base64&&p.image_base64.trim()!==""&&(o.push({type:"seal",image_base64:p.image_base64,page_num:f.page_num,seal_index:y,seal_value:p.value,label:`Seal: ${p.value||y}`}),p.image_base64="[BASE64_IMAGE_DATA]")})}),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((f,d)=>{n.push({type:"image",url:this.formatBase64Image(f.image_base64),key:`result-image-${d}`,label:f.label})})}else{const a=JSON.parse(JSON.stringify(l)),o=[];this.extractImagesFromObject(a,o),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((f,d)=>{n.push({type:"image",url:this.formatBase64Image(f.value),key:`extracted-image-${d}`,label:f.label})})}else n.push({type:"markdown",content:Le(String(l)),key:"text-0"})}catch(a){console.error("Error rendering content:",a),n.push({type:"markdown",content:Le("Error rendering content"),key:"error-0"})}return n},formatBase64Image(l){return l?l.startsWith("data:image")?l:l.startsWith("/9j/")?`data:image/jpeg;base64,${l}`:l.startsWith("iVBOR")?`data:image/png;base64,${l}`:l.startsWith("R0lGOD")?`data:image/gif;base64,${l}`:`data:image/jpeg;base64,${l}`:""},handleImageClick(l){Fl({options:this.viewerOptions,images:[l]})}}};var Pp=function(){var o;var n=this,a=n._self._c;return a("div",{staticClass:"debug-content"},[n.selectedSpan.type==="CLIENT"||n.selectedSpan.type==="EMBEDDING"?a("div",{staticClass:"debug-client-form"},[a("el-form",{attrs:{model:n.debugForm,"label-width":"60px",size:"small"}},[n._l(n.debugForm.params,function(f,d){return a("div",{key:d,staticClass:"debug-form-row"},[a("el-form-item",{attrs:{label:`${n.$t("debug.paramLabel")} ${d+1}`}},[a("el-row",{attrs:{gutter:10,type:"flex",align:"middle"}},[a("el-col",{attrs:{span:8}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramName")},on:{input:n.handleDebugParamChange},model:{value:f.key,callback:function(p){n.$set(f,"key",p)},expression:"item.key"}})],1),a("el-col",{attrs:{span:14}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramValue")},on:{input:n.handleDebugParamChange},model:{value:f.value,callback:function(p){n.$set(f,"value",p)},expression:"item.value"}})],1),a("el-col",{attrs:{span:2}},[a("el-button",{staticClass:"delete-param-btn",attrs:{type:"danger",icon:"el-icon-delete",size:"small"},on:{click:function(p){return n.removeDebugParam(d)}}})],1)],1)],1)],1)}),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-plus",size:"small"},on:{click:n.addDebugParam}},[n._v(n._s(n.$t("debug.addParam")))]),a("el-button",{attrs:{type:"warning",icon:"el-icon-refresh",size:"small"},on:{click:n.resetDebugForm}},[n._v(n._s(n.$t("debug.reset")))]),a("el-button",{attrs:{type:"success",icon:"el-icon-check",size:"small",loading:n.debugSubmitting},on:{click:n.submitDebugClient}},[n._v(n._s(n.$t("debug.submit")))])],1)],2),n.debugResponse!==null?a("div",{staticClass:"debug-response"},[a("div",{staticClass:"debug-response-header"},[a("span",[n._v(n._s(n.$t("debug.responseResult")))]),a("el-button",{attrs:{type:"text",size:"small"},on:{click:n.toggleDebugResponseView}},[n._v(n._s(n.showDebugRawResponse?n.$t("debug.switchToMarkdown"):n.$t("debug.switchToRaw")))])],1),n.showDebugRawResponse?a("div",{staticClass:"debug-response-raw"},[a("codemirror",{key:`debug-response-${n.selectedSpanId}-${n.debugResponseKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.debugResponse),options:n.cmOptions}})],1):a("div",{staticClass:"debug-response-markdown"},n._l(n.renderStructuredContent(n.debugResponse),function(f){return a("div",{key:f.key,staticClass:"content-element"},[f.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(f.content)}}):f.type==="image"?a("div",{staticClass:"image-content"},[f.label?a("div",{staticClass:"image-label"},[n._v(n._s(f.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:f.url,alt:"content image"},on:{click:function(d){return n.handleImageClick(f.url)}}})]):n._e()])}),0)]):n._e()],1):n._e(),n.selectedSpan.type==="CHAT_MODEL"?a("div",{staticClass:"debug-chat-model-form"},[a("el-form",{attrs:{model:n.debugForm,"label-width":"60px",size:"small"}},[a("el-form-item",{attrs:{label:n.$t("debug.systemPrompt")}},[a("codemirror",{key:`debug-system-${n.selectedSpanId}-${n.debugMarkdownKey}`,ref:"systemContentEditor",staticClass:"code-editor-wrapper markdown-editor",attrs:{options:n.cmOptionsMarkdown},model:{value:n.debugForm.systemContent,callback:function(f){n.$set(n.debugForm,"systemContent",f)},expression:"debugForm.systemContent"}})],1),a("el-form-item",{attrs:{label:n.$t("debug.userPrompt")}},[a("codemirror",{key:`debug-user-${n.selectedSpanId}-${n.debugMarkdownKey}`,ref:"userContentEditor",staticClass:"code-editor-wrapper markdown-editor",attrs:{options:n.cmOptionsMarkdown},model:{value:n.debugForm.userContent,callback:function(f){n.$set(n.debugForm,"userContent",f)},expression:"debugForm.userContent"}})],1),n.selectedSpan.type==="CHAT_MODEL"&&n.hasImageUrl?a("el-form-item",{attrs:{label:n.$t("debug.submitImage")}},[a("el-switch",{attrs:{"active-text":n.$t("debug.yes"),"inactive-text":n.$t("debug.no")},model:{value:n.submitImage,callback:function(f){n.submitImage=f},expression:"submitImage"}})],1):n._e(),n._l(n.debugForm.params,function(f,d){return a("div",{key:d,staticClass:"debug-form-row"},[a("el-form-item",{attrs:{label:`${n.$t("debug.paramLabel")} ${d+1}`}},[a("el-row",{attrs:{gutter:10,type:"flex",align:"middle"}},[a("el-col",{attrs:{span:8}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramName")},on:{input:n.handleDebugParamChange},model:{value:f.key,callback:function(p){n.$set(f,"key",p)},expression:"item.key"}})],1),a("el-col",{attrs:{span:14}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramValue")},on:{input:n.handleDebugParamChange},model:{value:f.value,callback:function(p){n.$set(f,"value",p)},expression:"item.value"}})],1),a("el-col",{attrs:{span:2}},[a("el-button",{staticClass:"delete-param-btn",attrs:{type:"danger",icon:"el-icon-delete",size:"small"},on:{click:function(p){return n.removeDebugParam(d)}}})],1)],1)],1)],1)}),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-plus",size:"small"},on:{click:n.addDebugParam}},[n._v(n._s(n.$t("debug.addParam")))]),a("el-button",{attrs:{type:"warning",icon:"el-icon-refresh",size:"small"},on:{click:n.resetDebugForm}},[n._v(n._s(n.$t("debug.reset")))]),a("el-button",{attrs:{type:"success",icon:"el-icon-check",size:"small",loading:n.debugSubmitting},on:{click:n.submitDebugChatModel}},[n._v(n._s(n.$t("debug.submit")))])],1)],2),n.debugResponse!==null?a("div",{staticClass:"debug-response"},[a("div",{staticClass:"debug-response-header"},[a("span",[n._v(n._s(n.$t("debug.responseResult")))]),a("el-button",{attrs:{type:"text",size:"small"},on:{click:n.toggleDebugResponseView}},[n._v(n._s(n.showDebugRawResponse?n.$t("debug.switchToMarkdown"):n.$t("debug.switchToRaw")))])],1),n.showDebugRawResponse?a("div",{staticClass:"debug-response-raw"},[a("codemirror",{key:`debug-response-${n.selectedSpanId}-${n.debugResponseKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.debugResponse),options:n.cmOptions}})],1):a("div",{staticClass:"debug-response-markdown"},[n.selectedSpan.type==="CHAT_MODEL"&&((o=n.debugResponse)!=null&&o.choices)?a("div",{staticClass:"outputs-section"},n._l(n.debugResponse.choices,function(f,d){return a("div",{key:d,staticClass:"choice-item"},[a("div",{staticClass:"choice-header"},[a("span",[n._v("Choice "+n._s(d))])]),a("div",{staticClass:"choice-content"},[f.message?a("div",[a("div",{staticClass:"message-header"},[a("i",{staticClass:"el-icon-user message-icon"}),a("span",[n._v(n._s(f.message.role))])]),a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(f.message.content),function(p){return a("div",{key:p.key,staticClass:"content-element"},[p.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(p.content)}}):p.type==="image"?a("div",{staticClass:"image-content"},[p.label?a("div",{staticClass:"image-label"},[n._v(n._s(p.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:p.url,alt:"content image"},on:{click:function(y){return n.handleImageClick(p.url)}}})]):n._e()])}),0)]):a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(f),function(p){return a("div",{key:p.key,staticClass:"content-element"},[p.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(p.content)}}):p.type==="image"?a("div",{staticClass:"image-content"},[p.label?a("div",{staticClass:"image-label"},[n._v(n._s(p.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:p.url,alt:"content image"},on:{click:function(y){return n.handleImageClick(p.url)}}})]):n._e()])}),0)])])}),0):a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(n.debugResponse),function(f){return a("div",{key:f.key,staticClass:"content-element"},[f.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(f.content)}}):f.type==="image"?a("div",{staticClass:"image-content"},[f.label?a("div",{staticClass:"image-label"},[n._v(n._s(f.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:f.url,alt:"content image"},on:{click:function(d){return n.handleImageClick(f.url)}}})]):n._e()])}),0)])]):n._e()],1):n._e()])},zp=[],$p=In(Fp,Pp,zp,!1,null,"f192a685");const Bp=$p.exports;(function(l,n){(function(a){a(Wt())})(function(a){function o(D,R,K,de,L,w){this.indented=D,this.column=R,this.type=K,this.info=de,this.align=L,this.prev=w}function f(D,R,K,de){var L=D.indented;return D.context&&D.context.type=="statement"&&K!="statement"&&(L=D.context.indented),D.context=new o(L,R,K,de,null,D.context)}function d(D){var R=D.context.type;return(R==")"||R=="]"||R=="}")&&(D.indented=D.context.indented),D.context=D.context.prev}function p(D,R,K){if(R.prevToken=="variable"||R.prevToken=="type"||/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(D.string.slice(0,K))||R.typeAtEndOfLine&&D.column()==D.indentation())return!0}function y(D){for(;;){if(!D||D.type=="top")return!0;if(D.type=="}"&&D.prev.info!="namespace")return!1;D=D.prev}}a.defineMode("clike",function(D,R){var K=D.indentUnit,de=R.statementIndentUnit||K,L=R.dontAlignCalls,w=R.keywords||{},oe=R.types||{},Te=R.builtin||{},Z=R.blockKeywords||{},ce=R.defKeywords||{},ke=R.atoms||{},_e=R.hooks||{},ft=R.multiLineStrings,we=R.indentStatements!==!1,Me=R.indentSwitch!==!1,Ke=R.namespaceSeparator,ct=R.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,Pt=R.numberStart||/[\d\.]/,ht=R.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,dt=R.isOperatorChar||/[+\-*&%=<>!?|\/]/,gt=R.isIdentifierChar||/[\w\$_\xa1-\uffff]/,Ut=R.isReservedIdentifier||!1,be,kt;function Gt(ye,xe){var pe=ye.next();if(_e[pe]){var Fe=_e[pe](ye,xe);if(Fe!==!1)return Fe}if(pe=='"'||pe=="'")return xe.tokenize=On(pe),xe.tokenize(ye,xe);if(Pt.test(pe)){if(ye.backUp(1),ye.match(ht))return"number";ye.next()}if(ct.test(pe))return be=pe,null;if(pe=="/"){if(ye.eat("*"))return xe.tokenize=Zn,Zn(ye,xe);if(ye.eat("/"))return ye.skipToEnd(),"comment"}if(dt.test(pe)){for(;!ye.match(/^\/[\/*]/,!1)&&ye.eat(dt););return"operator"}if(ye.eatWhile(gt),Ke)for(;ye.match(Ke);)ye.eatWhile(gt);var De=ye.current();return x(w,De)?(x(Z,De)&&(be="newstatement"),x(ce,De)&&(kt=!0),"keyword"):x(oe,De)?"type":x(Te,De)||Ut&&Ut(De)?(x(Z,De)&&(be="newstatement"),"builtin"):x(ke,De)?"atom":"variable"}function On(ye){return function(xe,pe){for(var Fe=!1,De,zt=!1;(De=xe.next())!=null;){if(De==ye&&!Fe){zt=!0;break}Fe=!Fe&&De=="\\"}return(zt||!(Fe||ft))&&(pe.tokenize=null),"string"}}function Zn(ye,xe){for(var pe=!1,Fe;Fe=ye.next();){if(Fe=="/"&&pe){xe.tokenize=null;break}pe=Fe=="*"}return"comment"}function wr(ye,xe){R.typeFirstDefinitions&&ye.eol()&&y(xe.context)&&(xe.typeAtEndOfLine=p(ye,xe,ye.pos))}return{startState:function(ye){return{tokenize:null,context:new o((ye||0)-K,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(ye,xe){var pe=xe.context;if(ye.sol()&&(pe.align==null&&(pe.align=!1),xe.indented=ye.indentation(),xe.startOfLine=!0),ye.eatSpace())return wr(ye,xe),null;be=kt=null;var Fe=(xe.tokenize||Gt)(ye,xe);if(Fe=="comment"||Fe=="meta")return Fe;if(pe.align==null&&(pe.align=!0),be==";"||be==":"||be==","&&ye.match(/^\s*(?:\/\/.*)?$/,!1))for(;xe.context.type=="statement";)d(xe);else if(be=="{")f(xe,ye.column(),"}");else if(be=="[")f(xe,ye.column(),"]");else if(be=="(")f(xe,ye.column(),")");else if(be=="}"){for(;pe.type=="statement";)pe=d(xe);for(pe.type=="}"&&(pe=d(xe));pe.type=="statement";)pe=d(xe)}else be==pe.type?d(xe):we&&((pe.type=="}"||pe.type=="top")&&be!=";"||pe.type=="statement"&&be=="newstatement")&&f(xe,ye.column(),"statement",ye.current());if(Fe=="variable"&&(xe.prevToken=="def"||R.typeFirstDefinitions&&p(ye,xe,ye.start)&&y(xe.context)&&ye.match(/^\s*\(/,!1))&&(Fe="def"),_e.token){var De=_e.token(ye,xe,Fe);De!==void 0&&(Fe=De)}return Fe=="def"&&R.styleDefs===!1&&(Fe="variable"),xe.startOfLine=!1,xe.prevToken=kt?"def":Fe||be,wr(ye,xe),Fe},indent:function(ye,xe){if(ye.tokenize!=Gt&&ye.tokenize!=null||ye.typeAtEndOfLine&&y(ye.context))return a.Pass;var pe=ye.context,Fe=xe&&xe.charAt(0),De=Fe==pe.type;if(pe.type=="statement"&&Fe=="}"&&(pe=pe.prev),R.dontIndentStatements)for(;pe.type=="statement"&&R.dontIndentStatements.test(pe.info);)pe=pe.prev;if(_e.indent){var zt=_e.indent(ye,pe,xe,K);if(typeof zt=="number")return zt}var Zt=pe.prev&&pe.prev.info=="switch";if(R.allmanIndentation&&/[{(]/.test(Fe)){for(;pe.type!="top"&&pe.type!="}";)pe=pe.prev;return pe.indented}return pe.type=="statement"?pe.indented+(Fe=="{"?0:de):pe.align&&(!L||pe.type!=")")?pe.column+(De?0:1):pe.type==")"&&!De?pe.indented+de:pe.indented+(De?0:K)+(!De&&Zt&&!/^(?:case|default)\b/.test(xe)?K:0)},electricInput:Me?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});function m(D){for(var R={},K=D.split(" "),de=0;de<K.length;++de)R[K[de]]=!0;return R}function x(D,R){return typeof D=="function"?D(R):D.propertyIsEnumerable(R)}var S="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",A="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",E="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",B=m("int long char short double float unsigned signed void bool"),U=m("SEL instancetype id Class Protocol BOOL");function F(D){return x(B,D)||/.+_t$/.test(D)}function N(D){return F(D)||x(U,D)}var O="case do else for if switch while struct enum union",$="struct enum union";function X(D,R){if(!R.startOfLine)return!1;for(var K,de=null;K=D.peek();){if(K=="\\"&&D.match(/^.$/)){de=X;break}else if(K=="/"&&D.match(/^\/[\/\*]/,!1))break;D.next()}return R.tokenize=de,"meta"}function ne(D,R){return R.prevToken=="type"?"type":!1}function ue(D){return!D||D.length<2||D[0]!="_"?!1:D[1]=="_"||D[1]!==D[1].toLowerCase()}function se(D){return D.eatWhile(/[\w\.']/),"number"}function he(D,R){if(D.backUp(1),D.match(/^(?:R|u8R|uR|UR|LR)/)){var K=D.match(/^"([^\s\\()]{0,16})\(/);return K?(R.cpp11RawStringDelim=K[1],R.tokenize=ie,ie(D,R)):!1}return D.match(/^(?:u8|u|U|L)/)?D.match(/^["']/,!1)?"string":!1:(D.next(),!1)}function Oe(D){var R=/(\w+)::~?(\w+)$/.exec(D);return R&&R[1]==R[2]}function Re(D,R){for(var K;(K=D.next())!=null;)if(K=='"'&&!D.eat('"')){R.tokenize=null;break}return"string"}function ie(D,R){var K=R.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&"),de=D.match(new RegExp(".*?\\)"+K+'"'));return de?R.tokenize=null:D.skipToEnd(),"string"}function ze(D,R){typeof D=="string"&&(D=[D]);var K=[];function de(w){if(w)for(var oe in w)w.hasOwnProperty(oe)&&K.push(oe)}de(R.keywords),de(R.types),de(R.builtin),de(R.atoms),K.length&&(R.helperType=D[0],a.registerHelper("hintWords",D[0],K));for(var L=0;L<D.length;++L)a.defineMIME(D[L],R)}ze(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:m(S),types:F,blockKeywords:m(O),defKeywords:m($),typeFirstDefinitions:!0,atoms:m("NULL true false"),isReservedIdentifier:ue,hooks:{"#":X,"*":ne},modeProps:{fold:["brace","include"]}}),ze(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:m(S+" "+A),types:F,blockKeywords:m(O+" class try catch"),defKeywords:m($+" class namespace"),typeFirstDefinitions:!0,atoms:m("true false NULL nullptr"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,isReservedIdentifier:ue,hooks:{"#":X,"*":ne,u:he,U:he,L:he,R:he,0:se,1:se,2:se,3:se,4:se,5:se,6:se,7:se,8:se,9:se,token:function(D,R,K){if(K=="variable"&&D.peek()=="("&&(R.prevToken==";"||R.prevToken==null||R.prevToken=="}")&&Oe(D.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),ze("text/x-java",{name:"clike",keywords:m("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:m("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:m("catch class do else finally for if switch try while"),defKeywords:m("class interface enum @interface"),typeFirstDefinitions:!0,atoms:m("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(D){return D.match("interface",!1)?!1:(D.eatWhile(/[\w\$_]/),"meta")},'"':function(D,R){return D.match(/""$/)?(R.tokenize=W,R.tokenize(D,R)):!1}},modeProps:{fold:["brace","import"]}}),ze("text/x-csharp",{name:"clike",keywords:m("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:m("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:m("catch class do else finally for foreach if struct switch try while"),defKeywords:m("class interface namespace record struct var"),typeFirstDefinitions:!0,atoms:m("true false null"),hooks:{"@":function(D,R){return D.eat('"')?(R.tokenize=Re,Re(D,R)):(D.eatWhile(/[\w\$_]/),"meta")}}});function W(D,R){for(var K=!1;!D.eol();){if(!K&&D.match('"""')){R.tokenize=null;break}K=D.next()=="\\"&&!K}return"string"}function Q(D){return function(R,K){for(var de;de=R.next();)if(de=="*"&&R.eat("/"))if(D==1){K.tokenize=null;break}else return K.tokenize=Q(D-1),K.tokenize(R,K);else if(de=="/"&&R.eat("*"))return K.tokenize=Q(D+1),K.tokenize(R,K);return"comment"}}ze("text/x-scala",{name:"clike",keywords:m("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:m("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:m("catch class enum do else finally for forSome if match switch try while"),defKeywords:m("class enum def object package trait type val var"),atoms:m("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(D){return D.eatWhile(/[\w\$_]/),"meta"},'"':function(D,R){return D.match('""')?(R.tokenize=W,R.tokenize(D,R)):!1},"'":function(D){return D.match(/^(\\[^'\s]+|[^\\'])'/)?"string-2":(D.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},"=":function(D,R){var K=R.context;return K.type=="}"&&K.align&&D.eat(">")?(R.context=new o(K.indented,K.column,K.type,K.info,null,K.prev),"operator"):!1},"/":function(D,R){return D.eat("*")?(R.tokenize=Q(1),R.tokenize(D,R)):!1}},modeProps:{closeBrackets:{pairs:'()[]{}""',triples:'"'}}});function k(D){return function(R,K){for(var de=!1,L,w=!1;!R.eol();){if(!D&&!de&&R.match('"')){w=!0;break}if(D&&R.match('"""')){w=!0;break}L=R.next(),!de&&L=="$"&&R.match("{")&&R.skipTo("}"),de=!de&&L=="\\"&&!D}return(w||!D)&&(K.tokenize=null),"string"}}ze("text/x-kotlin",{name:"clike",keywords:m("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:m("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:m("catch class do else finally for if where try while enum"),defKeywords:m("class val var object interface fun"),atoms:m("true false null this"),hooks:{"@":function(D){return D.eatWhile(/[\w\$_]/),"meta"},"*":function(D,R){return R.prevToken=="."?"variable":"operator"},'"':function(D,R){return R.tokenize=k(D.match('""')),R.tokenize(D,R)},"/":function(D,R){return D.eat("*")?(R.tokenize=Q(1),R.tokenize(D,R)):!1},indent:function(D,R,K,de){var L=K&&K.charAt(0);if((D.prevToken=="}"||D.prevToken==")")&&K=="")return D.indented;if(D.prevToken=="operator"&&K!="}"&&D.context.type!="}"||D.prevToken=="variable"&&L=="."||(D.prevToken=="}"||D.prevToken==")")&&L==".")return de*2+R.indented;if(R.align&&R.type=="}")return R.indented+(D.context.type==(K||"").charAt(0)?0:de)}},modeProps:{closeBrackets:{triples:'"'}}}),ze(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:m("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:m("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:m("for while do if else struct"),builtin:m("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:m("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:{"#":X},modeProps:{fold:["brace","include"]}}),ze("text/x-nesc",{name:"clike",keywords:m(S+" 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:F,blockKeywords:m(O),atoms:m("null true false"),hooks:{"#":X},modeProps:{fold:["brace","include"]}}),ze("text/x-objectivec",{name:"clike",keywords:m(S+" "+E),types:N,builtin:m(H),blockKeywords:m(O+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:m($+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:m("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:ue,hooks:{"#":X,"*":ne},modeProps:{fold:["brace","include"]}}),ze("text/x-objectivec++",{name:"clike",keywords:m(S+" "+E+" "+A),types:N,builtin:m(H),blockKeywords:m(O+" @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),defKeywords:m($+" @interface @implementation @protocol @class class namespace"),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:m("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:ue,hooks:{"#":X,"*":ne,u:he,U:he,L:he,R:he,0:se,1:se,2:se,3:se,4:se,5:se,6:se,7:se,8:se,9:se,token:function(D,R,K){if(K=="variable"&&D.peek()=="("&&(R.prevToken==";"||R.prevToken==null||R.prevToken=="}")&&Oe(D.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),ze("text/x-squirrel",{name:"clike",keywords:m("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:F,blockKeywords:m("case catch class else for foreach if switch try while"),defKeywords:m("function local class"),typeFirstDefinitions:!0,atoms:m("true false null"),hooks:{"#":X},modeProps:{fold:["brace","include"]}});var J=null;function G(D){return function(R,K){for(var de=!1,L,w=!1;!R.eol();){if(!de&&R.match('"')&&(D=="single"||R.match('""'))){w=!0;break}if(!de&&R.match("``")){J=G(D),w=!0;break}L=R.next(),de=D=="single"&&!de&&L=="\\"}return w&&(K.tokenize=null),"string"}}ze("text/x-ceylon",{name:"clike",keywords:m("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(D){var R=D.charAt(0);return R===R.toUpperCase()&&R!==R.toLowerCase()},blockKeywords:m("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:m("class dynamic function interface module object package value"),builtin:m("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:m("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(D){return D.eatWhile(/[\w\$_]/),"meta"},'"':function(D,R){return R.tokenize=G(D.match('""')?"triple":"single"),R.tokenize(D,R)},"`":function(D,R){return!J||!D.match("`")?!1:(R.tokenize=J,J=null,R.tokenize(D,R))},"'":function(D){return D.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(D,R,K){if((K=="variable"||K=="type")&&R.prevToken==".")return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})})})(),Le.setOptions({breaks:!0});const Hp={name:"TraceDetailDrawer",components:{TraceSpanTree:Ua,DebugTab:Bp,codemirror:co.codemirror},props:{visible:{type:Boolean,default:!1},currentTraceId:{type:String,default:null},traceInfo:{type:Object,default:()=>({})},spans:{type:Array,default:()=>[]},filteredSpans:{type:Array,default:()=>[]},selectedSpanId:{type:String,default:null},selectedSpan:{type:Object,default:null},loading:{type:Boolean,default:!1},spanHasNextPage:{type:Boolean,default:!1},spanLoadMoreLoading:{type:Boolean,default:!1},spanHasEvents:{type:Boolean,default:null},spanPageSize:{type:Number,default:100},traceStatusList:{type:Array,default:()=>[]}},data(){return{localVisible:this.visible,spanSearchQuery:"",activeTab:"io",activeCollapse:["inputs","outputs"],messageCollapse:[],rawIoCollapse:["rawInputs","rawOutputs"],rawInputsKey:0,rawOutputsKey:0,eventsCollapse:[],eventsKey:0,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,autoCloseBrackets:!0,indentUnit:4,styleActiveLine:!0},viewerOptions:{inline:!1,button:!0,navbar:!0,title:!0,toolbar:!0,tooltip:!0,movable:!0,zoomable:!0,rotatable:!0,scalable:!0,transition:!0,fullscreen:!0,keyboard:!0,zIndex:9999}}},computed:{drawerTitle(){let l=this.traceInfo.trace_name;return l||(l=this.traceInfo.trace_id),l?this.$t("trace.traceDetail")+": "+l:this.$t("trace.traceDetail")},traceStartTime(){return this.spans.length===0?0:Math.min(...this.spans.map(l=>l.start_time_unix_nano))},traceEndTime(){return this.spans.length===0?0:Math.max(...this.spans.map(l=>l.end_time_unix_nano))},hasInputs(){var l,n;return((n=(l=this.selectedSpan)==null?void 0:l.parsedContent)==null?void 0:n.inputs)!==void 0},hasOutputs(){var l,n;return((n=(l=this.selectedSpan)==null?void 0:l.parsedContent)==null?void 0:n.outputs)!==void 0},showIOTab(){var o,f,d;if(!this.selectedSpan||!(this.selectedSpan.type==="CLIENT"||this.selectedSpan.type==="EMBEDDING"||this.selectedSpan.type==="CHAT_MODEL"))return!1;const n=(d=(f=(o=this.selectedSpan)==null?void 0:o.parsedContent)==null?void 0:f.attributes)==null?void 0:d["langsword.spanInputs"];return n!=null&&n!==""},attributesData(){var n,a;if(!((a=(n=this.selectedSpan)==null?void 0:n.parsedContent)!=null&&a.attributes))return[];const l=["http.response.body.size","http.request.body.size","http.request.header.Content-Length","http.response.header.content-length"];return Object.entries(this.selectedSpan.parsedContent.attributes).filter(([o])=>!o.startsWith("langsword.span")).map(([o,f])=>{let d;return l.includes(o)?d=this.formatBytes(f):typeof f=="string"?d=f:d=JSON.stringify(f,null,2),{key:o,value:d}})},rawInputs(){var l,n,a;return(a=(n=(l=this.selectedSpan)==null?void 0:l.parsedContent)==null?void 0:n.attributes)==null?void 0:a["langsword.spanInputs"]},rawOutputs(){var l,n,a;return(a=(n=(l=this.selectedSpan)==null?void 0:l.parsedContent)==null?void 0:n.attributes)==null?void 0:a["langsword.spanOutputs"]},hasEvents(){var n,a,o;if(((n=this.selectedSpan)==null?void 0:n.has_events)!==void 0)return this.selectedSpan.has_events===!0;const l=(o=(a=this.selectedSpan)==null?void 0:a.parsedContent)==null?void 0:o.events;return l&&Array.isArray(l)&&l.length>0},spanEvents(){var n,a;const l=(a=(n=this.selectedSpan)==null?void 0:n.parsedContent)==null?void 0:a.events;return!l||!Array.isArray(l)?[]:l},showDebugTab(){var o,f,d,p,y;if(!this.selectedSpan||!(this.selectedSpan.type==="CLIENT"||this.selectedSpan.type==="EMBEDDING"||this.selectedSpan.type==="CHAT_MODEL"))return!1;const n=(d=(f=(o=this.selectedSpan)==null?void 0:o.parsedContent)==null?void 0:f.attributes)==null?void 0:d["langsword.spanInputs"];if(!(n!=null&&n!==""))return!1;if(this.selectedSpan.type==="CLIENT"||this.selectedSpan.type==="EMBEDDING"){const m=(y=(p=this.selectedSpan)==null?void 0:p.parsedContent)==null?void 0:y.inputs;if(!m){const x=this.rawInputs;if(x)try{const S=typeof x=="string"?JSON.parse(x):x;return S&&S.file&&(S.file.filename||S.file.content)}catch{return!1}return!1}return m&&m.file&&(m.file.filename||m.file.content)}return this.selectedSpan.type==="CHAT_MODEL"}},watch:{visible(l){this.localVisible=l,l||(this.spanSearchQuery="")},localVisible(l){this.$emit("update:visible",l)},activeTab(l){l==="raw"&&this.$nextTick(()=>{this.rawInputsKey++,this.rawOutputsKey++}),l==="events"&&this.$nextTick(()=>{this.eventsKey++})},selectedSpan(){var o;if(!this.selectedSpan)return;const l=this.selectedSpan.has_events===!0||((o=this.selectedSpan.parsedContent)==null?void 0:o.events)&&Array.isArray(this.selectedSpan.parsedContent.events)&&this.selectedSpan.parsedContent.events.length>0,n=[];this.showIOTab&&n.push("io","raw"),this.showDebugTab&&n.push("debug"),n.push("attributes"),l&&n.push("events");let a="attributes";this.showIOTab&&(a="io"),n.includes(a)?this.activeTab=a:this.activeTab="attributes",this.$nextTick(()=>{this.updateCollapseStates(),this.activeTab==="raw"&&(this.rawInputsKey++,this.rawOutputsKey++),this.activeTab==="events"&&this.eventsKey++})}},methods:{formatBytes(l){const n=typeof l=="number"?l:Number(l);if(!Number.isFinite(n))return typeof l=="string"?l:JSON.stringify(l,null,2);const a=n<0?"-":"";let o=Math.abs(n);const f=["B","K","M","G","T","P","E"];if(o<1024)return`${a}${Math.round(o)}B`;let d=0;for(;o>=1024&&d<f.length-1;)o/=1024,d++;return`${a}${o.toFixed(2)}${f[d]}`},handleClose(l){this.$emit("close"),l&&typeof l=="function"&&l()},handleSpanSearch(){this.$emit("span-search",this.spanSearchQuery)},handleHasEventsChange(l){this.$emit("update:span-has-events",l?!0:null)},handleSpanSelect(l){this.$emit("span-select",l),this.$nextTick(()=>{this.updateCollapseStates()})},updateCollapseStates(){var a,o,f,d,p;this.activeCollapse=["inputs","outputs"],(f=(o=(a=this.selectedSpan)==null?void 0:a.parsedContent)==null?void 0:o.inputs)!=null&&f.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((y,m)=>`message-${m}`):this.messageCollapse=[],this.rawIoCollapse=["rawInputs","rawOutputs"];const l=(p=(d=this.selectedSpan)==null?void 0:d.parsedContent)==null?void 0:p.events;l&&Array.isArray(l)&&l.length>0?this.eventsCollapse=l.map((y,m)=>`event-${m}`):this.eventsCollapse=[]},parseContentData(l){const n={attributes:l.attributes||{},events:l.events||[],status:l.status||{}};if(l.inputs&&(n.inputs=l.inputs),l.outputs&&(n.outputs=l.outputs),n.attributes){const a=n.attributes["langsword.spanInputs"],o=n.attributes["langsword.spanOutputs"];if(a)try{n.inputs=typeof a=="string"?JSON.parse(a):a}catch{try{const d=a.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.inputs=JSON.parse(d)}catch{n.inputs=a}}if(o)try{n.outputs=typeof o=="string"?JSON.parse(o):o}catch{try{const d=o.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.outputs=JSON.parse(d)}catch{n.outputs=o}}}return n},getStatusType(l){if(!l)return"info";const n=l.toUpperCase();return n==="OK"||n==="SUCCESS"?"success":n==="ERROR"||n==="FAILED"?"danger":n==="WARNING"||n==="WARN"?"warning":"info"},getStatusLabel(l){if(!l)return"-";const n=this.traceStatusList.find(a=>a.value===l);return n?n.label:l},formatNanoDuration(l){if(!l)return"-";const n=l/1e6;return n<1e3?`${n.toFixed(2)}ms`:n<6e4?`${(n/1e3).toFixed(2)}s`:`${(n/6e4).toFixed(2)}min`},formatTimestamp(l){if(!l)return"-";const n=typeof l=="string"?parseInt(l,10):l,a=new Date(n);return isNaN(a.getTime())?"-":a.toLocaleString("zh-CN")},formatEventTimestamp(l){if(!l)return"-";const n=l/1e6,a=new Date(n);return isNaN(a.getTime())?"-":a.toLocaleString("zh-CN")},getEventAttributesData(l){return!l||!l.attributes?[]:Object.entries(l.attributes).map(([n,a])=>({key:n,value:typeof a=="string"?a:JSON.stringify(a,null,2)}))},getOtherEventAttributes(l){if(!l||!l.attributes)return[];const n=["exception.type","exception.message","exception.stacktrace"];return Object.entries(l.attributes).filter(([a])=>!n.includes(a)).map(([a,o])=>({key:a,value:typeof o=="string"?o:JSON.stringify(o,null,2)}))},formatRawJson(l){if(!l)return"";if(typeof l=="string")try{const n=JSON.parse(l);return JSON.stringify(n,null,2)}catch{return l}return JSON.stringify(l,null,2)},getMessageIcon(l){return{user:"el-icon-user",assistant:"el-icon-service",system:"el-icon-setting"}[l]||"el-icon-document"},extractImagesFromObject(l,n=[],a=""){if(!(!l||typeof l!="object")){for(const[o,f]of Object.entries(l)){const d=a?`${a}.${o}`:o;typeof f=="string"&&f.trim()!==""?(f.startsWith("data:image/")||f.startsWith("/9j/")||f.startsWith("iVBOR")||f.startsWith("R0lGOD"))&&(n.push({path:d,value:f,label:o==="content"&&a?`${a.split(".").pop()}: ${o}`:o}),l[o]="[IMAGE_DATA]"):f&&typeof f=="object"&&!Array.isArray(f)?this.extractImagesFromObject(f,n,d):Array.isArray(f)&&f.forEach((p,y)=>{p&&typeof p=="object"&&this.extractImagesFromObject(p,n,`${d}[${y}]`)})}return n}},renderStructuredContent(l){const n=[];if(!l)return n;try{if(Array.isArray(l))l.forEach((a,o)=>{var f;a&&typeof a=="object"?a.type==="text"&&a.text?n.push({type:"markdown",content:Le(a.text),key:`text-${o}`}):a.type==="image_url"&&((f=a.image_url)!=null&&f.url)?n.push({type:"image",url:a.image_url.url,key:`image-${o}`}):a.image_base64&&a.image_base64.trim()!==""?n.push({type:"image",url:this.formatBase64Image(a.image_base64),key:`base64-image-${o}`}):n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:`json-${o}`}):n.push({type:"markdown",content:Le(String(a)),key:`text-${o}`})});else if(typeof l=="string")n.push({type:"markdown",content:Le(l),key:"text-0"});else if(typeof l=="object")if(l.data&&Array.isArray(l.data.result)){const a=JSON.parse(JSON.stringify(l)),o=[];a.data&&a.data.result&&a.data.result.forEach((f,d)=>{f.image_base64&&f.image_base64.trim()!==""&&(o.push({type:"page",image_base64:f.image_base64,page_num:f.page_num,label:f.page_num!==void 0?`Page ${f.page_num}`:`Result ${d}`}),f.image_base64="[BASE64_IMAGE_DATA]"),f.seals&&Array.isArray(f.seals)&&f.seals.forEach((p,y)=>{p.image_base64&&p.image_base64.trim()!==""&&(o.push({type:"seal",image_base64:p.image_base64,page_num:f.page_num,seal_index:y,seal_value:p.value,label:`Seal: ${p.value||y}`}),p.image_base64="[BASE64_IMAGE_DATA]")})}),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((f,d)=>{n.push({type:"image",url:this.formatBase64Image(f.image_base64),key:`result-image-${d}`,label:f.label})})}else{const a=JSON.parse(JSON.stringify(l)),o=[];this.extractImagesFromObject(a,o),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((f,d)=>{n.push({type:"image",url:this.formatBase64Image(f.value),key:`extracted-image-${d}`,label:f.label})})}else n.push({type:"markdown",content:Le(String(l)),key:"text-0"})}catch(a){console.error("Error rendering content:",a),n.push({type:"markdown",content:Le("Error rendering content"),key:"error-0"})}return n},formatBase64Image(l){return l?l.startsWith("data:image")?l:l.startsWith("/9j/")?`data:image/jpeg;base64,${l}`:l.startsWith("iVBOR")?`data:image/png;base64,${l}`:l.startsWith("R0lGOD")?`data:image/gif;base64,${l}`:`data:image/jpeg;base64,${l}`:""},handleImageClick(l){Fl({options:this.viewerOptions,images:[l]})}}};var Wp=function(){var o,f,d,p,y,m;var n=this,a=n._self._c;return a("el-drawer",{attrs:{visible:n.localVisible,"with-header":!0,title:n.drawerTitle,size:"90%",direction:"rtl","before-close":n.handleClose},on:{"update:visible":function(x){n.localVisible=x}}},[n.currentTraceId?a("div",{directives:[{name:"loading",rawName:"v-loading",value:n.loading,expression:"loading"}],staticClass:"trace-detail-content",attrs:{"element-loading-text":"加载中..."}},[a("div",{staticClass:"trace-info-section"},[a("el-descriptions",{attrs:{column:3,border:""}},[a("el-descriptions-item",{attrs:{label:n.$t("trace.traceId")}},[n._v(n._s(n.traceInfo.trace_id))]),a("el-descriptions-item",{attrs:{label:n.$t("trace.status")}},[a("el-tag",{attrs:{type:n.getStatusType(n.traceInfo.status),size:"mini"}},[n._v(" "+n._s(n.getStatusLabel(n.traceInfo.status))+" ")])],1),a("el-descriptions-item",{attrs:{label:n.$t("trace.executionTime")}},[n._v(" "+n._s(n.formatNanoDuration(n.traceInfo.execution_time_ms))+" ")]),a("el-descriptions-item",{attrs:{label:n.$t("trace.timeCreated")}},[n._v(" "+n._s(n.formatTimestamp(n.traceInfo.timestamp_ms))+" ")]),a("el-descriptions-item",{attrs:{label:n.$t("trace.experimentId")}},[n._v(n._s(n.traceInfo.experiment_id))]),a("el-descriptions-item",{attrs:{label:n.$t("trace.traceType")}},[a("el-tag",{attrs:{size:"mini",type:"info"}},[n._v(n._s(n.traceInfo.trace_type||"-"))])],1),a("el-descriptions-item",{attrs:{label:n.$t("trace.traceName"),span:2}},[n._v(" "+n._s(n.traceInfo.trace_name||"-")+" ")])],1)],1),a("el-divider"),a("el-row",{attrs:{gutter:20}},[a("el-col",{staticClass:"span-tree-col",attrs:{span:8}},[a("el-card",[a("div",{staticClass:"span-search-header",attrs:{slot:"header"},slot:"header"},[a("el-input",{staticClass:"span-search-input",attrs:{placeholder:n.$t("span.searchTree"),"prefix-icon":"el-icon-search",size:"small",clearable:""},on:{input:n.handleSpanSearch},model:{value:n.spanSearchQuery,callback:function(x){n.spanSearchQuery=x},expression:"spanSearchQuery"}}),a("el-checkbox",{attrs:{value:n.spanHasEvents===!0,size:"small"},on:{change:n.handleHasEventsChange}},[n._v(" "+n._s(n.$t("span.hasEvents"))+" ")])],1),a("TraceSpanTree",{attrs:{spans:n.filteredSpans,"selected-span-id":n.selectedSpanId,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"span-select":n.handleSpanSelect}}),n.spanHasNextPage?a("div",{staticClass:"span-load-more"},[a("el-button",{attrs:{type:"primary",size:"mini",loading:n.spanLoadMoreLoading},on:{click:function(x){return n.$emit("span-load-more")}}},[n._v(" 加载更多 ")]),a("el-select",{staticClass:"span-page-size-select",attrs:{value:n.spanPageSize,size:"mini"},on:{input:function(x){return n.$emit("update:span-page-size",x)}}},[a("el-option",{attrs:{label:5e3,value:5e3}}),a("el-option",{attrs:{label:1e4,value:1e4}}),a("el-option",{attrs:{label:2e4,value:2e4}}),a("el-option",{attrs:{label:5e4,value:5e4}})],1)],1):n._e()],1)],1),a("el-col",{staticClass:"span-detail-col",attrs:{span:16}},[a("el-card",[n.selectedSpan?a("div",{staticClass:"span-detail-content"},[a("el-tabs",{key:`tabs-${n.selectedSpanId}`,model:{value:n.activeTab,callback:function(x){n.activeTab=x},expression:"activeTab"}},[n.showIOTab?a("el-tab-pane",{attrs:{label:`${n.$t("trace.inputs")} / ${n.$t("trace.outputs")}`,name:"io"}},[a("div",{staticClass:"io-content"},[n.hasInputs?a("div",{staticClass:"io-section"},[a("el-collapse",{model:{value:n.activeCollapse,callback:function(x){n.activeCollapse=x},expression:"activeCollapse"}},[a("el-collapse-item",{attrs:{title:n.$t("trace.inputs"),name:"inputs"}},[(f=(o=n.selectedSpan.parsedContent)==null?void 0:o.inputs)!=null&&f.messages?a("div",{staticClass:"messages-section"},n._l(n.selectedSpan.parsedContent.inputs.messages,function(x,S){return a("div",{key:S,staticClass:"message-item"},[a("el-collapse",{model:{value:n.messageCollapse,callback:function(A){n.messageCollapse=A},expression:"messageCollapse"}},[a("el-collapse-item",{attrs:{name:`message-${S}`}},[a("template",{slot:"title"},[a("i",{staticClass:"message-icon",class:n.getMessageIcon(x.role)}),a("span",{staticClass:"message-role"},[n._v(n._s(x.role))])]),a("div",{staticClass:"message-content"},[a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(x.content),function(A){return a("div",{key:A.key,staticClass:"content-element"},[A.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(A.content)}}):A.type==="image"?a("div",{staticClass:"image-content"},[A.label?a("div",{staticClass:"image-label"},[n._v(n._s(A.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:A.url,alt:"content image"},on:{click:function(E){return n.handleImageClick(A.url)}}})]):n._e()])}),0)])],2)],1)],1)}),0):(d=n.selectedSpan.parsedContent)!=null&&d.inputs?a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(n.selectedSpan.parsedContent.inputs),function(x){return a("div",{key:x.key,staticClass:"content-element"},[x.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(x.content)}}):x.type==="image"?a("div",{staticClass:"image-content"},[x.label?a("div",{staticClass:"image-label"},[n._v(n._s(x.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:x.url,alt:"content image"},on:{click:function(S){return n.handleImageClick(x.url)}}})]):n._e()])}),0):a("div",{staticClass:"empty-content"},[a("el-empty",{attrs:{description:n.$t("trace.noInputs"),"image-size":80}})],1)])],1)],1):n._e(),n.hasOutputs?a("div",{staticClass:"io-section"},[a("el-collapse",{model:{value:n.activeCollapse,callback:function(x){n.activeCollapse=x},expression:"activeCollapse"}},[a("el-collapse-item",{attrs:{title:n.$t("trace.outputs"),name:"outputs"}},[(y=(p=n.selectedSpan.parsedContent)==null?void 0:p.outputs)!=null&&y.choices?a("div",{staticClass:"outputs-section"},n._l(n.selectedSpan.parsedContent.outputs.choices,function(x,S){return a("div",{key:S,staticClass:"choice-item"},[a("div",{staticClass:"choice-header"},[a("span",[n._v("Choice "+n._s(S))])]),a("div",{staticClass:"choice-content"},[x.message?a("div",[a("div",{staticClass:"message-header"},[a("i",{staticClass:"el-icon-user message-icon"}),a("span",[n._v(n._s(x.message.role))])]),a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(x.message.content),function(A){return a("div",{key:A.key,staticClass:"content-element"},[A.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(A.content)}}):A.type==="image"?a("div",{staticClass:"image-content"},[A.label?a("div",{staticClass:"image-label"},[n._v(n._s(A.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:A.url,alt:"content image"},on:{click:function(E){return n.handleImageClick(A.url)}}})]):n._e()])}),0)]):a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(x),function(A){return a("div",{key:A.key,staticClass:"content-element"},[A.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(A.content)}}):A.type==="image"?a("div",{staticClass:"image-content"},[A.label?a("div",{staticClass:"image-label"},[n._v(n._s(A.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:A.url,alt:"content image"},on:{click:function(E){return n.handleImageClick(A.url)}}})]):n._e()])}),0)])])}),0):(m=n.selectedSpan.parsedContent)!=null&&m.outputs?a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(n.selectedSpan.parsedContent.outputs),function(x){return a("div",{key:x.key,staticClass:"content-element"},[x.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(x.content)}}):x.type==="image"?a("div",{staticClass:"image-content"},[x.label?a("div",{staticClass:"image-label"},[n._v(n._s(x.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:x.url,alt:"content image"},on:{click:function(S){return n.handleImageClick(x.url)}}})]):n._e()])}),0):a("div",{staticClass:"empty-content"},[a("el-empty",{attrs:{description:n.$t("trace.noOutputs"),"image-size":80}})],1)])],1)],1):n._e(),!n.hasInputs&&!n.hasOutputs?a("div",{staticClass:"empty-io"},[a("el-empty",{attrs:{description:n.$t("trace.noIoData")}})],1):n._e()])]):n._e(),a("el-tab-pane",{attrs:{label:n.$t("trace.attributes"),name:"attributes"}},[a("el-table",{staticClass:"attributes-table",attrs:{data:n.attributesData,border:"",stripe:""}},[a("el-table-column",{attrs:{prop:"key",label:n.$t("trace.key"),width:"250"},scopedSlots:n._u([{key:"default",fn:function(x){return[a("el-tooltip",{attrs:{content:x.row.key,placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[a("span",{staticClass:"attribute-key"},[n._v(n._s(x.row.key))])])]}}],null,!1,688878823)}),a("el-table-column",{attrs:{prop:"value",label:n.$t("trace.value")},scopedSlots:n._u([{key:"default",fn:function(x){return[a("el-tooltip",{attrs:{placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[a("div",{staticClass:"attribute-tooltip-content",attrs:{slot:"content"},slot:"content"},[n._v(n._s(x.row.value))]),a("div",{staticClass:"attribute-value"},[n._v(n._s(x.row.value))])])]}}],null,!1,4281519148)})],1)],1),n.showIOTab?a("el-tab-pane",{attrs:{label:n.$t("trace.rawInputsOutputs"),name:"raw"}},[n.activeTab==="raw"?a("div",{staticClass:"raw-io-content"},[n.rawInputs?a("div",{staticClass:"raw-io-section"},[a("el-collapse",{model:{value:n.rawIoCollapse,callback:function(x){n.rawIoCollapse=x},expression:"rawIoCollapse"}},[a("el-collapse-item",{attrs:{title:n.$t("trace.rawInputs"),name:"rawInputs"}},[a("codemirror",{key:`raw-inputs-${n.selectedSpanId}-${n.rawInputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.rawInputs),options:n.cmOptions}})],1)],1)],1):n._e(),n.rawOutputs?a("div",{staticClass:"raw-io-section"},[a("el-collapse",{model:{value:n.rawIoCollapse,callback:function(x){n.rawIoCollapse=x},expression:"rawIoCollapse"}},[a("el-collapse-item",{attrs:{title:n.$t("trace.rawOutputs"),name:"rawOutputs"}},[a("codemirror",{key:`raw-outputs-${n.selectedSpanId}-${n.rawOutputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.rawOutputs),options:n.cmOptions}})],1)],1)],1):n._e(),!n.rawInputs&&!n.rawOutputs?a("div",{staticClass:"empty-raw-io"},[a("el-empty",{attrs:{description:n.$t("trace.noIoData")}})],1):n._e()]):n._e()]):n._e(),n.showDebugTab?a("el-tab-pane",{attrs:{label:"快速调试",name:"debug"}},[a("DebugTab",{directives:[{name:"show",rawName:"v-show",value:n.activeTab==="debug",expression:"activeTab === 'debug'"}],attrs:{"selected-span":n.selectedSpan,"selected-span-id":n.selectedSpanId}})],1):n._e(),n.hasEvents?a("el-tab-pane",{attrs:{label:n.$t("trace.events"),name:"events"}},[n.activeTab==="events"?a("div",{staticClass:"events-content"},[a("el-collapse",{model:{value:n.eventsCollapse,callback:function(x){n.eventsCollapse=x},expression:"eventsCollapse"}},n._l(n.spanEvents,function(x,S){return a("el-collapse-item",{key:`event-${S}`,attrs:{name:`event-${S}`}},[a("template",{slot:"title"},[a("div",{staticClass:"event-header"},[a("el-tag",{staticClass:"event-name-tag",attrs:{type:x.name==="exception"?"danger":"info",size:"mini"}},[n._v(" "+n._s(x.name)+" ")]),a("span",{staticClass:"event-time"},[n._v(n._s(n.formatEventTimestamp(x.timestamp)))])],1)]),a("div",{staticClass:"event-detail"},[x.name==="exception"?a("div",{staticClass:"exception-content"},[x.attributes["exception.type"]?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.exceptionType")))]),a("div",{staticClass:"field-value exception-type"},[n._v(n._s(x.attributes["exception.type"]))])]):n._e(),x.attributes["exception.message"]?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.exceptionMessage")))]),a("div",{staticClass:"field-value exception-message"},[n._v(n._s(x.attributes["exception.message"]))])]):n._e(),x.attributes["exception.stacktrace"]?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.exceptionStacktrace")))]),a("codemirror",{key:`stacktrace-${n.selectedSpanId}-${S}-${n.eventsKey}`,staticClass:"code-editor-wrapper stacktrace-editor",attrs:{value:x.attributes["exception.stacktrace"],options:n.cmOptionsJava}})],1):n._e(),n.getOtherEventAttributes(x).length>0?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.otherAttributes")))]),a("el-table",{attrs:{data:n.getOtherEventAttributes(x),border:"",stripe:"",size:"mini"}},[a("el-table-column",{attrs:{prop:"key",label:n.$t("trace.key"),width:"200"}}),a("el-table-column",{attrs:{prop:"value",label:n.$t("trace.value")}})],1)],1):n._e()]):a("div",{staticClass:"general-event-content"},[a("el-table",{attrs:{data:n.getEventAttributesData(x),border:"",stripe:"",size:"mini"}},[a("el-table-column",{attrs:{prop:"key",label:n.$t("trace.key"),width:"200"},scopedSlots:n._u([{key:"default",fn:function(A){return[a("el-tooltip",{attrs:{content:A.row.key,placement:"top","open-delay":500}},[a("span",{staticClass:"attribute-key"},[n._v(n._s(A.row.key))])])]}}],null,!0)}),a("el-table-column",{attrs:{prop:"value",label:n.$t("trace.value")},scopedSlots:n._u([{key:"default",fn:function(A){return[a("el-tooltip",{attrs:{placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[a("div",{staticClass:"attribute-tooltip-content",attrs:{slot:"content"},slot:"content"},[n._v(n._s(A.row.value))]),a("div",{staticClass:"attribute-value"},[n._v(n._s(A.row.value))])])]}}],null,!0)})],1)],1)])],2)}),1),n.spanEvents.length===0?a("div",{staticClass:"empty-events"},[a("el-empty",{attrs:{description:n.$t("trace.noEvents")}})],1):n._e()],1):n._e()]):n._e()],1)],1):a("el-empty",{attrs:{description:n.$t("trace.selectSpan")}})],1)],1)],1)],1):n._e()])},jp=[],qp=In(Hp,Wp,jp,!1,null,"a3b616bf");const Up={name:"Trace",components:{TraceDetailDrawer:qp.exports},data(){return{traceList:[],filteredTraceList:[],searchQuery:"",dateRange:null,selectedStatus:null,traceStatusList:[],experimentList:[],selectedExperimentId: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:"",spanHasEvents:null,selectedSpanId:null,selectedSpan:null,activeTab:"io",drawerLoading:!1,spanPageNum:1,spanPageSize:5e3,spanHasNextPage:!1,spanLoadMoreLoading:!1,messageCollapse:[],eventsCollapse:[],pageNum:1,pageSize:10,total:0,autoRefreshEnabled:!1,autoRefreshInterval:10,autoRefreshTimer:null,pickerOptions:{shortcuts:[{text:"近7天",onClick(l){const n=new Date,a=new Date;a.setTime(a.getTime()-3600*1e3*24*7),l.$emit("pick",[a,n])}},{text:"近30天",onClick(l){const n=new Date,a=new Date;a.setTime(a.getTime()-3600*1e3*24*30),l.$emit("pick",[a,n])}},{text:"7天前",onClick(l){const n=new Date;n.setTime(n.getTime()-3600*1e3*24*7),n.setHours(23,59,59,999);const a=n.getTime();l.$emit("pick",[null,a])}},{text:"30天前",onClick(l){const n=new Date;n.setTime(n.getTime()-3600*1e3*24*30),n.setHours(23,59,59,999);const a=n.getTime();l.$emit("pick",[null,a])}}]}}},computed:{},watch:{autoRefreshEnabled(l){l?this.startAutoRefresh():this.stopAutoRefresh()},spanHasEvents(){this.currentTraceId&&this.handleSpanSearch(this.spanSearchQuery)},spanPageSize(){this.currentTraceId&&this.handleSpanSearch(this.spanSearchQuery)}},mounted(){this.loadTraceStatus(),this.loadExperiments(),this.loadTraceList()},beforeDestroy(){this.stopAutoRefresh()},methods:{async loadTraceList(){this.loading=!0;try{let l=null,n=null;this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2?(this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""&&(l=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]!==""&&(n=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(n=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10)));const a=await Vt.getTraceList(this.searchQuery,l,n,this.pageNum,this.pageSize,this.selectedExperimentId,this.selectedStatus),o=Array.isArray(a==null?void 0:a.list)?a.list:[];this.traceList=o,this.filteredTraceList=o,this.total=parseInt((a==null?void 0:a.total)||0,10)}catch(l){console.error("Failed to load trace list:",l),this.$message.error("加载 trace 列表失败"),this.traceList=[],this.filteredTraceList=[],this.total=0}finally{this.loading=!1}},refresh(){this.loadTraceList()},startAutoRefresh(){this.stopAutoRefresh();const l=this.autoRefreshInterval*1e3;this.autoRefreshTimer=setInterval(()=>{this.loadTraceList()},l)},stopAutoRefresh(){this.autoRefreshTimer&&(clearInterval(this.autoRefreshTimer),this.autoRefreshTimer=null)},handleAutoRefreshIntervalChange(){this.autoRefreshEnabled&&this.startAutoRefresh()},handleRowClick(l){this.viewDetail(l.trace_id)},viewDetail(l){this.currentTraceId=l,this.loadTraceDetail(l),this.drawerVisible=!0},async loadTraceDetail(l){var n,a,o;this.drawerLoading=!0,this.spanPageNum=1;try{const[f,d]=await Promise.all([Vt.getTraceDetail(l),Vt.getTraceSpans(l,{query:this.spanSearchQuery||"",has_events:this.spanHasEvents===!0?!0:void 0,page_num:1,page_size:this.spanPageSize})]);this.traceInfo=f||{};const p=Array.isArray(d==null?void 0:d.list)?d.list:[];if(this.spans=p,this.filteredSpans=p,this.spanHasNextPage=(d==null?void 0:d.has_next_page)===!0,this.spans.length>0){this.selectedSpanId=this.spans[0].span_id,this.selectedSpan=this.spans[0],await this.loadSpanContent(this.spans[0]);const y=this.spans[0].type==="CLIENT"||this.spans[0].type==="EMBEDDING"||this.spans[0].type==="CHAT_MODEL",m=this.selectedSpan.has_events===!0,x=[];y&&x.push("io","raw"),x.push("attributes"),m&&x.push("events");let S="attributes";y&&(S="io"),x.includes(S)?this.activeTab=S:this.activeTab="attributes",(a=(n=this.selectedSpan.parsedContent)==null?void 0:n.inputs)!=null&&a.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((E,H)=>`message-${H}`):this.messageCollapse=[];const A=(o=this.selectedSpan.parsedContent)==null?void 0:o.events;A&&Array.isArray(A)&&A.length>0?this.eventsCollapse=A.map((E,H)=>`event-${H}`):this.eventsCollapse=[]}}catch(f){console.error("Failed to load trace detail:",f),this.$message.error("加载 trace 详情失败"),this.traceInfo={},this.spans=[],this.filteredSpans=[],this.spanHasNextPage=!1}finally{this.drawerLoading=!1}},async handleSpanSearch(l){if(this.spanSearchQuery=l,!!this.currentTraceId){this.spanPageNum=1;try{const n=await Vt.getTraceSpans(this.currentTraceId,{query:l||"",has_events:this.spanHasEvents===!0?!0:void 0,page_num:1,page_size:this.spanPageSize}),a=Array.isArray(n==null?void 0:n.list)?n.list:[];this.spans=a,this.filteredSpans=a,this.spanHasNextPage=(n==null?void 0:n.has_next_page)===!0,this.spans.length>0&&!this.selectedSpanId&&(this.selectedSpanId=this.spans[0].span_id,this.selectedSpan=this.spans[0],await this.loadSpanContent(this.spans[0]))}catch(n){console.error("Failed to search spans:",n),this.spans=[],this.filteredSpans=[],this.spanHasNextPage=!1}}},async loadMoreSpans(){if(!(!this.currentTraceId||!this.spanHasNextPage||this.spanLoadMoreLoading)){this.spanLoadMoreLoading=!0;try{const l=this.spanPageNum+1,n=await Vt.getTraceSpans(this.currentTraceId,{query:this.spanSearchQuery||"",has_events:this.spanHasEvents===!0?!0:void 0,page_num:l,page_size:this.spanPageSize}),a=Array.isArray(n==null?void 0:n.list)?n.list:[];this.spans=this.spans.concat(a),this.filteredSpans=this.spans,this.spanPageNum=l,this.spanHasNextPage=(n==null?void 0:n.has_next_page)===!0}catch(l){console.error("Failed to load more spans:",l)}finally{this.spanLoadMoreLoading=!1}}},async handleSpanSelect(l){var p,y,m;this.selectedSpanId=l.span_id,this.selectedSpan=l,await this.loadSpanContent(l);const n=l.type==="CLIENT"||l.type==="EMBEDDING"||l.type==="CHAT_MODEL",a=l.has_events===!0,o=[];n&&o.push("io","raw"),o.push("attributes"),a&&o.push("events");let f="attributes";n&&(f="io"),this.$nextTick(()=>{o.includes(f)?this.activeTab=f:this.activeTab="attributes"}),(y=(p=this.selectedSpan.parsedContent)==null?void 0:p.inputs)!=null&&y.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((x,S)=>`message-${S}`):this.messageCollapse=[];const d=(m=this.selectedSpan.parsedContent)==null?void 0:m.events;d&&Array.isArray(d)&&d.length>0?this.eventsCollapse=d.map((x,S)=>`event-${S}`):this.eventsCollapse=[]},async loadSpanContent(l){if(!(!this.currentTraceId||!l.span_id||l.parsedContent))try{const n=await Vt.getSpanContent(this.currentTraceId,l.span_id);if(n){const a=this.parseContentData(n);this.$set(l,"parsedContent",a)}}catch(n){console.error("Failed to load span content:",n)}},parseContentData(l){const n={attributes:l.attributes||{},events:l.events||[],status:l.status||{}};if(l.inputs&&(n.inputs=l.inputs),l.outputs&&(n.outputs=l.outputs),n.attributes){const a=n.attributes["langsword.spanInputs"],o=n.attributes["langsword.spanOutputs"];if(a)try{n.inputs=typeof a=="string"?JSON.parse(a):a}catch{try{const d=a.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.inputs=JSON.parse(d)}catch{n.inputs=a}}if(o)try{n.outputs=typeof o=="string"?JSON.parse(o):o}catch{try{const d=o.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.outputs=JSON.parse(d)}catch{n.outputs=o}}}return n},handleDrawerClose(){this.currentTraceId=null,this.traceInfo={},this.spans=[],this.filteredSpans=[],this.selectedSpanId=null,this.selectedSpan=null,this.spanSearchQuery="",this.spanHasEvents=null,this.spanPageNum=1,this.spanHasNextPage=!1,this.spanLoadMoreLoading=!1,this.eventsCollapse=[],this.drawerLoading=!1},async loadExperiments(){try{const l=await Vt.getExperiments();this.experimentList=Array.isArray(l)?l:[]}catch(l){console.error("Failed to load experiments:",l),this.experimentList=[]}},handleExperimentChange(){this.pageNum=1,this.loadTraceList()},handleSearch(){this.pageNum=1,this.loadTraceList()},handleSearchClear(){this.searchQuery="",this.pageNum=1,this.loadTraceList()},handleDateRangeChange(l){this.pageNum=1,l&&Array.isArray(l)?l.length===2&&(l[0]===null||l[0]===void 0)?this.dateRange=[null,l[1]]:this.dateRange=l:this.dateRange=l,this.loadTraceList()},handleSizeChange(l){this.pageSize=l,this.pageNum=1,this.loadTraceList()},handleCurrentChange(l){this.pageNum=l,this.loadTraceList()},async handleBatchDelete(){var p,y;const l=this.searchQuery&&this.searchQuery.trim(),n=this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2&&this.dateRange[1]!==null||this.dateRange.length===1&&this.dateRange[0]!==null),a=this.selectedExperimentId,o=this.selectedStatus;let f="",d="warning";if(!l&&!n&&!a&&!o)f=this.$t("trace.deleteAllWarning"),d="error";else{if(f=this.$t("trace.deleteConfirmMessage")+`
79
- `,a){const m=this.experimentList.find(S=>S.experiment_id===this.selectedExperimentId),x=m?m.name:this.selectedExperimentId;f+=`${this.$t("trace.application")}: ${x}
80
- `}if(l&&(f+=`${this.$t("trace.searchCondition")}: ${this.searchQuery}
81
- `),o&&(f+=`${this.$t("trace.status")}: ${this.getStatusLabel(this.selectedStatus)}
82
- `),n){const m=this.$i18n.locale==="zh-CN"?"zh-CN":"en-US";let x="";if(this.dateRange.length===2&&this.dateRange[1]!==null?x=new Date(this.dateRange[1]).toLocaleString(m):this.dateRange.length===1&&this.dateRange[0]!==null&&(x=new Date(this.dateRange[0]).toLocaleString(m)),this.dateRange.length===2&&this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""){const S=new Date(this.dateRange[0]).toLocaleString(m);f+=`${this.$t("trace.timeRange")}: ${S} ${this.$t("trace.to")} ${x}
83
- `}else this.$i18n.locale==="zh-CN"?f+=`${this.$t("trace.timeRange")}: ${this.$t("trace.before")} ${x} 之前
84
- `:f+=`${this.$t("trace.timeRange")}: ${this.$t("trace.before")} ${x}
85
- `}f+=this.$t("trace.deleteConfirmFooter")}try{await this.$confirm(f,this.$t("trace.confirmDelete"),{confirmButtonText:this.$t("trace.confirmDeleteButton"),cancelButtonText:this.$t("common.cancel"),type:d,dangerouslyUseHTMLString:!1}),this.deleteLoading=!0;let m=null,x=null;this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2?(this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""&&(m=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]!==""&&(x=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(x=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10))),await Vt.deleteTraces(l?this.searchQuery:null,m,x,this.selectedExperimentId,this.selectedStatus),this.$message.success(this.$t("trace.deleteSuccess")),await this.loadTraceList()}catch(m){if(m!=="cancel"){console.error("Failed to delete traces:",m);const x=((y=(p=m.response)==null?void 0:p.data)==null?void 0:y.message)||m.message||this.$t("trace.unknownError");this.$message.error(`${this.$t("trace.deleteFailed")}: ${x}`)}}finally{this.deleteLoading=!1}},async loadTraceStatus(){try{const l=await Vt.getTraceStatus();this.traceStatusList=Array.isArray(l)?l:[]}catch(l){console.error("Failed to load trace status:",l),this.traceStatusList=[]}},handleStatusChange(){this.pageNum=1,this.loadTraceList()},getStatusLabel(l){if(!l)return"-";const n=this.traceStatusList.find(a=>a.value===l);return n?n.label:l},getStatusType(l){return{OK:"success",ERROR:"danger",IN_PROGRESS:"warning",WARN:"warning",UNSET:"info"}[l]||"info"},formatDateTime(l){if(!l)return"-";const n=typeof l=="string"?parseInt(l,10):l;if(isNaN(n))return"-";const a=new Date(n);if(isNaN(a.getTime()))return"-";const o=a.getFullYear(),f=String(a.getMonth()+1).padStart(2,"0"),d=String(a.getDate()).padStart(2,"0"),p=String(a.getHours()).padStart(2,"0"),y=String(a.getMinutes()).padStart(2,"0"),m=String(a.getSeconds()).padStart(2,"0");return`${o}-${f}-${d} ${p}:${y}:${m}`},formatTimeAgo(l){if(!l)return"-";const n=typeof l=="string"?parseInt(l,10):l;if(isNaN(n))return"-";const o=Date.now()-n,f=this.$i18n.locale==="zh-CN",d=Math.floor(o/(1e3*60*60*24));if(d>0)return f?`${d} 天前`:`${d} days ago`;const p=Math.floor(o/(1e3*60*60));if(p>0)return f?`${p} 小时前`:`${p} hours ago`;const y=Math.floor(o/(1e3*60));return y>0?f?`${y} 分钟前`:`${y} minutes ago`:f?"刚刚":"Just now"},formatNanoDuration(l){if(!l)return"-";const n=l/1e6;return n<1e3?`${n.toFixed(2)}ms`:n<6e4?`${(n/1e3).toFixed(2)}s`:`${(n/6e4).toFixed(2)}min`},formatJson(l){return l?JSON.stringify(l,null,2):""},formatRawJson(l){if(!l)return"";if(typeof l=="string")try{const n=JSON.parse(l);return JSON.stringify(n,null,2)}catch{try{const a=l.replace(/\\"/g,'"').replace(/^"|"$/g,""),o=JSON.parse(a);return JSON.stringify(o,null,2)}catch{return l}}return JSON.stringify(l,null,2)},handleCodeMirrorReady(l){this.$nextTick(()=>{l&&l.refresh()})},formatMessageContent(l){return typeof l=="string"?l:JSON.stringify(l,null,2)},formatEventTime(l){if(l.time_unix_nano){const n=l.time_unix_nano/1e6;return new Date(n).toLocaleString("zh-CN")}return l.timestamp?new Date(l.timestamp).toLocaleString("zh-CN"):"-"},tableRowClassName({row:l,rowIndex:n}){return"trace-row"},getIndex(l){return(this.pageNum-1)*this.pageSize+l+1},applyColumns(){const l={};this.selectedColumns.forEach(n=>{l[n]=!0}),Object.keys(this.visibleColumns).forEach(n=>{this.selectedColumns.includes(n)||(l[n]=!1)}),this.visibleColumns=l,this.showColumnDialog=!1}}};var Gp=function(){var n=this,a=n._self._c;return a("div",{staticClass:"trace-list-container"},[a("el-card",[a("div",{staticClass:"trace-content-wrapper"},[a("div",{staticClass:"trace-toolbar"},[a("el-select",{staticClass:"toolbar-select",attrs:{placeholder:n.$t("trace.selectApplication"),clearable:"",size:"mini"},on:{change:n.handleExperimentChange},model:{value:n.selectedExperimentId,callback:function(o){n.selectedExperimentId=o},expression:"selectedExperimentId"}},n._l(n.experimentList,function(o){return a("el-option",{key:o.experiment_id,attrs:{label:o.name,value:o.experiment_id}})}),1),a("el-input",{staticClass:"toolbar-input",attrs:{placeholder:n.$t("trace.searchPlaceholder"),"prefix-icon":"el-icon-search",clearable:"",size:"mini"},on:{clear:n.handleSearchClear,input:n.handleSearch},model:{value:n.searchQuery,callback:function(o){n.searchQuery=o},expression:"searchQuery"}}),a("el-select",{staticClass:"toolbar-select",attrs:{placeholder:n.$t("trace.status"),clearable:"",size:"mini"},on:{change:n.handleStatusChange},model:{value:n.selectedStatus,callback:function(o){n.selectedStatus=o},expression:"selectedStatus"}},n._l(n.traceStatusList,function(o){return a("el-option",{key:o.value,attrs:{label:o.label,value:o.value}})}),1),a("el-date-picker",{staticClass:"toolbar-date-picker",attrs:{type:"datetimerange","range-separator":n.$t("trace.to"),"start-placeholder":n.$t("trace.startTime"),"end-placeholder":n.$t("trace.endTime"),"value-format":"timestamp",format:"yyyy-MM-dd HH:mm:ss",size:"mini","picker-options":n.pickerOptions,clearable:""},on:{change:n.handleDateRangeChange},model:{value:n.dateRange,callback:function(o){n.dateRange=o},expression:"dateRange"}}),a("el-button",{attrs:{type:"danger",icon:"el-icon-delete",size:"mini",disabled:n.deleteLoading},on:{click:n.handleBatchDelete}},[n._v(" "+n._s(n.$t("trace.batchDelete"))+" ")]),a("el-checkbox",{staticClass:"toolbar-auto-refresh",attrs:{size:"mini"},model:{value:n.autoRefreshEnabled,callback:function(o){n.autoRefreshEnabled=o},expression:"autoRefreshEnabled"}},[n._v(" "+n._s(n.$t("trace.autoRefresh"))+" ")]),n.autoRefreshEnabled?a("el-select",{staticClass:"toolbar-interval-select",attrs:{size:"mini"},on:{change:n.handleAutoRefreshIntervalChange},model:{value:n.autoRefreshInterval,callback:function(o){n.autoRefreshInterval=o},expression:"autoRefreshInterval"}},[a("el-option",{attrs:{label:n.$t("trace.refreshInterval5s"),value:5}}),a("el-option",{attrs:{label:n.$t("trace.refreshInterval10s"),value:10}}),a("el-option",{attrs:{label:n.$t("trace.refreshInterval20s"),value:20}})],1):n._e(),a("el-tooltip",{attrs:{content:n.$t("common.refresh"),placement:"top"}},[a("el-button",{attrs:{icon:"el-icon-refresh",size:"mini",circle:""},on:{click:n.refresh}})],1),a("el-button",{attrs:{icon:"el-icon-setting",size:"mini"},on:{click:function(o){n.showColumnDialog=!0}}},[n._v(" "+n._s(n.$t("common.columns"))+" ")])],1),a("div",{staticClass:"trace-table-wrapper"},[a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:n.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:n.filteredTraceList,size:"mini",stripe:"","row-class-name":n.tableRowClassName},on:{"row-click":n.handleRowClick}},[a("el-table-column",{attrs:{type:"index",label:"#",width:"60",index:n.getIndex}}),n.visibleColumns.trace_id?a("el-table-column",{attrs:{prop:"trace_id",label:n.$t("trace.requestId"),width:"280","show-overflow-tooltip":""},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-link",{attrs:{type:"primary"},on:{click:function(f){return f.stopPropagation(),n.viewDetail(o.row.trace_id)}}},[n._v(" "+n._s(o.row.trace_id)+" ")])]}}],null,!1,1400187371)}):n._e(),n.visibleColumns.trace_name?a("el-table-column",{attrs:{prop:"trace_name",label:n.$t("trace.traceName"),"min-width":"300","show-overflow-tooltip":""},scopedSlots:n._u([{key:"default",fn:function(o){return[a("span",[n._v(n._s(o.row.trace_name||"-"))])]}}],null,!1,3633653970)}):n._e(),n.visibleColumns.trace_type?a("el-table-column",{attrs:{prop:"trace_type",label:n.$t("trace.traceType"),width:"120"},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-tag",{attrs:{size:"mini",type:"info"}},[n._v(n._s(o.row.trace_type||"-"))])]}}],null,!1,1175446173)}):n._e(),n.visibleColumns.execution_time_ms?a("el-table-column",{attrs:{prop:"execution_time_ms",label:n.$t("trace.executionTime"),width:"120"},scopedSlots:n._u([{key:"default",fn:function(o){return[n._v(" "+n._s(n.formatNanoDuration(o.row.execution_time_ms))+" ")]}}],null,!1,1733254102)}):n._e(),n.visibleColumns.status?a("el-table-column",{attrs:{prop:"status",label:n.$t("trace.status"),width:"100"},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-tag",{attrs:{type:n.getStatusType(o.row.status),size:"mini"}},[o.row.status==="OK"?a("i",{staticClass:"el-icon-success"}):n._e(),n._v(" "+n._s(n.getStatusLabel(o.row.status))+" ")])]}}],null,!1,4220190539)}):n._e(),n.visibleColumns.timestamp_ms?a("el-table-column",{attrs:{prop:"timestamp_ms",label:n.$t("trace.timeCreated"),width:"180"},scopedSlots:n._u([{key:"default",fn:function(o){return[n._v(" "+n._s(n.formatDateTime(o.row.timestamp_ms))+" ")]}}],null,!1,1082702673)}):n._e(),a("el-table-column",{attrs:{label:n.$t("common.operation"),width:"100",fixed:"right"},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(f){return f.stopPropagation(),n.viewDetail(o.row.trace_id)}}},[n._v(" "+n._s(n.$t("common.viewDetail"))+" ")])]}}])})],1)],1),a("div",{staticClass:"trace-pagination-wrapper"},[n.total>0?a("el-pagination",{staticClass:"trace-pagination",attrs:{"current-page":n.pageNum,"page-sizes":[10,20,50,100],"page-size":n.pageSize,size:"mini",layout:"total, prev, pager, next, sizes, jumper",total:n.total,background:""},on:{"size-change":n.handleSizeChange,"current-change":n.handleCurrentChange}}):n._e()],1)])]),a("el-dialog",{attrs:{title:n.$t("trace.selectColumns"),visible:n.showColumnDialog,width:"400px"},on:{"update:visible":function(o){n.showColumnDialog=o}}},[a("el-checkbox-group",{model:{value:n.selectedColumns,callback:function(o){n.selectedColumns=o},expression:"selectedColumns"}},[a("el-checkbox",{attrs:{label:"trace_id"}},[n._v(n._s(n.$t("trace.requestId")))]),a("el-checkbox",{attrs:{label:"timestamp_ms"}},[n._v(n._s(n.$t("trace.timeCreated")))]),a("el-checkbox",{attrs:{label:"status"}},[n._v(n._s(n.$t("trace.status")))]),a("el-checkbox",{attrs:{label:"execution_time_ms"}},[n._v(n._s(n.$t("trace.executionTime")))]),a("el-checkbox",{attrs:{label:"trace_type"}},[n._v(n._s(n.$t("trace.traceType")))]),a("el-checkbox",{attrs:{label:"trace_name"}},[n._v(n._s(n.$t("trace.traceName")))])],1),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{size:"mini"},on:{click:function(o){n.showColumnDialog=!1}}},[n._v(n._s(n.$t("common.cancel")))]),a("el-button",{attrs:{size:"mini",type:"primary"},on:{click:n.applyColumns}},[n._v(n._s(n.$t("common.confirm")))])],1)],1),a("TraceDetailDrawer",{attrs:{visible:n.drawerVisible,"current-trace-id":n.currentTraceId,"trace-info":n.traceInfo,"trace-status-list":n.traceStatusList,spans:n.spans,"filtered-spans":n.filteredSpans,"selected-span-id":n.selectedSpanId,"selected-span":n.selectedSpan,loading:n.drawerLoading,"span-has-next-page":n.spanHasNextPage,"span-load-more-loading":n.spanLoadMoreLoading,"span-page-size":n.spanPageSize,"span-has-events":n.spanHasEvents},on:{"update:visible":[function(o){n.drawerVisible=o},function(o){n.drawerVisible=o}],"update:spanPageSize":function(o){n.spanPageSize=o},"update:span-page-size":function(o){n.spanPageSize=o},"update:spanHasEvents":function(o){n.spanHasEvents=o},"update:span-has-events":function(o){n.spanHasEvents=o},close:n.handleDrawerClose,"span-search":n.handleSpanSearch,"span-select":n.handleSpanSelect,"span-load-more":n.loadMoreSpans}})],1)},Kp=[],Xp=In(Up,Gp,Kp,!1,null,"2536a877");const ls=Xp.exports,Hl={routes:[{path:"/trace",name:"trace",component:ls}],beforeEach:(l,n,a)=>{a()}},Wl={common:{home:"首页",todos:"待办事项",trace:"追踪",login:"登录",logout:"退出",user:"用户",search:"搜索",refresh:"刷新",columns:"列设置",confirm:"确定",cancel:"取消",operation:"操作",viewDetail:"查看详情",language:"语言"},span:{searchTree:"Span名称/Span类型",hasEvents:"是否有事件"},trace:{title:"追踪列表",searchPlaceholder:"追踪ID/追踪名称/追踪类型",requestId:"追踪ID",timeCreated:"创建时间",status:"状态",executionTime:"执行时长",traceType:"追踪类型",traceName:"追踪名称",traceDetail:"追踪详情",traceId:"追踪ID",clientRequestId:"客户端请求ID",experimentId:"应用ID",application:"应用",selectApplication:"请选择应用",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 数据!
77
+ */function nh(l,n){if(!(l instanceof n))throw new TypeError("Cannot call a class as a function")}function Mo(l,n){for(var a=0;a<n.length;a++){var o=n[a];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(l,Po(o.key),o)}}function rh(l,n,a){return n&&Mo(l.prototype,n),a&&Mo(l,a),Object.defineProperty(l,"prototype",{writable:!1}),l}function ih(l,n,a){return(n=Po(n))in l?Object.defineProperty(l,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):l[n]=a,l}function Fo(l,n){var a=Object.keys(l);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(l);n&&(o=o.filter(function(c){return Object.getOwnPropertyDescriptor(l,c).enumerable})),a.push.apply(a,o)}return a}function Ga(l){for(var n=1;n<arguments.length;n++){var a=arguments[n]!=null?arguments[n]:{};n%2?Fo(Object(a),!0).forEach(function(o){ih(l,o,a[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(a)):Fo(Object(a)).forEach(function(o){Object.defineProperty(l,o,Object.getOwnPropertyDescriptor(a,o))})}return l}function ah(l,n){if(typeof l!="object"||!l)return l;var a=l[Symbol.toPrimitive];if(a!==void 0){var o=a.call(l,n);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(l)}function Po(l){var n=ah(l,"string");return typeof n=="symbol"?n:n+""}function Ka(l){"@babel/helpers - typeof";return Ka=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Ka(l)}var $o={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},sh='<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>',Ui=typeof window<"u"&&typeof window.document<"u",wn=Ui?window:{},hr=Ui&&wn.document.documentElement?"ontouchstart"in wn.document.documentElement:!1,Xa=Ui?"PointerEvent"in wn:!1,Ne="viewer",Gi="move",zo="switch",ei="zoom",Ki="".concat(Ne,"-active"),oh="".concat(Ne,"-close"),Xi="".concat(Ne,"-fade"),Ya="".concat(Ne,"-fixed"),lh="".concat(Ne,"-fullscreen"),Bo="".concat(Ne,"-fullscreen-exit"),Vn="".concat(Ne,"-hide"),uh="".concat(Ne,"-hide-md-down"),ch="".concat(Ne,"-hide-sm-down"),fh="".concat(Ne,"-hide-xs-down"),Jt="".concat(Ne,"-in"),ti="".concat(Ne,"-invisible"),dr="".concat(Ne,"-loading"),hh="".concat(Ne,"-move"),Ho="".concat(Ne,"-open"),pr="".concat(Ne,"-show"),at="".concat(Ne,"-transition"),gr="click",Va="dblclick",Wo="dragstart",jo="focusin",qo="keydown",Qt="load",Jn="error",dh=hr?"touchend touchcancel":"mouseup",ph=hr?"touchmove":"mousemove",gh=hr?"touchstart":"mousedown",Uo=Xa?"pointerdown":gh,Go=Xa?"pointermove":ph,Ko=Xa?"pointerup pointercancel":dh,Xo="resize",nn="transitionend",Yo="wheel",Vo="ready",Jo="show",Qo="shown",Zo="hide",el="hidden",tl="view",ni="viewed",nl="move",rl="moved",il="rotate",al="rotated",sl="scale",ol="scaled",ll="zoom",ul="zoomed",cl="play",fl="stop",Yi="".concat(Ne,"Action"),Ja=/\s\s*/,Vi=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"];function ri(l){return typeof l=="string"}var mh=Number.isNaN||wn.isNaN;function Ze(l){return typeof l=="number"&&!mh(l)}function mr(l){return typeof l>"u"}function vr(l){return Ka(l)==="object"&&l!==null}var vh=Object.prototype.hasOwnProperty;function yr(l){if(!vr(l))return!1;try{var n=l.constructor,a=n.prototype;return n&&a&&vh.call(a,"isPrototypeOf")}catch{return!1}}function Ue(l){return typeof l=="function"}function Xe(l,n){if(l&&Ue(n))if(Array.isArray(l)||Ze(l.length)){var a=l.length,o;for(o=0;o<a&&n.call(l,l[o],o,l)!==!1;o+=1);}else vr(l)&&Object.keys(l).forEach(function(c){n.call(l,l[c],c,l)});return l}var qt=Object.assign||function(n){for(var a=arguments.length,o=new Array(a>1?a-1:0),c=1;c<a;c++)o[c-1]=arguments[c];return vr(n)&&o.length>0&&o.forEach(function(d){vr(d)&&Object.keys(d).forEach(function(p){n[p]=d[p]})}),n},yh=/^(?:width|height|left|top|marginLeft|marginTop)$/;function rn(l,n){var a=l.style;Xe(n,function(o,c){yh.test(c)&&Ze(o)&&(o+="px"),a[c]=o})}function bh(l){return ri(l)?l.replace(/&(?!amp;|quot;|#39;|lt;|gt;)/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):l}function br(l,n){return!l||!n?!1:l.classList?l.classList.contains(n):l.className.indexOf(n)>-1}function Ce(l,n){if(!(!l||!n)){if(Ze(l.length)){Xe(l,function(o){Ce(o,n)});return}if(l.classList){l.classList.add(n);return}var a=l.className.trim();a?a.indexOf(n)<0&&(l.className="".concat(a," ").concat(n)):l.className=n}}function He(l,n){if(!(!l||!n)){if(Ze(l.length)){Xe(l,function(a){He(a,n)});return}if(l.classList){l.classList.remove(n);return}l.className.indexOf(n)>=0&&(l.className=l.className.replace(n,""))}}function ii(l,n,a){if(n){if(Ze(l.length)){Xe(l,function(o){ii(o,n,a)});return}a?Ce(l,n):He(l,n)}}var xh=/([a-z\d])([A-Z])/g;function Qa(l){return l.replace(xh,"$1-$2").toLowerCase()}function xr(l,n){return vr(l[n])?l[n]:l.dataset?l.dataset[n]:l.getAttribute("data-".concat(Qa(n)))}function Za(l,n,a){vr(a)?l[n]=a:l.dataset?l.dataset[n]=a:l.setAttribute("data-".concat(Qa(n)),a)}var hl=function(){var l=!1;if(Ui){var n=!1,a=function(){},o=Object.defineProperty({},"once",{get:function(){return l=!0,n},set:function(d){n=d}});wn.addEventListener("test",a,o),wn.removeEventListener("test",a,o)}return l}();function Ge(l,n,a){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},c=a;n.trim().split(Ja).forEach(function(d){if(!hl){var p=l.listeners;p&&p[d]&&p[d][a]&&(c=p[d][a],delete p[d][a],Object.keys(p[d]).length===0&&delete p[d],Object.keys(p).length===0&&delete l.listeners)}l.removeEventListener(d,c,o)})}function Ee(l,n,a){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},c=a;n.trim().split(Ja).forEach(function(d){if(o.once&&!hl){var p=l.listeners,y=p===void 0?{}:p;c=function(){delete y[d][a],l.removeEventListener(d,c,o);for(var w=arguments.length,S=new Array(w),M=0;M<w;M++)S[M]=arguments[M];a.apply(l,S)},y[d]||(y[d]={}),y[d][a]&&l.removeEventListener(d,y[d][a],o),y[d][a]=c,l.listeners=y}l.addEventListener(d,c,o)})}function ot(l,n,a,o){var c;return Ue(Event)&&Ue(CustomEvent)?c=new CustomEvent(n,Ga({bubbles:!0,cancelable:!0,detail:a},o)):(c=document.createEvent("CustomEvent"),c.initCustomEvent(n,!0,!0,a)),l.dispatchEvent(c)}function kh(l){var n=l.getBoundingClientRect();return{left:n.left+(window.pageXOffset-document.documentElement.clientLeft),top:n.top+(window.pageYOffset-document.documentElement.clientTop)}}function Ji(l){var n=l.rotate,a=l.scaleX,o=l.scaleY,c=l.translateX,d=l.translateY,p=[];Ze(c)&&c!==0&&p.push("translateX(".concat(c,"px)")),Ze(d)&&d!==0&&p.push("translateY(".concat(d,"px)")),Ze(n)&&n!==0&&p.push("rotate(".concat(n,"deg)")),Ze(a)&&a!==1&&p.push("scaleX(".concat(a,")")),Ze(o)&&o!==1&&p.push("scaleY(".concat(o,")"));var y=p.length?p.join(" "):"none";return{WebkitTransform:y,msTransform:y,transform:y}}function wh(l){return ri(l)?decodeURIComponent(l.replace(/^.*\//,"").replace(/[?&#].*$/,"")):""}var es=wn.navigator&&/Version\/\d+(\.\d+)+?\s+Safari/i.test(wn.navigator.userAgent);function dl(l,n,a){var o=document.createElement("img");if(l.naturalWidth&&!es)return a(l.naturalWidth,l.naturalHeight),o;var c=document.body||document.documentElement;return o.onload=function(){a(o.width,o.height),es||c.removeChild(o)},Xe(n.inheritedAttributes,function(d){var p=l.getAttribute(d);p!==null&&o.setAttribute(d,p)}),o.src=l.src,es||(o.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(o)),o}function Qi(l){switch(l){case 2:return fh;case 3:return ch;case 4:return uh;default:return""}}function Sh(l){var n=Ga({},l),a=[];return Xe(l,function(o,c){delete n[c],Xe(n,function(d){var p=Math.abs(o.startX-d.startX),y=Math.abs(o.startY-d.startY),m=Math.abs(o.endX-d.endX),w=Math.abs(o.endY-d.endY),S=Math.sqrt(p*p+y*y),M=Math.sqrt(m*m+w*w),E=(M-S)/S;a.push(E)})}),a.sort(function(o,c){return Math.abs(o)<Math.abs(c)}),a[0]}function Zi(l,n){var a=l.pageX,o=l.pageY,c={endX:a,endY:o};return n?c:Ga({timeStamp:Date.now(),startX:a,startY:o},c)}function Ch(l){var n=0,a=0,o=0;return Xe(l,function(c){var d=c.startX,p=c.startY;n+=d,a+=p,o+=1}),n/=o,a/=o,{pageX:n,pageY:a}}var Th={render:function(){this.initContainer(),this.initViewer(),this.initList(),this.renderViewer()},initBody:function(){var n=this.element.ownerDocument,a=n.body||n.documentElement;this.body=a,this.scrollbarWidth=window.innerWidth-n.documentElement.clientWidth,this.initialBodyPaddingRight=a.style.paddingRight,this.initialBodyComputedPaddingRight=window.getComputedStyle(a).paddingRight},initContainer:function(){this.containerData={width:window.innerWidth,height:window.innerHeight}},initViewer:function(){var n=this.options,a=this.parent,o;n.inline&&(o={width:Math.max(a.offsetWidth,n.minWidth),height:Math.max(a.offsetHeight,n.minHeight)},this.parentData=o),(this.fulled||!o)&&(o=this.containerData),this.viewerData=qt({},o)},renderViewer:function(){this.options.inline&&!this.fulled&&rn(this.viewer,this.viewerData)},initList:function(){var n=this,a=this.element,o=this.options,c=this.list,d=[];c.innerHTML="",Xe(this.images,function(p,y){var m=p.src,w=p.alt||wh(m),S=n.getImageURL(p);if(m||S){var M=document.createElement("li"),E=document.createElement("img");Xe(o.inheritedAttributes,function(A){var z=p.getAttribute(A);z!==null&&E.setAttribute(A,z)}),o.navbar&&(E.src=m||S),E.alt=w,E.setAttribute("data-original-url",S||m),M.setAttribute("data-index",y),M.setAttribute("data-viewer-action","view"),M.setAttribute("role","button"),o.keyboard&&M.setAttribute("tabindex",0),M.appendChild(E),c.appendChild(M),d.push(M)}}),this.items=d,Xe(d,function(p){var y=p.firstElementChild,m,w;Za(y,"filled",!0),o.loading&&Ce(p,dr),Ee(y,Qt,m=function(M){Ge(y,Jn,w),o.loading&&He(p,dr),n.loadImage(M)},{once:!0}),Ee(y,Jn,w=function(){Ge(y,Qt,m),o.loading&&He(p,dr)},{once:!0})}),o.transition&&Ee(a,ni,function(){Ce(c,at)},{once:!0})},renderList:function(){var n=this.index,a=this.items[n];if(a){var o=a.nextElementSibling,c=parseInt(window.getComputedStyle(o||a).marginLeft,10),d=a.offsetWidth,p=d+c;rn(this.list,qt({width:p*this.length-c},Ji({translateX:(this.viewerData.width-d)/2-p*n})))}},resetList:function(){var n=this.list;n.innerHTML="",He(n,at),rn(n,Ji({translateX:0}))},initImage:function(n){var a=this,o=this.options,c=this.image,d=this.viewerData,p=this.footer.offsetHeight,y=d.width,m=Math.max(d.height-p,p),w=this.imageData||{},S;this.imageInitializing={abort:function(){S.onload=null}},S=dl(c,o,function(M,E){var A=M/E,z=Math.max(0,Math.min(1,o.initialCoverage)),B=y,P=m;a.imageInitializing=!1,m*A>y?P=y/A:B=m*A,z=Ze(z)?z:.9,B=Math.min(B*z,M),P=Math.min(P*z,E);var N=(y-B)/2,O=(m-P)/2,W={left:N,top:O,x:N,y:O,width:B,height:P,oldRatio:1,ratio:B/M,aspectRatio:A,naturalWidth:M,naturalHeight:E},X=qt({},W);o.rotatable&&(W.rotate=w.rotate||0,X.rotate=0),o.scalable&&(W.scaleX=w.scaleX||1,W.scaleY=w.scaleY||1,X.scaleX=1,X.scaleY=1),a.imageData=W,a.initialImageData=X,n&&n()})},renderImage:function(n){var a=this,o=this.image,c=this.imageData;if(rn(o,qt({width:c.width,height:c.height,marginLeft:c.x,marginTop:c.y},Ji(c))),n)if((this.viewing||this.moving||this.rotating||this.scaling||this.zooming)&&this.options.transition&&br(o,at)){var d=function(){a.imageRendering=!1,n()};this.imageRendering={abort:function(){Ge(o,nn,d)}},Ee(o,nn,d,{once:!0})}else n()},resetImage:function(){var n=this.image;n&&(this.viewing&&this.viewing.abort(),n.parentNode.removeChild(n),this.image=null,this.title.innerHTML="")}},_h={bind:function(){var n=this.options,a=this.viewer,o=this.canvas,c=this.element.ownerDocument;Ee(a,gr,this.onClick=this.click.bind(this)),Ee(a,Wo,this.onDragStart=this.dragstart.bind(this)),Ee(o,Uo,this.onPointerDown=this.pointerdown.bind(this)),Ee(c,Go,this.onPointerMove=this.pointermove.bind(this)),Ee(c,Ko,this.onPointerUp=this.pointerup.bind(this)),Ee(c,qo,this.onKeyDown=this.keydown.bind(this)),Ee(window,Xo,this.onResize=this.resize.bind(this)),n.zoomable&&n.zoomOnWheel&&Ee(a,Yo,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),n.toggleOnDblclick&&Ee(o,Va,this.onDblclick=this.dblclick.bind(this))},unbind:function(){var n=this.options,a=this.viewer,o=this.canvas,c=this.element.ownerDocument;Ge(a,gr,this.onClick),Ge(a,Wo,this.onDragStart),Ge(o,Uo,this.onPointerDown),Ge(c,Go,this.onPointerMove),Ge(c,Ko,this.onPointerUp),Ge(c,qo,this.onKeyDown),Ge(window,Xo,this.onResize),n.zoomable&&n.zoomOnWheel&&Ge(a,Yo,this.onWheel,{passive:!1,capture:!0}),n.toggleOnDblclick&&Ge(o,Va,this.onDblclick)}},Lh={click:function(n){var a=this.options,o=this.imageData,c=n.target,d=xr(c,Yi);switch(!d&&c.localName==="img"&&c.parentElement.localName==="li"&&(c=c.parentElement,d=xr(c,Yi)),hr&&n.isTrusted&&c===this.canvas&&clearTimeout(this.clickCanvasTimeout),d){case"mix":this.played?this.stop():a.inline?this.fulled?this.exit():this.full():this.hide();break;case"hide":this.pointerMoved||this.hide();break;case"view":this.view(xr(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(a.loop);break;case"play":this.play(a.fullscreen);break;case"next":this.next(a.loop);break;case"rotate-left":this.rotate(-90);break;case"rotate-right":this.rotate(90);break;case"flip-horizontal":this.scaleX(-o.scaleX||-1);break;case"flip-vertical":this.scaleY(-o.scaleY||-1);break;default:this.played&&this.stop()}},dblclick:function(n){n.preventDefault(),this.viewed&&n.target===this.image&&(hr&&n.isTrusted&&clearTimeout(this.doubleClickImageTimeout),this.toggle(n.isTrusted?n:n.detail&&n.detail.originalEvent))},load:function(){var n=this;this.timeout&&(clearTimeout(this.timeout),this.timeout=!1);var a=this.element,o=this.options,c=this.image,d=this.index,p=this.viewerData;He(c,ti),o.loading&&He(this.canvas,dr),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(){ii(c,hh,o.movable),ii(c,at,o.transition),n.renderImage(function(){n.viewed=!0,n.viewing=!1,Ue(o.viewed)&&Ee(a,ni,o.viewed,{once:!0}),ot(a,ni,{originalImage:n.images[d],index:d,image:c},{cancelable:!1})})})},loadImage:function(n){var a=n.target,o=a.parentNode,c=o.offsetWidth||30,d=o.offsetHeight||50,p=!!xr(a,"filled");dl(a,this.options,function(y,m){var w=y/m,S=c,M=d;d*w>c?p?S=d*w:M=c/w:p?M=c/w:S=d*w,rn(a,qt({width:S,height:M},Ji({translateX:(c-S)/2,translateY:(d-M)/2})))})},keydown:function(n){var a=this.options;if(a.keyboard){var o=n.keyCode||n.which||n.charCode;switch(o){case 13:this.viewer.contains(n.target)&&this.click(n);break}if(this.fulled)switch(o){case 27:this.played?this.stop():a.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(a.loop);break;case 38:n.preventDefault(),this.zoom(a.zoomRatio,!0);break;case 39:this.played&&this.playing?this.playing.next():this.next(a.loop);break;case 40:n.preventDefault(),this.zoom(-a.zoomRatio,!0);break;case 48:case 49:n.ctrlKey&&(n.preventDefault(),this.toggle());break}}},dragstart:function(n){n.target.localName==="img"&&n.preventDefault()},pointerdown:function(n){var a=this.options,o=this.pointers,c=n.buttons,d=n.button;if(this.pointerMoved=!1,!(!this.viewed||this.showing||this.viewing||this.hiding||(n.type==="mousedown"||n.type==="pointerdown"&&n.pointerType==="mouse")&&(Ze(c)&&c!==1||Ze(d)&&d!==0||n.ctrlKey))){n.preventDefault(),n.changedTouches?Xe(n.changedTouches,function(y){o[y.identifier]=Zi(y)}):o[n.pointerId||0]=Zi(n);var p=a.movable?Gi:!1;a.zoomOnTouch&&a.zoomable&&Object.keys(o).length>1?p=ei:a.slideOnTouch&&(n.pointerType==="touch"||n.type==="touchstart")&&this.isSwitchable()&&(p=zo),a.transition&&(p===Gi||p===ei)&&He(this.image,at),this.action=p}},pointermove:function(n){var a=this.pointers,o=this.action;!this.viewed||!o||(n.preventDefault(),n.changedTouches?Xe(n.changedTouches,function(c){qt(a[c.identifier]||{},Zi(c,!0))}):qt(a[n.pointerId||0]||{},Zi(n,!0)),this.change(n))},pointerup:function(n){var a=this,o=this.options,c=this.action,d=this.pointers,p;n.changedTouches?Xe(n.changedTouches,function(y){p=d[y.identifier],delete d[y.identifier]}):(p=d[n.pointerId||0],delete d[n.pointerId||0]),c&&(n.preventDefault(),o.transition&&(c===Gi||c===ei)&&Ce(this.image,at),this.action=!1,hr&&c!==ei&&p&&Date.now()-p.timeStamp<500&&(clearTimeout(this.clickCanvasTimeout),clearTimeout(this.doubleClickImageTimeout),o.toggleOnDblclick&&this.viewed&&n.target===this.image?this.imageClicked?(this.imageClicked=!1,this.doubleClickImageTimeout=setTimeout(function(){ot(a.image,Va,{originalEvent:n})},50)):(this.imageClicked=!0,this.doubleClickImageTimeout=setTimeout(function(){a.imageClicked=!1},500)):(this.imageClicked=!1,o.backdrop&&o.backdrop!=="static"&&n.target===this.canvas&&(this.clickCanvasTimeout=setTimeout(function(){ot(a.canvas,gr,{originalEvent:n})},50)))))},resize:function(){var n=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(){n.renderImage()}),this.played)){if(this.options.fullscreen&&this.fulled&&!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)){this.stop();return}Xe(this.player.getElementsByTagName("img"),function(a){Ee(a,Qt,n.loadImage.bind(n),{once:!0}),ot(a,Qt)})}},wheel:function(n){var a=this;if(this.viewed&&(n.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){a.wheeling=!1},50);var o=Number(this.options.zoomRatio)||.1,c=1;n.deltaY?c=n.deltaY>0?1:-1:n.wheelDelta?c=-n.wheelDelta/120:n.detail&&(c=n.detail>0?1:-1),this.zoom(-c*o,!0,null,n)}}},Eh={show:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.element,o=this.options;if(o.inline||this.showing||this.isShown||this.showing)return this;if(!this.ready)return this.build(),this.ready&&this.show(n),this;if(Ue(o.show)&&Ee(a,Jo,o.show,{once:!0}),ot(a,Jo)===!1||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var c=this.viewer;if(He(c,Vn),c.setAttribute("role","dialog"),c.setAttribute("aria-labelledby",this.title.id),c.setAttribute("aria-modal",!0),c.removeAttribute("aria-hidden"),o.transition&&!n){var d=this.shown.bind(this);this.transitioning={abort:function(){Ge(c,nn,d),He(c,Jt)}},Ce(c,at),c.initialOffsetWidth=c.offsetWidth,Ee(c,nn,d,{once:!0}),Ce(c,Jt)}else Ce(c,Jt),this.shown();return this},hide:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,o=this.element,c=this.options;if(c.inline||this.hiding||!(this.isShown||this.showing))return this;if(Ue(c.hide)&&Ee(o,Zo,c.hide,{once:!0}),ot(o,Zo)===!1)return this;this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort();var d=this.viewer,p=this.image,y=function(){He(d,Jt),n.hidden()};if(c.transition&&!a){var m=function(M){M&&M.target===d&&(Ge(d,nn,m),n.hidden())},w=function(){br(d,at)?(Ee(d,nn,m),He(d,Jt)):y()};this.transitioning={abort:function(){n.viewed&&br(p,at)?Ge(p,nn,w):br(d,at)&&Ge(d,nn,m)}},this.viewed&&br(p,at)?(Ee(p,nn,w,{once:!0}),this.zoomTo(0,!1,null,null,!0)):w()}else y();return this},view:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.initialViewIndex;if(a=Number(a)||0,this.hiding||this.played||a<0||a>=this.length||this.viewed&&a===this.index)return this;if(!this.isShown)return this.index=a,this.show();this.viewing&&this.viewing.abort();var o=this.element,c=this.options,d=this.title,p=this.canvas,y=this.items[a],m=y.querySelector("img"),w=xr(m,"originalUrl"),S=m.getAttribute("alt"),M=document.createElement("img");if(Xe(c.inheritedAttributes,function(P){var N=m.getAttribute(P);N!==null&&M.setAttribute(P,N)}),M.src=w,M.alt=S,Ue(c.view)&&Ee(o,tl,c.view,{once:!0}),ot(o,tl,{originalImage:this.images[a],index:a,image:M})===!1||!this.isShown||this.hiding||this.played)return this;var E=this.items[this.index];E&&(He(E,Ki),E.removeAttribute("aria-selected")),Ce(y,Ki),y.setAttribute("aria-selected",!0),c.focus&&y.focus(),this.image=M,this.viewed=!1,this.index=a,this.imageData={},Ce(M,ti),c.loading&&Ce(p,dr),p.innerHTML="",p.appendChild(M),this.renderList(),d.innerHTML="";var A=function(){var N=n.imageData,O=Array.isArray(c.title)?c.title[1]:c.title;d.innerHTML=bh(Ue(O)?O.call(n,M,N):"".concat(S," (").concat(N.naturalWidth," × ").concat(N.naturalHeight,")"))},z,B;return Ee(o,ni,A,{once:!0}),this.viewing={abort:function(){Ge(o,ni,A),M.complete?n.imageRendering?n.imageRendering.abort():n.imageInitializing&&n.imageInitializing.abort():(M.src="",Ge(M,Qt,z),n.timeout&&clearTimeout(n.timeout))}},M.complete?this.load():(Ee(M,Qt,z=function(){Ge(M,Jn,B),n.load()},{once:!0}),Ee(M,Jn,B=function(){Ge(M,Qt,z),n.timeout&&(clearTimeout(n.timeout),n.timeout=!1),He(M,ti),c.loading&&He(n.canvas,dr)},{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){He(M,ti),n.timeout=!1},1e3)),this},prev:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.index-1;return a<0&&(a=n?this.length-1:0),this.view(a),this},next:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,a=this.length-1,o=this.index+1;return o>a&&(o=n?0:a),this.view(o),this},move:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,o=this.imageData;return this.moveTo(mr(n)?n:o.x+Number(n),mr(a)?a:o.y+Number(a)),this},moveTo:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,d=this.element,p=this.options,y=this.imageData;if(n=Number(n),o=Number(o),this.viewed&&!this.played&&p.movable){var m=y.x,w=y.y,S=!1;if(Ze(n)?S=!0:n=m,Ze(o)?S=!0:o=w,S){if(Ue(p.move)&&Ee(d,nl,p.move,{once:!0}),ot(d,nl,{x:n,y:o,oldX:m,oldY:w,originalEvent:c})===!1)return this;y.x=n,y.y=o,y.left=n,y.top=o,this.moving=!0,this.renderImage(function(){a.moving=!1,Ue(p.moved)&&Ee(d,rl,p.moved,{once:!0}),ot(d,rl,{x:n,y:o,oldX:m,oldY:w,originalEvent:c},{cancelable:!1})})}}return this},rotate:function(n){return this.rotateTo((this.imageData.rotate||0)+Number(n)),this},rotateTo:function(n){var a=this,o=this.element,c=this.options,d=this.imageData;if(n=Number(n),Ze(n)&&this.viewed&&!this.played&&c.rotatable){var p=d.rotate;if(Ue(c.rotate)&&Ee(o,il,c.rotate,{once:!0}),ot(o,il,{degree:n,oldDegree:p})===!1)return this;d.rotate=n,this.rotating=!0,this.renderImage(function(){a.rotating=!1,Ue(c.rotated)&&Ee(o,al,c.rotated,{once:!0}),ot(o,al,{degree:n,oldDegree:p},{cancelable:!1})})}return this},scaleX:function(n){return this.scale(n,this.imageData.scaleY),this},scaleY:function(n){return this.scale(this.imageData.scaleX,n),this},scale:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:n,c=this.element,d=this.options,p=this.imageData;if(n=Number(n),o=Number(o),this.viewed&&!this.played&&d.scalable){var y=p.scaleX,m=p.scaleY,w=!1;if(Ze(n)?w=!0:n=y,Ze(o)?w=!0:o=m,w){if(Ue(d.scale)&&Ee(c,sl,d.scale,{once:!0}),ot(c,sl,{scaleX:n,scaleY:o,oldScaleX:y,oldScaleY:m})===!1)return this;p.scaleX=n,p.scaleY=o,this.scaling=!0,this.renderImage(function(){a.scaling=!1,Ue(d.scaled)&&Ee(c,ol,d.scaled,{once:!0}),ot(c,ol,{scaleX:n,scaleY:o,oldScaleX:y,oldScaleY:m},{cancelable:!1})})}}return this},zoom:function(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,d=this.imageData;return n=Number(n),n<0?n=1/(1-n):n=1+n,this.zoomTo(d.width*n/d.naturalWidth,a,o,c),this},zoomTo:function(n){var a=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,p=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1,y=this.element,m=this.options,w=this.pointers,S=this.imageData,M=S.x,E=S.y,A=S.width,z=S.height,B=S.naturalWidth,P=S.naturalHeight;if(n=Math.max(0,n),Ze(n)&&this.viewed&&!this.played&&(p||m.zoomable)){if(!p){var N=Math.max(.01,m.minZoomRatio),O=Math.min(100,m.maxZoomRatio);n=Math.min(Math.max(n,N),O)}if(d)switch(d.type){case"wheel":m.zoomRatio>=.055&&n>.95&&n<1.05&&(n=1);break;case"pointermove":case"touchmove":case"mousemove":n>.99&&n<1.01&&(n=1);break}var W=B*n,X=P*n,ne=W-A,ue=X-z,se=S.ratio;if(Ue(m.zoom)&&Ee(y,ll,m.zoom,{once:!0}),ot(y,ll,{ratio:n,oldRatio:se,originalEvent:d})===!1)return this;if(this.zooming=!0,d){var he=kh(this.viewer),Oe=w&&Object.keys(w).length>0?Ch(w):{pageX:d.pageX,pageY:d.pageY};S.x-=ne*((Oe.pageX-he.left-M)/A),S.y-=ue*((Oe.pageY-he.top-E)/z)}else yr(c)&&Ze(c.x)&&Ze(c.y)?(S.x-=ne*((c.x-M)/A),S.y-=ue*((c.y-E)/z)):(S.x-=ne/2,S.y-=ue/2);S.left=S.x,S.top=S.y,S.width=W,S.height=X,S.oldRatio=se,S.ratio=n,this.renderImage(function(){a.zooming=!1,Ue(m.zoomed)&&Ee(y,ul,m.zoomed,{once:!0}),ot(y,ul,{ratio:n,oldRatio:se,originalEvent:d},{cancelable:!1})}),o&&this.tooltip()}return this},play:function(){var n=this,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!this.isShown||this.played)return this;var o=this.element,c=this.options;if(Ue(c.play)&&Ee(o,cl,c.play,{once:!0}),ot(o,cl)===!1)return this;var d=this.player,p=this.loadImage.bind(this),y=[],m=0,w=0;if(this.played=!0,this.onLoadWhenPlay=p,a&&this.requestFullscreen(a),Ce(d,pr),Xe(this.items,function(E,A){var z=E.querySelector("img"),B=document.createElement("img");B.src=xr(z,"originalUrl"),B.alt=z.getAttribute("alt"),B.referrerPolicy=z.referrerPolicy,m+=1,Ce(B,Xi),ii(B,at,c.transition),br(E,Ki)&&(Ce(B,Jt),w=A),y.push(B),Ee(B,Qt,p,{once:!0}),d.appendChild(B)}),Ze(c.interval)&&c.interval>0){var S=function(){clearTimeout(n.playing.timeout),He(y[w],Jt),w-=1,w=w>=0?w:m-1,Ce(y[w],Jt),n.playing.timeout=setTimeout(S,c.interval)},M=function(){clearTimeout(n.playing.timeout),He(y[w],Jt),w+=1,w=w<m?w:0,Ce(y[w],Jt),n.playing.timeout=setTimeout(M,c.interval)};m>1&&(this.playing={prev:S,next:M,timeout:setTimeout(M,c.interval)})}return this},stop:function(){var n=this;if(!this.played)return this;var a=this.element,o=this.options;if(Ue(o.stop)&&Ee(a,fl,o.stop,{once:!0}),ot(a,fl)===!1)return this;var c=this.player;return clearTimeout(this.playing.timeout),this.playing=!1,this.played=!1,Xe(c.getElementsByTagName("img"),function(d){Ge(d,Qt,n.onLoadWhenPlay)}),He(c,pr),c.innerHTML="",this.exitFullscreen(),this},full:function(){var n=this,a=this.options,o=this.viewer,c=this.image,d=this.list;return!this.isShown||this.played||this.fulled||!a.inline?this:(this.fulled=!0,this.open(),Ce(this.button,Bo),a.transition&&(He(d,at),this.viewed&&He(c,at)),Ce(o,Ya),o.setAttribute("role","dialog"),o.setAttribute("aria-labelledby",this.title.id),o.setAttribute("aria-modal",!0),o.removeAttribute("style"),rn(o,{zIndex:a.zIndex}),a.focus&&this.enforceFocus(),this.initContainer(),this.viewerData=qt({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){n.renderImage(function(){a.transition&&setTimeout(function(){Ce(c,at),Ce(d,at)},0)})}),this)},exit:function(){var n=this,a=this.options,o=this.viewer,c=this.image,d=this.list;return!this.isShown||this.played||!this.fulled||!a.inline?this:(this.fulled=!1,this.close(),He(this.button,Bo),a.transition&&(He(d,at),this.viewed&&He(c,at)),a.focus&&this.clearEnforceFocus(),o.removeAttribute("role"),o.removeAttribute("aria-labelledby"),o.removeAttribute("aria-modal"),He(o,Ya),rn(o,{zIndex:a.zIndexInline}),this.viewerData=qt({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){n.renderImage(function(){a.transition&&setTimeout(function(){Ce(c,at),Ce(d,at)},0)})}),this)},tooltip:function(){var n=this,a=this.options,o=this.tooltipBox,c=this.imageData;return!this.viewed||this.played||!a.tooltip?this:(o.textContent="".concat(Math.round(c.ratio*100),"%"),this.tooltipping?clearTimeout(this.tooltipping):a.transition?(this.fading&&ot(o,nn),Ce(o,pr),Ce(o,Xi),Ce(o,at),o.removeAttribute("aria-hidden"),o.initialOffsetWidth=o.offsetWidth,Ce(o,Jt)):(Ce(o,pr),o.removeAttribute("aria-hidden")),this.tooltipping=setTimeout(function(){a.transition?(Ee(o,nn,function(){He(o,pr),He(o,Xi),He(o,at),o.setAttribute("aria-hidden",!0),n.fading=!1},{once:!0}),He(o,Jt),n.fading=!0):(He(o,pr),o.setAttribute("aria-hidden",!0)),n.tooltipping=!1},1e3),this)},toggle:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.imageData.ratio===1?this.zoomTo(this.imageData.oldRatio,!0,null,n):this.zoomTo(1,!0,null,n),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=qt({},this.initialImageData),this.renderImage()),this},update:function(){var n=this,a=this.element,o=this.options,c=this.isImg;if(c&&!a.parentNode)return this.destroy();var d=[];if(Xe(c?[a]:a.querySelectorAll("img"),function(w){Ue(o.filter)?o.filter.call(n,w)&&d.push(w):n.getImageURL(w)&&d.push(w)}),!d.length)return this;if(this.images=d,this.length=d.length,this.ready){var p=[];if(Xe(this.items,function(w,S){var M=w.querySelector("img"),E=d[S];E&&M?(E.src!==M.src||E.alt!==M.alt)&&p.push(S):p.push(S)}),rn(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 m=this.items[this.index];Ce(m,Ki),m.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 n=this.element,a=this.options;return n[Ne]?(this.destroyed=!0,this.ready?(this.played&&this.stop(),a.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)):a.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),a.inline||Ge(n,gr,this.onStart),n[Ne]=void 0,this):this}},Dh={getImageURL:function(n){var a=this.options.url;return ri(a)?a=n.getAttribute(a):Ue(a)?a=a.call(this,n):a="",a},enforceFocus:function(){var n=this;this.clearEnforceFocus(),Ee(document,jo,this.onFocusin=function(a){var o=n.viewer,c=a.target;if(!(c===document||c===o||o.contains(c))){for(;c;){if(c.getAttribute("tabindex")!==null||c.getAttribute("aria-modal")==="true")return;c=c.parentElement}o.focus()}})},clearEnforceFocus:function(){this.onFocusin&&(Ge(document,jo,this.onFocusin),this.onFocusin=null)},open:function(){var n=this.body;Ce(n,Ho),this.scrollbarWidth>0&&(n.style.paddingRight="".concat(this.scrollbarWidth+(parseFloat(this.initialBodyComputedPaddingRight)||0),"px"))},close:function(){var n=this.body;He(n,Ho),this.scrollbarWidth>0&&(n.style.paddingRight=this.initialBodyPaddingRight)},shown:function(){var n=this.element,a=this.options,o=this.viewer;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,a.focus&&(o.focus(),this.enforceFocus()),Ue(a.shown)&&Ee(n,Qo,a.shown,{once:!0}),ot(n,Qo)!==!1&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var n=this.element,a=this.options,o=this.viewer;a.fucus&&this.clearEnforceFocus(),this.close(),this.unbind(),Ce(o,Vn),o.removeAttribute("role"),o.removeAttribute("aria-labelledby"),o.removeAttribute("aria-modal"),o.setAttribute("aria-hidden",!0),this.resetList(),this.resetImage(),this.fulled=!1,this.viewed=!1,this.isShown=!1,this.hiding=!1,this.destroyed||(Ue(a.hidden)&&Ee(n,el,a.hidden,{once:!0}),ot(n,el,null,{cancelable:!1}))},requestFullscreen:function(n){var a=this.element.ownerDocument;if(this.fulled&&!(a.fullscreenElement||a.webkitFullscreenElement||a.mozFullScreenElement||a.msFullscreenElement)){var o=a.documentElement;o.requestFullscreen?yr(n)?o.requestFullscreen(n):o.requestFullscreen():o.webkitRequestFullscreen?o.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):o.mozRequestFullScreen?o.mozRequestFullScreen():o.msRequestFullscreen&&o.msRequestFullscreen()}},exitFullscreen:function(){var n=this.element.ownerDocument;this.fulled&&(n.fullscreenElement||n.webkitFullscreenElement||n.mozFullScreenElement||n.msFullscreenElement)&&(n.exitFullscreen?n.exitFullscreen():n.webkitExitFullscreen?n.webkitExitFullscreen():n.mozCancelFullScreen?n.mozCancelFullScreen():n.msExitFullscreen&&n.msExitFullscreen())},change:function(n){var a=this.options,o=this.pointers,c=o[Object.keys(o)[0]];if(c){var d=c.endX-c.startX,p=c.endY-c.startY;switch(this.action){case Gi:(d!==0||p!==0)&&(this.pointerMoved=!0,this.move(d,p,n));break;case ei:this.zoom(Sh(o),!1,null,n);break;case zo:{this.action="switched";var y=Math.abs(d);y>1&&y>Math.abs(p)&&(this.pointers={},d>1?this.prev(a.loop):d<-1&&this.next(a.loop));break}}Xe(o,function(m){m.startX=m.endX,m.startY=m.endY})}},isSwitchable:function(){var n=this.imageData,a=this.viewerData;return this.length>1&&n.x>=0&&n.y>=0&&n.width<=a.width&&n.height<=a.height}},Ah=wn.Viewer,Ih=function(l){return function(){return l+=1,l}}(-1),pl=function(){function l(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(nh(this,l),!n||n.nodeType!==1)throw new Error("The first argument is required and must be an element.");this.element=n,this.options=qt({},$o,yr(a)&&a),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=Ih(),this.init()}return rh(l,[{key:"init",value:function(){var a=this,o=this.element,c=this.options;if(!o[Ne]){o[Ne]=this,c.focus&&!c.keyboard&&(c.focus=!1);var d=o.localName==="img",p=[];if(Xe(d?[o]:o.querySelectorAll("img"),function(w){Ue(c.filter)?c.filter.call(a,w)&&p.push(w):a.getImageURL(w)&&p.push(w)}),this.isImg=d,this.length=p.length,this.images=p,this.initBody(),mr(document.createElement(Ne).style.transition)&&(c.transition=!1),c.inline){var y=0,m=function(){if(y+=1,y===a.length){var S;a.initializing=!1,a.delaying={abort:function(){clearTimeout(S)}},S=setTimeout(function(){a.delaying=!1,a.build()},0)}};this.initializing={abort:function(){Xe(p,function(S){S.complete||(Ge(S,Qt,m),Ge(S,Jn,m))})}},Xe(p,function(w){if(w.complete)m();else{var S,M;Ee(w,Qt,S=function(){Ge(w,Jn,M),m()},{once:!0}),Ee(w,Jn,M=function(){Ge(w,Qt,S),m()},{once:!0})}})}else Ee(o,gr,this.onStart=function(w){var S=w.target;S.localName==="img"&&(!Ue(c.filter)||c.filter.call(a,S))&&a.view(a.images.indexOf(S))})}}},{key:"build",value:function(){if(!this.ready){var a=this.element,o=this.options,c=a.parentNode,d=document.createElement("div");d.innerHTML=sh;var p=d.querySelector(".".concat(Ne,"-container")),y=p.querySelector(".".concat(Ne,"-title")),m=p.querySelector(".".concat(Ne,"-toolbar")),w=p.querySelector(".".concat(Ne,"-navbar")),S=p.querySelector(".".concat(Ne,"-button")),M=p.querySelector(".".concat(Ne,"-canvas"));if(this.parent=c,this.viewer=p,this.title=y,this.toolbar=m,this.navbar=w,this.button=S,this.canvas=M,this.footer=p.querySelector(".".concat(Ne,"-footer")),this.tooltipBox=p.querySelector(".".concat(Ne,"-tooltip")),this.player=p.querySelector(".".concat(Ne,"-player")),this.list=p.querySelector(".".concat(Ne,"-list")),p.id="".concat(Ne).concat(this.id),y.id="".concat(Ne,"Title").concat(this.id),Ce(y,o.title?Qi(Array.isArray(o.title)?o.title[0]:o.title):Vn),Ce(w,o.navbar?Qi(o.navbar):Vn),ii(S,Vn,!o.button),o.keyboard&&S.setAttribute("tabindex",0),o.backdrop&&(Ce(p,"".concat(Ne,"-backdrop")),!o.inline&&o.backdrop!=="static"&&Za(M,Yi,"hide")),ri(o.className)&&o.className&&o.className.split(Ja).forEach(function(W){Ce(p,W)}),o.toolbar){var E=document.createElement("ul"),A=yr(o.toolbar),z=Vi.slice(0,3),B=Vi.slice(7,9),P=Vi.slice(9);A||Ce(m,Qi(o.toolbar)),Xe(A?o.toolbar:Vi,function(W,X){var ne=A&&yr(W),ue=A?Qa(X):W,se=ne&&!mr(W.show)?W.show:W;if(!(!se||!o.zoomable&&z.indexOf(ue)!==-1||!o.rotatable&&B.indexOf(ue)!==-1||!o.scalable&&P.indexOf(ue)!==-1)){var he=ne&&!mr(W.size)?W.size:W,Oe=ne&&!mr(W.click)?W.click:W,Me=document.createElement("li");o.keyboard&&Me.setAttribute("tabindex",0),Me.setAttribute("role","button"),Ce(Me,"".concat(Ne,"-").concat(ue)),Ue(Oe)||Za(Me,Yi,ue),Ze(se)&&Ce(Me,Qi(se)),["small","large"].indexOf(he)!==-1?Ce(Me,"".concat(Ne,"-").concat(he)):ue==="play"&&Ce(Me,"".concat(Ne,"-large")),Ue(Oe)&&Ee(Me,gr,Oe),E.appendChild(Me)}}),m.appendChild(E)}else Ce(m,Vn);if(!o.rotatable){var N=m.querySelectorAll('li[class*="rotate"]');Ce(N,ti),Xe(N,function(W){m.appendChild(W)})}if(o.inline)Ce(S,lh),rn(p,{zIndex:o.zIndexInline}),window.getComputedStyle(c).position==="static"&&rn(c,{position:"relative"}),c.insertBefore(p,a.nextSibling);else{Ce(S,oh),Ce(p,Ya),Ce(p,Xi),Ce(p,Vn),rn(p,{zIndex:o.zIndex});var O=o.container;ri(O)&&(O=a.ownerDocument.querySelector(O)),O||(O=this.body),O.appendChild(p)}if(o.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,Ue(o.ready)&&Ee(a,Vo,o.ready,{once:!0}),ot(a,Vo)===!1){this.ready=!1;return}this.ready&&o.inline&&this.view(this.index)}}}],[{key:"noConflict",value:function(){return window.Viewer=Ah,l}},{key:"setDefaults",value:function(a){qt($o,yr(a)&&a)}}])}();qt(pl.prototype,Th,_h,Lh,Eh,Dh);var Oh=typeof global=="object"&&global&&global.Object===Object&&global,gl=Oh,Nh=typeof self=="object"&&self&&self.Object===Object&&self,Rh=gl||Nh||Function("return this")(),ts=Rh,Mh=ts.Symbol,ea=Mh,ml=Object.prototype,Fh=ml.hasOwnProperty,Ph=ml.toString,ai=ea?ea.toStringTag:void 0;function $h(l){var n=Fh.call(l,ai),a=l[ai];try{l[ai]=void 0;var o=!0}catch{}var c=Ph.call(l);return o&&(n?l[ai]=a:delete l[ai]),c}var zh=Object.prototype,Bh=zh.toString;function Hh(l){return Bh.call(l)}var Wh="[object Null]",jh="[object Undefined]",vl=ea?ea.toStringTag:void 0;function ns(l){return l==null?l===void 0?jh:Wh:vl&&vl in Object(l)?$h(l):Hh(l)}function rs(l){return l!=null&&typeof l=="object"}var qh=Array.isArray,Uh=qh;function is(l){var n=typeof l;return l!=null&&(n=="object"||n=="function")}function yl(l){return l}var Gh="[object AsyncFunction]",Kh="[object Function]",Xh="[object GeneratorFunction]",Yh="[object Proxy]";function bl(l){if(!is(l))return!1;var n=ns(l);return n==Kh||n==Xh||n==Gh||n==Yh}var Vh=ts["__core-js_shared__"],as=Vh,xl=function(){var l=/[^.]+$/.exec(as&&as.keys&&as.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""}();function Jh(l){return!!xl&&xl in l}var Qh=Function.prototype,Zh=Qh.toString;function ed(l){if(l!=null){try{return Zh.call(l)}catch{}try{return l+""}catch{}}return""}var td=/[\\^$.*+?()[\]{}|]/g,nd=/^\[object .+?Constructor\]$/,rd=Function.prototype,id=Object.prototype,ad=rd.toString,sd=id.hasOwnProperty,od=RegExp("^"+ad.call(sd).replace(td,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function ld(l){if(!is(l)||Jh(l))return!1;var n=bl(l)?od:nd;return n.test(ed(l))}function ud(l,n){return l==null?void 0:l[n]}function cd(l,n){var a=ud(l,n);return ld(a)?a:void 0}function fd(l,n,a){switch(a.length){case 0:return l.call(n);case 1:return l.call(n,a[0]);case 2:return l.call(n,a[0],a[1]);case 3:return l.call(n,a[0],a[1],a[2])}return l.apply(n,a)}var hd=800,dd=16,pd=Date.now;function gd(l){var n=0,a=0;return function(){var o=pd(),c=dd-(o-a);if(a=o,c>0){if(++n>=hd)return arguments[0]}else n=0;return l.apply(void 0,arguments)}}function md(l){return function(){return l}}var vd=function(){try{var l=cd(Object,"defineProperty");return l({},"",{}),l}catch{}}(),ta=vd,yd=ta?function(l,n){return ta(l,"toString",{configurable:!0,enumerable:!1,value:md(n),writable:!0})}:yl,bd=yd,xd=gd(bd),kd=xd,wd=9007199254740991,Sd=/^(?:0|[1-9]\d*)$/;function kl(l,n){var a=typeof l;return n=n??wd,!!n&&(a=="number"||a!="symbol"&&Sd.test(l))&&l>-1&&l%1==0&&l<n}function wl(l,n,a){n=="__proto__"&&ta?ta(l,n,{configurable:!0,enumerable:!0,value:a,writable:!0}):l[n]=a}function Sl(l,n){return l===n||l!==l&&n!==n}var Cd=Object.prototype,Td=Cd.hasOwnProperty;function Cl(l,n,a){var o=l[n];(!(Td.call(l,n)&&Sl(o,a))||a===void 0&&!(n in l))&&wl(l,n,a)}function _d(l,n,a,o){var c=!a;a||(a={});for(var d=-1,p=n.length;++d<p;){var y=n[d],m=void 0;m===void 0&&(m=l[y]),c?wl(a,y,m):Cl(a,y,m)}return a}var Tl=Math.max;function Ld(l,n,a){return n=Tl(n===void 0?l.length-1:n,0),function(){for(var o=arguments,c=-1,d=Tl(o.length-n,0),p=Array(d);++c<d;)p[c]=o[n+c];c=-1;for(var y=Array(n+1);++c<n;)y[c]=o[c];return y[n]=a(p),fd(l,this,y)}}function Ed(l,n){return kd(Ld(l,n,yl),l+"")}var Dd=9007199254740991;function _l(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=Dd}function ss(l){return l!=null&&_l(l.length)&&!bl(l)}function Ad(l,n,a){if(!is(a))return!1;var o=typeof n;return(o=="number"?ss(a)&&kl(n,a.length):o=="string"&&n in a)?Sl(a[n],l):!1}function Id(l){return Ed(function(n,a){var o=-1,c=a.length,d=c>1?a[c-1]:void 0,p=c>2?a[2]:void 0;for(d=l.length>3&&typeof d=="function"?(c--,d):void 0,p&&Ad(a[0],a[1],p)&&(d=c<3?void 0:d,c=1),n=Object(n);++o<c;){var y=a[o];y&&l(n,y,o,d)}return n})}var Od=Object.prototype;function Ll(l){var n=l&&l.constructor,a=typeof n=="function"&&n.prototype||Od;return l===a}function Nd(l,n){for(var a=-1,o=Array(l);++a<l;)o[a]=n(a);return o}var Rd="[object Arguments]";function El(l){return rs(l)&&ns(l)==Rd}var Dl=Object.prototype,Md=Dl.hasOwnProperty,Fd=Dl.propertyIsEnumerable,Pd=El(function(){return arguments}())?El:function(l){return rs(l)&&Md.call(l,"callee")&&!Fd.call(l,"callee")},$d=Pd;function zd(){return!1}var Al=typeof Ie=="object"&&Ie&&!Ie.nodeType&&Ie,Il=Al&&typeof module=="object"&&module&&!module.nodeType&&module,Bd=Il&&Il.exports===Al,Ol=Bd?ts.Buffer:void 0,Hd=Ol?Ol.isBuffer:void 0,Wd=Hd||zd,jd=Wd,qd="[object Arguments]",Ud="[object Array]",Gd="[object Boolean]",Kd="[object Date]",Xd="[object Error]",Yd="[object Function]",Vd="[object Map]",Jd="[object Number]",Qd="[object Object]",Zd="[object RegExp]",ep="[object Set]",tp="[object String]",np="[object WeakMap]",rp="[object ArrayBuffer]",ip="[object DataView]",ap="[object Float32Array]",sp="[object Float64Array]",op="[object Int8Array]",lp="[object Int16Array]",up="[object Int32Array]",cp="[object Uint8Array]",fp="[object Uint8ClampedArray]",hp="[object Uint16Array]",dp="[object Uint32Array]",Ye={};Ye[ap]=Ye[sp]=Ye[op]=Ye[lp]=Ye[up]=Ye[cp]=Ye[fp]=Ye[hp]=Ye[dp]=!0,Ye[qd]=Ye[Ud]=Ye[rp]=Ye[Gd]=Ye[ip]=Ye[Kd]=Ye[Xd]=Ye[Yd]=Ye[Vd]=Ye[Jd]=Ye[Qd]=Ye[Zd]=Ye[ep]=Ye[tp]=Ye[np]=!1;function pp(l){return rs(l)&&_l(l.length)&&!!Ye[ns(l)]}function gp(l){return function(n){return l(n)}}var Nl=typeof Ie=="object"&&Ie&&!Ie.nodeType&&Ie,si=Nl&&typeof module=="object"&&module&&!module.nodeType&&module,mp=si&&si.exports===Nl,os=mp&&gl.process,vp=function(){try{var l=si&&si.require&&si.require("util").types;return l||os&&os.binding&&os.binding("util")}catch{}}(),Rl=vp,Ml=Rl&&Rl.isTypedArray,yp=Ml?gp(Ml):pp,bp=yp,xp=Object.prototype,kp=xp.hasOwnProperty;function wp(l,n){var a=Uh(l),o=!a&&$d(l),c=!a&&!o&&jd(l),d=!a&&!o&&!c&&bp(l),p=a||o||c||d,y=p?Nd(l.length,String):[],m=y.length;for(var w in l)kp.call(l,w)&&!(p&&(w=="length"||c&&(w=="offset"||w=="parent")||d&&(w=="buffer"||w=="byteLength"||w=="byteOffset")||kl(w,m)))&&y.push(w);return y}function Sp(l,n){return function(a){return l(n(a))}}var Cp=Sp(Object.keys,Object),Tp=Cp,_p=Object.prototype,Lp=_p.hasOwnProperty;function Ep(l){if(!Ll(l))return Tp(l);var n=[];for(var a in Object(l))Lp.call(l,a)&&a!="constructor"&&n.push(a);return n}function Dp(l){return ss(l)?wp(l):Ep(l)}var Ap=Object.prototype,Ip=Ap.hasOwnProperty,Op=Id(function(l,n){if(Ll(n)||ss(n)){_d(n,Dp(n),l);return}for(var a in n)Ip.call(n,a)&&Cl(l,a,n[a])}),Np=Op;const Fl=({images:l=[],options:n={}}={})=>{n=Np(n,{inline:!1});const a=Kc.extend({render(p){return p("div",{style:{display:"none"},class:["__viewer-token"]},l.map(y=>p("img",{attrs:typeof y=="string"?{src:y}:y})))}}),o=new a;o.$mount(),document.body.appendChild(o.$el);const c=new pl(o.$el,n),d=c.destroy.bind(c);return c.destroy=function(){return d(),o.$destroy(),document.body.removeChild(o.$el),c},c.show(),o.$el.addEventListener("hidden",function(){this.viewer===c&&c.destroy()}),c};var Pl={exports:{}},$l;function Rp(){return $l||($l=1,function(l,n){(function(a){a(Wt())})(function(a){var o={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},c={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};a.defineMode("xml",function(d,p){var y=d.indentUnit,m={},w=p.htmlMode?o:c;for(var S in w)m[S]=w[S];for(var S in p)m[S]=p[S];var M,E;function A(k,J){function G(K){return J.tokenize=K,K(k,J)}var D=k.next();if(D=="<")return k.eat("!")?k.eat("[")?k.match("CDATA[")?G(P("atom","]]>")):null:k.match("--")?G(P("comment","-->")):k.match("DOCTYPE",!0,!0)?(k.eatWhile(/[\w\._\-]/),G(N(1))):null:k.eat("?")?(k.eatWhile(/[\w\._\-]/),J.tokenize=P("meta","?>"),"meta"):(M=k.eat("/")?"closeTag":"openTag",J.tokenize=z,"tag bracket");if(D=="&"){var F;return k.eat("#")?k.eat("x")?F=k.eatWhile(/[a-fA-F\d]/)&&k.eat(";"):F=k.eatWhile(/[\d]/)&&k.eat(";"):F=k.eatWhile(/[\w\.\-:]/)&&k.eat(";"),F?"atom":"error"}else return k.eatWhile(/[^&<]/),null}A.isInText=!0;function z(k,J){var G=k.next();if(G==">"||G=="/"&&k.eat(">"))return J.tokenize=A,M=G==">"?"endTag":"selfcloseTag","tag bracket";if(G=="=")return M="equals",null;if(G=="<"){J.tokenize=A,J.state=ue,J.tagName=J.tagStart=null;var D=J.tokenize(k,J);return D?D+" tag error":"tag error"}else return/[\'\"]/.test(G)?(J.tokenize=B(G),J.stringStartCol=k.column(),J.tokenize(k,J)):(k.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function B(k){var J=function(G,D){for(;!G.eol();)if(G.next()==k){D.tokenize=z;break}return"string"};return J.isInAttribute=!0,J}function P(k,J){return function(G,D){for(;!G.eol();){if(G.match(J)){D.tokenize=A;break}G.next()}return k}}function N(k){return function(J,G){for(var D;(D=J.next())!=null;){if(D=="<")return G.tokenize=N(k+1),G.tokenize(J,G);if(D==">")if(k==1){G.tokenize=A;break}else return G.tokenize=N(k-1),G.tokenize(J,G)}return"meta"}}function O(k){return k&&k.toLowerCase()}function W(k,J,G){this.prev=k.context,this.tagName=J||"",this.indent=k.indented,this.startOfLine=G,(m.doNotIndent.hasOwnProperty(J)||k.context&&k.context.noIndent)&&(this.noIndent=!0)}function X(k){k.context&&(k.context=k.context.prev)}function ne(k,J){for(var G;;){if(!k.context||(G=k.context.tagName,!m.contextGrabbers.hasOwnProperty(O(G))||!m.contextGrabbers[O(G)].hasOwnProperty(O(J))))return;X(k)}}function ue(k,J,G){return k=="openTag"?(G.tagStart=J.column(),se):k=="closeTag"?he:ue}function se(k,J,G){return k=="word"?(G.tagName=J.current(),E="tag",ie):m.allowMissingTagName&&k=="endTag"?(E="tag bracket",ie(k,J,G)):(E="error",se)}function he(k,J,G){if(k=="word"){var D=J.current();return G.context&&G.context.tagName!=D&&m.implicitlyClosed.hasOwnProperty(O(G.context.tagName))&&X(G),G.context&&G.context.tagName==D||m.matchClosing===!1?(E="tag",Oe):(E="tag error",Me)}else return m.allowMissingTagName&&k=="endTag"?(E="tag bracket",Oe(k,J,G)):(E="error",Me)}function Oe(k,J,G){return k!="endTag"?(E="error",Oe):(X(G),ue)}function Me(k,J,G){return E="error",Oe(k,J,G)}function ie(k,J,G){if(k=="word")return E="attribute",$e;if(k=="endTag"||k=="selfcloseTag"){var D=G.tagName,F=G.tagStart;return G.tagName=G.tagStart=null,k=="selfcloseTag"||m.autoSelfClosers.hasOwnProperty(O(D))?ne(G,D):(ne(G,D),G.context=new W(G,D,F==G.indented)),ue}return E="error",ie}function $e(k,J,G){return k=="equals"?j:(m.allowMissing||(E="error"),ie(k,J,G))}function j(k,J,G){return k=="string"?Q:k=="word"&&m.allowUnquoted?(E="string",ie):(E="error",ie(k,J,G))}function Q(k,J,G){return k=="string"?Q:ie(k,J,G)}return{startState:function(k){var J={tokenize:A,state:ue,indented:k||0,tagName:null,tagStart:null,context:null};return k!=null&&(J.baseIndent=k),J},token:function(k,J){if(!J.tagName&&k.sol()&&(J.indented=k.indentation()),k.eatSpace())return null;M=null;var G=J.tokenize(k,J);return(G||M)&&G!="comment"&&(E=null,J.state=J.state(M||G,k,J),E&&(G=E=="error"?G+" error":E)),G},indent:function(k,J,G){var D=k.context;if(k.tokenize.isInAttribute)return k.tagStart==k.indented?k.stringStartCol+1:k.indented+y;if(D&&D.noIndent)return a.Pass;if(k.tokenize!=z&&k.tokenize!=A)return G?G.match(/^(\s*)/)[0].length:0;if(k.tagName)return m.multilineTagIndentPastTag!==!1?k.tagStart+k.tagName.length+2:k.tagStart+y*(m.multilineTagIndentFactor||1);if(m.alignCDATA&&/<!\[CDATA\[/.test(J))return 0;var F=J&&/^<(\/)?([\w_:\.-]*)/.exec(J);if(F&&F[1])for(;D;)if(D.tagName==F[2]){D=D.prev;break}else if(m.implicitlyClosed.hasOwnProperty(O(D.tagName)))D=D.prev;else break;else if(F)for(;D;){var K=m.contextGrabbers[O(D.tagName)];if(K&&K.hasOwnProperty(O(F[2])))D=D.prev;else break}for(;D&&D.prev&&!D.startOfLine;)D=D.prev;return D?D.indent+y:k.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:m.htmlMode?"html":"xml",helperType:m.htmlMode?"html":"xml",skipAttribute:function(k){k.state==j&&(k.state=ie)},xmlCurrentTag:function(k){return k.tagName?{name:k.tagName,close:k.type=="closeTag"}:null},xmlCurrentContext:function(k){for(var J=[],G=k.context;G;G=G.prev)J.push(G.tagName);return J.reverse()}}}),a.defineMIME("text/xml","xml"),a.defineMIME("application/xml","xml"),a.mimeModes.hasOwnProperty("text/html")||a.defineMIME("text/html",{name:"xml",htmlMode:!0})})}()),Pl.exports}var zl={exports:{}},Bl;function Mp(){return Bl||(Bl=1,function(l,n){(function(a){a(Wt())})(function(a){a.modeInfo=[{name:"APL",mime:"text/apl",mode:"apl",ext:["dyalog","apl"]},{name:"PGP",mimes:["application/pgp","application/pgp-encrypted","application/pgp-keys","application/pgp-signature"],mode:"asciiarmor",ext:["asc","pgp","sig"]},{name:"ASN.1",mime:"text/x-ttcn-asn",mode:"asn.1",ext:["asn","asn1"]},{name:"Asterisk",mime:"text/x-asterisk",mode:"asterisk",file:/^extensions\.conf$/i},{name:"Brainfuck",mime:"text/x-brainfuck",mode:"brainfuck",ext:["b","bf"]},{name:"C",mime:"text/x-csrc",mode:"clike",ext:["c","h","ino"]},{name:"C++",mime:"text/x-c++src",mode:"clike",ext:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],alias:["cpp"]},{name:"Cobol",mime:"text/x-cobol",mode:"cobol",ext:["cob","cpy","cbl"]},{name:"C#",mime:"text/x-csharp",mode:"clike",ext:["cs"],alias:["csharp","cs"]},{name:"Clojure",mime:"text/x-clojure",mode:"clojure",ext:["clj","cljc","cljx"]},{name:"ClojureScript",mime:"text/x-clojurescript",mode:"clojure",ext:["cljs"]},{name:"Closure Stylesheets (GSS)",mime:"text/x-gss",mode:"css",ext:["gss"]},{name:"CMake",mime:"text/x-cmake",mode:"cmake",ext:["cmake","cmake.in"],file:/^CMakeLists\.txt$/},{name:"CoffeeScript",mimes:["application/vnd.coffeescript","text/coffeescript","text/x-coffeescript"],mode:"coffeescript",ext:["coffee"],alias:["coffee","coffee-script"]},{name:"Common Lisp",mime:"text/x-common-lisp",mode:"commonlisp",ext:["cl","lisp","el"],alias:["lisp"]},{name:"Cypher",mime:"application/x-cypher-query",mode:"cypher",ext:["cyp","cypher"]},{name:"Cython",mime:"text/x-cython",mode:"python",ext:["pyx","pxd","pxi"]},{name:"Crystal",mime:"text/x-crystal",mode:"crystal",ext:["cr"]},{name:"CSS",mime:"text/css",mode:"css",ext:["css"]},{name:"CQL",mime:"text/x-cassandra",mode:"sql",ext:["cql"]},{name:"D",mime:"text/x-d",mode:"d",ext:["d"]},{name:"Dart",mimes:["application/dart","text/x-dart"],mode:"dart",ext:["dart"]},{name:"diff",mime:"text/x-diff",mode:"diff",ext:["diff","patch"]},{name:"Django",mime:"text/x-django",mode:"django"},{name:"Dockerfile",mime:"text/x-dockerfile",mode:"dockerfile",file:/^Dockerfile$/},{name:"DTD",mime:"application/xml-dtd",mode:"dtd",ext:["dtd"]},{name:"Dylan",mime:"text/x-dylan",mode:"dylan",ext:["dylan","dyl","intr"]},{name:"EBNF",mime:"text/x-ebnf",mode:"ebnf"},{name:"ECL",mime:"text/x-ecl",mode:"ecl",ext:["ecl"]},{name:"edn",mime:"application/edn",mode:"clojure",ext:["edn"]},{name:"Eiffel",mime:"text/x-eiffel",mode:"eiffel",ext:["e"]},{name:"Elm",mime:"text/x-elm",mode:"elm",ext:["elm"]},{name:"Embedded JavaScript",mime:"application/x-ejs",mode:"htmlembedded",ext:["ejs"]},{name:"Embedded Ruby",mime:"application/x-erb",mode:"htmlembedded",ext:["erb"]},{name:"Erlang",mime:"text/x-erlang",mode:"erlang",ext:["erl"]},{name:"Esper",mime:"text/x-esper",mode:"sql"},{name:"Factor",mime:"text/x-factor",mode:"factor",ext:["factor"]},{name:"FCL",mime:"text/x-fcl",mode:"fcl"},{name:"Forth",mime:"text/x-forth",mode:"forth",ext:["forth","fth","4th"]},{name:"Fortran",mime:"text/x-fortran",mode:"fortran",ext:["f","for","f77","f90","f95"]},{name:"F#",mime:"text/x-fsharp",mode:"mllike",ext:["fs"],alias:["fsharp"]},{name:"Gas",mime:"text/x-gas",mode:"gas",ext:["s"]},{name:"Gherkin",mime:"text/x-feature",mode:"gherkin",ext:["feature"]},{name:"GitHub Flavored Markdown",mime:"text/x-gfm",mode:"gfm",file:/^(readme|contributing|history)\.md$/i},{name:"Go",mime:"text/x-go",mode:"go",ext:["go"]},{name:"Groovy",mime:"text/x-groovy",mode:"groovy",ext:["groovy","gradle"],file:/^Jenkinsfile$/},{name:"HAML",mime:"text/x-haml",mode:"haml",ext:["haml"]},{name:"Haskell",mime:"text/x-haskell",mode:"haskell",ext:["hs"]},{name:"Haskell (Literate)",mime:"text/x-literate-haskell",mode:"haskell-literate",ext:["lhs"]},{name:"Haxe",mime:"text/x-haxe",mode:"haxe",ext:["hx"]},{name:"HXML",mime:"text/x-hxml",mode:"haxe",ext:["hxml"]},{name:"ASP.NET",mime:"application/x-aspx",mode:"htmlembedded",ext:["aspx"],alias:["asp","aspx"]},{name:"HTML",mime:"text/html",mode:"htmlmixed",ext:["html","htm","handlebars","hbs"],alias:["xhtml"]},{name:"HTTP",mime:"message/http",mode:"http"},{name:"IDL",mime:"text/x-idl",mode:"idl",ext:["pro"]},{name:"Pug",mime:"text/x-pug",mode:"pug",ext:["jade","pug"],alias:["jade"]},{name:"Java",mime:"text/x-java",mode:"clike",ext:["java"]},{name:"Java Server Pages",mime:"application/x-jsp",mode:"htmlembedded",ext:["jsp"],alias:["jsp"]},{name:"JavaScript",mimes:["text/javascript","text/ecmascript","application/javascript","application/x-javascript","application/ecmascript"],mode:"javascript",ext:["js"],alias:["ecmascript","js","node"]},{name:"JSON",mimes:["application/json","application/x-json"],mode:"javascript",ext:["json","map"],alias:["json5"]},{name:"JSON-LD",mime:"application/ld+json",mode:"javascript",ext:["jsonld"],alias:["jsonld"]},{name:"JSX",mime:"text/jsx",mode:"jsx",ext:["jsx"]},{name:"Jinja2",mime:"text/jinja2",mode:"jinja2",ext:["j2","jinja","jinja2"]},{name:"Julia",mime:"text/x-julia",mode:"julia",ext:["jl"],alias:["jl"]},{name:"Kotlin",mime:"text/x-kotlin",mode:"clike",ext:["kt"]},{name:"LESS",mime:"text/x-less",mode:"css",ext:["less"]},{name:"LiveScript",mime:"text/x-livescript",mode:"livescript",ext:["ls"],alias:["ls"]},{name:"Lua",mime:"text/x-lua",mode:"lua",ext:["lua"]},{name:"Markdown",mime:"text/x-markdown",mode:"markdown",ext:["markdown","md","mkd"]},{name:"mIRC",mime:"text/mirc",mode:"mirc"},{name:"MariaDB SQL",mime:"text/x-mariadb",mode:"sql"},{name:"Mathematica",mime:"text/x-mathematica",mode:"mathematica",ext:["m","nb","wl","wls"]},{name:"Modelica",mime:"text/x-modelica",mode:"modelica",ext:["mo"]},{name:"MUMPS",mime:"text/x-mumps",mode:"mumps",ext:["mps"]},{name:"MS SQL",mime:"text/x-mssql",mode:"sql"},{name:"mbox",mime:"application/mbox",mode:"mbox",ext:["mbox"]},{name:"MySQL",mime:"text/x-mysql",mode:"sql"},{name:"Nginx",mime:"text/x-nginx-conf",mode:"nginx",file:/nginx.*\.conf$/i},{name:"NSIS",mime:"text/x-nsis",mode:"nsis",ext:["nsh","nsi"]},{name:"NTriples",mimes:["application/n-triples","application/n-quads","text/n-triples"],mode:"ntriples",ext:["nt","nq"]},{name:"Objective-C",mime:"text/x-objectivec",mode:"clike",ext:["m"],alias:["objective-c","objc"]},{name:"Objective-C++",mime:"text/x-objectivec++",mode:"clike",ext:["mm"],alias:["objective-c++","objc++"]},{name:"OCaml",mime:"text/x-ocaml",mode:"mllike",ext:["ml","mli","mll","mly"]},{name:"Octave",mime:"text/x-octave",mode:"octave",ext:["m"]},{name:"Oz",mime:"text/x-oz",mode:"oz",ext:["oz"]},{name:"Pascal",mime:"text/x-pascal",mode:"pascal",ext:["p","pas"]},{name:"PEG.js",mime:"null",mode:"pegjs",ext:["jsonld"]},{name:"Perl",mime:"text/x-perl",mode:"perl",ext:["pl","pm"]},{name:"PHP",mimes:["text/x-php","application/x-httpd-php","application/x-httpd-php-open"],mode:"php",ext:["php","php3","php4","php5","php7","phtml"]},{name:"Pig",mime:"text/x-pig",mode:"pig",ext:["pig"]},{name:"Plain Text",mime:"text/plain",mode:"null",ext:["txt","text","conf","def","list","log"]},{name:"PLSQL",mime:"text/x-plsql",mode:"sql",ext:["pls"]},{name:"PostgreSQL",mime:"text/x-pgsql",mode:"sql"},{name:"PowerShell",mime:"application/x-powershell",mode:"powershell",ext:["ps1","psd1","psm1"]},{name:"Properties files",mime:"text/x-properties",mode:"properties",ext:["properties","ini","in"],alias:["ini","properties"]},{name:"ProtoBuf",mime:"text/x-protobuf",mode:"protobuf",ext:["proto"]},{name:"Python",mime:"text/x-python",mode:"python",ext:["BUILD","bzl","py","pyw"],file:/^(BUCK|BUILD)$/},{name:"Puppet",mime:"text/x-puppet",mode:"puppet",ext:["pp"]},{name:"Q",mime:"text/x-q",mode:"q",ext:["q"]},{name:"R",mime:"text/x-rsrc",mode:"r",ext:["r","R"],alias:["rscript"]},{name:"reStructuredText",mime:"text/x-rst",mode:"rst",ext:["rst"],alias:["rst"]},{name:"RPM Changes",mime:"text/x-rpm-changes",mode:"rpm"},{name:"RPM Spec",mime:"text/x-rpm-spec",mode:"rpm",ext:["spec"]},{name:"Ruby",mime:"text/x-ruby",mode:"ruby",ext:["rb"],alias:["jruby","macruby","rake","rb","rbx"]},{name:"Rust",mime:"text/x-rustsrc",mode:"rust",ext:["rs"]},{name:"SAS",mime:"text/x-sas",mode:"sas",ext:["sas"]},{name:"Sass",mime:"text/x-sass",mode:"sass",ext:["sass"]},{name:"Scala",mime:"text/x-scala",mode:"clike",ext:["scala"]},{name:"Scheme",mime:"text/x-scheme",mode:"scheme",ext:["scm","ss"]},{name:"SCSS",mime:"text/x-scss",mode:"css",ext:["scss"]},{name:"Shell",mimes:["text/x-sh","application/x-sh"],mode:"shell",ext:["sh","ksh","bash"],alias:["bash","sh","zsh"],file:/^PKGBUILD$/},{name:"Sieve",mime:"application/sieve",mode:"sieve",ext:["siv","sieve"]},{name:"Slim",mimes:["text/x-slim","application/x-slim"],mode:"slim",ext:["slim"]},{name:"Smalltalk",mime:"text/x-stsrc",mode:"smalltalk",ext:["st"]},{name:"Smarty",mime:"text/x-smarty",mode:"smarty",ext:["tpl"]},{name:"Solr",mime:"text/x-solr",mode:"solr"},{name:"SML",mime:"text/x-sml",mode:"mllike",ext:["sml","sig","fun","smackspec"]},{name:"Soy",mime:"text/x-soy",mode:"soy",ext:["soy"],alias:["closure template"]},{name:"SPARQL",mime:"application/sparql-query",mode:"sparql",ext:["rq","sparql"],alias:["sparul"]},{name:"Spreadsheet",mime:"text/x-spreadsheet",mode:"spreadsheet",alias:["excel","formula"]},{name:"SQL",mime:"text/x-sql",mode:"sql",ext:["sql"]},{name:"SQLite",mime:"text/x-sqlite",mode:"sql"},{name:"Squirrel",mime:"text/x-squirrel",mode:"clike",ext:["nut"]},{name:"Stylus",mime:"text/x-styl",mode:"stylus",ext:["styl"]},{name:"Swift",mime:"text/x-swift",mode:"swift",ext:["swift"]},{name:"sTeX",mime:"text/x-stex",mode:"stex"},{name:"LaTeX",mime:"text/x-latex",mode:"stex",ext:["text","ltx","tex"],alias:["tex"]},{name:"SystemVerilog",mime:"text/x-systemverilog",mode:"verilog",ext:["v","sv","svh"]},{name:"Tcl",mime:"text/x-tcl",mode:"tcl",ext:["tcl"]},{name:"Textile",mime:"text/x-textile",mode:"textile",ext:["textile"]},{name:"TiddlyWiki",mime:"text/x-tiddlywiki",mode:"tiddlywiki"},{name:"Tiki wiki",mime:"text/tiki",mode:"tiki"},{name:"TOML",mime:"text/x-toml",mode:"toml",ext:["toml"]},{name:"Tornado",mime:"text/x-tornado",mode:"tornado"},{name:"troff",mime:"text/troff",mode:"troff",ext:["1","2","3","4","5","6","7","8","9"]},{name:"TTCN",mime:"text/x-ttcn",mode:"ttcn",ext:["ttcn","ttcn3","ttcnpp"]},{name:"TTCN_CFG",mime:"text/x-ttcn-cfg",mode:"ttcn-cfg",ext:["cfg"]},{name:"Turtle",mime:"text/turtle",mode:"turtle",ext:["ttl"]},{name:"TypeScript",mime:"application/typescript",mode:"javascript",ext:["ts"],alias:["ts"]},{name:"TypeScript-JSX",mime:"text/typescript-jsx",mode:"jsx",ext:["tsx"],alias:["tsx"]},{name:"Twig",mime:"text/x-twig",mode:"twig"},{name:"Web IDL",mime:"text/x-webidl",mode:"webidl",ext:["webidl"]},{name:"VB.NET",mime:"text/x-vb",mode:"vb",ext:["vb"]},{name:"VBScript",mime:"text/vbscript",mode:"vbscript",ext:["vbs"]},{name:"Velocity",mime:"text/velocity",mode:"velocity",ext:["vtl"]},{name:"Verilog",mime:"text/x-verilog",mode:"verilog",ext:["v"]},{name:"VHDL",mime:"text/x-vhdl",mode:"vhdl",ext:["vhd","vhdl"]},{name:"Vue.js Component",mimes:["script/x-vue","text/x-vue"],mode:"vue",ext:["vue"]},{name:"XML",mimes:["application/xml","text/xml"],mode:"xml",ext:["xml","xsl","xsd","svg"],alias:["rss","wsdl","xsd"]},{name:"XQuery",mime:"application/xquery",mode:"xquery",ext:["xy","xquery"]},{name:"Yacas",mime:"text/x-yacas",mode:"yacas",ext:["ys"]},{name:"YAML",mimes:["text/x-yaml","text/yaml"],mode:"yaml",ext:["yaml","yml"],alias:["yml"]},{name:"Z80",mime:"text/x-z80",mode:"z80",ext:["z80"]},{name:"mscgen",mime:"text/x-mscgen",mode:"mscgen",ext:["mscgen","mscin","msc"]},{name:"xu",mime:"text/x-xu",mode:"mscgen",ext:["xu"]},{name:"msgenny",mime:"text/x-msgenny",mode:"mscgen",ext:["msgenny"]},{name:"WebAssembly",mime:"text/webassembly",mode:"wast",ext:["wat","wast"]}];for(var o=0;o<a.modeInfo.length;o++){var c=a.modeInfo[o];c.mimes&&(c.mime=c.mimes[0])}a.findModeByMIME=function(d){d=d.toLowerCase();for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.mime==d)return y;if(y.mimes){for(var m=0;m<y.mimes.length;m++)if(y.mimes[m]==d)return y}}if(/\+xml$/.test(d))return a.findModeByMIME("application/xml");if(/\+json$/.test(d))return a.findModeByMIME("application/json")},a.findModeByExtension=function(d){d=d.toLowerCase();for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.ext){for(var m=0;m<y.ext.length;m++)if(y.ext[m]==d)return y}}},a.findModeByFileName=function(d){for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.file&&y.file.test(d))return y}var m=d.lastIndexOf("."),w=m>-1&&d.substring(m+1,d.length);if(w)return a.findModeByExtension(w)},a.findModeByName=function(d){d=d.toLowerCase();for(var p=0;p<a.modeInfo.length;p++){var y=a.modeInfo[p];if(y.name.toLowerCase()==d)return y;if(y.alias){for(var m=0;m<y.alias.length;m++)if(y.alias[m].toLowerCase()==d)return y}}}})}()),zl.exports}(function(l,n){(function(a){a(Wt(),Rp(),Mp())})(function(a){a.defineMode("markdown",function(o,c){var d=a.getMode(o,"text/html"),p=d.name=="null";function y(L){if(a.findModeByName){var x=a.findModeByName(L);x&&(L=x.mime||x.mimes[0])}var oe=a.getMode(o,L);return oe.name=="null"?null:oe}c.highlightFormatting===void 0&&(c.highlightFormatting=!1),c.maxBlockquoteDepth===void 0&&(c.maxBlockquoteDepth=0),c.taskLists===void 0&&(c.taskLists=!1),c.strikethrough===void 0&&(c.strikethrough=!1),c.emoji===void 0&&(c.emoji=!1),c.fencedCodeBlockHighlighting===void 0&&(c.fencedCodeBlockHighlighting=!0),c.fencedCodeBlockDefaultMode===void 0&&(c.fencedCodeBlockDefaultMode="text/plain"),c.xml===void 0&&(c.xml=!0),c.tokenTypeOverrides===void 0&&(c.tokenTypeOverrides={});var m={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"image",imageAltText:"image-alt-text",imageMarker:"image-marker",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough",emoji:"builtin"};for(var w in m)m.hasOwnProperty(w)&&c.tokenTypeOverrides[w]&&(m[w]=c.tokenTypeOverrides[w]);var S=/^([*\-_])(?:\s*\1){2,}\s*$/,M=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,E=/^\[(x| )\](?=\s)/i,A=c.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,z=/^ {0,3}(?:\={1,}|-{2,})\s*$/,B=/^[^#!\[\]*_\\<>` "'(~:]+/,P=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,N=/^\s*\[[^\]]+?\]:.*$/,O=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/,W=" ";function X(L,x,oe){return x.f=x.inline=oe,oe(L,x)}function ne(L,x,oe){return x.f=x.block=oe,oe(L,x)}function ue(L){return!L||!/\S/.test(L.string)}function se(L){if(L.linkTitle=!1,L.linkHref=!1,L.linkText=!1,L.em=!1,L.strong=!1,L.strikethrough=!1,L.quote=0,L.indentedCode=!1,L.f==Oe){var x=p;if(!x){var oe=a.innerMode(d,L.htmlState);x=oe.mode.name=="xml"&&oe.state.tagStart===null&&!oe.state.context&&oe.state.tokenize.isInText}x&&(L.f=j,L.block=he,L.htmlState=null)}return L.trailingSpace=0,L.trailingSpaceNewLine=!1,L.prevLine=L.thisLine,L.thisLine={stream:null},null}function he(L,x){var oe=L.column()===x.indentation,Te=ue(x.prevLine.stream),Z=x.indentedCode,fe=x.prevLine.hr,we=x.list!==!1,_e=(x.listStack[x.listStack.length-1]||0)+3;x.indentedCode=!1;var ct=x.indentation;if(x.indentationDiff===null&&(x.indentationDiff=x.indentation,we)){for(x.list=null;ct<x.listStack[x.listStack.length-1];)x.listStack.pop(),x.listStack.length?x.indentation=x.listStack[x.listStack.length-1]:x.list=!1;x.list!==!1&&(x.indentationDiff=ct-x.listStack[x.listStack.length-1])}var ke=!Te&&!fe&&!x.prevLine.header&&(!we||!Z)&&!x.prevLine.fencedCodeEnd,Re=(x.list===!1||fe||Te)&&x.indentation<=_e&&L.match(S),Ke=null;if(x.indentationDiff>=4&&(Z||x.prevLine.fencedCodeEnd||x.prevLine.header||Te))return L.skipToEnd(),x.indentedCode=!0,m.code;if(L.eatSpace())return null;if(oe&&x.indentation<=_e&&(Ke=L.match(A))&&Ke[1].length<=6)return x.quote=0,x.header=Ke[1].length,x.thisLine.header=!0,c.highlightFormatting&&(x.formatting="header"),x.f=x.inline,ie(x);if(x.indentation<=_e&&L.eat(">"))return x.quote=oe?1:x.quote+1,c.highlightFormatting&&(x.formatting="quote"),L.eatSpace(),ie(x);if(!Re&&!x.setext&&oe&&x.indentation<=_e&&(Ke=L.match(M))){var ft=Ke[1]?"ol":"ul";return x.indentation=ct+L.current().length,x.list=!0,x.quote=0,x.listStack.push(x.indentation),x.em=!1,x.strong=!1,x.code=!1,x.strikethrough=!1,c.taskLists&&L.match(E,!1)&&(x.taskList=!0),x.f=x.inline,c.highlightFormatting&&(x.formatting=["list","list-"+ft]),ie(x)}else{if(oe&&x.indentation<=_e&&(Ke=L.match(P,!0)))return x.quote=0,x.fencedEndRE=new RegExp(Ke[1]+"+ *$"),x.localMode=c.fencedCodeBlockHighlighting&&y(Ke[2]||c.fencedCodeBlockDefaultMode),x.localMode&&(x.localState=a.startState(x.localMode)),x.f=x.block=Me,c.highlightFormatting&&(x.formatting="code-block"),x.code=-1,ie(x);if(x.setext||(!ke||!we)&&!x.quote&&x.list===!1&&!x.code&&!Re&&!N.test(L.string)&&(Ke=L.lookAhead(1))&&(Ke=Ke.match(z)))return x.setext?(x.header=x.setext,x.setext=0,L.skipToEnd(),c.highlightFormatting&&(x.formatting="header")):(x.header=Ke[0].charAt(0)=="="?1:2,x.setext=x.header),x.thisLine.header=!0,x.f=x.inline,ie(x);if(Re)return L.skipToEnd(),x.hr=!0,x.thisLine.hr=!0,m.hr;if(L.peek()==="[")return X(L,x,D)}return X(L,x,x.inline)}function Oe(L,x){var oe=d.token(L,x.htmlState);if(!p){var Te=a.innerMode(d,x.htmlState);(Te.mode.name=="xml"&&Te.state.tagStart===null&&!Te.state.context&&Te.state.tokenize.isInText||x.md_inside&&L.current().indexOf(">")>-1)&&(x.f=j,x.block=he,x.htmlState=null)}return oe}function Me(L,x){var oe=x.listStack[x.listStack.length-1]||0,Te=x.indentation<oe,Z=oe+3;if(x.fencedEndRE&&x.indentation<=Z&&(Te||L.match(x.fencedEndRE))){c.highlightFormatting&&(x.formatting="code-block");var fe;return Te||(fe=ie(x)),x.localMode=x.localState=null,x.block=he,x.f=j,x.fencedEndRE=null,x.code=0,x.thisLine.fencedCodeEnd=!0,Te?ne(L,x,x.block):fe}else return x.localMode?x.localMode.token(L,x.localState):(L.skipToEnd(),m.code)}function ie(L){var x=[];if(L.formatting){x.push(m.formatting),typeof L.formatting=="string"&&(L.formatting=[L.formatting]);for(var oe=0;oe<L.formatting.length;oe++)x.push(m.formatting+"-"+L.formatting[oe]),L.formatting[oe]==="header"&&x.push(m.formatting+"-"+L.formatting[oe]+"-"+L.header),L.formatting[oe]==="quote"&&(!c.maxBlockquoteDepth||c.maxBlockquoteDepth>=L.quote?x.push(m.formatting+"-"+L.formatting[oe]+"-"+L.quote):x.push("error"))}if(L.taskOpen)return x.push("meta"),x.length?x.join(" "):null;if(L.taskClosed)return x.push("property"),x.length?x.join(" "):null;if(L.linkHref?x.push(m.linkHref,"url"):(L.strong&&x.push(m.strong),L.em&&x.push(m.em),L.strikethrough&&x.push(m.strikethrough),L.emoji&&x.push(m.emoji),L.linkText&&x.push(m.linkText),L.code&&x.push(m.code),L.image&&x.push(m.image),L.imageAltText&&x.push(m.imageAltText,"link"),L.imageMarker&&x.push(m.imageMarker)),L.header&&x.push(m.header,m.header+"-"+L.header),L.quote&&(x.push(m.quote),!c.maxBlockquoteDepth||c.maxBlockquoteDepth>=L.quote?x.push(m.quote+"-"+L.quote):x.push(m.quote+"-"+c.maxBlockquoteDepth)),L.list!==!1){var Te=(L.listStack.length-1)%3;Te?Te===1?x.push(m.list2):x.push(m.list3):x.push(m.list1)}return L.trailingSpaceNewLine?x.push("trailing-space-new-line"):L.trailingSpace&&x.push("trailing-space-"+(L.trailingSpace%2?"a":"b")),x.length?x.join(" "):null}function $e(L,x){if(L.match(B,!0))return ie(x)}function j(L,x){var oe=x.text(L,x);if(typeof oe<"u")return oe;if(x.list)return x.list=null,ie(x);if(x.taskList){var Te=L.match(E,!0)[1]===" ";return Te?x.taskOpen=!0:x.taskClosed=!0,c.highlightFormatting&&(x.formatting="task"),x.taskList=!1,ie(x)}if(x.taskOpen=!1,x.taskClosed=!1,x.header&&L.match(/^#+$/,!0))return c.highlightFormatting&&(x.formatting="header"),ie(x);var Z=L.next();if(x.linkTitle){x.linkTitle=!1;var fe=Z;Z==="("&&(fe=")"),fe=(fe+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var we="^\\s*(?:[^"+fe+"\\\\]+|\\\\\\\\|\\\\.)"+fe;if(L.match(new RegExp(we),!0))return m.linkHref}if(Z==="`"){var _e=x.formatting;c.highlightFormatting&&(x.formatting="code"),L.eatWhile("`");var ct=L.current().length;if(x.code==0&&(!x.quote||ct==1))return x.code=ct,ie(x);if(ct==x.code){var ke=ie(x);return x.code=0,ke}else return x.formatting=_e,ie(x)}else if(x.code)return ie(x);if(Z==="\\"&&(L.next(),c.highlightFormatting)){var Re=ie(x),Ke=m.formatting+"-escape";return Re?Re+" "+Ke:Ke}if(Z==="!"&&L.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return x.imageMarker=!0,x.image=!0,c.highlightFormatting&&(x.formatting="image"),ie(x);if(Z==="["&&x.imageMarker&&L.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return x.imageMarker=!1,x.imageAltText=!0,c.highlightFormatting&&(x.formatting="image"),ie(x);if(Z==="]"&&x.imageAltText){c.highlightFormatting&&(x.formatting="image");var Re=ie(x);return x.imageAltText=!1,x.image=!1,x.inline=x.f=k,Re}if(Z==="["&&!x.image)return x.linkText&&L.match(/^.*?\]/)||(x.linkText=!0,c.highlightFormatting&&(x.formatting="link")),ie(x);if(Z==="]"&&x.linkText){c.highlightFormatting&&(x.formatting="link");var Re=ie(x);return x.linkText=!1,x.inline=x.f=L.match(/\(.*?\)| ?\[.*?\]/,!1)?k:j,Re}if(Z==="<"&&L.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){x.f=x.inline=Q,c.highlightFormatting&&(x.formatting="link");var Re=ie(x);return Re?Re+=" ":Re="",Re+m.linkInline}if(Z==="<"&&L.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){x.f=x.inline=Q,c.highlightFormatting&&(x.formatting="link");var Re=ie(x);return Re?Re+=" ":Re="",Re+m.linkEmail}if(c.xml&&Z==="<"&&L.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var ft=L.string.indexOf(">",L.pos);if(ft!=-1){var Pt=L.string.substring(L.start,ft);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Pt)&&(x.md_inside=!0)}return L.backUp(1),x.htmlState=a.startState(d),ne(L,x,Oe)}if(c.xml&&Z==="<"&&L.match(/^\/\w*?>/))return x.md_inside=!1,"tag";if(Z==="*"||Z==="_"){for(var ht=1,dt=L.pos==1?" ":L.string.charAt(L.pos-2);ht<3&&L.eat(Z);)ht++;var gt=L.peek()||" ",Ut=!/\s/.test(gt)&&(!O.test(gt)||/\s/.test(dt)||O.test(dt)),be=!/\s/.test(dt)&&(!O.test(dt)||/\s/.test(gt)||O.test(gt)),wt=null,Gt=null;if(ht%2&&(!x.em&&Ut&&(Z==="*"||!be||O.test(dt))?wt=!0:x.em==Z&&be&&(Z==="*"||!Ut||O.test(gt))&&(wt=!1)),ht>1&&(!x.strong&&Ut&&(Z==="*"||!be||O.test(dt))?Gt=!0:x.strong==Z&&be&&(Z==="*"||!Ut||O.test(gt))&&(Gt=!1)),Gt!=null||wt!=null){c.highlightFormatting&&(x.formatting=wt==null?"strong":Gt==null?"em":"strong em"),wt===!0&&(x.em=Z),Gt===!0&&(x.strong=Z);var ke=ie(x);return wt===!1&&(x.em=!1),Gt===!1&&(x.strong=!1),ke}}else if(Z===" "&&(L.eat("*")||L.eat("_"))){if(L.peek()===" ")return ie(x);L.backUp(1)}if(c.strikethrough){if(Z==="~"&&L.eatWhile(Z)){if(x.strikethrough){c.highlightFormatting&&(x.formatting="strikethrough");var ke=ie(x);return x.strikethrough=!1,ke}else if(L.match(/^[^\s]/,!1))return x.strikethrough=!0,c.highlightFormatting&&(x.formatting="strikethrough"),ie(x)}else if(Z===" "&&L.match("~~",!0)){if(L.peek()===" ")return ie(x);L.backUp(2)}}if(c.emoji&&Z===":"&&L.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){x.emoji=!0,c.highlightFormatting&&(x.formatting="emoji");var On=ie(x);return x.emoji=!1,On}return Z===" "&&(L.match(/^ +$/,!1)?x.trailingSpace++:x.trailingSpace&&(x.trailingSpaceNewLine=!0)),ie(x)}function Q(L,x){var oe=L.next();if(oe===">"){x.f=x.inline=j,c.highlightFormatting&&(x.formatting="link");var Te=ie(x);return Te?Te+=" ":Te="",Te+m.linkInline}return L.match(/^[^>]+/,!0),m.linkInline}function k(L,x){if(L.eatSpace())return null;var oe=L.next();return oe==="("||oe==="["?(x.f=x.inline=G(oe==="("?")":"]"),c.highlightFormatting&&(x.formatting="link-string"),x.linkHref=!0,ie(x)):"error"}var J={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function G(L){return function(x,oe){var Te=x.next();if(Te===L){oe.f=oe.inline=j,c.highlightFormatting&&(oe.formatting="link-string");var Z=ie(oe);return oe.linkHref=!1,Z}return x.match(J[L]),oe.linkHref=!0,ie(oe)}}function D(L,x){return L.match(/^([^\]\\]|\\.)*\]:/,!1)?(x.f=F,L.next(),c.highlightFormatting&&(x.formatting="link"),x.linkText=!0,ie(x)):X(L,x,j)}function F(L,x){if(L.match("]:",!0)){x.f=x.inline=K,c.highlightFormatting&&(x.formatting="link");var oe=ie(x);return x.linkText=!1,oe}return L.match(/^([^\]\\]|\\.)+/,!0),m.linkText}function K(L,x){return L.eatSpace()?null:(L.match(/^[^\s]+/,!0),L.peek()===void 0?x.linkTitle=!0:L.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),x.f=x.inline=j,m.linkHref+" url")}var de={startState:function(){return{f:he,prevLine:{stream:null},thisLine:{stream:null},block:he,htmlState:null,indentation:0,inline:j,text:$e,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,setext:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,emoji:!1,fencedEndRE:null}},copyState:function(L){return{f:L.f,prevLine:L.prevLine,thisLine:L.thisLine,block:L.block,htmlState:L.htmlState&&a.copyState(d,L.htmlState),indentation:L.indentation,localMode:L.localMode,localState:L.localMode?a.copyState(L.localMode,L.localState):null,inline:L.inline,text:L.text,formatting:!1,linkText:L.linkText,linkTitle:L.linkTitle,linkHref:L.linkHref,code:L.code,em:L.em,strong:L.strong,strikethrough:L.strikethrough,emoji:L.emoji,header:L.header,setext:L.setext,hr:L.hr,taskList:L.taskList,list:L.list,listStack:L.listStack.slice(0),quote:L.quote,indentedCode:L.indentedCode,trailingSpace:L.trailingSpace,trailingSpaceNewLine:L.trailingSpaceNewLine,md_inside:L.md_inside,fencedEndRE:L.fencedEndRE}},token:function(L,x){if(x.formatting=!1,L!=x.thisLine.stream){if(x.header=0,x.hr=!1,L.match(/^\s*$/,!0))return se(x),null;if(x.prevLine=x.thisLine,x.thisLine={stream:L},x.taskList=!1,x.trailingSpace=0,x.trailingSpaceNewLine=!1,!x.localState&&(x.f=x.block,x.f!=Oe)){var oe=L.match(/^\s*/,!0)[0].replace(/\t/g,W).length;if(x.indentation=oe,x.indentationDiff=null,oe>0)return null}}return x.f(L,x)},innerMode:function(L){return L.block==Oe?{state:L.htmlState,mode:d}:L.localState?{state:L.localState,mode:L.localMode}:{state:L,mode:de}},indent:function(L,x,oe){return L.block==Oe&&d.indent?d.indent(L.htmlState,x,oe):L.localState&&L.localMode.indent?L.localMode.indent(L.localState,x,oe):a.Pass},blankLine:se,getType:ie,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return de},"xml"),a.defineMIME("text/markdown","markdown"),a.defineMIME("text/x-markdown","markdown")})})();const Fp={name:"DebugTab",components:{codemirror:fo.codemirror},props:{selectedSpan:{type:Object,required:!0},selectedSpanId:{type:String,required:!0}},data(){return{debugForm:{params:[],systemContent:"",userContent:""},debugSubmitting:!1,debugResponse:null,showDebugRawResponse:!1,debugResponseKey:0,debugMarkdownKey:0,originalInputs:null,hasImageUrl:!1,submitImage:!0,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,autoRefresh:!0},cmOptionsMarkdown:{tabSize:2,mode:"markdown",theme:"monokai",lineNumbers:!0,lineWrapping:!0,readOnly:!1,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,autoCloseBrackets:!0,indentUnit:2,styleActiveLine:!0,autoRefresh:!0},viewerOptions:{inline:!1,button:!0,navbar:!0,title:!0,toolbar:!0,tooltip:!0,movable:!0,zoomable:!0,rotatable:!0,scalable:!0,transition:!0,fullscreen:!0,keyboard:!0,zIndex:9999},tokenCalculating:!1,promptTokensResult:null}},computed:{promptTokensTableData(){if(!this.promptTokensResult)return[];const l=this.promptTokensResult;return[{key:"debug.specialTokens",value:l.special_tokens||"0"},{key:"debug.systemTokens",value:l.system_tokens||"0"},{key:"debug.userTokens",value:l.user_tokens||"0"},{key:"debug.assistantTokens",value:l.assistant_tokens||"0"},{key:"debug.textTokens",value:l.text_tokens||"0"}].map(a=>({name:this.$t(a.key),value:a.value})).filter(a=>a.value!=="0"&&a.value!==0)},rawInputs(){var l,n,a;return(a=(n=(l=this.selectedSpan)==null?void 0:l.parsedContent)==null?void 0:n.attributes)==null?void 0:a["langsword.spanInputs"]},targetUrl(){var n,a;const l=(a=(n=this.selectedSpan)==null?void 0:n.parsedContent)==null?void 0:a.attributes;return l&&l["url.full"]?l["url.full"]:null}},watch:{selectedSpanId:{immediate:!0,handler(l,n){l&&l!==n&&this.$nextTick(()=>{this.initDebugForm()})}},"selectedSpan.parsedContent":{deep:!0,handler(){this.selectedSpan&&this.selectedSpanId&&this.$nextTick(()=>{this.initDebugForm()})}}},mounted(){this.selectedSpan&&this.selectedSpanId&&this.$nextTick(()=>{this.initDebugForm()})},methods:{getMessageRoleLabel(l){const n={system:"debug.systemRole",user:"debug.userRole",assistant:"debug.assistantRole"};return n[l]?this.$t(n[l]):l},copyContent(l){const n=l==="system"?this.debugForm.systemContent:this.debugForm.userContent;if(!n){this.$message.warning(this.$t("debug.copyEmpty"));return}navigator.clipboard.writeText(n).then(()=>{this.$message.success(this.$t("debug.copySuccess"))}).catch(()=>{this.$message.error(this.$t("debug.copyFailed"))})},copyDebugResponse(){if(!this.debugResponse){this.$message.warning(this.$t("debug.copyEmpty"));return}const l=this.formatRawJson(this.debugResponse);navigator.clipboard.writeText(l).then(()=>{this.$message.success(this.$t("debug.copySuccess"))}).catch(()=>{this.$message.error(this.$t("debug.copyFailed"))})},copyAssistantContent(l){let n="";if(typeof l=="string")n=l;else if(Array.isArray(l)){const a=l.filter(o=>o&&o.type==="text"&&o.text).map(o=>o.text);n=a.length>0?a.join(`
78
+ `):this.formatRawJson(l)}else n=this.formatRawJson(l);if(!n){this.$message.warning(this.$t("debug.copyEmpty"));return}navigator.clipboard.writeText(n).then(()=>{this.$message.success(this.$t("debug.copySuccess"))}).catch(()=>{this.$message.error(this.$t("debug.copyFailed"))})},initDebugForm(){var n,a;if(!this.selectedSpan)return;let l=(a=(n=this.selectedSpan)==null?void 0:n.parsedContent)==null?void 0:a.inputs;if(!l&&this.rawInputs)try{l=typeof this.rawInputs=="string"?JSON.parse(this.rawInputs):this.rawInputs}catch(o){console.error("Failed to parse rawInputs:",o);return}if(!l){console.warn("No inputs found for span:",this.selectedSpanId);return}if(this.originalInputs=JSON.parse(JSON.stringify(l)),this.selectedSpan.type==="CLIENT"||this.selectedSpan.type==="EMBEDDING")this.debugForm.params=[],this.debugForm.systemContent="",this.debugForm.userContent="",Object.keys(l).forEach(o=>{if(o!=="file"){const c=l[o];let d="";typeof c=="string"?d=c:typeof c=="boolean"||typeof c=="number"?d=String(c):d=JSON.stringify(c),this.debugForm.params.push({key:o,value:d})}});else if(this.selectedSpan.type==="CHAT_MODEL")if(this.debugForm.params=[],this.hasImageUrl=!1,this.submitImage=!0,Object.keys(l).forEach(o=>{if(o!=="messages"){const c=l[o];let d="";typeof c=="string"?d=c:typeof c=="boolean"||typeof c=="number"?d=String(c):d=JSON.stringify(c),this.debugForm.params.push({key:o,value:d})}}),l.messages&&Array.isArray(l.messages)){const o=l.messages.find(d=>d.role==="system"),c=l.messages.find(d=>d.role==="user");if(o&&o.content?this.debugForm.systemContent=typeof o.content=="string"?o.content:"":this.debugForm.systemContent="",c&&c.content)if(Array.isArray(c.content)){const d=c.content.filter(y=>y.type==="text"&&y.text).map(y=>y.text);this.debugForm.userContent=d.join(`
79
+ `);const p=c.content.some(y=>y.type==="image_url");this.hasImageUrl=p}else typeof c.content=="string"?this.debugForm.userContent=c.content:this.debugForm.userContent="";else this.debugForm.userContent=""}else this.debugForm.systemContent="",this.debugForm.userContent="";this.debugResponse=null,this.showDebugRawResponse=!1,this.promptTokensResult=null,this.$nextTick(()=>{this.$refs.systemContentEditor&&this.$refs.systemContentEditor.codemirror&&this.$refs.systemContentEditor.codemirror.setValue(this.debugForm.systemContent||""),this.$refs.userContentEditor&&this.$refs.userContentEditor.codemirror&&this.$refs.userContentEditor.codemirror.setValue(this.debugForm.userContent||"")})},addDebugParam(){this.debugForm.params.push({key:"",value:""})},removeDebugParam(l){this.debugForm.params.splice(l,1)},handleDebugParamChange(){},resetDebugForm(){this.initDebugForm()},parseParamValue(l){if(l==="true"||l==="false")return l==="true";if(l==="")return"";{const n=Number(l);if(!isNaN(n)&&isFinite(n)&&l!=="")return n;try{return JSON.parse(l)}catch{return l}}},buildRequestHeaders(l){const n={};let a=null;const o=Object.keys(l).find(c=>c.toLowerCase()==="x-target-url");return o?(a=l[o],delete l[o]):this.targetUrl&&(a=this.targetUrl),a&&(n["X-Target-Url"]=a),n},handleDebugResponse(l){this.debugResponse=l,this.showDebugRawResponse=!1,this.$nextTick(()=>{this.debugResponseKey++})},handleDebugError(l){console.error("Debug request failed:",l);let n="未知错误";if(l.response&&l.response.data){const a=l.response.data;typeof a=="object"&&a!==null&&a.message?n=a.message:l.message&&(n=l.message)}else l.message&&(n=l.message);this.$message.error("调试请求失败: "+n)},async submitDebugRequest(l){const n=this.buildRequestHeaders(l),a=await Vt.debugTrace(l,n);this.handleDebugResponse(a)},async submitDebugClient(){if(!(!this.selectedSpan||!this.originalInputs)){this.debugSubmitting=!0;try{const l={};this.originalInputs.file&&(l.file=this.originalInputs.file),this.debugForm.params.forEach(n=>{if(n.key&&n.key.trim()){const a=n.value?n.value.trim():"";l[n.key]=this.parseParamValue(a)}}),await this.submitDebugRequest(l)}catch(l){this.handleDebugError(l)}finally{this.debugSubmitting=!1}}},async submitDebugChatModel(){if(!(!this.selectedSpan||!this.originalInputs)){this.debugSubmitting=!0;try{const l=JSON.parse(JSON.stringify(this.originalInputs));if(this.debugForm.params.forEach(n=>{if(n.key&&n.key.trim()){const a=n.value?n.value.trim():"";l[n.key]=this.parseParamValue(a)}}),l.messages&&Array.isArray(l.messages)){const n=l.messages.find(o=>o.role==="system");n&&(n.content=this.debugForm.systemContent||"");const a=l.messages.find(o=>o.role==="user");if(a){const o=this.originalInputs.messages.find(d=>d.role==="user");if(o&&Array.isArray(o.content)){const d=[];this.submitImage&&Array.isArray(a.content)&&a.content.forEach(p=>{p.type==="image_url"&&d.push(p)}),this.debugForm.userContent&&this.debugForm.userContent.trim()&&d.push({type:"text",text:this.debugForm.userContent}),a.content=d.length>0?d:this.debugForm.userContent||""}else a.content=this.debugForm.userContent||""}}await this.submitDebugRequest(l)}catch(l){this.handleDebugError(l)}finally{this.debugSubmitting=!1}}},toggleDebugResponseView(){this.showDebugRawResponse=!this.showDebugRawResponse,this.$nextTick(()=>{this.debugResponseKey++})},formatRawJson(l){if(!l)return"";if(typeof l=="string")try{const n=JSON.parse(l);return JSON.stringify(n,null,2)}catch{return l}return JSON.stringify(l,null,2)},extractImagesFromObject(l,n=[],a=""){if(!(!l||typeof l!="object")){for(const[o,c]of Object.entries(l)){const d=a?`${a}.${o}`:o;typeof c=="string"&&c.trim()!==""?(c.startsWith("data:image/")||c.startsWith("/9j/")||c.startsWith("iVBOR")||c.startsWith("R0lGOD"))&&(n.push({path:d,value:c,label:o==="content"&&a?`${a.split(".").pop()}: ${o}`:o}),l[o]="[IMAGE_DATA]"):c&&typeof c=="object"&&!Array.isArray(c)?this.extractImagesFromObject(c,n,d):Array.isArray(c)&&c.forEach((p,y)=>{p&&typeof p=="object"&&this.extractImagesFromObject(p,n,`${d}[${y}]`)})}return n}},renderStructuredContent(l){const n=[];if(!l)return n;try{if(Array.isArray(l))l.forEach((a,o)=>{var c;a&&typeof a=="object"?a.type==="text"&&a.text?n.push({type:"markdown",content:Le(a.text),key:`text-${o}`}):a.type==="image_url"&&((c=a.image_url)!=null&&c.url)?n.push({type:"image",url:a.image_url.url,key:`image-${o}`}):a.image_base64&&a.image_base64.trim()!==""?n.push({type:"image",url:this.formatBase64Image(a.image_base64),key:`base64-image-${o}`}):n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:`json-${o}`}):n.push({type:"markdown",content:Le(String(a)),key:`text-${o}`})});else if(typeof l=="string")n.push({type:"markdown",content:Le(l),key:"text-0"});else if(typeof l=="object")if(l.data&&Array.isArray(l.data.result)){const a=JSON.parse(JSON.stringify(l)),o=[];a.data&&a.data.result&&a.data.result.forEach((c,d)=>{c.image_base64&&c.image_base64.trim()!==""&&(o.push({type:"page",image_base64:c.image_base64,page_num:c.page_num,label:c.page_num!==void 0?`Page ${c.page_num}`:`Result ${d}`}),c.image_base64="[BASE64_IMAGE_DATA]"),c.seals&&Array.isArray(c.seals)&&c.seals.forEach((p,y)=>{p.image_base64&&p.image_base64.trim()!==""&&(o.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]")})}),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((c,d)=>{n.push({type:"image",url:this.formatBase64Image(c.image_base64),key:`result-image-${d}`,label:c.label})})}else{const a=JSON.parse(JSON.stringify(l)),o=[];this.extractImagesFromObject(a,o),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((c,d)=>{n.push({type:"image",url:this.formatBase64Image(c.value),key:`extracted-image-${d}`,label:c.label})})}else n.push({type:"markdown",content:Le(String(l)),key:"text-0"})}catch(a){console.error("Error rendering content:",a),n.push({type:"markdown",content:Le("Error rendering content"),key:"error-0"})}return n},formatBase64Image(l){return l?l.startsWith("data:image")?l:l.startsWith("/9j/")?`data:image/jpeg;base64,${l}`:l.startsWith("iVBOR")?`data:image/png;base64,${l}`:l.startsWith("R0lGOD")?`data:image/gif;base64,${l}`:`data:image/jpeg;base64,${l}`:""},handleImageClick(l){Fl({options:this.viewerOptions,images:[l]})},async calculatePromptTokens(){if(!this.selectedSpan||this.selectedSpan.type!=="CHAT_MODEL")return;const l=[];if(this.debugForm.systemContent&&this.debugForm.systemContent.trim()&&l.push({role:"system",content:this.debugForm.systemContent.trim()}),this.debugForm.userContent&&this.debugForm.userContent.trim()&&l.push({role:"user",content:this.debugForm.userContent.trim()}),l.length===0){this.$message.warning("请至少填写系统提示词或用户提示词");return}const n=this.debugForm.params.find(o=>o.key&&o.key.trim().toLowerCase()==="model"),a={messages:l};n&&n.value&&n.value.trim()&&(a.model=n.value.trim()),this.tokenCalculating=!0;try{const o=await Vt.getPromptTokens(a);this.promptTokensResult=o}catch(o){console.error("Token calculation failed:",o);let c="未知错误";if(o.response&&o.response.data){const d=o.response.data;typeof d=="object"&&d!==null&&d.message?c=d.message:o.message&&(c=o.message)}else o.message&&(c=o.message);this.$message.error("Token计算失败: "+c)}finally{this.tokenCalculating=!1}}}};var Pp=function(){var o,c,d;var n=this,a=n._self._c;return a("div",{staticClass:"debug-content"},[n.selectedSpan.type==="CLIENT"||n.selectedSpan.type==="EMBEDDING"?a("div",{staticClass:"debug-client-form"},[a("el-form",{attrs:{model:n.debugForm,"label-width":"60px",size:"small"}},[n._l(n.debugForm.params,function(p,y){return a("div",{key:y,staticClass:"debug-form-row"},[a("el-form-item",{attrs:{label:`${n.$t("debug.paramLabel")} ${y+1}`}},[a("el-row",{attrs:{gutter:10,type:"flex",align:"middle"}},[a("el-col",{attrs:{span:8}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramName")},on:{input:n.handleDebugParamChange},model:{value:p.key,callback:function(m){n.$set(p,"key",m)},expression:"item.key"}})],1),a("el-col",{attrs:{span:14}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramValue")},on:{input:n.handleDebugParamChange},model:{value:p.value,callback:function(m){n.$set(p,"value",m)},expression:"item.value"}})],1),a("el-col",{attrs:{span:2}},[a("el-button",{staticClass:"delete-param-btn",attrs:{type:"danger",icon:"el-icon-delete",size:"small"},on:{click:function(m){return n.removeDebugParam(y)}}})],1)],1)],1)],1)}),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-plus",size:"small"},on:{click:n.addDebugParam}},[n._v(n._s(n.$t("debug.addParam")))]),a("el-button",{attrs:{type:"warning",icon:"el-icon-refresh",size:"small"},on:{click:n.resetDebugForm}},[n._v(n._s(n.$t("debug.reset")))]),a("el-button",{attrs:{type:"success",icon:"el-icon-check",size:"small",loading:n.debugSubmitting},on:{click:n.submitDebugClient}},[n._v(n._s(n.$t("debug.submit")))])],1)],2),n.debugResponse!==null?a("div",{staticClass:"debug-response"},[a("div",{staticClass:"debug-response-header"},[a("span",[n._v(n._s(n.$t("debug.responseResult")))]),a("div",{staticClass:"debug-response-actions"},[a("el-tooltip",{attrs:{content:n.$t("debug.copyTooltip"),placement:"top"}},[a("el-button",{attrs:{type:"text",icon:"el-icon-document-copy",size:"small"},on:{click:n.copyDebugResponse}})],1),a("el-button",{attrs:{type:"text",size:"small"},on:{click:n.toggleDebugResponseView}},[n._v(n._s(n.showDebugRawResponse?n.$t("debug.switchToMarkdown"):n.$t("debug.switchToRaw")))])],1)]),n.showDebugRawResponse?a("div",{staticClass:"debug-response-raw"},[a("codemirror",{key:`debug-response-${n.selectedSpanId}-${n.debugResponseKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.debugResponse),options:n.cmOptions}})],1):a("div",{staticClass:"debug-response-markdown"},n._l(n.renderStructuredContent(n.debugResponse),function(p){return a("div",{key:p.key,staticClass:"content-element"},[p.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(p.content)}}):p.type==="image"?a("div",{staticClass:"image-content"},[p.label?a("div",{staticClass:"image-label"},[n._v(n._s(p.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:p.url,alt:"content image"},on:{click:function(y){return n.handleImageClick(p.url)}}})]):n._e()])}),0)]):n._e()],1):n._e(),n.selectedSpan.type==="CHAT_MODEL"?a("div",{staticClass:"debug-chat-model-form"},[a("el-form",{attrs:{model:n.debugForm,"label-width":"60px",size:"small"}},[a("el-form-item",{scopedSlots:n._u([{key:"label",fn:function(){return[a("span",[n._v(n._s(n.$t("debug.systemPrompt")))]),a("el-tooltip",{attrs:{content:n.$t("debug.copyTooltip"),placement:"top"}},[a("el-button",{staticClass:"copy-btn",attrs:{type:"text",icon:"el-icon-document-copy",size:"mini"},on:{click:function(p){return n.copyContent("system")}}})],1)]},proxy:!0}],null,!1,671448622)},[a("codemirror",{key:`debug-system-${n.selectedSpanId}-${n.debugMarkdownKey}`,ref:"systemContentEditor",staticClass:"code-editor-wrapper markdown-editor",attrs:{options:n.cmOptionsMarkdown},model:{value:n.debugForm.systemContent,callback:function(p){n.$set(n.debugForm,"systemContent",p)},expression:"debugForm.systemContent"}})],1),a("el-form-item",{scopedSlots:n._u([{key:"label",fn:function(){return[a("span",[n._v(n._s(n.$t("debug.userPrompt")))]),a("el-tooltip",{attrs:{content:n.$t("debug.copyTooltip"),placement:"top"}},[a("el-button",{staticClass:"copy-btn",attrs:{type:"text",icon:"el-icon-document-copy",size:"mini"},on:{click:function(p){return n.copyContent("user")}}})],1)]},proxy:!0}],null,!1,1846549358)},[a("codemirror",{key:`debug-user-${n.selectedSpanId}-${n.debugMarkdownKey}`,ref:"userContentEditor",staticClass:"code-editor-wrapper markdown-editor",attrs:{options:n.cmOptionsMarkdown},model:{value:n.debugForm.userContent,callback:function(p){n.$set(n.debugForm,"userContent",p)},expression:"debugForm.userContent"}})],1),n.selectedSpan.type==="CHAT_MODEL"&&n.hasImageUrl?a("el-form-item",{attrs:{label:n.$t("debug.submitImage")}},[a("el-switch",{attrs:{"active-text":n.$t("debug.yes"),"inactive-text":n.$t("debug.no")},model:{value:n.submitImage,callback:function(p){n.submitImage=p},expression:"submitImage"}})],1):n._e(),n._l(n.debugForm.params,function(p,y){return a("div",{key:y,staticClass:"debug-form-row"},[a("el-form-item",{attrs:{label:`${n.$t("debug.paramLabel")} ${y+1}`}},[a("el-row",{attrs:{gutter:10,type:"flex",align:"middle"}},[a("el-col",{attrs:{span:8}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramName")},on:{input:n.handleDebugParamChange},model:{value:p.key,callback:function(m){n.$set(p,"key",m)},expression:"item.key"}})],1),a("el-col",{attrs:{span:14}},[a("el-input",{attrs:{placeholder:n.$t("debug.paramValue")},on:{input:n.handleDebugParamChange},model:{value:p.value,callback:function(m){n.$set(p,"value",m)},expression:"item.value"}})],1),a("el-col",{attrs:{span:2}},[a("el-button",{staticClass:"delete-param-btn",attrs:{type:"danger",icon:"el-icon-delete",size:"small"},on:{click:function(m){return n.removeDebugParam(y)}}})],1)],1)],1)],1)}),a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-plus",size:"small"},on:{click:n.addDebugParam}},[n._v(n._s(n.$t("debug.addParam")))]),a("el-button",{attrs:{type:"warning",icon:"el-icon-refresh",size:"small"},on:{click:n.resetDebugForm}},[n._v(n._s(n.$t("debug.reset")))]),a("el-button",{attrs:{type:"success",icon:"el-icon-check",size:"small",loading:n.debugSubmitting},on:{click:n.submitDebugChatModel}},[n._v(n._s(n.$t("debug.submit")))]),a("el-tooltip",{attrs:{content:n.$t("debug.calculateTokensTooltip"),placement:"top"}},[a("el-button",{attrs:{type:"info",icon:"el-icon-cpu",size:"small",loading:n.tokenCalculating},on:{click:n.calculatePromptTokens}},[n._v(n._s(n.$t("debug.calculateTokens")))])],1)],1)],2),n.promptTokensResult!==null?a("div",{staticClass:"token-result-section"},[a("div",{staticClass:"token-result-header"},[n._v(n._s(n.$t("debug.tokenResultTitle")))]),a("el-table",{attrs:{data:n.promptTokensTableData,size:"small",border:""}},[a("el-table-column",{attrs:{prop:"name",label:n.$t("debug.tokenType"),width:"140"}}),a("el-table-column",{attrs:{prop:"value",label:n.$t("debug.tokenCount")}})],1)],1):n._e(),n.debugResponse!==null?a("div",{staticClass:"debug-response"},[a("div",{staticClass:"debug-response-header"},[a("span",[n._v(n._s(n.$t("debug.responseResult")))]),a("div",{staticClass:"debug-response-actions"},[n.showDebugRawResponse||!(n.selectedSpan.type==="CHAT_MODEL"&&((o=n.debugResponse)!=null&&o.choices))?a("el-tooltip",{attrs:{content:n.$t("debug.copyTooltip"),placement:"top"}},[n.showDebugRawResponse||!(n.selectedSpan.type==="CHAT_MODEL"&&((c=n.debugResponse)!=null&&c.choices))?a("el-button",{attrs:{type:"text",icon:"el-icon-document-copy",size:"small"},on:{click:n.copyDebugResponse}}):n._e()],1):n._e(),a("el-button",{attrs:{type:"text",size:"small"},on:{click:n.toggleDebugResponseView}},[n._v(n._s(n.showDebugRawResponse?n.$t("debug.switchToMarkdown"):n.$t("debug.switchToRaw")))])],1)]),n.showDebugRawResponse?a("div",{staticClass:"debug-response-raw"},[a("codemirror",{key:`debug-response-${n.selectedSpanId}-${n.debugResponseKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.debugResponse),options:n.cmOptions}})],1):a("div",{staticClass:"debug-response-markdown"},[n.selectedSpan.type==="CHAT_MODEL"&&((d=n.debugResponse)!=null&&d.choices)?a("div",{staticClass:"outputs-section"},n._l(n.debugResponse.choices,function(p,y){return a("div",{key:y,staticClass:"choice-item"},[a("div",{staticClass:"choice-content"},[p.message?a("div",[a("div",{staticClass:"message-header"},[a("i",{staticClass:"el-icon-user message-icon"}),a("span",[n._v(n._s(n.getMessageRoleLabel(p.message.role)))]),a("el-tooltip",{attrs:{content:n.$t("debug.copyTooltip"),placement:"top"}},[a("el-button",{staticClass:"copy-btn-inline",attrs:{type:"text",icon:"el-icon-document-copy",size:"mini"},on:{click:function(m){return n.copyAssistantContent(p.message.content)}}})],1)],1),a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(p.message.content),function(m){return a("div",{key:m.key,staticClass:"content-element"},[m.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(m.content)}}):m.type==="image"?a("div",{staticClass:"image-content"},[m.label?a("div",{staticClass:"image-label"},[n._v(n._s(m.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:m.url,alt:"content image"},on:{click:function(w){return n.handleImageClick(m.url)}}})]):n._e()])}),0)]):a("div",[a("div",{staticClass:"message-header"},[a("el-tooltip",{attrs:{content:n.$t("debug.copyTooltip"),placement:"top"}},[a("el-button",{staticClass:"copy-btn-inline",attrs:{type:"text",icon:"el-icon-document-copy",size:"mini"},on:{click:function(m){return n.copyAssistantContent(p)}}})],1)],1),a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(p),function(m){return a("div",{key:m.key,staticClass:"content-element"},[m.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(m.content)}}):m.type==="image"?a("div",{staticClass:"image-content"},[m.label?a("div",{staticClass:"image-label"},[n._v(n._s(m.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:m.url,alt:"content image"},on:{click:function(w){return n.handleImageClick(m.url)}}})]):n._e()])}),0)])])])}),0):a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(n.debugResponse),function(p){return a("div",{key:p.key,staticClass:"content-element"},[p.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(p.content)}}):p.type==="image"?a("div",{staticClass:"image-content"},[p.label?a("div",{staticClass:"image-label"},[n._v(n._s(p.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:p.url,alt:"content image"},on:{click:function(y){return n.handleImageClick(p.url)}}})]):n._e()])}),0)])]):n._e()],1):n._e()])},$p=[],zp=In(Fp,Pp,$p,!1,null,"0885f6d2");const Bp=zp.exports;(function(l,n){(function(a){a(Wt())})(function(a){function o(D,F,K,de,L,x){this.indented=D,this.column=F,this.type=K,this.info=de,this.align=L,this.prev=x}function c(D,F,K,de){var L=D.indented;return D.context&&D.context.type=="statement"&&K!="statement"&&(L=D.context.indented),D.context=new o(L,F,K,de,null,D.context)}function d(D){var F=D.context.type;return(F==")"||F=="]"||F=="}")&&(D.indented=D.context.indented),D.context=D.context.prev}function p(D,F,K){if(F.prevToken=="variable"||F.prevToken=="type"||/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(D.string.slice(0,K))||F.typeAtEndOfLine&&D.column()==D.indentation())return!0}function y(D){for(;;){if(!D||D.type=="top")return!0;if(D.type=="}"&&D.prev.info!="namespace")return!1;D=D.prev}}a.defineMode("clike",function(D,F){var K=D.indentUnit,de=F.statementIndentUnit||K,L=F.dontAlignCalls,x=F.keywords||{},oe=F.types||{},Te=F.builtin||{},Z=F.blockKeywords||{},fe=F.defKeywords||{},we=F.atoms||{},_e=F.hooks||{},ct=F.multiLineStrings,ke=F.indentStatements!==!1,Re=F.indentSwitch!==!1,Ke=F.namespaceSeparator,ft=F.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,Pt=F.numberStart||/[\d\.]/,ht=F.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,dt=F.isOperatorChar||/[+\-*&%=<>!?|\/]/,gt=F.isIdentifierChar||/[\w\$_\xa1-\uffff]/,Ut=F.isReservedIdentifier||!1,be,wt;function Gt(ye,xe){var pe=ye.next();if(_e[pe]){var Fe=_e[pe](ye,xe);if(Fe!==!1)return Fe}if(pe=='"'||pe=="'")return xe.tokenize=On(pe),xe.tokenize(ye,xe);if(Pt.test(pe)){if(ye.backUp(1),ye.match(ht))return"number";ye.next()}if(ft.test(pe))return be=pe,null;if(pe=="/"){if(ye.eat("*"))return xe.tokenize=Zn,Zn(ye,xe);if(ye.eat("/"))return ye.skipToEnd(),"comment"}if(dt.test(pe)){for(;!ye.match(/^\/[\/*]/,!1)&&ye.eat(dt););return"operator"}if(ye.eatWhile(gt),Ke)for(;ye.match(Ke);)ye.eatWhile(gt);var De=ye.current();return w(x,De)?(w(Z,De)&&(be="newstatement"),w(fe,De)&&(wt=!0),"keyword"):w(oe,De)?"type":w(Te,De)||Ut&&Ut(De)?(w(Z,De)&&(be="newstatement"),"builtin"):w(we,De)?"atom":"variable"}function On(ye){return function(xe,pe){for(var Fe=!1,De,$t=!1;(De=xe.next())!=null;){if(De==ye&&!Fe){$t=!0;break}Fe=!Fe&&De=="\\"}return($t||!(Fe||ct))&&(pe.tokenize=null),"string"}}function Zn(ye,xe){for(var pe=!1,Fe;Fe=ye.next();){if(Fe=="/"&&pe){xe.tokenize=null;break}pe=Fe=="*"}return"comment"}function kr(ye,xe){F.typeFirstDefinitions&&ye.eol()&&y(xe.context)&&(xe.typeAtEndOfLine=p(ye,xe,ye.pos))}return{startState:function(ye){return{tokenize:null,context:new o((ye||0)-K,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(ye,xe){var pe=xe.context;if(ye.sol()&&(pe.align==null&&(pe.align=!1),xe.indented=ye.indentation(),xe.startOfLine=!0),ye.eatSpace())return kr(ye,xe),null;be=wt=null;var Fe=(xe.tokenize||Gt)(ye,xe);if(Fe=="comment"||Fe=="meta")return Fe;if(pe.align==null&&(pe.align=!0),be==";"||be==":"||be==","&&ye.match(/^\s*(?:\/\/.*)?$/,!1))for(;xe.context.type=="statement";)d(xe);else if(be=="{")c(xe,ye.column(),"}");else if(be=="[")c(xe,ye.column(),"]");else if(be=="(")c(xe,ye.column(),")");else if(be=="}"){for(;pe.type=="statement";)pe=d(xe);for(pe.type=="}"&&(pe=d(xe));pe.type=="statement";)pe=d(xe)}else be==pe.type?d(xe):ke&&((pe.type=="}"||pe.type=="top")&&be!=";"||pe.type=="statement"&&be=="newstatement")&&c(xe,ye.column(),"statement",ye.current());if(Fe=="variable"&&(xe.prevToken=="def"||F.typeFirstDefinitions&&p(ye,xe,ye.start)&&y(xe.context)&&ye.match(/^\s*\(/,!1))&&(Fe="def"),_e.token){var De=_e.token(ye,xe,Fe);De!==void 0&&(Fe=De)}return Fe=="def"&&F.styleDefs===!1&&(Fe="variable"),xe.startOfLine=!1,xe.prevToken=wt?"def":Fe||be,kr(ye,xe),Fe},indent:function(ye,xe){if(ye.tokenize!=Gt&&ye.tokenize!=null||ye.typeAtEndOfLine&&y(ye.context))return a.Pass;var pe=ye.context,Fe=xe&&xe.charAt(0),De=Fe==pe.type;if(pe.type=="statement"&&Fe=="}"&&(pe=pe.prev),F.dontIndentStatements)for(;pe.type=="statement"&&F.dontIndentStatements.test(pe.info);)pe=pe.prev;if(_e.indent){var $t=_e.indent(ye,pe,xe,K);if(typeof $t=="number")return $t}var Zt=pe.prev&&pe.prev.info=="switch";if(F.allmanIndentation&&/[{(]/.test(Fe)){for(;pe.type!="top"&&pe.type!="}";)pe=pe.prev;return pe.indented}return pe.type=="statement"?pe.indented+(Fe=="{"?0:de):pe.align&&(!L||pe.type!=")")?pe.column+(De?0:1):pe.type==")"&&!De?pe.indented+de:pe.indented+(De?0:K)+(!De&&Zt&&!/^(?:case|default)\b/.test(xe)?K:0)},electricInput:Re?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});function m(D){for(var F={},K=D.split(" "),de=0;de<K.length;++de)F[K[de]]=!0;return F}function w(D,F){return typeof D=="function"?D(F):D.propertyIsEnumerable(F)}var S="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",M="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",E="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",A="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",z=m("int long char short double float unsigned signed void bool"),B=m("SEL instancetype id Class Protocol BOOL");function P(D){return w(z,D)||/.+_t$/.test(D)}function N(D){return P(D)||w(B,D)}var O="case do else for if switch while struct enum union",W="struct enum union";function X(D,F){if(!F.startOfLine)return!1;for(var K,de=null;K=D.peek();){if(K=="\\"&&D.match(/^.$/)){de=X;break}else if(K=="/"&&D.match(/^\/[\/\*]/,!1))break;D.next()}return F.tokenize=de,"meta"}function ne(D,F){return F.prevToken=="type"?"type":!1}function ue(D){return!D||D.length<2||D[0]!="_"?!1:D[1]=="_"||D[1]!==D[1].toLowerCase()}function se(D){return D.eatWhile(/[\w\.']/),"number"}function he(D,F){if(D.backUp(1),D.match(/^(?:R|u8R|uR|UR|LR)/)){var K=D.match(/^"([^\s\\()]{0,16})\(/);return K?(F.cpp11RawStringDelim=K[1],F.tokenize=ie,ie(D,F)):!1}return D.match(/^(?:u8|u|U|L)/)?D.match(/^["']/,!1)?"string":!1:(D.next(),!1)}function Oe(D){var F=/(\w+)::~?(\w+)$/.exec(D);return F&&F[1]==F[2]}function Me(D,F){for(var K;(K=D.next())!=null;)if(K=='"'&&!D.eat('"')){F.tokenize=null;break}return"string"}function ie(D,F){var K=F.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&"),de=D.match(new RegExp(".*?\\)"+K+'"'));return de?F.tokenize=null:D.skipToEnd(),"string"}function $e(D,F){typeof D=="string"&&(D=[D]);var K=[];function de(x){if(x)for(var oe in x)x.hasOwnProperty(oe)&&K.push(oe)}de(F.keywords),de(F.types),de(F.builtin),de(F.atoms),K.length&&(F.helperType=D[0],a.registerHelper("hintWords",D[0],K));for(var L=0;L<D.length;++L)a.defineMIME(D[L],F)}$e(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:m(S),types:P,blockKeywords:m(O),defKeywords:m(W),typeFirstDefinitions:!0,atoms:m("NULL true false"),isReservedIdentifier:ue,hooks:{"#":X,"*":ne},modeProps:{fold:["brace","include"]}}),$e(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:m(S+" "+M),types:P,blockKeywords:m(O+" class try catch"),defKeywords:m(W+" class namespace"),typeFirstDefinitions:!0,atoms:m("true false NULL nullptr"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,isReservedIdentifier:ue,hooks:{"#":X,"*":ne,u:he,U:he,L:he,R:he,0:se,1:se,2:se,3:se,4:se,5:se,6:se,7:se,8:se,9:se,token:function(D,F,K){if(K=="variable"&&D.peek()=="("&&(F.prevToken==";"||F.prevToken==null||F.prevToken=="}")&&Oe(D.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),$e("text/x-java",{name:"clike",keywords:m("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:m("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:m("catch class do else finally for if switch try while"),defKeywords:m("class interface enum @interface"),typeFirstDefinitions:!0,atoms:m("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(D){return D.match("interface",!1)?!1:(D.eatWhile(/[\w\$_]/),"meta")},'"':function(D,F){return D.match(/""$/)?(F.tokenize=j,F.tokenize(D,F)):!1}},modeProps:{fold:["brace","import"]}}),$e("text/x-csharp",{name:"clike",keywords:m("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:m("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:m("catch class do else finally for foreach if struct switch try while"),defKeywords:m("class interface namespace record struct var"),typeFirstDefinitions:!0,atoms:m("true false null"),hooks:{"@":function(D,F){return D.eat('"')?(F.tokenize=Me,Me(D,F)):(D.eatWhile(/[\w\$_]/),"meta")}}});function j(D,F){for(var K=!1;!D.eol();){if(!K&&D.match('"""')){F.tokenize=null;break}K=D.next()=="\\"&&!K}return"string"}function Q(D){return function(F,K){for(var de;de=F.next();)if(de=="*"&&F.eat("/"))if(D==1){K.tokenize=null;break}else return K.tokenize=Q(D-1),K.tokenize(F,K);else if(de=="/"&&F.eat("*"))return K.tokenize=Q(D+1),K.tokenize(F,K);return"comment"}}$e("text/x-scala",{name:"clike",keywords:m("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:m("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:m("catch class enum do else finally for forSome if match switch try while"),defKeywords:m("class enum def object package trait type val var"),atoms:m("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(D){return D.eatWhile(/[\w\$_]/),"meta"},'"':function(D,F){return D.match('""')?(F.tokenize=j,F.tokenize(D,F)):!1},"'":function(D){return D.match(/^(\\[^'\s]+|[^\\'])'/)?"string-2":(D.eatWhile(/[\w\$_\xa1-\uffff]/),"atom")},"=":function(D,F){var K=F.context;return K.type=="}"&&K.align&&D.eat(">")?(F.context=new o(K.indented,K.column,K.type,K.info,null,K.prev),"operator"):!1},"/":function(D,F){return D.eat("*")?(F.tokenize=Q(1),F.tokenize(D,F)):!1}},modeProps:{closeBrackets:{pairs:'()[]{}""',triples:'"'}}});function k(D){return function(F,K){for(var de=!1,L,x=!1;!F.eol();){if(!D&&!de&&F.match('"')){x=!0;break}if(D&&F.match('"""')){x=!0;break}L=F.next(),!de&&L=="$"&&F.match("{")&&F.skipTo("}"),de=!de&&L=="\\"&&!D}return(x||!D)&&(K.tokenize=null),"string"}}$e("text/x-kotlin",{name:"clike",keywords:m("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:m("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:m("catch class do else finally for if where try while enum"),defKeywords:m("class val var object interface fun"),atoms:m("true false null this"),hooks:{"@":function(D){return D.eatWhile(/[\w\$_]/),"meta"},"*":function(D,F){return F.prevToken=="."?"variable":"operator"},'"':function(D,F){return F.tokenize=k(D.match('""')),F.tokenize(D,F)},"/":function(D,F){return D.eat("*")?(F.tokenize=Q(1),F.tokenize(D,F)):!1},indent:function(D,F,K,de){var L=K&&K.charAt(0);if((D.prevToken=="}"||D.prevToken==")")&&K=="")return D.indented;if(D.prevToken=="operator"&&K!="}"&&D.context.type!="}"||D.prevToken=="variable"&&L=="."||(D.prevToken=="}"||D.prevToken==")")&&L==".")return de*2+F.indented;if(F.align&&F.type=="}")return F.indented+(D.context.type==(K||"").charAt(0)?0:de)}},modeProps:{closeBrackets:{triples:'"'}}}),$e(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:m("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:m("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:m("for while do if else struct"),builtin:m("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:m("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:{"#":X},modeProps:{fold:["brace","include"]}}),$e("text/x-nesc",{name:"clike",keywords:m(S+" 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:P,blockKeywords:m(O),atoms:m("null true false"),hooks:{"#":X},modeProps:{fold:["brace","include"]}}),$e("text/x-objectivec",{name:"clike",keywords:m(S+" "+E),types:N,builtin:m(A),blockKeywords:m(O+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:m(W+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:m("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:ue,hooks:{"#":X,"*":ne},modeProps:{fold:["brace","include"]}}),$e("text/x-objectivec++",{name:"clike",keywords:m(S+" "+E+" "+M),types:N,builtin:m(A),blockKeywords:m(O+" @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),defKeywords:m(W+" @interface @implementation @protocol @class class namespace"),dontIndentStatements:/^@.*$|^template$/,typeFirstDefinitions:!0,atoms:m("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:ue,hooks:{"#":X,"*":ne,u:he,U:he,L:he,R:he,0:se,1:se,2:se,3:se,4:se,5:se,6:se,7:se,8:se,9:se,token:function(D,F,K){if(K=="variable"&&D.peek()=="("&&(F.prevToken==";"||F.prevToken==null||F.prevToken=="}")&&Oe(D.current()))return"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),$e("text/x-squirrel",{name:"clike",keywords:m("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:P,blockKeywords:m("case catch class else for foreach if switch try while"),defKeywords:m("function local class"),typeFirstDefinitions:!0,atoms:m("true false null"),hooks:{"#":X},modeProps:{fold:["brace","include"]}});var J=null;function G(D){return function(F,K){for(var de=!1,L,x=!1;!F.eol();){if(!de&&F.match('"')&&(D=="single"||F.match('""'))){x=!0;break}if(!de&&F.match("``")){J=G(D),x=!0;break}L=F.next(),de=D=="single"&&!de&&L=="\\"}return x&&(K.tokenize=null),"string"}}$e("text/x-ceylon",{name:"clike",keywords:m("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(D){var F=D.charAt(0);return F===F.toUpperCase()&&F!==F.toLowerCase()},blockKeywords:m("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:m("class dynamic function interface module object package value"),builtin:m("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:m("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(D){return D.eatWhile(/[\w\$_]/),"meta"},'"':function(D,F){return F.tokenize=G(D.match('""')?"triple":"single"),F.tokenize(D,F)},"`":function(D,F){return!J||!D.match("`")?!1:(F.tokenize=J,J=null,F.tokenize(D,F))},"'":function(D){return D.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(D,F,K){if((K=="variable"||K=="type")&&F.prevToken==".")return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})})})(),Le.setOptions({breaks:!0});const Hp={name:"TraceDetailDrawer",components:{TraceSpanTree:Ua,DebugTab:Bp,codemirror:fo.codemirror},props:{visible:{type:Boolean,default:!1},currentTraceId:{type:String,default:null},traceInfo:{type:Object,default:()=>({})},spans:{type:Array,default:()=>[]},filteredSpans:{type:Array,default:()=>[]},selectedSpanId:{type:String,default:null},selectedSpan:{type:Object,default:null},loading:{type:Boolean,default:!1},spanHasNextPage:{type:Boolean,default:!1},spanLoadMoreLoading:{type:Boolean,default:!1},spanHasEvents:{type:Boolean,default:null},spanPageSize:{type:Number,default:100},traceStatusList:{type:Array,default:()=>[]}},data(){return{localVisible:this.visible,spanSearchQuery:"",activeTab:"io",activeCollapse:["inputs","outputs"],messageCollapse:[],rawIoCollapse:["rawInputs","rawOutputs"],rawInputsKey:0,rawOutputsKey:0,eventsCollapse:[],eventsKey:0,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,autoRefresh:!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,autoCloseBrackets:!0,indentUnit:4,styleActiveLine:!0,autoRefresh:!0},viewerOptions:{inline:!1,button:!0,navbar:!0,title:!0,toolbar:!0,tooltip:!0,movable:!0,zoomable:!0,rotatable:!0,scalable:!0,transition:!0,fullscreen:!0,keyboard:!0,zIndex:9999}}},computed:{drawerTitle(){let l=this.traceInfo.trace_name;return l||(l=this.traceInfo.trace_id),l?this.$t("trace.traceDetail")+": "+l:this.$t("trace.traceDetail")},traceStartTime(){return this.spans.length===0?0:Math.min(...this.spans.map(l=>l.start_time_unix_nano))},traceEndTime(){return this.spans.length===0?0:Math.max(...this.spans.map(l=>l.end_time_unix_nano))},hasInputs(){var l,n;return((n=(l=this.selectedSpan)==null?void 0:l.parsedContent)==null?void 0:n.inputs)!==void 0},hasOutputs(){var l,n;return((n=(l=this.selectedSpan)==null?void 0:l.parsedContent)==null?void 0:n.outputs)!==void 0},showIOTab(){var d,p,y,m,w,S;if(!this.selectedSpan||!(this.selectedSpan.type==="CLIENT"||this.selectedSpan.type==="EMBEDDING"||this.selectedSpan.type==="CHAT_MODEL"))return!1;const n=(y=(p=(d=this.selectedSpan)==null?void 0:d.parsedContent)==null?void 0:p.attributes)==null?void 0:y["langsword.spanInputs"],a=(S=(w=(m=this.selectedSpan)==null?void 0:m.parsedContent)==null?void 0:w.attributes)==null?void 0:S["langsword.spanOutputs"],o=n!=null&&n!=="",c=a!=null&&a!=="";return o||c},attributesData(){var n,a;if(!((a=(n=this.selectedSpan)==null?void 0:n.parsedContent)!=null&&a.attributes))return[];const l=["http.response.body.size","http.request.body.size","http.request.header.Content-Length","http.response.header.content-length","http.request.header.content-length","http.response.header.Content-Length"];return Object.entries(this.selectedSpan.parsedContent.attributes).filter(([o])=>!o.startsWith("langsword.span")).map(([o,c])=>{let d;return l.includes(o)?d=this.formatBytes(c):typeof c=="string"?d=c:d=JSON.stringify(c,null,2),{key:o,value:d}})},rawInputs(){var l,n,a;return(a=(n=(l=this.selectedSpan)==null?void 0:l.parsedContent)==null?void 0:n.attributes)==null?void 0:a["langsword.spanInputs"]},rawOutputs(){var l,n,a;return(a=(n=(l=this.selectedSpan)==null?void 0:l.parsedContent)==null?void 0:n.attributes)==null?void 0:a["langsword.spanOutputs"]},hasEvents(){var n,a,o;if(((n=this.selectedSpan)==null?void 0:n.has_events)!==void 0)return this.selectedSpan.has_events===!0;const l=(o=(a=this.selectedSpan)==null?void 0:a.parsedContent)==null?void 0:o.events;return l&&Array.isArray(l)&&l.length>0},spanEvents(){var n,a;const l=(a=(n=this.selectedSpan)==null?void 0:n.parsedContent)==null?void 0:a.events;return!l||!Array.isArray(l)?[]:l},showDebugTab(){var o,c,d,p,y;if(!this.selectedSpan||!(this.selectedSpan.type==="CLIENT"||this.selectedSpan.type==="EMBEDDING"||this.selectedSpan.type==="CHAT_MODEL"))return!1;const n=(d=(c=(o=this.selectedSpan)==null?void 0:o.parsedContent)==null?void 0:c.attributes)==null?void 0:d["langsword.spanInputs"];if(!(n!=null&&n!==""))return!1;if(this.selectedSpan.type==="CLIENT"||this.selectedSpan.type==="EMBEDDING"){const m=(y=(p=this.selectedSpan)==null?void 0:p.parsedContent)==null?void 0:y.inputs;if(!m){const w=this.rawInputs;if(w)try{const S=typeof w=="string"?JSON.parse(w):w;return S&&S.file&&(S.file.filename||S.file.content)}catch{return!1}return!1}return m&&m.file&&(m.file.filename||m.file.content)}return this.selectedSpan.type==="CHAT_MODEL"}},watch:{visible(l){this.localVisible=l,l||(this.spanSearchQuery="")},localVisible(l){this.$emit("update:visible",l)},activeTab(l){l==="raw"&&this.$nextTick(()=>{this.rawInputsKey++,this.rawOutputsKey++}),l==="events"&&this.$nextTick(()=>{this.eventsKey++})},selectedSpan(){var o;if(!this.selectedSpan)return;const l=this.selectedSpan.has_events===!0||((o=this.selectedSpan.parsedContent)==null?void 0:o.events)&&Array.isArray(this.selectedSpan.parsedContent.events)&&this.selectedSpan.parsedContent.events.length>0,n=[];this.showIOTab&&n.push("io","raw"),this.showDebugTab&&n.push("debug"),n.push("attributes"),l&&n.push("events");let a="attributes";this.showIOTab&&(a="io"),n.includes(a)?this.activeTab=a:this.activeTab="attributes",this.$nextTick(()=>{this.updateCollapseStates(),this.activeTab==="raw"&&(this.rawInputsKey++,this.rawOutputsKey++),this.activeTab==="events"&&this.eventsKey++})}},methods:{copyToClipboard(l){if(!l){this.$message.warning(this.$t("debug.copyEmpty"));return}navigator.clipboard.writeText(l).then(()=>{this.$message.success(this.$t("debug.copySuccess"))}).catch(()=>{this.$message.error(this.$t("debug.copyFailed"))})},copyMessageContent(l){let n="";if(typeof l=="string")n=l;else if(Array.isArray(l)){const a=l.filter(o=>o&&o.type==="text"&&o.text).map(o=>o.text);n=a.length>0?a.join(`
80
+ `):this.formatRawJson(l)}else n=this.formatRawJson(l);this.copyToClipboard(n)},formatBytes(l){const n=typeof l=="number"?l:Number(l);if(!Number.isFinite(n))return typeof l=="string"?l:JSON.stringify(l,null,2);const a=n<0?"-":"";let o=Math.abs(n);const c=["B","K","M","G","T","P","E"];if(o<1024)return`${a}${Math.round(o)}B`;let d=0;for(;o>=1024&&d<c.length-1;)o/=1024,d++;return`${a}${o.toFixed(2)}${c[d]}`},handleClose(l){this.$emit("close"),l&&typeof l=="function"&&l()},handleSpanSearch(){this.$emit("span-search",this.spanSearchQuery)},handleHasEventsChange(l){this.$emit("update:span-has-events",l?!0:null)},handleSpanSelect(l){this.$emit("span-select",l),this.$nextTick(()=>{this.updateCollapseStates()})},updateCollapseStates(){var a,o,c,d,p;this.activeCollapse=["inputs","outputs"],(c=(o=(a=this.selectedSpan)==null?void 0:a.parsedContent)==null?void 0:o.inputs)!=null&&c.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((y,m)=>`message-${m}`):this.messageCollapse=[],this.rawIoCollapse=["rawInputs","rawOutputs"];const l=(p=(d=this.selectedSpan)==null?void 0:d.parsedContent)==null?void 0:p.events;l&&Array.isArray(l)&&l.length>0?this.eventsCollapse=l.map((y,m)=>`event-${m}`):this.eventsCollapse=[]},parseContentData(l){const n={attributes:l.attributes||{},events:l.events||[],status:l.status||{}};if(l.inputs&&(n.inputs=l.inputs),l.outputs&&(n.outputs=l.outputs),n.attributes){const a=n.attributes["langsword.spanInputs"],o=n.attributes["langsword.spanOutputs"];if(a)try{n.inputs=typeof a=="string"?JSON.parse(a):a}catch{try{const d=a.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.inputs=JSON.parse(d)}catch{n.inputs=a}}if(o)try{n.outputs=typeof o=="string"?JSON.parse(o):o}catch{try{const d=o.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.outputs=JSON.parse(d)}catch{n.outputs=o}}}return n},getStatusType(l){if(!l)return"info";const n=l.toUpperCase();return n==="OK"||n==="SUCCESS"?"success":n==="ERROR"||n==="FAILED"?"danger":n==="WARNING"||n==="WARN"?"warning":"info"},getStatusLabel(l){if(!l)return"-";const n=this.traceStatusList.find(a=>a.value===l);return n?n.label:l},formatNanoDuration(l){if(!l)return"-";const n=l/1e6;return n<1e3?`${n.toFixed(2)}ms`:n<6e4?`${(n/1e3).toFixed(2)}s`:`${(n/6e4).toFixed(2)}min`},formatTimestamp(l){if(!l)return"-";const n=typeof l=="string"?parseInt(l,10):l,a=new Date(n);return isNaN(a.getTime())?"-":a.toLocaleString("zh-CN")},formatEventTimestamp(l){if(!l)return"-";const n=l/1e6,a=new Date(n);return isNaN(a.getTime())?"-":a.toLocaleString("zh-CN")},getEventAttributesData(l){return!l||!l.attributes?[]:Object.entries(l.attributes).map(([n,a])=>({key:n,value:typeof a=="string"?a:JSON.stringify(a,null,2)}))},getOtherEventAttributes(l){if(!l||!l.attributes)return[];const n=["exception.type","exception.message","exception.stacktrace"];return Object.entries(l.attributes).filter(([a])=>!n.includes(a)).map(([a,o])=>({key:a,value:typeof o=="string"?o:JSON.stringify(o,null,2)}))},formatRawJson(l){if(!l)return"";if(typeof l=="string")try{const n=JSON.parse(l);return JSON.stringify(n,null,2)}catch{return l}return JSON.stringify(l,null,2)},getMessageIcon(l){return{user:"el-icon-user",assistant:"el-icon-service",system:"el-icon-setting"}[l]||"el-icon-document"},getMessageRoleLabel(l){const n={system:"debug.systemRole",user:"debug.userRole",assistant:"debug.assistantRole"};return n[l]?this.$t(n[l]):l},extractImagesFromObject(l,n=[],a=""){if(!(!l||typeof l!="object")){for(const[o,c]of Object.entries(l)){const d=a?`${a}.${o}`:o;typeof c=="string"&&c.trim()!==""?(c.startsWith("data:image/")||c.startsWith("/9j/")||c.startsWith("iVBOR")||c.startsWith("R0lGOD"))&&(n.push({path:d,value:c,label:o==="content"&&a?`${a.split(".").pop()}: ${o}`:o}),l[o]="[IMAGE_DATA]"):c&&typeof c=="object"&&!Array.isArray(c)?this.extractImagesFromObject(c,n,d):Array.isArray(c)&&c.forEach((p,y)=>{p&&typeof p=="object"&&this.extractImagesFromObject(p,n,`${d}[${y}]`)})}return n}},renderStructuredContent(l){const n=[];if(!l)return n;try{if(Array.isArray(l))l.forEach((a,o)=>{var c;a&&typeof a=="object"?a.type==="text"&&a.text?n.push({type:"markdown",content:Le(a.text),key:`text-${o}`}):a.type==="image_url"&&((c=a.image_url)!=null&&c.url)?n.push({type:"image",url:a.image_url.url,key:`image-${o}`}):a.image_base64&&a.image_base64.trim()!==""?n.push({type:"image",url:this.formatBase64Image(a.image_base64),key:`base64-image-${o}`}):n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:`json-${o}`}):n.push({type:"markdown",content:Le(String(a)),key:`text-${o}`})});else if(typeof l=="string")n.push({type:"markdown",content:Le(l),key:"text-0"});else if(typeof l=="object")if(l.data&&Array.isArray(l.data.result)){const a=JSON.parse(JSON.stringify(l)),o=[];a.data&&a.data.result&&a.data.result.forEach((c,d)=>{c.image_base64&&c.image_base64.trim()!==""&&(o.push({type:"page",image_base64:c.image_base64,page_num:c.page_num,label:c.page_num!==void 0?`Page ${c.page_num}`:`Result ${d}`}),c.image_base64="[BASE64_IMAGE_DATA]"),c.seals&&Array.isArray(c.seals)&&c.seals.forEach((p,y)=>{p.image_base64&&p.image_base64.trim()!==""&&(o.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]")})}),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((c,d)=>{n.push({type:"image",url:this.formatBase64Image(c.image_base64),key:`result-image-${d}`,label:c.label})})}else{const a=JSON.parse(JSON.stringify(l)),o=[];this.extractImagesFromObject(a,o),n.push({type:"markdown",content:Le("```json\n"+JSON.stringify(a,null,2)+"\n```"),key:"json-0"}),o.forEach((c,d)=>{n.push({type:"image",url:this.formatBase64Image(c.value),key:`extracted-image-${d}`,label:c.label})})}else n.push({type:"markdown",content:Le(String(l)),key:"text-0"})}catch(a){console.error("Error rendering content:",a),n.push({type:"markdown",content:Le("Error rendering content"),key:"error-0"})}return n},formatBase64Image(l){return l?l.startsWith("data:image")?l:l.startsWith("/9j/")?`data:image/jpeg;base64,${l}`:l.startsWith("iVBOR")?`data:image/png;base64,${l}`:l.startsWith("R0lGOD")?`data:image/gif;base64,${l}`:`data:image/jpeg;base64,${l}`:""},handleImageClick(l){Fl({options:this.viewerOptions,images:[l]})}}};var Wp=function(){var o,c,d,p,y,m,w,S,M,E;var n=this,a=n._self._c;return a("el-drawer",{attrs:{visible:n.localVisible,"with-header":!0,title:n.drawerTitle,size:"90%",direction:"rtl","before-close":n.handleClose},on:{"update:visible":function(A){n.localVisible=A}}},[n.currentTraceId?a("div",{directives:[{name:"loading",rawName:"v-loading",value:n.loading,expression:"loading"}],staticClass:"trace-detail-content",attrs:{"element-loading-text":"加载中..."}},[a("div",{staticClass:"trace-info-section"},[a("el-descriptions",{attrs:{column:3,border:""}},[a("el-descriptions-item",{attrs:{label:n.$t("trace.traceId")}},[n._v(n._s(n.traceInfo.trace_id))]),a("el-descriptions-item",{attrs:{label:n.$t("trace.status")}},[a("el-tag",{attrs:{type:n.getStatusType(n.traceInfo.status),size:"mini"}},[n._v(" "+n._s(n.getStatusLabel(n.traceInfo.status))+" ")])],1),a("el-descriptions-item",{attrs:{label:n.$t("trace.executionTime")}},[n._v(" "+n._s(n.formatNanoDuration(n.traceInfo.execution_time_ms))+" ")]),a("el-descriptions-item",{attrs:{label:n.$t("trace.timeCreated")}},[n._v(" "+n._s(n.formatTimestamp(n.traceInfo.timestamp_ms))+" ")]),a("el-descriptions-item",{attrs:{label:n.$t("trace.experimentId")}},[n._v(n._s(n.traceInfo.experiment_id))]),a("el-descriptions-item",{attrs:{label:n.$t("trace.traceType")}},[a("el-tag",{attrs:{size:"mini",type:"info"}},[n._v(n._s(n.traceInfo.trace_type||"-"))])],1),a("el-descriptions-item",{attrs:{label:n.$t("trace.traceName"),span:2}},[n._v(" "+n._s(n.traceInfo.trace_name||"-")+" ")])],1)],1),a("el-divider"),a("el-row",{attrs:{gutter:20}},[a("el-col",{staticClass:"span-tree-col",attrs:{span:8}},[a("el-card",[a("div",{staticClass:"span-search-header",attrs:{slot:"header"},slot:"header"},[a("el-input",{staticClass:"span-search-input",attrs:{placeholder:n.$t("span.searchTree"),"prefix-icon":"el-icon-search",size:"small",clearable:""},on:{input:n.handleSpanSearch},model:{value:n.spanSearchQuery,callback:function(A){n.spanSearchQuery=A},expression:"spanSearchQuery"}}),a("el-checkbox",{attrs:{value:n.spanHasEvents===!0,size:"small"},on:{change:n.handleHasEventsChange}},[n._v(" "+n._s(n.$t("span.hasEvents"))+" ")])],1),a("TraceSpanTree",{attrs:{spans:n.filteredSpans,"selected-span-id":n.selectedSpanId,"trace-start-time":n.traceStartTime,"trace-end-time":n.traceEndTime},on:{"span-select":n.handleSpanSelect}}),n.spanHasNextPage?a("div",{staticClass:"span-load-more"},[a("el-button",{attrs:{type:"primary",size:"mini",loading:n.spanLoadMoreLoading},on:{click:function(A){return n.$emit("span-load-more")}}},[n._v(" 加载更多 ")]),a("el-select",{staticClass:"span-page-size-select",attrs:{value:n.spanPageSize,size:"mini"},on:{input:function(A){return n.$emit("update:span-page-size",A)}}},[a("el-option",{attrs:{label:5e3,value:5e3}}),a("el-option",{attrs:{label:1e4,value:1e4}}),a("el-option",{attrs:{label:2e4,value:2e4}}),a("el-option",{attrs:{label:5e4,value:5e4}})],1)],1):n._e()],1)],1),a("el-col",{staticClass:"span-detail-col",attrs:{span:16}},[a("el-card",[n.selectedSpan?a("div",{staticClass:"span-detail-content"},[a("el-tabs",{key:`tabs-${n.selectedSpanId}`,model:{value:n.activeTab,callback:function(A){n.activeTab=A},expression:"activeTab"}},[n.showIOTab?a("el-tab-pane",{attrs:{label:`${n.$t("trace.inputs")} / ${n.$t("trace.outputs")}`,name:"io"}},[a("div",{staticClass:"io-content"},[n.hasInputs?a("div",{staticClass:"io-section"},[a("el-collapse",{model:{value:n.activeCollapse,callback:function(A){n.activeCollapse=A},expression:"activeCollapse"}},[a("el-collapse-item",{attrs:{name:"inputs"}},[a("template",{slot:"title"},[a("span",{staticClass:"collapse-title-text"},[n._v(n._s(n.$t("trace.inputs")))]),(c=(o=n.selectedSpan.parsedContent)==null?void 0:o.inputs)!=null&&c.messages?n._e():a("el-tooltip",{attrs:{content:n.$t("debug.copyTooltip"),placement:"top"}},[a("el-button",{staticClass:"copy-btn-inline",attrs:{type:"text",icon:"el-icon-document-copy",size:"mini"},nativeOn:{click:function(A){A.stopPropagation(),n.copyToClipboard(n.formatRawJson(n.selectedSpan.parsedContent.inputs))}}})],1)],1),(p=(d=n.selectedSpan.parsedContent)==null?void 0:d.inputs)!=null&&p.messages?a("div",{staticClass:"messages-section"},n._l(n.selectedSpan.parsedContent.inputs.messages,function(A,z){return a("div",{key:z,staticClass:"message-item"},[a("el-collapse",{model:{value:n.messageCollapse,callback:function(B){n.messageCollapse=B},expression:"messageCollapse"}},[a("el-collapse-item",{attrs:{name:`message-${z}`}},[a("template",{slot:"title"},[a("i",{staticClass:"message-icon",class:n.getMessageIcon(A.role)}),a("span",{staticClass:"message-role"},[n._v(n._s(n.getMessageRoleLabel(A.role)))]),a("el-tooltip",{attrs:{content:n.$t("debug.copyTooltip"),placement:"top"}},[a("el-button",{staticClass:"copy-btn-inline",attrs:{type:"text",icon:"el-icon-document-copy",size:"mini"},nativeOn:{click:function(B){return B.stopPropagation(),n.copyMessageContent(A.content)}}})],1)],1),a("div",{staticClass:"message-content"},[a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(A.content),function(B){return a("div",{key:B.key,staticClass:"content-element"},[B.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(B.content)}}):B.type==="image"?a("div",{staticClass:"image-content"},[B.label?a("div",{staticClass:"image-label"},[n._v(n._s(B.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:B.url,alt:"content image"},on:{click:function(P){return n.handleImageClick(B.url)}}})]):n._e()])}),0)])],2)],1)],1)}),0):(y=n.selectedSpan.parsedContent)!=null&&y.inputs?a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(n.selectedSpan.parsedContent.inputs),function(A){return a("div",{key:A.key,staticClass:"content-element"},[A.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(A.content)}}):A.type==="image"?a("div",{staticClass:"image-content"},[A.label?a("div",{staticClass:"image-label"},[n._v(n._s(A.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:A.url,alt:"content image"},on:{click:function(z){return n.handleImageClick(A.url)}}})]):n._e()])}),0):a("div",{staticClass:"empty-content"},[a("el-empty",{attrs:{description:n.$t("trace.noInputs"),"image-size":80}})],1)],2)],1)],1):n._e(),n.hasOutputs?a("div",{staticClass:"io-section"},[a("el-collapse",{model:{value:n.activeCollapse,callback:function(A){n.activeCollapse=A},expression:"activeCollapse"}},[a("el-collapse-item",{attrs:{name:"outputs"}},[a("template",{slot:"title"},[a("span",{staticClass:"collapse-title-text"},[n._v(n._s(n.$t("trace.outputs")))]),(w=(m=n.selectedSpan.parsedContent)==null?void 0:m.outputs)!=null&&w.choices?n._e():a("el-tooltip",{attrs:{content:n.$t("debug.copyTooltip"),placement:"top"}},[a("el-button",{staticClass:"copy-btn-inline",attrs:{type:"text",icon:"el-icon-document-copy",size:"mini"},nativeOn:{click:function(A){A.stopPropagation(),n.copyToClipboard(n.formatRawJson(n.selectedSpan.parsedContent.outputs))}}})],1)],1),(M=(S=n.selectedSpan.parsedContent)==null?void 0:S.outputs)!=null&&M.choices?a("div",{staticClass:"outputs-section"},n._l(n.selectedSpan.parsedContent.outputs.choices,function(A,z){return a("div",{key:z,staticClass:"choice-item"},[a("div",{staticClass:"choice-content"},[A.message?a("div",[a("div",{staticClass:"message-header"},[a("i",{staticClass:"el-icon-user message-icon"}),a("span",[n._v(n._s(n.getMessageRoleLabel(A.message.role)))]),a("el-tooltip",{attrs:{content:n.$t("debug.copyTooltip"),placement:"top"}},[a("el-button",{staticClass:"copy-btn-inline",attrs:{type:"text",icon:"el-icon-document-copy",size:"mini"},nativeOn:{click:function(B){return B.stopPropagation(),n.copyMessageContent(A.message.content)}}})],1)],1),a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(A.message.content),function(B){return a("div",{key:B.key,staticClass:"content-element"},[B.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(B.content)}}):B.type==="image"?a("div",{staticClass:"image-content"},[B.label?a("div",{staticClass:"image-label"},[n._v(n._s(B.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:B.url,alt:"content image"},on:{click:function(P){return n.handleImageClick(B.url)}}})]):n._e()])}),0)]):a("div",[a("div",{staticClass:"message-header"},[a("el-tooltip",{attrs:{content:n.$t("debug.copyTooltip"),placement:"top"}},[a("el-button",{staticClass:"copy-btn-inline",attrs:{type:"text",icon:"el-icon-document-copy",size:"mini"},nativeOn:{click:function(B){return B.stopPropagation(),n.copyMessageContent(A)}}})],1)],1),a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(A),function(B){return a("div",{key:B.key,staticClass:"content-element"},[B.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(B.content)}}):B.type==="image"?a("div",{staticClass:"image-content"},[B.label?a("div",{staticClass:"image-label"},[n._v(n._s(B.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:B.url,alt:"content image"},on:{click:function(P){return n.handleImageClick(B.url)}}})]):n._e()])}),0)])])])}),0):(E=n.selectedSpan.parsedContent)!=null&&E.outputs?a("div",{staticClass:"structured-content"},n._l(n.renderStructuredContent(n.selectedSpan.parsedContent.outputs),function(A){return a("div",{key:A.key,staticClass:"content-element"},[A.type==="markdown"?a("div",{staticClass:"markdown-content",domProps:{innerHTML:n._s(A.content)}}):A.type==="image"?a("div",{staticClass:"image-content"},[A.label?a("div",{staticClass:"image-label"},[n._v(n._s(A.label))]):n._e(),a("img",{staticClass:"content-image",attrs:{src:A.url,alt:"content image"},on:{click:function(z){return n.handleImageClick(A.url)}}})]):n._e()])}),0):a("div",{staticClass:"empty-content"},[a("el-empty",{attrs:{description:n.$t("trace.noOutputs"),"image-size":80}})],1)],2)],1)],1):n._e(),!n.hasInputs&&!n.hasOutputs?a("div",{staticClass:"empty-io"},[a("el-empty",{attrs:{description:n.$t("trace.noIoData")}})],1):n._e()])]):n._e(),a("el-tab-pane",{attrs:{label:n.$t("trace.attributes"),name:"attributes"}},[a("el-table",{staticClass:"attributes-table",attrs:{data:n.attributesData,border:"",stripe:""}},[a("el-table-column",{attrs:{prop:"key",label:n.$t("trace.key"),width:"250"},scopedSlots:n._u([{key:"default",fn:function(A){return[a("el-tooltip",{attrs:{content:A.row.key,placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[a("span",{staticClass:"attribute-key"},[n._v(n._s(A.row.key))])])]}}],null,!1,688878823)}),a("el-table-column",{attrs:{prop:"value",label:n.$t("trace.value")},scopedSlots:n._u([{key:"default",fn:function(A){return[a("el-tooltip",{attrs:{placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[a("div",{staticClass:"attribute-tooltip-content",attrs:{slot:"content"},slot:"content"},[n._v(n._s(A.row.value))]),a("div",{staticClass:"attribute-value"},[n._v(n._s(A.row.value))])])]}}],null,!1,4281519148)})],1)],1),n.showIOTab?a("el-tab-pane",{attrs:{label:n.$t("trace.rawInputsOutputs"),name:"raw"}},[n.activeTab==="raw"?a("div",{staticClass:"raw-io-content"},[n.rawInputs?a("div",{staticClass:"raw-io-section"},[a("el-collapse",{model:{value:n.rawIoCollapse,callback:function(A){n.rawIoCollapse=A},expression:"rawIoCollapse"}},[a("el-collapse-item",{attrs:{name:"rawInputs"}},[a("template",{slot:"title"},[a("span",{staticClass:"collapse-title-text"},[n._v(n._s(n.$t("trace.rawInputs")))]),a("el-tooltip",{attrs:{content:n.$t("debug.copyTooltip"),placement:"top"}},[a("el-button",{staticClass:"copy-btn-inline",attrs:{type:"text",icon:"el-icon-document-copy",size:"mini"},nativeOn:{click:function(A){A.stopPropagation(),n.copyToClipboard(n.formatRawJson(n.rawInputs))}}})],1)],1),a("codemirror",{key:`raw-inputs-${n.selectedSpanId}-${n.rawInputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.rawInputs),options:n.cmOptions}})],2)],1)],1):n._e(),n.rawOutputs?a("div",{staticClass:"raw-io-section"},[a("el-collapse",{model:{value:n.rawIoCollapse,callback:function(A){n.rawIoCollapse=A},expression:"rawIoCollapse"}},[a("el-collapse-item",{attrs:{name:"rawOutputs"}},[a("template",{slot:"title"},[a("span",{staticClass:"collapse-title-text"},[n._v(n._s(n.$t("trace.rawOutputs")))]),a("el-tooltip",{attrs:{content:n.$t("debug.copyTooltip"),placement:"top"}},[a("el-button",{staticClass:"copy-btn-inline",attrs:{type:"text",icon:"el-icon-document-copy",size:"mini"},nativeOn:{click:function(A){A.stopPropagation(),n.copyToClipboard(n.formatRawJson(n.rawOutputs))}}})],1)],1),a("codemirror",{key:`raw-outputs-${n.selectedSpanId}-${n.rawOutputsKey}`,staticClass:"code-editor-wrapper",attrs:{value:n.formatRawJson(n.rawOutputs),options:n.cmOptions}})],2)],1)],1):n._e(),!n.rawInputs&&!n.rawOutputs?a("div",{staticClass:"empty-raw-io"},[a("el-empty",{attrs:{description:n.$t("trace.noIoData")}})],1):n._e()]):n._e()]):n._e(),n.showDebugTab?a("el-tab-pane",{attrs:{label:"快速调试",name:"debug"}},[a("DebugTab",{directives:[{name:"show",rawName:"v-show",value:n.activeTab==="debug",expression:"activeTab === 'debug'"}],attrs:{"selected-span":n.selectedSpan,"selected-span-id":n.selectedSpanId}})],1):n._e(),n.hasEvents?a("el-tab-pane",{attrs:{label:n.$t("trace.events"),name:"events"}},[n.activeTab==="events"?a("div",{staticClass:"events-content"},[a("el-collapse",{model:{value:n.eventsCollapse,callback:function(A){n.eventsCollapse=A},expression:"eventsCollapse"}},n._l(n.spanEvents,function(A,z){return a("el-collapse-item",{key:`event-${z}`,attrs:{name:`event-${z}`}},[a("template",{slot:"title"},[a("div",{staticClass:"event-header"},[a("el-tag",{staticClass:"event-name-tag",attrs:{type:A.name==="exception"?"danger":"info",size:"mini"}},[n._v(" "+n._s(A.name)+" ")]),a("span",{staticClass:"event-time"},[n._v(n._s(n.formatEventTimestamp(A.timestamp)))])],1)]),a("div",{staticClass:"event-detail"},[A.name==="exception"?a("div",{staticClass:"exception-content"},[A.attributes["exception.type"]?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.exceptionType")))]),a("div",{staticClass:"field-value exception-type"},[n._v(n._s(A.attributes["exception.type"]))])]):n._e(),A.attributes["exception.message"]?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.exceptionMessage")))]),a("div",{staticClass:"field-value exception-message"},[n._v(n._s(A.attributes["exception.message"]))])]):n._e(),A.attributes["exception.stacktrace"]?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.exceptionStacktrace")))]),a("codemirror",{key:`stacktrace-${n.selectedSpanId}-${z}-${n.eventsKey}`,staticClass:"code-editor-wrapper stacktrace-editor",attrs:{value:A.attributes["exception.stacktrace"],options:n.cmOptionsJava}})],1):n._e(),n.getOtherEventAttributes(A).length>0?a("div",{staticClass:"exception-field"},[a("div",{staticClass:"field-label"},[n._v(n._s(n.$t("trace.otherAttributes")))]),a("el-table",{attrs:{data:n.getOtherEventAttributes(A),border:"",stripe:"",size:"mini"}},[a("el-table-column",{attrs:{prop:"key",label:n.$t("trace.key"),width:"200"}}),a("el-table-column",{attrs:{prop:"value",label:n.$t("trace.value")}})],1)],1):n._e()]):a("div",{staticClass:"general-event-content"},[a("el-table",{attrs:{data:n.getEventAttributesData(A),border:"",stripe:"",size:"mini"}},[a("el-table-column",{attrs:{prop:"key",label:n.$t("trace.key"),width:"200"},scopedSlots:n._u([{key:"default",fn:function(B){return[a("el-tooltip",{attrs:{content:B.row.key,placement:"top","open-delay":500}},[a("span",{staticClass:"attribute-key"},[n._v(n._s(B.row.key))])])]}}],null,!0)}),a("el-table-column",{attrs:{prop:"value",label:n.$t("trace.value")},scopedSlots:n._u([{key:"default",fn:function(B){return[a("el-tooltip",{attrs:{placement:"top","open-delay":500,"popper-class":"attribute-tooltip"}},[a("div",{staticClass:"attribute-tooltip-content",attrs:{slot:"content"},slot:"content"},[n._v(n._s(B.row.value))]),a("div",{staticClass:"attribute-value"},[n._v(n._s(B.row.value))])])]}}],null,!0)})],1)],1)])],2)}),1),n.spanEvents.length===0?a("div",{staticClass:"empty-events"},[a("el-empty",{attrs:{description:n.$t("trace.noEvents")}})],1):n._e()],1):n._e()]):n._e()],1)],1):a("el-empty",{attrs:{description:n.$t("trace.selectSpan")}})],1)],1)],1)],1):n._e()])},jp=[],qp=In(Hp,Wp,jp,!1,null,"5e3b210a");const Up={name:"Trace",components:{TraceDetailDrawer:qp.exports},data(){return{traceList:[],filteredTraceList:[],searchQuery:"",dateRange:null,selectedStatus:null,traceStatusList:[],experimentList:[],selectedExperimentId: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:"",spanHasEvents:null,selectedSpanId:null,selectedSpan:null,activeTab:"io",drawerLoading:!1,spanPageNum:1,spanPageSize:5e3,spanHasNextPage:!1,spanLoadMoreLoading:!1,messageCollapse:[],eventsCollapse:[],pageNum:1,pageSize:10,total:0,autoRefreshEnabled:!1,autoRefreshInterval:10,autoRefreshTimer:null,pickerOptions:{shortcuts:[{text:"近7天",onClick(l){const n=new Date,a=new Date;a.setTime(a.getTime()-3600*1e3*24*7),l.$emit("pick",[a,n])}},{text:"近30天",onClick(l){const n=new Date,a=new Date;a.setTime(a.getTime()-3600*1e3*24*30),l.$emit("pick",[a,n])}},{text:"7天前",onClick(l){const n=new Date;n.setTime(n.getTime()-3600*1e3*24*7),n.setHours(23,59,59,999);const a=n.getTime();l.$emit("pick",[null,a])}},{text:"30天前",onClick(l){const n=new Date;n.setTime(n.getTime()-3600*1e3*24*30),n.setHours(23,59,59,999);const a=n.getTime();l.$emit("pick",[null,a])}}]}}},computed:{},watch:{autoRefreshEnabled(l){l?this.startAutoRefresh():this.stopAutoRefresh()},spanHasEvents(){this.currentTraceId&&this.handleSpanSearch(this.spanSearchQuery)},spanPageSize(){this.currentTraceId&&this.handleSpanSearch(this.spanSearchQuery)}},mounted(){this.loadTraceStatus(),this.loadExperiments(),this.loadTraceList()},beforeDestroy(){this.stopAutoRefresh()},methods:{async loadTraceList(){this.loading=!0;try{let l=null,n=null;this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2?(this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""&&(l=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]!==""&&(n=typeof this.dateRange[1]=="number"?this.dateRange[1]:parseInt(this.dateRange[1],10))):this.dateRange.length===1&&this.dateRange[0]!==null&&(n=typeof this.dateRange[0]=="number"?this.dateRange[0]:parseInt(this.dateRange[0],10)));const a=await Vt.getTraceList(this.searchQuery,l,n,this.pageNum,this.pageSize,this.selectedExperimentId,this.selectedStatus),o=Array.isArray(a==null?void 0:a.list)?a.list:[];this.traceList=o,this.filteredTraceList=o,this.total=parseInt((a==null?void 0:a.total)||0,10)}catch(l){console.error("Failed to load trace list:",l),this.$message.error("加载 trace 列表失败"),this.traceList=[],this.filteredTraceList=[],this.total=0}finally{this.loading=!1}},refresh(){this.loadTraceList()},startAutoRefresh(){this.stopAutoRefresh();const l=this.autoRefreshInterval*1e3;this.autoRefreshTimer=setInterval(()=>{this.loadTraceList()},l)},stopAutoRefresh(){this.autoRefreshTimer&&(clearInterval(this.autoRefreshTimer),this.autoRefreshTimer=null)},handleAutoRefreshIntervalChange(){this.autoRefreshEnabled&&this.startAutoRefresh()},handleRowClick(l){this.viewDetail(l)},viewDetail(l){const n=l==null?void 0:l.trace_id;n&&(this.currentTraceId=n,this.traceInfo={...l},(l==null?void 0:l.status)==="WARN"&&(this.spanHasEvents=!0),this.drawerVisible=!0,this.loadTraceSpans(n))},async loadTraceSpans(l){var n,a,o;this.drawerLoading=!0,this.spanPageNum=1;try{const c=await Vt.getTraceSpans(l,{query:this.spanSearchQuery||"",has_events:this.spanHasEvents===!0?!0:void 0,page_num:1,page_size:this.spanPageSize}),d=Array.isArray(c==null?void 0:c.list)?c.list:[];if(this.spans=d,this.filteredSpans=d,this.spanHasNextPage=(c==null?void 0:c.has_next_page)===!0,this.spans.length>0){this.selectedSpanId=this.spans[0].span_id,this.selectedSpan=this.spans[0],await this.loadSpanContent(this.spans[0]);const p=this.spans[0].type==="CLIENT"||this.spans[0].type==="EMBEDDING"||this.spans[0].type==="CHAT_MODEL",y=this.selectedSpan.has_events===!0,m=[];p&&m.push("io","raw"),m.push("attributes"),y&&m.push("events");let w="attributes";p&&(w="io"),m.includes(w)?this.activeTab=w:this.activeTab="attributes",(a=(n=this.selectedSpan.parsedContent)==null?void 0:n.inputs)!=null&&a.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((M,E)=>`message-${E}`):this.messageCollapse=[];const S=(o=this.selectedSpan.parsedContent)==null?void 0:o.events;S&&Array.isArray(S)&&S.length>0?this.eventsCollapse=S.map((M,E)=>`event-${E}`):this.eventsCollapse=[]}}catch(c){console.error("Failed to load trace spans:",c),this.$message.error("加载 span 列表失败"),this.spans=[],this.filteredSpans=[],this.spanHasNextPage=!1}finally{this.drawerLoading=!1}},async handleSpanSearch(l){if(this.spanSearchQuery=l,!!this.currentTraceId){this.spanPageNum=1;try{const n=await Vt.getTraceSpans(this.currentTraceId,{query:l||"",has_events:this.spanHasEvents===!0?!0:void 0,page_num:1,page_size:this.spanPageSize}),a=Array.isArray(n==null?void 0:n.list)?n.list:[];this.spans=a,this.filteredSpans=a,this.spanHasNextPage=(n==null?void 0:n.has_next_page)===!0,this.spans.length>0&&!this.selectedSpanId&&(this.selectedSpanId=this.spans[0].span_id,this.selectedSpan=this.spans[0],await this.loadSpanContent(this.spans[0]))}catch(n){console.error("Failed to search spans:",n),this.spans=[],this.filteredSpans=[],this.spanHasNextPage=!1}}},async loadMoreSpans(){if(!(!this.currentTraceId||!this.spanHasNextPage||this.spanLoadMoreLoading)){this.spanLoadMoreLoading=!0;try{const l=this.spanPageNum+1,n=await Vt.getTraceSpans(this.currentTraceId,{query:this.spanSearchQuery||"",has_events:this.spanHasEvents===!0?!0:void 0,page_num:l,page_size:this.spanPageSize}),a=Array.isArray(n==null?void 0:n.list)?n.list:[];this.spans=this.spans.concat(a),this.filteredSpans=this.spans,this.spanPageNum=l,this.spanHasNextPage=(n==null?void 0:n.has_next_page)===!0}catch(l){console.error("Failed to load more spans:",l)}finally{this.spanLoadMoreLoading=!1}}},async handleSpanSelect(l){var p,y,m;this.selectedSpanId=l.span_id,this.selectedSpan=l,await this.loadSpanContent(l);const n=l.type==="CLIENT"||l.type==="EMBEDDING"||l.type==="CHAT_MODEL",a=l.has_events===!0,o=[];n&&o.push("io","raw"),o.push("attributes"),a&&o.push("events");let c="attributes";n&&(c="io"),this.$nextTick(()=>{o.includes(c)?this.activeTab=c:this.activeTab="attributes"}),(y=(p=this.selectedSpan.parsedContent)==null?void 0:p.inputs)!=null&&y.messages?this.messageCollapse=this.selectedSpan.parsedContent.inputs.messages.map((w,S)=>`message-${S}`):this.messageCollapse=[];const d=(m=this.selectedSpan.parsedContent)==null?void 0:m.events;d&&Array.isArray(d)&&d.length>0?this.eventsCollapse=d.map((w,S)=>`event-${S}`):this.eventsCollapse=[]},async loadSpanContent(l){if(!(!this.currentTraceId||!l.span_id||l.parsedContent))try{const n=await Vt.getSpanContent(this.currentTraceId,l.span_id);if(n){const a=this.parseContentData(n);this.$set(l,"parsedContent",a)}}catch(n){console.error("Failed to load span content:",n)}},parseContentData(l){const n={attributes:l.attributes||{},events:l.events||[],status:l.status||{}};if(l.inputs&&(n.inputs=l.inputs),l.outputs&&(n.outputs=l.outputs),n.attributes){const a=n.attributes["langsword.spanInputs"],o=n.attributes["langsword.spanOutputs"];if(a)try{n.inputs=typeof a=="string"?JSON.parse(a):a}catch{try{const d=a.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.inputs=JSON.parse(d)}catch{n.inputs=a}}if(o)try{n.outputs=typeof o=="string"?JSON.parse(o):o}catch{try{const d=o.replace(/\\"/g,'"').replace(/^"|"$/g,"");n.outputs=JSON.parse(d)}catch{n.outputs=o}}}return n},handleDrawerClose(){this.currentTraceId=null,this.traceInfo={},this.spans=[],this.filteredSpans=[],this.selectedSpanId=null,this.selectedSpan=null,this.spanSearchQuery="",this.spanHasEvents=null,this.spanPageNum=1,this.spanHasNextPage=!1,this.spanLoadMoreLoading=!1,this.eventsCollapse=[],this.drawerLoading=!1},async loadExperiments(){try{const l=await Vt.getExperiments();this.experimentList=Array.isArray(l)?l:[]}catch(l){console.error("Failed to load experiments:",l),this.experimentList=[]}},handleExperimentChange(){this.pageNum=1,this.loadTraceList()},handleSearch(){this.pageNum=1,this.loadTraceList()},handleSearchClear(){this.searchQuery="",this.pageNum=1,this.loadTraceList()},handleDateRangeChange(l){this.pageNum=1,l&&Array.isArray(l)?l.length===2&&(l[0]===null||l[0]===void 0)?this.dateRange=[null,l[1]]:this.dateRange=l:this.dateRange=l,this.loadTraceList()},handleSizeChange(l){this.pageSize=l,this.pageNum=1,this.loadTraceList()},handleCurrentChange(l){this.pageNum=l,this.loadTraceList()},async handleBatchDelete(){var p,y;const l=this.searchQuery&&this.searchQuery.trim(),n=this.dateRange&&Array.isArray(this.dateRange)&&(this.dateRange.length===2&&this.dateRange[1]!==null||this.dateRange.length===1&&this.dateRange[0]!==null),a=this.selectedExperimentId,o=this.selectedStatus;let c="",d="warning";if(!l&&!n&&!a&&!o)c=this.$t("trace.deleteAllWarning"),d="error";else{if(c=this.$t("trace.deleteConfirmMessage")+`
81
+ `,a){const m=this.experimentList.find(S=>S.experiment_id===this.selectedExperimentId),w=m?m.name:this.selectedExperimentId;c+=`${this.$t("trace.application")}: ${w}
82
+ `}if(l&&(c+=`${this.$t("trace.searchCondition")}: ${this.searchQuery}
83
+ `),o&&(c+=`${this.$t("trace.status")}: ${this.getStatusLabel(this.selectedStatus)}
84
+ `),n){const m=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(m):this.dateRange.length===1&&this.dateRange[0]!==null&&(w=new Date(this.dateRange[0]).toLocaleString(m)),this.dateRange.length===2&&this.dateRange[0]!==null&&this.dateRange[0]!==void 0&&this.dateRange[0]!==""){const S=new Date(this.dateRange[0]).toLocaleString(m);c+=`${this.$t("trace.timeRange")}: ${S} ${this.$t("trace.to")} ${w}
85
+ `}else this.$i18n.locale==="zh-CN"?c+=`${this.$t("trace.timeRange")}: ${this.$t("trace.before")} ${w} 之前
86
+ `:c+=`${this.$t("trace.timeRange")}: ${this.$t("trace.before")} ${w}
87
+ `}c+=this.$t("trace.deleteConfirmFooter")}try{await this.$confirm(c,this.$t("trace.confirmDelete"),{confirmButtonText:this.$t("trace.confirmDeleteButton"),cancelButtonText:this.$t("common.cancel"),type:d,dangerouslyUseHTMLString:!1}),this.deleteLoading=!0;let m=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]!==""&&(m=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 Vt.deleteTraces(l?this.searchQuery:null,m,w,this.selectedExperimentId,this.selectedStatus),this.$message.success(this.$t("trace.deleteSuccess")),await this.loadTraceList()}catch(m){if(m!=="cancel"){console.error("Failed to delete traces:",m);const w=((y=(p=m.response)==null?void 0:p.data)==null?void 0:y.message)||m.message||this.$t("trace.unknownError");this.$message.error(`${this.$t("trace.deleteFailed")}: ${w}`)}}finally{this.deleteLoading=!1}},async loadTraceStatus(){try{const l=await Vt.getTraceStatus();this.traceStatusList=Array.isArray(l)?l:[]}catch(l){console.error("Failed to load trace status:",l),this.traceStatusList=[]}},handleStatusChange(){this.pageNum=1,this.loadTraceList()},getStatusLabel(l){if(!l)return"-";const n=this.traceStatusList.find(a=>a.value===l);return n?n.label:l},getStatusType(l){return{OK:"success",ERROR:"danger",IN_PROGRESS:"warning",WARN:"warning",UNSET:"info"}[l]||"info"},formatDateTime(l){if(!l)return"-";const n=typeof l=="string"?parseInt(l,10):l;if(isNaN(n))return"-";const a=new Date(n);if(isNaN(a.getTime()))return"-";const o=a.getFullYear(),c=String(a.getMonth()+1).padStart(2,"0"),d=String(a.getDate()).padStart(2,"0"),p=String(a.getHours()).padStart(2,"0"),y=String(a.getMinutes()).padStart(2,"0"),m=String(a.getSeconds()).padStart(2,"0");return`${o}-${c}-${d} ${p}:${y}:${m}`},formatTimeAgo(l){if(!l)return"-";const n=typeof l=="string"?parseInt(l,10):l;if(isNaN(n))return"-";const o=Date.now()-n,c=this.$i18n.locale==="zh-CN",d=Math.floor(o/(1e3*60*60*24));if(d>0)return c?`${d} 天前`:`${d} days ago`;const p=Math.floor(o/(1e3*60*60));if(p>0)return c?`${p} 小时前`:`${p} hours ago`;const y=Math.floor(o/(1e3*60));return y>0?c?`${y} 分钟前`:`${y} minutes ago`:c?"刚刚":"Just now"},formatNanoDuration(l){if(!l)return"-";const n=l/1e6;return n<1e3?`${n.toFixed(2)}ms`:n<6e4?`${(n/1e3).toFixed(2)}s`:`${(n/6e4).toFixed(2)}min`},formatJson(l){return l?JSON.stringify(l,null,2):""},formatRawJson(l){if(!l)return"";if(typeof l=="string")try{const n=JSON.parse(l);return JSON.stringify(n,null,2)}catch{try{const a=l.replace(/\\"/g,'"').replace(/^"|"$/g,""),o=JSON.parse(a);return JSON.stringify(o,null,2)}catch{return l}}return JSON.stringify(l,null,2)},handleCodeMirrorReady(l){this.$nextTick(()=>{l&&l.refresh()})},formatMessageContent(l){return typeof l=="string"?l:JSON.stringify(l,null,2)},formatEventTime(l){if(l.time_unix_nano){const n=l.time_unix_nano/1e6;return new Date(n).toLocaleString("zh-CN")}return l.timestamp?new Date(l.timestamp).toLocaleString("zh-CN"):"-"},tableRowClassName({row:l,rowIndex:n}){return"trace-row"},getIndex(l){return(this.pageNum-1)*this.pageSize+l+1},applyColumns(){const l={};this.selectedColumns.forEach(n=>{l[n]=!0}),Object.keys(this.visibleColumns).forEach(n=>{this.selectedColumns.includes(n)||(l[n]=!1)}),this.visibleColumns=l,this.showColumnDialog=!1}}};var Gp=function(){var n=this,a=n._self._c;return a("div",{staticClass:"trace-list-container"},[a("el-card",[a("div",{staticClass:"trace-content-wrapper"},[a("div",{staticClass:"trace-toolbar"},[a("el-select",{staticClass:"toolbar-select",attrs:{placeholder:n.$t("trace.selectApplication"),clearable:"",size:"mini"},on:{change:n.handleExperimentChange},model:{value:n.selectedExperimentId,callback:function(o){n.selectedExperimentId=o},expression:"selectedExperimentId"}},n._l(n.experimentList,function(o){return a("el-option",{key:o.experiment_id,attrs:{label:o.name,value:o.experiment_id}})}),1),a("el-input",{staticClass:"toolbar-input",attrs:{placeholder:n.$t("trace.searchPlaceholder"),"prefix-icon":"el-icon-search",clearable:"",size:"mini"},on:{clear:n.handleSearchClear,input:n.handleSearch},model:{value:n.searchQuery,callback:function(o){n.searchQuery=o},expression:"searchQuery"}}),a("el-select",{staticClass:"toolbar-select",attrs:{placeholder:n.$t("trace.status"),clearable:"",size:"mini"},on:{change:n.handleStatusChange},model:{value:n.selectedStatus,callback:function(o){n.selectedStatus=o},expression:"selectedStatus"}},n._l(n.traceStatusList,function(o){return a("el-option",{key:o.value,attrs:{label:o.label,value:o.value}})}),1),a("el-date-picker",{staticClass:"toolbar-date-picker",attrs:{type:"datetimerange","range-separator":n.$t("trace.to"),"start-placeholder":n.$t("trace.startTime"),"end-placeholder":n.$t("trace.endTime"),"value-format":"timestamp",format:"yyyy-MM-dd HH:mm:ss",size:"mini","picker-options":n.pickerOptions,clearable:""},on:{change:n.handleDateRangeChange},model:{value:n.dateRange,callback:function(o){n.dateRange=o},expression:"dateRange"}}),a("el-button",{attrs:{type:"danger",icon:"el-icon-delete",size:"mini",disabled:n.deleteLoading},on:{click:n.handleBatchDelete}},[n._v(" "+n._s(n.$t("trace.batchDelete"))+" ")]),a("el-checkbox",{staticClass:"toolbar-auto-refresh",attrs:{size:"mini"},model:{value:n.autoRefreshEnabled,callback:function(o){n.autoRefreshEnabled=o},expression:"autoRefreshEnabled"}},[n._v(" "+n._s(n.$t("trace.autoRefresh"))+" ")]),n.autoRefreshEnabled?a("el-select",{staticClass:"toolbar-interval-select",attrs:{size:"mini"},on:{change:n.handleAutoRefreshIntervalChange},model:{value:n.autoRefreshInterval,callback:function(o){n.autoRefreshInterval=o},expression:"autoRefreshInterval"}},[a("el-option",{attrs:{label:n.$t("trace.refreshInterval5s"),value:5}}),a("el-option",{attrs:{label:n.$t("trace.refreshInterval10s"),value:10}}),a("el-option",{attrs:{label:n.$t("trace.refreshInterval20s"),value:20}})],1):n._e(),a("el-tooltip",{attrs:{content:n.$t("common.refresh"),placement:"top"}},[a("el-button",{attrs:{icon:"el-icon-refresh",size:"mini",circle:""},on:{click:n.refresh}})],1),a("el-button",{attrs:{icon:"el-icon-setting",size:"mini"},on:{click:function(o){n.showColumnDialog=!0}}},[n._v(" "+n._s(n.$t("common.columns"))+" ")])],1),a("div",{staticClass:"trace-table-wrapper"},[a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:n.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{data:n.filteredTraceList,size:"mini",stripe:"","row-class-name":n.tableRowClassName},on:{"row-click":n.handleRowClick}},[a("el-table-column",{attrs:{type:"index",label:"#",width:"60",index:n.getIndex}}),n.visibleColumns.trace_id?a("el-table-column",{attrs:{prop:"trace_id",label:n.$t("trace.requestId"),width:"280","show-overflow-tooltip":""},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-link",{attrs:{type:"primary"},on:{click:function(c){return c.stopPropagation(),n.viewDetail(o.row)}}},[n._v(" "+n._s(o.row.trace_id)+" ")])]}}],null,!1,1929277686)}):n._e(),n.visibleColumns.trace_name?a("el-table-column",{attrs:{prop:"trace_name",label:n.$t("trace.traceName"),"min-width":"300","show-overflow-tooltip":""},scopedSlots:n._u([{key:"default",fn:function(o){return[a("span",[n._v(n._s(o.row.trace_name||"-"))])]}}],null,!1,3633653970)}):n._e(),n.visibleColumns.trace_type?a("el-table-column",{attrs:{prop:"trace_type",label:n.$t("trace.traceType"),width:"120"},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-tag",{attrs:{size:"mini",type:"info"}},[n._v(n._s(o.row.trace_type||"-"))])]}}],null,!1,1175446173)}):n._e(),n.visibleColumns.execution_time_ms?a("el-table-column",{attrs:{prop:"execution_time_ms",label:n.$t("trace.executionTime"),width:"120"},scopedSlots:n._u([{key:"default",fn:function(o){return[n._v(" "+n._s(n.formatNanoDuration(o.row.execution_time_ms))+" ")]}}],null,!1,1733254102)}):n._e(),n.visibleColumns.status?a("el-table-column",{attrs:{prop:"status",label:n.$t("trace.status"),width:"100"},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-tag",{attrs:{type:n.getStatusType(o.row.status),size:"mini"}},[o.row.status==="OK"?a("i",{staticClass:"el-icon-success"}):n._e(),n._v(" "+n._s(n.getStatusLabel(o.row.status))+" ")])]}}],null,!1,4220190539)}):n._e(),n.visibleColumns.timestamp_ms?a("el-table-column",{attrs:{prop:"timestamp_ms",label:n.$t("trace.timeCreated"),width:"180"},scopedSlots:n._u([{key:"default",fn:function(o){return[n._v(" "+n._s(n.formatDateTime(o.row.timestamp_ms))+" ")]}}],null,!1,1082702673)}):n._e(),a("el-table-column",{attrs:{label:n.$t("common.operation"),width:"100",fixed:"right"},scopedSlots:n._u([{key:"default",fn:function(o){return[a("el-button",{attrs:{type:"text",size:"mini"},on:{click:function(c){return c.stopPropagation(),n.viewDetail(o.row)}}},[n._v(" "+n._s(n.$t("common.viewDetail"))+" ")])]}}])})],1)],1),a("div",{staticClass:"trace-pagination-wrapper"},[n.total>0?a("el-pagination",{staticClass:"trace-pagination",attrs:{"current-page":n.pageNum,"page-sizes":[10,20,50,100],"page-size":n.pageSize,size:"mini",layout:"total, prev, pager, next, sizes, jumper",total:n.total,background:""},on:{"size-change":n.handleSizeChange,"current-change":n.handleCurrentChange}}):n._e()],1)])]),a("el-dialog",{attrs:{title:n.$t("trace.selectColumns"),visible:n.showColumnDialog,width:"400px"},on:{"update:visible":function(o){n.showColumnDialog=o}}},[a("el-checkbox-group",{model:{value:n.selectedColumns,callback:function(o){n.selectedColumns=o},expression:"selectedColumns"}},[a("el-checkbox",{attrs:{label:"trace_id"}},[n._v(n._s(n.$t("trace.requestId")))]),a("el-checkbox",{attrs:{label:"timestamp_ms"}},[n._v(n._s(n.$t("trace.timeCreated")))]),a("el-checkbox",{attrs:{label:"status"}},[n._v(n._s(n.$t("trace.status")))]),a("el-checkbox",{attrs:{label:"execution_time_ms"}},[n._v(n._s(n.$t("trace.executionTime")))]),a("el-checkbox",{attrs:{label:"trace_type"}},[n._v(n._s(n.$t("trace.traceType")))]),a("el-checkbox",{attrs:{label:"trace_name"}},[n._v(n._s(n.$t("trace.traceName")))])],1),a("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{attrs:{size:"mini"},on:{click:function(o){n.showColumnDialog=!1}}},[n._v(n._s(n.$t("common.cancel")))]),a("el-button",{attrs:{size:"mini",type:"primary"},on:{click:n.applyColumns}},[n._v(n._s(n.$t("common.confirm")))])],1)],1),a("TraceDetailDrawer",{attrs:{visible:n.drawerVisible,"current-trace-id":n.currentTraceId,"trace-info":n.traceInfo,"trace-status-list":n.traceStatusList,spans:n.spans,"filtered-spans":n.filteredSpans,"selected-span-id":n.selectedSpanId,"selected-span":n.selectedSpan,loading:n.drawerLoading,"span-has-next-page":n.spanHasNextPage,"span-load-more-loading":n.spanLoadMoreLoading,"span-page-size":n.spanPageSize,"span-has-events":n.spanHasEvents},on:{"update:visible":[function(o){n.drawerVisible=o},function(o){n.drawerVisible=o}],"update:spanPageSize":function(o){n.spanPageSize=o},"update:span-page-size":function(o){n.spanPageSize=o},"update:spanHasEvents":function(o){n.spanHasEvents=o},"update:span-has-events":function(o){n.spanHasEvents=o},close:n.handleDrawerClose,"span-search":n.handleSpanSearch,"span-select":n.handleSpanSelect,"span-load-more":n.loadMoreSpans}})],1)},Kp=[],Xp=In(Up,Gp,Kp,!1,null,"d9c2b9bf");const ls=Xp.exports,Hl={routes:[{path:"/trace",name:"trace",component:ls}],beforeEach:(l,n,a)=>{a()}},Wl={common:{home:"首页",todos:"待办事项",trace:"追踪",login:"登录",logout:"退出",user:"用户",search:"搜索",refresh:"刷新",columns:"列设置",confirm:"确定",cancel:"取消",operation:"操作",viewDetail:"查看详情",language:"语言"},span:{searchTree:"Span名称/Span类型",hasEvents:"只显示有事件"},trace:{title:"追踪列表",searchPlaceholder:"追踪ID/追踪名称/追踪类型",requestId:"追踪ID",timeCreated:"创建时间",status:"状态",executionTime:"执行时长",traceType:"追踪类型",traceName:"追踪名称",traceDetail:"追踪详情",traceId:"追踪ID",clientRequestId:"客户端请求ID",experimentId:"应用ID",application:"应用",selectApplication:"请选择应用",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 数据!
86
88
 
87
89
  此操作不可恢复,请确认是否继续?`,deleteConfirmMessage:"确定要删除符合以下条件的 trace 吗?",searchCondition:"搜索条件",timeRange:"时间范围",before:"在",deleteConfirmFooter:`
88
- 此操作不可恢复,请确认是否继续?`,deleteSuccess:"删除成功",deleteFailed:"删除失败",unknownError:"未知错误",autoRefresh:"自动刷新",refreshInterval5s:"5秒",refreshInterval10s:"10秒",refreshInterval20s:"20秒"},debug:{paramLabel:"参数",systemPrompt:"系统提示词",userPrompt:"用户提示词",submitImage:"是否提交图片",addParam:"新增参数",reset:"重置",submit:"提交",responseResult:"返回结果",switchToMarkdown:"切换为Markdown",switchToRaw:"切换为原始输出",paramName:"参数名",paramValue:"参数值",yes:"是",no:"否"}},jl={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",hasEvents:"Has events"},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",application:"Application",selectApplication:"Please select application",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!
90
+ 此操作不可恢复,请确认是否继续?`,deleteSuccess:"删除成功",deleteFailed:"删除失败",unknownError:"未知错误",autoRefresh:"自动刷新",refreshInterval5s:"5秒",refreshInterval10s:"10秒",refreshInterval20s:"20秒"},debug:{paramLabel:"参数",systemPrompt:"系统提示词",userPrompt:"用户提示词",submitImage:"是否提交图片",addParam:"新增参数",reset:"重置",submit:"提交",responseResult:"返回结果",switchToMarkdown:"切换为Markdown",switchToRaw:"切换为原始输出",paramName:"参数名",paramValue:"参数值",yes:"是",no:"否",calculateTokens:"Token计算",calculateTokensTooltip:"仅计算文本类型提示词的token",copyTooltip:"复制内容",copySuccess:"复制成功",copyFailed:"复制失败",copyEmpty:"内容为空",tokenResultTitle:"Token计算结果",tokenType:"类型",tokenCount:"数量",specialTokens:"特殊字符",systemTokens:"系统提示词",userTokens:"用户提示词",assistantTokens:"助手回答",textTokens:"总计",systemRole:"系统",userRole:"用户",assistantRole:"助手"}},jl={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",hasEvents:"Has events"},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",application:"Application",selectApplication:"Please select application",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!
89
91
 
90
92
  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:`
91
- This operation cannot be undone. Are you sure you want to continue?`,deleteSuccess:"Delete successful",deleteFailed:"Delete failed",unknownError:"Unknown error",autoRefresh:"Auto refresh",refreshInterval5s:"5s",refreshInterval10s:"10s",refreshInterval20s:"20s"},debug:{paramLabel:"Parameter",systemPrompt:"System Prompt",userPrompt:"User Prompt",submitImage:"Submit Image",addParam:"Add Parameter",reset:"Reset",submit:"Submit",responseResult:"Response Result",switchToMarkdown:"Switch to Markdown",switchToRaw:"Switch to Raw Output",paramName:"Parameter Name",paramValue:"Parameter Value",yes:"Yes",no:"No"}},oi={"zh-CN":Wl,"en-US":jl};let us=!1;const ql=l=>{!l||us||(l.mergeLocaleMessage?(Object.keys(oi).forEach(n=>{l.mergeLocaleMessage(n,oi[n])}),us=!0):l.messages&&(Object.keys(oi).forEach(n=>{l.messages[n]||(l.messages[n]={}),Object.assign(l.messages[n],oi[n])}),us=!0))},Yp={store:uo,router:Hl,components:{Trace:ls,TraceSpanTree:Ua},api:Vt,locales:oi,setI18n(l){ql(l)},registerLocales:ql};Ie.Trace=ls,Ie.TraceSpanTree=Ua,Ie.default=Yp,Ie.enUS=jl,Ie.traceApi=Vt,Ie.traceRouter=Hl,Ie.traceStore=uo,Ie.zhCN=Wl,Object.defineProperties(Ie,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
93
+ This operation cannot be undone. Are you sure you want to continue?`,deleteSuccess:"Delete successful",deleteFailed:"Delete failed",unknownError:"Unknown error",autoRefresh:"Auto refresh",refreshInterval5s:"5s",refreshInterval10s:"10s",refreshInterval20s:"20s"},debug:{paramLabel:"Parameter",systemPrompt:"System Prompt",userPrompt:"User Prompt",submitImage:"Submit Image",addParam:"Add Parameter",reset:"Reset",submit:"Submit",responseResult:"Response Result",switchToMarkdown:"Switch to Markdown",switchToRaw:"Switch to Raw Output",paramName:"Parameter Name",paramValue:"Parameter Value",yes:"Yes",no:"No",calculateTokens:"Calculate Tokens",calculateTokensTooltip:"Only counts tokens for text prompts",copyTooltip:"Copy content",copySuccess:"Copied successfully",copyFailed:"Copy failed",copyEmpty:"Content is empty",tokenResultTitle:"Token Calculation Result",tokenType:"Type",tokenCount:"Count",specialTokens:"Special Tokens",systemTokens:"System Prompt",userTokens:"User Prompt",assistantTokens:"Assistant Message",textTokens:"Total",systemRole:"System",userRole:"User",assistantRole:"Assistant"}},oi={"zh-CN":Wl,"en-US":jl};let us=!1;const ql=l=>{!l||us||(l.mergeLocaleMessage?(Object.keys(oi).forEach(n=>{l.mergeLocaleMessage(n,oi[n])}),us=!0):l.messages&&(Object.keys(oi).forEach(n=>{l.messages[n]||(l.messages[n]={}),Object.assign(l.messages[n],oi[n])}),us=!0))},Yp={store:uo,router:Hl,components:{Trace:ls,TraceSpanTree:Ua},api:Vt,locales:oi,setI18n(l){ql(l)},registerLocales:ql};Ie.Trace=ls,Ie.TraceSpanTree=Ua,Ie.default=Yp,Ie.enUS=jl,Ie.traceApi=Vt,Ie.traceRouter=Hl,Ie.traceStore=uo,Ie.zhCN=Wl,Object.defineProperties(Ie,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});