daemonic.cc
Open in
urlscan Pro
172.67.208.171
Public Scan
Submitted URL: http://daemonic.cc/estore/wp-content/plugins/wp-codemirror-block/vendor/codemirror/lib/codemirror.min.js?ver=5.40.5
Effective URL: https://daemonic.cc/estore/wp-content/plugins/wp-codemirror-block/vendor/codemirror/lib/codemirror.min.js?ver=5.40.5
Submission: On October 31 via api from US — Scanned from CA
Effective URL: https://daemonic.cc/estore/wp-content/plugins/wp-codemirror-block/vendor/codemirror/lib/codemirror.min.js?ver=5.40.5
Submission: On October 31 via api from US — Scanned from CA
Form analysis
0 forms found in the DOMText Content
(function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.CodeMirror=t()})(this,function(){"use strict";function e(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function t(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function n(e,n){return t(e).appendChild(n)}function r(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"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 i(e,t,n,i){var o=r(e,t,n,i);return o.setAttribute("role","presentation"),o}function o(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 l(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function s(t,n){var r=t.className;e(n).test(r)||(t.className+=(r?" ":"")+n)}function a(t,n){for(var r=t.split(" "),i=0;i<r.length;i++)r[i]&&!e(r[i]).test(n)&&(n+=" "+r[i]);return n}function u(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function c(e,t,n){for(var r in t||(t={}),e)!e.hasOwnProperty(r)||!1===n&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function f(e,t,n,r,i){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=r||0,l=i||0;;){var s=e.indexOf("\t",o);if(s<0||s>=t)return l+(t-o);l+=s-o,l+=n-l%n,o=s+1}}function h(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}function d(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r);-1==o&&(o=e.length);var l=o-r;if(o==e.length||i+l>=t)return r+Math.min(l,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}function p(e){for(;Ql.length<=e;)Ql.push(g(Ql)+" ");return Ql[e]}function g(e){return e[e.length-1]}function v(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function m(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++;e.splice(r,0,t)}function y(){}function b(e,t){var n;return Object.create?n=Object.create(e):(y.prototype=e,n=new y),t&&c(t,n),n}function w(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Jl.test(e))}function x(e,t){return t?!!(t.source.indexOf("\\w")>-1&&w(e))||t.test(e):w(e)}function C(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function S(e){return e.charCodeAt(0)>=768&&es.test(e)}function L(e,t,n){for(;(n<0?t>0:t<e.length)&&S(e.charAt(t));)t+=n;return t}function k(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}function T(e,t,n){var o=this;this.input=n,o.scrollbarFiller=r("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=r("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=i("div",null,"CodeMirror-code"),o.selectionDiv=r("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=r("div",null,"CodeMirror-cursors"),o.measure=r("div",null,"CodeMirror-measure"),o.lineMeasure=r("div",null,"CodeMirror-measure"),o.lineSpace=i("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var l=i("div",[o.lineSpace],"CodeMirror-lines");o.mover=r("div",[l],null,"position: relative"),o.sizer=r("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=r("div",null,null,"position: absolute; height: "+Yl+"px; width: 1px;"),o.gutters=r("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=r("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=r("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),Cl&&Sl<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),Ll||yl&&Hl||(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,n.init(o)}function M(e,t){if(t-=e.first,t<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t<o){n=i;break}t-=o}return n.lines[t]}function A(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i}),r}function N(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function O(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function D(e){if(null==e.parent)return null;for(var t=e.parent,n=h(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function W(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height;if(t<o){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var l=0;l<e.lines.length;++l){var s=e.lines[l],a=s.height;if(t<a)break;t-=a}return n+l}function H(e,t){return t>=e.first&&t<e.first+e.size}function P(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function F(e,t,n){if(void 0===n&&(n=null),!(this instanceof F))return new F(e,t,n);this.line=e,this.ch=t,this.sticky=n}function z(e,t){return e.line-t.line||e.ch-t.ch}function E(e,t){return e.sticky==t.sticky&&0==z(e,t)}function I(e){return F(e.line,e.ch)}function R(e,t){return z(e,t)<0?t:e}function B(e,t){return z(e,t)<0?e:t}function G(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function U(e,t){if(t.line<e.first)return F(e.first,0);var n=e.first+e.size-1;return t.line>n?F(n,M(e,n).text.length):j(t,M(e,t.line).text.length)}function j(e,t){var n=e.ch;return null==n||n>t?F(e.line,t):n<0?F(e.line,0):e}function V(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=U(e,t[r]);return n}function K(){ts=!0}function X(){ns=!0}function Y(e,t,n){this.marker=e,this.from=t,this.to=n}function _(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function q(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function $(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Z(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker,s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);if(s||o.from==t&&"bookmark"==l.type&&(!n||!o.marker.insertLeft)){var a=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new Y(l,o.from,a?null:o.to))}}return r}function Q(e,t,n){var r;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker,s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);if(s||o.from==t&&"bookmark"==l.type&&(!n||o.marker.insertLeft)){var a=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new Y(l,a?null:o.from-t,null==o.to?null:o.to-t))}}return r}function J(e,t){if(t.full)return null;var n=H(e,t.from.line)&&M(e,t.from.line).markedSpans,r=H(e,t.to.line)&&M(e,t.to.line).markedSpans;if(!n&&!r)return null;var i=t.from.ch,o=t.to.ch,l=0==z(t.from,t.to),s=Z(n,i,l),a=Q(r,o,l),u=1==t.text.length,c=g(t.text).length+(u?i:0);if(s)for(var f=0;f<s.length;++f){var h=s[f];if(null==h.to){var d=_(a,h.marker);d?u&&(h.to=null==d.to?null:d.to+c):h.to=i}}if(a)for(var p=0;p<a.length;++p){var v=a[p];if(null!=v.to&&(v.to+=c),null==v.from){var m=_(s,v.marker);m||(v.from=c,u&&(s||(s=[])).push(v))}else v.from+=c,u&&(s||(s=[])).push(v)}s&&(s=ee(s)),a&&a!=s&&(a=ee(a));var y=[s];if(!u){var b,w=t.text.length-2;if(w>0&&s)for(var x=0;x<s.length;++x)null==s[x].to&&(b||(b=[])).push(new Y(s[x].marker,null,null));for(var C=0;C<w;++C)y.push(b);y.push(a)}return y}function ee(e){for(var t=0;t<e.length;++t){var n=e[t];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function te(e,t,n){var r=null;if(e.iter(t.line,n.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker;!n.readOnly||r&&-1!=h(r,n)||(r||(r=[])).push(n)}}),!r)return null;for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var l=r[o],s=l.find(0),a=0;a<i.length;++a){var u=i[a];if(!(z(u.to,s.from)<0||z(u.from,s.to)>0)){var c=[a,1],f=z(u.from,s.from),d=z(u.to,s.to);(f<0||!l.inclusiveLeft&&!f)&&c.push({from:u.from,to:s.from}),(d>0||!l.inclusiveRight&&!d)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),a+=c.length-3}}return i}function ne(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function re(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e);e.markedSpans=t}}function ie(e){return e.inclusiveLeft?-1:0}function oe(e){return e.inclusiveRight?1:0}function le(e,t){var n=e.lines.length-t.lines.length;if(0!=n)return n;var r=e.find(),i=t.find(),o=z(r.from,i.from)||ie(e)-ie(t);if(o)return-o;var l=z(r.to,i.to)||oe(e)-oe(t);return l||t.id-e.id}function se(e,t){var n,r=ns&&e.markedSpans;if(r)for(var i=void 0,o=0;o<r.length;++o)i=r[o],i.marker.collapsed&&null==(t?i.from:i.to)&&(!n||le(n,i.marker)<0)&&(n=i.marker);return n}function ae(e){return se(e,!0)}function ue(e){return se(e,!1)}function ce(e,t){var n,r=ns&&e.markedSpans;if(r)for(var i=0;i<r.length;++i){var o=r[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||le(n,o.marker)<0)&&(n=o.marker)}return n}function fe(e,t,n,r,i){var o=M(e,t),l=ns&&o.markedSpans;if(l)for(var s=0;s<l.length;++s){var a=l[s];if(a.marker.collapsed){var u=a.marker.find(0),c=z(u.from,n)||ie(a.marker)-ie(i),f=z(u.to,r)||oe(a.marker)-oe(i);if(!(c>=0&&f<=0||c<=0&&f>=0)&&(c<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?z(u.to,n)>=0:z(u.to,n)>0)||c>=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?z(u.from,r)<=0:z(u.from,r)<0)))return!0}}}function he(e){for(var t;t=ae(e);)e=t.find(-1,!0).line;return e}function de(e){for(var t;t=ue(e);)e=t.find(1,!0).line;return e}function pe(e){for(var t,n;t=ue(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function ge(e,t){var n=M(e,t),r=he(n);return n==r?t:D(r)}function ve(e,t){if(t>e.lastLine())return t;var n,r=M(e,t);if(!me(e,r))return t;for(;n=ue(r);)r=n.find(1,!0).line;return D(r)+1}function me(e,t){var n=ns&&t.markedSpans;if(n)for(var r=void 0,i=0;i<n.length;++i)if(r=n[i],r.marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&ye(e,t,r))return!0}}function ye(e,t,n){if(null==n.to){var r=n.marker.find(1,!0);return ye(e,r.line,_(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if(i=t.markedSpans[o],i.marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&ye(e,t,i))return!0}function be(e){e=he(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var i=n.lines[r];if(i==e)break;t+=i.height}for(var o=n.parent;o;n=o,o=n.parent)for(var l=0;l<o.children.length;++l){var s=o.children[l];if(s==n)break;t+=s.height}return t}function we(e){if(0==e.height)return 0;for(var t,n=e.text.length,r=e;t=ae(r);){var i=t.find(0,!0);r=i.from.line,n+=i.from.ch-i.to.ch}for(r=e;t=ue(r);){var o=t.find(0,!0);n-=r.text.length-o.from.ch,r=o.to.line,n+=r.text.length-o.to.ch}return n}function xe(e){var t=e.display,n=e.doc;t.maxLine=M(n,n.first),t.maxLineLength=we(t.maxLine),t.maxLineChanged=!0,n.iter(function(e){var n=we(e);n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function Ce(e,t,n,r){if(!e)return r(t,n,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<n&&l.to>t||t==n&&l.to==t)&&(r(Math.max(l.from,t),Math.min(l.to,n),1==l.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}function Se(e,t,n){var r;rs=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"==n?r=i:rs=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:rs=i)}return null!=r?r:rs}function Le(e,t){var n=e.order;return null==n&&(n=e.order=is(e.text,t)),n}function ke(e,t){return e._handlers&&e._handlers[t]||os}function Te(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else if(e.detachEvent)e.detachEvent("on"+t,n);else{var r=e._handlers,i=r&&r[t];if(i){var o=h(i,n);o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function Me(e,t){var n=ke(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function Ae(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Me(e,n||t.type,e,t),Pe(t)||t.codemirrorIgnore}function Ne(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==h(n,t[r])&&n.push(t[r])}function Oe(e,t){return ke(e,t).length>0}function De(e){e.prototype.on=function(e,t){ls(this,e,t)},e.prototype.off=function(e,t){Te(this,e,t)}}function We(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function He(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Pe(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Fe(e){We(e),He(e)}function ze(e){return e.target||e.srcElement}function Ee(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),Pl&&e.ctrlKey&&1==t&&(t=3),t}function Ie(e){if(null==Vl){var t=r("span","​");n(e,r("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Vl=t.offsetWidth<=1&&t.offsetHeight>2&&!(Cl&&Sl<8))}var i=Vl?r("span","​"):r("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return i.setAttribute("cm-text",""),i}function Re(e){if(null!=Kl)return Kl;var r=n(e,document.createTextNode("AØ®A")),i=Il(r,0,1).getBoundingClientRect(),o=Il(r,1,2).getBoundingClientRect();return t(e),!(!i||i.left==i.right)&&(Kl=o.right-i.right<3)}function Be(e){if(null!=fs)return fs;var t=n(e,r("span","x")),i=t.getBoundingClientRect(),o=Il(t,0,1).getBoundingClientRect();return fs=Math.abs(i.left-o.left)>1}function Ge(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),hs[e]=t}function Ue(e,t){ds[e]=t}function je(e){if("string"==typeof e&&ds.hasOwnProperty(e))e=ds[e];else if(e&&"string"==typeof e.name&&ds.hasOwnProperty(e.name)){var t=ds[e.name];"string"==typeof t&&(t={name:t}),e=b(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 n=hs[t.name];if(!n)return Ve(e,"text/plain");var r=n(e,t);if(ps.hasOwnProperty(t.name)){var i=ps[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)r[l]=t.modeProps[l];return r}function Ke(e,t){var n=ps.hasOwnProperty(e)?ps[e]:ps[e]={};c(t,n)}function Xe(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Ye(e,t){for(var n;e.innerMode&&(n=e.innerMode(t),n&&n.mode!=e);)t=n.state,e=n.mode;return n||{mode:e,state:t}}function _e(e,t,n){return!e.startState||e.startState(t,n)}function qe(e,t,n,r){var i=[e.state.modeGen],o={};rt(e,t.text,e.doc.mode,n,function(e,t){return i.push(e,t)},o,r);for(var l=n.state,s=function(r){n.baseTokens=i;var s=e.state.overlays[r],a=1,u=0;n.state=!0,rt(e,t.text,s.mode,n,function(e,t){for(var n=a;u<e;){var r=i[a];r>e&&i.splice(a,1,e,i[a+1],r),a+=2,u=Math.min(e,r)}if(t)if(s.opaque)i.splice(n,a-n,e,"overlay "+t),a=n+2;else for(;n<a;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"overlay "+t}},o),n.state=l,n.baseTokens=null,n.baseTokenPos=1},a=0;a<e.state.overlays.length;++a)s(a);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function $e(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Ze(e,D(t)),i=t.text.length>e.options.maxHighlightLength&&Xe(e.doc.mode,r.state),o=qe(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function Ze(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ms(r,!0,t);var o=it(e,t,n),l=o>r.first&&M(r,o-1).stateAfter,s=l?ms.fromSaved(r,l,o):new ms(r,_e(r.mode),o);return r.iter(o,t,function(n){Qe(e,n.text,s);var r=s.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&r<i.viewTo?s.save():null,s.nextLine()}),n&&(r.modeFrontier=s.line),s}function Qe(e,t,n,r){var i=e.doc.mode,o=new gs(t,e.options.tabSize,n);for(o.start=o.pos=r||0,""==t&&Je(i,n.state);!o.eol();)et(i,o,n.state),o.start=o.pos}function Je(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=Ye(e,t);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function et(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Ye(e,n).mode);var o=e.token(t,n);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}function tt(e,t,n,r){var i,o=e.doc,l=o.mode;t=U(o,t);var s,a=M(o,t.line),u=Ze(e,t.line,n),c=new gs(a.text,e.options.tabSize,u);for(r&&(s=[]);(r||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=et(l,c,u.state),r&&s.push(new ys(c,i,Xe(o.mode,u.state)));return r?s:new ys(c,i,u.state)}function nt(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;e=e.slice(0,n.index)+e.slice(n.index+n[0].length);var r=n[1]?"bgClass":"textClass";null==t[r]?t[r]=n[2]:new RegExp("(?:^|s)"+n[2]+"(?:$|s)").test(t[r])||(t[r]+=" "+n[2])}return e}function rt(e,t,n,r,i,o,l){var s=n.flattenSpans;null==s&&(s=e.options.flattenSpans);var a,u=0,c=null,f=new gs(t,e.options.tabSize,r),h=e.options.addModeClass&&[null];for(""==t&&nt(Je(n,r.state),o);!f.eol();){if(f.pos>e.options.maxHighlightLength?(s=!1,l&&Qe(e,t,r,f.pos),f.pos=t.length,a=null):a=nt(et(n,f,r.state,h),o),h){var d=h[0].name;d&&(a="m-"+(a?d+" "+a:d))}if(!s||c!=a){for(;u<f.start;)u=Math.min(f.start,u+5e3),i(u,c);c=a}f.start=f.pos}for(;u<f.pos;){var p=Math.min(f.pos,u+5e3);i(p,c),u=p}}function it(e,t,n){for(var r,i,o=e.doc,l=n?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>l;--s){if(s<=o.first)return o.first;var a=M(o,s-1),u=a.stateAfter;if(u&&(!n||s+(u instanceof vs?u.lookAhead:0)<=o.modeFrontier))return s;var c=f(a.text,null,e.options.tabSize);(null==i||r>c)&&(i=s-1,r=c)}return i}function ot(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var n=e.first,r=t-1;r>n;r--){var i=M(e,r).stateAfter;if(i&&(!(i instanceof vs)||r+i.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}function lt(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),ne(e),re(e,n);var i=r?r(e):1;i!=e.height&&O(e,i)}function st(e){e.parent=null,ne(e)}function at(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?Cs:xs;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function ut(e,t){var n=i("span",null,null,Ll?"padding-right: .1px":null),r={pre:i("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var l=o?t.rest[o-1]:t.line,s=void 0;r.pos=0,r.addToken=ft,Re(e.display.measure)&&(s=Le(l,e.doc.direction))&&(r.addToken=dt(r.addToken,s)),r.map=[];var u=t!=e.display.externalMeasured&&D(l);gt(l,r,$e(e,l,u)),l.styleClasses&&(l.styleClasses.bgClass&&(r.bgClass=a(l.styleClasses.bgClass,r.bgClass||"")),l.styleClasses.textClass&&(r.textClass=a(l.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Ie(e.display.measure))),0==o?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(Ll){var c=r.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Me(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=a(r.pre.className,r.textClass||"")),r}function ct(e){var t=r("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ft(e,t,n,i,o,l,s){if(t){var a,u=e.splitSpaces?ht(t,e.trailingSpace):t,c=e.cm.state.specialChars,f=!1;if(c.test(t)){a=document.createDocumentFragment();for(var h=0;;){c.lastIndex=h;var d=c.exec(t),g=d?d.index-h:t.length-h;if(g){var v=document.createTextNode(u.slice(h,h+g));Cl&&Sl<9?a.appendChild(r("span",[v])):a.appendChild(v),e.map.push(e.pos,e.pos+g,v),e.col+=g,e.pos+=g}if(!d)break;h+=g+1;var m=void 0;if("\t"==d[0]){var y=e.cm.options.tabSize,b=y-e.col%y;m=a.appendChild(r("span",p(b),"cm-tab")),m.setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),e.col+=b}else"\r"==d[0]||"\n"==d[0]?(m=a.appendChild(r("span","\r"==d[0]?"â":"â¤","cm-invalidchar")),m.setAttribute("cm-text",d[0]),e.col+=1):(m=e.cm.options.specialCharPlaceholder(d[0]),m.setAttribute("cm-text",d[0]),Cl&&Sl<9?a.appendChild(r("span",[m])):a.appendChild(m),e.col+=1);e.map.push(e.pos,e.pos+1,m),e.pos++}}else e.col+=t.length,a=document.createTextNode(u),e.map.push(e.pos,e.pos+t.length,a),Cl&&Sl<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==u.charCodeAt(t.length-1),n||i||o||f||s){var w=n||"";i&&(w+=i),o&&(w+=o);var x=r("span",[a],w,s);return l&&(x.title=l),e.content.appendChild(x)}e.content.appendChild(a)}}function ht(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!n||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),r+=o,n=" "==o}return r}function dt(e,t){return function(n,r,i,o,l,s,a){i=i?i+" cm-force-border":"cm-force-border";for(var u=n.pos,c=u+r.length;;){for(var f=void 0,h=0;h<t.length&&(f=t[h],!(f.to>u&&f.from<=u));h++);if(f.to>=c)return e(n,r,i,o,l,s,a);e(n,r.slice(0,f.to-u),i,o,null,s,a),o=null,r=r.slice(f.to-u),u=f.to}}}function pt(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function gt(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var l,s,a,u,c,f,h,d=i.length,p=0,g=1,v="",m=0;;){if(m==p){a=u=c=f=s="",h=null,m=1/0;for(var y=[],b=void 0,w=0;w<r.length;++w){var x=r[w],C=x.marker;"bookmark"==C.type&&x.from==p&&C.widgetNode?y.push(C):x.from<=p&&(null==x.to||x.to>p||C.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&m>x.to&&(m=x.to,u=""),C.className&&(a+=" "+C.className),C.css&&(s=(s?s+";":"")+C.css),C.startStyle&&x.from==p&&(c+=" "+C.startStyle),C.endStyle&&x.to==m&&(b||(b=[])).push(C.endStyle,x.to),C.title&&!f&&(f=C.title),C.collapsed&&(!h||le(h.marker,C)<0)&&(h=x)):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(!h||h.from==p)for(var L=0;L<y.length;++L)pt(t,0,y[L]);if(h&&(h.from||0)==p){if(pt(t,(null==h.to?d+1:h.to)-p,h.marker,null==h.from),null==h.to)return;h.to==p&&(h=!1)}}if(p>=d)break;for(var k=Math.min(d,m);;){if(v){var T=p+v.length;if(!h){var M=T>k?v.slice(0,k-p):v;t.addToken(t,M,l?l+a:a,c,p+M.length==m?u:"",f,s)}if(T>=k){v=v.slice(k-p),p=k;break}p=T,c=""}v=i.slice(o,o=n[g++]),l=at(n[g++],t.cm.options)}}else for(var A=1;A<n.length;A+=2)t.addToken(t,i.slice(o,o=n[A]),at(n[A+1],t.cm.options))}function vt(e,t,n){this.line=t,this.rest=pe(t),this.size=this.rest?D(g(this.rest))-n+1:1,this.node=this.text=null,this.hidden=me(e,t)}function mt(e,t,n){for(var r,i=[],o=t;o<n;o=r){var l=new vt(e.doc,M(e.doc,o),o);r=o+l.size,i.push(l)}return i}function yt(e){Ss?Ss.ops.push(e):e.ownsGroup=Ss={ops:[e],delayedCallbacks:[]}}function bt(e){var t=e.delayedCallbacks,n=0;do{for(;n<t.length;n++)t[n].call(null);for(var r=0;r<e.ops.length;r++){var i=e.ops[r];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}function wt(e,t){var n=e.ownsGroup;if(n)try{bt(n)}finally{Ss=null,t(n)}}function xt(e,t){var n=ke(e,t);if(n.length){var r,i=Array.prototype.slice.call(arguments,2);Ss?r=Ss.delayedCallbacks:Ls?r=Ls:(r=Ls=[],setTimeout(Ct,0));for(var o=function(e){r.push(function(){return n[e].apply(null,i)})},l=0;l<n.length;++l)o(l)}}function Ct(){var e=Ls;Ls=null;for(var t=0;t<e.length;++t)e[t]()}function St(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?Mt(e,t):"gutter"==o?Nt(e,t,n,r):"class"==o?At(e,t):"widget"==o&&Ot(e,t,r)}t.changes=null}function Lt(e){return e.node==e.text&&(e.node=r("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),Cl&&Sl<8&&(e.node.style.zIndex=2)),e.node}function kt(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var i=Lt(t);t.background=i.insertBefore(r("div",null,n),i.firstChild),e.display.input.setUneditable(t.background)}}function Tt(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):ut(e,t)}function Mt(e,t){var n=t.text.className,r=Tt(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,At(e,t)):n&&(t.text.className=n)}function At(e,t){kt(e,t),t.line.wrapClass?Lt(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=n||""}function Nt(e,t,n,i){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 o=Lt(t);t.gutterBackground=r("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),o.insertBefore(t.gutterBackground,t.text)}var l=t.line.gutterMarkers;if(e.options.lineNumbers||l){var s=Lt(t),a=t.gutter=r("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),s.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||l&&l["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(r("div",P(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),l)for(var u=0;u<e.options.gutters.length;++u){var c=e.options.gutters[u],f=l.hasOwnProperty(c)&&l[c];f&&a.appendChild(r("div",[f],"CodeMirror-gutter-elt","left: "+i.gutterLeft[c]+"px; width: "+i.gutterWidth[c]+"px"))}}}function Ot(e,t,n){t.alignable&&(t.alignable=null);for(var r=t.node.firstChild,i=void 0;r;r=i)i=r.nextSibling,"CodeMirror-linewidget"==r.className&&t.node.removeChild(r);Wt(e,t,n)}function Dt(e,t,n,r){var i=Tt(e,t);return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),At(e,t),Nt(e,t,n,r),Wt(e,t,r),t.node}function Wt(e,t,n){if(Ht(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)Ht(e,t.rest[r],t,n,!1)}function Ht(e,t,n,i,o){if(t.widgets)for(var l=Lt(n),s=0,a=t.widgets;s<a.length;++s){var u=a[s],c=r("div",[u.node],"CodeMirror-linewidget");u.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),Pt(u,c,n,i),e.display.input.setUneditable(c),o&&u.above?l.insertBefore(c,n.gutter||n.text):l.appendChild(c),xt(u,"redraw")}}function Pt(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var i=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function Ft(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!o(document.body,e.node)){var i="position: relative;";e.coverGutter&&(i+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(i+="width: "+t.display.wrapper.clientWidth+"px;"),n(t.display.measure,r("div",[e.node],null,i))}return e.height=e.node.parentNode.offsetHeight}function zt(e,t){for(var n=ze(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function Et(e){return e.lineSpace.offsetTop}function It(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Rt(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=n(e.measure,r("pre","x")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,o={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return isNaN(o.left)||isNaN(o.right)||(e.cachedPaddingH=o),o}function Bt(e){return Yl-e.display.nativeBarWidth}function Gt(e){return e.display.scroller.clientWidth-Bt(e)-e.display.barWidth}function Ut(e){return e.display.scroller.clientHeight-Bt(e)-e.display.barHeight}function jt(e,t,n){var r=e.options.lineWrapping,i=r&&Gt(e);if(!t.measure.heights||r&&t.measure.width!=i){var o=t.measure.heights=[];if(r){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),s=0;s<l.length-1;s++){var a=l[s],u=l[s+1];Math.abs(a.bottom-u.bottom)>2&&o.push((a.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Vt(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var i=0;i<e.rest.length;i++)if(D(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Kt(e,t){t=he(t);var r=D(t),i=e.display.externalMeasured=new vt(e.doc,t,r);i.lineN=r;var o=i.built=ut(e,i);return i.text=o.pre,n(e.display.lineMeasure,o.pre),i}function Xt(e,t,n,r){return qt(e,_t(e,t),n,r)}function Yt(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Mn(e,t)];var n=e.display.externalMeasured;return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function _t(e,t){var n=D(t),r=Yt(e,n);r&&!r.text?r=null:r&&r.changes&&(St(e,r,n,Cn(e)),e.curOp.forceUpdate=!0),r||(r=Kt(e,t));var i=Vt(r,t,n);return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function qt(e,t,n,r,i){t.before&&(n=-1);var o,l=n+(r||"");return t.cache.hasOwnProperty(l)?o=t.cache[l]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(jt(e,t.view,t.rect),t.hasHeights=!0),o=Qt(e,t,n,r),o.bogus||(t.cache[l]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}function $t(e,t,n){for(var r,i,o,l,s,a,u=0;u<e.length;u+=3)if(s=e[u],a=e[u+1],t<s?(i=0,o=1,l="left"):t<a?(i=t-s,o=i+1):(u==e.length-3||t==a&&e[u+3]>t)&&(o=a-s,i=o-1,t>=a&&(l="right")),null!=i){if(r=e[u+2],s==a&&n==(r.insertLeft?"left":"right")&&(l=n),"left"==n&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[2+(u-=3)],l="left";if("right"==n&&i==a-s)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)r=e[(u+=3)+2],l="right";break}return{node:r,start:i,end:o,collapse:l,coverStart:s,coverEnd:a}}function Zt(e,t){var n=ks ;if("left"==t)for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;i>=0&&(n=e[i]).left==n.right;i--);return n}function Qt(e,t,n,r){var i,o=$t(t.map,n,r),l=o.node,s=o.start,a=o.end,u=o.collapse;if(3==l.nodeType){for(var c=0;c<4;c++){for(;s&&S(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+a<o.coverEnd&&S(t.line.text.charAt(o.coverStart+a));)++a;if(i=Cl&&Sl<9&&0==s&&a==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():Zt(Il(l,s,a).getClientRects(),r),i.left||i.right||0==s)break;a=s,s-=1,u="right"}Cl&&Sl<11&&(i=Jt(e.display.measure,i))}else{var f;s>0&&(u=r="right"),i=e.options.lineWrapping&&(f=l.getClientRects()).length>1?f["right"==r?f.length-1:0]:l.getBoundingClientRect()}if(Cl&&Sl<9&&!s&&(!i||!i.left&&!i.right)){var h=l.parentNode.getClientRects()[0];i=h?{left:h.left,right:h.left+xn(e.display),top:h.top,bottom:h.bottom}:ks}for(var d=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(d+p)/2,v=t.view.measure.heights,m=0;m<v.length-1&&!(g<v[m]);m++);var y=m?v[m-1]:0,b=v[m],w={left:("right"==u?i.right:i.left)-t.rect.left,right:("left"==u?i.left:i.right)-t.rect.left,top:y,bottom:b};return i.left||i.right||(w.bogus=!0),e.options.singleCursorHeightPerLine||(w.rtop=d,w.rbottom=p),w}function Jt(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Be(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}function en(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 tn(e){e.display.externalMeasure=null,t(e.display.lineMeasure);for(var n=0;n<e.display.view.length;n++)en(e.display.view[n])}function nn(e){tn(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function rn(){return Tl&&Wl?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function on(){return Tl&&Wl?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function ln(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=Ft(e.widgets[n]));return t}function sn(e,t,n,r,i){if(!i){var o=ln(t);n.top+=o,n.bottom+=o}if("line"==r)return n;r||(r="local");var l=be(t);if("local"==r?l+=Et(e.display):l-=e.display.viewOffset,"page"==r||"window"==r){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==r?0:on());var a=s.left+("window"==r?0:rn());n.left+=a,n.right+=a}return n.top+=l,n.bottom+=l,n}function an(e,t,n){if("div"==n)return t;var r=t.left,i=t.top;if("page"==n)r-=rn(),i-=on();else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect();r+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:r-l.left,top:i-l.top}}function un(e,t,n,r,i){return r||(r=M(e.doc,t.line)),sn(e,r,Xt(e,r,t.ch,i),n)}function cn(e,t,n,r,i,o){function l(t,l){var s=qt(e,i,t,l?"right":"left",o);return l?s.left=s.right:s.right=s.left,sn(e,r,s,n)}function s(e,t,n){var r=a[t],i=1==r.level;return l(n?e-1:e,i!=n)}r=r||M(e.doc,t.line),i||(i=_t(e,r));var a=Le(r,e.doc.direction),u=t.ch,c=t.sticky;if(u>=r.text.length?(u=r.text.length,c="before"):u<=0&&(u=0,c="after"),!a)return l("before"==c?u-1:u,"before"==c);var f=Se(a,u,c),h=rs,d=s(u,f,"before"==c);return null!=h&&(d.other=s(u,h,"before"!=c)),d}function fn(e,t){var n=0;t=U(e.doc,t),e.options.lineWrapping||(n=xn(e.display)*t.ch);var r=M(e.doc,t.line),i=be(r)+Et(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function hn(e,t,n,r,i){var o=F(e,t,n);return o.xRel=i,r&&(o.outside=!0),o}function dn(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,n<0)return hn(r.first,0,null,!0,-1);var i=W(r,n),o=r.first+r.size-1;if(i>o)return hn(r.first+r.size-1,M(r,o).text.length,null,!0,1);t<0&&(t=0);for(var l=M(r,i);;){var s=mn(e,l,i,t,n),a=ce(l,s.ch+(s.xRel>0?1:0));if(!a)return s;var u=a.find(1);if(u.line==i)return u;l=M(r,i=u.line)}}function pn(e,t,n,r){r-=ln(t);var i=t.text.length,o=k(function(t){return qt(e,n,t-1).bottom<=r},i,0);return i=k(function(t){return qt(e,n,t).top>r},o,i),{begin:o,end:i}}function gn(e,t,n,r){n||(n=_t(e,t));var i=sn(e,t,qt(e,n,r),"line").top;return pn(e,t,n,i)}function vn(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function mn(e,t,n,r,i){i-=be(t);var o=_t(e,t),l=ln(t),s=0,a=t.text.length,u=!0,c=Le(t,e.doc.direction);if(c){var f=(e.options.lineWrapping?bn:yn)(e,t,n,o,c,r,i);u=1!=f.level,s=u?f.from:f.to-1,a=u?f.to:f.from-1}var h,d,p=null,g=null,v=k(function(t){var n=qt(e,o,t);return n.top+=l,n.bottom+=l,!!vn(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=t,g=n),!0)},s,a),m=!1;if(g){var y=r-g.left<g.right-r,b=y==u;v=p+(b?0:1),d=b?"after":"before",h=y?g.left:g.right}else{u||v!=a&&v!=s||v++,d=0==v?"after":v==t.text.length?"before":qt(e,o,v-(u?1:0)).bottom+l<=i==u?"after":"before";var w=cn(e,F(n,v,d),"line",t,o);h=w.left,m=i<w.top||i>=w.bottom}return v=L(t.text,v,1),hn(n,v,d,m,r-h)}function yn(e,t,n,r,i,o,l){var s=k(function(s){var a=i[s],u=1!=a.level;return vn(cn(e,F(n,u?a.to:a.from,u?"before":"after"),"line",t,r),o,l,!0)},0,i.length-1),a=i[s];if(s>0){var u=1!=a.level,c=cn(e,F(n,u?a.from:a.to,u?"after":"before"),"line",t,r);vn(c,o,l,!0)&&c.top>l&&(a=i[s-1])}return a}function bn(e,t,n,r,i,o,l){var s=pn(e,t,r,l),a=s.begin,u=s.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,f=null,h=0;h<i.length;h++){var d=i[h];if(!(d.from>=u||d.to<=a)){var p=1!=d.level,g=qt(e,r,p?Math.min(u,d.to)-1:Math.max(a,d.from)).right,v=g<o?o-g+1e9:g-o;(!c||f>v)&&(c=d,f=v)}}return c||(c=i[i.length-1]),c.from<a&&(c={from:a,to:c.to,level:c.level}),c.to>u&&(c={from:c.from,to:u,level:c.level}),c}function wn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==ws){ws=r("pre");for(var i=0;i<49;++i)ws.appendChild(document.createTextNode("x")),ws.appendChild(r("br"));ws.appendChild(document.createTextNode("x"))}n(e.measure,ws);var o=ws.offsetHeight/50;return o>3&&(e.cachedTextHeight=o),t(e.measure),o||1}function xn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=r("span","xxxxxxxxxx"),i=r("pre",[t]);n(e.measure,i);var o=t.getBoundingClientRect(),l=(o.right-o.left)/10;return l>2&&(e.cachedCharWidth=l),l||10}function Cn(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l)n[e.options.gutters[l]]=o.offsetLeft+o.clientLeft+i,r[e.options.gutters[l]]=o.clientWidth;return{fixedPos:Sn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function Sn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function Ln(e){var t=wn(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/xn(e.display)-3);return function(i){if(me(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l<i.widgets.length;l++)i.widgets[l].height&&(o+=i.widgets[l].height);return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function kn(e){var t=e.doc,n=Ln(e);t.iter(function(e){var t=n(e);t!=e.height&&O(e,t)})}function Tn(e,t,n,r){var i=e.display;if(!n&&"true"==ze(t).getAttribute("cm-not-content"))return null;var o,l,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,l=t.clientY-s.top}catch(t){return null}var a,u=dn(e,o,l);if(r&&1==u.xRel&&(a=M(e.doc,u.line).text).length==u.ch){var c=f(a,a.length,e.options.tabSize)-a.length;u=F(u.line,Math.max(0,Math.round((o-Rt(e.display).left)/xn(e.display))-c))}return u}function Mn(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,t<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if(t-=n[r].size,t<0)return r}function An(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Nn(e,t){void 0===t&&(t=!0);for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),l=0;l<n.sel.ranges.length;l++)if(t||l!=n.sel.primIndex){var s=n.sel.ranges[l];if(!(s.from().line>=e.display.viewTo||s.to().line<e.display.viewFrom)){var a=s.empty();(a||e.options.showCursorWhenSelecting)&&On(e,s.head,i),a||Wn(e,s,o)}}return r}function On(e,t,n){var i=cn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),o=n.appendChild(r("div"," ","CodeMirror-cursor"));if(o.style.left=i.left+"px",o.style.top=i.top+"px",o.style.height=Math.max(0,i.bottom-i.top)*e.options.cursorHeight+"px",i.other){var l=n.appendChild(r("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));l.style.display="",l.style.left=i.other.left+"px",l.style.top=i.other.top+"px",l.style.height=.85*(i.other.bottom-i.other.top)+"px"}}function Dn(e,t){return e.top-t.top||e.left-t.left}function Wn(e,t,n){function i(e,t,n,i){t<0&&(t=0),t=Math.round(t),i=Math.round(i),a.appendChild(r("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?f-e:n)+"px;\n height: "+(i-t)+"px"))}function o(t,n,r){function o(n,r){return un(e,F(t,n),"div",d,r)}function l(t,n,r){var i=gn(e,d,null,t),l="ltr"==n==("after"==r)?"left":"right",s="after"==r?i.begin:i.end-(/\s/.test(d.text.charAt(i.end-1))?2:1);return o(s,l)[l]}var a,u,d=M(s,t),p=d.text.length,g=Le(d,s.direction);return Ce(g,n||0,null==r?p:r,function(e,t,s,d){var v="ltr"==s,m=o(e,v?"left":"right"),y=o(t-1,v?"right":"left"),b=null==n&&0==e,w=null==r&&t==p,x=0==d,C=!g||d==g.length-1;if(y.top-m.top<=3){var S=(h?b:w)&&x,L=(h?w:b)&&C,k=S?c:(v?m:y).left,T=L?f:(v?y:m).right;i(k,m.top,T-k,m.bottom)}else{var M,A,N,O;v?(M=h&&b&&x?c:m.left,A=h?f:l(e,s,"before"),N=h?c:l(t,s,"after"),O=h&&w&&C?f:y.right):(M=h?l(e,s,"before"):c,A=!h&&b&&x?f:m.right,N=!h&&w&&C?c:y.left,O=h?l(t,s,"after"):f),i(M,m.top,A-M,m.bottom),m.bottom<y.top&&i(c,m.bottom,null,y.top),i(N,y.top,O-N,y.bottom)}(!a||Dn(m,a)<0)&&(a=m),Dn(y,a)<0&&(a=y),(!u||Dn(m,u)<0)&&(u=m),Dn(y,u)<0&&(u=y)}),{start:a,end:u}}var l=e.display,s=e.doc,a=document.createDocumentFragment(),u=Rt(e.display),c=u.left,f=Math.max(l.sizerWidth,Gt(e)-l.sizer.offsetLeft)-u.right,h="ltr"==s.direction,d=t.from(),p=t.to();if(d.line==p.line)o(d.line,d.ch,p.ch);else{var g=M(s,d.line),v=M(s,p.line),m=he(g)==he(v),y=o(d.line,d.ch,m?g.text.length+1:null).end,b=o(p.line,m?0:null,p.ch).start;m&&(y.top<b.top-2?(i(y.right,y.top,null,y.bottom),i(c,b.top,b.left,b.bottom)):i(y.right,y.top,b.left-y.right,y.bottom)),y.bottom<b.top&&i(c,y.bottom,null,b.top)}n.appendChild(a)}function Hn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var n=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Pn(e){e.state.focused||(e.display.input.focus(),zn(e))}function Fn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,En(e))},100)}function zn(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,s(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),Ll&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Hn(e))}function En(e,t){e.state.delayingBlurEvent||(e.state.focused&&(Me(e,"blur",e,t),e.state.focused=!1,Gl(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function In(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],o=void 0;if(!i.hidden){if(Cl&&Sl<8){var l=i.node.offsetTop+i.node.offsetHeight;o=l-n,n=l}else{var s=i.node.getBoundingClientRect();o=s.bottom-s.top}var a=i.line.height-o;if(o<2&&(o=wn(t)),(a>.005||a<-.005)&&(O(i.line,o),Rn(i.line),i.rest))for(var u=0;u<i.rest.length;u++)Rn(i.rest[u])}}}function Rn(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode;r&&(n.height=r.offsetHeight)}}function Bn(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Et(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=W(t,r),l=W(t,i);if(n&&n.ensure){var s=n.ensure.from.line,a=n.ensure.to.line;s<o?(o=s,l=W(t,be(M(t,s))+e.wrapper.clientHeight)):Math.min(a,t.lastLine())>=l&&(o=W(t,be(M(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function Gn(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=Sn(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",l=0;l<n.length;l++)if(!n[l].hidden){e.options.fixedGutter&&(n[l].gutter&&(n[l].gutter.style.left=o),n[l].gutterBackground&&(n[l].gutterBackground.style.left=o));var s=n[l].alignable;if(s)for(var a=0;a<s.length;a++)s[a].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function Un(e){if(!e.options.lineNumbers)return!1;var t=e.doc,n=P(e.options,t.first+t.size-1),i=e.display;if(n.length!=i.lineNumChars){var o=i.measure.appendChild(r("div",[r("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),l=o.firstChild.offsetWidth,s=o.offsetWidth-l;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(l,i.lineGutter.offsetWidth-s)+1,i.lineNumWidth=i.lineNumInnerWidth+s,i.lineNumChars=i.lineNumInnerWidth?n.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",Hr(e),!0}return!1}function jn(e,t){if(!Ae(e,"scrollCursorIntoView")){var n=e.display,i=n.sizer.getBoundingClientRect(),o=null;if(t.top+i.top<0?o=!0:t.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(o=!1),null!=o&&!Ol){var l=r("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Et(e.display))+"px;\n height: "+(t.bottom-t.top+Bt(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(l),l.scrollIntoView(o),e.display.lineSpace.removeChild(l)}}}function Vn(e,t,n,r){var i;null==r&&(r=0),e.options.lineWrapping||t!=n||(t=t.ch?F(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t,n="before"==t.sticky?F(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,s=cn(e,t),a=n&&n!=t?cn(e,n):s;i={left:Math.min(s.left,a.left),top:Math.min(s.top,a.top)-r,right:Math.max(s.left,a.left),bottom:Math.max(s.bottom,a.bottom)+r};var u=Xn(e,i),c=e.doc.scrollTop,f=e.doc.scrollLeft;if(null!=u.scrollTop&&(Jn(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(l=!0)),null!=u.scrollLeft&&(tr(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(l=!0)),!l)break}return i}function Kn(e,t){var n=Xn(e,t);null!=n.scrollTop&&Jn(e,n.scrollTop),null!=n.scrollLeft&&tr(e,n.scrollLeft)}function Xn(e,t){var n=e.display,r=wn(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=Ut(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+It(n),a=t.top<r,u=t.bottom>s-r;if(t.top<i)l.scrollTop=a?0:t.top;else if(t.bottom>i+o){var c=Math.min(t.top,(u?s:t.bottom)-o);c!=i&&(l.scrollTop=c)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,h=Gt(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),d=t.right-t.left>h;return d&&(t.right=t.left+h),t.left<10?l.scrollLeft=0:t.left<f?l.scrollLeft=Math.max(0,t.left-(d?0:10)):t.right>h+f-3&&(l.scrollLeft=t.right+(d?0:10)-h),l}function Yn(e,t){null!=t&&(Zn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function _n(e){Zn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function qn(e,t,n){null==t&&null==n||Zn(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function $n(e,t){Zn(e),e.curOp.scrollToPos=t}function Zn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=fn(e,t.from),r=fn(e,t.to);Qn(e,n,r,t.margin)}}function Qn(e,t,n,r){var i=Xn(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});qn(e,i.scrollLeft,i.scrollTop)}function Jn(e,t){Math.abs(e.doc.scrollTop-t)<2||(yl||Dr(e,{top:t}),er(e,t,!0),yl&&Dr(e),Lr(e,100))}function er(e,t,n){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function tr(e,t,n,r){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,Gn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function nr(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+It(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Bt(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function rr(e,t){t||(t=nr(e));var n=e.display.barWidth,r=e.display.barHeight;ir(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&In(e),ir(e,nr(e)),n=e.display.barWidth,r=e.display.barHeight}function ir(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function or(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&Gl(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new As[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),ls(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,n){"horizontal"==n?tr(e,t):Jn(e,t)},e),e.display.scrollbars.addClass&&s(e.display.wrapper,e.display.scrollbars.addClass)}function lr(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ns},yt(e.curOp)}function sr(e){var t=e.curOp;wt(t,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;ar(e)})}function ar(e){for(var t=e.ops,n=0;n<t.length;n++)ur(t[n]);for(var r=0;r<t.length;r++)cr(t[r]);for(var i=0;i<t.length;i++)fr(t[i]);for(var o=0;o<t.length;o++)hr(t[o]);for(var l=0;l<t.length;l++)dr(t[l])}function ur(e){var t=e.cm,n=t.display;Tr(t),e.updateMaxLine&&xe(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new Os(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function cr(e){e.updatedDisplay=e.mustUpdate&&Nr(e.cm,e.update)}function fr(e){var t=e.cm,n=t.display;e.updatedDisplay&&In(t),e.barMeasure=nr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Xt(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Bt(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Gt(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function hr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&tr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var n=e.focus&&e.focus==l();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&rr(t,e.barMeasure),e.updatedDisplay&&Pr(t,e.barMeasure),e.selectionChanged&&Hn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Pn(e.cm)}function dr(e){var t=e.cm,n=t.display,r=t.doc;if(e.updatedDisplay&&Or(t,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=e.scrollTop&&er(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&tr(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=Vn(t,U(r,e.scrollToPos.from),U(r,e.scrollToPos.to),e.scrollToPos.margin);jn(t,i)}var o=e.maybeHiddenMarkers,l=e.maybeUnhiddenMarkers;if(o)for(var s=0;s<o.length;++s)o[s].lines.length||Me(o[s],"hide");if(l)for(var a=0;a<l.length;++a)l[a].lines.length&&Me(l[a],"unhide");n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&Me(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function pr(e,t){if(e.curOp)return t();lr(e);try{return t()}finally{sr(e)}}function gr(e,t){return function(){if(e.curOp)return t.apply(e,arguments);lr(e);try{return t.apply(e,arguments)}finally{sr(e)}}}function vr(e){return function(){if(this.curOp)return e.apply(this,arguments);lr(this);try{return e.apply(this,arguments)}finally{sr(this)}}}function mr(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);lr(t);try{return e.apply(this,arguments)}finally{sr(t)}}}function yr(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)ns&&ge(e.doc,t)<i.viewTo&&wr(e);else if(n<=i.viewFrom)ns&&ve(e.doc,n+r)>i.viewFrom?wr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)wr(e);else if(t<=i.viewFrom){var o=xr(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):wr(e)}else if(n>=i.viewTo){var l=xr(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):wr(e)}else{var s=xr(e,t,t,-1),a=xr(e,n,n+r,1);s&&a?(i.view=i.view.slice(0,s.index).concat(mt(e,s.lineN,a.lineN)).concat(i.view.slice(a.index)),i.viewTo+=r):wr(e)}var u=i.externalMeasured;u&&(n<u.lineN?u.lineN+=r:t<u.lineN+u.size&&(i.externalMeasured=null))}function br(e,t,n){e.curOp.viewChanged=!0;var r=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[Mn(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==h(l,n)&&l.push(n)}}}function wr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function xr(e,t,n,r){var i,o=Mn(e,t),l=e.display.view;if(!ns||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var s=e.display.viewFrom,a=0;a<o;a++)s+=l[a].size;if(s!=t){if(r>0){if(o==l.length-1)return null;i=s+l[o].size-t,o++}else i=s-t;t+=i,n+=i}for(;ge(e.doc,n)!=n;){if(o==(r<0?0:l.length-1))return null;n+=r*l[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function Cr(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=mt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=mt(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(Mn(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(mt(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,Mn(e,n)))),r.viewTo=n}function Sr(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r];i.hidden||i.node&&!i.changes||++n}return n}function Lr(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,u(kr,e))}function kr(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=Ze(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(r.line>=e.display.viewFrom){var l=o.styles,s=o.text.length>e.options.maxHighlightLength?Xe(t.mode,r.state):null,a=qe(e,o,r,!0);s&&(r.state=s),o.styles=a.styles;var u=o.styleClasses,c=a.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var f=!l||l.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),h=0;!f&&h<l.length;++h)f=l[h]!=o.styles[h];f&&i.push(r.line),o.stateAfter=r.save(),r.nextLine()}else o.text.length<=e.options.maxHighlightLength&&Qe(e,o.text,r),o.stateAfter=r.line%5==0?r.save():null,r.nextLine();if(+new Date>n)return Lr(e,e.options.workDelay),!0}),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&pr(e,function(){for(var t=0;t<i.length;t++)br(e,i[t],"text")})}}function Tr(e){var t=e.display;!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Bt(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Bt(e)+"px",t.scrollbarsClipped=!0)}function Mr(e){if(e.hasFocus())return null;var t=l();if(!t||!o(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&o(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}function Ar(e){if(e&&e.activeElt&&e.activeElt!=l()&&(e.activeElt.focus(),e.anchorNode&&o(document.body,e.anchorNode)&&o(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}function Nr(e,n){var r=e.display,i=e.doc;if(n.editorIsHidden)return wr(e),!1;if(!n.force&&n.visible.from>=r.viewFrom&&n.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Sr(e))return!1;Un(e)&&(wr(e),n.dims=Cn(e));var o=i.first+i.size,l=Math.max(n.visible.from-e.options.viewportMargin,i.first),s=Math.min(o,n.visible.to+e.options.viewportMargin);r.viewFrom<l&&l-r.viewFrom<20&&(l=Math.max(i.first,r.viewFrom)),r.viewTo>s&&r.viewTo-s<20&&(s=Math.min(o,r.viewTo)),ns&&(l=ge(e.doc,l),s=ve(e.doc,s));var a=l!=r.viewFrom||s!=r.viewTo||r.lastWrapHeight!=n.wrapperHeight||r.lastWrapWidth!=n.wrapperWidth;Cr(e,l,s),r.viewOffset=be(M(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var u=Sr(e);if(!a&&0==u&&!n.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=Mr(e);return u>4&&(r.lineDiv.style.display="none"),Wr(e,r.updateLineNumbers,n.dims),u>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,Ar(c),t(r.cursorDiv),t(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,a&&(r.lastWrapHeight=n.wrapperHeight,r.lastWrapWidth=n.wrapperWidth,Lr(e,400)),r.updateLineNumbers=null,!0}function Or(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Gt(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+It(e.display)-Ut(e),n.top)}),t.visible=Bn(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&Nr(e,t);r=!1){In(e);var i=nr(e);An(e),rr(e,i),Pr(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 Dr(e,t){var n=new Os(e,t);if(Nr(e,n)){In(e),Or(e,n);var r=nr(e);An(e),rr(e,r),Pr(e,r),n.finish()}}function Wr(e,n,r){function i(t){var n=t.nextSibling;return Ll&&Pl&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var o=e.display,l=e.options.lineNumbers,s=o.lineDiv,a=s.firstChild,u=o.view,c=o.viewFrom,f=0;f<u.length;f++){var d=u[f];if(d.hidden);else if(d.node&&d.node.parentNode==s){for(;a!=d.node;)a=i(a);var p=l&&null!=n&&n<=c&&d.lineNumber;d.changes&&(h(d.changes,"gutter")>-1&&(p=!1),St(e,d,c,r)),p&&(t(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(P(e.options,c)))),a=d.node.nextSibling}else{var g=Dt(e,d,c,r);s.insertBefore(g,a)}c+=d.size}for(;a;)a=i(a)}function Hr(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function Pr(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+Bt(e)+"px"}function Fr(e){var n=e.display.gutters,i=e.options.gutters;t(n);for(var o=0;o<i.length;++o){var l=i[o],s=n.appendChild(r("div",null,"CodeMirror-gutter "+l));"CodeMirror-linenumbers"==l&&(e.display.lineGutter=s,s.style.width=(e.display.lineNumWidth||1)+"px")}n.style.display=o?"":"none",Hr(e)}function zr(e){var t=h(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function Er(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function Ir(e){var t=Er(e);return t.x*=Ws,t.y*=Ws,t}function Rr(e,t){var n=Er(t),r=n.x,i=n.y,o=e.display,l=o.scroller,s=l.scrollWidth>l.clientWidth,a=l.scrollHeight>l.clientHeight;if(r&&s||i&&a){if(i&&Pl&&Ll)e:for(var u=t.target,c=o.view;u!=l;u=u.parentNode)for(var f=0;f<c.length;f++)if(c[f].node==u){e.display.currentWheelTarget=u;break e}if(r&&!yl&&!Ml&&null!=Ws)return i&&a&&Jn(e,Math.max(0,l.scrollTop+i*Ws)),tr(e,Math.max(0,l.scrollLeft+r*Ws)),(!i||i&&a)&&We(t),void(o.wheelStartX=null);if(i&&null!=Ws){var h=i*Ws,d=e.doc.scrollTop,p=d+o.wrapper.clientHeight;h<0?d=Math.max(0,d+h-50):p=Math.min(e.doc.height,p+h+50),Dr(e,{top:d,bottom:p})}Ds<20&&(null==o.wheelStartX?(o.wheelStartX=l.scrollLeft,o.wheelStartY=l.scrollTop,o.wheelDX=r,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=l.scrollLeft-o.wheelStartX,t=l.scrollTop-o.wheelStartY,n=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,n&&(Ws=(Ws*Ds+n)/(Ds+1),++Ds)}},200)):(o.wheelDX+=r,o.wheelDY+=i))}}function Br(e,t){var n=e[t];e.sort(function(e,t){return z(e.from(),t.from())}),t=h(e,n);for(var r=1;r<e.length;r++){var i=e[r],o=e[r-1];if(z(o.to(),i.from())>=0){var l=B(o.from(),i.from()),s=R(o.to(),i.to()),a=o.empty()?i.from()==i.head:o.from()==o.head;r<=t&&--t,e.splice(--r,2,new Ps(a?s:l,a?l:s))}}return new Hs(e,t)}function Gr(e,t){return new Hs([new Ps(e,t||e)],0)}function Ur(e){return e.text?F(e.from.line+e.text.length-1,g(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function jr(e,t){if(z(e,t.from)<0)return e;if(z(e,t.to)<=0)return Ur(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Ur(t).ch-t.to.ch),F(n,r)}function Vr(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r];n.push(new Ps(jr(i.anchor,t),jr(i.head,t)))}return Br(n,e.sel.primIndex)}function Kr(e,t,n){return e.line==t.line?F(n.line,e.ch-t.ch+n.ch):F(n.line+(e.line-t.line),e.ch)}function Xr(e,t,n){for(var r=[],i=F(e.first,0),o=i,l=0;l<t.length;l++){var s=t[l],a=Kr(s.from,i,o),u=Kr(Ur(s),i,o);if(i=s.to,o=u,"around"==n){var c=e.sel.ranges[l],f=z(c.head,c.anchor)<0;r[l]=new Ps(f?u:a,f?a:u)}else r[l]=new Ps(a,a)} return new Hs(r,e.sel.primIndex)}function Yr(e){e.doc.mode=Ve(e.options,e.doc.modeOption),_r(e)}function _r(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,Lr(e,100),e.state.modeGen++,e.curOp&&yr(e)}function qr(e,t){return 0==t.from.ch&&0==t.to.ch&&""==g(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function $r(e,t,n,r){function i(e){return n?n[e]:null}function o(e,n,i){lt(e,n,i,r),xt(e,"change",e,t)}function l(e,t){for(var n=[],o=e;o<t;++o)n.push(new bs(u[o],i(o),r));return n}var s=t.from,a=t.to,u=t.text,c=M(e,s.line),f=M(e,a.line),h=g(u),d=i(u.length-1),p=a.line-s.line;if(t.full)e.insert(0,l(0,u.length)),e.remove(u.length,e.size-u.length);else if(qr(e,t)){var v=l(0,u.length-1);o(f,f.text,d),p&&e.remove(s.line,p),v.length&&e.insert(s.line,v)}else if(c==f)if(1==u.length)o(c,c.text.slice(0,s.ch)+h+c.text.slice(a.ch),d);else{var m=l(1,u.length-1);m.push(new bs(h+c.text.slice(a.ch),d,r)),o(c,c.text.slice(0,s.ch)+u[0],i(0)),e.insert(s.line+1,m)}else if(1==u.length)o(c,c.text.slice(0,s.ch)+u[0]+f.text.slice(a.ch),i(0)),e.remove(s.line+1,p);else{o(c,c.text.slice(0,s.ch)+u[0],i(0)),o(f,h+f.text.slice(a.ch),d);var y=l(1,u.length-1);p>1&&e.remove(s.line+1,p-1),e.insert(s.line+1,y)}xt(e,"change",e,t)}function Zr(e,t,n){function r(e,i,o){if(e.linked)for(var l=0;l<e.linked.length;++l){var s=e.linked[l];if(s.doc!=i){var a=o&&s.sharedHist;n&&!a||(t(s.doc,a),r(s.doc,e,a))}}}r(e,null,!0)}function Qr(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,kn(e),Yr(e),Jr(e),e.options.lineWrapping||xe(e),e.options.mode=t.modeOption,yr(e)}function Jr(e){("rtl"==e.doc.direction?s:Gl)(e.display.lineDiv,"CodeMirror-rtl")}function ei(e){pr(e,function(){Jr(e),yr(e)})}function ti(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 ni(e,t){var n={from:I(t.from),to:Ur(t),text:A(e,t.from,t.to)};return ui(e,n,t.from.line,t.to.line+1),Zr(e,function(e){return ui(e,n,t.from.line,t.to.line+1)},!0),n}function ri(e){for(;e.length;){var t=g(e);if(!t.ranges)break;e.pop()}}function ii(e,t){return t?(ri(e.done),g(e.done)):e.done.length&&!g(e.done).ranges?g(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),g(e.done)):void 0}function oi(e,t,n,r){var i=e.history;i.undone.length=0;var o,l,s=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>s-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=ii(i,i.lastOp==r)))l=g(o.changes),0==z(t.from,t.to)&&0==z(t.from,l.to)?l.to=Ur(t):o.changes.push(ni(e,t));else{var a=g(i.done);for(a&&a.ranges||ai(e.sel,i.done),o={changes:[ni(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=s,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||Me(e,"historyAdded")}function li(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function si(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||li(e,o,g(i.done),t))?i.done[i.done.length-1]=t:ai(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&ri(i.undone)}function ai(e,t){var n=g(t);n&&n.ranges&&n.equals(e)||t.push(e)}function ui(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function ci(e){if(!e)return null;for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n]);return t?t.length?t:null:e}function fi(e,t){var n=t["spans_"+e.id];if(!n)return null;for(var r=[],i=0;i<t.text.length;++i)r.push(ci(n[i]));return r}function hi(e,t){var n=fi(e,t),r=J(e,t);if(!n)return r;if(!r)return n;for(var i=0;i<n.length;++i){var o=n[i],l=r[i];if(o&&l)e:for(var s=0;s<l.length;++s){for(var a=l[s],u=0;u<o.length;++u)if(o[u].marker==a.marker)continue e;o.push(a)}else l&&(n[i]=l)}return n}function di(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)r.push(n?Hs.prototype.deepCopy.call(o):o);else{var l=o.changes,s=[];r.push({changes:s});for(var a=0;a<l.length;++a){var u=l[a],c=void 0;if(s.push({from:u.from,to:u.to,text:u.text}),t)for(var f in u)(c=f.match(/^spans_(\d+)$/))&&h(t,Number(c[1]))>-1&&(g(s)[f]=u[f],delete u[f])}}}return r}function pi(e,t,n,r){if(r){var i=e.anchor;if(n){var o=z(t,i)<0;o!=z(n,i)<0?(i=t,t=n):o!=z(t,n)<0&&(t=n)}return new Ps(i,t)}return new Ps(n||t,t)}function gi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),xi(e,new Hs([pi(e.sel.primary(),t,n,i)],0),r)}function vi(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)r[o]=pi(e.sel.ranges[o],t[o],null,i);var l=Br(r,e.sel.primIndex);xi(e,l,n)}function mi(e,t,n,r){var i=e.sel.ranges.slice(0);i[t]=n,xi(e,Br(i,e.sel.primIndex),r)}function yi(e,t,n,r){xi(e,Gr(t,n),r)}function bi(e,t,n){var r={ranges:t.ranges,update:function(t){var n=this;this.ranges=[];for(var r=0;r<t.length;r++)n.ranges[r]=new Ps(U(e,t[r].anchor),U(e,t[r].head))},origin:n&&n.origin};return Me(e,"beforeSelectionChange",e,r),e.cm&&Me(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Br(r.ranges,r.ranges.length-1):t}function wi(e,t,n){var r=e.history.done,i=g(r);i&&i.ranges?(r[r.length-1]=t,Ci(e,t,n)):xi(e,t,n)}function xi(e,t,n){Ci(e,t,n),si(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Ci(e,t,n){(Oe(e,"beforeSelectionChange")||e.cm&&Oe(e.cm,"beforeSelectionChange"))&&(t=bi(e,t,n));var r=n&&n.bias||(z(t.primary().head,e.sel.primary().head)<0?-1:1);Si(e,ki(e,t,r,!0)),n&&!1===n.scroll||!e.cm||_n(e.cm)}function Si(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,Ne(e.cm)),xt(e,"cursorActivity",e))}function Li(e){Si(e,ki(e,e.sel,null,!1))}function ki(e,t,n,r){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],a=Mi(e,l.anchor,s&&s.anchor,n,r),u=Mi(e,l.head,s&&s.head,n,r);(i||a!=l.anchor||u!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new Ps(a,u))}return i?Br(i,t.primIndex):t}function Ti(e,t,n,r,i){var o=M(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var s=o.markedSpans[l],a=s.marker;if((null==s.from||(a.inclusiveLeft?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(a.inclusiveRight?s.to>=t.ch:s.to>t.ch))){if(i&&(Me(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!a.atomic)continue;if(n){var u=a.find(r<0?1:-1),c=void 0;if((r<0?a.inclusiveRight:a.inclusiveLeft)&&(u=Ai(e,u,-r,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=z(u,n))&&(r<0?c<0:c>0))return Ti(e,u,t,r,i)}var f=a.find(r<0?-1:1);return(r<0?a.inclusiveLeft:a.inclusiveRight)&&(f=Ai(e,f,r,f.line==t.line?o:null)),f?Ti(e,f,t,r,i):null}}return t}function Mi(e,t,n,r,i){var o=r||1,l=Ti(e,t,n,o,i)||!i&&Ti(e,t,n,o,!0)||Ti(e,t,n,-o,i)||!i&&Ti(e,t,n,-o,!0);return l||(e.cantEdit=!0,F(e.first,0))}function Ai(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?U(e,F(t.line-1)):null:n>0&&t.ch==(r||M(e,t.line)).text.length?t.line<e.first+e.size-1?F(t.line+1,0):null:new F(t.line,t.ch+n)}function Ni(e){e.setSelection(F(e.firstLine(),0),F(e.lastLine()),ql)}function Oi(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}};return n&&(r.update=function(t,n,i,o){t&&(r.from=U(e,t)),n&&(r.to=U(e,n)),i&&(r.text=i),void 0!==o&&(r.origin=o)}),Me(e,"beforeChange",e,r),e.cm&&Me(e.cm,"beforeChange",e.cm,r),r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Di(e,t,n){if(e.cm){if(!e.cm.curOp)return gr(e.cm,Di)(e,t,n);if(e.cm.state.suppressEdits)return}if(!(Oe(e,"beforeChange")||e.cm&&Oe(e.cm,"beforeChange"))||(t=Oi(e,t,!0),t)){var r=ts&&!n&&te(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)Wi(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else Wi(e,t)}}function Wi(e,t){if(1!=t.text.length||""!=t.text[0]||0!=z(t.from,t.to)){var n=Vr(e,t);oi(e,t,n,e.cm?e.cm.curOp.id:NaN),Fi(e,t,n,J(e,t));var r=[];Zr(e,function(e,n){n||-1!=h(r,e.history)||(Bi(e.history,t),r.push(e.history)),Fi(e,t,null,J(e,t))})}}function Hi(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!r||n){for(var i,o=e.history,l=e.sel,s="undo"==t?o.done:o.undone,a="undo"==t?o.undone:o.done,u=0;u<s.length&&(i=s[u],n?!i.ranges||i.equals(e.sel):i.ranges);u++);if(u!=s.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(i=s.pop(),!i.ranges){if(r)return void s.push(i);break}if(ai(i,a),n&&!i.equals(e.sel))return void xi(e,i,{clearRedo:!1});l=i}var c=[];ai(l,a),a.push({changes:c,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var f=Oe(e,"beforeChange")||e.cm&&Oe(e.cm,"beforeChange"),d=function(n){var r=i.changes[n];if(r.origin=t,f&&!Oi(e,r,!1))return s.length=0,{};c.push(ni(e,r));var o=n?Vr(e,r):g(s);Fi(e,r,o,hi(e,r)),!n&&e.cm&&e.cm.scrollIntoView({from:r.from,to:Ur(r)});var l=[];Zr(e,function(e,t){t||-1!=h(l,e.history)||(Bi(e.history,r),l.push(e.history)),Fi(e,r,null,hi(e,r))})},p=i.changes.length-1;p>=0;--p){var v=d(p);if(v)return v.v}}}}function Pi(e,t){if(0!=t&&(e.first+=t,e.sel=new Hs(v(e.sel.ranges,function(e){return new Ps(F(e.anchor.line+t,e.anchor.ch),F(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){yr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)br(e.cm,r,"gutter")}}function Fi(e,t,n,r){if(e.cm&&!e.cm.curOp)return gr(e.cm,Fi)(e,t,n,r);if(t.to.line<e.first)Pi(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);Pi(e,i),t={from:F(e.first,0),to:F(t.to.line+i,t.to.ch),text:[g(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:F(o,M(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=A(e,t.from,t.to),n||(n=Vr(e,t)),e.cm?zi(e.cm,t,r):$r(e,t,r),Ci(e,n,ql)}}function zi(e,t,n){var r=e.doc,i=e.display,o=t.from,l=t.to,s=!1,a=o.line;e.options.lineWrapping||(a=D(he(M(r,o.line))),r.iter(a,l.line+1,function(e){if(e==i.maxLine)return s=!0,!0})),r.sel.contains(t.from,t.to)>-1&&Ne(e),$r(r,t,n,Ln(e)),e.options.lineWrapping||(r.iter(a,o.line+t.text.length,function(e){var t=we(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),ot(r,o.line),Lr(e,400);var u=t.text.length-(l.line-o.line)-1;t.full?yr(e):o.line!=l.line||1!=t.text.length||qr(e.doc,t)?yr(e,o.line,l.line+1,u):br(e,o.line,"text");var c=Oe(e,"changes"),f=Oe(e,"change");if(f||c){var h={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};f&&xt(e,"change",e,h),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function Ei(e,t,n,r,i){var o;(r||(r=n),z(r,n)<0)&&(o=[r,n],n=o[0],r=o[1]);"string"==typeof t&&(t=e.splitLines(t)),Di(e,{from:n,to:r,text:t,origin:i})}function Ii(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Ri(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||(o=e[i]=o.deepCopy(),o.copied=!0);for(var s=0;s<o.ranges.length;s++)Ii(o.ranges[s].anchor,t,n,r),Ii(o.ranges[s].head,t,n,r)}else{for(var a=0;a<o.changes.length;++a){var u=o.changes[a];if(n<u.from.line)u.from=F(u.from.line+r,u.from.ch),u.to=F(u.to.line+r,u.to.ch);else if(t<=u.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function Bi(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1;Ri(e.done,n,r,i),Ri(e.undone,n,r,i)}function Gi(e,t,n,r){var i=t,o=t;return"number"==typeof t?o=M(e,G(e,t)):i=D(t),null==i?null:(r(o,i)&&e.cm&&br(e.cm,i,n),o)}function Ui(e){var t=this;this.lines=e,this.parent=null;for(var n=0,r=0;r<e.length;++r)e[r].parent=t,n+=e[r].height;this.height=n}function ji(e){var t=this;this.children=e;for(var n=0,r=0,i=0;i<e.length;++i){var o=e[i];n+=o.chunkSize(),r+=o.height,o.parent=t}this.size=n,this.height=r,this.parent=null}function Vi(e,t,n){be(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Yn(e,n)}function Ki(e,t,n,r){var i=new Fs(e,n,r),o=e.cm;return o&&i.noHScroll&&(o.display.alignWidgets=!0),Gi(e,t,"widget",function(t){var n=t.widgets||(t.widgets=[]);if(null==i.insertAt?n.push(i):n.splice(Math.min(n.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!me(e,t)){var r=be(t)<e.scrollTop;O(t,t.height+Ft(i)),r&&Yn(o,i.height),o.curOp.forceUpdate=!0}return!0}),o&&xt(o,"lineWidgetAdded",o,i,"number"==typeof t?t:D(t)),i}function Xi(e,t,n,r,o){if(r&&r.shared)return Yi(e,t,n,r,o);if(e.cm&&!e.cm.curOp)return gr(e.cm,Xi)(e,t,n,r,o);var l=new Es(e,o),s=z(t,n);if(r&&c(r,l,!1),s>0||0==s&&!1!==l.clearWhenEmpty)return l;if(l.replacedWith&&(l.collapsed=!0,l.widgetNode=i("span",[l.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||l.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(l.widgetNode.insertLeft=!0)),l.collapsed){if(fe(e,t.line,t,n,l)||t.line!=n.line&&fe(e,n.line,t,n,l))throw new Error("Inserting collapsed marker partially overlapping an existing one");X()}l.addToHistory&&oi(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var a,u=t.line,f=e.cm;if(e.iter(u,n.line+1,function(e){f&&l.collapsed&&!f.options.lineWrapping&&he(e)==f.display.maxLine&&(a=!0),l.collapsed&&u!=t.line&&O(e,0),$(e,new Y(l,u==t.line?t.ch:null,u==n.line?n.ch:null)),++u}),l.collapsed&&e.iter(t.line,n.line+1,function(t){me(e,t)&&O(t,0)}),l.clearOnEnter&&ls(l,"beforeCursorEnter",function(){return l.clear()}),l.readOnly&&(K(),(e.history.done.length||e.history.undone.length)&&e.clearHistory()),l.collapsed&&(l.id=++zs,l.atomic=!0),f){if(a&&(f.curOp.updateMaxLine=!0),l.collapsed)yr(f,t.line,n.line+1);else if(l.className||l.title||l.startStyle||l.endStyle||l.css)for(var h=t.line;h<=n.line;h++)br(f,h,"text");l.atomic&&Li(f.doc),xt(f,"markerAdded",f,l)}return l}function Yi(e,t,n,r,i){r=c(r),r.shared=!1;var o=[Xi(e,t,n,r,i)],l=o[0],s=r.widgetNode;return Zr(e,function(e){s&&(r.widgetNode=s.cloneNode(!0)),o.push(Xi(e,U(e,t),U(e,n),r,i));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;l=g(o)}),new Is(o,l)}function _i(e){return e.findMarks(F(e.first,0),e.clipPos(F(e.lastLine())),function(e){return e.parent})}function qi(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),o=e.clipPos(i.from),l=e.clipPos(i.to);if(z(o,l)){var s=Xi(e,o,l,r.primary,r.primary.type);r.markers.push(s),s.parent=r}}}function $i(e){for(var t=function(t){var n=e[t],r=[n.primary.doc];Zr(n.primary.doc,function(e){return r.push(e)});for(var i=0;i<n.markers.length;i++){var o=n.markers[i];-1==h(r,o.doc)&&(o.parent=null,n.markers.splice(i--,1))}},n=0;n<e.length;n++)t(n)}function Zi(e){var t=this;if(eo(t),!Ae(t,e)&&!zt(t.display,e)){We(e),Cl&&(Gs=+new Date);var n=Tn(t,e,!0),r=e.dataTransfer.files;if(n&&!t.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),l=0,s=function(e,r){if(!t.options.allowDropFileTypes||-1!=h(t.options.allowDropFileTypes,e.type)){var s=new FileReader;s.onload=gr(t,function(){var e=s.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[r]=e,++l==i){n=U(t.doc,n);var a={from:n,to:n,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Di(t.doc,a),wi(t.doc,Gr(n,Ur(a)))}}),s.readAsText(e)}},a=0;a<i;++a)s(r[a],a);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var u=e.dataTransfer.getData("Text");if(u){var c;if(t.state.draggingText&&!t.state.draggingText.copy&&(c=t.listSelections()),Ci(t.doc,Gr(n,n)),c)for(var f=0;f<c.length;++f)Ei(t.doc,"",c[f].anchor,c[f].head,"drag");t.replaceSelection(u,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Qi(e,t){if(Cl&&(!e.state.draggingText||+new Date-Gs<100))Fe(t);else if(!Ae(e,t)&&!zt(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!Al)){var n=r("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",Ml&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),Ml&&n.parentNode.removeChild(n)}}function Ji(e,t){var i=Tn(e,t);if(i){var o=document.createDocumentFragment();On(e,i,o),e.display.dragCursor||(e.display.dragCursor=r("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),n(e.display.dragCursor,o)}}function eo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function to(e){if(document.getElementsByClassName)for(var t=document.getElementsByClassName("CodeMirror"),n=0;n<t.length;n++){var r=t[n].CodeMirror;r&&e(r)}}function no(){Us||(ro(),Us=!0)}function ro(){var e;ls(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,to(io)},100))}),ls(window,"blur",function(){return to(En)})}function io(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}function oo(e){var t,n,r,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var l=0;l<o.length-1;l++){var s=o[l];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function lo(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete e[n];continue}for(var i=v(n.split(" "),oo),o=0;o<i.length;o++){var l=void 0,s=void 0;o==i.length-1?(s=i.join(" "),l=r):(s=i.slice(0,o+1).join(" "),l="...");var a=t[s];if(a){if(a!=l)throw new Error("Inconsistent bindings for "+s)}else t[s]=l}delete e[n]}for(var u in t)e[u]=t[u];return e}function so(e,t,n,r){t=fo(t);var i=t.call?t.call(e,r):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&n(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return so(e,t.fallthrough,n,r);for(var o=0;o<t.fallthrough.length;o++){var l=so(e,t.fallthrough[o],n,r);if(l)return l}}}function ao(e){var t="string"==typeof e?e:js[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function uo(e,t,n){var r=e;return t.altKey&&"Alt"!=r&&(e="Alt-"+e),(Rl?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(e="Ctrl-"+e),(Rl?t.ctrlKey:t.metaKey)&&"Cmd"!=r&&(e="Cmd-"+e),!n&&t.shiftKey&&"Shift"!=r&&(e="Shift-"+e),e}function co(e,t){if(Ml&&34==e.keyCode&&e.char)return!1;var n=js[e.keyCode];return null!=n&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(n=e.code),uo(n,e,t))}function fo(e){return"string"==typeof e?Ys[e]:e}function ho(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=t(n[i]);r.length&&z(o.from,g(r).to)<=0;){var l=r.pop();if(z(l.from,o.from)<0){o.from=l.from;break}}r.push(o)}pr(e,function(){for(var t=r.length-1;t>=0;t--)Ei(e.doc,"",r[t].from,r[t].to,"+delete");_n(e)})}function po(e,t,n){var r=L(e.text,t+n,n);return r<0||r>e.text.length?null:r}function go(e,t,n){var r=po(e,t.ch,n);return null==r?null:new F(t.line,r,n<0?"after":"before")}function vo(e,t,n,r,i){if(e){var o=Le(n,t.doc.direction);if(o){var l,s=i<0?g(o):o[0],a=i<0==(1==s.level),u=a?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var c=_t(t,n);l=i<0?n.text.length-1:0;var f=qt(t,c,l).top;l=k(function(e){return qt(t,c,e).top==f},i<0==(1==s.level)?s.from:s.to-1,l),"before"==u&&(l=po(n,l,1))}else l=i<0?s.to:s.from;return new F(r,l,u)}}return new F(r,i<0?n.text.length:0,i<0?"before":"after")}function mo(e,t,n,r){var i=Le(t,e.doc.direction);if(!i)return go(t,n,r);n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=Se(i,n.ch,n.sticky),l=i[o];if("ltr"==e.doc.direction&&l.level%2==0&&(r>0?l.to>n.ch:l.from<n.ch))return go(t,n,r);var s,a=function(e,n){return po(t,e instanceof F?e.ch:e,n)},u=function(n){return e.options.lineWrapping?(s=s||_t(e,t),gn(e,t,s,n)):{begin:0,end:t.text.length}},c=u("before"==n.sticky?a(n,-1):n.ch);if("rtl"==e.doc.direction||1==l.level){var f=1==l.level==r<0,h=a(n,f?1:-1);if(null!=h&&(f?h<=l.to&&h<=c.end:h>=l.from&&h>=c.begin)){var d=f?"before":"after";return new F(n.line,h,d)}}var p=function(e,t,r){for(var o=function(e,t){return t?new F(n.line,a(e,1),"before"):new F(n.line,e,"after")};e>=0&&e<i.length;e+=t){var l=i[e],s=t>0==(1!=l.level),u=s?r.begin:a(r.end,-1);if(l.from<=u&&u<l.to)return o(u,s);if(u=s?l.from:a(l.to,-1),r.begin<=u&&u<r.end)return o(u,s)}},g=p(o+r,r,c);if(g)return g;var v=r>0?c.end:a(c.begin,-1);return null==v||r>0&&v==t.text.length||(g=p(r>0?0:i.length-1,r,u(v)),!g)?null:g}function yo(e,t){var n=M(e.doc,t),r=he(n);return r!=n&&(t=D(r)),vo(!0,e,r,t,1)}function bo(e,t){var n=M(e.doc,t),r=de(n);return r!=n&&(t=D(r)),vo(!0,e,n,t,-1)}function wo(e,t){var n=yo(e,t.line),r=M(e.doc,n.line),i=Le(r,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),l=t.line==n.line&&t.ch<=o&&t.ch;return F(n.line,l?0:o,n.sticky)}return n}function xo(e,t,n){if("string"==typeof t&&(t=$s[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=_l}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function Co(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=so(t,e.state.keyMaps[r],n,e);if(i)return i}return e.options.extraKeys&&so(t,e.options.extraKeys,n,e)||so(t,e.options.keyMap,n,e)}function So(e,t,n,r){var i=e.state.keySeq;if(i){if(ao(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Zs.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),Lo(e,i+" "+t,n,r))return!0}return Lo(e,t,n,r)}function Lo(e,t,n,r){var i=Co(e,t,r);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&xt(e,"keyHandled",e,t,n),"handled"!=i&&"multi"!=i||(We(n),Hn(e)),!!i}function ko(e,t){var n=co(t,!0);return!!n&&(t.shiftKey&&!e.state.keySeq?So(e,"Shift-"+n,t,function(t){return xo(e,t,!0)})||So(e,n,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return xo(e,t)}):So(e,n,t,function(t){return xo(e,t)}))}function To(e,t,n){return So(e,"'"+n+"'",t,function(t){return xo(e,t,!0)})}function Mo(e){var t=this;if(t.curOp.focus=l(),!Ae(t,e)){Cl&&Sl<11&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var r=ko(t,e);Ml&&(Qs=r?n:null,!r&&88==n&&!cs&&(Pl?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||Ao(t)}}function Ao(e){function t(e){18!=e.keyCode&&e.altKey||(Gl(n,"CodeMirror-crosshair"),Te(document,"keyup",t),Te(document,"mouseover",t))}var n=e.display.lineDiv;s(n,"CodeMirror-crosshair"),ls(document,"keyup",t),ls(document,"mouseover",t)}function No(e){16==e.keyCode&&(this.doc.sel.shift=!1),Ae(this,e)}function Oo(e){var t=this;if(!(zt(t.display,e)||Ae(t,e)||e.ctrlKey&&!e.altKey||Pl&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(Ml&&n==Qs)return Qs=null,void We(e);if(!Ml||e.which&&!(e.which<10)||!ko(t,e)){var i=String.fromCharCode(null==r?n:r);"\b"!=i&&(To(t,e,i)||t.display.input.onKeyPress(e))}}}function Do(e,t){var n=+new Date;return qs&&qs.compare(n,e,t)?(_s=qs=null,"triple"):_s&&_s.compare(n,e,t)?(qs=new ea(n,e,t),_s=null,"double"):(_s=new ea(n,e,t),qs=null,"single")}function Wo(e){var t=this,n=t.display;if(!(Ae(t,e)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=e.shiftKey,zt(n,e))Ll||(n.scroller.draggable=!1,setTimeout(function(){return n.scroller.draggable=!0},100));else{var r=Ee(e);if(3==r&&Bl?!jo(t,e):!Go(t,e)){var i=Tn(t,e),o=i?Do(i,r):"single";window.focus(),1==r&&t.state.selectingText&&t.state.selectingText(e),i&&Ho(t,r,i,o,e)||(1==r?i?Fo(t,i,o,e):ze(e)==n.scroller&&We(e):2==r?(i&&gi(t.doc,i),setTimeout(function(){return n.input.focus()},20)):3==r&&(Bl?Uo(t,e):Fn(t)))}}}function Ho(e,t,n,r,i){var o="Click";return"double"==r?o="Double"+o:"triple"==r&&(o="Triple"+o),o=(1==t?"Left":2==t?"Middle":"Right")+o,So(e,uo(o,i),i,function(t){if("string"==typeof t&&(t=$s[t]),!t)return!1;var r=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r=t(e,n)!=_l}finally{e.state.suppressEdits=!1}return r})}function Po(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{};if(null==i.unit){var o=Fl?n.shiftKey&&n.metaKey:n.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),null==i.addNew&&(i.addNew=Pl?n.metaKey:n.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(Pl?n.altKey:n.ctrlKey)),i}function Fo(e,t,n,r){Cl?setTimeout(u(Pn,e),0):e.curOp.focus=l();var i,o=Po(e,n,r),s=e.doc.sel;e.options.dragDrop&&ss&&!e.isReadOnly()&&"single"==n&&(i=s.contains(t))>-1&&(z((i=s.ranges[i]).from(),t)<0||t.xRel>0)&&(z(i.to(),t)>0||t.xRel<0)?zo(e,r,t,o):Io(e,r,t,o)}function zo(e,t,n,r){var i=e.display,o=!1,l=gr(e,function(t){Ll&&(i.scroller.draggable=!1),e.state.draggingText=!1,Te(i.wrapper.ownerDocument,"mouseup",l),Te(i.wrapper.ownerDocument,"mousemove",s),Te(i.scroller,"dragstart",a),Te(i.scroller,"drop",l),o||(We(t),r.addNew||gi(e.doc,n,null,null,r.extend),Ll||Cl&&9==Sl?setTimeout(function(){i.wrapper.ownerDocument.body.focus(),i.input.focus()},20):i.input.focus())}),s=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},a=function(){return o=!0};Ll&&(i.scroller.draggable=!0),e.state.draggingText=l,l.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),ls(i.wrapper.ownerDocument,"mouseup",l),ls(i.wrapper.ownerDocument,"mousemove",s),ls(i.scroller,"dragstart",a),ls(i.scroller,"drop",l),Fn(e),setTimeout(function(){return i.input.focus()},20)}function Eo(e,t,n){if("char"==n)return new Ps(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new Ps(F(t.line,0),U(e.doc,F(t.line+1,0)));var r=n(e,t);return new Ps(r.from,r.to)}function Io(e,t,n,r){function i(t){if(0!=z(m,t))if(m=t,"rectangle"==r.unit){for(var i=[],o=e.options.tabSize,l=f(M(u,n.line).text,n.ch,o),s=f(M(u,t.line).text,t.ch,o),a=Math.min(l,s),g=Math.max(l,s),v=Math.min(n.line,t.line),y=Math.min(e.lastLine(),Math.max(n.line,t.line));v<=y;v++){var b=M(u,v).text,w=d(b,a,o);a==g?i.push(new Ps(F(v,w),F(v,w))):b.length>w&&i.push(new Ps(F(v,w),F(v,d(b,g,o))))}i.length||i.push(new Ps(n,n)),xi(u,Br(p.ranges.slice(0,h).concat(i),h),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var x,C=c,S=Eo(e,t,r.unit),L=C.anchor;z(S.anchor,L)>0?(x=S.head,L=B(C.from(),S.anchor)):(x=S.anchor,L=R(C.to(),S.head));var k=p.ranges.slice(0);k[h]=Ro(e,new Ps(U(u,L),x)),xi(u,Br(k,h),$l)}}function o(t){var n=++b,s=Tn(e,t,!0,"rectangle"==r.unit);if(s)if(0!=z(s,m)){e.curOp.focus=l(),i(s);var c=Bn(a,u);(s.line>=c.to||s.line<c.from)&&setTimeout(gr(e,function(){b==n&&o(t)}),150)}else{var f=t.clientY<y.top?-20:t.clientY>y.bottom?20:0;f&&setTimeout(gr(e,function(){b==n&&(a.scroller.scrollTop+=f,o(t))}),50)}}function s(t){e.state.selectingText=!1,b=1/0,We(t),a.input.focus(),Te(a.wrapper.ownerDocument,"mousemove",w),Te(a.wrapper.ownerDocument,"mouseup",x),u.history.lastSelOrigin=null}var a=e.display,u=e.doc;We(t);var c,h,p=u.sel,g=p.ranges;if(r.addNew&&!r.extend?(h=u.sel.contains(n),c=h>-1?g[h]:new Ps(n,n)):(c=u.sel.primary(),h=u.sel.primIndex),"rectangle"==r.unit)r.addNew||(c=new Ps(n,n)),n=Tn(e,t,!0,!0),h=-1;else{var v=Eo(e,n,r.unit);c=r.extend?pi(c,v.anchor,v.head,r.extend):v}r.addNew?-1==h?(h=g.length,xi(u,Br(g.concat([c]),h),{scroll:!1,origin:"*mouse"})):g.length>1&&g[h].empty()&&"char"==r.unit&&!r.extend?(xi(u,Br(g.slice(0,h).concat(g.slice(h+1)),0),{scroll:!1,origin:"*mouse"}),p=u.sel):mi(u,h,c,$l):(h=0,xi(u,new Hs([c],0),$l),p=u.sel);var m=n,y=a.wrapper.getBoundingClientRect(),b=0,w=gr(e,function(e){0!==e.buttons&&Ee(e)?o(e):s(e)}),x=gr(e,s);e.state.selectingText=x,ls(a.wrapper.ownerDocument,"mousemove",w),ls(a.wrapper.ownerDocument,"mouseup",x)}function Ro(e,t){var n=t.anchor,r=t.head,i=M(e.doc,n.line);if(0==z(n,r)&&n.sticky==r.sticky)return t;var o=Le(i);if(!o)return t;var l=Se(o,n.ch,n.sticky),s=o[l];if(s.from!=n.ch&&s.to!=n.ch)return t;var a,u=l+(s.from==n.ch==(1!=s.level)?0:1);if(0==u||u==o.length)return t;if(r.line!=n.line)a=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=Se(o,r.ch,r.sticky),f=c-l||(r.ch-n.ch)*(1==s.level?-1:1);a=c==u-1||c==u?f<0:f>0}var h=o[u+(a?-1:0)],d=a==(1==h.level),p=d?h.from:h.to,g=d?"after":"before";return n.ch==p&&n.sticky==g?t:new Ps(new F(n.line,p,g),r)}function Bo(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&We(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(o>s.bottom||!Oe(e,n))return Pe(t);o-=s.top-l.viewOffset;for(var a=0;a<e.options.gutters.length;++a){var u=l.gutters.childNodes[a];if(u&&u.getBoundingClientRect().right>=i){var c=W(e.doc,o),f=e.options.gutters[a];return Me(e,n,e,c,f,t),Pe(t)}}}function Go(e,t){return Bo(e,t,"gutterClick",!0)}function Uo(e,t){zt(e.display,t)||jo(e,t)||Ae(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function jo(e,t){return!!Oe(e,"gutterContextMenu")&&Bo(e,t,"gutterContextMenu",!1)}function Vo(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),nn(e)}function Ko(e){function t(t,r,i,o){e.defaults[t]=r,i&&(n[t]=o?function(e,t,n){n!=ta&&i(e,t,n)}:i)}var n=e.optionHandlers;e.defineOption=t,e.Init=ta,t("value","",function(e,t){return e.setValue(t)},!0),t("mode",null,function(e,t){e.doc.modeOption=t,Yr(e)},!0),t("indentUnit",2,Yr,!0),t("indentWithTabs",!1),t("smartIndent",!0),t("tabSize",4,function(e){_r(e),nn(e),yr(e)},!0),t("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var n=[],r=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,n.push(F(r,o))}r++});for(var i=n.length-1;i>=0;i--)Ei(e.doc,t,n[i],F(n[i].line,n[i].ch+t.length))}}),t("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=ta&&e.refresh()}),t("specialCharPlaceholder",ct,function(e){return e.refresh()},!0),t("electricChars",!0),t("inputStyle",Hl?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),t("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),t("rtlMoveVisually",!zl),t("wholeLineUpdateBefore",!0),t("theme","default",function(e){Vo(e),Xo(e)},!0),t("keyMap","default",function(e,t,n){var r=fo(t),i=n!=ta&&fo(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)}),t("extraKeys",null),t("configureMouse",null),t("lineWrapping",!1,_o,!0),t("gutters",[],function(e){zr(e.options),Xo(e)},!0),t("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?Sn(e.display)+"px":"0",e.refresh()},!0),t("coverGutterNextToScrollbar",!1,function(e){return rr(e)},!0),t("scrollbarStyle","native",function(e){or(e),rr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),t("lineNumbers",!1,function(e){zr(e.options),Xo(e)},!0),t("firstLineNumber",1,Xo,!0),t("lineNumberFormatter",function(e){return e},Xo,!0),t("showCursorWhenSelecting",!1,An,!0),t("resetSelectionOnContextMenu",!0),t("lineWiseCopyCut",!0),t("pasteLinesPerSelection",!0),t("readOnly",!1,function(e,t){"nocursor"==t&&(En(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),t("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),t("dragDrop",!0,Yo), t("allowDropFileTypes",null),t("cursorBlinkRate",530),t("cursorScrollMargin",0),t("cursorHeight",1,An,!0),t("singleCursorHeightPerLine",!0,An,!0),t("workTime",100),t("workDelay",100),t("flattenSpans",!0,_r,!0),t("addModeClass",!1,_r,!0),t("pollInterval",100),t("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),t("historyEventDelay",1250),t("viewportMargin",10,function(e){return e.refresh()},!0),t("maxHighlightLength",1e4,_r,!0),t("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),t("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),t("autofocus",null),t("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),t("phrases",null)}function Xo(e){Fr(e),yr(e),Gn(e)}function Yo(e,t,n){var r=n&&n!=ta;if(!t!=!r){var i=e.display.dragFunctions,o=t?ls:Te;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 _o(e){e.options.lineWrapping?(s(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Gl(e.display.wrapper,"CodeMirror-wrap"),xe(e)),kn(e),yr(e),nn(e),setTimeout(function(){return rr(e)},100)}function qo(e,t){var n=this;if(!(this instanceof qo))return new qo(e,t);this.options=t=t?c(t):{},c(na,t,!1),zr(t);var r=t.value;"string"==typeof r?r=new Bs(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new qo.inputStyles[t.inputStyle](this),o=this.display=new T(e,r,i);for(var l in o.wrapper.CodeMirror=this,Fr(this),Vo(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),or(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 jl,keySeq:null,specialChars:null},t.autofocus&&!Hl&&o.input.focus(),Cl&&Sl<11&&setTimeout(function(){return n.display.input.reset(!0)},20),$o(this),no(),lr(this),this.curOp.forceUpdate=!0,Qr(this,r),t.autofocus&&!Hl||this.hasFocus()?setTimeout(u(zn,this),20):En(this),ra)ra.hasOwnProperty(l)&&ra[l](n,t[l],ta);Un(this),t.finishInit&&t.finishInit(this);for(var s=0;s<ia.length;++s)ia[s](n);sr(this),Ll&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}function $o(e){function t(){i.activeTouch&&(o=setTimeout(function(){return i.activeTouch=null},1e3),l=i.activeTouch,l.end=+new Date)}function n(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}function r(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}var i=e.display;ls(i.scroller,"mousedown",gr(e,Wo)),ls(i.scroller,"dblclick",Cl&&Sl<11?gr(e,function(t){if(!Ae(e,t)){var n=Tn(e,t);if(n&&!Go(e,t)&&!zt(e.display,t)){We(t);var r=e.findWordAt(n);gi(e.doc,r.anchor,r.head)}}}):function(t){return Ae(e,t)||We(t)}),Bl||ls(i.scroller,"contextmenu",function(t){return Uo(e,t)});var o,l={end:0};ls(i.scroller,"touchstart",function(t){if(!Ae(e,t)&&!n(t)&&!Go(e,t)){i.input.ensurePolled(),clearTimeout(o);var r=+new Date;i.activeTouch={start:r,moved:!1,prev:r-l.end<=300?l:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),ls(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),ls(i.scroller,"touchend",function(n){var o=i.activeTouch;if(o&&!zt(i,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var l,s=e.coordsChar(i.activeTouch,"page");l=!o.prev||r(o,o.prev)?new Ps(s,s):!o.prev.prev||r(o,o.prev.prev)?e.findWordAt(s):new Ps(F(s.line,0),U(e.doc,F(s.line+1,0))),e.setSelection(l.anchor,l.head),e.focus(),We(n)}t()}),ls(i.scroller,"touchcancel",t),ls(i.scroller,"scroll",function(){i.scroller.clientHeight&&(Jn(e,i.scroller.scrollTop),tr(e,i.scroller.scrollLeft,!0),Me(e,"scroll",e))}),ls(i.scroller,"mousewheel",function(t){return Rr(e,t)}),ls(i.scroller,"DOMMouseScroll",function(t){return Rr(e,t)}),ls(i.wrapper,"scroll",function(){return i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Ae(e,t)||Fe(t)},over:function(t){Ae(e,t)||(Ji(e,t),Fe(t))},start:function(t){return Qi(e,t)},drop:gr(e,Zi),leave:function(t){Ae(e,t)||eo(e)}};var s=i.input.getField();ls(s,"keyup",function(t){return No.call(e,t)}),ls(s,"keydown",gr(e,Mo)),ls(s,"keypress",gr(e,Oo)),ls(s,"focus",function(t){return zn(e,t)}),ls(s,"blur",function(t){return En(e,t)})}function Zo(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=Ze(e,t).state:n="prev");var l=e.options.tabSize,s=M(o,t),a=f(s.text,null,l);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(r||/\S/.test(s.text)){if("smart"==n&&(u=o.mode.indent(i,s.text.slice(c.length),s.text),u==_l||u>150)){if(!r)return;n="prev"}}else u=0,n="not";"prev"==n?u=t>o.first?f(M(o,t-1).text,null,l):0:"add"==n?u=a+e.options.indentUnit:"subtract"==n?u=a-e.options.indentUnit:"number"==typeof n&&(u=a+n),u=Math.max(0,u);var h="",d=0;if(e.options.indentWithTabs)for(var g=Math.floor(u/l);g;--g)d+=l,h+="\t";if(d<u&&(h+=p(u-d)),h!=c)return Ei(o,h,F(t,0),F(t,c.length),"+input"),s.stateAfter=null,!0;for(var v=0;v<o.sel.ranges.length;v++){var m=o.sel.ranges[v];if(m.head.line==t&&m.head.ch<c.length){var y=F(t,c.length);mi(o,v,new Ps(y,y));break}}}function Qo(e){oa=e}function Jo(e,t,n,r,i){var o=e.doc;e.display.shift=!1,r||(r=o.sel);var l,s=e.state.pasteIncoming||"paste"==i,a=as(t),u=null;if(s&&r.ranges.length>1)if(oa&&oa.text.join("\n")==t){if(r.ranges.length%oa.text.length==0){u=[];for(var c=0;c<oa.text.length;c++)u.push(o.splitLines(oa.text[c]))}}else a.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(u=v(a,function(e){return[e]}));for(var f=r.ranges.length-1;f>=0;f--){var h=r.ranges[f],d=h.from(),p=h.to();h.empty()&&(n&&n>0?d=F(d.line,d.ch-n):e.state.overwrite&&!s?p=F(p.line,Math.min(M(o,p.line).text.length,p.ch+g(a).length)):oa&&oa.lineWise&&oa.text.join("\n")==t&&(d=p=F(d.line,0))),l=e.curOp.updateInput;var m={from:d,to:p,text:u?u[f%u.length]:a,origin:i||(s?"paste":e.state.cutIncoming?"cut":"+input")};Di(e.doc,m),xt(e,"inputRead",e,m)}t&&!s&&tl(e,t),_n(e),e.curOp.updateInput=l,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function el(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||pr(t,function(){return Jo(t,n,0,null,"paste")}),!0}function tl(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),l=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(t.indexOf(o.electricChars.charAt(s))>-1){l=Zo(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(M(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Zo(e,i.head.line,"smart"));l&&xt(e,"electricInput",e,i.head.line)}}}function nl(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,o={anchor:F(i,0),head:F(i+1,0)};n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function rl(e,t){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck",!!t)}function il(){var e=r("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=r("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return Ll?e.style.width="1000px":e.setAttribute("wrap","off"),Dl&&(e.style.border="1px solid black"),rl(e),t}function ol(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e];r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&gr(this,t[e])(this,n,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"](fo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:vr(function(t,n){var r=t.token?t:e.getMode(this.options,t);if(r.startState)throw new Error("Overlays may not be stateful.");m(this.state.overlays,{mode:r,modeSpec:t,opaque:n&&n.opaque,priority:n&&n.priority||0},function(e){return e.priority}),this.state.modeGen++,yr(this)}),removeOverlay:vr(function(e){for(var t=this,n=this.state.overlays,r=0;r<n.length;++r){var i=n[r].modeSpec;if(i==e||"string"==typeof e&&i.name==e)return n.splice(r,1),t.state.modeGen++,void yr(t)}}),indentLine:vr(function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),H(this.doc,e)&&Zo(this,e,t,n)}),indentSelection:vr(function(e){for(var t=this,n=this.doc.sel.ranges,r=-1,i=0;i<n.length;i++){var o=n[i];if(o.empty())o.head.line>r&&(Zo(t,o.head.line,e,!0),r=o.head.line,i==t.doc.sel.primIndex&&_n(t));else{var l=o.from(),s=o.to(),a=Math.max(r,l.line);r=Math.min(t.lastLine(),s.line-(s.ch?0:1))+1;for(var u=a;u<r;++u)Zo(t,u,e);var c=t.doc.sel.ranges;0==l.ch&&n.length==c.length&&c[i].from().ch>0&&mi(t.doc,i,new Ps(l,c[i].to()),ql)}}}),getTokenAt:function(e,t){return tt(this,e,t)},getLineTokens:function(e,t){return tt(this,F(e),t,!0)},getTokenTypeAt:function(e){e=U(this.doc,e);var t,n=$e(this,M(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var l=r+i>>1;if((l?n[2*l-1]:0)>=o)i=l;else{if(!(n[2*l+1]<o)){t=n[2*l+2];break}r=l+1}}var s=t?t.indexOf("overlay "):-1;return s<0?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=this,i=[];if(!n.hasOwnProperty(t))return i;var o=n[t],l=this.getModeAt(e);if("string"==typeof l[t])o[l[t]]&&i.push(o[l[t]]);else if(l[t])for(var s=0;s<l[t].length;s++){var a=o[l[t][s]];a&&i.push(a)}else l.helperType&&o[l.helperType]?i.push(o[l.helperType]):o[l.name]&&i.push(o[l.name]);for(var u=0;u<o._global.length;u++){var c=o._global[u];c.pred(l,r)&&-1==h(i,c.val)&&i.push(c.val)}return i},getStateAfter:function(e,t){var n=this.doc;return e=G(n,null==e?n.first+n.size-1:e),Ze(this,e+1,t).state},cursorCoords:function(e,t){var n,r=this.doc.sel.primary();return n=null==e?r.head:"object"==typeof e?U(this.doc,e):e?r.from():r.to(),cn(this,n,t||"page")},charCoords:function(e,t){return un(this,U(this.doc,e),t||"page")},coordsChar:function(e,t){return e=an(this,e,t||"page"),dn(this,e.left,e.top)},lineAtHeight:function(e,t){return e=an(this,{top:e,left:0},t||"page").top,W(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,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),r=M(this.doc,e)}else r=e;return sn(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-be(r):0)},defaultTextHeight:function(){return wn(this.display)},defaultCharWidth:function(){return xn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display;e=cn(this,U(this.doc,e));var l=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)l=e.top;else if("above"==r||"near"==r){var a=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>a)&&e.top>t.offsetHeight?l=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=a&&(l=e.bottom),s+t.offsetWidth>u&&(s=u-t.offsetWidth)}t.style.top=l+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),n&&Kn(this,{left:s,top:l,right:s+t.offsetWidth,bottom:l+t.offsetHeight})},triggerOnKeyDown:vr(Mo),triggerOnKeyPress:vr(Oo),triggerOnKeyUp:No,triggerOnMouseDown:vr(Wo),execCommand:function(e){if($s.hasOwnProperty(e))return $s[e].call(null,this)},triggerElectric:vr(function(e){tl(this,e)}),findPosH:function(e,t,n,r){var i=this,o=1;t<0&&(o=-1,t=-t);for(var l=U(this.doc,e),s=0;s<t&&(l=ll(i.doc,l,o,n,r),!l.hitSide);++s);return l},moveH:vr(function(e,t){var n=this;this.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?ll(n.doc,r.head,e,t,n.options.rtlMoveVisually):e<0?r.from():r.to()},Zl)}),deleteH:vr(function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):ho(this,function(n){var i=ll(r,n.head,e,t,!1);return e<0?{from:i,to:n.head}:{from:n.head,to:i}})}),findPosV:function(e,t,n,r){var i=this,o=1,l=r;t<0&&(o=-1,t=-t);for(var s=U(this.doc,e),a=0;a<t;++a){var u=cn(i,s,"div");if(null==l?l=u.left:u.left=l,s=sl(i,u,o,n),s.hitSide)break}return s},moveV:vr(function(e,t){var n=this,r=this.doc,i=[],o=!this.display.shift&&!r.extend&&r.sel.somethingSelected();if(r.extendSelectionsBy(function(l){if(o)return e<0?l.from():l.to();var s=cn(n,l.head,"div");null!=l.goalColumn&&(s.left=l.goalColumn),i.push(s.left);var a=sl(n,s,e,t);return"page"==t&&l==r.sel.primary()&&Yn(n,un(n,a,"div").top-s.top),a},Zl),i.length)for(var l=0;l<r.sel.ranges.length;l++)r.sel.ranges[l].goalColumn=i[l]}),findWordAt:function(e){var t=this.doc,n=M(t,e.line).text,r=e.ch,i=e.ch;if(n){var o=this.getHelper(e,"wordChars");"before"!=e.sticky&&i!=n.length||!r?++i:--r;for(var l=n.charAt(r),s=x(l,o)?function(e){return x(e,o)}:/\s/.test(l)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!x(e)};r>0&&s(n.charAt(r-1));)--r;for(;i<n.length&&s(n.charAt(i));)++i}return new Ps(F(e.line,r),F(e.line,i))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?s(this.display.cursorDiv,"CodeMirror-overwrite"):Gl(this.display.cursorDiv,"CodeMirror-overwrite"),Me(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==l()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:vr(function(e,t){qn(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Bt(this)-this.display.barHeight,width:e.scrollWidth-Bt(this)-this.display.barWidth,clientHeight:Ut(this),clientWidth:Gt(this)}},scrollIntoView:vr(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:F(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?$n(this,e):Qn(this,e.from,e.to,e.margin)}),setSize:vr(function(e,t){var n=this,r=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&tn(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){br(n,i,"widget");break}++i}),this.curOp.forceUpdate=!0,Me(this,"refresh",this)}),operation:function(e){return pr(this,e)},startOperation:function(){return lr(this)},endOperation:function(){return sr(this)},refresh:vr(function(){var e=this.display.cachedTextHeight;yr(this),this.curOp.forceUpdate=!0,nn(this),qn(this,this.doc.scrollLeft,this.doc.scrollTop),Hr(this),(null==e||Math.abs(e-wn(this.display))>.5)&&kn(this),Me(this,"refresh",this)}),swapDoc:vr(function(e){var t=this.doc;return t.cm=null,Qr(this,e),nn(this),this.display.input.reset(),qn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,xt(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}},De(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}function ll(e,t,n,r,i){function o(){var r=t.line+n;return!(r<e.first||r>=e.first+e.size)&&(t=new F(r,t.ch,t.sticky),u=M(e,r))}function l(r){var l;if(l=i?mo(e.cm,u,t,n):go(u,t,n),null==l){if(r||!o())return!1;t=vo(i,e.cm,u,t.line,n)}else t=l;return!0}var s=t,a=n,u=M(e,t.line);if("char"==r)l();else if("column"==r)l(!0);else if("word"==r||"group"==r)for(var c=null,f="group"==r,h=e.cm&&e.cm.getHelper(t,"wordChars"),d=!0;!(n<0)||l(!d);d=!1){var p=u.text.charAt(t.ch)||"\n",g=x(p,h)?"w":f&&"\n"==p?"n":!f||/\s/.test(p)?null:"p";if(!f||d||g||(g="s"),c&&c!=g){n<0&&(n=1,l(),t.sticky="after");break}if(g&&(c=g),n>0&&!l(!d))break}var v=Mi(e,t,s,a,!0);return E(s,v)&&(v.hitSide=!0),v}function sl(e,t,n,r){var i,o,l=e.doc,s=t.left;if("page"==r){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(a-.5*wn(e.display),3);i=(n>0?t.bottom:t.top)+n*u}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;o=dn(e,s,i),o.outside;){if(n<0?i<=0:i>=l.height){o.hitSide=!0;break}i+=5*n}return o}function al(e,t){var n=Yt(e,t.line);if(!n||n.hidden)return null;var r=M(e.doc,t.line),i=Vt(n,r,t.line),o=Le(r,e.doc.direction),l="left";if(o){var s=Se(o,t.ch);l=s%2?"right":"left"}var a=$t(i.map,t.ch,l);return a.offset="right"==a.collapse?a.end:a.start,a}function ul(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}function cl(e,t){return t&&(e.bad=!0),e}function fl(e,t,n,r,i){function o(e){return function(t){return t.id==e}}function l(){c&&(u+=f,h&&(u+=f),c=h=!1)}function s(e){e&&(l(),u+=e)}function a(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void s(n);var u,d=t.getAttribute("cm-marker");if(d){var p=e.findMarks(F(r,0),F(i+1,0),o(+d));return void(p.length&&(u=p[0].find(0))&&s(A(e.doc,u.from,u.to).join(f)))}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&&l();for(var v=0;v<t.childNodes.length;v++)a(t.childNodes[v]);/^(pre|p)$/i.test(t.nodeName)&&(h=!0),g&&(c=!0)}else 3==t.nodeType&&s(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(var u="",c=!1,f=e.doc.lineSeparator(),h=!1;a(t),t!=n;)t=t.nextSibling,h=!1;return u}function hl(e,t,n){var r;if(t==e.display.lineDiv){if(r=e.display.lineDiv.childNodes[n],!r)return cl(e.clipPos(F(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==r)return dl(o,t,n)}}function dl(e,t,n){function r(t,n,r){for(var i=-1;i<(f?f.length:0);i++)for(var o=i<0?c.map:f[i],l=0;l<o.length;l+=3){var s=o[l+2];if(s==t||s==n){var a=D(i<0?e.line:e.rest[i]),u=o[l]+r;return(r<0||s!=t)&&(u=o[l+(r?1:0)]),F(a,u)}}}var i=e.text.firstChild,l=!1;if(!t||!o(i,t))return cl(F(D(e.line),0),!0);if(t==i&&(l=!0,t=i.childNodes[n],n=0,!t)){var s=e.rest?g(e.rest):e.line;return cl(F(D(s),s.text.length),l)}var a=3==t.nodeType?t:null,u=t;for(a||1!=t.childNodes.length||3!=t.firstChild.nodeType||(a=t.firstChild,n&&(n=a.nodeValue.length));u.parentNode!=i;)u=u.parentNode;var c=e.measure,f=c.maps,h=r(a,u,n);if(h)return cl(h,l);for(var d=u.nextSibling,p=a?a.nodeValue.length-n:0;d;d=d.nextSibling){if(h=r(d,d.firstChild,0),h)return cl(F(h.line,h.ch-p),l);p+=d.textContent.length}for(var v=u.previousSibling,m=n;v;v=v.previousSibling){if(h=r(v,v.firstChild,-1),h)return cl(F(h.line,h.ch+m),l);m+=v.textContent.length}}function pl(e,t){function n(){e.value=a.getValue()}if(t=t?c(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=l();t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}var i;if(e.form&&(ls(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var s=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=s}}catch(e){}}t.finishInit=function(t){t.save=n,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,n(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(Te(e.form,"submit",n),"function"==typeof e.form.submit&&(e.form.submit=i))}},e.style.display="none";var a=qo(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return a}function gl(e){e.off=Te,e.on=ls,e.wheelEventPixels=Ir,e.Doc=Bs,e.splitLines=as,e.countColumn=f,e.findColumn=d,e.isWordChar=w,e.Pass=_l,e.signal=Me,e.Line=bs,e.changeEnd=Ur,e.scrollbarModel=As,e.Pos=F,e.cmpPos=z,e.modes=hs,e.mimeModes=ds,e.resolveMode=je,e.getMode=Ve,e.modeExtensions=ps,e.extendMode=Ke,e.copyState=Xe,e.startState=_e,e.innerMode=Ye,e.commands=$s,e.keyMap=Ys,e.keyName=co,e.isModifierKey=ao,e.lookupKey=so,e.normalizeKeyMap=lo,e.StringStream=gs,e.SharedTextMarker=Is,e.TextMarker=Es,e.LineWidget=Fs,e.e_preventDefault=We,e.e_stopPropagation=He,e.e_stop=Fe,e.addClass=s,e.contains=o,e.rmClass=Gl,e.keyNames=js}var vl=navigator.userAgent,ml=navigator.platform,yl=/gecko\/\d/i.test(vl),bl=/MSIE \d/.test(vl),wl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(vl),xl=/Edge\/(\d+)/.exec(vl),Cl=bl||wl||xl,Sl=Cl&&(bl?document.documentMode||6:+(xl||wl)[1]),Ll=!xl&&/WebKit\//.test(vl),kl=Ll&&/Qt\/\d+\.\d+/.test(vl),Tl=!xl&&/Chrome\//.test(vl),Ml=/Opera\//.test(vl),Al=/Apple Computer/.test(navigator.vendor),Nl=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(vl),Ol=/PhantomJS/.test(vl),Dl=!xl&&/AppleWebKit/.test(vl)&&/Mobile\/\w+/.test(vl),Wl=/Android/.test(vl),Hl=Dl||Wl||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(vl),Pl=Dl||/Mac/.test(ml),Fl=/\bCrOS\b/.test(vl),zl=/win/i.test(ml),El=Ml&&vl.match(/Version\/(\d*\.\d*)/);El&&(El=Number(El[1])),El&&El>=15&&(Ml=!1,Ll=!0);var Il,Rl=Pl&&(kl||Ml&&(null==El||El<12.11)),Bl=yl||Cl&&Sl>=9,Gl=function(t,n){var r=t.className,i=e(n).exec(r);if(i){var o=r.slice(i.index+i[0].length);t.className=r.slice(0,i.index)+(o?i[1]+o:"")}};Il=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(e){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var Ul=function(e){e.select()};Dl?Ul=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:Cl&&(Ul=function(e){try{e.select()}catch(e){}});var jl=function(){this.id=null};jl.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var Vl,Kl,Xl,Yl=30,_l={toString:function(){return"CodeMirror.Pass"}},ql={scroll:!1},$l={origin:"*mouse"},Zl={origin:"+move"},Ql=[""],Jl=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,es=/[\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]/,ts=!1,ns=!1,rs=null,is=function(){function e(e){return e<=247?n.charAt(e):1424<=e&&e<=1524?"R":1536<=e&&e<=1785?r.charAt(e-1536):1774<=e&&e<=2220?"r":8192<=e&&e<=8203?"w":8204==e?"b":"L"}function t(e,t,n){this.level=e,this.from=t,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,l=/[LRr]/,s=/[Lb1n]/,a=/[1n]/;return function(n,r){var u="ltr"==r?"L":"R";if(0==n.length||"ltr"==r&&!i.test(n))return!1;for(var c=n.length,f=[],h=0;h<c;++h)f.push(e(n.charCodeAt(h)));for(var d=0,p=u;d<c;++d){var v=f[d];"m"==v?f[d]=p:p=v}for(var m=0,y=u;m<c;++m){var b=f[m];"1"==b&&"r"==y?f[m]="n":l.test(b)&&(y=b,"r"==b&&(f[m]="R"))}for(var w=1,x=f[0];w<c-1;++w){var C=f[w];"+"==C&&"1"==x&&"1"==f[w+1]?f[w]="1":","!=C||x!=f[w+1]||"1"!=x&&"n"!=x||(f[w]=x),x=C}for(var S=0;S<c;++S){var L=f[S];if(","==L)f[S]="N";else if("%"==L){var k=void 0;for(k=S+1;k<c&&"%"==f[k];++k);for(var T=S&&"!"==f[S-1]||k<c&&"1"==f[k]?"1":"N",M=S;M<k;++M)f[M]=T;S=k-1}}for(var A=0,N=u;A<c;++A){var O=f[A];"L"==N&&"1"==O?f[A]="L":l.test(O)&&(N=O)}for(var D=0;D<c;++D)if(o.test(f[D])){var W=void 0;for(W=D+1;W<c&&o.test(f[W]);++W);for(var H="L"==(D?f[D-1]:u),P="L"==(W<c?f[W]:u),F=H==P?H?"L":"R":u,z=D;z<W;++z)f[z]=F;D=W-1}for(var E,I=[],R=0;R<c;)if(s.test(f[R])){var B=R;for(++R;R<c&&s.test(f[R]);++R);I.push(new t(0,B,R))}else{var G=R,U=I.length;for(++R;R<c&&"L"!=f[R];++R);for(var j=G;j<R;)if(a.test(f[j])){G<j&&I.splice(U,0,new t(1,G,j));var V=j;for(++j;j<R&&a.test(f[j]);++j);I.splice(U,0,new t(2,V,j)),G=j}else++j;G<R&&I.splice(U,0,new t(1,G,R))}return"ltr"==r&&(1==I[0].level&&(E=n.match(/^\s+/))&&(I[0].from=E[0].length,I.unshift(new t(0,0,E[0].length))),1==g(I).level&&(E=n.match(/\s+$/))&&(g(I).to-=E[0].length,I.push(new t(0,c-E[0].length,c)))),"rtl"==r?I.reverse():I}}(),os=[],ls=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else if(e.attachEvent)e.attachEvent("on"+t,n);else{var r=e._handlers||(e._handlers={});r[t]=(r[t]||os).concat(n)}},ss=function(){if(Cl&&Sl<9)return!1;var e=r("div");return"draggable"in e||"dragDrop"in e}(),as=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(n.push(o.slice(0,l)),t+=l+1):(n.push(o),t=i+1)}return n}:function(e){return String(e).split(/\r\n?|\n/)},us=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},cs=(Xl=r("div"),"oncopy"in Xl||(Xl.setAttribute("oncopy","return;"),"function"==typeof Xl.oncopy)),fs=null,hs={},ds={},ps={},gs=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};gs.prototype.eol=function(){return this.pos>=this.string.length},gs.prototype.sol=function(){return this.pos==this.lineStart},gs.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},gs.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},gs.prototype.eat=function(e){var t,n=this.string.charAt(this.pos);if(t="string"==typeof e?n==e:n&&(e.test?e.test(n):e(n)),t)return++this.pos,n},gs.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},gs.prototype.eatSpace=function(){for(var e=this,t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++e.pos;return this.pos>t},gs.prototype.skipToEnd=function(){this.pos=this.string.length},gs.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},gs.prototype.backUp=function(e){this.pos-=e},gs.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=f(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?f(this.string,this.lineStart,this.tabSize):0)},gs.prototype.indentation=function(){return f(this.string,null,this.tabSize)-(this.lineStart?f(this.string,this.lineStart,this.tabSize):0)},gs.prototype.match=function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);if(i(o)==i(e))return!1!==t&&(this.pos+=e.length),!0},gs.prototype.current=function(){return this.string.slice(this.start,this.pos)},gs.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},gs.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},gs.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var vs=function(e,t){this.state=e,this.lookAhead=t},ms=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};ms.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ms.prototype.baseToken=function(e){var t=this;if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)t.baseTokenPos+=2;var n=this.baseTokens[this.baseTokenPos+1];return{type:n&&n.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ms.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ms.fromSaved=function(e,t,n){return t instanceof vs?new ms(e,Xe(e.mode,t.state),n,t.lookAhead):new ms(e,Xe(e.mode,t),n)},ms.prototype.save=function(e){var t=!1!==e?Xe(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new vs(t,this.maxLookAhead):t};var ys=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n},bs=function(e,t,n){this.text=e,re(this,t),this.height=n?n(this):1};bs.prototype.lineNo=function(){return D(this)},De(bs);var ws,xs={},Cs={},Ss=null,Ls=null,ks={left:0,right:0,top:0,bottom:0},Ts=function(e,t,n){this.cm=n;var i=this.vert=r("div",[r("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),o=this.horiz=r("div",[r("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar") ;i.tabIndex=o.tabIndex=-1,e(i),e(o),ls(i,"scroll",function(){i.clientHeight&&t(i.scrollTop,"vertical")}),ls(o,"scroll",function(){o.clientWidth&&t(o.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,Cl&&Sl<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Ts.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Ts.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Ts.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Ts.prototype.zeroWidthHack=function(){var e=Pl&&!Nl?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new jl,this.disableVert=new jl},Ts.prototype.enableZeroWidthBar=function(e,t,n){function r(){var i=e.getBoundingClientRect(),o="vert"==n?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,r)}e.style.pointerEvents="auto",t.set(1e3,r)},Ts.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ms=function(){};Ms.prototype.update=function(){return{bottom:0,right:0}},Ms.prototype.setScrollLeft=function(){},Ms.prototype.setScrollTop=function(){},Ms.prototype.clear=function(){};var As={native:Ts,null:Ms},Ns=0,Os=function(e,t,n){var r=e.display;this.viewport=t,this.visible=Bn(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Gt(e),this.force=n,this.dims=Cn(e),this.events=[]};Os.prototype.signal=function(e,t){Oe(e,t)&&this.events.push(arguments)},Os.prototype.finish=function(){for(var e=this,t=0;t<this.events.length;t++)Me.apply(null,e.events[t])};var Ds=0,Ws=null;Cl?Ws=-.53:yl?Ws=15:Tl?Ws=-.7:Al&&(Ws=-1/3);var Hs=function(e,t){this.ranges=e,this.primIndex=t};Hs.prototype.primary=function(){return this.ranges[this.primIndex]},Hs.prototype.equals=function(e){var t=this;if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var n=0;n<this.ranges.length;n++){var r=t.ranges[n],i=e.ranges[n];if(!E(r.anchor,i.anchor)||!E(r.head,i.head))return!1}return!0},Hs.prototype.deepCopy=function(){for(var e=this,t=[],n=0;n<this.ranges.length;n++)t[n]=new Ps(I(e.ranges[n].anchor),I(e.ranges[n].head));return new Hs(t,this.primIndex)},Hs.prototype.somethingSelected=function(){for(var e=this,t=0;t<this.ranges.length;t++)if(!e.ranges[t].empty())return!0;return!1},Hs.prototype.contains=function(e,t){var n=this;t||(t=e);for(var r=0;r<this.ranges.length;r++){var i=n.ranges[r];if(z(t,i.from())>=0&&z(e,i.to())<=0)return r}return-1};var Ps=function(e,t){this.anchor=e,this.head=t};Ps.prototype.from=function(){return B(this.anchor,this.head)},Ps.prototype.to=function(){return R(this.anchor,this.head)},Ps.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},Ui.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=this,r=e,i=e+t;r<i;++r){var o=n.lines[r];n.height-=o.height,st(o),xt(o,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){var r=this;this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var i=0;i<t.length;++i)t[i].parent=r},iterN:function(e,t,n){for(var r=this,i=e+t;e<i;++e)if(n(r.lines[e]))return!0}},ji.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){var n=this;this.size-=t;for(var r=0;r<this.children.length;++r){var i=n.children[r],o=i.chunkSize();if(e<o){var l=Math.min(t,o-e),s=i.height;if(i.removeInner(e,l),n.height-=s-i.height,o==l&&(n.children.splice(r--,1),i.parent=null),0==(t-=l))break;e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ui))){var a=[];this.collapse(a),this.children=[new Ui(a)],this.children[0].parent=this}},collapse:function(e){for(var t=this,n=0;n<this.children.length;++n)t.children[n].collapse(e)},insertInner:function(e,t,n){var r=this;this.size+=t.length,this.height+=n;for(var i=0;i<this.children.length;++i){var o=r.children[i],l=o.chunkSize();if(e<=l){if(o.insertInner(e,t,n),o.lines&&o.lines.length>50){for(var s=o.lines.length%25+25,a=s;a<o.lines.length;){var u=new Ui(o.lines.slice(a,a+=25));o.height-=u.height,r.children.splice(++i,0,u),u.parent=r}o.lines=o.lines.slice(0,s),r.maybeSpill()}break}e-=l}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new ji(t);if(e.parent){e.size-=n.size,e.height-=n.height;var r=h(e.parent.children,e);e.parent.children.splice(r+1,0,n)}else{var i=new ji(e.children);i.parent=e,e.children=[i,n],e=i}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=this,i=0;i<this.children.length;++i){var o=r.children[i],l=o.chunkSize();if(e<l){var s=Math.min(t,l-e);if(o.iterN(e,s,n))return!0;if(0==(t-=s))break;e=0}else e-=l}}};var Fs=function(e,t,n){var r=this;if(n)for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i]);this.doc=e,this.node=t};Fs.prototype.clear=function(){var e=this,t=this.doc.cm,n=this.line.widgets,r=this.line,i=D(r);if(null!=i&&n){for(var o=0;o<n.length;++o)n[o]==e&&n.splice(o--,1);n.length||(r.widgets=null);var l=Ft(this);O(r,Math.max(0,r.height-l)),t&&(pr(t,function(){Vi(t,r,-l),br(t,i,"widget")}),xt(t,"lineWidgetCleared",t,this,i))}},Fs.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line;this.height=null;var i=Ft(this)-t;i&&(me(this.doc,r)||O(r,r.height+i),n&&pr(n,function(){n.curOp.forceUpdate=!0,Vi(n,r,i),xt(n,"lineWidgetChanged",n,e,D(r))}))},De(Fs);var zs=0,Es=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++zs};Es.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){var t=this.doc.cm,n=t&&!t.curOp;if(n&&lr(t),Oe(this,"clear")){var r=this.find();r&&xt(this,"clear",r.from,r.to)}for(var i=null,o=null,l=0;l<this.lines.length;++l){var s=e.lines[l],a=_(s.markedSpans,e);t&&!e.collapsed?br(t,D(s),"text"):t&&(null!=a.to&&(o=D(s)),null!=a.from&&(i=D(s))),s.markedSpans=q(s.markedSpans,a),null==a.from&&e.collapsed&&!me(e.doc,s)&&t&&O(s,wn(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var u=0;u<this.lines.length;++u){var c=he(e.lines[u]),f=we(c);f>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=f,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&yr(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Li(t.doc)),t&&xt(t,"markerCleared",t,this,i,o),n&&sr(t),this.parent&&this.parent.clear()}},Es.prototype.find=function(e,t){var n,r,i=this;null==e&&"bookmark"==this.type&&(e=1);for(var o=0;o<this.lines.length;++o){var l=i.lines[o],s=_(l.markedSpans,i);if(null!=s.from&&(n=F(t?l:D(l),s.from),-1==e))return n;if(null!=s.to&&(r=F(t?l:D(l),s.to),1==e))return r}return n&&{from:n,to:r}},Es.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm;t&&r&&pr(r,function(){var i=t.line,o=D(t.line),l=Yt(r,o);if(l&&(en(l),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!me(n.doc,i)&&null!=n.height){var s=n.height;n.height=null;var a=Ft(n)-s;a&&O(i,i.height+a)}xt(r,"markerChanged",r,e)})},Es.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=h(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Es.prototype.detachLine=function(e){if(this.lines.splice(h(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},De(Es);var Is=function(e,t){var n=this;this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=n};Is.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)e.markers[t].clear();xt(this,"clear")}},Is.prototype.find=function(e,t){return this.primary.find(e,t)},De(Is);var Rs=0,Bs=function(e,t,n,r,i){if(!(this instanceof Bs))return new Bs(e,t,n,r,i);null==n&&(n=0),ji.call(this,[new Ui([new bs("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=F(n,0);this.sel=Gr(o),this.history=new ti(null),this.id=++Rs,this.modeOption=t,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),$r(this,{from:o,to:o,text:e}),xi(this,Gr(o),ql)};Bs.prototype=b(ji.prototype,{constructor:Bs,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height;this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=N(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:mr(function(e){var t=F(this.first,0),n=this.first+this.size-1;Di(this,{from:t,to:F(n,M(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&qn(this.cm,0,0),xi(this,Gr(t),ql)}),replaceRange:function(e,t,n,r){t=U(this,t),n=n?U(this,n):t,Ei(this,e,t,n,r)},getRange:function(e,t,n){var r=A(this,U(this,e),U(this,t));return!1===n?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(H(this,e))return M(this,e)},getLineNumber:function(e){return D(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=M(this,e)),he(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return U(this,e)},getCursor:function(e){var t,n=this.sel.primary();return t=null==e||"head"==e?n.head:"anchor"==e?n.anchor:"end"==e||"to"==e||!1===e?n.to():n.from(),t},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:mr(function(e,t,n){yi(this,U(this,"number"==typeof e?F(e,t||0):e),null,n)}),setSelection:mr(function(e,t,n){yi(this,U(this,e),U(this,t||e),n)}),extendSelection:mr(function(e,t,n){gi(this,U(this,e),t&&U(this,t),n)}),extendSelections:mr(function(e,t){vi(this,V(this,e),t)}),extendSelectionsBy:mr(function(e,t){var n=v(this.sel.ranges,e);vi(this,V(this,n),t)}),setSelections:mr(function(e,t,n){var r=this;if(e.length){for(var i=[],o=0;o<e.length;o++)i[o]=new Ps(U(r,e[o].anchor),U(r,e[o].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),xi(this,Br(i,t),n)}}),addSelection:mr(function(e,t,n){var r=this.sel.ranges.slice(0);r.push(new Ps(U(this,e),U(this,t||e))),xi(this,Br(r,r.length-1),n)}),getSelection:function(e){for(var t,n=this,r=this.sel.ranges,i=0;i<r.length;i++){var o=A(n,r[i].from(),r[i].to());t=t?t.concat(o):o}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=this,n=[],r=this.sel.ranges,i=0;i<r.length;i++){var o=A(t,r[i].from(),r[i].to());!1!==e&&(o=o.join(e||t.lineSeparator())),n[i]=o}return n},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e;this.replaceSelections(r,t,n||"+input")},replaceSelections:mr(function(e,t,n){for(var r=this,i=[],o=this.sel,l=0;l<o.ranges.length;l++){var s=o.ranges[l];i[l]={from:s.from(),to:s.to(),text:r.splitLines(e[l]),origin:n}}for(var a=t&&"end"!=t&&Xr(this,i,t),u=i.length-1;u>=0;u--)Di(r,i[u]);a?wi(this,a):this.cm&&_n(this.cm)}),undo:mr(function(){Hi(this,"undo")}),redo:mr(function(){Hi(this,"redo")}),undoSelection:mr(function(){Hi(this,"undo",!0)}),redoSelection:mr(function(){Hi(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n;return{undo:t,redo:n}},clearHistory:function(){this.history=new ti(this.history.maxGeneration)},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:di(this.history.done),undone:di(this.history.undone)}},setHistory:function(e){var t=this.history=new ti(this.history.maxGeneration);t.done=di(e.done.slice(0),null,!0),t.undone=di(e.undone.slice(0),null,!0)},setGutterMarker:mr(function(e,t,n){return Gi(this,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&C(r)&&(e.gutterMarkers=null),!0})}),clearGutter:mr(function(e){var t=this;this.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&Gi(t,n,"gutter",function(){return n.gutterMarkers[e]=null,C(n.gutterMarkers)&&(n.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!H(this,e))return null;if(t=e,e=M(this,e),!e)return null}else if(t=D(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:mr(function(t,n,r){return Gi(this,t,"gutter"==n?"gutter":"class",function(t){var i="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass";if(t[i]){if(e(r).test(t[i]))return!1;t[i]+=" "+r}else t[i]=r;return!0})}),removeLineClass:mr(function(t,n,r){return Gi(this,t,"gutter"==n?"gutter":"class",function(t){var i="text"==n?"textClass":"background"==n?"bgClass":"gutter"==n?"gutterClass":"wrapClass",o=t[i];if(!o)return!1;if(null==r)t[i]=null;else{var l=o.match(e(r));if(!l)return!1;var s=l.index+l[0].length;t[i]=o.slice(0,l.index)+(l.index&&s!=o.length?" ":"")+o.slice(s)||null}return!0})}),addLineWidget:mr(function(e,t,n){return Ki(this,e,t,n)}),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Xi(this,U(this,e),U(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return e=U(this,e),Xi(this,e,e,n,"bookmark")},findMarksAt:function(e){e=U(this,e);var t=[],n=M(this,e.line).markedSpans;if(n)for(var r=0;r<n.length;++r){var i=n[r];(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,n){e=U(this,e),t=U(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var s=0;s<l.length;s++){var a=l[s];null!=a.to&&i==e.line&&e.ch>=a.to||null==a.from&&i!=e.line||null!=a.from&&i==t.line&&a.from>=t.ch||n&&!n(a.marker)||r.push(a.marker.parent||a.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;r<n.length;++r)null!=n[r].from&&e.push(n[r].marker)}),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length;return this.iter(function(i){var o=i.text.length+r;if(o>e)return t=e,!0;e-=o,++n}),U(this,F(n,t))},indexFromPos:function(e){e=U(this,e);var t=e.ch;if(e.line<this.first||e.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+n}),t},copy:function(e){var t=new Bs(N(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,n=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to);var r=new Bs(N(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],qi(r,_i(this)),r},unlinkDoc:function(e){var t=this;if(e instanceof qo&&(e=e.doc),this.linked)for(var n=0;n<this.linked.length;++n){var r=t.linked[n];if(r.doc==e){t.linked.splice(n,1),e.unlinkDoc(t),$i(_i(t));break}}if(e.history==this.history){var i=[e.id];Zr(e,function(e){return i.push(e.id)},!0),e.history=new ti(null),e.history.done=di(this.history.done,i),e.history.undone=di(this.history.undone,i)}},iterLinkedDocs:function(e){Zr(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):as(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:mr(function(e){"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&ei(this.cm))})}),Bs.prototype.eachLine=Bs.prototype.iter;for(var Gs=0,Us=!1,js={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:"/",127:"Delete",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"},Vs=0;Vs<10;Vs++)js[Vs+48]=js[Vs+96]=String(Vs);for(var Ks=65;Ks<=90;Ks++)js[Ks]=String.fromCharCode(Ks);for(var Xs=1;Xs<=12;Xs++)js[Xs+111]=js[Xs+63235]="F"+Xs;var Ys={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"},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"},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"},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"]}};Ys.default=Pl?Ys.macDefault:Ys.pcDefault;var _s,qs,$s={selectAll:Ni,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ql)},killLine:function(e){return ho(e,function(t){if(t.empty()){var n=M(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:F(t.head.line+1,0)}:{from:t.head,to:F(t.head.line,n)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){return ho(e,function(t){return{from:F(t.from().line,0),to:U(e.doc,F(t.to().line+1,0))}})},delLineLeft:function(e){return ho(e,function(e){return{from:F(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){return ho(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return{from:r,to:t.from()}})},delWrappedLineRight:function(e){return ho(e,function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div");return{from:t.from(),to:r}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(F(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(F(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return yo(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return wo(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return bo(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")},Zl)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:n},"div")},Zl)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div");return r.ch<e.getLine(r.line).search(/\S/)?wo(e,t.head):r},Zl)},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=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),l=f(e.getLine(o.line),o.ch,r);t.push(p(r-l%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return pr(e,function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)if(t[r].empty()){var i=t[r].head,o=M(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new F(i.line,i.ch-1)),i.ch>0)i=new F(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),F(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=M(e.doc,i.line-1).text;l&&(i=new F(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),F(i.line-1,l.length-1),i,"+transpose"))}n.push(new Ps(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){return pr(e,function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0);_n(e)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}},Zs=new jl,Qs=null,Js=400,ea=function(e,t,n){this.time=e,this.pos=t,this.button=n};ea.prototype.compare=function(e,t,n){return this.time+Js>e&&0==z(t,this.pos)&&n==this.button};var ta={toString:function(){return"CodeMirror.Init"}},na={},ra={};qo.defaults=na,qo.optionHandlers=ra;var ia=[];qo.defineInitHook=function(e){return ia.push(e)};var oa=null,la=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new jl,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};la.prototype.init=function(e){function t(e){if(!Ae(i,e)){if(i.somethingSelected())Qo({lineWise:!1,text:i.getSelections()}),"cut"==e.type&&i.replaceSelection("",null,"cut");else{if(!i.options.lineWiseCopyCut)return;var t=nl(i);Qo({lineWise:!0,text:t.text}),"cut"==e.type&&i.operation(function(){i.setSelections(t.ranges,0,ql),i.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var n=oa.text.join("\n");if(e.clipboardData.setData("Text",n),e.clipboardData.getData("Text")==n)return void e.preventDefault()}var l=il(),s=l.firstChild;i.display.lineSpace.insertBefore(l,i.display.lineSpace.firstChild),s.value=oa.text.join("\n");var a=document.activeElement;Ul(s),setTimeout(function(){i.display.lineSpace.removeChild(l),a.focus(),a==o&&r.showPrimarySelection()},50)}}var n=this,r=this,i=r.cm,o=r.div=e.lineDiv;rl(o,i.options.spellcheck),ls(o,"paste",function(e){Ae(i,e)||el(e,i)||Sl<=11&&setTimeout(gr(i,function(){return n.updateFromDOM()}),20)}),ls(o,"compositionstart",function(e){n.composing={data:e.data,done:!1}}),ls(o,"compositionupdate",function(e){n.composing||(n.composing={data:e.data,done:!1})}),ls(o,"compositionend",function(e){n.composing&&(e.data!=n.composing.data&&n.readFromDOMSoon(),n.composing.done=!0)}),ls(o,"touchstart",function(){return r.forceCompositionEnd()}),ls(o,"input",function(){n.composing||n.readFromDOMSoon()}),ls(o,"copy",t),ls(o,"cut",t)},la.prototype.prepareSelection=function(){var e=Nn(this.cm,!1);return e.focus=this.cm.state.focused,e},la.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},la.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},la.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),r=n.from(),i=n.to();if(t.display.viewTo==t.display.viewFrom||r.line>=t.display.viewTo||i.line<t.display.viewFrom)e.removeAllRanges();else{var o=hl(t,e.anchorNode,e.anchorOffset),l=hl(t,e.focusNode,e.focusOffset);if(!o||o.bad||!l||l.bad||0!=z(B(o,l),r)||0!=z(R(o,l),i)){var s=t.display.view,a=r.line>=t.display.viewFrom&&al(t,r)||{node:s[0].measure.map[2],offset:0},u=i.line<t.display.viewTo&&al(t,i);if(!u){var c=s[s.length-1].measure,f=c.maps?c.maps[c.maps.length-1]:c.map;u={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(a&&u){var h,d=e.rangeCount&&e.getRangeAt(0);try{h=Il(a.node,a.offset,u.offset,u.node)}catch(e){}h&&(!yl&&t.state.focused?(e.collapse(a.node,a.offset),h.collapsed||(e.removeAllRanges(),e.addRange(h))):(e.removeAllRanges(),e.addRange(h)),d&&null==e.anchorNode?e.addRange(d):yl&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},la.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)},la.prototype.showMultipleSelections=function(e){n(this.cm.display.cursorDiv,e.cursors),n(this.cm.display.selectionDiv,e.selection)},la.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},la.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return o(this.div,t)},la.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},la.prototype.blur=function(){this.div.blur()},la.prototype.getField=function(){return this.div},la.prototype.supportsTouch=function(){return!0},la.prototype.receivedFocus=function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():pr(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},la.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},la.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(Wl&&Tl&&this.cm.options.gutters.length&&ul(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=hl(t,e.anchorNode,e.anchorOffset),r=hl(t,e.focusNode,e.focusOffset);n&&r&&pr(t,function(){xi(t.doc,Gr(n,r),ql),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}}},la.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,n,r=this.cm,i=r.display,o=r.doc.sel.primary(),l=o.from(),s=o.to();if(0==l.ch&&l.line>r.firstLine()&&(l=F(l.line-1,M(r.doc,l.line-1).length)),s.ch==M(r.doc,s.line).text.length&&s.line<r.lastLine()&&(s=F(s.line+1,0)),l.line<i.viewFrom||s.line>i.viewTo-1)return!1;l.line==i.viewFrom||0==(e=Mn(r,l.line))?(t=D(i.view[0].line),n=i.view[0].node):(t=D(i.view[e].line),n=i.view[e-1].node.nextSibling);var a,u,c=Mn(r,s.line);if(c==i.view.length-1?(a=i.viewTo-1,u=i.lineDiv.lastChild):(a=D(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!n)return!1;for(var f=r.doc.splitLines(fl(r,n,u,t,a)),h=A(r.doc,F(t,0),F(a,M(r.doc,a).text.length));f.length>1&&h.length>1;)if(g(f)==g(h))f.pop(),h.pop(),a--;else{if(f[0]!=h[0])break;f.shift(),h.shift(),t++}for(var d=0,p=0,v=f[0],m=h[0],y=Math.min(v.length,m.length);d<y&&v.charCodeAt(d)==m.charCodeAt(d);)++d;for(var b=g(f),w=g(h),x=Math.min(b.length-(1==f.length?d:0),w.length-(1==h.length?d:0));p<x&&b.charCodeAt(b.length-p-1)==w.charCodeAt(w.length-p-1);)++p ;if(1==f.length&&1==h.length&&t==l.line)for(;d&&d>l.ch&&b.charCodeAt(b.length-p-1)==w.charCodeAt(w.length-p-1);)d--,p++;f[f.length-1]=b.slice(0,b.length-p).replace(/^\u200b+/,""),f[0]=f[0].slice(d).replace(/\u200b+$/,"");var C=F(t,d),S=F(a,h.length?g(h).length-p:0);return f.length>1||f[0]||z(C,S)?(Ei(r.doc,f,C,S,"+input"),!0):void 0},la.prototype.ensurePolled=function(){this.forceCompositionEnd()},la.prototype.reset=function(){this.forceCompositionEnd()},la.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},la.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))},la.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||pr(this.cm,function(){return yr(e.cm)})},la.prototype.setUneditable=function(e){e.contentEditable="false"},la.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||gr(this.cm,Jo)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},la.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},la.prototype.onContextMenu=function(){},la.prototype.resetPosition=function(){},la.prototype.needsContentAttribute=!0;var sa=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new jl,this.hasSelection=!1,this.composing=null};sa.prototype.init=function(e){function t(e){if(!Ae(i,e)){if(i.somethingSelected())Qo({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=nl(i);Qo({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,ql):(r.prevInput="",o.value=t.text.join("\n"),Ul(o))}"cut"==e.type&&(i.state.cutIncoming=!0)}}var n=this,r=this,i=this.cm;this.createField(e);var o=this.textarea;e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),Dl&&(o.style.width="0px"),ls(o,"input",function(){Cl&&Sl>=9&&n.hasSelection&&(n.hasSelection=null),r.poll()}),ls(o,"paste",function(e){Ae(i,e)||el(e,i)||(i.state.pasteIncoming=!0,r.fastPoll())}),ls(o,"cut",t),ls(o,"copy",t),ls(e.scroller,"paste",function(t){zt(e,t)||Ae(i,t)||(i.state.pasteIncoming=!0,r.focus())}),ls(e.lineSpace,"selectstart",function(t){zt(e,t)||We(t)}),ls(o,"compositionstart",function(){var e=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}}),ls(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},sa.prototype.createField=function(e){this.wrapper=il(),this.textarea=this.wrapper.firstChild},sa.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=Nn(e);if(e.options.moveInputWithCursor){var i=cn(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return r},sa.prototype.showSelection=function(e){var t=this.cm,r=t.display;n(r.cursorDiv,e.cursors),n(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},sa.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&Ul(this.textarea),Cl&&Sl>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",Cl&&Sl>=9&&(this.hasSelection=null))}},sa.prototype.getField=function(){return this.textarea},sa.prototype.supportsTouch=function(){return!1},sa.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Hl||l()!=this.textarea))try{this.textarea.focus()}catch(e){}},sa.prototype.blur=function(){this.textarea.blur()},sa.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},sa.prototype.receivedFocus=function(){this.slowPoll()},sa.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},sa.prototype.fastPoll=function(){function e(){var r=n.poll();r||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))}var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,e)},sa.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||us(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(Cl&&Sl>=9&&this.hasSelection===i||Pl&&/[\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||r||(r="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,s=Math.min(r.length,i.length);l<s&&r.charCodeAt(l)==i.charCodeAt(l);)++l;return pr(t,function(){Jo(t,i.slice(l),r.length-l,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},sa.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},sa.prototype.onKeyPress=function(){Cl&&Sl>=9&&(this.hasSelection=null),this.fastPoll()},sa.prototype.onContextMenu=function(e){function t(){if(null!=l.selectionStart){var e=i.somethingSelected(),t="​"+(e?l.value:"");l.value="⇚",l.value=t,r.prevInput=e?"":"​",l.selectionStart=1,l.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function n(){if(r.contextMenuPending=!1,r.wrapper.style.cssText=f,l.style.cssText=c,Cl&&Sl<9&&o.scrollbars.setScrollTop(o.scroller.scrollTop=a),null!=l.selectionStart){(!Cl||Cl&&Sl<9)&&t();var e=0,n=function(){o.selForContextMenu==i.doc.sel&&0==l.selectionStart&&l.selectionEnd>0&&"​"==r.prevInput?gr(i,Ni)(i):e++<10?o.detectingSelectAll=setTimeout(n,500):(o.selForContextMenu=null,o.input.reset())};o.detectingSelectAll=setTimeout(n,200)}}var r=this,i=r.cm,o=i.display,l=r.textarea,s=Tn(i,e),a=o.scroller.scrollTop;if(s&&!Ml){var u=i.options.resetSelectionOnContextMenu;u&&-1==i.doc.sel.contains(s)&&gr(i,xi)(i.doc,Gr(s),ql);var c=l.style.cssText,f=r.wrapper.style.cssText;r.wrapper.style.cssText="position: absolute";var h,d=r.wrapper.getBoundingClientRect();if(l.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-d.top-5)+"px; left: "+(e.clientX-d.left-5)+"px;\n z-index: 1000; background: "+(Cl?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",Ll&&(h=window.scrollY),o.input.focus(),Ll&&window.scrollTo(null,h),o.input.reset(),i.somethingSelected()||(l.value=r.prevInput=" "),r.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),Cl&&Sl>=9&&t(),Bl){Fe(e);var p=function(){Te(window,"mouseup",p),setTimeout(n,20)};ls(window,"mouseup",p)}else setTimeout(n,50)}},sa.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},sa.prototype.setUneditable=function(){},sa.prototype.needsContentAttribute=!1,Ko(qo),ol(qo);var aa="iter insert remove copy getEditor constructor".split(" ");for(var ua in Bs.prototype)Bs.prototype.hasOwnProperty(ua)&&h(aa,ua)<0&&(qo.prototype[ua]=function(e){return function(){return e.apply(this.doc,arguments)}}(Bs.prototype[ua]));return De(Bs),qo.inputStyles={textarea:sa,contenteditable:la},qo.defineMode=function(e){qo.defaults.mode||"null"==e||(qo.defaults.mode=e),Ge.apply(this,arguments)},qo.defineMIME=Ue,qo.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),qo.defineMIME("text/plain","null"),qo.defineExtension=function(e,t){qo.prototype[e]=t},qo.defineDocExtension=function(e,t){Bs.prototype[e]=t},qo.fromTextArea=pl,gl(qo),qo.version="5.40.5",qo}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,n,r){function i(t){var n=e.wheelEventPixels(t)["horizontal"==o.orientation?"x":"y"],r=o.pos;o.moveTo(o.pos+n),o.pos!=r&&e.e_preventDefault(t)}this.orientation=n,this.scroll=r,this.screen=this.total=this.size=1,this.pos=0,this.node=document.createElement("div"),this.node.className=t+"-"+n,this.inner=this.node.appendChild(document.createElement("div"));var o=this;e.on(this.inner,"mousedown",function(t){function n(){e.off(document,"mousemove",r),e.off(document,"mouseup",n)}function r(e){if(1!=e.which)return n();o.moveTo(s+(e[i]-l)*(o.total/o.size))}if(1==t.which){e.e_preventDefault(t);var i="horizontal"==o.orientation?"pageX":"pageY",l=t[i],s=o.pos;e.on(document,"mousemove",r),e.on(document,"mouseup",n)}}),e.on(this.node,"click",function(t){e.e_preventDefault(t);var n,r=o.inner.getBoundingClientRect();n="horizontal"==o.orientation?t.clientX<r.left?-1:t.clientX>r.right?1:0:t.clientY<r.top?-1:t.clientY>r.bottom?1:0,o.moveTo(o.pos+n*o.screen)}),e.on(this.node,"mousewheel",i),e.on(this.node,"DOMMouseScroll",i)}function n(e,n,r){this.addClass=e,this.horiz=new t(e,"horizontal",r),n(this.horiz.node),this.vert=new t(e,"vertical",r),n(this.vert.node),this.width=null}t.prototype.setPos=function(e,t){return e<0&&(e=0),e>this.total-this.screen&&(e=this.total-this.screen),!(!t&&e==this.pos)&&(this.pos=e,this.inner.style["horizontal"==this.orientation?"left":"top"]=e*(this.size/this.total)+"px",!0)},t.prototype.moveTo=function(e){this.setPos(e)&&this.scroll(e,this.orientation)};var r=10;t.prototype.update=function(e,t,n){var i=this.screen!=t||this.total!=e||this.size!=n;i&&(this.screen=t,this.total=e,this.size=n);var o=this.screen*(this.size/this.total);o<r&&(this.size-=r-o,o=r),this.inner.style["horizontal"==this.orientation?"width":"height"]=o+"px",this.setPos(this.pos,i)},n.prototype.update=function(e){if(null==this.width){var t=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;t&&(this.width=parseInt(t.height))}var n=this.width||0,r=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1;return this.vert.node.style.display=i?"block":"none",this.horiz.node.style.display=r?"block":"none",i&&(this.vert.update(e.scrollHeight,e.clientHeight,e.viewHeight-(r?n:0)),this.vert.node.style.bottom=r?n+"px":"0"),r&&(this.horiz.update(e.scrollWidth,e.clientWidth,e.viewWidth-(i?n:0)-e.barLeft),this.horiz.node.style.right=i?n+"px":"0",this.horiz.node.style.left=e.barLeft+"px"),{right:i?n:0,bottom:r?n:0}},n.prototype.setScrollTop=function(e){this.vert.setPos(e)},n.prototype.setScrollLeft=function(e){this.horiz.setPos(e)},n.prototype.clear=function(){var e=this.horiz.node.parentNode;e.removeChild(this.horiz.node),e.removeChild(this.vert.node)},e.scrollbarModel.simple=function(e,t){return new n("CodeMirror-simplescroll",e,t)},e.scrollbarModel.overlay=function(e,t){return new n("CodeMirror-overlayscroll",e,t)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t=0;t<e.state.activeLines.length;t++)e.removeLineClass(e.state.activeLines[t],"wrap",o),e.removeLineClass(e.state.activeLines[t],"background",l),e.removeLineClass(e.state.activeLines[t],"gutter",s)}function n(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function r(e,r){for(var i=[],a=0;a<r.length;a++){var u=r[a],c=e.getOption("styleActiveLine");if("object"==typeof c&&c.nonEmpty?u.anchor.line==u.head.line:u.empty()){var f=e.getLineHandleVisualStart(u.head.line);i[i.length-1]!=f&&i.push(f)}}n(e.state.activeLines,i)||e.operation(function(){t(e);for(var n=0;n<i.length;n++)e.addLineClass(i[n],"wrap",o),e.addLineClass(i[n],"background",l),e.addLineClass(i[n],"gutter",s);e.state.activeLines=i})}function i(e,t){r(e,t.ranges)}var o="CodeMirror-activeline",l="CodeMirror-activeline-background",s="CodeMirror-activeline-gutter";e.defineOption("styleActiveLine",!1,function(n,o,l){var s=l!=e.Init&&l;o!=s&&(s&&(n.off("beforeSelectionChange",i),t(n),delete n.state.activeLines),o&&(n.state.activeLines=[],r(n,n.listSelections()),n.on("beforeSelectionChange",i)))})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.multiplexingMode=function(t){function n(e,t,n,r){if("string"==typeof t){var i=e.indexOf(t,n);return r&&i>-1?i+t.length:i}var o=t.exec(n?e.slice(n):e);return o?o.index+n+(r?o[0].length:0):-1}var r=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:e.startState(t),innerActive:null,inner:null}},copyState:function(n){return{outer:e.copyState(t,n.outer),innerActive:n.innerActive,inner:n.innerActive&&e.copyState(n.innerActive.mode,n.inner)}},token:function(i,o){if(o.innerActive){var l=o.innerActive;u=i.string;if(!l.close&&i.sol())return o.innerActive=o.inner=null,this.token(i,o);h=l.close?n(u,l.close,i.pos,l.parseDelimiters):-1;if(h==i.pos&&!l.parseDelimiters)return i.match(l.close),o.innerActive=o.inner=null,l.delimStyle&&l.delimStyle+" "+l.delimStyle+"-close";h>-1&&(i.string=u.slice(0,h));var s=l.mode.token(i,o.inner);return h>-1&&(i.string=u),h==i.pos&&l.parseDelimiters&&(o.innerActive=o.inner=null),l.innerStyle&&(s=s?s+" "+l.innerStyle:l.innerStyle),s}for(var a=1/0,u=i.string,c=0;c<r.length;++c){var f=r[c],h=n(u,f.open,i.pos);if(h==i.pos){f.parseDelimiters||i.match(f.open),o.innerActive=f;var d=0;if(t.indent){var p=t.indent(o.outer,"");p!==e.Pass&&(d=p)}return o.inner=e.startState(f.mode,d),f.delimStyle&&f.delimStyle+" "+f.delimStyle+"-open"}-1!=h&&h<a&&(a=h)}a!=1/0&&(i.string=u.slice(0,a));var g=t.token(i,o.outer);return a!=1/0&&(i.string=u),g},indent:function(n,r){var i=n.innerActive?n.innerActive.mode:t;return i.indent?i.indent(n.innerActive?n.inner:n.outer,r):e.Pass},blankLine:function(n){var i=n.innerActive?n.innerActive.mode:t;if(i.blankLine&&i.blankLine(n.innerActive?n.inner:n.outer),n.innerActive)"\n"===n.innerActive.close&&(n.innerActive=n.inner=null);else for(var o=0;o<r.length;++o){var l=r[o];"\n"===l.open&&(n.innerActive=l,n.inner=e.startState(l.mode,i.indent?i.indent(n.outer,""):0))}},electricChars:t.electricChars,innerMode:function(e){return e.inner?{state:e.inner,mode:e.innerActive.mode}:{state:e.outer,mode:t}}}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.overlayMode=function(t,n,r){return{startState:function(){return{base:e.startState(t),overlay:e.startState(n),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(r){return{base:e.copyState(t,r.base),overlay:e.copyState(n,r.overlay),basePos:r.basePos,baseCur:null,overlayPos:r.overlayPos,overlayCur:null}},token:function(e,i){return(e!=i.streamSeen||Math.min(i.basePos,i.overlayPos)<e.start)&&(i.streamSeen=e,i.basePos=i.overlayPos=e.start),e.start==i.basePos&&(i.baseCur=t.token(e,i.base),i.basePos=e.pos),e.start==i.overlayPos&&(e.pos=e.start,i.overlayCur=n.token(e,i.overlay),i.overlayPos=e.pos),e.pos=Math.min(i.basePos,i.overlayPos),null==i.overlayCur?i.baseCur:null!=i.baseCur&&i.overlay.combineTokens||r&&null==i.overlay.combineTokens?i.baseCur+" "+i.overlayCur:i.overlayCur},indent:t.indent&&function(e,n){return t.indent(e.base,n)},electricChars:t.electricChars,innerMode:function(e){return{state:e.base,mode:t}},blankLine:function(e){var i,o;return t.blankLine&&(i=t.blankLine(e.base)),n.blankLine&&(o=n.blankLine(e.overlay)),null==o?i:r&&null!=i?i+" "+o:o}}}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){if(!e.hasOwnProperty(t))throw new Error("Undefined state "+t+" in simple mode")}function n(e,t){if(!e)return/(?:)/;var n="";return e instanceof RegExp?(e.ignoreCase&&(n="i"),e=e.source):e=String(e),new RegExp((!1===t?"":"^")+"(?:"+e+")",n)}function r(e){if(!e)return null;if(e.apply)return e;if("string"==typeof e)return e.replace(/\./g," ");for(var t=[],n=0;n<e.length;n++)t.push(e[n]&&e[n].replace(/\./g," "));return t}function i(e,i){(e.next||e.push)&&t(i,e.next||e.push),this.regex=n(e.regex),this.token=r(e.token),this.data=e}function o(e,t){return function(n,r){if(r.pending){var i=r.pending.shift();return 0==r.pending.length&&(r.pending=null),n.pos+=i.text.length,i.token}if(r.local){if(r.local.end&&n.match(r.local.end)){var o=r.local.endToken||null;return r.local=r.localState=null,o}var l;o=r.local.mode.token(n,r.localState);return r.local.endScan&&(l=r.local.endScan.exec(n.current()))&&(n.pos=n.start+l.index),o}for(var a=e[r.state],u=0;u<a.length;u++){var c=a[u],f=(!c.data.sol||n.sol())&&n.match(c.regex);if(f){c.data.next?r.state=c.data.next:c.data.push?((r.stack||(r.stack=[])).push(r.state),r.state=c.data.push):c.data.pop&&r.stack&&r.stack.length&&(r.state=r.stack.pop()),c.data.mode&&s(t,r,c.data.mode,c.token),c.data.indent&&r.indent.push(n.indentation()+t.indentUnit),c.data.dedent&&r.indent.pop();var h=c.token;if(h&&h.apply&&(h=h(f)),f.length>2&&c.token&&"string"!=typeof c.token){r.pending=[];for(var d=2;d<f.length;d++)f[d]&&r.pending.push({text:f[d],token:c.token[d-1]});return n.backUp(f[0].length-(f[1]?f[1].length:0)),h[0]}return h&&h.join?h[0]:h}}return n.next(),null}}function l(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;var n=0;for(var r in e)if(e.hasOwnProperty(r)){if(!t.hasOwnProperty(r)||!l(e[r],t[r]))return!1;n++}for(var r in t)t.hasOwnProperty(r)&&n--;return 0==n}function s(t,r,i,o){var s;if(i.persistent)for(var a=r.persistentStates;a&&!s;a=a.next)(i.spec?l(i.spec,a.spec):i.mode==a.mode)&&(s=a);var u=s?s.mode:i.mode||e.getMode(t,i.spec),c=s?s.state:e.startState(u);i.persistent&&!s&&(r.persistentStates={mode:u,spec:i.spec,state:c,next:r.persistentStates}),r.localState=c,r.local={mode:u,end:i.end&&n(i.end),endScan:i.end&&!1!==i.forceEnd&&n(i.end,!1),endToken:o&&o.join?o[o.length-1]:o}}function a(e,t){for(var n=0;n<t.length;n++)if(t[n]===e)return!0}function u(t,n){return function(r,i,o){if(r.local&&r.local.mode.indent)return r.local.mode.indent(r.localState,i,o);if(null==r.indent||r.local||n.dontIndentStates&&a(r.state,n.dontIndentStates)>-1)return e.Pass;var l=r.indent.length-1,s=t[r.state];e:for(;;){for(var u=0;u<s.length;u++){var c=s[u];if(c.data.dedent&&!1!==c.data.dedentIfLineStart){var f=c.regex.exec(i);if(f&&f[0]){l--,(c.next||c.push)&&(s=t[c.next||c.push]),i=i.slice(f[0].length);continue e}}}break}return l<0?0:r.indent[l]}}e.defineSimpleMode=function(t,n){e.defineMode(t,function(t){return e.simpleMode(t,n)})},e.simpleMode=function(n,r){t(r,"start");var l={},s=r.meta||{},a=!1;for(var c in r)if(c!=s&&r.hasOwnProperty(c))for(var f=l[c]=[],h=r[c],d=0;d<h.length;d++){var p=h[d];f.push(new i(p,r)),(p.indent||p.dedent)&&(a=!0)}var g={startState:function(){return{state:"start",pending:null,local:null,localState:null,indent:a?[]:null}},copyState:function(t){var n={state:t.state,pending:t.pending,local:t.local,localState:null,indent:t.indent&&t.indent.slice(0)};t.localState&&(n.localState=e.copyState(t.local.mode,t.localState)),t.stack&&(n.stack=t.stack.slice(0));for(var r=t.persistentStates;r;r=r.next)n.persistentStates={mode:r.mode,spec:r.spec,state:r.state==t.localState?n.localState:e.copyState(r.mode,r.state),next:n.persistentStates};return n},token:o(l,n),innerMode:function(e){return e.local&&{mode:e.local.mode,state:e.localState}},indent:u(l,s)};if(s)for(var v in s)s.hasOwnProperty(v)&&(g[v]=s[v]);return g}});