Two prod bugs from the 2026-07-09 owner test: - post-form.js: complete upload gate on create submit. The form plugin's guard only blocks PROCESSING/QUEUED, so a failed upload (processing-error) or a just-picked file (loading) submitted silently and the entry saved without its photo. Submit is now blocked unless every FilePond item is processing-complete, with a visible status message for the failed vs still-uploading cases. (Bundle rebuilt via make build-assets.) - entry-journal partial: PhotoSwipe slides now link to a 2000px fit-within derivative and measure THAT file for data-pswp-width/height. The old img.width/height came from raw getimagesize() of the original, which ignores EXIF orientation, so stored-rotated portrait JPEGs got landscape slide boxes and rendered squeezed. Derivatives are re-encoded (EXIF stripped, orientation baked in server-side), so declared dims always match rendering. Also fixes the wrapper aspect-ratio pick for portrait-first entries. Note: Medium 'path' must be called as path() in Twig — the ArrayAccess 'path' item (page folder) shadows the method. Covered by tests/ui/post/upload-gate.spec.js and lightbox-dims.spec.js in the dev repo. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0195b3cDdMeize2Mm1FgC2aU
106 lines
384 KiB
JavaScript
106 lines
384 KiB
JavaScript
import{a as Qu,b as at,c as Kh}from"./chunk-ZWRDP37E.js";var Et=at((nl,il)=>{(function(o,l){typeof nl=="object"&&typeof il<"u"?il.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),p=/Edge\/(\d+)/.exec(o),c=a||f||p,d=c&&(a?document.documentMode||6:+(p||f)[1]),m=!p&&/WebKit\//.test(o),y=m&&/Qt\/\d+\.\d+/.test(o),x=!p&&/Chrome\/(\d+)/.exec(o),C=x&&+x[1],S=/Opera\//.test(o),A=/Apple Computer/.test(navigator.vendor),_=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(o),L=/PhantomJS/.test(o),T=A&&(/Mobile\/\w+/.test(o)||navigator.maxTouchPoints>2),O=/Android/.test(o),N=T||O||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(o),I=T||/Mac/.test(l),P=/\bCrOS\b/.test(o),q=/win/i.test(l),G=S&&o.match(/Version\/(\d*\.\d*)/);G&&(G=Number(G[1])),G&&G>=15&&(S=!1,m=!0);var K=I&&(y||S&&(G==null||G<12.11)),me=s||c&&d>=9;function U(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var le=function(e,t){var n=e.className,r=U(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function j(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function ee(e,t){return j(e).appendChild(t)}function E(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),typeof t=="string")i.appendChild(document.createTextNode(t));else if(t)for(var u=0;u<t.length;++u)i.appendChild(t[u]);return i}function H(e,t,n,r){var i=E(e,t,n,r);return i.setAttribute("role","presentation"),i}var W;document.createRange?W=function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:W=function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch{return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};function Z(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 ve(e){var t=e.ownerDocument||e,n;try{n=e.activeElement}catch{n=t.body||null}for(;n&&n.shadowRoot&&n.shadowRoot.activeElement;)n=n.shadowRoot.activeElement;return n}function De(e,t){var n=e.className;U(t).test(n)||(e.className+=(n?" ":"")+t)}function Le(e,t){for(var n=e.split(" "),r=0;r<n.length;r++)n[r]&&!U(n[r]).test(t)&&(t+=" "+n[r]);return t}var F=function(e){e.select()};T?F=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:c&&(F=function(e){try{e.select()}catch{}});function D(e){return e.display.wrapper.ownerDocument}function te(e){return we(e.display.wrapper)}function we(e){return e.getRootNode?e.getRootNode():e.ownerDocument}function ye(e){return D(e).defaultView}function gt(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function Tt(e,t,n){t||(t={});for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n!==!1||!Object.prototype.hasOwnProperty.call(t,r))&&(t[r]=e[r]);return t}function Ye(e,t,n,r,i){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));for(var u=r||0,h=i||0;;){var g=e.indexOf(" ",u);if(g<0||g>=t)return h+(t-u);h+=g-u,h+=n-h%n,u=g+1}}var ft=function(){this.id=null,this.f=null,this.time=0,this.handler=gt(this.onTimeout,this)};ft.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},ft.prototype.set=function(e,t){this.f=t;var n=+new Date+e;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=n)};function Ne(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}var He=50,Ze={toString:function(){return"CodeMirror.Pass"}},vt={scroll:!1},Tn={origin:"*mouse"},Xt={origin:"+move"};function Kt(e,t,n){for(var r=0,i=0;;){var u=e.indexOf(" ",r);u==-1&&(u=e.length);var h=u-r;if(u==e.length||i+h>=t)return r+Math.min(h,t-i);if(i+=u-r,i+=n-i%n,r=u+1,i>=t)return r}}var zt=[""];function pr(e){for(;zt.length<=e;)zt.push(Ce(zt)+" ");return zt[e]}function Ce(e){return e[e.length-1]}function Ht(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function gr(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function wi(){}function Ul(e,t){var n;return Object.create?n=Object.create(e):(wi.prototype=e,n=new wi),t&&Tt(t,n),n}var Oc=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Yo(e){return/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Oc.test(e))}function Ci(e,t){return t?t.source.indexOf("\\w")>-1&&Yo(e)?!0:t.test(e):Yo(e)}function jl(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var Ic=/[\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 Zo(e){return e.charCodeAt(0)>=768&&Ic.test(e)}function Gl(e,t,n){for(;(n<0?t>0:t<e.length)&&Zo(e.charAt(t));)t+=n;return t}function Ln(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,u=r<0?Math.ceil(i):Math.floor(i);if(u==t)return e(u)?t:n;e(u)?n=u:t=u+r}}function Pc(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,u=0;u<e.length;++u){var h=e[u];(h.from<n&&h.to>t||t==n&&h.to==t)&&(r(Math.max(h.from,t),Math.min(h.to,n),h.level==1?"rtl":"ltr",u),i=!0)}i||r(t,n,"ltr")}var Mn=null;function _n(e,t,n){var r;Mn=null;for(var i=0;i<e.length;++i){var u=e[i];if(u.from<t&&u.to>t)return i;u.to==t&&(u.from!=u.to&&n=="before"?r=i:Mn=i),u.from==t&&(u.from!=u.to&&n!="before"?r=i:Mn=i)}return r??Mn}var zc=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function n(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]/,i=/[stwN]/,u=/[LRr]/,h=/[Lb1n]/,g=/[1n]/;function v(b,w,k){this.level=b,this.from=w,this.to=k}return function(b,w){var k=w=="ltr"?"L":"R";if(b.length==0||w=="ltr"&&!r.test(b))return!1;for(var B=b.length,M=[],z=0;z<B;++z)M.push(n(b.charCodeAt(z)));for(var R=0,Y=k;R<B;++R){var Q=M[R];Q=="m"?M[R]=Y:Y=Q}for(var V=0,J=k;V<B;++V){var ne=M[V];ne=="1"&&J=="r"?M[V]="n":u.test(ne)&&(J=ne,ne=="r"&&(M[V]="R"))}for(var se=1,ae=M[0];se<B-1;++se){var xe=M[se];xe=="+"&&ae=="1"&&M[se+1]=="1"?M[se]="1":xe==","&&ae==M[se+1]&&(ae=="1"||ae=="n")&&(M[se]=ae),ae=xe}for(var Te=0;Te<B;++Te){var nt=M[Te];if(nt==",")M[Te]="N";else if(nt=="%"){var Pe=void 0;for(Pe=Te+1;Pe<B&&M[Pe]=="%";++Pe);for(var St=Te&&M[Te-1]=="!"||Pe<B&&M[Pe]=="1"?"1":"N",xt=Te;xt<Pe;++xt)M[xt]=St;Te=Pe-1}}for(var Xe=0,Dt=k;Xe<B;++Xe){var ot=M[Xe];Dt=="L"&&ot=="1"?M[Xe]="L":u.test(ot)&&(Dt=ot)}for(var Qe=0;Qe<B;++Qe)if(i.test(M[Qe])){var Ke=void 0;for(Ke=Qe+1;Ke<B&&i.test(M[Ke]);++Ke);for(var Re=(Qe?M[Qe-1]:k)=="L",wt=(Ke<B?M[Ke]:k)=="L",mn=Re==wt?Re?"L":"R":k,kr=Qe;kr<Ke;++kr)M[kr]=mn;Qe=Ke-1}for(var st=[],$t,it=0;it<B;)if(h.test(M[it])){var tl=it;for(++it;it<B&&h.test(M[it]);++it);st.push(new v(0,tl,it))}else{var lr=it,Wr=st.length,qr=w=="rtl"?1:0;for(++it;it<B&&M[it]!="L";++it);for(var dt=lr;dt<it;)if(g.test(M[dt])){lr<dt&&(st.splice(Wr,0,new v(1,lr,dt)),Wr+=qr);var bn=dt;for(++dt;dt<it&&g.test(M[dt]);++dt);st.splice(Wr,0,new v(2,bn,dt)),Wr+=qr,lr=dt}else++dt;lr<it&&st.splice(Wr,0,new v(1,lr,it))}return w=="ltr"&&(st[0].level==1&&($t=b.match(/^\s+/))&&(st[0].from=$t[0].length,st.unshift(new v(0,0,$t[0].length))),Ce(st).level==1&&($t=b.match(/\s+$/))&&(Ce(st).to-=$t[0].length,st.push(new v(0,B-$t[0].length,B)))),w=="rtl"?st.reverse():st}}();function tr(e,t){var n=e.order;return n==null&&(n=e.order=zc(e.text,t)),n}var Xl=[],ue=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||Xl).concat(n)}};function Qo(e,t){return e._handlers&&e._handlers[t]||Xl}function Lt(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var u=Ne(i,n);u>-1&&(r[t]=i.slice(0,u).concat(i.slice(u+1)))}}}function je(e,t){var n=Qo(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Ve(e,t,n){return typeof t=="string"&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),je(e,n||t.type,e,t),Jo(t)||t.codemirrorIgnore}function Kl(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)Ne(n,t[r])==-1&&n.push(t[r])}function It(e,t){return Qo(e,t).length>0}function Qr(e){e.prototype.on=function(t,n){ue(this,t,n)},e.prototype.off=function(t,n){Lt(this,t,n)}}function mt(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Yl(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Jo(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==!1}function Bn(e){mt(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)),I&&e.ctrlKey&&t==1&&(t=3),t}var Hc=function(){if(c&&d<9)return!1;var e=E("div");return"draggable"in e||"dragDrop"in e}(),Vo;function Rc(e){if(Vo==null){var t=E("span","\u200B");ee(e,E("span",[t,document.createTextNode("x")])),e.firstChild.offsetHeight!=0&&(Vo=t.offsetWidth<=1&&t.offsetHeight>2&&!(c&&d<8))}var n=Vo?E("span","\u200B"):E("span","\xA0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}var ea;function Wc(e){if(ea!=null)return ea;var t=ee(e,document.createTextNode("A\u062EA")),n=W(t,0,1).getBoundingClientRect(),r=W(t,1,2).getBoundingClientRect();return j(e),!n||n.left==n.right?!1:ea=r.right-n.right<3}var ta=`
|
|
|
|
b`.split(/\n/).length!=3?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf(`
|
|
`,t);i==-1&&(i=e.length);var u=e.slice(t,e.charAt(i-1)=="\r"?i-1:i),h=u.indexOf("\r");h!=-1?(n.push(u.slice(0,h)),t+=h+1):(n.push(u),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},qc=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},Uc=function(){var e=E("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),typeof e.oncopy=="function")}(),ra=null;function jc(e){if(ra!=null)return ra;var t=ee(e,E("span","x")),n=t.getBoundingClientRect(),r=W(t,0,1).getBoundingClientRect();return ra=Math.abs(n.left-r.left)>1}var na={},Jr={};function Gc(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),na[e]=t}function Xc(e,t){Jr[e]=t}function ki(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 ki("application/xml");if(typeof e=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ki("application/json")}return typeof e=="string"?{name:e}:e||{name:"null"}}function ia(e,t){t=ki(t);var n=na[t.name];if(!n)return ia(e,"text/plain");var r=n(e,t);if($r.hasOwnProperty(t.name)){var i=$r[t.name];for(var u in i)i.hasOwnProperty(u)&&(r.hasOwnProperty(u)&&(r["_"+u]=r[u]),r[u]=i[u])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var h in t.modeProps)r[h]=t.modeProps[h];return r}var $r={};function Kc(e,t){var n=$r.hasOwnProperty(e)?$r[e]:$r[e]={};Tt(t,n)}function Lr(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function oa(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),!(!n||n.mode==e));)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Ql(e,t,n){return e.startState?e.startState(t,n):!0}var Ge=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};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),n;if(typeof e=="string"?n=t==e:n=t&&(e.test?e.test(t):e(t)),n)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,n){if(typeof e=="string"){var r=function(h){return n?h.toLowerCase():h},i=this.string.substr(this.pos,e.length);if(r(i)==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 oe(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],u=i.chunkSize();if(t<u){n=i;break}t-=u}return n.lines[t]}function Mr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(u){var h=u.text;i==n.line&&(h=h.slice(0,n.ch)),i==t.line&&(h=h.slice(t.ch)),r.push(h),++i}),r}function aa(e,t,n){var r=[];return e.iter(t,n,function(i){r.push(i.text)}),r}function Yt(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Ae(e){if(e.parent==null)return null;for(var t=e.parent,n=Ne(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function _r(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],u=i.height;if(t<u){e=i;continue e}t-=u,n+=i.chunkSize()}return n}while(!e.lines);for(var h=0;h<e.lines.length;++h){var g=e.lines[h],v=g.height;if(t<v)break;t-=v}return n+h}function Nn(e,t){return t>=e.first&&t<e.first+e.size}function la(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function X(e,t,n){if(n===void 0&&(n=null),!(this instanceof X))return new X(e,t,n);this.line=e,this.ch=t,this.sticky=n}function pe(e,t){return e.line-t.line||e.ch-t.ch}function sa(e,t){return e.sticky==t.sticky&&pe(e,t)==0}function ua(e){return X(e.line,e.ch)}function Si(e,t){return pe(e,t)<0?t:e}function Ei(e,t){return pe(e,t)<0?e:t}function Jl(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ge(e,t){if(t.line<e.first)return X(e.first,0);var n=e.first+e.size-1;return t.line>n?X(n,oe(e,n).text.length):Yc(t,oe(e,t.line).text.length)}function Yc(e,t){var n=e.ch;return n==null||n>t?X(e.line,t):n<0?X(e.line,0):e}function $l(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=ge(e,t[r]);return n}var Ai=function(e,t){this.state=e,this.lookAhead=t},Zt=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,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,n){return t instanceof Ai?new Zt(e,Lr(e.mode,t.state),n,t.lookAhead):new Zt(e,Lr(e.mode,t),n)},Zt.prototype.save=function(e){var t=e!==!1?Lr(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Ai(t,this.maxLookAhead):t};function Vl(e,t,n,r){var i=[e.state.modeGen],u={};os(e,t.text,e.doc.mode,n,function(b,w){return i.push(b,w)},u,r);for(var h=n.state,g=function(b){n.baseTokens=i;var w=e.state.overlays[b],k=1,B=0;n.state=!0,os(e,t.text,w.mode,n,function(M,z){for(var R=k;B<M;){var Y=i[k];Y>M&&i.splice(k,1,M,i[k+1],Y),k+=2,B=Math.min(M,Y)}if(z)if(w.opaque)i.splice(R,k-R,M,"overlay "+z),k=R+2;else for(;R<k;R+=2){var Q=i[R+1];i[R+1]=(Q?Q+" ":"")+"overlay "+z}},u),n.state=h,n.baseTokens=null,n.baseTokenPos=1},v=0;v<e.state.overlays.length;++v)g(v);return{styles:i,classes:u.bgClass||u.textClass?u:null}}function es(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=On(e,Ae(t)),i=t.text.length>e.options.maxHighlightLength&&Lr(e.doc.mode,r.state),u=Vl(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=u.styles,u.classes?t.styleClasses=u.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function On(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new Zt(r,!0,t);var u=Zc(e,t,n),h=u>r.first&&oe(r,u-1).stateAfter,g=h?Zt.fromSaved(r,h,u):new Zt(r,Ql(r.mode),u);return r.iter(u,t,function(v){fa(e,v.text,g);var b=g.line;v.stateAfter=b==t-1||b%5==0||b>=i.viewFrom&&b<i.viewTo?g.save():null,g.nextLine()}),n&&(r.modeFrontier=g.line),g}function fa(e,t,n,r){var i=e.doc.mode,u=new Ge(t,e.options.tabSize,n);for(u.start=u.pos=r||0,t==""&&ts(i,n.state);!u.eol();)ca(i,u,n.state),u.start=u.pos}function ts(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=oa(e,t);if(n.mode.blankLine)return n.mode.blankLine(n.state)}}function ca(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=oa(e,n).mode);var u=e.token(t,n);if(t.pos>t.start)return u}throw new Error("Mode "+e.name+" failed to advance stream.")}var rs=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function ns(e,t,n,r){var i=e.doc,u=i.mode,h;t=ge(i,t);var g=oe(i,t.line),v=On(e,t.line,n),b=new Ge(g.text,e.options.tabSize,v),w;for(r&&(w=[]);(r||b.pos<t.ch)&&!b.eol();)b.start=b.pos,h=ca(u,b,v.state),r&&w.push(new rs(b,h,Lr(i.mode,v.state)));return r?w:new rs(b,h,v.state)}function is(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";t[r]==null?t[r]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(t[r])||(t[r]+=" "+n[2])}return e}function os(e,t,n,r,i,u,h){var g=n.flattenSpans;g==null&&(g=e.options.flattenSpans);var v=0,b=null,w=new Ge(t,e.options.tabSize,r),k,B=e.options.addModeClass&&[null];for(t==""&&is(ts(n,r.state),u);!w.eol();){if(w.pos>e.options.maxHighlightLength?(g=!1,h&&fa(e,t,r,w.pos),w.pos=t.length,k=null):k=is(ca(n,w,r.state,B),u),B){var M=B[0].name;M&&(k="m-"+(k?M+" "+k:M))}if(!g||b!=k){for(;v<w.start;)v=Math.min(w.start,v+5e3),i(v,b);b=k}w.start=w.pos}for(;v<w.pos;){var z=Math.min(w.pos,v+5e3);i(z,b),v=z}}function Zc(e,t,n){for(var r,i,u=e.doc,h=n?-1:t-(e.doc.mode.innerMode?1e3:100),g=t;g>h;--g){if(g<=u.first)return u.first;var v=oe(u,g-1),b=v.stateAfter;if(b&&(!n||g+(b instanceof Ai?b.lookAhead:0)<=u.modeFrontier))return g;var w=Ye(v.text,null,e.options.tabSize);(i==null||r>w)&&(i=g-1,r=w)}return i}function Qc(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;r>n;r--){var i=oe(e,r).stateAfter;if(i&&(!(i instanceof Ai)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}var as=!1,rr=!1;function Jc(){as=!0}function $c(){rr=!0}function Fi(e,t,n){this.marker=e,this.from=t,this.to=n}function In(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function Vc(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function ed(e,t,n){var r=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet));r&&e.markedSpans&&r.has(e.markedSpans)?e.markedSpans.push(t):(e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],r&&r.add(e.markedSpans)),t.marker.attachLine(e)}function td(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var u=e[i],h=u.marker,g=u.from==null||(h.inclusiveLeft?u.from<=t:u.from<t);if(g||u.from==t&&h.type=="bookmark"&&(!n||!u.marker.insertLeft)){var v=u.to==null||(h.inclusiveRight?u.to>=t:u.to>t);(r||(r=[])).push(new Fi(h,u.from,v?null:u.to))}}return r}function rd(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var u=e[i],h=u.marker,g=u.to==null||(h.inclusiveRight?u.to>=t:u.to>t);if(g||u.from==t&&h.type=="bookmark"&&(!n||u.marker.insertLeft)){var v=u.from==null||(h.inclusiveLeft?u.from<=t:u.from<t);(r||(r=[])).push(new Fi(h,v?null:u.from-t,u.to==null?null:u.to-t))}}return r}function da(e,t){if(t.full)return null;var n=Nn(e,t.from.line)&&oe(e,t.from.line).markedSpans,r=Nn(e,t.to.line)&&oe(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,u=t.to.ch,h=pe(t.from,t.to)==0,g=td(n,i,h),v=rd(r,u,h),b=t.text.length==1,w=Ce(t.text).length+(b?i:0);if(g)for(var k=0;k<g.length;++k){var B=g[k];if(B.to==null){var M=In(v,B.marker);M?b&&(B.to=M.to==null?null:M.to+w):B.to=i}}if(v)for(var z=0;z<v.length;++z){var R=v[z];if(R.to!=null&&(R.to+=w),R.from==null){var Y=In(g,R.marker);Y||(R.from=w,b&&(g||(g=[])).push(R))}else R.from+=w,b&&(g||(g=[])).push(R)}g&&(g=ls(g)),v&&v!=g&&(v=ls(v));var Q=[g];if(!b){var V=t.text.length-2,J;if(V>0&&g)for(var ne=0;ne<g.length;++ne)g[ne].to==null&&(J||(J=[])).push(new Fi(g[ne].marker,null,null));for(var se=0;se<V;++se)Q.push(J);Q.push(v)}return Q}function ls(e){for(var t=0;t<e.length;++t){var n=e[t];n.from!=null&&n.from==n.to&&n.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function nd(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(M){if(M.markedSpans)for(var z=0;z<M.markedSpans.length;++z){var R=M.markedSpans[z].marker;R.readOnly&&(!r||Ne(r,R)==-1)&&(r||(r=[])).push(R)}}),!r)return null;for(var i=[{from:t,to:n}],u=0;u<r.length;++u)for(var h=r[u],g=h.find(0),v=0;v<i.length;++v){var b=i[v];if(!(pe(b.to,g.from)<0||pe(b.from,g.to)>0)){var w=[v,1],k=pe(b.from,g.from),B=pe(b.to,g.to);(k<0||!h.inclusiveLeft&&!k)&&w.push({from:b.from,to:g.from}),(B>0||!h.inclusiveRight&&!B)&&w.push({from:g.to,to:b.to}),i.splice.apply(i,w),v+=w.length-3}}return i}function ss(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function us(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function Ti(e){return e.inclusiveLeft?-1:0}function Li(e){return e.inclusiveRight?1:0}function ha(e,t){var n=e.lines.length-t.lines.length;if(n!=0)return n;var r=e.find(),i=t.find(),u=pe(r.from,i.from)||Ti(e)-Ti(t);if(u)return-u;var h=pe(r.to,i.to)||Li(e)-Li(t);return h||t.id-e.id}function fs(e,t){var n=rr&&e.markedSpans,r;if(n)for(var i=void 0,u=0;u<n.length;++u)i=n[u],i.marker.collapsed&&(t?i.from:i.to)==null&&(!r||ha(r,i.marker)<0)&&(r=i.marker);return r}function cs(e){return fs(e,!0)}function Mi(e){return fs(e,!1)}function id(e,t){var n=rr&&e.markedSpans,r;if(n)for(var i=0;i<n.length;++i){var u=n[i];u.marker.collapsed&&(u.from==null||u.from<t)&&(u.to==null||u.to>t)&&(!r||ha(r,u.marker)<0)&&(r=u.marker)}return r}function ds(e,t,n,r,i){var u=oe(e,t),h=rr&&u.markedSpans;if(h)for(var g=0;g<h.length;++g){var v=h[g];if(v.marker.collapsed){var b=v.marker.find(0),w=pe(b.from,n)||Ti(v.marker)-Ti(i),k=pe(b.to,r)||Li(v.marker)-Li(i);if(!(w>=0&&k<=0||w<=0&&k>=0)&&(w<=0&&(v.marker.inclusiveRight&&i.inclusiveLeft?pe(b.to,n)>=0:pe(b.to,n)>0)||w>=0&&(v.marker.inclusiveRight&&i.inclusiveLeft?pe(b.from,r)<=0:pe(b.from,r)<0)))return!0}}}function Rt(e){for(var t;t=cs(e);)e=t.find(-1,!0).line;return e}function od(e){for(var t;t=Mi(e);)e=t.find(1,!0).line;return e}function ad(e){for(var t,n;t=Mi(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function pa(e,t){var n=oe(e,t),r=Rt(n);return n==r?t:Ae(r)}function hs(e,t){if(t>e.lastLine())return t;var n=oe(e,t),r;if(!vr(e,n))return t;for(;r=Mi(n);)n=r.find(1,!0).line;return Ae(n)+1}function vr(e,t){var n=rr&&t.markedSpans;if(n){for(var r=void 0,i=0;i<n.length;++i)if(r=n[i],!!r.marker.collapsed){if(r.from==null)return!0;if(!r.marker.widgetNode&&r.from==0&&r.marker.inclusiveLeft&&ga(e,t,r))return!0}}}function ga(e,t,n){if(n.to==null){var r=n.marker.find(1,!0);return ga(e,r.line,In(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,u=0;u<t.markedSpans.length;++u)if(i=t.markedSpans[u],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(i.to==null||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&ga(e,t,i))return!0}function nr(e){e=Rt(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var u=n.parent;u;n=u,u=n.parent)for(var h=0;h<u.children.length;++h){var g=u.children[h];if(g==n)break;t+=g.height}return t}function _i(e){if(e.height==0)return 0;for(var t=e.text.length,n,r=e;n=cs(r);){var i=n.find(0,!0);r=i.from.line,t+=i.from.ch-i.to.ch}for(r=e;n=Mi(r);){var u=n.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,n=e.doc;t.maxLine=oe(n,n.first),t.maxLineLength=_i(t.maxLine),t.maxLineChanged=!0,n.iter(function(r){var i=_i(r);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=r)})}var Vr=function(e,t,n){this.text=e,us(this,t),this.height=n?n(this):1};Vr.prototype.lineNo=function(){return Ae(this)},Qr(Vr);function ld(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),e.order!=null&&(e.order=null),ss(e),us(e,n);var i=r?r(e):1;i!=e.height&&Yt(e,i)}function sd(e){e.parent=null,ss(e)}var ud={},fd={};function ps(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?fd:ud;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function gs(e,t){var n=H("span",null,null,m?"padding-right: .1px":null),r={pre:H("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var u=i?t.rest[i-1]:t.line,h=void 0;r.pos=0,r.addToken=dd,Wc(e.display.measure)&&(h=tr(u,e.doc.direction))&&(r.addToken=pd(r.addToken,h)),r.map=[];var g=t!=e.display.externalMeasured&&Ae(u);gd(u,r,es(e,u,g)),u.styleClasses&&(u.styleClasses.bgClass&&(r.bgClass=Le(u.styleClasses.bgClass,r.bgClass||"")),u.styleClasses.textClass&&(r.textClass=Le(u.styleClasses.textClass,r.textClass||""))),r.map.length==0&&r.map.push(0,0,r.content.appendChild(Rc(e.display.measure))),i==0?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(m){var v=r.content.lastChild;(/\bcm-tab\b/.test(v.className)||v.querySelector&&v.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return je(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Le(r.pre.className,r.textClass||"")),r}function cd(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 dd(e,t,n,r,i,u,h){if(t){var g=e.splitSpaces?hd(t,e.trailingSpace):t,v=e.cm.state.specialChars,b=!1,w;if(!v.test(t))e.col+=t.length,w=document.createTextNode(g),e.map.push(e.pos,e.pos+t.length,w),c&&d<9&&(b=!0),e.pos+=t.length;else{w=document.createDocumentFragment();for(var k=0;;){v.lastIndex=k;var B=v.exec(t),M=B?B.index-k:t.length-k;if(M){var z=document.createTextNode(g.slice(k,k+M));c&&d<9?w.appendChild(E("span",[z])):w.appendChild(z),e.map.push(e.pos,e.pos+M,z),e.col+=M,e.pos+=M}if(!B)break;k+=M+1;var R=void 0;if(B[0]==" "){var Y=e.cm.options.tabSize,Q=Y-e.col%Y;R=w.appendChild(E("span",pr(Q),"cm-tab")),R.setAttribute("role","presentation"),R.setAttribute("cm-text"," "),e.col+=Q}else B[0]=="\r"||B[0]==`
|
|
`?(R=w.appendChild(E("span",B[0]=="\r"?"\u240D":"\u2424","cm-invalidchar")),R.setAttribute("cm-text",B[0]),e.col+=1):(R=e.cm.options.specialCharPlaceholder(B[0]),R.setAttribute("cm-text",B[0]),c&&d<9?w.appendChild(E("span",[R])):w.appendChild(R),e.col+=1);e.map.push(e.pos,e.pos+1,R),e.pos++}}if(e.trailingSpace=g.charCodeAt(t.length-1)==32,n||r||i||b||u||h){var V=n||"";r&&(V+=r),i&&(V+=i);var J=E("span",[w],V,u);if(h)for(var ne in h)h.hasOwnProperty(ne)&&ne!="style"&&ne!="class"&&J.setAttribute(ne,h[ne]);return e.content.appendChild(J)}e.content.appendChild(w)}}function hd(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var u=e.charAt(i);u==" "&&n&&(i==e.length-1||e.charCodeAt(i+1)==32)&&(u="\xA0"),r+=u,n=u==" "}return r}function pd(e,t){return function(n,r,i,u,h,g,v){i=i?i+" cm-force-border":"cm-force-border";for(var b=n.pos,w=b+r.length;;){for(var k=void 0,B=0;B<t.length&&(k=t[B],!(k.to>b&&k.from<=b));B++);if(k.to>=w)return e(n,r,i,u,h,g,v);e(n,r.slice(0,k.to-b),i,u,null,g,v),u=null,r=r.slice(k.to-b),b=k.to}}}function vs(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function gd(e,t,n){var r=e.markedSpans,i=e.text,u=0;if(!r){for(var h=1;h<n.length;h+=2)t.addToken(t,i.slice(u,u=n[h]),ps(n[h+1],t.cm.options));return}for(var g=i.length,v=0,b=1,w="",k,B,M=0,z,R,Y,Q,V;;){if(M==v){z=R=Y=B="",V=null,Q=null,M=1/0;for(var J=[],ne=void 0,se=0;se<r.length;++se){var ae=r[se],xe=ae.marker;if(xe.type=="bookmark"&&ae.from==v&&xe.widgetNode)J.push(xe);else if(ae.from<=v&&(ae.to==null||ae.to>v||xe.collapsed&&ae.to==v&&ae.from==v)){if(ae.to!=null&&ae.to!=v&&M>ae.to&&(M=ae.to,R=""),xe.className&&(z+=" "+xe.className),xe.css&&(B=(B?B+";":"")+xe.css),xe.startStyle&&ae.from==v&&(Y+=" "+xe.startStyle),xe.endStyle&&ae.to==M&&(ne||(ne=[])).push(xe.endStyle,ae.to),xe.title&&((V||(V={})).title=xe.title),xe.attributes)for(var Te in xe.attributes)(V||(V={}))[Te]=xe.attributes[Te];xe.collapsed&&(!Q||ha(Q.marker,xe)<0)&&(Q=ae)}else ae.from>v&&M>ae.from&&(M=ae.from)}if(ne)for(var nt=0;nt<ne.length;nt+=2)ne[nt+1]==M&&(R+=" "+ne[nt]);if(!Q||Q.from==v)for(var Pe=0;Pe<J.length;++Pe)vs(t,0,J[Pe]);if(Q&&(Q.from||0)==v){if(vs(t,(Q.to==null?g+1:Q.to)-v,Q.marker,Q.from==null),Q.to==null)return;Q.to==v&&(Q=!1)}}if(v>=g)break;for(var St=Math.min(g,M);;){if(w){var xt=v+w.length;if(!Q){var Xe=xt>St?w.slice(0,St-v):w;t.addToken(t,Xe,k?k+z:z,Y,v+Xe.length==M?R:"",B,V)}if(xt>=St){w=w.slice(St-v),v=St;break}v=xt,Y=""}w=i.slice(u,u=n[b++]),k=ps(n[b++],t.cm.options)}}}function ms(e,t,n){this.line=t,this.rest=ad(t),this.size=this.rest?Ae(Ce(this.rest))-n+1:1,this.node=this.text=null,this.hidden=vr(e,t)}function Bi(e,t,n){for(var r=[],i,u=t;u<n;u=i){var h=new ms(e.doc,oe(e.doc,u),u);i=u+h.size,r.push(h)}return r}var en=null;function vd(e){en?en.ops.push(e):e.ownsGroup=en={ops:[e],delayedCallbacks:[]}}function md(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function bd(e,t){var n=e.ownsGroup;if(n)try{md(n)}finally{en=null,t(n)}}var Pn=null;function et(e,t){var n=Qo(e,t);if(n.length){var r=Array.prototype.slice.call(arguments,2),i;en?i=en.delayedCallbacks:Pn?i=Pn:(i=Pn=[],setTimeout(yd,0));for(var u=function(g){i.push(function(){return n[g].apply(null,r)})},h=0;h<n.length;++h)u(h)}}function yd(){var e=Pn;Pn=null;for(var t=0;t<e.length;++t)e[t]()}function bs(e,t,n,r){for(var i=0;i<t.changes.length;i++){var u=t.changes[i];u=="text"?Dd(e,t):u=="gutter"?xs(e,t,n,r):u=="class"?ma(e,t):u=="widget"&&wd(e,t,r)}t.changes=null}function zn(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 xd(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=zn(t);t.background=r.insertBefore(E("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function ys(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):gs(e,t)}function Dd(e,t){var n=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,ma(e,t)):n&&(t.text.className=n)}function ma(e,t){xd(e,t),t.line.wrapClass?zn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function xs(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=zn(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),i.insertBefore(t.gutterBackground,t.text)}var u=t.line.gutterMarkers;if(e.options.lineNumbers||u){var h=zn(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),h.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",la(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),u)for(var v=0;v<e.display.gutterSpecs.length;++v){var b=e.display.gutterSpecs[v].className,w=u.hasOwnProperty(b)&&u[b];w&&g.appendChild(E("div",[w],"CodeMirror-gutter-elt","left: "+r.gutterLeft[b]+"px; width: "+r.gutterWidth[b]+"px"))}}}function wd(e,t,n){t.alignable&&(t.alignable=null);for(var r=U("CodeMirror-linewidget"),i=t.node.firstChild,u=void 0;i;i=u)u=i.nextSibling,r.test(i.className)&&t.node.removeChild(i);Ds(e,t,n)}function Cd(e,t,n,r){var i=ys(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),ma(e,t),xs(e,t,n,r),Ds(e,t,r),t.node}function Ds(e,t,n){if(ws(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)ws(e,t.rest[r],t,n,!1)}function ws(e,t,n,r,i){if(t.widgets)for(var u=zn(n),h=0,g=t.widgets;h<g.length;++h){var v=g[h],b=E("div",[v.node],"CodeMirror-linewidget"+(v.className?" "+v.className:""));v.handleMouseEvents||b.setAttribute("cm-ignore-events","true"),kd(v,b,n,r),e.display.input.setUneditable(b),i&&v.above?u.insertBefore(b,n.gutter||n.text):u.appendChild(b),et(v,"redraw")}}function kd(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function Hn(e){if(e.height!=null)return e.height;var t=e.doc.cm;if(!t)return 0;if(!Z(document.body,e.node)){var n="position: relative;";e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),ee(t.display.measure,E("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function ir(e,t){for(var n=$o(t);n!=e.wrapper;n=n.parentNode)if(!n||n.nodeType==1&&n.getAttribute("cm-ignore-events")=="true"||n.parentNode==e.sizer&&n!=e.mover)return!0}function Ni(e){return e.lineSpace.offsetTop}function ba(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Cs(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=ee(e.measure,E("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return!isNaN(r.left)&&!isNaN(r.right)&&(e.cachedPaddingH=r),r}function Qt(e){return He-e.display.nativeBarWidth}function Br(e){return e.display.scroller.clientWidth-Qt(e)-e.display.barWidth}function ya(e){return e.display.scroller.clientHeight-Qt(e)-e.display.barHeight}function Sd(e,t,n){var r=e.options.lineWrapping,i=r&&Br(e);if(!t.measure.heights||r&&t.measure.width!=i){var u=t.measure.heights=[];if(r){t.measure.width=i;for(var h=t.text.firstChild.getClientRects(),g=0;g<h.length-1;g++){var v=h[g],b=h[g+1];Math.abs(v.bottom-b.bottom)>2&&u.push((v.bottom+b.top)/2-n.top)}}u.push(n.bottom-n.top)}}function ks(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};if(e.rest){for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(Ae(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}}function Ed(e,t){t=Rt(t);var n=Ae(t),r=e.display.externalMeasured=new ms(e.doc,t,n);r.lineN=n;var i=r.built=gs(e,r);return r.text=i.pre,ee(e.display.lineMeasure,i.pre),r}function Ss(e,t,n,r){return Jt(e,tn(e,t),n,r)}function xa(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Ir(e,t)];var n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size)return n}function tn(e,t){var n=Ae(t),r=xa(e,n);r&&!r.text?r=null:r&&r.changes&&(bs(e,r,n,Sa(e)),e.curOp.forceUpdate=!0),r||(r=Ed(e,t));var i=ks(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Jt(e,t,n,r,i){t.before&&(n=-1);var u=n+(r||""),h;return t.cache.hasOwnProperty(u)?h=t.cache[u]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Sd(e,t.view,t.rect),t.hasHeights=!0),h=Fd(e,t,n,r),h.bogus||(t.cache[u]=h)),{left:h.left,right:h.right,top:i?h.rtop:h.top,bottom:i?h.rbottom:h.bottom}}var Es={left:0,right:0,top:0,bottom:0};function As(e,t,n){for(var r,i,u,h,g,v,b=0;b<e.length;b+=3)if(g=e[b],v=e[b+1],t<g?(i=0,u=1,h="left"):t<v?(i=t-g,u=i+1):(b==e.length-3||t==v&&e[b+3]>t)&&(u=v-g,i=u-1,t>=v&&(h="right")),i!=null){if(r=e[b+2],g==v&&n==(r.insertLeft?"left":"right")&&(h=n),n=="left"&&i==0)for(;b&&e[b-2]==e[b-3]&&e[b-1].insertLeft;)r=e[(b-=3)+2],h="left";if(n=="right"&&i==v-g)for(;b<e.length-3&&e[b+3]==e[b+4]&&!e[b+5].insertLeft;)r=e[(b+=3)+2],h="right";break}return{node:r,start:i,end:u,collapse:h,coverStart:g,coverEnd:v}}function Ad(e,t){var n=Es;if(t=="left")for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;i>=0&&(n=e[i]).left==n.right;i--);return n}function Fd(e,t,n,r){var i=As(t.map,n,r),u=i.node,h=i.start,g=i.end,v=i.collapse,b;if(u.nodeType==3){for(var w=0;w<4;w++){for(;h&&Zo(t.line.text.charAt(i.coverStart+h));)--h;for(;i.coverStart+g<i.coverEnd&&Zo(t.line.text.charAt(i.coverStart+g));)++g;if(c&&d<9&&h==0&&g==i.coverEnd-i.coverStart?b=u.parentNode.getBoundingClientRect():b=Ad(W(u,h,g).getClientRects(),r),b.left||b.right||h==0)break;g=h,h=h-1,v="right"}c&&d<11&&(b=Td(e.display.measure,b))}else{h>0&&(v=r="right");var k;e.options.lineWrapping&&(k=u.getClientRects()).length>1?b=k[r=="right"?k.length-1:0]:b=u.getBoundingClientRect()}if(c&&d<9&&!h&&(!b||!b.left&&!b.right)){var B=u.parentNode.getClientRects()[0];B?b={left:B.left,right:B.left+nn(e.display),top:B.top,bottom:B.bottom}:b=Es}for(var M=b.top-t.rect.top,z=b.bottom-t.rect.top,R=(M+z)/2,Y=t.view.measure.heights,Q=0;Q<Y.length-1&&!(R<Y[Q]);Q++);var V=Q?Y[Q-1]:0,J=Y[Q],ne={left:(v=="right"?b.right:b.left)-t.rect.left,right:(v=="left"?b.left:b.right)-t.rect.left,top:V,bottom:J};return!b.left&&!b.right&&(ne.bogus=!0),e.options.singleCursorHeightPerLine||(ne.rtop=M,ne.rbottom=z),ne}function Td(e,t){if(!window.screen||screen.logicalXDPI==null||screen.logicalXDPI==screen.deviceXDPI||!jc(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function 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,j(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Fs(e.display.view[t])}function Rn(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&&O?-(e.body.getBoundingClientRect().left-parseInt(getComputedStyle(e.body).marginLeft)):e.defaultView.pageXOffset||(e.documentElement||e.body).scrollLeft}function Ms(e){return x&&O?-(e.body.getBoundingClientRect().top-parseInt(getComputedStyle(e.body).marginTop)):e.defaultView.pageYOffset||(e.documentElement||e.body).scrollTop}function Da(e){var t=Rt(e),n=t.widgets,r=0;if(n)for(var i=0;i<n.length;++i)n[i].above&&(r+=Hn(n[i]));return r}function Oi(e,t,n,r,i){if(!i){var u=Da(t);n.top+=u,n.bottom+=u}if(r=="line")return n;r||(r="local");var h=nr(t);if(r=="local"?h+=Ni(e.display):h-=e.display.viewOffset,r=="page"||r=="window"){var g=e.display.lineSpace.getBoundingClientRect();h+=g.top+(r=="window"?0:Ms(D(e)));var v=g.left+(r=="window"?0:Ls(D(e)));n.left+=v,n.right+=v}return n.top+=h,n.bottom+=h,n}function _s(e,t,n){if(n=="div")return t;var r=t.left,i=t.top;if(n=="page")r-=Ls(D(e)),i-=Ms(D(e));else if(n=="local"||!n){var u=e.display.sizer.getBoundingClientRect();r+=u.left,i+=u.top}var h=e.display.lineSpace.getBoundingClientRect();return{left:r-h.left,top:i-h.top}}function Ii(e,t,n,r,i){return r||(r=oe(e.doc,t.line)),Oi(e,r,Ss(e,r,t.ch,i),n)}function Wt(e,t,n,r,i,u){r=r||oe(e.doc,t.line),i||(i=tn(e,r));function h(z,R){var Y=Jt(e,i,z,R?"right":"left",u);return R?Y.left=Y.right:Y.right=Y.left,Oi(e,r,Y,n)}var g=tr(r,e.doc.direction),v=t.ch,b=t.sticky;if(v>=r.text.length?(v=r.text.length,b="before"):v<=0&&(v=0,b="after"),!g)return h(b=="before"?v-1:v,b=="before");function w(z,R,Y){var Q=g[R],V=Q.level==1;return h(Y?z-1:z,V!=Y)}var k=_n(g,v,b),B=Mn,M=w(v,k,b=="before");return B!=null&&(M.other=w(v,B,b!="before")),M}function Bs(e,t){var n=0;t=ge(e.doc,t),e.options.lineWrapping||(n=nn(e.display)*t.ch);var r=oe(e.doc,t.line),i=nr(r)+Ni(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function wa(e,t,n,r,i){var u=X(e,t,n);return u.xRel=i,r&&(u.outside=r),u}function Ca(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return wa(r.first,0,null,-1,-1);var i=_r(r,n),u=r.first+r.size-1;if(i>u)return wa(r.first+r.size-1,oe(r,u).text.length,null,1,1);t<0&&(t=0);for(var h=oe(r,i);;){var g=Ld(e,h,i,t,n),v=id(h,g.ch+(g.xRel>0||g.outside>0?1:0));if(!v)return g;var b=v.find(1);if(b.line==i)return b;h=oe(r,i=b.line)}}function Ns(e,t,n,r){r-=Da(t);var i=t.text.length,u=Ln(function(h){return Jt(e,n,h-1).bottom<=r},i,0);return i=Ln(function(h){return Jt(e,n,h).top>r},u,i),{begin:u,end:i}}function Os(e,t,n,r){n||(n=tn(e,t));var i=Oi(e,t,Jt(e,n,r),"line").top;return Ns(e,t,n,i)}function ka(e,t,n,r){return e.bottom<=n?!1:e.top>n?!0:(r?e.left:e.right)>t}function Ld(e,t,n,r,i){i-=nr(t);var u=tn(e,t),h=Da(t),g=0,v=t.text.length,b=!0,w=tr(t,e.doc.direction);if(w){var k=(e.options.lineWrapping?_d:Md)(e,t,n,u,w,r,i);b=k.level!=1,g=b?k.from:k.to-1,v=b?k.to:k.from-1}var B=null,M=null,z=Ln(function(se){var ae=Jt(e,u,se);return ae.top+=h,ae.bottom+=h,ka(ae,r,i,!1)?(ae.top<=i&&ae.left<=r&&(B=se,M=ae),!0):!1},g,v),R,Y,Q=!1;if(M){var V=r-M.left<M.right-r,J=V==b;z=B+(J?0:1),Y=J?"after":"before",R=V?M.left:M.right}else{!b&&(z==v||z==g)&&z++,Y=z==0?"after":z==t.text.length?"before":Jt(e,u,z-(b?1:0)).bottom+h<=i==b?"after":"before";var ne=Wt(e,X(n,z,Y),"line",t,u);R=ne.left,Q=i<ne.top?-1:i>=ne.bottom?1:0}return z=Gl(t.text,z,1),wa(n,z,Y,Q,r-R)}function Md(e,t,n,r,i,u,h){var g=Ln(function(k){var B=i[k],M=B.level!=1;return ka(Wt(e,X(n,M?B.to:B.from,M?"before":"after"),"line",t,r),u,h,!0)},0,i.length-1),v=i[g];if(g>0){var b=v.level!=1,w=Wt(e,X(n,b?v.from:v.to,b?"after":"before"),"line",t,r);ka(w,u,h,!0)&&w.top>h&&(v=i[g-1])}return v}function _d(e,t,n,r,i,u,h){var g=Ns(e,t,r,h),v=g.begin,b=g.end;/\s/.test(t.text.charAt(b-1))&&b--;for(var w=null,k=null,B=0;B<i.length;B++){var M=i[B];if(!(M.from>=b||M.to<=v)){var z=M.level!=1,R=Jt(e,r,z?Math.min(b,M.to)-1:Math.max(v,M.from)).right,Y=R<u?u-R+1e9:R-u;(!w||k>Y)&&(w=M,k=Y)}}return w||(w=i[i.length-1]),w.from<v&&(w={from:v,to:w.to,level:w.level}),w.to>b&&(w={from:w.from,to:b,level:w.level}),w}var Nr;function rn(e){if(e.cachedTextHeight!=null)return e.cachedTextHeight;if(Nr==null){Nr=E("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Nr.appendChild(document.createTextNode("x")),Nr.appendChild(E("br"));Nr.appendChild(document.createTextNode("x"))}ee(e.measure,Nr);var n=Nr.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),j(e.measure),n||1}function nn(e){if(e.cachedCharWidth!=null)return e.cachedCharWidth;var t=E("span","xxxxxxxxxx"),n=E("pre",[t],"CodeMirror-line-like");ee(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Sa(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,u=t.gutters.firstChild,h=0;u;u=u.nextSibling,++h){var g=e.display.gutterSpecs[h].className;n[g]=u.offsetLeft+u.clientLeft+i,r[g]=u.clientWidth}return{fixedPos:Ea(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Ea(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Is(e){var t=rn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/nn(e.display)-3);return function(i){if(vr(e.doc,i))return 0;var u=0;if(i.widgets)for(var h=0;h<i.widgets.length;h++)i.widgets[h].height&&(u+=i.widgets[h].height);return n?u+(Math.ceil(i.text.length/r)||1)*t:u+t}}function Aa(e){var t=e.doc,n=Is(e);t.iter(function(r){var i=n(r);i!=r.height&&Yt(r,i)})}function Or(e,t,n,r){var i=e.display;if(!n&&$o(t).getAttribute("cm-not-content")=="true")return null;var u,h,g=i.lineSpace.getBoundingClientRect();try{u=t.clientX-g.left,h=t.clientY-g.top}catch{return null}var v=Ca(e,u,h),b;if(r&&v.xRel>0&&(b=oe(e.doc,v.line).text).length==v.ch){var w=Ye(b,b.length,e.options.tabSize)-b.length;v=X(v.line,Math.max(0,Math.round((u-Cs(e.display).left)/nn(e.display))-w))}return v}function Ir(e,t){if(t>=e.display.viewTo||(t-=e.display.viewFrom,t<0))return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function bt(e,t,n,r){t==null&&(t=e.doc.first),n==null&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(i.updateLineNumbers==null||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)rr&&pa(e.doc,t)<i.viewTo&&br(e);else if(n<=i.viewFrom)rr&&hs(e.doc,n+r)>i.viewFrom?br(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)br(e);else if(t<=i.viewFrom){var u=Pi(e,n,n+r,1);u?(i.view=i.view.slice(u.index),i.viewFrom=u.lineN,i.viewTo+=r):br(e)}else if(n>=i.viewTo){var h=Pi(e,t,t,-1);h?(i.view=i.view.slice(0,h.index),i.viewTo=h.lineN):br(e)}else{var g=Pi(e,t,t,-1),v=Pi(e,n,n+r,1);g&&v?(i.view=i.view.slice(0,g.index).concat(Bi(e,g.lineN,v.lineN)).concat(i.view.slice(v.index)),i.viewTo+=r):br(e)}var b=i.externalMeasured;b&&(n<b.lineN?b.lineN+=r:t<b.lineN+b.size&&(i.externalMeasured=null))}function mr(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var u=r.view[Ir(e,t)];if(u.node!=null){var h=u.changes||(u.changes=[]);Ne(h,n)==-1&&h.push(n)}}}function br(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Pi(e,t,n,r){var i=Ir(e,t),u,h=e.display.view;if(!rr||n==e.doc.first+e.doc.size)return{index:i,lineN:n};for(var g=e.display.viewFrom,v=0;v<i;v++)g+=h[v].size;if(g!=t){if(r>0){if(i==h.length-1)return null;u=g+h[i].size-t,i++}else u=g-t;t+=u,n+=u}for(;pa(e.doc,n)!=n;){if(i==(r<0?0:h.length-1))return null;n+=r*h[i-(r<0?1:0)].size,i+=r}return{index:i,lineN:n}}function Bd(e,t,n){var r=e.display,i=r.view;i.length==0||t>=r.viewTo||n<=r.viewFrom?(r.view=Bi(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Bi(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Ir(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(Bi(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Ir(e,n)))),r.viewTo=n}function Ps(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];!i.hidden&&(!i.node||i.changes)&&++n}return n}function Wn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function zs(e,t){t===void 0&&(t=!0);var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),u=r.selection=document.createDocumentFragment(),h=e.options.$customCursor;h&&(t=!0);for(var g=0;g<n.sel.ranges.length;g++)if(!(!t&&g==n.sel.primIndex)){var v=n.sel.ranges[g];if(!(v.from().line>=e.display.viewTo||v.to().line<e.display.viewFrom)){var b=v.empty();if(h){var w=h(e,v);w&&Fa(e,w,i)}else(b||e.options.showCursorWhenSelecting)&&Fa(e,v.head,i);b||Nd(e,v,u)}}return r}function Fa(e,t,n){var r=Wt(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(E("div","\xA0","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",/\bcm-fat-cursor\b/.test(e.getWrapperElement().className)){var u=Ii(e,t,"div",null,null),h=u.right-u.left;i.style.width=(h>0?h:e.defaultCharWidth())+"px"}if(r.other){var g=n.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 zi(e,t){return e.top-t.top||e.left-t.left}function Nd(e,t,n){var r=e.display,i=e.doc,u=document.createDocumentFragment(),h=Cs(e.display),g=h.left,v=Math.max(r.sizerWidth,Br(e)-r.sizer.offsetLeft)-h.right,b=i.direction=="ltr";function w(J,ne,se,ae){ne<0&&(ne=0),ne=Math.round(ne),ae=Math.round(ae),u.appendChild(E("div",null,"CodeMirror-selected","position: absolute; left: "+J+`px;
|
|
top: `+ne+"px; width: "+(se??v-J)+`px;
|
|
height: `+(ae-ne)+"px"))}function k(J,ne,se){var ae=oe(i,J),xe=ae.text.length,Te,nt;function Pe(Xe,Dt){return Ii(e,X(J,Xe),"div",ae,Dt)}function St(Xe,Dt,ot){var Qe=Os(e,ae,null,Xe),Ke=Dt=="ltr"==(ot=="after")?"left":"right",Re=ot=="after"?Qe.begin:Qe.end-(/\s/.test(ae.text.charAt(Qe.end-1))?2:1);return Pe(Re,Ke)[Ke]}var xt=tr(ae,i.direction);return Pc(xt,ne||0,se??xe,function(Xe,Dt,ot,Qe){var Ke=ot=="ltr",Re=Pe(Xe,Ke?"left":"right"),wt=Pe(Dt-1,Ke?"right":"left"),mn=ne==null&&Xe==0,kr=se==null&&Dt==xe,st=Qe==0,$t=!xt||Qe==xt.length-1;if(wt.top-Re.top<=3){var it=(b?mn:kr)&&st,tl=(b?kr:mn)&&$t,lr=it?g:(Ke?Re:wt).left,Wr=tl?v:(Ke?wt:Re).right;w(lr,Re.top,Wr-lr,Re.bottom)}else{var qr,dt,bn,rl;Ke?(qr=b&&mn&&st?g:Re.left,dt=b?v:St(Xe,ot,"before"),bn=b?g:St(Dt,ot,"after"),rl=b&&kr&&$t?v:wt.right):(qr=b?St(Xe,ot,"before"):g,dt=!b&&mn&&st?v:Re.right,bn=!b&&kr&&$t?g:wt.left,rl=b?St(Dt,ot,"after"):v),w(qr,Re.top,dt-qr,Re.bottom),Re.bottom<wt.top&&w(g,Re.bottom,null,wt.top),w(bn,wt.top,rl-bn,wt.bottom)}(!Te||zi(Re,Te)<0)&&(Te=Re),zi(wt,Te)<0&&(Te=wt),(!nt||zi(Re,nt)<0)&&(nt=Re),zi(wt,nt)<0&&(nt=wt)}),{start:Te,end:nt}}var B=t.from(),M=t.to();if(B.line==M.line)k(B.line,B.ch,M.ch);else{var z=oe(i,B.line),R=oe(i,M.line),Y=Rt(z)==Rt(R),Q=k(B.line,B.ch,Y?z.text.length+1:null).end,V=k(M.line,Y?0:null,M.ch).start;Y&&(Q.top<V.top-2?(w(Q.right,Q.top,null,Q.bottom),w(g,V.top,V.left,V.bottom)):w(Q.right,Q.top,V.left-Q.right,Q.bottom)),Q.bottom<V.top&&w(g,Q.bottom,null,V.top)}n.appendChild(u)}function Ta(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){e.hasFocus()||on(e),t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Hs(e){e.hasFocus()||(e.display.input.focus(),e.state.focused||Ma(e))}function La(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,e.state.focused&&on(e))},100)}function Ma(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,De(e.display.wrapper,"CodeMirror-focused"),!e.curOp&&e.display.selForContextMenu!=e.doc.sel&&(e.display.input.reset(),m&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Ta(e))}function on(e,t){e.state.delayingBlurEvent||(e.state.focused&&(je(e,"blur",e,t),e.state.focused=!1,le(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function Hi(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=Math.max(0,t.scroller.getBoundingClientRect().top),i=t.lineDiv.getBoundingClientRect().top,u=0,h=0;h<t.view.length;h++){var g=t.view[h],v=e.options.lineWrapping,b=void 0,w=0;if(!g.hidden){if(i+=g.line.height,c&&d<8){var k=g.node.offsetTop+g.node.offsetHeight;b=k-n,n=k}else{var B=g.node.getBoundingClientRect();b=B.bottom-B.top,!v&&g.text.firstChild&&(w=g.text.firstChild.getBoundingClientRect().right-B.left-1)}var M=g.line.height-b;if((M>.005||M<-.005)&&(i<r&&(u-=M),Yt(g.line,b),Rs(g.line),g.rest))for(var z=0;z<g.rest.length;z++)Rs(g.rest[z]);if(w>e.display.sizerWidth){var R=Math.ceil(w/nn(e.display));R>e.display.maxLineLength&&(e.display.maxLineLength=R,e.display.maxLine=g.line,e.display.maxLineChanged=!0)}}}Math.abs(u)>2&&(t.scroller.scrollTop+=u)}function Rs(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Ri(e,t,n){var r=n&&n.top!=null?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Ni(e));var i=n&&n.bottom!=null?n.bottom:r+e.wrapper.clientHeight,u=_r(t,r),h=_r(t,i);if(n&&n.ensure){var g=n.ensure.from.line,v=n.ensure.to.line;g<u?(u=g,h=_r(t,nr(oe(t,g))+e.wrapper.clientHeight)):Math.min(v,t.lastLine())>=h&&(u=_r(t,nr(oe(t,v))-e.wrapper.clientHeight),h=v)}return{from:u,to:Math.max(h,u+1)}}function Od(e,t){if(!Ve(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null,u=n.wrapper.ownerDocument;if(t.top+r.top<0?i=!0:t.bottom+r.top>(u.defaultView.innerHeight||u.documentElement.clientHeight)&&(i=!1),i!=null&&!L){var h=E("div","\u200B",null,`position: absolute;
|
|
top: `+(t.top-n.viewOffset-Ni(e.display))+`px;
|
|
height: `+(t.bottom-t.top+Qt(e)+n.barHeight)+`px;
|
|
left: `+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(h),h.scrollIntoView(i),e.display.lineSpace.removeChild(h)}}}function Id(e,t,n,r){r==null&&(r=0);var i;!e.options.lineWrapping&&t==n&&(n=t.sticky=="before"?X(t.line,t.ch+1,"before"):t,t=t.ch?X(t.line,t.sticky=="before"?t.ch-1:t.ch,"after"):t);for(var u=0;u<5;u++){var h=!1,g=Wt(e,t),v=!n||n==t?g:Wt(e,n);i={left:Math.min(g.left,v.left),top:Math.min(g.top,v.top)-r,right:Math.max(g.left,v.left),bottom:Math.max(g.bottom,v.bottom)+r};var b=_a(e,i),w=e.doc.scrollTop,k=e.doc.scrollLeft;if(b.scrollTop!=null&&(Un(e,b.scrollTop),Math.abs(e.doc.scrollTop-w)>1&&(h=!0)),b.scrollLeft!=null&&(Pr(e,b.scrollLeft),Math.abs(e.doc.scrollLeft-k)>1&&(h=!0)),!h)break}return i}function Pd(e,t){var n=_a(e,t);n.scrollTop!=null&&Un(e,n.scrollTop),n.scrollLeft!=null&&Pr(e,n.scrollLeft)}function _a(e,t){var n=e.display,r=rn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&e.curOp.scrollTop!=null?e.curOp.scrollTop:n.scroller.scrollTop,u=ya(e),h={};t.bottom-t.top>u&&(t.bottom=t.top+u);var g=e.doc.height+ba(n),v=t.top<r,b=t.bottom>g-r;if(t.top<i)h.scrollTop=v?0:t.top;else if(t.bottom>i+u){var w=Math.min(t.top,(b?g:t.bottom)-u);w!=i&&(h.scrollTop=w)}var k=e.options.fixedGutter?0:n.gutters.offsetWidth,B=e.curOp&&e.curOp.scrollLeft!=null?e.curOp.scrollLeft:n.scroller.scrollLeft-k,M=Br(e)-n.gutters.offsetWidth,z=t.right-t.left>M;return z&&(t.right=t.left+M),t.left<10?h.scrollLeft=0:t.left<B?h.scrollLeft=Math.max(0,t.left+k-(z?0:10)):t.right>M+B-3&&(h.scrollLeft=t.right+(z?0:10)-M),h}function Ba(e,t){t!=null&&(Wi(e),e.curOp.scrollTop=(e.curOp.scrollTop==null?e.doc.scrollTop:e.curOp.scrollTop)+t)}function an(e){Wi(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function qn(e,t,n){(t!=null||n!=null)&&Wi(e),t!=null&&(e.curOp.scrollLeft=t),n!=null&&(e.curOp.scrollTop=n)}function zd(e,t){Wi(e),e.curOp.scrollToPos=t}function Wi(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=Bs(e,t.from),r=Bs(e,t.to);Ws(e,n,r,t.margin)}}function Ws(e,t,n,r){var i=_a(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});qn(e,i.scrollLeft,i.scrollTop)}function Un(e,t){Math.abs(e.doc.scrollTop-t)<2||(s||Oa(e,{top:t}),qs(e,t,!0),s&&Oa(e),Xn(e,100))}function qs(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),!(e.display.scroller.scrollTop==t&&!n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Pr(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),!((n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r)&&(e.doc.scrollLeft=t,Ks(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function jn(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+ba(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Qt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var zr=function(e,t,n){this.cm=n;var r=this.vert=E("div",[E("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=E("div",[E("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),ue(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),ue(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,c&&d<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};zr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var u=e.viewWidth-e.barLeft-(n?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:n?r:0,bottom:t?r:0}},zr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},zr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},zr.prototype.zeroWidthHack=function(){var e=I&&!_?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new ft,this.disableVert=new ft},zr.prototype.enableZeroWidthBar=function(e,t,n){e.style.visibility="";function r(){var i=e.getBoundingClientRect(),u=n=="vert"?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);u!=e?e.style.visibility="hidden":t.set(1e3,r)}t.set(1e3,r)},zr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Gn=function(){};Gn.prototype.update=function(){return{bottom:0,right:0}},Gn.prototype.setScrollLeft=function(){},Gn.prototype.setScrollTop=function(){},Gn.prototype.clear=function(){};function ln(e,t){t||(t=jn(e));var n=e.display.barWidth,r=e.display.barHeight;Us(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Hi(e),Us(e,jn(e)),n=e.display.barWidth,r=e.display.barHeight}function Us(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}var js={native:zr,null:Gn};function Gs(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&le(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,n){n=="horizontal"?Pr(e,t):Un(e,t)},e),e.display.scrollbars.addClass&&De(e.display.wrapper,e.display.scrollbars.addClass)}var Hd=0;function Hr(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:++Hd,markArrays:null},vd(e.curOp)}function Rr(e){var t=e.curOp;t&&bd(t,function(n){for(var r=0;r<n.ops.length;r++)n.ops[r].cm.curOp=null;Rd(n)})}function Rd(e){for(var t=e.ops,n=0;n<t.length;n++)Wd(t[n]);for(var r=0;r<t.length;r++)qd(t[r]);for(var i=0;i<t.length;i++)Ud(t[i]);for(var u=0;u<t.length;u++)jd(t[u]);for(var h=0;h<t.length;h++)Gd(t[h])}function Wd(e){var t=e.cm,n=t.display;Kd(t),e.updateMaxLine&&va(t),e.mustUpdate=e.viewChanged||e.forceUpdate||e.scrollTop!=null||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new qi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function qd(e){e.updatedDisplay=e.mustUpdate&&Na(e.cm,e.update)}function Ud(e){var t=e.cm,n=t.display;e.updatedDisplay&&Hi(t),e.barMeasure=jn(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ss(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Qt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Br(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function jd(e){var t=e.cm;e.adjustWidthTo!=null&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Pr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==ve(te(t));e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&ln(t,e.barMeasure),e.updatedDisplay&&Pa(t,e.barMeasure),e.selectionChanged&&Ta(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Hs(e.cm)}function Gd(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Xs(t,e.update),n.wheelStartX!=null&&(e.scrollTop!=null||e.scrollLeft!=null||e.scrollToPos)&&(n.wheelStartX=n.wheelStartY=null),e.scrollTop!=null&&qs(t,e.scrollTop,e.forceScroll),e.scrollLeft!=null&&Pr(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Id(t,ge(r,e.scrollToPos.from),ge(r,e.scrollToPos.to),e.scrollToPos.margin);Od(t,i)}var u=e.maybeHiddenMarkers,h=e.maybeUnhiddenMarkers;if(u)for(var g=0;g<u.length;++g)u[g].lines.length||je(u[g],"hide");if(h)for(var v=0;v<h.length;++v)h[v].lines.length&&je(h[v],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&je(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function kt(e,t){if(e.curOp)return t();Hr(e);try{return t()}finally{Rr(e)}}function tt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Hr(e);try{return t.apply(e,arguments)}finally{Rr(e)}}}function ct(e){return function(){if(this.curOp)return e.apply(this,arguments);Hr(this);try{return e.apply(this,arguments)}finally{Rr(this)}}}function rt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Hr(t);try{return e.apply(this,arguments)}finally{Rr(t)}}}function Xn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,gt(Xd,e))}function Xd(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=On(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(u){if(r.line>=e.display.viewFrom){var h=u.styles,g=u.text.length>e.options.maxHighlightLength?Lr(t.mode,r.state):null,v=Vl(e,u,r,!0);g&&(r.state=g),u.styles=v.styles;var b=u.styleClasses,w=v.classes;w?u.styleClasses=w:b&&(u.styleClasses=null);for(var k=!h||h.length!=u.styles.length||b!=w&&(!b||!w||b.bgClass!=w.bgClass||b.textClass!=w.textClass),B=0;!k&&B<h.length;++B)k=h[B]!=u.styles[B];k&&i.push(r.line),u.stateAfter=r.save(),r.nextLine()}else u.text.length<=e.options.maxHighlightLength&&fa(e,u.text,r),u.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return Xn(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&kt(e,function(){for(var u=0;u<i.length;u++)mr(e,i[u],"text")})}}var qi=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Ri(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Br(e),this.force=n,this.dims=Sa(e),this.events=[]};qi.prototype.signal=function(e,t){It(e,t)&&this.events.push(arguments)},qi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)je.apply(null,this.events[e])};function Kd(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 Yd(e){if(e.hasFocus())return null;var t=ve(te(e));if(!t||!Z(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=ye(e).getSelection();r.anchorNode&&r.extend&&Z(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function Zd(e){if(!(!e||!e.activeElt||e.activeElt==ve(we(e.activeElt)))&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&Z(document.body,e.anchorNode)&&Z(document.body,e.focusNode))){var t=e.activeElt.ownerDocument,n=t.defaultView.getSelection(),r=t.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),n.removeAllRanges(),n.addRange(r),n.extend(e.focusNode,e.focusOffset)}}function Na(e,t){var n=e.display,r=e.doc;if(t.editorIsHidden)return br(e),!1;if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&Ps(e)==0)return!1;Ys(e)&&(br(e),t.dims=Sa(e));var i=r.first+r.size,u=Math.max(t.visible.from-e.options.viewportMargin,r.first),h=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFrom<u&&u-n.viewFrom<20&&(u=Math.max(r.first,n.viewFrom)),n.viewTo>h&&n.viewTo-h<20&&(h=Math.min(i,n.viewTo)),rr&&(u=pa(e.doc,u),h=hs(e.doc,h));var g=u!=n.viewFrom||h!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Bd(e,u,h),n.viewOffset=nr(oe(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var v=Ps(e);if(!g&&v==0&&!t.force&&n.renderedView==n.view&&(n.updateLineNumbers==null||n.updateLineNumbers>=n.viewTo))return!1;var b=Yd(e);return v>4&&(n.lineDiv.style.display="none"),Qd(e,n.updateLineNumbers,t.dims),v>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,Zd(b),j(n.cursorDiv),j(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,g&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Xn(e,400)),n.updateLineNumbers=null,!0}function Xs(e,t){for(var n=t.viewport,r=!0;;r=!1){if(!r||!e.options.lineWrapping||t.oldDisplayWidth==Br(e)){if(n&&n.top!=null&&(n={top:Math.min(e.doc.height+ba(e.display)-ya(e),n.top)}),t.visible=Ri(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break}else r&&(t.visible=Ri(e.display,e.doc,n));if(!Na(e,t))break;Hi(e);var i=jn(e);Wn(e),ln(e,i),Pa(e,i),t.force=!1}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function Oa(e,t){var n=new qi(e,t);if(Na(e,n)){Hi(e),Xs(e,n);var r=jn(e);Wn(e),ln(e,r),Pa(e,r),n.finish()}}function Qd(e,t,n){var r=e.display,i=e.options.lineNumbers,u=r.lineDiv,h=u.firstChild;function g(z){var R=z.nextSibling;return m&&I&&e.display.currentWheelTarget==z?z.style.display="none":z.parentNode.removeChild(z),R}for(var v=r.view,b=r.viewFrom,w=0;w<v.length;w++){var k=v[w];if(!k.hidden)if(!k.node||k.node.parentNode!=u){var B=Cd(e,k,b,n);u.insertBefore(B,h)}else{for(;h!=k.node;)h=g(h);var M=i&&t!=null&&t<=b&&k.lineNumber;k.changes&&(Ne(k.changes,"gutter")>-1&&(M=!1),bs(e,k,b,n)),M&&(j(k.lineNumber),k.lineNumber.appendChild(document.createTextNode(la(e.options,b)))),h=k.node.nextSibling}b+=k.size}for(;h;)h=g(h)}function Ia(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px",et(e,"gutterChanged",e)}function Pa(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,n=t.view;if(!(!t.alignWidgets&&(!t.gutters.firstChild||!e.options.fixedGutter))){for(var r=Ea(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,u=r+"px",h=0;h<n.length;h++)if(!n[h].hidden){e.options.fixedGutter&&(n[h].gutter&&(n[h].gutter.style.left=u),n[h].gutterBackground&&(n[h].gutterBackground.style.left=u));var g=n[h].alignable;if(g)for(var v=0;v<g.length;v++)g[v].style.left=u}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function Ys(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=la(e.options,t.first+t.size-1),r=e.display;if(n.length!=r.lineNumChars){var i=r.measure.appendChild(E("div",[E("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),u=i.firstChild.offsetWidth,h=i.offsetWidth-u;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(u,r.lineGutter.offsetWidth-h)+1,r.lineNumWidth=r.lineNumInnerWidth+h,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",Ia(e.display),!0}return!1}function za(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var u=e[i],h=null;if(typeof u!="string"&&(h=u.style,u=u.className),u=="CodeMirror-linenumbers")if(t)r=!0;else continue;n.push({className:u,style:h})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function Zs(e){var t=e.gutters,n=e.gutterSpecs;j(t),e.lineGutter=null;for(var r=0;r<n.length;++r){var i=n[r],u=i.className,h=i.style,g=t.appendChild(E("div",null,"CodeMirror-gutter "+u));h&&(g.style.cssText=h),u=="CodeMirror-linenumbers"&&(e.lineGutter=g,g.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",Ia(e)}function Kn(e){Zs(e.display),bt(e),Ks(e)}function Jd(e,t,n,r){var i=this;this.input=n,i.scrollbarFiller=E("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=E("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=H("div",null,"CodeMirror-code"),i.selectionDiv=E("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=E("div",null,"CodeMirror-cursors"),i.measure=E("div",null,"CodeMirror-measure"),i.lineMeasure=E("div",null,"CodeMirror-measure"),i.lineSpace=H("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var u=H("div",[i.lineSpace],"CodeMirror-lines");i.mover=E("div",[u],null,"position: relative"),i.sizer=E("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=E("div",null,null,"position: absolute; height: "+He+"px; width: 1px;"),i.gutters=E("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=E("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=E("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),x&&C===105&&(i.wrapper.style.clipPath="inset(0px)"),i.wrapper.setAttribute("translate","no"),c&&d<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),!m&&!(s&&N)&&(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,i.gutterSpecs=za(r.gutters,r.lineNumbers),Zs(i),n.init(i)}var Ui=0,or=null;c?or=-.53:s?or=15:x?or=-.7:A&&(or=-1/3);function Qs(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return t==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),n==null&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:n==null&&(n=e.wheelDelta),{x:t,y:n}}function $d(e){var t=Qs(e);return t.x*=or,t.y*=or,t}function Js(e,t){x&&C==102&&(e.display.chromeScrollHack==null?e.display.sizer.style.pointerEvents="none":clearTimeout(e.display.chromeScrollHack),e.display.chromeScrollHack=setTimeout(function(){e.display.chromeScrollHack=null,e.display.sizer.style.pointerEvents=""},100));var n=Qs(t),r=n.x,i=n.y,u=or;t.deltaMode===0&&(r=t.deltaX,i=t.deltaY,u=1);var h=e.display,g=h.scroller,v=g.scrollWidth>g.clientWidth,b=g.scrollHeight>g.clientHeight;if(r&&v||i&&b){if(i&&I&&m){e:for(var w=t.target,k=h.view;w!=g;w=w.parentNode)for(var B=0;B<k.length;B++)if(k[B].node==w){e.display.currentWheelTarget=w;break e}}if(r&&!s&&!S&&u!=null){i&&b&&Un(e,Math.max(0,g.scrollTop+i*u)),Pr(e,Math.max(0,g.scrollLeft+r*u)),(!i||i&&b)&&mt(t),h.wheelStartX=null;return}if(i&&u!=null){var M=i*u,z=e.doc.scrollTop,R=z+h.wrapper.clientHeight;M<0?z=Math.max(0,z+M-50):R=Math.min(e.doc.height,R+M+50),Oa(e,{top:z,bottom:R})}Ui<20&&t.deltaMode!==0&&(h.wheelStartX==null?(h.wheelStartX=g.scrollLeft,h.wheelStartY=g.scrollTop,h.wheelDX=r,h.wheelDY=i,setTimeout(function(){if(h.wheelStartX!=null){var Y=g.scrollLeft-h.wheelStartX,Q=g.scrollTop-h.wheelStartY,V=Q&&h.wheelDY&&Q/h.wheelDY||Y&&h.wheelDX&&Y/h.wheelDX;h.wheelStartX=h.wheelStartY=null,V&&(or=(or*Ui+V)/(Ui+1),++Ui)}},200)):(h.wheelDX+=r,h.wheelDY+=i))}}var Mt=function(e,t){this.ranges=e,this.primIndex=t};Mt.prototype.primary=function(){return this.ranges[this.primIndex]},Mt.prototype.equals=function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t];if(!sa(n.anchor,r.anchor)||!sa(n.head,r.head))return!1}return!0},Mt.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Ee(ua(this.ranges[t].anchor),ua(this.ranges[t].head));return new Mt(e,this.primIndex)},Mt.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},Mt.prototype.contains=function(e,t){t||(t=e);for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n];if(pe(t,r.from())>=0&&pe(e,r.to())<=0)return n}return-1};var Ee=function(e,t){this.anchor=e,this.head=t};Ee.prototype.from=function(){return Ei(this.anchor,this.head)},Ee.prototype.to=function(){return Si(this.anchor,this.head)},Ee.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};function qt(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort(function(B,M){return pe(B.from(),M.from())}),n=Ne(t,i);for(var u=1;u<t.length;u++){var h=t[u],g=t[u-1],v=pe(g.to(),h.from());if(r&&!h.empty()?v>0:v>=0){var b=Ei(g.from(),h.from()),w=Si(g.to(),h.to()),k=g.empty()?h.from()==h.head:g.from()==g.head;u<=n&&--n,t.splice(--u,2,new Ee(k?w:b,k?b:w))}}return new Mt(t,n)}function yr(e,t){return new Mt([new Ee(e,t||e)],0)}function xr(e){return e.text?X(e.from.line+e.text.length-1,Ce(e.text).length+(e.text.length==1?e.from.ch:0)):e.to}function $s(e,t){if(pe(e,t.from)<0)return e;if(pe(e,t.to)<=0)return xr(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xr(t).ch-t.to.ch),X(n,r)}function Ha(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Ee($s(i.anchor,t),$s(i.head,t)))}return qt(e.cm,n,e.sel.primIndex)}function Vs(e,t,n){return e.line==t.line?X(n.line,e.ch-t.ch+n.ch):X(n.line+(e.line-t.line),e.ch)}function Vd(e,t,n){for(var r=[],i=X(e.first,0),u=i,h=0;h<t.length;h++){var g=t[h],v=Vs(g.from,i,u),b=Vs(xr(g),i,u);if(i=g.to,u=b,n=="around"){var w=e.sel.ranges[h],k=pe(w.head,w.anchor)<0;r[h]=new Ee(k?b:v,k?v:b)}else r[h]=new Ee(v,v)}return new Mt(r,e.sel.primIndex)}function Ra(e){e.doc.mode=ia(e.options,e.doc.modeOption),Yn(e)}function Yn(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,Xn(e,100),e.state.modeGen++,e.curOp&&bt(e)}function eu(e,t){return t.from.ch==0&&t.to.ch==0&&Ce(t.text)==""&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Wa(e,t,n,r){function i(V){return n?n[V]:null}function u(V,J,ne){ld(V,J,ne,r),et(V,"change",V,t)}function h(V,J){for(var ne=[],se=V;se<J;++se)ne.push(new Vr(b[se],i(se),r));return ne}var g=t.from,v=t.to,b=t.text,w=oe(e,g.line),k=oe(e,v.line),B=Ce(b),M=i(b.length-1),z=v.line-g.line;if(t.full)e.insert(0,h(0,b.length)),e.remove(b.length,e.size-b.length);else if(eu(e,t)){var R=h(0,b.length-1);u(k,k.text,M),z&&e.remove(g.line,z),R.length&&e.insert(g.line,R)}else if(w==k)if(b.length==1)u(w,w.text.slice(0,g.ch)+B+w.text.slice(v.ch),M);else{var Y=h(1,b.length-1);Y.push(new Vr(B+w.text.slice(v.ch),M,r)),u(w,w.text.slice(0,g.ch)+b[0],i(0)),e.insert(g.line+1,Y)}else if(b.length==1)u(w,w.text.slice(0,g.ch)+b[0]+k.text.slice(v.ch),i(0)),e.remove(g.line+1,z);else{u(w,w.text.slice(0,g.ch)+b[0],i(0)),u(k,B+k.text.slice(v.ch),M);var Q=h(1,b.length-1);z>1&&e.remove(g.line+1,z-1),e.insert(g.line+1,Q)}et(e,"change",e,t)}function Dr(e,t,n){function r(i,u,h){if(i.linked)for(var g=0;g<i.linked.length;++g){var v=i.linked[g];if(v.doc!=u){var b=h&&v.sharedHist;n&&!b||(t(v.doc,b),r(v.doc,i,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,Aa(e),Ra(e),ru(e),e.options.direction=t.direction,e.options.lineWrapping||va(e),e.options.mode=t.modeOption,bt(e)}function ru(e){(e.doc.direction=="rtl"?De:le)(e.display.lineDiv,"CodeMirror-rtl")}function eh(e){kt(e,function(){ru(e),bt(e)})}function ji(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 qa(e,t){var n={from:ua(t.from),to:xr(t),text:Mr(e,t.from,t.to)};return ou(e,n,t.from.line,t.to.line+1),Dr(e,function(r){return ou(r,n,t.from.line,t.to.line+1)},!0),n}function nu(e){for(;e.length;){var t=Ce(e);if(t.ranges)e.pop();else break}}function th(e,t){if(t)return nu(e.done),Ce(e.done);if(e.done.length&&!Ce(e.done).ranges)return Ce(e.done);if(e.done.length>1&&!e.done[e.done.length-2].ranges)return e.done.pop(),Ce(e.done)}function iu(e,t,n,r){var i=e.history;i.undone.length=0;var u=+new Date,h,g;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&(t.origin.charAt(0)=="+"&&i.lastModTime>u-(e.cm?e.cm.options.historyEventDelay:500)||t.origin.charAt(0)=="*"))&&(h=th(i,i.lastOp==r)))g=Ce(h.changes),pe(t.from,t.to)==0&&pe(t.from,g.to)==0?g.to=xr(t):h.changes.push(qa(e,t));else{var v=Ce(i.done);for((!v||!v.ranges)&&Gi(e.sel,i.done),h={changes:[qa(e,t)],generation:i.generation},i.done.push(h);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=u,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,g||je(e,"historyAdded")}function rh(e,t,n,r){var i=t.charAt(0);return i=="*"||i=="+"&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function nh(e,t,n,r){var i=e.history,u=r&&r.origin;n==i.lastSelOp||u&&i.lastSelOrigin==u&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==u||rh(e,u,Ce(i.done),t))?i.done[i.done.length-1]=t:Gi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=u,i.lastSelOp=n,r&&r.clearRedo!==!1&&nu(i.undone)}function Gi(e,t){var n=Ce(t);n&&n.ranges&&n.equals(e)||t.push(e)}function ou(e,t,n,r){var i=t["spans_"+e.id],u=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(h){h.markedSpans&&((i||(i=t["spans_"+e.id]={}))[u]=h.markedSpans),++u})}function ih(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function oh(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(ih(n[i]));return r}function au(e,t){var n=oh(e,t),r=da(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var u=n[i],h=r[i];if(u&&h)e:for(var g=0;g<h.length;++g){for(var v=h[g],b=0;b<u.length;++b)if(u[b].marker==v.marker)continue e;u.push(v)}else h&&(n[i]=h)}return n}function sn(e,t,n){for(var r=[],i=0;i<e.length;++i){var u=e[i];if(u.ranges){r.push(n?Mt.prototype.deepCopy.call(u):u);continue}var h=u.changes,g=[];r.push({changes:g});for(var v=0;v<h.length;++v){var b=h[v],w=void 0;if(g.push({from:b.from,to:b.to,text:b.text}),t)for(var k in b)(w=k.match(/^spans_(\d+)$/))&&Ne(t,Number(w[1]))>-1&&(Ce(g)[k]=b[k],delete b[k])}}return r}function Ua(e,t,n,r){if(r){var i=e.anchor;if(n){var u=pe(t,i)<0;u!=pe(n,i)<0?(i=t,t=n):u!=pe(t,n)<0&&(t=n)}return new Ee(i,t)}else return new Ee(n||t,t)}function Xi(e,t,n,r,i){i==null&&(i=e.cm&&(e.cm.display.shift||e.extend)),lt(e,new Mt([Ua(e.sel.primary(),t,n,i)],0),r)}function lu(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),u=0;u<e.sel.ranges.length;u++)r[u]=Ua(e.sel.ranges[u],t[u],null,i);var h=qt(e.cm,r,e.sel.primIndex);lt(e,h,n)}function ja(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,lt(e,qt(e.cm,i,e.sel.primIndex),r)}function su(e,t,n,r){lt(e,yr(t,n),r)}function ah(e,t,n){var r={ranges:t.ranges,update:function(i){this.ranges=[];for(var u=0;u<i.length;u++)this.ranges[u]=new Ee(ge(e,i[u].anchor),ge(e,i[u].head))},origin:n&&n.origin};return je(e,"beforeSelectionChange",e,r),e.cm&&je(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?qt(e.cm,r.ranges,r.ranges.length-1):t}function uu(e,t,n){var r=e.history.done,i=Ce(r);i&&i.ranges?(r[r.length-1]=t,Ki(e,t,n)):lt(e,t,n)}function lt(e,t,n){Ki(e,t,n),nh(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Ki(e,t,n){(It(e,"beforeSelectionChange")||e.cm&&It(e.cm,"beforeSelectionChange"))&&(t=ah(e,t,n));var r=n&&n.bias||(pe(t.primary().head,e.sel.primary().head)<0?-1:1);fu(e,du(e,t,r,!0)),!(n&&n.scroll===!1)&&e.cm&&e.cm.getOption("readOnly")!="nocursor"&&an(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,n,r){for(var i,u=0;u<t.ranges.length;u++){var h=t.ranges[u],g=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[u],v=Yi(e,h.anchor,g&&g.anchor,n,r),b=h.head==h.anchor?v:Yi(e,h.head,g&&g.head,n,r);(i||v!=h.anchor||b!=h.head)&&(i||(i=t.ranges.slice(0,u)),i[u]=new Ee(v,b))}return i?qt(e.cm,i,t.primIndex):t}function un(e,t,n,r,i){var u=oe(e,t.line);if(u.markedSpans)for(var h=0;h<u.markedSpans.length;++h){var g=u.markedSpans[h],v=g.marker,b="selectLeft"in v?!v.selectLeft:v.inclusiveLeft,w="selectRight"in v?!v.selectRight:v.inclusiveRight;if((g.from==null||(b?g.from<=t.ch:g.from<t.ch))&&(g.to==null||(w?g.to>=t.ch:g.to>t.ch))){if(i&&(je(v,"beforeCursorEnter"),v.explicitlyCleared))if(u.markedSpans){--h;continue}else break;if(!v.atomic)continue;if(n){var k=v.find(r<0?1:-1),B=void 0;if((r<0?w:b)&&(k=hu(e,k,-r,k&&k.line==t.line?u:null)),k&&k.line==t.line&&(B=pe(k,n))&&(r<0?B<0:B>0))return un(e,k,t,r,i)}var M=v.find(r<0?-1:1);return(r<0?b:w)&&(M=hu(e,M,r,M.line==t.line?u:null)),M?un(e,M,t,r,i):null}}return t}function Yi(e,t,n,r,i){var u=r||1,h=un(e,t,n,u,i)||!i&&un(e,t,n,u,!0)||un(e,t,n,-u,i)||!i&&un(e,t,n,-u,!0);return h||(e.cantEdit=!0,X(e.first,0))}function hu(e,t,n,r){return n<0&&t.ch==0?t.line>e.first?ge(e,X(t.line-1)):null:n>0&&t.ch==(r||oe(e,t.line)).text.length?t.line<e.first+e.size-1?X(t.line+1,0):null:new X(t.line,t.ch+n)}function pu(e){e.setSelection(X(e.firstLine(),0),X(e.lastLine()),vt)}function gu(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(i,u,h,g){i&&(r.from=ge(e,i)),u&&(r.to=ge(e,u)),h&&(r.text=h),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 fn(e,t,n){if(e.cm){if(!e.cm.curOp)return tt(e.cm,fn)(e,t,n);if(e.cm.state.suppressEdits)return}if(!((It(e,"beforeChange")||e.cm&&It(e.cm,"beforeChange"))&&(t=gu(e,t,!0),!t))){var r=as&&!n&&nd(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)vu(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else vu(e,t)}}function vu(e,t){if(!(t.text.length==1&&t.text[0]==""&&pe(t.from,t.to)==0)){var n=Ha(e,t);iu(e,t,n,e.cm?e.cm.curOp.id:NaN),Zn(e,t,n,da(e,t));var r=[];Dr(e,function(i,u){!u&&Ne(r,i.history)==-1&&(xu(i.history,t),r.push(i.history)),Zn(i,t,null,da(i,t))})}}function Zi(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!(r&&!n)){for(var i=e.history,u,h=e.sel,g=t=="undo"?i.done:i.undone,v=t=="undo"?i.undone:i.done,b=0;b<g.length&&(u=g[b],!(n?u.ranges&&!u.equals(e.sel):!u.ranges));b++);if(b!=g.length){for(i.lastOrigin=i.lastSelOrigin=null;;)if(u=g.pop(),u.ranges){if(Gi(u,v),n&&!u.equals(e.sel)){lt(e,u,{clearRedo:!1});return}h=u}else if(r){g.push(u);return}else break;var w=[];Gi(h,v),v.push({changes:w,generation:i.generation}),i.generation=u.generation||++i.maxGeneration;for(var k=It(e,"beforeChange")||e.cm&&It(e.cm,"beforeChange"),B=function(R){var Y=u.changes[R];if(Y.origin=t,k&&!gu(e,Y,!1))return g.length=0,{};w.push(qa(e,Y));var Q=R?Ha(e,Y):Ce(g);Zn(e,Y,Q,au(e,Y)),!R&&e.cm&&e.cm.scrollIntoView({from:Y.from,to:xr(Y)});var V=[];Dr(e,function(J,ne){!ne&&Ne(V,J.history)==-1&&(xu(J.history,Y),V.push(J.history)),Zn(J,Y,null,au(J,Y))})},M=u.changes.length-1;M>=0;--M){var z=B(M);if(z)return z.v}}}}function mu(e,t){if(t!=0&&(e.first+=t,e.sel=new Mt(Ht(e.sel.ranges,function(i){return new Ee(X(i.anchor.line+t,i.anchor.ch),X(i.head.line+t,i.head.ch))}),e.sel.primIndex),e.cm)){bt(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)mr(e.cm,r,"gutter")}}function Zn(e,t,n,r){if(e.cm&&!e.cm.curOp)return tt(e.cm,Zn)(e,t,n,r);if(t.to.line<e.first){mu(e,t.text.length-1-(t.to.line-t.from.line));return}if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);mu(e,i),t={from:X(e.first,0),to:X(t.to.line+i,t.to.ch),text:[Ce(t.text)],origin:t.origin}}var u=e.lastLine();t.to.line>u&&(t={from:t.from,to:X(u,oe(e,u).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Mr(e,t.from,t.to),n||(n=Ha(e,t)),e.cm?lh(e.cm,t,r):Wa(e,t,r),Ki(e,n,vt),e.cantEdit&&Yi(e,X(e.firstLine(),0))&&(e.cantEdit=!1)}}function lh(e,t,n){var r=e.doc,i=e.display,u=t.from,h=t.to,g=!1,v=u.line;e.options.lineWrapping||(v=Ae(Rt(oe(r,u.line))),r.iter(v,h.line+1,function(M){if(M==i.maxLine)return g=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Kl(e),Wa(r,t,n,Is(e)),e.options.lineWrapping||(r.iter(v,u.line+t.text.length,function(M){var z=_i(M);z>i.maxLineLength&&(i.maxLine=M,i.maxLineLength=z,i.maxLineChanged=!0,g=!1)}),g&&(e.curOp.updateMaxLine=!0)),Qc(r,u.line),Xn(e,400);var b=t.text.length-(h.line-u.line)-1;t.full?bt(e):u.line==h.line&&t.text.length==1&&!eu(e.doc,t)?mr(e,u.line,"text"):bt(e,u.line,h.line+1,b);var w=It(e,"changes"),k=It(e,"change");if(k||w){var B={from:u,to:h,text:t.text,removed:t.removed,origin:t.origin};k&&et(e,"change",e,B),w&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(B)}e.display.selForContextMenu=null}function cn(e,t,n,r,i){var u;r||(r=n),pe(r,n)<0&&(u=[r,n],n=u[0],r=u[1]),typeof t=="string"&&(t=e.splitLines(t)),fn(e,{from:n,to:r,text:t,origin:i})}function bu(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function yu(e,t,n,r){for(var i=0;i<e.length;++i){var u=e[i],h=!0;if(u.ranges){u.copied||(u=e[i]=u.deepCopy(),u.copied=!0);for(var g=0;g<u.ranges.length;g++)bu(u.ranges[g].anchor,t,n,r),bu(u.ranges[g].head,t,n,r);continue}for(var v=0;v<u.changes.length;++v){var b=u.changes[v];if(n<b.from.line)b.from=X(b.from.line+r,b.from.ch),b.to=X(b.to.line+r,b.to.ch);else if(t<=b.to.line){h=!1;break}}h||(e.splice(0,i+1),i=0)}}function xu(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;yu(e.done,n,r,i),yu(e.undone,n,r,i)}function Qn(e,t,n,r){var i=t,u=t;return typeof t=="number"?u=oe(e,Jl(e,t)):i=Ae(t),i==null?null:(r(u,i)&&e.cm&&mr(e.cm,i,n),u)}function Jn(e){this.lines=e,this.parent=null;for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height;this.height=t}Jn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n];this.height-=i.height,sd(i),et(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}};function $n(e){this.children=e;for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r];t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}$n.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;n<this.children.length;++n){var r=this.children[n],i=r.chunkSize();if(e<i){var u=Math.min(t,i-e),h=r.height;if(r.removeInner(e,u),this.height-=h-r.height,i==u&&(this.children.splice(n--,1),r.parent=null),(t-=u)==0)break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Jn))){var g=[];this.collapse(g),this.children=[new Jn(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,n){this.size+=t.length,this.height+=n;for(var r=0;r<this.children.length;++r){var i=this.children[r],u=i.chunkSize();if(e<=u){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(var h=i.lines.length%25+25,g=h;g<i.lines.length;){var v=new Jn(i.lines.slice(g,g+=25));i.height-=v.height,this.children.splice(++r,0,v),v.parent=this}i.lines=i.lines.slice(0,h),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),n=new $n(t);if(e.parent){e.size-=n.size,e.height-=n.height;var i=Ne(e.parent.children,e);e.parent.children.splice(i+1,0,n)}else{var r=new $n(e.children);r.parent=e,e.children=[r,n],e=r}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],u=i.chunkSize();if(e<u){var h=Math.min(t,u-e);if(i.iterN(e,h,n))return!0;if((t-=h)==0)break;e=0}else e-=u}}};var Vn=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r]);this.doc=e,this.node=t};Vn.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Ae(n);if(!(r==null||!t)){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(n.widgets=null);var u=Hn(this);Yt(n,Math.max(0,n.height-u)),e&&(kt(e,function(){Du(e,n,-u),mr(e,r,"widget")}),et(e,"lineWidgetCleared",e,this,r))}},Vn.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=Hn(this)-t;i&&(vr(this.doc,r)||Yt(r,r.height+i),n&&kt(n,function(){n.curOp.forceUpdate=!0,Du(n,r,i),et(n,"lineWidgetChanged",n,e,Ae(r))}))},Qr(Vn);function Du(e,t,n){nr(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Ba(e,n)}function sh(e,t,n,r){var i=new Vn(e,n,r),u=e.cm;return u&&i.noHScroll&&(u.display.alignWidgets=!0),Qn(e,t,"widget",function(h){var g=h.widgets||(h.widgets=[]);if(i.insertAt==null?g.push(i):g.splice(Math.min(g.length,Math.max(0,i.insertAt)),0,i),i.line=h,u&&!vr(e,h)){var v=nr(h)<e.scrollTop;Yt(h,h.height+Hn(i)),v&&Ba(u,i.height),u.curOp.forceUpdate=!0}return!0}),u&&et(u,"lineWidgetAdded",u,i,typeof t=="number"?t:Ae(t)),i}var wu=0,wr=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++wu};wr.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Hr(e),It(this,"clear")){var n=this.find();n&&et(this,"clear",n.from,n.to)}for(var r=null,i=null,u=0;u<this.lines.length;++u){var h=this.lines[u],g=In(h.markedSpans,this);e&&!this.collapsed?mr(e,Ae(h),"text"):e&&(g.to!=null&&(i=Ae(h)),g.from!=null&&(r=Ae(h))),h.markedSpans=Vc(h.markedSpans,g),g.from==null&&this.collapsed&&!vr(this.doc,h)&&e&&Yt(h,rn(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var v=0;v<this.lines.length;++v){var b=Rt(this.lines[v]),w=_i(b);w>e.display.maxLineLength&&(e.display.maxLine=b,e.display.maxLineLength=w,e.display.maxLineChanged=!0)}r!=null&&e&&this.collapsed&&bt(e,r,i+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,i),t&&Rr(e),this.parent&&this.parent.clear()}},wr.prototype.find=function(e,t){e==null&&this.type=="bookmark"&&(e=1);for(var n,r,i=0;i<this.lines.length;++i){var u=this.lines[i],h=In(u.markedSpans,this);if(h.from!=null&&(n=X(t?u:Ae(u),h.from),e==-1))return n;if(h.to!=null&&(r=X(t?u:Ae(u),h.to),e==1))return r}return n&&{from:n,to:r}},wr.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;!t||!r||kt(r,function(){var i=t.line,u=Ae(t.line),h=xa(r,u);if(h&&(Fs(h),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!vr(n.doc,i)&&n.height!=null){var g=n.height;n.height=null;var v=Hn(n)-g;v&&Yt(i,i.height+v)}et(r,"markerChanged",r,e)})},wr.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(!t.maybeHiddenMarkers||Ne(t.maybeHiddenMarkers,this)==-1)&&(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},wr.prototype.detachLine=function(e){if(this.lines.splice(Ne(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},Qr(wr);function dn(e,t,n,r,i){if(r&&r.shared)return uh(e,t,n,r,i);if(e.cm&&!e.cm.curOp)return tt(e.cm,dn)(e,t,n,r,i);var u=new wr(e,i),h=pe(t,n);if(r&&Tt(r,u,!1),h>0||h==0&&u.clearWhenEmpty!==!1)return u;if(u.replacedWith&&(u.collapsed=!0,u.widgetNode=H("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,n,u)||t.line!=n.line&&ds(e,n.line,t,n,u))throw new Error("Inserting collapsed marker partially overlapping an existing one");$c()}u.addToHistory&&iu(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var g=t.line,v=e.cm,b;if(e.iter(g,n.line+1,function(k){v&&u.collapsed&&!v.options.lineWrapping&&Rt(k)==v.display.maxLine&&(b=!0),u.collapsed&&g!=t.line&&Yt(k,0),ed(k,new Fi(u,g==t.line?t.ch:null,g==n.line?n.ch:null),e.cm&&e.cm.curOp),++g}),u.collapsed&&e.iter(t.line,n.line+1,function(k){vr(e,k)&&Yt(k,0)}),u.clearOnEnter&&ue(u,"beforeCursorEnter",function(){return u.clear()}),u.readOnly&&(Jc(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),u.collapsed&&(u.id=++wu,u.atomic=!0),v){if(b&&(v.curOp.updateMaxLine=!0),u.collapsed)bt(v,t.line,n.line+1);else if(u.className||u.startStyle||u.endStyle||u.css||u.attributes||u.title)for(var w=t.line;w<=n.line;w++)mr(v,w,"text");u.atomic&&cu(v.doc),et(v,"markerAdded",v,u)}return u}var ei=function(e,t){this.markers=e,this.primary=t;for(var n=0;n<e.length;++n)e[n].parent=this};ei.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")}},ei.prototype.find=function(e,t){return this.primary.find(e,t)},Qr(ei);function uh(e,t,n,r,i){r=Tt(r),r.shared=!1;var u=[dn(e,t,n,r,i)],h=u[0],g=r.widgetNode;return Dr(e,function(v){g&&(r.widgetNode=g.cloneNode(!0)),u.push(dn(v,ge(v,t),ge(v,n),r,i));for(var b=0;b<v.linked.length;++b)if(v.linked[b].isParent)return;h=Ce(u)}),new ei(u,h)}function Cu(e){return e.findMarks(X(e.first,0),e.clipPos(X(e.lastLine())),function(t){return t.parent})}function fh(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),u=e.clipPos(i.from),h=e.clipPos(i.to);if(pe(u,h)){var g=dn(e,u,h,r.primary,r.primary.type);r.markers.push(g),g.parent=r}}}function ch(e){for(var t=function(r){var i=e[r],u=[i.primary.doc];Dr(i.primary.doc,function(v){return u.push(v)});for(var h=0;h<i.markers.length;h++){var g=i.markers[h];Ne(u,g.doc)==-1&&(g.parent=null,i.markers.splice(h--,1))}},n=0;n<e.length;n++)t(n)}var dh=0,yt=function(e,t,n,r,i){if(!(this instanceof yt))return new yt(e,t,n,r,i);n==null&&(n=0),$n.call(this,[new Jn([new Vr("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var u=X(n,0);this.sel=yr(u),this.history=new ji(null),this.id=++dh,this.modeOption=t,this.lineSep=r,this.direction=i=="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)};yt.prototype=Ul($n.prototype,{constructor:yt,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=aa(this,this.first,this.first+this.size);return e===!1?t:t.join(e||this.lineSeparator())},setValue:rt(function(e){var t=X(this.first,0),n=this.first+this.size-1;fn(this,{from:t,to:X(n,oe(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&qn(this.cm,0,0),lt(this,yr(t),vt)}),replaceRange:function(e,t,n,r){t=ge(this,t),n=n?ge(this,n):t,cn(this,e,t,n,r)},getRange:function(e,t,n){var r=Mr(this,ge(this,e),ge(this,t));return n===!1?r:n===""?r.join(""):r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(Nn(this,e))return oe(this,e)},getLineNumber:function(e){return Ae(e)},getLineHandleVisualStart:function(e){return typeof e=="number"&&(e=oe(this,e)),Rt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ge(this,e)},getCursor:function(e){var t=this.sel.primary(),n;return e==null||e=="head"?n=t.head:e=="anchor"?n=t.anchor:e=="end"||e=="to"||e===!1?n=t.to():n=t.from(),n},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:rt(function(e,t,n){su(this,ge(this,typeof e=="number"?X(e,t||0):e),null,n)}),setSelection:rt(function(e,t,n){su(this,ge(this,e),ge(this,t||e),n)}),extendSelection:rt(function(e,t,n){Xi(this,ge(this,e),t&&ge(this,t),n)}),extendSelections:rt(function(e,t){lu(this,$l(this,e),t)}),extendSelectionsBy:rt(function(e,t){var n=Ht(this.sel.ranges,e);lu(this,$l(this,n),t)}),setSelections:rt(function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new Ee(ge(this,e[i].anchor),ge(this,e[i].head||e[i].anchor));t==null&&(t=Math.min(e.length-1,this.sel.primIndex)),lt(this,qt(this.cm,r,t),n)}}),addSelection:rt(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Ee(ge(this,e),ge(this,t||e))),lt(this,qt(this.cm,r,r.length-1),n)}),getSelection:function(e){for(var t=this.sel.ranges,n,r=0;r<t.length;r++){var i=Mr(this,t[r].from(),t[r].to());n=n?n.concat(i):i}return e===!1?n:n.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Mr(this,n[r].from(),n[r].to());e!==!1&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:rt(function(e,t,n){for(var r=[],i=this.sel,u=0;u<i.ranges.length;u++){var h=i.ranges[u];r[u]={from:h.from(),to:h.to(),text:this.splitLines(e[u]),origin:n}}for(var g=t&&t!="end"&&Vd(this,r,t),v=r.length-1;v>=0;v--)fn(this,r[v]);g?uu(this,g):this.cm&&an(this.cm)}),undo:rt(function(){Zi(this,"undo")}),redo:rt(function(){Zi(this,"redo")}),undoSelection:rt(function(){Zi(this,"undo",!0)}),redoSelection:rt(function(){Zi(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){var e=this;this.history=new ji(this.history),Dr(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:sn(this.history.done),undone:sn(this.history.undone)}},setHistory:function(e){var t=this.history=new ji(this.history);t.done=sn(e.done.slice(0),null,!0),t.undone=sn(e.undone.slice(0),null,!0)},setGutterMarker:rt(function(e,t,n){return Qn(this,e,"gutter",function(r){var i=r.gutterMarkers||(r.gutterMarkers={});return i[t]=n,!n&&jl(i)&&(r.gutterMarkers=null),!0})}),clearGutter:rt(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Qn(t,n,"gutter",function(){return n.gutterMarkers[e]=null,jl(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if(typeof e=="number"){if(!Nn(this,e)||(t=e,e=oe(this,e),!e))return null}else if(t=Ae(e),t==null)return null;return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:rt(function(e,t,n){return Qn(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass";if(!r[i])r[i]=n;else{if(U(n).test(r[i]))return!1;r[i]+=" "+n}return!0})}),removeLineClass:rt(function(e,t,n){return Qn(this,e,t=="gutter"?"gutter":"class",function(r){var i=t=="text"?"textClass":t=="background"?"bgClass":t=="gutter"?"gutterClass":"wrapClass",u=r[i];if(u)if(n==null)r[i]=null;else{var h=u.match(U(n));if(!h)return!1;var g=h.index+h[0].length;r[i]=u.slice(0,h.index)+(!h.index||g==u.length?"":" ")+u.slice(g)||null}else return!1;return!0})}),addLineWidget:rt(function(e,t,n){return sh(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return dn(this,ge(this,e),ge(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(t.nodeType==null?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ge(this,e),dn(this,e,e,n,"bookmark")},findMarksAt:function(e){e=ge(this,e);var t=[],n=oe(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(i.from==null||i.from<=e.ch)&&(i.to==null||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ge(this,e),t=ge(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(u){var h=u.markedSpans;if(h)for(var g=0;g<h.length;g++){var v=h[g];!(v.to!=null&&i==e.line&&e.ch>=v.to||v.from==null&&i!=e.line||v.from!=null&&i==t.line&&v.from>=t.ch)&&(!n||n(v.marker))&&r.push(v.marker.parent||v.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)n[r].from!=null&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var u=i.text.length+r;if(u>e)return t=e,!0;e-=u,++n}),ge(this,X(n,t))},indexFromPos:function(e){e=ge(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(r){t+=r.text.length+n}),t},copy:function(e){var t=new yt(aa(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;e.from!=null&&e.from>t&&(t=e.from),e.to!=null&&e.to<n&&(n=e.to);var r=new yt(aa(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],fh(r,Cu(this)),r},unlinkDoc:function(e){if(e instanceof Oe&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var n=this.linked[t];if(n.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),ch(Cu(this));break}}if(e.history==this.history){var r=[e.id];Dr(e,function(i){return r.push(i.id)},!0),e.history=new ji(null),e.history.done=sn(this.history.done,r),e.history.undone=sn(this.history.undone,r)}},iterLinkedDocs:function(e){Dr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):ta(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&&eh(this.cm))})}),yt.prototype.eachLine=yt.prototype.iter;var ku=0;function hh(e){var t=this;if(Su(t),!(Ve(t,e)||ir(t.display,e))){mt(e),c&&(ku=+new Date);var n=Or(t,e,!0),r=e.dataTransfer.files;if(!(!n||t.isReadOnly()))if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,u=Array(i),h=0,g=function(){++h==i&&tt(t,function(){n=ge(t.doc,n);var M={from:n,to:n,text:t.doc.splitLines(u.filter(function(z){return z!=null}).join(t.doc.lineSeparator())),origin:"paste"};fn(t.doc,M),uu(t.doc,yr(ge(t.doc,n),ge(t.doc,xr(M))))})()},v=function(M,z){if(t.options.allowDropFileTypes&&Ne(t.options.allowDropFileTypes,M.type)==-1){g();return}var R=new FileReader;R.onerror=function(){return g()},R.onload=function(){var Y=R.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(Y)){g();return}u[z]=Y,g()},R.readAsText(M)},b=0;b<r.length;b++)v(r[b],b);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1){t.state.draggingText(e),setTimeout(function(){return t.display.input.focus()},20);return}try{var w=e.dataTransfer.getData("Text");if(w){var k;if(t.state.draggingText&&!t.state.draggingText.copy&&(k=t.listSelections()),Ki(t.doc,yr(n,n)),k)for(var B=0;B<k.length;++B)cn(t.doc,"",k[B].anchor,k[B].head,"drag");t.replaceSelection(w,"around","paste"),t.display.input.focus()}}catch{}}}}function ph(e,t){if(c&&(!e.state.draggingText||+new Date-ku<100)){Bn(t);return}if(!(Ve(e,t)||ir(e.display,t))&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!A)){var n=E("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",S&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),S&&n.parentNode.removeChild(n)}}function gh(e,t){var n=Or(e,t);if(n){var r=document.createDocumentFragment();Fa(e,n,r),e.display.dragCursor||(e.display.dragCursor=E("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),ee(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"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror;i&&n.push(i)}n.length&&n[0].operation(function(){for(var u=0;u<n.length;u++)e(n[u])})}}var Au=!1;function vh(){Au||(mh(),Au=!0)}function mh(){var e;ue(window,"resize",function(){e==null&&(e=setTimeout(function(){e=null,Eu(bh)},100))}),ue(window,"blur",function(){return Eu(on)})}function bh(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Cr={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},ti=0;ti<10;ti++)Cr[ti+48]=Cr[ti+96]=String(ti);for(var Qi=65;Qi<=90;Qi++)Cr[Qi]=String.fromCharCode(Qi);for(var ri=1;ri<=12;ri++)Cr[ri+111]=Cr[ri+63235]="F"+ri;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=I?ar.macDefault:ar.pcDefault;function yh(e){var t=e.split(/-(?!$)/);e=t[t.length-1];for(var n,r,i,u,h=0;h<t.length-1;h++){var g=t[h];if(/^(cmd|meta|m)$/i.test(g))u=!0;else if(/^a(lt)?$/i.test(g))n=!0;else if(/^(c|ctrl|control)$/i.test(g))r=!0;else if(/^s(hift)?$/i.test(g))i=!0;else throw new Error("Unrecognized modifier name: "+g)}return n&&(e="Alt-"+e),r&&(e="Ctrl-"+e),u&&(e="Cmd-"+e),i&&(e="Shift-"+e),e}function xh(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if(r=="..."){delete e[n];continue}for(var i=Ht(n.split(" "),yh),u=0;u<i.length;u++){var h=void 0,g=void 0;u==i.length-1?(g=i.join(" "),h=r):(g=i.slice(0,u+1).join(" "),h="...");var v=t[g];if(!v)t[g]=h;else if(v!=h)throw new Error("Inconsistent bindings for "+g)}delete e[n]}for(var b in t)e[b]=t[b];return e}function hn(e,t,n,r){t=Ji(t);var i=t.call?t.call(e,r):t[e];if(i===!1)return"nothing";if(i==="...")return"multi";if(i!=null&&n(i))return"handled";if(t.fallthrough){if(Object.prototype.toString.call(t.fallthrough)!="[object Array]")return hn(e,t.fallthrough,n,r);for(var u=0;u<t.fallthrough.length;u++){var h=hn(e,t.fallthrough[u],n,r);if(h)return h}}}function Fu(e){var t=typeof e=="string"?e:Cr[e.keyCode];return t=="Ctrl"||t=="Alt"||t=="Shift"||t=="Mod"}function Tu(e,t,n){var r=e;return t.altKey&&r!="Alt"&&(e="Alt-"+e),(K?t.metaKey:t.ctrlKey)&&r!="Ctrl"&&(e="Ctrl-"+e),(K?t.ctrlKey:t.metaKey)&&r!="Mod"&&(e="Cmd-"+e),!n&&t.shiftKey&&r!="Shift"&&(e="Shift-"+e),e}function Lu(e,t){if(S&&e.keyCode==34&&e.char)return!1;var n=Cr[e.keyCode];return n==null||e.altGraphKey?!1:(e.keyCode==3&&e.code&&(n=e.code),Tu(n,e,t))}function Ji(e){return typeof e=="string"?ar[e]:e}function pn(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var u=t(n[i]);r.length&&pe(u.from,Ce(r).to)<=0;){var h=r.pop();if(pe(h.from,u.from)<0){u.from=h.from;break}}r.push(u)}kt(e,function(){for(var g=r.length-1;g>=0;g--)cn(e.doc,"",r[g].from,r[g].to,"+delete");an(e)})}function Ga(e,t,n){var r=Gl(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Xa(e,t,n){var r=Ga(e,t.ch,n);return r==null?null:new X(t.line,r,n<0?"after":"before")}function Ka(e,t,n,r,i){if(e){t.doc.direction=="rtl"&&(i=-i);var u=tr(n,t.doc.direction);if(u){var h=i<0?Ce(u):u[0],g=i<0==(h.level==1),v=g?"after":"before",b;if(h.level>0||t.doc.direction=="rtl"){var w=tn(t,n);b=i<0?n.text.length-1:0;var k=Jt(t,w,b).top;b=Ln(function(B){return Jt(t,w,B).top==k},i<0==(h.level==1)?h.from:h.to-1,b),v=="before"&&(b=Ga(n,b,1))}else b=i<0?h.to:h.from;return new X(r,b,v)}}return new X(r,i<0?n.text.length:0,i<0?"before":"after")}function Dh(e,t,n,r){var i=tr(t,e.doc.direction);if(!i)return Xa(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var u=_n(i,n.ch,n.sticky),h=i[u];if(e.doc.direction=="ltr"&&h.level%2==0&&(r>0?h.to>n.ch:h.from<n.ch))return Xa(t,n,r);var g=function(Q,V){return Ga(t,Q instanceof X?Q.ch:Q,V)},v,b=function(Q){return e.options.lineWrapping?(v=v||tn(e,t),Os(e,t,v,Q)):{begin:0,end:t.text.length}},w=b(n.sticky=="before"?g(n,-1):n.ch);if(e.doc.direction=="rtl"||h.level==1){var k=h.level==1==r<0,B=g(n,k?1:-1);if(B!=null&&(k?B<=h.to&&B<=w.end:B>=h.from&&B>=w.begin)){var M=k?"before":"after";return new X(n.line,B,M)}}var z=function(Q,V,J){for(var ne=function(Te,nt){return nt?new X(n.line,g(Te,1),"before"):new X(n.line,Te,"after")};Q>=0&&Q<i.length;Q+=V){var se=i[Q],ae=V>0==(se.level!=1),xe=ae?J.begin:g(J.end,-1);if(se.from<=xe&&xe<se.to||(xe=ae?se.from:g(se.to,-1),J.begin<=xe&&xe<J.end))return ne(xe,ae)}},R=z(u+r,r,w);if(R)return R;var Y=r>0?w.end:g(w.begin,-1);return Y!=null&&!(r>0&&Y==t.text.length)&&(R=z(r>0?0:i.length-1,r,b(Y)),R)?R:null}var ni={selectAll:pu,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),vt)},killLine:function(e){return pn(e,function(t){if(t.empty()){var n=oe(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:X(t.head.line+1,0)}:{from:t.head,to:X(t.head.line,n)}}else return{from:t.from(),to:t.to()}})},deleteLine:function(e){return pn(e,function(t){return{from:X(t.from().line,0),to:ge(e.doc,X(t.to().line+1,0))}})},delLineLeft:function(e){return pn(e,function(t){return{from:X(t.from().line,0),to:t.from()}})},delWrappedLineLeft:function(e){return pn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return pn(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(X(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(X(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 _u(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return wh(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Xt)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Xt)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?_u(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=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var u=n[i].from(),h=Ye(e.getLine(u.line),u.ch,r);t.push(pr(r-h%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return kt(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)if(t[r].empty()){var i=t[r].head,u=oe(e.doc,i.line).text;if(u){if(i.ch==u.length&&(i=new X(i.line,i.ch-1)),i.ch>0)i=new X(i.line,i.ch+1),e.replaceRange(u.charAt(i.ch-1)+u.charAt(i.ch-2),X(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var h=oe(e.doc,i.line-1).text;h&&(i=new X(i.line,1),e.replaceRange(u.charAt(0)+e.doc.lineSeparator()+h.charAt(h.length-1),X(i.line-1,h.length-1),i,"+transpose"))}}n.push(new Ee(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return kt(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);an(e)})},openLine:function(e){return e.replaceSelection(`
|
|
`,"start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Mu(e,t){var n=oe(e.doc,t),r=Rt(n);return r!=n&&(t=Ae(r)),Ka(!0,e,r,t,1)}function wh(e,t){var n=oe(e.doc,t),r=od(n);return r!=n&&(t=Ae(r)),Ka(!0,e,n,t,-1)}function _u(e,t){var n=Mu(e,t.line),r=oe(e.doc,n.line),i=tr(r,e.doc.direction);if(!i||i[0].level==0){var u=Math.max(n.ch,r.text.search(/\S/)),h=t.line==n.line&&t.ch<=u&&t.ch;return X(n.line,h?0:u,n.sticky)}return n}function $i(e,t,n){if(typeof t=="string"&&(t=ni[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ze}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Ch(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=hn(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&hn(t,e.options.extraKeys,n,e)||hn(t,e.options.keyMap,n,e)}var kh=new ft;function ii(e,t,n,r){var i=e.state.keySeq;if(i){if(Fu(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:kh.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),Bu(e,i+" "+t,n,r))return!0}return Bu(e,t,n,r)}function Bu(e,t,n,r){var i=Ch(e,t,r);return i=="multi"&&(e.state.keySeq=t),i=="handled"&&et(e,"keyHandled",e,t,n),(i=="handled"||i=="multi")&&(mt(n),Ta(e)),!!i}function Nu(e,t){var n=Lu(t,!0);return n?t.shiftKey&&!e.state.keySeq?ii(e,"Shift-"+n,t,function(r){return $i(e,r,!0)})||ii(e,n,t,function(r){if(typeof r=="string"?/^go[A-Z]/.test(r):r.motion)return $i(e,r)}):ii(e,n,t,function(r){return $i(e,r)}):!1}function Sh(e,t,n){return ii(e,"'"+n+"'",t,function(r){return $i(e,r,!0)})}var Ya=null;function Ou(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&(t.curOp.focus=ve(te(t)),!Ve(t,e))){c&&d<11&&e.keyCode==27&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=n==16||e.shiftKey;var r=Nu(t,e);S&&(Ya=r?n:null,!r&&n==88&&!Uc&&(I?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),s&&!I&&!r&&n==46&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),n==18&&!/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)&&Eh(t)}}function Eh(e){var t=e.display.lineDiv;De(t,"CodeMirror-crosshair");function n(r){(r.keyCode==18||!r.altKey)&&(le(t,"CodeMirror-crosshair"),Lt(document,"keyup",n),Lt(document,"mouseover",n))}ue(document,"keyup",n),ue(document,"mouseover",n)}function Iu(e){e.keyCode==16&&(this.doc.sel.shift=!1),Ve(this,e)}function Pu(e){var t=this;if(!(e.target&&e.target!=t.display.input.getField())&&!(ir(t.display,e)||Ve(t,e)||e.ctrlKey&&!e.altKey||I&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(S&&n==Ya){Ya=null,mt(e);return}if(!(S&&(!e.which||e.which<10)&&Nu(t,e))){var i=String.fromCharCode(r??n);i!="\b"&&(Sh(t,e,i)||t.display.input.onKeyPress(e))}}}var Ah=400,Za=function(e,t,n){this.time=e,this.pos=t,this.button=n};Za.prototype.compare=function(e,t,n){return this.time+Ah>e&&pe(t,this.pos)==0&&n==this.button};var oi,ai;function Fh(e,t){var n=+new Date;return ai&&ai.compare(n,e,t)?(oi=ai=null,"triple"):oi&&oi.compare(n,e,t)?(ai=new Za(n,e,t),oi=null,"double"):(oi=new Za(n,e,t),ai=null,"single")}function zu(e){var t=this,n=t.display;if(!(Ve(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.input.ensurePolled(),n.shift=e.shiftKey,ir(n,e)){m||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));return}if(!Qa(t,e)){var r=Or(t,e),i=Zl(e),u=r?Fh(r,i):"single";ye(t).focus(),i==1&&t.state.selectingText&&t.state.selectingText(e),!(r&&Th(t,i,r,u,e))&&(i==1?r?Mh(t,r,u,e):$o(e)==n.scroller&&mt(e):i==2?(r&&Xi(t.doc,r),setTimeout(function(){return n.input.focus()},20)):i==3&&(me?t.display.input.onContextMenu(e):La(t)))}}}function Th(e,t,n,r,i){var u="Click";return r=="double"?u="Double"+u:r=="triple"&&(u="Triple"+u),u=(t==1?"Left":t==2?"Middle":"Right")+u,ii(e,Tu(u,i),i,function(h){if(typeof h=="string"&&(h=ni[h]),!h)return!1;var g=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),g=h(e,n)!=Ze}finally{e.state.suppressEdits=!1}return g})}function Lh(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(i.unit==null){var u=P?n.shiftKey&&n.metaKey:n.altKey;i.unit=u?"rectangle":t=="single"?"char":t=="double"?"word":"line"}return(i.extend==null||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),i.addNew==null&&(i.addNew=I?n.metaKey:n.ctrlKey),i.moveOnDrag==null&&(i.moveOnDrag=!(I?n.altKey:n.ctrlKey)),i}function Mh(e,t,n,r){c?setTimeout(gt(Hs,e),0):e.curOp.focus=ve(te(e));var i=Lh(e,n,r),u=e.doc.sel,h;e.options.dragDrop&&Hc&&!e.isReadOnly()&&n=="single"&&(h=u.contains(t))>-1&&(pe((h=u.ranges[h]).from(),t)<0||t.xRel>0)&&(pe(h.to(),t)>0||t.xRel<0)?_h(e,r,t,i):Bh(e,r,t,i)}function _h(e,t,n,r){var i=e.display,u=!1,h=tt(e,function(b){m&&(i.scroller.draggable=!1),e.state.draggingText=!1,e.state.delayingBlurEvent&&(e.hasFocus()?e.state.delayingBlurEvent=!1:La(e)),Lt(i.wrapper.ownerDocument,"mouseup",h),Lt(i.wrapper.ownerDocument,"mousemove",g),Lt(i.scroller,"dragstart",v),Lt(i.scroller,"drop",h),u||(mt(b),r.addNew||Xi(e.doc,n,null,null,r.extend),m&&!A||c&&d==9?setTimeout(function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()},20):i.input.focus())}),g=function(b){u=u||Math.abs(t.clientX-b.clientX)+Math.abs(t.clientY-b.clientY)>=10},v=function(){return u=!0};m&&(i.scroller.draggable=!0),e.state.draggingText=h,h.copy=!r.moveOnDrag,ue(i.wrapper.ownerDocument,"mouseup",h),ue(i.wrapper.ownerDocument,"mousemove",g),ue(i.scroller,"dragstart",v),ue(i.scroller,"drop",h),e.state.delayingBlurEvent=!0,setTimeout(function(){return i.input.focus()},20),i.scroller.dragDrop&&i.scroller.dragDrop()}function Hu(e,t,n){if(n=="char")return new Ee(t,t);if(n=="word")return e.findWordAt(t);if(n=="line")return new Ee(X(t.line,0),ge(e.doc,X(t.line+1,0)));var r=n(e,t);return new Ee(r.from,r.to)}function Bh(e,t,n,r){c&&La(e);var i=e.display,u=e.doc;mt(t);var h,g,v=u.sel,b=v.ranges;if(r.addNew&&!r.extend?(g=u.sel.contains(n),g>-1?h=b[g]:h=new Ee(n,n)):(h=u.sel.primary(),g=u.sel.primIndex),r.unit=="rectangle")r.addNew||(h=new Ee(n,n)),n=Or(e,t,!0,!0),g=-1;else{var w=Hu(e,n,r.unit);r.extend?h=Ua(h,w.anchor,w.head,r.extend):h=w}r.addNew?g==-1?(g=b.length,lt(u,qt(e,b.concat([h]),g),{scroll:!1,origin:"*mouse"})):b.length>1&&b[g].empty()&&r.unit=="char"&&!r.extend?(lt(u,qt(e,b.slice(0,g).concat(b.slice(g+1)),0),{scroll:!1,origin:"*mouse"}),v=u.sel):ja(u,g,h,Tn):(g=0,lt(u,new Mt([h],0),Tn),v=u.sel);var k=n;function B(J){if(pe(k,J)!=0)if(k=J,r.unit=="rectangle"){for(var ne=[],se=e.options.tabSize,ae=Ye(oe(u,n.line).text,n.ch,se),xe=Ye(oe(u,J.line).text,J.ch,se),Te=Math.min(ae,xe),nt=Math.max(ae,xe),Pe=Math.min(n.line,J.line),St=Math.min(e.lastLine(),Math.max(n.line,J.line));Pe<=St;Pe++){var xt=oe(u,Pe).text,Xe=Kt(xt,Te,se);Te==nt?ne.push(new Ee(X(Pe,Xe),X(Pe,Xe))):xt.length>Xe&&ne.push(new Ee(X(Pe,Xe),X(Pe,Kt(xt,nt,se))))}ne.length||ne.push(new Ee(n,n)),lt(u,qt(e,v.ranges.slice(0,g).concat(ne),g),{origin:"*mouse",scroll:!1}),e.scrollIntoView(J)}else{var Dt=h,ot=Hu(e,J,r.unit),Qe=Dt.anchor,Ke;pe(ot.anchor,Qe)>0?(Ke=ot.head,Qe=Ei(Dt.from(),ot.anchor)):(Ke=ot.anchor,Qe=Si(Dt.to(),ot.head));var Re=v.ranges.slice(0);Re[g]=Nh(e,new Ee(ge(u,Qe),Ke)),lt(u,qt(e,Re,g),Tn)}}var M=i.wrapper.getBoundingClientRect(),z=0;function R(J){var ne=++z,se=Or(e,J,!0,r.unit=="rectangle");if(se)if(pe(se,k)!=0){e.curOp.focus=ve(te(e)),B(se);var ae=Ri(i,u);(se.line>=ae.to||se.line<ae.from)&&setTimeout(tt(e,function(){z==ne&&R(J)}),150)}else{var xe=J.clientY<M.top?-20:J.clientY>M.bottom?20:0;xe&&setTimeout(tt(e,function(){z==ne&&(i.scroller.scrollTop+=xe,R(J))}),50)}}function Y(J){e.state.selectingText=!1,z=1/0,J&&(mt(J),i.input.focus()),Lt(i.wrapper.ownerDocument,"mousemove",Q),Lt(i.wrapper.ownerDocument,"mouseup",V),u.history.lastSelOrigin=null}var Q=tt(e,function(J){J.buttons===0||!Zl(J)?Y(J):R(J)}),V=tt(e,Y);e.state.selectingText=V,ue(i.wrapper.ownerDocument,"mousemove",Q),ue(i.wrapper.ownerDocument,"mouseup",V)}function Nh(e,t){var n=t.anchor,r=t.head,i=oe(e.doc,n.line);if(pe(n,r)==0&&n.sticky==r.sticky)return t;var u=tr(i);if(!u)return t;var h=_n(u,n.ch,n.sticky),g=u[h];if(g.from!=n.ch&&g.to!=n.ch)return t;var v=h+(g.from==n.ch==(g.level!=1)?0:1);if(v==0||v==u.length)return t;var b;if(r.line!=n.line)b=(r.line-n.line)*(e.doc.direction=="ltr"?1:-1)>0;else{var w=_n(u,r.ch,r.sticky),k=w-h||(r.ch-n.ch)*(g.level==1?-1:1);w==v-1||w==v?b=k<0:b=k>0}var B=u[v+(b?-1:0)],M=b==(B.level==1),z=M?B.from:B.to,R=M?"after":"before";return n.ch==z&&n.sticky==R?t:new Ee(new X(n.line,z,R),r)}function Ru(e,t,n,r){var i,u;if(t.touches)i=t.touches[0].clientX,u=t.touches[0].clientY;else try{i=t.clientX,u=t.clientY}catch{return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&mt(t);var h=e.display,g=h.lineDiv.getBoundingClientRect();if(u>g.bottom||!It(e,n))return Jo(t);u-=g.top-h.viewOffset;for(var v=0;v<e.display.gutterSpecs.length;++v){var b=h.gutters.childNodes[v];if(b&&b.getBoundingClientRect().right>=i){var w=_r(e.doc,u),k=e.display.gutterSpecs[v];return je(e,n,e,w,k.className,t),Jo(t)}}}function Qa(e,t){return Ru(e,t,"gutterClick",!0)}function Wu(e,t){ir(e.display,t)||Oh(e,t)||Ve(e,t,"contextmenu")||me||e.display.input.onContextMenu(t)}function Oh(e,t){return It(e,"gutterContextMenu")?Ru(e,t,"gutterContextMenu",!1):!1}function qu(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Rn(e)}var gn={toString:function(){return"CodeMirror.Init"}},Uu={},Vi={};function Ih(e){var t=e.optionHandlers;function n(r,i,u,h){e.defaults[r]=i,u&&(t[r]=h?function(g,v,b){b!=gn&&u(g,v,b)}:u)}e.defineOption=n,e.Init=gn,n("value","",function(r,i){return r.setValue(i)},!0),n("mode",null,function(r,i){r.doc.modeOption=i,Ra(r)},!0),n("indentUnit",2,Ra,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,function(r){Yn(r),Rn(r),bt(r)},!0),n("lineSeparator",null,function(r,i){if(r.doc.lineSep=i,!!i){var u=[],h=r.doc.first;r.doc.iter(function(v){for(var b=0;;){var w=v.text.indexOf(i,b);if(w==-1)break;b=w+i.length,u.push(X(h,w))}h++});for(var g=u.length-1;g>=0;g--)cn(r.doc,i,u[g],X(u[g].line,u[g].ch+i.length))}}),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,function(r,i,u){r.state.specialChars=new RegExp(i.source+(i.test(" ")?"":"| "),"g"),u!=gn&&r.refresh()}),n("specialCharPlaceholder",cd,function(r){return r.refresh()},!0),n("electricChars",!0),n("inputStyle",N?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),n("spellcheck",!1,function(r,i){return r.getInputField().spellcheck=i},!0),n("autocorrect",!1,function(r,i){return r.getInputField().autocorrect=i},!0),n("autocapitalize",!1,function(r,i){return r.getInputField().autocapitalize=i},!0),n("rtlMoveVisually",!q),n("wholeLineUpdateBefore",!0),n("theme","default",function(r){qu(r),Kn(r)},!0),n("keyMap","default",function(r,i,u){var h=Ji(i),g=u!=gn&&Ji(u);g&&g.detach&&g.detach(r,h),h.attach&&h.attach(r,g||null)}),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,zh,!0),n("gutters",[],function(r,i){r.display.gutterSpecs=za(i,r.options.lineNumbers),Kn(r)},!0),n("fixedGutter",!0,function(r,i){r.display.gutters.style.left=i?Ea(r.display)+"px":"0",r.refresh()},!0),n("coverGutterNextToScrollbar",!1,function(r){return ln(r)},!0),n("scrollbarStyle","native",function(r){Gs(r),ln(r),r.display.scrollbars.setScrollTop(r.doc.scrollTop),r.display.scrollbars.setScrollLeft(r.doc.scrollLeft)},!0),n("lineNumbers",!1,function(r,i){r.display.gutterSpecs=za(r.options.gutters,i),Kn(r)},!0),n("firstLineNumber",1,Kn,!0),n("lineNumberFormatter",function(r){return r},Kn,!0),n("showCursorWhenSelecting",!1,Wn,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,function(r,i){i=="nocursor"&&(on(r),r.display.input.blur()),r.display.input.readOnlyChanged(i)}),n("screenReaderLabel",null,function(r,i){i=i===""?null:i,r.display.input.screenReaderLabelChanged(i)}),n("disableInput",!1,function(r,i){i||r.display.input.reset()},!0),n("dragDrop",!0,Ph),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,Wn,!0),n("singleCursorHeightPerLine",!0,Wn,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Yn,!0),n("addModeClass",!1,Yn,!0),n("pollInterval",100),n("undoDepth",200,function(r,i){return r.doc.history.undoDepth=i}),n("historyEventDelay",1250),n("viewportMargin",10,function(r){return r.refresh()},!0),n("maxHighlightLength",1e4,Yn,!0),n("moveInputWithCursor",!0,function(r,i){i||r.display.input.resetPosition()}),n("tabindex",null,function(r,i){return r.display.input.getField().tabIndex=i||""}),n("autofocus",null),n("direction","ltr",function(r,i){return r.doc.setDirection(i)},!0),n("phrases",null)}function Ph(e,t,n){var r=n&&n!=gn;if(!t!=!r){var i=e.display.dragFunctions,u=t?ue:Lt;u(e.display.scroller,"dragstart",i.start),u(e.display.scroller,"dragenter",i.enter),u(e.display.scroller,"dragover",i.over),u(e.display.scroller,"dragleave",i.leave),u(e.display.scroller,"drop",i.drop)}}function zh(e){e.options.lineWrapping?(De(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(le(e.display.wrapper,"CodeMirror-wrap"),va(e)),Aa(e),bt(e),Rn(e),setTimeout(function(){return ln(e)},100)}function Oe(e,t){var n=this;if(!(this instanceof Oe))return new Oe(e,t);this.options=t=t?Tt(t):{},Tt(Uu,t,!1);var r=t.value;typeof r=="string"?r=new yt(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Oe.inputStyles[t.inputStyle](this),u=this.display=new Jd(e,r,i,t);u.wrapper.CodeMirror=this,qu(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 ft,keySeq:null,specialChars:null},t.autofocus&&!N&&u.input.focus(),c&&d<11&&setTimeout(function(){return n.display.input.reset(!0)},20),Hh(this),vh(),Hr(this),this.curOp.forceUpdate=!0,tu(this,r),t.autofocus&&!N||this.hasFocus()?setTimeout(function(){n.hasFocus()&&!n.state.focused&&Ma(n)},20):on(this);for(var h in Vi)Vi.hasOwnProperty(h)&&Vi[h](this,t[h],gn);Ys(this),t.finishInit&&t.finishInit(this);for(var g=0;g<Ja.length;++g)Ja[g](this);Rr(this),m&&t.lineWrapping&&getComputedStyle(u.lineDiv).textRendering=="optimizelegibility"&&(u.lineDiv.style.textRendering="auto")}Oe.defaults=Uu,Oe.optionHandlers=Vi;function Hh(e){var t=e.display;ue(t.scroller,"mousedown",tt(e,zu)),c&&d<11?ue(t.scroller,"dblclick",tt(e,function(v){if(!Ve(e,v)){var b=Or(e,v);if(!(!b||Qa(e,v)||ir(e.display,v))){mt(v);var w=e.findWordAt(b);Xi(e.doc,w.anchor,w.head)}}})):ue(t.scroller,"dblclick",function(v){return Ve(e,v)||mt(v)}),ue(t.scroller,"contextmenu",function(v){return Wu(e,v)}),ue(t.input.getField(),"contextmenu",function(v){t.scroller.contains(v.target)||Wu(e,v)});var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout(function(){return t.activeTouch=null},1e3),r=t.activeTouch,r.end=+new Date)}function u(v){if(v.touches.length!=1)return!1;var b=v.touches[0];return b.radiusX<=1&&b.radiusY<=1}function h(v,b){if(b.left==null)return!0;var w=b.left-v.left,k=b.top-v.top;return w*w+k*k>20*20}ue(t.scroller,"touchstart",function(v){if(!Ve(e,v)&&!u(v)&&!Qa(e,v)){t.input.ensurePolled(),clearTimeout(n);var b=+new Date;t.activeTouch={start:b,moved:!1,prev:b-r.end<=300?r:null},v.touches.length==1&&(t.activeTouch.left=v.touches[0].pageX,t.activeTouch.top=v.touches[0].pageY)}}),ue(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),ue(t.scroller,"touchend",function(v){var b=t.activeTouch;if(b&&!ir(t,v)&&b.left!=null&&!b.moved&&new Date-b.start<300){var w=e.coordsChar(t.activeTouch,"page"),k;!b.prev||h(b,b.prev)?k=new Ee(w,w):!b.prev.prev||h(b,b.prev.prev)?k=e.findWordAt(w):k=new Ee(X(w.line,0),ge(e.doc,X(w.line+1,0))),e.setSelection(k.anchor,k.head),e.focus(),mt(v)}i()}),ue(t.scroller,"touchcancel",i),ue(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Un(e,t.scroller.scrollTop),Pr(e,t.scroller.scrollLeft,!0),je(e,"scroll",e))}),ue(t.scroller,"mousewheel",function(v){return Js(e,v)}),ue(t.scroller,"DOMMouseScroll",function(v){return Js(e,v)}),ue(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(v){Ve(e,v)||Bn(v)},over:function(v){Ve(e,v)||(gh(e,v),Bn(v))},start:function(v){return ph(e,v)},drop:tt(e,hh),leave:function(v){Ve(e,v)||Su(e)}};var g=t.input.getField();ue(g,"keyup",function(v){return Iu.call(e,v)}),ue(g,"keydown",tt(e,Ou)),ue(g,"keypress",tt(e,Pu)),ue(g,"focus",function(v){return Ma(e,v)}),ue(g,"blur",function(v){return on(e,v)})}var Ja=[];Oe.defineInitHook=function(e){return Ja.push(e)};function li(e,t,n,r){var i=e.doc,u;n==null&&(n="add"),n=="smart"&&(i.mode.indent?u=On(e,t).state:n="prev");var h=e.options.tabSize,g=oe(i,t),v=Ye(g.text,null,h);g.stateAfter&&(g.stateAfter=null);var b=g.text.match(/^\s*/)[0],w;if(!r&&!/\S/.test(g.text))w=0,n="not";else if(n=="smart"&&(w=i.mode.indent(u,g.text.slice(b.length),g.text),w==Ze||w>150)){if(!r)return;n="prev"}n=="prev"?t>i.first?w=Ye(oe(i,t-1).text,null,h):w=0:n=="add"?w=v+e.options.indentUnit:n=="subtract"?w=v-e.options.indentUnit:typeof n=="number"&&(w=v+n),w=Math.max(0,w);var k="",B=0;if(e.options.indentWithTabs)for(var M=Math.floor(w/h);M;--M)B+=h,k+=" ";if(B<w&&(k+=pr(w-B)),k!=b)return cn(i,k,X(t,0),X(t,b.length),"+input"),g.stateAfter=null,!0;for(var z=0;z<i.sel.ranges.length;z++){var R=i.sel.ranges[z];if(R.head.line==t&&R.head.ch<b.length){var Y=X(t,b.length);ja(i,z,new Ee(Y,Y));break}}}var Ut=null;function eo(e){Ut=e}function $a(e,t,n,r,i){var u=e.doc;e.display.shift=!1,r||(r=u.sel);var h=+new Date-200,g=i=="paste"||e.state.pasteIncoming>h,v=ta(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 w=0;w<Ut.text.length;w++)b.push(u.splitLines(Ut.text[w]))}}else v.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(b=Ht(v,function(Q){return[Q]}));for(var k=e.curOp.updateInput,B=r.ranges.length-1;B>=0;B--){var M=r.ranges[B],z=M.from(),R=M.to();M.empty()&&(n&&n>0?z=X(z.line,z.ch-n):e.state.overwrite&&!g?R=X(R.line,Math.min(oe(u,R.line).text.length,R.ch+Ce(v).length)):g&&Ut&&Ut.lineWise&&Ut.text.join(`
|
|
`)==v.join(`
|
|
`)&&(z=R=X(z.line,0)));var Y={from:z,to:R,text:b?b[B%b.length]:v,origin:i||(g?"paste":e.state.cutIncoming>h?"cut":"+input")};fn(e.doc,Y),et(e,"inputRead",e,Y)}t&&!g&&Gu(e,t),an(e),e.curOp.updateInput<2&&(e.curOp.updateInput=k),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function ju(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),!t.isReadOnly()&&!t.options.disableInput&&t.hasFocus()&&kt(t,function(){return $a(t,n,0,null,"paste")}),!0}function Gu(e,t){if(!(!e.options.electricChars||!e.options.smartIndent))for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var u=e.getModeAt(i.head),h=!1;if(u.electricChars){for(var g=0;g<u.electricChars.length;g++)if(t.indexOf(u.electricChars.charAt(g))>-1){h=li(e,i.head.line,"smart");break}}else u.electricInput&&u.electricInput.test(oe(e.doc,i.head.line).text.slice(0,i.head.ch))&&(h=li(e,i.head.line,"smart"));h&&et(e,"electricInput",e,i.head.line)}}}function Xu(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,u={anchor:X(i,0),head:X(i+1,0)};n.push(u),t.push(e.getRange(u.anchor,u.head))}return{text:t,ranges:n}}function Va(e,t,n,r){e.setAttribute("autocorrect",n?"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 m?e.style.width="1000px":e.setAttribute("wrap","off"),T&&(e.style.border="1px solid black"),t}function Rh(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){ye(this).focus(),this.display.input.focus()},setOption:function(r,i){var u=this.options,h=u[r];u[r]==i&&r!="mode"||(u[r]=i,t.hasOwnProperty(r)&&tt(this,t[r])(this,i,h),je(this,"optionChange",this,r))},getOption:function(r){return this.options[r]},getDoc:function(){return this.doc},addKeyMap:function(r,i){this.state.keyMaps[i?"push":"unshift"](Ji(r))},removeKeyMap:function(r){for(var i=this.state.keyMaps,u=0;u<i.length;++u)if(i[u]==r||i[u].name==r)return i.splice(u,1),!0},addOverlay:ct(function(r,i){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:i&&i.opaque,priority:i&&i.priority||0},function(h){return h.priority}),this.state.modeGen++,bt(this)}),removeOverlay:ct(function(r){for(var i=this.state.overlays,u=0;u<i.length;++u){var h=i[u].modeSpec;if(h==r||typeof r=="string"&&h.name==r){i.splice(u,1),this.state.modeGen++,bt(this);return}}}),indentLine:ct(function(r,i,u){typeof i!="string"&&typeof i!="number"&&(i==null?i=this.options.smartIndent?"smart":"prev":i=i?"add":"subtract"),Nn(this.doc,r)&&li(this,r,i,u)}),indentSelection:ct(function(r){for(var i=this.doc.sel.ranges,u=-1,h=0;h<i.length;h++){var g=i[h];if(g.empty())g.head.line>u&&(li(this,g.head.line,r,!0),u=g.head.line,h==this.doc.sel.primIndex&&an(this));else{var v=g.from(),b=g.to(),w=Math.max(u,v.line);u=Math.min(this.lastLine(),b.line-(b.ch?0:1))+1;for(var k=w;k<u;++k)li(this,k,r);var B=this.doc.sel.ranges;v.ch==0&&i.length==B.length&&B[h].from().ch>0&&ja(this.doc,h,new Ee(v,B[h].to()),vt)}}}),getTokenAt:function(r,i){return ns(this,r,i)},getLineTokens:function(r,i){return ns(this,X(r),i,!0)},getTokenTypeAt:function(r){r=ge(this.doc,r);var i=es(this,oe(this.doc,r.line)),u=0,h=(i.length-1)/2,g=r.ch,v;if(g==0)v=i[2];else for(;;){var b=u+h>>1;if((b?i[b*2-1]:0)>=g)h=b;else if(i[b*2+1]<g)u=b+1;else{v=i[b*2+2];break}}var w=v?v.indexOf("overlay "):-1;return w<0?v:w==0?null:v.slice(0,w-1)},getModeAt:function(r){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(r).state).mode:i},getHelper:function(r,i){return this.getHelpers(r,i)[0]},getHelpers:function(r,i){var u=[];if(!n.hasOwnProperty(i))return u;var h=n[i],g=this.getModeAt(r);if(typeof g[i]=="string")h[g[i]]&&u.push(h[g[i]]);else if(g[i])for(var v=0;v<g[i].length;v++){var b=h[g[i][v]];b&&u.push(b)}else g.helperType&&h[g.helperType]?u.push(h[g.helperType]):h[g.name]&&u.push(h[g.name]);for(var w=0;w<h._global.length;w++){var k=h._global[w];k.pred(g,this)&&Ne(u,k.val)==-1&&u.push(k.val)}return u},getStateAfter:function(r,i){var u=this.doc;return r=Jl(u,r??u.first+u.size-1),On(this,r+1,i).state},cursorCoords:function(r,i){var u,h=this.doc.sel.primary();return r==null?u=h.head:typeof r=="object"?u=ge(this.doc,r):u=r?h.from():h.to(),Wt(this,u,i||"page")},charCoords:function(r,i){return Ii(this,ge(this.doc,r),i||"page")},coordsChar:function(r,i){return r=_s(this,r,i||"page"),Ca(this,r.left,r.top)},lineAtHeight:function(r,i){return r=_s(this,{top:r,left:0},i||"page").top,_r(this.doc,r+this.display.viewOffset)},heightAtLine:function(r,i,u){var h=!1,g;if(typeof r=="number"){var v=this.doc.first+this.doc.size-1;r<this.doc.first?r=this.doc.first:r>v&&(r=v,h=!0),g=oe(this.doc,r)}else g=r;return Oi(this,g,{top:0,left:0},i||"page",u||h).top+(h?this.doc.height-nr(g):0)},defaultTextHeight:function(){return rn(this.display)},defaultCharWidth:function(){return nn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(r,i,u,h,g){var v=this.display;r=Wt(this,ge(this.doc,r));var b=r.bottom,w=r.left;if(i.style.position="absolute",i.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(i),v.sizer.appendChild(i),h=="over")b=r.top;else if(h=="above"||h=="near"){var k=Math.max(v.wrapper.clientHeight,this.doc.height),B=Math.max(v.sizer.clientWidth,v.lineSpace.clientWidth);(h=="above"||r.bottom+i.offsetHeight>k)&&r.top>i.offsetHeight?b=r.top-i.offsetHeight:r.bottom+i.offsetHeight<=k&&(b=r.bottom),w+i.offsetWidth>B&&(w=B-i.offsetWidth)}i.style.top=b+"px",i.style.left=i.style.right="",g=="right"?(w=v.sizer.clientWidth-i.offsetWidth,i.style.right="0px"):(g=="left"?w=0:g=="middle"&&(w=(v.sizer.clientWidth-i.offsetWidth)/2),i.style.left=w+"px"),u&&Pd(this,{left:w,top:b,right:w+i.offsetWidth,bottom:b+i.offsetHeight})},triggerOnKeyDown:ct(Ou),triggerOnKeyPress:ct(Pu),triggerOnKeyUp:Iu,triggerOnMouseDown:ct(zu),execCommand:function(r){if(ni.hasOwnProperty(r))return ni[r].call(null,this)},triggerElectric:ct(function(r){Gu(this,r)}),findPosH:function(r,i,u,h){var g=1;i<0&&(g=-1,i=-i);for(var v=ge(this.doc,r),b=0;b<i&&(v=el(this.doc,v,g,u,h),!v.hitSide);++b);return v},moveH:ct(function(r,i){var u=this;this.extendSelectionsBy(function(h){return u.display.shift||u.doc.extend||h.empty()?el(u.doc,h.head,r,i,u.options.rtlMoveVisually):r<0?h.from():h.to()},Xt)}),deleteH:ct(function(r,i){var u=this.doc.sel,h=this.doc;u.somethingSelected()?h.replaceSelection("",null,"+delete"):pn(this,function(g){var v=el(h,g.head,r,i,!1);return r<0?{from:v,to:g.head}:{from:g.head,to:v}})}),findPosV:function(r,i,u,h){var g=1,v=h;i<0&&(g=-1,i=-i);for(var b=ge(this.doc,r),w=0;w<i;++w){var k=Wt(this,b,"div");if(v==null?v=k.left:k.left=v,b=Yu(this,k,g,u),b.hitSide)break}return b},moveV:ct(function(r,i){var u=this,h=this.doc,g=[],v=!this.display.shift&&!h.extend&&h.sel.somethingSelected();if(h.extendSelectionsBy(function(w){if(v)return r<0?w.from():w.to();var k=Wt(u,w.head,"div");w.goalColumn!=null&&(k.left=w.goalColumn),g.push(k.left);var B=Yu(u,k,r,i);return i=="page"&&w==h.sel.primary()&&Ba(u,Ii(u,B,"div").top-k.top),B},Xt),g.length)for(var b=0;b<h.sel.ranges.length;b++)h.sel.ranges[b].goalColumn=g[b]}),findWordAt:function(r){var i=this.doc,u=oe(i,r.line).text,h=r.ch,g=r.ch;if(u){var v=this.getHelper(r,"wordChars");(r.sticky=="before"||g==u.length)&&h?--h:++g;for(var b=u.charAt(h),w=Ci(b,v)?function(k){return Ci(k,v)}:/\s/.test(b)?function(k){return/\s/.test(k)}:function(k){return!/\s/.test(k)&&!Ci(k)};h>0&&w(u.charAt(h-1));)--h;for(;g<u.length&&w(u.charAt(g));)++g}return new Ee(X(r.line,h),X(r.line,g))},toggleOverwrite:function(r){r!=null&&r==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?De(this.display.cursorDiv,"CodeMirror-overwrite"):le(this.display.cursorDiv,"CodeMirror-overwrite"),je(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==ve(te(this))},isReadOnly:function(){return!!(this.options.readOnly||this.doc.cantEdit)},scrollTo:ct(function(r,i){qn(this,r,i)}),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:ya(this),clientWidth:Br(this)}},scrollIntoView:ct(function(r,i){r==null?(r={from:this.doc.sel.primary().head,to:null},i==null&&(i=this.options.cursorScrollMargin)):typeof r=="number"?r={from:X(r,0),to:null}:r.from==null&&(r={from:r,to:null}),r.to||(r.to=r.from),r.margin=i||0,r.from.line!=null?zd(this,r):Ws(this,r.from,r.to,r.margin)}),setSize:ct(function(r,i){var u=this,h=function(v){return typeof v=="number"||/^\d+$/.test(String(v))?v+"px":v};r!=null&&(this.display.wrapper.style.width=h(r)),i!=null&&(this.display.wrapper.style.height=h(i)),this.options.lineWrapping&&Ts(this);var g=this.display.viewFrom;this.doc.iter(g,this.display.viewTo,function(v){if(v.widgets){for(var b=0;b<v.widgets.length;b++)if(v.widgets[b].noHScroll){mr(u,g,"widget");break}}++g}),this.curOp.forceUpdate=!0,je(this,"refresh",this)}),operation:function(r){return kt(this,r)},startOperation:function(){return Hr(this)},endOperation:function(){return Rr(this)},refresh:ct(function(){var r=this.display.cachedTextHeight;bt(this),this.curOp.forceUpdate=!0,Rn(this),qn(this,this.doc.scrollLeft,this.doc.scrollTop),Ia(this.display),(r==null||Math.abs(r-rn(this.display))>.5||this.options.lineWrapping)&&Aa(this),je(this,"refresh",this)}),swapDoc:ct(function(r){var i=this.doc;return i.cm=null,this.state.selectingText&&this.state.selectingText(),tu(this,r),Rn(this),this.display.input.reset(),qn(this,r.scrollLeft,r.scrollTop),this.curOp.forceScroll=!0,et(this,"swapDoc",this,i),i}),phrase:function(r){var i=this.options.phrases;return i&&Object.prototype.hasOwnProperty.call(i,r)?i[r]:r},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Qr(e),e.registerHelper=function(r,i,u){n.hasOwnProperty(r)||(n[r]=e[r]={_global:[]}),n[r][i]=u},e.registerGlobalHelper=function(r,i,u,h){e.registerHelper(r,i,h),n[r]._global.push({pred:u,val:h})}}function el(e,t,n,r,i){var u=t,h=n,g=oe(e,t.line),v=i&&e.direction=="rtl"?-n:n;function b(){var V=t.line+v;return V<e.first||V>=e.first+e.size?!1:(t=new X(V,t.ch,t.sticky),g=oe(e,V))}function w(V){var J;if(r=="codepoint"){var ne=g.text.charCodeAt(t.ch+(n>0?0:-1));if(isNaN(ne))J=null;else{var se=n>0?ne>=55296&&ne<56320:ne>=56320&&ne<57343;J=new X(t.line,Math.max(0,Math.min(g.text.length,t.ch+n*(se?2:1))),-n)}}else i?J=Dh(e.cm,g,t,n):J=Xa(g,t,n);if(J==null)if(!V&&b())t=Ka(i,e.cm,g,t.line,v);else return!1;else t=J;return!0}if(r=="char"||r=="codepoint")w();else if(r=="column")w(!0);else if(r=="word"||r=="group")for(var k=null,B=r=="group",M=e.cm&&e.cm.getHelper(t,"wordChars"),z=!0;!(n<0&&!w(!z));z=!1){var R=g.text.charAt(t.ch)||`
|
|
`,Y=Ci(R,M)?"w":B&&R==`
|
|
`?"n":!B||/\s/.test(R)?null:"p";if(B&&!z&&!Y&&(Y="s"),k&&k!=Y){n<0&&(n=1,w(),t.sticky="after");break}if(Y&&(k=Y),n>0&&!w(!z))break}var Q=Yi(e,t,u,h,!0);return sa(u,Q)&&(Q.hitSide=!0),Q}function Yu(e,t,n,r){var i=e.doc,u=t.left,h;if(r=="page"){var g=Math.min(e.display.wrapper.clientHeight,ye(e).innerHeight||i(e).documentElement.clientHeight),v=Math.max(g-.5*rn(e.display),3);h=(n>0?t.bottom:t.top)+n*v}else r=="line"&&(h=n>0?t.bottom+3:t.top-3);for(var b;b=Ca(e,u,h),!!b.outside;){if(n<0?h<=0:h>=i.height){b.hitSide=!0;break}h+=n*5}return b}var Fe=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new ft,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};Fe.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable=!0,Va(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize);function u(g){for(var v=g.target;v;v=v.parentNode){if(v==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(v.className))break}return!1}ue(i,"paste",function(g){!u(g)||Ve(r,g)||ju(g,r)||d<=11&&setTimeout(tt(r,function(){return t.updateFromDOM()}),20)}),ue(i,"compositionstart",function(g){t.composing={data:g.data,done:!1}}),ue(i,"compositionupdate",function(g){t.composing||(t.composing={data:g.data,done:!1})}),ue(i,"compositionend",function(g){t.composing&&(g.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),ue(i,"touchstart",function(){return n.forceCompositionEnd()}),ue(i,"input",function(){t.composing||t.readFromDOMSoon()});function h(g){if(!(!u(g)||Ve(r,g))){if(r.somethingSelected())eo({lineWise:!1,text:r.getSelections()}),g.type=="cut"&&r.replaceSelection("",null,"cut");else if(r.options.lineWiseCopyCut){var v=Xu(r);eo({lineWise:!0,text:v.text}),g.type=="cut"&&r.operation(function(){r.setSelections(v.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 w=Ku(),k=w.firstChild;Va(k),r.display.lineSpace.insertBefore(w,r.display.lineSpace.firstChild),k.value=Ut.text.join(`
|
|
`);var B=ve(we(i));F(k),setTimeout(function(){r.display.lineSpace.removeChild(w),B.focus(),B==i&&n.showPrimarySelection()},50)}}ue(i,"copy",h),ue(i,"cut",h)},Fe.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Fe.prototype.prepareSelection=function(){var e=zs(this.cm,!1);return e.focus=ve(we(this.div))==this.div,e},Fe.prototype.showSelection=function(e,t){!e||!this.cm.display.view.length||((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Fe.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Fe.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom){e.removeAllRanges();return}var u=to(t,e.anchorNode,e.anchorOffset),h=to(t,e.focusNode,e.focusOffset);if(!(u&&!u.bad&&h&&!h.bad&&pe(Ei(u,h),r)==0&&pe(Si(u,h),i)==0)){var g=t.display.view,v=r.line>=t.display.viewFrom&&Zu(t,r)||{node:g[0].measure.map[2],offset:0},b=i.line<t.display.viewTo&&Zu(t,i);if(!b){var w=g[g.length-1].measure,k=w.maps?w.maps[w.maps.length-1]:w.map;b={node:k[k.length-1],offset:k[k.length-2]-k[k.length-3]}}if(!v||!b){e.removeAllRanges();return}var B=e.rangeCount&&e.getRangeAt(0),M;try{M=W(v.node,v.offset,b.offset,b.node)}catch{}M&&(!s&&t.state.focused?(e.collapse(v.node,v.offset),M.collapsed||(e.removeAllRanges(),e.addRange(M))):(e.removeAllRanges(),e.addRange(M)),B&&e.anchorNode==null?e.addRange(B):s&&this.startGracePeriod()),this.rememberSelection()}},Fe.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)},Fe.prototype.showMultipleSelections=function(e){ee(this.cm.display.cursorDiv,e.cursors),ee(this.cm.display.selectionDiv,e.selection)},Fe.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Fe.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Z(this.div,t)},Fe.prototype.focus=function(){this.cm.options.readOnly!="nocursor"&&((!this.selectionInEditor()||ve(we(this.div))!=this.div)&&this.showSelection(this.prepareSelection(),!0),this.div.focus())},Fe.prototype.blur=function(){this.div.blur()},Fe.prototype.getField=function(){return this.div},Fe.prototype.supportsTouch=function(){return!0},Fe.prototype.receivedFocus=function(){var e=this,t=this;this.selectionInEditor()?setTimeout(function(){return e.pollSelection()},20):kt(this.cm,function(){return t.cm.curOp.selectionChanged=!0});function n(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,n))}this.polling.set(this.cm.options.pollInterval,n)},Fe.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Fe.prototype.pollSelection=function(){if(!(this.readDOMTimeout!=null||this.gracePeriod||!this.selectionChanged())){var e=this.getSelection(),t=this.cm;if(O&&x&&this.cm.display.gutterSpecs.length&&Wh(e.anchorNode)){this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();return}if(!this.composing){this.rememberSelection();var n=to(t,e.anchorNode,e.anchorOffset),r=to(t,e.focusNode,e.focusOffset);n&&r&&kt(t,function(){lt(t.doc,yr(n,r),vt),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},Fe.prototype.pollContent=function(){this.readDOMTimeout!=null&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.ch==0&&r.line>e.firstLine()&&(r=X(r.line-1,oe(e.doc,r.line-1).length)),i.ch==oe(e.doc,i.line).text.length&&i.line<e.lastLine()&&(i=X(i.line+1,0)),r.line<t.viewFrom||i.line>t.viewTo-1)return!1;var u,h,g;r.line==t.viewFrom||(u=Ir(e,r.line))==0?(h=Ae(t.view[0].line),g=t.view[0].node):(h=Ae(t.view[u].line),g=t.view[u-1].node.nextSibling);var v=Ir(e,i.line),b,w;if(v==t.view.length-1?(b=t.viewTo-1,w=t.lineDiv.lastChild):(b=Ae(t.view[v+1].line)-1,w=t.view[v+1].node.previousSibling),!g)return!1;for(var k=e.doc.splitLines(qh(e,g,w,h,b)),B=Mr(e.doc,X(h,0),X(b,oe(e.doc,b).text.length));k.length>1&&B.length>1;)if(Ce(k)==Ce(B))k.pop(),B.pop(),b--;else if(k[0]==B[0])k.shift(),B.shift(),h++;else break;for(var M=0,z=0,R=k[0],Y=B[0],Q=Math.min(R.length,Y.length);M<Q&&R.charCodeAt(M)==Y.charCodeAt(M);)++M;for(var V=Ce(k),J=Ce(B),ne=Math.min(V.length-(k.length==1?M:0),J.length-(B.length==1?M:0));z<ne&&V.charCodeAt(V.length-z-1)==J.charCodeAt(J.length-z-1);)++z;if(k.length==1&&B.length==1&&h==r.line)for(;M&&M>r.ch&&V.charCodeAt(V.length-z-1)==J.charCodeAt(J.length-z-1);)M--,z++;k[k.length-1]=V.slice(0,V.length-z).replace(/^\u200b+/,""),k[0]=k[0].slice(M).replace(/\u200b+$/,"");var se=X(h,M),ae=X(b,B.length?Ce(B).length-z:0);if(k.length>1||k[0]||pe(se,ae))return cn(e.doc,k,se,ae,"+input"),!0},Fe.prototype.ensurePolled=function(){this.forceCompositionEnd()},Fe.prototype.reset=function(){this.forceCompositionEnd()},Fe.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Fe.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))},Fe.prototype.updateFromDOM=function(){var e=this;(this.cm.isReadOnly()||!this.pollContent())&&kt(this.cm,function(){return bt(e.cm)})},Fe.prototype.setUneditable=function(e){e.contentEditable="false"},Fe.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))},Fe.prototype.readOnlyChanged=function(e){this.div.contentEditable=String(e!="nocursor")},Fe.prototype.onContextMenu=function(){},Fe.prototype.resetPosition=function(){},Fe.prototype.needsContentAttribute=!0;function Zu(e,t){var n=xa(e,t.line);if(!n||n.hidden)return null;var r=oe(e.doc,t.line),i=ks(n,r,t.line),u=tr(r,e.doc.direction),h="left";if(u){var g=_n(u,t.ch);h=g%2?"right":"left"}var v=As(i.map,t.ch,h);return v.offset=v.collapse=="right"?v.end:v.start,v}function Wh(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function vn(e,t){return t&&(e.bad=!0),e}function qh(e,t,n,r,i){var u="",h=!1,g=e.doc.lineSeparator(),v=!1;function b(M){return function(z){return z.id==M}}function w(){h&&(u+=g,v&&(u+=g),h=v=!1)}function k(M){M&&(w(),u+=M)}function B(M){if(M.nodeType==1){var z=M.getAttribute("cm-text");if(z){k(z);return}var R=M.getAttribute("cm-marker"),Y;if(R){var Q=e.findMarks(X(r,0),X(i+1,0),b(+R));Q.length&&(Y=Q[0].find(0))&&k(Mr(e.doc,Y.from,Y.to).join(g));return}if(M.getAttribute("contenteditable")=="false")return;var V=/^(pre|div|p|li|table|br)$/i.test(M.nodeName);if(!/^br$/i.test(M.nodeName)&&M.textContent.length==0)return;V&&w();for(var J=0;J<M.childNodes.length;J++)B(M.childNodes[J]);/^(pre|p)$/i.test(M.nodeName)&&(v=!0),V&&(h=!0)}else M.nodeType==3&&k(M.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;B(t),t!=n;)t=t.nextSibling,v=!1;return u}function to(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return vn(e.clipPos(X(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var u=e.display.view[i];if(u.node==r)return Uh(u,t,n)}}function Uh(e,t,n){var r=e.text.firstChild,i=!1;if(!t||!Z(r,t))return vn(X(Ae(e.line),0),!0);if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var u=e.rest?Ce(e.rest):e.line;return vn(X(Ae(u),u.text.length),i)}var h=t.nodeType==3?t:null,g=t;for(!h&&t.childNodes.length==1&&t.firstChild.nodeType==3&&(h=t.firstChild,n&&(n=h.nodeValue.length));g.parentNode!=r;)g=g.parentNode;var v=e.measure,b=v.maps;function w(Y,Q,V){for(var J=-1;J<(b?b.length:0);J++)for(var ne=J<0?v.map:b[J],se=0;se<ne.length;se+=3){var ae=ne[se+2];if(ae==Y||ae==Q){var xe=Ae(J<0?e.line:e.rest[J]),Te=ne[se]+V;return(V<0||ae!=Y)&&(Te=ne[se+(V?1:0)]),X(xe,Te)}}}var k=w(h,g,n);if(k)return vn(k,i);for(var B=g.nextSibling,M=h?h.nodeValue.length-n:0;B;B=B.nextSibling){if(k=w(B,B.firstChild,0),k)return vn(X(k.line,k.ch-M),i);M+=B.textContent.length}for(var z=g.previousSibling,R=n;z;z=z.previousSibling){if(k=w(z,z.firstChild,-1),k)return vn(X(k.line,k.ch+R),i);R+=z.textContent.length}}var qe=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new ft,this.hasSelection=!1,this.composing=null,this.resetting=!1};qe.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),T&&(i.style.width="0px"),ue(i,"input",function(){c&&d>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()}),ue(i,"paste",function(h){Ve(r,h)||ju(h,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())});function u(h){if(!Ve(r,h)){if(r.somethingSelected())eo({lineWise:!1,text:r.getSelections()});else if(r.options.lineWiseCopyCut){var g=Xu(r);eo({lineWise:!0,text:g.text}),h.type=="cut"?r.setSelections(g.ranges,null,vt):(n.prevInput="",i.value=g.text.join(`
|
|
`),F(i))}else return;h.type=="cut"&&(r.state.cutIncoming=+new Date)}}ue(i,"cut",u),ue(i,"copy",u),ue(e.scroller,"paste",function(h){if(!(ir(e,h)||Ve(r,h))){if(!i.dispatchEvent){r.state.pasteIncoming=+new Date,n.focus();return}var g=new Event("paste");g.clipboardData=h.clipboardData,i.dispatchEvent(g)}}),ue(e.lineSpace,"selectstart",function(h){ir(e,h)||mt(h)}),ue(i,"compositionstart",function(){var h=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:h,range:r.markText(h,r.getCursor("to"),{className:"CodeMirror-composing"})}}),ue(i,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},qe.prototype.createField=function(e){this.wrapper=Ku(),this.textarea=this.wrapper.firstChild;var t=this.cm.options;Va(this.textarea,t.spellcheck,t.autocorrect,t.autocapitalize)},qe.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},qe.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=zs(e);if(e.options.moveInputWithCursor){var i=Wt(e,n.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),h=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+h.top-u.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+h.left-u.left))}return r},qe.prototype.showSelection=function(e){var t=this.cm,n=t.display;ee(n.cursorDiv,e.cursors),ee(n.selectionDiv,e.selection),e.teTop!=null&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},qe.prototype.reset=function(e){if(!(this.contextMenuPending||this.composing&&e)){var t=this.cm;if(this.resetting=!0,t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&F(this.textarea),c&&d>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",c&&d>=9&&(this.hasSelection=null));this.resetting=!1}},qe.prototype.getField=function(){return this.textarea},qe.prototype.supportsTouch=function(){return!1},qe.prototype.focus=function(){if(this.cm.options.readOnly!="nocursor"&&(!N||ve(we(this.textarea))!=this.textarea))try{this.textarea.focus()}catch{}},qe.prototype.blur=function(){this.textarea.blur()},qe.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},qe.prototype.receivedFocus=function(){this.slowPoll()},qe.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},qe.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0;function n(){var r=t.poll();!r&&!e?(e=!0,t.polling.set(60,n)):(t.pollingFast=!1,t.slowPoll())}t.polling.set(20,n)},qe.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||this.resetting||!t.state.focused||qc(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(c&&d>=9&&this.hasSelection===i||I&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var u=i.charCodeAt(0);if(u==8203&&!r&&(r="\u200B"),u==8666)return this.reset(),this.cm.execCommand("undo")}for(var h=0,g=Math.min(r.length,i.length);h<g&&r.charCodeAt(h)==i.charCodeAt(h);)++h;return kt(t,function(){$a(t,i.slice(h),r.length-h,null,e.composing?"*compose":null),i.length>1e3||i.indexOf(`
|
|
`)>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},qe.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},qe.prototype.onKeyPress=function(){c&&d>=9&&(this.hasSelection=null),this.fastPoll()},qe.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var u=Or(n,e),h=r.scroller.scrollTop;if(!u||S)return;var g=n.options.resetSelectionOnContextMenu;g&&n.doc.sel.contains(u)==-1&&tt(n,lt)(n.doc,yr(u),vt);var v=i.style.cssText,b=t.wrapper.style.cssText,w=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText=`position: absolute; width: 30px; height: 30px;
|
|
top: `+(e.clientY-w.top-5)+"px; left: "+(e.clientX-w.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 k;m&&(k=i.ownerDocument.defaultView.scrollY),r.input.focus(),m&&i.ownerDocument.defaultView.scrollTo(null,k),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=M,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll);function B(){if(i.selectionStart!=null){var R=n.somethingSelected(),Y="\u200B"+(R?i.value:"");i.value="\u21DA",i.value=Y,t.prevInput=R?"":"\u200B",i.selectionStart=1,i.selectionEnd=Y.length,r.selForContextMenu=n.doc.sel}}function M(){if(t.contextMenuPending==M&&(t.contextMenuPending=!1,t.wrapper.style.cssText=b,i.style.cssText=v,c&&d<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=h),i.selectionStart!=null)){(!c||c&&d<9)&&B();var R=0,Y=function(){r.selForContextMenu==n.doc.sel&&i.selectionStart==0&&i.selectionEnd>0&&t.prevInput=="\u200B"?tt(n,pu)(n):R++<10?r.detectingSelectAll=setTimeout(Y,500):(r.selForContextMenu=null,r.input.reset())};r.detectingSelectAll=setTimeout(Y,200)}}if(c&&d>=9&&B(),me){Bn(e);var z=function(){Lt(window,"mouseup",z),setTimeout(M,20)};ue(window,"mouseup",z)}else setTimeout(M,50)},qe.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled=e=="nocursor",this.textarea.readOnly=!!e},qe.prototype.setUneditable=function(){},qe.prototype.needsContentAttribute=!1;function jh(e,t){if(t=t?Tt(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),t.autofocus==null){var n=ve(we(e));t.autofocus=n==e||e.getAttribute("autofocus")!=null&&n==document.body}function r(){e.value=g.getValue()}var i;if(e.form&&(ue(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var u=e.form;i=u.submit;try{var h=u.submit=function(){r(),u.submit=i,u.submit(),u.submit=h}}catch{}}t.finishInit=function(v){v.save=r,v.getTextArea=function(){return e},v.toTextArea=function(){v.toTextArea=isNaN,r(),e.parentNode.removeChild(v.getWrapperElement()),e.style.display="",e.form&&(Lt(e.form,"submit",r),!t.leaveSubmitMethodAlone&&typeof e.form.submit=="function"&&(e.form.submit=i))}},e.style.display="none";var g=Oe(function(v){return e.parentNode.insertBefore(v,e.nextSibling)},t);return g}function Gh(e){e.off=Lt,e.on=ue,e.wheelEventPixels=$d,e.Doc=yt,e.splitLines=ta,e.countColumn=Ye,e.findColumn=Kt,e.isWordChar=Yo,e.Pass=Ze,e.signal=je,e.Line=Vr,e.changeEnd=xr,e.scrollbarModel=js,e.Pos=X,e.cmpPos=pe,e.modes=na,e.mimeModes=Jr,e.resolveMode=ki,e.getMode=ia,e.modeExtensions=$r,e.extendMode=Kc,e.copyState=Lr,e.startState=Ql,e.innerMode=oa,e.commands=ni,e.keyMap=ar,e.keyName=Lu,e.isModifierKey=Fu,e.lookupKey=hn,e.normalizeKeyMap=xh,e.StringStream=Ge,e.SharedTextMarker=ei,e.TextMarker=wr,e.LineWidget=Vn,e.e_preventDefault=mt,e.e_stopPropagation=Yl,e.e_stop=Bn,e.addClass=De,e.contains=Z,e.rmClass=le,e.keyNames=Cr}Ih(Oe),Rh(Oe);var Xh="iter insert remove copy getEditor constructor".split(" ");for(var ro in yt.prototype)yt.prototype.hasOwnProperty(ro)&&Ne(Xh,ro)<0&&(Oe.prototype[ro]=function(e){return function(){return e.apply(this.doc,arguments)}}(yt.prototype[ro]));return Qr(yt),Oe.inputStyles={textarea:qe,contenteditable:Fe},Oe.defineMode=function(e){!Oe.defaults.mode&&e!="null"&&(Oe.defaults.mode=e),Gc.apply(this,arguments)},Oe.defineMIME=Xc,Oe.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),Oe.defineMIME("text/plain","null"),Oe.defineExtension=function(e,t){Oe.prototype[e]=t},Oe.defineDocExtension=function(e,t){yt.prototype[e]=t},Oe.fromTextArea=jh,Gh(Oe),Oe.version="5.65.21",Oe})});var Vu=at((Ju,$u)=>{(function(o){typeof Ju=="object"&&typeof $u=="object"?o(Et()):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(p){if(p.getOption("disableInput"))return o.Pass;for(var c=p.listSelections(),d=[],m=0;m<c.length;m++){var y=c[m].head,x=p.getStateAfter(y.line),C=o.innerMode(p.getMode(),x);if(C.mode.name!=="markdown"&&C.mode.helperType!=="markdown"){p.execCommand("newlineAndIndent");return}else x=C.state;var S=x.list!==!1,A=x.quote!==0,_=p.getLine(y.line),L=l.exec(_),T=/^\s*$/.test(_.slice(0,y.ch));if(!c[m].empty()||!S&&!A||!L||T){p.execCommand("newlineAndIndent");return}if(s.test(_)){var O=A&&/>\s*$/.test(_),N=!/>\s*$/.test(_);(O||N)&&p.replaceRange("",{line:y.line,ch:0},{line:y.line,ch:y.ch+1}),d[m]=`
|
|
`}else{var I=L[1],P=L[5],q=!(a.test(L[2])||L[2].indexOf(">")>=0),G=q?parseInt(L[3],10)+1+L[4]:L[2].replace("x"," ");d[m]=`
|
|
`+I+G+P,q&&f(p,y)}}p.replaceSelections(d)};function f(p,c){var d=c.line,m=0,y=0,x=l.exec(p.getLine(d)),C=x[1];do{m+=1;var S=d+m,A=p.getLine(S),_=l.exec(A);if(_){var L=_[1],T=parseInt(x[3],10)+m-y,O=parseInt(_[3],10),N=O;if(C===L&&!isNaN(O))T===O&&(N=O+1),T>O&&(N=T+1),p.replaceRange(A.replace(l,L+N+_[4]+_[5]),{line:S,ch:0},{line:S,ch:A.length});else{if(C.length>L.length||C.length<L.length&&m===1)return;y+=1}}}while(_)}})});var tf=at(()=>{var ef=Et();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 p=Array(o.options.tabSize+1).join(" ");o.replaceSelection(p)}};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 p=Array(o.options.tabSize+1).join(" ");o.replaceSelection(p)}}});var of=at((rf,nf)=>{(function(o){typeof rf=="object"&&typeof nf=="object"?o(Et()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("fullScreen",!1,function(a,f,p){p==o.Init&&(p=!1),!p!=!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 p=a.state.fullScreenRestore;f.style.width=p.width,f.style.height=p.height,window.scrollTo(p.scrollLeft,p.scrollTop),a.refresh()}})});var ol=at((af,lf)=>{(function(o){typeof af=="object"&&typeof lf=="object"?o(Et()):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 p=a.indentUnit,c={},d=f.htmlMode?l:s;for(var m in d)c[m]=d[m];for(var m in f)c[m]=f[m];var y,x;function C(E,H){function W(De){return H.tokenize=De,De(E,H)}var Z=E.next();if(Z=="<")return E.eat("!")?E.eat("[")?E.match("CDATA[")?W(_("atom","]]>")):null:E.match("--")?W(_("comment","-->")):E.match("DOCTYPE",!0,!0)?(E.eatWhile(/[\w\._\-]/),W(L(1))):null:E.eat("?")?(E.eatWhile(/[\w\._\-]/),H.tokenize=_("meta","?>"),"meta"):(y=E.eat("/")?"closeTag":"openTag",H.tokenize=S,"tag bracket");if(Z=="&"){var ve;return E.eat("#")?E.eat("x")?ve=E.eatWhile(/[a-fA-F\d]/)&&E.eat(";"):ve=E.eatWhile(/[\d]/)&&E.eat(";"):ve=E.eatWhile(/[\w\.\-:]/)&&E.eat(";"),ve?"atom":"error"}else return E.eatWhile(/[^&<]/),null}C.isInText=!0;function S(E,H){var W=E.next();if(W==">"||W=="/"&&E.eat(">"))return H.tokenize=C,y=W==">"?"endTag":"selfcloseTag","tag bracket";if(W=="=")return y="equals",null;if(W=="<"){H.tokenize=C,H.state=P,H.tagName=H.tagStart=null;var Z=H.tokenize(E,H);return Z?Z+" tag error":"tag error"}else return/[\'\"]/.test(W)?(H.tokenize=A(W),H.stringStartCol=E.column(),H.tokenize(E,H)):(E.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function A(E){var H=function(W,Z){for(;!W.eol();)if(W.next()==E){Z.tokenize=S;break}return"string"};return H.isInAttribute=!0,H}function _(E,H){return function(W,Z){for(;!W.eol();){if(W.match(H)){Z.tokenize=C;break}W.next()}return E}}function L(E){return function(H,W){for(var Z;(Z=H.next())!=null;){if(Z=="<")return W.tokenize=L(E+1),W.tokenize(H,W);if(Z==">")if(E==1){W.tokenize=C;break}else return W.tokenize=L(E-1),W.tokenize(H,W)}return"meta"}}function T(E){return E&&E.toLowerCase()}function O(E,H,W){this.prev=E.context,this.tagName=H||"",this.indent=E.indented,this.startOfLine=W,(c.doNotIndent.hasOwnProperty(H)||E.context&&E.context.noIndent)&&(this.noIndent=!0)}function N(E){E.context&&(E.context=E.context.prev)}function I(E,H){for(var W;;){if(!E.context||(W=E.context.tagName,!c.contextGrabbers.hasOwnProperty(T(W))||!c.contextGrabbers[T(W)].hasOwnProperty(T(H))))return;N(E)}}function P(E,H,W){return E=="openTag"?(W.tagStart=H.column(),q):E=="closeTag"?G:P}function q(E,H,W){return E=="word"?(W.tagName=H.current(),x="tag",U):c.allowMissingTagName&&E=="endTag"?(x="tag bracket",U(E,H,W)):(x="error",q)}function G(E,H,W){if(E=="word"){var Z=H.current();return W.context&&W.context.tagName!=Z&&c.implicitlyClosed.hasOwnProperty(T(W.context.tagName))&&N(W),W.context&&W.context.tagName==Z||c.matchClosing===!1?(x="tag",K):(x="tag error",me)}else return c.allowMissingTagName&&E=="endTag"?(x="tag bracket",K(E,H,W)):(x="error",me)}function K(E,H,W){return E!="endTag"?(x="error",K):(N(W),P)}function me(E,H,W){return x="error",K(E,H,W)}function U(E,H,W){if(E=="word")return x="attribute",le;if(E=="endTag"||E=="selfcloseTag"){var Z=W.tagName,ve=W.tagStart;return W.tagName=W.tagStart=null,E=="selfcloseTag"||c.autoSelfClosers.hasOwnProperty(T(Z))?I(W,Z):(I(W,Z),W.context=new O(W,Z,ve==W.indented)),P}return x="error",U}function le(E,H,W){return E=="equals"?j:(c.allowMissing||(x="error"),U(E,H,W))}function j(E,H,W){return E=="string"?ee:E=="word"&&c.allowUnquoted?(x="string",U):(x="error",U(E,H,W))}function ee(E,H,W){return E=="string"?ee:U(E,H,W)}return{startState:function(E){var H={tokenize:C,state:P,indented:E||0,tagName:null,tagStart:null,context:null};return E!=null&&(H.baseIndent=E),H},token:function(E,H){if(!H.tagName&&E.sol()&&(H.indented=E.indentation()),E.eatSpace())return null;y=null;var W=H.tokenize(E,H);return(W||y)&&W!="comment"&&(x=null,H.state=H.state(y||W,E,H),x&&(W=x=="error"?W+" error":x)),W},indent:function(E,H,W){var Z=E.context;if(E.tokenize.isInAttribute)return E.tagStart==E.indented?E.stringStartCol+1:E.indented+p;if(Z&&Z.noIndent)return o.Pass;if(E.tokenize!=S&&E.tokenize!=C)return W?W.match(/^(\s*)/)[0].length:0;if(E.tagName)return c.multilineTagIndentPastTag!==!1?E.tagStart+E.tagName.length+2:E.tagStart+p*(c.multilineTagIndentFactor||1);if(c.alignCDATA&&/<!\[CDATA\[/.test(H))return 0;var ve=H&&/^<(\/)?([\w_:\.-]*)/.exec(H);if(ve&&ve[1])for(;Z;)if(Z.tagName==ve[2]){Z=Z.prev;break}else if(c.implicitlyClosed.hasOwnProperty(T(Z.tagName)))Z=Z.prev;else break;else if(ve)for(;Z;){var De=c.contextGrabbers[T(Z.tagName)];if(De&&De.hasOwnProperty(T(ve[2])))Z=Z.prev;else break}for(;Z&&Z.prev&&!Z.startOfLine;)Z=Z.prev;return Z?Z.indent+p:E.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"<!--",blockCommentEnd:"-->",configuration:c.htmlMode?"html":"xml",helperType:c.htmlMode?"html":"xml",skipAttribute:function(E){E.state==j&&(E.state=U)},xmlCurrentTag:function(E){return E.tagName?{name:E.tagName,close:E.type=="closeTag"}:null},xmlCurrentContext:function(E){for(var H=[],W=E.context;W;W=W.prev)H.push(W.tagName);return H.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(Et()):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 p=o.modeInfo[f];if(p.mime==a)return p;if(p.mimes){for(var c=0;c<p.mimes.length;c++)if(p.mimes[c]==a)return p}}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 p=o.modeInfo[f];if(p.ext){for(var c=0;c<p.ext.length;c++)if(p.ext[c]==a)return p}}},o.findModeByFileName=function(a){for(var f=0;f<o.modeInfo.length;f++){var p=o.modeInfo[f];if(p.file&&p.file.test(a))return p}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 p=o.modeInfo[f];if(p.name.toLowerCase()==a)return p;if(p.alias){for(var c=0;c<p.alias.length;c++)if(p.alias[c].toLowerCase()==a)return p}}}})});var al=at((cf,df)=>{(function(o){typeof cf=="object"&&typeof df=="object"?o(Et(),ol(),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 p(F){if(o.findModeByName){var D=o.findModeByName(F);D&&(F=D.mime||D.mimes[0])}var te=o.getMode(l,F);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 m=/^([*\-_])(?:\s*\1){2,}\s*$/,y=/^(?:[*\-+]|^[0-9]+([.)]))\s+/,x=/^\[(x| )\](?=\s)/i,C=s.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,S=/^ {0,3}(?:\={1,}|-{2,})\s*$/,A=/^[^#!\[\]*_\\<>` "'(~:]+/,_=/^(~~~+|```+)[ \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]/,O=" ";function N(F,D,te){return D.f=D.inline=te,te(F,D)}function I(F,D,te){return D.f=D.block=te,te(F,D)}function P(F){return!F||!/\S/.test(F.string)}function q(F){if(F.linkTitle=!1,F.linkHref=!1,F.linkText=!1,F.em=!1,F.strong=!1,F.strikethrough=!1,F.quote=0,F.indentedCode=!1,F.f==K){var D=f;if(!D){var te=o.innerMode(a,F.htmlState);D=te.mode.name=="xml"&&te.state.tagStart===null&&!te.state.context&&te.state.tokenize.isInText}D&&(F.f=j,F.block=G,F.htmlState=null)}return F.trailingSpace=0,F.trailingSpaceNewLine=!1,F.prevLine=F.thisLine,F.thisLine={stream:null},null}function G(F,D){var te=F.column()===D.indentation,we=P(D.prevLine.stream),ye=D.indentedCode,gt=D.prevLine.hr,Tt=D.list!==!1,Ye=(D.listStack[D.listStack.length-1]||0)+3;D.indentedCode=!1;var ft=D.indentation;if(D.indentationDiff===null&&(D.indentationDiff=D.indentation,Tt)){for(D.list=null;ft<D.listStack[D.listStack.length-1];)D.listStack.pop(),D.listStack.length?D.indentation=D.listStack[D.listStack.length-1]:D.list=!1;D.list!==!1&&(D.indentationDiff=ft-D.listStack[D.listStack.length-1])}var Ne=!we&&!gt&&!D.prevLine.header&&(!Tt||!ye)&&!D.prevLine.fencedCodeEnd,He=(D.list===!1||gt||we)&&D.indentation<=Ye&&F.match(m),Ze=null;if(D.indentationDiff>=4&&(ye||D.prevLine.fencedCodeEnd||D.prevLine.header||we))return F.skipToEnd(),D.indentedCode=!0,c.code;if(F.eatSpace())return null;if(te&&D.indentation<=Ye&&(Ze=F.match(C))&&Ze[1].length<=6)return D.quote=0,D.header=Ze[1].length,D.thisLine.header=!0,s.highlightFormatting&&(D.formatting="header"),D.f=D.inline,U(D);if(D.indentation<=Ye&&F.eat(">"))return D.quote=te?1:D.quote+1,s.highlightFormatting&&(D.formatting="quote"),F.eatSpace(),U(D);if(!He&&!D.setext&&te&&D.indentation<=Ye&&(Ze=F.match(y))){var vt=Ze[1]?"ol":"ul";return D.indentation=ft+F.current().length,D.list=!0,D.quote=0,D.listStack.push(D.indentation),D.em=!1,D.strong=!1,D.code=!1,D.strikethrough=!1,s.taskLists&&F.match(x,!1)&&(D.taskList=!0),D.f=D.inline,s.highlightFormatting&&(D.formatting=["list","list-"+vt]),U(D)}else{if(te&&D.indentation<=Ye&&(Ze=F.match(_,!0)))return D.quote=0,D.fencedEndRE=new RegExp(Ze[1]+"+ *$"),D.localMode=s.fencedCodeBlockHighlighting&&p(Ze[2]||s.fencedCodeBlockDefaultMode),D.localMode&&(D.localState=o.startState(D.localMode)),D.f=D.block=me,s.highlightFormatting&&(D.formatting="code-block"),D.code=-1,U(D);if(D.setext||(!Ne||!Tt)&&!D.quote&&D.list===!1&&!D.code&&!He&&!L.test(F.string)&&(Ze=F.lookAhead(1))&&(Ze=Ze.match(S)))return D.setext?(D.header=D.setext,D.setext=0,F.skipToEnd(),s.highlightFormatting&&(D.formatting="header")):(D.header=Ze[0].charAt(0)=="="?1:2,D.setext=D.header),D.thisLine.header=!0,D.f=D.inline,U(D);if(He)return F.skipToEnd(),D.hr=!0,D.thisLine.hr=!0,c.hr;if(F.peek()==="[")return N(F,D,Z)}return N(F,D,D.inline)}function K(F,D){var te=a.token(F,D.htmlState);if(!f){var we=o.innerMode(a,D.htmlState);(we.mode.name=="xml"&&we.state.tagStart===null&&!we.state.context&&we.state.tokenize.isInText||D.md_inside&&F.current().indexOf(">")>-1)&&(D.f=j,D.block=G,D.htmlState=null)}return te}function me(F,D){var te=D.listStack[D.listStack.length-1]||0,we=D.indentation<te,ye=te+3;if(D.fencedEndRE&&D.indentation<=ye&&(we||F.match(D.fencedEndRE))){s.highlightFormatting&&(D.formatting="code-block");var gt;return we||(gt=U(D)),D.localMode=D.localState=null,D.block=G,D.f=j,D.fencedEndRE=null,D.code=0,D.thisLine.fencedCodeEnd=!0,we?I(F,D,D.block):gt}else return D.localMode?D.localMode.token(F,D.localState):(F.skipToEnd(),c.code)}function U(F){var D=[];if(F.formatting){D.push(c.formatting),typeof F.formatting=="string"&&(F.formatting=[F.formatting]);for(var te=0;te<F.formatting.length;te++)D.push(c.formatting+"-"+F.formatting[te]),F.formatting[te]==="header"&&D.push(c.formatting+"-"+F.formatting[te]+"-"+F.header),F.formatting[te]==="quote"&&(!s.maxBlockquoteDepth||s.maxBlockquoteDepth>=F.quote?D.push(c.formatting+"-"+F.formatting[te]+"-"+F.quote):D.push("error"))}if(F.taskOpen)return D.push("meta"),D.length?D.join(" "):null;if(F.taskClosed)return D.push("property"),D.length?D.join(" "):null;if(F.linkHref?D.push(c.linkHref,"url"):(F.strong&&D.push(c.strong),F.em&&D.push(c.em),F.strikethrough&&D.push(c.strikethrough),F.emoji&&D.push(c.emoji),F.linkText&&D.push(c.linkText),F.code&&D.push(c.code),F.image&&D.push(c.image),F.imageAltText&&D.push(c.imageAltText,"link"),F.imageMarker&&D.push(c.imageMarker)),F.header&&D.push(c.header,c.header+"-"+F.header),F.quote&&(D.push(c.quote),!s.maxBlockquoteDepth||s.maxBlockquoteDepth>=F.quote?D.push(c.quote+"-"+F.quote):D.push(c.quote+"-"+s.maxBlockquoteDepth)),F.list!==!1){var we=(F.listStack.length-1)%3;we?we===1?D.push(c.list2):D.push(c.list3):D.push(c.list1)}return F.trailingSpaceNewLine?D.push("trailing-space-new-line"):F.trailingSpace&&D.push("trailing-space-"+(F.trailingSpace%2?"a":"b")),D.length?D.join(" "):null}function le(F,D){if(F.match(A,!0))return U(D)}function j(F,D){var te=D.text(F,D);if(typeof te<"u")return te;if(D.list)return D.list=null,U(D);if(D.taskList){var we=F.match(x,!0)[1]===" ";return we?D.taskOpen=!0:D.taskClosed=!0,s.highlightFormatting&&(D.formatting="task"),D.taskList=!1,U(D)}if(D.taskOpen=!1,D.taskClosed=!1,D.header&&F.match(/^#+$/,!0))return s.highlightFormatting&&(D.formatting="header"),U(D);var ye=F.next();if(D.linkTitle){D.linkTitle=!1;var gt=ye;ye==="("&&(gt=")"),gt=(gt+"").replace(/([.?*+^\[\]\\(){}|-])/g,"\\$1");var Tt="^\\s*(?:[^"+gt+"\\\\]+|\\\\\\\\|\\\\.)"+gt;if(F.match(new RegExp(Tt),!0))return c.linkHref}if(ye==="`"){var Ye=D.formatting;s.highlightFormatting&&(D.formatting="code"),F.eatWhile("`");var ft=F.current().length;if(D.code==0&&(!D.quote||ft==1))return D.code=ft,U(D);if(ft==D.code){var Ne=U(D);return D.code=0,Ne}else return D.formatting=Ye,U(D)}else if(D.code)return U(D);if(ye==="\\"&&(F.next(),s.highlightFormatting)){var He=U(D),Ze=c.formatting+"-escape";return He?He+" "+Ze:Ze}if(ye==="!"&&F.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return D.imageMarker=!0,D.image=!0,s.highlightFormatting&&(D.formatting="image"),U(D);if(ye==="["&&D.imageMarker&&F.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/,!1))return D.imageMarker=!1,D.imageAltText=!0,s.highlightFormatting&&(D.formatting="image"),U(D);if(ye==="]"&&D.imageAltText){s.highlightFormatting&&(D.formatting="image");var He=U(D);return D.imageAltText=!1,D.image=!1,D.inline=D.f=E,He}if(ye==="["&&!D.image)return D.linkText&&F.match(/^.*?\]/)||(D.linkText=!0,s.highlightFormatting&&(D.formatting="link")),U(D);if(ye==="]"&&D.linkText){s.highlightFormatting&&(D.formatting="link");var He=U(D);return D.linkText=!1,D.inline=D.f=F.match(/\(.*?\)| ?\[.*?\]/,!1)?E:j,He}if(ye==="<"&&F.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){D.f=D.inline=ee,s.highlightFormatting&&(D.formatting="link");var He=U(D);return He?He+=" ":He="",He+c.linkInline}if(ye==="<"&&F.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){D.f=D.inline=ee,s.highlightFormatting&&(D.formatting="link");var He=U(D);return He?He+=" ":He="",He+c.linkEmail}if(s.xml&&ye==="<"&&F.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i,!1)){var vt=F.string.indexOf(">",F.pos);if(vt!=-1){var Tn=F.string.substring(F.start,vt);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(Tn)&&(D.md_inside=!0)}return F.backUp(1),D.htmlState=o.startState(a),I(F,D,K)}if(s.xml&&ye==="<"&&F.match(/^\/\w*?>/))return D.md_inside=!1,"tag";if(ye==="*"||ye==="_"){for(var Xt=1,Kt=F.pos==1?" ":F.string.charAt(F.pos-2);Xt<3&&F.eat(ye);)Xt++;var zt=F.peek()||" ",pr=!/\s/.test(zt)&&(!T.test(zt)||/\s/.test(Kt)||T.test(Kt)),Ce=!/\s/.test(Kt)&&(!T.test(Kt)||/\s/.test(zt)||T.test(zt)),Ht=null,gr=null;if(Xt%2&&(!D.em&&pr&&(ye==="*"||!Ce||T.test(Kt))?Ht=!0:D.em==ye&&Ce&&(ye==="*"||!pr||T.test(zt))&&(Ht=!1)),Xt>1&&(!D.strong&&pr&&(ye==="*"||!Ce||T.test(Kt))?gr=!0:D.strong==ye&&Ce&&(ye==="*"||!pr||T.test(zt))&&(gr=!1)),gr!=null||Ht!=null){s.highlightFormatting&&(D.formatting=Ht==null?"strong":gr==null?"em":"strong em"),Ht===!0&&(D.em=ye),gr===!0&&(D.strong=ye);var Ne=U(D);return Ht===!1&&(D.em=!1),gr===!1&&(D.strong=!1),Ne}}else if(ye===" "&&(F.eat("*")||F.eat("_"))){if(F.peek()===" ")return U(D);F.backUp(1)}if(s.strikethrough){if(ye==="~"&&F.eatWhile(ye)){if(D.strikethrough){s.highlightFormatting&&(D.formatting="strikethrough");var Ne=U(D);return D.strikethrough=!1,Ne}else if(F.match(/^[^\s]/,!1))return D.strikethrough=!0,s.highlightFormatting&&(D.formatting="strikethrough"),U(D)}else if(ye===" "&&F.match("~~",!0)){if(F.peek()===" ")return U(D);F.backUp(2)}}if(s.emoji&&ye===":"&&F.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)){D.emoji=!0,s.highlightFormatting&&(D.formatting="emoji");var wi=U(D);return D.emoji=!1,wi}return ye===" "&&(F.match(/^ +$/,!1)?D.trailingSpace++:D.trailingSpace&&(D.trailingSpaceNewLine=!0)),U(D)}function ee(F,D){var te=F.next();if(te===">"){D.f=D.inline=j,s.highlightFormatting&&(D.formatting="link");var we=U(D);return we?we+=" ":we="",we+c.linkInline}return F.match(/^[^>]+/,!0),c.linkInline}function E(F,D){if(F.eatSpace())return null;var te=F.next();return te==="("||te==="["?(D.f=D.inline=W(te==="("?")":"]"),s.highlightFormatting&&(D.formatting="link-string"),D.linkHref=!0,U(D)):"error"}var H={")":/^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,"]":/^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/};function W(F){return function(D,te){var we=D.next();if(we===F){te.f=te.inline=j,s.highlightFormatting&&(te.formatting="link-string");var ye=U(te);return te.linkHref=!1,ye}return D.match(H[F]),te.linkHref=!0,U(te)}}function Z(F,D){return F.match(/^([^\]\\]|\\.)*\]:/,!1)?(D.f=ve,F.next(),s.highlightFormatting&&(D.formatting="link"),D.linkText=!0,U(D)):N(F,D,j)}function ve(F,D){if(F.match("]:",!0)){D.f=D.inline=De,s.highlightFormatting&&(D.formatting="link");var te=U(D);return D.linkText=!1,te}return F.match(/^([^\]\\]|\\.)+/,!0),c.linkText}function De(F,D){return F.eatSpace()?null:(F.match(/^[^\s]+/,!0),F.peek()===void 0?D.linkTitle=!0:F.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/,!0),D.f=D.inline=j,c.linkHref+" url")}var Le={startState:function(){return{f:G,prevLine:{stream:null},thisLine:{stream:null},block:G,htmlState:null,indentation:0,inline:j,text:le,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(F){return{f:F.f,prevLine:F.prevLine,thisLine:F.thisLine,block:F.block,htmlState:F.htmlState&&o.copyState(a,F.htmlState),indentation:F.indentation,localMode:F.localMode,localState:F.localMode?o.copyState(F.localMode,F.localState):null,inline:F.inline,text:F.text,formatting:!1,linkText:F.linkText,linkTitle:F.linkTitle,linkHref:F.linkHref,code:F.code,em:F.em,strong:F.strong,strikethrough:F.strikethrough,emoji:F.emoji,header:F.header,setext:F.setext,hr:F.hr,taskList:F.taskList,list:F.list,listStack:F.listStack.slice(0),quote:F.quote,indentedCode:F.indentedCode,trailingSpace:F.trailingSpace,trailingSpaceNewLine:F.trailingSpaceNewLine,md_inside:F.md_inside,fencedEndRE:F.fencedEndRE}},token:function(F,D){if(D.formatting=!1,F!=D.thisLine.stream){if(D.header=0,D.hr=!1,F.match(/^\s*$/,!0))return q(D),null;if(D.prevLine=D.thisLine,D.thisLine={stream:F},D.taskList=!1,D.trailingSpace=0,D.trailingSpaceNewLine=!1,!D.localState&&(D.f=D.block,D.f!=K)){var te=F.match(/^\s*/,!0)[0].replace(/\t/g,O).length;if(D.indentation=te,D.indentationDiff=null,te>0)return null}}return D.f(F,D)},innerMode:function(F){return F.block==K?{state:F.htmlState,mode:a}:F.localState?{state:F.localState,mode:F.localMode}:{state:F,mode:Le}},indent:function(F,D,te){return F.block==K&&a.indent?a.indent(F.htmlState,D,te):F.localState&&F.localMode.indent?F.localMode.indent(F.localState,D,te):o.Pass},blankLine:q,getType:U,blockCommentStart:"<!--",blockCommentEnd:"-->",closeBrackets:"()[]{}''\"\"``",fold:"markdown"};return Le},"xml"),o.defineMIME("text/markdown","markdown"),o.defineMIME("text/x-markdown","markdown")})});var ll=at((hf,pf)=>{(function(o){typeof hf=="object"&&typeof pf=="object"?o(Et()):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,p){return(f!=p.streamSeen||Math.min(p.basePos,p.overlayPos)<f.start)&&(p.streamSeen=f,p.basePos=p.overlayPos=f.start),f.start==p.basePos&&(p.baseCur=l.token(f,p.base),p.basePos=f.pos),f.start==p.overlayPos&&(f.pos=f.start,p.overlayCur=s.token(f,p.overlay),p.overlayPos=f.pos),f.pos=Math.min(p.basePos,p.overlayPos),p.overlayCur==null?p.baseCur:p.baseCur!=null&&p.overlay.combineTokens||a&&p.overlay.combineTokens==null?p.baseCur+" "+p.overlayCur:p.overlayCur},indent:l.indent&&function(f,p,c){return l.indent(f.base,p,c)},electricChars:l.electricChars,innerMode:function(f){return{state:f.base,mode:l}},blankLine:function(f){var p,c;return l.blankLine&&(p=l.blankLine(f.base)),s.blankLine&&(c=s.blankLine(f.overlay)),c==null?p:a&&p!=null?p+" "+c:c}}}})});var mf=at((gf,vf)=>{(function(o){typeof gf=="object"&&typeof vf=="object"?o(Et()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){o.defineOption("placeholder","",function(d,m,y){var x=y&&y!=o.Init;if(m&&!x)d.on("blur",f),d.on("change",p),d.on("swapDoc",p),o.on(d.getInputField(),"compositionupdate",d.state.placeholderCompose=function(){a(d)}),p(d);else if(!m&&x){d.off("blur",f),d.off("change",p),d.off("swapDoc",p),o.off(d.getInputField(),"compositionupdate",d.state.placeholderCompose),l(d);var C=d.getWrapperElement();C.className=C.className.replace(" CodeMirror-empty","")}m&&!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 m=d.state.placeholder=document.createElement("pre");m.style.cssText="height: 0; overflow: visible",m.style.direction=d.getOption("direction"),m.className="CodeMirror-placeholder CodeMirror-line-like";var y=d.getOption("placeholder");typeof y=="string"&&(y=document.createTextNode(y)),m.appendChild(y),d.display.lineSpace.insertBefore(m,d.display.lineSpace.firstChild)}function a(d){setTimeout(function(){var m=!1;if(d.lineCount()==1){var y=d.getInputField();m=y.nodeName=="TEXTAREA"?!d.getLine(0).length:!/[^\u200b]/.test(y.querySelector(".CodeMirror-line").textContent)}m?s(d):l(d)},20)}function f(d){c(d)&&s(d)}function p(d){var m=d.getWrapperElement(),y=c(d);m.className=m.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(Et()):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 p(){a.display.wrapper.offsetHeight?(s(a,f),a.display.lastWrapHeight!=a.display.wrapper.clientHeight&&a.refresh()):f.timeout=setTimeout(p,f.delay)}f.timeout=setTimeout(p,f.delay),f.hurry=function(){clearTimeout(f.timeout),f.timeout=setTimeout(p,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 Cf=at((Df,wf)=>{(function(o){typeof Df=="object"&&typeof wf=="object"?o(Et()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";o.defineOption("styleSelectedText",!1,function(x,C,S){var A=S&&S!=o.Init;C&&!A?(x.state.markedSelection=[],x.state.markedSelectionStyle=typeof C=="string"?C:"CodeMirror-selectedtext",m(x),x.on("cursorActivity",l),x.on("change",s)):!C&&A&&(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,p=o.cmpPos;function c(x,C,S,A){if(p(C,S)!=0)for(var _=x.state.markedSelection,L=x.state.markedSelectionStyle,T=C.line;;){var O=T==C.line?C:f(T,0),N=T+a,I=N>=S.line,P=I?S:f(N,0),q=x.markText(O,P,{className:L});if(A==null?_.push(q):_.splice(A++,0,q),I)break;T=N}}function d(x){for(var C=x.state.markedSelection,S=0;S<C.length;++S)C[S].clear();C.length=0}function m(x){d(x);for(var C=x.listSelections(),S=0;S<C.length;S++)c(x,C[S].from(),C[S].to())}function y(x){if(!x.somethingSelected())return d(x);if(x.listSelections().length>1)return m(x);var C=x.getCursor("start"),S=x.getCursor("end"),A=x.state.markedSelection;if(!A.length)return c(x,C,S);var _=A[0].find(),L=A[A.length-1].find();if(!_||!L||S.line-C.line<=a||p(C,L.to)>=0||p(S,_.from)<=0)return m(x);for(;p(C,_.from)>0;)A.shift().clear(),_=A[0].find();for(p(C,_.from)<0&&(_.to.line-C.line<a?(A.shift().clear(),c(x,C,_.to,0)):c(x,C,_.from,0));p(S,L.to)<0;)A.pop().clear(),L=A[A.length-1].find();p(S,L.to)>0&&(S.line-L.from.line<a?(A.pop().clear(),c(x,L.from,S)):c(x,L.to,S))}})});var Ef=at((kf,Sf)=>{(function(o){typeof kf=="object"&&typeof Sf=="object"?o(Et()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)})(function(o){"use strict";var l=o.Pos;function s(T){var O=T.flags;return O??(T.ignoreCase?"i":"")+(T.global?"g":"")+(T.multiline?"m":"")}function a(T,O){for(var N=s(T),I=N,P=0;P<O.length;P++)I.indexOf(O.charAt(P))==-1&&(I+=O.charAt(P));return N==I?T:new RegExp(T.source,I)}function f(T){return/\\s|\\n|\n|\\W|\\D|\[\^/.test(T.source)}function p(T,O,N){O=a(O,"g");for(var I=N.line,P=N.ch,q=T.lastLine();I<=q;I++,P=0){O.lastIndex=P;var G=T.getLine(I),K=O.exec(G);if(K)return{from:l(I,K.index),to:l(I,K.index+K[0].length),match:K}}}function c(T,O,N){if(!f(O))return p(T,O,N);O=a(O,"gm");for(var I,P=1,q=N.line,G=T.lastLine();q<=G;){for(var K=0;K<P&&!(q>G);K++){var me=T.getLine(q++);I=I==null?me:I+`
|
|
`+me}P=P*2,O.lastIndex=N.ch;var U=O.exec(I);if(U){var le=I.slice(0,U.index).split(`
|
|
`),j=U[0].split(`
|
|
`),ee=N.line+le.length-1,E=le[le.length-1].length;return{from:l(ee,E),to:l(ee+j.length-1,j.length==1?E+j[0].length:j[j.length-1].length),match:U}}}}function d(T,O,N){for(var I,P=0;P<=T.length;){O.lastIndex=P;var q=O.exec(T);if(!q)break;var G=q.index+q[0].length;if(G>T.length-N)break;(!I||G>I.index+I[0].length)&&(I=q),P=q.index+1}return I}function m(T,O,N){O=a(O,"g");for(var I=N.line,P=N.ch,q=T.firstLine();I>=q;I--,P=-1){var G=T.getLine(I),K=d(G,O,P<0?0:G.length-P);if(K)return{from:l(I,K.index),to:l(I,K.index+K[0].length),match:K}}}function y(T,O,N){if(!f(O))return m(T,O,N);O=a(O,"gm");for(var I,P=1,q=T.getLine(N.line).length-N.ch,G=N.line,K=T.firstLine();G>=K;){for(var me=0;me<P&&G>=K;me++){var U=T.getLine(G--);I=I==null?U:U+`
|
|
`+I}P*=2;var le=d(I,O,q);if(le){var j=I.slice(0,le.index).split(`
|
|
`),ee=le[0].split(`
|
|
`),E=G+j.length,H=j[j.length-1].length;return{from:l(E,H),to:l(E+ee.length-1,ee.length==1?H+ee[0].length:ee[ee.length-1].length),match:le}}}}var x,C;String.prototype.normalize?(x=function(T){return T.normalize("NFD").toLowerCase()},C=function(T){return T.normalize("NFD")}):(x=function(T){return T.toLowerCase()},C=function(T){return T});function S(T,O,N,I){if(T.length==O.length)return N;for(var P=0,q=N+Math.max(0,T.length-O.length);;){if(P==q)return P;var G=P+q>>1,K=I(T.slice(0,G)).length;if(K==N)return G;K>N?q=G:P=G+1}}function A(T,O,N,I){if(!O.length)return null;var P=I?x:C,q=P(O).split(/\r|\n\r?/);e:for(var G=N.line,K=N.ch,me=T.lastLine()+1-q.length;G<=me;G++,K=0){var U=T.getLine(G).slice(K),le=P(U);if(q.length==1){var j=le.indexOf(q[0]);if(j==-1)continue e;var N=S(U,le,j,P)+K;return{from:l(G,S(U,le,j,P)+K),to:l(G,S(U,le,j+q[0].length,P)+K)}}else{var ee=le.length-q[0].length;if(le.slice(ee)!=q[0])continue e;for(var E=1;E<q.length-1;E++)if(P(T.getLine(G+E))!=q[E])continue e;var H=T.getLine(G+q.length-1),W=P(H),Z=q[q.length-1];if(W.slice(0,Z.length)!=Z)continue e;return{from:l(G,S(U,le,ee,P)+K),to:l(G+q.length-1,S(H,W,Z.length,P))}}}}function _(T,O,N,I){if(!O.length)return null;var P=I?x:C,q=P(O).split(/\r|\n\r?/);e:for(var G=N.line,K=N.ch,me=T.firstLine()-1+q.length;G>=me;G--,K=-1){var U=T.getLine(G);K>-1&&(U=U.slice(0,K));var le=P(U);if(q.length==1){var j=le.lastIndexOf(q[0]);if(j==-1)continue e;return{from:l(G,S(U,le,j,P)),to:l(G,S(U,le,j+q[0].length,P))}}else{var ee=q[q.length-1];if(le.slice(0,ee.length)!=ee)continue e;for(var E=1,N=G-q.length+1;E<q.length-1;E++)if(P(T.getLine(N+E))!=q[E])continue e;var H=T.getLine(G+1-q.length),W=P(H);if(W.slice(W.length-q[0].length)!=q[0])continue e;return{from:l(G+1-q.length,S(H,W,H.length-q[0].length,P)),to:l(G,S(U,le,ee.length,P))}}}}function L(T,O,N,I){this.atOccurrence=!1,this.afterEmptyMatch=!1,this.doc=T,N=N?T.clipPos(N):l(0,0),this.pos={from:N,to:N};var P;typeof I=="object"?P=I.caseFold:(P=I,I=null),typeof O=="string"?(P==null&&(P=!1),this.matches=function(q,G){return(q?_:A)(T,O,G,P)}):(O=a(O,"gm"),!I||I.multiline!==!1?this.matches=function(q,G){return(q?y:c)(T,O,G)}:this.matches=function(q,G){return(q?m:p)(T,O,G)})}L.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(T){var O=this.doc.clipPos(T?this.pos.from:this.pos.to);if(this.afterEmptyMatch&&this.atOccurrence&&(O=l(O.line,O.ch),T?(O.ch--,O.ch<0&&(O.line--,O.ch=(this.doc.getLine(O.line)||"").length)):(O.ch++,O.ch>(this.doc.getLine(O.line)||"").length&&(O.ch=0,O.line++)),o.cmpPos(O,this.doc.clipPos(O))!=0))return this.atOccurrence=!1;var N=this.matches(T,O);if(this.afterEmptyMatch=N&&o.cmpPos(N.from,N.to)==0,N)return this.pos=N,this.atOccurrence=!0,this.pos.match||!0;var I=l(T?this.doc.firstLine():this.doc.lastLine()+1,0);return this.pos={from:I,to:I},this.atOccurrence=!1},from:function(){if(this.atOccurrence)return this.pos.from},to:function(){if(this.atOccurrence)return this.pos.to},replace:function(T,O){if(this.atOccurrence){var N=o.splitLines(T);this.doc.replaceRange(N,this.pos.from,this.pos.to,O),this.pos.to=l(this.pos.from.line+N.length-1,N[N.length-1].length+(N.length==1?this.pos.from.ch:0))}}},o.defineExtension("getSearchCursor",function(T,O,N){return new L(this.doc,T,O,N)}),o.defineDocExtension("getSearchCursor",function(T,O,N){return new L(this,T,O,N)}),o.defineExtension("selectMatches",function(T,O){for(var N=[],I=this.getSearchCursor(T,this.getCursor("from"),O);I.findNext()&&!(o.cmpPos(I.to(),this.getCursor("to"))>0);)N.push({anchor:I.from(),head:I.to()});N.length&&this.setSelections(N,0)})})});var Tf=at((Af,Ff)=>{(function(o){typeof Af=="object"&&typeof Ff=="object"?o(Et(),al(),ll()):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 p(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 C=y.pos;y.eatWhile("`");var S=1+y.pos-C;return x.code?S===f&&(x.code=!1):(f=S,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:p},d={taskLists:!0,strikethrough:!0,emoji:!0};for(var m in a)d[m]=a[m];return d.name="markdown",o.overlayMode(o.getMode(s,d),c)},"markdown"),o.defineMIME("text/x-gfm","gfm")})});var Lf=at(()=>{});var Mf=at((Ig,ul)=>{var sl;(function(){"use strict";sl=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,p,c,d,m,y;o&&(f.dictionary=o,l&&s?A():(typeof window<"u"?(a.dictionaryPath?p=a.dictionaryPath:p="typo/dictionaries",window.chrome&&window.chrome.runtime&&window.chrome.runtime.getURL?p=window.chrome.runtime.getURL(p):window.browser&&window.browser.runtime&&window.browser.runtime.getURL&&(p=window.browser.runtime.getURL(p))):typeof __dirname<"u"?p=__dirname+"/dictionaries":p="./dictionaries",l||x(p+"/"+o+"/"+o+".aff",C),s||x(p+"/"+o+"/"+o+".dic",S)));function x(_,L){var T=f._readFile(_,null,a?.asyncLoad);a?.asyncLoad?T.then(function(O){L(O)}):L(T)}function C(_){l=_,s&&A()}function S(_){s=_,l&&A()}function A(){for(f.rules=f._parseAFF(l),f.compoundRuleCodes={},c=0,m=f.compoundRules.length;c<m;c++){var _=f.compoundRules[c];for(d=0,y=_.length;d<y;d++)f.compoundRuleCodes[_[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,m=f.compoundRules.length;c<m;c++){var L=f.compoundRules[c],T="";for(d=0,y=L.length;d<y;d++){var O=L[d];O in f.compoundRuleCodes?T+="("+f.compoundRuleCodes[O].join("|")+")":T+=O}f.compoundRules[c]=new RegExp("^"+T+"$","i")}f.loaded=!0,a?.asyncLoad&&a?.loadedCallback&&a.loadedCallback(f)}return this},sl.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 p=new Promise(function(d,m){f.onload=function(){f.status===200?d(f.responseText):m(f.statusText)},f.onerror=function(){m(f.statusText)}});return f.send(null),p}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,p,c,d,m,y,x=o.split(/\r?\n/);for(c=0,m=x.length;c<m;c++)if(s=this._removeAffixComments(x[c]),s=s.trim(),!!s){var C=s.split(/\s+/),S=C[0];if(S==="PFX"||S==="SFX"){var A=C[1],_=C[2];f=parseInt(C[3],10);var L=[];for(d=c+1,y=c+1+f;d<y;d++){a=x[d],p=a.split(/\s+/);var T=p[2],O=p[3].split("/"),N=O[0];N==="0"&&(N="");var I=this.parseRuleCodes(O[1]),P=p[4],q={add:N};I.length>0&&(q.continuationClasses=I),P!=="."&&(S==="SFX"?q.match=new RegExp(P+"$"):q.match=new RegExp("^"+P)),T!="0"&&(S==="SFX"?q.remove=new RegExp(T+"$"):q.remove=T),L.push(q)}l[A]={type:S,combineable:_==="Y",entries:L},c+=f}else if(S==="COMPOUNDRULE"){for(f=parseInt(C[1],10),d=c+1,y=c+1+f;d<y;d++)s=x[d],p=s.split(/\s+/),this.compoundRules.push(p[1]);c+=f}else S==="REP"?(p=s.split(/\s+/),p.length===3&&this.replacementTable.push([p[1],p[2]])):this.flags[S]=C[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(le,j){s.has(le)||s.set(le,null),j.length>0&&(s.get(le)===null&&s.set(le,[]),s.get(le).push(j))}for(var f=1,p=l.length;f<p;f++){var c=l[f];if(c){var d=c.replace(/\s.*$/,""),m=d.split("/",2),y=m[0];if(m.length>1){var x=this.parseRuleCodes(m[1]);(!("NEEDAFFIX"in this.flags)||x.indexOf(this.flags.NEEDAFFIX)===-1)&&a(y,x);for(var C=0,S=x.length;C<S;C++){var A=x[C],_=this.rules[A];if(_)for(var L=this._applyRule(y,_),T=0,O=L.length;T<O;T++){var N=L[T];if(a(N,[]),_.combineable)for(var I=C+1;I<S;I++){var P=x[I],q=this.rules[P];if(q&&q.combineable&&_.type!=q.type)for(var G=this._applyRule(N,q),K=0,me=G.length;K<me;K++){var U=G[K];a(U,[])}}}A in this.compoundRuleCodes&&this.compoundRuleCodes[A].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,p=s.length;f<p;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 m=0,y=c.continuationClasses.length;m<y;m++){var x=this.rules[c.continuationClasses[m]];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 p=this.replacementTable[a];if(o.indexOf(p[0])!==-1){var c=o.replace(p[0],p[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 m={},a=0;a<d.length;a++)m[d[a]]=!0;this.alphabet="";for(var a in m)this.alphabet+=a}var y=this;function x(S,A){var _={},L,T,O,N,I,P,q=y.alphabet.length;for(var G in S)for(L=0,N=G.length+1;L<N;L++){var K=[G.substring(0,L),G.substring(L)];if(K[1]&&(P=K[0]+K[1].substring(1),(!A||y.check(P))&&(P in _?_[P]+=1:_[P]=1)),K[1].length>1&&K[1][1]!==K[1][0]&&(P=K[0]+K[1][1]+K[1][0]+K[1].substring(2),(!A||y.check(P))&&(P in _?_[P]+=1:_[P]=1)),K[1]){var me=K[1].substring(0,1).toUpperCase()===K[1].substring(0,1)?"uppercase":"lowercase";for(T=0;T<q;T++){var U=y.alphabet[T];me==="uppercase"&&(U=U.toUpperCase()),U!=K[1].substring(0,1)&&(P=K[0]+U+K[1].substring(1),(!A||y.check(P))&&(P in _?_[P]+=1:_[P]=1))}}if(K[1])for(T=0;T<q;T++){var me=K[0].substring(-1).toUpperCase()===K[0].substring(-1)&&K[1].substring(0,1).toUpperCase()===K[1].substring(0,1)?"uppercase":"lowercase",U=y.alphabet[T];me==="uppercase"&&(U=U.toUpperCase()),P=K[0]+U+K[1],(!A||y.check(P))&&(P in _?_[P]+=1:_[P]=1)}}return _}function C(S){var A,_=x((A={},A[S]=!0,A)),L=x(_,!0),T=L;for(var O in _)y.check(O)&&(O in T?T[O]+=_[O]:T[O]=_[O]);var N,I,P=[];for(N in T)T.hasOwnProperty(N)&&(y.hasFlag(N,"PRIORITYSUGGEST")&&(T[N]+=1e3),P.push([N,T[N]]));function q(U,le){var j=U[1],ee=le[1];return j<ee?-1:j>ee?1:le[0].localeCompare(U[0])}P.sort(q).reverse();var G=[],K="lowercase";S.toUpperCase()===S?K="uppercase":S.substr(0,1).toUpperCase()+S.substr(1).toLowerCase()===S&&(K="capitalized");var me=l;for(N=0;N<Math.min(me,P.length);N++)K==="uppercase"?P[N][0]=P[N][0].toUpperCase():K==="capitalized"&&(P[N][0]=P[N][0].substr(0,1).toUpperCase()+P[N][0].substr(1)),!y.hasFlag(P[N][0],"NOSUGGEST")&&G.indexOf(P[N][0])===-1?G.push(P[N][0]):me++;return G}return this.memoized[o]={suggestions:C(o),limit:l},this.memoized[o].suggestions}}})();typeof ul<"u"&&(ul.exports=sl)});var Nf=at((zg,Bf)=>{"use strict";var _f=Mf();function Ie(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(!Ie.aff_loading){Ie.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&&(Ie.aff_data=s.responseText,Ie.num_loaded++,Ie.num_loaded==2&&(Ie.typo=new _f("en_US",Ie.aff_data,Ie.dic_data,{platform:"any"})))},s.send(null)}if(!Ie.dic_loading){Ie.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&&(Ie.dic_data=a.responseText,Ie.num_loaded++,Ie.num_loaded==2&&(Ie.typo=new _f("en_US",Ie.aff_data,Ie.dic_data,{platform:"any"})))},a.send(null)}var f='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',p={token:function(d){var m=d.peek(),y="";if(f.includes(m))return d.next(),null;for(;(m=d.peek())!=null&&!f.includes(m);)y+=m,d.next();return Ie.typo&&!Ie.typo.check(y)?"spell-error":null}},c=o.codeMirrorInstance.getMode(l,l.backdrop||"text/plain");return o.codeMirrorInstance.overlayMode(c,p,!0)})}Ie.num_loaded=0;Ie.aff_loading=!1;Ie.dic_loading=!1;Ie.aff_data="";Ie.dic_data="";Ie.typo;Bf.exports=Ie});var Kf=at(Be=>{"use strict";function Of(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,Jh(a.key),a)}}function Yh(o,l,s){return l&&Of(o.prototype,l),s&&Of(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 Zh(o,l){if(o){if(typeof o=="string")return If(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 If(o,l)}}function If(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 no(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=Zh(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 Qh(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 Jh(o){var l=Qh(o,"string");return typeof l=="symbol"?l:String(l)}function fl(){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}}Be.defaults=fl();function $h(o){Be.defaults=o}var Uf=/[&<>"']/,Vh=new RegExp(Uf.source,"g"),jf=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,ep=new RegExp(jf.source,"g"),tp={"&":"&","<":"<",">":">",'"':""","'":"'"},Pf=function(l){return tp[l]};function ht(o,l){if(l){if(Uf.test(o))return o.replace(Vh,Pf)}else if(jf.test(o))return o.replace(ep,Pf);return o}var rp=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function Gf(o){return o.replace(rp,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 np=/(^|[^\[])\^/g;function Me(o,l){o=typeof o=="string"?o:o.source,l=l||"";var s={replace:function(f,p){return p=p.source||p,p=p.replace(np,"$1"),o=o.replace(f,p),s},getRegex:function(){return new RegExp(o,l)}};return s}var ip=/[^\w:]/g,op=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function zf(o,l,s){if(o){var a;try{a=decodeURIComponent(Gf(s)).replace(ip,"").toLowerCase()}catch{return null}if(a.indexOf("javascript:")===0||a.indexOf("vbscript:")===0||a.indexOf("data:")===0)return null}l&&!op.test(s)&&(s=up(l,s));try{s=encodeURI(s).replace(/%25/g,"%")}catch{return null}return s}var io={},ap=/^[^:]+:\/*[^/]*$/,lp=/^([^:]+:)[\s\S]*$/,sp=/^([^:]+:\/*[^/]*)[\s\S]*$/;function up(o,l){io[" "+o]||(ap.test(o)?io[" "+o]=o+"/":io[" "+o]=oo(o,"/",!0)),o=io[" "+o];var s=o.indexOf(":")===-1;return l.substring(0,2)==="//"?s?l:o.replace(lp,"$1")+l:l.charAt(0)==="/"?s?l:o.replace(sp,"$1")+l:o+l}var ao={exec:function(){}};function Hf(o,l){var s=o.replace(/\|/g,function(p,c,d){for(var m=!1,y=c;--y>=0&&d[y]==="\\";)m=!m;return m?"|":" |"}),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 p=o.charAt(a-f-1);if(p===l&&!s)f++;else if(p!==l&&s)f++;else break}return o.slice(0,a-f)}function fp(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 cp(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 Rf(o,l){if(l<1)return"";for(var s="";l>1;)l&1&&(s+=o),l>>=1,o+=o;return s+o}function Wf(o,l,s,a){var f=l.href,p=l.title?ht(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:p,text:c,tokens:a.inlineTokens(c)};return a.state.inLink=!1,d}return{type:"image",raw:s,href:f,title:p,text:ht(c)}}function dp(o,l){var s=o.match(/^(\s+)(?:```)/);if(s===null)return l;var a=s[1];return l.split(`
|
|
`).map(function(f){var p=f.match(/^\s+/);if(p===null)return f;var c=p[0];return c.length>=a.length?f.slice(a.length):f}).join(`
|
|
`)}var lo=function(){function o(s){this.options=s||Be.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 p=f[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:f[0],codeBlockStyle:"indented",text:this.options.pedantic?p:oo(p,`
|
|
`)}}},l.fences=function(a){var f=this.rules.block.fences.exec(a);if(f){var p=f[0],c=dp(p,f[3]||"");return{type:"code",raw:p,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 p=f[2].trim();if(/#$/.test(p)){var c=oo(p,"#");(this.options.pedantic||!c||/ $/.test(c))&&(p=c.trim())}return{type:"heading",raw:f[0],depth:f[1].length,text:p,tokens:this.lexer.inline(p)}}},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 p=f[0].replace(/^ *>[ \t]?/gm,""),c=this.lexer.state.top;this.lexer.state.top=!0;var d=this.lexer.blockTokens(p);return this.lexer.state.top=c,{type:"blockquote",raw:f[0],tokens:d,text:p}}},l.list=function(a){var f=this.rules.block.list.exec(a);if(f){var p,c,d,m,y,x,C,S,A,_,L,T,O=f[1].trim(),N=O.length>1,I={type:"list",raw:"",ordered:N,start:N?+O.slice(0,-1):"",loose:!1,items:[]};O=N?"\\d{1,9}\\"+O.slice(-1):"\\"+O,this.options.pedantic&&(O=N?O:"[*+-]");for(var P=new RegExp("^( {0,3}"+O+")((?:[ ][^\\n]*)?(?:\\n|$))");a&&(T=!1,!(!(f=P.exec(a))||this.rules.block.hr.test(a)));){if(p=f[0],a=a.substring(p.length),S=f[2].split(`
|
|
`,1)[0].replace(/^\t+/,function(ee){return" ".repeat(3*ee.length)}),A=a.split(`
|
|
`,1)[0],this.options.pedantic?(m=2,L=S.trimLeft()):(m=f[2].search(/[^ ]/),m=m>4?1:m,L=S.slice(m),m+=f[1].length),x=!1,!S&&/^ *$/.test(A)&&(p+=A+`
|
|
`,a=a.substring(A.length+1),T=!0),!T)for(var q=new RegExp("^ {0,"+Math.min(3,m-1)+"}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))"),G=new RegExp("^ {0,"+Math.min(3,m-1)+"}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"),K=new RegExp("^ {0,"+Math.min(3,m-1)+"}(?:```|~~~)"),me=new RegExp("^ {0,"+Math.min(3,m-1)+"}#");a&&(_=a.split(`
|
|
`,1)[0],A=_,this.options.pedantic&&(A=A.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(K.test(A)||me.test(A)||q.test(A)||G.test(a)));){if(A.search(/[^ ]/)>=m||!A.trim())L+=`
|
|
`+A.slice(m);else{if(x||S.search(/[^ ]/)>=4||K.test(S)||me.test(S)||G.test(S))break;L+=`
|
|
`+A}!x&&!A.trim()&&(x=!0),p+=_+`
|
|
`,a=a.substring(_.length+1),S=A.slice(m)}I.loose||(C?I.loose=!0:/\n *\n *$/.test(p)&&(C=!0)),this.options.gfm&&(c=/^\[[ xX]\] /.exec(L),c&&(d=c[0]!=="[ ] ",L=L.replace(/^\[[ xX]\] +/,""))),I.items.push({type:"list_item",raw:p,task:!!c,checked:d,loose:!1,text:L}),I.raw+=p}I.items[I.items.length-1].raw=p.trimRight(),I.items[I.items.length-1].text=L.trimRight(),I.raw=I.raw.trimRight();var U=I.items.length;for(y=0;y<U;y++)if(this.lexer.state.top=!1,I.items[y].tokens=this.lexer.blockTokens(I.items[y].text,[]),!I.loose){var le=I.items[y].tokens.filter(function(ee){return ee.type==="space"}),j=le.length>0&&le.some(function(ee){return/\n.*\n/.test(ee.raw)});I.loose=j}if(I.loose)for(y=0;y<U;y++)I.items[y].loose=!0;return I}},l.html=function(a){var f=this.rules.block.html.exec(a);if(f){var p={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]):ht(f[0]);p.type="paragraph",p.text=c,p.tokens=this.lexer.inline(c)}return p}},l.def=function(a){var f=this.rules.block.def.exec(a);if(f){var p=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:p,raw:f[0],href:c,title:d}}},l.table=function(a){var f=this.rules.block.table.exec(a);if(f){var p={type:"table",header:Hf(f[1]).map(function(C){return{text:C}}),align:f[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:f[3]&&f[3].trim()?f[3].replace(/\n[ \t]*$/,"").split(`
|
|
`):[]};if(p.header.length===p.align.length){p.raw=f[0];var c=p.align.length,d,m,y,x;for(d=0;d<c;d++)/^ *-+: *$/.test(p.align[d])?p.align[d]="right":/^ *:-+: *$/.test(p.align[d])?p.align[d]="center":/^ *:-+ *$/.test(p.align[d])?p.align[d]="left":p.align[d]=null;for(c=p.rows.length,d=0;d<c;d++)p.rows[d]=Hf(p.rows[d],p.header.length).map(function(C){return{text:C}});for(c=p.header.length,m=0;m<c;m++)p.header[m].tokens=this.lexer.inline(p.header[m].text);for(c=p.rows.length,m=0;m<c;m++)for(x=p.rows[m],y=0;y<x.length;y++)x[y].tokens=this.lexer.inline(x[y].text);return p}}},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 p=f[1].charAt(f[1].length-1)===`
|
|
`?f[1].slice(0,-1):f[1];return{type:"paragraph",raw:f[0],text:p,tokens:this.lexer.inline(p)}}},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:ht(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]):ht(f[0]):f[0]}},l.link=function(a){var f=this.rules.inline.link.exec(a);if(f){var p=f[2].trim();if(!this.options.pedantic&&/^</.test(p)){if(!/>$/.test(p))return;var c=oo(p.slice(0,-1),"\\");if((p.length-c.length)%2===0)return}else{var d=fp(f[2],"()");if(d>-1){var m=f[0].indexOf("!")===0?5:4,y=m+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],C="";if(this.options.pedantic){var S=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(x);S&&(x=S[1],C=S[3])}else C=f[3]?f[3].slice(1,-1):"";return x=x.trim(),/^</.test(x)&&(this.options.pedantic&&!/>$/.test(p)?x=x.slice(1):x=x.slice(1,-1)),Wf(f,{href:x&&x.replace(this.rules.inline._escapes,"$1"),title:C&&C.replace(this.rules.inline._escapes,"$1")},f[0],this.lexer)}},l.reflink=function(a,f){var p;if((p=this.rules.inline.reflink.exec(a))||(p=this.rules.inline.nolink.exec(a))){var c=(p[2]||p[1]).replace(/\s+/g," ");if(c=f[c.toLowerCase()],!c){var d=p[0].charAt(0);return{type:"text",raw:d,text:d}}return Wf(p,c,p[0],this.lexer)}},l.emStrong=function(a,f,p){p===void 0&&(p="");var c=this.rules.inline.emStrong.lDelim.exec(a);if(c&&!(c[3]&&p.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&&(p===""||this.rules.inline.punctuation.exec(p))){var m=c[0].length-1,y,x,C=m,S=0,A=c[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(A.lastIndex=0,f=f.slice(-1*a.length+m);(c=A.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]){C+=x;continue}else if((c[5]||c[6])&&m%3&&!((m+x)%3)){S+=x;continue}if(C-=x,!(C>0)){x=Math.min(x,x+C+S);var _=a.slice(0,m+c.index+(c[0].length-y.length)+x);if(Math.min(m,x)%2){var L=_.slice(1,-1);return{type:"em",raw:_,text:L,tokens:this.lexer.inlineTokens(L)}}var T=_.slice(2,-2);return{type:"strong",raw:_,text:T,tokens:this.lexer.inlineTokens(T)}}}}}},l.codespan=function(a){var f=this.rules.inline.code.exec(a);if(f){var p=f[2].replace(/\n/g," "),c=/[^ ]/.test(p),d=/^ /.test(p)&&/ $/.test(p);return c&&d&&(p=p.substring(1,p.length-1)),p=ht(p,!0),{type:"codespan",raw:f[0],text:p}}},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 p=this.rules.inline.autolink.exec(a);if(p){var c,d;return p[2]==="@"?(c=ht(this.options.mangle?f(p[1]):p[1]),d="mailto:"+c):(c=ht(p[1]),d=c),{type:"link",raw:p[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.url=function(a,f){var p;if(p=this.rules.inline.url.exec(a)){var c,d;if(p[2]==="@")c=ht(this.options.mangle?f(p[0]):p[0]),d="mailto:"+c;else{var m;do m=p[0],p[0]=this.rules.inline._backpedal.exec(p[0])[0];while(m!==p[0]);c=ht(p[0]),p[1]==="www."?d="http://"+p[0]:d=p[0]}return{type:"link",raw:p[0],text:c,href:d,tokens:[{type:"text",raw:c,text:c}]}}},l.inlineText=function(a,f){var p=this.rules.inline.text.exec(a);if(p){var c;return this.lexer.state.inRawBlock?c=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(p[0]):ht(p[0]):p[0]:c=ht(this.options.smartypants?f(p[0]):p[0]),{type:"text",raw:p[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 ie={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])/};ie._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";ie.punctuation=Me(ie.punctuation).replace(/punctuation/g,ie._punctuation).getRegex();ie.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;ie.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;ie._comment=Me(ce._comment).replace("(?:-->|$)","-->").getRegex();ie.emStrong.lDelim=Me(ie.emStrong.lDelim).replace(/punct/g,ie._punctuation).getRegex();ie.emStrong.rDelimAst=Me(ie.emStrong.rDelimAst,"g").replace(/punct/g,ie._punctuation).getRegex();ie.emStrong.rDelimUnd=Me(ie.emStrong.rDelimUnd,"g").replace(/punct/g,ie._punctuation).getRegex();ie._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;ie._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;ie._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])?)+(?![-_])/;ie.autolink=Me(ie.autolink).replace("scheme",ie._scheme).replace("email",ie._email).getRegex();ie._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;ie.tag=Me(ie.tag).replace("comment",ie._comment).replace("attribute",ie._attribute).getRegex();ie._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;ie._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;ie._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;ie.link=Me(ie.link).replace("label",ie._label).replace("href",ie._href).replace("title",ie._title).getRegex();ie.reflink=Me(ie.reflink).replace("label",ie._label).replace("ref",ce._label).getRegex();ie.nolink=Me(ie.nolink).replace("ref",ce._label).getRegex();ie.reflinkSearch=Me(ie.reflinkSearch,"g").replace("reflink",ie.reflink).replace("nolink",ie.nolink).getRegex();ie.normal=_t({},ie);ie.pedantic=_t({},ie.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",ie._label).getRegex(),reflink:Me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ie._label).getRegex()});ie.gfm=_t({},ie.normal,{escape:Me(ie.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.!#$%&'*+\/=?_`{\|}~-]+@)))/});ie.gfm.url=Me(ie.gfm.url,"i").replace("email",ie.gfm._extended_email).getRegex();ie.breaks=_t({},ie.gfm,{br:Me(ie.br).replace("{2,}","*").getRegex(),text:Me(ie.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});function hp(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 qf(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 yn=function(){function o(s){this.tokens=[],this.tokens.links=Object.create(null),this.options=s||Be.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:ie.normal};this.options.pedantic?(a.block=ce.pedantic,a.inline=ie.pedantic):this.options.gfm&&(a.block=ce.gfm,this.options.breaks?a.inline=ie.breaks:a.inline=ie.gfm),this.tokenizer.rules=a}o.lex=function(a,f){var p=new o(f);return p.lex(a)},o.lexInline=function(a,f){var p=new o(f);return p.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 p=this;f===void 0&&(f=[]),this.options.pedantic?a=a.replace(/\t/g," ").replace(/^ +$/gm,""):a=a.replace(/^( *)(\t+)/gm,function(C,S,A){return S+" ".repeat(A.length)});for(var c,d,m,y;a;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(function(C){return(c=C.call({lexer:p},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(m=a,this.options.extensions&&this.options.extensions.startBlock&&function(){var C=1/0,S=a.slice(1),A=void 0;p.options.extensions.startBlock.forEach(function(_){A=_.call({lexer:this},S),typeof A=="number"&&A>=0&&(C=Math.min(C,A))}),C<1/0&&C>=0&&(m=a.substring(0,C+1))}(),this.state.top&&(c=this.tokenizer.paragraph(m))){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=m.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 p=this;f===void 0&&(f=[]);var c,d,m,y=a,x,C,S;if(this.tokens.links){var A=Object.keys(this.tokens.links);if(A.length>0)for(;(x=this.tokenizer.rules.inline.reflinkSearch.exec(y))!=null;)A.includes(x[0].slice(x[0].lastIndexOf("[")+1,-1))&&(y=y.slice(0,x.index)+"["+Rf("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)+"["+Rf("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(C||(S=""),C=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(function(L){return(c=L.call({lexer:p},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,S)){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,qf)){a=a.substring(c.raw.length),f.push(c);continue}if(!this.state.inLink&&(c=this.tokenizer.url(a,qf))){a=a.substring(c.raw.length),f.push(c);continue}if(m=a,this.options.extensions&&this.options.extensions.startInline&&function(){var L=1/0,T=a.slice(1),O=void 0;p.options.extensions.startInline.forEach(function(N){O=N.call({lexer:this},T),typeof O=="number"&&O>=0&&(L=Math.min(L,O))}),L<1/0&&L>=0&&(m=a.substring(0,L+1))}(),c=this.tokenizer.inlineText(m,hp)){a=a.substring(c.raw.length),c.raw.slice(-1)!=="_"&&(S=c.raw.slice(-1)),C=!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 _="Infinite loop on byte: "+a.charCodeAt(0);if(this.options.silent){console.error(_);break}else throw new Error(_)}}return f},Yh(o,null,[{key:"rules",get:function(){return{block:ce,inline:ie}}}]),o}(),so=function(){function o(s){this.options=s||Be.defaults}var l=o.prototype;return l.code=function(a,f,p){var c=(f||"").match(/\S*/)[0];if(this.options.highlight){var d=this.options.highlight(a,c);d!=null&&d!==a&&(p=!0,a=d)}return a=a.replace(/\n$/,"")+`
|
|
`,c?'<pre><code class="'+this.options.langPrefix+ht(c)+'">'+(p?a:ht(a,!0))+`</code></pre>
|
|
`:"<pre><code>"+(p?a:ht(a,!0))+`</code></pre>
|
|
`},l.blockquote=function(a){return`<blockquote>
|
|
`+a+`</blockquote>
|
|
`},l.html=function(a){return a},l.heading=function(a,f,p,c){if(this.options.headerIds){var d=this.options.headerPrefix+c.slug(p);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,p){var c=f?"ol":"ul",d=f&&p!==1?' start="'+p+'"':"";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 p=f.header?"th":"td",c=f.align?"<"+p+' align="'+f.align+'">':"<"+p+">";return c+a+("</"+p+`>
|
|
`)},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,p){if(a=zf(this.options.sanitize,this.options.baseUrl,a),a===null)return p;var c='<a href="'+a+'"';return f&&(c+=' title="'+f+'"'),c+=">"+p+"</a>",c},l.image=function(a,f,p){if(a=zf(this.options.sanitize,this.options.baseUrl,a),a===null)return p;var c='<img src="'+a+'" alt="'+p+'"';return f&&(c+=' title="'+f+'"'),c+=this.options.xhtml?"/>":">",c},l.text=function(a){return a},o}(),cl=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,p){return""+p},l.image=function(a,f,p){return""+p},l.br=function(){return""},o}(),dl=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 p=a,c=0;if(this.seen.hasOwnProperty(p)){c=this.seen[a];do c++,p=a+"-"+c;while(this.seen.hasOwnProperty(p))}return f||(this.seen[a]=c,this.seen[p]=0),p},l.slug=function(a,f){f===void 0&&(f={});var p=this.serialize(a);return this.getNextSafeSlug(p,f.dryrun)},o}(),xn=function(){function o(s){this.options=s||Be.defaults,this.options.renderer=this.options.renderer||new so,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new cl,this.slugger=new dl}o.parse=function(a,f){var p=new o(f);return p.parse(a)},o.parseInline=function(a,f){var p=new o(f);return p.parseInline(a)};var l=o.prototype;return l.parse=function(a,f){f===void 0&&(f=!0);var p="",c,d,m,y,x,C,S,A,_,L,T,O,N,I,P,q,G,K,me,U=a.length;for(c=0;c<U;c++){if(L=a[c],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[L.type]&&(me=this.options.extensions.renderers[L.type].call({parser:this},L),me!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(L.type))){p+=me||"";continue}switch(L.type){case"space":continue;case"hr":{p+=this.renderer.hr();continue}case"heading":{p+=this.renderer.heading(this.parseInline(L.tokens),L.depth,Gf(this.parseInline(L.tokens,this.textRenderer)),this.slugger);continue}case"code":{p+=this.renderer.code(L.text,L.lang,L.escaped);continue}case"table":{for(A="",S="",y=L.header.length,d=0;d<y;d++)S+=this.renderer.tablecell(this.parseInline(L.header[d].tokens),{header:!0,align:L.align[d]});for(A+=this.renderer.tablerow(S),_="",y=L.rows.length,d=0;d<y;d++){for(C=L.rows[d],S="",x=C.length,m=0;m<x;m++)S+=this.renderer.tablecell(this.parseInline(C[m].tokens),{header:!1,align:L.align[m]});_+=this.renderer.tablerow(S)}p+=this.renderer.table(A,_);continue}case"blockquote":{_=this.parse(L.tokens),p+=this.renderer.blockquote(_);continue}case"list":{for(T=L.ordered,O=L.start,N=L.loose,y=L.items.length,_="",d=0;d<y;d++)P=L.items[d],q=P.checked,G=P.task,I="",P.task&&(K=this.renderer.checkbox(q),N?P.tokens.length>0&&P.tokens[0].type==="paragraph"?(P.tokens[0].text=K+" "+P.tokens[0].text,P.tokens[0].tokens&&P.tokens[0].tokens.length>0&&P.tokens[0].tokens[0].type==="text"&&(P.tokens[0].tokens[0].text=K+" "+P.tokens[0].tokens[0].text)):P.tokens.unshift({type:"text",text:K}):I+=K),I+=this.parse(P.tokens,N),_+=this.renderer.listitem(I,G,q);p+=this.renderer.list(_,T,O);continue}case"html":{p+=this.renderer.html(L.text);continue}case"paragraph":{p+=this.renderer.paragraph(this.parseInline(L.tokens));continue}case"text":{for(_=L.tokens?this.parseInline(L.tokens):L.text;c+1<U&&a[c+1].type==="text";)L=a[++c],_+=`
|
|
`+(L.tokens?this.parseInline(L.tokens):L.text);p+=f?this.renderer.paragraph(_):_;continue}default:{var le='Token with "'+L.type+'" type was not found.';if(this.options.silent){console.error(le);return}else throw new Error(le)}}}return p},l.parseInline=function(a,f){f=f||this.renderer;var p="",c,d,m,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]&&(m=this.options.extensions.renderers[d.type].call({parser:this},d),m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(d.type))){p+=m||"";continue}switch(d.type){case"escape":{p+=f.text(d.text);break}case"html":{p+=f.html(d.text);break}case"link":{p+=f.link(d.href,d.title,this.parseInline(d.tokens,f));break}case"image":{p+=f.image(d.href,d.title,d.text);break}case"strong":{p+=f.strong(this.parseInline(d.tokens,f));break}case"em":{p+=f.em(this.parseInline(d.tokens,f));break}case"codespan":{p+=f.codespan(d.text);break}case"br":{p+=f.br();break}case"del":{p+=f.del(this.parseInline(d.tokens,f));break}case"text":{p+=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 p},o}(),si=function(){function o(s){this.options=s||Be.defaults}var l=o.prototype;return l.preprocess=function(a){return a},l.postprocess=function(a){return a},o}();si.passThroughHooks=new Set(["preprocess","postprocess"]);function pp(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>"+ht(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 p=_t({},a);a=_t({},fe.defaults,p);var c=pp(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(cp(a),a.hooks&&(a.hooks.options=a),f){var d=a.highlight,m;try{a.hooks&&(s=a.hooks.preprocess(s)),m=o(s,a)}catch(A){return c(A)}var y=function(_){var L;if(!_)try{a.walkTokens&&fe.walkTokens(m,a.walkTokens),L=l(m,a),a.hooks&&(L=a.hooks.postprocess(L))}catch(T){_=T}return a.highlight=d,_?c(_):f(null,L)};if(!d||d.length<3||(delete a.highlight,!m.length))return y();var x=0;fe.walkTokens(m,function(A){A.type==="code"&&(x++,setTimeout(function(){d(A.text,A.lang,function(_,L){if(_)return y(_);L!=null&&L!==A.text&&(A.text=L,A.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(A){return o(A,a)}).then(function(A){return a.walkTokens?Promise.all(fe.walkTokens(A,a.walkTokens)).then(function(){return A}):A}).then(function(A){return l(A,a)}).then(function(A){return a.hooks?a.hooks.postprocess(A):A}).catch(c);try{a.hooks&&(s=a.hooks.preprocess(s));var C=o(s,a);a.walkTokens&&fe.walkTokens(C,a.walkTokens);var S=l(C,a);return a.hooks&&(S=a.hooks.postprocess(S)),S}catch(A){return c(A)}}}function fe(o,l,s){return Xf(yn.lex,xn.parse)(o,l,s)}fe.options=fe.setOptions=function(o){return fe.defaults=_t({},fe.defaults,o),$h(fe.defaults),fe};fe.getDefaults=fl;fe.defaults=Be.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 p=_t({},f);if(p.async=fe.defaults.async||p.async||!1,f.extensions&&(f.extensions.forEach(function(d){if(!d.name)throw new Error("extension name required");if(d.renderer){var m=o.renderers[d.name];m?o.renderers[d.name]=function(){for(var y=arguments.length,x=new Array(y),C=0;C<y;C++)x[C]=arguments[C];var S=d.renderer.apply(this,x);return S===!1&&(S=m.apply(this,x)),S}: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)}),p.extensions=o),f.renderer&&function(){var d=fe.defaults.renderer||new so,m=function(C){var S=d[C];d[C]=function(){for(var A=arguments.length,_=new Array(A),L=0;L<A;L++)_[L]=arguments[L];var T=f.renderer[C].apply(d,_);return T===!1&&(T=S.apply(d,_)),T}};for(var y in f.renderer)m(y);p.renderer=d}(),f.tokenizer&&function(){var d=fe.defaults.tokenizer||new lo,m=function(C){var S=d[C];d[C]=function(){for(var A=arguments.length,_=new Array(A),L=0;L<A;L++)_[L]=arguments[L];var T=f.tokenizer[C].apply(d,_);return T===!1&&(T=S.apply(d,_)),T}};for(var y in f.tokenizer)m(y);p.tokenizer=d}(),f.hooks&&function(){var d=fe.defaults.hooks||new si,m=function(C){var S=d[C];si.passThroughHooks.has(C)?d[C]=function(A){if(fe.defaults.async)return Promise.resolve(f.hooks[C].call(d,A)).then(function(L){return S.call(d,L)});var _=f.hooks[C].call(d,A);return S.call(d,_)}:d[C]=function(){for(var A=arguments.length,_=new Array(A),L=0;L<A;L++)_[L]=arguments[L];var T=f.hooks[C].apply(d,_);return T===!1&&(T=S.apply(d,_)),T}};for(var y in f.hooks)m(y);p.hooks=d}(),f.walkTokens){var c=fe.defaults.walkTokens;p.walkTokens=function(d){var m=[];return m.push(f.walkTokens.call(this,d)),c&&(m=m.concat(c.call(this,d))),m}}fe.setOptions(p)})};fe.walkTokens=function(o,l){for(var s=[],a=function(){var d=p.value;switch(s=s.concat(l.call(fe,d)),d.type){case"table":{for(var m=no(d.header),y;!(y=m()).done;){var x=y.value;s=s.concat(fe.walkTokens(x.tokens,l))}for(var C=no(d.rows),S;!(S=C()).done;)for(var A=S.value,_=no(A),L;!(L=_()).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(O){s=s.concat(fe.walkTokens(d[O],l))}):d.tokens&&(s=s.concat(fe.walkTokens(d.tokens,l)))}},f=no(o),p;!(p=f()).done;)a();return s};fe.parseInline=Xf(yn.lexInline,xn.parseInline);fe.Parser=xn;fe.parser=xn.parse;fe.Renderer=so;fe.TextRenderer=cl;fe.Lexer=yn;fe.lexer=yn.lex;fe.Tokenizer=lo;fe.Slugger=dl;fe.Hooks=si;fe.parse=fe;var gp=fe.options,vp=fe.setOptions,mp=fe.use,bp=fe.walkTokens,yp=fe.parseInline,xp=fe,Dp=xn.parse,wp=yn.lex;Be.Hooks=si;Be.Lexer=yn;Be.Parser=xn;Be.Renderer=so;Be.Slugger=dl;Be.TextRenderer=cl;Be.Tokenizer=lo;Be.getDefaults=fl;Be.lexer=wp;Be.marked=fe;Be.options=gp;Be.parse=xp;Be.parseInline=yp;Be.parser=Dp;Be.setOptions=vp;Be.use=mp;Be.walkTokens=bp});var ic=at((Rg,nc)=>{"use strict";var Dn=Et();Vu();tf();of();al();ll();mf();xf();Cf();Ef();Tf();ol();var Cp=Nf(),hl=Kf().marked,Qf=/Mac/.test(navigator.platform),kp=new RegExp(/(<a.*?https?:\/\/.*?[^a]>)+?/g),ui={toggleBold:co,toggleItalic:ho,drawLink:So,toggleHeadingSmaller:fi,toggleHeadingBigger:mo,drawImage:Eo,toggleBlockquote:vo,toggleOrderedList:wo,toggleUnorderedList:Do,toggleCheckList:Co,toggleCodeBlock:go,togglePreview:Mo,toggleStrikethrough:po,toggleHeading1:bo,toggleHeading2:yo,toggleHeading3:xo,toggleHeading4:gl,toggleHeading5:vl,toggleHeading6:ml,cleanBlock:ko,drawTable:Ao,drawHorizontalRule:Fo,undo:To,redo:Lo,toggleSideBySide:wn,toggleFullScreen:jr},Sp={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"},Ep=function(o){for(var l in ui)if(ui[l]===o)return l;return null},pl=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 Ap(o){for(var l;(l=kp.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 Fp(o){for(var l=new DOMParser,s=l.parseFromString(o,"text/html"),a=s.getElementsByTagName("li"),f=0;f<a.length;f++)for(var p=a[f],c=0;c<p.children.length;c++){var d=p.children[c];d instanceof HTMLInputElement&&d.type==="checkbox"&&(p.style.marginLeft="-1.5em",p.style.listStyleType="none")}return s.documentElement.innerHTML}function Jf(o){return Qf?o=o.replace("Ctrl","Cmd"):o=o.replace("Cmd","Ctrl"),o}function Tp(o,l,s,a){var f=uo(o,!1,l,s,"button",a);f.classList.add("easymde-dropdown"),f.onclick=function(){f.focus()};var p=document.createElement("div");p.className="easymde-dropdown-content";for(var c=0;c<o.children.length;c++){var d=o.children[c],m;typeof d=="string"&&d in Ur?m=uo(Ur[d],!0,l,s,"button",a):m=uo(d,!0,l,s,"button",a),m.addEventListener("click",function(y){y.stopPropagation()},!1),p.appendChild(m)}return f.appendChild(p),f}function uo(o,l,s,a,f,p){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 m=p.options.toolbarButtonClassPrefix?p.options.toolbarButtonClassPrefix+"-":"";c.className=m+o.name,c.setAttribute("type",f),s=s??!0,o.text&&(c.innerText=o.text),o.name&&o.name in a&&(ui[o.name]=o.action),o.title&&s&&(c.title=Mp(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=[],C=0;C<y.length;C++){var S=y[C];S.match(/^fa([srlb]|(-[\w-]*)|$)/)?x.push(S):c.classList.add(S)}if(c.tabIndex=-1,x.length>0){for(var A=document.createElement("i"),_=0;_<x.length;_++){var L=x[_];A.classList.add(L)}c.appendChild(A)}return typeof o.icon<"u"&&(c.innerHTML=o.icon),o.action&&l&&(typeof o.action=="function"?c.onclick=function(T){T.preventDefault(),o.action(p)}:typeof o.action=="string"&&(c.onclick=function(T){T.preventDefault(),window.open(o.action,"_blank")})),c}function Lp(){var o=document.createElement("i");return o.className="separator",o.innerHTML="|",o}function Mp(o,l,s){var a,f=o;return l&&(a=Ep(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={},p,c,d=0;d<a.length;d++)p=a[d],p==="strong"?f.bold=!0:p==="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):p==="atom"?f.quote=!0:p==="em"?f.italic=!0:p==="quote"?f.quote=!0:p==="strikethrough"?f.strikethrough=!0:p==="comment"?f.code=!0:p==="link"&&!f.image?f.link=!0:p==="image"?f.image=!0:p.match(/^header(-[1-6])?$/)&&(f[p.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 wn(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 p=o.toolbarElements.fullscreen;p.classList.toggle("active")}}function co(o){yl(o,"bold",o.options.blockStyles.bold)}function ho(o){yl(o,"italic",o.options.blockStyles.italic)}function po(o){yl(o,"strikethrough","~~")}function go(o){var l=o.options.blockStyles.code;function s(H){if(typeof H!="object")throw"fencing_line() takes a 'line' object (not a line number, or line text). Got: "+typeof H+": "+H;return H.styles&&H.styles[2]&&H.styles[2].indexOf("formatting-code-block")!==-1}function a(H){return H.state.base.base||H.state.base}function f(H,W,Z,ve,De){Z=Z||H.getLineHandle(W),ve=ve||H.getTokenAt({line:W,ch:1}),De=De||!!Z.text&&H.getTokenAt({line:W,ch:Z.text.length-1});var Le=ve.type?ve.type.split(" "):[];return De&&a(De).indentedCode?"indented":Le.indexOf("comment")===-1?!1:a(ve).fencedChars||a(De).fencedChars||s(Z)?"fenced":"single"}function p(H,W,Z,ve){var De=W.line+1,Le=Z.line+1,F=W.line!==Z.line,D=ve+`
|
|
`,te=`
|
|
`+ve;F&&Le++,F&&Z.ch===0&&(te=ve+`
|
|
`,Le--),Gr(H,!1,[D,te]),H.setSelection({line:De,ch:0},{line:Le,ch:0})}var c=o.codemirror,d=c.getCursor("start"),m=c.getCursor("end"),y=c.getTokenAt({line:d.line,ch:d.ch||1}),x=c.getLineHandle(d.line),C=f(c,d.line,x,y),S,A,_;if(C==="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!==m&&m.ch--,c.setSelection(d,m),c.focus()}else if(C==="fenced")if(d.line!==m.line||d.ch!==m.ch){for(S=d.line;S>=0&&(x=c.getLineHandle(S),!s(x));S--);var O=c.getTokenAt({line:S,ch:1}),N=a(O).fencedChars,I,P,q,G;s(c.getLineHandle(d.line))?(I="",P=d.line):s(c.getLineHandle(d.line-1))?(I="",P=d.line-1):(I=N+`
|
|
`,P=d.line),s(c.getLineHandle(m.line))?(q="",G=m.line,m.ch===0&&(G+=1)):m.ch!==0&&s(c.getLineHandle(m.line+1))?(q="",G=m.line+1):(q=N+`
|
|
`,G=m.line+1),m.ch===0&&(G-=1),c.operation(function(){c.replaceRange(q,{line:G,ch:0},{line:G+(q?0:1),ch:0}),c.replaceRange(I,{line:P,ch:0},{line:P+(I?0:1),ch:0})}),c.setSelection({line:P+(I?1:0),ch:0},{line:G+(I?1:-1),ch:0}),c.focus()}else{var K=d.line;if(s(c.getLineHandle(d.line))&&(f(c,d.line+1)==="fenced"?(S=d.line,K=d.line+1):(A=d.line,K=d.line-1)),S===void 0)for(S=K;S>=0&&(x=c.getLineHandle(S),!s(x));S--);if(A===void 0)for(_=c.lineCount(),A=K;A<_&&(x=c.getLineHandle(A),!s(x));A++);c.operation(function(){c.replaceRange("",{line:S,ch:0},{line:S+1,ch:0}),c.replaceRange("",{line:A-1,ch:0},{line:A,ch:0})}),c.focus()}else if(C==="indented"){if(d.line!==m.line||d.ch!==m.ch)S=d.line,A=m.line,m.ch===0&&A--;else{for(S=d.line;S>=0;S--)if(x=c.getLineHandle(S),!x.text.match(/^\s*$/)&&f(c,S,x)!=="indented"){S+=1;break}for(_=c.lineCount(),A=d.line;A<_;A++)if(x=c.getLineHandle(A),!x.text.match(/^\s*$/)&&f(c,A,x)!=="indented"){A-=1;break}}var me=c.getLineHandle(A+1),U=me&&c.getTokenAt({line:A+1,ch:me.text.length-1}),le=U&&a(U).indentedCode;le&&c.replaceRange(`
|
|
`,{line:A+1,ch:0});for(var j=S;j<=A;j++)c.indentLine(j,"subtract");c.focus()}else{var ee=d.line===m.line&&d.ch===m.ch&&d.ch===0,E=d.line!==m.line;ee||E?p(c,d,m,l):Gr(c,!1,["`","`"])}}function vo(o){_o(o.codemirror,"quote")}function fi(o){Er(o.codemirror,"smaller")}function mo(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 gl(o){Er(o.codemirror,void 0,4)}function vl(o){Er(o.codemirror,void 0,5)}function ml(o){Er(o.codemirror,void 0,6)}function Do(o){var l=o.codemirror,s="*";["-","+","*"].includes(o.options.unorderedListStyle)&&(s=o.options.unorderedListStyle),_o(l,"unordered-list",s)}function wo(o){_o(o.codemirror,"ordered-list")}function Co(o){_o(o.codemirror,"check-list")}function ko(o){_p(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=$f(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=$f(a)}ec(o,"image",l.insertTexts.image,s)}function $f(o){return encodeURI(o).replace(/([\\()])/g,"\\$1")}function bl(o){o.openBrowseFileWindow()}function Vf(o,l){var s=o.codemirror,a=Sr(s),f=o.options,p=l.substr(l.lastIndexOf("/")+1),c=p.substring(p.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]="["+p,Gr(s,a.link,d,l)}o.updateStatusBar("upload-image",o.options.imageTexts.sbOnUploaded.replace("#image_name#",p)),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 wn(o){var l=o.codemirror,s=l.getWrapperElement(),a=s.nextSibling,f=o.toolbarElements&&o.toolbarElements["side-by-side"],p=!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"),p=!0);var d=s.lastChild;if(d.classList.contains("editor-preview-active")){d.classList.remove("editor-preview-active");var m=o.toolbarElements.preview,y=o.toolbar_div;m.classList.remove("active"),y.classList.remove("disabled-for-preview")}var x=function(){var S=o.options.previewRender(o.value(),a);S!=null&&(a.innerHTML=S)};if(l.sideBySideRenderingFunction||(l.sideBySideRenderingFunction=x),p){var C=o.options.previewRender(o.value(),a);C!=null&&(a.innerHTML=C),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,p=s.lastChild,c=l.getWrapperElement().nextSibling;if(c.classList.contains("editor-preview-active-side")&&wn(o),!p||!p.classList.contains("editor-preview-full")){if(p=document.createElement("div"),p.className="editor-preview-full",o.options.previewClass)if(Array.isArray(o.options.previewClass))for(var d=0;d<o.options.previewClass.length;d++)p.classList.add(o.options.previewClass[d]);else typeof o.options.previewClass=="string"&&p.classList.add(o.options.previewClass);s.appendChild(p)}p.classList.contains("editor-preview-active")?(p.classList.remove("editor-preview-active"),f&&(f.classList.remove("active"),a.classList.remove("disabled-for-preview"))):(setTimeout(function(){p.classList.add("editor-preview-active")},1),f&&(f.classList.add("active"),a.classList.add("disabled-for-preview")));var m=o.options.previewRender(o.value(),p);m!==null&&(p.innerHTML=m)}function Gr(o,l,s,a){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active")){var f,p=s[0],c=s[1],d={},m={};Object.assign(d,o.getCursor("start")),Object.assign(m,o.getCursor("end")),a&&(p=p.replace("#url#",a),c=c.replace("#url#",a)),l?(f=o.getLine(d.line),p=f.slice(0,d.ch),c=f.slice(d.ch),o.replaceRange(p+c,{line:d.line,ch:0})):(f=o.getSelection(),o.replaceSelection(p+f+c),d.ch+=p.length,d!==m&&(m.ch+=p.length)),o.setSelection(d,m),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"),p=a.line;p<=f.line;p++)(function(c){var d=o.getLine(c),m=d.search(/[^#]/);l!==void 0?m<=0?l=="bigger"?d="###### "+d:d="# "+d:m==6&&l=="smaller"?d=d.substr(7):m==1&&l=="bigger"?d=d.substr(2):l=="bigger"?d=d.substr(1):d="#"+d:m<=0?d="#".repeat(s)+" "+d:m==s?d=d.substr(m+1):d="#".repeat(s)+" "+d.substr(m+1),o.replaceRange(d,{line:c,ch:0},{line:c,ch:99999999999999})})(p);o.focus()}}function _o(o,l,s){if(!o.getWrapperElement().lastChild.classList.contains("editor-preview-active")){var a=/^(\s*)(\*|-|\+|\d*\.)(\s+)/,f=/^\s*/,p=Sr(o),c=o.getCursor("start"),d=o.getCursor("end"),m={quote:/^(\s*)>\s+/,"unordered-list":a,"ordered-list":a,"check-list":/^(\s*)(- \[[ xX]])(\s+)/},y=function(O,N){var I={quote:">","unordered-list":s,"ordered-list":"%%i.","check-list":"- [ ]"};return I[O].replace("%%i",N)},x=function(O,N){var I={quote:">","unordered-list":"\\"+s,"ordered-list":"\\d+.","check-list":"- \\[[ xX]]"},P=new RegExp(I[O]);return N&&P.test(N)},C=function(O,N,I){var P=a.exec(N),q=y(O,S);return P!==null?(x(O,P[2])&&(q=""),N=P[1]+q+P[3]+N.replace(f,"").replace(m[O],"$1")):I==!1&&(N=q+" "+N),N},S=1,A=["unordered-list","ordered-list","check-list"],_=Object.keys(p)[0];if(!A.includes(_)){var L=o.getLine(c.line);/^\s*- \[[ xX]]\s/.test(L)?_="check-list":/^\s*\d+\.\s/.test(L)?_="ordered-list":/^\s*[*\-+]\s/.test(L)&&(_="unordered-list")}for(var T=c.line;T<=d.line;T++)(function(O){var N=o.getLine(O);p[l]?N=N.replace(m[l],"$1"):A.includes(_)&&A.includes(l)?(N=N.replace(m[_],"$1"),N=C(l,N,!1),S+=1):(N=C(l,N,!1),S+=1),o.replaceRange(N,{line:O,ch:0},{line:O,ch:99999999999999})})(T);o.focus()}}function ec(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){var f=o.codemirror,p=Sr(f),c=p[l];if(!c){Gr(f,c,s,a);return}var d=f.getCursor("start"),m=f.getCursor("end"),y=f.getLine(d.line),x=y.slice(0,d.ch),C=y.slice(d.ch);l=="link"?x=x.replace(/(.*)[^!]\[/,"$1"):l=="image"&&(x=x.replace(/(.*)!\[$/,"$1")),C=C.replace(/]\(.*?\)/,""),f.replaceRange(x+C,{line:d.line,ch:0},{line:d.line,ch:99999999999999}),d.ch-=s[0].length,d!==m&&(m.ch-=s[0].length),f.setSelection(d,m),f.focus()}}function yl(o,l,s,a){if(!(!o.codemirror||o.isPreviewActive())){a=typeof a>"u"?s:a;var f=o.codemirror,p=Sr(f),c,d=s,m=a,y=f.getCursor("start"),x=f.getCursor("end");p[l]?(c=f.getLine(y.line),d=c.slice(0,y.ch),m=c.slice(y.ch),l=="bold"?(d=d.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),m=m.replace(/(\*\*|__)/,"")):l=="italic"?(d=d.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),m=m.replace(/(\*|_)/,"")):l=="strikethrough"&&(d=d.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),m=m.replace(/(\*\*|~~)/,"")),f.replaceRange(d+m,{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+m),y.ch+=s.length,x.ch=y.ch+c.length),f.setSelection(y,x),f.focus()}}function _p(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 _e={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:_e.bold,title:"Bold",default:!0},italic:{name:"italic",action:ho,className:_e.italic,title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:po,className:_e.strikethrough,title:"Strikethrough"},heading:{name:"heading",action:fi,className:_e.heading,title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:fi,className:_e["heading-smaller"],title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:mo,className:_e["heading-bigger"],title:"Bigger Heading"},"heading-1":{name:"heading-1",action:bo,className:_e["heading-1"],title:"Big Heading"},"heading-2":{name:"heading-2",action:yo,className:_e["heading-2"],title:"Medium Heading"},"heading-3":{name:"heading-3",action:xo,className:_e["heading-3"],title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:go,className:_e.code,title:"Code"},quote:{name:"quote",action:vo,className:_e.quote,title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:Do,className:_e["unordered-list"],title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:wo,className:_e["ordered-list"],title:"Numbered List",default:!0},"check-list":{name:"check-list",action:Co,className:_e["check-list"],title:"Check List",default:!0},"clean-block":{name:"clean-block",action:ko,className:_e["clean-block"],title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:So,className:_e.link,title:"Create Link",default:!0},image:{name:"image",action:Eo,className:_e.image,title:"Insert Image",default:!0},"upload-image":{name:"upload-image",action:bl,className:_e["upload-image"],title:"Import an image"},table:{name:"table",action:Ao,className:_e.table,title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:Fo,className:_e["horizontal-rule"],title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:Mo,className:_e.preview,noDisable:!0,title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:wn,className:_e["side-by-side"],noDisable:!0,noMobile:!0,title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:jr,className:_e.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:_e.guide,noDisable:!0,title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:To,className:_e.undo,noDisable:!0,title:"Undo"},redo:{name:"redo",action:Lo,className:_e.redo,noDisable:!0,title:"Redo"}},Bp={link:["[","](#url#)"],image:[""],uploadedImage:["",""],table:["",`
|
|
|
|
| Column 1 | Column 2 | Column 3 |
|
|
| -------- | -------- | -------- |
|
|
| Text | Text | Text |
|
|
|
|
`],horizontalRule:["",`
|
|
|
|
-----
|
|
|
|
`]},Np={link:"URL for the link:",image:"URL of the image:"},Op={locale:"en-US",format:{hour:"2-digit",minute:"2-digit"}},Ip={bold:"**",code:"```",italic:"*"},Pp={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"},zp={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 p in Ur)Object.prototype.hasOwnProperty.call(Ur,p)&&(p.indexOf("separator-")!=-1&&o.toolbar.push("|"),(Ur[p].default===!0||o.showIcons&&o.showIcons.constructor===Array&&o.showIcons.indexOf(p)!=-1)&&o.toolbar.push(p))}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({},Bp,o.insertTexts||{}),o.promptTexts=sr({},Np,o.promptTexts||{}),o.blockStyles=sr({},Ip,o.blockStyles||{}),o.autosave!=null&&(o.autosave.timeFormat=sr({},Op,o.autosave.timeFormat||{})),o.iconClassMap=sr({},_e,o.iconClassMap||{}),o.shortcuts=sr({},Sp,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({},Pp,o.imageTexts||{}),o.errorMessages=sr({},zp,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,m){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),m.stopPropagation(),m.preventDefault()}),this.codemirror.on("dragend",function(d,m){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),m.stopPropagation(),m.preventDefault()}),this.codemirror.on("dragleave",function(d,m){c.updateStatusBar("upload-image",c.options.imageTexts.sbInit),m.stopPropagation(),m.preventDefault()}),this.codemirror.on("dragover",function(d,m){c.updateStatusBar("upload-image",c.options.imageTexts.sbOnDragEnter),m.stopPropagation(),m.preventDefault()}),this.codemirror.on("drop",function(d,m){m.stopPropagation(),m.preventDefault(),o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,m.dataTransfer.files):c.uploadImages(m.dataTransfer.files)}),this.codemirror.on("paste",function(d,m){o.imageUploadFunction?c.uploadImagesUsingCustomFunction(o.imageUploadFunction,m.clipboardData.files):c.uploadImages(m.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(hl){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,p){return p&&s.getLanguage(p)?s.highlight(p,f).value:s.highlightAuto(f).value})}hl.use(l);var a=hl.parse(o);return this.options.renderingConfig&&typeof this.options.renderingConfig.sanitizerFunction=="function"&&(a=this.options.renderingConfig.sanitizerFunction.call(this,a)),a=Ap(a),a=Fp(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&&ui[f]!==null&&function(T){a[Jf(l.shortcuts[T])]=function(){var O=ui[T];typeof O=="function"?O(s):typeof O=="string"&&window.open(O,"_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 p,c;l.overlayMode?(Dn.defineMode("overlay-mode",function(T){return Dn.overlayMode(Dn.getMode(T,l.spellChecker!==!1?"spell-checker":"gfm"),l.overlayMode.mode,l.overlayMode.combine)}),p="overlay-mode",c=l.parsingConfig,c.gitHubSpice=!1):(p=l.parsingConfig,p.name="gfm",p.gitHubSpice=!1),l.spellChecker!==!1&&(p="spell-checker",c=l.parsingConfig,c.name="gfm",c.gitHubSpice=!1,typeof l.spellChecker=="function"?l.spellChecker({codeMirrorInstance:Dn}):Cp({codeMirrorInstance:Dn}));function d(T,O,N){return{addNew:!1}}if(this.codemirror=Dn.fromTextArea(o,{mode:p,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:!pl(),scrollbarStyle:l.scrollbarStyle!=null?l.scrollbarStyle:"native",configureMouse:d,inputStyle:l.inputStyle!=null?l.inputStyle:pl()?"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 m=this.codemirror;m.on("change",function(){m.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 C(T,O){var N,I=window.getComputedStyle(document.querySelector(".CodeMirror-sizer")).width.replace("px","");return T<I?N=O+"px":N=O/T*100+"%",N}var S=this;function A(T,O){var N=new URL(O.url,document.baseURI).href;T.setAttribute("data-img-src",N),T.setAttribute("style","--bg-image:url("+N+");--width:"+O.naturalWidth+"px;--height:"+C(O.naturalWidth,O.naturalHeight)),S.codemirror.setSize()}function _(){l.previewImagesInEditor&&y.querySelectorAll(".cm-image-marker").forEach(function(T){var O=T.parentElement;if(O.innerText.match(/^!\[.*?\]\(.*\)/g)&&!O.hasAttribute("data-img-src")){var N=O.innerText.match(/!\[.*?\]\((.*?)\)/);if(window.EMDEimagesCache||(window.EMDEimagesCache={}),N&&N.length>=2){var I=N[1];if(l.imagesPreviewHandler){var P=l.imagesPreviewHandler(N[1]);typeof P=="string"&&(I=P)}if(window.EMDEimagesCache[I])A(O,window.EMDEimagesCache[I]);else{window.EMDEimagesCache[I]={};var q=document.createElement("img");q.onload=function(){window.EMDEimagesCache[I]={naturalWidth:q.naturalWidth,naturalHeight:q.naturalHeight,url:I},A(O,window.EMDEimagesCache[I])},q.src=I}}}})}this.codemirror.on("update",function(){_()}),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),p=this.options.autosave.text==null?"Autosaved: ":this.options.autosave.text;s.innerHTML=p+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(p){s.options.imageUploadFunction?s.uploadImagesUsingCustomFunction(s.options.imageUploadFunction,p.target.files):s.uploadImages(p.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){Vf(a,y)};function f(m){a.updateStatusBar("upload-image",m),setTimeout(function(){a.updateStatusBar("upload-image",a.options.imageTexts.sbInit)},1e4),s&&typeof s=="function"&&s(m),a.options.errorCallback(m)}function p(m){var y=a.options.imageTexts.sizeUnits.split(",");return m.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(p(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(m){if(m.lengthComputable){var y=""+Math.round(m.loaded*100/m.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 m=JSON.parse(this.responseText)}catch{console.error("EasyMDE: The server did not return a valid json."),f(p(a.options.errorMessages.importError));return}this.status===200&&m&&!m.error&&m.data&&m.data.filePath?l((a.options.imagePathAbsolute?"":window.location.origin+"/")+m.data.filePath):m.error&&m.error in a.options.errorMessages?f(p(a.options.errorMessages[m.error])):m.error?f(p(m.error)):(console.error("EasyMDE: Received an unexpected response after uploading the image."+this.status+" ("+this.statusText+")"),f(p(a.options.errorMessages.importError)))},d.onerror=function(m){console.error("EasyMDE: An unexpected error occurred when trying to upload the image."+m.target.status+" ("+m.target.statusText+")"),f(a.options.errorMessages.importError)},d.send(c)};re.prototype.uploadImageUsingCustomFunction=function(o,l){var s=this;function a(c){Vf(s,c)}function f(c){var d=p(c);s.updateStatusBar("upload-image",d),setTimeout(function(){s.updateStatusBar("upload-image",s.options.imageTexts.sbInit)},1e4),s.options.errorCallback(d)}function p(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),p=parseInt(this.options.maxHeight),c=p+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,p=!1;return o.on("scroll",function(c){if(f){f=!1;return}p=!0;var d=c.getScrollInfo().height-c.getScrollInfo().clientHeight,m=parseFloat(c.getScrollInfo().top)/d,y=(s.scrollHeight-s.clientHeight)*m;s.scrollTop=y}),s.onscroll=function(){if(p){p=!1;return}f=!0;var c=s.scrollHeight-s.clientHeight,d=parseFloat(s.scrollTop)/c,m=(o.getScrollInfo().height-o.getScrollInfo().clientHeight)*d;o.scrollTo(0,m)},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")&&pl())){if(o[l]==="|"){for(var p=!1,c=l+1;c<o.length;c++)o[c]!=="|"&&(!a.options.hideIcons||a.options.hideIcons.indexOf(o[c].name)==-1)&&(p=!0);if(!p)continue}(function(y){var x;if(y==="|"?x=Lp():y.children?x=Tp(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 C=document.createElement("input");C.className="imageInput",C.type="file",C.multiple=!0,C.name=a.options.imageInputName,C.accept=a.options.imageAccept,C.style.display="none",C.style.opacity=0,s.appendChild(C)}})(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(C){var S=f[C];y[C]?S.classList.add("active"):C!="fullscreen"&&C!="side-by-side"&&S.classList.remove("active")})(x)});var m=d.getWrapperElement();return m.parentNode.insertBefore(s,m),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,p,c,d;for(f=0;f<o.length;f++)if(p=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 m=o[f];m==="words"?(d=function(A){A.innerHTML=Zf(s.getValue())},p=function(A){A.innerHTML=Zf(s.getValue())}):m==="lines"?(d=function(A){A.innerHTML=s.lineCount()},p=function(A){A.innerHTML=s.lineCount()}):m==="cursor"?(d=function(A){A.innerHTML="1:1"},c=function(A){var _=s.getCursor(),L=_.line+1,T=_.ch+1;A.innerHTML=L+":"+T}):m==="autosave"?d=function(A){l.autosave!=null&&l.autosave.enabled===!0&&A.setAttribute("id","autosaved")}:m==="upload-image"&&(d=function(A){A.innerHTML=l.imageTexts.sbInit}),a.push({className:m,defaultValue:d,onUpdate:p,onActivity:c})}var y=document.createElement("div");for(y.className="editor-statusbar",f=0;f<a.length;f++){var x=a[f],C=document.createElement("span");C.className=x.className,typeof x.defaultValue=="function"&&x.defaultValue(C),typeof x.onUpdate=="function"&&this.codemirror.on("update",function(A,_){return function(){_.onUpdate(A)}}(C,x)),typeof x.onActivity=="function"&&this.codemirror.on("cursorActivity",function(A,_){return function(){_.onActivity(A)}}(C,x)),y.appendChild(C)}var S=this.codemirror.getWrapperElement();return S.parentNode.insertBefore(y,S.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=vo;re.toggleHeadingSmaller=fi;re.toggleHeadingBigger=mo;re.toggleHeading1=bo;re.toggleHeading2=yo;re.toggleHeading3=xo;re.toggleHeading4=gl;re.toggleHeading5=vl;re.toggleHeading6=ml;re.toggleCodeBlock=go;re.toggleUnorderedList=Do;re.toggleOrderedList=wo;re.toggleCheckList=Co;re.cleanBlock=ko;re.drawLink=So;re.drawImage=Eo;re.drawUploadedImage=bl;re.drawTable=Ao;re.drawHorizontalRule=Fo;re.undo=To;re.redo=Lo;re.togglePreview=Mo;re.toggleSideBySide=wn;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(){vo(this)};re.prototype.toggleHeadingSmaller=function(){fi(this)};re.prototype.toggleHeadingBigger=function(){mo(this)};re.prototype.toggleHeading1=function(){bo(this)};re.prototype.toggleHeading2=function(){yo(this)};re.prototype.toggleHeading3=function(){xo(this)};re.prototype.toggleHeading4=function(){gl(this)};re.prototype.toggleHeading5=function(){vl(this)};re.prototype.toggleHeading6=function(){ml(this)};re.prototype.toggleCodeBlock=function(){go(this)};re.prototype.toggleUnorderedList=function(){Do(this)};re.prototype.toggleOrderedList=function(){wo(this)};re.prototype.toggleCheckList=function(){Co(this)};re.prototype.cleanBlock=function(){ko(this)};re.prototype.drawLink=function(){So(this)};re.prototype.drawImage=function(){Eo(this)};re.prototype.drawUploadedImage=function(){bl(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(){wn(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())};nc.exports=re});var Zr=Kh(ic());function Hp(o,l,s){return(l=Up(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){Hp(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 Rp(o,l){if(o==null)return{};var s,a,f=Wp(o,l);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(o);for(a=0;a<p.length;a++)s=p[a],l.indexOf(s)===-1&&{}.propertyIsEnumerable.call(o,s)&&(f[s]=o[s])}return f}function Wp(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 qp(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 Up(o){var l=qp(o,"string");return typeof l=="symbol"?l:l+""}function Tl(o){"@babel/helpers - typeof";return Tl=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},Tl(o)}var jp="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),yi=ur(/Edge/i),ac=ur(/firefox/i),pi=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 Wo(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 vc(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&&Wo(o,l):Wo(o,l))||a&&o===s)return o;if(o===s)break}while(o=vc(o))}return null}var lc=/\s+/g;function Bt(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 de(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 An(o,l){var s="";if(typeof o=="string")s=o;else do{var a=de(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 mc(o,l,s){if(o){var a=o.getElementsByTagName(l),f=0,p=a.length;if(s)for(;f<p;f++)s(a[f],f);return a}return[]}function Vt(){var o=document.scrollingElement;return o||document.documentElement}function $e(o,l,s,a,f){if(!(!o.getBoundingClientRect&&o!==window)){var p,c,d,m,y,x,C;if(o!==window&&o.parentNode&&o!==Vt()?(p=o.getBoundingClientRect(),c=p.top,d=p.left,m=p.bottom,y=p.right,x=p.height,C=p.width):(c=0,d=0,m=window.innerHeight,y=window.innerWidth,x=window.innerHeight,C=window.innerWidth),(l||s)&&o!==window&&(f=f||o.parentNode,!cr))do if(f&&f.getBoundingClientRect&&(de(f,"transform")!=="none"||s&&de(f,"position")!=="static")){var S=f.getBoundingClientRect();c-=S.top+parseInt(de(f,"border-top-width")),d-=S.left+parseInt(de(f,"border-left-width")),m=c+p.height,y=d+p.width;break}while(f=f.parentNode);if(a&&o!==window){var A=An(f||o),_=A&&A.a,L=A&&A.d;A&&(c/=L,d/=_,C/=_,x/=L,m=c+x,y=d+C)}return{top:c,left:d,bottom:m,right:y,width:C,height:x}}}function sc(o,l,s){for(var a=Tr(o,!0),f=$e(o)[l];a;){var p=$e(a)[s],c=void 0;if(s==="top"||s==="left"?c=f>=p:c=f<=p,!c)return a;if(a===Vt())break;a=Tr(a,!1)}return!1}function Fn(o,l,s,a){for(var f=0,p=0,c=o.children;p<c.length;){if(c[p].style.display!=="none"&&c[p]!==he.ghost&&(a||c[p]!==he.dragged)&&Gt(c[p],s.draggable,o,!1)){if(f===l)return c[p];f++}p++}return null}function Ol(o,l){for(var s=o.lastElementChild;s&&(s===he.ghost||de(s,"display")==="none"||l&&!Wo(s,l));)s=s.previousElementSibling;return s||null}function Pt(o,l){var s=0;if(!o||!o.parentNode)return-1;for(;o=o.previousElementSibling;)o.nodeName.toUpperCase()!=="TEMPLATE"&&o!==he.clone&&(!l||Wo(o,l))&&s++;return s}function uc(o){var l=0,s=0,a=Vt();if(o)do{var f=An(o),p=f.a,c=f.d;l+=o.scrollLeft*p,s+=o.scrollTop*c}while(o!==a&&(o=o.parentNode));return[l,s]}function Gp(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 Vt();var s=o,a=!1;do if(s.clientWidth<s.scrollWidth||s.clientHeight<s.scrollHeight){var f=de(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 Vt();if(a||l)return s;a=!0}}while(s=s.parentNode);return Vt()}function Xp(o,l){if(o&&l)for(var s in l)l.hasOwnProperty(s)&&(o[s]=l[s]);return o}function xl(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 gi;function bc(o,l){return function(){if(!gi){var s=arguments,a=this;s.length===1?o.call(a,s[0]):o.apply(a,s),gi=setTimeout(function(){gi=void 0},l)}}}function Kp(){clearTimeout(gi),gi=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 Dc(o,l,s){var a={};return Array.from(o.children).forEach(function(f){var p,c,d,m;if(!(!Gt(f,l.draggable,o,!1)||f.animated||f===s)){var y=$e(f);a.left=Math.min((p=a.left)!==null&&p!==void 0?p: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((m=a.bottom)!==null&&m!==void 0?m:-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 Ft="Sortable"+new Date().getTime();function Yp(){var o=[],l;return{captureAnimationState:function(){if(o=[],!!this.options.animation){var a=[].slice.call(this.el.children);a.forEach(function(f){if(!(de(f,"display")==="none"||f===he.ghost)){o.push({target:f,rect:$e(f)});var p=er({},o[o.length-1].rect);if(f.thisAnimationDuration){var c=An(f,!0);c&&(p.top-=c.f,p.left-=c.e)}f.fromRect=p}})}},addAnimationState:function(a){o.push(a)},removeAnimationState:function(a){o.splice(Gp(o,{target:a}),1)},animateAll:function(a){var f=this;if(!this.options.animation){clearTimeout(l),typeof a=="function"&&a();return}var p=!1,c=0;o.forEach(function(d){var m=0,y=d.target,x=y.fromRect,C=$e(y),S=y.prevFromRect,A=y.prevToRect,_=d.rect,L=An(y,!0);L&&(C.top-=L.f,C.left-=L.e),y.toRect=C,y.thisAnimationDuration&&xl(S,C)&&!xl(x,C)&&(_.top-C.top)/(_.left-C.left)===(x.top-C.top)/(x.left-C.left)&&(m=Qp(_,S,A,f.options)),xl(C,x)||(y.prevFromRect=x,y.prevToRect=C,m||(m=f.options.animation),f.animate(y,_,C,m)),m&&(p=!0,c=Math.max(c,m),clearTimeout(y.animationResetTimer),y.animationResetTimer=setTimeout(function(){y.animationTime=0,y.prevFromRect=null,y.fromRect=null,y.prevToRect=null,y.thisAnimationDuration=null},m),y.thisAnimationDuration=m)}),clearTimeout(l),p?l=setTimeout(function(){typeof a=="function"&&a()},c):typeof a=="function"&&a(),o=[]},animate:function(a,f,p,c){if(c){de(a,"transition",""),de(a,"transform","");var d=An(this.el),m=d&&d.a,y=d&&d.d,x=(f.left-p.left)/(m||1),C=(f.top-p.top)/(y||1);a.animatingX=!!x,a.animatingY=!!C,de(a,"transform","translate3d("+x+"px,"+C+"px,0)"),this.forRepaintDummy=Zp(a),de(a,"transition","transform "+c+"ms"+(this.options.easing?" "+this.options.easing:"")),de(a,"transform","translate3d(0,0,0)"),typeof a.animated=="number"&&clearTimeout(a.animated),a.animated=setTimeout(function(){de(a,"transition",""),de(a,"transform",""),a.animated=!1,a.animatingX=!1,a.animatingY=!1},c)}}}}function Zp(o){return o.offsetWidth}function Qp(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 Cn=[],Dl={initializeByDefault:!0},xi={mount:function(l){for(var s in Dl)Dl.hasOwnProperty(s)&&!(s in l)&&(l[s]=Dl[s]);Cn.forEach(function(a){if(a.pluginName===l.pluginName)throw"Sortable: Cannot mount plugin ".concat(l.pluginName," more than once")}),Cn.push(l)},pluginEvent:function(l,s,a){var f=this;this.eventCanceled=!1,a.cancel=function(){f.eventCanceled=!0};var p=l+"Global";Cn.forEach(function(c){s[c.pluginName]&&(s[c.pluginName][p]&&s[c.pluginName][p](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){Cn.forEach(function(d){var m=d.pluginName;if(!(!l.options[m]&&!d.initializeByDefault)){var y=new d(l,s,l.options);y.sortable=l,y.options=l.options,l[m]=y,fr(a,y.defaults)}});for(var p in l.options)if(l.options.hasOwnProperty(p)){var c=this.modifyOption(l,p,l.options[p]);typeof c<"u"&&(l.options[p]=c)}},getEventProperties:function(l,s){var a={};return Cn.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 Cn.forEach(function(p){l[p.pluginName]&&p.optionListeners&&typeof p.optionListeners[s]=="function"&&(f=p.optionListeners[s].call(l[p.pluginName],a))}),f}};function Jp(o){var l=o.sortable,s=o.rootEl,a=o.name,f=o.targetEl,p=o.cloneEl,c=o.toEl,d=o.fromEl,m=o.oldIndex,y=o.newIndex,x=o.oldDraggableIndex,C=o.newDraggableIndex,S=o.originalEvent,A=o.putSortable,_=o.extraEventProperties;if(l=l||s&&s[Ft],!!l){var L,T=l.options,O="on"+a.charAt(0).toUpperCase()+a.substr(1);window.CustomEvent&&!cr&&!yi?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=p,L.oldIndex=m,L.newIndex=y,L.oldDraggableIndex=x,L.newDraggableIndex=C,L.originalEvent=S,L.pullMode=A?A.lastPutMode:void 0;var N=er(er({},_),xi.getEventProperties(a,l));for(var I in N)L[I]=N[I];s&&s.dispatchEvent(L),T[O]&&T[O].call(l,L)}}var $p=["evt"],At=function(l,s){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},f=a.evt,p=Rp(a,$p);xi.pluginEvent.bind(he)(l,s,er({dragEl:$,parentEl:Ue,ghostEl:be,rootEl:ze,nextEl:Yr,lastDownEl:Po,cloneEl:We,cloneHidden:Fr,dragStarted:ci,putSortable:ut,activeSortable:he.active,originalEvent:f,oldIndex:En,oldDraggableIndex:vi,newIndex:Nt,newDraggableIndex:Ar,hideGhostForTarget:Sc,unhideGhostForTarget:Ec,cloneNowHidden:function(){Fr=!0},cloneNowShown:function(){Fr=!1},dispatchSortableEvent:function(d){Ct({sortable:s,name:d,originalEvent:f})}},p))};function Ct(o){Jp(er({putSortable:ut,cloneEl:We,targetEl:$,rootEl:ze,oldIndex:En,oldDraggableIndex:vi,newIndex:Nt,newDraggableIndex:Ar},o))}var $,Ue,be,ze,Yr,Po,We,Fr,En,Nt,vi,Ar,Bo,ut,Sn=!1,qo=!1,Uo=[],Xr,jt,wl,Cl,fc,cc,ci,kn,mi,bi=!1,No=!1,zo,pt,kl=[],Ll=!1,jo=[],Xo=typeof document<"u",Oo=Nl,dc=yi||cr?"cssFloat":"float",Vp=Xo&&!pc&&!Nl&&"draggable"in document.createElement("div"),wc=function(){if(Xo){if(cr)return!1;var o=document.createElement("x");return o.style.cssText="pointer-events:auto",o.style.pointerEvents==="auto"}}(),Cc=function(l,s){var a=de(l),f=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),p=Fn(l,0,s),c=Fn(l,1,s),d=p&&de(p),m=c&&de(c),y=d&&parseInt(d.marginLeft)+parseInt(d.marginRight)+$e(p).width,x=m&&parseInt(m.marginLeft)+parseInt(m.marginRight)+$e(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(p&&d.float&&d.float!=="none"){var C=d.float==="left"?"left":"right";return c&&(m.clear==="both"||m.clear===C)?"vertical":"horizontal"}return p&&(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"},eg=function(l,s,a){var f=a?l.left:l.top,p=a?l.right:l.bottom,c=a?l.width:l.height,d=a?s.left:s.top,m=a?s.right:s.bottom,y=a?s.width:s.height;return f===d||p===m||f+c/2===d+y/2},tg=function(l,s){var a;return Uo.some(function(f){var p=f[Ft].options.emptyInsertThreshold;if(!(!p||Ol(f))){var c=$e(f),d=l>=c.left-p&&l<=c.right+p,m=s>=c.top-p&&s<=c.bottom+p;if(d&&m)return a=f}}),a},kc=function(l){function s(p,c){return function(d,m,y,x){var C=d.options.group.name&&m.options.group.name&&d.options.group.name===m.options.group.name;if(p==null&&(c||C))return!0;if(p==null||p===!1)return!1;if(c&&p==="clone")return p;if(typeof p=="function")return s(p(d,m,y,x),c)(d,m,y,x);var S=(c?d:m).options.group.name;return p===!0||typeof p=="string"&&p===S||p.join&&p.indexOf(S)>-1}}var a={},f=l.group;(!f||Tl(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(){!wc&&be&&de(be,"display","none")},Ec=function(){!wc&&be&&de(be,"display","")};Xo&&!pc&&document.addEventListener("click",function(o){if(qo)return o.preventDefault(),o.stopPropagation&&o.stopPropagation(),o.stopImmediatePropagation&&o.stopImmediatePropagation(),qo=!1,!1},!0);var Kr=function(l){if($){l=l.touches?l.touches[0]:l;var s=tg(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[Ft]._onDragOver(a)}}},rg=function(l){$&&$.parentNode[Ft]._isOutsideThisEl(l.target)};function he(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[Ft]=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 Cc(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:he.supportPointer!==!1&&"PointerEvent"in window&&(!pi||Nl),emptyInsertThreshold:5};xi.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:Vp,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,Yp())}he.prototype={constructor:he,_isOutsideThisEl:function(l){!this.el.contains(l)&&l!==this.el&&(kn=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,p=f.preventOnFilter,c=l.type,d=l.touches&&l.touches[0]||l.pointerType&&l.pointerType==="touch"&&l,m=(d||l).target,y=l.target.shadowRoot&&(l.path&&l.path[0]||l.composedPath&&l.composedPath()[0])||m,x=f.filter;if(fg(a),!$&&!(/mousedown|pointerdown/.test(c)&&l.button!==0||f.disabled)&&!y.isContentEditable&&!(!this.nativeDraggable&&pi&&m&&m.tagName.toUpperCase()==="SELECT")&&(m=Gt(m,f.draggable,a,!1),!(m&&m.animated)&&Po!==m)){if(En=Pt(m),vi=Pt(m,f.draggable),typeof x=="function"){if(x.call(this,l,m,this)){Ct({sortable:s,rootEl:y,name:"filter",targetEl:m,toEl:a,fromEl:a}),At("filter",s,{evt:l}),p&&l.preventDefault();return}}else if(x&&(x=x.split(",").some(function(C){if(C=Gt(y,C.trim(),a,!1),C)return Ct({sortable:s,rootEl:C,name:"filter",targetEl:m,fromEl:a,toEl:a}),At("filter",s,{evt:l}),!0}),x)){p&&l.preventDefault();return}f.handle&&!Gt(y,f.handle,a,!1)||this._prepareDragStart(l,d,m)}}},_prepareDragStart:function(l,s,a){var f=this,p=f.el,c=f.options,d=p.ownerDocument,m;if(a&&!$&&a.parentNode===p){var y=$e(a);if(ze=p,$=a,Ue=$.parentNode,Yr=$.nextSibling,Po=a,Bo=c.group,he.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",m=function(){if(At("delayEnded",f,{evt:l}),he.eventCanceled){f._onDrop();return}f._disableDelayedDragEvents(),!ac&&f.nativeDraggable&&($.draggable=!0),f._triggerDragStart(l,s),Ct({sortable:f,name:"choose",originalEvent:l}),Bt($,c.chosenClass,!0)},c.ignore.split(",").forEach(function(x){mc($,x.trim(),Sl)}),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),At("delayStart",this,{evt:l}),c.delay&&(!c.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(yi||cr))){if(he.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(m,c.delay)}else m()}},_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(){$&&Sl($),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(ze,"dragstart",this._onDragStart));try{document.selection?Ho(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(l,s){if(Sn=!1,ze&&$){At("dragStarted",this,{evt:s}),this.nativeDraggable&&Se(document,"dragover",rg);var a=this.options;!l&&Bt($,a.dragClass,!1),Bt($,a.ghostClass,!0),he.active=this,l&&this._appendGhost(),Ct({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[Ft]._isOutsideThisEl(l),s)do{if(s[Ft]){var a=void 0;if(a=s[Ft]._onDragOver({clientX:jt.clientX,clientY:jt.clientY,target:l,rootEl:s}),a&&!this.options.dragoverBubble)break}l=s}while(s=vc(s));Ec()}},_onTouchMove:function(l){if(Xr){var s=this.options,a=s.fallbackTolerance,f=s.fallbackOffset,p=l.touches?l.touches[0]:l,c=be&&An(be,!0),d=be&&c&&c.a,m=be&&c&&c.d,y=Oo&&pt&&uc(pt),x=(p.clientX-Xr.clientX+f.x)/(d||1)+(y?y[0]-kl[0]:0)/(d||1),C=(p.clientY-Xr.clientY+f.y)/(m||1)+(y?y[1]-kl[1]:0)/(m||1);if(!he.active&&!Sn){if(a&&Math.max(Math.abs(p.clientX-this._lastX),Math.abs(p.clientY-this._lastY))<a)return;this._onDragStart(l,!0)}if(be){c?(c.e+=x-(wl||0),c.f+=C-(Cl||0)):c={a:1,b:0,c:0,d:1,e:x,f:C};var S="matrix(".concat(c.a,",").concat(c.b,",").concat(c.c,",").concat(c.d,",").concat(c.e,",").concat(c.f,")");de(be,"webkitTransform",S),de(be,"mozTransform",S),de(be,"msTransform",S),de(be,"transform",S),wl=x,Cl=C,jt=p}l.cancelable&&l.preventDefault()}},_appendGhost:function(){if(!be){var l=this.options.fallbackOnBody?document.body:ze,s=$e($,!0,Oo,!0,l),a=this.options;if(Oo){for(pt=l;de(pt,"position")==="static"&&de(pt,"transform")==="none"&&pt!==document;)pt=pt.parentNode;pt!==document.body&&pt!==document.documentElement?(pt===document&&(pt=Vt()),s.top+=pt.scrollTop,s.left+=pt.scrollLeft):pt=Vt(),kl=uc(pt)}be=$.cloneNode(!0),Bt(be,a.ghostClass,!1),Bt(be,a.fallbackClass,!0),Bt(be,a.dragClass,!0),de(be,"transition",""),de(be,"transform",""),de(be,"box-sizing","border-box"),de(be,"margin",0),de(be,"top",s.top),de(be,"left",s.left),de(be,"width",s.width),de(be,"height",s.height),de(be,"opacity","0.8"),de(be,"position",Oo?"absolute":"fixed"),de(be,"zIndex","100000"),de(be,"pointerEvents","none"),he.ghost=be,l.appendChild(be),de(be,"transform-origin",fc/parseInt(be.style.width)*100+"% "+cc/parseInt(be.style.height)*100+"%")}},_onDragStart:function(l,s){var a=this,f=l.dataTransfer,p=a.options;if(At("dragStart",this,{evt:l}),he.eventCanceled){this._onDrop();return}At("setupClone",this),he.eventCanceled||(We=xc($),We.removeAttribute("id"),We.draggable=!1,We.style["will-change"]="",this._hideClone(),Bt(We,this.options.chosenClass,!1),he.clone=We),a.cloneId=Ho(function(){At("clone",a),!he.eventCanceled&&(a.options.removeCloneOnHide||ze.insertBefore(We,$),a._hideClone(),Ct({sortable:a,name:"clone"}))}),!s&&Bt($,p.dragClass,!0),s?(qo=!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",p.setData&&p.setData.call(a,f,$)),Se(document,"drop",a),de($,"transform","translateZ(0)")),Sn=!0,a._dragStartId=Ho(a._dragStarted.bind(a,s,l)),Se(document,"selectstart",a),ci=!0,window.getSelection().removeAllRanges(),pi&&de(document.body,"user-select","none")},_onDragOver:function(l){var s=this.el,a=l.target,f,p,c,d=this.options,m=d.group,y=he.active,x=Bo===m,C=d.sort,S=ut||y,A,_=this,L=!1;if(Ll)return;function T(De,Le){At(De,_,er({evt:l,isOwner:x,axis:A?"vertical":"horizontal",revert:c,dragRect:f,targetRect:p,canSort:C,fromSortable:S,target:a,completed:N,onMove:function(D,te){return Io(ze,s,$,f,D,$e(D),l,te)},changed:I},Le))}function O(){T("dragOverAnimationCapture"),_.captureAnimationState(),_!==S&&S.captureAnimationState()}function N(De){return T("dragOverCompleted",{insertion:De}),De&&(x?y._hideClone():y._showClone(_),_!==S&&(Bt($,ut?ut.options.ghostClass:y.options.ghostClass,!1),Bt($,d.ghostClass,!0)),ut!==_&&_!==he.active?ut=_:_===he.active&&ut&&(ut=null),S===_&&(_._ignoreWhileAnimating=a),_.animateAll(function(){T("dragOverAnimationComplete"),_._ignoreWhileAnimating=null}),_!==S&&(S.animateAll(),S._ignoreWhileAnimating=null)),(a===$&&!$.animated||a===s&&!a.animated)&&(kn=null),!d.dragoverBubble&&!l.rootEl&&a!==document&&($.parentNode[Ft]._isOutsideThisEl(l.target),!De&&Kr(l)),!d.dragoverBubble&&l.stopPropagation&&l.stopPropagation(),L=!0}function I(){Nt=Pt($),Ar=Pt($,d.draggable),Ct({sortable:_,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"),he.eventCanceled)return L;if($.contains(l.target)||a.animated&&a.animatingX&&a.animatingY||_._ignoreWhileAnimating===a)return N(!1);if(qo=!1,y&&!d.disabled&&(x?C||(c=Ue!==ze):ut===this||(this.lastPutMode=Bo.checkPull(this,y,$,l))&&m.checkPut(this,y,$,l))){if(A=this._getDirection(l,a)==="vertical",f=$e($),T("dragOverValid"),he.eventCanceled)return L;if(c)return Ue=ze,O(),this._hideClone(),T("revert"),he.eventCanceled||(Yr?ze.insertBefore($,Yr):ze.appendChild($)),N(!0);var P=Ol(s,d.draggable);if(!P||ag(l,A,this)&&!P.animated){if(P===$)return N(!1);if(P&&s===l.target&&(a=P),a&&(p=$e(a)),Io(ze,s,$,f,a,p,l,!!a)!==!1)return O(),P&&P.nextSibling?s.insertBefore($,P.nextSibling):s.appendChild($),Ue=s,I(),N(!0)}else if(P&&og(l,A,this)){var q=Fn(s,0,d,!0);if(q===$)return N(!1);if(a=q,p=$e(a),Io(ze,s,$,f,a,p,l,!1)!==!1)return O(),s.insertBefore($,q),Ue=s,I(),N(!0)}else if(a.parentNode===s){p=$e(a);var G=0,K,me=$.parentNode!==s,U=!eg($.animated&&$.toRect||f,a.animated&&a.toRect||p,A),le=A?"top":"left",j=sc(a,"top","top")||sc($,"top","top"),ee=j?j.scrollTop:void 0;kn!==a&&(K=p[le],bi=!1,No=!U&&d.invertSwap||me),G=lg(l,a,p,A,U?1:d.swapThreshold,d.invertedSwapThreshold==null?d.swapThreshold:d.invertedSwapThreshold,No,kn===a);var E;if(G!==0){var H=Pt($);do H-=G,E=Ue.children[H];while(E&&(de(E,"display")==="none"||E===be))}if(G===0||E===a)return N(!1);kn=a,mi=G;var W=a.nextElementSibling,Z=!1;Z=G===1;var ve=Io(ze,s,$,f,a,p,l,Z);if(ve!==!1)return(ve===1||ve===-1)&&(Z=ve===1),Ll=!0,setTimeout(ig,30),O(),Z&&!W?s.appendChild($):a.parentNode.insertBefore($,Z?W:a),j&&yc(j,0,ee-j.scrollTop),Ue=$.parentNode,K!==void 0&&!No&&(zo=Math.abs(K-$e(a)[le])),I(),N(!0)}if(s.contains($))return N(!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=Pt($),Ar=Pt($,a.draggable),At("drop",this,{evt:l}),Ue=$&&$.parentNode,Nt=Pt($),Ar=Pt($,a.draggable),he.eventCanceled){this._nulling();return}Sn=!1,No=!1,bi=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Ml(this.cloneId),Ml(this._dragStartId),this.nativeDraggable&&(ke(document,"drop",this),ke(s,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),pi&&de(document.body,"user-select",""),de($,"transform",""),l&&(ci&&(l.cancelable&&l.preventDefault(),!a.dropBubble&&l.stopPropagation()),be&&be.parentNode&&be.parentNode.removeChild(be),(ze===Ue||ut&&ut.lastPutMode!=="clone")&&We&&We.parentNode&&We.parentNode.removeChild(We),$&&(this.nativeDraggable&&ke($,"dragend",this),Sl($),$.style["will-change"]="",ci&&!Sn&&Bt($,ut?ut.options.ghostClass:this.options.ghostClass,!1),Bt($,this.options.chosenClass,!1),Ct({sortable:this,name:"unchoose",toEl:Ue,newIndex:null,newDraggableIndex:null,originalEvent:l}),ze!==Ue?(Nt>=0&&(Ct({rootEl:Ue,name:"add",toEl:Ue,fromEl:ze,originalEvent:l}),Ct({sortable:this,name:"remove",toEl:Ue,originalEvent:l}),Ct({rootEl:Ue,name:"sort",toEl:Ue,fromEl:ze,originalEvent:l}),Ct({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),ut&&ut.save()):Nt!==En&&Nt>=0&&(Ct({sortable:this,name:"update",toEl:Ue,originalEvent:l}),Ct({sortable:this,name:"sort",toEl:Ue,originalEvent:l})),he.active&&((Nt==null||Nt===-1)&&(Nt=En,Ar=vi),Ct({sortable:this,name:"end",toEl:Ue,originalEvent:l}),this.save()))),this._nulling()},_nulling:function(){At("nulling",this),ze=$=Ue=be=Yr=We=Po=Fr=Xr=jt=ci=Nt=Ar=En=vi=kn=mi=ut=Bo=he.dragged=he.ghost=he.clone=he.active=null;var l=this.el;jo.forEach(function(s){l.contains(s)&&(s.checked=!0)}),jo.length=wl=Cl=0},handleEvent:function(l){switch(l.type){case"drop":case"dragend":this._onDrop(l);break;case"dragenter":case"dragover":$&&(this._onDragOver(l),ng(l));break;case"selectstart":l.preventDefault();break}},toArray:function(){for(var l=[],s,a=this.el.children,f=0,p=a.length,c=this.options;f<p;f++)s=a[f],Gt(s,c.draggable,this.el,!1)&&l.push(s.getAttribute(c.dataIdAttr)||ug(s));return l},sort:function(l,s){var a={},f=this.el;this.toArray().forEach(function(p,c){var d=f.children[c];Gt(d,this.options.draggable,f,!1)&&(a[p]=d)},this),s&&this.captureAnimationState(),l.forEach(function(p){a[p]&&(f.removeChild(a[p]),f.appendChild(a[p]))}),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=xi.modifyOption(this,l,s);typeof f<"u"?a[l]=f:a[l]=s,l==="group"&&kc(a)},destroy:function(){At("destroy",this);var l=this.el;l[Ft]=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(At("hideClone",this),he.eventCanceled)return;de(We,"display","none"),this.options.removeCloneOnHide&&We.parentNode&&We.parentNode.removeChild(We),Fr=!0}},_showClone:function(l){if(l.lastPutMode!=="clone"){this._hideClone();return}if(Fr){if(At("showClone",this),he.eventCanceled)return;$.parentNode==ze&&!this.options.group.revertClone?ze.insertBefore(We,$):Yr?ze.insertBefore(We,Yr):ze.appendChild(We),this.options.group.revertClone&&this.animate($,We),de(We,"display",""),Fr=!1}}};function ng(o){o.dataTransfer&&(o.dataTransfer.dropEffect="move"),o.cancelable&&o.preventDefault()}function Io(o,l,s,a,f,p,c,d){var m,y=o[Ft],x=y.options.onMove,C;return window.CustomEvent&&!cr&&!yi?m=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(m=document.createEvent("Event"),m.initEvent("move",!0,!0)),m.to=l,m.from=o,m.dragged=s,m.draggedRect=a,m.related=f||l,m.relatedRect=p||$e(l),m.willInsertAfter=d,m.originalEvent=c,o.dispatchEvent(m),x&&(C=x.call(y,m,c)),C}function Sl(o){o.draggable=!1}function ig(){Ll=!1}function og(o,l,s){var a=$e(Fn(s.el,0,s.options,!0)),f=Dc(s.el,s.options,be),p=10;return l?o.clientX<f.left-p||o.clientY<a.top&&o.clientX<a.right:o.clientY<f.top-p||o.clientY<a.bottom&&o.clientX<a.left}function ag(o,l,s){var a=$e(Ol(s.el,s.options.draggable)),f=Dc(s.el,s.options,be),p=10;return l?o.clientX>f.right+p||o.clientY>a.bottom&&o.clientX>a.left:o.clientY>f.bottom+p||o.clientX>a.right&&o.clientY>a.top}function lg(o,l,s,a,f,p,c,d){var m=a?o.clientY:o.clientX,y=a?s.height:s.width,x=a?s.top:s.left,C=a?s.bottom:s.right,S=!1;if(!c){if(d&&zo<y*f){if(!bi&&(mi===1?m>x+y*p/2:m<C-y*p/2)&&(bi=!0),bi)S=!0;else if(mi===1?m<x+zo:m>C-zo)return-mi}else if(m>x+y*(1-f)/2&&m<C-y*(1-f)/2)return sg(l)}return S=S||c,S&&(m<x+y*p/2||m>C-y*p/2)?m>x+y/2?1:-1:0}function sg(o){return Pt($)<Pt(o)?1:-1}function ug(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 fg(o){jo.length=0;for(var l=o.getElementsByTagName("input"),s=l.length;s--;){var a=l[s];a.checked&&jo.push(a)}}function Ho(o){return setTimeout(o,0)}function Ml(o){return clearTimeout(o)}Xo&&Se(document,"touchmove",function(o){(he.active||Sn)&&o.cancelable&&o.preventDefault()});he.utils={on:Se,off:ke,css:de,find:mc,is:function(l,s){return!!Gt(l,s,l,!1)},extend:Xp,throttle:bc,closest:Gt,toggleClass:Bt,clone:xc,index:Pt,nextTick:Ho,cancelNextTick:Ml,detectDirection:Cc,getChild:Fn,expando:Ft};he.get=function(o){return o[Ft]};he.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&&(he.utils=er(er({},he.utils),a.utils)),xi.mount(a)})};he.create=function(o,l){return new he(o,l)};he.version=jp;var Je=[],di,_l,Bl=!1,El,Al,Go,hi;function cg(){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(),Ro(),Kp()},nulling:function(){Go=_l=di=Bl=hi=El=Al=null,Je.length=0},_handleFallbackAutoScroll:function(s){this._handleAutoScroll(s,!0)},_handleAutoScroll:function(s,a){var f=this,p=(s.touches?s.touches[0]:s).clientX,c=(s.touches?s.touches[0]:s).clientY,d=document.elementFromPoint(p,c);if(Go=s,a||this.options.forceAutoScrollFallback||yi||cr||pi){Fl(s,this.options,d,a);var m=Tr(d,!0);Bl&&(!hi||p!==El||c!==Al)&&(hi&&hc(),hi=setInterval(function(){var y=Tr(document.elementFromPoint(p,c),!0);y!==m&&(m=y,Ro()),Fl(s,f.options,y,a)},10),El=p,Al=c)}else{if(!this.options.bubbleScroll||Tr(d,!0)===Vt()){Ro();return}Fl(s,this.options,Tr(d,!1),!1)}}},fr(o,{pluginName:"scroll",initializeByDefault:!0})}function Ro(){Je.forEach(function(o){clearInterval(o.pid)}),Je=[]}function hc(){clearInterval(hi)}var Fl=bc(function(o,l,s,a){if(l.scroll){var f=(o.touches?o.touches[0]:o).clientX,p=(o.touches?o.touches[0]:o).clientY,c=l.scrollSensitivity,d=l.scrollSpeed,m=Vt(),y=!1,x;_l!==s&&(_l=s,Ro(),di=l.scroll,x=l.scrollFn,di===!0&&(di=Tr(s,!0)));var C=0,S=di;do{var A=S,_=$e(A),L=_.top,T=_.bottom,O=_.left,N=_.right,I=_.width,P=_.height,q=void 0,G=void 0,K=A.scrollWidth,me=A.scrollHeight,U=de(A),le=A.scrollLeft,j=A.scrollTop;A===m?(q=I<K&&(U.overflowX==="auto"||U.overflowX==="scroll"||U.overflowX==="visible"),G=P<me&&(U.overflowY==="auto"||U.overflowY==="scroll"||U.overflowY==="visible")):(q=I<K&&(U.overflowX==="auto"||U.overflowX==="scroll"),G=P<me&&(U.overflowY==="auto"||U.overflowY==="scroll"));var ee=q&&(Math.abs(N-f)<=c&&le+I<K)-(Math.abs(O-f)<=c&&!!le),E=G&&(Math.abs(T-p)<=c&&j+P<me)-(Math.abs(L-p)<=c&&!!j);if(!Je[C])for(var H=0;H<=C;H++)Je[H]||(Je[H]={});(Je[C].vx!=ee||Je[C].vy!=E||Je[C].el!==A)&&(Je[C].el=A,Je[C].vx=ee,Je[C].vy=E,clearInterval(Je[C].pid),(ee!=0||E!=0)&&(y=!0,Je[C].pid=setInterval(function(){a&&this.layer===0&&he.active._onTouchMove(Go);var W=Je[this.layer].vy?Je[this.layer].vy*d:0,Z=Je[this.layer].vx?Je[this.layer].vx*d:0;typeof x=="function"&&x.call(he.dragged.parentNode[Ft],Z,W,o,Go,Je[this.layer].el)!=="continue"||yc(Je[this.layer].el,Z,W)}.bind({layer:C}),24))),C++}while(l.bubbleScroll&&S!==m&&(S=Tr(S,!1)));Bl=y}},30),Ac=function(l){var s=l.originalEvent,a=l.putSortable,f=l.dragEl,p=l.activeSortable,c=l.dispatchSortableEvent,d=l.hideGhostForTarget,m=l.unhideGhostForTarget;if(s){var y=a||p;d();var x=s.changedTouches&&s.changedTouches.length?s.changedTouches[0]:s,C=document.elementFromPoint(x.clientX,x.clientY);m(),y&&!y.el.contains(C)&&(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=Fn(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 Pl(){}Pl.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(Pl,{pluginName:"removeOnSpill"});he.mount(new cg);he.mount(Pl,Il);var Fc=he;function Di(o,l,s,a){var f=a?new AbortController:null,p=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(p&&clearTimeout(p),d.ok||s&&s.indexOf(d.status)!==-1)return d;var m=new Error("HTTP "+d.status);throw m.status=d.status,m},function(d){throw p&&clearTimeout(p),d})}function zl(o,l){var s=o&&o.status;return s===401||s===403?"Your login session expired \u2014 sign in again, then retry.":l}function dg(){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 hg=["heic","heix","heif","hevc","hevx","mif1","msf1","heim","heis","hevm","hevs"];function Nc(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 hg.some(function(p){return a.indexOf(p)!==-1})}).catch(function(){return!1})}function pg(o){var l=String(o||"photo").replace(/\.[^.]+$/,"");return l=l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),(l||"photo")+".jpg"}function Hl(){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 gg(){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 vg(){var o=document.querySelector('form[name="new-entry"]');if(!o||Ko)return;var l=0,s=gg(),a=null;o.addEventListener("submit",function(){if(a){var x=a.getFiles();if(x.length){var C=o.querySelector('input[name="photo_order"]');C||(C=document.createElement("input"),C.type="hidden",C.name="photo_order",o.appendChild(C)),C.value=JSON.stringify(x.map(function(S){return S.filename}))}}},!0);function f(x,C){var S=Hl();S&&(S.textContent=x||"",S.className="photo-convert-status form-status"+(C?" form-status--"+C:""))}function p(){if(s){var x=document.querySelectorAll(".filepond--item[data-filepond-item-state]"),C=x.length,S=0;Array.prototype.forEach.call(x,function(A){A.getAttribute("data-filepond-item-state")==="processing-complete"&&S++}),l>0||C>0&&S<C?(s.summary.textContent=l>0?"Converting "+l+" photo"+(l>1?"s":"")+"\u2026":"Uploading "+C+" photo"+(C>1?"s":"")+"\u2026",s.details.open=!0):C>0?(s.summary.textContent="\u2713 "+C+" photo"+(C>1?"s":"")+" ready \u2014 tap to review",s.details.open=!1):(s.summary.textContent="Photos (1\u20136)",s.details.open=!0)}}function c(){p(),setTimeout(p,150),setTimeout(p,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 C=Hl();C&&/Converting/.test(C.textContent)&&f("")}p()}o.addEventListener("submit",function(x){l>0&&(x.preventDefault(),f("Hang on \u2014 a photo is still converting.","err"))},!0),o.addEventListener("submit",function(x){if(a){var C=a.getFiles();if(C.length){var S=window.FilePond&&window.FilePond.FileStatus||{},A=0,_=0;if(C.forEach(function(T){T.status!==S.PROCESSING_COMPLETE&&(T.status===S.PROCESSING_ERROR||T.status===S.LOAD_ERROR?_++:A++)}),!(!A&&!_)){x.preventDefault(),s&&(s.details.open=!0),f(_?"A photo failed to upload \u2014 remove it (tap its \u2715) and re-add it before posting.":"Photos are still uploading \u2014 hang on a moment.","err");var L=Hl();L&&typeof L.scrollIntoView=="function"&&L.scrollIntoView({behavior:"smooth",block:"center"})}}}},!0);function m(x){return function(C){var S=C&&C.file;return S?Nc(S).then(function(A){return A?(l++,d(),import("./heic-to-CN7JBE7H.js").then(function(_){var L=_.heicTo||_.default&&_.default.heicTo;return L({blob:S,type:"image/jpeg",quality:.85})}).then(function(_){var L=new File([_],pg(S.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 C=window.GravFilePond&&window.GravFilePond.getInstances?window.GravFilePond.getInstances():[];if(!C.length){y++<120&&setTimeout(x,50);return}C.forEach(function(S){S&&!S._heicHooked&&(S._heicHooked=!0,S.setOptions({beforeAddFile:m(S),allowReorder:!0,itemInsertLocation:"after"}),a=S,["addfile","processfile","processfiles","removefile","error"].forEach(function(A){try{S.on(A,c)}catch{}}),p())})})()}function Ot(o){return document.querySelector('[name="data['+o+']"]')}function mg(){var o=Array.prototype.slice.call(document.querySelectorAll(".advanced-field"));if(o.length){var l=[];if(o.forEach(function(p){var c=p.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(p){s.appendChild(p)});var f=l.some(function(p){var c=p.querySelector('input[type="text"]');if(c&&c.value.trim())return!0;var d=p.querySelector('input[type="radio"]:checked');if(!d||!d.value)return!1;var m=p.querySelector('input[type="radio"][checked]');return m?d.value!==m.value:d.value!=="0"});f&&(s.open=!0)}}}var bg={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 yg(){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=Ot("lat"),m=Ot("lng"),y=d?d.value.trim():"",x=m?m.value.trim():"";return y&&x?{lat:y,lng:x}:null}function p(){if(l){var d=!!f();l.disabled=!d,l.title=d?"":"Get location first"}}p();function c(d,m){var y=Ot("location_city"),x=Ot("location_country");if(!((!y||y.value.trim())&&(!x||x.value.trim()))){var C="https://api.bigdatacloud.net/data/reverse-geocode-client?latitude="+encodeURIComponent(d)+"&longitude="+encodeURIComponent(m)+"&localityLanguage=en";fetch(C).then(function(S){return S.json()}).then(function(S){var A=(S.city||S.locality||"").trim(),_=(S.countryName||"").trim();y&&!y.value.trim()&&A&&(y.value=A),x&&!x.value.trim()&&_&&(x.value=_);var L=[A,_].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 m=d.coords.latitude.toFixed(6),y=d.coords.longitude.toFixed(6),x=Ot("lat"),C=Ot("lng");x&&(x.value=m),C&&(C.value=y),o.classList.remove("is-loading"),o.disabled=!1,dr(s,"\u2713 Location captured \xB7 "+m+", "+y,"ok"),p(),c(m,y)},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 m="https://api.open-meteo.com/v1/forecast?latitude="+d.lat+"&longitude="+d.lng+"¤t=temperature_2m,weather_code&temperature_unit=celsius";fetch(m).then(function(y){return y.json()}).then(function(y){var x=Math.round(y.current.temperature_2m),C=bg[y.current.weather_code]||"Cloudy",S=Ot("weather_temp_c"),A=Ot("weather_desc");S&&(S.value=x),A&&(A.value=C),l.classList.remove("is-loading"),p(),dr(a,"\u2713 Weather set \xB7 "+C+" \xB7 "+x+"\xB0C (edit above if needed)","ok")}).catch(function(){l.classList.remove("is-loading"),p(),dr(a,"\u2717 Could not fetch weather \u2014 set it manually above.","err")})})}function xg(){var o=new Date;return o.setSeconds(0,0),o.setMinutes(o.getMinutes()-o.getTimezoneOffset()),o.toISOString().slice(0,16)}function Dg(){var o={title:"Title",date:"Date & time",content:"Content"},l=document.querySelector('form[name="new-entry"]');if(!l)return;var s=Ot("date");s&&!String(s.value).trim()&&(s.value=xg());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 m=document.createElement("span");m.className="field-error",m.textContent=d,c.parentNode.insertBefore(m,c.nextSibling)}function p(c){var d=l.querySelector(".photos-collapse"),m,y;if(d?(d.open=!0,y=d.querySelector(".photos-collapse__summary"),m=d):(m=document.querySelector(".filepond-root, .form-input-file"),y=m),!y)return m||null;var x=document.createElement("span");return x.className="field-error",x.textContent=c,y.insertAdjacentElement("afterend",x),m||y}l.addEventListener("submit",function(c){a();var d=null;!Ko&&document.querySelectorAll(".filepond--item").length<1&&(d=p("Add at least one photo.")),Object.keys(o).forEach(function(m){var y=Ot(m);y&&!String(y.value).trim()&&(f(y,o[m]+" is required."),d||(d=y))}),d&&(c.preventDefault(),typeof d.focus=="function"&&d.focus(),d.scrollIntoView({behavior:"smooth",block:"center"}))})}var Rl="intotheeast:new-entry-draft";function wg(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 Cg(){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 kg(){var o=document.querySelector('form[name="new-entry"]');if(!o||Ko)return;if(document.querySelector(".notices.success")){try{localStorage.removeItem(Rl)}catch{}return}function l(){var p={};wg(o).forEach(function(c){c.type==="radio"?c.checked&&(p[c.name]=c.value):p[c.name]=c.value});try{localStorage.setItem(Rl,JSON.stringify(p))}catch{}}var s=null;try{s=localStorage.getItem(Rl)}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(p){var c=a[p];if(c!=null&&String(c).trim()&&(f=!0),p!=="data[content]"){var d=o.querySelectorAll('input[type="radio"][name="'+p+'"]');if(d.length){d.forEach(function(y){y.checked=y.value===c});return}var m=o.querySelector('[name="'+p+'"]');m&&m.type!=="file"&&(m.value=c)}}),window.postFormEditor&&a["data[content]"]!=null&&window.postFormEditor.value(a["data[content]"]),f&&Cg()}}o.addEventListener("input",l),o.addEventListener("change",l),window.postFormEditor&&window.postFormEditor.codemirror.on("change",l)}function Sg(){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 p=o.getAttribute("data-trip-url");if(p){var c=document.createElement("a");c.className="post-success__view",c.href=p,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(m){var y=o.querySelector(m);y&&(y.style.display="none")}),l.scrollIntoView({behavior:"smooth",block:"start"})}}var Ko=!1;function Tc(o){return new URLSearchParams(window.location.search).get(o)}function hr(o,l){var s=Ot(o);s&&(s.value=l==null?"":String(l))}function Wl(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 Eg(o){var l=o==null?"":String(o);if(window.postFormEditor&&typeof window.postFormEditor.value=="function")window.postFormEditor.value(l);else{var s=Ot("content");s&&(s.value=l)}}function Lc(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 ql(o,l){o&&(o.tagName==="INPUT"?o.value=l:o.textContent=l)}function Ag(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 Fg=/\.(jpe?g|png|webp|heic|heif|gif)$/i;function Mc(o){var l=/(?:^|\/)photo-0*(\d+)\./i.exec(o);return l?parseInt(l[1],10):Number.MAX_SAFE_INTEGER}function Tg(o,l){var s=Mc(o),a=Mc(l);return s!==a?s-a:o<l?-1:o>l?1:0}function _c(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",p=l?".jpg":a>0?s.slice(a).toLowerCase():".jpg",c=Date.now().toString(36)+Math.random().toString(36).slice(2,6);return f+"-"+c+p}function Lg(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 p=l.querySelector(".photos-collapse");p&&(p.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"),m=c.querySelector(".photo-editor__status"),y=c.querySelector(".photo-editor__add"),x=c.querySelector(".photo-editor__input"),C=[],S=null,A=!1,_=0;function L(j,ee){m.textContent=j||"",m.className="photo-editor__status gpx-status"+(ee?" error":"")}function T(j){A=j,y.disabled=j,Array.prototype.forEach.call(d.querySelectorAll(".photo-editor__del, .photo-editor__confirm-yes, .photo-editor__confirm-no"),function(ee){ee.disabled=j}),S&&S.option("disabled",j)}function O(){return fetch("/api/v1/pages"+o+"/media",{credentials:"include",headers:{Accept:"application/json"}}).then(function(j){if(!j.ok)throw new Error("HTTP "+j.status);return j.json()}).then(function(j){return(j&&j.data||[]).filter(function(ee){return ee&&typeof ee.filename=="string"&&Fg.test(ee.filename)}).map(function(ee){return ee.filename}).sort(Tg)})}function N(j){return Di("/api/v1/entry/"+encodeURIComponent(s)+"/photos/order",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({order:j})})}function I(j){if(C=(j||[]).slice(),S&&(S.destroy(),S=null),d.innerHTML="",!C.length){d.innerHTML='<p class="photo-editor__empty">No photos yet \u2014 add some.</p>';return}var ee=++_;C.forEach(function(E){var H=document.createElement("div");H.className="photo-editor__cell",H.setAttribute("data-filename",E);var W=document.createElement("img");W.className="photo-editor__img",W.loading="lazy",W.alt=E,W.src=o+"/"+encodeURIComponent(E)+"?v="+ee;var Z=document.createElement("button");Z.type="button",Z.className="photo-editor__del",Z.setAttribute("aria-label","Delete "+E),Z.textContent="\u2715",Z.addEventListener("click",function(){K(H,E)}),H.appendChild(W),H.appendChild(Z),d.appendChild(H)}),C.length>1&&(S=new Fc(d,{animation:150,draggable:".photo-editor__cell",filter:".photo-editor__confirm",onEnd:G}))}function P(){return Array.prototype.map.call(d.querySelectorAll(".photo-editor__cell"),function(j){return j.getAttribute("data-filename")})}function q(j,ee){if(j.length!==ee.length)return!1;for(var E=0;E<j.length;E++)if(j[E]!==ee[E])return!1;return!0}function G(){var j=P();if(!q(j,C)){var ee=C.slice();T(!0),L("Saving order\u2026"),N(j).then(function(){return O().then(function(E){L(""),I(E)},function(){L(""),I(j)})},function(E){L(zl(E,"Couldn\u2019t save the new order \u2014 reverted. Try again."),!0),I(ee)}).then(function(){T(!1)})}}function K(j,ee){if(!(A||j.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>',j.appendChild(E),j.classList.add("is-confirming"),E.querySelector(".photo-editor__confirm-no").addEventListener("click",function(){j.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,me(ee)})}}function me(j){var ee=C.slice(),E=C.filter(function(H){return H!==j});T(!0),L("Deleting\u2026"),Di("/api/v1/pages"+o+"/media/"+encodeURIComponent(j),{method:"DELETE"},[204,404]).then(function(){return(E.length?N(E):Promise.resolve()).then(O).then(function(H){L(""),I(H)},function(){L("Photo deleted, but refreshing the list failed \u2014 reload if it looks off.",!0),I(E)})},function(H){L(zl(H,"Couldn\u2019t delete that photo. Try again."),!0),I(ee)}).then(function(){T(!1)})}function U(j){return Nc(j).then(function(ee){return ee?import("./heic-to-CN7JBE7H.js").then(function(E){var H=E.heicTo||E.default&&E.default.heicTo;return H({blob:j,type:"image/jpeg",quality:.85})}).then(function(E){return{blob:E,name:_c(j.name,!0)}}):{blob:j,name:_c(j.name,!1)}})}y.addEventListener("click",function(){A||x.click()}),x.addEventListener("change",function(){var j=Array.prototype.slice.call(x.files||[]);x.value="",j.length&&le(j)});function le(j){T(!0);var ee=j.length,E=0,H=0,W=!1,Z=C.slice(),ve=Promise.resolve();j.forEach(function(De){ve=ve.then(function(){return E++,L("Uploading "+E+" of "+ee+"\u2026"),U(De).then(function(Le){var F=new FormData;return F.append("file",Le.blob,Le.name),Di("/api/v1/pages"+o+"/media",{method:"POST",body:F})}).then(null,function(Le){H++,Le&&(Le.status===401||Le.status===403)&&(W=!0)})})}),ve.then(function(){return L("Finishing\u2026"),O()}).then(function(De){var Le=Z.filter(function(te){return De.indexOf(te)!==-1}),F=De.filter(function(te){return Z.indexOf(te)===-1}),D=Le.concat(F);return D.length?N(D).catch(function(){return N(D)}).catch(function(){return Promise.all(F.map(function(te){return Di("/api/v1/pages"+o+"/media/"+encodeURIComponent(te),{method:"DELETE"},[204,404]).then(function(){return!0},function(){return!1})})).then(function(te){var we=new Error("reorder failed");throw we.rolledBack=!0,we.rollbackIncomplete=te.indexOf(!1)!==-1,we})}).then(O):(I([]),null)}).then(function(De){De&&I(De),H?L(W?"Couldn\u2019t add photos \u2014 your login session expired. Sign in again, then retry.":H+" photo"+(H>1?"s":"")+" couldn\u2019t be added.",!0):L("")}).catch(function(De){var Le;return De&&De.rolledBack?Le=De.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.":Le="Couldn\u2019t add photos. Please try again.",L(Le,!0),O().then(I,function(){I(Z)})}).then(function(){T(!1)})}d.innerHTML='<p class="photo-editor__loading">Loading photos\u2026</p>',O().then(I).catch(function(){L("Couldn\u2019t load photos.",!0),I([])})}function Mg(){var o=document.querySelector('form[name="new-entry"]'),l=document.querySelector(".post-form-wrap");if(!(!o||!l)){var s=Tc("edit");if(s){Ko=!0;var a=l.querySelector("h1");a&&(a.textContent="Edit entry");var f=o.querySelector('button[type="submit"], input[type="submit"]'),p=f?f.tagName==="INPUT"?f.value:f.textContent:"Save changes";Lc(o,!0),ql(f,"Loading entry\u2026");var c=Tc("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 m=new Error("HTTP "+d.status);throw m.status=d.status,m}return d.json()}).then(function(d){var m=d&&d.data||{},y=m.header||{};hr("title",y.title!=null?y.title:m.title),hr("date",y.date?String(y.date).replace(" ","T"):""),Eg(m.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),Wl("featured",y.featured),Wl("force_connect",y.force_connect),Wl("published",y.published!==void 0?y.published:m.published);var x=Ot("edit_path");x&&(x.value=s+"/entry.md"),Lc(o,!1),ql(f,"Save changes");var C=o.querySelector(".more-options");C&&(C.open=!0),Lg(s)}).catch(function(d){var m=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.";Ag(l,m),ql(f,p)})}}}function Bc(){window.postFormEditor=dg(),Sg(),Mg(),kg(),vg(),mg(),yg(),Dg()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Bc):Bc();
|
|
/*! Bundled license information:
|
|
|
|
sortablejs/modular/sortable.esm.js:
|
|
(**!
|
|
* Sortable 1.15.7
|
|
* @author RubaXa <trash@rubaxa.org>
|
|
* @author owenm <owen23355@gmail.com>
|
|
* @license MIT
|
|
*)
|
|
*/
|