Files
intotheeast-com-content/themes/intotheeast/js/post/post-form.js
T
m038 797b472a60 feat(post): add "More location details" panel — search, map, sync
Closed-by-default disclosure below City/Country holding a city/country
geocode lookup (Open-Meteo, city-only query with client-side country
ranking), a single-marker draggable MapLibre preview (lazy-loaded via
location-map.js), and the relocated lat/lng fields. GPS button, search
pick, pin drag, and typed values all stay in sync via syncPinFromFields(),
with a visual mismatch flag for unparseable typed input.

Built entirely in JS (mirrors the existing 'More options' disclosure
pattern) so post-form.html.twig needs no template change.
2026-07-24 19:38:24 +02:00

106 lines
388 KiB
JavaScript

import{a as Qu,b as at,c as Jh}from"./chunk-ZWRDP37E.js";var At=at((nl,ol)=>{(function(o,l){typeof nl=="object"&&typeof ol<"u"?ol.exports=l():typeof define=="function"&&define.amd?define(l):(o=o||self,o.CodeMirror=l())})(nl,function(){"use strict";var o=navigator.userAgent,l=navigator.platform,s=/gecko\/\d/i.test(o),a=/MSIE \d/.test(o),f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(o),h=/Edge\/(\d+)/.exec(o),c=a||f||h,d=c&&(a?document.documentMode||6:+(h||f)[1]),v=!h&&/WebKit\//.test(o),y=v&&/Qt\/\d+\.\d+/.test(o),x=!h&&/Chrome\/(\d+)/.exec(o),D=x&&+x[1],k=/Opera\//.test(o),F=/Apple Computer/.test(navigator.vendor),B=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(o),L=/PhantomJS/.test(o),T=F&&(/Mobile\/\w+/.test(o)||navigator.maxTouchPoints>2),N=/Android/.test(o),z=T||N||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(o),O=T||/Mac/.test(l),I=/\bCrOS\b/.test(o),W=/win/i.test(l),G=k&&o.match(/Version\/(\d*\.\d*)/);G&&(G=Number(G[1])),G&&G>=15&&(k=!1,v=!0);var X=O&&(y||k&&(G==null||G<12.11)),de=s||c&&d>=9;function j(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var oe=function(e,t){var i=e.className,r=j(t).exec(i);if(r){var n=i.slice(r.index+r[0].length);e.className=i.slice(0,r.index)+(n?r[1]+n:"")}};function H(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function Y(e,t){return H(e).appendChild(t)}function E(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),typeof t=="string")n.appendChild(document.createTextNode(t));else if(t)for(var u=0;u<t.length;++u)n.appendChild(t[u]);return n}function q(e,t,i,r){var n=E(e,t,i,r);return n.setAttribute("role","presentation"),n}var R;document.createRange?R=function(e,t,i,r){var n=document.createRange();return n.setEnd(r||e,i),n.setStart(e,t),n}:R=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 Q(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 he(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 be(e,t){var i=e.className;j(t).test(i)||(e.className+=(i?" ":"")+t)}function Ee(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!j(i[r]).test(t)&&(t+=" "+i[r]);return t}var A=function(e){e.select()};T?A=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:c&&(A=function(e){try{e.select()}catch{}});function w(e){return e.display.wrapper.ownerDocument}function te(e){return Ce(e.display.wrapper)}function Ce(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function xe(e){return w(e).defaultView}function mt(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Lt(e,t,i){t||(t={});for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i!==!1||!Object.prototype.hasOwnProperty.call(t,r))&&(t[r]=e[r]);return t}function Ye(e,t,i,r,n){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var u=r||0,p=n||0;;){var g=e.indexOf(" ",u);if(g<0||g>=t)return p+(t-u);p+=g-u,p+=i-p%i,u=g+1}}var ct=function(){this.id=null,this.f=null,this.time=0,this.handler=mt(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 ze(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}var Pe=50,Ze={toString:function(){return"CodeMirror.Pass"}},vt={scroll:!1},Fi={origin:"*mouse"},Xt={origin:"+move"};function Kt(e,t,i){for(var r=0,n=0;;){var u=e.indexOf(" ",r);u==-1&&(u=e.length);var p=u-r;if(u==e.length||n+p>=t)return r+Math.min(p,t-n);if(n+=u-r,n+=i-n%i,r=u+1,n>=t)return r}}var Ht=[""];function pr(e){for(;Ht.length<=e;)Ht.push(De(Ht)+" ");return Ht[e]}function De(e){return e[e.length-1]}function Pt(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function gr(e,t,i){for(var r=0,n=i(t);r<e.length&&i(e[r])<=n;)r++;e.splice(r,0,t)}function Cn(){}function Ul(e,t){var i;return Object.create?i=Object.create(e):(Cn.prototype=e,i=new Cn),t&&Lt(t,i),i}var Pc=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Zo(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Pc.test(e))}function Dn(e,t){return t?t.source.indexOf("\\w")>-1&&Zo(e)?!0:t.test(e):Zo(e)}function jl(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var qc=/[\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 Qo(e){return e.charCodeAt(0)>=768&&qc.test(e)}function Gl(e,t,i){for(;(i<0?t>0:t<e.length)&&Qo(e.charAt(t));)t+=i;return t}function Ti(e,t,i){for(var r=t>i?-1:1;;){if(t==i)return t;var n=(t+i)/2,u=r<0?Math.ceil(n):Math.floor(n);if(u==t)return e(u)?t:i;e(u)?i=u:t=u+r}}function Rc(e,t,i,r){if(!e)return r(t,i,"ltr",0);for(var n=!1,u=0;u<e.length;++u){var p=e[u];(p.from<i&&p.to>t||t==i&&p.to==t)&&(r(Math.max(p.from,t),Math.min(p.to,i),p.level==1?"rtl":"ltr",u),n=!0)}n||r(t,i,"ltr")}var Li=null;function Mi(e,t,i){var r;Li=null;for(var n=0;n<e.length;++n){var u=e[n];if(u.from<t&&u.to>t)return n;u.to==t&&(u.from!=u.to&&i=="before"?r=n:Li=n),u.from==t&&(u.from!=u.to&&i!="before"?r=n:Li=n)}return r??Li}var Wc=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function i(b){return b<=247?e.charAt(b):1424<=b&&b<=1524?"R":1536<=b&&b<=1785?t.charAt(b-1536):1774<=b&&b<=2220?"r":8192<=b&&b<=8203?"w":b==8204?"b":"L"}var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,u=/[LRr]/,p=/[Lb1n]/,g=/[1n]/;function m(b,C,S){this.level=b,this.from=C,this.to=S}return function(b,C){var S=C=="ltr"?"L":"R";if(b.length==0||C=="ltr"&&!r.test(b))return!1;for(var _=b.length,M=[],P=0;P<_;++P)M.push(i(b.charCodeAt(P)));for(var U=0,Z=S;U<_;++U){var J=M[U];J=="m"?M[U]=Z:Z=J}for(var ee=0,V=S;ee<_;++ee){var ie=M[ee];ie=="1"&&V=="r"?M[ee]="n":u.test(ie)&&(V=ie,ie=="r"&&(M[ee]="R"))}for(var se=1,le=M[0];se<_-1;++se){var we=M[se];we=="+"&&le=="1"&&M[se+1]=="1"?M[se]="1":we==","&&le==M[se+1]&&(le=="1"||le=="n")&&(M[se]=le),le=we}for(var Le=0;Le<_;++Le){var it=M[Le];if(it==",")M[Le]="N";else if(it=="%"){var Ie=void 0;for(Ie=Le+1;Ie<_&&M[Ie]=="%";++Ie);for(var Et=Le&&M[Le-1]=="!"||Ie<_&&M[Ie]=="1"?"1":"N",wt=Le;wt<Ie;++wt)M[wt]=Et;Le=Ie-1}}for(var Xe=0,Ct=S;Xe<_;++Xe){var ot=M[Xe];Ct=="L"&&ot=="1"?M[Xe]="L":u.test(ot)&&(Ct=ot)}for(var Qe=0;Qe<_;++Qe)if(n.test(M[Qe])){var Ke=void 0;for(Ke=Qe+1;Ke<_&&n.test(M[Ke]);++Ke);for(var qe=(Qe?M[Qe-1]:S)=="L",Dt=(Ke<_?M[Ke]:S)=="L",mi=qe==Dt?qe?"L":"R":S,kr=Qe;kr<Ke;++kr)M[kr]=mi;Qe=Ke-1}for(var st=[],Vt,nt=0;nt<_;)if(p.test(M[nt])){var rl=nt;for(++nt;nt<_&&p.test(M[nt]);++nt);st.push(new m(0,rl,nt))}else{var lr=nt,Rr=st.length,Wr=C=="rtl"?1:0;for(++nt;nt<_&&M[nt]!="L";++nt);for(var ht=lr;ht<nt;)if(g.test(M[ht])){lr<ht&&(st.splice(Rr,0,new m(1,lr,ht)),Rr+=Wr);var vi=ht;for(++ht;ht<nt&&g.test(M[ht]);++ht);st.splice(Rr,0,new m(2,vi,ht)),Rr+=Wr,lr=ht}else++ht;lr<nt&&st.splice(Rr,0,new m(1,lr,nt))}return C=="ltr"&&(st[0].level==1&&(Vt=b.match(/^\s+/))&&(st[0].from=Vt[0].length,st.unshift(new m(0,0,Vt[0].length))),De(st).level==1&&(Vt=b.match(/\s+$/))&&(De(st).to-=Vt[0].length,st.push(new m(0,_-Vt[0].length,_)))),C=="rtl"?st.reverse():st}}();function tr(e,t){var i=e.order;return i==null&&(i=e.order=Wc(e.text,t)),i}var Xl=[],ue=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]||Xl).concat(i)}};function Jo(e,t){return e._handlers&&e._handlers[t]||Xl}function Mt(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,n=r&&r[t];if(n){var u=ze(n,i);u>-1&&(r[t]=n.slice(0,u).concat(n.slice(u+1)))}}}function je(e,t){var i=Jo(e,t);if(i.length)for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)}function $e(e,t,i){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),je(e,i||t.type,e,t),Vo(t)||t.codemirrorIgnore}function Kl(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)ze(i,t[r])==-1&&i.push(t[r])}function Ot(e,t){return Jo(e,t).length>0}function Qr(e){e.prototype.on=function(t,i){ue(this,t,i)},e.prototype.off=function(t,i){Mt(this,t,i)}}function bt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Yl(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Vo(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Bi(e){bt(e),Yl(e)}function $o(e){return e.target||e.srcElement}function Zl(e){var t=e.which;return t==null&&(e.button&1?t=1:e.button&2?t=3:e.button&4&&(t=2)),O&&e.ctrlKey&&t==1&&(t=3),t}var Uc=function(){if(c&&d<9)return!1;var e=E("div");return"draggable"in e||"dragDrop"in e}(),ea;function jc(e){if(ea==null){var t=E("span","\u200B");Y(e,E("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(ea=t.offsetWidth<=1&&t.offsetHeight>2&&!(c&&d<8))}var i=ea?E("span","\u200B"):E("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}var ta;function Gc(e){if(ta!=null)return ta;var t=Y(e,document.createTextNode("A\u062EA")),i=R(t,0,1).getBoundingClientRect(),r=R(t,1,2).getBoundingClientRect();return H(e),!i||i.left==i.right?!1:ta=r.right-i.right<3}var ra=`
b`.split(/\n/).length!=3?function(e){for(var t=0,i=[],r=e.length;t<=r;){var n=e.indexOf(`
`,t);n==-1&&(n=e.length);var u=e.slice(t,e.charAt(n-1)=="\r"?n-1:n),p=u.indexOf("\r");p!=-1?(i.push(u.slice(0,p)),t+=p+1):(i.push(u),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},Xc=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},Kc=function(){var e=E("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ia=null;function Yc(e){if(ia!=null)return ia;var t=Y(e,E("span","x")),i=t.getBoundingClientRect(),r=R(t,0,1).getBoundingClientRect();return ia=Math.abs(i.left-r.left)>1}var na={},Jr={};function Zc(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),na[e]=t}function Qc(e,t){Jr[e]=t}function kn(e){if(typeof e=="string"&&Jr.hasOwnProperty(e))e=Jr[e];else if(e&&typeof e.name=="string"&&Jr.hasOwnProperty(e.name)){var t=Jr[e.name];typeof t=="string"&&(t={name:t}),e=Ul(t,e),e.name=t.name}else{if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return kn("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return kn("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function oa(e,t){t=kn(t);var i=na[t.name];if(!i)return oa(e,"text/plain");var r=i(e,t);if(Vr.hasOwnProperty(t.name)){var n=Vr[t.name];for(var u in n)n.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=n[u])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var p in t.modeProps)r[p]=t.modeProps[p];return r}var Vr={};function Jc(e,t){var i=Vr.hasOwnProperty(e)?Vr[e]:Vr[e]={};Lt(t,i)}function Lr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i}function aa(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 Ql(e,t,i){return e.startState?e.startState(t,i):!0}var Ge=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};Ge.prototype.eol=function(){return this.pos>=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ge.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},Ge.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Ye(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?Ye(this.string,this.lineStart,this.tabSize):0)},Ge.prototype.indentation=function(){return Ye(this.string,null,this.tabSize)-(this.lineStart?Ye(this.string,this.lineStart,this.tabSize):0)},Ge.prototype.match=function(e,t,i){if(typeof e=="string"){var r=function(p){return i?p.toLowerCase():p},n=this.string.substr(this.pos,e.length);if(r(n)==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)}},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};function ae(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 n=i.children[r],u=n.chunkSize();if(t<u){i=n;break}t-=u}return i.lines[t]}function Mr(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(u){var p=u.text;n==i.line&&(p=p.slice(0,i.ch)),n==t.line&&(p=p.slice(t.ch)),r.push(p),++n}),r}function la(e,t,i){var r=[];return e.iter(t,i,function(n){r.push(n.text)}),r}function Yt(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Fe(e){if(e.parent==null)return null;for(var t=e.parent,i=ze(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;r.children[n]!=t;++n)i+=r.children[n].chunkSize();return i+t.first}function Br(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],u=n.height;if(t<u){e=n;continue e}t-=u,i+=n.chunkSize()}return i}while(!e.lines);for(var p=0;p<e.lines.length;++p){var g=e.lines[p],m=g.height;if(t<m)break;t-=m}return i+p}function _i(e,t){return t>=e.first&&t<e.first+e.size}function sa(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function K(e,t,i){if(i===void 0&&(i=null),!(this instanceof K))return new K(e,t,i);this.line=e,this.ch=t,this.sticky=i}function me(e,t){return e.line-t.line||e.ch-t.ch}function ua(e,t){return e.sticky==t.sticky&&me(e,t)==0}function fa(e){return K(e.line,e.ch)}function Sn(e,t){return me(e,t)<0?t:e}function En(e,t){return me(e,t)<0?e:t}function Jl(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ve(e,t){if(t.line<e.first)return K(e.first,0);var i=e.first+e.size-1;return t.line>i?K(i,ae(e,i).text.length):Vc(t,ae(e,t.line).text.length)}function Vc(e,t){var i=e.ch;return i==null||i>t?K(e.line,t):i<0?K(e.line,0):e}function Vl(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=ve(e,t[r]);return i}var An=function(e,t){this.state=e,this.lookAhead=t},Zt=function(e,t,i,r){this.state=t,this.doc=e,this.line=i,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};Zt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return t!=null&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Zt.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}},Zt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Zt.fromSaved=function(e,t,i){return t instanceof An?new Zt(e,Lr(e.mode,t.state),i,t.lookAhead):new Zt(e,Lr(e.mode,t),i)},Zt.prototype.save=function(e){var t=e!==!1?Lr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new An(t,this.maxLookAhead):t};function $l(e,t,i,r){var n=[e.state.modeGen],u={};os(e,t.text,e.doc.mode,i,function(b,C){return n.push(b,C)},u,r);for(var p=i.state,g=function(b){i.baseTokens=n;var C=e.state.overlays[b],S=1,_=0;i.state=!0,os(e,t.text,C.mode,i,function(M,P){for(var U=S;_<M;){var Z=n[S];Z>M&&n.splice(S,1,M,n[S+1],Z),S+=2,_=Math.min(M,Z)}if(P)if(C.opaque)n.splice(U,S-U,M,"overlay "+P),S=U+2;else for(;U<S;U+=2){var J=n[U+1];n[U+1]=(J?J+" ":"")+"overlay "+P}},u),i.state=p,i.baseTokens=null,i.baseTokenPos=1},m=0;m<e.state.overlays.length;++m)g(m);return{styles:n,classes:u.bgClass||u.textClass?u:null}}function es(e,t,i){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=zi(e,Fe(t)),n=t.text.length>e.options.maxHighlightLength&&Lr(e.doc.mode,r.state),u=$l(e,t,r);n&&(r.state=n),t.stateAfter=r.save(!n),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 zi(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return new Zt(r,!0,t);var u=$c(e,t,i),p=u>r.first&&ae(r,u-1).stateAfter,g=p?Zt.fromSaved(r,p,u):new Zt(r,Ql(r.mode),u);return r.iter(u,t,function(m){ca(e,m.text,g);var b=g.line;m.stateAfter=b==t-1||b%5==0||b>=n.viewFrom&&b<n.viewTo?g.save():null,g.nextLine()}),i&&(r.modeFrontier=g.line),g}function ca(e,t,i,r){var n=e.doc.mode,u=new Ge(t,e.options.tabSize,i);for(u.start=u.pos=r||0,t==""&&ts(n,i.state);!u.eol();)da(n,u,i.state),u.start=u.pos}function ts(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var i=aa(e,t);if(i.mode.blankLine)return i.mode.blankLine(i.state)}}function da(e,t,i,r){for(var n=0;n<10;n++){r&&(r[0]=aa(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 rs=function(e,t,i){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=i};function is(e,t,i,r){var n=e.doc,u=n.mode,p;t=ve(n,t);var g=ae(n,t.line),m=zi(e,t.line,i),b=new Ge(g.text,e.options.tabSize,m),C;for(r&&(C=[]);(r||b.pos<t.ch)&&!b.eol();)b.start=b.pos,p=da(u,b,m.state),r&&C.push(new rs(b,p,Lr(n.mode,m.state)));return r?C:new rs(b,p,m.state)}function ns(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 os(e,t,i,r,n,u,p){var g=i.flattenSpans;g==null&&(g=e.options.flattenSpans);var m=0,b=null,C=new Ge(t,e.options.tabSize,r),S,_=e.options.addModeClass&&[null];for(t==""&&ns(ts(i,r.state),u);!C.eol();){if(C.pos>e.options.maxHighlightLength?(g=!1,p&&ca(e,t,r,C.pos),C.pos=t.length,S=null):S=ns(da(i,C,r.state,_),u),_){var M=_[0].name;M&&(S="m-"+(S?M+" "+S:M))}if(!g||b!=S){for(;m<C.start;)m=Math.min(C.start,m+5e3),n(m,b);b=S}C.start=C.pos}for(;m<C.pos;){var P=Math.min(C.pos,m+5e3);n(P,b),m=P}}function $c(e,t,i){for(var r,n,u=e.doc,p=i?-1:t-(e.doc.mode.innerMode?1e3:100),g=t;g>p;--g){if(g<=u.first)return u.first;var m=ae(u,g-1),b=m.stateAfter;if(b&&(!i||g+(b instanceof An?b.lookAhead:0)<=u.modeFrontier))return g;var C=Ye(m.text,null,e.options.tabSize);(n==null||r>C)&&(n=g-1,r=C)}return n}function ed(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 n=ae(e,r).stateAfter;if(n&&(!(n instanceof An)||r+n.lookAhead<t)){i=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,i)}}var as=!1,rr=!1;function td(){as=!0}function rd(){rr=!0}function Fn(e,t,i){this.marker=e,this.from=t,this.to=i}function Ni(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function id(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function nd(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 od(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var u=e[n],p=u.marker,g=u.from==null||(p.inclusiveLeft?u.from<=t:u.from<t);if(g||u.from==t&&p.type=="bookmark"&&(!i||!u.marker.insertLeft)){var m=u.to==null||(p.inclusiveRight?u.to>=t:u.to>t);(r||(r=[])).push(new Fn(p,u.from,m?null:u.to))}}return r}function ad(e,t,i){var r;if(e)for(var n=0;n<e.length;++n){var u=e[n],p=u.marker,g=u.to==null||(p.inclusiveRight?u.to>=t:u.to>t);if(g||u.from==t&&p.type=="bookmark"&&(!i||u.marker.insertLeft)){var m=u.from==null||(p.inclusiveLeft?u.from<=t:u.from<t);(r||(r=[])).push(new Fn(p,m?null:u.from-t,u.to==null?null:u.to-t))}}return r}function ha(e,t){if(t.full)return null;var i=_i(e,t.from.line)&&ae(e,t.from.line).markedSpans,r=_i(e,t.to.line)&&ae(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,u=t.to.ch,p=me(t.from,t.to)==0,g=od(i,n,p),m=ad(r,u,p),b=t.text.length==1,C=De(t.text).length+(b?n:0);if(g)for(var S=0;S<g.length;++S){var _=g[S];if(_.to==null){var M=Ni(m,_.marker);M?b&&(_.to=M.to==null?null:M.to+C):_.to=n}}if(m)for(var P=0;P<m.length;++P){var U=m[P];if(U.to!=null&&(U.to+=C),U.from==null){var Z=Ni(g,U.marker);Z||(U.from=C,b&&(g||(g=[])).push(U))}else U.from+=C,b&&(g||(g=[])).push(U)}g&&(g=ls(g)),m&&m!=g&&(m=ls(m));var J=[g];if(!b){var ee=t.text.length-2,V;if(ee>0&&g)for(var ie=0;ie<g.length;++ie)g[ie].to==null&&(V||(V=[])).push(new Fn(g[ie].marker,null,null));for(var se=0;se<ee;++se)J.push(V);J.push(m)}return J}function ls(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 ld(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(M){if(M.markedSpans)for(var P=0;P<M.markedSpans.length;++P){var U=M.markedSpans[P].marker;U.readOnly&&(!r||ze(r,U)==-1)&&(r||(r=[])).push(U)}}),!r)return null;for(var n=[{from:t,to:i}],u=0;u<r.length;++u)for(var p=r[u],g=p.find(0),m=0;m<n.length;++m){var b=n[m];if(!(me(b.to,g.from)<0||me(b.from,g.to)>0)){var C=[m,1],S=me(b.from,g.from),_=me(b.to,g.to);(S<0||!p.inclusiveLeft&&!S)&&C.push({from:b.from,to:g.from}),(_>0||!p.inclusiveRight&&!_)&&C.push({from:g.to,to:b.to}),n.splice.apply(n,C),m+=C.length-3}}return n}function ss(e){var t=e.markedSpans;if(t){for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}}function us(e,t){if(t){for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}}function Tn(e){return e.inclusiveLeft?-1:0}function Ln(e){return e.inclusiveRight?1:0}function pa(e,t){var i=e.lines.length-t.lines.length;if(i!=0)return i;var r=e.find(),n=t.find(),u=me(r.from,n.from)||Tn(e)-Tn(t);if(u)return-u;var p=me(r.to,n.to)||Ln(e)-Ln(t);return p||t.id-e.id}function fs(e,t){var i=rr&&e.markedSpans,r;if(i)for(var n=void 0,u=0;u<i.length;++u)n=i[u],n.marker.collapsed&&(t?n.from:n.to)==null&&(!r||pa(r,n.marker)<0)&&(r=n.marker);return r}function cs(e){return fs(e,!0)}function Mn(e){return fs(e,!1)}function sd(e,t){var i=rr&&e.markedSpans,r;if(i)for(var n=0;n<i.length;++n){var u=i[n];u.marker.collapsed&&(u.from==null||u.from<t)&&(u.to==null||u.to>t)&&(!r||pa(r,u.marker)<0)&&(r=u.marker)}return r}function ds(e,t,i,r,n){var u=ae(e,t),p=rr&&u.markedSpans;if(p)for(var g=0;g<p.length;++g){var m=p[g];if(m.marker.collapsed){var b=m.marker.find(0),C=me(b.from,i)||Tn(m.marker)-Tn(n),S=me(b.to,r)||Ln(m.marker)-Ln(n);if(!(C>=0&&S<=0||C<=0&&S>=0)&&(C<=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?me(b.to,i)>=0:me(b.to,i)>0)||C>=0&&(m.marker.inclusiveRight&&n.inclusiveLeft?me(b.from,r)<=0:me(b.from,r)<0)))return!0}}}function qt(e){for(var t;t=cs(e);)e=t.find(-1,!0).line;return e}function ud(e){for(var t;t=Mn(e);)e=t.find(1,!0).line;return e}function fd(e){for(var t,i;t=Mn(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function ga(e,t){var i=ae(e,t),r=qt(i);return i==r?t:Fe(r)}function hs(e,t){if(t>e.lastLine())return t;var i=ae(e,t),r;if(!mr(e,i))return t;for(;r=Mn(i);)i=r.find(1,!0).line;return Fe(i)+1}function mr(e,t){var i=rr&&t.markedSpans;if(i){for(var r=void 0,n=0;n<i.length;++n)if(r=i[n],!!r.marker.collapsed){if(r.from==null)return!0;if(!r.marker.widgetNode&&r.from==0&&r.marker.inclusiveLeft&&ma(e,t,r))return!0}}}function ma(e,t,i){if(i.to==null){var r=i.marker.find(1,!0);return ma(e,r.line,Ni(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n=void 0,u=0;u<t.markedSpans.length;++u)if(n=t.markedSpans[u],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(n.to==null||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&ma(e,t,n))return!0}function ir(e){e=qt(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var u=i.parent;u;i=u,u=i.parent)for(var p=0;p<u.children.length;++p){var g=u.children[p];if(g==i)break;t+=g.height}return t}function Bn(e){if(e.height==0)return 0;for(var t=e.text.length,i,r=e;i=cs(r);){var n=i.find(0,!0);r=n.from.line,t+=n.from.ch-n.to.ch}for(r=e;i=Mn(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 va(e){var t=e.display,i=e.doc;t.maxLine=ae(i,i.first),t.maxLineLength=Bn(t.maxLine),t.maxLineChanged=!0,i.iter(function(r){var n=Bn(r);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=r)})}var $r=function(e,t,i){this.text=e,us(this,t),this.height=i?i(this):1};$r.prototype.lineNo=function(){return Fe(this)},Qr($r);function cd(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),ss(e),us(e,i);var n=r?r(e):1;n!=e.height&&Yt(e,n)}function dd(e){e.parent=null,ss(e)}var hd={},pd={};function ps(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?pd:hd;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function gs(e,t){var i=q("span",null,null,v?"padding-right: .1px":null),r={pre:q("pre",[i],"CodeMirror-line"),content:i,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var u=n?t.rest[n-1]:t.line,p=void 0;r.pos=0,r.addToken=md,Gc(e.display.measure)&&(p=tr(u,e.doc.direction))&&(r.addToken=bd(r.addToken,p)),r.map=[];var g=t!=e.display.externalMeasured&&Fe(u);yd(u,r,es(e,u,g)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=Ee(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=Ee(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(jc(e.display.measure))),n==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(v){var m=r.content.lastChild;(/\bcm-tab\b/.test(m.className)||m.querySelector&&m.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ee(r.pre.className,r.textClass||"")),r}function gd(e){var t=E("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function md(e,t,i,r,n,u,p){if(t){var g=e.splitSpaces?vd(t,e.trailingSpace):t,m=e.cm.state.specialChars,b=!1,C;if(!m.test(t))e.col+=t.length,C=document.createTextNode(g),e.map.push(e.pos,e.pos+t.length,C),c&&d<9&&(b=!0),e.pos+=t.length;else{C=document.createDocumentFragment();for(var S=0;;){m.lastIndex=S;var _=m.exec(t),M=_?_.index-S:t.length-S;if(M){var P=document.createTextNode(g.slice(S,S+M));c&&d<9?C.appendChild(E("span",[P])):C.appendChild(P),e.map.push(e.pos,e.pos+M,P),e.col+=M,e.pos+=M}if(!_)break;S+=M+1;var U=void 0;if(_[0]==" "){var Z=e.cm.options.tabSize,J=Z-e.col%Z;U=C.appendChild(E("span",pr(J),"cm-tab")),U.setAttribute("role","presentation"),U.setAttribute("cm-text"," "),e.col+=J}else _[0]=="\r"||_[0]==`
`?(U=C.appendChild(E("span",_[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),U.setAttribute("cm-text",_[0]),e.col+=1):(U=e.cm.options.specialCharPlaceholder(_[0]),U.setAttribute("cm-text",_[0]),c&&d<9?C.appendChild(E("span",[U])):C.appendChild(U),e.col+=1);e.map.push(e.pos,e.pos+1,U),e.pos++}}if(e.trailingSpace=g.charCodeAt(t.length-1)==32,i||r||n||b||u||p){var ee=i||"";r&&(ee+=r),n&&(ee+=n);var V=E("span",[C],ee,u);if(p)for(var ie in p)p.hasOwnProperty(ie)&&ie!="style"&&ie!="class"&&V.setAttribute(ie,p[ie]);return e.content.appendChild(V)}e.content.appendChild(C)}}function vd(e,t){if(e.length>1&&!/ /.test(e))return e;for(var i=t,r="",n=0;n<e.length;n++){var u=e.charAt(n);u==" "&&i&&(n==e.length-1||e.charCodeAt(n+1)==32)&&(u="\xA0"),r+=u,i=u==" "}return r}function bd(e,t){return function(i,r,n,u,p,g,m){n=n?n+" cm-force-border":"cm-force-border";for(var b=i.pos,C=b+r.length;;){for(var S=void 0,_=0;_<t.length&&(S=t[_],!(S.to>b&&S.from<=b));_++);if(S.to>=C)return e(i,r,n,u,p,g,m);e(i,r.slice(0,S.to-b),n,u,null,g,m),u=null,r=r.slice(S.to-b),b=S.to}}}function ms(e,t,i,r){var n=!r&&i.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!r&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",i.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function yd(e,t,i){var r=e.markedSpans,n=e.text,u=0;if(!r){for(var p=1;p<i.length;p+=2)t.addToken(t,n.slice(u,u=i[p]),ps(i[p+1],t.cm.options));return}for(var g=n.length,m=0,b=1,C="",S,_,M=0,P,U,Z,J,ee;;){if(M==m){P=U=Z=_="",ee=null,J=null,M=1/0;for(var V=[],ie=void 0,se=0;se<r.length;++se){var le=r[se],we=le.marker;if(we.type=="bookmark"&&le.from==m&&we.widgetNode)V.push(we);else if(le.from<=m&&(le.to==null||le.to>m||we.collapsed&&le.to==m&&le.from==m)){if(le.to!=null&&le.to!=m&&M>le.to&&(M=le.to,U=""),we.className&&(P+=" "+we.className),we.css&&(_=(_?_+";":"")+we.css),we.startStyle&&le.from==m&&(Z+=" "+we.startStyle),we.endStyle&&le.to==M&&(ie||(ie=[])).push(we.endStyle,le.to),we.title&&((ee||(ee={})).title=we.title),we.attributes)for(var Le in we.attributes)(ee||(ee={}))[Le]=we.attributes[Le];we.collapsed&&(!J||pa(J.marker,we)<0)&&(J=le)}else le.from>m&&M>le.from&&(M=le.from)}if(ie)for(var it=0;it<ie.length;it+=2)ie[it+1]==M&&(U+=" "+ie[it]);if(!J||J.from==m)for(var Ie=0;Ie<V.length;++Ie)ms(t,0,V[Ie]);if(J&&(J.from||0)==m){if(ms(t,(J.to==null?g+1:J.to)-m,J.marker,J.from==null),J.to==null)return;J.to==m&&(J=!1)}}if(m>=g)break;for(var Et=Math.min(g,M);;){if(C){var wt=m+C.length;if(!J){var Xe=wt>Et?C.slice(0,Et-m):C;t.addToken(t,Xe,S?S+P:P,Z,m+Xe.length==M?U:"",_,ee)}if(wt>=Et){C=C.slice(Et-m),m=Et;break}m=wt,Z=""}C=n.slice(u,u=i[b++]),S=ps(i[b++],t.cm.options)}}}function vs(e,t,i){this.line=t,this.rest=fd(t),this.size=this.rest?Fe(De(this.rest))-i+1:1,this.node=this.text=null,this.hidden=mr(e,t)}function _n(e,t,i){for(var r=[],n,u=t;u<i;u=n){var p=new vs(e.doc,ae(e.doc,u),u);n=u+p.size,r.push(p)}return r}var ei=null;function xd(e){ei?ei.ops.push(e):e.ownsGroup=ei={ops:[e],delayedCallbacks:[]}}function wd(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 n=e.ops[r];if(n.cursorActivityHandlers)for(;n.cursorActivityCalled<n.cursorActivityHandlers.length;)n.cursorActivityHandlers[n.cursorActivityCalled++].call(null,n.cm)}}while(i<t.length)}function Cd(e,t){var i=e.ownsGroup;if(i)try{wd(i)}finally{ei=null,t(i)}}var Oi=null;function et(e,t){var i=Jo(e,t);if(i.length){var r=Array.prototype.slice.call(arguments,2),n;ei?n=ei.delayedCallbacks:Oi?n=Oi:(n=Oi=[],setTimeout(Dd,0));for(var u=function(g){n.push(function(){return i[g].apply(null,r)})},p=0;p<i.length;++p)u(p)}}function Dd(){var e=Oi;Oi=null;for(var t=0;t<e.length;++t)e[t]()}function bs(e,t,i,r){for(var n=0;n<t.changes.length;n++){var u=t.changes[n];u=="text"?Sd(e,t):u=="gutter"?xs(e,t,i,r):u=="class"?ba(e,t):u=="widget"&&Ed(e,t,r)}t.changes=null}function Ii(e){return e.node==e.text&&(e.node=E("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),c&&d<8&&(e.node.style.zIndex=2)),e.node}function kd(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=Ii(t);t.background=r.insertBefore(E("div",null,i),r.firstChild),e.display.input.setUneditable(t.background)}}function ys(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):gs(e,t)}function Sd(e,t){var i=t.text.className,r=ys(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,ba(e,t)):i&&(t.text.className=i)}function ba(e,t){kd(e,t),t.line.wrapClass?Ii(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 xs(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 n=Ii(t);t.gutterBackground=E("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),n.insertBefore(t.gutterBackground,t.text)}var u=t.line.gutterMarkers;if(e.options.lineNumbers||u){var p=Ii(t),g=t.gutter=E("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(g.setAttribute("aria-hidden","true"),e.display.input.setUneditable(g),p.insertBefore(g,t.text),t.line.gutterClass&&(g.className+=" "+t.line.gutterClass),e.options.lineNumbers&&(!u||!u["CodeMirror-linenumbers"])&&(t.lineNumber=g.appendChild(E("div",sa(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),u)for(var m=0;m<e.display.gutterSpecs.length;++m){var b=e.display.gutterSpecs[m].className,C=u.hasOwnProperty(b)&&u[b];C&&g.appendChild(E("div",[C],"CodeMirror-gutter-elt","left: "+r.gutterLeft[b]+"px; width: "+r.gutterWidth[b]+"px"))}}}function Ed(e,t,i){t.alignable&&(t.alignable=null);for(var r=j("CodeMirror-linewidget"),n=t.node.firstChild,u=void 0;n;n=u)u=n.nextSibling,r.test(n.className)&&t.node.removeChild(n);ws(e,t,i)}function Ad(e,t,i,r){var n=ys(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),ba(e,t),xs(e,t,i,r),ws(e,t,r),t.node}function ws(e,t,i){if(Cs(e,t.line,t,i,!0),t.rest)for(var r=0;r<t.rest.length;r++)Cs(e,t.rest[r],t,i,!1)}function Cs(e,t,i,r,n){if(t.widgets)for(var u=Ii(i),p=0,g=t.widgets;p<g.length;++p){var m=g[p],b=E("div",[m.node],"CodeMirror-linewidget"+(m.className?" "+m.className:""));m.handleMouseEvents||b.setAttribute("cm-ignore-events","true"),Fd(m,b,i,r),e.display.input.setUneditable(b),n&&m.above?u.insertBefore(b,i.gutter||i.text):u.appendChild(b),et(m,"redraw")}}function Fd(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var n=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function Hi(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Q(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;"),Y(t.display.measure,E("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function nr(e,t){for(var i=$o(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 zn(e){return e.lineSpace.offsetTop}function ya(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ds(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=Y(e.measure,E("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 Qt(e){return Pe-e.display.nativeBarWidth}function _r(e){return e.display.scroller.clientWidth-Qt(e)-e.display.barWidth}function xa(e){return e.display.scroller.clientHeight-Qt(e)-e.display.barHeight}function Td(e,t,i){var r=e.options.lineWrapping,n=r&&_r(e);if(!t.measure.heights||r&&t.measure.width!=n){var u=t.measure.heights=[];if(r){t.measure.width=n;for(var p=t.text.firstChild.getClientRects(),g=0;g<p.length-1;g++){var m=p[g],b=p[g+1];Math.abs(m.bottom-b.bottom)>2&&u.push((m.bottom+b.top)/2-i.top)}}u.push(i.bottom-i.top)}}function ks(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 n=0;n<e.rest.length;n++)if(Fe(e.rest[n])>i)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}}function Ld(e,t){t=qt(t);var i=Fe(t),r=e.display.externalMeasured=new vs(e.doc,t,i);r.lineN=i;var n=r.built=gs(e,r);return r.text=n.pre,Y(e.display.lineMeasure,n.pre),r}function Ss(e,t,i,r){return Jt(e,ti(e,t),i,r)}function wa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Or(e,t)];var i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size)return i}function ti(e,t){var i=Fe(t),r=wa(e,i);r&&!r.text?r=null:r&&r.changes&&(bs(e,r,i,Ea(e)),e.curOp.forceUpdate=!0),r||(r=Ld(e,t));var n=ks(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function Jt(e,t,i,r,n){t.before&&(i=-1);var u=i+(r||""),p;return t.cache.hasOwnProperty(u)?p=t.cache[u]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Td(e,t.view,t.rect),t.hasHeights=!0),p=Bd(e,t,i,r),p.bogus||(t.cache[u]=p)),{left:p.left,right:p.right,top:n?p.rtop:p.top,bottom:n?p.rbottom:p.bottom}}var Es={left:0,right:0,top:0,bottom:0};function As(e,t,i){for(var r,n,u,p,g,m,b=0;b<e.length;b+=3)if(g=e[b],m=e[b+1],t<g?(n=0,u=1,p="left"):t<m?(n=t-g,u=n+1):(b==e.length-3||t==m&&e[b+3]>t)&&(u=m-g,n=u-1,t>=m&&(p="right")),n!=null){if(r=e[b+2],g==m&&i==(r.insertLeft?"left":"right")&&(p=i),i=="left"&&n==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)r=e[(b-=3)+2],p="left";if(i=="right"&&n==m-g)for(;b<e.length-3&&e[b+3]==e[b+4]&&!e[b+5].insertLeft;)r=e[(b+=3)+2],p="right";break}return{node:r,start:n,end:u,collapse:p,coverStart:g,coverEnd:m}}function Md(e,t){var i=Es;if(t=="left")for(var r=0;r<e.length&&(i=e[r]).left==i.right;r++);else for(var n=e.length-1;n>=0&&(i=e[n]).left==i.right;n--);return i}function Bd(e,t,i,r){var n=As(t.map,i,r),u=n.node,p=n.start,g=n.end,m=n.collapse,b;if(u.nodeType==3){for(var C=0;C<4;C++){for(;p&&Qo(t.line.text.charAt(n.coverStart+p));)--p;for(;n.coverStart+g<n.coverEnd&&Qo(t.line.text.charAt(n.coverStart+g));)++g;if(c&&d<9&&p==0&&g==n.coverEnd-n.coverStart?b=u.parentNode.getBoundingClientRect():b=Md(R(u,p,g).getClientRects(),r),b.left||b.right||p==0)break;g=p,p=p-1,m="right"}c&&d<11&&(b=_d(e.display.measure,b))}else{p>0&&(m=r="right");var S;e.options.lineWrapping&&(S=u.getClientRects()).length>1?b=S[r=="right"?S.length-1:0]:b=u.getBoundingClientRect()}if(c&&d<9&&!p&&(!b||!b.left&&!b.right)){var _=u.parentNode.getClientRects()[0];_?b={left:_.left,right:_.left+ii(e.display),top:_.top,bottom:_.bottom}:b=Es}for(var M=b.top-t.rect.top,P=b.bottom-t.rect.top,U=(M+P)/2,Z=t.view.measure.heights,J=0;J<Z.length-1&&!(U<Z[J]);J++);var ee=J?Z[J-1]:0,V=Z[J],ie={left:(m=="right"?b.right:b.left)-t.rect.left,right:(m=="left"?b.left:b.right)-t.rect.left,top:ee,bottom:V};return!b.left&&!b.right&&(ie.bogus=!0),e.options.singleCursorHeightPerLine||(ie.rtop=M,ie.rbottom=P),ie}function _d(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!Yc(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 Fs(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 Ts(e){e.display.externalMeasure=null,H(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Fs(e.display.view[t])}function Pi(e){Ts(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Ls(e){return x&&N?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function Ms(e){return x&&N?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function Ca(e){var t=qt(e),i=t.widgets,r=0;if(i)for(var n=0;n<i.length;++n)i[n].above&&(r+=Hi(i[n]));return r}function Nn(e,t,i,r,n){if(!n){var u=Ca(t);i.top+=u,i.bottom+=u}if(r=="line")return i;r||(r="local");var p=ir(t);if(r=="local"?p+=zn(e.display):p-=e.display.viewOffset,r=="page"||r=="window"){var g=e.display.lineSpace.getBoundingClientRect();p+=g.top+(r=="window"?0:Ms(w(e)));var m=g.left+(r=="window"?0:Ls(w(e)));i.left+=m,i.right+=m}return i.top+=p,i.bottom+=p,i}function Bs(e,t,i){if(i=="div")return t;var r=t.left,n=t.top;if(i=="page")r-=Ls(w(e)),n-=Ms(w(e));else if(i=="local"||!i){var u=e.display.sizer.getBoundingClientRect();r+=u.left,n+=u.top}var p=e.display.lineSpace.getBoundingClientRect();return{left:r-p.left,top:n-p.top}}function On(e,t,i,r,n){return r||(r=ae(e.doc,t.line)),Nn(e,r,Ss(e,r,t.ch,n),i)}function Rt(e,t,i,r,n,u){r=r||ae(e.doc,t.line),n||(n=ti(e,r));function p(P,U){var Z=Jt(e,n,P,U?"right":"left",u);return U?Z.left=Z.right:Z.right=Z.left,Nn(e,r,Z,i)}var g=tr(r,e.doc.direction),m=t.ch,b=t.sticky;if(m>=r.text.length?(m=r.text.length,b="before"):m<=0&&(m=0,b="after"),!g)return p(b=="before"?m-1:m,b=="before");function C(P,U,Z){var J=g[U],ee=J.level==1;return p(Z?P-1:P,ee!=Z)}var S=Mi(g,m,b),_=Li,M=C(m,S,b=="before");return _!=null&&(M.other=C(m,_,b!="before")),M}function _s(e,t){var i=0;t=ve(e.doc,t),e.options.lineWrapping||(i=ii(e.display)*t.ch);var r=ae(e.doc,t.line),n=ir(r)+zn(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function Da(e,t,i,r,n){var u=K(e,t,i);return u.xRel=n,r&&(u.outside=r),u}function ka(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,i<0)return Da(r.first,0,null,-1,-1);var n=Br(r,i),u=r.first+r.size-1;if(n>u)return Da(r.first+r.size-1,ae(r,u).text.length,null,1,1);t<0&&(t=0);for(var p=ae(r,n);;){var g=zd(e,p,n,t,i),m=sd(p,g.ch+(g.xRel>0||g.outside>0?1:0));if(!m)return g;var b=m.find(1);if(b.line==n)return b;p=ae(r,n=b.line)}}function zs(e,t,i,r){r-=Ca(t);var n=t.text.length,u=Ti(function(p){return Jt(e,i,p-1).bottom<=r},n,0);return n=Ti(function(p){return Jt(e,i,p).top>r},u,n),{begin:u,end:n}}function Ns(e,t,i,r){i||(i=ti(e,t));var n=Nn(e,t,Jt(e,i,r),"line").top;return zs(e,t,i,n)}function Sa(e,t,i,r){return e.bottom<=i?!1:e.top>i?!0:(r?e.left:e.right)>t}function zd(e,t,i,r,n){n-=ir(t);var u=ti(e,t),p=Ca(t),g=0,m=t.text.length,b=!0,C=tr(t,e.doc.direction);if(C){var S=(e.options.lineWrapping?Od:Nd)(e,t,i,u,C,r,n);b=S.level!=1,g=b?S.from:S.to-1,m=b?S.to:S.from-1}var _=null,M=null,P=Ti(function(se){var le=Jt(e,u,se);return le.top+=p,le.bottom+=p,Sa(le,r,n,!1)?(le.top<=n&&le.left<=r&&(_=se,M=le),!0):!1},g,m),U,Z,J=!1;if(M){var ee=r-M.left<M.right-r,V=ee==b;P=_+(V?0:1),Z=V?"after":"before",U=ee?M.left:M.right}else{!b&&(P==m||P==g)&&P++,Z=P==0?"after":P==t.text.length?"before":Jt(e,u,P-(b?1:0)).bottom+p<=n==b?"after":"before";var ie=Rt(e,K(i,P,Z),"line",t,u);U=ie.left,J=n<ie.top?-1:n>=ie.bottom?1:0}return P=Gl(t.text,P,1),Da(i,P,Z,J,r-U)}function Nd(e,t,i,r,n,u,p){var g=Ti(function(S){var _=n[S],M=_.level!=1;return Sa(Rt(e,K(i,M?_.to:_.from,M?"before":"after"),"line",t,r),u,p,!0)},0,n.length-1),m=n[g];if(g>0){var b=m.level!=1,C=Rt(e,K(i,b?m.from:m.to,b?"after":"before"),"line",t,r);Sa(C,u,p,!0)&&C.top>p&&(m=n[g-1])}return m}function Od(e,t,i,r,n,u,p){var g=zs(e,t,r,p),m=g.begin,b=g.end;/\s/.test(t.text.charAt(b-1))&&b--;for(var C=null,S=null,_=0;_<n.length;_++){var M=n[_];if(!(M.from>=b||M.to<=m)){var P=M.level!=1,U=Jt(e,r,P?Math.min(b,M.to)-1:Math.max(m,M.from)).right,Z=U<u?u-U+1e9:U-u;(!C||S>Z)&&(C=M,S=Z)}}return C||(C=n[n.length-1]),C.from<m&&(C={from:m,to:C.to,level:C.level}),C.to>b&&(C={from:C.from,to:b,level:C.level}),C}var zr;function ri(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(zr==null){zr=E("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)zr.appendChild(document.createTextNode("x")),zr.appendChild(E("br"));zr.appendChild(document.createTextNode("x"))}Y(e.measure,zr);var i=zr.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),H(e.measure),i||1}function ii(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=E("span","xxxxxxxxxx"),i=E("pre",[t],"CodeMirror-line-like");Y(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Ea(e){for(var t=e.display,i={},r={},n=t.gutters.clientLeft,u=t.gutters.firstChild,p=0;u;u=u.nextSibling,++p){var g=e.display.gutterSpecs[p].className;i[g]=u.offsetLeft+u.clientLeft+n,r[g]=u.clientWidth}return{fixedPos:Aa(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Aa(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Os(e){var t=ri(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/ii(e.display)-3);return function(n){if(mr(e.doc,n))return 0;var u=0;if(n.widgets)for(var p=0;p<n.widgets.length;p++)n.widgets[p].height&&(u+=n.widgets[p].height);return i?u+(Math.ceil(n.text.length/r)||1)*t:u+t}}function Fa(e){var t=e.doc,i=Os(e);t.iter(function(r){var n=i(r);n!=r.height&&Yt(r,n)})}function Nr(e,t,i,r){var n=e.display;if(!i&&$o(t).getAttribute("cm-not-content")=="true")return null;var u,p,g=n.lineSpace.getBoundingClientRect();try{u=t.clientX-g.left,p=t.clientY-g.top}catch{return null}var m=ka(e,u,p),b;if(r&&m.xRel>0&&(b=ae(e.doc,m.line).text).length==m.ch){var C=Ye(b,b.length,e.options.tabSize)-b.length;m=K(m.line,Math.max(0,Math.round((u-Ds(e.display).left)/ii(e.display))-C))}return m}function Or(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 yt(e,t,i,r){t==null&&(t=e.doc.first),i==null&&(i=e.doc.first+e.doc.size),r||(r=0);var n=e.display;if(r&&i<n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)rr&&ga(e.doc,t)<n.viewTo&&br(e);else if(i<=n.viewFrom)rr&&hs(e.doc,i+r)>n.viewFrom?br(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)br(e);else if(t<=n.viewFrom){var u=In(e,i,i+r,1);u?(n.view=n.view.slice(u.index),n.viewFrom=u.lineN,n.viewTo+=r):br(e)}else if(i>=n.viewTo){var p=In(e,t,t,-1);p?(n.view=n.view.slice(0,p.index),n.viewTo=p.lineN):br(e)}else{var g=In(e,t,t,-1),m=In(e,i,i+r,1);g&&m?(n.view=n.view.slice(0,g.index).concat(_n(e,g.lineN,m.lineN)).concat(n.view.slice(m.index)),n.viewTo+=r):br(e)}var b=n.externalMeasured;b&&(i<b.lineN?b.lineN+=r:t<b.lineN+b.size&&(n.externalMeasured=null))}function vr(e,t,i){e.curOp.viewChanged=!0;var r=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var u=r.view[Or(e,t)];if(u.node!=null){var p=u.changes||(u.changes=[]);ze(p,i)==-1&&p.push(i)}}}function br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function In(e,t,i,r){var n=Or(e,t),u,p=e.display.view;if(!rr||i==e.doc.first+e.doc.size)return{index:n,lineN:i};for(var g=e.display.viewFrom,m=0;m<n;m++)g+=p[m].size;if(g!=t){if(r>0){if(n==p.length-1)return null;u=g+p[n].size-t,n++}else u=g-t;t+=u,i+=u}for(;ga(e.doc,i)!=i;){if(n==(r<0?0:p.length-1))return null;i+=r*p[n-(r<0?1:0)].size,n+=r}return{index:n,lineN:i}}function Id(e,t,i){var r=e.display,n=r.view;n.length==0||t>=r.viewTo||i<=r.viewFrom?(r.view=_n(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=_n(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Or(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(_n(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,Or(e,i)))),r.viewTo=i}function Is(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var n=t[r];!n.hidden&&(!n.node||n.changes)&&++i}return i}function qi(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Hs(e,t){t===void 0&&(t=!0);var i=e.doc,r={},n=r.cursors=document.createDocumentFragment(),u=r.selection=document.createDocumentFragment(),p=e.options.$customCursor;p&&(t=!0);for(var g=0;g<i.sel.ranges.length;g++)if(!(!t&&g==i.sel.primIndex)){var m=i.sel.ranges[g];if(!(m.from().line>=e.display.viewTo||m.to().line<e.display.viewFrom)){var b=m.empty();if(p){var C=p(e,m);C&&Ta(e,C,n)}else(b||e.options.showCursorWhenSelecting)&&Ta(e,m.head,n);b||Hd(e,m,u)}}return r}function Ta(e,t,i){var r=Rt(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),n=i.appendChild(E("div","\xA0","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var u=On(e,t,"div",null,null),p=u.right-u.left;n.style.width=(p>0?p:e.defaultCharWidth())+"px"}if(r.other){var g=i.appendChild(E("div","\xA0","CodeMirror-cursor CodeMirror-secondarycursor"));g.style.display="",g.style.left=r.other.left+"px",g.style.top=r.other.top+"px",g.style.height=(r.other.bottom-r.other.top)*.85+"px"}}function Hn(e,t){return e.top-t.top||e.left-t.left}function Hd(e,t,i){var r=e.display,n=e.doc,u=document.createDocumentFragment(),p=Ds(e.display),g=p.left,m=Math.max(r.sizerWidth,_r(e)-r.sizer.offsetLeft)-p.right,b=n.direction=="ltr";function C(V,ie,se,le){ie<0&&(ie=0),ie=Math.round(ie),le=Math.round(le),u.appendChild(E("div",null,"CodeMirror-selected","position: absolute; left: "+V+`px;
top: `+ie+"px; width: "+(se??m-V)+`px;
height: `+(le-ie)+"px"))}function S(V,ie,se){var le=ae(n,V),we=le.text.length,Le,it;function Ie(Xe,Ct){return On(e,K(V,Xe),"div",le,Ct)}function Et(Xe,Ct,ot){var Qe=Ns(e,le,null,Xe),Ke=Ct=="ltr"==(ot=="after")?"left":"right",qe=ot=="after"?Qe.begin:Qe.end-(/\s/.test(le.text.charAt(Qe.end-1))?2:1);return Ie(qe,Ke)[Ke]}var wt=tr(le,n.direction);return Rc(wt,ie||0,se??we,function(Xe,Ct,ot,Qe){var Ke=ot=="ltr",qe=Ie(Xe,Ke?"left":"right"),Dt=Ie(Ct-1,Ke?"right":"left"),mi=ie==null&&Xe==0,kr=se==null&&Ct==we,st=Qe==0,Vt=!wt||Qe==wt.length-1;if(Dt.top-qe.top<=3){var nt=(b?mi:kr)&&st,rl=(b?kr:mi)&&Vt,lr=nt?g:(Ke?qe:Dt).left,Rr=rl?m:(Ke?Dt:qe).right;C(lr,qe.top,Rr-lr,qe.bottom)}else{var Wr,ht,vi,il;Ke?(Wr=b&&mi&&st?g:qe.left,ht=b?m:Et(Xe,ot,"before"),vi=b?g:Et(Ct,ot,"after"),il=b&&kr&&Vt?m:Dt.right):(Wr=b?Et(Xe,ot,"before"):g,ht=!b&&mi&&st?m:qe.right,vi=!b&&kr&&Vt?g:Dt.left,il=b?Et(Ct,ot,"after"):m),C(Wr,qe.top,ht-Wr,qe.bottom),qe.bottom<Dt.top&&C(g,qe.bottom,null,Dt.top),C(vi,Dt.top,il-vi,Dt.bottom)}(!Le||Hn(qe,Le)<0)&&(Le=qe),Hn(Dt,Le)<0&&(Le=Dt),(!it||Hn(qe,it)<0)&&(it=qe),Hn(Dt,it)<0&&(it=Dt)}),{start:Le,end:it}}var _=t.from(),M=t.to();if(_.line==M.line)S(_.line,_.ch,M.ch);else{var P=ae(n,_.line),U=ae(n,M.line),Z=qt(P)==qt(U),J=S(_.line,_.ch,Z?P.text.length+1:null).end,ee=S(M.line,Z?0:null,M.ch).start;Z&&(J.top<ee.top-2?(C(J.right,J.top,null,J.bottom),C(g,ee.top,ee.left,ee.bottom)):C(J.right,J.top,ee.left-J.right,J.bottom)),J.bottom<ee.top&&C(g,J.bottom,null,ee.top)}i.appendChild(u)}function La(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()||ni(e),t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ps(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ba(e))}function Ma(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&ni(e))},100)}function Ba(e,t){e.state.delayingBlurEvent&&!e.state.draggingText&&(e.state.delayingBlurEvent=!1),e.options.readOnly!="nocursor"&&(e.state.focused||(je(e,"focus",e,t),e.state.focused=!0,be(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),v&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),La(e))}function ni(e,t){e.state.delayingBlurEvent||(e.state.focused&&(je(e,"blur",e,t),e.state.focused=!1,oe(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Pn(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),n=t.lineDiv.getBoundingClientRect().top,u=0,p=0;p<t.view.length;p++){var g=t.view[p],m=e.options.lineWrapping,b=void 0,C=0;if(!g.hidden){if(n+=g.line.height,c&&d<8){var S=g.node.offsetTop+g.node.offsetHeight;b=S-i,i=S}else{var _=g.node.getBoundingClientRect();b=_.bottom-_.top,!m&&g.text.firstChild&&(C=g.text.firstChild.getBoundingClientRect().right-_.left-1)}var M=g.line.height-b;if((M>.005||M<-.005)&&(n<r&&(u-=M),Yt(g.line,b),qs(g.line),g.rest))for(var P=0;P<g.rest.length;P++)qs(g.rest[P]);if(C>e.display.sizerWidth){var U=Math.ceil(C/ii(e.display));U>e.display.maxLineLength&&(e.display.maxLineLength=U,e.display.maxLine=g.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function qs(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 qn(e,t,i){var r=i&&i.top!=null?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-zn(e));var n=i&&i.bottom!=null?i.bottom:r+e.wrapper.clientHeight,u=Br(t,r),p=Br(t,n);if(i&&i.ensure){var g=i.ensure.from.line,m=i.ensure.to.line;g<u?(u=g,p=Br(t,ir(ae(t,g))+e.wrapper.clientHeight)):Math.min(m,t.lastLine())>=p&&(u=Br(t,ir(ae(t,m))-e.wrapper.clientHeight),p=m)}return{from:u,to:Math.max(p,u+1)}}function Pd(e,t){if(!$e(e,"scrollCursorIntoView")){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null,u=i.wrapper.ownerDocument;if(t.top+r.top<0?n=!0:t.bottom+r.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(n=!1),n!=null&&!L){var p=E("div","\u200B",null,`position: absolute;
top: `+(t.top-i.viewOffset-zn(e.display))+`px;
height: `+(t.bottom-t.top+Qt(e)+i.barHeight)+`px;
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(p),p.scrollIntoView(n),e.display.lineSpace.removeChild(p)}}}function qd(e,t,i,r){r==null&&(r=0);var n;!e.options.lineWrapping&&t==i&&(i=t.sticky=="before"?K(t.line,t.ch+1,"before"):t,t=t.ch?K(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var p=!1,g=Rt(e,t),m=!i||i==t?g:Rt(e,i);n={left:Math.min(g.left,m.left),top:Math.min(g.top,m.top)-r,right:Math.max(g.left,m.left),bottom:Math.max(g.bottom,m.bottom)+r};var b=_a(e,n),C=e.doc.scrollTop,S=e.doc.scrollLeft;if(b.scrollTop!=null&&(Wi(e,b.scrollTop),Math.abs(e.doc.scrollTop-C)>1&&(p=!0)),b.scrollLeft!=null&&(Ir(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-S)>1&&(p=!0)),!p)break}return n}function Rd(e,t){var i=_a(e,t);i.scrollTop!=null&&Wi(e,i.scrollTop),i.scrollLeft!=null&&Ir(e,i.scrollLeft)}function _a(e,t){var i=e.display,r=ri(e.display);t.top<0&&(t.top=0);var n=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:i.scroller.scrollTop,u=xa(e),p={};t.bottom-t.top>u&&(t.bottom=t.top+u);var g=e.doc.height+ya(i),m=t.top<r,b=t.bottom>g-r;if(t.top<n)p.scrollTop=m?0:t.top;else if(t.bottom>n+u){var C=Math.min(t.top,(b?g:t.bottom)-u);C!=n&&(p.scrollTop=C)}var S=e.options.fixedGutter?0:i.gutters.offsetWidth,_=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:i.scroller.scrollLeft-S,M=_r(e)-i.gutters.offsetWidth,P=t.right-t.left>M;return P&&(t.right=t.left+M),t.left<10?p.scrollLeft=0:t.left<_?p.scrollLeft=Math.max(0,t.left+S-(P?0:10)):t.right>M+_-3&&(p.scrollLeft=t.right+(P?0:10)-M),p}function za(e,t){t!=null&&(Rn(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function oi(e){Rn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ri(e,t,i){(t!=null||i!=null)&&Rn(e),t!=null&&(e.curOp.scrollLeft=t),i!=null&&(e.curOp.scrollTop=i)}function Wd(e,t){Rn(e),e.curOp.scrollToPos=t}function Rn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=_s(e,t.from),r=_s(e,t.to);Rs(e,i,r,t.margin)}}function Rs(e,t,i,r){var n=_a(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});Ri(e,n.scrollLeft,n.scrollTop)}function Wi(e,t){Math.abs(e.doc.scrollTop-t)<2||(s||Oa(e,{top:t}),Ws(e,t,!0),s&&Oa(e),Gi(e,100))}function Ws(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 Ir(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,Ks(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Ui(e){var t=e.display,i=t.gutters.offsetWidth,r=Math.round(e.doc.height+ya(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+Qt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:i}}var Hr=function(e,t,i){this.cm=i;var r=this.vert=E("div",[E("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=E("div",[E("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=n.tabIndex=-1,e(r),e(n),ue(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ue(n,"scroll",function(){n.clientWidth&&t(n.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,c&&d<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Hr.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 n=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"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}},Hr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Hr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Hr.prototype.zeroWidthHack=function(){var e=O&&!B?"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},Hr.prototype.enableZeroWidthBar=function(e,t,i){e.style.visibility="";function r(){var n=e.getBoundingClientRect(),u=i=="vert"?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},Hr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var ji=function(){};ji.prototype.update=function(){return{bottom:0,right:0}},ji.prototype.setScrollLeft=function(){},ji.prototype.setScrollTop=function(){},ji.prototype.clear=function(){};function ai(e,t){t||(t=Ui(e));var i=e.display.barWidth,r=e.display.barHeight;Us(e,t);for(var n=0;n<4&&i!=e.display.barWidth||r!=e.display.barHeight;n++)i!=e.display.barWidth&&e.options.lineWrapping&&Pn(e),Us(e,Ui(e)),i=e.display.barWidth,r=e.display.barHeight}function Us(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 js={native:Hr,null:ji};function Gs(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&oe(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new js[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ue(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"?Ir(e,t):Wi(e,t)},e),e.display.scrollbars.addClass&&be(e.display.wrapper,e.display.scrollbars.addClass)}var Ud=0;function Pr(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:++Ud,markArrays:null},xd(e.curOp)}function qr(e){var t=e.curOp;t&&Cd(t,function(i){for(var r=0;r<i.ops.length;r++)i.ops[r].cm.curOp=null;jd(i)})}function jd(e){for(var t=e.ops,i=0;i<t.length;i++)Gd(t[i]);for(var r=0;r<t.length;r++)Xd(t[r]);for(var n=0;n<t.length;n++)Kd(t[n]);for(var u=0;u<t.length;u++)Yd(t[u]);for(var p=0;p<t.length;p++)Zd(t[p])}function Gd(e){var t=e.cm,i=t.display;Jd(t),e.updateMaxLine&&va(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 Wn(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Xd(e){e.updatedDisplay=e.mustUpdate&&Na(e.cm,e.update)}function Kd(e){var t=e.cm,i=t.display;e.updatedDisplay&&Pn(t),e.barMeasure=Ui(t),i.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ss(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+Qt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,i.sizer.offsetLeft+e.adjustWidthTo-_r(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=i.input.prepareSelection())}function Yd(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Ir(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var i=e.focus&&e.focus==he(te(t));e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,i),(e.updatedDisplay||e.startHeight!=t.doc.height)&&ai(t,e.barMeasure),e.updatedDisplay&&Ha(t,e.barMeasure),e.selectionChanged&&La(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),i&&Ps(e.cm)}function Zd(e){var t=e.cm,i=t.display,r=t.doc;if(e.updatedDisplay&&Xs(t,e.update),i.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(i.wheelStartX=i.wheelStartY=null),e.scrollTop!=null&&Ws(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Ir(t,e.scrollLeft,!0,!0),e.scrollToPos){var n=qd(t,ve(r,e.scrollToPos.from),ve(r,e.scrollToPos.to),e.scrollToPos.margin);Pd(t,n)}var u=e.maybeHiddenMarkers,p=e.maybeUnhiddenMarkers;if(u)for(var g=0;g<u.length;++g)u[g].lines.length||je(u[g],"hide");if(p)for(var m=0;m<p.length;++m)p[m].lines.length&&je(p[m],"unhide");i.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&je(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function St(e,t){if(e.curOp)return t();Pr(e);try{return t()}finally{qr(e)}}function tt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Pr(e);try{return t.apply(e,arguments)}finally{qr(e)}}}function dt(e){return function(){if(this.curOp)return e.apply(this,arguments);Pr(this);try{return e.apply(this,arguments)}finally{qr(this)}}}function rt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Pr(t);try{return e.apply(this,arguments)}finally{qr(t)}}}function Gi(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,mt(Qd,e))}function Qd(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var i=+new Date+e.options.workTime,r=zi(e,t.highlightFrontier),n=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(r.line>=e.display.viewFrom){var p=u.styles,g=u.text.length>e.options.maxHighlightLength?Lr(t.mode,r.state):null,m=$l(e,u,r,!0);g&&(r.state=g),u.styles=m.styles;var b=u.styleClasses,C=m.classes;C?u.styleClasses=C:b&&(u.styleClasses=null);for(var S=!p||p.length!=u.styles.length||b!=C&&(!b||!C||b.bgClass!=C.bgClass||b.textClass!=C.textClass),_=0;!S&&_<p.length;++_)S=p[_]!=u.styles[_];S&&n.push(r.line),u.stateAfter=r.save(),r.nextLine()}else u.text.length<=e.options.maxHighlightLength&&ca(e,u.text,r),u.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>i)return Gi(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),n.length&&St(e,function(){for(var u=0;u<n.length;u++)vr(e,n[u],"text")})}}var Wn=function(e,t,i){var r=e.display;this.viewport=t,this.visible=qn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=_r(e),this.force=i,this.dims=Ea(e),this.events=[]};Wn.prototype.signal=function(e,t){Ot(e,t)&&this.events.push(arguments)},Wn.prototype.finish=function(){for(var e=0;e<this.events.length;e++)je.apply(null,this.events[e])};function Jd(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Qt(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Qt(e)+"px",t.scrollbarsClipped=!0)}function Vd(e){if(e.hasFocus())return null;var t=he(te(e));if(!t||!Q(e.display.lineDiv,t))return null;var i={activeElt:t};if(window.getSelection){var r=xe(e).getSelection();r.anchorNode&&r.extend&&Q(e.display.lineDiv,r.anchorNode)&&(i.anchorNode=r.anchorNode,i.anchorOffset=r.anchorOffset,i.focusNode=r.focusNode,i.focusOffset=r.focusOffset)}return i}function $d(e){if(!(!e||!e.activeElt||e.activeElt==he(Ce(e.activeElt)))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&Q(document.body,e.anchorNode)&&Q(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 Na(e,t){var i=e.display,r=e.doc;if(t.editorIsHidden)return br(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&&Is(e)==0)return!1;Ys(e)&&(br(e),t.dims=Ea(e));var n=r.first+r.size,u=Math.max(t.visible.from-e.options.viewportMargin,r.first),p=Math.min(n,t.visible.to+e.options.viewportMargin);i.viewFrom<u&&u-i.viewFrom<20&&(u=Math.max(r.first,i.viewFrom)),i.viewTo>p&&i.viewTo-p<20&&(p=Math.min(n,i.viewTo)),rr&&(u=ga(e.doc,u),p=hs(e.doc,p));var g=u!=i.viewFrom||p!=i.viewTo||i.lastWrapHeight!=t.wrapperHeight||i.lastWrapWidth!=t.wrapperWidth;Id(e,u,p),i.viewOffset=ir(ae(e.doc,i.viewFrom)),e.display.mover.style.top=i.viewOffset+"px";var m=Is(e);if(!g&&m==0&&!t.force&&i.renderedView==i.view&&(i.updateLineNumbers==null||i.updateLineNumbers>=i.viewTo))return!1;var b=Vd(e);return m>4&&(i.lineDiv.style.display="none"),eh(e,i.updateLineNumbers,t.dims),m>4&&(i.lineDiv.style.display=""),i.renderedView=i.view,$d(b),H(i.cursorDiv),H(i.selectionDiv),i.gutters.style.height=i.sizer.style.minHeight=0,g&&(i.lastWrapHeight=t.wrapperHeight,i.lastWrapWidth=t.wrapperWidth,Gi(e,400)),i.updateLineNumbers=null,!0}function Xs(e,t){for(var i=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==_r(e)){if(i&&i.top!=null&&(i={top:Math.min(e.doc.height+ya(e.display)-xa(e),i.top)}),t.visible=qn(e.display,e.doc,i),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=qn(e.display,e.doc,i));if(!Na(e,t))break;Pn(e);var n=Ui(e);qi(e),ai(e,n),Ha(e,n),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 Oa(e,t){var i=new Wn(e,t);if(Na(e,i)){Pn(e),Xs(e,i);var r=Ui(e);qi(e),ai(e,r),Ha(e,r),i.finish()}}function eh(e,t,i){var r=e.display,n=e.options.lineNumbers,u=r.lineDiv,p=u.firstChild;function g(P){var U=P.nextSibling;return v&&O&&e.display.currentWheelTarget==P?P.style.display="none":P.parentNode.removeChild(P),U}for(var m=r.view,b=r.viewFrom,C=0;C<m.length;C++){var S=m[C];if(!S.hidden)if(!S.node||S.node.parentNode!=u){var _=Ad(e,S,b,i);u.insertBefore(_,p)}else{for(;p!=S.node;)p=g(p);var M=n&&t!=null&&t<=b&&S.lineNumber;S.changes&&(ze(S.changes,"gutter")>-1&&(M=!1),bs(e,S,b,i)),M&&(H(S.lineNumber),S.lineNumber.appendChild(document.createTextNode(sa(e.options,b)))),p=S.node.nextSibling}b+=S.size}for(;p;)p=g(p)}function Ia(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",et(e,"gutterChanged",e)}function Ha(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+Qt(e)+"px"}function Ks(e){var t=e.display,i=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Aa(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,u=r+"px",p=0;p<i.length;p++)if(!i[p].hidden){e.options.fixedGutter&&(i[p].gutter&&(i[p].gutter.style.left=u),i[p].gutterBackground&&(i[p].gutterBackground.style.left=u));var g=i[p].alignable;if(g)for(var m=0;m<g.length;m++)g[m].style.left=u}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}}function Ys(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=sa(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(E("div",[E("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),u=n.firstChild.offsetWidth,p=n.offsetWidth-u;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(u,r.lineGutter.offsetWidth-p)+1,r.lineNumWidth=r.lineNumInnerWidth+p,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ia(e.display),!0}return!1}function Pa(e,t){for(var i=[],r=!1,n=0;n<e.length;n++){var u=e[n],p=null;if(typeof u!="string"&&(p=u.style,u=u.className),u=="CodeMirror-linenumbers")if(t)r=!0;else continue;i.push({className:u,style:p})}return t&&!r&&i.push({className:"CodeMirror-linenumbers",style:null}),i}function Zs(e){var t=e.gutters,i=e.gutterSpecs;H(t),e.lineGutter=null;for(var r=0;r<i.length;++r){var n=i[r],u=n.className,p=n.style,g=t.appendChild(E("div",null,"CodeMirror-gutter "+u));p&&(g.style.cssText=p),u=="CodeMirror-linenumbers"&&(e.lineGutter=g,g.style.width=(e.lineNumWidth||1)+"px")}t.style.display=i.length?"":"none",Ia(e)}function Xi(e){Zs(e.display),yt(e),Ks(e)}function th(e,t,i,r){var n=this;this.input=i,n.scrollbarFiller=E("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=E("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=q("div",null,"CodeMirror-code"),n.selectionDiv=E("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=E("div",null,"CodeMirror-cursors"),n.measure=E("div",null,"CodeMirror-measure"),n.lineMeasure=E("div",null,"CodeMirror-measure"),n.lineSpace=q("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var u=q("div",[n.lineSpace],"CodeMirror-lines");n.mover=E("div",[u],null,"position: relative"),n.sizer=E("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=E("div",null,null,"position: absolute; height: "+Pe+"px; width: 1px;"),n.gutters=E("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=E("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=E("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),x&&D===105&&(n.wrapper.style.clipPath="inset(0px)"),n.wrapper.setAttribute("translate","no"),c&&d<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),!v&&!(s&&z)&&(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,n.gutterSpecs=Pa(r.gutters,r.lineNumbers),Zs(n),i.init(n)}var Un=0,or=null;c?or=-.53:s?or=15:x?or=-.7:F&&(or=-1/3);function Qs(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 rh(e){var t=Qs(e);return t.x*=or,t.y*=or,t}function Js(e,t){x&&D==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=Qs(t),r=i.x,n=i.y,u=or;t.deltaMode===0&&(r=t.deltaX,n=t.deltaY,u=1);var p=e.display,g=p.scroller,m=g.scrollWidth>g.clientWidth,b=g.scrollHeight>g.clientHeight;if(r&&m||n&&b){if(n&&O&&v){e:for(var C=t.target,S=p.view;C!=g;C=C.parentNode)for(var _=0;_<S.length;_++)if(S[_].node==C){e.display.currentWheelTarget=C;break e}}if(r&&!s&&!k&&u!=null){n&&b&&Wi(e,Math.max(0,g.scrollTop+n*u)),Ir(e,Math.max(0,g.scrollLeft+r*u)),(!n||n&&b)&&bt(t),p.wheelStartX=null;return}if(n&&u!=null){var M=n*u,P=e.doc.scrollTop,U=P+p.wrapper.clientHeight;M<0?P=Math.max(0,P+M-50):U=Math.min(e.doc.height,U+M+50),Oa(e,{top:P,bottom:U})}Un<20&&t.deltaMode!==0&&(p.wheelStartX==null?(p.wheelStartX=g.scrollLeft,p.wheelStartY=g.scrollTop,p.wheelDX=r,p.wheelDY=n,setTimeout(function(){if(p.wheelStartX!=null){var Z=g.scrollLeft-p.wheelStartX,J=g.scrollTop-p.wheelStartY,ee=J&&p.wheelDY&&J/p.wheelDY||Z&&p.wheelDX&&Z/p.wheelDX;p.wheelStartX=p.wheelStartY=null,ee&&(or=(or*Un+ee)/(Un+1),++Un)}},200)):(p.wheelDX+=r,p.wheelDY+=n))}}var Bt=function(e,t){this.ranges=e,this.primIndex=t};Bt.prototype.primary=function(){return this.ranges[this.primIndex]},Bt.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(!ua(i.anchor,r.anchor)||!ua(i.head,r.head))return!1}return!0},Bt.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Ae(fa(this.ranges[t].anchor),fa(this.ranges[t].head));return new Bt(e,this.primIndex)},Bt.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Bt.prototype.contains=function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(me(t,r.from())>=0&&me(e,r.to())<=0)return i}return-1};var Ae=function(e,t){this.anchor=e,this.head=t};Ae.prototype.from=function(){return En(this.anchor,this.head)},Ae.prototype.to=function(){return Sn(this.anchor,this.head)},Ae.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function Wt(e,t,i){var r=e&&e.options.selectionsMayTouch,n=t[i];t.sort(function(_,M){return me(_.from(),M.from())}),i=ze(t,n);for(var u=1;u<t.length;u++){var p=t[u],g=t[u-1],m=me(g.to(),p.from());if(r&&!p.empty()?m>0:m>=0){var b=En(g.from(),p.from()),C=Sn(g.to(),p.to()),S=g.empty()?p.from()==p.head:g.from()==g.head;u<=i&&--i,t.splice(--u,2,new Ae(S?C:b,S?b:C))}}return new Bt(t,i)}function yr(e,t){return new Bt([new Ae(e,t||e)],0)}function xr(e){return e.text?K(e.from.line+e.text.length-1,De(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function Vs(e,t){if(me(e,t.from)<0)return e;if(me(e,t.to)<=0)return xr(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+=xr(t).ch-t.to.ch),K(i,r)}function qa(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new Ae(Vs(n.anchor,t),Vs(n.head,t)))}return Wt(e.cm,i,e.sel.primIndex)}function $s(e,t,i){return e.line==t.line?K(i.line,e.ch-t.ch+i.ch):K(i.line+(e.line-t.line),e.ch)}function ih(e,t,i){for(var r=[],n=K(e.first,0),u=n,p=0;p<t.length;p++){var g=t[p],m=$s(g.from,n,u),b=$s(xr(g),n,u);if(n=g.to,u=b,i=="around"){var C=e.sel.ranges[p],S=me(C.head,C.anchor)<0;r[p]=new Ae(S?b:m,S?m:b)}else r[p]=new Ae(m,m)}return new Bt(r,e.sel.primIndex)}function Ra(e){e.doc.mode=oa(e.options,e.doc.modeOption),Ki(e)}function Ki(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,Gi(e,100),e.state.modeGen++,e.curOp&&yt(e)}function eu(e,t){return t.from.ch==0&&t.to.ch==0&&De(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Wa(e,t,i,r){function n(ee){return i?i[ee]:null}function u(ee,V,ie){cd(ee,V,ie,r),et(ee,"change",ee,t)}function p(ee,V){for(var ie=[],se=ee;se<V;++se)ie.push(new $r(b[se],n(se),r));return ie}var g=t.from,m=t.to,b=t.text,C=ae(e,g.line),S=ae(e,m.line),_=De(b),M=n(b.length-1),P=m.line-g.line;if(t.full)e.insert(0,p(0,b.length)),e.remove(b.length,e.size-b.length);else if(eu(e,t)){var U=p(0,b.length-1);u(S,S.text,M),P&&e.remove(g.line,P),U.length&&e.insert(g.line,U)}else if(C==S)if(b.length==1)u(C,C.text.slice(0,g.ch)+_+C.text.slice(m.ch),M);else{var Z=p(1,b.length-1);Z.push(new $r(_+C.text.slice(m.ch),M,r)),u(C,C.text.slice(0,g.ch)+b[0],n(0)),e.insert(g.line+1,Z)}else if(b.length==1)u(C,C.text.slice(0,g.ch)+b[0]+S.text.slice(m.ch),n(0)),e.remove(g.line+1,P);else{u(C,C.text.slice(0,g.ch)+b[0],n(0)),u(S,_+S.text.slice(m.ch),M);var J=p(1,b.length-1);P>1&&e.remove(g.line+1,P-1),e.insert(g.line+1,J)}et(e,"change",e,t)}function wr(e,t,i){function r(n,u,p){if(n.linked)for(var g=0;g<n.linked.length;++g){var m=n.linked[g];if(m.doc!=u){var b=p&&m.sharedHist;i&&!b||(t(m.doc,b),r(m.doc,n,b))}}}r(e,null,!0)}function tu(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Fa(e),Ra(e),ru(e),e.options.direction=t.direction,e.options.lineWrapping||va(e),e.options.mode=t.modeOption,yt(e)}function ru(e){(e.doc.direction=="rtl"?be:oe)(e.display.lineDiv,"CodeMirror-rtl")}function nh(e){St(e,function(){ru(e),yt(e)})}function jn(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 Ua(e,t){var i={from:fa(t.from),to:xr(t),text:Mr(e,t.from,t.to)};return ou(e,i,t.from.line,t.to.line+1),wr(e,function(r){return ou(r,i,t.from.line,t.to.line+1)},!0),i}function iu(e){for(;e.length;){var t=De(e);if(t.ranges)e.pop();else break}}function oh(e,t){if(t)return iu(e.done),De(e.done);if(e.done.length&&!De(e.done).ranges)return De(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),De(e.done)}function nu(e,t,i,r){var n=e.history;n.undone.length=0;var u=+new Date,p,g;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&n.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(p=oh(n,n.lastOp==r)))g=De(p.changes),me(t.from,t.to)==0&&me(t.from,g.to)==0?g.to=xr(t):p.changes.push(Ua(e,t));else{var m=De(n.done);for((!m||!m.ranges)&&Gn(e.sel,n.done),p={changes:[Ua(e,t)],generation:n.generation},n.done.push(p);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=u,n.lastOp=n.lastSelOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,g||je(e,"historyAdded")}function ah(e,t,i,r){var n=t.charAt(0);return n=="*"||n=="+"&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function lh(e,t,i,r){var n=e.history,u=r&&r.origin;i==n.lastSelOp||u&&n.lastSelOrigin==u&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==u||ah(e,u,De(n.done),t))?n.done[n.done.length-1]=t:Gn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=u,n.lastSelOp=i,r&&r.clearRedo!==!1&&iu(n.undone)}function Gn(e,t){var i=De(t);i&&i.ranges&&i.equals(e)||t.push(e)}function ou(e,t,i,r){var n=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(p){p.markedSpans&&((n||(n=t["spans_"+e.id]={}))[u]=p.markedSpans),++u})}function sh(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 uh(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=[],n=0;n<t.text.length;++n)r.push(sh(i[n]));return r}function au(e,t){var i=uh(e,t),r=ha(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var u=i[n],p=r[n];if(u&&p)e:for(var g=0;g<p.length;++g){for(var m=p[g],b=0;b<u.length;++b)if(u[b].marker==m.marker)continue e;u.push(m)}else p&&(i[n]=p)}return i}function li(e,t,i){for(var r=[],n=0;n<e.length;++n){var u=e[n];if(u.ranges){r.push(i?Bt.prototype.deepCopy.call(u):u);continue}var p=u.changes,g=[];r.push({changes:g});for(var m=0;m<p.length;++m){var b=p[m],C=void 0;if(g.push({from:b.from,to:b.to,text:b.text}),t)for(var S in b)(C=S.match(/^spans_(\d+)$/))&&ze(t,Number(C[1]))>-1&&(De(g)[S]=b[S],delete b[S])}}return r}function ja(e,t,i,r){if(r){var n=e.anchor;if(i){var u=me(t,n)<0;u!=me(i,n)<0?(n=t,t=i):u!=me(t,i)<0&&(t=i)}return new Ae(n,t)}else return new Ae(i||t,t)}function Xn(e,t,i,r,n){n==null&&(n=e.cm&&(e.cm.display.shift||e.extend)),lt(e,new Bt([ja(e.sel.primary(),t,i,n)],0),r)}function lu(e,t,i){for(var r=[],n=e.cm&&(e.cm.display.shift||e.extend),u=0;u<e.sel.ranges.length;u++)r[u]=ja(e.sel.ranges[u],t[u],null,n);var p=Wt(e.cm,r,e.sel.primIndex);lt(e,p,i)}function Ga(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,lt(e,Wt(e.cm,n,e.sel.primIndex),r)}function su(e,t,i,r){lt(e,yr(t,i),r)}function fh(e,t,i){var r={ranges:t.ranges,update:function(n){this.ranges=[];for(var u=0;u<n.length;u++)this.ranges[u]=new Ae(ve(e,n[u].anchor),ve(e,n[u].head))},origin:i&&i.origin};return je(e,"beforeSelectionChange",e,r),e.cm&&je(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Wt(e.cm,r.ranges,r.ranges.length-1):t}function uu(e,t,i){var r=e.history.done,n=De(r);n&&n.ranges?(r[r.length-1]=t,Kn(e,t,i)):lt(e,t,i)}function lt(e,t,i){Kn(e,t,i),lh(e,e.sel,e.cm?e.cm.curOp.id:NaN,i)}function Kn(e,t,i){(Ot(e,"beforeSelectionChange")||e.cm&&Ot(e.cm,"beforeSelectionChange"))&&(t=fh(e,t,i));var r=i&&i.bias||(me(t.primary().head,e.sel.primary().head)<0?-1:1);fu(e,du(e,t,r,!0)),!(i&&i.scroll===!1)&&e.cm&&e.cm.getOption("readOnly")!="nocursor"&&oi(e.cm)}function fu(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,Kl(e.cm)),et(e,"cursorActivity",e))}function cu(e){fu(e,du(e,e.sel,null,!1))}function du(e,t,i,r){for(var n,u=0;u<t.ranges.length;u++){var p=t.ranges[u],g=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[u],m=Yn(e,p.anchor,g&&g.anchor,i,r),b=p.head==p.anchor?m:Yn(e,p.head,g&&g.head,i,r);(n||m!=p.anchor||b!=p.head)&&(n||(n=t.ranges.slice(0,u)),n[u]=new Ae(m,b))}return n?Wt(e.cm,n,t.primIndex):t}function si(e,t,i,r,n){var u=ae(e,t.line);if(u.markedSpans)for(var p=0;p<u.markedSpans.length;++p){var g=u.markedSpans[p],m=g.marker,b="selectLeft"in m?!m.selectLeft:m.inclusiveLeft,C="selectRight"in m?!m.selectRight:m.inclusiveRight;if((g.from==null||(b?g.from<=t.ch:g.from<t.ch))&&(g.to==null||(C?g.to>=t.ch:g.to>t.ch))){if(n&&(je(m,"beforeCursorEnter"),m.explicitlyCleared))if(u.markedSpans){--p;continue}else break;if(!m.atomic)continue;if(i){var S=m.find(r<0?1:-1),_=void 0;if((r<0?C:b)&&(S=hu(e,S,-r,S&&S.line==t.line?u:null)),S&&S.line==t.line&&(_=me(S,i))&&(r<0?_<0:_>0))return si(e,S,t,r,n)}var M=m.find(r<0?-1:1);return(r<0?b:C)&&(M=hu(e,M,r,M.line==t.line?u:null)),M?si(e,M,t,r,n):null}}return t}function Yn(e,t,i,r,n){var u=r||1,p=si(e,t,i,u,n)||!n&&si(e,t,i,u,!0)||si(e,t,i,-u,n)||!n&&si(e,t,i,-u,!0);return p||(e.cantEdit=!0,K(e.first,0))}function hu(e,t,i,r){return i<0&&t.ch==0?t.line>e.first?ve(e,K(t.line-1)):null:i>0&&t.ch==(r||ae(e,t.line)).text.length?t.line<e.first+e.size-1?K(t.line+1,0):null:new K(t.line,t.ch+i)}function pu(e){e.setSelection(K(e.firstLine(),0),K(e.lastLine()),vt)}function gu(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(n,u,p,g){n&&(r.from=ve(e,n)),u&&(r.to=ve(e,u)),p&&(r.text=p),g!==void 0&&(r.origin=g)}),je(e,"beforeChange",e,r),e.cm&&je(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 ui(e,t,i){if(e.cm){if(!e.cm.curOp)return tt(e.cm,ui)(e,t,i);if(e.cm.state.suppressEdits)return}if(!((Ot(e,"beforeChange")||e.cm&&Ot(e.cm,"beforeChange"))&&(t=gu(e,t,!0),!t))){var r=as&&!i&&ld(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)mu(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text,origin:t.origin});else mu(e,t)}}function mu(e,t){if(!(t.text.length==1&&t.text[0]==""&&me(t.from,t.to)==0)){var i=qa(e,t);nu(e,t,i,e.cm?e.cm.curOp.id:NaN),Yi(e,t,i,ha(e,t));var r=[];wr(e,function(n,u){!u&&ze(r,n.history)==-1&&(xu(n.history,t),r.push(n.history)),Yi(n,t,null,ha(n,t))})}}function Zn(e,t,i){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!i)){for(var n=e.history,u,p=e.sel,g=t=="undo"?n.done:n.undone,m=t=="undo"?n.undone:n.done,b=0;b<g.length&&(u=g[b],!(i?u.ranges&&!u.equals(e.sel):!u.ranges));b++);if(b!=g.length){for(n.lastOrigin=n.lastSelOrigin=null;;)if(u=g.pop(),u.ranges){if(Gn(u,m),i&&!u.equals(e.sel)){lt(e,u,{clearRedo:!1});return}p=u}else if(r){g.push(u);return}else break;var C=[];Gn(p,m),m.push({changes:C,generation:n.generation}),n.generation=u.generation||++n.maxGeneration;for(var S=Ot(e,"beforeChange")||e.cm&&Ot(e.cm,"beforeChange"),_=function(U){var Z=u.changes[U];if(Z.origin=t,S&&!gu(e,Z,!1))return g.length=0,{};C.push(Ua(e,Z));var J=U?qa(e,Z):De(g);Yi(e,Z,J,au(e,Z)),!U&&e.cm&&e.cm.scrollIntoView({from:Z.from,to:xr(Z)});var ee=[];wr(e,function(V,ie){!ie&&ze(ee,V.history)==-1&&(xu(V.history,Z),ee.push(V.history)),Yi(V,Z,null,au(V,Z))})},M=u.changes.length-1;M>=0;--M){var P=_(M);if(P)return P.v}}}}function vu(e,t){if(t!=0&&(e.first+=t,e.sel=new Bt(Pt(e.sel.ranges,function(n){return new Ae(K(n.anchor.line+t,n.anchor.ch),K(n.head.line+t,n.head.ch))}),e.sel.primIndex),e.cm)){yt(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)vr(e.cm,r,"gutter")}}function Yi(e,t,i,r){if(e.cm&&!e.cm.curOp)return tt(e.cm,Yi)(e,t,i,r);if(t.to.line<e.first){vu(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 n=t.text.length-1-(e.first-t.from.line);vu(e,n),t={from:K(e.first,0),to:K(t.to.line+n,t.to.ch),text:[De(t.text)],origin:t.origin}}var u=e.lastLine();t.to.line>u&&(t={from:t.from,to:K(u,ae(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),i||(i=qa(e,t)),e.cm?ch(e.cm,t,r):Wa(e,t,r),Kn(e,i,vt),e.cantEdit&&Yn(e,K(e.firstLine(),0))&&(e.cantEdit=!1)}}function ch(e,t,i){var r=e.doc,n=e.display,u=t.from,p=t.to,g=!1,m=u.line;e.options.lineWrapping||(m=Fe(qt(ae(r,u.line))),r.iter(m,p.line+1,function(M){if(M==n.maxLine)return g=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Kl(e),Wa(r,t,i,Os(e)),e.options.lineWrapping||(r.iter(m,u.line+t.text.length,function(M){var P=Bn(M);P>n.maxLineLength&&(n.maxLine=M,n.maxLineLength=P,n.maxLineChanged=!0,g=!1)}),g&&(e.curOp.updateMaxLine=!0)),ed(r,u.line),Gi(e,400);var b=t.text.length-(p.line-u.line)-1;t.full?yt(e):u.line==p.line&&t.text.length==1&&!eu(e.doc,t)?vr(e,u.line,"text"):yt(e,u.line,p.line+1,b);var C=Ot(e,"changes"),S=Ot(e,"change");if(S||C){var _={from:u,to:p,text:t.text,removed:t.removed,origin:t.origin};S&&et(e,"change",e,_),C&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(_)}e.display.selForContextMenu=null}function fi(e,t,i,r,n){var u;r||(r=i),me(r,i)<0&&(u=[r,i],i=u[0],r=u[1]),typeof t=="string"&&(t=e.splitLines(t)),ui(e,{from:i,to:r,text:t,origin:n})}function bu(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function yu(e,t,i,r){for(var n=0;n<e.length;++n){var u=e[n],p=!0;if(u.ranges){u.copied||(u=e[n]=u.deepCopy(),u.copied=!0);for(var g=0;g<u.ranges.length;g++)bu(u.ranges[g].anchor,t,i,r),bu(u.ranges[g].head,t,i,r);continue}for(var m=0;m<u.changes.length;++m){var b=u.changes[m];if(i<b.from.line)b.from=K(b.from.line+r,b.from.ch),b.to=K(b.to.line+r,b.to.ch);else if(t<=b.to.line){p=!1;break}}p||(e.splice(0,n+1),n=0)}}function xu(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;yu(e.done,i,r,n),yu(e.undone,i,r,n)}function Zi(e,t,i,r){var n=t,u=t;return typeof t=="number"?u=ae(e,Jl(e,t)):n=Fe(t),n==null?null:(r(u,n)&&e.cm&&vr(e.cm,n,i),u)}function Qi(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}Qi.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;i<r;++i){var n=this.lines[i];this.height-=n.height,dd(n),et(n,"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 Ji(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var n=e[r];t+=n.chunkSize(),i+=n.height,n.parent=this}this.size=t,this.height=i,this.parent=null}Ji.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],n=r.chunkSize();if(e<n){var u=Math.min(t,n-e),p=r.height;if(r.removeInner(e,u),this.height-=p-r.height,n==u&&(this.children.splice(i--,1),r.parent=null),(t-=u)==0)break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Qi))){var g=[];this.collapse(g),this.children=[new Qi(g)],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 n=this.children[r],u=n.chunkSize();if(e<=u){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(var p=n.lines.length%25+25,g=p;g<n.lines.length;){var m=new Qi(n.lines.slice(g,g+=25));n.height-=m.height,this.children.splice(++r,0,m),m.parent=this}n.lines=n.lines.slice(0,p),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 Ji(t);if(e.parent){e.size-=i.size,e.height-=i.height;var n=ze(e.parent.children,e);e.parent.children.splice(n+1,0,i)}else{var r=new Ji(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 n=this.children[r],u=n.chunkSize();if(e<u){var p=Math.min(t,u-e);if(n.iterN(e,p,i))return!0;if((t-=p)==0)break;e=0}else e-=u}}};var Vi=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.doc=e,this.node=t};Vi.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,i=this.line,r=Fe(i);if(!(r==null||!t)){for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var u=Hi(this);Yt(i,Math.max(0,i.height-u)),e&&(St(e,function(){wu(e,i,-u),vr(e,r,"widget")}),et(e,"lineWidgetCleared",e,this,r))}},Vi.prototype.changed=function(){var e=this,t=this.height,i=this.doc.cm,r=this.line;this.height=null;var n=Hi(this)-t;n&&(mr(this.doc,r)||Yt(r,r.height+n),i&&St(i,function(){i.curOp.forceUpdate=!0,wu(i,r,n),et(i,"lineWidgetChanged",i,e,Fe(r))}))},Qr(Vi);function wu(e,t,i){ir(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&za(e,i)}function dh(e,t,i,r){var n=new Vi(e,i,r),u=e.cm;return u&&n.noHScroll&&(u.display.alignWidgets=!0),Zi(e,t,"widget",function(p){var g=p.widgets||(p.widgets=[]);if(n.insertAt==null?g.push(n):g.splice(Math.min(g.length,Math.max(0,n.insertAt)),0,n),n.line=p,u&&!mr(e,p)){var m=ir(p)<e.scrollTop;Yt(p,p.height+Hi(n)),m&&za(u,n.height),u.curOp.forceUpdate=!0}return!0}),u&&et(u,"lineWidgetAdded",u,n,typeof t=="number"?t:Fe(t)),n}var Cu=0,Cr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Cu};Cr.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Pr(e),Ot(this,"clear")){var i=this.find();i&&et(this,"clear",i.from,i.to)}for(var r=null,n=null,u=0;u<this.lines.length;++u){var p=this.lines[u],g=Ni(p.markedSpans,this);e&&!this.collapsed?vr(e,Fe(p),"text"):e&&(g.to!=null&&(n=Fe(p)),g.from!=null&&(r=Fe(p))),p.markedSpans=id(p.markedSpans,g),g.from==null&&this.collapsed&&!mr(this.doc,p)&&e&&Yt(p,ri(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var m=0;m<this.lines.length;++m){var b=qt(this.lines[m]),C=Bn(b);C>e.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=C,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&yt(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&cu(e.doc)),e&&et(e,"markerCleared",e,this,r,n),t&&qr(e),this.parent&&this.parent.clear()}},Cr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var u=this.lines[n],p=Ni(u.markedSpans,this);if(p.from!=null&&(i=K(t?u:Fe(u),p.from),e==-1))return i;if(p.to!=null&&(r=K(t?u:Fe(u),p.to),e==1))return r}return i&&{from:i,to:r}},Cr.prototype.changed=function(){var e=this,t=this.find(-1,!0),i=this,r=this.doc.cm;!t||!r||St(r,function(){var n=t.line,u=Fe(t.line),p=wa(r,u);if(p&&(Fs(p),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!mr(i.doc,n)&&i.height!=null){var g=i.height;i.height=null;var m=Hi(i)-g;m&&Yt(n,n.height+m)}et(r,"markerChanged",r,e)})},Cr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||ze(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Cr.prototype.detachLine=function(e){if(this.lines.splice(ze(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Qr(Cr);function ci(e,t,i,r,n){if(r&&r.shared)return hh(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return tt(e.cm,ci)(e,t,i,r,n);var u=new Cr(e,n),p=me(t,i);if(r&&Lt(r,u,!1),p>0||p==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=q("span",[u.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||u.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(u.widgetNode.insertLeft=!0)),u.collapsed){if(ds(e,t.line,t,i,u)||t.line!=i.line&&ds(e,i.line,t,i,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");rd()}u.addToHistory&&nu(e,{from:t,to:i,origin:"markText"},e.sel,NaN);var g=t.line,m=e.cm,b;if(e.iter(g,i.line+1,function(S){m&&u.collapsed&&!m.options.lineWrapping&&qt(S)==m.display.maxLine&&(b=!0),u.collapsed&&g!=t.line&&Yt(S,0),nd(S,new Fn(u,g==t.line?t.ch:null,g==i.line?i.ch:null),e.cm&&e.cm.curOp),++g}),u.collapsed&&e.iter(t.line,i.line+1,function(S){mr(e,S)&&Yt(S,0)}),u.clearOnEnter&&ue(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(td(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++Cu,u.atomic=!0),m){if(b&&(m.curOp.updateMaxLine=!0),u.collapsed)yt(m,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++)vr(m,C,"text");u.atomic&&cu(m.doc),et(m,"markerAdded",m,u)}return u}var $i=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};$i.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();et(this,"clear")}},$i.prototype.find=function(e,t){return this.primary.find(e,t)},Qr($i);function hh(e,t,i,r,n){r=Lt(r),r.shared=!1;var u=[ci(e,t,i,r,n)],p=u[0],g=r.widgetNode;return wr(e,function(m){g&&(r.widgetNode=g.cloneNode(!0)),u.push(ci(m,ve(m,t),ve(m,i),r,n));for(var b=0;b<m.linked.length;++b)if(m.linked[b].isParent)return;p=De(u)}),new $i(u,p)}function Du(e){return e.findMarks(K(e.first,0),e.clipPos(K(e.lastLine())),function(t){return t.parent})}function ph(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),u=e.clipPos(n.from),p=e.clipPos(n.to);if(me(u,p)){var g=ci(e,u,p,r.primary,r.primary.type);r.markers.push(g),g.parent=r}}}function gh(e){for(var t=function(r){var n=e[r],u=[n.primary.doc];wr(n.primary.doc,function(m){return u.push(m)});for(var p=0;p<n.markers.length;p++){var g=n.markers[p];ze(u,g.doc)==-1&&(g.parent=null,n.markers.splice(p--,1))}},i=0;i<e.length;i++)t(i)}var mh=0,xt=function(e,t,i,r,n){if(!(this instanceof xt))return new xt(e,t,i,r,n);i==null&&(i=0),Ji.call(this,[new Qi([new $r("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=i;var u=K(i,0);this.sel=yr(u),this.history=new jn(null),this.id=++mh,this.modeOption=t,this.lineSep=r,this.direction=n=="rtl"?"rtl":"ltr",this.extend=!1,typeof e=="string"&&(e=this.splitLines(e)),Wa(this,{from:u,to:u,text:e}),lt(this,yr(u),vt)};xt.prototype=Ul(Ji.prototype,{constructor:xt,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=la(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:rt(function(e){var t=K(this.first,0),i=this.first+this.size-1;ui(this,{from:t,to:K(i,ae(this,i).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Ri(this.cm,0,0),lt(this,yr(t),vt)}),replaceRange:function(e,t,i,r){t=ve(this,t),i=i?ve(this,i):t,fi(this,e,t,i,r)},getRange:function(e,t,i){var r=Mr(this,ve(this,e),ve(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(_i(this,e))return ae(this,e)},getLineNumber:function(e){return Fe(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=ae(this,e)),qt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ve(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:rt(function(e,t,i){su(this,ve(this,typeof e=="number"?K(e,t||0):e),null,i)}),setSelection:rt(function(e,t,i){su(this,ve(this,e),ve(this,t||e),i)}),extendSelection:rt(function(e,t,i){Xn(this,ve(this,e),t&&ve(this,t),i)}),extendSelections:rt(function(e,t){lu(this,Vl(this,e),t)}),extendSelectionsBy:rt(function(e,t){var i=Pt(this.sel.ranges,e);lu(this,Vl(this,i),t)}),setSelections:rt(function(e,t,i){if(e.length){for(var r=[],n=0;n<e.length;n++)r[n]=new Ae(ve(this,e[n].anchor),ve(this,e[n].head||e[n].anchor));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),lt(this,Wt(this.cm,r,t),i)}}),addSelection:rt(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new Ae(ve(this,e),ve(this,t||e))),lt(this,Wt(this.cm,r,r.length-1),i)}),getSelection:function(e){for(var t=this.sel.ranges,i,r=0;r<t.length;r++){var n=Mr(this,t[r].from(),t[r].to());i=i?i.concat(n):n}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 n=Mr(this,i[r].from(),i[r].to());e!==!1&&(n=n.join(e||this.lineSeparator())),t[r]=n}return t},replaceSelection:function(e,t,i){for(var r=[],n=0;n<this.sel.ranges.length;n++)r[n]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:rt(function(e,t,i){for(var r=[],n=this.sel,u=0;u<n.ranges.length;u++){var p=n.ranges[u];r[u]={from:p.from(),to:p.to(),text:this.splitLines(e[u]),origin:i}}for(var g=t&&t!="end"&&ih(this,r,t),m=r.length-1;m>=0;m--)ui(this,r[m]);g?uu(this,g):this.cm&&oi(this.cm)}),undo:rt(function(){Zn(this,"undo")}),redo:rt(function(){Zn(this,"redo")}),undoSelection:rt(function(){Zn(this,"undo",!0)}),redoSelection:rt(function(){Zn(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 n=0;n<e.undone.length;n++)e.undone[n].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){var e=this;this.history=new jn(this.history),wr(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:li(this.history.done),undone:li(this.history.undone)}},setHistory:function(e){var t=this.history=new jn(this.history);t.done=li(e.done.slice(0),null,!0),t.undone=li(e.undone.slice(0),null,!0)},setGutterMarker:rt(function(e,t,i){return Zi(this,e,"gutter",function(r){var n=r.gutterMarkers||(r.gutterMarkers={});return n[t]=i,!i&&jl(n)&&(r.gutterMarkers=null),!0})}),clearGutter:rt(function(e){var t=this;this.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&Zi(t,i,"gutter",function(){return i.gutterMarkers[e]=null,jl(i.gutterMarkers)&&(i.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!_i(this,e)||(t=e,e=ae(this,e),!e))return null}else if(t=Fe(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:rt(function(e,t,i){return Zi(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[n])r[n]=i;else{if(j(i).test(r[n]))return!1;r[n]+=" "+i}return!0})}),removeLineClass:rt(function(e,t,i){return Zi(this,e,t=="gutter"?"gutter":"class",function(r){var n=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",u=r[n];if(u)if(i==null)r[n]=null;else{var p=u.match(j(i));if(!p)return!1;var g=p.index+p[0].length;r[n]=u.slice(0,p.index)+(!p.index||g==u.length?"":" ")+u.slice(g)||null}else return!1;return!0})}),addLineWidget:rt(function(e,t,i){return dh(this,e,t,i)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,i){return ci(this,ve(this,e),ve(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=ve(this,e),ci(this,e,e,i,"bookmark")},findMarksAt:function(e){e=ve(this,e);var t=[],i=ae(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(n.from==null||n.from<=e.ch)&&(n.to==null||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=ve(this,e),t=ve(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(u){var p=u.markedSpans;if(p)for(var g=0;g<p.length;g++){var m=p[g];!(m.to!=null&&n==e.line&&e.ch>=m.to||m.from==null&&n!=e.line||m.from!=null&&n==t.line&&m.from>=t.ch)&&(!i||i(m.marker))&&r.push(m.marker.parent||m.marker)}++n}),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(n){var u=n.text.length+r;if(u>e)return t=e,!0;e-=u,++i}),ve(this,K(i,t))},indexFromPos:function(e){e=ve(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 xt(la(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 xt(la(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}],ph(r,Du(this)),r},unlinkDoc:function(e){if(e instanceof Ne&&(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),gh(Du(this));break}}if(e.history==this.history){var r=[e.id];wr(e,function(n){return r.push(n.id)},!0),e.history=new jn(null),e.history.done=li(this.history.done,r),e.history.undone=li(this.history.undone,r)}},iterLinkedDocs:function(e){wr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ra(e)},lineSeparator:function(){return this.lineSep||`
`},setDirection:rt(function(e){e!="rtl"&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(t){return t.order=null}),this.cm&&nh(this.cm))})}),xt.prototype.eachLine=xt.prototype.iter;var ku=0;function vh(e){var t=this;if(Su(t),!($e(t,e)||nr(t.display,e))){bt(e),c&&(ku=+new Date);var i=Nr(t,e,!0),r=e.dataTransfer.files;if(!(!i||t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File)for(var n=r.length,u=Array(n),p=0,g=function(){++p==n&&tt(t,function(){i=ve(t.doc,i);var M={from:i,to:i,text:t.doc.splitLines(u.filter(function(P){return P!=null}).join(t.doc.lineSeparator())),origin:"paste"};ui(t.doc,M),uu(t.doc,yr(ve(t.doc,i),ve(t.doc,xr(M))))})()},m=function(M,P){if(t.options.allowDropFileTypes&&ze(t.options.allowDropFileTypes,M.type)==-1){g();return}var U=new FileReader;U.onerror=function(){return g()},U.onload=function(){var Z=U.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Z)){g();return}u[P]=Z,g()},U.readAsText(M)},b=0;b<r.length;b++)m(r[b],b);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 S;if(t.state.draggingText&&!t.state.draggingText.copy&&(S=t.listSelections()),Kn(t.doc,yr(i,i)),S)for(var _=0;_<S.length;++_)fi(t.doc,"",S[_].anchor,S[_].head,"drag");t.replaceSelection(C,"around","paste"),t.display.input.focus()}}catch{}}}}function bh(e,t){if(c&&(!e.state.draggingText||+new Date-ku<100)){Bi(t);return}if(!($e(e,t)||nr(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!F)){var i=E("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",k&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),k&&i.parentNode.removeChild(i)}}function yh(e,t){var i=Nr(e,t);if(i){var r=document.createDocumentFragment();Ta(e,i,r),e.display.dragCursor||(e.display.dragCursor=E("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),Y(e.display.dragCursor,r)}}function Su(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Eu(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),i=[],r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&i.push(n)}i.length&&i[0].operation(function(){for(var u=0;u<i.length;u++)e(i[u])})}}var Au=!1;function xh(){Au||(wh(),Au=!0)}function wh(){var e;ue(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Eu(Ch)},100))}),ue(window,"blur",function(){return Eu(ni)})}function Ch(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Dr={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"},en=0;en<10;en++)Dr[en+48]=Dr[en+96]=String(en);for(var Qn=65;Qn<=90;Qn++)Dr[Qn]=String.fromCharCode(Qn);for(var tn=1;tn<=12;tn++)Dr[tn+111]=Dr[tn+63235]="F"+tn;var ar={};ar.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"},ar.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"},ar.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"},ar.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"]},ar.default=O?ar.macDefault:ar.pcDefault;function Dh(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var i,r,n,u,p=0;p<t.length-1;p++){var g=t[p];if(/^(cmd|meta|m)$/i.test(g))u=!0;else if(/^a(lt)?$/i.test(g))i=!0;else if(/^(c|ctrl|control)$/i.test(g))r=!0;else if(/^s(hift)?$/i.test(g))n=!0;else throw new Error("Unrecognized modifier name: "+g)}return i&&(e="Alt-"+e),r&&(e="Ctrl-"+e),u&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function kh(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 n=Pt(i.split(" "),Dh),u=0;u<n.length;u++){var p=void 0,g=void 0;u==n.length-1?(g=n.join(" "),p=r):(g=n.slice(0,u+1).join(" "),p="...");var m=t[g];if(!m)t[g]=p;else if(m!=p)throw new Error("Inconsistent bindings for "+g)}delete e[i]}for(var b in t)e[b]=t[b];return e}function di(e,t,i,r){t=Jn(t);var n=t.call?t.call(e,r):t[e];if(n===!1)return"nothing";if(n==="...")return"multi";if(n!=null&&i(n))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return di(e,t.fallthrough,i,r);for(var u=0;u<t.fallthrough.length;u++){var p=di(e,t.fallthrough[u],i,r);if(p)return p}}}function Fu(e){var t=typeof e=="string"?e:Dr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Tu(e,t,i){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(X?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(X?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!i&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function Lu(e,t){if(k&&e.keyCode==34&&e.char)return!1;var i=Dr[e.keyCode];return i==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(i=e.code),Tu(i,e,t))}function Jn(e){return typeof e=="string"?ar[e]:e}function hi(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var u=t(i[n]);r.length&&me(u.from,De(r).to)<=0;){var p=r.pop();if(me(p.from,u.from)<0){u.from=p.from;break}}r.push(u)}St(e,function(){for(var g=r.length-1;g>=0;g--)fi(e.doc,"",r[g].from,r[g].to,"+delete");oi(e)})}function Xa(e,t,i){var r=Gl(e.text,t+i,i);return r<0||r>e.text.length?null:r}function Ka(e,t,i){var r=Xa(e,t.ch,i);return r==null?null:new K(t.line,r,i<0?"after":"before")}function Ya(e,t,i,r,n){if(e){t.doc.direction=="rtl"&&(n=-n);var u=tr(i,t.doc.direction);if(u){var p=n<0?De(u):u[0],g=n<0==(p.level==1),m=g?"after":"before",b;if(p.level>0||t.doc.direction=="rtl"){var C=ti(t,i);b=n<0?i.text.length-1:0;var S=Jt(t,C,b).top;b=Ti(function(_){return Jt(t,C,_).top==S},n<0==(p.level==1)?p.from:p.to-1,b),m=="before"&&(b=Xa(i,b,1))}else b=n<0?p.to:p.from;return new K(r,b,m)}}return new K(r,n<0?i.text.length:0,n<0?"before":"after")}function Sh(e,t,i,r){var n=tr(t,e.doc.direction);if(!n)return Ka(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=Mi(n,i.ch,i.sticky),p=n[u];if(e.doc.direction=="ltr"&&p.level%2==0&&(r>0?p.to>i.ch:p.from<i.ch))return Ka(t,i,r);var g=function(J,ee){return Xa(t,J instanceof K?J.ch:J,ee)},m,b=function(J){return e.options.lineWrapping?(m=m||ti(e,t),Ns(e,t,m,J)):{begin:0,end:t.text.length}},C=b(i.sticky=="before"?g(i,-1):i.ch);if(e.doc.direction=="rtl"||p.level==1){var S=p.level==1==r<0,_=g(i,S?1:-1);if(_!=null&&(S?_<=p.to&&_<=C.end:_>=p.from&&_>=C.begin)){var M=S?"before":"after";return new K(i.line,_,M)}}var P=function(J,ee,V){for(var ie=function(Le,it){return it?new K(i.line,g(Le,1),"before"):new K(i.line,Le,"after")};J>=0&&J<n.length;J+=ee){var se=n[J],le=ee>0==(se.level!=1),we=le?V.begin:g(V.end,-1);if(se.from<=we&&we<se.to||(we=le?se.from:g(se.to,-1),V.begin<=we&&we<V.end))return ie(we,le)}},U=P(u+r,r,C);if(U)return U;var Z=r>0?C.end:g(C.begin,-1);return Z!=null&&!(r>0&&Z==t.text.length)&&(U=P(r>0?0:n.length-1,r,b(Z)),U)?U:null}var rn={selectAll:pu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),vt)},killLine:function(e){return hi(e,function(t){if(t.empty()){var i=ae(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:K(t.head.line+1,0)}:{from:t.head,to:K(t.head.line,i)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return hi(e,function(t){return{from:K(t.from().line,0),to:ve(e.doc,K(t.to().line+1,0))}})},delLineLeft:function(e){return hi(e,function(t){return{from:K(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return hi(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 hi(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(K(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(K(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return Mu(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return Bu(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return Eh(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")},Xt)},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")},Xt)},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/)?Bu(e,t.head):r},Xt)},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,n=0;n<i.length;n++){var u=i[n].from(),p=Ye(e.getLine(u.line),u.ch,r);t.push(pr(r-p%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return St(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++)if(t[r].empty()){var n=t[r].head,u=ae(e.doc,n.line).text;if(u){if(n.ch==u.length&&(n=new K(n.line,n.ch-1)),n.ch>0)n=new K(n.line,n.ch+1),e.replaceRange(u.charAt(n.ch-1)+u.charAt(n.ch-2),K(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var p=ae(e.doc,n.line-1).text;p&&(n=new K(n.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+p.charAt(p.length-1),K(n.line-1,p.length-1),n,"+transpose"))}}i.push(new Ae(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){return St(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);oi(e)})},openLine:function(e){return e.replaceSelection(`
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Mu(e,t){var i=ae(e.doc,t),r=qt(i);return r!=i&&(t=Fe(r)),Ya(!0,e,r,t,1)}function Eh(e,t){var i=ae(e.doc,t),r=ud(i);return r!=i&&(t=Fe(r)),Ya(!0,e,i,t,-1)}function Bu(e,t){var i=Mu(e,t.line),r=ae(e.doc,i.line),n=tr(r,e.doc.direction);if(!n||n[0].level==0){var u=Math.max(i.ch,r.text.search(/\S/)),p=t.line==i.line&&t.ch<=u&&t.ch;return K(i.line,p?0:u,i.sticky)}return i}function Vn(e,t,i){if(typeof t=="string"&&(t=rn[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),n=t(e)!=Ze}finally{e.display.shift=r,e.state.suppressEdits=!1}return n}function Ah(e,t,i){for(var r=0;r<e.state.keyMaps.length;r++){var n=di(t,e.state.keyMaps[r],i,e);if(n)return n}return e.options.extraKeys&&di(t,e.options.extraKeys,i,e)||di(t,e.options.keyMap,i,e)}var Fh=new ct;function nn(e,t,i,r){var n=e.state.keySeq;if(n){if(Fu(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Fh.set(50,function(){e.state.keySeq==n&&(e.state.keySeq=null,e.display.input.reset())}),_u(e,n+" "+t,i,r))return!0}return _u(e,t,i,r)}function _u(e,t,i,r){var n=Ah(e,t,r);return n=="multi"&&(e.state.keySeq=t),n=="handled"&&et(e,"keyHandled",e,t,i),(n=="handled"||n=="multi")&&(bt(i),La(e)),!!n}function zu(e,t){var i=Lu(t,!0);return i?t.shiftKey&&!e.state.keySeq?nn(e,"Shift-"+i,t,function(r){return Vn(e,r,!0)})||nn(e,i,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return Vn(e,r)}):nn(e,i,t,function(r){return Vn(e,r)}):!1}function Th(e,t,i){return nn(e,"'"+i+"'",t,function(r){return Vn(e,r,!0)})}var Za=null;function Nu(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=he(te(t)),!$e(t,e))){c&&d<11&&e.keyCode==27&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=i==16||e.shiftKey;var r=zu(t,e);k&&(Za=r?i:null,!r&&i==88&&!Kc&&(O?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),s&&!O&&!r&&i==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),i==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Lh(t)}}function Lh(e){var t=e.display.lineDiv;be(t,"CodeMirror-crosshair");function i(r){(r.keyCode==18||!r.altKey)&&(oe(t,"CodeMirror-crosshair"),Mt(document,"keyup",i),Mt(document,"mouseover",i))}ue(document,"keyup",i),ue(document,"mouseover",i)}function Ou(e){e.keyCode==16&&(this.doc.sel.shift=!1),$e(this,e)}function Iu(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(nr(t.display,e)||$e(t,e)||e.ctrlKey&&!e.altKey||O&&e.metaKey)){var i=e.keyCode,r=e.charCode;if(k&&i==Za){Za=null,bt(e);return}if(!(k&&(!e.which||e.which<10)&&zu(t,e))){var n=String.fromCharCode(r??i);n!="\b"&&(Th(t,e,n)||t.display.input.onKeyPress(e))}}}var Mh=400,Qa=function(e,t,i){this.time=e,this.pos=t,this.button=i};Qa.prototype.compare=function(e,t,i){return this.time+Mh>e&&me(t,this.pos)==0&&i==this.button};var on,an;function Bh(e,t){var i=+new Date;return an&&an.compare(i,e,t)?(on=an=null,"triple"):on&&on.compare(i,e,t)?(an=new Qa(i,e,t),on=null,"double"):(on=new Qa(i,e,t),an=null,"single")}function Hu(e){var t=this,i=t.display;if(!($e(t,e)||i.activeTouch&&i.input.supportsTouch())){if(i.input.ensurePolled(),i.shift=e.shiftKey,nr(i,e)){v||(i.scroller.draggable=!1,setTimeout(function(){return i.scroller.draggable=!0},100));return}if(!Ja(t,e)){var r=Nr(t,e),n=Zl(e),u=r?Bh(r,n):"single";xe(t).focus(),n==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&_h(t,n,r,u,e))&&(n==1?r?Nh(t,r,u,e):$o(e)==i.scroller&&bt(e):n==2?(r&&Xn(t.doc,r),setTimeout(function(){return i.input.focus()},20)):n==3&&(de?t.display.input.onContextMenu(e):Ma(t)))}}}function _h(e,t,i,r,n){var u="Click";return r=="double"?u="Double"+u:r=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,nn(e,Tu(u,n),n,function(p){if(typeof p=="string"&&(p=rn[p]),!p)return!1;var g=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),g=p(e,i)!=Ze}finally{e.state.suppressEdits=!1}return g})}function zh(e,t,i){var r=e.getOption("configureMouse"),n=r?r(e,t,i):{};if(n.unit==null){var u=I?i.shiftKey&&i.metaKey:i.altKey;n.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(n.extend==null||e.doc.extend)&&(n.extend=e.doc.extend||i.shiftKey),n.addNew==null&&(n.addNew=O?i.metaKey:i.ctrlKey),n.moveOnDrag==null&&(n.moveOnDrag=!(O?i.altKey:i.ctrlKey)),n}function Nh(e,t,i,r){c?setTimeout(mt(Ps,e),0):e.curOp.focus=he(te(e));var n=zh(e,i,r),u=e.doc.sel,p;e.options.dragDrop&&Uc&&!e.isReadOnly()&&i=="single"&&(p=u.contains(t))>-1&&(me((p=u.ranges[p]).from(),t)<0||t.xRel>0)&&(me(p.to(),t)>0||t.xRel<0)?Oh(e,r,t,n):Ih(e,r,t,n)}function Oh(e,t,i,r){var n=e.display,u=!1,p=tt(e,function(b){v&&(n.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:Ma(e)),Mt(n.wrapper.ownerDocument,"mouseup",p),Mt(n.wrapper.ownerDocument,"mousemove",g),Mt(n.scroller,"dragstart",m),Mt(n.scroller,"drop",p),u||(bt(b),r.addNew||Xn(e.doc,i,null,null,r.extend),v&&!F||c&&d==9?setTimeout(function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()},20):n.input.focus())}),g=function(b){u=u||Math.abs(t.clientX-b.clientX)+Math.abs(t.clientY-b.clientY)>=10},m=function(){return u=!0};v&&(n.scroller.draggable=!0),e.state.draggingText=p,p.copy=!r.moveOnDrag,ue(n.wrapper.ownerDocument,"mouseup",p),ue(n.wrapper.ownerDocument,"mousemove",g),ue(n.scroller,"dragstart",m),ue(n.scroller,"drop",p),e.state.delayingBlurEvent=!0,setTimeout(function(){return n.input.focus()},20),n.scroller.dragDrop&&n.scroller.dragDrop()}function Pu(e,t,i){if(i=="char")return new Ae(t,t);if(i=="word")return e.findWordAt(t);if(i=="line")return new Ae(K(t.line,0),ve(e.doc,K(t.line+1,0)));var r=i(e,t);return new Ae(r.from,r.to)}function Ih(e,t,i,r){c&&Ma(e);var n=e.display,u=e.doc;bt(t);var p,g,m=u.sel,b=m.ranges;if(r.addNew&&!r.extend?(g=u.sel.contains(i),g>-1?p=b[g]:p=new Ae(i,i)):(p=u.sel.primary(),g=u.sel.primIndex),r.unit=="rectangle")r.addNew||(p=new Ae(i,i)),i=Nr(e,t,!0,!0),g=-1;else{var C=Pu(e,i,r.unit);r.extend?p=ja(p,C.anchor,C.head,r.extend):p=C}r.addNew?g==-1?(g=b.length,lt(u,Wt(e,b.concat([p]),g),{scroll:!1,origin:"*mouse"})):b.length>1&&b[g].empty()&&r.unit=="char"&&!r.extend?(lt(u,Wt(e,b.slice(0,g).concat(b.slice(g+1)),0),{scroll:!1,origin:"*mouse"}),m=u.sel):Ga(u,g,p,Fi):(g=0,lt(u,new Bt([p],0),Fi),m=u.sel);var S=i;function _(V){if(me(S,V)!=0)if(S=V,r.unit=="rectangle"){for(var ie=[],se=e.options.tabSize,le=Ye(ae(u,i.line).text,i.ch,se),we=Ye(ae(u,V.line).text,V.ch,se),Le=Math.min(le,we),it=Math.max(le,we),Ie=Math.min(i.line,V.line),Et=Math.min(e.lastLine(),Math.max(i.line,V.line));Ie<=Et;Ie++){var wt=ae(u,Ie).text,Xe=Kt(wt,Le,se);Le==it?ie.push(new Ae(K(Ie,Xe),K(Ie,Xe))):wt.length>Xe&&ie.push(new Ae(K(Ie,Xe),K(Ie,Kt(wt,it,se))))}ie.length||ie.push(new Ae(i,i)),lt(u,Wt(e,m.ranges.slice(0,g).concat(ie),g),{origin:"*mouse",scroll:!1}),e.scrollIntoView(V)}else{var Ct=p,ot=Pu(e,V,r.unit),Qe=Ct.anchor,Ke;me(ot.anchor,Qe)>0?(Ke=ot.head,Qe=En(Ct.from(),ot.anchor)):(Ke=ot.anchor,Qe=Sn(Ct.to(),ot.head));var qe=m.ranges.slice(0);qe[g]=Hh(e,new Ae(ve(u,Qe),Ke)),lt(u,Wt(e,qe,g),Fi)}}var M=n.wrapper.getBoundingClientRect(),P=0;function U(V){var ie=++P,se=Nr(e,V,!0,r.unit=="rectangle");if(se)if(me(se,S)!=0){e.curOp.focus=he(te(e)),_(se);var le=qn(n,u);(se.line>=le.to||se.line<le.from)&&setTimeout(tt(e,function(){P==ie&&U(V)}),150)}else{var we=V.clientY<M.top?-20:V.clientY>M.bottom?20:0;we&&setTimeout(tt(e,function(){P==ie&&(n.scroller.scrollTop+=we,U(V))}),50)}}function Z(V){e.state.selectingText=!1,P=1/0,V&&(bt(V),n.input.focus()),Mt(n.wrapper.ownerDocument,"mousemove",J),Mt(n.wrapper.ownerDocument,"mouseup",ee),u.history.lastSelOrigin=null}var J=tt(e,function(V){V.buttons===0||!Zl(V)?Z(V):U(V)}),ee=tt(e,Z);e.state.selectingText=ee,ue(n.wrapper.ownerDocument,"mousemove",J),ue(n.wrapper.ownerDocument,"mouseup",ee)}function Hh(e,t){var i=t.anchor,r=t.head,n=ae(e.doc,i.line);if(me(i,r)==0&&i.sticky==r.sticky)return t;var u=tr(n);if(!u)return t;var p=Mi(u,i.ch,i.sticky),g=u[p];if(g.from!=i.ch&&g.to!=i.ch)return t;var m=p+(g.from==i.ch==(g.level!=1)?0:1);if(m==0||m==u.length)return t;var b;if(r.line!=i.line)b=(r.line-i.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var C=Mi(u,r.ch,r.sticky),S=C-p||(r.ch-i.ch)*(g.level==1?-1:1);C==m-1||C==m?b=S<0:b=S>0}var _=u[m+(b?-1:0)],M=b==(_.level==1),P=M?_.from:_.to,U=M?"after":"before";return i.ch==P&&i.sticky==U?t:new Ae(new K(i.line,P,U),r)}function qu(e,t,i,r){var n,u;if(t.touches)n=t.touches[0].clientX,u=t.touches[0].clientY;else try{n=t.clientX,u=t.clientY}catch{return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&bt(t);var p=e.display,g=p.lineDiv.getBoundingClientRect();if(u>g.bottom||!Ot(e,i))return Vo(t);u-=g.top-p.viewOffset;for(var m=0;m<e.display.gutterSpecs.length;++m){var b=p.gutters.childNodes[m];if(b&&b.getBoundingClientRect().right>=n){var C=Br(e.doc,u),S=e.display.gutterSpecs[m];return je(e,i,e,C,S.className,t),Vo(t)}}}function Ja(e,t){return qu(e,t,"gutterClick",!0)}function Ru(e,t){nr(e.display,t)||Ph(e,t)||$e(e,t,"contextmenu")||de||e.display.input.onContextMenu(t)}function Ph(e,t){return Ot(e,"gutterContextMenu")?qu(e,t,"gutterContextMenu",!1):!1}function Wu(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Pi(e)}var pi={toString:function(){return"CodeMirror.Init"}},Uu={},$n={};function qh(e){var t=e.optionHandlers;function i(r,n,u,p){e.defaults[r]=n,u&&(t[r]=p?function(g,m,b){b!=pi&&u(g,m,b)}:u)}e.defineOption=i,e.Init=pi,i("value","",function(r,n){return r.setValue(n)},!0),i("mode",null,function(r,n){r.doc.modeOption=n,Ra(r)},!0),i("indentUnit",2,Ra,!0),i("indentWithTabs",!1),i("smartIndent",!0),i("tabSize",4,function(r){Ki(r),Pi(r),yt(r)},!0),i("lineSeparator",null,function(r,n){if(r.doc.lineSep=n,!!n){var u=[],p=r.doc.first;r.doc.iter(function(m){for(var b=0;;){var C=m.text.indexOf(n,b);if(C==-1)break;b=C+n.length,u.push(K(p,C))}p++});for(var g=u.length-1;g>=0;g--)fi(r.doc,n,u[g],K(u[g].line,u[g].ch+n.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,n,u){r.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),u!=pi&&r.refresh()}),i("specialCharPlaceholder",gd,function(r){return r.refresh()},!0),i("electricChars",!0),i("inputStyle",z?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),i("spellcheck",!1,function(r,n){return r.getInputField().spellcheck=n},!0),i("autocorrect",!1,function(r,n){return r.getInputField().autocorrect=n},!0),i("autocapitalize",!1,function(r,n){return r.getInputField().autocapitalize=n},!0),i("rtlMoveVisually",!W),i("wholeLineUpdateBefore",!0),i("theme","default",function(r){Wu(r),Xi(r)},!0),i("keyMap","default",function(r,n,u){var p=Jn(n),g=u!=pi&&Jn(u);g&&g.detach&&g.detach(r,p),p.attach&&p.attach(r,g||null)}),i("extraKeys",null),i("configureMouse",null),i("lineWrapping",!1,Wh,!0),i("gutters",[],function(r,n){r.display.gutterSpecs=Pa(n,r.options.lineNumbers),Xi(r)},!0),i("fixedGutter",!0,function(r,n){r.display.gutters.style.left=n?Aa(r.display)+"px":"0",r.refresh()},!0),i("coverGutterNextToScrollbar",!1,function(r){return ai(r)},!0),i("scrollbarStyle","native",function(r){Gs(r),ai(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),i("lineNumbers",!1,function(r,n){r.display.gutterSpecs=Pa(r.options.gutters,n),Xi(r)},!0),i("firstLineNumber",1,Xi,!0),i("lineNumberFormatter",function(r){return r},Xi,!0),i("showCursorWhenSelecting",!1,qi,!0),i("resetSelectionOnContextMenu",!0),i("lineWiseCopyCut",!0),i("pasteLinesPerSelection",!0),i("selectionsMayTouch",!1),i("readOnly",!1,function(r,n){n=="nocursor"&&(ni(r),r.display.input.blur()),r.display.input.readOnlyChanged(n)}),i("screenReaderLabel",null,function(r,n){n=n===""?null:n,r.display.input.screenReaderLabelChanged(n)}),i("disableInput",!1,function(r,n){n||r.display.input.reset()},!0),i("dragDrop",!0,Rh),i("allowDropFileTypes",null),i("cursorBlinkRate",530),i("cursorScrollMargin",0),i("cursorHeight",1,qi,!0),i("singleCursorHeightPerLine",!0,qi,!0),i("workTime",100),i("workDelay",100),i("flattenSpans",!0,Ki,!0),i("addModeClass",!1,Ki,!0),i("pollInterval",100),i("undoDepth",200,function(r,n){return r.doc.history.undoDepth=n}),i("historyEventDelay",1250),i("viewportMargin",10,function(r){return r.refresh()},!0),i("maxHighlightLength",1e4,Ki,!0),i("moveInputWithCursor",!0,function(r,n){n||r.display.input.resetPosition()}),i("tabindex",null,function(r,n){return r.display.input.getField().tabIndex=n||""}),i("autofocus",null),i("direction","ltr",function(r,n){return r.doc.setDirection(n)},!0),i("phrases",null)}function Rh(e,t,i){var r=i&&i!=pi;if(!t!=!r){var n=e.display.dragFunctions,u=t?ue:Mt;u(e.display.scroller,"dragstart",n.start),u(e.display.scroller,"dragenter",n.enter),u(e.display.scroller,"dragover",n.over),u(e.display.scroller,"dragleave",n.leave),u(e.display.scroller,"drop",n.drop)}}function Wh(e){e.options.lineWrapping?(be(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(oe(e.display.wrapper,"CodeMirror-wrap"),va(e)),Fa(e),yt(e),Pi(e),setTimeout(function(){return ai(e)},100)}function Ne(e,t){var i=this;if(!(this instanceof Ne))return new Ne(e,t);this.options=t=t?Lt(t):{},Lt(Uu,t,!1);var r=t.value;typeof r=="string"?r=new xt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var n=new Ne.inputStyles[t.inputStyle](this),u=this.display=new th(e,r,n,t);u.wrapper.CodeMirror=this,Wu(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Gs(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&&!z&&u.input.focus(),c&&d<11&&setTimeout(function(){return i.display.input.reset(!0)},20),Uh(this),xh(),Pr(this),this.curOp.forceUpdate=!0,tu(this,r),t.autofocus&&!z||this.hasFocus()?setTimeout(function(){i.hasFocus()&&!i.state.focused&&Ba(i)},20):ni(this);for(var p in $n)$n.hasOwnProperty(p)&&$n[p](this,t[p],pi);Ys(this),t.finishInit&&t.finishInit(this);for(var g=0;g<Va.length;++g)Va[g](this);qr(this),v&&t.lineWrapping&&getComputedStyle(u.lineDiv).textRendering=="optimizelegibility"&&(u.lineDiv.style.textRendering="auto")}Ne.defaults=Uu,Ne.optionHandlers=$n;function Uh(e){var t=e.display;ue(t.scroller,"mousedown",tt(e,Hu)),c&&d<11?ue(t.scroller,"dblclick",tt(e,function(m){if(!$e(e,m)){var b=Nr(e,m);if(!(!b||Ja(e,m)||nr(e.display,m))){bt(m);var C=e.findWordAt(b);Xn(e.doc,C.anchor,C.head)}}})):ue(t.scroller,"dblclick",function(m){return $e(e,m)||bt(m)}),ue(t.scroller,"contextmenu",function(m){return Ru(e,m)}),ue(t.input.getField(),"contextmenu",function(m){t.scroller.contains(m.target)||Ru(e,m)});var i,r={end:0};function n(){t.activeTouch&&(i=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function u(m){if(m.touches.length!=1)return!1;var b=m.touches[0];return b.radiusX<=1&&b.radiusY<=1}function p(m,b){if(b.left==null)return!0;var C=b.left-m.left,S=b.top-m.top;return C*C+S*S>20*20}ue(t.scroller,"touchstart",function(m){if(!$e(e,m)&&!u(m)&&!Ja(e,m)){t.input.ensurePolled(),clearTimeout(i);var b=+new Date;t.activeTouch={start:b,moved:!1,prev:b-r.end<=300?r:null},m.touches.length==1&&(t.activeTouch.left=m.touches[0].pageX,t.activeTouch.top=m.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(m){var b=t.activeTouch;if(b&&!nr(t,m)&&b.left!=null&&!b.moved&&new Date-b.start<300){var C=e.coordsChar(t.activeTouch,"page"),S;!b.prev||p(b,b.prev)?S=new Ae(C,C):!b.prev.prev||p(b,b.prev.prev)?S=e.findWordAt(C):S=new Ae(K(C.line,0),ve(e.doc,K(C.line+1,0))),e.setSelection(S.anchor,S.head),e.focus(),bt(m)}n()}),ue(t.scroller,"touchcancel",n),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Wi(e,t.scroller.scrollTop),Ir(e,t.scroller.scrollLeft,!0),je(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(m){return Js(e,m)}),ue(t.scroller,"DOMMouseScroll",function(m){return Js(e,m)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(m){$e(e,m)||Bi(m)},over:function(m){$e(e,m)||(yh(e,m),Bi(m))},start:function(m){return bh(e,m)},drop:tt(e,vh),leave:function(m){$e(e,m)||Su(e)}};var g=t.input.getField();ue(g,"keyup",function(m){return Ou.call(e,m)}),ue(g,"keydown",tt(e,Nu)),ue(g,"keypress",tt(e,Iu)),ue(g,"focus",function(m){return Ba(e,m)}),ue(g,"blur",function(m){return ni(e,m)})}var Va=[];Ne.defineInitHook=function(e){return Va.push(e)};function ln(e,t,i,r){var n=e.doc,u;i==null&&(i="add"),i=="smart"&&(n.mode.indent?u=zi(e,t).state:i="prev");var p=e.options.tabSize,g=ae(n,t),m=Ye(g.text,null,p);g.stateAfter&&(g.stateAfter=null);var b=g.text.match(/^\s*/)[0],C;if(!r&&!/\S/.test(g.text))C=0,i="not";else if(i=="smart"&&(C=n.mode.indent(u,g.text.slice(b.length),g.text),C==Ze||C>150)){if(!r)return;i="prev"}i=="prev"?t>n.first?C=Ye(ae(n,t-1).text,null,p):C=0:i=="add"?C=m+e.options.indentUnit:i=="subtract"?C=m-e.options.indentUnit:typeof i=="number"&&(C=m+i),C=Math.max(0,C);var S="",_=0;if(e.options.indentWithTabs)for(var M=Math.floor(C/p);M;--M)_+=p,S+=" ";if(_<C&&(S+=pr(C-_)),S!=b)return fi(n,S,K(t,0),K(t,b.length),"+input"),g.stateAfter=null,!0;for(var P=0;P<n.sel.ranges.length;P++){var U=n.sel.ranges[P];if(U.head.line==t&&U.head.ch<b.length){var Z=K(t,b.length);Ga(n,P,new Ae(Z,Z));break}}}var Ut=null;function eo(e){Ut=e}function $a(e,t,i,r,n){var u=e.doc;e.display.shift=!1,r||(r=u.sel);var p=+new Date-200,g=n=="paste"||e.state.pasteIncoming>p,m=ra(t),b=null;if(g&&r.ranges.length>1)if(Ut&&Ut.text.join(`
`)==t){if(r.ranges.length%Ut.text.length==0){b=[];for(var C=0;C<Ut.text.length;C++)b.push(u.splitLines(Ut.text[C]))}}else m.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(b=Pt(m,function(J){return[J]}));for(var S=e.curOp.updateInput,_=r.ranges.length-1;_>=0;_--){var M=r.ranges[_],P=M.from(),U=M.to();M.empty()&&(i&&i>0?P=K(P.line,P.ch-i):e.state.overwrite&&!g?U=K(U.line,Math.min(ae(u,U.line).text.length,U.ch+De(m).length)):g&&Ut&&Ut.lineWise&&Ut.text.join(`
`)==m.join(`
`)&&(P=U=K(P.line,0)));var Z={from:P,to:U,text:b?b[_%b.length]:m,origin:n||(g?"paste":e.state.cutIncoming>p?"cut":"+input")};ui(e.doc,Z),et(e,"inputRead",e,Z)}t&&!g&&Gu(e,t),oi(e),e.curOp.updateInput<2&&(e.curOp.updateInput=S),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ju(e,t){var i=e.clipboardData&&e.clipboardData.getData("Text");if(i)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&St(t,function(){return $a(t,i,0,null,"paste")}),!0}function Gu(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var i=e.doc.sel,r=i.ranges.length-1;r>=0;r--){var n=i.ranges[r];if(!(n.head.ch>100||r&&i.ranges[r-1].head.line==n.head.line)){var u=e.getModeAt(n.head),p=!1;if(u.electricChars){for(var g=0;g<u.electricChars.length;g++)if(t.indexOf(u.electricChars.charAt(g))>-1){p=ln(e,n.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(ae(e.doc,n.head.line).text.slice(0,n.head.ch))&&(p=ln(e,n.head.line,"smart"));p&&et(e,"electricInput",e,n.head.line)}}}function Xu(e){for(var t=[],i=[],r=0;r<e.doc.sel.ranges.length;r++){var n=e.doc.sel.ranges[r].head.line,u={anchor:K(n,0),head:K(n+1,0)};i.push(u),t.push(e.getRange(u.anchor,u.head))}return{text:t,ranges:i}}function el(e,t,i,r){e.setAttribute("autocorrect",i?"on":"off"),e.setAttribute("autocapitalize",r?"on":"off"),e.setAttribute("spellcheck",!!t)}function Ku(){var e=E("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),t=E("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return v?e.style.width="1000px":e.setAttribute("wrap","off"),T&&(e.style.border="1px solid black"),t}function jh(e){var t=e.optionHandlers,i=e.helpers={};e.prototype={constructor:e,focus:function(){xe(this).focus(),this.display.input.focus()},setOption:function(r,n){var u=this.options,p=u[r];u[r]==n&&r!="mode"||(u[r]=n,t.hasOwnProperty(r)&&tt(this,t[r])(this,n,p),je(this,"optionChange",this,r))},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,n){this.state.keyMaps[n?"push":"unshift"](Jn(r))},removeKeyMap:function(r){for(var n=this.state.keyMaps,u=0;u<n.length;++u)if(n[u]==r||n[u].name==r)return n.splice(u,1),!0},addOverlay:dt(function(r,n){var u=r.token?r:e.getMode(this.options,r);if(u.startState)throw new Error("Overlays may not be stateful.");gr(this.state.overlays,{mode:u,modeSpec:r,opaque:n&&n.opaque,priority:n&&n.priority||0},function(p){return p.priority}),this.state.modeGen++,yt(this)}),removeOverlay:dt(function(r){for(var n=this.state.overlays,u=0;u<n.length;++u){var p=n[u].modeSpec;if(p==r||typeof r=="string"&&p.name==r){n.splice(u,1),this.state.modeGen++,yt(this);return}}}),indentLine:dt(function(r,n,u){typeof n!="string"&&typeof n!="number"&&(n==null?n=this.options.smartIndent?"smart":"prev":n=n?"add":"subtract"),_i(this.doc,r)&&ln(this,r,n,u)}),indentSelection:dt(function(r){for(var n=this.doc.sel.ranges,u=-1,p=0;p<n.length;p++){var g=n[p];if(g.empty())g.head.line>u&&(ln(this,g.head.line,r,!0),u=g.head.line,p==this.doc.sel.primIndex&&oi(this));else{var m=g.from(),b=g.to(),C=Math.max(u,m.line);u=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var S=C;S<u;++S)ln(this,S,r);var _=this.doc.sel.ranges;m.ch==0&&n.length==_.length&&_[p].from().ch>0&&Ga(this.doc,p,new Ae(m,_[p].to()),vt)}}}),getTokenAt:function(r,n){return is(this,r,n)},getLineTokens:function(r,n){return is(this,K(r),n,!0)},getTokenTypeAt:function(r){r=ve(this.doc,r);var n=es(this,ae(this.doc,r.line)),u=0,p=(n.length-1)/2,g=r.ch,m;if(g==0)m=n[2];else for(;;){var b=u+p>>1;if((b?n[b*2-1]:0)>=g)p=b;else if(n[b*2+1]<g)u=b+1;else{m=n[b*2+2];break}}var C=m?m.indexOf("overlay "):-1;return C<0?m:C==0?null:m.slice(0,C-1)},getModeAt:function(r){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(r).state).mode:n},getHelper:function(r,n){return this.getHelpers(r,n)[0]},getHelpers:function(r,n){var u=[];if(!i.hasOwnProperty(n))return u;var p=i[n],g=this.getModeAt(r);if(typeof g[n]=="string")p[g[n]]&&u.push(p[g[n]]);else if(g[n])for(var m=0;m<g[n].length;m++){var b=p[g[n][m]];b&&u.push(b)}else g.helperType&&p[g.helperType]?u.push(p[g.helperType]):p[g.name]&&u.push(p[g.name]);for(var C=0;C<p._global.length;C++){var S=p._global[C];S.pred(g,this)&&ze(u,S.val)==-1&&u.push(S.val)}return u},getStateAfter:function(r,n){var u=this.doc;return r=Jl(u,r??u.first+u.size-1),zi(this,r+1,n).state},cursorCoords:function(r,n){var u,p=this.doc.sel.primary();return r==null?u=p.head:typeof r=="object"?u=ve(this.doc,r):u=r?p.from():p.to(),Rt(this,u,n||"page")},charCoords:function(r,n){return On(this,ve(this.doc,r),n||"page")},coordsChar:function(r,n){return r=Bs(this,r,n||"page"),ka(this,r.left,r.top)},lineAtHeight:function(r,n){return r=Bs(this,{top:r,left:0},n||"page").top,Br(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,n,u){var p=!1,g;if(typeof r=="number"){var m=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>m&&(r=m,p=!0),g=ae(this.doc,r)}else g=r;return Nn(this,g,{top:0,left:0},n||"page",u||p).top+(p?this.doc.height-ir(g):0)},defaultTextHeight:function(){return ri(this.display)},defaultCharWidth:function(){return ii(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,n,u,p,g){var m=this.display;r=Rt(this,ve(this.doc,r));var b=r.bottom,C=r.left;if(n.style.position="absolute",n.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(n),m.sizer.appendChild(n),p=="over")b=r.top;else if(p=="above"||p=="near"){var S=Math.max(m.wrapper.clientHeight,this.doc.height),_=Math.max(m.sizer.clientWidth,m.lineSpace.clientWidth);(p=="above"||r.bottom+n.offsetHeight>S)&&r.top>n.offsetHeight?b=r.top-n.offsetHeight:r.bottom+n.offsetHeight<=S&&(b=r.bottom),C+n.offsetWidth>_&&(C=_-n.offsetWidth)}n.style.top=b+"px",n.style.left=n.style.right="",g=="right"?(C=m.sizer.clientWidth-n.offsetWidth,n.style.right="0px"):(g=="left"?C=0:g=="middle"&&(C=(m.sizer.clientWidth-n.offsetWidth)/2),n.style.left=C+"px"),u&&Rd(this,{left:C,top:b,right:C+n.offsetWidth,bottom:b+n.offsetHeight})},triggerOnKeyDown:dt(Nu),triggerOnKeyPress:dt(Iu),triggerOnKeyUp:Ou,triggerOnMouseDown:dt(Hu),execCommand:function(r){if(rn.hasOwnProperty(r))return rn[r].call(null,this)},triggerElectric:dt(function(r){Gu(this,r)}),findPosH:function(r,n,u,p){var g=1;n<0&&(g=-1,n=-n);for(var m=ve(this.doc,r),b=0;b<n&&(m=tl(this.doc,m,g,u,p),!m.hitSide);++b);return m},moveH:dt(function(r,n){var u=this;this.extendSelectionsBy(function(p){return u.display.shift||u.doc.extend||p.empty()?tl(u.doc,p.head,r,n,u.options.rtlMoveVisually):r<0?p.from():p.to()},Xt)}),deleteH:dt(function(r,n){var u=this.doc.sel,p=this.doc;u.somethingSelected()?p.replaceSelection("",null,"+delete"):hi(this,function(g){var m=tl(p,g.head,r,n,!1);return r<0?{from:m,to:g.head}:{from:g.head,to:m}})}),findPosV:function(r,n,u,p){var g=1,m=p;n<0&&(g=-1,n=-n);for(var b=ve(this.doc,r),C=0;C<n;++C){var S=Rt(this,b,"div");if(m==null?m=S.left:S.left=m,b=Yu(this,S,g,u),b.hitSide)break}return b},moveV:dt(function(r,n){var u=this,p=this.doc,g=[],m=!this.display.shift&&!p.extend&&p.sel.somethingSelected();if(p.extendSelectionsBy(function(C){if(m)return r<0?C.from():C.to();var S=Rt(u,C.head,"div");C.goalColumn!=null&&(S.left=C.goalColumn),g.push(S.left);var _=Yu(u,S,r,n);return n=="page"&&C==p.sel.primary()&&za(u,On(u,_,"div").top-S.top),_},Xt),g.length)for(var b=0;b<p.sel.ranges.length;b++)p.sel.ranges[b].goalColumn=g[b]}),findWordAt:function(r){var n=this.doc,u=ae(n,r.line).text,p=r.ch,g=r.ch;if(u){var m=this.getHelper(r,"wordChars");(r.sticky=="before"||g==u.length)&&p?--p:++g;for(var b=u.charAt(p),C=Dn(b,m)?function(S){return Dn(S,m)}:/\s/.test(b)?function(S){return/\s/.test(S)}:function(S){return!/\s/.test(S)&&!Dn(S)};p>0&&C(u.charAt(p-1));)--p;for(;g<u.length&&C(u.charAt(g));)++g}return new Ae(K(r.line,p),K(r.line,g))},toggleOverwrite:function(r){r!=null&&r==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?be(this.display.cursorDiv,"CodeMirror-overwrite"):oe(this.display.cursorDiv,"CodeMirror-overwrite"),je(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==he(te(this))},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:dt(function(r,n){Ri(this,r,n)}),getScrollInfo:function(){var r=this.display.scroller;return{left:r.scrollLeft,top:r.scrollTop,height:r.scrollHeight-Qt(this)-this.display.barHeight,width:r.scrollWidth-Qt(this)-this.display.barWidth,clientHeight:xa(this),clientWidth:_r(this)}},scrollIntoView:dt(function(r,n){r==null?(r={from:this.doc.sel.primary().head,to:null},n==null&&(n=this.options.cursorScrollMargin)):typeof r=="number"?r={from:K(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=n||0,r.from.line!=null?Wd(this,r):Rs(this,r.from,r.to,r.margin)}),setSize:dt(function(r,n){var u=this,p=function(m){return typeof m=="number"||/^\d+$/.test(String(m))?m+"px":m};r!=null&&(this.display.wrapper.style.width=p(r)),n!=null&&(this.display.wrapper.style.height=p(n)),this.options.lineWrapping&&Ts(this);var g=this.display.viewFrom;this.doc.iter(g,this.display.viewTo,function(m){if(m.widgets){for(var b=0;b<m.widgets.length;b++)if(m.widgets[b].noHScroll){vr(u,g,"widget");break}}++g}),this.curOp.forceUpdate=!0,je(this,"refresh",this)}),operation:function(r){return St(this,r)},startOperation:function(){return Pr(this)},endOperation:function(){return qr(this)},refresh:dt(function(){var r=this.display.cachedTextHeight;yt(this),this.curOp.forceUpdate=!0,Pi(this),Ri(this,this.doc.scrollLeft,this.doc.scrollTop),Ia(this.display),(r==null||Math.abs(r-ri(this.display))>.5||this.options.lineWrapping)&&Fa(this),je(this,"refresh",this)}),swapDoc:dt(function(r){var n=this.doc;return n.cm=null,this.state.selectingText&&this.state.selectingText(),tu(this,r),Pi(this),this.display.input.reset(),Ri(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,et(this,"swapDoc",this,n),n}),phrase:function(r){var n=this.options.phrases;return n&&Object.prototype.hasOwnProperty.call(n,r)?n[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}},Qr(e),e.registerHelper=function(r,n,u){i.hasOwnProperty(r)||(i[r]=e[r]={_global:[]}),i[r][n]=u},e.registerGlobalHelper=function(r,n,u,p){e.registerHelper(r,n,p),i[r]._global.push({pred:u,val:p})}}function tl(e,t,i,r,n){var u=t,p=i,g=ae(e,t.line),m=n&&e.direction=="rtl"?-i:i;function b(){var ee=t.line+m;return ee<e.first||ee>=e.first+e.size?!1:(t=new K(ee,t.ch,t.sticky),g=ae(e,ee))}function C(ee){var V;if(r=="codepoint"){var ie=g.text.charCodeAt(t.ch+(i>0?0:-1));if(isNaN(ie))V=null;else{var se=i>0?ie>=55296&&ie<56320:ie>=56320&&ie<57343;V=new K(t.line,Math.max(0,Math.min(g.text.length,t.ch+i*(se?2:1))),-i)}}else n?V=Sh(e.cm,g,t,i):V=Ka(g,t,i);if(V==null)if(!ee&&b())t=Ya(n,e.cm,g,t.line,m);else return!1;else t=V;return!0}if(r=="char"||r=="codepoint")C();else if(r=="column")C(!0);else if(r=="word"||r=="group")for(var S=null,_=r=="group",M=e.cm&&e.cm.getHelper(t,"wordChars"),P=!0;!(i<0&&!C(!P));P=!1){var U=g.text.charAt(t.ch)||`
`,Z=Dn(U,M)?"w":_&&U==`
`?"n":!_||/\s/.test(U)?null:"p";if(_&&!P&&!Z&&(Z="s"),S&&S!=Z){i<0&&(i=1,C(),t.sticky="after");break}if(Z&&(S=Z),i>0&&!C(!P))break}var J=Yn(e,t,u,p,!0);return ua(u,J)&&(J.hitSide=!0),J}function Yu(e,t,i,r){var n=e.doc,u=t.left,p;if(r=="page"){var g=Math.min(e.display.wrapper.clientHeight,xe(e).innerHeight||n(e).documentElement.clientHeight),m=Math.max(g-.5*ri(e.display),3);p=(i>0?t.bottom:t.top)+i*m}else r=="line"&&(p=i>0?t.bottom+3:t.top-3);for(var b;b=ka(e,u,p),!!b.outside;){if(i<0?p<=0:p>=n.height){b.hitSide=!0;break}p+=i*5}return b}var Te=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};Te.prototype.init=function(e){var t=this,i=this,r=i.cm,n=i.div=e.lineDiv;n.contentEditable=!0,el(n,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function u(g){for(var m=g.target;m;m=m.parentNode){if(m==n)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(m.className))break}return!1}ue(n,"paste",function(g){!u(g)||$e(r,g)||ju(g,r)||d<=11&&setTimeout(tt(r,function(){return t.updateFromDOM()}),20)}),ue(n,"compositionstart",function(g){t.composing={data:g.data,done:!1}}),ue(n,"compositionupdate",function(g){t.composing||(t.composing={data:g.data,done:!1})}),ue(n,"compositionend",function(g){t.composing&&(g.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ue(n,"touchstart",function(){return i.forceCompositionEnd()}),ue(n,"input",function(){t.composing||t.readFromDOMSoon()});function p(g){if(!(!u(g)||$e(r,g))){if(r.somethingSelected())eo({lineWise:!1,text:r.getSelections()}),g.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var m=Xu(r);eo({lineWise:!0,text:m.text}),g.type=="cut"&&r.operation(function(){r.setSelections(m.ranges,0,vt),r.replaceSelection("",null,"cut")})}else return;if(g.clipboardData){g.clipboardData.clearData();var b=Ut.text.join(`
`);if(g.clipboardData.setData("Text",b),g.clipboardData.getData("Text")==b){g.preventDefault();return}}var C=Ku(),S=C.firstChild;el(S),r.display.lineSpace.insertBefore(C,r.display.lineSpace.firstChild),S.value=Ut.text.join(`
`);var _=he(Ce(n));A(S),setTimeout(function(){r.display.lineSpace.removeChild(C),_.focus(),_==n&&i.showPrimarySelection()},50)}}ue(n,"copy",p),ue(n,"cut",p)},Te.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Te.prototype.prepareSelection=function(){var e=Hs(this.cm,!1);return e.focus=he(Ce(this.div))==this.div,e},Te.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Te.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Te.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,i=t.doc.sel.primary(),r=i.from(),n=i.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||n.line<t.display.viewFrom){e.removeAllRanges();return}var u=to(t,e.anchorNode,e.anchorOffset),p=to(t,e.focusNode,e.focusOffset);if(!(u&&!u.bad&&p&&!p.bad&&me(En(u,p),r)==0&&me(Sn(u,p),n)==0)){var g=t.display.view,m=r.line>=t.display.viewFrom&&Zu(t,r)||{node:g[0].measure.map[2],offset:0},b=n.line<t.display.viewTo&&Zu(t,n);if(!b){var C=g[g.length-1].measure,S=C.maps?C.maps[C.maps.length-1]:C.map;b={node:S[S.length-1],offset:S[S.length-2]-S[S.length-3]}}if(!m||!b){e.removeAllRanges();return}var _=e.rangeCount&&e.getRangeAt(0),M;try{M=R(m.node,m.offset,b.offset,b.node)}catch{}M&&(!s&&t.state.focused?(e.collapse(m.node,m.offset),M.collapsed||(e.removeAllRanges(),e.addRange(M))):(e.removeAllRanges(),e.addRange(M)),_&&e.anchorNode==null?e.addRange(_):s&&this.startGracePeriod()),this.rememberSelection()}},Te.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)},Te.prototype.showMultipleSelections=function(e){Y(this.cm.display.cursorDiv,e.cursors),Y(this.cm.display.selectionDiv,e.selection)},Te.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Te.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Q(this.div,t)},Te.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||he(Ce(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Te.prototype.blur=function(){this.div.blur()},Te.prototype.getField=function(){return this.div},Te.prototype.supportsTouch=function(){return!0},Te.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):St(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)},Te.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Te.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var e=this.getSelection(),t=this.cm;if(N&&x&&this.cm.display.gutterSpecs.length&&Gh(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var i=to(t,e.anchorNode,e.anchorOffset),r=to(t,e.focusNode,e.focusOffset);i&&r&&St(t,function(){lt(t.doc,yr(i,r),vt),(i.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},Te.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(),n=i.to();if(r.ch==0&&r.line>e.firstLine()&&(r=K(r.line-1,ae(e.doc,r.line-1).length)),n.ch==ae(e.doc,n.line).text.length&&n.line<e.lastLine()&&(n=K(n.line+1,0)),r.line<t.viewFrom||n.line>t.viewTo-1)return!1;var u,p,g;r.line==t.viewFrom||(u=Or(e,r.line))==0?(p=Fe(t.view[0].line),g=t.view[0].node):(p=Fe(t.view[u].line),g=t.view[u-1].node.nextSibling);var m=Or(e,n.line),b,C;if(m==t.view.length-1?(b=t.viewTo-1,C=t.lineDiv.lastChild):(b=Fe(t.view[m+1].line)-1,C=t.view[m+1].node.previousSibling),!g)return!1;for(var S=e.doc.splitLines(Xh(e,g,C,p,b)),_=Mr(e.doc,K(p,0),K(b,ae(e.doc,b).text.length));S.length>1&&_.length>1;)if(De(S)==De(_))S.pop(),_.pop(),b--;else if(S[0]==_[0])S.shift(),_.shift(),p++;else break;for(var M=0,P=0,U=S[0],Z=_[0],J=Math.min(U.length,Z.length);M<J&&U.charCodeAt(M)==Z.charCodeAt(M);)++M;for(var ee=De(S),V=De(_),ie=Math.min(ee.length-(S.length==1?M:0),V.length-(_.length==1?M:0));P<ie&&ee.charCodeAt(ee.length-P-1)==V.charCodeAt(V.length-P-1);)++P;if(S.length==1&&_.length==1&&p==r.line)for(;M&&M>r.ch&&ee.charCodeAt(ee.length-P-1)==V.charCodeAt(V.length-P-1);)M--,P++;S[S.length-1]=ee.slice(0,ee.length-P).replace(/^\u200b+/,""),S[0]=S[0].slice(M).replace(/\u200b+$/,"");var se=K(p,M),le=K(b,_.length?De(_).length-P:0);if(S.length>1||S[0]||me(se,le))return fi(e.doc,S,se,le,"+input"),!0},Te.prototype.ensurePolled=function(){this.forceCompositionEnd()},Te.prototype.reset=function(){this.forceCompositionEnd()},Te.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Te.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))},Te.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&St(this.cm,function(){return yt(e.cm)})},Te.prototype.setUneditable=function(e){e.contentEditable="false"},Te.prototype.onKeyPress=function(e){e.charCode==0||this.composing||(e.preventDefault(),this.cm.isReadOnly()||tt(this.cm,$a)(this.cm,String.fromCharCode(e.charCode==null?e.keyCode:e.charCode),0))},Te.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Te.prototype.onContextMenu=function(){},Te.prototype.resetPosition=function(){},Te.prototype.needsContentAttribute=!0;function Zu(e,t){var i=wa(e,t.line);if(!i||i.hidden)return null;var r=ae(e.doc,t.line),n=ks(i,r,t.line),u=tr(r,e.doc.direction),p="left";if(u){var g=Mi(u,t.ch);p=g%2?"right":"left"}var m=As(n.map,t.ch,p);return m.offset=m.collapse=="right"?m.end:m.start,m}function Gh(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function gi(e,t){return t&&(e.bad=!0),e}function Xh(e,t,i,r,n){var u="",p=!1,g=e.doc.lineSeparator(),m=!1;function b(M){return function(P){return P.id==M}}function C(){p&&(u+=g,m&&(u+=g),p=m=!1)}function S(M){M&&(C(),u+=M)}function _(M){if(M.nodeType==1){var P=M.getAttribute("cm-text");if(P){S(P);return}var U=M.getAttribute("cm-marker"),Z;if(U){var J=e.findMarks(K(r,0),K(n+1,0),b(+U));J.length&&(Z=J[0].find(0))&&S(Mr(e.doc,Z.from,Z.to).join(g));return}if(M.getAttribute("contenteditable")=="false")return;var ee=/^(pre|div|p|li|table|br)$/i.test(M.nodeName);if(!/^br$/i.test(M.nodeName)&&M.textContent.length==0)return;ee&&C();for(var V=0;V<M.childNodes.length;V++)_(M.childNodes[V]);/^(pre|p)$/i.test(M.nodeName)&&(m=!0),ee&&(p=!0)}else M.nodeType==3&&S(M.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;_(t),t!=i;)t=t.nextSibling,m=!1;return u}function to(e,t,i){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[i],!r)return gi(e.clipPos(K(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 n=0;n<e.display.view.length;n++){var u=e.display.view[n];if(u.node==r)return Kh(u,t,i)}}function Kh(e,t,i){var r=e.text.firstChild,n=!1;if(!t||!Q(r,t))return gi(K(Fe(e.line),0),!0);if(t==r&&(n=!0,t=r.childNodes[i],i=0,!t)){var u=e.rest?De(e.rest):e.line;return gi(K(Fe(u),u.text.length),n)}var p=t.nodeType==3?t:null,g=t;for(!p&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(p=t.firstChild,i&&(i=p.nodeValue.length));g.parentNode!=r;)g=g.parentNode;var m=e.measure,b=m.maps;function C(Z,J,ee){for(var V=-1;V<(b?b.length:0);V++)for(var ie=V<0?m.map:b[V],se=0;se<ie.length;se+=3){var le=ie[se+2];if(le==Z||le==J){var we=Fe(V<0?e.line:e.rest[V]),Le=ie[se]+ee;return(ee<0||le!=Z)&&(Le=ie[se+(ee?1:0)]),K(we,Le)}}}var S=C(p,g,i);if(S)return gi(S,n);for(var _=g.nextSibling,M=p?p.nodeValue.length-i:0;_;_=_.nextSibling){if(S=C(_,_.firstChild,0),S)return gi(K(S.line,S.ch-M),n);M+=_.textContent.length}for(var P=g.previousSibling,U=i;P;P=P.previousSibling){if(S=C(P,P.firstChild,-1),S)return gi(K(S.line,S.ch+U),n);U+=P.textContent.length}}var We=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ct,this.hasSelection=!1,this.composing=null,this.resetting=!1};We.prototype.init=function(e){var t=this,i=this,r=this.cm;this.createField(e);var n=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),T&&(n.style.width="0px"),ue(n,"input",function(){c&&d>=9&&t.hasSelection&&(t.hasSelection=null),i.poll()}),ue(n,"paste",function(p){$e(r,p)||ju(p,r)||(r.state.pasteIncoming=+new Date,i.fastPoll())});function u(p){if(!$e(r,p)){if(r.somethingSelected())eo({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var g=Xu(r);eo({lineWise:!0,text:g.text}),p.type=="cut"?r.setSelections(g.ranges,null,vt):(i.prevInput="",n.value=g.text.join(`
`),A(n))}else return;p.type=="cut"&&(r.state.cutIncoming=+new Date)}}ue(n,"cut",u),ue(n,"copy",u),ue(e.scroller,"paste",function(p){if(!(nr(e,p)||$e(r,p))){if(!n.dispatchEvent){r.state.pasteIncoming=+new Date,i.focus();return}var g=new Event("paste");g.clipboardData=p.clipboardData,n.dispatchEvent(g)}}),ue(e.lineSpace,"selectstart",function(p){nr(e,p)||bt(p)}),ue(n,"compositionstart",function(){var p=r.getCursor("from");i.composing&&i.composing.range.clear(),i.composing={start:p,range:r.markText(p,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ue(n,"compositionend",function(){i.composing&&(i.poll(),i.composing.range.clear(),i.composing=null)})},We.prototype.createField=function(e){this.wrapper=Ku(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;el(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},We.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},We.prototype.prepareSelection=function(){var e=this.cm,t=e.display,i=e.doc,r=Hs(e);if(e.options.moveInputWithCursor){var n=Rt(e,i.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),p=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+p.top-u.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+p.left-u.left))}return r},We.prototype.showSelection=function(e){var t=this.cm,i=t.display;Y(i.cursorDiv,e.cursors),Y(i.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},We.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&&A(this.textarea),c&&d>=9&&(this.hasSelection=i)}else e||(this.prevInput=this.textarea.value="",c&&d>=9&&(this.hasSelection=null));this.resetting=!1}},We.prototype.getField=function(){return this.textarea},We.prototype.supportsTouch=function(){return!1},We.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!z||he(Ce(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},We.prototype.blur=function(){this.textarea.blur()},We.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},We.prototype.receivedFocus=function(){this.slowPoll()},We.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},We.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)},We.prototype.poll=function(){var e=this,t=this.cm,i=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||Xc(i)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=i.value;if(n==r&&!t.somethingSelected())return!1;if(c&&d>=9&&this.hasSelection===n||O&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var u=n.charCodeAt(0);if(u==8203&&!r&&(r="\u200B"),u==8666)return this.reset(),this.cm.execCommand("undo")}for(var p=0,g=Math.min(r.length,n.length);p<g&&r.charCodeAt(p)==n.charCodeAt(p);)++p;return St(t,function(){$a(t,n.slice(p),r.length-p,null,e.composing?"*compose":null),n.length>1e3||n.indexOf(`
`)>-1?i.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},We.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},We.prototype.onKeyPress=function(){c&&d>=9&&(this.hasSelection=null),this.fastPoll()},We.prototype.onContextMenu=function(e){var t=this,i=t.cm,r=i.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var u=Nr(i,e),p=r.scroller.scrollTop;if(!u||k)return;var g=i.options.resetSelectionOnContextMenu;g&&i.doc.sel.contains(u)==-1&&tt(i,lt)(i.doc,yr(u),vt);var m=n.style.cssText,b=t.wrapper.style.cssText,C=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",n.style.cssText=`position: absolute; width: 30px; height: 30px;
top: `+(e.clientY-C.top-5)+"px; left: "+(e.clientX-C.left-5)+`px;
z-index: 1000; background: `+(c?"rgba(255, 255, 255, .05)":"transparent")+`;
outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`;var S;v&&(S=n.ownerDocument.defaultView.scrollY),r.input.focus(),v&&n.ownerDocument.defaultView.scrollTo(null,S),r.input.reset(),i.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=M,r.selForContextMenu=i.doc.sel,clearTimeout(r.detectingSelectAll);function _(){if(n.selectionStart!=null){var U=i.somethingSelected(),Z="\u200B"+(U?n.value:"");n.value="\u21DA",n.value=Z,t.prevInput=U?"":"\u200B",n.selectionStart=1,n.selectionEnd=Z.length,r.selForContextMenu=i.doc.sel}}function M(){if(t.contextMenuPending==M&&(t.contextMenuPending=!1,t.wrapper.style.cssText=b,n.style.cssText=m,c&&d<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=p),n.selectionStart!=null)){(!c||c&&d<9)&&_();var U=0,Z=function(){r.selForContextMenu==i.doc.sel&&n.selectionStart==0&&n.selectionEnd>0&&t.prevInput=="\u200B"?tt(i,pu)(i):U++<10?r.detectingSelectAll=setTimeout(Z,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Z,200)}}if(c&&d>=9&&_(),de){Bi(e);var P=function(){Mt(window,"mouseup",P),setTimeout(M,20)};ue(window,"mouseup",P)}else setTimeout(M,50)},We.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},We.prototype.setUneditable=function(){},We.prototype.needsContentAttribute=!1;function Yh(e,t){if(t=t?Lt(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=he(Ce(e));t.autofocus=i==e||e.getAttribute("autofocus")!=null&&i==document.body}function r(){e.value=g.getValue()}var n;if(e.form&&(ue(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var u=e.form;n=u.submit;try{var p=u.submit=function(){r(),u.submit=n,u.submit(),u.submit=p}}catch{}}t.finishInit=function(m){m.save=r,m.getTextArea=function(){return e},m.toTextArea=function(){m.toTextArea=isNaN,r(),e.parentNode.removeChild(m.getWrapperElement()),e.style.display="",e.form&&(Mt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=n))}},e.style.display="none";var g=Ne(function(m){return e.parentNode.insertBefore(m,e.nextSibling)},t);return g}function Zh(e){e.off=Mt,e.on=ue,e.wheelEventPixels=rh,e.Doc=xt,e.splitLines=ra,e.countColumn=Ye,e.findColumn=Kt,e.isWordChar=Zo,e.Pass=Ze,e.signal=je,e.Line=$r,e.changeEnd=xr,e.scrollbarModel=js,e.Pos=K,e.cmpPos=me,e.modes=na,e.mimeModes=Jr,e.resolveMode=kn,e.getMode=oa,e.modeExtensions=Vr,e.extendMode=Jc,e.copyState=Lr,e.startState=Ql,e.innerMode=aa,e.commands=rn,e.keyMap=ar,e.keyName=Lu,e.isModifierKey=Fu,e.lookupKey=di,e.normalizeKeyMap=kh,e.StringStream=Ge,e.SharedTextMarker=$i,e.TextMarker=Cr,e.LineWidget=Vi,e.e_preventDefault=bt,e.e_stopPropagation=Yl,e.e_stop=Bi,e.addClass=be,e.contains=Q,e.rmClass=oe,e.keyNames=Dr}qh(Ne),jh(Ne);var Qh="iter insert remove copy getEditor constructor".split(" ");for(var ro in xt.prototype)xt.prototype.hasOwnProperty(ro)&&ze(Qh,ro)<0&&(Ne.prototype[ro]=function(e){return function(){return e.apply(this.doc,arguments)}}(xt.prototype[ro]));return Qr(xt),Ne.inputStyles={textarea:We,contenteditable:Te},Ne.defineMode=function(e){!Ne.defaults.mode&&e!="null"&&(Ne.defaults.mode=e),Zc.apply(this,arguments)},Ne.defineMIME=Qc,Ne.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Ne.defineMIME("text/plain","null"),Ne.defineExtension=function(e,t){Ne.prototype[e]=t},Ne.defineDocExtension=function(e,t){xt.prototype[e]=t},Ne.fromTextArea=Yh,Zh(Ne),Ne.version="5.65.21",Ne})});var $u=at((Ju,Vu)=>{(function(o){typeof Ju=="object"&&typeof Vu=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,s=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,a=/[*+-]\s/;o.commands.newlineAndIndentContinueMarkdownList=function(h){if(h.getOption("disableInput"))return o.Pass;for(var c=h.listSelections(),d=[],v=0;v<c.length;v++){var y=c[v].head,x=h.getStateAfter(y.line),D=o.innerMode(h.getMode(),x);if(D.mode.name!=="markdown"&&D.mode.helperType!=="markdown"){h.execCommand("newlineAndIndent");return}else x=D.state;var k=x.list!==!1,F=x.quote!==0,B=h.getLine(y.line),L=l.exec(B),T=/^\s*$/.test(B.slice(0,y.ch));if(!c[v].empty()||!k&&!F||!L||T){h.execCommand("newlineAndIndent");return}if(s.test(B)){var N=F&&/>\s*$/.test(B),z=!/>\s*$/.test(B);(N||z)&&h.replaceRange("",{line:y.line,ch:0},{line:y.line,ch:y.ch+1}),d[v]=`
`}else{var O=L[1],I=L[5],W=!(a.test(L[2])||L[2].indexOf(">")>=0),G=W?parseInt(L[3],10)+1+L[4]:L[2].replace("x"," ");d[v]=`
`+O+G+I,W&&f(h,y)}}h.replaceSelections(d)};function f(h,c){var d=c.line,v=0,y=0,x=l.exec(h.getLine(d)),D=x[1];do{v+=1;var k=d+v,F=h.getLine(k),B=l.exec(F);if(B){var L=B[1],T=parseInt(x[3],10)+v-y,N=parseInt(B[3],10),z=N;if(D===L&&!isNaN(N))T===N&&(z=N+1),T>N&&(z=T+1),h.replaceRange(F.replace(l,L+z+B[4]+B[5]),{line:k,ch:0},{line:k,ch:F.length});else{if(D.length>L.length||D.length<L.length&&v===1)return;y+=1}}}while(B)}})});var tf=at(()=>{var ef=At();ef.commands.tabAndIndentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentMore");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}};ef.commands.shiftTabAndUnindentMarkdownList=function(o){var l=o.listSelections(),s=l[0].head,a=o.getStateAfter(s.line),f=a.list!==!1;if(f){o.execCommand("indentLess");return}if(o.options.indentWithTabs)o.execCommand("insertTab");else{var h=Array(o.options.tabSize+1).join(" ");o.replaceSelection(h)}}});var of=at((rf,nf)=>{(function(o){typeof rf=="object"&&typeof nf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("fullScreen",!1,function(a,f,h){h==o.Init&&(h=!1),!h!=!f&&(f?l(a):s(a))});function l(a){var f=a.getWrapperElement();a.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:f.style.width,height:f.style.height},f.style.width="",f.style.height="auto",f.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",a.refresh()}function s(a){var f=a.getWrapperElement();f.className=f.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var h=a.state.fullScreenRestore;f.style.width=h.width,f.style.height=h.height,window.scrollTo(h.scrollLeft,h.scrollTop),a.refresh()}})});var al=at((af,lf)=>{(function(o){typeof af=="object"&&typeof lf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l={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},s={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1};o.defineMode("xml",function(a,f){var h=a.indentUnit,c={},d=f.htmlMode?l:s;for(var v in d)c[v]=d[v];for(var v in f)c[v]=f[v];var y,x;function D(E,q){function R(be){return q.tokenize=be,be(E,q)}var Q=E.next();if(Q=="<")return E.eat("!")?E.eat("[")?E.match("CDATA[")?R(B("atom","]]>")):null:E.match("--")?R(B("comment","-->")):E.match("DOCTYPE",!0,!0)?(E.eatWhile(/[\w\._\-]/),R(L(1))):null:E.eat("?")?(E.eatWhile(/[\w\._\-]/),q.tokenize=B("meta","?>"),"meta"):(y=E.eat("/")?"closeTag":"openTag",q.tokenize=k,"tag bracket");if(Q=="&"){var he;return E.eat("#")?E.eat("x")?he=E.eatWhile(/[a-fA-F\d]/)&&E.eat(";"):he=E.eatWhile(/[\d]/)&&E.eat(";"):he=E.eatWhile(/[\w\.\-:]/)&&E.eat(";"),he?"atom":"error"}else return E.eatWhile(/[^&<]/),null}D.isInText=!0;function k(E,q){var R=E.next();if(R==">"||R=="/"&&E.eat(">"))return q.tokenize=D,y=R==">"?"endTag":"selfcloseTag","tag bracket";if(R=="=")return y="equals",null;if(R=="<"){q.tokenize=D,q.state=I,q.tagName=q.tagStart=null;var Q=q.tokenize(E,q);return Q?Q+" tag error":"tag error"}else return/[\'\"]/.test(R)?(q.tokenize=F(R),q.stringStartCol=E.column(),q.tokenize(E,q)):(E.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function F(E){var q=function(R,Q){for(;!R.eol();)if(R.next()==E){Q.tokenize=k;break}return"string"};return q.isInAttribute=!0,q}function B(E,q){return function(R,Q){for(;!R.eol();){if(R.match(q)){Q.tokenize=D;break}R.next()}return E}}function L(E){return function(q,R){for(var Q;(Q=q.next())!=null;){if(Q=="<")return R.tokenize=L(E+1),R.tokenize(q,R);if(Q==">")if(E==1){R.tokenize=D;break}else return R.tokenize=L(E-1),R.tokenize(q,R)}return"meta"}}function T(E){return E&&E.toLowerCase()}function N(E,q,R){this.prev=E.context,this.tagName=q||"",this.indent=E.indented,this.startOfLine=R,(c.doNotIndent.hasOwnProperty(q)||E.context&&E.context.noIndent)&&(this.noIndent=!0)}function z(E){E.context&&(E.context=E.context.prev)}function O(E,q){for(var R;;){if(!E.context||(R=E.context.tagName,!c.contextGrabbers.hasOwnProperty(T(R))||!c.contextGrabbers[T(R)].hasOwnProperty(T(q))))return;z(E)}}function I(E,q,R){return E=="openTag"?(R.tagStart=q.column(),W):E=="closeTag"?G:I}function W(E,q,R){return E=="word"?(R.tagName=q.current(),x="tag",j):c.allowMissingTagName&&E=="endTag"?(x="tag bracket",j(E,q,R)):(x="error",W)}function G(E,q,R){if(E=="word"){var Q=q.current();return R.context&&R.context.tagName!=Q&&c.implicitlyClosed.hasOwnProperty(T(R.context.tagName))&&z(R),R.context&&R.context.tagName==Q||c.matchClosing===!1?(x="tag",X):(x="tag error",de)}else return c.allowMissingTagName&&E=="endTag"?(x="tag bracket",X(E,q,R)):(x="error",de)}function X(E,q,R){return E!="endTag"?(x="error",X):(z(R),I)}function de(E,q,R){return x="error",X(E,q,R)}function j(E,q,R){if(E=="word")return x="attribute",oe;if(E=="endTag"||E=="selfcloseTag"){var Q=R.tagName,he=R.tagStart;return R.tagName=R.tagStart=null,E=="selfcloseTag"||c.autoSelfClosers.hasOwnProperty(T(Q))?O(R,Q):(O(R,Q),R.context=new N(R,Q,he==R.indented)),I}return x="error",j}function oe(E,q,R){return E=="equals"?H:(c.allowMissing||(x="error"),j(E,q,R))}function H(E,q,R){return E=="string"?Y:E=="word"&&c.allowUnquoted?(x="string",j):(x="error",j(E,q,R))}function Y(E,q,R){return E=="string"?Y:j(E,q,R)}return{startState:function(E){var q={tokenize:D,state:I,indented:E||0,tagName:null,tagStart:null,context:null};return E!=null&&(q.baseIndent=E),q},token:function(E,q){if(!q.tagName&&E.sol()&&(q.indented=E.indentation()),E.eatSpace())return null;y=null;var R=q.tokenize(E,q);return(R||y)&&R!="comment"&&(x=null,q.state=q.state(y||R,E,q),x&&(R=x=="error"?R+" error":x)),R},indent:function(E,q,R){var Q=E.context;if(E.tokenize.isInAttribute)return E.tagStart==E.indented?E.stringStartCol+1:E.indented+h;if(Q&&Q.noIndent)return o.Pass;if(E.tokenize!=k&&E.tokenize!=D)return R?R.match(/^(\s*)/)[0].length:0;if(E.tagName)return c.multilineTagIndentPastTag!==!1?E.tagStart+E.tagName.length+2:E.tagStart+h*(c.multilineTagIndentFactor||1);if(c.alignCDATA&&/<!\[CDATA\[/.test(q))return 0;var he=q&&/^<(\/)?([\w_:\.-]*)/.exec(q);if(he&&he[1])for(;Q;)if(Q.tagName==he[2]){Q=Q.prev;break}else if(c.implicitlyClosed.hasOwnProperty(T(Q.tagName)))Q=Q.prev;else break;else if(he)for(;Q;){var be=c.contextGrabbers[T(Q.tagName)];if(be&&be.hasOwnProperty(T(he[2])))Q=Q.prev;else break}for(;Q&&Q.prev&&!Q.startOfLine;)Q=Q.prev;return Q?Q.indent+h:E.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:c.htmlMode?"html":"xml",helperType:c.htmlMode?"html":"xml",skipAttribute:function(E){E.state==H&&(E.state=j)},xmlCurrentTag:function(E){return E.tagName?{name:E.tagName,close:E.type=="closeTag"}:null},xmlCurrentContext:function(E){for(var q=[],R=E.context;R;R=R.prev)q.push(R.tagName);return q.reverse()}}}),o.defineMIME("text/xml","xml"),o.defineMIME("application/xml","xml"),o.mimeModes.hasOwnProperty("text/html")||o.defineMIME("text/html",{name:"xml",htmlMode:!0})})});var ff=at((sf,uf)=>{(function(o){typeof sf=="object"&&typeof uf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.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 l=0;l<o.modeInfo.length;l++){var s=o.modeInfo[l];s.mimes&&(s.mime=s.mimes[0])}o.findModeByMIME=function(a){a=a.toLowerCase();for(var f=0;f<o.modeInfo.length;f++){var h=o.modeInfo[f];if(h.mime==a)return h;if(h.mimes){for(var c=0;c<h.mimes.length;c++)if(h.mimes[c]==a)return h}}if(/\+xml$/.test(a))return o.findModeByMIME("application/xml");if(/\+json$/.test(a))return o.findModeByMIME("application/json")},o.findModeByExtension=function(a){a=a.toLowerCase();for(var f=0;f<o.modeInfo.length;f++){var h=o.modeInfo[f];if(h.ext){for(var c=0;c<h.ext.length;c++)if(h.ext[c]==a)return h}}},o.findModeByFileName=function(a){for(var f=0;f<o.modeInfo.length;f++){var h=o.modeInfo[f];if(h.file&&h.file.test(a))return h}var c=a.lastIndexOf("."),d=c>-1&&a.substring(c+1,a.length);if(d)return o.findModeByExtension(d)},o.findModeByName=function(a){a=a.toLowerCase();for(var f=0;f<o.modeInfo.length;f++){var h=o.modeInfo[f];if(h.name.toLowerCase()==a)return h;if(h.alias){for(var c=0;c<h.alias.length;c++)if(h.alias[c].toLowerCase()==a)return h}}}})});var ll=at((cf,df)=>{(function(o){typeof cf=="object"&&typeof df=="object"?o(At(),al(),ff()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],o):o(CodeMirror)})(function(o){"use strict";o.defineMode("markdown",function(l,s){var a=o.getMode(l,"text/html"),f=a.name=="null";function h(A){if(o.findModeByName){var w=o.findModeByName(A);w&&(A=w.mime||w.mimes[0])}var te=o.getMode(l,A);return te.name=="null"?null:te}s.highlightFormatting===void 0&&(s.highlightFormatting=!1),s.maxBlockquoteDepth===void 0&&(s.maxBlockquoteDepth=0),s.taskLists===void 0&&(s.taskLists=!1),s.strikethrough===void 0&&(s.strikethrough=!1),s.emoji===void 0&&(s.emoji=!1),s.fencedCodeBlockHighlighting===void 0&&(s.fencedCodeBlockHighlighting=!0),s.fencedCodeBlockDefaultMode===void 0&&(s.fencedCodeBlockDefaultMode="text/plain"),s.xml===void 0&&(s.xml=!0),s.tokenTypeOverrides===void 0&&(s.tokenTypeOverrides={});var c={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 d in c)c.hasOwnProperty(d)&&s.tokenTypeOverrides[d]&&(c[d]=s.tokenTypeOverrides[d]);var v=/^([*\-_])(?:\s*\1){2,}\s*$/,y=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,D=s.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,k=/^ {0,3}(?:\={1,}|-{2,})\s*$/,F=/^[^#!\[\]*_\\<>` "'(~:]+/,B=/^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/,L=/^\s*\[[^\]]+?\]:.*$/,T=/[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\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]/,N=" ";function z(A,w,te){return w.f=w.inline=te,te(A,w)}function O(A,w,te){return w.f=w.block=te,te(A,w)}function I(A){return!A||!/\S/.test(A.string)}function W(A){if(A.linkTitle=!1,A.linkHref=!1,A.linkText=!1,A.em=!1,A.strong=!1,A.strikethrough=!1,A.quote=0,A.indentedCode=!1,A.f==X){var w=f;if(!w){var te=o.innerMode(a,A.htmlState);w=te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText}w&&(A.f=H,A.block=G,A.htmlState=null)}return A.trailingSpace=0,A.trailingSpaceNewLine=!1,A.prevLine=A.thisLine,A.thisLine={stream:null},null}function G(A,w){var te=A.column()===w.indentation,Ce=I(w.prevLine.stream),xe=w.indentedCode,mt=w.prevLine.hr,Lt=w.list!==!1,Ye=(w.listStack[w.listStack.length-1]||0)+3;w.indentedCode=!1;var ct=w.indentation;if(w.indentationDiff===null&&(w.indentationDiff=w.indentation,Lt)){for(w.list=null;ct<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=ct-w.listStack[w.listStack.length-1])}var ze=!Ce&&!mt&&!w.prevLine.header&&(!Lt||!xe)&&!w.prevLine.fencedCodeEnd,Pe=(w.list===!1||mt||Ce)&&w.indentation<=Ye&&A.match(v),Ze=null;if(w.indentationDiff>=4&&(xe||w.prevLine.fencedCodeEnd||w.prevLine.header||Ce))return A.skipToEnd(),w.indentedCode=!0,c.code;if(A.eatSpace())return null;if(te&&w.indentation<=Ye&&(Ze=A.match(D))&&Ze[1].length<=6)return w.quote=0,w.header=Ze[1].length,w.thisLine.header=!0,s.highlightFormatting&&(w.formatting="header"),w.f=w.inline,j(w);if(w.indentation<=Ye&&A.eat(">"))return w.quote=te?1:w.quote+1,s.highlightFormatting&&(w.formatting="quote"),A.eatSpace(),j(w);if(!Pe&&!w.setext&&te&&w.indentation<=Ye&&(Ze=A.match(y))){var vt=Ze[1]?"ol":"ul";return w.indentation=ct+A.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,s.taskLists&&A.match(x,!1)&&(w.taskList=!0),w.f=w.inline,s.highlightFormatting&&(w.formatting=["list","list-"+vt]),j(w)}else{if(te&&w.indentation<=Ye&&(Ze=A.match(B,!0)))return w.quote=0,w.fencedEndRE=new RegExp(Ze[1]+"+ *$"),w.localMode=s.fencedCodeBlockHighlighting&&h(Ze[2]||s.fencedCodeBlockDefaultMode),w.localMode&&(w.localState=o.startState(w.localMode)),w.f=w.block=de,s.highlightFormatting&&(w.formatting="code-block"),w.code=-1,j(w);if(w.setext||(!ze||!Lt)&&!w.quote&&w.list===!1&&!w.code&&!Pe&&!L.test(A.string)&&(Ze=A.lookAhead(1))&&(Ze=Ze.match(k)))return w.setext?(w.header=w.setext,w.setext=0,A.skipToEnd(),s.highlightFormatting&&(w.formatting="header")):(w.header=Ze[0].charAt(0)=="="?1:2,w.setext=w.header),w.thisLine.header=!0,w.f=w.inline,j(w);if(Pe)return A.skipToEnd(),w.hr=!0,w.thisLine.hr=!0,c.hr;if(A.peek()==="[")return z(A,w,Q)}return z(A,w,w.inline)}function X(A,w){var te=a.token(A,w.htmlState);if(!f){var Ce=o.innerMode(a,w.htmlState);(Ce.mode.name=="xml"&&Ce.state.tagStart===null&&!Ce.state.context&&Ce.state.tokenize.isInText||w.md_inside&&A.current().indexOf(">")>-1)&&(w.f=H,w.block=G,w.htmlState=null)}return te}function de(A,w){var te=w.listStack[w.listStack.length-1]||0,Ce=w.indentation<te,xe=te+3;if(w.fencedEndRE&&w.indentation<=xe&&(Ce||A.match(w.fencedEndRE))){s.highlightFormatting&&(w.formatting="code-block");var mt;return Ce||(mt=j(w)),w.localMode=w.localState=null,w.block=G,w.f=H,w.fencedEndRE=null,w.code=0,w.thisLine.fencedCodeEnd=!0,Ce?O(A,w,w.block):mt}else return w.localMode?w.localMode.token(A,w.localState):(A.skipToEnd(),c.code)}function j(A){var w=[];if(A.formatting){w.push(c.formatting),typeof A.formatting=="string"&&(A.formatting=[A.formatting]);for(var te=0;te<A.formatting.length;te++)w.push(c.formatting+"-"+A.formatting[te]),A.formatting[te]==="header"&&w.push(c.formatting+"-"+A.formatting[te]+"-"+A.header),A.formatting[te]==="quote"&&(!s.maxBlockquoteDepth||s.maxBlockquoteDepth>=A.quote?w.push(c.formatting+"-"+A.formatting[te]+"-"+A.quote):w.push("error"))}if(A.taskOpen)return w.push("meta"),w.length?w.join(" "):null;if(A.taskClosed)return w.push("property"),w.length?w.join(" "):null;if(A.linkHref?w.push(c.linkHref,"url"):(A.strong&&w.push(c.strong),A.em&&w.push(c.em),A.strikethrough&&w.push(c.strikethrough),A.emoji&&w.push(c.emoji),A.linkText&&w.push(c.linkText),A.code&&w.push(c.code),A.image&&w.push(c.image),A.imageAltText&&w.push(c.imageAltText,"link"),A.imageMarker&&w.push(c.imageMarker)),A.header&&w.push(c.header,c.header+"-"+A.header),A.quote&&(w.push(c.quote),!s.maxBlockquoteDepth||s.maxBlockquoteDepth>=A.quote?w.push(c.quote+"-"+A.quote):w.push(c.quote+"-"+s.maxBlockquoteDepth)),A.list!==!1){var Ce=(A.listStack.length-1)%3;Ce?Ce===1?w.push(c.list2):w.push(c.list3):w.push(c.list1)}return A.trailingSpaceNewLine?w.push("trailing-space-new-line"):A.trailingSpace&&w.push("trailing-space-"+(A.trailingSpace%2?"a":"b")),w.length?w.join(" "):null}function oe(A,w){if(A.match(F,!0))return j(w)}function H(A,w){var te=w.text(A,w);if(typeof te<"u")return te;if(w.list)return w.list=null,j(w);if(w.taskList){var Ce=A.match(x,!0)[1]===" ";return Ce?w.taskOpen=!0:w.taskClosed=!0,s.highlightFormatting&&(w.formatting="task"),w.taskList=!1,j(w)}if(w.taskOpen=!1,w.taskClosed=!1,w.header&&A.match(/^#+$/,!0))return s.highlightFormatting&&(w.formatting="header"),j(w);var xe=A.next();if(w.linkTitle){w.linkTitle=!1;var mt=xe;xe==="("&&(mt=")"),mt=(mt+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Lt="^\\s*(?:[^"+mt+"\\\\]+|\\\\\\\\|\\\\.)"+mt;if(A.match(new RegExp(Lt),!0))return c.linkHref}if(xe==="`"){var Ye=w.formatting;s.highlightFormatting&&(w.formatting="code"),A.eatWhile("`");var ct=A.current().length;if(w.code==0&&(!w.quote||ct==1))return w.code=ct,j(w);if(ct==w.code){var ze=j(w);return w.code=0,ze}else return w.formatting=Ye,j(w)}else if(w.code)return j(w);if(xe==="\\"&&(A.next(),s.highlightFormatting)){var Pe=j(w),Ze=c.formatting+"-escape";return Pe?Pe+" "+Ze:Ze}if(xe==="!"&&A.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return w.imageMarker=!0,w.image=!0,s.highlightFormatting&&(w.formatting="image"),j(w);if(xe==="["&&w.imageMarker&&A.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return w.imageMarker=!1,w.imageAltText=!0,s.highlightFormatting&&(w.formatting="image"),j(w);if(xe==="]"&&w.imageAltText){s.highlightFormatting&&(w.formatting="image");var Pe=j(w);return w.imageAltText=!1,w.image=!1,w.inline=w.f=E,Pe}if(xe==="["&&!w.image)return w.linkText&&A.match(/^.*?\]/)||(w.linkText=!0,s.highlightFormatting&&(w.formatting="link")),j(w);if(xe==="]"&&w.linkText){s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return w.linkText=!1,w.inline=w.f=A.match(/\(.*?\)| ?\[.*?\]/,!1)?E:H,Pe}if(xe==="<"&&A.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Y,s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return Pe?Pe+=" ":Pe="",Pe+c.linkInline}if(xe==="<"&&A.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){w.f=w.inline=Y,s.highlightFormatting&&(w.formatting="link");var Pe=j(w);return Pe?Pe+=" ":Pe="",Pe+c.linkEmail}if(s.xml&&xe==="<"&&A.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var vt=A.string.indexOf(">",A.pos);if(vt!=-1){var Fi=A.string.substring(A.start,vt);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Fi)&&(w.md_inside=!0)}return A.backUp(1),w.htmlState=o.startState(a),O(A,w,X)}if(s.xml&&xe==="<"&&A.match(/^\/\w*?>/))return w.md_inside=!1,"tag";if(xe==="*"||xe==="_"){for(var Xt=1,Kt=A.pos==1?" ":A.string.charAt(A.pos-2);Xt<3&&A.eat(xe);)Xt++;var Ht=A.peek()||" ",pr=!/\s/.test(Ht)&&(!T.test(Ht)||/\s/.test(Kt)||T.test(Kt)),De=!/\s/.test(Kt)&&(!T.test(Kt)||/\s/.test(Ht)||T.test(Ht)),Pt=null,gr=null;if(Xt%2&&(!w.em&&pr&&(xe==="*"||!De||T.test(Kt))?Pt=!0:w.em==xe&&De&&(xe==="*"||!pr||T.test(Ht))&&(Pt=!1)),Xt>1&&(!w.strong&&pr&&(xe==="*"||!De||T.test(Kt))?gr=!0:w.strong==xe&&De&&(xe==="*"||!pr||T.test(Ht))&&(gr=!1)),gr!=null||Pt!=null){s.highlightFormatting&&(w.formatting=Pt==null?"strong":gr==null?"em":"strong em"),Pt===!0&&(w.em=xe),gr===!0&&(w.strong=xe);var ze=j(w);return Pt===!1&&(w.em=!1),gr===!1&&(w.strong=!1),ze}}else if(xe===" "&&(A.eat("*")||A.eat("_"))){if(A.peek()===" ")return j(w);A.backUp(1)}if(s.strikethrough){if(xe==="~"&&A.eatWhile(xe)){if(w.strikethrough){s.highlightFormatting&&(w.formatting="strikethrough");var ze=j(w);return w.strikethrough=!1,ze}else if(A.match(/^[^\s]/,!1))return w.strikethrough=!0,s.highlightFormatting&&(w.formatting="strikethrough"),j(w)}else if(xe===" "&&A.match("~~",!0)){if(A.peek()===" ")return j(w);A.backUp(2)}}if(s.emoji&&xe===":"&&A.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){w.emoji=!0,s.highlightFormatting&&(w.formatting="emoji");var Cn=j(w);return w.emoji=!1,Cn}return xe===" "&&(A.match(/^ +$/,!1)?w.trailingSpace++:w.trailingSpace&&(w.trailingSpaceNewLine=!0)),j(w)}function Y(A,w){var te=A.next();if(te===">"){w.f=w.inline=H,s.highlightFormatting&&(w.formatting="link");var Ce=j(w);return Ce?Ce+=" ":Ce="",Ce+c.linkInline}return A.match(/^[^>]+/,!0),c.linkInline}function E(A,w){if(A.eatSpace())return null;var te=A.next();return te==="("||te==="["?(w.f=w.inline=R(te==="("?")":"]"),s.highlightFormatting&&(w.formatting="link-string"),w.linkHref=!0,j(w)):"error"}var q={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function R(A){return function(w,te){var Ce=w.next();if(Ce===A){te.f=te.inline=H,s.highlightFormatting&&(te.formatting="link-string");var xe=j(te);return te.linkHref=!1,xe}return w.match(q[A]),te.linkHref=!0,j(te)}}function Q(A,w){return A.match(/^([^\]\\]|\\.)*\]:/,!1)?(w.f=he,A.next(),s.highlightFormatting&&(w.formatting="link"),w.linkText=!0,j(w)):z(A,w,H)}function he(A,w){if(A.match("]:",!0)){w.f=w.inline=be,s.highlightFormatting&&(w.formatting="link");var te=j(w);return w.linkText=!1,te}return A.match(/^([^\]\\]|\\.)+/,!0),c.linkText}function be(A,w){return A.eatSpace()?null:(A.match(/^[^\s]+/,!0),A.peek()===void 0?w.linkTitle=!0:A.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),w.f=w.inline=H,c.linkHref+" url")}var Ee={startState:function(){return{f:G,prevLine:{stream:null},thisLine:{stream:null},block:G,htmlState:null,indentation:0,inline:H,text:oe,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(A){return{f:A.f,prevLine:A.prevLine,thisLine:A.thisLine,block:A.block,htmlState:A.htmlState&&o.copyState(a,A.htmlState),indentation:A.indentation,localMode:A.localMode,localState:A.localMode?o.copyState(A.localMode,A.localState):null,inline:A.inline,text:A.text,formatting:!1,linkText:A.linkText,linkTitle:A.linkTitle,linkHref:A.linkHref,code:A.code,em:A.em,strong:A.strong,strikethrough:A.strikethrough,emoji:A.emoji,header:A.header,setext:A.setext,hr:A.hr,taskList:A.taskList,list:A.list,listStack:A.listStack.slice(0),quote:A.quote,indentedCode:A.indentedCode,trailingSpace:A.trailingSpace,trailingSpaceNewLine:A.trailingSpaceNewLine,md_inside:A.md_inside,fencedEndRE:A.fencedEndRE}},token:function(A,w){if(w.formatting=!1,A!=w.thisLine.stream){if(w.header=0,w.hr=!1,A.match(/^\s*$/,!0))return W(w),null;if(w.prevLine=w.thisLine,w.thisLine={stream:A},w.taskList=!1,w.trailingSpace=0,w.trailingSpaceNewLine=!1,!w.localState&&(w.f=w.block,w.f!=X)){var te=A.match(/^\s*/,!0)[0].replace(/\t/g,N).length;if(w.indentation=te,w.indentationDiff=null,te>0)return null}}return w.f(A,w)},innerMode:function(A){return A.block==X?{state:A.htmlState,mode:a}:A.localState?{state:A.localState,mode:A.localMode}:{state:A,mode:Ee}},indent:function(A,w,te){return A.block==X&&a.indent?a.indent(A.htmlState,w,te):A.localState&&A.localMode.indent?A.localMode.indent(A.localState,w,te):o.Pass},blankLine:W,getType:j,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Ee},"xml"),o.defineMIME("text/markdown","markdown"),o.defineMIME("text/x-markdown","markdown")})});var sl=at((hf,pf)=>{(function(o){typeof hf=="object"&&typeof pf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.overlayMode=function(l,s,a){return{startState:function(){return{base:o.startState(l),overlay:o.startState(s),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(f){return{base:o.copyState(l,f.base),overlay:o.copyState(s,f.overlay),basePos:f.basePos,baseCur:null,overlayPos:f.overlayPos,overlayCur:null}},token:function(f,h){return(f!=h.streamSeen||Math.min(h.basePos,h.overlayPos)<f.start)&&(h.streamSeen=f,h.basePos=h.overlayPos=f.start),f.start==h.basePos&&(h.baseCur=l.token(f,h.base),h.basePos=f.pos),f.start==h.overlayPos&&(f.pos=f.start,h.overlayCur=s.token(f,h.overlay),h.overlayPos=f.pos),f.pos=Math.min(h.basePos,h.overlayPos),h.overlayCur==null?h.baseCur:h.baseCur!=null&&h.overlay.combineTokens||a&&h.overlay.combineTokens==null?h.baseCur+" "+h.overlayCur:h.overlayCur},indent:l.indent&&function(f,h,c){return l.indent(f.base,h,c)},electricChars:l.electricChars,innerMode:function(f){return{state:f.base,mode:l}},blankLine:function(f){var h,c;return l.blankLine&&(h=l.blankLine(f.base)),s.blankLine&&(c=s.blankLine(f.overlay)),c==null?h:a&&h!=null?h+" "+c:c}}}})});var vf=at((gf,mf)=>{(function(o){typeof gf=="object"&&typeof mf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){o.defineOption("placeholder","",function(d,v,y){var x=y&&y!=o.Init;if(v&&!x)d.on("blur",f),d.on("change",h),d.on("swapDoc",h),o.on(d.getInputField(),"compositionupdate",d.state.placeholderCompose=function(){a(d)}),h(d);else if(!v&&x){d.off("blur",f),d.off("change",h),d.off("swapDoc",h),o.off(d.getInputField(),"compositionupdate",d.state.placeholderCompose),l(d);var D=d.getWrapperElement();D.className=D.className.replace(" CodeMirror-empty","")}v&&!d.hasFocus()&&f(d)});function l(d){d.state.placeholder&&(d.state.placeholder.parentNode.removeChild(d.state.placeholder),d.state.placeholder=null)}function s(d){l(d);var v=d.state.placeholder=document.createElement("pre");v.style.cssText="height: 0; overflow: visible",v.style.direction=d.getOption("direction"),v.className="CodeMirror-placeholder CodeMirror-line-like";var y=d.getOption("placeholder");typeof y=="string"&&(y=document.createTextNode(y)),v.appendChild(y),d.display.lineSpace.insertBefore(v,d.display.lineSpace.firstChild)}function a(d){setTimeout(function(){var v=!1;if(d.lineCount()==1){var y=d.getInputField();v=y.nodeName=="TEXTAREA"?!d.getLine(0).length:!/[^\u200b]/.test(y.querySelector(".CodeMirror-line").textContent)}v?s(d):l(d)},20)}function f(d){c(d)&&s(d)}function h(d){var v=d.getWrapperElement(),y=c(d);v.className=v.className.replace(" CodeMirror-empty","")+(y?" CodeMirror-empty":""),y?s(d):l(d)}function c(d){return d.lineCount()===1&&d.getLine(0)===""}})});var xf=at((bf,yf)=>{(function(o){typeof bf=="object"&&typeof yf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("autoRefresh",!1,function(a,f){a.state.autoRefresh&&(s(a,a.state.autoRefresh),a.state.autoRefresh=null),f&&a.display.wrapper.offsetHeight==0&&l(a,a.state.autoRefresh={delay:f.delay||250})});function l(a,f){function h(){a.display.wrapper.offsetHeight?(s(a,f),a.display.lastWrapHeight!=a.display.wrapper.clientHeight&&a.refresh()):f.timeout=setTimeout(h,f.delay)}f.timeout=setTimeout(h,f.delay),f.hurry=function(){clearTimeout(f.timeout),f.timeout=setTimeout(h,50)},o.on(window,"mouseup",f.hurry),o.on(window,"keyup",f.hurry)}function s(a,f){clearTimeout(f.timeout),o.off(window,"mouseup",f.hurry),o.off(window,"keyup",f.hurry)}})});var Df=at((wf,Cf)=>{(function(o){typeof wf=="object"&&typeof Cf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("styleSelectedText",!1,function(x,D,k){var F=k&&k!=o.Init;D&&!F?(x.state.markedSelection=[],x.state.markedSelectionStyle=typeof D=="string"?D:"CodeMirror-selectedtext",v(x),x.on("cursorActivity",l),x.on("change",s)):!D&&F&&(x.off("cursorActivity",l),x.off("change",s),d(x),x.state.markedSelection=x.state.markedSelectionStyle=null)});function l(x){x.state.markedSelection&&x.operation(function(){y(x)})}function s(x){x.state.markedSelection&&x.state.markedSelection.length&&x.operation(function(){d(x)})}var a=8,f=o.Pos,h=o.cmpPos;function c(x,D,k,F){if(h(D,k)!=0)for(var B=x.state.markedSelection,L=x.state.markedSelectionStyle,T=D.line;;){var N=T==D.line?D:f(T,0),z=T+a,O=z>=k.line,I=O?k:f(z,0),W=x.markText(N,I,{className:L});if(F==null?B.push(W):B.splice(F++,0,W),O)break;T=z}}function d(x){for(var D=x.state.markedSelection,k=0;k<D.length;++k)D[k].clear();D.length=0}function v(x){d(x);for(var D=x.listSelections(),k=0;k<D.length;k++)c(x,D[k].from(),D[k].to())}function y(x){if(!x.somethingSelected())return d(x);if(x.listSelections().length>1)return v(x);var D=x.getCursor("start"),k=x.getCursor("end"),F=x.state.markedSelection;if(!F.length)return c(x,D,k);var B=F[0].find(),L=F[F.length-1].find();if(!B||!L||k.line-D.line<=a||h(D,L.to)>=0||h(k,B.from)<=0)return v(x);for(;h(D,B.from)>0;)F.shift().clear(),B=F[0].find();for(h(D,B.from)<0&&(B.to.line-D.line<a?(F.shift().clear(),c(x,D,B.to,0)):c(x,D,B.from,0));h(k,L.to)<0;)F.pop().clear(),L=F[F.length-1].find();h(k,L.to)>0&&(k.line-L.from.line<a?(F.pop().clear(),c(x,L.from,k)):c(x,L.to,k))}})});var Ef=at((kf,Sf)=>{(function(o){typeof kf=="object"&&typeof Sf=="object"?o(At()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=o.Pos;function s(T){var N=T.flags;return N??(T.ignoreCase?"i":"")+(T.global?"g":"")+(T.multiline?"m":"")}function a(T,N){for(var z=s(T),O=z,I=0;I<N.length;I++)O.indexOf(N.charAt(I))==-1&&(O+=N.charAt(I));return z==O?T:new RegExp(T.source,O)}function f(T){return/\\s|\\n|\n|\\W|\\D|\[\^/.test(T.source)}function h(T,N,z){N=a(N,"g");for(var O=z.line,I=z.ch,W=T.lastLine();O<=W;O++,I=0){N.lastIndex=I;var G=T.getLine(O),X=N.exec(G);if(X)return{from:l(O,X.index),to:l(O,X.index+X[0].length),match:X}}}function c(T,N,z){if(!f(N))return h(T,N,z);N=a(N,"gm");for(var O,I=1,W=z.line,G=T.lastLine();W<=G;){for(var X=0;X<I&&!(W>G);X++){var de=T.getLine(W++);O=O==null?de:O+`
`+de}I=I*2,N.lastIndex=z.ch;var j=N.exec(O);if(j){var oe=O.slice(0,j.index).split(`
`),H=j[0].split(`
`),Y=z.line+oe.length-1,E=oe[oe.length-1].length;return{from:l(Y,E),to:l(Y+H.length-1,H.length==1?E+H[0].length:H[H.length-1].length),match:j}}}}function d(T,N,z){for(var O,I=0;I<=T.length;){N.lastIndex=I;var W=N.exec(T);if(!W)break;var G=W.index+W[0].length;if(G>T.length-z)break;(!O||G>O.index+O[0].length)&&(O=W),I=W.index+1}return O}function v(T,N,z){N=a(N,"g");for(var O=z.line,I=z.ch,W=T.firstLine();O>=W;O--,I=-1){var G=T.getLine(O),X=d(G,N,I<0?0:G.length-I);if(X)return{from:l(O,X.index),to:l(O,X.index+X[0].length),match:X}}}function y(T,N,z){if(!f(N))return v(T,N,z);N=a(N,"gm");for(var O,I=1,W=T.getLine(z.line).length-z.ch,G=z.line,X=T.firstLine();G>=X;){for(var de=0;de<I&&G>=X;de++){var j=T.getLine(G--);O=O==null?j:j+`
`+O}I*=2;var oe=d(O,N,W);if(oe){var H=O.slice(0,oe.index).split(`
`),Y=oe[0].split(`
`),E=G+H.length,q=H[H.length-1].length;return{from:l(E,q),to:l(E+Y.length-1,Y.length==1?q+Y[0].length:Y[Y.length-1].length),match:oe}}}}var x,D;String.prototype.normalize?(x=function(T){return T.normalize("NFD").toLowerCase()},D=function(T){return T.normalize("NFD")}):(x=function(T){return T.toLowerCase()},D=function(T){return T});function k(T,N,z,O){if(T.length==N.length)return z;for(var I=0,W=z+Math.max(0,T.length-N.length);;){if(I==W)return I;var G=I+W>>1,X=O(T.slice(0,G)).length;if(X==z)return G;X>z?W=G:I=G+1}}function F(T,N,z,O){if(!N.length)return null;var I=O?x:D,W=I(N).split(/\r|\n\r?/);e:for(var G=z.line,X=z.ch,de=T.lastLine()+1-W.length;G<=de;G++,X=0){var j=T.getLine(G).slice(X),oe=I(j);if(W.length==1){var H=oe.indexOf(W[0]);if(H==-1)continue e;var z=k(j,oe,H,I)+X;return{from:l(G,k(j,oe,H,I)+X),to:l(G,k(j,oe,H+W[0].length,I)+X)}}else{var Y=oe.length-W[0].length;if(oe.slice(Y)!=W[0])continue e;for(var E=1;E<W.length-1;E++)if(I(T.getLine(G+E))!=W[E])continue e;var q=T.getLine(G+W.length-1),R=I(q),Q=W[W.length-1];if(R.slice(0,Q.length)!=Q)continue e;return{from:l(G,k(j,oe,Y,I)+X),to:l(G+W.length-1,k(q,R,Q.length,I))}}}}function B(T,N,z,O){if(!N.length)return null;var I=O?x:D,W=I(N).split(/\r|\n\r?/);e:for(var G=z.line,X=z.ch,de=T.firstLine()-1+W.length;G>=de;G--,X=-1){var j=T.getLine(G);X>-1&&(j=j.slice(0,X));var oe=I(j);if(W.length==1){var H=oe.lastIndexOf(W[0]);if(H==-1)continue e;return{from:l(G,k(j,oe,H,I)),to:l(G,k(j,oe,H+W[0].length,I))}}else{var Y=W[W.length-1];if(oe.slice(0,Y.length)!=Y)continue e;for(var E=1,z=G-W.length+1;E<W.length-1;E++)if(I(T.getLine(z+E))!=W[E])continue e;var q=T.getLine(G+1-W.length),R=I(q);if(R.slice(R.length-W[0].length)!=W[0])continue e;return{from:l(G+1-W.length,k(q,R,q.length-W[0].length,I)),to:l(G,k(j,oe,Y.length,I))}}}}function L(T,N,z,O){this.atOccurrence=!1,this.afterEmptyMatch=!1,this.doc=T,z=z?T.clipPos(z):l(0,0),this.pos={from:z,to:z};var I;typeof O=="object"?I=O.caseFold:(I=O,O=null),typeof N=="string"?(I==null&&(I=!1),this.matches=function(W,G){return(W?B:F)(T,N,G,I)}):(N=a(N,"gm"),!O||O.multiline!==!1?this.matches=function(W,G){return(W?y:c)(T,N,G)}:this.matches=function(W,G){return(W?v:h)(T,N,G)})}L.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(T){var N=this.doc.clipPos(T?this.pos.from:this.pos.to);if(this.afterEmptyMatch&&this.atOccurrence&&(N=l(N.line,N.ch),T?(N.ch--,N.ch<0&&(N.line--,N.ch=(this.doc.getLine(N.line)||"").length)):(N.ch++,N.ch>(this.doc.getLine(N.line)||"").length&&(N.ch=0,N.line++)),o.cmpPos(N,this.doc.clipPos(N))!=0))return this.atOccurrence=!1;var z=this.matches(T,N);if(this.afterEmptyMatch=z&&o.cmpPos(z.from,z.to)==0,z)return this.pos=z,this.atOccurrence=!0,this.pos.match||!0;var O=l(T?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:O,to:O},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(T,N){if(this.atOccurrence){var z=o.splitLines(T);this.doc.replaceRange(z,this.pos.from,this.pos.to,N),this.pos.to=l(this.pos.from.line+z.length-1,z[z.length-1].length+(z.length==1?this.pos.from.ch:0))}}},o.defineExtension("getSearchCursor",function(T,N,z){return new L(this.doc,T,N,z)}),o.defineDocExtension("getSearchCursor",function(T,N,z){return new L(this,T,N,z)}),o.defineExtension("selectMatches",function(T,N){for(var z=[],O=this.getSearchCursor(T,this.getCursor("from"),N);O.findNext()&&!(o.cmpPos(O.to(),this.getCursor("to"))>0);)z.push({anchor:O.from(),head:O.to()});z.length&&this.setSelections(z,0)})})});var Tf=at((Af,Ff)=>{(function(o){typeof Af=="object"&&typeof Ff=="object"?o(At(),ll(),sl()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],o):o(CodeMirror)})(function(o){"use strict";var l=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;o.defineMode("gfm",function(s,a){var f=0;function h(y){return y.code=!1,null}var c={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(y){return{code:y.code,codeBlock:y.codeBlock,ateSpace:y.ateSpace}},token:function(y,x){if(x.combineTokens=null,x.codeBlock)return y.match(/^```+/)?(x.codeBlock=!1,null):(y.skipToEnd(),null);if(y.sol()&&(x.code=!1),y.sol()&&y.match(/^```+/))return y.skipToEnd(),x.codeBlock=!0,null;if(y.peek()==="`"){y.next();var D=y.pos;y.eatWhile("`");var k=1+y.pos-D;return x.code?k===f&&(x.code=!1):(f=k,x.code=!0),null}else if(x.code)return y.next(),null;if(y.eatSpace())return x.ateSpace=!0,null;if((y.sol()||x.ateSpace)&&(x.ateSpace=!1,a.gitHubSpice!==!1)){if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return x.combineTokens=!0,"link";if(y.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return x.combineTokens=!0,"link"}return y.match(l)&&y.string.slice(y.start-2,y.start)!="]("&&(y.start==0||/\W/.test(y.string.charAt(y.start-1)))?(x.combineTokens=!0,"link"):(y.next(),null)},blankLine:h},d={taskLists:!0,strikethrough:!0,emoji:!0};for(var v in a)d[v]=a[v];return d.name="markdown",o.overlayMode(o.getMode(s,d),c)},"markdown"),o.defineMIME("text/x-gfm","gfm")})});var Lf=at(()=>{});var Mf=at((j0,fl)=>{var ul;(function(){"use strict";ul=function(o,l,s,a){a=a||{},this.dictionary=null,this.rules={},this.dictionaryTable=new Map,this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=a.flags||{},this.memoized={},this.loaded=!1;var f=this,h,c,d,v,y;o&&(f.dictionary=o,l&&s?F():(typeof window<"u"?(a.dictionaryPath?h=a.dictionaryPath:h="typo/dictionaries",window.chrome&&window.chrome.runtime&&window.chrome.runtime.getURL?h=window.chrome.runtime.getURL(h):window.browser&&window.browser.runtime&&window.browser.runtime.getURL&&(h=window.browser.runtime.getURL(h))):typeof __dirname<"u"?h=__dirname+"/dictionaries":h="./dictionaries",l||x(h+"/"+o+"/"+o+".aff",D),s||x(h+"/"+o+"/"+o+".dic",k)));function x(B,L){var T=f._readFile(B,null,a?.asyncLoad);a?.asyncLoad?T.then(function(N){L(N)}):L(T)}function D(B){l=B,s&&F()}function k(B){s=B,l&&F()}function F(){for(f.rules=f._parseAFF(l),f.compoundRuleCodes={},c=0,v=f.compoundRules.length;c<v;c++){var B=f.compoundRules[c];for(d=0,y=B.length;d<y;d++)f.compoundRuleCodes[B[d]]=[]}"ONLYINCOMPOUND"in f.flags&&(f.compoundRuleCodes[f.flags.ONLYINCOMPOUND]=[]),f.dictionaryTable=f._parseDIC(s);for(c in f.compoundRuleCodes)f.compoundRuleCodes[c].length===0&&delete f.compoundRuleCodes[c];for(c=0,v=f.compoundRules.length;c<v;c++){var L=f.compoundRules[c],T="";for(d=0,y=L.length;d<y;d++){var N=L[d];N in f.compoundRuleCodes?T+="("+f.compoundRuleCodes[N].join("|")+")":T+=N}f.compoundRules[c]=new RegExp("^"+T+"$","i")}f.loaded=!0,a?.asyncLoad&&a?.loadedCallback&&a.loadedCallback(f)}return this},ul.prototype={load:function(o){for(var l in o)o.hasOwnProperty(l)&&(this[l]=o[l]);return this},_readFile:function(o,l,s){var a;if(l=l||"utf8",typeof XMLHttpRequest<"u"){var f=new XMLHttpRequest;if(f.open("GET",o,!!s),(a=f.overrideMimeType)===null||a===void 0||a.call(f,"text/plain; charset="+l),s){var h=new Promise(function(d,v){f.onload=function(){f.status===200?d(f.responseText):v(f.statusText)},f.onerror=function(){v(f.statusText)}});return f.send(null),h}else return f.send(null),f.responseText}else if(typeof Qu<"u"){var c=Lf();try{if(c.existsSync(o))return c.readFileSync(o,l);console.log("Path "+o+" does not exist.")}catch(d){console.log(d)}return""}return""},_parseAFF:function(o){var l={},s,a,f,h,c,d,v,y,x=o.split(/\r?\n/);for(c=0,v=x.length;c<v;c++)if(s=this._removeAffixComments(x[c]),s=s.trim(),!!s){var D=s.split(/\s+/),k=D[0];if(k==="PFX"||k==="SFX"){var F=D[1],B=D[2];f=parseInt(D[3],10);var L=[];for(d=c+1,y=c+1+f;d<y;d++){a=x[d],h=a.split(/\s+/);var T=h[2],N=h[3].split("/"),z=N[0];z==="0"&&(z="");var O=this.parseRuleCodes(N[1]),I=h[4],W={add:z};O.length>0&&(W.continuationClasses=O),I!=="."&&(k==="SFX"?W.match=new RegExp(I+"$"):W.match=new RegExp("^"+I)),T!="0"&&(k==="SFX"?W.remove=new RegExp(T+"$"):W.remove=T),L.push(W)}l[F]={type:k,combineable:B==="Y",entries:L},c+=f}else if(k==="COMPOUNDRULE"){for(f=parseInt(D[1],10),d=c+1,y=c+1+f;d<y;d++)s=x[d],h=s.split(/\s+/),this.compoundRules.push(h[1]);c+=f}else k==="REP"?(h=s.split(/\s+/),h.length===3&&this.replacementTable.push([h[1],h[2]])):this.flags[k]=D[1]}return l},_removeAffixComments:function(o){return o.match(/^\s*#/)?"":o},_parseDIC:function(o){o=this._removeDicComments(o);var l=o.split(/\r?\n/),s=new Map;function a(oe,H){s.has(oe)||s.set(oe,null),H.length>0&&(s.get(oe)===null&&s.set(oe,[]),s.get(oe).push(H))}for(var f=1,h=l.length;f<h;f++){var c=l[f];if(c){var d=c.replace(/\s.*$/,""),v=d.split("/",2),y=v[0];if(v.length>1){var x=this.parseRuleCodes(v[1]);(!("NEEDAFFIX"in this.flags)||x.indexOf(this.flags.NEEDAFFIX)===-1)&&a(y,x);for(var D=0,k=x.length;D<k;D++){var F=x[D],B=this.rules[F];if(B)for(var L=this._applyRule(y,B),T=0,N=L.length;T<N;T++){var z=L[T];if(a(z,[]),B.combineable)for(var O=D+1;O<k;O++){var I=x[O],W=this.rules[I];if(W&&W.combineable&&B.type!=W.type)for(var G=this._applyRule(z,W),X=0,de=G.length;X<de;X++){var j=G[X];a(j,[])}}}F in this.compoundRuleCodes&&this.compoundRuleCodes[F].push(y)}}else a(y.trim(),[])}}return s},_removeDicComments:function(o){return o=o.replace(/^\t.*$/mg,""),o},parseRuleCodes:function(o){if(o)if("FLAG"in this.flags)if(this.flags.FLAG==="long"){for(var l=[],s=0,a=o.length;s<a;s+=2)l.push(o.substr(s,2));return l}else return this.flags.FLAG==="num"?o.split(","):this.flags.FLAG==="UTF-8"?Array.from(o):o.split("");else return o.split("");else return[]},_applyRule:function(o,l){for(var s=l.entries,a=[],f=0,h=s.length;f<h;f++){var c=s[f];if(!c.match||o.match(c.match)){var d=o;if(c.remove&&(d=d.replace(c.remove,"")),l.type==="SFX"?d=d+c.add:d=c.add+d,a.push(d),"continuationClasses"in c)for(var v=0,y=c.continuationClasses.length;v<y;v++){var x=this.rules[c.continuationClasses[v]];x&&(a=a.concat(this._applyRule(d,x)))}}}return a},check:function(o){if(!this.loaded)throw"Dictionary not loaded.";if(!o)return!1;var l=o.replace(/^\s\s*/,"").replace(/\s\s*$/,"");if(this.checkExact(l))return!0;if(l.toUpperCase()===l){var s=l[0]+l.substring(1).toLowerCase();if(this.hasFlag(s,"KEEPCASE"))return!1;if(this.checkExact(s)||this.checkExact(l.toLowerCase()))return!0}var a=l[0].toLowerCase()+l.substring(1);if(a!==l){if(this.hasFlag(a,"KEEPCASE"))return!1;if(this.checkExact(a))return!0}return!1},checkExact:function(o){if(!this.loaded)throw"Dictionary not loaded.";var l=this.dictionaryTable.get(o),s,a;if(typeof l>"u"){if("COMPOUNDMIN"in this.flags&&o.length>=this.flags.COMPOUNDMIN){for(s=0,a=this.compoundRules.length;s<a;s++)if(o.match(this.compoundRules[s]))return!0}}else{if(l===null)return!0;if(typeof l=="object"){for(s=0,a=l.length;s<a;s++)if(!this.hasFlag(o,"ONLYINCOMPOUND",l[s]))return!0}}return!1},hasFlag:function(o,l,s){if(!this.loaded)throw"Dictionary not loaded.";return!!(l in this.flags&&(typeof s>"u"&&(s=Array.prototype.concat.apply([],this.dictionaryTable.get(o))),s&&s.indexOf(this.flags[l])!==-1))},alphabet:"",suggest:function(o,l){if(!this.loaded)throw"Dictionary not loaded.";if(l=l||5,this.memoized.hasOwnProperty(o)){var s=this.memoized[o].limit;if(l<=s||this.memoized[o].suggestions.length<s)return this.memoized[o].suggestions.slice(0,l)}if(this.check(o))return[];for(var a=0,f=this.replacementTable.length;a<f;a++){var h=this.replacementTable[a];if(o.indexOf(h[0])!==-1){var c=o.replace(h[0],h[1]);if(this.check(c))return[c]}}if(!this.alphabet){this.alphabet="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ","TRY"in this.flags&&(this.alphabet+=this.flags.TRY),"WORDCHARS"in this.flags&&(this.alphabet+=this.flags.WORDCHARS);var d=this.alphabet.split("");d.sort();for(var v={},a=0;a<d.length;a++)v[d[a]]=!0;this.alphabet="";for(var a in v)this.alphabet+=a}var y=this;function x(k,F){var B={},L,T,N,z,O,I,W=y.alphabet.length;for(var G in k)for(L=0,z=G.length+1;L<z;L++){var X=[G.substring(0,L),G.substring(L)];if(X[1]&&(I=X[0]+X[1].substring(1),(!F||y.check(I))&&(I in B?B[I]+=1:B[I]=1)),X[1].length>1&&X[1][1]!==X[1][0]&&(I=X[0]+X[1][1]+X[1][0]+X[1].substring(2),(!F||y.check(I))&&(I in B?B[I]+=1:B[I]=1)),X[1]){var de=X[1].substring(0,1).toUpperCase()===X[1].substring(0,1)?"uppercase":"lowercase";for(T=0;T<W;T++){var j=y.alphabet[T];de==="uppercase"&&(j=j.toUpperCase()),j!=X[1].substring(0,1)&&(I=X[0]+j+X[1].substring(1),(!F||y.check(I))&&(I in B?B[I]+=1:B[I]=1))}}if(X[1])for(T=0;T<W;T++){var de=X[0].substring(-1).toUpperCase()===X[0].substring(-1)&&X[1].substring(0,1).toUpperCase()===X[1].substring(0,1)?"uppercase":"lowercase",j=y.alphabet[T];de==="uppercase"&&(j=j.toUpperCase()),I=X[0]+j+X[1],(!F||y.check(I))&&(I in B?B[I]+=1:B[I]=1)}}return B}function D(k){var F,B=x((F={},F[k]=!0,F)),L=x(B,!0),T=L;for(var N in B)y.check(N)&&(N in T?T[N]+=B[N]:T[N]=B[N]);var z,O,I=[];for(z in T)T.hasOwnProperty(z)&&(y.hasFlag(z,"PRIORITYSUGGEST")&&(T[z]+=1e3),I.push([z,T[z]]));function W(j,oe){var H=j[1],Y=oe[1];return H<Y?-1:H>Y?1:oe[0].localeCompare(j[0])}I.sort(W).reverse();var G=[],X="lowercase";k.toUpperCase()===k?X="uppercase":k.substr(0,1).toUpperCase()+k.substr(1).toLowerCase()===k&&(X="capitalized");var de=l;for(z=0;z<Math.min(de,I.length);z++)X==="uppercase"?I[z][0]=I[z][0].toUpperCase():X==="capitalized"&&(I[z][0]=I[z][0].substr(0,1).toUpperCase()+I[z][0].substr(1)),!y.hasFlag(I[z][0],"NOSUGGEST")&&G.indexOf(I[z][0])===-1?G.push(I[z][0]):de++;return G}return this.memoized[o]={suggestions:D(o),limit:l},this.memoized[o].suggestions}}})();typeof fl<"u"&&(fl.exports=ul)});var zf=at((X0,_f)=>{"use strict";var Bf=Mf();function Oe(o){if(o=o||{},typeof o.codeMirrorInstance!="function"||typeof o.codeMirrorInstance.defineMode!="function"){console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`");return}String.prototype.includes||(String.prototype.includes=function(){"use strict";return String.prototype.indexOf.apply(this,arguments)!==-1}),o.codeMirrorInstance.defineMode("spell-checker",function(l){if(!Oe.aff_loading){Oe.aff_loading=!0;var s=new XMLHttpRequest;s.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),s.onload=function(){s.readyState===4&&s.status===200&&(Oe.aff_data=s.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new Bf("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},s.send(null)}if(!Oe.dic_loading){Oe.dic_loading=!0;var a=new XMLHttpRequest;a.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),a.onload=function(){a.readyState===4&&a.status===200&&(Oe.dic_data=a.responseText,Oe.num_loaded++,Oe.num_loaded==2&&(Oe.typo=new Bf("en_US",Oe.aff_data,Oe.dic_data,{platform:"any"})))},a.send(null)}var f='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',h={token:function(d){var v=d.peek(),y="";if(f.includes(v))return d.next(),null;for(;(v=d.peek())!=null&&!f.includes(v);)y+=v,d.next();return Oe.typo&&!Oe.typo.check(y)?"spell-error":null}},c=o.codeMirrorInstance.getMode(l,l.backdrop||"text/plain");return o.codeMirrorInstance.overlayMode(c,h,!0)})}Oe.num_loaded=0;Oe.aff_loading=!1;Oe.dic_loading=!1;Oe.aff_data="";Oe.dic_data="";Oe.typo;_f.exports=Oe});var Kf=at(_e=>{"use strict";function Nf(o,l){for(var s=0;s<l.length;s++){var a=l[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(o,tp(a.key),a)}}function Vh(o,l,s){return l&&Nf(o.prototype,l),s&&Nf(o,s),Object.defineProperty(o,"prototype",{writable:!1}),o}function _t(){return _t=Object.assign?Object.assign.bind():function(o){for(var l=1;l<arguments.length;l++){var s=arguments[l];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(o[a]=s[a])}return o},_t.apply(this,arguments)}function $h(o,l){if(o){if(typeof o=="string")return Of(o,l);var s=Object.prototype.toString.call(o).slice(8,-1);if(s==="Object"&&o.constructor&&(s=o.constructor.name),s==="Map"||s==="Set")return Array.from(o);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return Of(o,l)}}function Of(o,l){(l==null||l>o.length)&&(l=o.length);for(var s=0,a=new Array(l);s<l;s++)a[s]=o[s];return a}function io(o,l){var s=typeof Symbol<"u"&&o[Symbol.iterator]||o["@@iterator"];if(s)return(s=s.call(o)).next.bind(s);if(Array.isArray(o)||(s=$h(o))||l&&o&&typeof o.length=="number"){s&&(o=s);var a=0;return function(){return a>=o.length?{done:!0}:{done:!1,value:o[a++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ep(o,l){if(typeof o!="object"||o===null)return o;var s=o[Symbol.toPrimitive];if(s!==void 0){var a=s.call(o,l||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}function tp(o){var l=ep(o,"string");return typeof l=="symbol"?l:String(l)}function cl(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,hooks:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}_e.defaults=cl();function rp(o){_e.defaults=o}var Uf=/[&<>"']/,ip=new RegExp(Uf.source,"g"),jf=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,np=new RegExp(jf.source,"g"),op={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},If=function(l){return op[l]};function pt(o,l){if(l){if(Uf.test(o))return o.replace(ip,If)}else if(jf.test(o))return o.replace(np,If);return o}var ap=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Gf(o){return o.replace(ap,function(l,s){return s=s.toLowerCase(),s==="colon"?":":s.charAt(0)==="#"?s.charAt(1)==="x"?String.fromCharCode(parseInt(s.substring(2),16)):String.fromCharCode(+s.substring(1)):""})}var lp=/(^|[^\[])\^/g;function Me(o,l){o=typeof o=="string"?o:o.source,l=l||"";var s={replace:function(f,h){return h=h.source||h,h=h.replace(lp,"$1"),o=o.replace(f,h),s},getRegex:function(){return new RegExp(o,l)}};return s}var sp=/[^\w:]/g,up=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Hf(o,l,s){if(o){var a;try{a=decodeURIComponent(Gf(s)).replace(sp,"").toLowerCase()}catch{return null}if(a.indexOf("javascript:")===0||a.indexOf("vbscript:")===0||a.indexOf("data:")===0)return null}l&&!up.test(s)&&(s=hp(l,s));try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}var no={},fp=/^[^:]+:\/*[^/]*$/,cp=/^([^:]+:)[\s\S]*$/,dp=/^([^:]+:\/*[^/]*)[\s\S]*$/;function hp(o,l){no[" "+o]||(fp.test(o)?no[" "+o]=o+"/":no[" "+o]=oo(o,"/",!0)),o=no[" "+o];var s=o.indexOf(":")===-1;return l.substring(0,2)==="//"?s?l:o.replace(cp,"$1")+l:l.charAt(0)==="/"?s?l:o.replace(dp,"$1")+l:o+l}var ao={exec:function(){}};function Pf(o,l){var s=o.replace(/\|/g,function(h,c,d){for(var v=!1,y=c;--y>=0&&d[y]==="\\";)v=!v;return v?"|":" |"}),a=s.split(/ \|/),f=0;if(a[0].trim()||a.shift(),a.length>0&&!a[a.length-1].trim()&&a.pop(),a.length>l)a.splice(l);else for(;a.length<l;)a.push("");for(;f<a.length;f++)a[f]=a[f].trim().replace(/\\\|/g,"|");return a}function oo(o,l,s){var a=o.length;if(a===0)return"";for(var f=0;f<a;){var h=o.charAt(a-f-1);if(h===l&&!s)f++;else if(h!==l&&s)f++;else break}return o.slice(0,a-f)}function pp(o,l){if(o.indexOf(l[1])===-1)return-1;for(var s=o.length,a=0,f=0;f<s;f++)if(o[f]==="\\")f++;else if(o[f]===l[0])a++;else if(o[f]===l[1]&&(a--,a<0))return f;return-1}function gp(o){o&&o.sanitize&&!o.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function qf(o,l){if(l<1)return"";for(var s="";l>1;)l&1&&(s+=o),l>>=1,o+=o;return s+o}function Rf(o,l,s,a){var f=l.href,h=l.title?pt(l.title):null,c=o[1].replace(/\\([\[\]])/g,"$1");if(o[0].charAt(0)!=="!"){a.state.inLink=!0;var d={type:"link",raw:s,href:f,title:h,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,d}return{type:"image",raw:s,href:f,title:h,text:pt(c)}}function mp(o,l){var s=o.match(/^(\s+)(?:```)/);if(s===null)return l;var a=s[1];return l.split(`
`).map(function(f){var h=f.match(/^\s+/);if(h===null)return f;var c=h[0];return c.length>=a.length?f.slice(a.length):f}).join(`
`)}var lo=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.space=function(a){var f=this.rules.block.newline.exec(a);if(f&&f[0].length>0)return{type:"space",raw:f[0]}},l.code=function(a){var f=this.rules.block.code.exec(a);if(f){var h=f[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:f[0],codeBlockStyle:"indented",text:this.options.pedantic?h:oo(h,`
`)}}},l.fences=function(a){var f=this.rules.block.fences.exec(a);if(f){var h=f[0],c=mp(h,f[3]||"");return{type:"code",raw:h,lang:f[2]?f[2].trim().replace(this.rules.inline._escapes,"$1"):f[2],text:c}}},l.heading=function(a){var f=this.rules.block.heading.exec(a);if(f){var h=f[2].trim();if(/#$/.test(h)){var c=oo(h,"#");(this.options.pedantic||!c||/ $/.test(c))&&(h=c.trim())}return{type:"heading",raw:f[0],depth:f[1].length,text:h,tokens:this.lexer.inline(h)}}},l.hr=function(a){var f=this.rules.block.hr.exec(a);if(f)return{type:"hr",raw:f[0]}},l.blockquote=function(a){var f=this.rules.block.blockquote.exec(a);if(f){var h=f[0].replace(/^ *>[ \t]?/gm,""),c=this.lexer.state.top;this.lexer.state.top=!0;var d=this.lexer.blockTokens(h);return this.lexer.state.top=c,{type:"blockquote",raw:f[0],tokens:d,text:h}}},l.list=function(a){var f=this.rules.block.list.exec(a);if(f){var h,c,d,v,y,x,D,k,F,B,L,T,N=f[1].trim(),z=N.length>1,O={type:"list",raw:"",ordered:z,start:z?+N.slice(0,-1):"",loose:!1,items:[]};N=z?"\\d{1,9}\\"+N.slice(-1):"\\"+N,this.options.pedantic&&(N=z?N:"[*+-]");for(var I=new RegExp("^( {0,3}"+N+")((?:[ ][^\\n]*)?(?:\\n|$))");a&&(T=!1,!(!(f=I.exec(a))||this.rules.block.hr.test(a)));){if(h=f[0],a=a.substring(h.length),k=f[2].split(`
`,1)[0].replace(/^\t+/,function(Y){return" ".repeat(3*Y.length)}),F=a.split(`
`,1)[0],this.options.pedantic?(v=2,L=k.trimLeft()):(v=f[2].search(/[^ ]/),v=v>4?1:v,L=k.slice(v),v+=f[1].length),x=!1,!k&&/^ *$/.test(F)&&(h+=F+`
`,a=a.substring(F.length+1),T=!0),!T)for(var W=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))"),G=new RegExp("^ {0,"+Math.min(3,v-1)+"}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"),X=new RegExp("^ {0,"+Math.min(3,v-1)+"}(?:```|~~~)"),de=new RegExp("^ {0,"+Math.min(3,v-1)+"}#");a&&(B=a.split(`
`,1)[0],F=B,this.options.pedantic&&(F=F.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(X.test(F)||de.test(F)||W.test(F)||G.test(a)));){if(F.search(/[^ ]/)>=v||!F.trim())L+=`
`+F.slice(v);else{if(x||k.search(/[^ ]/)>=4||X.test(k)||de.test(k)||G.test(k))break;L+=`
`+F}!x&&!F.trim()&&(x=!0),h+=B+`
`,a=a.substring(B.length+1),k=F.slice(v)}O.loose||(D?O.loose=!0:/\n *\n *$/.test(h)&&(D=!0)),this.options.gfm&&(c=/^\[[ xX]\] /.exec(L),c&&(d=c[0]!=="[ ] ",L=L.replace(/^\[[ xX]\] +/,""))),O.items.push({type:"list_item",raw:h,task:!!c,checked:d,loose:!1,text:L}),O.raw+=h}O.items[O.items.length-1].raw=h.trimRight(),O.items[O.items.length-1].text=L.trimRight(),O.raw=O.raw.trimRight();var j=O.items.length;for(y=0;y<j;y++)if(this.lexer.state.top=!1,O.items[y].tokens=this.lexer.blockTokens(O.items[y].text,[]),!O.loose){var oe=O.items[y].tokens.filter(function(Y){return Y.type==="space"}),H=oe.length>0&&oe.some(function(Y){return/\n.*\n/.test(Y.raw)});O.loose=H}if(O.loose)for(y=0;y<j;y++)O.items[y].loose=!0;return O}},l.html=function(a){var f=this.rules.block.html.exec(a);if(f){var h={type:"html",raw:f[0],pre:!this.options.sanitizer&&(f[1]==="pre"||f[1]==="script"||f[1]==="style"),text:f[0]};if(this.options.sanitize){var c=this.options.sanitizer?this.options.sanitizer(f[0]):pt(f[0]);h.type="paragraph",h.text=c,h.tokens=this.lexer.inline(c)}return h}},l.def=function(a){var f=this.rules.block.def.exec(a);if(f){var h=f[1].toLowerCase().replace(/\s+/g," "),c=f[2]?f[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",d=f[3]?f[3].substring(1,f[3].length-1).replace(this.rules.inline._escapes,"$1"):f[3];return{type:"def",tag:h,raw:f[0],href:c,title:d}}},l.table=function(a){var f=this.rules.block.table.exec(a);if(f){var h={type:"table",header:Pf(f[1]).map(function(D){return{text:D}}),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:f[3]&&f[3].trim()?f[3].replace(/\n[ \t]*$/,"").split(`
`):[]};if(h.header.length===h.align.length){h.raw=f[0];var c=h.align.length,d,v,y,x;for(d=0;d<c;d++)/^ *-+: *$/.test(h.align[d])?h.align[d]="right":/^ *:-+: *$/.test(h.align[d])?h.align[d]="center":/^ *:-+ *$/.test(h.align[d])?h.align[d]="left":h.align[d]=null;for(c=h.rows.length,d=0;d<c;d++)h.rows[d]=Pf(h.rows[d],h.header.length).map(function(D){return{text:D}});for(c=h.header.length,v=0;v<c;v++)h.header[v].tokens=this.lexer.inline(h.header[v].text);for(c=h.rows.length,v=0;v<c;v++)for(x=h.rows[v],y=0;y<x.length;y++)x[y].tokens=this.lexer.inline(x[y].text);return h}}},l.lheading=function(a){var f=this.rules.block.lheading.exec(a);if(f)return{type:"heading",raw:f[0],depth:f[2].charAt(0)==="="?1:2,text:f[1],tokens:this.lexer.inline(f[1])}},l.paragraph=function(a){var f=this.rules.block.paragraph.exec(a);if(f){var h=f[1].charAt(f[1].length-1)===`
`?f[1].slice(0,-1):f[1];return{type:"paragraph",raw:f[0],text:h,tokens:this.lexer.inline(h)}}},l.text=function(a){var f=this.rules.block.text.exec(a);if(f)return{type:"text",raw:f[0],text:f[0],tokens:this.lexer.inline(f[0])}},l.escape=function(a){var f=this.rules.inline.escape.exec(a);if(f)return{type:"escape",raw:f[0],text:pt(f[1])}},l.tag=function(a){var f=this.rules.inline.tag.exec(a);if(f)return!this.lexer.state.inLink&&/^<a /i.test(f[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(f[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(f[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(f[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:f[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(f[0]):pt(f[0]):f[0]}},l.link=function(a){var f=this.rules.inline.link.exec(a);if(f){var h=f[2].trim();if(!this.options.pedantic&&/^</.test(h)){if(!/>$/.test(h))return;var c=oo(h.slice(0,-1),"\\");if((h.length-c.length)%2===0)return}else{var d=pp(f[2],"()");if(d>-1){var v=f[0].indexOf("!")===0?5:4,y=v+f[1].length+d;f[2]=f[2].substring(0,d),f[0]=f[0].substring(0,y).trim(),f[3]=""}}var x=f[2],D="";if(this.options.pedantic){var k=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(x);k&&(x=k[1],D=k[3])}else D=f[3]?f[3].slice(1,-1):"";return x=x.trim(),/^</.test(x)&&(this.options.pedantic&&!/>$/.test(h)?x=x.slice(1):x=x.slice(1,-1)),Rf(f,{href:x&&x.replace(this.rules.inline._escapes,"$1"),title:D&&D.replace(this.rules.inline._escapes,"$1")},f[0],this.lexer)}},l.reflink=function(a,f){var h;if((h=this.rules.inline.reflink.exec(a))||(h=this.rules.inline.nolink.exec(a))){var c=(h[2]||h[1]).replace(/\s+/g," ");if(c=f[c.toLowerCase()],!c){var d=h[0].charAt(0);return{type:"text",raw:d,text:d}}return Rf(h,c,h[0],this.lexer)}},l.emStrong=function(a,f,h){h===void 0&&(h="");var c=this.rules.inline.emStrong.lDelim.exec(a);if(c&&!(c[3]&&h.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var d=c[1]||c[2]||"";if(!d||d&&(h===""||this.rules.inline.punctuation.exec(h))){var v=c[0].length-1,y,x,D=v,k=0,F=c[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(F.lastIndex=0,f=f.slice(-1*a.length+v);(c=F.exec(f))!=null;)if(y=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!!y){if(x=y.length,c[3]||c[4]){D+=x;continue}else if((c[5]||c[6])&&v%3&&!((v+x)%3)){k+=x;continue}if(D-=x,!(D>0)){x=Math.min(x,x+D+k);var B=a.slice(0,v+c.index+(c[0].length-y.length)+x);if(Math.min(v,x)%2){var L=B.slice(1,-1);return{type:"em",raw:B,text:L,tokens:this.lexer.inlineTokens(L)}}var T=B.slice(2,-2);return{type:"strong",raw:B,text:T,tokens:this.lexer.inlineTokens(T)}}}}}},l.codespan=function(a){var f=this.rules.inline.code.exec(a);if(f){var h=f[2].replace(/\n/g," "),c=/[^ ]/.test(h),d=/^ /.test(h)&&/ $/.test(h);return c&&d&&(h=h.substring(1,h.length-1)),h=pt(h,!0),{type:"codespan",raw:f[0],text:h}}},l.br=function(a){var f=this.rules.inline.br.exec(a);if(f)return{type:"br",raw:f[0]}},l.del=function(a){var f=this.rules.inline.del.exec(a);if(f)return{type:"del",raw:f[0],text:f[2],tokens:this.lexer.inlineTokens(f[2])}},l.autolink=function(a,f){var h=this.rules.inline.autolink.exec(a);if(h){var c,d;return h[2]==="@"?(c=pt(this.options.mangle?f(h[1]):h[1]),d="mailto:"+c):(c=pt(h[1]),d=c),{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.url=function(a,f){var h;if(h=this.rules.inline.url.exec(a)){var c,d;if(h[2]==="@")c=pt(this.options.mangle?f(h[0]):h[0]),d="mailto:"+c;else{var v;do v=h[0],h[0]=this.rules.inline._backpedal.exec(h[0])[0];while(v!==h[0]);c=pt(h[0]),h[1]==="www."?d="http://"+h[0]:d=h[0]}return{type:"link",raw:h[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.inlineText=function(a,f){var h=this.rules.inline.text.exec(a);if(h){var c;return this.lexer.state.inRawBlock?c=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(h[0]):pt(h[0]):h[0]:c=pt(this.options.smartypants?f(h[0]):h[0]),{type:"text",raw:h[0],text:c}}},o}(),ce={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {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|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:ao,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};ce._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;ce._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;ce.def=Me(ce.def).replace("label",ce._label).replace("title",ce._title).getRegex();ce.bullet=/(?:[*+-]|\d{1,9}[.)])/;ce.listItemStart=Me(/^( *)(bull) */).replace("bull",ce.bullet).getRegex();ce.list=Me(ce.list).replace(/bull/g,ce.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+ce.def.source+")").getRegex();ce._tag="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";ce._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/;ce.html=Me(ce.html,"i").replace("comment",ce._comment).replace("tag",ce._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();ce.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").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",ce._tag).getRegex();ce.blockquote=Me(ce.blockquote).replace("paragraph",ce.paragraph).getRegex();ce.normal=_t({},ce);ce.gfm=_t({},ce.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"});ce.gfm.table=Me(ce.gfm.table).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").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",ce._tag).getRegex();ce.gfm.paragraph=Me(ce._paragraph).replace("hr",ce.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",ce.gfm.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",ce._tag).getRegex();ce.pedantic=_t({},ce.normal,{html:Me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ce._comment).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:ao,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Me(ce.normal._paragraph).replace("hr",ce.hr).replace("heading",` *#{1,6} *[^
]`).replace("lheading",ce.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var ne={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:ao,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:ao,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};ne._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";ne.punctuation=Me(ne.punctuation).replace(/punctuation/g,ne._punctuation).getRegex();ne.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;ne.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;ne._comment=Me(ce._comment).replace("(?:-->|$)","-->").getRegex();ne.emStrong.lDelim=Me(ne.emStrong.lDelim).replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimAst=Me(ne.emStrong.rDelimAst,"g").replace(/punct/g,ne._punctuation).getRegex();ne.emStrong.rDelimUnd=Me(ne.emStrong.rDelimUnd,"g").replace(/punct/g,ne._punctuation).getRegex();ne._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;ne._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;ne._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])?)+(?![-_])/;ne.autolink=Me(ne.autolink).replace("scheme",ne._scheme).replace("email",ne._email).getRegex();ne._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;ne.tag=Me(ne.tag).replace("comment",ne._comment).replace("attribute",ne._attribute).getRegex();ne._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;ne._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;ne._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;ne.link=Me(ne.link).replace("label",ne._label).replace("href",ne._href).replace("title",ne._title).getRegex();ne.reflink=Me(ne.reflink).replace("label",ne._label).replace("ref",ce._label).getRegex();ne.nolink=Me(ne.nolink).replace("ref",ce._label).getRegex();ne.reflinkSearch=Me(ne.reflinkSearch,"g").replace("reflink",ne.reflink).replace("nolink",ne.nolink).getRegex();ne.normal=_t({},ne);ne.pedantic=_t({},ne.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:Me(/^!?\[(label)\]\((.*?)\)/).replace("label",ne._label).getRegex(),reflink:Me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ne._label).getRegex()});ne.gfm=_t({},ne.normal,{escape:Me(ne.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_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.!#$%&'*+\/=?_`{\|}~-]+@)))/});ne.gfm.url=Me(ne.gfm.url,"i").replace("email",ne.gfm._extended_email).getRegex();ne.breaks=_t({},ne.gfm,{br:Me(ne.br).replace("{2,}","*").getRegex(),text:Me(ne.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});function vp(o){return o.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Wf(o){var l="",s,a,f=o.length;for(s=0;s<f;s++)a=o.charCodeAt(s),Math.random()>.5&&(a="x"+a.toString(16)),l+="&#"+a+";";return l}var bi=function(){function o(s){this.tokens=[],this.tokens.links=Object.create(null),this.options=s||_e.defaults,this.options.tokenizer=this.options.tokenizer||new lo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};var a={block:ce.normal,inline:ne.normal};this.options.pedantic?(a.block=ce.pedantic,a.inline=ne.pedantic):this.options.gfm&&(a.block=ce.gfm,this.options.breaks?a.inline=ne.breaks:a.inline=ne.gfm),this.tokenizer.rules=a}o.lex=function(a,f){var h=new o(f);return h.lex(a)},o.lexInline=function(a,f){var h=new o(f);return h.inlineTokens(a)};var l=o.prototype;return l.lex=function(a){a=a.replace(/\r\n|\r/g,`
`),this.blockTokens(a,this.tokens);for(var f;f=this.inlineQueue.shift();)this.inlineTokens(f.src,f.tokens);return this.tokens},l.blockTokens=function(a,f){var h=this;f===void 0&&(f=[]),this.options.pedantic?a=a.replace(/\t/g," ").replace(/^ +$/gm,""):a=a.replace(/^( *)(\t+)/gm,function(D,k,F){return k+" ".repeat(F.length)});for(var c,d,v,y;a;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(function(D){return(c=D.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.space(a)){a=a.substring(c.raw.length),c.raw.length===1&&f.length>0?f[f.length-1].raw+=`
`:f.push(c);continue}if(c=this.tokenizer.code(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&(d.type==="paragraph"||d.type==="text")?(d.raw+=`
`+c.raw,d.text+=`
`+c.text,this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c);continue}if(c=this.tokenizer.fences(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.heading(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.hr(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.blockquote(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.list(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.html(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.def(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&(d.type==="paragraph"||d.type==="text")?(d.raw+=`
`+c.raw,d.text+=`
`+c.raw,this.inlineQueue[this.inlineQueue.length-1].src=d.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title});continue}if(c=this.tokenizer.table(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.lheading(a)){a=a.substring(c.raw.length),f.push(c);continue}if(v=a,this.options.extensions&&this.options.extensions.startBlock&&function(){var D=1/0,k=a.slice(1),F=void 0;h.options.extensions.startBlock.forEach(function(B){F=B.call({lexer:this},k),typeof F=="number"&&F>=0&&(D=Math.min(D,F))}),D<1/0&&D>=0&&(v=a.substring(0,D+1))}(),this.state.top&&(c=this.tokenizer.paragraph(v))){d=f[f.length-1],y&&d.type==="paragraph"?(d.raw+=`
`+c.raw,d.text+=`
`+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c),y=v.length!==a.length,a=a.substring(c.raw.length);continue}if(c=this.tokenizer.text(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&d.type==="text"?(d.raw+=`
`+c.raw,d.text+=`
`+c.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=d.text):f.push(c);continue}if(a){var x="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return this.state.top=!0,f},l.inline=function(a,f){return f===void 0&&(f=[]),this.inlineQueue.push({src:a,tokens:f}),f},l.inlineTokens=function(a,f){var h=this;f===void 0&&(f=[]);var c,d,v,y=a,x,D,k;if(this.tokens.links){var F=Object.keys(this.tokens.links);if(F.length>0)for(;(x=this.tokenizer.rules.inline.reflinkSearch.exec(y))!=null;)F.includes(x[0].slice(x[0].lastIndexOf("[")+1,-1))&&(y=y.slice(0,x.index)+"["+qf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(x=this.tokenizer.rules.inline.blockSkip.exec(y))!=null;)y=y.slice(0,x.index)+"["+qf("a",x[0].length-2)+"]"+y.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(x=this.tokenizer.rules.inline.escapedEmSt.exec(y))!=null;)y=y.slice(0,x.index+x[0].length-2)+"++"+y.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;a;)if(D||(k=""),D=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(function(L){return(c=L.call({lexer:h},a,f))?(a=a.substring(c.raw.length),f.push(c),!0):!1}))){if(c=this.tokenizer.escape(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.tag(a)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.link(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.reflink(a,this.tokens.links)){a=a.substring(c.raw.length),d=f[f.length-1],d&&c.type==="text"&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(c=this.tokenizer.emStrong(a,y,k)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.codespan(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.br(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.del(a)){a=a.substring(c.raw.length),f.push(c);continue}if(c=this.tokenizer.autolink(a,Wf)){a=a.substring(c.raw.length),f.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(a,Wf))){a=a.substring(c.raw.length),f.push(c);continue}if(v=a,this.options.extensions&&this.options.extensions.startInline&&function(){var L=1/0,T=a.slice(1),N=void 0;h.options.extensions.startInline.forEach(function(z){N=z.call({lexer:this},T),typeof N=="number"&&N>=0&&(L=Math.min(L,N))}),L<1/0&&L>=0&&(v=a.substring(0,L+1))}(),c=this.tokenizer.inlineText(v,vp)){a=a.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(k=c.raw.slice(-1)),D=!0,d=f[f.length-1],d&&d.type==="text"?(d.raw+=c.raw,d.text+=c.text):f.push(c);continue}if(a){var B="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(B);break}else throw new Error(B)}}return f},Vh(o,null,[{key:"rules",get:function(){return{block:ce,inline:ne}}}]),o}(),so=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.code=function(a,f,h){var c=(f||"").match(/\S*/)[0];if(this.options.highlight){var d=this.options.highlight(a,c);d!=null&&d!==a&&(h=!0,a=d)}return a=a.replace(/\n$/,"")+`
`,c?'<pre><code class="'+this.options.langPrefix+pt(c)+'">'+(h?a:pt(a,!0))+`</code></pre>
`:"<pre><code>"+(h?a:pt(a,!0))+`</code></pre>
`},l.blockquote=function(a){return`<blockquote>
`+a+`</blockquote>
`},l.html=function(a){return a},l.heading=function(a,f,h,c){if(this.options.headerIds){var d=this.options.headerPrefix+c.slug(h);return"<h"+f+' id="'+d+'">'+a+"</h"+f+`>
`}return"<h"+f+">"+a+"</h"+f+`>
`},l.hr=function(){return this.options.xhtml?`<hr/>
`:`<hr>
`},l.list=function(a,f,h){var c=f?"ol":"ul",d=f&&h!==1?' start="'+h+'"':"";return"<"+c+d+`>
`+a+"</"+c+`>
`},l.listitem=function(a){return"<li>"+a+`</li>
`},l.checkbox=function(a){return"<input "+(a?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "},l.paragraph=function(a){return"<p>"+a+`</p>
`},l.table=function(a,f){return f&&(f="<tbody>"+f+"</tbody>"),`<table>
<thead>
`+a+`</thead>
`+f+`</table>
`},l.tablerow=function(a){return`<tr>
`+a+`</tr>
`},l.tablecell=function(a,f){var h=f.header?"th":"td",c=f.align?"<"+h+' align="'+f.align+'">':"<"+h+">";return c+a+("</"+h+`>
`)},l.strong=function(a){return"<strong>"+a+"</strong>"},l.em=function(a){return"<em>"+a+"</em>"},l.codespan=function(a){return"<code>"+a+"</code>"},l.br=function(){return this.options.xhtml?"<br/>":"<br>"},l.del=function(a){return"<del>"+a+"</del>"},l.link=function(a,f,h){if(a=Hf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c='<a href="'+a+'"';return f&&(c+=' title="'+f+'"'),c+=">"+h+"</a>",c},l.image=function(a,f,h){if(a=Hf(this.options.sanitize,this.options.baseUrl,a),a===null)return h;var c='<img src="'+a+'" alt="'+h+'"';return f&&(c+=' title="'+f+'"'),c+=this.options.xhtml?"/>":">",c},l.text=function(a){return a},o}(),dl=function(){function o(){}var l=o.prototype;return l.strong=function(a){return a},l.em=function(a){return a},l.codespan=function(a){return a},l.del=function(a){return a},l.html=function(a){return a},l.text=function(a){return a},l.link=function(a,f,h){return""+h},l.image=function(a,f,h){return""+h},l.br=function(){return""},o}(),hl=function(){function o(){this.seen={}}var l=o.prototype;return l.serialize=function(a){return a.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},l.getNextSafeSlug=function(a,f){var h=a,c=0;if(this.seen.hasOwnProperty(h)){c=this.seen[a];do c++,h=a+"-"+c;while(this.seen.hasOwnProperty(h))}return f||(this.seen[a]=c,this.seen[h]=0),h},l.slug=function(a,f){f===void 0&&(f={});var h=this.serialize(a);return this.getNextSafeSlug(h,f.dryrun)},o}(),yi=function(){function o(s){this.options=s||_e.defaults,this.options.renderer=this.options.renderer||new so,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new dl,this.slugger=new hl}o.parse=function(a,f){var h=new o(f);return h.parse(a)},o.parseInline=function(a,f){var h=new o(f);return h.parseInline(a)};var l=o.prototype;return l.parse=function(a,f){f===void 0&&(f=!0);var h="",c,d,v,y,x,D,k,F,B,L,T,N,z,O,I,W,G,X,de,j=a.length;for(c=0;c<j;c++){if(L=a[c],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[L.type]&&(de=this.options.extensions.renderers[L.type].call({parser:this},L),de!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(L.type))){h+=de||"";continue}switch(L.type){case"space":continue;case"hr":{h+=this.renderer.hr();continue}case"heading":{h+=this.renderer.heading(this.parseInline(L.tokens),L.depth,Gf(this.parseInline(L.tokens,this.textRenderer)),this.slugger);continue}case"code":{h+=this.renderer.code(L.text,L.lang,L.escaped);continue}case"table":{for(F="",k="",y=L.header.length,d=0;d<y;d++)k+=this.renderer.tablecell(this.parseInline(L.header[d].tokens),{header:!0,align:L.align[d]});for(F+=this.renderer.tablerow(k),B="",y=L.rows.length,d=0;d<y;d++){for(D=L.rows[d],k="",x=D.length,v=0;v<x;v++)k+=this.renderer.tablecell(this.parseInline(D[v].tokens),{header:!1,align:L.align[v]});B+=this.renderer.tablerow(k)}h+=this.renderer.table(F,B);continue}case"blockquote":{B=this.parse(L.tokens),h+=this.renderer.blockquote(B);continue}case"list":{for(T=L.ordered,N=L.start,z=L.loose,y=L.items.length,B="",d=0;d<y;d++)I=L.items[d],W=I.checked,G=I.task,O="",I.task&&(X=this.renderer.checkbox(W),z?I.tokens.length>0&&I.tokens[0].type==="paragraph"?(I.tokens[0].text=X+" "+I.tokens[0].text,I.tokens[0].tokens&&I.tokens[0].tokens.length>0&&I.tokens[0].tokens[0].type==="text"&&(I.tokens[0].tokens[0].text=X+" "+I.tokens[0].tokens[0].text)):I.tokens.unshift({type:"text",text:X}):O+=X),O+=this.parse(I.tokens,z),B+=this.renderer.listitem(O,G,W);h+=this.renderer.list(B,T,N);continue}case"html":{h+=this.renderer.html(L.text);continue}case"paragraph":{h+=this.renderer.paragraph(this.parseInline(L.tokens));continue}case"text":{for(B=L.tokens?this.parseInline(L.tokens):L.text;c+1<j&&a[c+1].type==="text";)L=a[++c],B+=`
`+(L.tokens?this.parseInline(L.tokens):L.text);h+=f?this.renderer.paragraph(B):B;continue}default:{var oe='Token with "'+L.type+'" type was not found.';if(this.options.silent){console.error(oe);return}else throw new Error(oe)}}}return h},l.parseInline=function(a,f){f=f||this.renderer;var h="",c,d,v,y=a.length;for(c=0;c<y;c++){if(d=a[c],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[d.type]&&(v=this.options.extensions.renderers[d.type].call({parser:this},d),v!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(d.type))){h+=v||"";continue}switch(d.type){case"escape":{h+=f.text(d.text);break}case"html":{h+=f.html(d.text);break}case"link":{h+=f.link(d.href,d.title,this.parseInline(d.tokens,f));break}case"image":{h+=f.image(d.href,d.title,d.text);break}case"strong":{h+=f.strong(this.parseInline(d.tokens,f));break}case"em":{h+=f.em(this.parseInline(d.tokens,f));break}case"codespan":{h+=f.codespan(d.text);break}case"br":{h+=f.br();break}case"del":{h+=f.del(this.parseInline(d.tokens,f));break}case"text":{h+=f.text(d.text);break}default:{var x='Token with "'+d.type+'" type was not found.';if(this.options.silent){console.error(x);return}else throw new Error(x)}}}return h},o}(),sn=function(){function o(s){this.options=s||_e.defaults}var l=o.prototype;return l.preprocess=function(a){return a},l.postprocess=function(a){return a},o}();sn.passThroughHooks=new Set(["preprocess","postprocess"]);function bp(o,l,s){return function(a){if(a.message+=`
Please report this to https://github.com/markedjs/marked.`,o){var f="<p>An error occurred:</p><pre>"+pt(a.message+"",!0)+"</pre>";if(l)return Promise.resolve(f);if(s){s(null,f);return}return f}if(l)return Promise.reject(a);if(s){s(a);return}throw a}}function Xf(o,l){return function(s,a,f){typeof a=="function"&&(f=a,a=null);var h=_t({},a);a=_t({},fe.defaults,h);var c=bp(a.silent,a.async,f);if(typeof s>"u"||s===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(gp(a),a.hooks&&(a.hooks.options=a),f){var d=a.highlight,v;try{a.hooks&&(s=a.hooks.preprocess(s)),v=o(s,a)}catch(F){return c(F)}var y=function(B){var L;if(!B)try{a.walkTokens&&fe.walkTokens(v,a.walkTokens),L=l(v,a),a.hooks&&(L=a.hooks.postprocess(L))}catch(T){B=T}return a.highlight=d,B?c(B):f(null,L)};if(!d||d.length<3||(delete a.highlight,!v.length))return y();var x=0;fe.walkTokens(v,function(F){F.type==="code"&&(x++,setTimeout(function(){d(F.text,F.lang,function(B,L){if(B)return y(B);L!=null&&L!==F.text&&(F.text=L,F.escaped=!0),x--,x===0&&y()})},0))}),x===0&&y();return}if(a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(s):s).then(function(F){return o(F,a)}).then(function(F){return a.walkTokens?Promise.all(fe.walkTokens(F,a.walkTokens)).then(function(){return F}):F}).then(function(F){return l(F,a)}).then(function(F){return a.hooks?a.hooks.postprocess(F):F}).catch(c);try{a.hooks&&(s=a.hooks.preprocess(s));var D=o(s,a);a.walkTokens&&fe.walkTokens(D,a.walkTokens);var k=l(D,a);return a.hooks&&(k=a.hooks.postprocess(k)),k}catch(F){return c(F)}}}function fe(o,l,s){return Xf(bi.lex,yi.parse)(o,l,s)}fe.options=fe.setOptions=function(o){return fe.defaults=_t({},fe.defaults,o),rp(fe.defaults),fe};fe.getDefaults=cl;fe.defaults=_e.defaults;fe.use=function(){for(var o=fe.defaults.extensions||{renderers:{},childTokens:{}},l=arguments.length,s=new Array(l),a=0;a<l;a++)s[a]=arguments[a];s.forEach(function(f){var h=_t({},f);if(h.async=fe.defaults.async||h.async||!1,f.extensions&&(f.extensions.forEach(function(d){if(!d.name)throw new Error("extension name required");if(d.renderer){var v=o.renderers[d.name];v?o.renderers[d.name]=function(){for(var y=arguments.length,x=new Array(y),D=0;D<y;D++)x[D]=arguments[D];var k=d.renderer.apply(this,x);return k===!1&&(k=v.apply(this,x)),k}:o.renderers[d.name]=d.renderer}if(d.tokenizer){if(!d.level||d.level!=="block"&&d.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");o[d.level]?o[d.level].unshift(d.tokenizer):o[d.level]=[d.tokenizer],d.start&&(d.level==="block"?o.startBlock?o.startBlock.push(d.start):o.startBlock=[d.start]:d.level==="inline"&&(o.startInline?o.startInline.push(d.start):o.startInline=[d.start]))}d.childTokens&&(o.childTokens[d.name]=d.childTokens)}),h.extensions=o),f.renderer&&function(){var d=fe.defaults.renderer||new so,v=function(D){var k=d[D];d[D]=function(){for(var F=arguments.length,B=new Array(F),L=0;L<F;L++)B[L]=arguments[L];var T=f.renderer[D].apply(d,B);return T===!1&&(T=k.apply(d,B)),T}};for(var y in f.renderer)v(y);h.renderer=d}(),f.tokenizer&&function(){var d=fe.defaults.tokenizer||new lo,v=function(D){var k=d[D];d[D]=function(){for(var F=arguments.length,B=new Array(F),L=0;L<F;L++)B[L]=arguments[L];var T=f.tokenizer[D].apply(d,B);return T===!1&&(T=k.apply(d,B)),T}};for(var y in f.tokenizer)v(y);h.tokenizer=d}(),f.hooks&&function(){var d=fe.defaults.hooks||new sn,v=function(D){var k=d[D];sn.passThroughHooks.has(D)?d[D]=function(F){if(fe.defaults.async)return Promise.resolve(f.hooks[D].call(d,F)).then(function(L){return k.call(d,L)});var B=f.hooks[D].call(d,F);return k.call(d,B)}:d[D]=function(){for(var F=arguments.length,B=new Array(F),L=0;L<F;L++)B[L]=arguments[L];var T=f.hooks[D].apply(d,B);return T===!1&&(T=k.apply(d,B)),T}};for(var y in f.hooks)v(y);h.hooks=d}(),f.walkTokens){var c=fe.defaults.walkTokens;h.walkTokens=function(d){var v=[];return v.push(f.walkTokens.call(this,d)),c&&(v=v.concat(c.call(this,d))),v}}fe.setOptions(h)})};fe.walkTokens=function(o,l){for(var s=[],a=function(){var d=h.value;switch(s=s.concat(l.call(fe,d)),d.type){case"table":{for(var v=io(d.header),y;!(y=v()).done;){var x=y.value;s=s.concat(fe.walkTokens(x.tokens,l))}for(var D=io(d.rows),k;!(k=D()).done;)for(var F=k.value,B=io(F),L;!(L=B()).done;){var T=L.value;s=s.concat(fe.walkTokens(T.tokens,l))}break}case"list":{s=s.concat(fe.walkTokens(d.items,l));break}default:fe.defaults.extensions&&fe.defaults.extensions.childTokens&&fe.defaults.extensions.childTokens[d.type]?fe.defaults.extensions.childTokens[d.type].forEach(function(N){s=s.concat(fe.walkTokens(d[N],l))}):d.tokens&&(s=s.concat(fe.walkTokens(d.tokens,l)))}},f=io(o),h;!(h=f()).done;)a();return s};fe.parseInline=Xf(bi.lexInline,yi.parseInline);fe.Parser=yi;fe.parser=yi.parse;fe.Renderer=so;fe.TextRenderer=dl;fe.Lexer=bi;fe.lexer=bi.lex;fe.Tokenizer=lo;fe.Slugger=hl;fe.Hooks=sn;fe.parse=fe;var yp=fe.options,xp=fe.setOptions,wp=fe.use,Cp=fe.walkTokens,Dp=fe.parseInline,kp=fe,Sp=yi.parse,Ep=bi.lex;_e.Hooks=sn;_e.Lexer=bi;_e.Parser=yi;_e.Renderer=so;_e.Slugger=hl;_e.TextRenderer=dl;_e.Tokenizer=lo;_e.getDefaults=cl;_e.lexer=Ep;_e.marked=fe;_e.options=yp;_e.parse=kp;_e.parseInline=Dp;_e.parser=Sp;_e.setOptions=xp;_e.use=wp;_e.walkTokens=Cp});var nc=at((Y0,ic)=>{"use strict";var xi=At();$u();tf();of();ll();sl();vf();xf();Df();Ef();Tf();al();var Ap=zf(),pl=Kf().marked,Qf=/Mac/.test(navigator.platform),Fp=new RegExp(/(<a.*?https?:\/\/.*?[^a]>)+?/g),un={toggleBold:co,toggleItalic:ho,drawLink:So,toggleHeadingSmaller:fn,toggleHeadingBigger:vo,drawImage:Eo,toggleBlockquote:mo,toggleOrderedList:Co,toggleUnorderedList:wo,toggleCheckList:Do,toggleCodeBlock:go,togglePreview:Mo,toggleStrikethrough:po,toggleHeading1:bo,toggleHeading2:yo,toggleHeading3:xo,toggleHeading4:ml,toggleHeading5:vl,toggleHeading6:bl,cleanBlock:ko,drawTable:Ao,drawHorizontalRule:Fo,undo:To,redo:Lo,toggleSideBySide:wi,toggleFullScreen:jr},Tp={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",toggleHeading1:"Ctrl+Alt+1",toggleHeading2:"Ctrl+Alt+2",toggleHeading3:"Ctrl+Alt+3",toggleHeading4:"Ctrl+Alt+4",toggleHeading5:"Ctrl+Alt+5",toggleHeading6:"Ctrl+Alt+6",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCheckList:"Shift-Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Lp=function(o){for(var l in un)if(un[l]===o)return l;return null},gl=function(){var o=!1;return function(l){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(l)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(l.substr(0,4)))&&(o=!0)}(navigator.userAgent||navigator.vendor||window.opera),o};function Mp(o){for(var l;(l=Fp.exec(o))!==null;){var s=l[0];if(s.indexOf("target=")===-1){var a=s.replace(/>$/,' target="_blank">');o=o.replace(s,a)}}return o}function Bp(o){for(var l=new DOMParser,s=l.parseFromString(o,"text/html"),a=s.getElementsByTagName("li"),f=0;f<a.length;f++)for(var h=a[f],c=0;c<h.children.length;c++){var d=h.children[c];d instanceof HTMLInputElement&&d.type==="checkbox"&&(h.style.marginLeft="-1.5em",h.style.listStyleType="none")}return s.documentElement.innerHTML}function Jf(o){return Qf?o=o.replace("Ctrl","Cmd"):o=o.replace("Cmd","Ctrl"),o}function _p(o,l,s,a){var f=uo(o,!1,l,s,"button",a);f.classList.add("easymde-dropdown"),f.onclick=function(){f.focus()};var h=document.createElement("div");h.className="easymde-dropdown-content";for(var c=0;c<o.children.length;c++){var d=o.children[c],v;typeof d=="string"&&d in Ur?v=uo(Ur[d],!0,l,s,"button",a):v=uo(d,!0,l,s,"button",a),v.addEventListener("click",function(y){y.stopPropagation()},!1),h.appendChild(v)}return f.appendChild(h),f}function uo(o,l,s,a,f,h){o=o||{};var c=document.createElement(f);if(o.attributes)for(var d in o.attributes)Object.prototype.hasOwnProperty.call(o.attributes,d)&&c.setAttribute(d,o.attributes[d]);var v=h.options.toolbarButtonClassPrefix?h.options.toolbarButtonClassPrefix+"-":"";c.className=v+o.name,c.setAttribute("type",f),s=s??!0,o.text&&(c.innerText=o.text),o.name&&o.name in a&&(un[o.name]=o.action),o.title&&s&&(c.title=Np(o.title,o.action,a),Qf&&(c.title=c.title.replace("Ctrl","\u2318"),c.title=c.title.replace("Alt","\u2325"))),o.title&&c.setAttribute("aria-label",o.title),o.noDisable&&c.classList.add("no-disable"),o.noMobile&&c.classList.add("no-mobile");var y=[];typeof o.className<"u"&&(y=o.className.split(" "));for(var x=[],D=0;D<y.length;D++){var k=y[D];k.match(/^fa([srlb]|(-[\w-]*)|$)/)?x.push(k):c.classList.add(k)}if(c.tabIndex=-1,x.length>0){for(var F=document.createElement("i"),B=0;B<x.length;B++){var L=x[B];F.classList.add(L)}c.appendChild(F)}return typeof o.icon<"u"&&(c.innerHTML=o.icon),o.action&&l&&(typeof o.action=="function"?c.onclick=function(T){T.preventDefault(),o.action(h)}:typeof o.action=="string"&&(c.onclick=function(T){T.preventDefault(),window.open(o.action,"_blank")})),c}function zp(){var o=document.createElement("i");return o.className="separator",o.innerHTML="|",o}function Np(o,l,s){var a,f=o;return l&&(a=Lp(l),s[a]&&(f+=" ("+Jf(s[a])+")")),f}function Sr(o,l){l=l||o.getCursor("start");var s=o.getTokenAt(l);if(!s.type)return{};for(var a=s.type.split(" "),f={},h,c,d=0;d<a.length;d++)h=a[d],h==="strong"?f.bold=!0:h==="variable-2"?(c=o.getLine(l.line),/^\s*\d+\.\s/.test(c)?f["ordered-list"]=!0:/^\s*- \[[ xX]]\s/.test(c)?f["check-list"]=!0:f["unordered-list"]=!0):h==="atom"?f.quote=!0:h==="em"?f.italic=!0:h==="quote"?f.quote=!0:h==="strikethrough"?f.strikethrough=!0:h==="comment"?f.code=!0:h==="link"&&!f.image?f.link=!0:h==="image"?f.image=!0:h.match(/^header(-[1-6])?$/)&&(f[h.replace("header","heading")]=!0);return f}var Yf="";function jr(o){var l=o.codemirror;l.setOption("fullScreen",!l.getOption("fullScreen")),l.getOption("fullScreen")?(Yf=document.body.style.overflow,document.body.style.overflow="hidden"):document.body.style.overflow=Yf;var s=l.getWrapperElement(),a=s.nextSibling;if(a.classList.contains("editor-preview-active-side"))if(o.options.sideBySideFullscreen===!1){var f=s.parentNode;l.getOption("fullScreen")?f.classList.remove("sided--no-fullscreen"):f.classList.add("sided--no-fullscreen")}else wi(o);if(o.options.onToggleFullScreen&&o.options.onToggleFullScreen(l.getOption("fullScreen")||!1),typeof o.options.maxHeight<"u"&&(l.getOption("fullScreen")?(l.getScrollerElement().style.removeProperty("height"),a.style.removeProperty("height")):(l.getScrollerElement().style.height=o.options.maxHeight,o.setPreviewMaxHeight())),o.toolbar_div.classList.toggle("fullscreen"),o.toolbarElements&&o.toolbarElements.fullscreen){var h=o.toolbarElements.fullscreen;h.classList.toggle("active")}}function co(o){xl(o,"bold",o.options.blockStyles.bold)}function ho(o){xl(o,"italic",o.options.blockStyles.italic)}function po(o){xl(o,"strikethrough","~~")}function go(o){var l=o.options.blockStyles.code;function s(q){if(typeof q!="object")throw"fencing_line() takes a 'line' object (not a line number, or line text). Got: "+typeof q+": "+q;return q.styles&&q.styles[2]&&q.styles[2].indexOf("formatting-code-block")!==-1}function a(q){return q.state.base.base||q.state.base}function f(q,R,Q,he,be){Q=Q||q.getLineHandle(R),he=he||q.getTokenAt({line:R,ch:1}),be=be||!!Q.text&&q.getTokenAt({line:R,ch:Q.text.length-1});var Ee=he.type?he.type.split(" "):[];return be&&a(be).indentedCode?"indented":Ee.indexOf("comment")===-1?!1:a(he).fencedChars||a(be).fencedChars||s(Q)?"fenced":"single"}function h(q,R,Q,he){var be=R.line+1,Ee=Q.line+1,A=R.line!==Q.line,w=he+`
`,te=`
`+he;A&&Ee++,A&&Q.ch===0&&(te=he+`
`,Ee--),Gr(q,!1,[w,te]),q.setSelection({line:be,ch:0},{line:Ee,ch:0})}var c=o.codemirror,d=c.getCursor("start"),v=c.getCursor("end"),y=c.getTokenAt({line:d.line,ch:d.ch||1}),x=c.getLineHandle(d.line),D=f(c,d.line,x,y),k,F,B;if(D==="single"){var L=x.text.slice(0,d.ch).replace("`",""),T=x.text.slice(d.ch).replace("`","");c.replaceRange(L+T,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch--,d!==v&&v.ch--,c.setSelection(d,v),c.focus()}else if(D==="fenced")if(d.line!==v.line||d.ch!==v.ch){for(k=d.line;k>=0&&(x=c.getLineHandle(k),!s(x));k--);var N=c.getTokenAt({line:k,ch:1}),z=a(N).fencedChars,O,I,W,G;s(c.getLineHandle(d.line))?(O="",I=d.line):s(c.getLineHandle(d.line-1))?(O="",I=d.line-1):(O=z+`
`,I=d.line),s(c.getLineHandle(v.line))?(W="",G=v.line,v.ch===0&&(G+=1)):v.ch!==0&&s(c.getLineHandle(v.line+1))?(W="",G=v.line+1):(W=z+`
`,G=v.line+1),v.ch===0&&(G-=1),c.operation(function(){c.replaceRange(W,{line:G,ch:0},{line:G+(W?0:1),ch:0}),c.replaceRange(O,{line:I,ch:0},{line:I+(O?0:1),ch:0})}),c.setSelection({line:I+(O?1:0),ch:0},{line:G+(O?1:-1),ch:0}),c.focus()}else{var X=d.line;if(s(c.getLineHandle(d.line))&&(f(c,d.line+1)==="fenced"?(k=d.line,X=d.line+1):(F=d.line,X=d.line-1)),k===void 0)for(k=X;k>=0&&(x=c.getLineHandle(k),!s(x));k--);if(F===void 0)for(B=c.lineCount(),F=X;F<B&&(x=c.getLineHandle(F),!s(x));F++);c.operation(function(){c.replaceRange("",{line:k,ch:0},{line:k+1,ch:0}),c.replaceRange("",{line:F-1,ch:0},{line:F,ch:0})}),c.focus()}else if(D==="indented"){if(d.line!==v.line||d.ch!==v.ch)k=d.line,F=v.line,v.ch===0&&F--;else{for(k=d.line;k>=0;k--)if(x=c.getLineHandle(k),!x.text.match(/^\s*$/)&&f(c,k,x)!=="indented"){k+=1;break}for(B=c.lineCount(),F=d.line;F<B;F++)if(x=c.getLineHandle(F),!x.text.match(/^\s*$/)&&f(c,F,x)!=="indented"){F-=1;break}}var de=c.getLineHandle(F+1),j=de&&c.getTokenAt({line:F+1,ch:de.text.length-1}),oe=j&&a(j).indentedCode;oe&&c.replaceRange(`
`,{line:F+1,ch:0});for(var H=k;H<=F;H++)c.indentLine(H,"subtract");c.focus()}else{var Y=d.line===v.line&&d.ch===v.ch&&d.ch===0,E=d.line!==v.line;Y||E?h(c,d,v,l):Gr(c,!1,["`","`"])}}function mo(o){Bo(o.codemirror,"quote")}function fn(o){Er(o.codemirror,"smaller")}function vo(o){Er(o.codemirror,"bigger")}function bo(o){Er(o.codemirror,void 0,1)}function yo(o){Er(o.codemirror,void 0,2)}function xo(o){Er(o.codemirror,void 0,3)}function ml(o){Er(o.codemirror,void 0,4)}function vl(o){Er(o.codemirror,void 0,5)}function bl(o){Er(o.codemirror,void 0,6)}function wo(o){var l=o.codemirror,s="*";["-","+","*"].includes(o.options.unorderedListStyle)&&(s=o.options.unorderedListStyle),Bo(l,"unordered-list",s)}function Co(o){Bo(o.codemirror,"ordered-list")}function Do(o){Bo(o.codemirror,"check-list")}function ko(o){Op(o.codemirror)}function So(o){var l=o.options,s="https://";if(l.promptURLs){var a=prompt(l.promptTexts.link,s);if(!a)return!1;s=Vf(a)}ec(o,"link",l.insertTexts.link,s)}function Eo(o){var l=o.options,s="https://";if(l.promptURLs){var a=prompt(l.promptTexts.image,s);if(!a)return!1;s=Vf(a)}ec(o,"image",l.insertTexts.image,s)}function Vf(o){return encodeURI(o).replace(/([\\()])/g,"\\$1")}function yl(o){o.openBrowseFileWindow()}function $f(o,l){var s=o.codemirror,a=Sr(s),f=o.options,h=l.substr(l.lastIndexOf("/")+1),c=h.substring(h.lastIndexOf(".")+1).replace(/\?.*$/,"").toLowerCase();if(["png","jpg","jpeg","gif","svg","apng","avif","webp"].includes(c))Gr(s,a.image,f.insertTexts.uploadedImage,l);else{var d=f.insertTexts.link;d[0]="["+h,Gr(s,a.link,d,l)}o.updateStatusBar("upload-image",o.options.imageTexts.sbOnUploaded.replace("#image_name#",h)),setTimeout(function(){o.updateStatusBar("upload-image",o.options.imageTexts.sbInit)},1e3)}function Ao(o){var l=o.codemirror,s=Sr(l),a=o.options;Gr(l,s.table,a.insertTexts.table)}function Fo(o){var l=o.codemirror,s=Sr(l),a=o.options;Gr(l,s.image,a.insertTexts.horizontalRule)}function To(o){var l=o.codemirror;l.undo(),l.focus()}function Lo(o){var l=o.codemirror;l.redo(),l.focus()}function wi(o){var l=o.codemirror,s=l.getWrapperElement(),a=s.nextSibling,f=o.toolbarElements&&o.toolbarElements["side-by-side"],h=!1,c=s.parentNode;a.classList.contains("editor-preview-active-side")?(o.options.sideBySideFullscreen===!1&&c.classList.remove("sided--no-fullscreen"),a.classList.remove("editor-preview-active-side"),f&&f.classList.remove("active"),s.classList.remove("CodeMirror-sided")):(setTimeout(function(){l.getOption("fullScreen")||(o.options.sideBySideFullscreen===!1?c.classList.add("sided--no-fullscreen"):jr(o)),a.classList.add("editor-preview-active-side")},1),f&&f.classList.add("active"),s.classList.add("CodeMirror-sided"),h=!0);var d=s.lastChild;if(d.classList.contains("editor-preview-active")){d.classList.remove("editor-preview-active");var v=o.toolbarElements.preview,y=o.toolbar_div;v.classList.remove("active"),y.classList.remove("disabled-for-preview")}var x=function(){var k=o.options.previewRender(o.value(),a);k!=null&&(a.innerHTML=k)};if(l.sideBySideRenderingFunction||(l.sideBySideRenderingFunction=x),h){var D=o.options.previewRender(o.value(),a);D!=null&&(a.innerHTML=D),l.on("update",l.sideBySideRenderingFunction)}else l.off("update",l.sideBySideRenderingFunction);l.refresh()}function Mo(o){var l=o.codemirror,s=l.getWrapperElement(),a=o.toolbar_div,f=o.options.toolbar?o.toolbarElements.preview:!1,h=s.lastChild,c=l.getWrapperElement().nextSibling;if(c.classList.contains("editor-preview-active-side")&&wi(o),!h||!h.classList.contains("editor-preview-full")){if(h=document.createElement("div"),h.className="editor-preview-full",o.options.previewClass)if(Array.isArray(o.options.previewClass))for(var d=0;d<o.options.previewClass.length;d++)h.classList.add(o.options.previewClass[d]);else typeof o.options.previewClass=="string"&&h.classList.add(o.options.previewClass);s.appendChild(h)}h.classList.contains("editor-preview-active")?(h.classList.remove("editor-preview-active"),f&&(f.classList.remove("active"),a.classList.remove("disabled-for-preview"))):(setTimeout(function(){h.classList.add("editor-preview-active")},1),f&&(f.classList.add("active"),a.classList.add("disabled-for-preview")));var v=o.options.previewRender(o.value(),h);v!==null&&(h.innerHTML=v)}function Gr(o,l,s,a){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active")){var f,h=s[0],c=s[1],d={},v={};Object.assign(d,o.getCursor("start")),Object.assign(v,o.getCursor("end")),a&&(h=h.replace("#url#",a),c=c.replace("#url#",a)),l?(f=o.getLine(d.line),h=f.slice(0,d.ch),c=f.slice(d.ch),o.replaceRange(h+c,{line:d.line,ch:0})):(f=o.getSelection(),o.replaceSelection(h+f+c),d.ch+=h.length,d!==v&&(v.ch+=h.length)),o.setSelection(d,v),o.focus()}}function Er(o,l,s){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active")){for(var a=o.getCursor("start"),f=o.getCursor("end"),h=a.line;h<=f.line;h++)(function(c){var d=o.getLine(c),v=d.search(/[^#]/);l!==void 0?v<=0?l=="bigger"?d="###### "+d:d="# "+d:v==6&&l=="smaller"?d=d.substr(7):v==1&&l=="bigger"?d=d.substr(2):l=="bigger"?d=d.substr(1):d="#"+d:v<=0?d="#".repeat(s)+" "+d:v==s?d=d.substr(v+1):d="#".repeat(s)+" "+d.substr(v+1),o.replaceRange(d,{line:c,ch:0},{line:c,ch:99999999999999})})(h);o.focus()}}function Bo(o,l,s){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active")){var a=/^(\s*)(\*|-|\+|\d*\.)(\s+)/,f=/^\s*/,h=Sr(o),c=o.getCursor("start"),d=o.getCursor("end"),v={quote:/^(\s*)>\s+/,"unordered-list":a,"ordered-list":a,"check-list":/^(\s*)(- \[[ xX]])(\s+)/},y=function(N,z){var O={quote:">","unordered-list":s,"ordered-list":"%%i.","check-list":"- [ ]"};return O[N].replace("%%i",z)},x=function(N,z){var O={quote:">","unordered-list":"\\"+s,"ordered-list":"\\d+.","check-list":"- \\[[ xX]]"},I=new RegExp(O[N]);return z&&I.test(z)},D=function(N,z,O){var I=a.exec(z),W=y(N,k);return I!==null?(x(N,I[2])&&(W=""),z=I[1]+W+I[3]+z.replace(f,"").replace(v[N],"$1")):O==!1&&(z=W+" "+z),z},k=1,F=["unordered-list","ordered-list","check-list"],B=Object.keys(h)[0];if(!F.includes(B)){var L=o.getLine(c.line);/^\s*- \[[ xX]]\s/.test(L)?B="check-list":/^\s*\d+\.\s/.test(L)?B="ordered-list":/^\s*[*\-+]\s/.test(L)&&(B="unordered-list")}for(var T=c.line;T<=d.line;T++)(function(N){var z=o.getLine(N);h[l]?z=z.replace(v[l],"$1"):F.includes(B)&&F.includes(l)?(z=z.replace(v[B],"$1"),z=D(l,z,!1),k+=1):(z=D(l,z,!1),k+=1),o.replaceRange(z,{line:N,ch:0},{line:N,ch:99999999999999})})(T);o.focus()}}function ec(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){var f=o.codemirror,h=Sr(f),c=h[l];if(!c){Gr(f,c,s,a);return}var d=f.getCursor("start"),v=f.getCursor("end"),y=f.getLine(d.line),x=y.slice(0,d.ch),D=y.slice(d.ch);l=="link"?x=x.replace(/(.*)[^!]\[/,"$1"):l=="image"&&(x=x.replace(/(.*)!\[$/,"$1")),D=D.replace(/]\(.*?\)/,""),f.replaceRange(x+D,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch-=s[0].length,d!==v&&(v.ch-=s[0].length),f.setSelection(d,v),f.focus()}}function xl(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){a=typeof a>"u"?s:a;var f=o.codemirror,h=Sr(f),c,d=s,v=a,y=f.getCursor("start"),x=f.getCursor("end");h[l]?(c=f.getLine(y.line),d=c.slice(0,y.ch),v=c.slice(y.ch),l=="bold"?(d=d.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),v=v.replace(/(\*\*|__)/,"")):l=="italic"?(d=d.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),v=v.replace(/(\*|_)/,"")):l=="strikethrough"&&(d=d.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),v=v.replace(/(\*\*|~~)/,"")),f.replaceRange(d+v,{line:y.line,ch:0},{line:y.line,ch:99999999999999}),l=="bold"||l=="strikethrough"?(y.ch-=2,y!==x&&(x.ch-=2)):l=="italic"&&(y.ch-=1,y!==x&&(x.ch-=1))):(c=f.getSelection(),l=="bold"?(c=c.split("**").join(""),c=c.split("__").join("")):l=="italic"?(c=c.split("*").join(""),c=c.split("_").join("")):l=="strikethrough"&&(c=c.split("~~").join("")),f.replaceSelection(d+c+v),y.ch+=s.length,x.ch=y.ch+c.length),f.setSelection(y,x),f.focus()}}function Op(o){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active"))for(var l=o.getCursor("start"),s=o.getCursor("end"),a,f=l.line;f<=s.line;f++)a=o.getLine(f),a=a.replace(/^[ ]*([# ]+|\*|-|[> ]+|[0-9]+(.|\)))[ ]*/,""),o.replaceRange(a,{line:f,ch:0},{line:f,ch:99999999999999})}function fo(o,l){if(Math.abs(o)<1024)return""+o+l[0];var s=0;do o/=1024,++s;while(Math.abs(o)>=1024&&s<l.length);return""+o.toFixed(1)+l[s]}function tc(o,l){for(var s in l)Object.prototype.hasOwnProperty.call(l,s)&&(l[s]instanceof Array?o[s]=l[s].concat(o[s]instanceof Array?o[s]:[]):l[s]!==null&&typeof l[s]=="object"&&l[s].constructor===Object?o[s]=tc(o[s]||{},l[s]):o[s]=l[s]);return o}function sr(o){for(var l=1;l<arguments.length;l++)o=tc(o,arguments[l]);return o}function Zf(o){var l=/[a-zA-Z0-9_\u00A0-\u02AF\u0392-\u03c9\u0410-\u04F9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g,s=o.match(l),a=0;if(s===null)return a;for(var f=0;f<s.length;f++)s[f].charCodeAt(0)>=19968?a+=s[f].length:a+=1;return a}var Be={bold:"fa fa-bold",italic:"fa fa-italic",strikethrough:"fa fa-strikethrough",heading:"fa fa-header fa-heading","heading-smaller":"fa fa-header fa-heading header-smaller","heading-bigger":"fa fa-header fa-heading header-bigger","heading-1":"fa fa-header fa-heading header-1","heading-2":"fa fa-header fa-heading header-2","heading-3":"fa fa-header fa-heading header-3",code:"fa fa-code",quote:"fa fa-quote-left","ordered-list":"fa fa-list-ol","unordered-list":"fa fa-list-ul","check-list":"fa fa-check-square-o","clean-block":"fa fa-eraser",link:"fa fa-link",image:"fa fa-image","upload-image":"fa fa-image",table:"fa fa-table","horizontal-rule":"fa fa-minus",preview:"fa fa-eye","side-by-side":"fa fa-columns",fullscreen:"fa fa-arrows-alt",guide:"fa fa-question-circle",undo:"fa fa-undo",redo:"fa fa-repeat fa-redo"},Ur={bold:{name:"bold",action:co,className:Be.bold,title:"Bold",default:!0},italic:{name:"italic",action:ho,className:Be.italic,title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:po,className:Be.strikethrough,title:"Strikethrough"},heading:{name:"heading",action:fn,className:Be.heading,title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:fn,className:Be["heading-smaller"],title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:vo,className:Be["heading-bigger"],title:"Bigger Heading"},"heading-1":{name:"heading-1",action:bo,className:Be["heading-1"],title:"Big Heading"},"heading-2":{name:"heading-2",action:yo,className:Be["heading-2"],title:"Medium Heading"},"heading-3":{name:"heading-3",action:xo,className:Be["heading-3"],title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:go,className:Be.code,title:"Code"},quote:{name:"quote",action:mo,className:Be.quote,title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:wo,className:Be["unordered-list"],title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:Co,className:Be["ordered-list"],title:"Numbered List",default:!0},"check-list":{name:"check-list",action:Do,className:Be["check-list"],title:"Check List",default:!0},"clean-block":{name:"clean-block",action:ko,className:Be["clean-block"],title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:So,className:Be.link,title:"Create Link",default:!0},image:{name:"image",action:Eo,className:Be.image,title:"Insert Image",default:!0},"upload-image":{name:"upload-image",action:yl,className:Be["upload-image"],title:"Import an image"},table:{name:"table",action:Ao,className:Be.table,title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:Fo,className:Be["horizontal-rule"],title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:Mo,className:Be.preview,noDisable:!0,title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:wi,className:Be["side-by-side"],noDisable:!0,noMobile:!0,title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:jr,className:Be.fullscreen,noDisable:!0,noMobile:!0,title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://www.markdownguide.org/basic-syntax/",className:Be.guide,noDisable:!0,title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:To,className:Be.undo,noDisable:!0,title:"Undo"},redo:{name:"redo",action:Lo,className:Be.redo,noDisable:!0,title:"Redo"}},Ip={link:["[","](#url#)"],image:["![","](#url#)"],uploadedImage:["![](#url#)",""],table:["",`
| Column 1 | Column 2 | Column 3 |
| -------- | -------- | -------- |
| Text | Text | Text |
`],horizontalRule:["",`
-----
`]},Hp={link:"URL for the link:",image:"URL of the image:"},Pp={locale:"en-US",format:{hour:"2-digit",minute:"2-digit"}},qp={bold:"**",code:"```",italic:"*"},Rp={sbInit:"Attach files by drag and dropping or pasting from clipboard.",sbOnDragEnter:"Drop image to upload it.",sbOnDrop:"Uploading image #images_names#...",sbProgress:"Uploading #file_name#: #progress#%",sbOnUploaded:"Uploaded #image_name#",sizeUnits:" B, KB, MB"},Wp={noFileGiven:"You must select a file.",typeNotAllowed:"This image type is not allowed.",fileTooLarge:`Image #image_name# is too big (#image_size#).
Maximum file size is #image_max_size#.`,importError:"Something went wrong when uploading the image #image_name#."};function re(o){o=o||{},o.parent=this;var l=!0;if(o.autoDownloadFontAwesome===!1&&(l=!1),o.autoDownloadFontAwesome!==!0)for(var s=document.styleSheets,a=0;a<s.length;a++)s[a].href&&s[a].href.indexOf("//maxcdn.bootstrapcdn.com/font-awesome/")>-1&&(l=!1);if(l){var f=document.createElement("link");f.rel="stylesheet",f.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(f)}if(o.element)this.element=o.element;else if(o.element===null){console.log("EasyMDE: Error. No element was found.");return}if(o.toolbar===void 0){o.toolbar=[];for(var h in Ur)Object.prototype.hasOwnProperty.call(Ur,h)&&(h.indexOf("separator-")!=-1&&o.toolbar.push("|"),(Ur[h].default===!0||o.showIcons&&o.showIcons.constructor===Array&&o.showIcons.indexOf(h)!=-1)&&o.toolbar.push(h))}if(Object.prototype.hasOwnProperty.call(o,"previewClass")||(o.previewClass="editor-preview"),Object.prototype.hasOwnProperty.call(o,"status")||(o.status=["autosave","lines","words","cursor"],o.uploadImage&&o.status.unshift("upload-image")),o.previewRender||(o.previewRender=function(d){return this.parent.markdown(d)}),o.parsingConfig=sr({highlightFormatting:!0},o.parsingConfig||{}),o.insertTexts=sr({},Ip,o.insertTexts||{}),o.promptTexts=sr({},Hp,o.promptTexts||{}),o.blockStyles=sr({},qp,o.blockStyles||{}),o.autosave!=null&&(o.autosave.timeFormat=sr({},Pp,o.autosave.timeFormat||{})),o.iconClassMap=sr({},Be,o.iconClassMap||{}),o.shortcuts=sr({},Tp,o.shortcuts||{}),o.maxHeight=o.maxHeight||void 0,o.direction=o.direction||"ltr",typeof o.maxHeight<"u"?o.minHeight=o.maxHeight:o.minHeight=o.minHeight||"300px",o.errorCallback=o.errorCallback||function(d){alert(d)},o.uploadImage=o.uploadImage||!1,o.imageMaxSize=o.imageMaxSize||2097152,o.imageAccept=o.imageAccept||"image/png, image/jpeg, image/gif, image/avif",o.imageTexts=sr({},Rp,o.imageTexts||{}),o.errorMessages=sr({},Wp,o.errorMessages||{}),o.imagePathAbsolute=o.imagePathAbsolute||!1,o.imageCSRFName=o.imageCSRFName||"csrfmiddlewaretoken",o.imageCSRFHeader=o.imageCSRFHeader||!1,o.imageInputName=o.imageInputName||"image",o.autosave!=null&&o.autosave.unique_id!=null&&o.autosave.unique_id!=""&&(o.autosave.uniqueId=o.autosave.unique_id),o.overlayMode&&o.overlayMode.combine===void 0&&(o.overlayMode.combine=!0),this.options=o,this.render(),o.initialValue&&(!this.options.autosave||this.options.autosave.foundSavedValue!==!0)&&this.value(o.initialValue),o.uploadImage){var c=this;this.codemirror.on("dragenter",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragend",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragleave",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("dragover",function(d,v){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),v.stopPropagation(),v.preventDefault()}),this.codemirror.on("drop",function(d,v){v.stopPropagation(),v.preventDefault(),o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.dataTransfer.files):c.uploadImages(v.dataTransfer.files)}),this.codemirror.on("paste",function(d,v){o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,v.clipboardData.files):c.uploadImages(v.clipboardData.files)})}}re.prototype.uploadImages=function(o,l,s){if(o.length!==0){for(var a=[],f=0;f<o.length;f++)a.push(o[f].name),this.uploadImage(o[f],l,s);this.updateStatusBar("upload-image",this.options.imageTexts.sbOnDrop.replace("#images_names#",a.join(", ")))}};re.prototype.uploadImagesUsingCustomFunction=function(o,l){if(l.length!==0){for(var s=[],a=0;a<l.length;a++)s.push(l[a].name),this.uploadImageUsingCustomFunction(o,l[a]);this.updateStatusBar("upload-image",this.options.imageTexts.sbOnDrop.replace("#images_names#",s.join(", ")))}};re.prototype.updateStatusBar=function(o,l){if(this.gui.statusbar){var s=this.gui.statusbar.getElementsByClassName(o);s.length===1?this.gui.statusbar.getElementsByClassName(o)[0].textContent=l:s.length===0?console.log("EasyMDE: status bar item "+o+" was not found."):console.log("EasyMDE: Several status bar items named "+o+" was found.")}};re.prototype.markdown=function(o){if(pl){var l;if(this.options&&this.options.renderingConfig&&this.options.renderingConfig.markedOptions?l=this.options.renderingConfig.markedOptions:l={},this.options&&this.options.renderingConfig&&this.options.renderingConfig.singleLineBreaks===!1?l.breaks=!1:l.breaks=!0,this.options&&this.options.renderingConfig&&this.options.renderingConfig.codeSyntaxHighlighting===!0){var s=this.options.renderingConfig.hljs||window.hljs;s&&(l.highlight=function(f,h){return h&&s.getLanguage(h)?s.highlight(h,f).value:s.highlightAuto(f).value})}pl.use(l);var a=pl.parse(o);return this.options.renderingConfig&&typeof this.options.renderingConfig.sanitizerFunction=="function"&&(a=this.options.renderingConfig.sanitizerFunction.call(this,a)),a=Mp(a),a=Bp(a),a}};re.prototype.render=function(o){if(o||(o=this.element||document.getElementsByTagName("textarea")[0]),this._rendered&&this._rendered===o)return;this.element=o;var l=this.options,s=this,a={};for(var f in l.shortcuts)l.shortcuts[f]!==null&&un[f]!==null&&function(T){a[Jf(l.shortcuts[T])]=function(){var N=un[T];typeof N=="function"?N(s):typeof N=="string"&&window.open(N,"_blank")}}(f);a.Enter="newlineAndIndentContinueMarkdownList",a.Tab="tabAndIndentMarkdownList",a["Shift-Tab"]="shiftTabAndUnindentMarkdownList",a.Esc=function(T){T.getOption("fullScreen")&&jr(s)},this.documentOnKeyDown=function(T){T=T||window.event,T.keyCode==27&&s.codemirror.getOption("fullScreen")&&jr(s)},document.addEventListener("keydown",this.documentOnKeyDown,!1);var h,c;l.overlayMode?(xi.defineMode("overlay-mode",function(T){return xi.overlayMode(xi.getMode(T,l.spellChecker!==!1?"spell-checker":"gfm"),l.overlayMode.mode,l.overlayMode.combine)}),h="overlay-mode",c=l.parsingConfig,c.gitHubSpice=!1):(h=l.parsingConfig,h.name="gfm",h.gitHubSpice=!1),l.spellChecker!==!1&&(h="spell-checker",c=l.parsingConfig,c.name="gfm",c.gitHubSpice=!1,typeof l.spellChecker=="function"?l.spellChecker({codeMirrorInstance:xi}):Ap({codeMirrorInstance:xi}));function d(T,N,z){return{addNew:!1}}if(this.codemirror=xi.fromTextArea(o,{mode:h,backdrop:c,theme:l.theme!=null?l.theme:"easymde",tabSize:l.tabSize!=null?l.tabSize:2,indentUnit:l.tabSize!=null?l.tabSize:2,indentWithTabs:l.indentWithTabs!==!1,lineNumbers:l.lineNumbers===!0,autofocus:l.autofocus===!0,extraKeys:a,direction:l.direction,lineWrapping:l.lineWrapping!==!1,allowDropFileTypes:["text/plain"],placeholder:l.placeholder||o.getAttribute("placeholder")||"",styleSelectedText:l.styleSelectedText!=null?l.styleSelectedText:!gl(),scrollbarStyle:l.scrollbarStyle!=null?l.scrollbarStyle:"native",configureMouse:d,inputStyle:l.inputStyle!=null?l.inputStyle:gl()?"contenteditable":"textarea",spellcheck:l.nativeSpellcheck!=null?l.nativeSpellcheck:!0,autoRefresh:l.autoRefresh!=null?l.autoRefresh:!1}),this.codemirror.getScrollerElement().style.minHeight=l.minHeight,typeof l.maxHeight<"u"&&(this.codemirror.getScrollerElement().style.height=l.maxHeight),l.forceSync===!0){var v=this.codemirror;v.on("change",function(){v.save()})}this.gui={};var y=document.createElement("div");y.classList.add("EasyMDEContainer"),y.setAttribute("role","application");var x=this.codemirror.getWrapperElement();x.parentNode.insertBefore(y,x),y.appendChild(x),l.toolbar!==!1&&(this.gui.toolbar=this.createToolbar()),l.status!==!1&&(this.gui.statusbar=this.createStatusbar()),l.autosave!=null&&l.autosave.enabled===!0&&(this.autosave(),this.codemirror.on("change",function(){clearTimeout(s._autosave_timeout),s._autosave_timeout=setTimeout(function(){s.autosave()},s.options.autosave.submit_delay||s.options.autosave.delay||1e3)}));function D(T,N){var z,O=window.getComputedStyle(document.querySelector(".CodeMirror-sizer")).width.replace("px","");return T<O?z=N+"px":z=N/T*100+"%",z}var k=this;function F(T,N){var z=new URL(N.url,document.baseURI).href;T.setAttribute("data-img-src",z),T.setAttribute("style","--bg-image:url("+z+");--width:"+N.naturalWidth+"px;--height:"+D(N.naturalWidth,N.naturalHeight)),k.codemirror.setSize()}function B(){l.previewImagesInEditor&&y.querySelectorAll(".cm-image-marker").forEach(function(T){var N=T.parentElement;if(N.innerText.match(/^!\[.*?\]\(.*\)/g)&&!N.hasAttribute("data-img-src")){var z=N.innerText.match(/!\[.*?\]\((.*?)\)/);if(window.EMDEimagesCache||(window.EMDEimagesCache={}),z&&z.length>=2){var O=z[1];if(l.imagesPreviewHandler){var I=l.imagesPreviewHandler(z[1]);typeof I=="string"&&(O=I)}if(window.EMDEimagesCache[O])F(N,window.EMDEimagesCache[O]);else{window.EMDEimagesCache[O]={};var W=document.createElement("img");W.onload=function(){window.EMDEimagesCache[O]={naturalWidth:W.naturalWidth,naturalHeight:W.naturalHeight,url:O},F(N,window.EMDEimagesCache[O])},W.src=O}}}})}this.codemirror.on("update",function(){B()}),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element,(l.autofocus===!0||o.autofocus)&&this.codemirror.focus();var L=this.codemirror;setTimeout(function(){L.refresh()}.bind(L),0)};re.prototype.cleanup=function(){document.removeEventListener("keydown",this.documentOnKeyDown)};function rc(){if(typeof localStorage=="object")try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch{return!1}else return!1;return!0}re.prototype.autosave=function(){if(rc()){var o=this;if(this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to use the autosave feature");return}this.options.autosave.binded!==!0&&(o.element.form!=null&&o.element.form!=null&&o.element.form.addEventListener("submit",function(){clearTimeout(o.autosaveTimeoutId),o.autosaveTimeoutId=void 0,localStorage.removeItem("smde_"+o.options.autosave.uniqueId)}),this.options.autosave.binded=!0),this.options.autosave.loaded!==!0&&(typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)=="string"&&localStorage.getItem("smde_"+this.options.autosave.uniqueId)!=""&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0);var l=o.value();l!==""?localStorage.setItem("smde_"+this.options.autosave.uniqueId,l):localStorage.removeItem("smde_"+this.options.autosave.uniqueId);var s=document.getElementById("autosaved");if(s!=null&&s!=null&&s!=""){var a=new Date,f=new Intl.DateTimeFormat([this.options.autosave.timeFormat.locale,"en-US"],this.options.autosave.timeFormat.format).format(a),h=this.options.autosave.text==null?"Autosaved: ":this.options.autosave.text;s.innerHTML=h+f}}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.clearAutosavedValue=function(){if(rc()){if(this.options.autosave==null||this.options.autosave.uniqueId==null||this.options.autosave.uniqueId==""){console.log("EasyMDE: You must set a uniqueId to clear the autosave value");return}localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("EasyMDE: localStorage not available, cannot autosave")};re.prototype.openBrowseFileWindow=function(o,l){var s=this,a=this.gui.toolbar.getElementsByClassName("imageInput")[0];a.click();function f(h){s.options.imageUploadFunction?s.uploadImagesUsingCustomFunction(s.options.imageUploadFunction,h.target.files):s.uploadImages(h.target.files,o,l),a.removeEventListener("change",f)}a.addEventListener("change",f)};re.prototype.uploadImage=function(o,l,s){var a=this;l=l||function(y){$f(a,y)};function f(v){a.updateStatusBar("upload-image",v),setTimeout(function(){a.updateStatusBar("upload-image",a.options.imageTexts.sbInit)},1e4),s&&typeof s=="function"&&s(v),a.options.errorCallback(v)}function h(v){var y=a.options.imageTexts.sizeUnits.split(",");return v.replace("#image_name#",o.name).replace("#image_size#",fo(o.size,y)).replace("#image_max_size#",fo(a.options.imageMaxSize,y))}if(o.size>this.options.imageMaxSize){f(h(this.options.errorMessages.fileTooLarge));return}var c=new FormData;c.append("image",o),a.options.imageCSRFToken&&!a.options.imageCSRFHeader&&c.append(a.options.imageCSRFName,a.options.imageCSRFToken);var d=new XMLHttpRequest;d.upload.onprogress=function(v){if(v.lengthComputable){var y=""+Math.round(v.loaded*100/v.total);a.updateStatusBar("upload-image",a.options.imageTexts.sbProgress.replace("#file_name#",o.name).replace("#progress#",y))}},d.open("POST",this.options.imageUploadEndpoint),a.options.imageCSRFToken&&a.options.imageCSRFHeader&&d.setRequestHeader(a.options.imageCSRFName,a.options.imageCSRFToken),d.onload=function(){try{var v=JSON.parse(this.responseText)}catch{console.error("EasyMDE: The server did not return a valid json."),f(h(a.options.errorMessages.importError));return}this.status===200&&v&&!v.error&&v.data&&v.data.filePath?l((a.options.imagePathAbsolute?"":window.location.origin+"/")+v.data.filePath):v.error&&v.error in a.options.errorMessages?f(h(a.options.errorMessages[v.error])):v.error?f(h(v.error)):(console.error("EasyMDE: Received an unexpected response after uploading the image."+this.status+" ("+this.statusText+")"),f(h(a.options.errorMessages.importError)))},d.onerror=function(v){console.error("EasyMDE: An unexpected error occurred when trying to upload the image."+v.target.status+" ("+v.target.statusText+")"),f(a.options.errorMessages.importError)},d.send(c)};re.prototype.uploadImageUsingCustomFunction=function(o,l){var s=this;function a(c){$f(s,c)}function f(c){var d=h(c);s.updateStatusBar("upload-image",d),setTimeout(function(){s.updateStatusBar("upload-image",s.options.imageTexts.sbInit)},1e4),s.options.errorCallback(d)}function h(c){var d=s.options.imageTexts.sizeUnits.split(",");return c.replace("#image_name#",l.name).replace("#image_size#",fo(l.size,d)).replace("#image_max_size#",fo(s.options.imageMaxSize,d))}o.apply(this,[l,a,f])};re.prototype.setPreviewMaxHeight=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling,a=parseInt(window.getComputedStyle(l).paddingTop),f=parseInt(window.getComputedStyle(l).borderTopWidth),h=parseInt(this.options.maxHeight),c=h+a*2+f*2,d=c.toString()+"px";s.style.height=d};re.prototype.createSideBySide=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling;if(!s||!s.classList.contains("editor-preview-side")){if(s=document.createElement("div"),s.className="editor-preview-side",this.options.previewClass)if(Array.isArray(this.options.previewClass))for(var a=0;a<this.options.previewClass.length;a++)s.classList.add(this.options.previewClass[a]);else typeof this.options.previewClass=="string"&&s.classList.add(this.options.previewClass);l.parentNode.insertBefore(s,l.nextSibling)}if(typeof this.options.maxHeight<"u"&&this.setPreviewMaxHeight(),this.options.syncSideBySidePreviewScroll===!1)return s;var f=!1,h=!1;return o.on("scroll",function(c){if(f){f=!1;return}h=!0;var d=c.getScrollInfo().height-c.getScrollInfo().clientHeight,v=parseFloat(c.getScrollInfo().top)/d,y=(s.scrollHeight-s.clientHeight)*v;s.scrollTop=y}),s.onscroll=function(){if(h){h=!1;return}f=!0;var c=s.scrollHeight-s.clientHeight,d=parseFloat(s.scrollTop)/c,v=(o.getScrollInfo().height-o.getScrollInfo().clientHeight)*d;o.scrollTo(0,v)},s};re.prototype.createToolbar=function(o){if(o=o||this.options.toolbar,!(!o||o.length===0)){var l;for(l=0;l<o.length;l++)Ur[o[l]]!=null&&(o[l]=Ur[o[l]]);var s=document.createElement("div");s.className="editor-toolbar",s.setAttribute("role","toolbar");var a=this,f={};for(a.toolbar=o,l=0;l<o.length;l++)if(!(o[l].name=="guide"&&a.options.toolbarGuideIcon===!1)&&!(a.options.hideIcons&&a.options.hideIcons.indexOf(o[l].name)!=-1)&&!((o[l].name=="fullscreen"||o[l].name=="side-by-side")&&gl())){if(o[l]==="|"){for(var h=!1,c=l+1;c<o.length;c++)o[c]!=="|"&&(!a.options.hideIcons||a.options.hideIcons.indexOf(o[c].name)==-1)&&(h=!0);if(!h)continue}(function(y){var x;if(y==="|"?x=zp():y.children?x=_p(y,a.options.toolbarTips,a.options.shortcuts,a):x=uo(y,!0,a.options.toolbarTips,a.options.shortcuts,"button",a),f[y.name||y]=x,s.appendChild(x),y.name==="upload-image"){var D=document.createElement("input");D.className="imageInput",D.type="file",D.multiple=!0,D.name=a.options.imageInputName,D.accept=a.options.imageAccept,D.style.display="none",D.style.opacity=0,s.appendChild(D)}})(o[l])}a.toolbar_div=s,a.toolbarElements=f;var d=this.codemirror;d.on("cursorActivity",function(){var y=Sr(d);for(var x in f)(function(D){var k=f[D];y[D]?k.classList.add("active"):D!="fullscreen"&&D!="side-by-side"&&k.classList.remove("active")})(x)});var v=d.getWrapperElement();return v.parentNode.insertBefore(s,v),s}};re.prototype.createStatusbar=function(o){o=o||this.options.status;var l=this.options,s=this.codemirror;if(!(!o||o.length===0)){var a=[],f,h,c,d;for(f=0;f<o.length;f++)if(h=void 0,c=void 0,d=void 0,typeof o[f]=="object")a.push({className:o[f].className,defaultValue:o[f].defaultValue,onUpdate:o[f].onUpdate,onActivity:o[f].onActivity});else{var v=o[f];v==="words"?(d=function(F){F.innerHTML=Zf(s.getValue())},h=function(F){F.innerHTML=Zf(s.getValue())}):v==="lines"?(d=function(F){F.innerHTML=s.lineCount()},h=function(F){F.innerHTML=s.lineCount()}):v==="cursor"?(d=function(F){F.innerHTML="1:1"},c=function(F){var B=s.getCursor(),L=B.line+1,T=B.ch+1;F.innerHTML=L+":"+T}):v==="autosave"?d=function(F){l.autosave!=null&&l.autosave.enabled===!0&&F.setAttribute("id","autosaved")}:v==="upload-image"&&(d=function(F){F.innerHTML=l.imageTexts.sbInit}),a.push({className:v,defaultValue:d,onUpdate:h,onActivity:c})}var y=document.createElement("div");for(y.className="editor-statusbar",f=0;f<a.length;f++){var x=a[f],D=document.createElement("span");D.className=x.className,typeof x.defaultValue=="function"&&x.defaultValue(D),typeof x.onUpdate=="function"&&this.codemirror.on("update",function(F,B){return function(){B.onUpdate(F)}}(D,x)),typeof x.onActivity=="function"&&this.codemirror.on("cursorActivity",function(F,B){return function(){B.onActivity(F)}}(D,x)),y.appendChild(D)}var k=this.codemirror.getWrapperElement();return k.parentNode.insertBefore(y,k.nextSibling),y}};re.prototype.value=function(o){var l=this.codemirror;if(o===void 0)return l.getValue();if(l.getDoc().setValue(o),this.isPreviewActive()){var s=l.getWrapperElement(),a=s.lastChild,f=this.options.previewRender(o,a);f!==null&&(a.innerHTML=f)}return this};re.toggleBold=co;re.toggleItalic=ho;re.toggleStrikethrough=po;re.toggleBlockquote=mo;re.toggleHeadingSmaller=fn;re.toggleHeadingBigger=vo;re.toggleHeading1=bo;re.toggleHeading2=yo;re.toggleHeading3=xo;re.toggleHeading4=ml;re.toggleHeading5=vl;re.toggleHeading6=bl;re.toggleCodeBlock=go;re.toggleUnorderedList=wo;re.toggleOrderedList=Co;re.toggleCheckList=Do;re.cleanBlock=ko;re.drawLink=So;re.drawImage=Eo;re.drawUploadedImage=yl;re.drawTable=Ao;re.drawHorizontalRule=Fo;re.undo=To;re.redo=Lo;re.togglePreview=Mo;re.toggleSideBySide=wi;re.toggleFullScreen=jr;re.prototype.toggleBold=function(){co(this)};re.prototype.toggleItalic=function(){ho(this)};re.prototype.toggleStrikethrough=function(){po(this)};re.prototype.toggleBlockquote=function(){mo(this)};re.prototype.toggleHeadingSmaller=function(){fn(this)};re.prototype.toggleHeadingBigger=function(){vo(this)};re.prototype.toggleHeading1=function(){bo(this)};re.prototype.toggleHeading2=function(){yo(this)};re.prototype.toggleHeading3=function(){xo(this)};re.prototype.toggleHeading4=function(){ml(this)};re.prototype.toggleHeading5=function(){vl(this)};re.prototype.toggleHeading6=function(){bl(this)};re.prototype.toggleCodeBlock=function(){go(this)};re.prototype.toggleUnorderedList=function(){wo(this)};re.prototype.toggleOrderedList=function(){Co(this)};re.prototype.toggleCheckList=function(){Do(this)};re.prototype.cleanBlock=function(){ko(this)};re.prototype.drawLink=function(){So(this)};re.prototype.drawImage=function(){Eo(this)};re.prototype.drawUploadedImage=function(){yl(this)};re.prototype.drawTable=function(){Ao(this)};re.prototype.drawHorizontalRule=function(){Fo(this)};re.prototype.undo=function(){To(this)};re.prototype.redo=function(){Lo(this)};re.prototype.togglePreview=function(){Mo(this)};re.prototype.toggleSideBySide=function(){wi(this)};re.prototype.toggleFullScreen=function(){jr(this)};re.prototype.isPreviewActive=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.lastChild;return s.classList.contains("editor-preview-active")};re.prototype.isSideBySideActive=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.nextSibling;return s.classList.contains("editor-preview-active-side")};re.prototype.isFullscreenActive=function(){var o=this.codemirror;return o.getOption("fullScreen")};re.prototype.getState=function(){var o=this.codemirror;return Sr(o)};re.prototype.toTextArea=function(){var o=this.codemirror,l=o.getWrapperElement(),s=l.parentNode;s&&(this.gui.toolbar&&s.removeChild(this.gui.toolbar),this.gui.statusbar&&s.removeChild(this.gui.statusbar),this.gui.sideBySide&&s.removeChild(this.gui.sideBySide)),s.parentNode.insertBefore(l,s),s.remove(),o.toTextArea(),this.autosaveTimeoutId&&(clearTimeout(this.autosaveTimeoutId),this.autosaveTimeoutId=void 0,this.clearAutosavedValue())};ic.exports=re});var Zr=Jh(nc());function Up(o,l,s){return(l=Kp(l))in o?Object.defineProperty(o,l,{value:s,enumerable:!0,configurable:!0,writable:!0}):o[l]=s,o}function fr(){return fr=Object.assign?Object.assign.bind():function(o){for(var l=1;l<arguments.length;l++){var s=arguments[l];for(var a in s)({}).hasOwnProperty.call(s,a)&&(o[a]=s[a])}return o},fr.apply(null,arguments)}function oc(o,l){var s=Object.keys(o);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(o);l&&(a=a.filter(function(f){return Object.getOwnPropertyDescriptor(o,f).enumerable})),s.push.apply(s,a)}return s}function er(o){for(var l=1;l<arguments.length;l++){var s=arguments[l]!=null?arguments[l]:{};l%2?oc(Object(s),!0).forEach(function(a){Up(o,a,s[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(o,Object.getOwnPropertyDescriptors(s)):oc(Object(s)).forEach(function(a){Object.defineProperty(o,a,Object.getOwnPropertyDescriptor(s,a))})}return o}function jp(o,l){if(o==null)return{};var s,a,f=Gp(o,l);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(o);for(a=0;a<h.length;a++)s=h[a],l.indexOf(s)===-1&&{}.propertyIsEnumerable.call(o,s)&&(f[s]=o[s])}return f}function Gp(o,l){if(o==null)return{};var s={};for(var a in o)if({}.hasOwnProperty.call(o,a)){if(l.indexOf(a)!==-1)continue;s[a]=o[a]}return s}function Xp(o,l){if(typeof o!="object"||!o)return o;var s=o[Symbol.toPrimitive];if(s!==void 0){var a=s.call(o,l||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}function Kp(o){var l=Xp(o,"string");return typeof l=="symbol"?l:l+""}function Ll(o){"@babel/helpers - typeof";return Ll=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(l){return typeof l}:function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},Ll(o)}var Yp="1.15.7";function ur(o){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(o)}var cr=ur(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),yn=ur(/Edge/i),ac=ur(/firefox/i),pn=ur(/safari/i)&&!ur(/chrome/i)&&!ur(/android/i),Nl=ur(/iP(ad|od|hone)/i),pc=ur(/chrome/i)&&ur(/android/i),gc={capture:!1,passive:!1};function Se(o,l,s){o.addEventListener(l,s,!cr&&gc)}function ke(o,l,s){o.removeEventListener(l,s,!cr&&gc)}function Ro(o,l){if(l){if(l[0]===">"&&(l=l.substring(1)),o)try{if(o.matches)return o.matches(l);if(o.msMatchesSelector)return o.msMatchesSelector(l);if(o.webkitMatchesSelector)return o.webkitMatchesSelector(l)}catch{return!1}return!1}}function mc(o){return o.host&&o!==document&&o.host.nodeType&&o.host!==o?o.host:o.parentNode}function Gt(o,l,s,a){if(o){s=s||document;do{if(l!=null&&(l[0]===">"?o.parentNode===s&&Ro(o,l):Ro(o,l))||a&&o===s)return o;if(o===s)break}while(o=mc(o))}return null}var lc=/\s+/g;function zt(o,l,s){if(o&&l)if(o.classList)o.classList[s?"add":"remove"](l);else{var a=(" "+o.className+" ").replace(lc," ").replace(" "+l+" "," ");o.className=(a+(s?" "+l:"")).replace(lc," ")}}function pe(o,l,s){var a=o&&o.style;if(a){if(s===void 0)return document.defaultView&&document.defaultView.getComputedStyle?s=document.defaultView.getComputedStyle(o,""):o.currentStyle&&(s=o.currentStyle),l===void 0?s:s[l];!(l in a)&&l.indexOf("webkit")===-1&&(l="-webkit-"+l),a[l]=s+(typeof s=="string"?"":"px")}}function Ei(o,l){var s="";if(typeof o=="string")s=o;else do{var a=pe(o,"transform");a&&a!=="none"&&(s=a+" "+s)}while(!l&&(o=o.parentNode));var f=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return f&&new f(s)}function vc(o,l,s){if(o){var a=o.getElementsByTagName(l),f=0,h=a.length;if(s)for(;f<h;f++)s(a[f],f);return a}return[]}function $t(){var o=document.scrollingElement;return o||document.documentElement}function Ve(o,l,s,a,f){if(!(!o.getBoundingClientRect&&o!==window)){var h,c,d,v,y,x,D;if(o!==window&&o.parentNode&&o!==$t()?(h=o.getBoundingClientRect(),c=h.top,d=h.left,v=h.bottom,y=h.right,x=h.height,D=h.width):(c=0,d=0,v=window.innerHeight,y=window.innerWidth,x=window.innerHeight,D=window.innerWidth),(l||s)&&o!==window&&(f=f||o.parentNode,!cr))do if(f&&f.getBoundingClientRect&&(pe(f,"transform")!=="none"||s&&pe(f,"position")!=="static")){var k=f.getBoundingClientRect();c-=k.top+parseInt(pe(f,"border-top-width")),d-=k.left+parseInt(pe(f,"border-left-width")),v=c+h.height,y=d+h.width;break}while(f=f.parentNode);if(a&&o!==window){var F=Ei(f||o),B=F&&F.a,L=F&&F.d;F&&(c/=L,d/=B,D/=B,x/=L,v=c+x,y=d+D)}return{top:c,left:d,bottom:v,right:y,width:D,height:x}}}function sc(o,l,s){for(var a=Tr(o,!0),f=Ve(o)[l];a;){var h=Ve(a)[s],c=void 0;if(s==="top"||s==="left"?c=f>=h:c=f<=h,!c)return a;if(a===$t())break;a=Tr(a,!1)}return!1}function Ai(o,l,s,a){for(var f=0,h=0,c=o.children;h<c.length;){if(c[h].style.display!=="none"&&c[h]!==ge.ghost&&(a||c[h]!==ge.dragged)&&Gt(c[h],s.draggable,o,!1)){if(f===l)return c[h];f++}h++}return null}function Ol(o,l){for(var s=o.lastElementChild;s&&(s===ge.ghost||pe(s,"display")==="none"||l&&!Ro(s,l));)s=s.previousElementSibling;return s||null}function It(o,l){var s=0;if(!o||!o.parentNode)return-1;for(;o=o.previousElementSibling;)o.nodeName.toUpperCase()!=="TEMPLATE"&&o!==ge.clone&&(!l||Ro(o,l))&&s++;return s}function uc(o){var l=0,s=0,a=$t();if(o)do{var f=Ei(o),h=f.a,c=f.d;l+=o.scrollLeft*h,s+=o.scrollTop*c}while(o!==a&&(o=o.parentNode));return[l,s]}function Zp(o,l){for(var s in o)if(o.hasOwnProperty(s)){for(var a in l)if(l.hasOwnProperty(a)&&l[a]===o[s][a])return Number(s)}return-1}function Tr(o,l){if(!o||!o.getBoundingClientRect)return $t();var s=o,a=!1;do if(s.clientWidth<s.scrollWidth||s.clientHeight<s.scrollHeight){var f=pe(s);if(s.clientWidth<s.scrollWidth&&(f.overflowX=="auto"||f.overflowX=="scroll")||s.clientHeight<s.scrollHeight&&(f.overflowY=="auto"||f.overflowY=="scroll")){if(!s.getBoundingClientRect||s===document.body)return $t();if(a||l)return s;a=!0}}while(s=s.parentNode);return $t()}function Qp(o,l){if(o&&l)for(var s in l)l.hasOwnProperty(s)&&(o[s]=l[s]);return o}function wl(o,l){return Math.round(o.top)===Math.round(l.top)&&Math.round(o.left)===Math.round(l.left)&&Math.round(o.height)===Math.round(l.height)&&Math.round(o.width)===Math.round(l.width)}var gn;function bc(o,l){return function(){if(!gn){var s=arguments,a=this;s.length===1?o.call(a,s[0]):o.apply(a,s),gn=setTimeout(function(){gn=void 0},l)}}}function Jp(){clearTimeout(gn),gn=void 0}function yc(o,l,s){o.scrollLeft+=l,o.scrollTop+=s}function xc(o){var l=window.Polymer,s=window.jQuery||window.Zepto;return l&&l.dom?l.dom(o).cloneNode(!0):s?s(o).clone(!0)[0]:o.cloneNode(!0)}function wc(o,l,s){var a={};return Array.from(o.children).forEach(function(f){var h,c,d,v;if(!(!Gt(f,l.draggable,o,!1)||f.animated||f===s)){var y=Ve(f);a.left=Math.min((h=a.left)!==null&&h!==void 0?h:1/0,y.left),a.top=Math.min((c=a.top)!==null&&c!==void 0?c:1/0,y.top),a.right=Math.max((d=a.right)!==null&&d!==void 0?d:-1/0,y.right),a.bottom=Math.max((v=a.bottom)!==null&&v!==void 0?v:-1/0,y.bottom)}}),a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}var Tt="Sortable"+new Date().getTime();function Vp(){var o=[],l;return{captureAnimationState:function(){if(o=[],!!this.options.animation){var a=[].slice.call(this.el.children);a.forEach(function(f){if(!(pe(f,"display")==="none"||f===ge.ghost)){o.push({target:f,rect:Ve(f)});var h=er({},o[o.length-1].rect);if(f.thisAnimationDuration){var c=Ei(f,!0);c&&(h.top-=c.f,h.left-=c.e)}f.fromRect=h}})}},addAnimationState:function(a){o.push(a)},removeAnimationState:function(a){o.splice(Zp(o,{target:a}),1)},animateAll:function(a){var f=this;if(!this.options.animation){clearTimeout(l),typeof a=="function"&&a();return}var h=!1,c=0;o.forEach(function(d){var v=0,y=d.target,x=y.fromRect,D=Ve(y),k=y.prevFromRect,F=y.prevToRect,B=d.rect,L=Ei(y,!0);L&&(D.top-=L.f,D.left-=L.e),y.toRect=D,y.thisAnimationDuration&&wl(k,D)&&!wl(x,D)&&(B.top-D.top)/(B.left-D.left)===(x.top-D.top)/(x.left-D.left)&&(v=e0(B,k,F,f.options)),wl(D,x)||(y.prevFromRect=x,y.prevToRect=D,v||(v=f.options.animation),f.animate(y,B,D,v)),v&&(h=!0,c=Math.max(c,v),clearTimeout(y.animationResetTimer),y.animationResetTimer=setTimeout(function(){y.animationTime=0,y.prevFromRect=null,y.fromRect=null,y.prevToRect=null,y.thisAnimationDuration=null},v),y.thisAnimationDuration=v)}),clearTimeout(l),h?l=setTimeout(function(){typeof a=="function"&&a()},c):typeof a=="function"&&a(),o=[]},animate:function(a,f,h,c){if(c){pe(a,"transition",""),pe(a,"transform","");var d=Ei(this.el),v=d&&d.a,y=d&&d.d,x=(f.left-h.left)/(v||1),D=(f.top-h.top)/(y||1);a.animatingX=!!x,a.animatingY=!!D,pe(a,"transform","translate3d("+x+"px,"+D+"px,0)"),this.forRepaintDummy=$p(a),pe(a,"transition","transform "+c+"ms"+(this.options.easing?" "+this.options.easing:"")),pe(a,"transform","translate3d(0,0,0)"),typeof a.animated=="number"&&clearTimeout(a.animated),a.animated=setTimeout(function(){pe(a,"transition",""),pe(a,"transform",""),a.animated=!1,a.animatingX=!1,a.animatingY=!1},c)}}}}function $p(o){return o.offsetWidth}function e0(o,l,s,a){return Math.sqrt(Math.pow(l.top-o.top,2)+Math.pow(l.left-o.left,2))/Math.sqrt(Math.pow(l.top-s.top,2)+Math.pow(l.left-s.left,2))*a.animation}var Ci=[],Cl={initializeByDefault:!0},xn={mount:function(l){for(var s in Cl)Cl.hasOwnProperty(s)&&!(s in l)&&(l[s]=Cl[s]);Ci.forEach(function(a){if(a.pluginName===l.pluginName)throw"Sortable: Cannot mount plugin ".concat(l.pluginName," more than once")}),Ci.push(l)},pluginEvent:function(l,s,a){var f=this;this.eventCanceled=!1,a.cancel=function(){f.eventCanceled=!0};var h=l+"Global";Ci.forEach(function(c){s[c.pluginName]&&(s[c.pluginName][h]&&s[c.pluginName][h](er({sortable:s},a)),s.options[c.pluginName]&&s[c.pluginName][l]&&s[c.pluginName][l](er({sortable:s},a)))})},initializePlugins:function(l,s,a,f){Ci.forEach(function(d){var v=d.pluginName;if(!(!l.options[v]&&!d.initializeByDefault)){var y=new d(l,s,l.options);y.sortable=l,y.options=l.options,l[v]=y,fr(a,y.defaults)}});for(var h in l.options)if(l.options.hasOwnProperty(h)){var c=this.modifyOption(l,h,l.options[h]);typeof c<"u"&&(l.options[h]=c)}},getEventProperties:function(l,s){var a={};return Ci.forEach(function(f){typeof f.eventProperties=="function"&&fr(a,f.eventProperties.call(s[f.pluginName],l))}),a},modifyOption:function(l,s,a){var f;return Ci.forEach(function(h){l[h.pluginName]&&h.optionListeners&&typeof h.optionListeners[s]=="function"&&(f=h.optionListeners[s].call(l[h.pluginName],a))}),f}};function t0(o){var l=o.sortable,s=o.rootEl,a=o.name,f=o.targetEl,h=o.cloneEl,c=o.toEl,d=o.fromEl,v=o.oldIndex,y=o.newIndex,x=o.oldDraggableIndex,D=o.newDraggableIndex,k=o.originalEvent,F=o.putSortable,B=o.extraEventProperties;if(l=l||s&&s[Tt],!!l){var L,T=l.options,N="on"+a.charAt(0).toUpperCase()+a.substr(1);window.CustomEvent&&!cr&&!yn?L=new CustomEvent(a,{bubbles:!0,cancelable:!0}):(L=document.createEvent("Event"),L.initEvent(a,!0,!0)),L.to=c||s,L.from=d||s,L.item=f||s,L.clone=h,L.oldIndex=v,L.newIndex=y,L.oldDraggableIndex=x,L.newDraggableIndex=D,L.originalEvent=k,L.pullMode=F?F.lastPutMode:void 0;var z=er(er({},B),xn.getEventProperties(a,l));for(var O in z)L[O]=z[O];s&&s.dispatchEvent(L),T[N]&&T[N].call(l,L)}}var r0=["evt"],Ft=function(l,s){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},f=a.evt,h=jp(a,r0);xn.pluginEvent.bind(ge)(l,s,er({dragEl:$,parentEl:Ue,ghostEl:ye,rootEl:He,nextEl:Yr,lastDownEl:Io,cloneEl:Re,cloneHidden:Fr,dragStarted:cn,putSortable:ut,activeSortable:ge.active,originalEvent:f,oldIndex:Si,oldDraggableIndex:mn,newIndex:Nt,newDraggableIndex:Ar,hideGhostForTarget:Sc,unhideGhostForTarget:Ec,cloneNowHidden:function(){Fr=!0},cloneNowShown:function(){Fr=!1},dispatchSortableEvent:function(d){kt({sortable:s,name:d,originalEvent:f})}},h))};function kt(o){t0(er({putSortable:ut,cloneEl:Re,targetEl:$,rootEl:He,oldIndex:Si,oldDraggableIndex:mn,newIndex:Nt,newDraggableIndex:Ar},o))}var $,Ue,ye,He,Yr,Io,Re,Fr,Si,Nt,mn,Ar,_o,ut,ki=!1,Wo=!1,Uo=[],Xr,jt,Dl,kl,fc,cc,cn,Di,vn,bn=!1,zo=!1,Ho,gt,Sl=[],Ml=!1,jo=[],Xo=typeof document<"u",No=Nl,dc=yn||cr?"cssFloat":"float",i0=Xo&&!pc&&!Nl&&"draggable"in document.createElement("div"),Cc=function(){if(Xo){if(cr)return!1;var o=document.createElement("x");return o.style.cssText="pointer-events:auto",o.style.pointerEvents==="auto"}}(),Dc=function(l,s){var a=pe(l),f=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),h=Ai(l,0,s),c=Ai(l,1,s),d=h&&pe(h),v=c&&pe(c),y=d&&parseInt(d.marginLeft)+parseInt(d.marginRight)+Ve(h).width,x=v&&parseInt(v.marginLeft)+parseInt(v.marginRight)+Ve(c).width;if(a.display==="flex")return a.flexDirection==="column"||a.flexDirection==="column-reverse"?"vertical":"horizontal";if(a.display==="grid")return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(h&&d.float&&d.float!=="none"){var D=d.float==="left"?"left":"right";return c&&(v.clear==="both"||v.clear===D)?"vertical":"horizontal"}return h&&(d.display==="block"||d.display==="flex"||d.display==="table"||d.display==="grid"||y>=f&&a[dc]==="none"||c&&a[dc]==="none"&&y+x>f)?"vertical":"horizontal"},n0=function(l,s,a){var f=a?l.left:l.top,h=a?l.right:l.bottom,c=a?l.width:l.height,d=a?s.left:s.top,v=a?s.right:s.bottom,y=a?s.width:s.height;return f===d||h===v||f+c/2===d+y/2},o0=function(l,s){var a;return Uo.some(function(f){var h=f[Tt].options.emptyInsertThreshold;if(!(!h||Ol(f))){var c=Ve(f),d=l>=c.left-h&&l<=c.right+h,v=s>=c.top-h&&s<=c.bottom+h;if(d&&v)return a=f}}),a},kc=function(l){function s(h,c){return function(d,v,y,x){var D=d.options.group.name&&v.options.group.name&&d.options.group.name===v.options.group.name;if(h==null&&(c||D))return!0;if(h==null||h===!1)return!1;if(c&&h==="clone")return h;if(typeof h=="function")return s(h(d,v,y,x),c)(d,v,y,x);var k=(c?d:v).options.group.name;return h===!0||typeof h=="string"&&h===k||h.join&&h.indexOf(k)>-1}}var a={},f=l.group;(!f||Ll(f)!="object")&&(f={name:f}),a.name=f.name,a.checkPull=s(f.pull,!0),a.checkPut=s(f.put),a.revertClone=f.revertClone,l.group=a},Sc=function(){!Cc&&ye&&pe(ye,"display","none")},Ec=function(){!Cc&&ye&&pe(ye,"display","")};Xo&&!pc&&document.addEventListener("click",function(o){if(Wo)return o.preventDefault(),o.stopPropagation&&o.stopPropagation(),o.stopImmediatePropagation&&o.stopImmediatePropagation(),Wo=!1,!1},!0);var Kr=function(l){if($){l=l.touches?l.touches[0]:l;var s=o0(l.clientX,l.clientY);if(s){var a={};for(var f in l)l.hasOwnProperty(f)&&(a[f]=l[f]);a.target=a.rootEl=s,a.preventDefault=void 0,a.stopPropagation=void 0,s[Tt]._onDragOver(a)}}},a0=function(l){$&&$.parentNode[Tt]._isOutsideThisEl(l.target)};function ge(o,l){if(!(o&&o.nodeType&&o.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(o));this.el=o,this.options=l=fr({},l),o[Tt]=this;var s={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(o.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Dc(o,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(c,d){c.setData("Text",d.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:ge.supportPointer!==!1&&"PointerEvent"in window&&(!pn||Nl),emptyInsertThreshold:5};xn.initializePlugins(this,o,s);for(var a in s)!(a in l)&&(l[a]=s[a]);kc(l);for(var f in this)f.charAt(0)==="_"&&typeof this[f]=="function"&&(this[f]=this[f].bind(this));this.nativeDraggable=l.forceFallback?!1:i0,this.nativeDraggable&&(this.options.touchStartThreshold=1),l.supportPointer?Se(o,"pointerdown",this._onTapStart):(Se(o,"mousedown",this._onTapStart),Se(o,"touchstart",this._onTapStart)),this.nativeDraggable&&(Se(o,"dragover",this),Se(o,"dragenter",this)),Uo.push(this.el),l.store&&l.store.get&&this.sort(l.store.get(this)||[]),fr(this,Vp())}ge.prototype={constructor:ge,_isOutsideThisEl:function(l){!this.el.contains(l)&&l!==this.el&&(Di=null)},_getDirection:function(l,s){return typeof this.options.direction=="function"?this.options.direction.call(this,l,s,$):this.options.direction},_onTapStart:function(l){if(l.cancelable){var s=this,a=this.el,f=this.options,h=f.preventOnFilter,c=l.type,d=l.touches&&l.touches[0]||l.pointerType&&l.pointerType==="touch"&&l,v=(d||l).target,y=l.target.shadowRoot&&(l.path&&l.path[0]||l.composedPath&&l.composedPath()[0])||v,x=f.filter;if(p0(a),!$&&!(/mousedown|pointerdown/.test(c)&&l.button!==0||f.disabled)&&!y.isContentEditable&&!(!this.nativeDraggable&&pn&&v&&v.tagName.toUpperCase()==="SELECT")&&(v=Gt(v,f.draggable,a,!1),!(v&&v.animated)&&Io!==v)){if(Si=It(v),mn=It(v,f.draggable),typeof x=="function"){if(x.call(this,l,v,this)){kt({sortable:s,rootEl:y,name:"filter",targetEl:v,toEl:a,fromEl:a}),Ft("filter",s,{evt:l}),h&&l.preventDefault();return}}else if(x&&(x=x.split(",").some(function(D){if(D=Gt(y,D.trim(),a,!1),D)return kt({sortable:s,rootEl:D,name:"filter",targetEl:v,fromEl:a,toEl:a}),Ft("filter",s,{evt:l}),!0}),x)){h&&l.preventDefault();return}f.handle&&!Gt(y,f.handle,a,!1)||this._prepareDragStart(l,d,v)}}},_prepareDragStart:function(l,s,a){var f=this,h=f.el,c=f.options,d=h.ownerDocument,v;if(a&&!$&&a.parentNode===h){var y=Ve(a);if(He=h,$=a,Ue=$.parentNode,Yr=$.nextSibling,Io=a,_o=c.group,ge.dragged=$,Xr={target:$,clientX:(s||l).clientX,clientY:(s||l).clientY},fc=Xr.clientX-y.left,cc=Xr.clientY-y.top,this._lastX=(s||l).clientX,this._lastY=(s||l).clientY,$.style["will-change"]="all",v=function(){if(Ft("delayEnded",f,{evt:l}),ge.eventCanceled){f._onDrop();return}f._disableDelayedDragEvents(),!ac&&f.nativeDraggable&&($.draggable=!0),f._triggerDragStart(l,s),kt({sortable:f,name:"choose",originalEvent:l}),zt($,c.chosenClass,!0)},c.ignore.split(",").forEach(function(x){vc($,x.trim(),El)}),Se(d,"dragover",Kr),Se(d,"mousemove",Kr),Se(d,"touchmove",Kr),c.supportPointer?(Se(d,"pointerup",f._onDrop),!this.nativeDraggable&&Se(d,"pointercancel",f._onDrop)):(Se(d,"mouseup",f._onDrop),Se(d,"touchend",f._onDrop),Se(d,"touchcancel",f._onDrop)),ac&&this.nativeDraggable&&(this.options.touchStartThreshold=4,$.draggable=!0),Ft("delayStart",this,{evt:l}),c.delay&&(!c.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(yn||cr))){if(ge.eventCanceled){this._onDrop();return}c.supportPointer?(Se(d,"pointerup",f._disableDelayedDrag),Se(d,"pointercancel",f._disableDelayedDrag)):(Se(d,"mouseup",f._disableDelayedDrag),Se(d,"touchend",f._disableDelayedDrag),Se(d,"touchcancel",f._disableDelayedDrag)),Se(d,"mousemove",f._delayedDragTouchMoveHandler),Se(d,"touchmove",f._delayedDragTouchMoveHandler),c.supportPointer&&Se(d,"pointermove",f._delayedDragTouchMoveHandler),f._dragStartTimer=setTimeout(v,c.delay)}else v()}},_delayedDragTouchMoveHandler:function(l){var s=l.touches?l.touches[0]:l;Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){$&&El($),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var l=this.el.ownerDocument;ke(l,"mouseup",this._disableDelayedDrag),ke(l,"touchend",this._disableDelayedDrag),ke(l,"touchcancel",this._disableDelayedDrag),ke(l,"pointerup",this._disableDelayedDrag),ke(l,"pointercancel",this._disableDelayedDrag),ke(l,"mousemove",this._delayedDragTouchMoveHandler),ke(l,"touchmove",this._delayedDragTouchMoveHandler),ke(l,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(l,s){s=s||l.pointerType=="touch"&&l,!this.nativeDraggable||s?this.options.supportPointer?Se(document,"pointermove",this._onTouchMove):s?Se(document,"touchmove",this._onTouchMove):Se(document,"mousemove",this._onTouchMove):(Se($,"dragend",this),Se(He,"dragstart",this._onDragStart));try{document.selection?Po(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(l,s){if(ki=!1,He&&$){Ft("dragStarted",this,{evt:s}),this.nativeDraggable&&Se(document,"dragover",a0);var a=this.options;!l&&zt($,a.dragClass,!1),zt($,a.ghostClass,!0),ge.active=this,l&&this._appendGhost(),kt({sortable:this,name:"start",originalEvent:s})}else this._nulling()},_emulateDragOver:function(){if(jt){this._lastX=jt.clientX,this._lastY=jt.clientY,Sc();for(var l=document.elementFromPoint(jt.clientX,jt.clientY),s=l;l&&l.shadowRoot&&(l=l.shadowRoot.elementFromPoint(jt.clientX,jt.clientY),l!==s);)s=l;if($.parentNode[Tt]._isOutsideThisEl(l),s)do{if(s[Tt]){var a=void 0;if(a=s[Tt]._onDragOver({clientX:jt.clientX,clientY:jt.clientY,target:l,rootEl:s}),a&&!this.options.dragoverBubble)break}l=s}while(s=mc(s));Ec()}},_onTouchMove:function(l){if(Xr){var s=this.options,a=s.fallbackTolerance,f=s.fallbackOffset,h=l.touches?l.touches[0]:l,c=ye&&Ei(ye,!0),d=ye&&c&&c.a,v=ye&&c&&c.d,y=No&&gt&&uc(gt),x=(h.clientX-Xr.clientX+f.x)/(d||1)+(y?y[0]-Sl[0]:0)/(d||1),D=(h.clientY-Xr.clientY+f.y)/(v||1)+(y?y[1]-Sl[1]:0)/(v||1);if(!ge.active&&!ki){if(a&&Math.max(Math.abs(h.clientX-this._lastX),Math.abs(h.clientY-this._lastY))<a)return;this._onDragStart(l,!0)}if(ye){c?(c.e+=x-(Dl||0),c.f+=D-(kl||0)):c={a:1,b:0,c:0,d:1,e:x,f:D};var k="matrix(".concat(c.a,",").concat(c.b,",").concat(c.c,",").concat(c.d,",").concat(c.e,",").concat(c.f,")");pe(ye,"webkitTransform",k),pe(ye,"mozTransform",k),pe(ye,"msTransform",k),pe(ye,"transform",k),Dl=x,kl=D,jt=h}l.cancelable&&l.preventDefault()}},_appendGhost:function(){if(!ye){var l=this.options.fallbackOnBody?document.body:He,s=Ve($,!0,No,!0,l),a=this.options;if(No){for(gt=l;pe(gt,"position")==="static"&&pe(gt,"transform")==="none"&&gt!==document;)gt=gt.parentNode;gt!==document.body&&gt!==document.documentElement?(gt===document&&(gt=$t()),s.top+=gt.scrollTop,s.left+=gt.scrollLeft):gt=$t(),Sl=uc(gt)}ye=$.cloneNode(!0),zt(ye,a.ghostClass,!1),zt(ye,a.fallbackClass,!0),zt(ye,a.dragClass,!0),pe(ye,"transition",""),pe(ye,"transform",""),pe(ye,"box-sizing","border-box"),pe(ye,"margin",0),pe(ye,"top",s.top),pe(ye,"left",s.left),pe(ye,"width",s.width),pe(ye,"height",s.height),pe(ye,"opacity","0.8"),pe(ye,"position",No?"absolute":"fixed"),pe(ye,"zIndex","100000"),pe(ye,"pointerEvents","none"),ge.ghost=ye,l.appendChild(ye),pe(ye,"transform-origin",fc/parseInt(ye.style.width)*100+"% "+cc/parseInt(ye.style.height)*100+"%")}},_onDragStart:function(l,s){var a=this,f=l.dataTransfer,h=a.options;if(Ft("dragStart",this,{evt:l}),ge.eventCanceled){this._onDrop();return}Ft("setupClone",this),ge.eventCanceled||(Re=xc($),Re.removeAttribute("id"),Re.draggable=!1,Re.style["will-change"]="",this._hideClone(),zt(Re,this.options.chosenClass,!1),ge.clone=Re),a.cloneId=Po(function(){Ft("clone",a),!ge.eventCanceled&&(a.options.removeCloneOnHide||He.insertBefore(Re,$),a._hideClone(),kt({sortable:a,name:"clone"}))}),!s&&zt($,h.dragClass,!0),s?(Wo=!0,a._loopId=setInterval(a._emulateDragOver,50)):(ke(document,"mouseup",a._onDrop),ke(document,"touchend",a._onDrop),ke(document,"touchcancel",a._onDrop),f&&(f.effectAllowed="move",h.setData&&h.setData.call(a,f,$)),Se(document,"drop",a),pe($,"transform","translateZ(0)")),ki=!0,a._dragStartId=Po(a._dragStarted.bind(a,s,l)),Se(document,"selectstart",a),cn=!0,window.getSelection().removeAllRanges(),pn&&pe(document.body,"user-select","none")},_onDragOver:function(l){var s=this.el,a=l.target,f,h,c,d=this.options,v=d.group,y=ge.active,x=_o===v,D=d.sort,k=ut||y,F,B=this,L=!1;if(Ml)return;function T(be,Ee){Ft(be,B,er({evt:l,isOwner:x,axis:F?"vertical":"horizontal",revert:c,dragRect:f,targetRect:h,canSort:D,fromSortable:k,target:a,completed:z,onMove:function(w,te){return Oo(He,s,$,f,w,Ve(w),l,te)},changed:O},Ee))}function N(){T("dragOverAnimationCapture"),B.captureAnimationState(),B!==k&&k.captureAnimationState()}function z(be){return T("dragOverCompleted",{insertion:be}),be&&(x?y._hideClone():y._showClone(B),B!==k&&(zt($,ut?ut.options.ghostClass:y.options.ghostClass,!1),zt($,d.ghostClass,!0)),ut!==B&&B!==ge.active?ut=B:B===ge.active&&ut&&(ut=null),k===B&&(B._ignoreWhileAnimating=a),B.animateAll(function(){T("dragOverAnimationComplete"),B._ignoreWhileAnimating=null}),B!==k&&(k.animateAll(),k._ignoreWhileAnimating=null)),(a===$&&!$.animated||a===s&&!a.animated)&&(Di=null),!d.dragoverBubble&&!l.rootEl&&a!==document&&($.parentNode[Tt]._isOutsideThisEl(l.target),!be&&Kr(l)),!d.dragoverBubble&&l.stopPropagation&&l.stopPropagation(),L=!0}function O(){Nt=It($),Ar=It($,d.draggable),kt({sortable:B,name:"change",toEl:s,newIndex:Nt,newDraggableIndex:Ar,originalEvent:l})}if(l.preventDefault!==void 0&&l.cancelable&&l.preventDefault(),a=Gt(a,d.draggable,s,!0),T("dragOver"),ge.eventCanceled)return L;if($.contains(l.target)||a.animated&&a.animatingX&&a.animatingY||B._ignoreWhileAnimating===a)return z(!1);if(Wo=!1,y&&!d.disabled&&(x?D||(c=Ue!==He):ut===this||(this.lastPutMode=_o.checkPull(this,y,$,l))&&v.checkPut(this,y,$,l))){if(F=this._getDirection(l,a)==="vertical",f=Ve($),T("dragOverValid"),ge.eventCanceled)return L;if(c)return Ue=He,N(),this._hideClone(),T("revert"),ge.eventCanceled||(Yr?He.insertBefore($,Yr):He.appendChild($)),z(!0);var I=Ol(s,d.draggable);if(!I||f0(l,F,this)&&!I.animated){if(I===$)return z(!1);if(I&&s===l.target&&(a=I),a&&(h=Ve(a)),Oo(He,s,$,f,a,h,l,!!a)!==!1)return N(),I&&I.nextSibling?s.insertBefore($,I.nextSibling):s.appendChild($),Ue=s,O(),z(!0)}else if(I&&u0(l,F,this)){var W=Ai(s,0,d,!0);if(W===$)return z(!1);if(a=W,h=Ve(a),Oo(He,s,$,f,a,h,l,!1)!==!1)return N(),s.insertBefore($,W),Ue=s,O(),z(!0)}else if(a.parentNode===s){h=Ve(a);var G=0,X,de=$.parentNode!==s,j=!n0($.animated&&$.toRect||f,a.animated&&a.toRect||h,F),oe=F?"top":"left",H=sc(a,"top","top")||sc($,"top","top"),Y=H?H.scrollTop:void 0;Di!==a&&(X=h[oe],bn=!1,zo=!j&&d.invertSwap||de),G=c0(l,a,h,F,j?1:d.swapThreshold,d.invertedSwapThreshold==null?d.swapThreshold:d.invertedSwapThreshold,zo,Di===a);var E;if(G!==0){var q=It($);do q-=G,E=Ue.children[q];while(E&&(pe(E,"display")==="none"||E===ye))}if(G===0||E===a)return z(!1);Di=a,vn=G;var R=a.nextElementSibling,Q=!1;Q=G===1;var he=Oo(He,s,$,f,a,h,l,Q);if(he!==!1)return(he===1||he===-1)&&(Q=he===1),Ml=!0,setTimeout(s0,30),N(),Q&&!R?s.appendChild($):a.parentNode.insertBefore($,Q?R:a),H&&yc(H,0,Y-H.scrollTop),Ue=$.parentNode,X!==void 0&&!zo&&(Ho=Math.abs(X-Ve(a)[oe])),O(),z(!0)}if(s.contains($))return z(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){ke(document,"mousemove",this._onTouchMove),ke(document,"touchmove",this._onTouchMove),ke(document,"pointermove",this._onTouchMove),ke(document,"dragover",Kr),ke(document,"mousemove",Kr),ke(document,"touchmove",Kr)},_offUpEvents:function(){var l=this.el.ownerDocument;ke(l,"mouseup",this._onDrop),ke(l,"touchend",this._onDrop),ke(l,"pointerup",this._onDrop),ke(l,"pointercancel",this._onDrop),ke(l,"touchcancel",this._onDrop),ke(document,"selectstart",this)},_onDrop:function(l){var s=this.el,a=this.options;if(Nt=It($),Ar=It($,a.draggable),Ft("drop",this,{evt:l}),Ue=$&&$.parentNode,Nt=It($),Ar=It($,a.draggable),ge.eventCanceled){this._nulling();return}ki=!1,zo=!1,bn=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Bl(this.cloneId),Bl(this._dragStartId),this.nativeDraggable&&(ke(document,"drop",this),ke(s,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),pn&&pe(document.body,"user-select",""),pe($,"transform",""),l&&(cn&&(l.cancelable&&l.preventDefault(),!a.dropBubble&&l.stopPropagation()),ye&&ye.parentNode&&ye.parentNode.removeChild(ye),(He===Ue||ut&&ut.lastPutMode!=="clone")&&Re&&Re.parentNode&&Re.parentNode.removeChild(Re),$&&(this.nativeDraggable&&ke($,"dragend",this),El($),$.style["will-change"]="",cn&&!ki&&zt($,ut?ut.options.ghostClass:this.options.ghostClass,!1),zt($,this.options.chosenClass,!1),kt({sortable:this,name:"unchoose",toEl:Ue,newIndex:null,newDraggableIndex:null,originalEvent:l}),He!==Ue?(Nt>=0&&(kt({rootEl:Ue,name:"add",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"remove",toEl:Ue,originalEvent:l}),kt({rootEl:Ue,name:"sort",toEl:Ue,fromEl:He,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ut&&ut.save()):Nt!==Si&&Nt>=0&&(kt({sortable:this,name:"update",toEl:Ue,originalEvent:l}),kt({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ge.active&&((Nt==null||Nt===-1)&&(Nt=Si,Ar=mn),kt({sortable:this,name:"end",toEl:Ue,originalEvent:l}),this.save()))),this._nulling()},_nulling:function(){Ft("nulling",this),He=$=Ue=ye=Yr=Re=Io=Fr=Xr=jt=cn=Nt=Ar=Si=mn=Di=vn=ut=_o=ge.dragged=ge.ghost=ge.clone=ge.active=null;var l=this.el;jo.forEach(function(s){l.contains(s)&&(s.checked=!0)}),jo.length=Dl=kl=0},handleEvent:function(l){switch(l.type){case"drop":case"dragend":this._onDrop(l);break;case"dragenter":case"dragover":$&&(this._onDragOver(l),l0(l));break;case"selectstart":l.preventDefault();break}},toArray:function(){for(var l=[],s,a=this.el.children,f=0,h=a.length,c=this.options;f<h;f++)s=a[f],Gt(s,c.draggable,this.el,!1)&&l.push(s.getAttribute(c.dataIdAttr)||h0(s));return l},sort:function(l,s){var a={},f=this.el;this.toArray().forEach(function(h,c){var d=f.children[c];Gt(d,this.options.draggable,f,!1)&&(a[h]=d)},this),s&&this.captureAnimationState(),l.forEach(function(h){a[h]&&(f.removeChild(a[h]),f.appendChild(a[h]))}),s&&this.animateAll()},save:function(){var l=this.options.store;l&&l.set&&l.set(this)},closest:function(l,s){return Gt(l,s||this.options.draggable,this.el,!1)},option:function(l,s){var a=this.options;if(s===void 0)return a[l];var f=xn.modifyOption(this,l,s);typeof f<"u"?a[l]=f:a[l]=s,l==="group"&&kc(a)},destroy:function(){Ft("destroy",this);var l=this.el;l[Tt]=null,ke(l,"mousedown",this._onTapStart),ke(l,"touchstart",this._onTapStart),ke(l,"pointerdown",this._onTapStart),this.nativeDraggable&&(ke(l,"dragover",this),ke(l,"dragenter",this)),Array.prototype.forEach.call(l.querySelectorAll("[draggable]"),function(s){s.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Uo.splice(Uo.indexOf(this.el),1),this.el=l=null},_hideClone:function(){if(!Fr){if(Ft("hideClone",this),ge.eventCanceled)return;pe(Re,"display","none"),this.options.removeCloneOnHide&&Re.parentNode&&Re.parentNode.removeChild(Re),Fr=!0}},_showClone:function(l){if(l.lastPutMode!=="clone"){this._hideClone();return}if(Fr){if(Ft("showClone",this),ge.eventCanceled)return;$.parentNode==He&&!this.options.group.revertClone?He.insertBefore(Re,$):Yr?He.insertBefore(Re,Yr):He.appendChild(Re),this.options.group.revertClone&&this.animate($,Re),pe(Re,"display",""),Fr=!1}}};function l0(o){o.dataTransfer&&(o.dataTransfer.dropEffect="move"),o.cancelable&&o.preventDefault()}function Oo(o,l,s,a,f,h,c,d){var v,y=o[Tt],x=y.options.onMove,D;return window.CustomEvent&&!cr&&!yn?v=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(v=document.createEvent("Event"),v.initEvent("move",!0,!0)),v.to=l,v.from=o,v.dragged=s,v.draggedRect=a,v.related=f||l,v.relatedRect=h||Ve(l),v.willInsertAfter=d,v.originalEvent=c,o.dispatchEvent(v),x&&(D=x.call(y,v,c)),D}function El(o){o.draggable=!1}function s0(){Ml=!1}function u0(o,l,s){var a=Ve(Ai(s.el,0,s.options,!0)),f=wc(s.el,s.options,ye),h=10;return l?o.clientX<f.left-h||o.clientY<a.top&&o.clientX<a.right:o.clientY<f.top-h||o.clientY<a.bottom&&o.clientX<a.left}function f0(o,l,s){var a=Ve(Ol(s.el,s.options.draggable)),f=wc(s.el,s.options,ye),h=10;return l?o.clientX>f.right+h||o.clientY>a.bottom&&o.clientX>a.left:o.clientY>f.bottom+h||o.clientX>a.right&&o.clientY>a.top}function c0(o,l,s,a,f,h,c,d){var v=a?o.clientY:o.clientX,y=a?s.height:s.width,x=a?s.top:s.left,D=a?s.bottom:s.right,k=!1;if(!c){if(d&&Ho<y*f){if(!bn&&(vn===1?v>x+y*h/2:v<D-y*h/2)&&(bn=!0),bn)k=!0;else if(vn===1?v<x+Ho:v>D-Ho)return-vn}else if(v>x+y*(1-f)/2&&v<D-y*(1-f)/2)return d0(l)}return k=k||c,k&&(v<x+y*h/2||v>D-y*h/2)?v>x+y/2?1:-1:0}function d0(o){return It($)<It(o)?1:-1}function h0(o){for(var l=o.tagName+o.className+o.src+o.href+o.textContent,s=l.length,a=0;s--;)a+=l.charCodeAt(s);return a.toString(36)}function p0(o){jo.length=0;for(var l=o.getElementsByTagName("input"),s=l.length;s--;){var a=l[s];a.checked&&jo.push(a)}}function Po(o){return setTimeout(o,0)}function Bl(o){return clearTimeout(o)}Xo&&Se(document,"touchmove",function(o){(ge.active||ki)&&o.cancelable&&o.preventDefault()});ge.utils={on:Se,off:ke,css:pe,find:vc,is:function(l,s){return!!Gt(l,s,l,!1)},extend:Qp,throttle:bc,closest:Gt,toggleClass:zt,clone:xc,index:It,nextTick:Po,cancelNextTick:Bl,detectDirection:Dc,getChild:Ai,expando:Tt};ge.get=function(o){return o[Tt]};ge.mount=function(){for(var o=arguments.length,l=new Array(o),s=0;s<o;s++)l[s]=arguments[s];l[0].constructor===Array&&(l=l[0]),l.forEach(function(a){if(!a.prototype||!a.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(a));a.utils&&(ge.utils=er(er({},ge.utils),a.utils)),xn.mount(a)})};ge.create=function(o,l){return new ge(o,l)};ge.version=Yp;var Je=[],dn,_l,zl=!1,Al,Fl,Go,hn;function g0(){function o(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var l in this)l.charAt(0)==="_"&&typeof this[l]=="function"&&(this[l]=this[l].bind(this))}return o.prototype={dragStarted:function(s){var a=s.originalEvent;this.sortable.nativeDraggable?Se(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Se(document,"pointermove",this._handleFallbackAutoScroll):a.touches?Se(document,"touchmove",this._handleFallbackAutoScroll):Se(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(s){var a=s.originalEvent;!this.options.dragOverBubble&&!a.rootEl&&this._handleAutoScroll(a)},drop:function(){this.sortable.nativeDraggable?ke(document,"dragover",this._handleAutoScroll):(ke(document,"pointermove",this._handleFallbackAutoScroll),ke(document,"touchmove",this._handleFallbackAutoScroll),ke(document,"mousemove",this._handleFallbackAutoScroll)),hc(),qo(),Jp()},nulling:function(){Go=_l=dn=zl=hn=Al=Fl=null,Je.length=0},_handleFallbackAutoScroll:function(s){this._handleAutoScroll(s,!0)},_handleAutoScroll:function(s,a){var f=this,h=(s.touches?s.touches[0]:s).clientX,c=(s.touches?s.touches[0]:s).clientY,d=document.elementFromPoint(h,c);if(Go=s,a||this.options.forceAutoScrollFallback||yn||cr||pn){Tl(s,this.options,d,a);var v=Tr(d,!0);zl&&(!hn||h!==Al||c!==Fl)&&(hn&&hc(),hn=setInterval(function(){var y=Tr(document.elementFromPoint(h,c),!0);y!==v&&(v=y,qo()),Tl(s,f.options,y,a)},10),Al=h,Fl=c)}else{if(!this.options.bubbleScroll||Tr(d,!0)===$t()){qo();return}Tl(s,this.options,Tr(d,!1),!1)}}},fr(o,{pluginName:"scroll",initializeByDefault:!0})}function qo(){Je.forEach(function(o){clearInterval(o.pid)}),Je=[]}function hc(){clearInterval(hn)}var Tl=bc(function(o,l,s,a){if(l.scroll){var f=(o.touches?o.touches[0]:o).clientX,h=(o.touches?o.touches[0]:o).clientY,c=l.scrollSensitivity,d=l.scrollSpeed,v=$t(),y=!1,x;_l!==s&&(_l=s,qo(),dn=l.scroll,x=l.scrollFn,dn===!0&&(dn=Tr(s,!0)));var D=0,k=dn;do{var F=k,B=Ve(F),L=B.top,T=B.bottom,N=B.left,z=B.right,O=B.width,I=B.height,W=void 0,G=void 0,X=F.scrollWidth,de=F.scrollHeight,j=pe(F),oe=F.scrollLeft,H=F.scrollTop;F===v?(W=O<X&&(j.overflowX==="auto"||j.overflowX==="scroll"||j.overflowX==="visible"),G=I<de&&(j.overflowY==="auto"||j.overflowY==="scroll"||j.overflowY==="visible")):(W=O<X&&(j.overflowX==="auto"||j.overflowX==="scroll"),G=I<de&&(j.overflowY==="auto"||j.overflowY==="scroll"));var Y=W&&(Math.abs(z-f)<=c&&oe+O<X)-(Math.abs(N-f)<=c&&!!oe),E=G&&(Math.abs(T-h)<=c&&H+I<de)-(Math.abs(L-h)<=c&&!!H);if(!Je[D])for(var q=0;q<=D;q++)Je[q]||(Je[q]={});(Je[D].vx!=Y||Je[D].vy!=E||Je[D].el!==F)&&(Je[D].el=F,Je[D].vx=Y,Je[D].vy=E,clearInterval(Je[D].pid),(Y!=0||E!=0)&&(y=!0,Je[D].pid=setInterval(function(){a&&this.layer===0&&ge.active._onTouchMove(Go);var R=Je[this.layer].vy?Je[this.layer].vy*d:0,Q=Je[this.layer].vx?Je[this.layer].vx*d:0;typeof x=="function"&&x.call(ge.dragged.parentNode[Tt],Q,R,o,Go,Je[this.layer].el)!=="continue"||yc(Je[this.layer].el,Q,R)}.bind({layer:D}),24))),D++}while(l.bubbleScroll&&k!==v&&(k=Tr(k,!1)));zl=y}},30),Ac=function(l){var s=l.originalEvent,a=l.putSortable,f=l.dragEl,h=l.activeSortable,c=l.dispatchSortableEvent,d=l.hideGhostForTarget,v=l.unhideGhostForTarget;if(s){var y=a||h;d();var x=s.changedTouches&&s.changedTouches.length?s.changedTouches[0]:s,D=document.elementFromPoint(x.clientX,x.clientY);v(),y&&!y.el.contains(D)&&(c("spill"),this.onSpill({dragEl:f,putSortable:a}))}};function Il(){}Il.prototype={startIndex:null,dragStart:function(l){var s=l.oldDraggableIndex;this.startIndex=s},onSpill:function(l){var s=l.dragEl,a=l.putSortable;this.sortable.captureAnimationState(),a&&a.captureAnimationState();var f=Ai(this.sortable.el,this.startIndex,this.options);f?this.sortable.el.insertBefore(s,f):this.sortable.el.appendChild(s),this.sortable.animateAll(),a&&a.animateAll()},drop:Ac};fr(Il,{pluginName:"revertOnSpill"});function Hl(){}Hl.prototype={onSpill:function(l){var s=l.dragEl,a=l.putSortable,f=a||this.sortable;f.captureAnimationState(),s.parentNode&&s.parentNode.removeChild(s),f.animateAll()},drop:Ac};fr(Hl,{pluginName:"removeOnSpill"});ge.mount(new g0);ge.mount(Hl,Il);var Fc=ge;function wn(o,l,s,a){var f=a?new AbortController:null,h=f?setTimeout(function(){f.abort()},a):null,c=Object.assign({credentials:"include"},l);return f&&(c.signal=f.signal),fetch(o,c).then(function(d){if(h&&clearTimeout(h),d.ok||s&&s.indexOf(d.status)!==-1)return d;var v=new Error("HTTP "+d.status);throw v.status=d.status,v},function(d){throw h&&clearTimeout(h),d})}function Pl(o,l){var s=o&&o.status;return s===401||s===403?"Your login session expired \u2014 sign in again, then retry.":l}var Tc="https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json";var Ko=null;function m0(){var o=document.createElement("div");return o.className="location-pin",o}function Lc(o,l){return Ko&&Ko.container===o?Promise.resolve(Ko.handle):import("./maplibre-gl-5OH44QV6.js").then(function(s){var a=s.default||s,f=new a.Map({container:o,style:Tc,center:[0,20],zoom:2,attributionControl:!1});f.addControl(new a.AttributionControl({compact:!0}),"bottom-left");var h=new a.Marker({draggable:!0,element:m0()}),c=!1;h.on("dragend",function(){l&&l(h.getLngLat())});var d={setPin:function(v,y){h.setLngLat([y,v]),c||(h.addTo(f),c=!0),f.panTo([y,v])},hasPin:function(){return c},resize:function(){f.resize()}};return Ko={container:o,handle:d},d})}function v0(){var o=document.querySelector('textarea[name="data[content]"]');if(!o)return null;var l=new Zr.default({element:o,spellChecker:!1,autoDownloadFontAwesome:!1,status:!1,placeholder:"What happened today?",minHeight:"180px",toolbar:[{name:"bold",action:Zr.default.toggleBold,className:"mde-btn mde-bold",title:"Bold"},{name:"italic",action:Zr.default.toggleItalic,className:"mde-btn mde-italic",title:"Italic"},{name:"unordered-list",action:Zr.default.toggleUnorderedList,className:"mde-btn mde-ul",title:"Bulleted list"},{name:"link",action:Zr.default.drawLink,className:"mde-btn mde-link",title:"Insert link"},"|",{name:"preview",action:Zr.default.togglePreview,className:"mde-btn mde-preview",title:"Toggle preview"}]});l.codemirror.on("change",function(){l.codemirror.save()});var s=o.closest("form");return s&&s.addEventListener("submit",function(){l.codemirror.save()},!0),l}var b0=["heic","heix","heif","hevc","hevx","mif1","msf1","heim","heis","hevm","hevs"];function Ic(o){return o.slice(0,64).arrayBuffer().then(function(l){var s=new Uint8Array(l);if(s.length<12||String.fromCharCode(s[4],s[5],s[6],s[7])!=="ftyp")return!1;for(var a="",f=8;f+4<=s.length;f+=4)a+=String.fromCharCode(s[f],s[f+1],s[f+2],s[f+3]).toLowerCase();return b0.some(function(h){return a.indexOf(h)!==-1})}).catch(function(){return!1})}function y0(o){var l=String(o||"photo").replace(/\.[^.]+$/,"");return l=l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),(l||"photo")+".jpg"}function Mc(){var o=document.querySelector(".filepond-root, .form-input-file");if(!o||!o.parentNode)return null;var l=o.parentNode.querySelector(".photo-convert-status");return l||(l=document.createElement("p"),l.className="photo-convert-status form-status",l.setAttribute("role","status"),o.parentNode.insertBefore(l,o.nextSibling)),l}function x0(){var o=document.querySelector(".filepond-root, .form-input-file");if(!o)return null;var l=o.closest(".form-field");if(!l)return null;var s=l.querySelector(".form-label"),a=document.createElement("details");a.className="photos-collapse",a.open=!0;var f=document.createElement("summary");for(f.className="photos-collapse__summary",f.textContent="Photos (1\u20136)",a.appendChild(f);l.firstChild;)a.appendChild(l.firstChild);return l.appendChild(a),s&&(s.style.display="none"),{details:a,summary:f}}function w0(){var o=document.querySelector('form[name="new-entry"]');if(!o||Yo)return;var l=0,s=x0(),a=null;o.addEventListener("submit",function(){if(a){var x=a.getFiles();if(x.length){var D=o.querySelector('input[name="photo_order"]');D||(D=document.createElement("input"),D.type="hidden",D.name="photo_order",o.appendChild(D)),D.value=JSON.stringify(x.map(function(k){return k.filename}))}}},!0);function f(x,D){var k=Mc();k&&(k.textContent=x||"",k.className="photo-convert-status form-status"+(D?" form-status--"+D:""))}function h(){if(s){var x=document.querySelectorAll(".filepond--item[data-filepond-item-state]"),D=x.length,k=0;Array.prototype.forEach.call(x,function(F){F.getAttribute("data-filepond-item-state")==="processing-complete"&&k++}),l>0||D>0&&k<D?(s.summary.textContent=l>0?"Converting "+l+" photo"+(l>1?"s":"")+"\u2026":"Uploading "+D+" photo"+(D>1?"s":"")+"\u2026",s.details.open=!0):D>0?(s.summary.textContent="\u2713 "+D+" photo"+(D>1?"s":"")+" ready \u2014 tap to review",s.details.open=!1):(s.summary.textContent="Photos (1\u20136)",s.details.open=!0)}}function c(){h(),setTimeout(h,150),setTimeout(h,500)}function d(){var x=o.querySelector('button[type="submit"], input[type="submit"]');if(x&&(x.disabled=l>0),l>0)f("Converting "+l+" photo"+(l>1?"s":"")+"\u2026");else{var D=Mc();D&&/Converting/.test(D.textContent)&&f("")}h()}o.addEventListener("submit",function(x){l>0&&(x.preventDefault(),f("Hang on \u2014 a photo is still converting.","err"))},!0);function v(x){return function(D){var k=D&&D.file;return k?Ic(k).then(function(F){return F?(l++,d(),import("./heic-to-CN7JBE7H.js").then(function(B){var L=B.heicTo||B.default&&B.default.heicTo;return L({blob:k,type:"image/jpeg",quality:.85})}).then(function(B){var L=new File([B],y0(k.name),{type:"image/jpeg"});x.addFile(L)}).catch(function(){f("A photo couldn\u2019t be converted and was skipped \u2014 the others are fine.","err")}).then(function(){l--,d()}),!1):!0}):!0}}var y=0;(function x(){var D=window.GravFilePond&&window.GravFilePond.getInstances?window.GravFilePond.getInstances():[];if(!D.length){y++<120&&setTimeout(x,50);return}D.forEach(function(k){k&&!k._heicHooked&&(k._heicHooked=!0,k.setOptions({beforeAddFile:v(k),allowReorder:!0,itemInsertLocation:"after"}),a=k,["addfile","processfile","processfiles","removefile","error"].forEach(function(F){try{k.on(F,c)}catch{}}),h())})})()}function ft(o){return document.querySelector('[name="data['+o+']"]')}function C0(){var o=Array.prototype.slice.call(document.querySelectorAll(".advanced-field"));if(o.length){var l=[];if(o.forEach(function(h){var c=h.closest(".form-field");c&&l.indexOf(c)===-1&&l.push(c)}),!!l.length){var s=document.createElement("details");s.className="more-options";var a=document.createElement("summary");a.className="more-options__summary",a.textContent="More options",s.appendChild(a),l[0].parentNode.insertBefore(s,l[0]),l.forEach(function(h){s.appendChild(h)});var f=l.some(function(h){var c=h.querySelector('input[type="text"]');if(c&&c.value.trim())return!0;var d=h.querySelector('input[type="radio"]:checked');if(!d||!d.value)return!1;var v=h.querySelector('input[type="radio"][checked]');return v?d.value!==v.value:d.value!=="0"});f&&(s.open=!0)}}}var D0={0:"Sunny",1:"Partly cloudy",2:"Partly cloudy",3:"Cloudy",45:"Foggy",48:"Foggy",51:"Drizzle",53:"Drizzle",55:"Drizzle",56:"Drizzle",57:"Drizzle",61:"Rain",63:"Rain",65:"Rain",66:"Rain",67:"Rain",80:"Rain",81:"Rain",82:"Rain",71:"Snow",73:"Snow",75:"Snow",77:"Snow",85:"Snow",86:"Snow",95:"Thunderstorm",96:"Thunderstorm",99:"Thunderstorm"};function dr(o,l,s){o&&(o.className="form-status"+(s?" form-status--"+s:""),o.textContent=l||"")}function k0(){var o=document.getElementById("get-location"),l=document.getElementById("get-weather");if(!o&&!l)return;var s=document.getElementById("location-status"),a=document.getElementById("weather-status");function f(){var d=ft("lat"),v=ft("lng"),y=d?d.value.trim():"",x=v?v.value.trim():"";return y&&x?{lat:y,lng:x}:null}function h(){if(l){var d=!!f();l.disabled=!d,l.title=d?"":"Get location first"}}h();function c(d,v){var y=ft("location_city"),x=ft("location_country");if(!((!y||y.value.trim())&&(!x||x.value.trim()))){var D="https://api.bigdatacloud.net/data/reverse-geocode-client?latitude="+encodeURIComponent(d)+"&longitude="+encodeURIComponent(v)+"&localityLanguage=en";fetch(D).then(function(k){return k.json()}).then(function(k){var F=(k.city||k.locality||"").trim(),B=(k.countryName||"").trim();y&&!y.value.trim()&&F&&(y.value=F),x&&!x.value.trim()&&B&&(x.value=B);var L=[F,B].filter(Boolean).join(", ");L&&dr(s,"\u2713 Location captured \xB7 "+L,"ok")}).catch(function(){})}}o&&o.addEventListener("click",function(){if(!navigator.geolocation){dr(s,"Geolocation is not supported on this device.","err");return}o.classList.add("is-loading"),o.disabled=!0,dr(s,"Getting location\u2026"),navigator.geolocation.getCurrentPosition(function(d){var v=d.coords.latitude.toFixed(6),y=d.coords.longitude.toFixed(6),x=ft("lat"),D=ft("lng");x&&(x.value=v),D&&(D.value=y),o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2713 Location captured \xB7 "+v+", "+y,"ok"),h(),c(v,y);var k=document.querySelector(".location-details");k&&k.open&&Hc()},function(d){o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2717 "+(d&&d.message?d.message:"Could not get location")+" \u2014 enter coordinates manually if needed.","err")},{enableHighAccuracy:!0,timeout:15e3})}),l&&l.addEventListener("click",function(){var d=f();if(!d){dr(a,"Get location first, then fetch weather.","err");return}l.classList.add("is-loading"),l.disabled=!0,dr(a,"Fetching weather\u2026");var v="https://api.open-meteo.com/v1/forecast?latitude="+d.lat+"&longitude="+d.lng+"&current=temperature_2m,weather_code&temperature_unit=celsius";fetch(v).then(function(y){return y.json()}).then(function(y){var x=Math.round(y.current.temperature_2m),D=D0[y.current.weather_code]||"Cloudy",k=ft("weather_temp_c"),F=ft("weather_desc");k&&(k.value=x),F&&(F.value=D),l.classList.remove("is-loading"),h(),dr(a,"\u2713 Weather set \xB7 "+D+" \xB7 "+x+"\xB0C (edit above if needed)","ok")}).catch(function(){l.classList.remove("is-loading"),h(),dr(a,"\u2717 Could not fetch weather \u2014 set it manually above.","err")})})}var Hc=function(){};function S0(o,l){var s=null;return function(){var a=arguments;clearTimeout(s),s=setTimeout(function(){o.apply(null,a)},l)}}function E0(o){return[o.name,o.admin1,o.country].filter(Boolean).join(", ")}function A0(){var o=ft("lat"),l=ft("lng");if(!o||!l)return;var s=o.closest(".form-field"),a=l.closest(".form-field");if(!s||!a)return;var f=ft("location_city"),h=ft("location_country"),c=h?h.closest(".form-field"):null,d=c||s,v=document.createElement("details");v.className="location-details";var y=document.createElement("summary");y.className="location-details__summary",y.textContent="More location details",v.appendChild(y);var x=document.createElement("div");x.className="location-details__body";var D=document.createElement("div");D.className="location-search-row";var k=document.createElement("button");k.type="button",k.id="lookup-coords",k.className="btn-action";var F="\u{1F50D} Look up coordinates";k.textContent=F,D.appendChild(k),x.appendChild(D);var B=document.createElement("p");B.id="location-search-hint",B.className="location-search-hint",B.setAttribute("role","status"),x.appendChild(B);var L=document.createElement("ul");L.id="location-search-results",L.className="location-search-results",x.appendChild(L);var T=document.createElement("div");T.id="location-map",T.className="location-map",x.appendChild(T),v.appendChild(x),d.parentNode.insertBefore(v,d.nextSibling),v.appendChild(s),v.appendChild(a);function N(H){return H===o?"location-lat-note":"location-lng-note"}function z(){[o,l].forEach(function(H){H.classList.add("location-field--mismatch"),H.setAttribute("aria-invalid","true");var Y=N(H),E=document.getElementById(Y);E||(E=document.createElement("span"),E.id=Y,E.className="location-field-note",E.setAttribute("role","status"),E.setAttribute("aria-live","polite"),E.textContent="Not reflected on the map yet.",H.parentNode.insertBefore(E,H.nextSibling)),H.setAttribute("aria-describedby",Y)})}function O(){[o,l].forEach(function(H){H.classList.remove("location-field--mismatch"),H.removeAttribute("aria-invalid"),H.removeAttribute("aria-describedby");var Y=document.getElementById(N(H));Y&&Y.parentNode&&Y.parentNode.removeChild(Y)})}var I=null;function W(){var H=parseFloat(o.value),Y=parseFloat(l.value),E=isFinite(H)&&isFinite(Y)&&H>=-90&&H<=90&&Y>=-180&&Y<=180;E?(O(),I&&I.setPin(H,Y)):(o.value.trim()||l.value.trim())&&z()}Hc=W;function G(H){o.value=H.lat.toFixed(6),l.value=H.lng.toFixed(6),O()}v.addEventListener("toggle",function(){v.open&&Lc(T,G).then(function(H){I=H,H.resize(),W()})}),o.addEventListener("blur",W),l.addEventListener("blur",W);var X=S0(W,400);o.addEventListener("input",X),l.addEventListener("input",X);function de(H){B.textContent=H||""}function j(){L.innerHTML=""}function oe(H){H.forEach(function(Y){var E=document.createElement("li"),q=document.createElement("button");q.type="button",q.textContent=E0(Y),q.addEventListener("click",function(){o.value=Number(Y.latitude).toFixed(6),l.value=Number(Y.longitude).toFixed(6),j(),W()}),E.appendChild(q),L.appendChild(E)})}k.addEventListener("click",function(){j();var H=f?f.value.trim():"",Y=h?h.value.trim():"";if(!H&&!Y){de("Enter a city or country first.");return}var E=H||Y;de(""),k.disabled=!0,k.textContent="Searching\u2026";var q="https://geocoding-api.open-meteo.com/v1/search?name="+encodeURIComponent(E)+"&count=10&language=en&format=json";fetch(q).then(function(R){return R.json()}).then(function(R){var Q=R&&R.results||[];if(!Q.length){de("No matches \u2014 try adding a country, or drag the pin on the map.");return}if(Y){var he=Y.toLowerCase(),be=function(Ee){return(Ee.admin1||"").toLowerCase().indexOf(he)!==-1||(Ee.country||"").toLowerCase().indexOf(he)!==-1};Q=Q.slice().sort(function(Ee,A){var w=be(Ee),te=be(A);return w===te?0:w?-1:1})}oe(Q)}).catch(function(){}).then(function(){k.disabled=!1,k.textContent=F})})}function F0(){var o=new Date;return o.setSeconds(0,0),o.setMinutes(o.getMinutes()-o.getTimezoneOffset()),o.toISOString().slice(0,16)}function T0(){var o={title:"Title",date:"Date & time",content:"Content"},l=document.querySelector('form[name="new-entry"]');if(!l)return;var s=ft("date");s&&!String(s.value).trim()&&(s.value=F0());function a(){l.querySelectorAll(".field-error").forEach(function(c){c.remove()}),l.querySelectorAll(".field-invalid").forEach(function(c){c.classList.remove("field-invalid")})}function f(c,d){c.classList.add("field-invalid");var v=document.createElement("span");v.className="field-error",v.textContent=d,c.parentNode.insertBefore(v,c.nextSibling)}function h(c){var d=l.querySelector(".photos-collapse"),v,y;if(d?(d.open=!0,y=d.querySelector(".photos-collapse__summary"),v=d):(v=document.querySelector(".filepond-root, .form-input-file"),y=v),!y)return v||null;var x=document.createElement("span");return x.className="field-error",x.textContent=c,y.insertAdjacentElement("afterend",x),v||y}l.addEventListener("submit",function(c){a();var d=null;!Yo&&document.querySelectorAll(".filepond--item").length<1&&(d=h("Add at least one photo.")),Object.keys(o).forEach(function(v){var y=ft(v);y&&!String(y.value).trim()&&(f(y,o[v]+" is required."),d||(d=y))}),d&&(c.preventDefault(),typeof d.focus=="function"&&d.focus(),d.scrollIntoView({behavior:"smooth",block:"center"}))})}var ql="intotheeast:new-entry-draft";function L0(o){return Array.prototype.slice.call(o.querySelectorAll('[name^="data["]')).filter(function(l){if(l.type==="file")return!1;var s=l.name;return s.indexOf("data[_json")!==0&&s.indexOf("data[photos")!==0})}function M0(){var o=document.querySelector(".filepond-root, .form-input-file");if(!(!o||!o.parentNode)&&!o.parentNode.querySelector(".photo-reauth-hint")){var l=document.createElement("p");l.className="photo-reauth-hint is-shown",l.textContent="Your text was restored \u2014 photos need re-selecting (they can\u2019t be saved in a draft).",o.parentNode.insertBefore(l,o.nextSibling)}}function B0(){var o=document.querySelector('form[name="new-entry"]');if(!o||Yo)return;if(document.querySelector(".notices.success")){try{localStorage.removeItem(ql)}catch{}return}function l(){var h={};L0(o).forEach(function(c){c.type==="radio"?c.checked&&(h[c.name]=c.value):h[c.name]=c.value});try{localStorage.setItem(ql,JSON.stringify(h))}catch{}}var s=null;try{s=localStorage.getItem(ql)}catch{s=null}if(s){var a=null;try{a=JSON.parse(s)}catch{a=null}if(a){var f=!1;Object.keys(a).forEach(function(h){var c=a[h];if(c!=null&&String(c).trim()&&(f=!0),h!=="data[content]"){var d=o.querySelectorAll('input[type="radio"][name="'+h+'"]');if(d.length){d.forEach(function(y){y.checked=y.value===c});return}var v=o.querySelector('[name="'+h+'"]');v&&v.type!=="file"&&(v.value=c)}}),window.postFormEditor&&a["data[content]"]!=null&&window.postFormEditor.value(a["data[content]"]),f&&M0()}}o.addEventListener("input",l),o.addEventListener("change",l),window.postFormEditor&&window.postFormEditor.codemirror.on("change",l)}function _0(){var o=document.querySelector(".post-form-wrap"),l=document.querySelector(".post-form-wrap .notices.success, .post-form-wrap .notices.green");if(!(!o||!l)){var s=document.createElement("div");s.className="post-success";var a=document.createElement("p");a.className="post-success__title",a.textContent="\u2713 Saved to your journal.",s.appendChild(a);var f=document.createElement("div");f.className="post-success__actions";var h=o.getAttribute("data-trip-url");if(h){var c=document.createElement("a");c.className="post-success__view",c.href=h,c.textContent="View your journal \u2192",f.appendChild(c)}var d=document.createElement("a");d.className="post-success__again",d.href=window.location.pathname,d.textContent="Post another",f.appendChild(d),s.appendChild(f),l.parentNode.insertBefore(s,l.nextSibling),["form",".form-action-row","#location-status","#weather-status"].forEach(function(v){var y=o.querySelector(v);y&&(y.style.display="none")}),l.scrollIntoView({behavior:"smooth",block:"start"})}}var Yo=!1;function Bc(o){return new URLSearchParams(window.location.search).get(o)}function hr(o,l){var s=ft(o);s&&(s.value=l==null?"":String(l))}function Rl(o,l){var s=l?"1":"0",a=document.querySelectorAll('[name="data['+o+']"]');Array.prototype.forEach.call(a,function(f){f.checked=String(f.value)===s})}function z0(o){var l=o==null?"":String(o);if(window.postFormEditor&&typeof window.postFormEditor.value=="function")window.postFormEditor.value(l);else{var s=ft("content");s&&(s.value=l)}}function _c(o,l){var s=o.querySelectorAll("input, textarea, select, button");Array.prototype.forEach.call(s,function(a){a.type==="file"||a.name&&a.name.indexOf("data[photos")===0||(a.disabled=l)}),window.postFormEditor&&window.postFormEditor.codemirror&&window.postFormEditor.codemirror.setOption("readOnly",l?"nocursor":!1)}function Wl(o,l){o&&(o.tagName==="INPUT"?o.value=l:o.textContent=l)}function N0(o,l){var s=o.querySelector(".post-edit-error");if(s){s.textContent=l;return}var a=document.createElement("div");a.className="post-edit-error",a.setAttribute("role","alert"),a.textContent=l;var f=o.querySelector("h1");f?f.insertAdjacentElement("afterend",a):o.insertBefore(a,o.firstChild)}var O0=/\.(jpe?g|png|webp|heic|heif|gif)$/i;function zc(o){var l=/(?:^|\/)photo-0*(\d+)\./i.exec(o);return l?parseInt(l[1],10):Number.MAX_SAFE_INTEGER}function I0(o,l){var s=zc(o),a=zc(l);return s!==a?s-a:o<l?-1:o>l?1:0}function Nc(o,l){var s=String(o||"photo"),a=s.lastIndexOf("."),f=(a>0?s.slice(0,a):s).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"photo",h=l?".jpg":a>0?s.slice(a).toLowerCase():".jpg",c=Date.now().toString(36)+Math.random().toString(36).slice(2,6);return f+"-"+c+h}function H0(o){var l=document.querySelector('form[name="new-entry"]');if(!l||!o)return;var s=o.split("/").filter(Boolean).pop();if(!s)return;var a=document.querySelector(".filepond-root, .form-input-file"),f=a?a.closest(".form-field"):null;f&&(f.style.display="none");var h=l.querySelector(".photos-collapse");h&&(h.style.display="none");var c=document.createElement("div");c.className="photo-editor",c.innerHTML='<div class="photo-editor__head"><span class="photo-editor__label">Photos</span><button type="button" class="photo-editor__add">Add photos</button></div><p class="photo-editor__status gpx-status" role="status"></p><div class="photo-editor__grid" aria-live="polite"></div><input type="file" class="photo-editor__input" multiple hidden accept="image/jpeg,image/png,image/webp,.jpg,.jpeg,.png,.webp,.heic,.heif">',f&&f.parentNode?f.parentNode.insertBefore(c,f):l.insertBefore(c,l.firstElementChild);var d=c.querySelector(".photo-editor__grid"),v=c.querySelector(".photo-editor__status"),y=c.querySelector(".photo-editor__add"),x=c.querySelector(".photo-editor__input"),D=[],k=null,F=!1,B=0;function L(H,Y){v.textContent=H||"",v.className="photo-editor__status gpx-status"+(Y?" error":"")}function T(H){F=H,y.disabled=H,Array.prototype.forEach.call(d.querySelectorAll(".photo-editor__del, .photo-editor__confirm-yes, .photo-editor__confirm-no"),function(Y){Y.disabled=H}),k&&k.option("disabled",H)}function N(){return fetch("/api/v1/pages"+o+"/media",{credentials:"include",headers:{Accept:"application/json"}}).then(function(H){if(!H.ok)throw new Error("HTTP "+H.status);return H.json()}).then(function(H){return(H&&H.data||[]).filter(function(Y){return Y&&typeof Y.filename=="string"&&O0.test(Y.filename)}).map(function(Y){return Y.filename}).sort(I0)})}function z(H){return wn("/api/v1/entry/"+encodeURIComponent(s)+"/photos/order",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({order:H})})}function O(H){if(D=(H||[]).slice(),k&&(k.destroy(),k=null),d.innerHTML="",!D.length){d.innerHTML='<p class="photo-editor__empty">No photos yet \u2014 add some.</p>';return}var Y=++B;D.forEach(function(E){var q=document.createElement("div");q.className="photo-editor__cell",q.setAttribute("data-filename",E);var R=document.createElement("img");R.className="photo-editor__img",R.loading="lazy",R.alt=E,R.src=o+"/"+encodeURIComponent(E)+"?v="+Y;var Q=document.createElement("button");Q.type="button",Q.className="photo-editor__del",Q.setAttribute("aria-label","Delete "+E),Q.textContent="\u2715",Q.addEventListener("click",function(){X(q,E)}),q.appendChild(R),q.appendChild(Q),d.appendChild(q)}),D.length>1&&(k=new Fc(d,{animation:150,draggable:".photo-editor__cell",filter:".photo-editor__confirm",onEnd:G}))}function I(){return Array.prototype.map.call(d.querySelectorAll(".photo-editor__cell"),function(H){return H.getAttribute("data-filename")})}function W(H,Y){if(H.length!==Y.length)return!1;for(var E=0;E<H.length;E++)if(H[E]!==Y[E])return!1;return!0}function G(){var H=I();if(!W(H,D)){var Y=D.slice();T(!0),L("Saving order\u2026"),z(H).then(function(){return N().then(function(E){L(""),O(E)},function(){L(""),O(H)})},function(E){L(Pl(E,"Couldn\u2019t save the new order \u2014 reverted. Try again."),!0),O(Y)}).then(function(){T(!1)})}}function X(H,Y){if(!(F||H.querySelector(".photo-editor__confirm"))){var E=document.createElement("div");E.className="photo-editor__confirm",E.innerHTML='<span class="photo-editor__confirm-q">Delete?</span><button type="button" class="photo-editor__confirm-yes">Confirm</button><button type="button" class="photo-editor__confirm-no">Cancel</button>',H.appendChild(E),H.classList.add("is-confirming"),E.querySelector(".photo-editor__confirm-no").addEventListener("click",function(){H.classList.remove("is-confirming"),E.remove()}),E.querySelector(".photo-editor__confirm-yes").addEventListener("click",function(){E.querySelector(".photo-editor__confirm-yes").disabled=!0,E.querySelector(".photo-editor__confirm-no").disabled=!0,de(Y)})}}function de(H){var Y=D.slice(),E=D.filter(function(q){return q!==H});T(!0),L("Deleting\u2026"),wn("/api/v1/pages"+o+"/media/"+encodeURIComponent(H),{method:"DELETE"},[204,404]).then(function(){return(E.length?z(E):Promise.resolve()).then(N).then(function(q){L(""),O(q)},function(){L("Photo deleted, but refreshing the list failed \u2014 reload if it looks off.",!0),O(E)})},function(q){L(Pl(q,"Couldn\u2019t delete that photo. Try again."),!0),O(Y)}).then(function(){T(!1)})}function j(H){return Ic(H).then(function(Y){return Y?import("./heic-to-CN7JBE7H.js").then(function(E){var q=E.heicTo||E.default&&E.default.heicTo;return q({blob:H,type:"image/jpeg",quality:.85})}).then(function(E){return{blob:E,name:Nc(H.name,!0)}}):{blob:H,name:Nc(H.name,!1)}})}y.addEventListener("click",function(){F||x.click()}),x.addEventListener("change",function(){var H=Array.prototype.slice.call(x.files||[]);x.value="",H.length&&oe(H)});function oe(H){T(!0);var Y=H.length,E=0,q=0,R=!1,Q=D.slice(),he=Promise.resolve();H.forEach(function(be){he=he.then(function(){return E++,L("Uploading "+E+" of "+Y+"\u2026"),j(be).then(function(Ee){var A=new FormData;return A.append("file",Ee.blob,Ee.name),wn("/api/v1/pages"+o+"/media",{method:"POST",body:A})}).then(null,function(Ee){q++,Ee&&(Ee.status===401||Ee.status===403)&&(R=!0)})})}),he.then(function(){return L("Finishing\u2026"),N()}).then(function(be){var Ee=Q.filter(function(te){return be.indexOf(te)!==-1}),A=be.filter(function(te){return Q.indexOf(te)===-1}),w=Ee.concat(A);return w.length?z(w).catch(function(){return z(w)}).catch(function(){return Promise.all(A.map(function(te){return wn("/api/v1/pages"+o+"/media/"+encodeURIComponent(te),{method:"DELETE"},[204,404]).then(function(){return!0},function(){return!1})})).then(function(te){var Ce=new Error("reorder failed");throw Ce.rolledBack=!0,Ce.rollbackIncomplete=te.indexOf(!1)!==-1,Ce})}).then(N):(O([]),null)}).then(function(be){be&&O(be),q?L(R?"Couldn\u2019t add photos \u2014 your login session expired. Sign in again, then retry.":q+" photo"+(q>1?"s":"")+" couldn\u2019t be added.",!0):L("")}).catch(function(be){var Ee;return be&&be.rolledBack?Ee=be.rollbackIncomplete?"Couldn\u2019t finish adding photos and cleanup was incomplete \u2014 reload the page and check your photos.":"Couldn\u2019t finish adding photos \u2014 changes were rolled back. Try again.":Ee="Couldn\u2019t add photos. Please try again.",L(Ee,!0),N().then(O,function(){O(Q)})}).then(function(){T(!1)})}d.innerHTML='<p class="photo-editor__loading">Loading photos\u2026</p>',N().then(O).catch(function(){L("Couldn\u2019t load photos.",!0),O([])})}function P0(){var o=document.querySelector('form[name="new-entry"]'),l=document.querySelector(".post-form-wrap");if(!(!o||!l)){var s=Bc("edit");if(s){Yo=!0;var a=l.querySelector("h1");a&&(a.textContent="Edit entry");var f=o.querySelector('button[type="submit"], input[type="submit"]'),h=f?f.tagName==="INPUT"?f.value:f.textContent:"Save changes";_c(o,!0),Wl(f,"Loading entry\u2026");var c=Bc("return")||l.getAttribute("data-trip-url")||"";o.setAttribute("action","/post?edit="+encodeURIComponent(s)+(c?"&return="+encodeURIComponent(c):"")),fetch("/api/v1/pages"+s,{credentials:"include",headers:{Accept:"application/json"}}).then(function(d){if(!d.ok){var v=new Error("HTTP "+d.status);throw v.status=d.status,v}return d.json()}).then(function(d){var v=d&&d.data||{},y=v.header||{};hr("title",y.title!=null?y.title:v.title),hr("date",y.date?String(y.date).replace(" ","T"):""),z0(v.content),hr("lat",y.lat),hr("lng",y.lng),hr("location_city",y.location_city),hr("location_country",y.location_country),hr("weather_desc",y.weather_desc),hr("weather_temp_c",y.weather_temp_c),hr("transport_mode",y.transport_mode),Rl("featured",y.featured),Rl("force_connect",y.force_connect),Rl("published",y.published!==void 0?y.published:v.published);var x=ft("edit_path");x&&(x.value=s+"/entry.md"),_c(o,!1),Wl(f,"Save changes");var D=o.querySelector(".more-options");D&&(D.open=!0),H0(s)}).catch(function(d){var v=d&&d.status===404?"This entry no longer exists \u2014 it may have been deleted. Head back to the journal.":"Sorry \u2014 this entry couldn\u2019t be loaded for editing. Check your connection and try again.";N0(l,v),Wl(f,h)})}}}function Oc(){window.postFormEditor=v0(),_0(),P0(),B0(),w0(),C0(),k0(),A0(),T0()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Oc):Oc();
/*! Bundled license information:
sortablejs/modular/sortable.esm.js:
(**!
* Sortable 1.15.7
* @author RubaXa <trash@rubaxa.org>
* @author owenm <owen23355@gmail.com>
* @license MIT
*)
*/