text: (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-37c92f0e"],{1148:function(e,t,r){"use strict";var n=r("a691"),i=r("1d80");e.exports="".repeat||function(e){var t=String(i(this)),r="",o=n(e);if(o<0||o==1/0)throw RangeError("Wrong number of repetitions");for(;o>0;(o>>>=1)&&(t+=t))1&o&&(r+=t);return r}},1276:function(e,t,r){"use strict";var n=r("d784"),i=r("44e7"),o=r("825a"),a=r("1d80"),l=r("4840"),s=r("8aa5"),u=r("50c4"),c=r("14c3"),f=r("9263"),d=r("d039"),h=[].push,p=Math.min,g=4294967295,v=!d((function(){return!RegExp(g,"y")}));n("split",2,(function(e,t,r){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,r){var n=String(a(this)),o=void 0===r?g:r>>>0;if(0===o)return[];if(void 0===e)return[n];if(!i(e))return t.call(n,e,o);var l,s,u,c=[],d=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),p=0,v=new RegExp(e.source,d+"g");while(l=f.call(v,n)){if(s=v.lastIndex,s>p&&(c.push(n.slice(p,l.index)),l.length>1&&l.index<n.length&&h.apply(c,l.slice(1)),u=l[0].length,p=s,c.length>=o))break;v.lastIndex===l.index&&v.lastIndex++}return p===n.length?!u&&v.test("")||c.push(""):c.push(n.slice(p)),c.length>o?c.slice(0,o):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:t.call(this,e,r)}:t,[function(t,r){var i=a(this),o=void 0==t?void 0:t[e];return void 0!==o?o.call(t,i,r):n.call(String(i),t,r)},function(e,i){var a=r(n,e,this,i,n!==t);if(a.done)return a.value;var f=o(e),d=String(this),h=l(f,RegExp),m=f.unicode,y=(f.ignoreCase?"i":"")+(f.multiline?"m":"")+(f.unicode?"u":"")+(v?"y":"g"),b=new h(v?f:"^(?:"+f.source+")",y),w=void 0===i?g:i>>>0;if(0===w)return[];if(0===d.length)return null===c(b,d)?[d]:[];var x=0,C=0,k=[];while(C<d.length){b.lastIndex=v?C:0;var S,L=c(b,v?d:d.slice(C));if(null===L||(S=p(u(b.lastIndex+(v?0:C)),d.length))===x)C=s(d,C,m);else{if(k.push(d.slice(x,C)),k.length===w)return k;for(var M=1;M<=L.length-1;M++)if(k.push(L[M]),k.length===w)return k;C=x=S}}return k.push(d.slice(x)),k}]}),!v)},"25f0":function(e,t,r){"use strict";var n=r("6eeb"),i=r("825a"),o=r("d039"),a=r("ad6d"),l="toString",s=RegExp.prototype,u=s[l],c=o((function(){return"/a/b"!=u.call({source:"a",flags:"b"})})),f=u.name!=l;(c||f)&&n(RegExp.prototype,l,(function(){var e=i(this),t=String(e.source),r=e.flags,n=String(void 0===r&&e instanceof RegExp&&!("flags"in s)?a.call(e):r);return"/"+t+"/"+n}),{unsafe:!0})},"27ae":function(module,exports,__webpack_require__){(function(global){var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__;(function(e,t){module.exports=t(e)})("undefined"!==typeof self?self:"undefined"!==typeof window?window:"undefined"!==typeof global?global:this,(function(global){"use strict";global=global||{};var _Base64=global.Base64,version="2.5.2",buffer;if(module.exports)try{buffer=eval("require('buffer').Buffer")}catch(err){buffer=void 0}var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64tab=function(e){for(var t={},r=0,n=e.length;r<n;r++)t[e.charAt(r)]=r;return t}(b64chars),fromCharCode=String.fromCharCode,cb_utob=function(e){if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?fromCharCode(192|t>>>6)+fromCharCode(128|63&t):fromCharCode(224|t>>>12&15)+fromCharCode(128|t>>>6&63)+fromCharCode(128|63&t)}t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return fromCharCode(240|t>>>18&7)+fromCharCode(128|t>>>12&63)+fromCharCode(128|t>>>6&63)+fromCharCode(128|63&t)},re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=function(e){return e.replace(re_utob,cb_utob)},cb_encode=function(e){var t=[0,2,1][e.length%3],r=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0),n=[b64chars.charAt(r>>>18),b64chars.charAt(r>>>12&63),t>=2?"=":b64chars.charAt(r>>>6&63),t>=1?"=":b64chars.charAt(63&r)];return n.join("")},btoa=global.btoa?function(e){return global.btoa(e)}:function(e){return e.replace(/[\s\S]{1,3}/g,cb_encode)},_encode=function(e){var t="[object Uint8Array]"===Object.prototype.toString.call(e);return t?e.toString("base64"):btoa(utob(String(e)))},encode=function(e,t){return t?_encode(String(e)).replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"})).replace(/=/g,""):_encode(e)},encodeURI=function(e){return encode(e,!0)},re_btou=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,cb_btou=function(e){switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),r=t-65536;return fromCharCode(55296+(r>>>10))+fromCharCode(56320+(1023&r));case 3:return fromCharCode((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return fromCharCode((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},btou=function(e){return e.replace(re_btou,cb_btou)},cb_decode=function(e){var t=e.length,r=t%4,n=(t>0?b64tab[e.charAt(0)]<<18:0)|(t>1?b64tab[e.charAt(1)]<<12:0)|(t>2?b64tab[e.charAt(2)]<<6:0)|(t>3?b64tab[e.charAt(3)]:0),i=[fromCharCode(n>>>16),fromCharCode(n>>>8&255),fromCharCode(255&n)];return i.length-=[0,0,2,1][r],i.join("")},_atob=global.atob?function(e){return global.atob(e)}:function(e){return e.replace(/\S{1,4}/g,cb_decode)},atob=function(e){return _atob(String(e).replace(/[^A-Za-z0-9\+\/]/g,""))},_decode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(e){return(e.constructor===buffer.constructor?e:buffer.from(e,"base64")).toString()}:function(e){return(e.constructor===buffer.constructor?e:new buffer(e,"base64")).toString()}:function(e){return btou(_atob(e))},decode=function(e){return _decode(String(e).replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,""))},noConflict=function(){var e=global.Base64;return global.Base64=_Base64,e};if(global.Base64={VERSION:version,atob:atob,btoa:btoa,fromBase64:decode,toBase64:encode,utob:utob,encode:encode,encodeURI:encodeURI,btou:btou,decode:decode,noConflict:noConflict,__buffer__:buffer},"function"===typeof Object.defineProperty){var noEnum=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum((function(){return decode(this)}))),Object.defineProperty(String.prototype,"toBase64",noEnum((function(e){return encode(this,e)}))),Object.defineProperty(String.prototype,"toBase64URI",noEnum((function(){return encode(this,!0)})))}}return global["Meteor"]&&(Base64=global.Base64),module.exports?module.exports.Base64=global.Base64:(__WEBPACK_AMD_DEFINE_ARRAY__=[],__WEBPACK_AMD_DEFINE_RESULT__=function(){return global.Base64}.apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)),{Base64:global.Base64}}))}).call(this,__webpack_require__("c8ba"))},"362a":function(e,t,r){},"408a":function(e,t,r){var n=r("c6b6");e.exports=function(e){if("number"!=typeof e&&"Number"!=n(e))throw TypeError("Incorrect invocation");return+e}},"44e7":function(e,t,r){var n=r("861d"),i=r("c6b6"),o=r("b622"),a=o("match");e.exports=function(e){var t;return n(e)&&(void 0!==(t=e[a])?!!t:"RegExp"==i(e))}},"45d8":function(e,t,r){"use strict";r.d(t,"c",(function(){return c})),r.d(t,"b",(function(){return f})),r.d(t,"a",(function(){return d})),r.d(t,"d",(function(){return p})),r.d(t,"g",(function(){return g})),r.d(t,"f",(function(){return v})),r.d(t,"e",(function(){return m}));r("99af"),r("c975"),r("b680"),r("4d63"),r("ac1f"),r("25f0"),r("5319"),r("1276");var n=r("9bd2"),i=r("27ae").Base64,o=["html","php","css","go","java","js","json","txt","sh","md"],a=["mp4","webm","mkv","m3u8","flv","mov","m4v"],l=["bmp","jpg","jpeg","png","gif"],s=["pdf"],u=function(e){return e.replace(/(.*)/,(function(e,t){return t.replace().replace(/\//g,"%2F").replace(/#/g,"%23")}))},c=function(e,t){return e=u(e),"application/vnd.google-apps.folder"===t.mimeType&&"/"!==e.substr(-1)&&(e+="/"),e},f=function(e){var t=e.split("/").pop(),r=t.split(".").pop().toLowerCase(),n=h(e);return-1!=o.indexOf("".concat(r))&&(e=e.replace(/\/(\d+:)\/.*/,(function(e,t){return"/".concat(t,"text/").concat(n)}))),-1!=s.indexOf("".concat(r))&&(e=e.replace(/\/(\d+:)\/.*/,(function(e,t){return"/".concat(t,"pdf/").concat(n)}))),-1!=a.indexOf("".concat(r))&&(e=e.replace(/\/(\d+:)\/.*/,(function(e,t){return"/".concat(t,"video/").concat(n)}))),-1!=l.indexOf("".concat(r))&&(e=e.replace(/\/(\d+:)\/.*/,(function(e,t){return"/".concat(t,"image/").concat(n)}))),e},d=function(e){var t=e.split("/").pop(),r=t.split(".").pop().toLowerCase(),n=o.concat.apply(o,a.concat(l,s));return-1!=n.indexOf("".concat(r))},h=function(e){return i.encodeURI(e)},p=function(e){return i.decode(e)};function g(e,t){var r=e.path,i=e.file,o=i?i.modifiedTime:null,a="file_path_"+r+o,l=o?localStorage.getItem(a):null;if(l)return t(l);n["a"].get(r).then((function(e){var r=e.data;localStorage.setItem(a,r),t(r)}))}function v(e){return e>=1e9?e=(e/1e9).toFixed(2)+" GB":e>=1e6?e=(e/1e6).toFixed(2)+" MB":e>=1e3?e=(e/1e3).toFixed(2)+" KB":e>1?e+=" bytes":1==e?e+=" byte":e="",e}function m(e,t){t=t||"YYYY-MM-DD HH:mm:ss","string"===typeof e&&(e=new Date(e)),"number"===typeof e&&(e=new Date(e));var r={"M+":e.getMonth()+1,"D+":e.getDate(),"h+":e.getHours()%12===0?12:e.getHours()%12,"H+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()},n={0:"日",1:"一",2:"二",3:"三",4:"四",5:"五",6:"六"};for(var i in/(Y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),/(E+)/.test(t)&&(t=t.replace(RegExp.$1,(RegExp.$1.length>1?RegExp.$1.length>2?"星期":"周":"")+n[e.getDay()+""])),r)new RegExp("("+i+")").test(t)&&(t=t.replace(RegExp.$1,1===RegExp.$1.length?r[i]:("00"+r[i]).substr((""+r[i]).length)));return t}},"4d63":function(e,t,r){var n=r("83ab"),i=r("da84"),o=r("94ca"),a=r("7156"),l=r("9bf2").f,s=r("241c").f,u=r("44e7"),c=r("ad6d"),f=r("9f7f"),d=r("6eeb"),h=r("d039"),p=r("69f3").set,g=r("2626"),v=r("b622"),m=v("match"),y=i.RegExp,b=y.prototype,w=/a/g,x=/a/g,C=new y(w)!==w,k=f.UNSUPPORTED_Y,S=n&&o("RegExp",!C||k||h((function(){return x[m]=!1,y(w)!=w||y(x)==x||"/a/i"!=y(w,"i")})));if(S){var L=function(e,t){var r,n=this instanceof L,i=u(e),o=void 0===t;if(!n&&i&&e.constructor===L&&o)return e;C?i&&!o&&(e=e.source):e instanceof L&&(o&&(t=c.call(e)),e=e.source),k&&(r=!!t&&t.indexOf("y")>-1,r&&(t=t.replace(/y/g,"")));var l=a(C?new y(e,t):y(e,t),n?this:b,L);return k&&r&&p(l,{sticky:r}),l},M=function(e){e in L||l(L,e,{configurable:!0,get:function(){return y[e]},set:function(t){y[e]=t}})},T=s(y),A=0;while(T.length>A)M(T[A++]);b.constructor=L,L.prototype=b,d(i,"RegExp",L)}g("RegExp")},"56b3":function(e,t,r){(function(t,r){e.exports=r()})(0,(function(){"use strict";var e=navigator.userAgent,t=navigator.platform,r=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),a=n||i||o,l=a&&(n?document.documentMode||6:+(o||i)[1]),s=!o&&/WebKit\//.test(e),u=s&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\//.test(e),f=/Opera\//.test(e),d=/Apple Computer/.test(navigator.vendor),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),v=/Android/.test(e),m=g||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),w=/win/i.test(t),x=f&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(f=!1,s=!0);var C=y&&(u||f&&(null==x||x<12.11)),k=r||a&&l>=9;function S(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var L,M=function(e,t){var r=e.className,n=S(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}};function T(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function A(e,t){return T(e).appendChild(t)}function O(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)i.appendChild(t[o]);return i}function N(e,t,r,n){var i=O(e,t,r,n);return i.setAttribute("role","presentation"),i}function D(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do{if(11==t.nodeType&&(t=t.host),t==e)return!0}while(t=t.parentNode)}function E(){var e;try{e=document.activeElement}catch(t){e=document.body||null}while(e&&e.shadowRoot&&e.shadowRoot.activeElement)e=e.shadowRoot.activeElement;return e}function W(e,t){var r=e.className;S(t).test(r)||(e.className+=(r?" ":"")+t)}function F(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!S(r[n]).test(t)&&(t+=" "+r[n]);return t}L=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(i){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var H=function(e){e.select()};function R(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(e,t,r){for(var n in t||(t={}),e)!e.hasOwnProperty(n)||!1===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function P(e,t,r,n,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=n||0,a=i||0;;){var l=e.indexOf("\t",o);if(l<0||l>=t)return a+(t-o);a+=l-o,a+=r-a%r,o=l+1}}g?H=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:a&&(H=function(e){try{e.select()}catch(t){}});var _=function(){this.id=null,this.f=null,this.time=0,this.handler=R(this.onTimeout,this)};function z(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}_.prototype.onTimeout=function(e){e.id=0,e.time<=+new Date?e.f():setTimeout(e.handler,e.time-+new Date)},_.prototype.set=function(e,t){this.f=t;var r=+new Date+e;(!this.id||r<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,e),this.time=r)};var B=50,j={toString:function(){return"CodeMirror.Pass"}},V={scroll:!1},U={origin:"*mouse"},G={origin:"+move"};function $(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}}var K=[""];function Y(e){while(K.length<=e)K.push(X(K)+" ");return K[e]}function X(e){return e[e.length-1]}function q(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Z(e,t,r){var n=0,i=r(t);while(n<e.length&&r(e[n])<=i)n++;e.splice(n,0,t)}function J(){}function Q(e,t){var r;return Object.create?r=Object.create(e):(J.prototype=e,r=new J),t&&I(t,r),r}var ee=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function te(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||ee.test(e))}function re(e,t){return t?!!(t.source.indexOf("\\w")>-1&&te(e))||t.test(e):te(e)}function ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ie=/[\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 oe(e){return e.charCodeAt(0)>=768&&ie.test(e)}function ae(e,t,r){while((r<0?t>0:t<e.length)&&oe(e.charAt(t)))t+=r;return t}function le(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}function se(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}var ue=null;function ce(e,t,r){var n;ue=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:ue=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:ue=i)}return null!=n?n:ue}var fe=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function r(r){return r<=247?e.charAt(r):1424<=r&&r<=1524?"R":1536<=r&&r<=1785?t.charAt(r-1536):1774<=r&&r<=2220?"r":8192<=r&&r<=8203?"w":8204==r?"b":"L"}var n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,i=/[stwN]/,o=/[LRr]/,a=/[Lb1n]/,l=/[1n]/;function s(e,t,r){this.level=e,this.from=t,this.to=r}return function(e,t){var u="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!n.test(e))return!1;for(var c=e.length,f=[],d=0;d<c;++d)f.push(r(e.charCodeAt(d)));for(var h=0,p=u;h<c;++h){var g=f[h];"m"==g?f[h]=p:p=g}for(var v=0,m=u;v<c;++v){var y=f[v];"1"==y&&"r"==m?f[v]="n":o.test(y)&&(m=y,"r"==y&&(f[v]="R"))}for(var b=1,w=f[0];b<c-1;++b){var x=f[b];"+"==x&&"1"==w&&"1"==f[b+1]?f[b]="1":","!=x||w!=f[b+1]||"1"!=w&&"n"!=w||(f[b]=w),w=x}for(var C=0;C<c;++C){var k=f[C];if(","==k)f[C]="N";else if("%"==k){var S=void 0;for(S=C+1;S<c&&"%"==f[S];++S);for(var L=C&&"!"==f[C-1]||S<c&&"1"==f[S]?"1":"N",M=C;M<S;++M)f[M]=L;C=S-1}}for(var T=0,A=u;T<c;++T){var O=f[T];"L"==A&&"1"==O?f[T]="L":o.test(O)&&(A=O)}for(var N=0;N<c;++N)if(i.test(f[N])){var D=void 0;for(D=N+1;D<c&&i.test(f[D]);++D);for(var E="L"==(N?f[N-1]:u),W="L"==(D<c?f[D]:u),F=E==W?E?"L":"R":u,H=N;H<D;++H)f[H]=F;N=D-1}for(var R,I=[],P=0;P<c;)if(a.test(f[P])){var _=P;for(++P;P<c&&a.test(f[P]);++P);I.push(new s(0,_,P))}else{var z=P,B=I.length,j="rtl"==t?1:0;for(++P;P<c&&"L"!=f[P];++P);for(var V=z;V<P;)if(l.test(f[V])){z<V&&(I.splice(B,0,new s(1,z,V)),B+=j);var U=V;for(++V;V<P&&l.test(f[V]);++V);I.splice(B,0,new s(2,U,V)),B+=j,z=V}else++V;z<P&&I.splice(B,0,new s(1,z,P))}return"ltr"==t&&(1==I[0].level&&(R=e.match(/^\s+/))&&(I[0].from=R[0].length,I.unshift(new s(0,0,R[0].length))),1==X(I).level&&(R=e.match(/\s+$/))&&(X(I).to-=R[0].length,I.push(new s(0,c-R[0].length,c)))),"rtl"==t?I.reverse():I}}();function de(e,t){var r=e.order;return null==r&&(r=e.order=fe(e.text,t)),r}var he=[],pe=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||he).concat(r)}};function ge(e,t){return e._handlers&&e._handlers[t]||he}function ve(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var o=z(i,r);o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function me(e,t){var r=ge(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function ye(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),me(e,r||t.type,e,t),Se(t)||t.codemirrorIgnore}function be(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==z(r,t[n])&&r.push(t[n])}function we(e,t){return ge(e,t).length>0}function xe(e){e.prototype.on=function(e,t){pe(this,e,t)},e.prototype.off=function(e,t){ve(this,e,t)}}function Ce(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ke(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Se(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Le(e){Ce(e),ke(e)}function Me(e){return e.target||e.srcElement}function Te(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var Ae,Oe,Ne=function(){if(a&&l<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function De(e){if(null==Ae){var t=O("span","​");A(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Ae=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&l<8))}var r=Ae?O("span","​"):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Ee(e){if(null!=Oe)return Oe;var t=A(e,document.createTextNode("AخA")),r=L(t,0,1).getBoundingClientRect(),n=L(t,1,2).getBoundingClientRect();return T(e),!(!r||r.left==r.right)&&(Oe=n.right-r.right<3)}var We=3!="\n\nb".split(/\n/).length?function(e){var t=0,r=[],n=e.length;while(t<=n){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},Fe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(r){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},He=function(){var e=O("div");return"oncopy"in e||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Re=null;function Ie(e){if(null!=Re)return Re;var t=A(e,O("span","x")),r=t.getBoundingClientRect(),n=L(t,0,1).getBoundingClientRect();return Re=Math.abs(r.left-n.left)>1}var Pe={},_e={};function ze(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Pe[e]=t}function Be(e,t){_e[e]=t}function je(e){if("string"==typeof e&&_e.hasOwnProperty(e))e=_e[e];else if(e&&"string"==typeof e.name&&_e.hasOwnProperty(e.name)){var t=_e[e.name];"string"==typeof t&&(t={name:t}),e=Q(t,e),e.name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return je("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return je("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ve(e,t){t=je(t);var r=Pe[t.name];if(!r)return Ve(e,"text/plain");var n=r(e,t);if(Ue.hasOwnProperty(t.name)){var i=Ue[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)n[a]=t.modeProps[a];return n}var Ue={};function Ge(e,t){var r=Ue.hasOwnProperty(e)?Ue[e]:Ue[e]={};I(t,r)}function $e(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ke(e,t){var r;while(e.innerMode){if(r=e.innerMode(t),!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}}function Ye(e,t,r){return!e.startState||e.startState(t,r)}var Xe=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};function qe(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");var r=e;while(!r.lines)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(t<o){r=i;break}t-=o}return r.lines[t]}function Ze(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,(function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i})),n}function Je(e,t,r){var n=[];return e.iter(t,r,(function(e){n.push(e.text)})),n}function Qe(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function et(e){if(null==e.parent)return null;for(var t=e.parent,r=z(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;;++i){if(n.children[i]==t)break;r+=n.children[i].chunkSize()}return r+t.first}function tt(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var a=0;a<e.lines.length;++a){var l=e.lines[a],s=l.height;if(t<s)break;t-=s}return r+a}function rt(e,t){return t>=e.first&&t<e.first+e.size}function nt(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function it(e,t,r){if(void 0===r&&(r=null),!(this instanceof it))return new it(e,t,r);this.line=e,this.ch=t,this.sticky=r}function ot(e,t){return e.line-t.line||e.ch-t.ch}function at(e,t){return e.sticky==t.sticky&&0==ot(e,t)}function lt(e){return it(e.line,e.ch)}function st(e,t){return ot(e,t)<0?t:e}function ut(e,t){return ot(e,t)<0?e:t}function ct(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ft(e,t){if(t.line<e.first)return it(e.first,0);var r=e.first+e.size-1;return t.line>r?it(r,qe(e,r).text.length):dt(t,qe(e,t.line).text.length)}function dt(e,t){var r=e.ch;return null==r||r>t?it(e.line,t):r<0?it(e.line,0):e}function ht(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=ft(e,t[n]);return r}Xe.prototype.eol=function(){return this.pos>=this.string.length},Xe.prototype.sol=function(){return this.pos==this.lineStart},Xe.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Xe.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Xe.prototype.eat=function(e){var t,r=this.string.charAt(this.pos);if(t="string"==typeof e?r==e:r&&(e.test?e.test(r):e(r)),t)return++this.pos,r},Xe.prototype.eatWhile=function(e){var t=this.pos;while(this.eat(e));return this.pos>t},Xe.prototype.eatSpace=function(){var e=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>e},Xe.prototype.skipToEnd=function(){this.pos=this.string.length},Xe.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Xe.prototype.backUp=function(e){this.pos-=e},Xe.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=P(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?P(this.string,this.lineStart,this.tabSize):0)},Xe.prototype.indentation=function(){return P(this.string,null,this.tabSize)-(this.lineStart?P(this.string,this.lineStart,this.tabSize):0)},Xe.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(i(o)==i(e))return!1!==t&&(this.pos+=e.length),!0},Xe.prototype.current=function(){return this.string.slice(this.start,this.pos)},Xe.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Xe.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Xe.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var pt=function(e,t){this.state=e,this.lookAhead=t},gt=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function vt(e,t,r,n){var i=[e.state.modeGen],o={};Lt(e,t.text,e.doc.mode,r,(function(e,t){return i.push(e,t)}),o,n);for(var a=r.state,l=function(n){r.baseTokens=i;var l=e.state.overlays[n],s=1,u=0;r.state=!0,Lt(e,t.text,l.mode,r,(function(e,t){var r=s;while(u<e){var n=i[s];n>e&&i.splice(s,1,e,i[s+1],n),s+=2,u=Math.min(e,n)}if(t)if(l.opaque)i.splice(r,s-r,e,"overlay "+t),s=r+2;else for(;r<s;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"overlay "+t}}),o),r.state=a,r.baseTokens=null,r.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)l(s);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function mt(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=yt(e,et(t)),i=t.text.length>e.options.maxHighlightLength&&$e(e.doc.mode,n.state),o=vt(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function yt(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new gt(n,!0,t);var o=Mt(e,t,r),a=o>n.first&&qe(n,o-1).stateAfter,l=a?gt.fromSaved(n,a,o):new gt(n,Ye(n.mode),o);return n.iter(o,t,(function(r){bt(e,r.text,l);var n=l.line;r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?l.save():null,l.nextLine()})),r&&(n.modeFrontier=l.line),l}function bt(e,t,r,n){var i=e.doc.mode,o=new Xe(t,e.options.tabSize,r);o.start=o.pos=n||0,""==t&&wt(i,r.state);while(!o.eol())xt(i,o,r.state),o.start=o.pos}function wt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=Ke(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function xt(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Ke(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}gt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},gt.prototype.baseToken=function(e){if(!this.baseTokens)return null;while(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}},gt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},gt.fromSaved=function(e,t,r){return t instanceof pt?new gt(e,$e(e.mode,t.state),r,t.lookAhead):new gt(e,$e(e.mode,t),r)},gt.prototype.save=function(e){var t=!1!==e?$e(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new pt(t,this.maxLookAhead):t};var Ct=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function kt(e,t,r,n){var i,o=e.doc,a=o.mode;t=ft(o,t);var l,s=qe(o,t.line),u=yt(e,t.line,r),c=new Xe(s.text,e.options.tabSize,u);n&&(l=[]);while((n||c.pos<t.ch)&&!c.eol())c.start=c.pos,i=xt(a,c,u.state),n&&l.push(new Ct(c,i,$e(o.mode,u.state)));return n?l:new Ct(c,i,u.state)}function St(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|\\s)"+r[2]+"(?:$|\\s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Lt(e,t,r,n,i,o,a){var l=r.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,u=0,c=null,f=new Xe(t,e.options.tabSize,n),d=e.options.addModeClass&&[null];""==t&&St(wt(r,n.state),o);while(!f.eol()){if(f.pos>e.options.maxHighlightLength?(l=!1,a&&bt(e,t,n,f.pos),f.pos=t.length,s=null):s=St(xt(r,f,n.state,d),o),d){var h=d[0].name;h&&(s="m-"+(s?h+" "+s:h))}if(!l||c!=s){while(u<f.start)u=Math.min(f.start,u+5e3),i(u,c);c=s}f.start=f.pos}while(u<f.pos){var p=Math.min(f.pos,u+5e3);i(p,c),u=p}}function Mt(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first;var s=qe(o,l-1),u=s.stateAfter;if(u&&(!r||l+(u instanceof pt?u.lookAhead:0)<=o.modeFrontier))return l;var c=P(s.text,null,e.options.tabSize);(null==i||n>c)&&(i=l-1,n=c)}return i}function Tt(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var r=e.first,n=t-1;n>r;n--){var i=qe(e,n).stateAfter;if(i&&(!(i instanceof pt)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}}var At=!1,Ot=!1;function Nt(){At=!0}function Dt(){Ot=!0}function Et(e,t,r){this.marker=e,this.from=t,this.to=r}function Wt(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Ft(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Ht(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Rt(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);if(l||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Et(a,o.from,s?null:o.to))}}return n}function It(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker,l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Et(a,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}function Pt(e,t){if(t.full)return null;var r=rt(e,t.from.line)&&qe(e,t.from.line).markedSpans,n=rt(e,t.to.line)&&qe(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,a=0==ot(t.from,t.to),l=Rt(r,i,a),s=It(n,o,a),u=1==t.text.length,c=X(t.text).length+(u?i:0);if(l)for(var f=0;f<l.length;++f){var d=l[f];if(null==d.to){var h=Wt(s,d.marker);h?u&&(d.to=null==h.to?null:h.to+c):d.to=i}}if(s)for(var p=0;p<s.length;++p){var g=s[p];if(null!=g.to&&(g.to+=c),null==g.from){var v=Wt(l,g.marker);v||(g.from=c,u&&(l||(l=[])).push(g))}else g.from+=c,u&&(l||(l=[])).push(g)}l&&(l=_t(l)),s&&s!=l&&(s=_t(s));var m=[l];if(!u){var y,b=t.text.length-2;if(b>0&&l)for(var w=0;w<l.length;++w)null==l[w].to&&(y||(y=[])).push(new Et(l[w].marker,null,null));for(var x=0;x<b;++x)m.push(y);m.push(s)}return m}function _t(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function zt(e,t,r){var n=null;if(e.iter(t.line,r.line+1,(function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=z(n,r)||(n||(n=[])).push(r)}})),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var u=i[s];if(!(ot(u.to,l.from)<0||ot(u.from,l.to)>0)){var c=[s,1],f=ot(u.from,l.from),d=ot(u.to,l.to);(f<0||!a.inclusiveLeft&&!f)&&c.push({from:u.from,to:l.from}),(d>0||!a.inclusiveRight&&!d)&&c.push({from:l.to,to:u.to}),i.splice.apply(i,c),s+=c.length-3}}return i}function Bt(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function jt(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function Vt(e){return e.inclusiveLeft?-1:0}function Ut(e){return e.inclusiveRight?1:0}function Gt(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=ot(n.from,i.from)||Vt(e)-Vt(t);if(o)return-o;var a=ot(n.to,i.to)||Ut(e)-Ut(t);return a||t.id-e.id}function $t(e,t){var r,n=Ot&&e.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)i=n[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!r||Gt(r,i.marker)<0)&&(r=i.marker);return r}function Kt(e){return $t(e,!0)}function Yt(e){return $t(e,!1)}function Xt(e,t){var r,n=Ot&&e.markedSpans;if(n)for(var i=0;i<n.length;++i){var o=n[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!r||Gt(r,o.marker)<0)&&(r=o.marker)}return r}function qt(e,t,r,n,i){var o=qe(e,t),a=Ot&&o.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var u=s.marker.find(0),c=ot(u.from,r)||Vt(s.marker)-Vt(i),f=ot(u.to,n)||Ut(s.marker)-Ut(i);if(!(c>=0&&f<=0||c<=0&&f>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?ot(u.to,r)>=0:ot(u.to,r)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?ot(u.from,n)<=0:ot(u.from,n)<0)))return!0}}}function Zt(e){var t;while(t=Kt(e))e=t.find(-1,!0).line;return e}function Jt(e){var t;while(t=Yt(e))e=t.find(1,!0).line;return e}function Qt(e){var t,r;while(t=Yt(e))e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function er(e,t){var r=qe(e,t),n=Zt(r);return r==n?t:et(n)}function tr(e,t){if(t>e.lastLine())return t;var r,n=qe(e,t);if(!rr(e,n))return t;while(r=Yt(n))n=r.find(1,!0).line;return et(n)+1}function rr(e,t){var r=Ot&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if(n=r[i],n.marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&nr(e,t,n))return!0}}function nr(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return nr(e,n.line,Wt(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&nr(e,t,i))return!0}function ir(e){e=Zt(e);for(var t=0,r=e.parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;r=o,o=r.parent)for(var a=0;a<o.children.length;++a){var l=o.children[a];if(l==r)break;t+=l.height}return t}function or(e){if(0==e.height)return 0;var t,r=e.text.length,n=e;while(t=Kt(n)){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}n=e;while(t=Yt(n)){var o=t.find(0,!0);r-=n.text.length-o.from.ch,n=o.to.line,r+=n.text.length-o.to.ch}return r}function ar(e){var t=e.display,r=e.doc;t.maxLine=qe(r,r.first),t.maxLineLength=or(t.maxLine),t.maxLineChanged=!0,r.iter((function(e){var r=or(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)}))}var lr=function(e,t,r){this.text=e,jt(this,t),this.height=r?r(this):1};function sr(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Bt(e),jt(e,r);var i=n?n(e):1;i!=e.height&&Qe(e,i)}function ur(e){e.parent=null,Bt(e)}lr.prototype.lineNo=function(){return et(this)},xe(lr);var cr={},fr={};function dr(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?fr:cr;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function hr(e,t){var r=N("span",null,null,s?"padding-right: .1px":null),n={pre:N("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;n.pos=0,n.addToken=gr,Ee(e.display.measure)&&(a=de(o,e.doc.direction))&&(n.addToken=mr(n.addToken,a)),n.map=[];var l=t!=e.display.externalMeasured&&et(o);br(o,n,mt(e,o,l)),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=F(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=F(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(De(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var u=n.content.lastChild;(/\bcm-tab\b/.test(u.className)||u.querySelector&&u.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return me(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=F(n.pre.className,n.textClass||"")),n}function pr(e){var t=O("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function gr(e,t,r,n,i,o,s){if(t){var u,c=e.splitSpaces?vr(t,e.trailingSpace):t,f=e.cm.state.specialChars,d=!1;if(f.test(t)){u=document.createDocumentFragment();var h=0;while(1){f.lastIndex=h;var p=f.exec(t),g=p?p.index-h:t.length-h;if(g){var v=document.createTextNode(c.slice(h,h+g));a&&l<9?u.appendChild(O("span",[v])):u.appendChild(v),e.map.push(e.pos,e.pos+g,v),e.col+=g,e.pos+=g}if(!p)break;h+=g+1;var m=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;m=u.appendChild(O("span",Y(b),"cm-tab")),m.setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?(m=u.appendChild(O("span","\r"==p[0]?"␍":"␤","cm-invalidchar")),m.setAttribute("cm-text",p[0]),e.col+=1):(m=e.cm.options.specialCharPlaceholder(p[0]),m.setAttribute("cm-text",p[0]),a&&l<9?u.appendChild(O("span",[m])):u.appendChild(m),e.col+=1);e.map.push(e.pos,e.pos+1,m),e.pos++}}else e.col+=t.length,u=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,u),a&&l<9&&(d=!0),e.pos+=t.length;if(e.trailingSpace=32==c.charCodeAt(t.length-1),r||n||i||d||o){var w=r||"";n&&(w+=n),i&&(w+=i);var x=O("span",[u],w,o);if(s)for(var C in s)s.hasOwnProperty(C)&&"style"!=C&&"class"!=C&&x.setAttribute(C,s[C]);return e.content.appendChild(x)}e.content.appendChild(u)}}function vr(e,t){if(e.length>1&&!/  /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}function mr(e,t){return function(r,n,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border";for(var u=r.pos,c=u+n.length;;){for(var f=void 0,d=0;d<t.length;d++)if(f=t[d],f.to>u&&f.from<=u)break;if(f.to>=c)return e(r,n,i,o,a,l,s);e(r,n.slice(0,f.to-u),i,o,null,l,s),o=null,n=n.slice(f.to-u),u=f.to}}}function yr(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function br(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,l,s,u,c,f,d,h=i.length,p=0,g=1,v="",m=0;;){if(m==p){s=u=c=l="",d=null,f=null,m=1/0;for(var y=[],b=void 0,w=0;w<n.length;++w){var x=n[w],C=x.marker;if("bookmark"==C.type&&x.from==p&&C.widgetNode)y.push(C);else if(x.from<=p&&(null==x.to||x.to>p||C.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&m>x.to&&(m=x.to,u=""),C.className&&(s+=" "+C.className),C.css&&(l=(l?l+";":"")+C.css),C.startStyle&&x.from==p&&(c+=" "+C.startStyle),C.endStyle&&x.to==m&&(b||(b=[])).push(C.endStyle,x.to),C.title&&((d||(d={})).title=C.title),C.attributes)for(var k in C.attributes)(d||(d={}))[k]=C.attributes[k];C.collapsed&&(!f||Gt(f.marker,C)<0)&&(f=x)}else x.from>p&&m>x.from&&(m=x.from)}if(b)for(var S=0;S<b.length;S+=2)b[S+1]==m&&(u+=" "+b[S]);if(!f||f.from==p)for(var L=0;L<y.length;++L)yr(t,0,y[L]);if(f&&(f.from||0)==p){if(yr(t,(null==f.to?h+1:f.to)-p,f.marker,null==f.from),null==f.to)return;f.to==p&&(f=!1)}}if(p>=h)break;var M=Math.min(h,m);while(1){if(v){var T=p+v.length;if(!f){var A=T>M?v.slice(0,M-p):v;t.addToken(t,A,a?a+s:s,c,p+A.length==m?u:"",l,d)}if(T>=M){v=v.slice(M-p),p=M;break}p=T,c=""}v=i.slice(o,o=r[g++]),a=dr(r[g++],t.cm.options)}}else for(var O=1;O<r.length;O+=2)t.addToken(t,i.slice(o,o=r[O]),dr(r[O+1],t.cm.options))}function wr(e,t,r){this.line=t,this.rest=Qt(t),this.size=this.rest?et(X(this.rest))-r+1:1,this.node=this.text=null,this.hidden=rr(e,t)}function xr(e,t,r){for(var n,i=[],o=t;o<r;o=n){var a=new wr(e.doc,qe(e.doc,o),o);n=o+a.size,i.push(a)}return i}var Cr=null;function kr(e){Cr?Cr.ops.push(e):e.ownsGroup=Cr={ops:[e],delayedCallbacks:[]}}function Sr(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)while(i.cursorActivityCalled<i.cursorActivityHandlers.length)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}function Lr(e,t){var r=e.ownsGroup;if(r)try{Sr(r)}finally{Cr=null,t(r)}}var Mr=null;function Tr(e,t){var r=ge(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);Cr?n=Cr.delayedCallbacks:Mr?n=Mr:(n=Mr=[],setTimeout(Ar,0));for(var o=function(e){n.push((function(){return r[e].apply(null,i)}))},a=0;a<r.length;++a)o(a)}}function Ar(){var e=Mr;Mr=null;for(var t=0;t<e.length;++t)e[t]()}function Or(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?Wr(e,t):"gutter"==o?Hr(e,t,r,n):"class"==o?Fr(e,t):"widget"==o&&Rr(e,t,n)}t.changes=null}function Nr(e){return e.node==e.text&&(e.node=O("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),a&&l<8&&(e.node.style.zIndex=2)),e.node}function Dr(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=Nr(t);t.background=n.insertBefore(O("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}function Er(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):hr(e,t)}function Wr(e,t){var r=t.text.className,n=Er(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,Fr(e,t)):r&&(t.text.className=r)}function Fr(e,t){Dr(e,t),t.line.wrapClass?Nr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function Hr(e,t,r,n){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=Nr(t);t.gutterBackground=O("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var a=Nr(t),l=t.gutter=O("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(l),a.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(O("div",nt(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.display.gutterSpecs.length;++s){var u=e.display.gutterSpecs[s].className,c=o.hasOwnProperty(u)&&o[u];c&&l.appendChild(O("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[u]+"px; width: "+n.gutterWidth[u]+"px"))}}}function Rr(e,t,r){t.alignable&&(t.alignable=null);for(var n=S("CodeMirror-linewidget"),i=t.node.firstChild,o=void 0;i;i=o)o=i.nextSibling,n.test(i.className)&&t.node.removeChild(i);Pr(e,t,r)}function Ir(e,t,r,n){var i=Er(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),Fr(e,t),Hr(e,t,r,n),Pr(e,t,n),t.node}function Pr(e,t,r){if(_r(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)_r(e,t.rest[n],t,r,!1)}function _r(e,t,r,n,i){if(t.widgets)for(var o=Nr(r),a=0,l=t.widgets;a<l.length;++a){var s=l[a],u=O("div",[s.node],"CodeMirror-linewidget"+(s.className?" "+s.className:""));s.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),zr(s,u,r,n),e.display.input.setUneditable(u),i&&s.above?o.insertBefore(u,r.gutter||r.text):o.appendChild(u),Tr(s,"redraw")}}function zr(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function Br(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),A(t.display.measure,O("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function jr(e,t){for(var r=Me(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Vr(e){return e.lineSpace.offsetTop}function Ur(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Gr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=A(e.measure,O("pre","x","CodeMirror-line-like")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function $r(e){return B-e.display.nativeBarWidth}function Kr(e){return e.display.scroller.clientWidth-$r(e)-e.display.barWidth}function Yr(e){return e.display.scroller.clientHeight-$r(e)-e.display.barHeight}function Xr(e,t,r){var n=e.options.lineWrapping,i=n&&Kr(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],u=a[l+1];Math.abs(s.bottom-u.bottom)>2&&o.push((s.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}function qr(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(et(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Zr(e,t){t=Zt(t);var r=et(t),n=e.display.externalMeasured=new wr(e.doc,t,r);n.lineN=r;var i=n.built=hr(e,n);return n.text=i.pre,A(e.display.lineMeasure,i.pre),n}function Jr(e,t,r,n){return tn(e,en(e,t),r,n)}function Qr(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Hn(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function en(e,t){var r=et(t),n=Qr(e,r);n&&!n.text?n=null:n&&n.changes&&(Or(e,n,r,Nn(e)),e.curOp.forceUpdate=!0),n||(n=Zr(e,t));var i=qr(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function tn(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Xr(e,t.view,t.rect),t.hasHeights=!0),o=ln(e,t,r,n),o.bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var rn,nn={left:0,right:0,top:0,bottom:0};function on(e,t,r){for(var n,i,o,a,l,s,u=0;u<e.length;u+=3)if(l=e[u],s=e[u+1],t<l?(i=0,o=1,a="left"):t<s?(i=t-l,o=i+1):(u==e.length-3||t==s&&e[u+3]>t)&&(o=s-l,i=o-1,t>=s&&(a="right")),null!=i){if(n=e[u+2],l==s&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)while(u&&e[u-2]==e[u-3]&&e[u-1].insertLeft)n=e[2+(u-=3)],a="left";if("right"==r&&i==s-l)while(u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft)n=e[(u+=3)+2],a="right";break}return{node:n,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function an(e,t){var r=nn;if("left"==t){for(var n=0;n<e.length;n++)if((r=e[n]).left!=r.right)break}else for(var i=e.length-1;i>=0;i--)if((r=e[i]).left!=r.right)break;return r}function ln(e,t,r,n){var i,o=on(t.map,r,n),s=o.node,u=o.start,c=o.end,f=o.collapse;if(3==s.nodeType){for(var d=0;d<4;d++){while(u&&oe(t.line.text.charAt(o.coverStart+u)))--u;while(o.coverStart+c<o.coverEnd&&oe(t.line.text.charAt(o.coverStart+c)))++c;if(i=a&&l<9&&0==u&&c==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():an(L(s,u,c).getClientRects(),n),i.left||i.right||0==u)break;c=u,u-=1,f="right"}a&&l<11&&(i=sn(e.display.measure,i))}else{var h;u>0&&(f=n="right"),i=e.options.lineWrapping&&(h=s.getClientRects()).length>1?h["right"==n?h.length-1:0]:s.getBoundingClientRect()}if(a&&l<9&&!u&&(!i||!i.left&&!i.right)){var p=s.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+On(e.display),top:p.top,bottom:p.bottom}:nn}for(var g=i.top-t.rect.top,v=i.bottom-t.rect.top,m=(g+v)/2,y=t.view.measure.heights,b=0;b<y.length-1;b++)if(m<y[b])break;var w=b?y[b-1]:0,x=y[b],C={left:("right"==f?i.right:i.left)-t.rect.left,right:("left"==f?i.left:i.right)-t.rect.left,top:w,bottom:x};return i.left||i.right||(C.bogus=!0),e.options.singleCursorHeightPerLine||(C.rtop=g,C.rbottom=v),C}function sn(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Ie(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}function un(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 cn(e){e.display.externalMeasure=null,T(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)un(e.display.view[t])}function fn(e){cn(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function dn(){return c&&v?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function hn(){return c&&v?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function pn(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=Br(e.widgets[r]));return t}function gn(e,t,r,n,i){if(!i){var o=pn(t);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var a=ir(t);if("local"==n?a+=Vr(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==n?0:hn());var s=l.left+("window"==n?0:dn());r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function vn(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=dn(),i-=hn();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:n-a.left,top:i-a.top}}function mn(e,t,r,n,i){return n||(n=qe(e.doc,t.line)),gn(e,n,Jr(e,n,t.ch,i),r)}function yn(e,t,r,n,i,o){function a(t,a){var l=tn(e,i,t,a?"right":"left",o);return a?l.left=l.right:l.right=l.left,gn(e,n,l,r)}n=n||qe(e.doc,t.line),i||(i=en(e,n));var l=de(n,e.doc.direction),s=t.ch,u=t.sticky;if(s>=n.text.length?(s=n.text.length,u="before"):s<=0&&(s=0,u="after"),!l)return a("before"==u?s-1:s,"before"==u);function c(e,t,r){var n=l[t],i=1==n.level;return a(r?e-1:e,i!=r)}var f=ce(l,s,u),d=ue,h=c(s,f,"before"==u);return null!=d&&(h.other=c(s,d,"before"!=u)),h}function bn(e,t){var r=0;t=ft(e.doc,t),e.options.lineWrapping||(r=On(e.display)*t.ch);var n=qe(e.doc,t.line),i=ir(n)+Vr(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function wn(e,t,r,n,i){var o=it(e,t,r);return o.xRel=i,n&&(o.outside=n),o}function xn(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,r<0)return wn(n.first,0,null,-1,-1);var i=tt(n,r),o=n.first+n.size-1;if(i>o)return wn(n.first+n.size-1,qe(n,o).text.length,null,1,1);t<0&&(t=0);for(var a=qe(n,i);;){var l=Ln(e,a,i,t,r),s=Xt(a,l.ch+(l.xRel>0||l.outside>0?1:0));if(!s)return l;var u=s.find(1);if(u.line==i)return u;a=qe(n,i=u.line)}}function Cn(e,t,r,n){n-=pn(t);var i=t.text.length,o=le((function(t){return tn(e,r,t-1).bottom<=n}),i,0);return i=le((function(t){return tn(e,r,t).top>n}),o,i),{begin:o,end:i}}function kn(e,t,r,n){r||(r=en(e,t));var i=gn(e,t,tn(e,r,n),"line").top;return Cn(e,t,r,i)}function Sn(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Ln(e,t,r,n,i){i-=ir(t);var o=en(e,t),a=pn(t),l=0,s=t.text.length,u=!0,c=de(t,e.doc.direction);if(c){var f=(e.options.lineWrapping?Tn:Mn)(e,t,r,o,c,n,i);u=1!=f.level,l=u?f.from:f.to-1,s=u?f.to:f.from-1}var d,h,p=null,g=null,v=le((function(t){var r=tn(e,o,t);return r.top+=a,r.bottom+=a,!!Sn(r,n,i,!1)&&(r.top<=i&&r.left<=n&&(p=t,g=r),!0)}),l,s),m=!1;if(g){var y=n-g.left<g.right-n,b=y==u;v=p+(b?0:1),h=b?"after":"before",d=y?g.left:g.right}else{u||v!=s&&v!=l||v++,h=0==v?"after":v==t.text.length?"before":tn(e,o,v-(u?1:0)).bottom+a<=i==u?"after":"before";var w=yn(e,it(r,v,h),"line",t,o);d=w.left,m=i<w.top?-1:i>=w.bottom?1:0}return v=ae(t.text,v,1),wn(r,v,h,m,n-d)}function Mn(e,t,r,n,i,o,a){var l=le((function(l){var s=i[l],u=1!=s.level;return Sn(yn(e,it(r,u?s.to:s.from,u?"before":"after"),"line",t,n),o,a,!0)}),0,i.length-1),s=i[l];if(l>0){var u=1!=s.level,c=yn(e,it(r,u?s.from:s.to,u?"after":"before"),"line",t,n);Sn(c,o,a,!0)&&c.top>a&&(s=i[l-1])}return s}function Tn(e,t,r,n,i,o,a){var l=Cn(e,t,n,a),s=l.begin,u=l.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,f=null,d=0;d<i.length;d++){var h=i[d];if(!(h.from>=u||h.to<=s)){var p=1!=h.level,g=tn(e,n,p?Math.min(u,h.to)-1:Math.max(s,h.from)).right,v=g<o?o-g+1e9:g-o;(!c||f>v)&&(c=h,f=v)}}return c||(c=i[i.length-1]),c.from<s&&(c={from:s,to:c.to,level:c.level}),c.to>u&&(c={from:c.from,to:u,level:c.level}),c}function An(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==rn){rn=O("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)rn.appendChild(document.createTextNode("x")),rn.appendChild(O("br"));rn.appendChild(document.createTextNode("x"))}A(e.measure,rn);var r=rn.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),T(e.measure),r||1}function On(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=O("span","xxxxxxxxxx"),r=O("pre",[t],"CodeMirror-line-like");A(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Nn(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className;r[l]=o.offsetLeft+o.clientLeft+i,n[l]=o.clientWidth}return{fixedPos:Dn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function Dn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function En(e){var t=An(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/On(e.display)-3);return function(i){if(rr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function Wn(e){var t=e.doc,r=En(e);t.iter((function(e){var t=r(e);t!=e.height&&Qe(e,t)}))}function Fn(e,t,r,n){var i=e.display;if(!r&&"true"==Me(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,u=xn(e,o,a);if(n&&u.xRel>0&&(s=qe(e.doc,u.line).text).length==u.ch){var c=P(s,s.length,e.options.tabSize)-s.length;u=it(u.line,Math.max(0,Math.round((o-Gr(e.display).left)/On(e.display))-c))}return u}function Hn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if(t-=r[n].size,t<0)return n}function Rn(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ot&&er(e.doc,t)<i.viewTo&&Pn(e);else if(r<=i.viewFrom)Ot&&tr(e.doc,r+n)>i.viewFrom?Pn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Pn(e);else if(t<=i.viewFrom){var o=_n(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):Pn(e)}else if(r>=i.viewTo){var a=_n(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):Pn(e)}else{var l=_n(e,t,t,-1),s=_n(e,r,r+n,1);l&&s?(i.view=i.view.slice(0,l.index).concat(xr(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):Pn(e)}var u=i.externalMeasured;u&&(r<u.lineN?u.lineN+=n:t<u.lineN+u.size&&(i.externalMeasured=null))}function In(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[Hn(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==z(a,r)&&a.push(r)}}}function Pn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function _n(e,t,r,n){var i,o=Hn(e,t),a=e.display.view;if(!Ot||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var l=e.display.viewFrom,s=0;s<o;s++)l+=a[s].size;if(l!=t){if(n>0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,r+=i}while(er(e.doc,r)!=r){if(o==(n<0?0:a.length-1))return null;r+=n*a[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function zn(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=xr(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=xr(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(Hn(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(xr(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,Hn(e,r)))),n.viewTo=r}function Bn(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function jn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Vn(e,t){void 0===t&&(t=!0);for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),a=0;a<r.sel.ranges.length;a++)if(t||a!=r.sel.primIndex){var l=r.sel.ranges[a];if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var s=l.empty();(s||e.options.showCursorWhenSelecting)&&Un(e,l.head,i),s||$n(e,l,o)}}return n}function Un(e,t,r){var n=yn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(O("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(O("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function Gn(e,t){return e.top-t.top||e.left-t.left}function $n(e,t,r){var n=e.display,i=e.doc,o=document.createDocumentFragment(),a=Gr(e.display),l=a.left,s=Math.max(n.sizerWidth,Kr(e)-n.sizer.offsetLeft)-a.right,u="ltr"==i.direction;function c(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),o.appendChild(O("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n                             top: "+t+"px; width: "+(null==r?s-e:r)+"px;\n                             height: "+(n-t)+"px"))}function f(t,r,n){var o,a,f=qe(i,t),d=f.text.length;function h(r,n){return mn(e,it(t,r),"div",f,n)}function p(t,r,n){var i=kn(e,f,null,t),o="ltr"==r==("after"==n)?"left":"right",a="after"==n?i.begin:i.end-(/\s/.test(f.text.charAt(i.end-1))?2:1);return h(a,o)[o]}var g=de(f,i.direction);return se(g,r||0,null==n?d:n,(function(e,t,i,f){var v="ltr"==i,m=h(e,v?"left":"right"),y=h(t-1,v?"right":"left"),b=null==r&&0==e,w=null==n&&t==d,x=0==f,C=!g||f==g.length-1;if(y.top-m.top<=3){var k=(u?b:w)&&x,S=(u?w:b)&&C,L=k?l:(v?m:y).left,M=S?s:(v?y:m).right;c(L,m.top,M-L,m.bottom)}else{var T,A,O,N;v?(T=u&&b&&x?l:m.left,A=u?s:p(e,i,"before"),O=u?l:p(t,i,"after"),N=u&&w&&C?s:y.right):(T=u?p(e,i,"before"):l,A=!u&&b&&x?s:m.right,O=!u&&w&&C?l:y.left,N=u?p(t,i,"after"):s),c(T,m.top,A-T,m.bottom),m.bottom<y.top&&c(l,m.bottom,null,y.top),c(O,y.top,N-O,y.bottom)}(!o||Gn(m,o)<0)&&(o=m),Gn(y,o)<0&&(o=y),(!a||Gn(m,a)<0)&&(a=m),Gn(y,a)<0&&(a=y)})),{start:o,end:a}}var d=t.from(),h=t.to();if(d.line==h.line)f(d.line,d.ch,h.ch);else{var p=qe(i,d.line),g=qe(i,h.line),v=Zt(p)==Zt(g),m=f(d.line,d.ch,v?p.text.length+1:null).end,y=f(h.line,v?0:null,h.ch).start;v&&(m.top<y.top-2?(c(m.right,m.top,null,m.bottom),c(l,y.top,y.left,y.bottom)):c(m.right,m.top,y.left-m.right,m.bottom)),m.bottom<y.top&&c(l,m.bottom,null,y.top)}r.appendChild(o)}function Kn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval((function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Yn(e){e.state.focused||(e.display.input.focus(),qn(e))}function Xn(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Zn(e))}),100)}function qn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(me(e,"focus",e,t),e.state.focused=!0,W(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),s&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),Kn(e))}function Zn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(me(e,"blur",e,t),e.state.focused=!1,M(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Jn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o=e.options.lineWrapping,s=void 0,u=0;if(!i.hidden){if(a&&l<8){var c=i.node.offsetTop+i.node.offsetHeight;s=c-r,r=c}else{var f=i.node.getBoundingClientRect();s=f.bottom-f.top,!o&&i.text.firstChild&&(u=i.text.firstChild.getBoundingClientRect().right-f.left-1)}var d=i.line.height-s;if((d>.005||d<-.005)&&(Qe(i.line,s),Qn(i.line),i.rest))for(var h=0;h<i.rest.length;h++)Qn(i.rest[h]);if(u>e.display.sizerWidth){var p=Math.ceil(u/On(e.display));p>e.display.maxLineLength&&(e.display.maxLineLength=p,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function Qn(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function ei(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-Vr(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=tt(t,n),a=tt(t,i);if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line;l<o?(o=l,a=tt(t,ir(qe(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=tt(t,ir(qe(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function ti(e,t){if(!ye(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=O("div","​",null,"position: absolute;\n                         top: "+(t.top-r.viewOffset-Vr(e.display))+"px;\n                         height: "+(t.bottom-t.top+$r(e)+r.barHeight)+"px;\n                         left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function ri(e,t,r,n){var i;null==n&&(n=0),e.options.lineWrapping||t!=r||(t=t.ch?it(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t,r="before"==t.sticky?it(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var a=!1,l=yn(e,t),s=r&&r!=t?yn(e,r):l;i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-n,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+n};var u=ii(e,i),c=e.doc.scrollTop,f=e.doc.scrollLeft;if(null!=u.scrollTop&&(fi(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),null!=u.scrollLeft&&(hi(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(a=!0)),!a)break}return i}function ni(e,t){var r=ii(e,t);null!=r.scrollTop&&fi(e,r.scrollTop),null!=r.scrollLeft&&hi(e,r.scrollLeft)}function ii(e,t){var r=e.display,n=An(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=Yr(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var l=e.doc.height+Ur(r),s=t.top<n,u=t.bottom>l-n;if(t.top<i)a.scrollTop=s?0:t.top;else if(t.bottom>i+o){var c=Math.min(t.top,(u?l:t.bottom)-o);c!=i&&(a.scrollTop=c)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,d=Kr(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),h=t.right-t.left>d;return h&&(t.right=t.left+d),t.left<10?a.scrollLeft=0:t.left<f?a.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>d+f-3&&(a.scrollLeft=t.right+(h?0:10)-d),a}function oi(e,t){null!=t&&(ui(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function ai(e){ui(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function li(e,t,r){null==t&&null==r||ui(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function si(e,t){ui(e),e.curOp.scrollToPos=t}function ui(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=bn(e,t.from),n=bn(e,t.to);ci(e,r,n,t.margin)}}function ci(e,t,r,n){var i=ii(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});li(e,i.scrollLeft,i.scrollTop)}function fi(e,t){Math.abs(e.doc.scrollTop-t)<2||(r||ji(e,{top:t}),di(e,t,!0),r&&ji(e),Fi(e,100))}function di(e,t,r){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function hi(e,t,r,n){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,$i(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function pi(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Ur(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?r:0,docHeight:n,scrollHeight:n+$r(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var gi=function(e,t,r){this.cm=r;var n=this.vert=O("div",[O("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=O("div",[O("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),pe(n,"scroll",(function(){n.clientHeight&&t(n.scrollTop,"vertical")})),pe(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&l<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};gi.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},gi.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},gi.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},gi.prototype.zeroWidthHack=function(){var e=y&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new _,this.disableVert=new _},gi.prototype.enableZeroWidthBar=function(e,t,r){function n(){var i=e.getBoundingClientRect(),o="vert"==r?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1);o!=e?e.style.pointerEvents="none":t.set(1e3,n)}e.style.pointerEvents="auto",t.set(1e3,n)},gi.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var vi=function(){};function mi(e,t){t||(t=pi(e));var r=e.display.barWidth,n=e.display.barHeight;yi(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&Jn(e),yi(e,pi(e)),r=e.display.barWidth,n=e.display.barHeight}function yi(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}vi.prototype.update=function(){return{bottom:0,right:0}},vi.prototype.setScrollLeft=function(){},vi.prototype.setScrollTop=function(){},vi.prototype.clear=function(){};var bi={native:gi,null:vi};function wi(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&M(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new bi[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),pe(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,r){"horizontal"==r?hi(e,t):fi(e,t)}),e),e.display.scrollbars.addClass&&W(e.display.wrapper,e.display.scrollbars.addClass)}var xi=0;function Ci(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:++xi},kr(e.curOp)}function ki(e){var t=e.curOp;t&&Lr(t,(function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;Si(e)}))}function Si(e){for(var t=e.ops,r=0;r<t.length;r++)Li(t[r]);for(var n=0;n<t.length;n++)Mi(t[n]);for(var i=0;i<t.length;i++)Ti(t[i]);for(var o=0;o<t.length;o++)Ai(t[o]);for(var a=0;a<t.length;a++)Oi(t[a])}function Li(e){var t=e.cm,r=t.display;Ii(t),e.updateMaxLine&&ar(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Ri(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Mi(e){e.updatedDisplay=e.mustUpdate&&zi(e.cm,e.update)}function Ti(e){var t=e.cm,r=t.display;e.updatedDisplay&&Jn(t),e.barMeasure=pi(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Jr(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+$r(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Kr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Ai(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&hi(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==E();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&mi(t,e.barMeasure),e.updatedDisplay&&Gi(t,e.barMeasure),e.selectionChanged&&Kn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&Yn(e.cm)}function Oi(e){var t=e.cm,r=t.display,n=t.doc;if(e.updatedDisplay&&Bi(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&di(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&hi(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=ri(t,ft(n,e.scrollToPos.from),ft(n,e.scrollToPos.to),e.scrollToPos.margin);ti(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers;if(o)for(var l=0;l<o.length;++l)o[l].lines.length||me(o[l],"hide");if(a)for(var s=0;s<a.length;++s)a[s].lines.length&&me(a[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&me(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Ni(e,t){if(e.curOp)return t();Ci(e);try{return t()}finally{ki(e)}}function Di(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Ci(e);try{return t.apply(e,arguments)}finally{ki(e)}}}function Ei(e){return function(){if(this.curOp)return e.apply(this,arguments);Ci(this);try{return e.apply(this,arguments)}finally{ki(this)}}}function Wi(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Ci(t);try{return e.apply(this,arguments)}finally{ki(t)}}}function Fi(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,R(Hi,e))}function Hi(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=yt(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(n.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?$e(t.mode,n.state):null,s=vt(e,o,n,!0);l&&(n.state=l),o.styles=s.styles;var u=o.styleClasses,c=s.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var f=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),d=0;!f&&d<a.length;++d)f=a[d]!=o.styles[d];f&&i.push(n.line),o.stateAfter=n.save(),n.nextLine()}else o.text.length<=e.options.maxHighlightLength&&bt(e,o.text,n),o.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return Fi(e,e.options.workDelay),!0})),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Ni(e,(function(){for(var t=0;t<i.length;t++)In(e,i[t],"text")}))}}var Ri=function(e,t,r){var n=e.display;this.viewport=t,this.visible=ei(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Kr(e),this.force=r,this.dims=Nn(e),this.events=[]};function Ii(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=$r(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=$r(e)+"px",t.scrollbarsClipped=!0)}function Pi(e){if(e.hasFocus())return null;var t=E();if(!t||!D(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&D(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}function _i(e){if(e&&e.activeElt&&e.activeElt!=E()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}function zi(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Pn(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Bn(e))return!1;Ki(e)&&(Pn(e),t.dims=Nn(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>a&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),Ot&&(o=er(e.doc,o),a=tr(e.doc,a));var l=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;zn(e,o,a),r.viewOffset=ir(qe(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var s=Bn(e);if(!l&&0==s&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var u=Pi(e);return s>4&&(r.lineDiv.style.display="none"),Vi(e,r.updateLineNumbers,t.dims),s>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,_i(u),T(r.cursorDiv),T(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,l&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Fi(e,400)),r.updateLineNumbers=null,!0}function Bi(e,t){for(var r=t.viewport,n=!0;;n=!1){if(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Kr(e))n&&(t.visible=ei(e.display,e.doc,r));else if(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Ur(e.display)-Yr(e),r.top)}),t.visible=ei(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!zi(e,t))break;Jn(e);var i=pi(e);jn(e),mi(e,i),Gi(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 ji(e,t){var r=new Ri(e,t);if(zi(e,r)){Jn(e),Bi(e,r);var n=pi(e);jn(e),mi(e,n),Gi(e,n),r.finish()}}function Vi(e,t,r){var n=e.display,i=e.options.lineNumbers,o=n.lineDiv,a=o.firstChild;function l(t){var r=t.nextSibling;return s&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var u=n.view,c=n.viewFrom,f=0;f<u.length;f++){var d=u[f];if(d.hidden);else if(d.node&&d.node.parentNode==o){while(a!=d.node)a=l(a);var h=i&&null!=t&&t<=c&&d.lineNumber;d.changes&&(z(d.changes,"gutter")>-1&&(h=!1),Or(e,d,c,r)),h&&(T(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(nt(e.options,c)))),a=d.node.nextSibling}else{var p=Ir(e,d,c,r);o.insertBefore(p,a)}c+=d.size}while(a)a=l(a)}function Ui(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function Gi(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+$r(e)+"px"}function $i(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=Dn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&(r[a].gutter&&(r[a].gutter.style.left=o),r[a].gutterBackground&&(r[a].gutterBackground.style.left=o));var l=r[a].alignable;if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function Ki(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=nt(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(O("div",[O("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a)+1,n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",Ui(e.display),!0}return!1}function Yi(e,t){for(var r=[],n=!1,i=0;i<e.length;i++){var o=e[i],a=null;if("string"!=typeof o&&(a=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue;n=!0}r.push({className:o,style:a})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function Xi(e){var t=e.gutters,r=e.gutterSpecs;T(t),e.lineGutter=null;for(var n=0;n<r.length;++n){var i=r[n],o=i.className,a=i.style,l=t.appendChild(O("div",null,"CodeMirror-gutter "+o));a&&(l.style.cssText=a),"CodeMirror-linenumbers"==o&&(e.lineGutter=l,l.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",Ui(e)}function qi(e){Xi(e.display),Rn(e),$i(e)}function Zi(e,t,n,i){var o=this;this.input=n,o.scrollbarFiller=O("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=O("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=N("div",null,"CodeMirror-code"),o.selectionDiv=O("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=O("div",null,"CodeMirror-cursors"),o.measure=O("div",null,"CodeMirror-measure"),o.lineMeasure=O("div",null,"CodeMirror-measure"),o.lineSpace=N("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var u=N("div",[o.lineSpace],"CodeMirror-lines");o.mover=O("div",[u],null,"position: relative"),o.sizer=O("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=O("div",null,null,"position: absolute; height: "+B+"px; width: 1px;"),o.gutters=O("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=O("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=O("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),a&&l<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),s||r&&m||(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=Yi(i.gutters,i.lineNumbers),Xi(o),n.init(o)}Ri.prototype.signal=function(e,t){we(e,t)&&this.events.push(arguments)},Ri.prototype.finish=function(){for(var e=0;e<this.events.length;e++)me.apply(null,this.events[e])};var Ji=0,Qi=null;function eo(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function to(e){var t=eo(e);return t.x*=Qi,t.y*=Qi,t}function ro(e,t){var n=eo(t),i=n.x,o=n.y,a=e.display,l=a.scroller,u=l.scrollWidth>l.clientWidth,c=l.scrollHeight>l.clientHeight;if(i&&u||o&&c){if(o&&y&&s)e:for(var d=t.target,h=a.view;d!=l;d=d.parentNode)for(var p=0;p<h.length;p++)if(h[p].node==d){e.display.currentWheelTarget=d;break e}if(i&&!r&&!f&&null!=Qi)return o&&c&&fi(e,Math.max(0,l.scrollTop+o*Qi)),hi(e,Math.max(0,l.scrollLeft+i*Qi)),(!o||o&&c)&&Ce(t),void(a.wheelStartX=null);if(o&&null!=Qi){var g=o*Qi,v=e.doc.scrollTop,m=v+a.wrapper.clientHeight;g<0?v=Math.max(0,v+g-50):m=Math.min(e.doc.height,m+g+50),ji(e,{top:v,bottom:m})}Ji<20&&(null==a.wheelStartX?(a.wheelStartX=l.scrollLeft,a.wheelStartY=l.scrollTop,a.wheelDX=i,a.wheelDY=o,setTimeout((function(){if(null!=a.wheelStartX){var e=l.scrollLeft-a.wheelStartX,t=l.scrollTop-a.wheelStartY,r=t&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX;a.wheelStartX=a.wheelStartY=null,r&&(Qi=(Qi*Ji+r)/(Ji+1),++Ji)}}),200)):(a.wheelDX+=i,a.wheelDY+=o))}}a?Qi=-.53:r?Qi=15:c?Qi=-.7:d&&(Qi=-1/3);var no=function(e,t){this.ranges=e,this.primIndex=t};no.prototype.primary=function(){return this.ranges[this.primIndex]},no.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 r=this.ranges[t],n=e.ranges[t];if(!at(r.anchor,n.anchor)||!at(r.head,n.head))return!1}return!0},no.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new io(lt(this.ranges[t].anchor),lt(this.ranges[t].head));return new no(e,this.primIndex)},no.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},no.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(ot(t,n.from())>=0&&ot(e,n.to())<=0)return r}return-1};var io=function(e,t){this.anchor=e,this.head=t};function oo(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort((function(e,t){return ot(e.from(),t.from())})),r=z(t,i);for(var o=1;o<t.length;o++){var a=t[o],l=t[o-1],s=ot(l.to(),a.from());if(n&&!a.empty()?s>0:s>=0){var u=ut(l.from(),a.from()),c=st(l.to(),a.to()),f=l.empty()?a.from()==a.head:l.from()==l.head;o<=r&&--r,t.splice(--o,2,new io(f?c:u,f?u:c))}}return new no(t,r)}function ao(e,t){return new no([new io(e,t||e)],0)}function lo(e){return e.text?it(e.from.line+e.text.length-1,X(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function so(e,t){if(ot(e,t.from)<0)return e;if(ot(e,t.to)<=0)return lo(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=lo(t).ch-t.to.ch),it(r,n)}function uo(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new io(so(i.anchor,t),so(i.head,t)))}return oo(e.cm,r,e.sel.primIndex)}function co(e,t,r){return e.line==t.line?it(r.line,e.ch-t.ch+r.ch):it(r.line+(e.line-t.line),e.ch)}function fo(e,t,r){for(var n=[],i=it(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=co(l.from,i,o),u=co(lo(l),i,o);if(i=l.to,o=u,"around"==r){var c=e.sel.ranges[a],f=ot(c.head,c.anchor)<0;n[a]=new io(f?u:s,f?s:u)}else n[a]=new io(s,s)}return new no(n,e.sel.primIndex)}function ho(e){e.doc.mode=Ve(e.options,e.doc.modeOption),po(e)}function po(e){e.doc.iter((function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)})),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Fi(e,100),e.state.modeGen++,e.curOp&&Rn(e)}function go(e,t){return 0==t.from.ch&&0==t.to.ch&&""==X(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function vo(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){sr(e,r,i,n),Tr(e,"change",e,t)}function a(e,t){for(var r=[],o=e;o<t;++o)r.push(new lr(u[o],i(o),n));return r}var l=t.from,s=t.to,u=t.text,c=qe(e,l.line),f=qe(e,s.line),d=X(u),h=i(u.length-1),p=s.line-l.line;if(t.full)e.insert(0,a(0,u.length)),e.remove(u.length,e.size-u.length);else if(go(e,t)){var g=a(0,u.length-1);o(f,f.text,h),p&&e.remove(l.line,p),g.length&&e.insert(l.line,g)}else if(c==f)if(1==u.length)o(c,c.text.slice(0,l.ch)+d+c.text.slice(s.ch),h);else{var v=a(1,u.length-1);v.push(new lr(d+c.text.slice(s.ch),h,n)),o(c,c.text.slice(0,l.ch)+u[0],i(0)),e.insert(l.line+1,v)}else if(1==u.length)o(c,c.text.slice(0,l.ch)+u[0]+f.text.slice(s.ch),i(0)),e.remove(l.line+1,p);else{o(c,c.text.slice(0,l.ch)+u[0],i(0)),o(f,d+f.text.slice(s.ch),h);var m=a(1,u.length-1);p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,m)}Tr(e,"change",e,t)}function mo(e,t,r){function n(e,i,o){if(e.linked)for(var a=0;a<e.linked.length;++a){var l=e.linked[a];if(l.doc!=i){var s=o&&l.sharedHist;r&&!s||(t(l.doc,s),n(l.doc,e,s))}}}n(e,null,!0)}function yo(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,Wn(e),ho(e),bo(e),e.options.lineWrapping||ar(e),e.options.mode=t.modeOption,Rn(e)}function bo(e){("rtl"==e.doc.direction?W:M)(e.display.lineDiv,"CodeMirror-rtl")}function wo(e){Ni(e,(function(){bo(e),Rn(e)}))}function xo(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Co(e,t){var r={from:lt(t.from),to:lo(t),text:Ze(e,t.from,t.to)};return Oo(e,r,t.from.line,t.to.line+1),mo(e,(function(e){return Oo(e,r,t.from.line,t.to.line+1)}),!0),r}function ko(e){while(e.length){var t=X(e);if(!t.ranges)break;e.pop()}}function So(e,t){return t?(ko(e.done),X(e.done)):e.done.length&&!X(e.done).ranges?X(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),X(e.done)):void 0}function Lo(e,t,r,n){var i=e.history;i.undone.length=0;var o,a,l=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=So(i,i.lastOp==n)))a=X(o.changes),0==ot(t.from,t.to)&&0==ot(t.from,a.to)?a.to=lo(t):o.changes.push(Co(e,t));else{var s=X(i.done);s&&s.ranges||Ao(e.sel,i.done),o={changes:[Co(e,t)],generation:i.generation},i.done.push(o);while(i.done.length>i.undoDepth)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,a||me(e,"historyAdded")}function Mo(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function To(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||Mo(e,o,X(i.done),t))?i.done[i.done.length-1]=t:Ao(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&!1!==n.clearRedo&&ko(i.undone)}function Ao(e,t){var r=X(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Oo(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),(function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o}))}function No(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function Do(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(No(r[i]));return n}function Eo(e,t){var r=Do(e,t),n=Pt(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],a=n[i];if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],u=0;u<o.length;++u)if(o[u].marker==s.marker)continue e;o.push(s)}else a&&(r[i]=a)}return r}function Wo(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?no.prototype.deepCopy.call(o):o);else{var a=o.changes,l=[];n.push({changes:l});for(var s=0;s<a.length;++s){var u=a[s],c=void 0;if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var f in u)(c=f.match(/^spans_(\d+)$/))&&z(t,Number(c[1]))>-1&&(X(l)[f]=u[f],delete u[f])}}}return n}function Fo(e,t,r,n){if(n){var i=e.anchor;if(r){var o=ot(t,i)<0;o!=ot(r,i)<0?(i=t,t=r):o!=ot(t,r)<0&&(t=r)}return new io(i,t)}return new io(r||t,t)}function Ho(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Bo(e,new no([Fo(e.sel.primary(),t,r,i)],0),n)}function Ro(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)n[o]=Fo(e.sel.ranges[o],t[o],null,i);var a=oo(e.cm,n,e.sel.primIndex);Bo(e,a,r)}function Io(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Bo(e,oo(e.cm,i,e.sel.primIndex),n)}function Po(e,t,r,n){Bo(e,ao(t,r),n)}function _o(e,t,r){var n={ranges:t.ranges,update:function(t){this.ranges=[];for(var r=0;r<t.length;r++)this.ranges[r]=new io(ft(e,t[r].anchor),ft(e,t[r].head))},origin:r&&r.origin};return me(e,"beforeSelectionChange",e,n),e.cm&&me(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?oo(e.cm,n.ranges,n.ranges.length-1):t}function zo(e,t,r){var n=e.history.done,i=X(n);i&&i.ranges?(n[n.length-1]=t,jo(e,t,r)):Bo(e,t,r)}function Bo(e,t,r){jo(e,t,r),To(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function jo(e,t,r){(we(e,"beforeSelectionChange")||e.cm&&we(e.cm,"beforeSelectionChange"))&&(t=_o(e,t,r));var n=r&&r.bias||(ot(t.primary().head,e.sel.primary().head)<0?-1:1);Vo(e,Go(e,t,n,!0)),r&&!1===r.scroll||!e.cm||ai(e.cm)}function Vo(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,be(e.cm)),Tr(e,"cursorActivity",e))}function Uo(e){Vo(e,Go(e,e.sel,null,!1))}function Go(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=Ko(e,a.anchor,l&&l.anchor,r,n),u=Ko(e,a.head,l&&l.head,r,n);(i||s!=a.anchor||u!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new io(s,u))}return i?oo(e.cm,i,t.primIndex):t}function $o(e,t,r,n,i){var o=qe(e,t.line);if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker,u="selectLeft"in s?!s.selectLeft:s.inclusiveLeft,c="selectRight"in s?!s.selectRight:s.inclusiveRight;if((null==l.from||(u?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(c?l.to>=t.ch:l.to>t.ch))){if(i&&(me(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(r){var f=s.find(n<0?1:-1),d=void 0;if((n<0?c:u)&&(f=Yo(e,f,-n,f&&f.line==t.line?o:null)),f&&f.line==t.line&&(d=ot(f,r))&&(n<0?d<0:d>0))return $o(e,f,t,n,i)}var h=s.find(n<0?-1:1);return(n<0?u:c)&&(h=Yo(e,h,n,h.line==t.line?o:null)),h?$o(e,h,t,n,i):null}}return t}function Ko(e,t,r,n,i){var o=n||1,a=$o(e,t,r,o,i)||!i&&$o(e,t,r,o,!0)||$o(e,t,r,-o,i)||!i&&$o(e,t,r,-o,!0);return a||(e.cantEdit=!0,it(e.first,0))}function Yo(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?ft(e,it(t.line-1)):null:r>0&&t.ch==(n||qe(e,t.line)).text.length?t.line<e.first+e.size-1?it(t.line+1,0):null:new it(t.line,t.ch+r)}function Xo(e){e.setSelection(it(e.firstLine(),0),it(e.lastLine()),V)}function qo(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(t,r,i,o){t&&(n.from=ft(e,t)),r&&(n.to=ft(e,r)),i&&(n.text=i),void 0!==o&&(n.origin=o)}),me(e,"beforeChange",e,n),e.cm&&me(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function Zo(e,t,r){if(e.cm){if(!e.cm.curOp)return Di(e.cm,Zo)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(we(e,"beforeChange")||e.cm&&we(e.cm,"beforeChange"))||(t=qo(e,t,!0),t)){var n=At&&!r&&zt(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)Jo(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else Jo(e,t)}}function Jo(e,t){if(1!=t.text.length||""!=t.text[0]||0!=ot(t.from,t.to)){var r=uo(e,t);Lo(e,t,r,e.cm?e.cm.curOp.id:NaN),ta(e,t,r,Pt(e,t));var n=[];mo(e,(function(e,r){r||-1!=z(n,e.history)||(aa(e.history,t),n.push(e.history)),ta(e,t,null,Pt(e,t))}))}}function Qo(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(!n||r){for(var i,o=e.history,a=e.sel,l="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,u=0;u<l.length;u++)if(i=l[u],r?i.ranges&&!i.equals(e.sel):!i.ranges)break;if(u!=l.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(i=l.pop(),!i.ranges){if(n)return void l.push(i);break}if(Ao(i,s),r&&!i.equals(e.sel))return void Bo(e,i,{clearRedo:!1});a=i}var c=[];Ao(a,s),s.push({changes:c,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var f=we(e,"beforeChange")||e.cm&&we(e.cm,"beforeChange"),d=function(r){var n=i.changes[r];if(n.origin=t,f&&!qo(e,n,!1))return l.length=0,{};c.push(Co(e,n));var o=r?uo(e,n):X(l);ta(e,n,o,Eo(e,n)),!r&&e.cm&&e.cm.scrollIntoView({from:n.from,to:lo(n)});var a=[];mo(e,(function(e,t){t||-1!=z(a,e.history)||(aa(e.history,n),a.push(e.history)),ta(e,n,null,Eo(e,n))}))},h=i.changes.length-1;h>=0;--h){var p=d(h);if(p)return p.v}}}}function ea(e,t){if(0!=t&&(e.first+=t,e.sel=new no(q(e.sel.ranges,(function(e){return new io(it(e.anchor.line+t,e.anchor.ch),it(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){Rn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)In(e.cm,n,"gutter")}}function ta(e,t,r,n){if(e.cm&&!e.cm.curOp)return Di(e.cm,ta)(e,t,r,n);if(t.to.line<e.first)ea(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);ea(e,i),t={from:it(e.first,0),to:it(t.to.line+i,t.to.ch),text:[X(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:it(o,qe(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ze(e,t.from,t.to),r||(r=uo(e,t)),e.cm?ra(e.cm,t,n):vo(e,t,n),jo(e,r,V),e.cantEdit&&Ko(e,it(e.firstLine(),0))&&(e.cantEdit=!1)}}function ra(e,t,r){var n=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line;e.options.lineWrapping||(s=et(Zt(qe(n,o.line))),n.iter(s,a.line+1,(function(e){if(e==i.maxLine)return l=!0,!0}))),n.sel.contains(t.from,t.to)>-1&&be(e),vo(n,t,r,En(e)),e.options.lineWrapping||(n.iter(s,o.line+t.text.length,(function(e){var t=or(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)})),l&&(e.curOp.updateMaxLine=!0)),Tt(n,o.line),Fi(e,400);var u=t.text.length-(a.line-o.line)-1;t.full?Rn(e):o.line!=a.line||1!=t.text.length||go(e.doc,t)?Rn(e,o.line,a.line+1,u):In(e,o.line,"text");var c=we(e,"changes"),f=we(e,"change");if(f||c){var d={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin};f&&Tr(e,"change",e,d),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(d)}e.display.selForContextMenu=null}function na(e,t,r,n,i){var o;n||(n=r),ot(n,r)<0&&(o=[n,r],r=o[0],n=o[1]),"string"==typeof t&&(t=e.splitLines(t)),Zo(e,{from:r,to:n,text:t,origin:i})}function ia(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function oa(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var l=0;l<o.ranges.length;l++)ia(o.ranges[l].anchor,t,r,n),ia(o.ranges[l].head,t,r,n)}else{for(var s=0;s<o.changes.length;++s){var u=o.changes[s];if(r<u.from.line)u.from=it(u.from.line+n,u.from.ch),u.to=it(u.to.line+n,u.to.ch);else if(t<=u.to.line){a=!1;break}}a||(e.splice(0,i+1),i=0)}}}function aa(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;oa(e.done,r,n,i),oa(e.undone,r,n,i)}function la(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=qe(e,ct(e,t)):i=et(t),null==i?null:(n(o,i)&&e.cm&&In(e.cm,i,r),o)}function sa(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}function ua(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}io.prototype.from=function(){return ut(this.anchor,this.head)},io.prototype.to=function(){return st(this.anchor,this.head)},io.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},sa.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var i=this.lines[r];this.height-=i.height,ur(i),Tr(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},ua.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(e<i){var o=Math.min(t,i-e),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof sa))){var l=[];this.collapse(l),this.children=[new sa(l)],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,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(var a=i.lines.length%25+25,l=a;l<i.lines.length;){var s=new sa(i.lines.slice(l,l+=25));i.height-=s.height,this.children.splice(++n,0,s),s.parent=this}i.lines=i.lines.slice(0,a),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new ua(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=z(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new ua(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<o){var a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var ca=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};function fa(e,t,r){ir(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&oi(e,r)}function da(e,t,r,n){var i=new ca(e,r,n),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),la(e,t,"widget",(function(t){var r=t.widgets||(t.widgets=[]);if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!rr(e,t)){var n=ir(t)<e.scrollTop;Qe(t,t.height+Br(i)),n&&oi(o,i.height),o.curOp.forceUpdate=!0}return!0})),o&&Tr(o,"lineWidgetAdded",o,i,"number"==typeof t?t:et(t)),i}ca.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=et(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=Br(this);Qe(r,Math.max(0,r.height-o)),e&&(Ni(e,(function(){fa(e,r,-o),In(e,n,"widget")})),Tr(e,"lineWidgetCleared",e,this,n))}},ca.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=Br(this)-t;i&&(rr(this.doc,n)||Qe(n,n.height+i),r&&Ni(r,(function(){r.curOp.forceUpdate=!0,fa(r,n,i),Tr(r,"lineWidgetChanged",r,e,et(n))})))},xe(ca);var ha=0,pa=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ha};function ga(e,t,r,n,i){if(n&&n.shared)return ma(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return Di(e.cm,ga)(e,t,r,n,i);var o=new pa(e,i),a=ot(t,r);if(n&&I(n,o,!1),a>0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(qt(e,t.line,t,r,o)||t.line!=r.line&&qt(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Dt()}o.addToHistory&&Lo(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var l,s=t.line,u=e.cm;if(e.iter(s,r.line+1,(function(e){u&&o.collapsed&&!u.options.lineWrapping&&Zt(e)==u.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&Qe(e,0),Ht(e,new Et(o,s==t.line?t.ch:null,s==r.line?r.ch:null)),++s})),o.collapsed&&e.iter(t.line,r.line+1,(function(t){rr(e,t)&&Qe(t,0)})),o.clearOnEnter&&pe(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(Nt(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ha,o.atomic=!0),u){if(l&&(u.curOp.updateMaxLine=!0),o.collapsed)Rn(u,t.line,r.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=r.line;c++)In(u,c,"text");o.atomic&&Uo(u.doc),Tr(u,"markerAdded",u,o)}return o}pa.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Ci(e),we(this,"clear")){var r=this.find();r&&Tr(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;o<this.lines.length;++o){var a=this.lines[o],l=Wt(a.markedSpans,this);e&&!this.collapsed?In(e,et(a),"text"):e&&(null!=l.to&&(i=et(a)),null!=l.from&&(n=et(a))),a.markedSpans=Ft(a.markedSpans,l),null==l.from&&this.collapsed&&!rr(this.doc,a)&&e&&Qe(a,An(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var s=0;s<this.lines.length;++s){var u=Zt(this.lines[s]),c=or(u);c>e.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Rn(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Uo(e.doc)),e&&Tr(e,"markerCleared",e,this,n,i),t&&ki(e),this.parent&&this.parent.clear()}},pa.prototype.find=function(e,t){var r,n;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=Wt(o.markedSpans,this);if(null!=a.from&&(r=it(t?o:et(o),a.from),-1==e))return r;if(null!=a.to&&(n=it(t?o:et(o),a.to),1==e))return n}return r&&{from:r,to:n}},pa.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;t&&n&&Ni(n,(function(){var i=t.line,o=et(t.line),a=Qr(n,o);if(a&&(un(a),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!rr(r.doc,i)&&null!=r.height){var l=r.height;r.height=null;var s=Br(r)-l;s&&Qe(i,i.height+s)}Tr(n,"markerChanged",n,e)}))},pa.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=z(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},pa.prototype.detachLine=function(e){if(this.lines.splice(z(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},xe(pa);var va=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};function ma(e,t,r,n,i){n=I(n),n.shared=!1;var o=[ga(e,t,r,n,i)],a=o[0],l=n.widgetNode;return mo(e,(function(e){l&&(n.widgetNode=l.cloneNode(!0)),o.push(ga(e,ft(e,t),ft(e,r),n,i));for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return;a=X(o)})),new va(o,a)}function ya(e){return e.findMarks(it(e.first,0),e.clipPos(it(e.lastLine())),(function(e){return e.parent}))}function ba(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),a=e.clipPos(i.to);if(ot(o,a)){var l=ga(e,o,a,n.primary,n.primary.type);n.markers.push(l),l.parent=n}}}function wa(e){for(var t=function(t){var r=e[t],n=[r.primary.doc];mo(r.primary.doc,(function(e){return n.push(e)}));for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==z(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}},r=0;r<e.length;r++)t(r)}va.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();Tr(this,"clear")}},va.prototype.find=function(e,t){return this.primary.find(e,t)},xe(va);var xa=0,Ca=function(e,t,r,n,i){if(!(this instanceof Ca))return new Ca(e,t,r,n,i);null==r&&(r=0),ua.call(this,[new sa([new lr("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=it(r,0);this.sel=ao(o),this.history=new xo(null),this.id=++xa,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),vo(this,{from:o,to:o,text:e}),Bo(this,ao(o),V)};Ca.prototype=Q(ua.prototype,{constructor:Ca,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Je(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:Wi((function(e){var t=it(this.first,0),r=this.first+this.size-1;Zo(this,{from:t,to:it(r,qe(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&li(this.cm,0,0),Bo(this,ao(t),V)})),replaceRange:function(e,t,r,n){t=ft(this,t),r=r?ft(this,r):t,na(this,e,t,r,n)},getRange:function(e,t,r){var n=Ze(this,ft(this,e),ft(this,t));return!1===r?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(rt(this,e))return qe(this,e)},getLineNumber:function(e){return et(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=qe(this,e)),Zt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ft(this,e)},getCursor:function(e){var t,r=this.sel.primary();return t=null==e||"head"==e?r.head:"anchor"==e?r.anchor:"end"==e||"to"==e||!1===e?r.to():r.from(),t},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Wi((function(e,t,r){Po(this,ft(this,"number"==typeof e?it(e,t||0):e),null,r)})),setSelection:Wi((function(e,t,r){Po(this,ft(this,e),ft(this,t||e),r)})),extendSelection:Wi((function(e,t,r){Ho(this,ft(this,e),t&&ft(this,t),r)})),extendSelections:Wi((function(e,t){Ro(this,ht(this,e),t)})),extendSelectionsBy:Wi((function(e,t){var r=q(this.sel.ranges,e);Ro(this,ht(this,r),t)})),setSelections:Wi((function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new io(ft(this,e[i].anchor),ft(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Bo(this,oo(this.cm,n,t),r)}})),addSelection:Wi((function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new io(ft(this,e),ft(this,t||e))),Bo(this,oo(this.cm,n,n.length-1),r)})),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=Ze(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=Ze(this,r[n].from(),r[n].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Wi((function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o];n[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:r}}for(var l=t&&"end"!=t&&fo(this,n,t),s=n.length-1;s>=0;s--)Zo(this,n[s]);l?zo(this,l):this.cm&&ai(this.cm)})),undo:Wi((function(){Qo(this,"undo")})),redo:Wi((function(){Qo(this,"redo")})),undoSelection:Wi((function(){Qo(this,"undo",!0)})),redoSelection:Wi((function(){Qo(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){var e=this;this.history=new xo(this.history.maxGeneration),mo(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:Wo(this.history.done),undone:Wo(this.history.undone)}},setHistory:function(e){var t=this.history=new xo(this.history.maxGeneration);t.done=Wo(e.done.slice(0),null,!0),t.undone=Wo(e.undone.slice(0),null,!0)},setGutterMarker:Wi((function(e,t,r){return la(this,e,"gutter",(function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&ne(n)&&(e.gutterMarkers=null),!0}))})),clearGutter:Wi((function(e){var t=this;this.iter((function(r){r.gutterMarkers&&r.gutterMarkers[e]&&la(t,r,"gutter",(function(){return r.gutterMarkers[e]=null,ne(r.gutterMarkers)&&(r.gutterMarkers=null),!0}))}))})),lineInfo:function(e){var t;if("number"==typeof e){if(!rt(this,e))return null;if(t=e,e=qe(this,e),!e)return null}else if(t=et(e),null==t)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:Wi((function(e,t,r){return la(this,e,"gutter"==t?"gutter":"class",(function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(S(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0}))})),removeLineClass:Wi((function(e,t,r){return la(this,e,"gutter"==t?"gutter":"class",(function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(S(r));if(!o)return!1;var a=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0}))})),addLineWidget:Wi((function(e,t,r){return da(this,e,t,r)})),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return ga(this,ft(this,e),ft(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=ft(this,e),ga(this,e,e,r,"bookmark")},findMarksAt:function(e){e=ft(this,e);var t=[],r=qe(this,e.line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=ft(this,e),t=ft(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,(function(o){var a=o.markedSpans;if(a)for(var l=0;l<a.length;l++){var s=a[l];null!=s.to&&i==e.line&&e.ch>=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||r&&!r(s.marker)||n.push(s.marker.parent||s.marker)}++i})),n},getAllMarks:function(){var e=[];return this.iter((function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)})),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter((function(i){var o=i.text.length+n;if(o>e)return t=e,!0;e-=o,++r})),ft(this,it(r,t))},indexFromPos:function(e){e=ft(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,(function(e){t+=e.text.length+r})),t},copy:function(e){var t=new Ca(Je(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,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new Ca(Je(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],ba(n,ya(this)),n},unlinkDoc:function(e){if(e instanceof Rl&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){var r=this.linked[t];if(r.doc==e){this.linked.splice(t,1),e.unlinkDoc(this),wa(ya(this));break}}if(e.history==this.history){var n=[e.id];mo(e,(function(e){return n.push(e.id)}),!0),e.history=new xo(null),e.history.done=Wo(this.history.done,n),e.history.undone=Wo(this.history.undone,n)}},iterLinkedDocs:function(e){mo(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):We(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Wi((function(e){"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter((function(e){return e.order=null})),this.cm&&wo(this.cm))}))}),Ca.prototype.eachLine=Ca.prototype.iter;var ka=0;function Sa(e){var t=this;if(Ta(t),!ye(t,e)&&!jr(t.display,e)){Ce(e),a&&(ka=+new Date);var r=Fn(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),l=0,s=function(){++l==i&&Di(t,(function(){r=ft(t.doc,r);var e={from:r,to:r,text:t.doc.splitLines(o.filter((function(e){return null!=e})).join(t.doc.lineSeparator())),origin:"paste"};Zo(t.doc,e),zo(t.doc,ao(ft(t.doc,r),ft(t.doc,lo(e))))}))()},u=function(e,r){if(t.options.allowDropFileTypes&&-1==z(t.options.allowDropFileTypes,e.type))s();else{var n=new FileReader;n.onerror=function(){return s()},n.onload=function(){var e=n.result;/[\x00-\x08\x0e-\x1f]{2}/.test(e)||(o[r]=e),s()},n.readAsText(e)}},c=0;c<n.length;c++)u(n[c],c);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var f=e.dataTransfer.getData("Text");if(f){var d;if(t.state.draggingText&&!t.state.draggingText.copy&&(d=t.listSelections()),jo(t.doc,ao(r,r)),d)for(var h=0;h<d.length;++h)na(t.doc,"",d[h].anchor,d[h].head,"drag");t.replaceSelection(f,"around","paste"),t.display.input.focus()}}catch(e){}}}}function La(e,t){if(a&&(!e.state.draggingText||+new Date-ka<100))Le(t);else if(!ye(e,t)&&!jr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!d)){var r=O("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),f&&r.parentNode.removeChild(r)}}function Ma(e,t){var r=Fn(e,t);if(r){var n=document.createDocumentFragment();Un(e,r,n),e.display.dragCursor||(e.display.dragCursor=O("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),A(e.display.dragCursor,n)}}function Ta(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Aa(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<t.length;n++){var i=t[n].CodeMirror;i&&r.push(i)}r.length&&r[0].operation((function(){for(var t=0;t<r.length;t++)e(r[t])}))}}var Oa=!1;function Na(){Oa||(Da(),Oa=!0)}function Da(){var e;pe(window,"resize",(function(){null==e&&(e=setTimeout((function(){e=null,Aa(Ea)}),100))})),pe(window,"blur",(function(){return Aa(Zn)}))}function Ea(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Wa={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:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Fa=0;Fa<10;Fa++)Wa[Fa+48]=Wa[Fa+96]=String(Fa);for(var Ha=65;Ha<=90;Ha++)Wa[Ha]=String.fromCharCode(Ha);for(var Ra=1;Ra<=12;Ra++)Wa[Ra+111]=Wa[Ra+63235]="F"+Ra;var Ia={};function Pa(e){var t,r,n,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var a=0;a<o.length-1;a++){var l=o[a];if(/^(cmd|meta|m)$/i.test(l))i=!0;else if(/^a(lt)?$/i.test(l))t=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else{if(!/^s(hift)?$/i.test(l))throw new Error("Unrecognized modifier name: "+l);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function _a(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=q(r.split(" "),Pa),o=0;o<i.length;o++){var a=void 0,l=void 0;o==i.length-1?(l=i.join(" "),a=n):(l=i.slice(0,o+1).join(" "),a="...");var s=t[l];if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[r]}for(var u in t)e[u]=t[u];return e}function za(e,t,r,n){t=Ua(t);var i=t.call?t.call(e,n):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return za(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var a=za(e,t.fallthrough[o],r,n);if(a)return a}}}function Ba(e){var t="string"==typeof e?e:Wa[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function ja(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(C?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(C?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function Va(e,t){if(f&&34==e.keyCode&&e["char"])return!1;var r=Wa[e.keyCode];return null!=r&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(r=e.code),ja(r,e,t))}function Ua(e){return"string"==typeof e?Ia[e]:e}function Ga(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){var o=t(r[i]);while(n.length&&ot(o.from,X(n).to)<=0){var a=n.pop();if(ot(a.from,o.from)<0){o.from=a.from;break}}n.push(o)}Ni(e,(function(){for(var t=n.length-1;t>=0;t--)na(e.doc,"",n[t].from,n[t].to,"+delete");ai(e)}))}function $a(e,t,r){var n=ae(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Ka(e,t,r){var n=$a(e,t.ch,r);return null==n?null:new it(t.line,n,r<0?"after":"before")}function Ya(e,t,r,n,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=de(r,t.doc.direction);if(o){var a,l=i<0?X(o):o[0],s=i<0==(1==l.level),u=s?"after":"before";if(l.level>0||"rtl"==t.doc.direction){var c=en(t,r);a=i<0?r.text.length-1:0;var f=tn(t,c,a).top;a=le((function(e){return tn(t,c,e).top==f}),i<0==(1==l.level)?l.from:l.to-1,a),"before"==u&&(a=$a(r,a,1))}else a=i<0?l.to:l.from;return new it(n,a,u)}}return new it(n,i<0?r.text.length:0,i<0?"before":"after")}function Xa(e,t,r,n){var i=de(t,e.doc.direction);if(!i)return Ka(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=ce(i,r.ch,r.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(n>0?a.to>r.ch:a.from<r.ch))return Ka(t,r,n);var l,s=function(e,r){return $a(t,e instanceof it?e.ch:e,r)},u=function(r){return e.options.lineWrapping?(l=l||en(e,t),kn(e,t,l,r)):{begin:0,end:t.text.length}},c=u("before"==r.sticky?s(r,-1):r.ch);if("rtl"==e.doc.direction||1==a.level){var f=1==a.level==n<0,d=s(r,f?1:-1);if(null!=d&&(f?d<=a.to&&d<=c.end:d>=a.from&&d>=c.begin)){var h=f?"before":"after";return new it(r.line,d,h)}}var p=function(e,t,n){for(var o=function(e,t){return t?new it(r.line,s(e,1),"before"):new it(r.line,e,"after")};e>=0&&e<i.length;e+=t){var a=i[e],l=t>0==(1!=a.level),u=l?n.begin:s(n.end,-1);if(a.from<=u&&u<a.to)return o(u,l);if(u=l?a.from:s(a.to,-1),n.begin<=u&&u<n.end)return o(u,l)}},g=p(o+n,n,c);if(g)return g;var v=n>0?c.end:s(c.begin,-1);return null==v||n>0&&v==t.text.length||(g=p(n>0?0:i.length-1,n,u(v)),!g)?null:g}Ia.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"},Ia.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"},Ia.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ia.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"]},Ia["default"]=y?Ia.macDefault:Ia.pcDefault;var qa={selectAll:Xo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),V)},killLine:function(e){return Ga(e,(function(t){if(t.empty()){var r=qe(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:it(t.head.line+1,0)}:{from:t.head,to:it(t.head.line,r)}}return{from:t.from(),to:t.to()}}))},deleteLine:function(e){return Ga(e,(function(t){return{from:it(t.from().line,0),to:ft(e.doc,it(t.to().line+1,0))}}))},delLineLeft:function(e){return Ga(e,(function(e){return{from:it(e.from().line,0),to:e.from()}}))},delWrappedLineLeft:function(e){return Ga(e,(function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return{from:n,to:t.from()}}))},delWrappedLineRight:function(e){return Ga(e,(function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}}))},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(it(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(it(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy((function(t){return Za(e,t.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy((function(t){return Qa(e,t.head)}),{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy((function(t){return Ja(e,t.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")}),G)},goLineLeft:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")}),G)},goLineLeftSmart:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?Qa(e,t.head):n}),G)},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,"char")},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("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),a=P(e.getLine(o.line),o.ch,n);t.push(Y(n-a%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Ni(e,(function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++)if(t[n].empty()){var i=t[n].head,o=qe(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new it(i.line,i.ch-1)),i.ch>0)i=new it(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),it(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=qe(e.doc,i.line-1).text;a&&(i=new it(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),it(i.line-1,a.length-1),i,"+transpose"))}r.push(new io(i,i))}e.setSelections(r)}))},newlineAndIndent:function(e){return Ni(e,(function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);ai(e)}))},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Za(e,t){var r=qe(e.doc,t),n=Zt(r);return n!=r&&(t=et(n)),Ya(!0,e,n,t,1)}function Ja(e,t){var r=qe(e.doc,t),n=Jt(r);return n!=r&&(t=et(n)),Ya(!0,e,r,t,-1)}function Qa(e,t){var r=Za(e,t.line),n=qe(e.doc,r.line),i=de(n,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(r.ch,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch;return it(r.line,a?0:o,r.sticky)}return r}function el(e,t,r){if("string"==typeof t&&(t=qa[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=j}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function tl(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=za(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&za(t,e.options.extraKeys,r,e)||za(t,e.options.keyMap,r,e)}var rl=new _;function nl(e,t,r,n){var i=e.state.keySeq;if(i){if(Ba(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:rl.set(50,(function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())})),il(e,i+" "+t,r,n))return!0}return il(e,t,r,n)}function il(e,t,r,n){var i=tl(e,t,n);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&Tr(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(Ce(r),Kn(e)),!!i}function ol(e,t){var r=Va(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?nl(e,"Shift-"+r,t,(function(t){return el(e,t,!0)}))||nl(e,r,t,(function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return el(e,t)})):nl(e,r,t,(function(t){return el(e,t)})))}function al(e,t,r){return nl(e,"'"+r+"'",t,(function(t){return el(e,t,!0)}))}var ll=null;function sl(e){var t=this;if((!e.target||e.target==t.display.input.getField())&&(t.curOp.focus=E(),!ye(t,e))){a&&l<11&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var i=ol(t,e);f&&(ll=i?n:null,i||88!=n||He||!(y?e.metaKey:e.ctrlKey)||t.replaceSelection("",null,"cut")),r&&!y&&!i&&46==n&&e.shiftKey&&!e.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||ul(t)}}function ul(e){var t=e.display.lineDiv;function r(e){18!=e.keyCode&&e.altKey||(M(t,"CodeMirror-crosshair"),ve(document,"keyup",r),ve(document,"mouseover",r))}W(t,"CodeMirror-crosshair"),pe(document,"keyup",r),pe(document,"mouseover",r)}function cl(e){16==e.keyCode&&(this.doc.sel.shift=!1),ye(this,e)}function fl(e){var t=this;if((!e.target||e.target==t.display.input.getField())&&!(jr(t.display,e)||ye(t,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(f&&r==ll)return ll=null,void Ce(e);if(!f||e.which&&!(e.which<10)||!ol(t,e)){var i=String.fromCharCode(null==n?r:n);"\b"!=i&&(al(t,e,i)||t.display.input.onKeyPress(e))}}}var dl,hl,pl=400,gl=function(e,t,r){this.time=e,this.pos=t,this.button=r};function vl(e,t){var r=+new Date;return hl&&hl.compare(r,e,t)?(dl=hl=null,"triple"):dl&&dl.compare(r,e,t)?(hl=new gl(r,e,t),dl=null,"double"):(dl=new gl(r,e,t),hl=null,"single")}function ml(e){var t=this,r=t.display;if(!(ye(t,e)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=e.shiftKey,jr(r,e))s||(r.scroller.draggable=!1,setTimeout((function(){return r.scroller.draggable=!0}),100));else if(!Ml(t,e)){var n=Fn(t,e),i=Te(e),o=n?vl(n,i):"single";window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),n&&yl(t,i,n,o,e)||(1==i?n?wl(t,n,o,e):Me(e)==r.scroller&&Ce(e):2==i?(n&&Ho(t.doc,n),setTimeout((function(){return r.input.focus()}),20)):3==i&&(k?t.display.input.onContextMenu(e):Xn(t)))}}function yl(e,t,r,n,i){var o="Click";return"double"==n?o="Double"+o:"triple"==n&&(o="Triple"+o),o=(1==t?"Left":2==t?"Middle":"Right")+o,nl(e,ja(o,i),i,(function(t){if("string"==typeof t&&(t=qa[t]),!t)return!1;var n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,r)!=j}finally{e.state.suppressEdits=!1}return n}))}function bl(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(null==i.unit){var o=b?r.shiftKey&&r.metaKey:r.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey),null==i.addNew&&(i.addNew=y?r.metaKey:r.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(y?r.altKey:r.ctrlKey)),i}function wl(e,t,r,n){a?setTimeout(R(Yn,e),0):e.curOp.focus=E();var i,o=bl(e,r,n),l=e.doc.sel;e.options.dragDrop&&Ne&&!e.isReadOnly()&&"single"==r&&(i=l.contains(t))>-1&&(ot((i=l.ranges[i]).from(),t)<0||t.xRel>0)&&(ot(i.to(),t)>0||t.xRel<0)?xl(e,n,t,o):kl(e,n,t,o)}function xl(e,t,r,n){var i=e.display,o=!1,u=Di(e,(function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,ve(i.wrapper.ownerDocument,"mouseup",u),ve(i.wrapper.ownerDocument,"mousemove",c),ve(i.scroller,"dragstart",f),ve(i.scroller,"drop",u),o||(Ce(t),n.addNew||Ho(e.doc,r,null,null,n.extend),s&&!d||a&&9==l?setTimeout((function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()}),20):i.input.focus())})),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},f=function(){return o=!0};s&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),pe(i.wrapper.ownerDocument,"mouseup",u),pe(i.wrapper.ownerDocument,"mousemove",c),pe(i.scroller,"dragstart",f),pe(i.scroller,"drop",u),Xn(e),setTimeout((function(){return i.input.focus()}),20)}function Cl(e,t,r){if("char"==r)return new io(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new io(it(t.line,0),ft(e.doc,it(t.line+1,0)));var n=r(e,t);return new io(n.from,n.to)}function kl(e,t,r,n){var i=e.display,o=e.doc;Ce(t);var a,l,s=o.sel,u=s.ranges;if(n.addNew&&!n.extend?(l=o.sel.contains(r),a=l>-1?u[l]:new io(r,r)):(a=o.sel.primary(),l=o.sel.primIndex),"rectangle"==n.unit)n.addNew||(a=new io(r,r)),r=Fn(e,t,!0,!0),l=-1;else{var c=Cl(e,r,n.unit);a=n.extend?Fo(a,c.anchor,c.head,n.extend):c}n.addNew?-1==l?(l=u.length,Bo(o,oo(e,u.concat([a]),l),{scroll:!1,origin:"*mouse"})):u.length>1&&u[l].empty()&&"char"==n.unit&&!n.extend?(Bo(o,oo(e,u.slice(0,l).concat(u.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):Io(o,l,a,U):(l=0,Bo(o,new no([a],0),U),s=o.sel);var f=r;function d(t){if(0!=ot(f,t))if(f=t,"rectangle"==n.unit){for(var i=[],u=e.options.tabSize,c=P(qe(o,r.line).text,r.ch,u),d=P(qe(o,t.line).text,t.ch,u),h=Math.min(c,d),p=Math.max(c,d),g=Math.min(r.line,t.line),v=Math.min(e.lastLine(),Math.max(r.line,t.line));g<=v;g++){var m=qe(o,g).text,y=$(m,h,u);h==p?i.push(new io(it(g,y),it(g,y))):m.length>y&&i.push(new io(it(g,y),it(g,$(m,p,u))))}i.length||i.push(new io(r,r)),Bo(o,oo(e,s.ranges.slice(0,l).concat(i),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=a,x=Cl(e,t,n.unit),C=w.anchor;ot(x.anchor,C)>0?(b=x.head,C=ut(w.from(),x.anchor)):(b=x.anchor,C=st(w.to(),x.head));var k=s.ranges.slice(0);k[l]=Sl(e,new io(ft(o,C),b)),Bo(o,oo(e,k,l),U)}}var h=i.wrapper.getBoundingClientRect(),p=0;function g(t){var r=++p,a=Fn(e,t,!0,"rectangle"==n.unit);if(a)if(0!=ot(a,f)){e.curOp.focus=E(),d(a);var l=ei(i,o);(a.line>=l.to||a.line<l.from)&&setTimeout(Di(e,(function(){p==r&&g(t)})),150)}else{var s=t.clientY<h.top?-20:t.clientY>h.bottom?20:0;s&&setTimeout(Di(e,(function(){p==r&&(i.scroller.scrollTop+=s,g(t))})),50)}}function v(t){e.state.selectingText=!1,p=1/0,t&&(Ce(t),i.input.focus()),ve(i.wrapper.ownerDocument,"mousemove",m),ve(i.wrapper.ownerDocument,"mouseup",y),o.history.lastSelOrigin=null}var m=Di(e,(function(e){0!==e.buttons&&Te(e)?g(e):v(e)})),y=Di(e,v);e.state.selectingText=y,pe(i.wrapper.ownerDocument,"mousemove",m),pe(i.wrapper.ownerDocument,"mouseup",y)}function Sl(e,t){var r=t.anchor,n=t.head,i=qe(e.doc,r.line);if(0==ot(r,n)&&r.sticky==n.sticky)return t;var o=de(i);if(!o)return t;var a=ce(o,r.ch,r.sticky),l=o[a];if(l.from!=r.ch&&l.to!=r.ch)return t;var s,u=a+(l.from==r.ch==(1!=l.level)?0:1);if(0==u||u==o.length)return t;if(n.line!=r.line)s=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=ce(o,n.ch,n.sticky),f=c-a||(n.ch-r.ch)*(1==l.level?-1:1);s=c==u-1||c==u?f<0:f>0}var d=o[u+(s?-1:0)],h=s==(1==d.level),p=h?d.from:d.to,g=h?"after":"before";return r.ch==p&&r.sticky==g?t:new io(new it(r.line,p,g),n)}function Ll(e,t,r,n){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Ce(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!we(e,r))return Se(t);o-=l.top-a.viewOffset;for(var s=0;s<e.display.gutterSpecs.length;++s){var u=a.gutters.childNodes[s];if(u&&u.getBoundingClientRect().right>=i){var c=tt(e.doc,o),f=e.display.gutterSpecs[s];return me(e,r,e,c,f.className,t),Se(t)}}}function Ml(e,t){return Ll(e,t,"gutterClick",!0)}function Tl(e,t){jr(e.display,t)||Al(e,t)||ye(e,t,"contextmenu")||k||e.display.input.onContextMenu(t)}function Al(e,t){return!!we(e,"gutterContextMenu")&&Ll(e,t,"gutterContextMenu",!1)}function Ol(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),fn(e)}gl.prototype.compare=function(e,t,r){return this.time+pl>e&&0==ot(t,this.pos)&&r==this.button};var Nl={toString:function(){return"CodeMirror.Init"}},Dl={},El={};function Wl(e){var t=e.optionHandlers;function r(r,n,i,o){e.defaults[r]=n,i&&(t[r]=o?function(e,t,r){r!=Nl&&i(e,t,r)}:i)}e.defineOption=r,e.Init=Nl,r("value","",(function(e,t){return e.setValue(t)}),!0),r("mode",null,(function(e,t){e.doc.modeOption=t,ho(e)}),!0),r("indentUnit",2,ho,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,(function(e){po(e),fn(e),Rn(e)}),!0),r("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter((function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,r.push(it(n,o))}n++}));for(var i=r.length-1;i>=0;i--)na(e.doc,t,r[i],it(r[i].line,r[i].ch+t.length))}})),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=Nl&&e.refresh()})),r("specialCharPlaceholder",pr,(function(e){return e.refresh()}),!0),r("electricChars",!0),r("inputStyle",m?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),r("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),r("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),r("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),r("rtlMoveVisually",!w),r("wholeLineUpdateBefore",!0),r("theme","default",(function(e){Ol(e),qi(e)}),!0),r("keyMap","default",(function(e,t,r){var n=Ua(t),i=r!=Nl&&Ua(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)})),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Hl,!0),r("gutters",[],(function(e,t){e.display.gutterSpecs=Yi(t,e.options.lineNumbers),qi(e)}),!0),r("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?Dn(e.display)+"px":"0",e.refresh()}),!0),r("coverGutterNextToScrollbar",!1,(function(e){return mi(e)}),!0),r("scrollbarStyle","native",(function(e){wi(e),mi(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),r("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=Yi(e.options.gutters,t),qi(e)}),!0),r("firstLineNumber",1,qi,!0),r("lineNumberFormatter",(function(e){return e}),qi,!0),r("showCursorWhenSelecting",!1,jn,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,(function(e,t){"nocursor"==t&&(Zn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),r("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),r("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),r("dragDrop",!0,Fl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,jn,!0),r("singleCursorHeightPerLine",!0,jn,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,po,!0),r("addModeClass",!1,po,!0),r("pollInterval",100),r("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),r("historyEventDelay",1250),r("viewportMargin",10,(function(e){return e.refresh()}),!0),r("maxHighlightLength",1e4,po,!0),r("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),r("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),r("autofocus",null),r("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),r("phrases",null)}function Fl(e,t,r){var n=r&&r!=Nl;if(!t!=!n){var i=e.display.dragFunctions,o=t?pe:ve;o(e.display.scroller,"dragstart",i.start),o(e.display.scroller,"dragenter",i.enter),o(e.display.scroller,"dragover",i.over),o(e.display.scroller,"dragleave",i.leave),o(e.display.scroller,"drop",i.drop)}}function Hl(e){e.options.lineWrapping?(W(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(M(e.display.wrapper,"CodeMirror-wrap"),ar(e)),Wn(e),Rn(e),fn(e),setTimeout((function(){return mi(e)}),100)}function Rl(e,t){var r=this;if(!(this instanceof Rl))return new Rl(e,t);this.options=t=t?I(t):{},I(Dl,t,!1);var n=t.value;"string"==typeof n?n=new Ca(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new Rl.inputStyles[t.inputStyle](this),o=this.display=new Zi(e,n,i,t);for(var u in o.wrapper.CodeMirror=this,Ol(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),wi(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 _,keySeq:null,specialChars:null},t.autofocus&&!m&&o.input.focus(),a&&l<11&&setTimeout((function(){return r.display.input.reset(!0)}),20),Il(this),Na(),Ci(this),this.curOp.forceUpdate=!0,yo(this,n),t.autofocus&&!m||this.hasFocus()?setTimeout(R(qn,this),20):Zn(this),El)El.hasOwnProperty(u)&&El[u](this,t[u],Nl);Ki(this),t.finishInit&&t.finishInit(this);for(var c=0;c<Pl.length;++c)Pl[c](this);ki(this),s&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}function Il(e){var t=e.display;pe(t.scroller,"mousedown",Di(e,ml)),pe(t.scroller,"dblclick",a&&l<11?Di(e,(function(t){if(!ye(e,t)){var r=Fn(e,t);if(r&&!Ml(e,t)&&!jr(e.display,t)){Ce(t);var n=e.findWordAt(r);Ho(e.doc,n.anchor,n.head)}}})):function(t){return ye(e,t)||Ce(t)}),pe(t.scroller,"contextmenu",(function(t){return Tl(e,t)})),pe(t.input.getField(),"contextmenu",(function(r){t.scroller.contains(r.target)||Tl(e,r)}));var r,n={end:0};function i(){t.activeTouch&&(r=setTimeout((function(){return t.activeTouch=null}),1e3),n=t.activeTouch,n.end=+new Date)}function o(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function s(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}pe(t.scroller,"touchstart",(function(i){if(!ye(e,i)&&!o(i)&&!Ml(e,i)){t.input.ensurePolled(),clearTimeout(r);var a=+new Date;t.activeTouch={start:a,moved:!1,prev:a-n.end<=300?n:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),pe(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),pe(t.scroller,"touchend",(function(r){var n=t.activeTouch;if(n&&!jr(t,r)&&null!=n.left&&!n.moved&&new Date-n.start<300){var o,a=e.coordsChar(t.activeTouch,"page");o=!n.prev||s(n,n.prev)?new io(a,a):!n.prev.prev||s(n,n.prev.prev)?e.findWordAt(a):new io(it(a.line,0),ft(e.doc,it(a.line+1,0))),e.setSelection(o.anchor,o.head),e.focus(),Ce(r)}i()})),pe(t.scroller,"touchcancel",i),pe(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(fi(e,t.scroller.scrollTop),hi(e,t.scroller.scrollLeft,!0),me(e,"scroll",e))})),pe(t.scroller,"mousewheel",(function(t){return ro(e,t)})),pe(t.scroller,"DOMMouseScroll",(function(t){return ro(e,t)})),pe(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){ye(e,t)||Le(t)},over:function(t){ye(e,t)||(Ma(e,t),Le(t))},start:function(t){return La(e,t)},drop:Di(e,Sa),leave:function(t){ye(e,t)||Ta(e)}};var u=t.input.getField();pe(u,"keyup",(function(t){return cl.call(e,t)})),pe(u,"keydown",Di(e,sl)),pe(u,"keypress",Di(e,fl)),pe(u,"focus",(function(t){return qn(e,t)})),pe(u,"blur",(function(t){return Zn(e,t)}))}Rl.defaults=Dl,Rl.optionHandlers=El;var Pl=[];function _l(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=yt(e,t).state:r="prev");var a=e.options.tabSize,l=qe(o,t),s=P(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var u,c=l.text.match(/^\s*/)[0];if(n||/\S/.test(l.text)){if("smart"==r&&(u=o.mode.indent(i,l.text.slice(c.length),l.text),u==j||u>150)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?P(qe(o,t-1).text,null,a):0:"add"==r?u=s+e.options.indentUnit:"subtract"==r?u=s-e.options.indentUnit:"number"==typeof r&&(u=s+r),u=Math.max(0,u);var f="",d=0;if(e.options.indentWithTabs)for(var h=Math.floor(u/a);h;--h)d+=a,f+="\t";if(d<u&&(f+=Y(u-d)),f!=c)return na(o,f,it(t,0),it(t,c.length),"+input"),l.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<c.length){var v=it(t,c.length);Io(o,p,new io(v,v));break}}}Rl.defineInitHook=function(e){return Pl.push(e)};var zl=null;function Bl(e){zl=e}function jl(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var a=+new Date-200,l="paste"==i||e.state.pasteIncoming>a,s=We(t),u=null;if(l&&n.ranges.length>1)if(zl&&zl.text.join("\n")==t){if(n.ranges.length%zl.text.length==0){u=[];for(var c=0;c<zl.text.length;c++)u.push(o.splitLines(zl.text[c]))}}else s.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(u=q(s,(function(e){return[e]})));for(var f=e.curOp.updateInput,d=n.ranges.length-1;d>=0;d--){var h=n.ranges[d],p=h.from(),g=h.to();h.empty()&&(r&&r>0?p=it(p.line,p.ch-r):e.state.overwrite&&!l?g=it(g.line,Math.min(qe(o,g.line).text.length,g.ch+X(s).length)):l&&zl&&zl.lineWise&&zl.text.join("\n")==t&&(p=g=it(p.line,0)));var v={from:p,to:g,text:u?u[d%u.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")};Zo(e.doc,v),Tr(e,"inputRead",e,v)}t&&!l&&Ul(e,t),ai(e),e.curOp.updateInput<2&&(e.curOp.updateInput=f),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Vl(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Ni(t,(function(){return jl(t,r,0,null,"paste")})),!0}function Ul(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){a=_l(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(qe(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=_l(e,i.head.line,"smart"));a&&Tr(e,"electricInput",e,i.head.line)}}}function Gl(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:it(i,0),head:it(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function $l(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function Kl(){var e=O("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=O("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return s?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),$l(e),t}function Yl(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,r){var n=this.options,i=n[e];n[e]==r&&"mode"!=e||(n[e]=r,t.hasOwnProperty(e)&&Di(this,t[e])(this,r,i),me(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Ua(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:Ei((function(t,r){var n=t.token?t:e.getMode(this.options,t);if(n.startState)throw new Error("Overlays may not be stateful.");Z(this.state.overlays,{mode:n,modeSpec:t,opaque:r&&r.opaque,priority:r&&r.priority||0},(function(e){return e.priority})),this.state.modeGen++,Rn(this)})),removeOverlay:Ei((function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void Rn(this)}})),indentLine:Ei((function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),rt(this.doc,e)&&_l(this,e,t,r)})),indentSelection:Ei((function(e){for(var t=this.doc.sel.ranges,r=-1,n=0;n<t.length;n++){var i=t[n];if(i.empty())i.head.line>r&&(_l(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&ai(this));else{var o=i.from(),a=i.to(),l=Math.max(r,o.line);r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;s<r;++s)_l(this,s,e);var u=this.doc.sel.ranges;0==o.ch&&t.length==u.length&&u[n].from().ch>0&&Io(this.doc,n,new io(o,u[n].to()),V)}}})),getTokenAt:function(e,t){return kt(this,e,t)},getLineTokens:function(e,t){return kt(this,it(e),t,!0)},getTokenTypeAt:function(e){e=ft(this.doc,e);var t,r=mt(this,qe(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var a=n+i>>1;if((a?r[2*a-1]:0)>=o)i=a;else{if(!(r[2*a+1]<o)){t=r[2*a+2];break}n=a+1}}var l=t?t.indexOf("overlay "):-1;return l<0?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!r.hasOwnProperty(t))return n;var i=r[t],o=this.getModeAt(e);if("string"==typeof o[t])i[o[t]]&&n.push(i[o[t]]);else if(o[t])for(var a=0;a<o[t].length;a++){var l=i[o[t][a]];l&&n.push(l)}else o.helperType&&i[o.helperType]?n.push(i[o.helperType]):i[o.name]&&n.push(i[o.name]);for(var s=0;s<i._global.length;s++){var u=i._global[s];u.pred(o,this)&&-1==z(n,u.val)&&n.push(u.val)}return n},getStateAfter:function(e,t){var r=this.doc;return e=ct(r,null==e?r.first+r.size-1:e),yt(this,e+1,t).state},cursorCoords:function(e,t){var r,n=this.doc.sel.primary();return r=null==e?n.head:"object"==typeof e?ft(this.doc,e):e?n.from():n.to(),yn(this,r,t||"page")},charCoords:function(e,t){return mn(this,ft(this.doc,e),t||"page")},coordsChar:function(e,t){return e=vn(this,e,t||"page"),xn(this,e.left,e.top)},lineAtHeight:function(e,t){return e=vn(this,{top:e,left:0},t||"page").top,tt(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),n=qe(this.doc,e)}else n=e;return gn(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-ir(n):0)},defaultTextHeight:function(){return An(this.display)},defaultCharWidth:function(){return On(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=yn(this,ft(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var s=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>u&&(l=u-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),r&&ni(this,{left:l,top:a,right:l+t.offsetWidth,bottom:a+t.offsetHeight})},triggerOnKeyDown:Ei(sl),triggerOnKeyPress:Ei(fl),triggerOnKeyUp:cl,triggerOnMouseDown:Ei(ml),execCommand:function(e){if(qa.hasOwnProperty(e))return qa[e].call(null,this)},triggerElectric:Ei((function(e){Ul(this,e)})),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=ft(this.doc,e),a=0;a<t;++a)if(o=Xl(this.doc,o,i,r,n),o.hitSide)break;return o},moveH:Ei((function(e,t){var r=this;this.extendSelectionsBy((function(n){return r.display.shift||r.doc.extend||n.empty()?Xl(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()}),G)})),deleteH:Ei((function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Ga(this,(function(r){var i=Xl(n,r.head,e,t,!1);return e<0?{from:i,to:r.head}:{from:r.head,to:i}}))})),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var a=ft(this.doc,e),l=0;l<t;++l){var s=yn(this,a,"div");if(null==o?o=s.left:s.left=o,a=ql(this,s,i,r),a.hitSide)break}return a},moveV:Ei((function(e,t){var r=this,n=this.doc,i=[],o=!this.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy((function(a){if(o)return e<0?a.from():a.to();var l=yn(r,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=ql(r,l,e,t);return"page"==t&&a==n.sel.primary()&&oi(r,mn(r,s,"div").top-l.top),s}),G),i.length)for(var a=0;a<n.sel.ranges.length;a++)n.sel.ranges[a].goalColumn=i[a]})),findWordAt:function(e){var t=this.doc,r=qe(t,e.line).text,n=e.ch,i=e.ch;if(r){var o=this.getHelper(e,"wordChars");"before"!=e.sticky&&i!=r.length||!n?++i:--n;var a=r.charAt(n),l=re(a,o)?function(e){return re(e,o)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!re(e)};while(n>0&&l(r.charAt(n-1)))--n;while(i<r.length&&l(r.charAt(i)))++i}return new io(it(e.line,n),it(e.line,i))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?W(this.display.cursorDiv,"CodeMirror-overwrite"):M(this.display.cursorDiv,"CodeMirror-overwrite"),me(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==E()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Ei((function(e,t){li(this,e,t)})),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-$r(this)-this.display.barHeight,width:e.scrollWidth-$r(this)-this.display.barWidth,clientHeight:Yr(this),clientWidth:Kr(this)}},scrollIntoView:Ei((function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:it(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?si(this,e):ci(this,e.from,e.to,e.margin)})),setSize:Ei((function(e,t){var r=this,n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&cn(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,(function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){In(r,i,"widget");break}++i})),this.curOp.forceUpdate=!0,me(this,"refresh",this)})),operation:function(e){return Ni(this,e)},startOperation:function(){return Ci(this)},endOperation:function(){return ki(this)},refresh:Ei((function(){var e=this.display.cachedTextHeight;Rn(this),this.curOp.forceUpdate=!0,fn(this),li(this,this.doc.scrollLeft,this.doc.scrollTop),Ui(this.display),(null==e||Math.abs(e-An(this.display))>.5||this.options.lineWrapping)&&Wn(this),me(this,"refresh",this)})),swapDoc:Ei((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),yo(this,e),fn(this),this.display.input.reset(),li(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Tr(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},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}},xe(e),e.registerHelper=function(t,n,i){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]}),r[t][n]=i},e.registerGlobalHelper=function(t,n,i,o){e.registerHelper(t,n,o),r[t]._global.push({pred:i,val:o})}}function Xl(e,t,r,n,i){var o=t,a=r,l=qe(e,t.line),s=i&&"rtl"==e.direction?-r:r;function u(){var r=t.line+s;return!(r<e.first||r>=e.first+e.size)&&(t=new it(r,t.ch,t.sticky),l=qe(e,r))}function c(n){var o;if(o=i?Xa(e.cm,l,t,r):Ka(l,t,r),null==o){if(n||!u())return!1;t=Ya(i,e.cm,l,t.line,s)}else t=o;return!0}if("char"==n)c();else if("column"==n)c(!0);else if("word"==n||"group"==n)for(var f=null,d="group"==n,h=e.cm&&e.cm.getHelper(t,"wordChars"),p=!0;;p=!1){if(r<0&&!c(!p))break;var g=l.text.charAt(t.ch)||"\n",v=re(g,h)?"w":d&&"\n"==g?"n":!d||/\s/.test(g)?null:"p";if(!d||p||v||(v="s"),f&&f!=v){r<0&&(r=1,c(),t.sticky="after");break}if(v&&(f=v),r>0&&!c(!p))break}var m=Ko(e,t,o,a,!0);return at(o,m)&&(m.hitSide=!0),m}function ql(e,t,r,n){var i,o,a=e.doc,l=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(s-.5*An(e.display),3);i=(r>0?t.bottom:t.top)+r*u}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){if(o=xn(e,l,i),!o.outside)break;if(r<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*r}return o}var Zl=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new _,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Jl(e,t){var r=Qr(e,t.line);if(!r||r.hidden)return null;var n=qe(e.doc,t.line),i=qr(r,n,t.line),o=de(n,e.doc.direction),a="left";if(o){var l=ce(o,t.ch);a=l%2?"right":"left"}var s=on(i.map,t.ch,a);return s.offset="right"==s.collapse?s.end:s.start,s}function Ql(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function es(e,t){return t&&(e.bad=!0),e}function ts(e,t,r,n,i){var o="",a=!1,l=e.doc.lineSeparator(),s=!1;function u(e){return function(t){return t.id==e}}function c(){a&&(o+=l,s&&(o+=l),a=s=!1)}function f(e){e&&(c(),o+=e)}function d(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(r)return void f(r);var o,h=t.getAttribute("cm-marker");if(h){var p=e.findMarks(it(n,0),it(i+1,0),u(+h));return void(p.length&&(o=p[0].find(0))&&f(Ze(e.doc,o.from,o.to).join(l)))}if("false"==t.getAttribute("contenteditable"))return;var g=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;g&&c();for(var v=0;v<t.childNodes.length;v++)d(t.childNodes[v]);/^(pre|p)$/i.test(t.nodeName)&&(s=!0),g&&(a=!0)}else 3==t.nodeType&&f(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;;){if(d(t),t==r)break;t=t.nextSibling,s=!1}return o}function rs(e,t,r){var n;if(t==e.display.lineDiv){if(n=e.display.lineDiv.childNodes[r],!n)return es(e.clipPos(it(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return ns(o,t,r)}}function ns(e,t,r){var n=e.text.firstChild,i=!1;if(!t||!D(n,t))return es(it(et(e.line),0),!0);if(t==n&&(i=!0,t=n.childNodes[r],r=0,!t)){var o=e.rest?X(e.rest):e.line;return es(it(et(o),o.text.length),i)}var a=3==t.nodeType?t:null,l=t;a||1!=t.childNodes.length||3!=t.firstChild.nodeType||(a=t.firstChild,r&&(r=a.nodeValue.length));while(l.parentNode!=n)l=l.parentNode;var s=e.measure,u=s.maps;function c(t,r,n){for(var i=-1;i<(u?u.length:0);i++)for(var o=i<0?s.map:u[i],a=0;a<o.length;a+=3){var l=o[a+2];if(l==t||l==r){var c=et(i<0?e.line:e.rest[i]),f=o[a]+n;return(n<0||l!=t)&&(f=o[a+(n?1:0)]),it(c,f)}}}var f=c(a,l,r);if(f)return es(f,i);for(var d=l.nextSibling,h=a?a.nodeValue.length-r:0;d;d=d.nextSibling){if(f=c(d,d.firstChild,0),f)return es(it(f.line,f.ch-h),i);h+=d.textContent.length}for(var p=l.previousSibling,g=r;p;p=p.previousSibling){if(f=c(p,p.firstChild,-1),f)return es(it(f.line,f.ch+g),i);g+=p.textContent.length}}Zl.prototype.init=function(e){var t=this,r=this,n=r.cm,i=r.div=e.lineDiv;function o(e){for(var t=e.target;t;t=t.parentNode){if(t==i)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(t.className))break}return!1}function a(e){if(o(e)&&!ye(n,e)){if(n.somethingSelected())Bl({lineWise:!1,text:n.getSelections()}),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=Gl(n);Bl({lineWise:!0,text:t.text}),"cut"==e.type&&n.operation((function(){n.setSelections(t.ranges,0,V),n.replaceSelection("",null,"cut")}))}if(e.clipboardData){e.clipboardData.clearData();var a=zl.text.join("\n");if(e.clipboardData.setData("Text",a),e.clipboardData.getData("Text")==a)return void e.preventDefault()}var l=Kl(),s=l.firstChild;n.display.lineSpace.insertBefore(l,n.display.lineSpace.firstChild),s.value=zl.text.join("\n");var u=document.activeElement;H(s),setTimeout((function(){n.display.lineSpace.removeChild(l),u.focus(),u==i&&r.showPrimarySelection()}),50)}}$l(i,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize),pe(i,"paste",(function(e){!o(e)||ye(n,e)||Vl(e,n)||l<=11&&setTimeout(Di(n,(function(){return t.updateFromDOM()})),20)})),pe(i,"compositionstart",(function(e){t.composing={data:e.data,done:!1}})),pe(i,"compositionupdate",(function(e){t.composing||(t.composing={data:e.data,done:!1})})),pe(i,"compositionend",(function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)})),pe(i,"touchstart",(function(){return r.forceCompositionEnd()})),pe(i,"input",(function(){t.composing||t.readFromDOMSoon()})),pe(i,"copy",a),pe(i,"cut",a)},Zl.prototype.screenReaderLabelChanged=function(e){e?this.div.setAttribute("aria-label",e):this.div.removeAttribute("aria-label")},Zl.prototype.prepareSelection=function(){var e=Vn(this.cm,!1);return e.focus=document.activeElement==this.div,e},Zl.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Zl.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Zl.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges();else{var a=rs(t,e.anchorNode,e.anchorOffset),l=rs(t,e.focusNode,e.focusOffset);if(!a||a.bad||!l||l.bad||0!=ot(ut(a,l),i)||0!=ot(st(a,l),o)){var s=t.display.view,u=i.line>=t.display.viewFrom&&Jl(t,i)||{node:s[0].measure.map[2],offset:0},c=o.line<t.display.viewTo&&Jl(t,o);if(!c){var f=s[s.length-1].measure,d=f.maps?f.maps[f.maps.length-1]:f.map;c={node:d[d.length-1],offset:d[d.length-2]-d[d.length-3]}}if(u&&c){var h,p=e.rangeCount&&e.getRangeAt(0);try{h=L(u.node,u.offset,c.offset,c.node)}catch(g){}h&&(!r&&t.state.focused?(e.collapse(u.node,u.offset),h.collapsed||(e.removeAllRanges(),e.addRange(h))):(e.removeAllRanges(),e.addRange(h)),p&&null==e.anchorNode?e.addRange(p):r&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Zl.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)},Zl.prototype.showMultipleSelections=function(e){A(this.cm.display.cursorDiv,e.cursors),A(this.cm.display.selectionDiv,e.selection)},Zl.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Zl.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},Zl.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&document.activeElement==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Zl.prototype.blur=function(){this.div.blur()},Zl.prototype.getField=function(){return this.div},Zl.prototype.supportsTouch=function(){return!0},Zl.prototype.receivedFocus=function(){var e=this;function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}this.selectionInEditor()?this.pollSelection():Ni(this.cm,(function(){return e.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,t)},Zl.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Zl.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(v&&c&&this.cm.display.gutterSpecs.length&&Ql(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=rs(t,e.anchorNode,e.anchorOffset),n=rs(t,e.focusNode,e.focusOffset);r&&n&&Ni(t,(function(){Bo(t.doc,ao(r,n),V),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)}))}}},Zl.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,r,n=this.cm,i=n.display,o=n.doc.sel.primary(),a=o.from(),l=o.to();if(0==a.ch&&a.line>n.firstLine()&&(a=it(a.line-1,qe(n.doc,a.line-1).length)),l.ch==qe(n.doc,l.line).text.length&&l.line<n.lastLine()&&(l=it(l.line+1,0)),a.line<i.viewFrom||l.line>i.viewTo-1)return!1;a.line==i.viewFrom||0==(e=Hn(n,a.line))?(t=et(i.view[0].line),r=i.view[0].node):(t=et(i.view[e].line),r=i.view[e-1].node.nextSibling);var s,u,c=Hn(n,l.line);if(c==i.view.length-1?(s=i.viewTo-1,u=i.lineDiv.lastChild):(s=et(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!r)return!1;var f=n.doc.splitLines(ts(n,r,u,t,s)),d=Ze(n.doc,it(t,0),it(s,qe(n.doc,s).text.length));while(f.length>1&&d.length>1)if(X(f)==X(d))f.pop(),d.pop(),s--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),t++}var h=0,p=0,g=f[0],v=d[0],m=Math.min(g.length,v.length);while(h<m&&g.charCodeAt(h)==v.charCodeAt(h))++h;var y=X(f),b=X(d),w=Math.min(y.length-(1==f.length?h:0),b.length-(1==d.length?h:0));while(p<w&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1))++p;if(1==f.length&&1==d.length&&t==a.line)while(h&&h>a.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1))h--,p++;f[f.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),f[0]=f[0].slice(h).replace(/\u200b+$/,"");var x=it(t,h),C=it(s,d.length?X(d).length-p:0);return f.length>1||f[0]||ot(x,C)?(na(n.doc,f,x,C,"+input"),!0):void 0},Zl.prototype.ensurePolled=function(){this.forceCompositionEnd()},Zl.prototype.reset=function(){this.forceCompositionEnd()},Zl.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Zl.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},Zl.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Ni(this.cm,(function(){return Rn(e.cm)}))},Zl.prototype.setUneditable=function(e){e.contentEditable="false"},Zl.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Di(this.cm,jl)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Zl.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Zl.prototype.onContextMenu=function(){},Zl.prototype.resetPosition=function(){},Zl.prototype.needsContentAttribute=!0;var is=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new _,this.hasSelection=!1,this.composing=null};function os(e,t){if(t=t?I(t):{},t.value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var r=E();t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function n(){e.value=l.getValue()}var i;if(e.form&&(pe(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=a}}catch(s){}}t.finishInit=function(r){r.save=n,r.getTextArea=function(){return e},r.toTextArea=function(){r.toTextArea=isNaN,n(),e.parentNode.removeChild(r.getWrapperElement()),e.style.display="",e.form&&(ve(e.form,"submit",n),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var l=Rl((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return l}function as(e){e.off=ve,e.on=pe,e.wheelEventPixels=to,e.Doc=Ca,e.splitLines=We,e.countColumn=P,e.findColumn=$,e.isWordChar=te,e.Pass=j,e.signal=me,e.Line=lr,e.changeEnd=lo,e.scrollbarModel=bi,e.Pos=it,e.cmpPos=ot,e.modes=Pe,e.mimeModes=_e,e.resolveMode=je,e.getMode=Ve,e.modeExtensions=Ue,e.extendMode=Ge,e.copyState=$e,e.startState=Ye,e.innerMode=Ke,e.commands=qa,e.keyMap=Ia,e.keyName=Va,e.isModifierKey=Ba,e.lookupKey=za,e.normalizeKeyMap=_a,e.StringStream=Xe,e.SharedTextMarker=va,e.TextMarker=pa,e.LineWidget=ca,e.e_preventDefault=Ce,e.e_stopPropagation=ke,e.e_stop=Le,e.addClass=W,e.contains=D,e.rmClass=M,e.keyNames=Wa}is.prototype.init=function(e){var t=this,r=this,n=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!ye(n,e)){if(n.somethingSelected())Bl({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Gl(n);Bl({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,V):(r.prevInput="",i.value=t.text.join("\n"),H(i))}"cut"==e.type&&(n.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(i.style.width="0px"),pe(i,"input",(function(){a&&l>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()})),pe(i,"paste",(function(e){ye(n,e)||Vl(e,n)||(n.state.pasteIncoming=+new Date,r.fastPoll())})),pe(i,"cut",o),pe(i,"copy",o),pe(e.scroller,"paste",(function(t){if(!jr(e,t)&&!ye(n,t)){if(!i.dispatchEvent)return n.state.pasteIncoming=+new Date,void r.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),pe(e.lineSpace,"selectstart",(function(t){jr(e,t)||Ce(t)})),pe(i,"compositionstart",(function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}})),pe(i,"compositionend",(function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)}))},is.prototype.createField=function(e){this.wrapper=Kl(),this.textarea=this.wrapper.firstChild},is.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},is.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=Vn(e);if(e.options.moveInputWithCursor){var i=yn(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n},is.prototype.showSelection=function(e){var t=this.cm,r=t.display;A(r.cursorDiv,e.cursors),A(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},is.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&H(this.textarea),a&&l>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",a&&l>=9&&(this.hasSelection=null))}},is.prototype.getField=function(){return this.textarea},is.prototype.supportsTouch=function(){return!1},is.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!m||E()!=this.textarea))try{this.textarea.focus()}catch(e){}},is.prototype.blur=function(){this.textarea.blur()},is.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},is.prototype.receivedFocus=function(){this.slowPoll()},is.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},is.prototype.fastPoll=function(){var e=!1,t=this;function r(){var n=t.poll();n||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))}t.pollingFast=!0,t.polling.set(20,r)},is.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||Fe(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(a&&l>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||n||(n="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}var s=0,u=Math.min(n.length,i.length);while(s<u&&n.charCodeAt(s)==i.charCodeAt(s))++s;return Ni(t,(function(){jl(t,i.slice(s),n.length-s,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?r.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},is.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},is.prototype.onKeyPress=function(){a&&l>=9&&(this.hasSelection=null),this.fastPoll()},is.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=Fn(r,e),u=n.scroller.scrollTop;if(o&&!f){var c=r.options.resetSelectionOnContextMenu;c&&-1==r.doc.sel.contains(o)&&Di(r,Bo)(r.doc,ao(o),V);var d,h=i.style.cssText,p=t.wrapper.style.cssText,g=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(e.clientY-g.top-5)+"px; left: "+(e.clientX-g.left-5)+"px;\n      z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(d=window.scrollY),n.input.focus(),s&&window.scrollTo(null,d),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=y,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),a&&l>=9&&m(),k){Le(e);var v=function(){ve(window,"mouseup",v),setTimeout(y,20)};pe(window,"mouseup",v)}else setTimeout(y,50)}function m(){if(null!=i.selectionStart){var e=r.somethingSelected(),o="​"+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"​",i.selectionStart=1,i.selectionEnd=o.length,n.selForContextMenu=r.doc.sel}}function y(){if(t.contextMenuPending==y&&(t.contextMenuPending=!1,t.wrapper.style.cssText=p,i.style.cssText=h,a&&l<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=u),null!=i.selectionStart)){(!a||a&&l<9)&&m();var e=0,o=function(){n.selForContextMenu==r.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==t.prevInput?Di(r,Xo)(r):e++<10?n.detectingSelectAll=setTimeout(o,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(o,200)}}},is.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},is.prototype.setUneditable=function(){},is.prototype.needsContentAttribute=!1,Wl(Rl),Yl(Rl);var ls="iter insert remove copy getEditor constructor".split(" ");for(var ss in Ca.prototype)Ca.prototype.hasOwnProperty(ss)&&z(ls,ss)<0&&(Rl.prototype[ss]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ca.prototype[ss]));return xe(Ca),Rl.inputStyles={textarea:is,contenteditable:Zl},Rl.defineMode=function(e){Rl.defaults.mode||"null"==e||(Rl.defaults.mode=e),ze.apply(this,arguments)},Rl.defineMIME=Be,Rl.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),Rl.defineMIME("text/plain","null"),Rl.defineExtension=function(e,t){Rl.prototype[e]=t},Rl.defineDocExtension=function(e,t){Ca.prototype[e]=t},Rl.fromTextArea=os,as(Rl),Rl.version="5.54.0",Rl}))},"612b":function(e,t,r){},7156:function(e,t,r){var n=r("861d"),i=r("d2bb");e.exports=function(e,t,r){var o,a;return i&&"function"==typeof(o=t.constructor)&&o!==r&&n(a=o.prototype)&&a!==r.prototype&&i(e,a),e}},"84f5":function(e,t,r){"use strict";var n=r("362a"),i=r.n(n);i.a},"8c2e":function(e,t,r){},"8f94":function(e,t,r){!function(t,n){e.exports=n(r("56b3"))}(0,(function(e){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=3)}([function(t,r){t.exports=e},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),i=function(e){return e&&e.__esModule?e:{default:e}}(n),o=window.CodeMirror||i.default;"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var r=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])}return r},writable:!0,configurable:!0}),t.default={name:"codemirror",data:function(){return{content:"",codemirror:null,cminstance:null}},props:{code:String,value:String,marker:Function,unseenLines:Array,name:{type:String,default:"codemirror"},placeholder:{type:String,default:""},merge:{type:Boolean,default:!1},options:{type:Object,default:function(){return{}}},events:{type:Array,default:function(){return[]}},globalOptions:{type:Object,default:function(){return{}}},globalEvents:{type:Array,default:function(){return[]}}},watch:{options:{deep:!0,handler:function(e){for(var t in e)this.cminstance.setOption(t,e[t])}},merge:function(){this.$nextTick(this.switchMerge)},code:function(e){this.handerCodeChange(e)},value:function(e){this.handerCodeChange(e)}},methods:{initialize:function(){var e=this,t=Object.assign({},this.globalOptions,this.options);this.merge?(this.codemirror=o.MergeView(this.$refs.mergeview,t),this.cminstance=this.codemirror.edit):(this.codemirror=o.fromTextArea(this.$refs.textarea,t),this.cminstance=this.codemirror,this.cminstance.setValue(this.code||this.value||this.content)),this.cminstance.on("change",(function(t){e.content=t.getValue(),e.$emit&&e.$emit("input",e.content)}));var r={};["scroll","changes","beforeChange","cursorActivity","keyHandled","inputRead","electricInput","beforeSelectionChange","viewportChange","swapDoc","gutterClick","gutterContextMenu","focus","blur","refresh","optionChange","scrollCursorIntoView","update"].concat(this.events).concat(this.globalEvents).filter((function(e){return!r[e]&&(r[e]=!0)})).forEach((function(t){e.cminstance.on(t,(function(){for(var r=arguments.length,n=Array(r),i=0;i<r;i++)n[i]=arguments[i];e.$emit.apply(e,[t].concat(n));var o=t.replace(/([A-Z])/g,"-$1").toLowerCase();o!==t&&e.$emit.apply(e,[o].concat(n))}))})),this.$emit("ready",this.codemirror),this.unseenLineMarkers(),this.refresh()},refresh:function(){var e=this;this.$nextTick((function(){e.cminstance.refresh()}))},destroy:function(){var e=this.cminstance.doc.cm.getWrapperElement();e&&e.remove&&e.remove()},handerCodeChange:function(e){if(e!==this.cminstance.getValue()){var t=this.cminstance.getScrollInfo();this.cminstance.setValue(e),this.content=e,this.cminstance.scrollTo(t.left,t.top)}this.unseenLineMarkers()},unseenLineMarkers:function(){var e=this;void 0!==this.unseenLines&&void 0!==this.marker&&this.unseenLines.forEach((function(t){var r=e.cminstance.lineInfo(t);e.cminstance.setGutterMarker(t,"breakpoints",r.gutterMarkers?null:e.marker())}))},switchMerge:function(){var e=this.cminstance.doc.history,t=this.cminstance.doc.cleanGeneration;this.options.value=this.cminstance.getValue(),this.destroy(),this.initialize(),this.cminstance.doc.history=e,this.cminstance.doc.cleanGeneration=t}},mounted:function(){this.initialize()},beforeDestroy:function(){this.destroy()}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),i=r.n(n);for(var o in n)["default","default"].indexOf(o)<0&&function(e){r.d(t,e,(function(){return n[e]}))}(o);var a=r(5),l=r(4),s=l(i.a,a.a,!1,null,null,null);t.default=s.exports},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.install=t.codemirror=t.CodeMirror=void 0;var i=r(0),o=n(i),a=r(2),l=n(a),s=window.CodeMirror||o.default,u=function(e,t){t&&(t.options&&(l.default.props.globalOptions.default=function(){return t.options}),t.events&&(l.default.props.globalEvents.default=function(){return t.events})),e.component(l.default.name,l.default)},c={CodeMirror:s,codemirror:l.default,install:u};t.default=c,t.CodeMirror=s,t.codemirror=l.default,t.install=u},function(e,t){e.exports=function(e,t,r,n,i,o){var a,l=e=e||{},s=typeof e.default;"object"!==s&&"function"!==s||(a=e,l=e.default);var u,c="function"==typeof l?l.options:l;if(t&&(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0),r&&(c.functional=!0),i&&(c._scopeId=i),o?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),n&&n.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},c._ssrRegister=u):n&&(u=n),u){var f=c.functional,d=f?c.render:c.beforeCreate;f?(c._injectStyles=u,c.render=function(e,t){return u.call(t),d(e,t)}):c.beforeCreate=d?[].concat(d,u):[u]}return{esModule:a,exports:l,options:c}}},function(e,t,r){"use strict";var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"vue-codemirror",class:{merge:e.merge}},[e.merge?r("div",{ref:"mergeview"}):r("textarea",{ref:"textarea",attrs:{name:e.name,placeholder:e.placeholder}})])},i=[],o={render:n,staticRenderFns:i};t.a=o}])}))},a34b:function(e,t,r){"use strict";var n=r("612b"),i=r.n(n);i.a},a7be:function(e,t,r){},b680:function(e,t,r){"use strict";var n=r("23e7"),i=r("a691"),o=r("408a"),a=r("1148"),l=r("d039"),s=1..toFixed,u=Math.floor,c=function(e,t,r){return 0===t?r:t%2===1?c(e,t-1,r*e):c(e*e,t/2,r)},f=function(e){var t=0,r=e;while(r>=4096)t+=12,r/=4096;while(r>=2)t+=1,r/=2;return t},d=s&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!l((function(){s.call({})}));n({target:"Number",proto:!0,forced:d},{toFixed:function(e){var t,r,n,l,s=o(this),d=i(e),h=[0,0,0,0,0,0],p="",g="0",v=function(e,t){var r=-1,n=t;while(++r<6)n+=e*h[r],h[r]=n%1e7,n=u(n/1e7)},m=function(e){var t=6,r=0;while(--t>=0)r+=h[t],h[t]=u(r/e),r=r%e*1e7},y=function(){var e=6,t="";while(--e>=0)if(""!==t||0===e||0!==h[e]){var r=String(h[e]);t=""===t?r:t+a.call("0",7-r.length)+r}return t};if(d<0||d>20)throw RangeError("Incorrect fraction digits");if(s!=s)return"NaN";if(s<=-1e21||s>=1e21)return String(s);if(s<0&&(p="-",s=-s),s>1e-21)if(t=f(s*c(2,69,1))-69,r=t<0?s*c(2,-t,1):s/c(2,t,1),r*=4503599627370496,t=52-t,t>0){v(0,r),n=d;while(n>=7)v(1e7,0),n-=7;v(c(10,n,1),0),n=t-1;while(n>=23)m(1<<23),n-=23;m(1<<n),v(1,1),m(2),g=y()}else v(0,r),v(1<<-t,0),g=y()+a.call("0",d);return d>0?(l=g.length,g=p+(l<=d?"0."+a.call("0",d-l)+g:g.slice(0,l-d)+"."+g.slice(l-d))):g=p+g,g}})},c556:function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"content g2-content"},[!e.ismd||e.isEdit||e.loaded?r("codemirror",{directives:[{name:"show",rawName:"v-show",value:!e.ismd||e.isEdit,expression:"!ismd || isEdit"}],attrs:{options:e.options},model:{value:e.content,callback:function(t){e.content=t},expression:"content"}}):e._e(),e.ismd?r("markdown",{directives:[{name:"show",rawName:"v-show",value:!e.isEdit,expression:"!isEdit"}],attrs:{source:e.content}}):e._e(),e.ismd?r("a",{staticClass:"g2-content-edit is-hidden-mobile",on:{click:e.edit}},[r("i",{class:"fa"+(e.isEdit?" fa-eye":" fa-pencil-square-o"),attrs:{"aria-hidden":"true"}})]):e._e()],1)},i=[],o=(r("ac1f"),r("466d"),r("96cf"),r("1da1")),a=r("5530"),l=r("5880"),s=r("45d8"),u=r("8f94"),c=(r("a7be"),r("f9d4"),r("8c2e"),{data:function(){return{path:"",content:"",options:{tabSize:4,mode:"text/javascript",lineNumbers:!0,line:!0},isEdit:!1,loaded:!1}},beforeRouteEnter:function(e,t,r){"/"===t.path&&(e.params.reload=!0),r()},activated:function(){this.render()},computed:{url:function(){return this.$route.params.path?Object(s["d"])(this.$route.params.path):""},ismd:function(){return this.url.match(".*\\.(md|MD)$")}},components:{codemirror:u["codemirror"]},methods:Object(a["a"])(Object(a["a"])({},Object(l["mapActions"])("acrou/db",["get"])),{},{render:function(){var e=this;return Object(o["a"])(regeneratorRuntime.mark((function t(){var r,n,i;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:if(r=e.url,e.content='<center>\n        <i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>\n        <span class="sr-only">Loading...</span>\n      </center>',i=e.$route.params.reload,i){t.next=7;break}return t.next=6,e.get({path:"page.".concat(e.$route.fullPath)});case 6:n=t.sent;case 7:Object(s["g"])({path:r,file:n},(function(t){e.content=t}));case 8:case"end":return t.stop()}}),t)})))()},edit:function(){this.loaded=!0,this.isEdit=!this.isEdit}})}),f=c,d=(r("84f5"),r("a34b"),r("2877")),h=Object(d["a"])(f,n,i,!1,null,"1be29141",null);t["default"]=h.exports},f9d4:function(e,t,r){(function(e){e(r("56b3"))})((function(e){"use strict";e.defineMode("javascript",(function(t,r){var n,i,o=t.indentUnit,a=r.statementIndent,l=r.jsonld,s=r.json||l,u=r.typescript,c=r.wordCharacters||/[\w$\xa1-\uffff]/,f=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("keyword d"),o=e("operator"),a={type:"atom",style:"atom"};return{if:e("if"),while:t,with:t,else:r,do:r,try:r,finally:r,return:i,break:i,continue:i,new:e("new"),delete:n,void:n,throw:n,debugger:e("debugger"),var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:o,typeof:o,instanceof:o,true:a,false:a,null:a,undefined:a,NaN:a,Infinity:a,this:e("this"),class:e("class"),super:e("atom"),yield:n,export:e("export"),import:e("import"),extends:n,await:n}}(),d=/[+\-*&%=<>!?|~^@]/,h=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function p(e){var t,r=!1,n=!1;while(null!=(t=e.next())){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function g(e,t,r){return n=e,i=r,t}function v(e,t){var r=e.next();if('"'==r||"'"==r)return t.tokenize=m(r),t.tokenize(e,t);if("."==r&&e.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return g("number","number");if("."==r&&e.match(".."))return g("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return g(r);if("="==r&&e.eat(">"))return g("=>","operator");if("0"==r&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return g("number","number");if(/\d/.test(r))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),g("number","number");if("/"==r)return e.eat("*")?(t.tokenize=y,y(e,t)):e.eat("/")?(e.skipToEnd(),g("comment","comment")):et(e,t,1)?(p(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),g("regexp","string-2")):(e.eat("="),g("operator","operator",e.current()));if("`"==r)return t.tokenize=b,b(e,t);if("#"==r&&"!"==e.peek())return e.skipToEnd(),g("meta","meta");if("#"==r&&e.eatWhile(c))return g("variable","property");if("<"==r&&e.match("!--")||"-"==r&&e.match("->"))return e.skipToEnd(),g("comment","comment");if(d.test(r))return">"==r&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=r&&"="!=r||e.eat("="):/[<>*+\-]/.test(r)&&(e.eat(r),">"==r&&e.eat(r))),"?"==r&&e.eat(".")?g("."):g("operator","operator",e.current());if(c.test(r)){e.eatWhile(c);var n=e.current();if("."!=t.lastType){if(f.propertyIsEnumerable(n)){var i=f[n];return g(i.type,i.style,n)}if("async"==n&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return g("async","keyword",n)}return g("variable","variable",n)}}function m(e){return function(t,r){var n,i=!1;if(l&&"@"==t.peek()&&t.match(h))return r.tokenize=v,g("jsonld-keyword","meta");while(null!=(n=t.next())){if(n==e&&!i)break;i=!i&&"\\"==n}return i||(r.tokenize=v),g("string","string")}}function y(e,t){var r,n=!1;while(r=e.next()){if("/"==r&&n){t.tokenize=v;break}n="*"==r}return g("comment","comment")}function b(e,t){var r,n=!1;while(null!=(r=e.next())){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=v;break}n=!n&&"\\"==r}return g("quasi","string-2",e.current())}var w="([{}])";function x(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(r<0)){if(u){var n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,r));n&&(r=n.index)}for(var i=0,o=!1,a=r-1;a>=0;--a){var l=e.string.charAt(a),s=w.indexOf(l);if(s>=0&&s<3){if(!i){++a;break}if(0==--i){"("==l&&(o=!0);break}}else if(s>=3&&s<6)++i;else if(c.test(l))o=!0;else if(/["'\/`]/.test(l))for(;;--a){if(0==a)return;var f=e.string.charAt(a-1);if(f==l&&"\\"!=e.string.charAt(a-2)){a--;break}}else if(o&&!i){++a;break}}o&&!i&&(t.fatArrowAt=a)}}var C={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function k(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function S(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(r=n.vars;r;r=r.next)if(r.name==t)return!0}function L(e,t,r,n,i){var o=e.cc;M.state=e,M.stream=i,M.marked=null,M.cc=o,M.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);while(1){var a=o.length?o.pop():s?U:j;if(a(r,n)){while(o.length&&o[o.length-1].lex)o.pop()();return M.marked?M.marked:"variable"==r&&S(e,n)?"variable-2":t}}}var M={state:null,column:null,marked:null,cc:null};function T(){for(var e=arguments.length-1;e>=0;e--)M.cc.push(arguments[e])}function A(){return T.apply(null,arguments),!0}function O(e,t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}function N(e){var t=M.state;if(M.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var n=D(e,t.context);if(null!=n)return void(t.context=n)}else if(!O(e,t.localVars))return void(t.localVars=new F(e,t.localVars));r.globalVars&&!O(e,t.globalVars)&&(t.globalVars=new F(e,t.globalVars))}function D(e,t){if(t){if(t.block){var r=D(e,t.prev);return r?r==t.prev?t:new W(r,t.vars,!0):null}return O(e,t.vars)?t:new W(t.prev,new F(e,t.vars),!1)}return null}function E(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function W(e,t,r){this.prev=e,this.vars=t,this.block=r}function F(e,t){this.name=e,this.next=t}var H=new F("this",new F("arguments",null));function R(){M.state.context=new W(M.state.context,M.state.localVars,!1),M.state.localVars=H}function I(){M.state.context=new W(M.state.context,M.state.localVars,!0),M.state.localVars=null}function P(){M.state.localVars=M.state.context.vars,M.state.context=M.state.context.prev}function _(e,t){var r=function(){var r=M.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new k(n,M.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function z(){var e=M.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function B(e){function t(r){return r==e?A():";"==e||"}"==r||")"==r||"]"==r?T():A(t)}return t}function j(e,t){return"var"==e?A(_("vardef",t),Se,B(";"),z):"keyword a"==e?A(_("form"),$,j,z):"keyword b"==e?A(_("form"),j,z):"keyword d"==e?M.stream.match(/^\s*$/,!1)?A():A(_("stat"),Y,B(";"),z):"debugger"==e?A(B(";")):"{"==e?A(_("}"),I,fe,z,P):";"==e?A():"if"==e?("else"==M.state.lexical.info&&M.state.cc[M.state.cc.length-1]==z&&M.state.cc.pop()(),A(_("form"),$,j,z,Ne)):"function"==e?A(Fe):"for"==e?A(_("form"),De,j,z):"class"==e||u&&"interface"==t?(M.marked="keyword",A(_("form","class"==e?e:t),_e,z)):"variable"==e?u&&"declare"==t?(M.marked="keyword",A(j)):u&&("module"==t||"enum"==t||"type"==t)&&M.stream.match(/^\s*\w/,!1)?(M.marked="keyword","enum"==t?A(Ze):"type"==t?A(Re,B("operator"),ve,B(";")):A(_("form"),Le,B("{"),_("}"),fe,z,z)):u&&"namespace"==t?(M.marked="keyword",A(_("form"),U,j,z)):u&&"abstract"==t?(M.marked="keyword",A(j)):A(_("stat"),ie):"switch"==e?A(_("form"),$,B("{"),_("}","switch"),I,fe,z,z,P):"case"==e?A(U,B(":")):"default"==e?A(B(":")):"catch"==e?A(_("form"),R,V,j,z,P):"export"==e?A(_("stat"),Ve,z):"import"==e?A(_("stat"),Ge,z):"async"==e?A(j):"@"==t?A(U,j):T(_("stat"),U,B(";"),z)}function V(e){if("("==e)return A(Ie,B(")"))}function U(e,t){return K(e,t,!1)}function G(e,t){return K(e,t,!0)}function $(e){return"("!=e?T():A(_(")"),Y,B(")"),z)}function K(e,t,r){if(M.state.fatArrowAt==M.stream.start){var n=r?ee:Q;if("("==e)return A(R,_(")"),ue(Ie,")"),z,B("=>"),n,P);if("variable"==e)return T(R,Le,B("=>"),n,P)}var i=r?q:X;return C.hasOwnProperty(e)?A(i):"function"==e?A(Fe,i):"class"==e||u&&"interface"==t?(M.marked="keyword",A(_("form"),Pe,z)):"keyword c"==e||"async"==e?A(r?G:U):"("==e?A(_(")"),Y,B(")"),z,i):"operator"==e||"spread"==e?A(r?G:U):"["==e?A(_("]"),qe,z,i):"{"==e?ce(ae,"}",null,i):"quasi"==e?T(Z,i):"new"==e?A(te(r)):"import"==e?A(U):A()}function Y(e){return e.match(/[;\}\)\],]/)?T():T(U)}function X(e,t){return","==e?A(Y):q(e,t,!1)}function q(e,t,r){var n=0==r?X:q,i=0==r?U:G;return"=>"==e?A(R,r?ee:Q,P):"operator"==e?/\+\+|--/.test(t)||u&&"!"==t?A(n):u&&"<"==t&&M.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?A(_(">"),ue(ve,">"),z,n):"?"==t?A(U,B(":"),i):A(i):"quasi"==e?T(Z,n):";"!=e?"("==e?ce(G,")","call",n):"."==e?A(oe,n):"["==e?A(_("]"),Y,B("]"),z,n):u&&"as"==t?(M.marked="keyword",A(ve,n)):"regexp"==e?(M.state.lastType=M.marked="operator",M.stream.backUp(M.stream.pos-M.stream.start-1),A(i)):void 0:void 0}function Z(e,t){return"quasi"!=e?T():"${"!=t.slice(t.length-2)?A(Z):A(U,J)}function J(e){if("}"==e)return M.marked="string-2",M.state.tokenize=b,A(Z)}function Q(e){return x(M.stream,M.state),T("{"==e?j:U)}function ee(e){return x(M.stream,M.state),T("{"==e?j:G)}function te(e){return function(t){return"."==t?A(e?ne:re):"variable"==t&&u?A(xe,e?q:X):T(e?G:U)}}function re(e,t){if("target"==t)return M.marked="keyword",A(X)}function ne(e,t){if("target"==t)return M.marked="keyword",A(q)}function ie(e){return":"==e?A(z,j):T(X,B(";"),z)}function oe(e){if("variable"==e)return M.marked="property",A()}function ae(e,t){return"async"==e?(M.marked="property",A(ae)):"variable"==e||"keyword"==M.style?(M.marked="property","get"==t||"set"==t?A(le):(u&&M.state.fatArrowAt==M.stream.start&&(r=M.stream.match(/^\s*:\s*/,!1))&&(M.state.fatArrowAt=M.stream.pos+r[0].length),A(se))):"number"==e||"string"==e?(M.marked=l?"property":M.style+" property",A(se)):"jsonld-keyword"==e?A(se):u&&E(t)?(M.marked="keyword",A(ae)):"["==e?A(U,de,B("]"),se):"spread"==e?A(G,se):"*"==t?(M.marked="keyword",A(ae)):":"==e?T(se):void 0;var r}function le(e){return"variable"!=e?T(se):(M.marked="property",A(Fe))}function se(e){return":"==e?A(G):"("==e?T(Fe):void 0}function ue(e,t,r){function n(i,o){if(r?r.indexOf(i)>-1:","==i){var a=M.state.lexical;return"call"==a.info&&(a.pos=(a.pos||0)+1),A((function(r,n){return r==t||n==t?T():T(e)}),n)}return i==t||o==t?A():r&&r.indexOf(";")>-1?T(e):A(B(t))}return function(r,i){return r==t||i==t?A():T(e,n)}}function ce(e,t,r){for(var n=3;n<arguments.length;n++)M.cc.push(arguments[n]);return A(_(t,r),ue(e,t),z)}function fe(e){return"}"==e?A():T(j,fe)}function de(e,t){if(u){if(":"==e)return A(ve);if("?"==t)return A(de)}}function he(e,t){if(u&&(":"==e||"in"==t))return A(ve)}function pe(e){if(u&&":"==e)return M.stream.match(/^\s*\w+\s+is\b/,!1)?A(U,ge,ve):A(ve)}function ge(e,t){if("is"==t)return M.marked="keyword",A()}function ve(e,t){return"keyof"==t||"typeof"==t||"infer"==t?(M.marked="keyword",A("typeof"==t?G:ve)):"variable"==e||"void"==t?(M.marked="type",A(we)):"|"==t||"&"==t?A(ve):"string"==e||"number"==e||"atom"==e?A(we):"["==e?A(_("]"),ue(ve,"]",","),z,we):"{"==e?A(_("}"),ue(ye,"}",",;"),z,we):"("==e?A(ue(be,")"),me,we):"<"==e?A(ue(ve,">"),ve):void 0}function me(e){if("=>"==e)return A(ve)}function ye(e,t){return"variable"==e||"keyword"==M.style?(M.marked="property",A(ye)):"?"==t||"number"==e||"string"==e?A(ye):":"==e?A(ve):"["==e?A(B("variable"),he,B("]"),ye):"("==e?T(He,ye):void 0}function be(e,t){return"variable"==e&&M.stream.match(/^\s*[?:]/,!1)||"?"==t?A(be):":"==e?A(ve):"spread"==e?A(be):T(ve)}function we(e,t){return"<"==t?A(_(">"),ue(ve,">"),z,we):"|"==t||"."==e||"&"==t?A(ve):"["==e?A(ve,B("]"),we):"extends"==t||"implements"==t?(M.marked="keyword",A(ve)):"?"==t?A(ve,B(":"),ve):void 0}function xe(e,t){if("<"==t)return A(_(">"),ue(ve,">"),z,we)}function Ce(){return T(ve,ke)}function ke(e,t){if("="==t)return A(ve)}function Se(e,t){return"enum"==t?(M.marked="keyword",A(Ze)):T(Le,de,Ae,Oe)}function Le(e,t){return u&&E(t)?(M.marked="keyword",A(Le)):"variable"==e?(N(t),A()):"spread"==e?A(Le):"["==e?ce(Te,"]"):"{"==e?ce(Me,"}"):void 0}function Me(e,t){return"variable"!=e||M.stream.match(/^\s*:/,!1)?("variable"==e&&(M.marked="property"),"spread"==e?A(Le):"}"==e?T():"["==e?A(U,B("]"),B(":"),Me):A(B(":"),Le,Ae)):(N(t),A(Ae))}function Te(){return T(Le,Ae)}function Ae(e,t){if("="==t)return A(G)}function Oe(e){if(","==e)return A(Se)}function Ne(e,t){if("keyword b"==e&&"else"==t)return A(_("form","else"),j,z)}function De(e,t){return"await"==t?A(De):"("==e?A(_(")"),Ee,z):void 0}function Ee(e){return"var"==e?A(Se,We):"variable"==e?A(We):T(We)}function We(e,t){return")"==e?A():";"==e?A(We):"in"==t||"of"==t?(M.marked="keyword",A(U,We)):T(U,We)}function Fe(e,t){return"*"==t?(M.marked="keyword",A(Fe)):"variable"==e?(N(t),A(Fe)):"("==e?A(R,_(")"),ue(Ie,")"),z,pe,j,P):u&&"<"==t?A(_(">"),ue(Ce,">"),z,Fe):void 0}function He(e,t){return"*"==t?(M.marked="keyword",A(He)):"variable"==e?(N(t),A(He)):"("==e?A(R,_(")"),ue(Ie,")"),z,pe,P):u&&"<"==t?A(_(">"),ue(Ce,">"),z,He):void 0}function Re(e,t){return"keyword"==e||"variable"==e?(M.marked="type",A(Re)):"<"==t?A(_(">"),ue(Ce,">"),z):void 0}function Ie(e,t){return"@"==t&&A(U,Ie),"spread"==e?A(Ie):u&&E(t)?(M.marked="keyword",A(Ie)):u&&"this"==e?A(de,Ae):T(Le,de,Ae)}function Pe(e,t){return"variable"==e?_e(e,t):ze(e,t)}function _e(e,t){if("variable"==e)return N(t),A(ze)}function ze(e,t){return"<"==t?A(_(">"),ue(Ce,">"),z,ze):"extends"==t||"implements"==t||u&&","==e?("implements"==t&&(M.marked="keyword"),A(u?ve:U,ze)):"{"==e?A(_("}"),Be,z):void 0}function Be(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||u&&E(t))&&M.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(M.marked="keyword",A(Be)):"variable"==e||"keyword"==M.style?(M.marked="property",A(je,Be)):"number"==e||"string"==e?A(je,Be):"["==e?A(U,de,B("]"),je,Be):"*"==t?(M.marked="keyword",A(Be)):u&&"("==e?T(He,Be):";"==e||","==e?A(Be):"}"==e?A():"@"==t?A(U,Be):void 0}function je(e,t){if("?"==t)return A(je);if(":"==e)return A(ve,Ae);if("="==t)return A(G);var r=M.state.lexical.prev,n=r&&"interface"==r.info;return T(n?He:Fe)}function Ve(e,t){return"*"==t?(M.marked="keyword",A(Xe,B(";"))):"default"==t?(M.marked="keyword",A(U,B(";"))):"{"==e?A(ue(Ue,"}"),Xe,B(";")):T(j)}function Ue(e,t){return"as"==t?(M.marked="keyword",A(B("variable"))):"variable"==e?T(G,Ue):void 0}function Ge(e){return"string"==e?A():"("==e?T(U):T($e,Ke,Xe)}function $e(e,t){return"{"==e?ce($e,"}"):("variable"==e&&N(t),"*"==t&&(M.marked="keyword"),A(Ye))}function Ke(e){if(","==e)return A($e,Ke)}function Ye(e,t){if("as"==t)return M.marked="keyword",A($e)}function Xe(e,t){if("from"==t)return M.marked="keyword",A(U)}function qe(e){return"]"==e?A():T(ue(G,"]"))}function Ze(){return T(_("form"),Le,B("{"),_("}"),ue(Je,"}"),z,z)}function Je(){return T(Le,Ae)}function Qe(e,t){return"operator"==e.lastType||","==e.lastType||d.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}function et(e,t,r){return t.tokenize==v&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}return P.lex=!0,z.lex=!0,{startState:function(e){var t={tokenize:v,lastType:"sof",cc:[],lexical:new k((e||0)-o,0,"block",!1),localVars:r.localVars,context:r.localVars&&new W(null,null,!1),indented:e||0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),x(e,t)),t.tokenize!=y&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==n?r:(t.lastType="operator"!=n||"++"!=i&&"--"!=i?n:"incdec",L(t,r,n,i,e))},indent:function(t,n){if(t.tokenize==y)return e.Pass;if(t.tokenize!=v)return 0;var i,l=n&&n.charAt(0),s=t.lexical;if(!/^\s*else\b/.test(n))for(var u=t.cc.length-1;u>=0;--u){var c=t.cc[u];if(c==z)s=s.prev;else if(c!=Ne)break}while(("stat"==s.type||"form"==s.type)&&("}"==l||(i=t.cc[t.cc.length-1])&&(i==X||i==q)&&!/^[,\.=+\-*:?[\(]/.test(n)))s=s.prev;a&&")"==s.type&&"stat"==s.prev.type&&(s=s.prev);var f=s.type,d=l==f;return"vardef"==f?s.indented+("operator"==t.lastType||","==t.lastType?s.info.length+1:0):"form"==f&&"{"==l?s.indented:"form"==f?s.indented+o:"stat"==f?s.indented+(Qe(t,n)?a||o:0):"switch"!=s.info||d||0==r.doubleIndentSwitch?s.align?s.column+(d?0:1):s.indented+(d?0:o):s.indented+(/^(?:case|default)\b/.test(n)?o:2*o)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:s?null:"/*",blockCommentEnd:s?null:"*/",blockCommentContinue:s?null:" * ",lineComment:s?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:s?"json":"javascript",jsonldMode:l,jsonMode:s,expressionAllowed:et,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=U&&t!=G||e.cc.pop()}}})),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}))}}]);