UNPKG

choco-algorithm

Version:

Algorithm runtime emulator, like a IDE

1 lines 464 kB
!function(e){function t(e){delete installedChunks[e]}function n(e){var t=document.getElementsByTagName("head")[0],n=document.createElement("script");n.type="text/javascript",n.charset="utf-8",n.src=p.p+""+e+"."+w+".hot-update.js",t.appendChild(n)}function r(e){return e=e||1e4,new Promise(function(t,n){if("undefined"==typeof XMLHttpRequest)return n(new Error("No browser support"));try{var r=new XMLHttpRequest,o=p.p+""+w+".hot-update.json";r.open("GET",o,!0),r.timeout=e,r.send(null)}catch(e){return n(e)}r.onreadystatechange=function(){if(4===r.readyState)if(0===r.status)n(new Error("Manifest request to "+o+" timed out."));else if(404===r.status)t();else if(200!==r.status&&304!==r.status)n(new Error("Manifest request to "+o+" failed."));else{try{var e=JSON.parse(r.responseText)}catch(e){return void n(e)}t(e)}}})}function o(e){var t=N[e];if(!t)return p;var n=function(n){return t.hot.active?(N[n]?N[n].parents.indexOf(e)<0&&N[n].parents.push(e):(S=[e],m=n),t.children.indexOf(n)<0&&t.children.push(n)):(console.warn("[HMR] unexpected require("+n+") from disposed module "+e),S=[]),p(n)};for(var r in p)Object.prototype.hasOwnProperty.call(p,r)&&"e"!==r&&Object.defineProperty(n,r,function(e){return{configurable:!0,enumerable:!0,get:function(){return p[e]},set:function(t){p[e]=t}}}(r));return n.e=function(e){function t(){P--,"prepare"===_&&(M[e]||c(e),0===P&&0===T&&f())}return"ready"===_&&a("prepare"),P++,p.e(e).then(t,function(e){throw t(),e})},n}function i(e){var t={_acceptedDependencies:{},_declinedDependencies:{},_selfAccepted:!1,_selfDeclined:!1,_disposeHandlers:[],_main:m!==e,active:!0,accept:function(e,n){if(void 0===e)t._selfAccepted=!0;else if("function"==typeof e)t._selfAccepted=e;else if("object"==typeof e)for(var r=0;r<e.length;r++)t._acceptedDependencies[e[r]]=n||function(){};else t._acceptedDependencies[e]=n||function(){}},decline:function(e){if(void 0===e)t._selfDeclined=!0;else if("object"==typeof e)for(var n=0;n<e.length;n++)t._declinedDependencies[e[n]]=!0;else t._declinedDependencies[e]=!0},dispose:function(e){t._disposeHandlers.push(e)},addDisposeHandler:function(e){t._disposeHandlers.push(e)},removeDisposeHandler:function(e){var n=t._disposeHandlers.indexOf(e);n>=0&&t._disposeHandlers.splice(n,1)},check:s,apply:d,status:function(e){if(!e)return _;O.push(e)},addStatusHandler:function(e){O.push(e)},removeStatusHandler:function(e){var t=O.indexOf(e);t>=0&&O.splice(t,1)},data:C[e]};return m=void 0,t}function a(e){_=e;for(var t=0;t<O.length;t++)O[t].call(null,e)}function l(e){return+e+""===e?+e:e}function s(e){if("idle"!==_)throw new Error("check() is only allowed in idle status");return b=e,a("check"),r(x).then(function(e){if(!e)return a("idle"),null;E={},M={},L=e.c,y=e.h,a("prepare");var t=new Promise(function(e,t){v={resolve:e,reject:t}});g={};return c(0),"prepare"===_&&0===P&&0===T&&f(),t})}function u(e,t){if(L[e]&&E[e]){E[e]=!1;for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(g[n]=t[n]);0==--T&&0===P&&f()}}function c(e){L[e]?(E[e]=!0,T++,n(e)):M[e]=!0}function f(){a("ready");var e=v;if(v=null,e)if(b)Promise.resolve().then(function(){return d(b)}).then(function(t){e.resolve(t)},function(t){e.reject(t)});else{var t=[];for(var n in g)Object.prototype.hasOwnProperty.call(g,n)&&t.push(l(n));e.resolve(t)}}function d(n){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.indexOf(r)<0&&e.push(r)}}if("ready"!==_)throw new Error("apply() is only allowed in ready status");n=n||{};var o,i,s,u,c,f={},d=[],h={},m=function(){console.warn("[HMR] unexpected require("+b.moduleId+") to disposed module")};for(var v in g)if(Object.prototype.hasOwnProperty.call(g,v)){c=l(v);var b;b=g[v]?function(e){for(var t=[e],n={},o=t.slice().map(function(e){return{chain:[e],id:e}});o.length>0;){var i=o.pop(),a=i.id,l=i.chain;if((u=N[a])&&!u.hot._selfAccepted){if(u.hot._selfDeclined)return{type:"self-declined",chain:l,moduleId:a};if(u.hot._main)return{type:"unaccepted",chain:l,moduleId:a};for(var s=0;s<u.parents.length;s++){var c=u.parents[s],f=N[c];if(f){if(f.hot._declinedDependencies[a])return{type:"declined",chain:l.concat([c]),moduleId:a,parentId:c};t.indexOf(c)>=0||(f.hot._acceptedDependencies[a]?(n[c]||(n[c]=[]),r(n[c],[a])):(delete n[c],t.push(c),o.push({chain:l.concat([c]),id:c})))}}}}return{type:"accepted",moduleId:e,outdatedModules:t,outdatedDependencies:n}}(c):{type:"disposed",moduleId:v};var x=!1,k=!1,O=!1,T="";switch(b.chain&&(T="\nUpdate propagation: "+b.chain.join(" -> ")),b.type){case"self-declined":n.onDeclined&&n.onDeclined(b),n.ignoreDeclined||(x=new Error("Aborted because of self decline: "+b.moduleId+T));break;case"declined":n.onDeclined&&n.onDeclined(b),n.ignoreDeclined||(x=new Error("Aborted because of declined dependency: "+b.moduleId+" in "+b.parentId+T));break;case"unaccepted":n.onUnaccepted&&n.onUnaccepted(b),n.ignoreUnaccepted||(x=new Error("Aborted because "+c+" is not accepted"+T));break;case"accepted":n.onAccepted&&n.onAccepted(b),k=!0;break;case"disposed":n.onDisposed&&n.onDisposed(b),O=!0;break;default:throw new Error("Unexception type "+b.type)}if(x)return a("abort"),Promise.reject(x);if(k){h[c]=g[c],r(d,b.outdatedModules);for(c in b.outdatedDependencies)Object.prototype.hasOwnProperty.call(b.outdatedDependencies,c)&&(f[c]||(f[c]=[]),r(f[c],b.outdatedDependencies[c]))}O&&(r(d,[b.moduleId]),h[c]=m)}var P=[];for(i=0;i<d.length;i++)c=d[i],N[c]&&N[c].hot._selfAccepted&&P.push({module:c,errorHandler:N[c].hot._selfAccepted});a("dispose"),Object.keys(L).forEach(function(e){!1===L[e]&&t(e)});for(var M,E=d.slice();E.length>0;)if(c=E.pop(),u=N[c]){var A={},j=u.hot._disposeHandlers;for(s=0;s<j.length;s++)(o=j[s])(A);for(C[c]=A,u.hot.active=!1,delete N[c],delete f[c],s=0;s<u.children.length;s++){var R=N[u.children[s]];R&&((M=R.parents.indexOf(c))>=0&&R.parents.splice(M,1))}}var D,I;for(c in f)if(Object.prototype.hasOwnProperty.call(f,c)&&(u=N[c]))for(I=f[c],s=0;s<I.length;s++)D=I[s],(M=u.children.indexOf(D))>=0&&u.children.splice(M,1);a("apply"),w=y;for(c in h)Object.prototype.hasOwnProperty.call(h,c)&&(e[c]=h[c]);var H=null;for(c in f)if(Object.prototype.hasOwnProperty.call(f,c)&&(u=N[c])){I=f[c];var F=[];for(i=0;i<I.length;i++)if(D=I[i],o=u.hot._acceptedDependencies[D]){if(F.indexOf(o)>=0)continue;F.push(o)}for(i=0;i<F.length;i++){o=F[i];try{o(I)}catch(e){n.onErrored&&n.onErrored({type:"accept-errored",moduleId:c,dependencyId:I[i],error:e}),n.ignoreErrored||H||(H=e)}}}for(i=0;i<P.length;i++){var U=P[i];c=U.module,S=[c];try{p(c)}catch(e){if("function"==typeof U.errorHandler)try{U.errorHandler(e)}catch(t){n.onErrored&&n.onErrored({type:"self-accept-error-handler-errored",moduleId:c,error:t,orginalError:e,originalError:e}),n.ignoreErrored||H||(H=t),H||(H=e)}else n.onErrored&&n.onErrored({type:"self-accept-errored",moduleId:c,error:e}),n.ignoreErrored||H||(H=e)}}return H?(a("fail"),Promise.reject(H)):(a("idle"),new Promise(function(e){e(d)}))}function p(t){if(N[t])return N[t].exports;var n=N[t]={i:t,l:!1,exports:{},hot:i(t),parents:(k=S,S=[],k),children:[]};return e[t].call(n.exports,n,n.exports,o(t)),n.l=!0,n.exports}var h=window.webpackHotUpdate;window.webpackHotUpdate=function(e,t){u(e,t),h&&h(e,t)};var m,v,g,y,b=!0,w="c1f194f6b6df53ef5bed",x=1e4,C={},S=[],k=[],O=[],_="idle",T=0,P=0,M={},E={},L={},N={};p.m=e,p.c=N,p.d=function(e,t,n){p.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},p.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return p.d(t,"a",t),t},p.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},p.p="assets/",p.h=function(){return w},o(59)(p.s=59)}([function(e,t,n){"use strict";e.exports=n(60)},function(e,t,n){e.exports=n(72)()},function(e,t,n){"use strict";var r=function(){};e.exports=r},function(e,t,n){"use strict";var r=function(e,t,n,r,o,i,a,l){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,o,i,a,l],c=0;s=new Error(t.replace(/%s/g,function(){return u[c++]})),s.name="Invariant Violation"}throw s.framesToPop=1,s}};e.exports=r},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o,i;!function(a,l){"object"===r(t)&&void 0!==e?e.exports=l():(o=l,void 0!==(i="function"==typeof o?o.call(t,n,t,e):o)&&(e.exports=i))}(0,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 o(e,t,n,r){var o=document.createElement(e);if(n&&(o.className=n),r&&(o.style.cssText=r),"string"==typeof t)o.appendChild(document.createTextNode(t));else if(t)for(var i=0;i<t.length;++i)o.appendChild(t[i]);return o}function i(e,t,n,r){var i=o(e,t,n,r);return i.setAttribute("role","presentation"),i}function a(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 u(t,n){for(var r=t.split(" "),o=0;o<r.length;o++)r[o]&&!e(r[o]).test(n)&&(n+=" "+r[o]);return n}function c(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function f(e,t,n){t||(t={});for(var r in e)!e.hasOwnProperty(r)||!1===n&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function d(e,t,n,r,o){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var i=r||0,a=o||0;;){var l=e.indexOf("\t",i);if(l<0||l>=t)return a+(t-i);a+=l-i,a+=n-a%n,i=l+1}}function p(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n;return-1}function h(e,t,n){for(var r=0,o=0;;){var i=e.indexOf("\t",r);-1==i&&(i=e.length);var a=i-r;if(i==e.length||o+a>=t)return r+Math.min(a,t-o);if(o+=i-r,o+=n-o%n,r=i+1,o>=t)return r}}function m(e){for(;$a.length<=e;)$a.push(v($a)+" ");return $a[e]}function v(e){return e[e.length-1]}function g(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r);return n}function y(e,t,n){for(var r=0,o=n(t);r<e.length&&n(e[r])<=o;)r++;e.splice(r,0,t)}function b(){}function w(e,t){var n;return Object.create?n=Object.create(e):(b.prototype=e,n=new b),t&&f(t,n),n}function x(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Ya.test(e))}function C(e,t){return t?!!(t.source.indexOf("\\w")>-1&&x(e))||t.test(e):x(e)}function S(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function k(e){return e.charCodeAt(0)>=768&&Xa.test(e)}function O(e,t,n){for(;(n<0?t>0:t<e.length)&&k(e.charAt(t));)t+=n;return t}function _(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t;var o=(t+n)/2,i=r<0?Math.ceil(o):Math.floor(o);if(i==t)return e(i)?t:n;e(i)?n=i:t=i+r}}function T(e,t,n){var r=this;this.input=n,r.scrollbarFiller=o("div",null,"CodeMirror-scrollbar-filler"),r.scrollbarFiller.setAttribute("cm-not-content","true"),r.gutterFiller=o("div",null,"CodeMirror-gutter-filler"),r.gutterFiller.setAttribute("cm-not-content","true"),r.lineDiv=i("div",null,"CodeMirror-code"),r.selectionDiv=o("div",null,null,"position: relative; z-index: 1"),r.cursorDiv=o("div",null,"CodeMirror-cursors"),r.measure=o("div",null,"CodeMirror-measure"),r.lineMeasure=o("div",null,"CodeMirror-measure"),r.lineSpace=i("div",[r.measure,r.lineMeasure,r.selectionDiv,r.cursorDiv,r.lineDiv],null,"position: relative; outline: none");var a=i("div",[r.lineSpace],"CodeMirror-lines");r.mover=o("div",[a],null,"position: relative"),r.sizer=o("div",[r.mover],"CodeMirror-sizer"),r.sizerWidth=null,r.heightForcer=o("div",null,null,"position: absolute; height: "+Ba+"px; width: 1px;"),r.gutters=o("div",null,"CodeMirror-gutters"),r.lineGutter=null,r.scroller=o("div",[r.sizer,r.heightForcer,r.gutters],"CodeMirror-scroll"),r.scroller.setAttribute("tabIndex","-1"),r.wrapper=o("div",[r.scrollbarFiller,r.gutterFiller,r.scroller],"CodeMirror"),ba&&wa<8&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),xa||ma&&Ea||(r.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(r.wrapper):e(r.wrapper)),r.viewFrom=r.viewTo=t.first,r.reportedViewFrom=r.reportedViewTo=t.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,n.init(r)}function P(e,t){if((t-=e.first)<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 o=n.children[r],i=o.chunkSize();if(t<i){n=o;break}t-=i}return n.lines[t]}function M(e,t,n){var r=[],o=t.line;return e.iter(t.line,n.line+1,function(e){var i=e.text;o==n.line&&(i=i.slice(0,n.ch)),o==t.line&&(i=i.slice(t.ch)),r.push(i),++o}),r}function E(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function L(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function N(e){if(null==e.parent)return null;for(var t=e.parent,n=p(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var o=0;r.children[o]!=t;++o)n+=r.children[o].chunkSize();return n+t.first}function A(e,t){var n=e.first;e:do{for(var r=0;r<e.children.length;++r){var o=e.children[r],i=o.height;if(t<i){e=o;continue e}t-=i,n+=o.chunkSize()}return n}while(!e.lines);for(var a=0;a<e.lines.length;++a){var l=e.lines[a],s=l.height;if(t<s)break;t-=s}return n+a}function j(e,t){return t>=e.first&&t<e.first+e.size}function R(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function D(e,t,n){if(void 0===n&&(n=null),!(this instanceof D))return new D(e,t,n);this.line=e,this.ch=t,this.sticky=n}function I(e,t){return e.line-t.line||e.ch-t.ch}function H(e,t){return e.sticky==t.sticky&&0==I(e,t)}function F(e){return D(e.line,e.ch)}function U(e,t){return I(e,t)<0?t:e}function W(e,t){return I(e,t)<0?e:t}function z(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function B(e,t){if(t.line<e.first)return D(e.first,0);var n=e.first+e.size-1;return t.line>n?D(n,P(e,n).text.length):V(t,P(e,t.line).text.length)}function V(e,t){var n=e.ch;return null==n||n>t?D(e.line,t):n<0?D(e.line,0):e}function q(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=B(e,t[r]);return n}function K(){Qa=!0}function G(){Za=!0}function $(e,t,n){this.marker=e,this.from=t,this.to=n}function Y(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n];if(r.marker==t)return r}}function X(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r]);return n}function Q(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 o=0;o<e.length;++o){var i=e[o],a=i.marker,l=null==i.from||(a.inclusiveLeft?i.from<=t:i.from<t);if(l||i.from==t&&"bookmark"==a.type&&(!n||!i.marker.insertLeft)){var s=null==i.to||(a.inclusiveRight?i.to>=t:i.to>t);(r||(r=[])).push(new $(a,i.from,s?null:i.to))}}return r}function J(e,t,n){var r;if(e)for(var o=0;o<e.length;++o){var i=e[o],a=i.marker,l=null==i.to||(a.inclusiveRight?i.to>=t:i.to>t);if(l||i.from==t&&"bookmark"==a.type&&(!n||i.marker.insertLeft)){var s=null==i.from||(a.inclusiveLeft?i.from<=t:i.from<t);(r||(r=[])).push(new $(a,s?null:i.from-t,null==i.to?null:i.to-t))}}return r}function ee(e,t){if(t.full)return null;var n=j(e,t.from.line)&&P(e,t.from.line).markedSpans,r=j(e,t.to.line)&&P(e,t.to.line).markedSpans;if(!n&&!r)return null;var o=t.from.ch,i=t.to.ch,a=0==I(t.from,t.to),l=Z(n,o,a),s=J(r,i,a),u=1==t.text.length,c=v(t.text).length+(u?o:0);if(l)for(var f=0;f<l.length;++f){var d=l[f];if(null==d.to){var p=Y(s,d.marker);p?u&&(d.to=null==p.to?null:p.to+c):d.to=o}}if(s)for(var h=0;h<s.length;++h){var m=s[h];if(null!=m.to&&(m.to+=c),null==m.from){var g=Y(l,m.marker);g||(m.from=c,u&&(l||(l=[])).push(m))}else m.from+=c,u&&(l||(l=[])).push(m)}l&&(l=te(l)),s&&s!=l&&(s=te(s));var y=[l];if(!u){var b,w=t.text.length-2;if(w>0&&l)for(var x=0;x<l.length;++x)null==l[x].to&&(b||(b=[])).push(new $(l[x].marker,null,null));for(var C=0;C<w;++C)y.push(b);y.push(s)}return y}function te(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 ne(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!=p(r,n)||(r||(r=[])).push(n)}}),!r)return null;for(var o=[{from:t,to:n}],i=0;i<r.length;++i)for(var a=r[i],l=a.find(0),s=0;s<o.length;++s){var u=o[s];if(!(I(u.to,l.from)<0||I(u.from,l.to)>0)){var c=[s,1],f=I(u.from,l.from),d=I(u.to,l.to);(f<0||!a.inclusiveLeft&&!f)&&c.push({from:u.from,to:l.from}),(d>0||!a.inclusiveRight&&!d)&&c.push({from:l.to,to:u.to}),o.splice.apply(o,c),s+=c.length-3}}return o}function re(e){var t=e.markedSpans;if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e);e.markedSpans=null}}function oe(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 ae(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(),o=t.find(),i=I(r.from,o.from)||ie(e)-ie(t);if(i)return-i;var a=I(r.to,o.to)||ae(e)-ae(t);return a||t.id-e.id}function se(e,t){var n,r=Za&&e.markedSpans;if(r)for(var o=void 0,i=0;i<r.length;++i)o=r[i],o.marker.collapsed&&null==(t?o.from:o.to)&&(!n||le(n,o.marker)<0)&&(n=o.marker);return n}function ue(e){return se(e,!0)}function ce(e){return se(e,!1)}function fe(e,t,n,r,o){var i=P(e,t),a=Za&&i.markedSpans;if(a)for(var l=0;l<a.length;++l){var s=a[l];if(s.marker.collapsed){var u=s.marker.find(0),c=I(u.from,n)||ie(s.marker)-ie(o),f=I(u.to,r)||ae(s.marker)-ae(o);if(!(c>=0&&f<=0||c<=0&&f>=0)&&(c<=0&&(s.marker.inclusiveRight&&o.inclusiveLeft?I(u.to,n)>=0:I(u.to,n)>0)||c>=0&&(s.marker.inclusiveRight&&o.inclusiveLeft?I(u.from,r)<=0:I(u.from,r)<0)))return!0}}}function de(e){for(var t;t=ue(e);)e=t.find(-1,!0).line;return e}function pe(e){for(var t;t=ce(e);)e=t.find(1,!0).line;return e}function he(e){for(var t,n;t=ce(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function me(e,t){var n=P(e,t),r=de(n);return n==r?t:N(r)}function ve(e,t){if(t>e.lastLine())return t;var n,r=P(e,t);if(!ge(e,r))return t;for(;n=ce(r);)r=n.find(1,!0).line;return N(r)+1}function ge(e,t){var n=Za&&t.markedSpans;if(n)for(var r=void 0,o=0;o<n.length;++o)if(r=n[o],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,Y(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0;for(var o=void 0,i=0;i<t.markedSpans.length;++i)if(o=t.markedSpans[i],o.marker.collapsed&&!o.marker.widgetNode&&o.from==n.to&&(null==o.to||o.to!=n.from)&&(o.marker.inclusiveLeft||n.marker.inclusiveRight)&&ye(e,t,o))return!0}function be(e){e=de(e);for(var t=0,n=e.parent,r=0;r<n.lines.length;++r){var o=n.lines[r];if(o==e)break;t+=o.height}for(var i=n.parent;i;n=i,i=n.parent)for(var a=0;a<i.children.length;++a){var l=i.children[a];if(l==n)break;t+=l.height}return t}function we(e){if(0==e.height)return 0;for(var t,n=e.text.length,r=e;t=ue(r);){var o=t.find(0,!0);r=o.from.line,n+=o.from.ch-o.to.ch}for(r=e;t=ce(r);){var i=t.find(0,!0);n-=r.text.length-i.from.ch,r=i.to.line,n+=r.text.length-i.to.ch}return n}function xe(e){var t=e.display,n=e.doc;t.maxLine=P(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 o=!1,i=0;i<e.length;++i){var a=e[i];(a.from<n&&a.to>t||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",i),o=!0)}o||r(t,n,"ltr")}function Se(e,t,n){var r;Ja=null;for(var o=0;o<e.length;++o){var i=e[o];if(i.from<t&&i.to>t)return o;i.to==t&&(i.from!=i.to&&"before"==n?r=o:Ja=o),i.from==t&&(i.from!=i.to&&"before"!=n?r=o:Ja=o)}return null!=r?r:Ja}function ke(e,t){var n=e.order;return null==n&&(n=e.order=el(e.text,t)),n}function Oe(e,t){return e._handlers&&e._handlers[t]||tl}function _e(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,o=r&&r[t];if(o){var i=p(o,n);i>-1&&(r[t]=o.slice(0,i).concat(o.slice(i+1)))}}}function Te(e,t){var n=Oe(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),o=0;o<n.length;++o)n[o].apply(null,r)}function Pe(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),Te(e,n||t.type,e,t),je(t)||t.codemirrorIgnore}function Me(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==p(n,t[r])&&n.push(t[r])}function Ee(e,t){return Oe(e,t).length>0}function Le(e){e.prototype.on=function(e,t){nl(this,e,t)},e.prototype.off=function(e,t){_e(this,e,t)}}function Ne(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function Ae(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function je(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Re(e){Ne(e),Ae(e)}function De(e){return e.target||e.srcElement}function Ie(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),La&&e.ctrlKey&&1==t&&(t=3),t}function He(e){if(null==Wa){var t=o("span","​");n(e,o("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Wa=t.offsetWidth<=1&&t.offsetHeight>2&&!(ba&&wa<8))}var r=Wa?o("span","​"):o("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Fe(e){if(null!=za)return za;var r=n(e,document.createTextNode("AخA")),o=Ra(r,0,1).getBoundingClientRect(),i=Ra(r,1,2).getBoundingClientRect();return t(e),!(!o||o.left==o.right)&&(za=i.right-o.right<3)}function Ue(e){if(null!=ll)return ll;var t=n(e,o("span","x")),r=t.getBoundingClientRect(),i=Ra(t,0,1).getBoundingClientRect();return ll=Math.abs(r.left-i.left)>1}function We(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),sl[e]=t}function ze(e,t){ul[e]=t}function Be(e){if("string"==typeof e&&ul.hasOwnProperty(e))e=ul[e];else if(e&&"string"==typeof e.name&&ul.hasOwnProperty(e.name)){var t=ul[e.name];"string"==typeof t&&(t={name:t}),e=w(t,e),e.name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Be("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Be("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ve(e,t){t=Be(t);var n=sl[t.name];if(!n)return Ve(e,"text/plain");var r=n(e,t);if(cl.hasOwnProperty(t.name)){var o=cl[t.name];for(var i in o)o.hasOwnProperty(i)&&(r.hasOwnProperty(i)&&(r["_"+i]=r[i]),r[i]=o[i])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}function qe(e,t){f(t,cl.hasOwnProperty(e)?cl[e]:cl[e]={})}function Ke(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var o=t[r];o instanceof Array&&(o=o.concat([])),n[r]=o}return n}function Ge(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&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 Ye(e,t,n,r){var o=[e.state.modeGen],i={};rt(e,t.text,e.doc.mode,n,function(e,t){return o.push(e,t)},i,r);for(var a=n.state,l=0;l<e.state.overlays.length;++l)!function(r){n.baseTokens=o;var l=e.state.overlays[r],s=1,u=0;n.state=!0,rt(e,t.text,l.mode,n,function(e,t){for(var n=s;u<e;){var r=o[s];r>e&&o.splice(s,1,e,o[s+1],r),s+=2,u=Math.min(e,r)}if(t)if(l.opaque)o.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;n<s;n+=2){var i=o[n+1];o[n+1]=(i?i+" ":"")+"overlay "+t}},i),n.state=a,n.baseTokens=null,n.baseTokenPos=1}(l);return{styles:o,classes:i.bgClass||i.textClass?i:null}}function Xe(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Qe(e,N(t)),o=t.text.length>e.options.maxHighlightLength&&Ke(e.doc.mode,r.state),i=Ye(e,t,r);o&&(r.state=o),t.stateAfter=r.save(!o),t.styles=i.styles,i.classes?t.styleClasses=i.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 Qe(e,t,n){var r=e.doc,o=e.display;if(!r.mode.startState)return new pl(r,!0,t);var i=ot(e,t,n),a=i>r.first&&P(r,i-1).stateAfter,l=a?pl.fromSaved(r,a,i):new pl(r,$e(r.mode),i);return r.iter(i,t,function(n){Ze(e,n.text,l);var r=l.line;n.stateAfter=r==t-1||r%5==0||r>=o.viewFrom&&r<o.viewTo?l.save():null,l.nextLine()}),n&&(r.modeFrontier=l.line),l}function Ze(e,t,n,r){var o=e.doc.mode,i=new fl(t,e.options.tabSize,n);for(i.start=i.pos=r||0,""==t&&Je(o,n.state);!i.eol();)et(o,i,n.state),i.start=i.pos}function Je(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var n=Ge(e,t);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function et(e,t,n,r){for(var o=0;o<10;o++){r&&(r[0]=Ge(e,n).mode);var i=e.token(t,n);if(t.pos>t.start)return i}throw new Error("Mode "+e.name+" failed to advance stream.")}function tt(e,t,n,r){var o,i=e.doc,a=i.mode;t=B(i,t);var l,s=P(i,t.line),u=Qe(e,t.line,n),c=new fl(s.text,e.options.tabSize,u);for(r&&(l=[]);(r||c.pos<t.ch)&&!c.eol();)c.start=c.pos,o=et(a,c,u.state),r&&l.push(new hl(c,o,Ke(i.mode,u.state)));return r?l:new hl(c,o,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,o,i,a){var l=n.flattenSpans;null==l&&(l=e.options.flattenSpans);var s,u=0,c=null,f=new fl(t,e.options.tabSize,r),d=e.options.addModeClass&&[null];for(""==t&&nt(Je(n,r.state),i);!f.eol();){if(f.pos>e.options.maxHighlightLength?(l=!1,a&&Ze(e,t,r,f.pos),f.pos=t.length,s=null):s=nt(et(n,f,r.state,d),i),d){var p=d[0].name;p&&(s="m-"+(s?p+" "+s:p))}if(!l||c!=s){for(;u<f.start;)u=Math.min(f.start,u+5e3),o(u,c);c=s}f.start=f.pos}for(;u<f.pos;){var h=Math.min(f.pos,u+5e3);o(h,c),u=h}}function ot(e,t,n){for(var r,o,i=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=i.first)return i.first;var s=P(i,l-1),u=s.stateAfter;if(u&&(!n||l+(u instanceof dl?u.lookAhead:0)<=i.modeFrontier))return l;var c=d(s.text,null,e.options.tabSize);(null==o||r>c)&&(o=l-1,r=c)}return o}function it(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 o=P(e,r).stateAfter;if(o&&(!(o instanceof dl)||r+o.lookAhead<t)){n=r+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}function at(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),re(e),oe(e,n);var o=r?r(e):1;o!=e.height&&L(e,o)}function lt(e){e.parent=null,re(e)}function st(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?yl:gl;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function ut(e,t){var n=i("span",null,null,xa?"padding-right: .1px":null),r={pre:i("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:(ba||xa)&&e.getOption("lineWrapping")};t.measure={};for(var o=0;o<=(t.rest?t.rest.length:0);o++){var a=o?t.rest[o-1]:t.line,l=void 0;r.pos=0,r.addToken=ft,Fe(e.display.measure)&&(l=ke(a,e.doc.direction))&&(r.addToken=pt(r.addToken,l)),r.map=[];mt(a,r,Xe(e,a,t!=e.display.externalMeasured&&N(a))),a.styleClasses&&(a.styleClasses.bgClass&&(r.bgClass=u(a.styleClasses.bgClass,r.bgClass||"")),a.styleClasses.textClass&&(r.textClass=u(a.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(He(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(xa){var s=r.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return Te(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=u(r.pre.className,r.textClass||"")),r}function ct(e){var t=o("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function ft(e,t,n,r,i,a,l){if(t){var s,u=e.splitSpaces?dt(t,e.trailingSpace):t,c=e.cm.state.specialChars,f=!1;if(c.test(t)){s=document.createDocumentFragment();for(var d=0;;){c.lastIndex=d;var p=c.exec(t),h=p?p.index-d:t.length-d;if(h){var v=document.createTextNode(u.slice(d,d+h));ba&&wa<9?s.appendChild(o("span",[v])):s.appendChild(v),e.map.push(e.pos,e.pos+h,v),e.col+=h,e.pos+=h}if(!p)break;d+=h+1;var g=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;g=s.appendChild(o("span",m(b),"cm-tab")),g.setAttribute("role","presentation"),g.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?(g=s.appendChild(o("span","\r"==p[0]?"␍":"␤","cm-invalidchar")),g.setAttribute("cm-text",p[0]),e.col+=1):(g=e.cm.options.specialCharPlaceholder(p[0]),g.setAttribute("cm-text",p[0]),ba&&wa<9?s.appendChild(o("span",[g])):s.appendChild(g),e.col+=1);e.map.push(e.pos,e.pos+1,g),e.pos++}}else e.col+=t.length,s=document.createTextNode(u),e.map.push(e.pos,e.pos+t.length,s),ba&&wa<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==u.charCodeAt(t.length-1),n||r||i||f||l){var w=n||"";r&&(w+=r),i&&(w+=i);var x=o("span",[s],w,l);return a&&(x.title=a),e.content.appendChild(x)}e.content.appendChild(s)}}function dt(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",o=0;o<e.length;o++){var i=e.charAt(o);" "!=i||!n||o!=e.length-1&&32!=e.charCodeAt(o+1)||(i=" "),r+=i,n=" "==i}return r}function pt(e,t){return function(n,r,o,i,a,l,s){o=o?o+" cm-force-border":"cm-force-border";for(var u=n.pos,c=u+r.length;;){for(var f=void 0,d=0;d<t.length&&(f=t[d],!(f.to>u&&f.from<=u));d++);if(f.to>=c)return e(n,r,o,i,a,l,s);e(n,r.slice(0,f.to-u),o,i,null,l,s),i=null,r=r.slice(f.to-u),u=f.to}}}function ht(e,t,n,r){var o=!r&&n.widgetNode;o&&e.map.push(e.pos,e.pos+t,o),!r&&e.cm.display.input.needsContentAttribute&&(o||(o=e.content.appendChild(document.createElement("span"))),o.setAttribute("cm-marker",n.id)),o&&(e.cm.display.input.setUneditable(o),e.content.appendChild(o)),e.pos+=t,e.trailingSpace=!1}function mt(e,t,n){var r=e.markedSpans,o=e.text,i=0;if(r)for(var a,l,s,u,c,f,d,p=o.length,h=0,m=1,v="",g=0;;){if(g==h){s=u=c=f=l="",d=null,g=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==h&&C.widgetNode?y.push(C):x.from<=h&&(null==x.to||x.to>h||C.collapsed&&x.to==h&&x.from==h)?(null!=x.to&&x.to!=h&&g>x.to&&(g=x.to,u=""),C.className&&(s+=" "+C.className),C.css&&(l=(l?l+";":"")+C.css),C.startStyle&&x.from==h&&(c+=" "+C.startStyle),C.endStyle&&x.to==g&&(b||(b=[])).push(C.endStyle,x.to),C.title&&!f&&(f=C.title),C.collapsed&&(!d||le(d.marker,C)<0)&&(d=x)):x.from>h&&g>x.from&&(g=x.from)}if(b)for(var S=0;S<b.length;S+=2)b[S+1]==g&&(u+=" "+b[S]);if(!d||d.from==h)for(var k=0;k<y.length;++k)ht(t,0,y[k]);if(d&&(d.from||0)==h){if(ht(t,(null==d.to?p+1:d.to)-h,d.marker,null==d.from),null==d.to)return;d.to==h&&(d=!1)}}if(h>=p)break;for(var O=Math.min(p,g);;){if(v){var _=h+v.length;if(!d){var T=_>O?v.slice(0,O-h):v;t.addToken(t,T,a?a+s:s,c,h+T.length==g?u:"",f,l)}if(_>=O){v=v.slice(O-h),h=O;break}h=_,c=""}v=o.slice(i,i=n[m++]),a=st(n[m++],t.cm.options)}}else for(var P=1;P<n.length;P+=2)t.addToken(t,o.slice(i,i=n[P]),st(n[P+1],t.cm.options))}function vt(e,t,n){this.line=t,this.rest=he(t),this.size=this.rest?N(v(this.rest))-n+1:1,this.node=this.text=null,this.hidden=ge(e,t)}function gt(e,t,n){for(var r,o=[],i=t;i<n;i=r){var a=new vt(e.doc,P(e.doc,i),i);r=i+a.size,o.push(a)}return o}function yt(e){bl?bl.ops.push(e):e.ownsGroup=bl={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 o=e.ops[r];if(o.cursorActivityHandlers)for(;o.cursorActivityCalled<o.cursorActivityHandlers.length;)o.cursorActivityHandlers[o.cursorActivityCalled++].call(null,o.cm)}}while(n<t.length)}function wt(e,t){var n=e.ownsGroup;if(n)try{bt(n)}finally{bl=null,t(n)}}function xt(e,t){var n=Oe(e,t);if(n.length){var r,o=Array.prototype.slice.call(arguments,2);bl?r=bl.delayedCallbacks:wl?r=wl:(r=wl=[],setTimeout(Ct,0));for(var i=0;i<n.length;++i)!function(e){r.push(function(){return n[e].apply(null,o)})}(i)}}function Ct(){var e=wl;wl=null;for(var t=0;t<e.length;++t)e[t]()}function St(e,t,n,r){for(var o=0;o<t.changes.length;o++){var i=t.changes[o];"text"==i?Tt(e,t):"gutter"==i?Mt(e,t,n,r):"class"==i?Pt(e,t):"widget"==i&&Et(e,t,r)}t.changes=null}function kt(e){return e.node==e.text&&(e.node=o("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),ba&&wa<8&&(e.node.style.zIndex=2)),e.node}function Ot(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null);else if(n){var r=kt(t);t.background=r.insertBefore(o("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}function _t(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 Tt(e,t){var n=t.text.className,r=_t(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,Pt(e,t)):n&&(t.text.className=n)}function Pt(e,t){Ot(e,t),t.line.wrapClass?kt(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 Mt(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=kt(t);t.gutterBackground=o("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var a=t.line.gutterMarkers;if(e.options.lineNumbers||a){var l=kt(t),s=t.gutter=o("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(s),l.insertBefore(s,t.text),t.line.gutterClass&&(s.className+=" "+t.line.gutterClass),!e.options.lineNumbers||a&&a["CodeMirror-linenumbers"]||(t.lineNumber=s.appendChild(o("div",R(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),a)for(var u=0;u<e.options.gutters.length;++u){var c=e.options.gutters[u],f=a.hasOwnProperty(c)&&a[c];f&&s.appendChild(o("div",[f],"CodeMirror-gutter-elt","left: "+r.gutterLeft[c]+"px; width: "+r.gutterWidth[c]+"px"))}}}function Et(e,t,n){t.alignable&&(t.alignable=null);for(var r=t.node.firstChild,o=void 0;r;r=o)o=r.nextSibling,"CodeMirror-linewidget"==r.className&&t.node.removeChild(r);Nt(e,t,n)}function Lt(e,t,n,r){var o=_t(e,t);return t.text=t.node=o.pre,o.bgClass&&(t.bgClass=o.bgClass),o.textClass&&(t.textClass=o.textClass),Pt(e,t),Mt(e,t,n,r),Nt(e,t,r),t.node}function Nt(e,t,n){if(At(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)At(e,t.rest[r],t,n,!1)}function At(e,t,n,r,i){if(t.widgets)for(var a=kt(n),l=0,s=t.widgets;l<s.length;++l){var u=s[l],c=o("div",[u.node],"CodeMirror-linewidget");u.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),jt(u,c,n,r),e.display.input.setUneditable(c),i&&u.above?a.insertBefore(c,n.gutter||n.text):a.appendChild(c),xt(u,"redraw")}}function jt(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t);var o=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(o-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=o+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function Rt(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!a(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),n(t.display.measure,o("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function Dt(e,t){for(var n=De(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 It(e){return e.lineSpace.offsetTop}function Ht(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ft(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=n(e.measure,o("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,i={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(i.left)||isNaN(i.right)||(e.cachedPaddingH=i),i}function Ut(e){return Ba-e.display.nativeBarWidth}function Wt(e){return e.display.scroller.clientWidth-Ut(e)-e.display.barWidth}function zt(e){return e.display.scroller.clientHeight-Ut(e)-e.display.barHeight}function Bt(e,t,n){var r=e.options.lineWrapping,o=r&&Wt(e);if(!t.measure.heights||r&&t.measure.width!=o){var i=t.measure.heights=[];if(r){t.measure.width=o;for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],u=a[l+1];Math.abs(s.bottom-u.bottom)>2&&i.push((s.bottom+u.top)/2-n.top)}}i.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 o=0;o<e.rest.length;o++)if(N(e.rest[o])>n)return{map:e.measure.maps[o],cache:e.measure.caches[o],before:!0}}function qt(e,t){t=de(t);var r=N(t),o=e.display.externalMeasured=new vt(e.doc,t,r);o.lineN=r;var i=o.built=ut(e,o);return o.text=i.pre,n(e.display.lineMeasure,i.pre),o}function Kt(e,t,n,r){return Yt(e,$t(e,t),n,r)}function Gt(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[Tn(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=N(t),r=Gt(e,n);r&&!r.text?r=null:r&&r.changes&&(St(e,r,n,Cn(e)),e.curOp.forceUpdate=!0),r||(r=qt(e,t));var o=Vt(r,t,n);return{line:t,view:r,rect:null,map:o.map,cache:o.cache,before:o.before,hasHeights:!1}}function Yt(e,t,n,r,o){t.before&&(n=-1);var i,a=n+(r||"");return t.cache.hasOwnProperty(a)?i=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(Bt(e,t.view,t.rect),t.hasHeights=!0),i=Zt(e,t,n,r),i.bogus||(t.cache[a]=i)),{left:i.left,right:i.right,top:o?i.rtop:i.top,bottom:o?i.rbottom:i.bottom}}function Xt(e,t,n){for(var r,o,i,a,l,s,u=0;u<e.length;u+=3)if(l=e[u],s=e[u+1],t<l?(o=0,i=1,a="left"):t<s?(o=t-l,i=o+1):(u==e.length-3||t==s&&e[u+3]>t)&&(i=s-l,o=i-1,t>=s&&(a="right")),null!=o){if(r=e[u+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==o)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[2+(u-=3)],a="left";if("right"==n&&o==s-l)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)r=e[(u+=3)+2],a="right";break}return{node:r,start:o,end:i,collapse:a,coverStart:l,coverEnd:s}}function Qt(e,t){var n=xl;if("left"==t)for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var o=e.length-1;o>=0&&(n=e[o]).left==n.right;o--);return n}function Zt(e,t,n,r){var o,i=Xt(t.map,n,r),a=i.node,l=i.start,s=i.end,u=i.collapse;if(3==a.nodeType){for(var c=0;c<4;c++){for(;l&&k(t.line.text.charAt(i.coverStart+l));)--l;for(;i.coverStart+s<i.coverEnd&&k(t.line.text.charAt(i.coverStart+s));)++s;if(o=ba&&wa<9&&0==l&&s==i.coverEnd-i.coverStart?a.parentNode.getBoundingClientRect():Qt(Ra(a,l,s).getClientRects(),r),o.left||o.right||0==l)break;s=l,l-=1,u="right"}ba&&wa<11&&(o=Jt(e.display.measure,o))}else{l>0&&(u=r="right");var f;o=e.options.lineWrapping&&(f=a.getClientRects()).length>1?f["right"==r?f.length-1:0]:a.getBoundingClientRect()}if(ba&&wa<9&&!l&&(!o||!o.left&&!o.right)){var d=a.parentNode.getClientRects()[0];o=d?{left:d.left,right:d.left+xn(e.display),top:d.top,bottom:d.bottom}:xl}for(var p=o.top-t.rect.top,h=o.bottom-t.rect.top,m=(p+h)/2,v=t.view.measure.heights,g=0;g<v.length-1&&!(m<v[g]);g++);var y=g?v[g-1]:0,b=v[g],w={left:("right"==u?o.right:o.left)-t.rect.left,right:("left"==u?o.left:o.right)-t.rect.left,top:y,bottom:b};return o.left||o.right||(w.bogus=!0),e.options.singleCursorHeightPerLine||(w.rtop=p,w.rbottom=h),w}function Jt(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!Ue(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 Sa&&Ma?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function on(){return Sa&&Ma?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function an(e){var t=0;if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=Rt(e.widgets[n]));return t}function ln(e,t,n,r,o){if(!o){var i=an(t);n.top+=i,n.bottom+=i}if("line"==r)return n;r||(r="local");var a=be(t);if("local"==r?a+=It(e.display):a-=e.display.viewOffset,"page"==r||"window"==r){var l=e.display.lineSpace.getBoundingClientRect();a+=l.top+("window"==r?0:on());var s=l.left+("window"==r?0:rn());n.left+=s,n.right+=s}return n.top+=a,n.bottom+=a,n}function sn(e,t,n){if("div"==n)return t;var r=t.left,o=t.top;if("page"==n)r-=rn(),o-=on();else if("local"==n||!n){var i=e.display.sizer.getBoundingClientRect();r+=i.left,o+=i.top}var a=e.display.lineSpace.getBoundingClientRect();return{left:r-a.left,top:o-a.top}}function un(e,t,n,r,o){return r||(r=P(e.doc,t.line)),ln(e,r,Kt(e,r,t.ch,o),n)}function cn(e,t,n,r,o,i){function a(t,a){var l=Yt(e,o,t,a?"right":"left",i);return a?l.left=l.right:l.right=l.left,ln(e,r,l,n)}function l(e,t,n){var r=s[t],o=1==r.level;return a(n?e-1:e,o!=n)}r=r||P(e.doc,t.line),o||(o=$t(e,r));var s=ke(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"),!s)return a("before"==c?u-1:u,"before"==c);var f=Se(s,u,c),d=Ja,p=l(u,f,"before"==c);return null!=d&&(p.other=l(u,d,"before"!=c)),p}function fn(e,t){var n=0;t=B(e.doc,t),e.options.lineWrapping||(n=xn(e.display)*t.ch);var r=P(e.doc,t.line),o=be(r)+It(e.display);return{left:n,right:n,top:o,bottom:o+r.height}}function dn(e,t,n,r,o){var i=D(e,t,n);return i.xRel=o,r&&(i.outside=!0),i}function pn(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return dn(r.first,0,null,!0,-1);var o=A(r,n),i=r.first+r.size-1;if(o>i)return dn(r.first+r.size-1,P(r,i).text.length,null,!0,1);t<0&&(t=0);for(var a=P(r,o);;){var l=gn(e,a,o,t,n),s=ce(a),u=s&&s.find(0,!0);if(!s||!(l.ch>u.from.ch||l.ch==u.from.ch&&l.xRel>0))return l;o=N(a=u.to.line)}}function hn(e,t,n,r){r-=an(t);var o=t.text.length,i=_(function(t){return Yt(e,n,t-1).bottom<=r},o,0);return o=_(function(t){return Yt(e,n,t).top>r},i,o),{begin:i,end:o}}function mn(e,t,n,r){return n||(n=$t(e,t)),hn(e,t,n,ln(e,t,Yt(e,n,r),"line").top)}function vn(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function gn(e,t,n,r,o){o-=be(t);var i=$t(e,t),a=an(t),l=0,s=t.text.length,u=!0,c=ke(t,e.doc.direction);if(c){var f=(e.options.lineWrapping?bn:yn)(e,t,n,i,c,r,o);u=1!=f.level,l=u?f.from:f.to-1,s=u?f.to:f.from-1}var d,p,h=null,m=null,v=_(function(t){var n=Yt(e,i,t);return n.top+=a,n.bottom+=a,!!vn(n,r,o,!1)&&(n.top<=o&&n.left<=r&&(h=t,m=n),!0)},l,s),g=!1;if(m){var y=r-m.left<m.right-r,b=y==u;v=h+(b?0:1),p=b?"after":"before",d=y?m.left:m.right}else{u||v!=s&&v!=l||v++,p=0==v?"after":v==t.text.length?"before":Yt(e,i,v-(u?1:0)).bottom+a<=o==u?"after":"before";var w=cn(e,D(n,v,p),"line",t,i);d=w.left,g=o<w.top||o>=w.bottom}return v=O(t.text,v,1),dn(n,v,p,g,r-d)}function yn(e,t,n,r,o,i,a){var l=_(function(l){var s=o[l],u=1!=s.level;return vn(cn(e,D(n,u?s.to:s.from,u?"before":"after"),"line",t,r),i,a,!0)},0,o.length-1),s=o[l];if(l>0){var u=1!=s.level,c=cn(e,D(n,u?s.from:s.to,u?"after":"before"),"line",t,r);vn(c,i,a,!0)&&c.top>a&&(s=o[l-1])}return s}function bn(e,t,n,r,o,i,a){var l=hn(e,t,r,a),s=l.begin,u=l.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,f=null,d=0;d<o.length;d++){var p=o[d];if(!(p.from>=u||p.to<=s)){var h=1!=p.level,m=Yt(e,r,h?Math.min(u,p.to)-1:Math.max(s,p.from)).right,v=m<i?i-m+1e9:m-i;(!c||f>v)&&(c=p,f=v)}}return c||(c=o[o.length-1]),c.from<s&&(c={from:s,to:c.to,level:c.level}),c.to>u&&(c={from:c.from,to:u,level:c.level}),c}function wn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==vl){vl=o("pre");for(var r=0;r<49;++r)vl.appendChild(document.createTextNode("x")),vl.appendChild(o("br"));vl.appendChild(document.createTextNode("x"))}n(e.measure,vl);var i=vl.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),t(e.measure),i||1}function xn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=o("span","xxxxxxxxxx"),r=o("pre",[t]);n(e.measure,r);var i=t.getBoundingClientRect(),a=(i.right-i.left)/10;return a>2&&(e.cachedCharWidth=a),a||10}function Cn(e){for(var t=e.display,n={},r={},o=t.gutters.clientLeft,i=t.gutters.firstChild,a=0;i;i=i.nextSibling,++a)n[e.options.gutters[a]]=i.offsetLeft+i.clientLeft+o,r[e.options.gutters[a]]=i.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 kn(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(o){if(ge(e.doc,o))return 0;var i=0;if(o.widgets)for(var a=0;a<o.widgets.length;a++)o.widgets[a].height&&(i+=o.widgets[a].height);return n?i+(Math.ceil(o.text.length/r)||1)*t:i+t}}function On(e){var t=e.doc,n=kn(e);t.iter(function(e){var t=n(e);t!=e.height&&L(e,t)})}function _n(e,t,n,r){var o=e.display;if(!n&&"true"==De(t).getAttribute("cm-not-content"))return null;var i,a,l=o.lineSpace.getBoundingClientRect();try{i=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,u=pn(e,i,a);if(r&&1==u.xRel&&(s=P(e.doc,u.line).text).length==u.ch){var c=d(s,s.length,e.options.tabSize)-s.length;u=D(u.line,Math.max(0,Math.round((i-Ft(e.display).left)/xn(e.display))-c))}return u}function Tn(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;r<n.length;r++)if((t-=n[r].size)<0)return r}function Pn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function Mn(e,t){void 0===t&&(t=!0);for(var n=e.doc,r={},o=r.cursors=document.createDocumentFragment(),i=r.selection=document.createDocumentFragment(),a=0;a<n.sel.ranges.length;a++)if(t||a!=n.sel.primIndex){var l=n.sel.ranges[a];if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var s=l.empty();(s||e.options.showCursorWhenSelecting)&&En(e,l.head,o),s||Nn(e,l,i)}}return r}function En(e,t,n){var r=cn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(o("div"," ","CodeMirror-cursor"));if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var a=n.appendChild(o("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));a.style.display="",a.style.left=r.other.left+"px",a.style.top=r.other.top+"px",a.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function Ln(e,t){return e.top-t.top||e.left-t.left}function Nn(e,t,n){function r(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),s.appendChild(o("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?f-e:n)+"px;\n height: "+(r-t)+"px"))}function i(t,n,o){function i(n,r){return un(e,D(t,n),"div",p,r)}function a(t,n,r){var o=mn(e,p,null,t),a="ltr"==n==("after"==r)?"left":"right";return i("after"==r?o.begin:o.end-(/\s/.test(p.text.charAt(o.end-1))?2:1),a)[a]}var s,u,p=P(l,t),h=p.text.length,m=ke(p,l.direction);return Ce(m,n||0,null==o?h:o,function(e,t,l,p){var v="ltr"==l,g=i(e,v?"left":"right"),y=i(t-1,v?"right":"left"),b=null==n&&0==e,w=null==o&&t==h,x=0==p,C=!m||p==m.length-1;if(y.top-g.top<=3){var S=(d?b:w)&&x,k=(d?w:b)&&C,O=S?c:(v?g:y).left,_=k?f:(v?y:g).right;r(O,g.top,_-O,g.bottom)}else{var T,P,M,E;v?(T=d&&b&&x?c:g.left,P=d?f:a(e,l,"before"),M=d?c:a(t,l,"after"),E=d&&w&&C?f:y.right):(T=d?a(e,l,"before"):c,P=!d&&b